stdpipe.utils module

stdpipe.utils.breakpoint()[source]
stdpipe.utils.make_jname(ra, dec)[source]
stdpipe.utils.get_data_path(dataname)[source]

Returns full path to the data file located in the module data/ folder

stdpipe.utils.download(url, filename=None, overwrite=False, verbose=False)[source]
stdpipe.utils.get_obs_time(header=None, filename=None, string=None, get_datetime=False, verbose=False)[source]

Extract date and time of observations from a FITS header or string.

Tries the following FITS keywords in order: DATE-OBS, DATEOBS, DATE, TIME-OBS, TIMEOBS, UT, MJD, JD.

Parameters:
headerastropy.io.fits.Header, optional

FITS header containing observation time keywords.

filenamestr, optional

Path to a FITS file; its header is loaded if header is not provided.

stringstr, optional

Time string to parse directly instead of using a FITS header.

get_datetimebool, optional

If True, return a datetime.datetime instead of astropy.time.Time.

verbosebool or callable, optional

Whether to show verbose messages. May be boolean or a print-like callable.

Returns:
astropy.time.Time or datetime.datetime or None

Parsed observation time, or None if parsing fails.

stdpipe.utils.table_get(table, colname, default=0)[source]

Simple wrapper to get table column, or default value if it is not present

stdpipe.utils.format_astromatic_opts(opts)[source]

Auxiliary function to format dictionary of options into Astromatic compatible command-line string. Booleans are converted to Y/N, arrays to comma separated lists, strings are quoted when necessary

stdpipe.utils.format_long_opts(opts)[source]

Auxiliary function to format dictionary of options into a command-line string. Boolean options are added when True, strings are quoted when necessary

stdpipe.utils.parse_det(string)[source]

Parse DATASEC-like keyword

stdpipe.utils.crop_overscans(image, header, subtract_bias=True, verbose=False)[source]

Crop overscans from input image based on its header keywords. Also, subtract the ‘bias’ value estimated from overscan.

stdpipe.utils.rebin_image(image, nx=1, ny=None)[source]

Simple rebinning / downscaling the image by an integer factor. Pixel values are averaged, not co-added.

stdpipe.utils.file_write(filename, contents=None, append=False)[source]

Simple utility for writing some contents into file.

stdpipe.utils.file_read(filename, contents=None)[source]

Simple utility for reading some contents from file.

stdpipe.utils.fits_write(filename, image, header=None, compress=False)[source]

Store image with or without header to FITS file, with or without compression