ui.filter_with_mrfilter

Denoise FITS images with Wavelet Transform.

This script use mr_filter – a program written CEA/CosmoStat (www.cosmostat.org) – to make Wavelet Transform.

Usage

filter_with_mrfilter.py [-h] [--type-of-filtering INTEGER]
                             [--coef-detection-method INTEGER]
                             [--type-of-multiresolution-transform INTEGER]
                             [--type-of-filters INTEGER]
                             [--type-of-non-orthog-filters INTEGER]
                             [--noise-model INTEGER]
                             [--number-of-scales integer]
                             [--k-sigma-noise-threshold FLOAT]
                             [--number-of-iterations integer] [--epsilon FLOAT]
                             [--support-file-name FILE]
                             [--suppress-isolated-pixels]
                             [--kill-isolated-pixels] [--suppress-last-scale]
                             [--detect-only-positive-structure]
                             [--precision FLOAT]
                             [--first-detection-scale INTEGER]
                             [--suppress-positivity-constraint]
                             [--maximum-level-constraint]
                             [--mask-file-path MASK_FILE_NAME]
                             [--offset-after-calibration FLOAT]
                             [--correction-offset]
                             [--input-image-scale INPUT_IMAGE_SCALE]
                             [--noise-cdf-file FILE] [--tmp-dir DIRECTORY]
                             [--verbose] [--debug] [--max-images INTEGER]
                             [--telid INTEGER] [--eventid INTEGER]
                             [--camid STRING] [--benchmark STRING]
                             [--label STRING] [--plot] [--saveplot FILE]
                             [--output FILE]
                             FILE [FILE ...]

Denoise images with Wavelet Transform.

positional arguments:
  FILE                  The files image to process. If fileargs is a
                        directory, all files it contains are processed.

