See also the cmd_states task.
Return a predefined cmd_set name generated with *args.
Parameters: |
|
---|---|
Returns: | cmd set |
Decode number of chips and feps from a ACIS power command Return a dictionary with the number of chips and their identifiers
Example:
>>> decode_power("WSPOW08F3E")
{'ccd_count': 5,
'ccds': 'I0 I1 I2 I3 S3 ',
'fep_count': 5,
'feps': '1 2 3 4 5 '}
Parameters: | mnem – power command string |
---|
Generate a set of commands based on the supplied cmd_set starting from the specified time.
The cmd_set is a list of command definitions like the output of read_backstop() but with an optional ‘dur’ key in each command and no absolute time values. This key specifies the duration of that command in seconds. Normally this routine is used with the predefined CMD_SET values.
Parameters: |
|
---|---|
Returns: | list of command dicts ala read_backstop() |
Get states resulting from the spacecraft commands cmds starting from an initial state0.
State keys in the exclude list or set will be excluded from causing a transition. This is useful if a state parameter (e.g. simfa_pos) is not of interest. An excluding parameter will have incorrect values in the returned states.
A state is a dict with key values corresponding to the following database schema:
Name | Type | Size |
---|---|---|
datestart | varchar | 21 |
datestop | varchar | 21 |
obsid | int | 4 |
power_cmd | varchar | 11 |
si_mode | varchar | 8 |
pcad_mode | varchar | 6 |
vid_board | bit | 1 |
clocking | bit | 1 |
fep_count | int | 4 |
ccd_count | int | 4 |
simpos | int | 4 |
simfa_pos | int | 4 |
pitch | float | 8 |
ra | float | 8 |
dec | float | 8 |
roll | float | 8 |
q1 | float | 8 |
q2 | float | 8 |
q3 | float | 8 |
q4 | float | 8 |
trans_keys | varchar | 60 |
letg | varchar | 4 |
hetg | varchar | 4 |
dither | varchar | 4 |
The input commands must be a list of dicts including keys date, vcdu, cmd, params, time. See also Ska.ParseCM.read_backstop().
Parameters: |
|
---|---|
Returns: | recarray of states starting with state0 (which might be modified) |
From the cmd_states table get the last state with datepar before date.
It is assumed that the cmd_states database table is populated and accurate (definitive) at times more than date_margin days before the present time. The conservative default value of date_margin=10 allows for processing downtime. The table is accessed via the db object.
Parameters: |
|
---|---|
Returns: | state0 |
Return type: | dict |
Get all commands with datestart < date <= datestop using DBI object db. This includes both commands already in the database and new commands. If update_db is True then update the database cmds table to reflect new and/or deleted commands.
Use datestart < date instead of <= because in typical ussage datestart is the start date of a state and one wants commands after those that generated the original state transition.
The timeline_loads table is relied upon as the final authority of which commands were (will be) run on-board. The timeline_load values can change in the database in the event of an autonomous or ground-commanded load segment interrupt. The strategy is to regenerate the list of commands that were (will be) run on-board using commands already in the database supplemented by backstop commands found in the SOTMP repository of load products.
Parameters: |
|
---|---|
Returns: | cmds |
Return type: | list of dicts |
Insert the cmds into the db table ‘cmds’ with timeline_id. Command parameters are also inserted into ‘cmd_intpars’ and ‘cmd_fltpars’ tables. timeline_id can be None to indicate non-load commands (from ground or autonomous).
Each command must be dict with at least the following keys:
date | char |
time | float |
cmd | char |
Optional keys are:
params | dict |
paramstr | char |
tlmsid | char |
msid | char |
vcdu | int |
step | int |
scs | int |
The input cmds are used to populate three tables:
cmds
name | type | length |
---|---|---|
id (PK) | int | 4 |
timeline_id | int | 4 |
date | char | 21 |
time | float | 8, |
cmd | varchar | 12 |
tlmsid | varchar | 10 |
msid | varchar | 8 |
vcdu | int | 4 |
step | int | 4 |
scs | int | 4 |
cmd_intpars and cmd_fltpars
name | type | length |
---|---|---|
cmd_id (FK) | int | 4 |
timeline_id (FK) | int | 4 |
name | varchar | 15 |
value | int/float | 8 |
Parameters: |
|
---|---|
Returns: | None |
Interpolate states np.recarray at given times.
Parameters: |
|
---|---|
Returns: | states view at times |
Interrupt the timelines with db.datestop > datestop by updating the table datestop accordingly. Use DBI handle db to access tables. If current_only is set then only update the load that actually contains datestop.
Parameters: |
|
---|---|
Returns: | None |
Reduce the input states so that only transitions in the cols columns are noticed.
Parameters: |
|
---|---|
Returns: | numpy recarray of reduced states |