Utilities used by subpixal

This module provides utility functions for use by subpixal module.

Author

Mihai Cara (for help, contact HST Help Desk)

License

LICENSE

subpixal.utils.parse_file_name(image_name)[source]

Parse image file names including possible extensions.

Parameters
image_namestr

An image file name and (optionally) extension specification, e.g.: 'j1234567q_flt.fits[1]', 'j1234568q_flt.fits[sci,2]', etc.

Returns
file_namestr

File name itself without extension specification.

exttuple, int, None

A tuple of two elements: extension name (a string) and extension version (an integer number), e.g., ('SCI', 2). Alternatively, an extention can be specified using an integer extension number. When no extension was specified, ext returns None.

Examples

>>> import subpixal
>>> subpixal.utils.parse_file_name('j1234568q_flt.fits[sci,2]')
('j1234568q_flt.fits', ('sci', 2))
subpixal.utils.py2round(x)[source]

This function returns a rounded up value of the argument, similar to Python 2.

subpixal.utils.get_ext_list(image, extname='SCI')[source]

Return a list of all extension versions of extname extensions. image can be either a file name or a astropy.io.fits.HDUList object.

This function returns a list of fully qualified extensions: a list of tuples of the form ('extname', 'extver').

Examples

>>> get_ext_list('j9irw1rqq_flt.fits')
[('SCI', 1), ('SCI', 2)]