optional arguments:
  -h, --help            show this help message and exit
  --type-of-filtering INTEGER, -f INTEGER
                        Type of filtering: 1: Multiresolution Hard K-Sigma
                        Thresholding 2: Multiresolution Soft K-Sigma
                        Thresholding 3: Iterative Multiresolution Thresholding
                        4: Adjoint operator applied to the multiresolution
                        support 5: Bivariate Shrinkage 6: Multiresolution
                        Wiener Filtering 7: Total Variation + Wavelet
                        Constraint 8: Wavelet Constraint Iterative Methods 9:
                        Median Absolute Deviation (MAD) Hard Thesholding 10:
                        Median Absolute Deviation (MAD) Soft Thesholding.
                        Default=1.
  --coef-detection-method INTEGER, -C INTEGER
                        Coef_Detection_Method: 1: K-SigmaNoise Threshold 2:
                        False Discovery Rate (FDR) Theshold 3: Universal
                        Threshold 4: SURE Threshold 5: Multiscale SURE
                        Threshold. Default=1.
  --type-of-multiresolution-transform INTEGER, -t INTEGER
                        Type of multiresolution transform: 1: linear wavelet
                        transform: a trous algorithm 2: bspline wavelet
                        transform: a trous algorithm 3: wavelet transform in
                        Fourier space 4: morphological median transform 5:
                        morphological minmax transform 6: pyramidal linear
                        wavelet transform 7: pyramidal bspline wavelet
                        transform 8: pyramidal wavelet transform in Fourier
                        space: algo 1 (diff. between two resolutions) 9:
                        Meyer's wavelets (compact support in Fourier space)
                        10: pyramidal median transform (PMT) 11: pyramidal
                        laplacian 12: morphological pyramidal minmax transform
                        13: decomposition on scaling function 14: Mallat's
                        wavelet transform (7/9 filters) 15: Feauveau's wavelet
                        transform 16: Feauveau's wavelet transform without
                        undersampling 17: Line Column Wavelet Transform
                        (1D+1D) 18: Haar's wavelet transform 19: half-
                        pyramidal transform 20: mixed Half-pyramidal WT and
                        Median method (WT-HPMT) 21: undecimated diadic wavelet
                        transform (two bands per scale) 22: mixed WT and PMT
                        method (WT-PMT) 23: undecimated Haar transform: a
                        trous algorithm (one band per scale) 24: undecimated
                        (bi-) orthogonal transform (three bands per scale) 25:
                        non orthogonal undecimated transform (three bands per
                        scale) 26: Isotropic and compact support wavelet in
                        Fourier space 27: pyramidal wavelet transform in
                        Fourier space: algo 2 (diff. between the square of two
                        resolutions) 28: Fast Curvelet Transform. Default=2.
  --type-of-filters INTEGER, -T INTEGER
                        Type of filters: 1: Biorthogonal 7/9 filters 2:
                        Daubechies filter 4 3: Biorthogonal 2/6 Haar filters
                        4: Biorthogonal 2/10 Haar filters 5: Odegard 9/7
                        filters 6: 5/3 filter 7: Battle-Lemarie filters (2
                        vanishing moments) 8: Battle-Lemarie filters (4
                        vanishing moments) 9: Battle-Lemarie filters (6
                        vanishing moments) 10: User's filters 11: Haar filter
                        12: 3/5 filter 13: 4/4 Linar spline filters 14:
                        Undefined sub-band filters. Default=1.
  --type-of-non-orthog-filters INTEGER, -U INTEGER
                        Type of non-orthogonal filters: 1: SplineB3-Id+H:
                        H=[1,4,6,4,1]/16, Ht=H, G=Id-H, Gt=Id+H 2:
                        SplineB3-Id: H=[1,4,6,4,1]/16, Ht=H, G=Id-H*H, Gt=Id
                        3: SplineB2-Id: H=4[1,2,1]/4, Ht=H, G=Id-H*H, Gt=Id 4:
                        Harr/Spline POS:
                        H=Haar,G=[-1/4,1/2,-1/4],Ht=[1,3,3,1]/8,Gt=[1,6,1]/4.
                        Default=2.
  --noise-model INTEGER, -m INTEGER
                        Noise model: 1: Gaussian noise 2: Poisson noise 3:
                        Poisson noise + Gaussian noise 4: Multiplicative noise
                        5: Non-stationary additive noise 6: Non-stationary
                        multiplicative noise 7: Undefined stationary noise 8:
                        Undefined noise 9: Stationary correlated noise 10:
                        Poisson noise with few events. Default=1.
  --number-of-scales integer, -n integer
                        Number of scales used in the multiresolution
                        transform. Default=4.
  --k-sigma-noise-threshold FLOAT, -s FLOAT
                        Thresholding at nsigma * SigmaNoise. Default=3.
  --number-of-iterations integer, -i integer
                        Maximum number of iterations. Default=10.
  --epsilon FLOAT, -e FLOAT
                        Convergence parameter. Default=0.001000 or 0.000010 in
                        case of poisson noise with few events.
  --support-file-name FILE, -w FILE
                        Creates an image from the multiresolution support and
                        save to disk.
  --suppress-isolated-pixels, -k
                        Suppress isolated pixels in the support
  --kill-isolated-pixels
                        Suppress isolated pixels in the support (scipy
                        implementation)
  --suppress-last-scale, -K
                        Suppress the last scale (to have background pixels =
                        0)
  --detect-only-positive-structure, -p
                        Detect only positive structure
  --precision FLOAT, -E FLOAT
                        Epsilon = precision for computing thresholds (only
                        used in case of poisson noise with few events).
                        Default=1.00e-03.
  --first-detection-scale INTEGER, -F INTEGER
                        First scale used for the detection. Default=1.
  --suppress-positivity-constraint, -P
                        Suppress positivity constraint
  --maximum-level-constraint
                        Add the maximum level constraint. Max value is 255.
  --mask-file-path MASK_FILE_NAME
                        Filename of the mask containing the bad data
                        (Mask[i,j]=1 for good pixels and 0 otherwise. Default
                        is none.
  --offset-after-calibration FLOAT
                        Value added to all pixels of the input image after
                        calibration. Default=0.
  --correction-offset   Apply a correction offset to the output image.
  --input-image-scale INPUT_IMAGE_SCALE
                        Use a different scale for the input image ('linear',
                        'log' or 'sqrt'). Default='linear'.
  --noise-cdf-file FILE
                        The JSON file containing the Cumulated Distribution
                        Function of the noise model used to inject artificial
                        noise in blank pixels (those with a NaN value).
                        Default=None.
  --tmp-dir DIRECTORY   The directory where temporary files are written.
  --verbose, -v         Verbose mode
  --debug               Debug mode
  --max-images INTEGER  The maximum number of images to process
  --telid INTEGER       Only process images from the specified telescope
  --eventid INTEGER     Only process images from the specified event
  --camid STRING        Only process images from the specified camera
  --benchmark STRING, -b STRING
                        The benchmark method to use to assess the algorithm
                        for thegiven images
  --label STRING, -l STRING
                        The label attached to the produced results
  --plot                Plot images
  --saveplot FILE       The output file where to save plotted images
  --output FILE, -o FILE
                        The output file path (JSON)

Examples

./filter_with_mrfilter.py -h ./filter_with_mrfilter.py ./test.fits ipython3 – ./filter_with_mrfilter.py -n4 ./test.fits

Notes

This script requires the mr_filter program (http://www.cosmostat.org/software/isap/).

pywi.ui.filter_with_mrfilter.add_arguments(parser)[source]

Populate the given argparse.ArgumentParser with arguments.

This function can be used to make the definition these argparse arguments reusable in other modules and avoid the duplication of these definitions among the executable scripts.

Parameters:parser (argparse.ArgumentParser) – The parser to populate.
Returns:Return the populated ArgumentParser object.
Return type:argparse.ArgumentParser