Table API¶
This page documents the public mega-table classes.
RadialMegaTable ¶
Bases: GeneralRegionTable
Mega-table built from radial bins for a (inclined) galaxy disk.
Each ring (annular region) corresponds to a row in the table. Once a table is constructed, additional columns can be added by calculating statistics of images within each ring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gal_ra_deg
|
float
|
Right Ascension of the galaxy center (in degrees). |
required |
gal_dec_deg
|
float
|
Declination of the galaxy center (in degrees). |
required |
rgal_bin_arcsec
|
float
|
Radial width of each ring (in arcseconds). |
required |
gal_incl_deg
|
float
|
Inclination angle of the galaxy (in degrees). Default is 0 degree. |
0
|
gal_posang_deg
|
float
|
Position angle of the galaxy (in degrees; North through East). Default is 0 degree. |
0
|
rgal_max_arcsec
|
float
|
The maximum galactic radius (in arcseconds) that the outermost ring will cover. Default is to cover out to 20 times the ring width. |
None
|
Methods:¶
__init__ ¶
__init__(gal_ra_deg, gal_dec_deg, rgal_bin_arcsec, gal_incl_deg=0, gal_posang_deg=0, rgal_max_arcsec=None)
read
classmethod
¶
Read (and reconstruct) a RadialMegaTable object from file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of the file to read. |
required |
**kwargs
|
Any
|
Keyword arguments to be passed to |
{}
|
Returns:
| Type | Description |
|---|---|
RadialMegaTable
|
Reconstructed table instance. |
format ¶
Format table content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colnames
|
sequence of str
|
Names of the columns to keep. Columns in the new table will be ordered according to this parameter. |
None
|
units
|
sequence
|
Units to which each kept column should be converted.
Items can be either |
None
|
formats
|
sequence of str
|
Format specifiers for each kept column. |
None
|
descriptions
|
sequence of str
|
Descriptions of each kept column. |
None
|
ignore_missing
|
bool
|
Whether to ignore the error when any key in |
False
|
write ¶
Write table to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of the file to write to. |
required |
keep_metadata
|
bool
|
Whether to keep existing metadata (Default: True) |
True
|
add_timestamp
|
bool
|
Whether to add a time stamp in the metadata (Default: True) |
True
|
**kwargs
|
Any
|
Additional keyword arguments passed to
|
{}
|
find_coords_in_regions ¶
Evaluate region membership for each input coordinate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra
|
array_like
|
R.A. of the coordinates in question |
required |
dec
|
array_like
|
Declination of the coordinates in question |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A boolean array indicating whether each region contains
each input coordinate. The shape of this array is:
|
calc_catalog_stats ¶
calc_catalog_stats(entry, ra, dec, stat_func=None, weight=None, colname='new_col', unit='', **kwargs)
Calculate statistics of a catalog entry within each region.
"Catalog" in this context means a table recording both the (ra, dec) coordinates and other properties of a list of identified objects on the sky. Typical examples: molecular cloud catalogs, HII region catalogs, stellar cluster catalogs.
An example catalog entry: the "molecular cloud size" column in a cloud catalog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry
|
array_like
|
The catalog entry in question. |
required |
ra
|
array_like
|
RA coordinates of the listed objects. |
required |
dec
|
array_like
|
Dec coordinates of the listed objects. |
required |
stat_func
|
callable
|
A function that accepts an array of values and returns a scalar value (which is the calculated statistics). If 'weight' is not None, this function should also accept a keyword named 'weights', which specifies the statistical weight of each value in the array. |
None
|
weight
|
array_like
|
If not None, this keyword should be an ndarray specifying the statistical weight of each row in the catalog. Note that in this case, the broadcasted weight array will be passed to 'stat_func' in a keyword named 'weights'. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). |
''
|
**kwargs
|
Any
|
Additional keyword arguments passed to |
{}
|
calc_image_stats ¶
calc_image_stats(image, ihdu=0, header=None, stat_func=None, weight=None, colname='new_col', unit='', suppress_error=False, **kwargs)
Calculate statistics of an image within each region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str, bytes, path-like, `~astropy.io.fits.HDUList`,
|
FITS HDU, or ndarray The image to calculate statistics for. |
required |
ihdu
|
int
|
If 'image' is a str or an HDUList, this keyword should specify which HDU (extension) to use (default=0) |
0
|
header
|
`~astropy.io.fits.Header`
|
If 'image' is an ndarray, this keyword should be a FITS header providing the WCS information. |
None
|
stat_func
|
callable
|
A function that accepts an array of values, and return a scalar value (which is the calculated statistics). If 'weight' is not None, this function should also accept a keyword named 'weights', which specifies the statistical weight of each value in the array. |
None
|
weight
|
array_like
|
If not None, this keyword should be an ndarray specifying the statistical weight of each pixel in the input image. Note that in this case, the broadcasted weight array will be passed to 'stat_func' in a keyword named 'weights'. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). If unit='header', the 'BUNIT' entry in the header is used. |
''
|
suppress_error
|
bool
|
Whether to suppress the error message if 'image' looks like a file but is not found on disk (default=False) |
False
|
**kwargs
|
Any
|
Additional keyword arguments passed to |
{}
|
create_maps_from_columns ¶
Create 2D maps from data in columns based on a FITS header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colnames
|
sequence of str
|
Name of the columns to create 2D maps for. |
required |
header
|
`~astropy.fits.Header`
|
FITS header defining the WCS of the output 2D maps. |
required |
allow_region_overlap
|
bool
|
If False (default), an error will be raised when regions overlap (i.e., if any pixel belongs in multiple regions). If True, overlapping regions will be allowed, in which case later rows (regions) will overwrite earlier rows. |
False
|
Returns:
| Type | Description |
|---|---|
list
|
List of two-dimensional arrays or quantity arrays built from the requested columns. |
StripeMegaTable ¶
Bases: GeneralRegionTable
Mega-table built from stripes along a galaxy's minor axis.
Each stripe corresponds to a row in the table. Once a table is constructed, additional columns can be added by calculating statistics of images within each stripe.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gal_ra_deg
|
float
|
Right Ascension of the galaxy center (in degrees). |
required |
gal_dec_deg
|
float
|
Declination of the galaxy center (in degrees). |
required |
gal_posang_deg
|
float
|
Position angle of the galaxy (in degrees; North through East). Default is 0 degree. |
required |
xbin_arcsec
|
float
|
Width of each stripe (in arcseconds) along the galaxy major axis. |
required |
xmax_arcsec
|
float
|
The maximum distance (in arcseconds) along the galaxy major axis that the outermost stripes will cover. |
required |
ymax_arcsec
|
float
|
Width of each stripe (in arcseconds) along the galaxy minor axis.
Default is the same as |
None
|
Methods:¶
__init__ ¶
read
classmethod
¶
Read (and reconstruct) a StripeMegaTable object from file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of the file to read. |
required |
**kwargs
|
Any
|
Keyword arguments to be passed to |
{}
|
Returns:
| Type | Description |
|---|---|
StripeMegaTable
|
Reconstructed table instance. |
format ¶
Format table content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colnames
|
sequence of str
|
Names of the columns to keep. Columns in the new table will be ordered according to this parameter. |
None
|
units
|
sequence
|
Units to which each kept column should be converted.
Items can be either |
None
|
formats
|
sequence of str
|
Format specifiers for each kept column. |
None
|
descriptions
|
sequence of str
|
Descriptions of each kept column. |
None
|
ignore_missing
|
bool
|
Whether to ignore the error when any key in |
False
|
write ¶
Write table to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of the file to write to. |
required |
keep_metadata
|
bool
|
Whether to keep existing metadata (Default: True) |
True
|
add_timestamp
|
bool
|
Whether to add a time stamp in the metadata (Default: True) |
True
|
**kwargs
|
Any
|
Additional keyword arguments passed to
|
{}
|
find_coords_in_regions ¶
Evaluate region membership for each input coordinate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra
|
array_like
|
R.A. of the coordinates in question |
required |
dec
|
array_like
|
Declination of the coordinates in question |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A boolean array indicating whether each region contains
each input coordinate. The shape of this array is:
|
calc_catalog_stats ¶
calc_catalog_stats(entry, ra, dec, stat_func=None, weight=None, colname='new_col', unit='', **kwargs)
Calculate statistics of a catalog entry within each region.
"Catalog" in this context means a table recording both the (ra, dec) coordinates and other properties of a list of identified objects on the sky. Typical examples: molecular cloud catalogs, HII region catalogs, stellar cluster catalogs.
An example catalog entry: the "molecular cloud size" column in a cloud catalog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry
|
array_like
|
The catalog entry in question. |
required |
ra
|
array_like
|
RA coordinates of the listed objects. |
required |
dec
|
array_like
|
Dec coordinates of the listed objects. |
required |
stat_func
|
callable
|
A function that accepts an array of values and returns a scalar value (which is the calculated statistics). If 'weight' is not None, this function should also accept a keyword named 'weights', which specifies the statistical weight of each value in the array. |
None
|
weight
|
array_like
|
If not None, this keyword should be an ndarray specifying the statistical weight of each row in the catalog. Note that in this case, the broadcasted weight array will be passed to 'stat_func' in a keyword named 'weights'. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). |
''
|
**kwargs
|
Any
|
Additional keyword arguments passed to |
{}
|
calc_image_stats ¶
calc_image_stats(image, ihdu=0, header=None, stat_func=None, weight=None, colname='new_col', unit='', suppress_error=False, **kwargs)
Calculate statistics of an image within each region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str, bytes, path-like, `~astropy.io.fits.HDUList`,
|
FITS HDU, or ndarray The image to calculate statistics for. |
required |
ihdu
|
int
|
If 'image' is a str or an HDUList, this keyword should specify which HDU (extension) to use (default=0) |
0
|
header
|
`~astropy.io.fits.Header`
|
If 'image' is an ndarray, this keyword should be a FITS header providing the WCS information. |
None
|
stat_func
|
callable
|
A function that accepts an array of values, and return a scalar value (which is the calculated statistics). If 'weight' is not None, this function should also accept a keyword named 'weights', which specifies the statistical weight of each value in the array. |
None
|
weight
|
array_like
|
If not None, this keyword should be an ndarray specifying the statistical weight of each pixel in the input image. Note that in this case, the broadcasted weight array will be passed to 'stat_func' in a keyword named 'weights'. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). If unit='header', the 'BUNIT' entry in the header is used. |
''
|
suppress_error
|
bool
|
Whether to suppress the error message if 'image' looks like a file but is not found on disk (default=False) |
False
|
**kwargs
|
Any
|
Additional keyword arguments passed to |
{}
|
create_maps_from_columns ¶
Create 2D maps from data in columns based on a FITS header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colnames
|
sequence of str
|
Name of the columns to create 2D maps for. |
required |
header
|
`~astropy.fits.Header`
|
FITS header defining the WCS of the output 2D maps. |
required |
allow_region_overlap
|
bool
|
If False (default), an error will be raised when regions overlap (i.e., if any pixel belongs in multiple regions). If True, overlapping regions will be allowed, in which case later rows (regions) will overwrite earlier rows. |
False
|
Returns:
| Type | Description |
|---|---|
list
|
List of two-dimensional arrays or quantity arrays built from the requested columns. |
ApertureMegaTable ¶
Bases: GeneralRegionTable
Mega-table built from apertures centered on specified locations.
Each aperture corresponds to a row in the table. Once a table is constructed, additional columns can be added by calculating statistics of images within each aperture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aperture_ra_deg
|
array_like
|
Right Ascension of the aperture centers (in degrees). |
required |
aperture_dec_deg
|
array_like
|
Declination of the aperture centers (in degrees). |
required |
aperture_size_arcsec
|
float
|
The angular size of the apertures (in arcseconds). |
required |
aperture_names
|
list of str
|
Names of the apertures. |
None
|
Methods:¶
read
classmethod
¶
Read (and reconstruct) an ApertureMegaTable object from file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of the file to read. |
required |
**kwargs
|
Any
|
Keyword arguments to be passed to |
{}
|
Returns:
| Type | Description |
|---|---|
ApertureMegaTable
|
Reconstructed table instance. |
resample_image ¶
resample_image(image, ihdu=0, header=None, colname='new_col', unit='', suppress_error=False, fill_outside='nearest')
Resample an image at the location of the aperture centers.
The resampling is done by finding the nearest image pixel to each aperture center.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str, bytes, path-like, `~astropy.io.fits.HDUList`,
|
FITS HDU, or ndarray The image to be resampled. |
required |
ihdu
|
int
|
If 'image' is a str or an HDUList, this keyword should specify which HDU (extension) to use (default=0) |
0
|
header
|
`~astropy.io.fits.Header`
|
If 'image' is an ndarray, this keyword should be a FITS header providing the WCS information. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). If unit='header', the 'BUNIT' entry in the header is used. |
''
|
fill_outside
|
(nearest, float)
|
The behavior outside the footprint of the input image. If fill_outside='nearest', all seeds outside the footprint are assigned the value of the nearest pixel in the image. Otherwise, all aperture centers outside the image footprint are assigned the value of this keyword. |
'nearest'
|
suppress_error
|
bool
|
Whether to suppress the error message if 'image' looks like a file but is not found on disk (default=False) |
False
|
format ¶
Format table content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colnames
|
sequence of str
|
Names of the columns to keep. Columns in the new table will be ordered according to this parameter. |
None
|
units
|
sequence
|
Units to which each kept column should be converted.
Items can be either |
None
|
formats
|
sequence of str
|
Format specifiers for each kept column. |
None
|
descriptions
|
sequence of str
|
Descriptions of each kept column. |
None
|
ignore_missing
|
bool
|
Whether to ignore the error when any key in |
False
|
write ¶
Write table to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of the file to write to. |
required |
keep_metadata
|
bool
|
Whether to keep existing metadata (Default: True) |
True
|
add_timestamp
|
bool
|
Whether to add a time stamp in the metadata (Default: True) |
True
|
**kwargs
|
Any
|
Additional keyword arguments passed to
|
{}
|
find_coords_in_regions ¶
Evaluate region membership for each input coordinate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra
|
array_like
|
R.A. of the coordinates in question |
required |
dec
|
array_like
|
Declination of the coordinates in question |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A boolean array indicating whether each region contains
each input coordinate. The shape of this array is:
|
calc_catalog_stats ¶
calc_catalog_stats(entry, ra, dec, stat_func=None, weight=None, colname='new_col', unit='', **kwargs)
Calculate statistics of a catalog entry within each region.
"Catalog" in this context means a table recording both the (ra, dec) coordinates and other properties of a list of identified objects on the sky. Typical examples: molecular cloud catalogs, HII region catalogs, stellar cluster catalogs.
An example catalog entry: the "molecular cloud size" column in a cloud catalog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry
|
array_like
|
The catalog entry in question. |
required |
ra
|
array_like
|
RA coordinates of the listed objects. |
required |
dec
|
array_like
|
Dec coordinates of the listed objects. |
required |
stat_func
|
callable
|
A function that accepts an array of values and returns a scalar value (which is the calculated statistics). If 'weight' is not None, this function should also accept a keyword named 'weights', which specifies the statistical weight of each value in the array. |
None
|
weight
|
array_like
|
If not None, this keyword should be an ndarray specifying the statistical weight of each row in the catalog. Note that in this case, the broadcasted weight array will be passed to 'stat_func' in a keyword named 'weights'. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). |
''
|
**kwargs
|
Any
|
Additional keyword arguments passed to |
{}
|
calc_image_stats ¶
calc_image_stats(image, ihdu=0, header=None, stat_func=None, weight=None, colname='new_col', unit='', suppress_error=False, **kwargs)
Calculate statistics of an image within each region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str, bytes, path-like, `~astropy.io.fits.HDUList`,
|
FITS HDU, or ndarray The image to calculate statistics for. |
required |
ihdu
|
int
|
If 'image' is a str or an HDUList, this keyword should specify which HDU (extension) to use (default=0) |
0
|
header
|
`~astropy.io.fits.Header`
|
If 'image' is an ndarray, this keyword should be a FITS header providing the WCS information. |
None
|
stat_func
|
callable
|
A function that accepts an array of values, and return a scalar value (which is the calculated statistics). If 'weight' is not None, this function should also accept a keyword named 'weights', which specifies the statistical weight of each value in the array. |
None
|
weight
|
array_like
|
If not None, this keyword should be an ndarray specifying the statistical weight of each pixel in the input image. Note that in this case, the broadcasted weight array will be passed to 'stat_func' in a keyword named 'weights'. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). If unit='header', the 'BUNIT' entry in the header is used. |
''
|
suppress_error
|
bool
|
Whether to suppress the error message if 'image' looks like a file but is not found on disk (default=False) |
False
|
**kwargs
|
Any
|
Additional keyword arguments passed to |
{}
|
create_maps_from_columns ¶
Create 2D maps from data in columns based on a FITS header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colnames
|
sequence of str
|
Name of the columns to create 2D maps for. |
required |
header
|
`~astropy.fits.Header`
|
FITS header defining the WCS of the output 2D maps. |
required |
allow_region_overlap
|
bool
|
If False (default), an error will be raised when regions overlap (i.e., if any pixel belongs in multiple regions). If True, overlapping regions will be allowed, in which case later rows (regions) will overwrite earlier rows. |
False
|
Returns:
| Type | Description |
|---|---|
list
|
List of two-dimensional arrays or quantity arrays built from the requested columns. |
TessellMegaTable ¶
Bases: VoronoiTessTable
Mega-table built from a tessellation of a galaxy's sky footprint.
Each tile in the tessellation maps to a row in the table. Once a table is constructed, additional columns can be added by calculating statistics of images within each tile, or by resampling images at the center of each tile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_ra_deg
|
float
|
Right Ascension of the FoV center (in degrees). This also determines the location of the central tile. |
required |
center_dec_deg
|
float
|
Declination of the FoV center (in degrees). This also determines the location of the central tile. |
required |
fov_radius_arcsec
|
float
|
Radius of the FoV covered by the tessellation (in arcsecs). This determines the overall extent of the tessellation. |
required |
tile_size_arcsec
|
float
|
The angular size of the tiles (defined as the spacing between adjacent tile centers; in arcseconds). |
required |
tile_shape
|
(hexagon, square)
|
The shape of the tiles that form the tessellation. Default: 'hexagon', in which case hexagonal tiles are used. |
'hexagon'
|
Methods:¶
read
classmethod
¶
Read (and reconstruct) a TessellMegaTable object from file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of the file to read. |
required |
**kwargs
|
Any
|
Keyword arguments to be passed to |
{}
|
Returns:
| Type | Description |
|---|---|
TessellMegaTable
|
Reconstructed table instance. |
show_tiles_on_sky ¶
Plot tile centers on an image or Matplotlib axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ax
|
`~matplotlib.axes.Axes`
|
Axes on which to plot the tile centers when |
None
|
image
|
Any
|
Image-like input accepted by |
None
|
ffigkw
|
dict
|
Keyword arguments passed to |
None
|
**scatterkw
|
Any
|
Keyword arguments passed to the marker plotting call. |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
|
format ¶
Format table content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colnames
|
sequence of str
|
Names of the columns to keep. Columns in the new table will be ordered according to this parameter. |
None
|
units
|
sequence
|
Units to which each kept column should be converted.
Items can be either |
None
|
formats
|
sequence of str
|
Format specifiers for each kept column. |
None
|
descriptions
|
sequence of str
|
Descriptions of each kept column. |
None
|
ignore_missing
|
bool
|
Whether to ignore the error when any key in |
False
|
write ¶
Write table to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of the file to write to. |
required |
keep_metadata
|
bool
|
Whether to keep existing metadata (Default: True) |
True
|
add_timestamp
|
bool
|
Whether to add a time stamp in the metadata (Default: True) |
True
|
**kwargs
|
Any
|
Additional keyword arguments passed to
|
{}
|
find_coords_in_regions ¶
Match coordinates to the nearest Voronoi tile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra
|
array_like
|
R.A. of the coordinates in question |
required |
dec
|
array_like
|
Declination of the coordinates in question |
required |
fill_value
|
int
|
The index value to return for input coordinates that have no matched regions (default: -1). |
-1
|
Returns:
| Type | Description |
|---|---|
ndarray
|
An index array indicating which tile each input coordinate belongs to. The length of this array equals the number of input coordinates. |
calc_catalog_stats ¶
calc_catalog_stats(entry, ra, dec, stat_func=None, weight=None, colname='new_col', unit='', **kwargs)
Calculate statistics of a catalog entry within each region.
"Catalog" in this context means a table recording both the (ra, dec) coordinates and other properties of a list of identified objects on the sky. Typical examples: molecular cloud catalogs, HII region catalogs, stellar cluster catalogs.
An example catalog entry: the "molecular cloud size" column in a cloud catalog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry
|
array_like
|
The catalog entry in question. |
required |
ra
|
array_like
|
RA coordinates of the listed objects. |
required |
dec
|
array_like
|
Dec coordinates of the listed objects. |
required |
stat_func
|
callable
|
A function that accepts an array of values and returns a scalar value (which is the calculated statistics). If 'weight' is not None, this function should also accept a keyword named 'weights', which specifies the statistical weight of each value in the array. |
None
|
weight
|
array_like
|
If not None, this keyword should be an ndarray specifying the statistical weight of each row in the catalog. Note that in this case, the broadcasted weight array will be passed to 'stat_func' in a keyword named 'weights'. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). |
''
|
**kwargs
|
Any
|
Additional keyword arguments passed to |
{}
|
calc_image_stats ¶
calc_image_stats(image, ihdu=0, header=None, stat_func=None, weight=None, colname='new_col', unit='', suppress_error=False, **kwargs)
Calculate statistics of an image within each region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str, bytes, path-like, `~astropy.io.fits.HDUList`,
|
FITS HDU, or ndarray The image to calculate statistics for. |
required |
ihdu
|
int
|
If 'image' is a str or an HDUList, this keyword should specify which HDU (extension) to use (default=0) |
0
|
header
|
`~astropy.io.fits.Header`
|
If 'image' is an ndarray, this keyword should be a FITS header providing the WCS information. |
None
|
stat_func
|
callable
|
A function that accepts an array of values, and return a scalar value (which is the calculated statistics). If 'weight' is not None, this function should also accept a keyword named 'weights', which specifies the statistical weight of each value in the array. |
None
|
weight
|
array_like
|
If not None, this keyword should be an ndarray specifying the statistical weight of each pixel in the input image. Note that in this case, the broadcasted weight array will be passed to 'stat_func' in a keyword named 'weights'. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). If unit='header', the 'BUNIT' entry in the header is used. |
''
|
suppress_error
|
bool
|
Whether to suppress the error message if 'image' looks like a file but is not found on disk (default=False) |
False
|
**kwargs
|
Any
|
Additional keyword arguments passed to |
{}
|
create_maps_from_columns ¶
Create 2D maps from data in columns based on a FITS header.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colnames
|
sequence of str
|
Name of the columns to create 2D maps for. |
required |
header
|
`~astropy.fits.Header`
|
FITS header defining the WCS of the output 2D maps. |
required |
allow_region_overlap
|
bool
|
If False (default), an error will be raised when regions overlap (i.e., if any pixel belongs in multiple regions). If True, overlapping regions will be allowed, in which case later rows (regions) will overwrite earlier rows. |
False
|
Returns:
| Type | Description |
|---|---|
list
|
List of two-dimensional arrays or quantity arrays built from the requested columns. |
resample_image ¶
resample_image(image, ihdu=0, header=None, colname='new_col', unit='', suppress_error=False, fill_outside='nearest')
Resample an image at the location of the Voronoi seeds.
The resampling is done by finding the nearest pixel to the location of each seed in the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
str, bytes, path-like, `~astropy.io.fits.HDUList`,
|
FITS HDU, or ndarray The image to be resampled. |
required |
ihdu
|
int
|
If 'image' is a str or an HDUList, this keyword should specify which HDU (extension) to use (default=0) |
0
|
header
|
`~astropy.io.fits.Header`
|
If 'image' is an ndarray, this keyword should be a FITS header providing the WCS information. |
None
|
colname
|
str
|
Name of a column in the table to save the output values. Default: 'new_col' |
'new_col'
|
unit
|
str or `~astropy.units.UnitBase`
|
Physical unit of the output values (default=''). If unit='header', the 'BUNIT' entry in the header is used. |
''
|
fill_outside
|
(nearest, float)
|
The behavior outside the footprint of the input image. If fill_outside='nearest', all seeds outside the footprint are assigned the value of the nearest pixel in the image. Otherwise, all seeds outside the image footprint are assigned the value of this keyword. |
'nearest'
|
suppress_error
|
bool
|
Whether to suppress the error message if 'image' looks like a file but is not found on disk (default=False) |
False
|