AstroPy - stack.py


Description

Computes the average or median of a set of processed and aligned images, or of raw sky images for making flats.

Usage

stack.py command-file

The command file is a text file of the paths of images to stack, the output file to write, and flags controlling mode, printout, and graphics (see examples below). The output is another FITS file. This program will be used by others to create intercept and slope frames for flat-fielding, for creating br-gm frames from aligned images, and for creating composite processed images.

Examples

The file 'brgm1.stack.txt' contains the following:

# sample stack.py command file
# comment out or remove any undesired flags

# set files to stack (one per line)
files = '''072407/processed/im0101.a.fits
072407/processed/im0102.a.fits
072407/processed/im0103.a.fits
072407/processed/im0104.a.fits
072407/processed/im0105.a.fits
072407/processed/im0106.a.fits
072407/processed/im0107.a.fits
072407/processed/im0108.a.fits
072407/processed/im0109.a.fits
072407/processed/im0110.a.fits
072407/processed/im0111.a.fits
072407/processed/im0112.a.fits
072407/processed/im0113.a.fits
072407/processed/im0114.a.fits
072407/processed/im0115.a.fits
072407/processed/im0116.a.fits
072407/processed/im0117.a.fits
072407/processed/im0118.a.fits
072407/processed/im0119.a.fits
072407/processed/im0120.a.fits'''

# set stacking mode, printout, graphics flags
mode = 0           # 0 = average, 1 = median
printout = True
graphics = True

# set output file to write
output = '072407/intermediates/brgm1.fits'

Calling 'stack.py' on this command file creates the file 'brgm1.fits':

> stack.py 072407/intermediates/brgm1.stack.txt
reading 072407/processed/im0101.a.fits
reading 072407/processed/im0102.a.fits
reading 072407/processed/im0103.a.fits
reading 072407/processed/im0104.a.fits
reading 072407/processed/im0105.a.fits
reading 072407/processed/im0106.a.fits
reading 072407/processed/im0107.a.fits
reading 072407/processed/im0108.a.fits
reading 072407/processed/im0109.a.fits
reading 072407/processed/im0110.a.fits
reading 072407/processed/im0111.a.fits
reading 072407/processed/im0112.a.fits
reading 072407/processed/im0113.a.fits
reading 072407/processed/im0114.a.fits
reading 072407/processed/im0115.a.fits
reading 072407/processed/im0116.a.fits
reading 072407/processed/im0117.a.fits
reading 072407/processed/im0118.a.fits
reading 072407/processed/im0119.a.fits
reading 072407/processed/im0120.a.fits
stack is  (20, 512, 512)
av is (512, 512), mean = 968.938119635, std = 1412.00217144
writing 072407/intermediates/brgm1.fits

If you set the graphics flag to 'False', or comment it out or remove it from the file (as the default is False), the graphics module will not be imported and no image will be displayed.

The file 'brgm2.stack.txt' contains the following:

# sample stack.py command file
# comment out or remove any undesired flags

# set files to stack (one per line)
files = '''072407/processed/im0277.a.fits
072407/processed/im0279.a.fits
072407/processed/im0280.a.fits
072407/processed/im0281.a.fits
072407/processed/im0282.a.fits
072407/processed/im0283.a.fits
072407/processed/im0284.a.fits
072407/processed/im0285.a.fits
072407/processed/im0286.a.fits
072407/processed/im0287.a.fits
072407/processed/im0288.a.fits
072407/processed/im0289.a.fits
072407/processed/im0290.a.fits
072407/processed/im0291.a.fits
072407/processed/im0292.a.fits
072407/processed/im0293.a.fits
072407/processed/im0294.a.fits
072407/processed/im0295.a.fits
072407/processed/im0296.a.fits'''

# set stacking mode, printout, graphics flags
mode = 0           # 0 = average, 1 = median
printout = True
graphics = True

# set output file to write
output = '072407/intermediates/brgm2.fits'

Image 278 was not included, as it is a multiple image taken while the planet is moving in the frame. Calling 'stack.py' creates the file 'brgm2.fits':

> stack.py 072407/intermediates/brgm2.stack.txt
reading 072407/processed/im0277.a.fits
reading 072407/processed/im0279.a.fits
reading 072407/processed/im0280.a.fits
reading 072407/processed/im0281.a.fits
reading 072407/processed/im0282.a.fits
reading 072407/processed/im0283.a.fits
reading 072407/processed/im0284.a.fits
reading 072407/processed/im0285.a.fits
reading 072407/processed/im0286.a.fits
reading 072407/processed/im0287.a.fits
reading 072407/processed/im0288.a.fits
reading 072407/processed/im0289.a.fits
reading 072407/processed/im0290.a.fits
reading 072407/processed/im0291.a.fits
reading 072407/processed/im0292.a.fits
reading 072407/processed/im0293.a.fits
reading 072407/processed/im0294.a.fits
reading 072407/processed/im0295.a.fits
reading 072407/processed/im0296.a.fits
stack is  (19, 512, 512)
av is (512, 512), mean = 954.750451992, std = 1127.93224344
writing 072407/intermediates/brgm2.fits


©Sky Coyote 2007