vasca.tables
¶
Module Contents¶
Classes¶
Collection of |
Data¶
API¶
- vasca.tables.dimless = None¶
- vasca.tables.FILE_DIR = 'dirname(...)'¶
- vasca.tables.ROOT_DIR = None¶
- class vasca.tables.TableCollection[source]¶
Collection of
Table
objects. Base calss for data storage classes in VASCA.Initialization
- static table_from_template(dd_data: dict, template_name: str) astropy.table.Table [source]¶
Creates a new astropy table.
- Parameters:
dd_data (dict) – Data dictionaty with the key corresponding to the templates columns. Id data==None an empty template table is returned.
template_name (str) – Identifier to select a table template. Templates are selected by setting the class key and a corresponding table key in one string separated by a colon, e.g. template_name=<class_key>:<table_key>.
- Return type:
- add_table(data: list | numpy.ndarray, template_name: str) None [source]¶
Add a VASCA table to the colection
- Parameters:
data (list, array-like) – Data of the table with shape (n, n_cols) or as dictionary with the key corresponding to the templates columns.
template_name (str) – Identifier to select a table template. Templates are selected by setting the class key and a corresponding table key in one string separated by a colon, e.g. template_name=<class_key>:<table_key>. If no “:” is in the templatename, assume that this is not a VASCA table, but proceed adding it to the collection anyhow. template_name will be used as a table name in that case. The available VASCA templates are defined in
tables_dict
.
- remove_unselected(table_name: str) None [source]¶
Remove unselected rows from given table
- Parameters:
table_name (str) – Table to delete the unselected rows from. Has to contain the “sel” column.
- write_to_fits(file_name: str = 'tables.fits', overwrite: bool = True, fits_verify: str = 'fix') None [source]¶
Write tables and image of a collection to a fits file.
- Parameters:
file_name (str, optional) – File name. The default is “field_default.fits”.
overwrite (bool, optional) – Overwrite existing file. The default is True.
fits_verfy (str, optional) – Verify if output is compatible with FITS format. Options are: ‘exception’, ‘ignore’, ‘fix’, ‘silentfix’, ‘warn’ See https://docs.astropy.org/en/stable/io/fits/api/verification.html The default is ‘warn’.
- load_from_fits(file_name: str) None [source]¶
Loads collection from a fits file
- Parameters:
file_name (str) – File name
- select_from_config(dd_selections: dict) None [source]¶
Apply multiple selections at once.
- Parameters:
dd_selections (dict) – Dictionary with selection table, variables and cut values
- select_rows(selections: dict, remove_unselected: bool = False) None [source]¶
Apply selection to a passed table.
- get_light_curve(fd_src_ids: int | list[int] | None = None, rg_src_ids: int | list[int] | None = None, flux_var: str = 'flux') dict [source]¶
Get a light curves for one or list of sources, for regions or fields.
- Parameters:
fd_src_ids (list, int, optional) – List or single field source IDs to plot. Default is None.
rg_src_ids (list, int, optional) – List or single region source IDs to plot. Default is None.
flux_var (str, optional) – Variable in table to be used to get flux Jy. Flux error assumed to be named flux_var+’_err’
- Returns:
Dictionary {src_id : light_curve). Light curve as an astropy Table compatible with astropy BinnedTimeSeries.
- Return type:
- cluster_meanshift(**ms_kw) int [source]¶
Apply MeanShift clustering algorithm using to derive sources. Runs only on selected detections or sources.
- set_src_stats(src_id_name: str = 'fd_src_id') None [source]¶
Calculates source parameters from detections and stores them in the source table (tt_source).
- Parameters:
src_id_name (str, optional) – Name of the src_id to calculate statistics for. ‘rg_src_id’ indicates operations being performed on
vasca.region
objects whereas ‘fd_src_id’ would indicatevasca.field
objects.
- set_hardness_ratio(obs_filter_id1: int = 1, obs_filter_id2: int = 2) None [source]¶
Calculated hardness ratio from detections flux(filter_2)/ flux(filter_1). Only simultaneous detections are considered
- add_column(table_name: str, col_name: str, col_data: dict | numpy.ndarray | None = None) None [source]¶
Adds column in a table, using the predefined VASCA columns. If column exists already replace it.
- copy_table_columns(tab_name_to: str, tab_name_from: str, copy_vars: list[str], match_var: str = 'rg_src_id', select_matched: bool = False) None [source]¶
Copy a column from one table to the other, for those columns that have a matching variable value ‘match_variable’
- cross_match(dist_max: astropy.units.Quantity = 1.5 * uu.arcsec, dist_s2n_max: float = 3, cat_table_name: str = 'tt_coadd_sources', cat_id_name: str = 'coadd_src_id', cat_name: str = 'coadd', src_table_name: str = 'tt_sources') None [source]¶
Cross match sources to a catalog by position. Typically this is the coadd catalog.
- Parameters:
dist_max (
Quantity
, optional) – Maximum angular distance under which all associations are done, independent of dist_s2n. The default is “1 arcsec”.dist_s2n_max (float, optional) – Maximum distance in units of position error. All sources below this cut are associated, independently of the dist_max selection.
cat_table_name (str, optional) – Catalog table name. Has to contain “ra”,”dec” (in deg), “flux” (in microJy) and “cat_id_name” columns. Marks associated catalog sources in the “sel” column of the catalog table, if it exists.
cat_id_name (str, optional) – Catalog ID Br. variable name. The default is “coadd_src_id”.
src_table_name (str, optional) – Table to cross match to catalog. The default is “tt_sources”.