fitsextract

edge_pydb.fitsextract.fitsextract(input, header=None, stride=[1, 1, 1], keepref=True, keepnan=True, zselect=None, col_lbl='imdat', ra_gc=None, dec_gc=None, pa=0, inc=0, ortlabel='default', bunit=None, first=False, use_hexgrid=False, sidelen=2, starting_angle=0, precision=2, header_hex=None, hexgrid_output=None)[source]

Sample data from an image into an AstroPy table indexed by coordinates. Simple approach taking every nth pixel along each image axis. Pseudocubes are handled as separate images and are detected by a blank value for CTYPE3 in the header.

Parameters:
inputstr or ndarray
The input image or cube to turn into a table. This can be:
  • The name of a FITS file

  • A numpy array (in which case header must be separately given)

headerHeader object

Header corresponding to the input array. Must be provided if the input is a numpy array.

stridetuple of ints, optional

Step size to select pixels along each axis. Axes are ordered using the FITS convention, not numpy convention (i.e. velaxis last). Default is [1,1,1] to keep all pixels. Note: stride in z is ignored for pseudocubes.

keeprefbool, optional

If dropping pixels, try to ensure that the reference pixel is kept. Default is True (keep the reference pixel).

keepnanbool, optional

If False, the output table drops rows which are all-NaN. Default is True (keep the NaNs).

zselectlist of ints, optional

Indices of planes in cube/pseudocube to be selected. Default is to keep all planes.

col_lblstring or list of strings, optional

Column label for the data values, can be list corresponding to each plane to be selected, for CALIFA pseudocubes. Default is “imdat”+possible integer.

ra_gcfloat, optional

Right ascension of galaxy center. Used to determine polar coordinates of each sample in the plane of the galaxy. Default is reference RA value of the image.

dec_gcfloat, optional

Declination of galaxy center. Used to determine polar coordinates of each sample in the plane of the galaxy. Default is reference DEC value of the image.

pafloat, optional

Position angle of the galaxy disk in degrees E of N. Used to determine polar coordinates of each sample in the plane of the galaxy. Default is 0 (due north).

incfloat, optional

Inclination of the galaxy disk in degrees from face-on. Used to determine polar coordinates of each sample in the plane of the galaxy. Default is 0 (face-on).

ortlabelstring, optional

String label describing the origin of the orientation parameters.

bunitstring or list of strings, optional

Astropy units for data values, can be list corresponding to each plane to be selected, for CALIFA pseudocubes. Default is obtained from BUNIT in the header.

firstbool, optional

True to write the coordinate columns, which only need to be done once per table. When combining multiple FITS images into a table, fitsextract should be called initially with first=True and then subsequently with first=False. Default is False.

Returns:
tabTable

The selected pixels as a 1-D table.