BrowseCatalog¶
- class gdt.core.heasarc.BrowseCatalog(cache_path, table=None, verbose=True, cached=False)[source]¶
Bases:
objectA class that interfaces with the HEASARC Browse API. This can be called directly, but is primarily intended as a base class.
This class makes a query to HEASARC’s w3query.pl perl script in BATCHRETRIEVALCATALOG mode. All fields and rows are retrieved so that this class, on instantiation, contains the full set of catalog data. Any queries based on row or columns selections/slices are then done locally, instead of making repeated requests to the HEASARC. A cached copy of the catalog is saved locally so future instantiations can utilize the local copy instead of querying HEASARC.
- Parameters:
cache_path (str) – The path where the cached catalog will live.
cached (bool, optional) – Set to True to read from the cached file instead of querying HEASARC. Default is False.
table (str, optional) – The name of the table to be passed to the w3query.pl script.
verbose (bool, optional) – Default is True
Attributes Summary
The names of the columns available in the table
The total number of columns (fields) in the data table
The total number of rows in the data table
Methods Summary
column_range(column)Return the data range for a given column, in the form of (low, high).
get_table([columns])Return the table data as a numpy record array.
slice(column[, lo, hi])Perform row slices of the data table based on a conditional of a single column.
slices(columns)Perform row slices of the data table based on a conditional of multiple columns.
Attributes Documentation
- columns¶
The names of the columns available in the table
- Type:
(np.array)
- num_cols¶
The total number of columns (fields) in the data table
- Type:
(int)
- num_rows¶
The total number of rows in the data table
- Type:
(int)
Methods Documentation
- column_range(column)[source]¶
Return the data range for a given column, in the form of (low, high).
- Parameters:
column (str) – The column name
- Returns:
(tuple)
- get_table(columns=None)[source]¶
Return the table data as a numpy record array.
- Parameters:
columns (list of str, optional) – The columns to return. If omitted, returns all columns.
- Returns:
(np.recarray)
- slice(column, lo=None, hi=None)[source]¶
Perform row slices of the data table based on a conditional of a single column. Returns a new BrowseCatalog object.
- Parameters:
column (str) – The column name
lo (optional) – The minimum (inclusive) value of the slice. If not set, uses the lowest range of the data in the column.
hi (optional) – The maximum (inclusive) value of the slice. If not set, uses the highest range of the data in the column.
- Returns:
- slices(columns)[source]¶
Perform row slices of the data table based on a conditional of multiple columns. Returns a new BrowseCatalog object.
- Parameters:
columns (list of tuples) – A list of tuples, where each tuple is (column, lo, hi). The ‘column’ is the column name, ‘lo’ is the lowest bounding value, and ‘hi’ is the highest bouding value. If no low or high bounding is desired, set to None. See
slice()for more info.- Returns: