vasca.tables
¶
Module Contents¶
Classes¶
Collection of astropy.table.Table_ objects. Base calss for data storage classes in VASCA. |
Data¶
API¶
- vasca.tables.dimless = None¶
- vasca.tables.FILE_DIR = 'dirname(...)'¶
- vasca.tables.ROOT_DIR = None¶
- class vasca.tables.TableCollection[source]¶
Bases:
object
Collection of astropy.table.Table_ objects. Base calss for data storage classes in VASCA.
Initialization
- static table_from_template(dd_data, template_name)[source]¶
Creates a new astropy table.
- dd_datadict
Data dictionaty with the key corresponding to the templates columns. Id data==None an empty template table is returned.
- template_namestr
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>.
astropy.table.Table
- remove_tables(ll_table_names)[source]¶
Removes table from collection
- ll_table_nameslist of str
List with name of tables
- add_table(data, template_name)[source]¶
Add a VASCA table to the colection
- datalist, array-like
Data of the table with shape (n, n_cols) or as dictionary with the key corresponding to the templates columns.
- template_namestr
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
vasca.tables_dict
.
- remove_unselected(table_name)[source]¶
Remove unselected rows from given table
- table_namestr
Table to delete the unselected rows from. Has to contain the “sel” column.
None
- write_to_fits(file_name='tables.fits', overwrite=True, fits_verify='fix')[source]¶
Write tables and image of a collection to a fits file.
- file_namestr, optional
File name. The default is “field_default.fits”.
- overwritebool, 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’.
None.
- load_from_fits(file_name)[source]¶
Loads collection from a fits file
- file_namestr, optional
File name.
None.
- select_from_config(dd_selections)[source]¶
Apply multiple selections at once.
- dd_selectionsdict
Dictionary with selection table, variables and cut values
None
- select_rows(selections, remove_unselected=False)[source]¶
Apply selection to a passed table.
- selectionsdict
Dictionary with selection table, variables and cut values
- remove_unselected: bool
Remove table rows with entry False in ‘sel’ table.
None
- get_light_curve(fd_src_ids=None, rg_src_ids=None, flux_var='flux')[source]¶
Get a light curves for one or list of sources, for regions or fields.
- fd_src_idslist or int
List or single field source IDs to plot. Default is None.
- rg_src_idslist or int
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’
- dict
Dictionary {src_id : light_curve). Light curve as an astropy Table compatible with astropy BinnedTimeSeries.
- cluster_meanshift(**ms_kw)[source]¶
Apply _MeanShift clustering algorithm using to derive sources. Runs only on selected detections or sources.
- ms_kwdict, optional
Keywords passed to the scikit MeanShift function. Note that the bandwidth is assumed to be in units of arc seconds.
- int
Number of detected clusters.
- set_src_stats(src_id_name='fd_src_id')[source]¶
Calculates source parameters from detections and stores them in the source table (tt_source).
- src_id_namestr, 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.
None
- set_hardness_ratio(obs_filter_id1=1, obs_filter_id2=2)[source]¶
Calculated hardness ratio from detections flux(filter_2)/ flux(filter_1). Only simultaneous detections are considered
- obs_filter_id1int, optional
Observation filter ID1. The default is 1.
- obs_filter_id2int, optional
Observation filter ID2. The default is 1. The default is 2.
None
- add_column(table_name, col_name, col_data=None)[source]¶
Adds column in a table, using the predefined VASCA columns. If column exists already replace it.
- table_namestr
Name of the table.
- col_name: str
Name of the column
- col_data dict or array
Data to be inserted. If “None” use vasca.table_dict default value.
None
- copy_table_columns(tab_name_to, tab_name_from, copy_vars, match_var='rg_src_id', select_matched=False)[source]¶
Copy a column from one table to the other, for those columns that have a matching variable value ‘match_variable’ Parameters ———- tab_name_to str
Table name of tabla to copy into
- tab_name_from str
Table name of tabla to copy into
- copy_vars list
Variable names of column to copy
- match_var
Variable name to match rows in tables
- select_matched
Adjust the “sel” column in ‘tab_name_to’
None
- cross_match(dist_max=1.5 * uu.arcsec, dist_s2n_max=3, cat_table_name='tt_coadd_sources', cat_id_name='coadd_src_id', cat_name='coadd', src_table_name='tt_sources')[source]¶
Cross match sources to a catalog by position. Typically this is the coadd catalog.
- dist_max astropy.Quantity
Maximum angular distance under which all associations are done, independent of dist_s2n. The default is “1 arcsec”.
- dist_s2n_max float
Maximum distance in units of position error. All sources below this cut are associated, independently of the dist_max selection.
- cat_table_namestr, 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_namestr, optional
Catalog ID Br. variable name. The default is “coadd_src_id”.
- src_table_namestr, optional
Table to cross match to catalog. The default is “tt_sources”.
None