getTable(table, filter, sortcol=None, exactly_one=False, at_least_one=False)¶
Return row(s) of a table that match the filter.
Rows that match every item in the filter (a dictionary of column_name=value) will be returned. If the value in the table is STRING_WILDCARD or INT_WILDCARD (depending on the data type of the column), that value is considered to match the filter for that column. Also, for a given filter key, if the corresponding value in the filter is STRING_WILDCARD, the test on filter will be skipped for that key (i.e. a wildcard filter element matches any row).
If more than one row matches the filter, there is an option to sort these rows based on the values of one of the table columns.
It is an error if exactly_one or at_least_one is True but no row matches the filter. A warning will be printed if exactly_one is True but more than one row matches the filter.
- table : string
name of the reference table
- filter : dict
each key is a column name, and the corresponding value is a possible table value in that column
- sortcol : string
the name of a column on which to sort the table rows (if there is more than one matching row), or None to disable sorting
- exactly_one : bool
set this to True if there must be one and only one matching row
- at_least_one : bool
set this to True if there must be at least one matching row
- match_rows : rec_array
an array of the rows of the table that match the filter; note that if only one row matches the filter, the function value will still be an array
Rotate a2displ, if MJD and DEGPERYR are in the trace table.
- trace_info : rec_array
an array of the relevant rows of the table; the A2DISPL column will be modified in-place if the MJD and DEGPERYR columns are present
- expstart : float
exposure start time (MJD)
sortrows(rowdata, sortcol, ascend=True)¶
Return a copy of rowdata, sorted on sortcol.