Package stistools :: Module gettable
[hide private]
[frames] | no frames]

Module gettable

source code

Functions [hide private]
record array (a pyfits table data object)
getTable(table, filter, sortcol=None, exactly_one=False, at_least_one=False)
Return row(s) of a table that match the filter.
source code
 
sortrows(rowdata, sortcol, ascend=True)
Return a copy of rowdata, sorted on sortcol.
source code
 
rotateTrace(trace_info, expstart)
Rotate a2displ, if MJD and DEGPERYR are in the trace table.
source code
Variables [hide private]
  STRING_WILDCARD = 'ANY'
  INT_WILDCARD = -1
  __package__ = 'stistools'

Imports: os, math, N, pyfits


Function Details [hide private]

getTable(table, filter, sortcol=None, exactly_one=False, at_least_one=False)

source code 

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.

Parameters:
  • table (string) - name of the reference table
  • filter (dictionary) - 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 (boolean) - set this to True if there must be one and only one matching row
  • at_least_one (boolean) - set this to True if there must be at least one matching row
Returns: record array (a pyfits table data object)
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

rotateTrace(trace_info, expstart)

source code 

Rotate a2displ, if MJD and DEGPERYR are in the trace table.

Parameters:
  • trace_info (record array (a pyfits table data object)) - 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)