Module azcam.functions.fits
azcam.fits contains FITS image support functions for azcam.
Functions
def add(filename1: str, filename2: str, filename3: str, datatype: str = 'uint16') ‑> None
-
Add two images.
filename3 = filename1 + filename2
.Args
filename1
- image filename.
filename2
- may be an image filename or a constant.
filename3
- optional, must be an image filename. If not specified, result goes into filename1.
datatype
- valid datatype string for resultant data type.
def add_history(filename: str, history_string: str, extension: int = 0) ‑> None
-
Adds a HISTORY line containing 'history_string' to the image. Used to record actions performed on an image. A 20 character time stamp is added as a prefix, and the result is split across up to three cards if it is too long to fit in one. Any extra text is truncated.
Args
filename
- image filename.
history_string
- string to add as a HISTORY keyword.
extension
- image extension number.
def arith(filename1: str, operator: str, filename2: str, filename3: str = '', datatype: str = 'uint16') ‑> None
-
Simple image arithmetic of FITS files.
Args
filename1
- image filename.
operator
- '+','-','/', or '*'.
filename2
- may be an image filename or a constant.
filename3
- optional, must be an image filename. If not specified, result goes into filename1.
datatype
- valid datatype string for resultant data type.
def colbias(filename: str = 'test', fit_order: int = 3, margin_cols: int = 0) ‑> None
-
Remove column bias from a FITS file.
Args
filename
- image filename.
fit_order
- polynomial fit order, use 0 to remove median not fitted value.
margin_cols
- number of overscan columns to skip before correction.
def combine(file_list: list = [], out_filename: str = 'combined.fits', combination_type: str = 'median', overscan_correct: int = 1, fit_order=3, datatype='float32') ‑> None
-
Make a combination iamge from a list of FITS filenames.
Args
file_list
- list of filenames to combine.
out_filename
- output filename.
combination_type
- combination type, "median", "sum", or "mean".
overscan_correct
- line fit order if >0 for overscan correction before combination.
def div(filename1: str, filename2: str, filename3: str, datatype: str = 'uint16') ‑> None
-
Divide two images.
filename3 = filename1 / filename2
.Args
filename1
- image filename.
operator
- '+','-','/', or '*'.
filename2
- may be an image filename or a constant.
filename3
- optional, must be an image filename. If not specified, result goes into filename1.
datatype
- valid datatype string for resultant data type.
def edit_keyword(filename: str, keyword: str, value: Any, extension: int = 0) ‑> None
-
Edits a header keyword value.
Args
filename
- image filename.
keyword
- keyword name.
value
- new value of keyword.
extension
- image extension number.
def file_exists(filename: str) ‑> bool
-
Args
filename
- filename to check if exists.
Returns
True if the file exists.
def get_data(filename: str = 'test', roi: str = []) ‑> list
-
Return data (pixel values) from an ROI in an image for every extension. NOT FINISHED!
Args
filename
- image filename.
roi
- Region-Of-Interest.
Returns
list of pixel values.
def get_extensions(filename: str) ‑> list
-
Returns the number of image extensions and their indices. The number of extensions is 0 for a standard FITS file and >0 for MEF. The first data extension for an MEF file is 1.
Args
filename
- image filename.
Returns
the list
[number_exts, first_ext, last_ext]
containing the number of extensions and the indices for the pythonrange
function to iterate over them. def get_header(filename: str, extension: int = 0) ‑> object
-
Return an image header.
Args
filename
- image filename.
extension
- image extension number.
Returns
the image header as a pyfits header object.
def get_history(filename: str, extension: int = 0) ‑> str
-
Returns the HISTOR header lines.
Args
filename
- image filename.
extension
- image extension number.
Returns
string containing all HISTORY lines.
def get_keyword(filename: str, keyword: str, extension: int = 0) ‑> Any
-
Return a header keyword value.
Args
filename
- image filename.
keyword
- keyword name.
extension
- image extension number.
Returns
the specified keyword value.
def get_section(filename: str, section: str, extension: int = 0) ‑> list
-
Returns image section pixel numbers from a FITS keyword.
Args
filename
- image filename.
section
- section name (like "CCDSEC").
extension
- image extension number where keyword is located.
Returns
list of zero-based pixel numbers defining the section as
[first_col,last_col,first_row,last_row]
. def maximum(filename: str = 'test', roi: str = []) ‑> list
-
Compute maximum of an image ROI for every extension.
Args
filename
- image filename.
roi
- Region-Of-Interest.
Returns
list of the maxima of each image extension or ROI in each extension.
def mean(filename: str = 'test', roi: list = []) ‑> list
-
Compute mean of an image ROI in every extension.
Args
filename
- image filename.
roi
- Region-Of-Interest.
Returns
list of the means of each image extension or ROI in each extension.
def minimum(filename: str = 'test', roi: str = []) ‑> list
-
Compute minimum of an image ROI for every extension.
Args
filename
- image filename.
roi
- Region-Of-Interest.
Returns
list of the minima of each image extension or ROI in each extension.
def mult(filename1: str, filename2: str, filename3: str, datatype: str = 'uint16') ‑> None
-
Multiple two images.
filename3 = filename1 * filename2
.Args
filename1
- image filename.
operator
- '+','-','/',or '*'.
filename2
- may be an image filename or a constant.
filename3
- optional, must be an image filename. If not specified, result goes into filename1.
datatype
- valid datatype string for resultant data type.
def resample(filename: str, resample: int = 2) ‑> None
-
Resample an image by combining adjacent pixels.
Args
filename
- image filename.
resample
- number of pixels to combine in each dimension.
def sdev(filename: str = 'test', roi: list = []) ‑> list
-
Compute standard deviation of an image ROI in every extension.
Args
filename
- image filename.
roi
- Region-Of-Interest.
Returns
list of the standard deviations of each image extension or ROI in each extension.
def stat(filename: str = 'test', roi: list = []) ‑> list
-
Compute mean and sdev image statistics of ROI in every extension.
Args
filename
- image filename.
roi
- Region-Of-Interest.
Returns
list of
[[means], [sdevs], ROI]
the status of each image extension or ROI in each extension. def sub(filename1: str, filename2: str, filename3: str, datatype: str = 'uint16') ‑> None
-
Subtract two images.
filename3 = filename1 - filename2
.Args
filename1
- image filename.
operator
- '+','-','/',or '*'.
filename2
- may be an image filename or a constant.
filename3
- optional, must be an image filename. If not specified, result goes into filename1.
datatype
- valid datatype string for resultant data type.