DeconvV1

class DeconvV1[source]

Bases: object

Same class as DeconvV0 but with a more modular approach

-> possibility to init the deconv (process G arrays) once for different _weight arrays or shadowgrams

-> possibility to prepare the deconv (process A and B arrays) for different shadowgrams

constructor

init with everything at 0

self.epsilon=1E-9 : we remove anything below that threshold in the A array…

self.alpha=0.4 : use in the calculation of G

slef.conjug_type=1: conjugation type. cf Aleksandra Gros doc

shadowgrams, shadowgrams_bgcorrected, shadowgrams_var has to be set manually

Note

is self.shadowgrams used in the class ?

Methods Summary

build_array_with_padding(myarray) Builds an array containing the myarray in the center and a padding with zeroes outside
decon([showarrays, savearrays]) Actual deconvolution and construction of the sky image
decon_init([mask_filename, …]) initialization of the deconvolution
decon_prep([weight_filename, showarrays]) preparation of the deconvolution
remove_padding_from_sky(myarray) Returns an array containing the data array in the center and no Padding border
set_mask([mask_filename, …]) read mask array from file
set_weight([filename, showarrays]) Read the _weight array “W” from the fits file

Methods Documentation

build_array_with_padding(myarray)[source]

Builds an array containing the myarray in the center and a padding with zeroes outside

myarray should be smaller that the sky array. the build padded array has the dimension of the padded sky array (power of 2 above unpadded sky array size).

Parameters:myarray (2D array) – array to add the padding to
Returns:array with padding
Return type:2D array
decon(showarrays=False, savearrays=None)[source]

Actual deconvolution and construction of the sky image

  • Builds the sky array with the correct shape = Rebinned (120) + 2* shadowgrams (80) = 280x280
  • Builds the shadowgrams arrays used for deconvolution (Decon suffix) by padding them correctly
  • Do the deconvolution to build the sky arrays

Note

Need the deconvolution to be initialized and prepared

Parameters:
  • showarrays (bool) – plot sky_count, sky_variance and sky_snr. Default=False.
  • savearrays (string) – PATH of the directory to save the plots. Default=None
decon_init(mask_filename=None, mask_rebinned_filename=None, showarrays=False)[source]

initialization of the deconvolution

initialization of the deconvolution (FIRST STEP)
  • Memorize the sky image array size according the size of the shadowgrams and mask arrays
  • Prepare the mask array for deconvolution
  • Build the deconvolution arrays G

Note

Nedded only at the beginning of the imaging process

Parameters:
  • mask_filename (string) – PATH/name of the mask file. Default=None.
  • mask_rebinned_filename (string) – PATH/name of the rebinned mask Default=None.
  • showarrays (bool) – plot mask and rebinned mask. Default=False.
decon_prep(weight_filename=None, showarrays=False)[source]

preparation of the deconvolution

preparation of the deconvolution (SECOND STEP)
  • Prepare the _weight array and the auxiliary arrays A and B for deconvolution

(_weight to be applied to pixels to remove noisy pixels or mask sources in the fov)

Note

It should be executed each time the efficiency changes

Note

Need the deconvolution to be initialized

Parameters:
  • weight_filename (string) – PATH/name of the fits file containing the weight matrix
  • showarrays (bool) – plot the W array, the A array and the B array. Default=False.
remove_padding_from_sky(myarray)[source]

Returns an array containing the data array in the center and no Padding border

the array with padding is the dimension of the sky array size (the power of 2 above the unpadded sky array size).

the array without padding is the dimension of the unpadded sky array size.

Parameters:myarray (2D array) – padded array
Returns:array with no padding
Return type:2D array
set_mask(mask_filename=None, mask_rebinned_filename=None, showarrays=False)[source]

read mask array from file

default is common/data/maskECLAIRs.fits and maskECLAIRs_rebinned.fits

G arrays are set to 0, because they have to be computed with the new mask.

Parameters:
  • mask_filename (string) – PATH/name of the mask file. Default=None.
  • mask_rebinned_filename (string) – PATH/name of the rebinned mask Default=None.
  • showarrays (bool) – plot mask and rebinned mask. Default=False.
set_weight(filename=None, showarrays=False)[source]

Read the _weight array “W” from the fits file

If none fits file : array of 1

Builds the Weigth arrays used for deconvolution (Decon suffix) by padding them correctly.

A and B matrix are set to 0 because they have to be compute with the new W.

Parameters:
  • filename (string) – PATH/name of the fits file containing the weight matrix
  • showarrays (bool) – plot the W array. Default=False.