imaginglss.model.brickindex module¶
Python code to provide a high level table/list/index of bricks, and methods for organizing and querying them and returning brick objects.
-
class
imaginglss.model.brickindex.
BrickIndex
(brickdata)[source]¶ Bases:
object
BrickIndex manages a high level table/list/index of bricks.
It contains methods for organizing and querying bricks or returning brick objects.
The FITS file ‘bricks.fits’ within each imaging data release contains meta-data about each of the bricks in the release.
We generate an index from bricks.fits , e.g.
>>> brickdata = fits.read_table('bricks.fits') >>> bi = BrickIndex(brickdata)
However, a BrickIndex object is usually automatically handled by
DataRelease
, and one shall use>>> dr = DataRelease() >>> dr.brickindex
Notes
The bricks in DECALS are first divided as uniform DEC rows. The number of bricks changes with DEC, such that each brick as apporximately same area.
-
get_brick
(index)[source]¶ Obtain a single brick from index.
The returned Brick object is immutable; there is only a single instance per BrickIndex.
Parameters: index : integer
The internal index of a brick. This differ from BRICKID in the catalogue.
Returns: brick :
Brick
A brick object at index.
Notes
The lack of a vector version is on purpose to emphasize we are dealing with objects.
Use
get_bricks()
to create a list of objects.
-
get_bricks
(indices)[source]¶ Obtain a list of bricks.
Parameters: indices : array_like
Indices to obtain bricks
Returns: bricks : list
A list of bricks.
-
optimize
(coord, return_index=False, return_inverse=False)[source]¶ Optimize the ordering of coord=(RA,DEC) to make later queries faster.
RA and DEC are sorted by their brickid, to group future queries.
Parameters: return_inverse : boolean
if True, returns the array that can be used to reconstruct coord from the returned coord.
return_index : boolean
if True, returns the array that can be used to construct sorted_coord from coord:
Returns: Depending or return_inverse and return_index, may return
(sorted_coord, indices, iindices), (sorted_coord, iindices)
(sorted_coord, indices), or sorted_coord
sorted_coord : array_like
Optimized coord array, that is sorted by bricks.
iindeces : array_like
sorted_ra[ iindices] == ra sorted_dec[iindices] == dec
indices : array_like
sorted_ra == ra[indices] sorted_dec == dec[indices]
-
query
(coord)[source]¶ Returns a brick at coord=(RA,DEC) in decimal degrees.
Parameters: coord : array_like
coord = (RA, DEC) in degrees, vectorized.
-
query_internal
(coord)[source]¶ Returns the internal index of a brick at coord=(RA,DEC) in decimal degrees.
Parameters: coord : array_like
coord = (RA, DEC) in degrees, vectorized.
Notes
Get Brick objects with
get_bricks()
orget_brick()
.
-
query_region
(extent)[source]¶ Returns a list of bricks covering the extent in decimal degrees.
Parameters: extent : tuple, list
extent = (RA1, RA2, DEC1, DEC2) in degrees.
Notes
RA1 is the left side and RA2 is the right side.
-
search_by_id
(brickid)[source]¶ Search the brickindex for bricks with a given brickid.
Parameters: brickid : integer or array_like
the matching BRICKID or list of BRICKIDs
Returns: index : integer or array_like
the internal index of brick or bricks (for array_like input)
Notes
Get Brick objects with
get_bricks()
orget_brick()
.
-