States API¶
Command states¶
Provide functions for dynamically determining Chandra commanded states.
This is based entirely on known history of commands.
- class kadi.commands.states.ACISFP_SetPointTransition[source]¶
Bases:
BaseTransition
Implement transitions for ACIS focal plane temperature setpoint state.
Looks for ACISPKT commands with TLMSID like
WSFTNEG<number>
, where the ACIS FP setpoint temperature is-<number>
.State keys: acisfp_setpoint
Commands: type=ACISPKT
Others: default_value=-121.0, set_transitions=<classmethod(<function ACISFP_SetPointTransition.set_transitions at 0x7f9ed15dbe20>)>
- class kadi.commands.states.ACISTransition[source]¶
Bases:
BaseTransition
Implement transitions for ACIS states.
State keys: clocking, power_cmd, vid_board, fep_count, si_mode, ccd_count, obsid
Commands: type=ACISPKT
Others: set_transitions=<classmethod(<function ACISTransition.set_transitions at 0x7f9ed15dbd80>)>, simode_callback=<staticmethod(<function ACISTransition.simode_callback at 0x7f9ed15dbec0>)>
- class kadi.commands.states.AutoNPMDisableTransition[source]¶
Bases:
FixedTransition
Disable automatic transition to Normal Point Mode
State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: tlmsid=AONM2NPD
Others: transition_key=auto_npnt, transition_val=DISA
- class kadi.commands.states.AutoNPMEnableTransition[source]¶
Bases:
FixedTransition
Enable automatic transition to Normal Point Mode
State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: tlmsid=AONM2NPE
Others: transition_key=auto_npnt, transition_val=ENAB
- class kadi.commands.states.BaseTransition[source]¶
Bases:
object
Base transition class from which all actual transition classes are derived.
- classmethod get_state_changing_commands(cmds)[source]¶
Get commands that match the required attributes for state changing commands.
This depends on two class attributes that are defined in derived classes:
command_attributes
(required)dict of {cmd_attr: match_value, ..}, where
cmd_attr
is eithertype
ortlmsid
, andmatch_value
is the required value.command_params
(optional)dict of {cmd_attr: match_value, ..}, where
cmd_attr
is one of the available command parameters, andmatch_value
is either the required value or a list of required values (where at least one must match).
- Parameters:
- cmdsCommandTable
Input commands
- Returns:
- CommandTable
Subset of
cmds
relevant for this Transition class
- class kadi.commands.states.BatteryConnect[source]¶
Bases:
BaseTransition
Most recent battery connect time (type=COMMAND_SW and tlmsid=EOESTECN)
State keys: sun_pos_mon, battery_connect, eclipse_enable_spm
Commands: tlmsid=EOESTECN
Others: default_value=1999:001:00:00:00.000, set_transitions=<classmethod(<function BatteryConnect.set_transitions at 0x7f9ed15db380>)>
- class kadi.commands.states.DitherDisableTransition[source]¶
Bases:
FixedTransition
Dither disable
State keys: dither
Commands: tlmsid=AODSDITH
Others: transition_key=dither, transition_val=DISA
- class kadi.commands.states.DitherEnableTransition[source]¶
Bases:
FixedTransition
Dither enable
State keys: dither
Commands: tlmsid=AOENDITH
Others: transition_key=dither, transition_val=ENAB
- class kadi.commands.states.DitherParamsTransition[source]¶
Bases:
BaseTransition
Dither parameters
State keys: dither_phase_pitch, dither_phase_yaw, dither_ampl_pitch, dither_ampl_yaw, dither_period_pitch, dither_period_yaw
Commands: tlmsid=AODITPAR
Others: set_transitions=<classmethod(<function DitherParamsTransition.set_transitions at 0x7f9ed15db420>)>
- class kadi.commands.states.EclipseEnableSPM[source]¶
Bases:
BaseTransition
Flag to indicate whether SPM will be enabled 11 minutes after eclipse exit.
This is evaluated at the time of eclipse entry and checks that the most recent battery connect command (via the
battery_connect
state) was within 135 seconds of eclipse entry.See email thread “Criteria for SPM auto-enable following eclipse” around 2024-Feb-17 for more details on the 135 second threshold.
State keys: sun_pos_mon, battery_connect, eclipse_enable_spm
Commands: type=ORBPOINT, event_type=PENTRY or LSPENTRY
Others: default_value=False, BATTERY_CONNECT_MAX_DT=135, set_transitions=<classmethod(<function EclipseEnableSPM.set_transitions at 0x7f9ed15db240>)>, callback=<classmethod(<function EclipseEnableSPM.callback at 0x7f9ed15db2e0>)>
- class kadi.commands.states.EclipseEntryTimerTransition[source]¶
Bases:
ParamTransition
Eclipse entry timer update
State keys: eclipse_timer
Commands: tlmsid=EOECLETO
Others: transition_key=eclipse_timer, cmd_param_key=timecnt
- class kadi.commands.states.EclipsePenumbraEntryTransition[source]¶
Bases:
FixedTransition
Eclipse penumbra entry
State keys: eclipse
Commands: type=ORBPOINT, event_type=PENTRY or LSPENTRY
Others: transition_key=eclipse, transition_val=PENUMBRA
- class kadi.commands.states.EclipsePenumbraExitTransition[source]¶
Bases:
FixedTransition
Eclipse penumbra exit
State keys: eclipse
Commands: type=ORBPOINT, event_type=PEXIT or LSPEXIT
Others: transition_key=eclipse, transition_val=DAY
- class kadi.commands.states.EclipseUmbraEntryTransition[source]¶
Bases:
FixedTransition
Eclipse umbra entry
State keys: eclipse
Commands: type=ORBPOINT, event_type=EONIGHT
Others: transition_key=eclipse, transition_val=UMBRA
- class kadi.commands.states.EclipseUmbraExitTransition[source]¶
Bases:
FixedTransition
Eclipse umbra exit
State keys: eclipse
Commands: type=ORBPOINT, event_type=EODAY
Others: transition_key=eclipse, transition_val=PENUMBRA
- class kadi.commands.states.EphemerisTransition[source]¶
Bases:
ParamTransition
On-board ephemeris update values
State keys: aoephem1, aoephem2, aoratio, aoargper, aoeccent, ao1minus, ao1plus, aomotion, aoiterat, aoorbang, aoperige, aoascend, aosini, aoslr, aosqrtmu
Commands: tlmsid=AOEPHUPS
Others: transition_key=[‘aoephem1’, ‘aoephem2’, ‘aoratio’, ‘aoargper’, ‘aoeccent’, ‘ao1minus’, ‘ao1plus’, ‘aomotion’, ‘aoiterat’, ‘aoorbang’, ‘aoperige’, ‘aoascend’, ‘aosini’, ‘aoslr’, ‘aosqrtmu’], cmd_param_key=[‘aoephem1’, ‘aoephem2’, ‘aoratio’, ‘aoargper’, ‘aoeccent’, ‘ao1minus’, ‘ao1plus’, ‘aomotion’, ‘aoiterat’, ‘aoorbang’, ‘aoperige’, ‘aoascend’, ‘aosini’, ‘aoslr’, ‘aosqrtmu’]
- class kadi.commands.states.EphemerisUpdateTransition[source]¶
Bases:
BaseTransition
On-board ephemeris update date.
Mostly useful for the FOT to assist in backstop processing.
State keys: ephem_update
Commands: tlmsid=AOEPHUPS
Others: set_transitions=<classmethod(<function EphemerisUpdateTransition.set_transitions at 0x7f9ed15db060>)>
- class kadi.commands.states.FidsTransition[source]¶
Bases:
BaseTransition
Fid light transitions.
This sets the “fids” to a Python set of FID IDs that are currently on.
The relevant fid light commands are shown below. Basically it comes down to AFLCxxDy (fid id xx and driver y) commands, AFLCRSET and AFLCAAOF/AFLCAAON/AFLCABOF/AFLCABON commands. The latter four are never used (we don’t turn the fid light controllers on or off in loads). This table is from the CDB in
$SKA/data/Ska.tdb/cdb/p010/cdb_command.csv
.cmd_mnemonic technical_name ------------ --------------------------------------------- AFLC01D1 drive flca fid light 1 (acis-1) on driver 1 AFLC01D2 drive flca fid light 1 (acis-1) on driver 2 AFLC01D3 drive flca fid light 1 (acis-1) on driver 3 AFLC01D4 drive flca fid light 1 (acis-1) on driver 4 AFLC02D1 drive flca fid light 2 (acis-2) on driver 1 AFLC02D2 drive flca fid light 2 (acis-2) on driver 2 AFLC02D3 drive flca fid light 2 (acis-2) on driver 3 AFLC02D4 drive flca fid light 2 (acis-2) on driver 4 AFLC03D1 drive flca fid light 3 (acis-3) on driver 1 AFLC03D2 drive flca fid light 3 (acis-3) on driver 2 AFLC03D3 drive flca fid light 3 (acis-3) on driver 3 AFLC03D4 drive flca fid light 3 (acis-3) on driver 4 AFLC04D1 drive flca fid light 4 (acis-4) on driver 1 AFLC04D2 drive flca fid light 4 (acis-4) on driver 2 AFLC04D3 drive flca fid light 4 (acis-4) on driver 3 AFLC04D4 drive flca fid light 4 (acis-4) on driver 4 AFLC05D1 drive flca fid light 5 (acis-5) on driver 1 AFLC05D2 drive flca fid light 5 (acis-5) on driver 2 AFLC05D3 drive flca fid light 5 (acis-5) on driver 3 AFLC05D4 drive flca fid light 5 (acis-5) on driver 4 AFLC06D1 drive flca fid light 6 (acis-6) on driver 1 AFLC06D2 drive flca fid light 6 (acis-6) on driver 2 AFLC06D3 drive flca fid light 6 (acis-6) on driver 3 AFLC06D4 drive flca fid light 6 (acis-6) on driver 4 AFLC07D1 drive flca fid light 7 (hrc-i-1) on driver 1 AFLC08D2 drive flca fid light 8 (hrc-i-2) on driver 2 AFLC09D3 drive flca fid light 9 (hrc-i-3) on driver 3 AFLC10D4 drive flca fid light 10 (hrc-i-4) on driver 4 AFLC11D1 drive flca fid light 11 (hrc-s-1) on driver 1 AFLC12D2 drive flca fid light 12 (hrc-s-3) on driver 2 AFLC13D3 drive flca fid light 13 (hrc-s-2) on driver 3 AFLC14D4 drive flca fid light 14 (hrc-s-4) on driver 4 AFLCAAOF flca - a off AFLCAAON flca - a on AFLCABOF flca - b off AFLCABON flca - b on AFLCRSET flca configuration reset
State keys: fids
Commands: tlmsid=AFIDP
Others: set_transitions=<classmethod(<function FidsTransition.set_transitions at 0x7f9ed15dbf60>)>, fids_callback=<staticmethod(<function FidsTransition.fids_callback at 0x7f9ed15ec040>)>
- class kadi.commands.states.FixedTransition[source]¶
Bases:
BaseTransition
Transitions for fixed attribute.
This is for the case of an attribute that gets set to a fixed value when the command occurs, e.g. pcad_mode=’NMAN’ for AONMMODE.
Class attributes:
- Parameters:
transition_key – single transition key or list of transition keys
transition_val – single transition value or list of values
- class kadi.commands.states.Format1_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry format 1
State keys: format
Commands: tlmsid=CSELFMT1
Others: transition_key=format, transition_val=FMT1
- class kadi.commands.states.Format2_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry format 2
State keys: format
Commands: tlmsid=CSELFMT2
Others: transition_key=format, transition_val=FMT2
- class kadi.commands.states.Format3_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry format 3
State keys: format
Commands: tlmsid=CSELFMT3
Others: transition_key=format, transition_val=FMT3
- class kadi.commands.states.Format4_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry format 4
State keys: format
Commands: tlmsid=CSELFMT4
Others: transition_key=format, transition_val=FMT4
- class kadi.commands.states.Format5_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry format 5
State keys: format
Commands: tlmsid=CSELFMT5
Others: transition_key=format, transition_val=FMT5
- class kadi.commands.states.Format6_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry format 6
State keys: format
Commands: tlmsid=CSELFMT6
Others: transition_key=format, transition_val=FMT6
- class kadi.commands.states.HETG_INSR_Transition[source]¶
Bases:
MechMove
HETG insertion
State keys: letg, hetg, grating
Commands: tlmsid=4OHETGIN
Others: transition_key=[‘hetg’, ‘grating’], transition_val=[‘INSR’, ‘HETG’], move_duration=157.0 s
- class kadi.commands.states.HETG_RETR_Transition[source]¶
Bases:
MechMove
HETG retraction
State keys: letg, hetg, grating
Commands: tlmsid=4OHETGRE
Others: transition_key=[‘hetg’, ‘grating’], transition_val=[‘RETR’, ‘NONE’], move_duration=153.0 s
- class kadi.commands.states.Hrc15vOff_Transition[source]¶
Bases:
FixedTransition
HRC 15V OFF
State keys: hrc_15v
Commands: tlmsid=215PCAOF
Others: transition_key=hrc_15v, transition_val=OFF
- class kadi.commands.states.Hrc15vOn_SCS134_Transition[source]¶
Bases:
FixedTransition
HRC 15V ON from SCS-134
State keys: hrc_15v
Commands: tlmsid=COACTSX, coacts1=134
Others: transition_key=hrc_15v, transition_val=ON
- class kadi.commands.states.Hrc15vOn_Transition[source]¶
Bases:
FixedTransition
HRC 15V ON from hardware 215PCAON command
State keys: hrc_15v
Commands: tlmsid=215PCAON
Others: transition_key=hrc_15v, transition_val=ON
- class kadi.commands.states.Hrc24vOff_Transition[source]¶
Bases:
FixedTransition
HRC 24V OFF
State keys: hrc_24v
Commands: tlmsid=224PCAOF
Others: transition_key=hrc_24v, transition_val=OFF
- class kadi.commands.states.Hrc24vOn_Transition[source]¶
Bases:
FixedTransition
HRC 24V ON
State keys: hrc_24v
Commands: tlmsid=224PCAON
Others: transition_key=hrc_24v, transition_val=ON
- class kadi.commands.states.HrcIOff_Transition[source]¶
Bases:
FixedTransition
HRC-I OFF
State keys: hrc_i
Commands: tlmsid=2IMHVOF
Others: transition_key=hrc_i, transition_val=OFF
- class kadi.commands.states.HrcIOn_Transition[source]¶
Bases:
FixedTransition
HRC-I ON
State keys: hrc_i
Commands: tlmsid=COENASX, coenas1=89
Others: transition_key=hrc_i, transition_val=ON
- class kadi.commands.states.HrcSOff_Transition[source]¶
Bases:
FixedTransition
HRC-S OFF
State keys: hrc_s
Commands: tlmsid=2SPHVOF
Others: transition_key=hrc_s, transition_val=OFF
- class kadi.commands.states.HrcSOn_Transition[source]¶
Bases:
FixedTransition
HRC-S ON
State keys: hrc_s
Commands: tlmsid=COENASX, coenas1=90
Others: transition_key=hrc_s, transition_val=ON
- class kadi.commands.states.LETG_INSR_Transition[source]¶
Bases:
MechMove
LETG insertion
State keys: letg, hetg, grating
Commands: tlmsid=4OLETGIN
Others: transition_key=[‘letg’, ‘grating’], transition_val=[‘INSR’, ‘LETG’], move_duration=203.0 s
- class kadi.commands.states.LETG_RETR_Transition[source]¶
Bases:
MechMove
LETG retraction
State keys: letg, hetg, grating
Commands: tlmsid=4OLETGRE
Others: transition_key=[‘letg’, ‘grating’], transition_val=[‘RETR’, ‘NONE’], move_duration=203.0 s
- class kadi.commands.states.ManeuverSunPitchTransition[source]¶
Bases:
ManeuverTransition
Like
ManeuverTransition
except perform a pure-pitch maneuver from attitude.This does not change the PCAD mode.
State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: type=LOAD_EVENT, tlmsid=SUN_PITCH
Others: set_transitions=<classmethod(<function ManeuverSunPitchTransition.set_transitions at 0x7f9ed15dba60>)>, callback=<staticmethod(<function ManeuverSunPitchTransition.callback at 0x7f9ed15dbb00>)>
- class kadi.commands.states.ManeuverSunRaslTransition[source]¶
Bases:
ManeuverTransition
Like
ManeuverTransition
except roll about the sun line.This does not change the PCAD mode.
State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: type=LOAD_EVENT, tlmsid=SUN_RASL
Others: set_transitions=<classmethod(<function ManeuverSunRaslTransition.set_transitions at 0x7f9ed15dbba0>)>, callback=<staticmethod(<function ManeuverSunRaslTransition.callback at 0x7f9ed15dbc40>)>
- class kadi.commands.states.ManeuverTransition[source]¶
Bases:
BaseTransition
Execute maneuver.
This is a relatively complex transition that computes the intermediate quaternion values for the maneuver and inserts downstream transitions to perform attitude quaternion updated accordingly. At the end of the maneuver it schedules a NPM transition if
auto_npnt
is enabled.State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: tlmsid=AOMANUVR
Others: set_transitions=<classmethod(<function ManeuverTransition.set_transitions at 0x7f9ed15db600>)>, callback=<classmethod(<function ManeuverTransition.callback at 0x7f9ed15db7e0>)>, add_manvr_transitions=<classmethod(<function ManeuverTransition.add_manvr_transitions at 0x7f9ed15db6a0>)>
- class kadi.commands.states.MechMove[source]¶
Bases:
FixedTransition
Transitions for mech moves that have non-zero duration.
This adds two transitions per matched command: - First one at cmd time with the transition value with
_MOVE
appended - Second one at cmd time + move_duration with the straight transition valueThis inherits from FixedTransition for the case of an attribute that gets set to a fixed value when the command occurs, e.g. pcad_mode=’NMAN’ for AONMMODE.
Class attributes:
- Parameters:
transition_key – single transition key or list of transition keys
transition_val – single transition value or list of values
move_duration – duration of the move (astropy time Quantity)
apply_move_duration – if True, apply the move duration to states
- class kadi.commands.states.NMM_Transition[source]¶
Bases:
FixedTransition
Transition to Normal Maneuver Mode
State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: tlmsid=AONMMODE
Others: transition_key=pcad_mode, transition_val=NMAN
- class kadi.commands.states.NPM_Transition[source]¶
Bases:
FixedTransition
Transition to Normal Point Mode
State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: tlmsid=AONPMODE
Others: transition_key=pcad_mode, transition_val=NPNT
- exception kadi.commands.states.NoTransitionsError[source]¶
Bases:
ValueError
No transitions found within commands
- class kadi.commands.states.NormalSunTransition[source]¶
Bases:
ManeuverTransition
Same as
ManeuverTransition
except perform maneuver to NSM.This uses ska_sun.get_nsm_attitude() to get the NSM attitude, potentially at an offset pitch like 160 degrees. It also changes
pcad_mode
to NSUN.State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: tlmsid=AONSMSAF
Others: pcad_mode=NSUN, set_transitions=<classmethod(<function NormalSunTransition.set_transitions at 0x7f9ed15db740>)>, callback=<staticmethod(<function NormalSunTransition.callback at 0x7f9ed15db880>)>
- class kadi.commands.states.ObsidTransition[source]¶
Bases:
ParamTransition
Obsid update
State keys: obsid
Commands: type=MP_OBSID
Others: transition_key=obsid, cmd_param_key=id
- class kadi.commands.states.OrbitPointTransition[source]¶
Bases:
ParamTransition
Orbit point state based on backstop ephemeris entries
State keys: orbit_point
Commands: type=ORBPOINT
Others: transition_key=orbit_point, cmd_param_key=event_type
- class kadi.commands.states.ParamTransition[source]¶
Bases:
BaseTransition
Transitions for case of attribute that gets set to value defined by cmd param.
E.g.
obsid
=ID
parameter ofCOBRQID
command.Class attributes:
- Parameters:
transition_key – single transition key or list of transition keys
cmd_param_key – command parameter name (str or list of str)
- class kadi.commands.states.RadmonDisableTransition[source]¶
Bases:
FixedTransition
RADMON disable
State keys: radmon
Commands: tlmsid=OORMPDS
Others: transition_key=radmon, transition_val=DISA
- class kadi.commands.states.RadmonEnableTransition[source]¶
Bases:
FixedTransition
RADMON enable
State keys: radmon
Commands: tlmsid=OORMPEN
Others: transition_key=radmon, transition_val=ENAB
- class kadi.commands.states.SCS84DisableTransition[source]¶
Bases:
FixedTransition
SCS-84 disable
State keys: scs84
Commands: tlmsid=CODISASX, codisas1=84
Others: transition_key=scs84, transition_val=DISA
- class kadi.commands.states.SCS84EnableTransition[source]¶
Bases:
FixedTransition
SCS-84 enable
State keys: scs84
Commands: tlmsid=COENASX, coenas1=84
Others: transition_key=scs84, transition_val=ENAB, default_value=DISA
- class kadi.commands.states.SCS98DisableTransition[source]¶
Bases:
FixedTransition
SCS-98 disable
State keys: scs98
Commands: tlmsid=CODISASX, codisas1=98
Others: transition_key=scs98, transition_val=DISA
- class kadi.commands.states.SCS98EnableTransition[source]¶
Bases:
FixedTransition
SCS-98 enable
State keys: scs98
Commands: tlmsid=COENASX, coenas1=98
Others: transition_key=scs98, transition_val=ENAB
- class kadi.commands.states.SPMDisableTransition[source]¶
Bases:
FixedTransition
Sun position monitor disable
State keys: sun_pos_mon, battery_connect, eclipse_enable_spm
Commands: tlmsid=AOFUNCDS, aopcadsd=30
Others: transition_key=sun_pos_mon, transition_val=DISA
- class kadi.commands.states.SPMEclipseEnableTransition[source]¶
Bases:
BaseTransition
Automatic enable of sun position monitor.
This occurs 11 minutes after eclipse exit, but only if the battery-connect command occurs within 135 seconds of eclipse entry.
Connect batteries is an event type COMMAND_SW and TLMSID= EOESTECN Eclipse entry is event type ORBPOINT with TYPE=PENTRY or TYPE=LSPENTRY Eclipse exit is event type ORBPOINT with TYPE=PEXIT or TYPE=LSPEXIT
State keys: sun_pos_mon, battery_connect, eclipse_enable_spm
Commands: type=ORBPOINT, event_type=PEXIT or LSPEXIT
Others: default_value=False, set_transitions=<classmethod(<function SPMEclipseEnableTransition.set_transitions at 0x7f9ed15db100>)>, callback=<classmethod(<function SPMEclipseEnableTransition.callback at 0x7f9ed15db1a0>)>
- class kadi.commands.states.SPMEnableTransition[source]¶
Bases:
FixedTransition
Sun position monitor enable
State keys: sun_pos_mon, battery_connect, eclipse_enable_spm
Commands: tlmsid=AOFUNCEN, aopcadse=30
Others: transition_key=sun_pos_mon, transition_val=ENAB
- class kadi.commands.states.SafeSunTransition[source]¶
Bases:
NormalSunTransition
Similar to
NormalSunTransition
but in Safe Sun Mode with pcad_mode = STBY.This uses ska_sun.get_nsm_attitude() to get the NSM attitude, potentially at an offset pitch like 160 degrees. It also changes
pcad_mode
to STBY.State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: tlmsid=ACPCSFSU
Others: pcad_mode=STBY
- class kadi.commands.states.SimFocusTransition[source]¶
Bases:
ParamTransition
SIM focus assembly translation
State keys: simfa_pos
Commands: type=SIMFOCUS
Others: transition_key=simfa_pos, cmd_param_key=pos
- class kadi.commands.states.SimTscTransition[source]¶
Bases:
ParamTransition
SIM translating science compartment translation
State keys: simpos
Commands: type=SIMTRANS
Others: transition_key=simpos, cmd_param_key=pos
- class kadi.commands.states.StateDict(*args, **kwargs)[source]¶
Bases:
dict
Dict for state key/val pairs.
When a key value is set the key is stored in the trans_keys attribute.
- class kadi.commands.states.SubFormatEPS_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry EPS subformat
State keys: subformat
Commands: tlmsid=OFMTSEPS
Others: transition_key=subformat, transition_val=EPS
- class kadi.commands.states.SubFormatNRM_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry NRM subformat
State keys: subformat
Commands: tlmsid=OFMTSNRM
Others: transition_key=subformat, transition_val=NORM
- class kadi.commands.states.SubFormatPDG_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry PDG subformat
State keys: subformat
Commands: tlmsid=OFMTSPDG
Others: transition_key=subformat, transition_val=PDG
- class kadi.commands.states.SubFormatSSR_Transition[source]¶
Bases:
FixedTransition
Transition to telemetry SSR subformat
State keys: subformat
Commands: tlmsid=OFMTSSSR
Others: transition_key=subformat, transition_val=SSR
- class kadi.commands.states.SunVectorTransition[source]¶
Bases:
BaseTransition
Add transitions between start/stop every 10 ksec.
This is to sample the pitch and off_nominal roll during NPNT. These are function transitions which check to see that
pcad_mode == 'NPNT'
before changing the pitch / off_nominal_roll.State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Others: set_transitions=<classmethod(<function SunVectorTransition.set_transitions at 0x7f9ed15dade0>)>, update_sun_vector_state=<classmethod(<function SunVectorTransition.update_sun_vector_state at 0x7f9ed15db4c0>)>
- classmethod set_transitions(transitions_dict, cmds, start, stop)[source]¶
Set transitions for a Table of commands
cmds
.- Parameters:
- transitions_dict
global dict of transitions (updated in-place)
- cmds
commands (CmdList)
- start
start time for states
- stop
stop time for states
- Returns:
- None
- classmethod update_sun_vector_state(date, transitions, state, idx)[source]¶
Transition callback method for
pitch
/off_nom_roll
states.This will potentially update the
pitch
andoff_nom_roll
states if pcad_mode is NPNT.- Parameters:
- date
date (str)
- transitions
global list of transitions
- state
current state (dict)
- idx
current index into transitions
- class kadi.commands.states.TargQuatTransition[source]¶
Bases:
BaseTransition
Commanded target quaternion
State keys: q1, q2, q3, q4, targ_q1, targ_q2, targ_q3, targ_q4, ra, dec, roll, auto_npnt, pcad_mode, pitch, off_nom_roll
Commands: type=MP_TARGQUAT
Others: set_transitions=<classmethod(<function TargQuatTransition.set_transitions at 0x7f9ed15db560>)>
- class kadi.commands.states.TransKeysSet[source]¶
Bases:
set
Like set() but with more compact str output for table printing
- class kadi.commands.states.TransitionMeta(name, bases, members)[source]¶
Bases:
type
Metaclass that adds the class to the TRANSITIONS dict.
This is keyed by state_keys from the TRANSITIONS_CLASSES set, and makes the complete list of STATE_KEYS.
- kadi.commands.states.add_transition(transitions, idx, transition)[source]¶
Add
transition
to thetransitions
list.This is done at the first appropriate place after the
idx
entry.This is typically used by dynamic transitions that are actually calling a function to generate downstream transitions. The ManeuverTransition class is the canonical example.
- Parameters:
- transitions
global list of transition dicts
- idx
current index into transitions in state processing
- transition
transition to add (dict)
- Returns:
- None
- kadi.commands.states.decode_power(mnem)[source]¶
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 ', 'clocking': 0, 'fep_count': 5, 'feps': '1 2 3 4 5 ', 'vid_board': 1}
- Parameters:
- mnem
power command string
- kadi.commands.states.disable_grating_move_duration()[source]¶
Temporarily disable the grating move duration
- kadi.commands.states.get_chandra_states(main_args=None)[source]¶
Command line interface to output commanded states over a date range.
The output is in tabular form to stdout or a file.
- kadi.commands.states.get_continuity(date=None, state_keys=None, lookbacks=(7, 30, 180, 1000), scenario=None)[source]¶
Get the state and transition dates at
date
forstate_keys
.This function finds the state at a particular date by fetching commands prior to that date and determine the states. It returns dictionary
continuity
provides the state values. Included in this dict is a special key__dates__
which provides the corresponding date at which the state-changing command occurred.Since some state keys like
pitch
change often (many times per day) while others likeletg
may not change for weeks, this function does dynamic lookbacks fromdate
to find transitions for each key. By default it will try looking back 7 days, then 30 days, then 180 days, and finally 1000 days. This lookback sequence can be controlled with thelookbacks
argument.If
state_keys
isNone
then the default keysstates.DEFAULT_STATE_KEYS
is used. This corresponds to the “classic” Chandra commanded states (obsid, ACIS, PCAD, and mechanisms).- Parameters:
- date
date (DateTime compatible, default=NOW)
- state_keys
list of state keys or str (one state key) or None
- lookbacks
list of lookback times in days (default=[7, 30, 180, 1000])
- scenario
commands archive scenario (default=None)
- Returns:
- dict of state values
- kadi.commands.states.get_states(start=None, stop=None, state_keys=None, cmds=None, continuity=None, reduce=True, merge_identical=False, scenario=None) Table [source]¶
Get table of states for intervals when
state_keys
params are unchanged.If
state_keys
isNone
then the default keysstates.DEFAULT_STATE_KEYS
is used. This corresponds to the “classic” Chandra commanded states (obsid, ACIS, PCAD, and mechanisms). One can also provide a single state key as a a string, e.g.state_keys='obsid'
.If the
cmds
argument is not provided then thestart
andstop
are used to fetch the commands internally. If thestop
date is not provided then all known commands (including future commands from approved loads) will be included.The output table will contain columns for
state_keys
along withdatestart
anddatestop
columns. By default thereduce_states
function is called (with the supplied value ofmerge_identical
) in order to reduce down to the specifiedstate_keys
.If
reduce
isFalse
thenreduce_states
is not called and output table may include additional columns for related states. For instance in order to compute the attitude quaternion stateq1
it is necessary to collect a number of other states such aspcad_mode
and target quaternionstarg_q1
throughtarg_q4
. One can call thereduce_states()
function separately to reduce to only the desired state keys.- Parameters:
- start
start of states (optional, DateTime compatible)
- stop
stop of states (optional, DateTime compatible)
- state_keys
state keys of interest (optional, list or str or None)
- cmds
input commands (optional, CmdList, CommandTable)
- continuity
initial state (optional, dict)
- reduce
call reduce_states() on output
- merge_identical
merge identical states (see reduce_states() docs)
- scenario
commands archive scenario to use
- Returns:
- astropy Table of states
- kadi.commands.states.get_transition_classes(state_keys=None)[source]¶
Get BaseTransition subclasses in module for
state_keys
.
- kadi.commands.states.get_transitions_list(cmds, state_keys, start, stop, continuity=None)[source]¶
Get transitions for given set of
cmds
andstate_keys
.A
transition
here defines a state transition. It is a dict with adate
key (date of transition) and key/value pairs corresponding to the state keys that change.If
state_keys
is None then all known state keys are included.- Parameters:
- cmds
CmdList with spacecraft commands
- state_keys
desired state keys (None, str, or list)
- Returns:
- list of dict (transitions), set of transition classes
- kadi.commands.states.interpolate_states(states, times)[source]¶
Interpolate
states
table at given times.- Parameters:
- states
states (astropy states Table)
- times
times (np.array or any DateTime compatible input)
- Returns:
states
view attimes
- kadi.commands.states.print_state_keys_transition_classes_docs()[source]¶
Sort transition classes into a data structure keyed by state_keys
- kadi.commands.states.reduce_states(states, state_keys, merge_identical=False, all_keys=False) Table [source]¶
Reduce input
states
so only transitions instate_keys
are in output.By default this also reduces the states table to only include columns for those
state_keys
, but if theall_keys
argument isTrue
then all columns are included in the output.By default, the output table will reflect every state transition generated by commands even if this does not change the state value. This allows uniquely identifying the time of such commanding related to a state value. A common example of transition commanding that does not change state is the pair of ACIS stop science commands, where the second is redundant.
However, if
merge_identical
is True then adacent states with identical values will be merged.- Parameters:
- states
table of states
- state_keys
notice transitions in this list of state keys
- merge_identical
merge adjacent identical states
- all_keys
if True, then all state keys are included in the output
- Returns:
- Table of reduced states