bozepy package¶
Submodules¶
bozepy.ccdproc module¶
CCDPROC.PY - Generic CCD image calibration/reduction
- bozepy.ccdproc.autored(datadir='.')[source]¶
Automatically pick up FITS files from a directory and reduce.
- bozepy.ccdproc.ccdproc(data, head=None, bpm=None, zero=None, dark=None, flat=None, outfile=None, outsuffix='_red', verbose=False, clobber=True, compress=False, fix=False)[source]¶
Overscan subtract, trim, subtract master zero, subtract master dark, flat field.
- Parameters
- datalist or numpy 2D array
- This can either be (1) a list of image filenames, (2) a file with a list of
names image filenames, or (3) a 2D image (head must also be input).
- headheader dictionary, optional
The header if a single image is input (data).
- bpmfilename, numpy 2D array, or boolean, optional
- The bad pixel mask. Either the 2D image, the filename, or
a boolean. If bpm=True, then a library BPM will be used.
- zerofilename, numpy 2D array, or boolean, optional
- The master bias. Either the 2D image, the filename, or
a boolean. If zero=True, then a library zero will be used.
- darkfilename, numpy 2D array, or boolean, optional
- The master dark. Either the 2D image, the filename, or
a boolean. If dark=True, then a library dark will be used.
- flatfilename, numpy 2D array, or boolean, optional
- The master flat. Either the 2D image, the filename, or
a boolean. If flat=True, then a library flat will be used.
- fixboolean, optional
Interpolate over bad pixels. Default is False.
- outfilestring or boolean, optional
- Filename to write the processed image to. If outfile=True, then
the output filename will be the input filename with outsuffix added (i.e. image.fits -> image_red.fits).
- outsuffixstring, optional
Suffix to use for output files. Default is “_red”.
- verboseboolean, optional
Verbose output to the screen.
- clobberboolean, optional
If the output file already exists, then overwrite it.
- compressboolean, optional
Gzip compress output file. Default is False.
- Returns
- fimnumpy image
The 2D processed image.
- fheadheader dictionary
The header for the processed image.
- bozepy.ccdproc.makebpm(zero, dark=None, flat=None, maxzero=100, maxdark=1, maxflat=1.2, outfile=None, verbose=False, clobber=True, compress=False)[source]¶
Create bad pixel mask from master bias, dark and flat.
- Parameters
- zerofilename or numpy 2D array, optional
The master bias. Either the 2D image or the filename.
- darkfilename or numpy 2D array, optional
The master dark. Either the 2D image or the filename.
- flatfilename or numpy 2D array, optional
The master flat. Either the 2D image or the filename.
- maxzeroint, optional
- The cutoff to use for the bias image. Values above that will
be considered bad. Default is 100.
- maxdarkint, optional
- The cutoff to use for the dark image. Values above that will
be considered bad. Default is 1.0
- maxflatint, optional
- The cutoff to use for the flat image. Values above that will
be considered bad. Default is 1.2
- outfilestring, optional
Filename to write the processed image to.
- verboseboolean, optional
Verbose output to the screen.
- clobberboolean, optional
If the output file already exists, then overwrite it.
- compressboolean, optional
Gzip compress output file. Default is False.
- Returns
- bpmnumpy image
The 2D processed image.
- fheadheader dictionary
The header for the processed image.
- bozepy.ccdproc.masterbias(files, med=False, outfile=None, clobber=True, verbose=False)[source]¶
Load the bias images. Overscan correct and trim them. Then average them.
- Parameters
- fileslist
List of bias FITS files.
- medboolean, optional
Use the median of all the files. By default med=False and the mean is calculated.
- outfilestring, optional
Filename to write the master bias image to.
- clobberboolean, optional
If the output file already exists, then overwrite it. Default is True.
- verboseboolean, optional
Verbose output to the screen. Default is False.
- Returns
- aimnumpy image
The 2D master bias image.
- aheadheader dictionary
The master bias header.
- bozepy.ccdproc.masterdark(files, zero, med=False, outfile=None, clobber=True, verbose=False)[source]¶
Load the dark images. Overscan correct and trim them. zero subtract. Then average them.
- Parameters
- fileslist
List of dark FITS files.
- zeronumpy image or str
Master bias. This can be the image or the filename.
- medboolean, optional
Use the median of all the files. By default med=False and the mean is calculated.
- outfilestring, optional
Filename to write the master dark image to.
- clobberboolean, optional
If the output file already exists, then overwrite it. Default is True.
- verboseboolean, optional
Verbose output to the screen. Default is False.
- Returns
- aimnumpy image
The 2D master dark image.
- aheadheader dictionary
The master dark header.
- bozepy.ccdproc.masterflat(files, zero, dark, med=False, outfile=None, clobber=True, verbose=False)[source]¶
Load the flat images. Overscan correct and trim them. Bias and dark subtract. Then divide by median and average them.
- Parameters
- fileslist
List of flat FITS files.
- zeronumpy image or str
Master bias. This can be the image or the filename.
- darknumpy image or str
Master dark. This can be the image or the filename.
- medboolean, optional
Use the median of all the files. By default med=False and the mean is calculated.
- outfilestring, optional
Filename to write the master flat image to.
- clobberbool, optional
If the output file already exists, then overwrite it. If the output file already exists, then overwrite it. Default is True.
- verboseboolean, optional
Verbose output to the screen. Default is False.
- Returns
- aimnumpy image
The 2D master flat image.
- aheadheader dictionary
The master flat header.
bozepy.phot module¶
PHOT.PY - Generic CCD image calibration/reduction
- bozepy.phot.aperphot(im, positions, rap=5.0, rin=10.0, rout=20.0)[source]¶
Calculate circular aperture photometry for a list of sources.
- Parameters
- im2D numpy array
The image to estimate the background for.
- positionslist
List of two-element positions or catalog.
- rapfloat, optional
Radius of the aperture. Default is 5.0 pixels.
- rinfloat, optional
Radius of the inner background aperture. Default is 10.0 pixels.
- routfloat, optional
Radius of the outer background aperture. Default is 20.0 pixels.
- Returns
- photastropy table
Catalog of measured aperture photometry.
- bozepy.phot.background(im, clipsigma=3.0, boxsize=None, filtersize=(3, 3))[source]¶
Estimate a smooth background in an image.
- Parameters
- im2D numpy array
The image to estimate the background for.
- clipsigmafloat, optional
Value to use for sigma clipping. Default is 3.0.
- boxsizetuple/list, optional
Box size to use for the background estimation. Default is (ny//10,nx//10).
- filtersizetuple/list, optional
Filter size to use. Default is (3,3).
- Returns
- background2D numpy array
The estimate background image. Will be same shape as “im”.
- bozepy.phot.daodetect(im, fwhm=5.0, nsig=5.0)[source]¶
Detect sources in an image using DAO technique.
- Parameters
- im2D numpy array
The image to estimate the background for.
- fwhmfloat, optional
The full width at half maximum of the PSF in the image. Default is 5.
- nsigfloat, optional
- The number of sigma above the background to set for the threshold.
Default is 5.0 sigma.
- Returns
- catastropy table
Catalog of detected sources and their central positions.
- bozepy.phot.detection(im, fwhm=5, nsig=5)[source]¶
Detect sources in an image.
- Parameters
- im2D numpy array
The image to estimate the background for.
- fwhmfloat, optional
The full width at half maximum of the PSF in the image. Default is 5.
- nsigfloat, optional
- The number of sigma above the background to set for the threshold.
Default is 5.0 sigma.
- Returns
- catastropy table
Catalog of detected sources and their central positions.
- bozepy.phot.morphology(im, positions=None)[source]¶
Calculate centroid and morphology for sources.
- Parameters
- im2D numpy array
The image to estimate the background for.
- positionslist or table, optional
List of positions or table. Default is to fit a single source in the center.
- Returns
- catastropy table
Catalog of calculated values.