AstroPy - process.py


Description

Performs all steps of image processing sequentially, on-the-fly, without the need for intermediate images. Specifically:

  1. Rough alignment using 'roughalign.py',
  2. Flattening using 'flatten.py',
  3. Filling using 'fill.py',
  4. Bright alignment using 'brightalign.py',
  5. Shifting to center using 'shift.py',
  6. Bracket-gamma subtraction using 'subbrgm.py'.

In single file mode, each intermediate image is displayed, and numerical output is printed to the terminal. In multiple file mode, no graphics or output are produced, and the final processed image is saved to a 'processed' directory. Currently, only the default parameters for each program are applied. Shortly, a text file of custom parameters can be specified on the command line for non-default processing.

Usage

process.py fits-file, or
process.py folder [min-fits-file max-fits-file]

From the path of the input file or folder, a parallel 'intermediates' directory containing mask, intercept, slope, and brgm images is implicitly extracted. In addition, a parallel 'processed' directory (which must already exist) is used to save results in multiple file mode.

Examples

Single file mode:

> process.py 072407/raw/im0215.a.fits
*** roughalign.py ***
Circle: cx=296.959917      cy=253.505009      rad=210.532756      err=1.921364        npts=38   
*** flatten.py ***
reading 072407/intermediates/mask.fits
reading 072407/intermediates/intercept.fits
reading 072407/intermediates/slope.fits
*** fill.py ***
*** brightalign.py ***
New: cx=306.171271      cy=251.775071      rad=202.839058      err=1.988070        npts=68   
*** shift.py ***
*** subbrgm.py ***
 data: min=       0.000000, max=    6874.474259, mean=     977.839864, std=    1197.944650
 brgm: min=       0.000000, max=   10842.000626, mean=     968.938120, std=    1412.002171
  sub: min=  -22412.225364, max=    1586.894004, mean=   -1226.501441, std=    2739.316751
 data:  bg=     197.743181,  fg=    1691.403306
  sub:  bg=    -720.169012,  fg=     180.556126
rescaling...
  sub: min=       0.000000, max=    4023.514092, mean=     607.576491, std=     617.452302
  sub:  bg=     197.743181,  fg=    1691.403306

The input image and rough limb alignment, and the flattened image:

The filled image and bright alignment, and the shifted image:

The br-gm subtracted image:

In multiple file mode, the subtracted images are implicitly written to a directory named 'processed', which must already exist:

> process.py 072407/raw im0171.a.fits im0276.a.fits
072407/processed/im0188.a.fits      478.628107      95.765388       26.020181       1.148663        57   
072407/processed/im0189.a.fits      477.690833      100.264397      26.824199       1.487302        59   
072407/processed/im0190.a.fits      481.762946      100.569416      22.537614       1.291621        60   
072407/processed/im0191.a.fits      440.719231      140.316066      75.148276       1.735602        40   
072407/processed/im0192.a.fits      452.384966      123.949230      54.282870       1.988745        50   
072407/processed/im0193.a.fits      368.756860      249.386696      202.630737      1.640249        29   
072407/processed/im0194.a.fits      354.415425      251.494437      207.720639      2.376111        33   
072407/processed/im0195.a.fits      417.256200      167.536824      103.736876      2.089751        33   
072407/processed/im0196.a.fits      361.137029      251.542244      202.664859      1.245135        35   
072407/processed/im0197.a.fits      361.367475      251.679735      202.188217      1.390570        36   
...
072407/processed/im0267.a.fits      145.755833      267.135837      202.841389      1.458485        69   
072407/processed/im0268.a.fits      143.430528      266.243961      203.698534      1.224450        69   
072407/processed/im0269.a.fits      140.960888      267.212026      203.108301      1.423598        69   
072407/processed/im0270.a.fits      135.524195      268.335167      204.195779      1.570873        69   
072407/processed/im0271.a.fits      132.350052      267.615003      203.324974      1.366084        69   
072407/processed/im0272.a.fits      132.884927      268.933227      203.528741      1.254714        69   
072407/processed/im0273.a.fits      127.087629      270.308486      203.913158      1.246985        69   
072407/processed/im0274.a.fits      126.178032      269.661451      203.763520      1.228737        69   
072407/processed/im0275.a.fits      123.693678      270.121665      203.562213      1.329151        67   
072407/processed/im0276.a.fits      120.661988      270.290501      204.791719      1.340484        69   

The final bright aligned circle coordinates are also printed for each image.


©Sky Coyote 2007