Deconv¶
-
class
Deconv[source]¶ Bases:
objectbased on ‘CodedMaskImage’ python program of Cyril Lachaud and IDL program of Aleksandra Gros 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 shadowgramsconstructor
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 self.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(efficiency_filename, …[, …])preparation of the deconvolution get_shadowgrams()Return shadowgrams attribute get_shadowgrams_bgcorrected()Return shadowgrams_bgcorrected attribute get_shadowgrams_var()Return shadowgrams_var attribute 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_shadowgrams(shds)Set shadowgrams attribute to new value set_shadowgrams_bgcorrected(shdsbgc)Set shadowgrams_var attribute to new value set_shadowgrams_var(shdsv)Set shadowgrams_var attribute to new value set_weight(efficiency_filename, nonunif_filename)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
where 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, debug=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
Only needed 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.
- debug (bool) – whether or not to display debug quantities
-
decon_prep(efficiency_filename, nonuniformity_filename, showarrays=False, debug=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: - efficiency_filename (string) – PATH/filename of the detector efficiency array
- nonunif_filename (string) – PATH/filename of the detector non-uniformity array
- showarrays (bool) – whether or not to show a plot
- debug (bool) – whether or not to display debug quantities
-
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(efficiency_filename, nonunif_filename)[source]¶ Read the _weight array “W” from the fits file
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 computed with the new W.
Parameters: - efficiency_filename (string) – PATH/filename of the detector efficiency array
- nonunif_filename (string) – PATH/filename of the detector non-uniformity array
-