kadi.commands.read_backstop#

kadi.commands.read_backstop(backstop, add_observations=False, load_name=None)#

Read backstop and return a CommandTable.

The backstop argument can be either be a string or Path to a backstop file or a list of lines from a backstop file.

If add_observations is True then add OBS commands (default=False) into the returned CommandTable. This allows the returned CommandTable to be used in calls to get_observations and get_starcats.

If load_name is provided then this is used for the “source” column in the returned table.

If load_name is not provided, the default is to use the load name if it can be determined from the backstop directory path. This path must follow the SOT MP naming convention where the directory path containing the backstop file looks like <prefix>/<YEAR>/<MON><DD><YY>/ofls<REV>/*.backstop. An example would be /proj/sot/ska/data/mpcrit1/mplogs/2023/DEC1123/oflsa/CR344_2303.backstop.

If reading a backstop file from a local directory or from a list of lines then the load name should be provided explicitly.

Parameters:
backstop: str or Path or list of str

Backstop file name or path, or backstop file contents as a list of str

add_observationsbool

Add OBS commands (default=False) to allow get_observations() and get_starcats()

load_namestr, optional

Load name to use for “source” column if provided.

Returns:
CommandTable of commands

Examples

>>> import kadi.commands as kc
>>> import parse_cm.paths
>>> path = parse_cm.paths.load_file_path('DEC1123A', "CR*.backstop", "backstop")
>>> cmds = kc.read_backstop(path, add_observations=True)
>>> obss = kc.get_observations(cmds=cmds)
>>> starcats = kc.get_starcats(cmds=cmds)