Events API¶
Event models¶
- class kadi.events.models.AsciiTableEvent(*args, **kwargs)[source]¶
Base class for events defined by a simple quasi-static text table file. Subclasses need to define the file name (lives in DATA_DIR()/<filename>) and the start and stop column names.
- class kadi.events.models.BaseEvent(*args, **kwargs)[source]¶
Base class for any event that gets updated in update_events.main(). Note that BaseModel is the base class for models like ManvrSeq that get generated as part of another event class.
- class kadi.events.models.BaseModel(*args, **kwargs)[source]¶
Base class for for all models.
- class QuerySet(model=None, query=None, using=None, hints=None)[source]¶
More user-friendly output from event queries.
- select_overlapping(query_event, allow_partial=True)[source]¶
Select events which overlap with the specified
query_event
.By default partial overlap between the self events and the
query_event
intervals is sufficient. However, ifallow_partial=False
, then complete overlap is required. As an example this would be selecting maneuvers that are entirely within the radiation zone.Examples:
>>> from kadi import events >>> manvrs = events.manvrs.filter('2001:001:00:00:00', '2001:003:00:00:00') >>> non_rad_manvrs = manvrs.select_overlapping(~events.rad_zones) >>> rad_manvrs = manvrs.select_overlapping(events.rad_zones) >>> fully_radzone_manvrs = manvrs.select_overlapping(events.rad_zones, ... allow_partial=False)
- Parameters:
query_event – QueryEvent object (e.g. events.tsc_moves or a composite boolean expression)
allow_partial – return events where there is at least partial overlap (default=True)
- Returns:
list of overlapping events
- classmethod from_dict(model_dict, logger=None)[source]¶
Set model from a dict model_dict which might have extra stuff not in Model. If logger is supplied then log output at debug level.
- class kadi.events.models.CAP(*args, **kwargs)[source]¶
CAP from iFOT database
Event definition: CAP from iFOT database
Fields
Field
Type
Description
ifot_id
Integer
iFOT identifier
start
Char(21)
Start time (date)
stop
Char(21)
Stop time (date)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
num
Char(15)
CAP number
title
Text
CAP title
descr
Text
CAP description
notes
Text
CAP notes
link
Char(250)
CAP link
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.DarkCal(*args, **kwargs)[source]¶
ACA dark current calibration event
Event definition: interval where
CIUMACAC = ON
CIUMACAC is the IU MODE ACA CALIBRATION INDICATOR. Individual intervals within one day are joined together to a single calibration event.
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.DarkCalReplica(*args, **kwargs)[source]¶
ACA dark current calibration replica
Event definition: interval where
CIUMACAC = ON
CIUMACAC is the IU MODE ACA CALIBRATION INDICATOR.
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.DsnComm(*args, **kwargs)[source]¶
DSN comm period
- Event definition: DSN comm pass beginning of support to end of support (not
beginning / end of track).
Fields
Field
Type
Description
ifot_id
Integer
iFOT identifier
start
Char(21)
Start time (date)
stop
Char(21)
Stop time (date)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
bot
Char(4)
Beginning of track
eot
Char(4)
End of track
activity
Char(30)
Activity description
config
Char(10)
Configuration
data_rate
Char(9)
Data rate
site
Char(12)
DSN site
soe
Char(4)
DSN Sequence Of Events
station
Char(6)
DSN station
oc
Char(30)
OC crew
cc
Char(30)
CC crew
pass_plan
OneToOne
Pass plan
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.Dump(*args, **kwargs)[source]¶
Momentum unload either ground commanded or autonomous
Event definition: interval where
AOUNLOAD = GRND
orAOUNLOAD = AUTO
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
type
Char(4)
Momentum unload type (GRND AUTO)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- classmethod get_state_times_bools(event_msidset)[source]¶
Get the boolean True/False array indicating when
event_msid
is in the desired state for this event type. The default is whenevent_msid == cls.event_val
, but subclasses may override this method.- Parameters:
- event_msid
fetch.MSID object
- Returns:
- boolean ndarray
- class kadi.events.models.Dwell(*args, **kwargs)[source]¶
Dwell in Kalman mode
Event definition: contiguous interval of AOACASEQ = KALM between:
Start: AOACASEQ ==> KALM (transition from any state to KALM) Stop: AOACASEQ ==> not KALM (transition to any state other than KALM) **or** AOPCADMD ==> NMAN
Short Kalman dwells that are less than 400 seconds long are ignored and are not recorded in the database. These are typically associated with monitor window commanding or multiple acquisition attempts).
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
rel_tstart
Float
Start time relative to manvr end (sec)
manvr
ForeignKey
Maneuver that contains this dwell
ra
Float
Right ascension (deg)
dec
Float
Declination (deg)
roll
Float
Roll angle (deg)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.Eclipse(*args, **kwargs)[source]¶
Event definition: interval where
AOECLIPS = ECL
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.FaMove(*args, **kwargs)[source]¶
SIM FA translation
Event definition: interval where
3FAMOVE = MOVE
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
start_3fapos
Integer
Start FA position (steps)
stop_3fapos
Integer
Stop FA position (steps)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.GratingMove(*args, **kwargs)[source]¶
Grating movement (HETG or LETG)
Event definition: interval with 4MP28AV > 2.0 V (MCE A + 28 VOLT MONITOR)
This event detects grating motion via the MCE-A 28 volt monitor. Due to changes in the on-board software over the years, this appears to be the most reliable method.
Short movements of less than 4 seconds are classified with grating=BUMP. In a handful of cases in 2000, there are intervals with 4MP28AV > 2.0 where no grating motion is seen. These have grating=UNKN (unknown).
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
start_4lposaro
Float
Start LETG position (degrees)
stop_4lposaro
Float
Stop LETG position (degrees)
start_4hposaro
Float
Start HETG position (degrees)
stop_4hposaro
Float
Stop HETG position (degrees)
grating
Char(4)
Grating in motion (UNKN LETG HETG BUMP)
direction
Char(4)
Grating direction (UNKN INSR RETR)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- classmethod get_extras(event, event_msidset)[source]¶
Define start/stop grating positions for HETG and LETG
- classmethod get_state_times_bools(event_msidset)[source]¶
Get the boolean True/False array indicating when
event_msid
is in the desired state for this event type. The default is whenevent_msid == cls.event_val
, but subclasses may override this method.- Parameters:
- event_msid
fetch.MSID object
- Returns:
- boolean ndarray
- class kadi.events.models.IFotEvent(*args, **kwargs)[source]¶
Base class for events from the iFOT database
- class kadi.events.models.IntervalPad[source]¶
Data descriptor that sets and gets an interval pad. This pad has two values that are applied to the start and stop times for an interval, respectively.
- class kadi.events.models.LoadSegment(*args, **kwargs)[source]¶
Load segment
Event definition: Load segment from iFOT database
Fields
Field
Type
Description
ifot_id
Integer
iFOT identifier
start
Char(21)
Start time (date)
stop
Char(21)
Stop time (date)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
name
Char(12)
Load segment name
scs
Integer
SCS slot
load_name
Char(10)
Load name
comment
Text
Comment
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.LttBad(*args, **kwargs)[source]¶
LTT bad intervals
Fields
Field
Type
Description
key
Char(38)
Unique key for this event
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
msid
Char(20)
MSID
flag
Char(2)
Flag
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.MajorEvent(*args, **kwargs)[source]¶
Major event
- Event definition: events from the two lists maintained by the FOT and
the FDB (systems engineering).
Two lists of major event related to Chandra are available on OCCweb:
http://occweb.cfa.harvard.edu/occweb/web/fot_web/eng/reports/Chandra_major_events.htm
http://occweb.cfa.harvard.edu/occweb/web/fdb_web/Major_Events.html
These two event lists are scraped from OCCweb and merged into a single list with a common structure. Unlike most kadi event types, the MajorEvent class does not represent an interval of time (
start
andstop
) but only hasstart
(YYYY:DOY) anddate
(YYYY-Mon-DD) attributes to indicate the time.Fields
Field
Type
Description
key
Char(24)
Unique key for this event
start
Char(8)
Event time to the nearest day (YYYY:DOY)
date
Char(11)
Event time to the nearest day (YYYY-Mon-DD)
tstart
Float
Event time to the nearest day (CXC sec)
descr
Text
Event description
note
Text
Note (comments or CAP # or FSW PR #)
source
Char(3)
Event source (FDB or FOT)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.Manvr(*args, **kwargs)[source]¶
Maneuver
Event definition: interval where
AOFATTMD = MNVR
(spacecraft actually maneuvering)The maneuver event includes a number of attributes that give a detailed characterization of the timing and nature of the maneuver and corresponding star acquisitions and normal point model dwells.
The
start
andstop
time attributes for a maneuver event correspond exactly to the start and stop of the actual maneuver. However, the full maneuver event contains information covering a larger time span from the end of the previous maneuver to the start of the next maneuver:Previous maneuver <---- Start of included information Previous MANV end Previous NPNT start ==> Maneuver <== Star acquisition Transition to KALM Kalman dwell Optional: more dwells, star acq sequences, NMAN/NPNT Transition to NMAN Transition to MANV <---- End of included information Next maneuver
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
prev_manvr_stop
Char(21)
Stop time of previous AOFATTMD=MNVR before manvr
prev_npnt_start
Char(21)
Start time of previous AOPCADMD=NPNT before manvr
nman_start
Char(21)
Start time of AOPCADMD=NMAN for manvr
manvr_start
Char(21)
Start time of AOFATTMD=MNVR for manvr
manvr_stop
Char(21)
Stop time of AOFATTMD=MNVR for manvr
npnt_start
Char(21)
Start time of AOPCADMD=NPNT after manvr
acq_start
Char(21)
Start time of AOACASEQ=AQXN after manvr
guide_start
Char(21)
Start time of AOACASEQ=GUID after manvr
kalman_start
Char(21)
Start time of AOACASEQ=KALM after manvr
aca_proc_act_start
Char(21)
Start time of AOPSACPR=ACT after manvr
npnt_stop
Char(21)
Stop time of AOPCADMD=NPNT after manvr
next_nman_start
Char(21)
Start time of next AOPCADMD=NMAN after manvr
next_manvr_start
Char(21)
Start time of next AOFATTMD=MNVR after manvr
n_dwell
Integer
Number of kalman dwells after manvr and before next manvr
n_acq
Integer
Number of AQXN intervals after manvr and before next manvr
n_guide
Integer
Number of GUID intervals after manvr and before next manvr
n_kalman
Integer
Number of KALM intervals after manvr and before next manvr
anomalous
Boolean
Key MSID shows off-nominal value
template
Char(16)
Matched maneuver template
start_ra
Float
Start right ascension before manvr
start_dec
Float
Start declination before manvr
start_roll
Float
Start roll angle before manvr
stop_ra
Float
Stop right ascension after manvr
stop_dec
Float
Stop declination after manvr
stop_roll
Float
Stop roll angle after manvr
angle
Float
Maneuver angle (deg)
one_shot
Float
One shot attitude update (arcsec)
one_shot_roll
Float
One shot attitude update roll (arcsec)
one_shot_pitch
Float
One shot attitude update pitch (arcsec)
one_shot_yaw
Float
One shot attitude update yaw (arcsec)
n_acq
,n_guide
, andn_kalman
: these provide a count of the number of timesafter the maneuver ends that
AOACASEQ
changes value from anything toAQXN
,GUID
, andKALM
respectively.anomalous
: this isTrue
if the following MSIDs have values that arenot in the list of nominal state values:
MSID
Nominal state values
AOPCADMD
NPNT NMAN
AOACASEQ
GUID KALM AQXN
AOFATTMD
MNVR STDY
AOPSACPR
INIT INAC ACT
AOUNLOAD
MON GRND
template
: this indicates which of the pre-defined maneuver sequence templates werematched by this maneuver. For details see Maneuver sequence templates.
one_shot
: one shot attitude update following maneuver. This is -99.0 for maneuverswith no corresponding transition to NPM.
one_shot_roll
,one_shot_pitch
, andone_shot_yaw
are the values of AOATTER1, 2, and 3from samples after the guide transition.
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- classmethod get_dwells(event, changes)[source]¶
Get the Kalman dwells associated with a maneuver event.
A Kalman dwell is the contiguous interval of AOACASEQ = KALM between:
Start: AOACASEQ ==> KALM (transition from any state to KALM) Stop: AOACASEQ ==> not KALM (transition to any state other than KALM) **or** AOPCADMD ==> NMAN
Short Kalman dwells that are less than 400 seconds long are ignored and are not recorded in the database. These are typically associated with monitor window commanding or multiple acquisition attempts).
- classmethod get_manvr_attrs(changes)[source]¶
Get attributes of the maneuver event and possible dwells based on the MSID changes.
- class kadi.events.models.ManvrSeq(*args, **kwargs)[source]¶
Maneuver sequence event
Each entry in this table corresponds to a state transition for an MSID that is relevant to the sequence of events comprising a maneuver event.
Fields
Field
Type
Description
manvr
ForeignKey
msid
Char(8)
prev_val
Char(4)
val
Char(4)
date
Char(21)
dt
Float
time
Float
prev_date
Char(21)
prev_time
Float
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.MyManager(*args, **kwargs)[source]¶
Custom query manager that allows for overriding the default __repr__. The purpose is to make a more user friendly output for event queries.
http://stackoverflow.com/questions/2163151/custom-queryset-and-manager-without-breaking-dry https://docs.djangoproject.com/en/3.1/topics/db/managers/#custom-managers
- class kadi.events.models.NormalSun(*args, **kwargs)[source]¶
Normal sun mode event
Event definition: interval when PCAD mode
AOPCADMD = NSUN
During a safing event and recovery this MSID can toggle to different values, so NormalSun events within 4 hours of each other are merged.
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.Obsid(*args, **kwargs)[source]¶
Observation identifier
Event definition: interval where
COBSRQID
is unchanged.Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.Orbit(*args, **kwargs)[source]¶
Event definition: single Chandra orbit starting from ascending node crossing
Full orbit, with dates corresponding to start (ORBIT ASCENDING NODE CROSSING), stop, apogee, perigee, radzone start and radzone stop. Radzone is defined as the time covering perigee when radmon is disabled by command. This corresponds to the planned values and may differ from actual in the case of events that run SCS107 and prematurely disable RADMON.
Fields
Field
Type
Description
start
Char(21)
Start time (orbit ascending node crossing)
stop
Char(21)
Stop time (next orbit ascending node crossing)
tstart
Float
Start time (orbit ascending node crossing)
tstop
Float
Stop time (next orbit ascending node crossing)
dur
Float
Orbit duration (sec)
orbit_num
Integer
Orbit number
perigee
Char(21)
Perigee time
apogee
Char(21)
Apogee time
t_perigee
Float
Perigee time (CXC sec)
start_radzone
Char(21)
Start time of rad zone
stop_radzone
Char(21)
Stop time of rad zone
dt_start_radzone
Float
Start time of rad zone relative to perigee (sec)
dt_stop_radzone
Float
Stop time of rad zone relative to perigee (sec)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.OrbitPoint(*args, **kwargs)[source]¶
Orbit point
Fields
Field
Type
Description
orbit
ForeignKey
date
Char(21)
name
Char(9)
orbit_num
Integer
descr
Char(50)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.Pad(start=None, stop=None)[source]¶
Time padding at the start and stop of an interval.
Positive values always make the interval bigger in each direction, so a pad of 300 seconds makes the interval a total of 10 minutes longer (5 minutes on each side). A pad of -300 seconds makes the interval start 5 minutes later and end 5 minutes earlier.
- class kadi.events.models.PassPlan(*args, **kwargs)[source]¶
Pass plan
Event definition: Pass plan from iFOT
Fields
Field
Type
Description
ifot_id
Integer
iFOT identifier
start
Char(21)
Start time (date)
stop
Char(21)
Stop time (date)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
oc
Char(30)
OC crew
cc
Char(30)
CC crew
got
Char(30)
GOT crew
station
Char(6)
DSN station
est_datetime
Char(20)
Date local
sched_support_time
Char(13)
Support time
activity
Char(20)
Activity
bot
Char(4)
Beginning of track
eot
Char(4)
End of track
data_rate
Char(10)
Data rate
config
Char(8)
Configuration
lga
Char(1)
LGA
power
Char(6)
Power
rxa_rsl
Char(10)
Rx-A RSL
rxb_rsl
Char(10)
Rx-B RSL
err_log
Char(10)
Error log
cmd_count
Char(15)
Command count
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.RadZone(*args, **kwargs)[source]¶
Radiation zone
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
orbit
ForeignKey
orbit_num
Integer
perigee
Char(21)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.SafeSun(*args, **kwargs)[source]¶
Safe sun event
Event definition: interval from safe mode entry to recovery to OBC control.
Specifically, it is considered part of the safe mode condition if any of the following are True:
CONLOFP != 'NRML' # OFP state CTUFMTSL = 'FMT5' # CTU telemetry format C1SQAX != 'ENAB' # Sequencer A enable/disable
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
notes
Text
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- classmethod get_state_times_bools(msidset)[source]¶
Get the boolean True/False array indicating when
event_msid
is in the desired state for this event type. The default is whenevent_msid == cls.event_val
, but subclasses may override this method.- Parameters:
- event_msid
fetch.MSID object
- Returns:
- boolean ndarray
- class kadi.events.models.Scs107(*args, **kwargs)[source]¶
SCS107 run
Event definition: interval with the following combination of state values:
3TSCMOVE = MOVE AORWBIAS = DISA CORADMEN = DISA
These MSIDs are first sampled onto a common time sequence of 32.8 sec samples so the start / stop times are accurate only to that resolution.
Early in the mission there were two SIM TSC translations during an SCS107 run. By the above rules this would generate two SCS107 events, but instead any two SCS107 events within 600 seconds are combined into a single event.
Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
notes
Text
Supplemental notes
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- classmethod get_state_times_bools(msidset)[source]¶
Get the boolean True/False array indicating when
event_msid
is in the desired state for this event type. The default is whenevent_msid == cls.event_val
, but subclasses may override this method.- Parameters:
- event_msid
fetch.MSID object
- Returns:
- boolean ndarray
- class kadi.events.models.TlmEvent(*args, **kwargs)[source]¶
- fetch_event(pad=None, extra_msids=None, filter_bad=True)[source]¶
Fetch an MSIDset of self.fetch_msids.
- classmethod get_events(start, stop=None)[source]¶
Get events from telemetry defined by a simple rule that the value of event_msids[0] == event_val.
- classmethod get_extras(event, event_msidset)[source]¶
Get extra stuff for the event based on telemetry available in event_msidset. This is a hook within get_events() that should be overridden in individual classes.
- classmethod get_msids_states(start, stop)[source]¶
Get event and related MSIDs and compute the states corresponding to the event.
- classmethod get_state_times_bools(event_msidset)[source]¶
Get the boolean True/False array indicating when
event_msid
is in the desired state for this event type. The default is whenevent_msid == cls.event_val
, but subclasses may override this method.- Parameters:
- event_msid
fetch.MSID object
- Returns:
- boolean ndarray
- property msidset¶
fetch.MSIDset of self.fetch_event_msids. By default filter_bad is True.
- class kadi.events.models.TscMove(*args, **kwargs)[source]¶
SIM TSC translation
Event definition: interval where
3TSCMOVE = MOVE
In addition to reporting the start and stop TSC position, these positions are also converted to the corresponding science instrument detector name, one of
ACIS-I
,ACIS-S
,HRC-I
, orHRC-S
. The maximum PWM value3MRMMXMV
(sampled at the stop time + 66 seconds) is also included.Fields
Field
Type
Description
start
Char(21)
Start time (YYYY:DDD:HH:MM:SS)
stop
Char(21)
Stop time (YYYY:DDD:HH:MM:SS)
tstart
Float
Start time (CXC secs)
tstop
Float
Stop time (CXC secs)
dur
Float
Duration (secs)
obsid
Integer
Observation ID (COBSRQID)
start_3tscpos
Integer
Start TSC position (steps)
stop_3tscpos
Integer
Stop TSC position (steps)
start_det
Char(6)
Start detector (ACIS-I ACIS-S HRC-I HRC-S)
stop_det
Char(6)
Stop detector (ACIS-I ACIS-S HRC-I HRC-S)
max_pwm
Integer
Max PWM during translation
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class kadi.events.models.Update(*args, **kwargs)[source]¶
Last telemetry which was searched for an update.
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- kadi.events.models.fuzz_states(states, t_fuzz)[source]¶
For a set of states (from fetch.MSID.state_intervals()) or intervals (from fetch.MSID.logical_intervals), merge any that are within t_fuzz seconds of each other. Logical intervals are just the subset of states with ‘val’ equal to a particular value.
- Parameters:
- states
table of states or intervals
- t_fuzzfuzz time in seconds
- returns fuzzed_states:
table
Event queries¶
- class kadi.events.query.EventQuery(cls=None, left=None, right=None, op=None, pad=None, **filter_kwargs)[source]¶
High-level interface for handling event queries.
This includes a few key methods:
filter() : filter events matching criteria and return Django query set
intervals(): return time intervals between event start/stop times
An EventQuery object can be pre-filtered via any of the expressions described in the
filter()
doc string. In this way the correspondingintervals()
and fetchremove_intervals
/select_intervals
outputs can be likewise filtered.A key feature is that EventQuery objects can be combined with boolean and, or, and not logic to generate composite EventQuery objects. From there the intervals() output can be used to select or remove the intervals from cheta fetch datasets.
- all()[source]¶
Return all events as a Django query set object.
Example:
>>> from kadi import events >>> print events.safe_suns.all() <SafeSun: start=1999:229:20:17:50.616 dur=105091> <SafeSun: start=1999:269:20:22:50.616 dur=43165> <SafeSun: start=2000:048:08:08:54.216 dur=68798> <SafeSun: start=2011:187:12:28:53.816 dur=288624> <SafeSun: start=2012:150:03:33:09.816 dur=118720> >>> print events.safe_suns.all().table start stop tstart tstop dur notes --------------------- --------------------- ----------- ----------- -------- ----- 1999:229:20:17:50.616 1999:231:01:29:21.816 51308334.8 51413426.0 105091.2 1999:269:20:22:50.616 1999:270:08:22:15.416 54764634.8 54807799.6 43164.8 2000:048:08:08:54.216 2000:049:03:15:32.216 67162198.4 67230996.4 68798.0 2011:187:12:28:53.816 2011:190:20:39:17.416 426342600.0 426631223.6 288623.6 2012:150:03:33:09.816 2012:151:12:31:49.416 454649656.0 454768375.6 118719.6
- filter(start=None, stop=None, obsid=None, subset=None, **kwargs)[source]¶
Find events between
start
andstop
, or with the givenobsid
, which match the filter attributes in subsequent keyword arguments. The matching events are returned as a Django query set [1].If
start
orstop
are not supplied they default to the beginning / end of available data. The optionalsubset
arg must be a Python slice() object and allows slicing of the filtered output.This function allows for the powerful field lookups from the underlying Django model implementation. A field lookup is similar to an SQL
WHERE
clause with the form<field_name>__<filter_type>=<value>
(with a double underscore between). For instancen_dwell__lte=1
would be the same asSELECT ... WHERE n_dwell <= 1
. Common filter types are:exact
(exact match),contains
(contains string)startswith
,endswith
(starts or ends with string)gt
,gte
,lt
,lte
(comparisons)isnull
(field value is missing, e.g. manvrs.aca_proc_act_start)
For the common case of testing equality (
exact
) there is a shortcut where the__exact
can be skipped, so for instancen_dwell=1
selects maneuver events with one dwell. The full list of field lookups is at [2].Examples:
>>> from kadi import events >>> events.manvrs.filter('2011:001', '2012:001', n_dwell=1, angle__gte=140) >>> events.manvrs.filter('2011:001', '2012:001', subset=slice(None, 5)) # first 5 >>> events.manvrs.filter(obsid=14305)
[1]: https://docs.djangoproject.com/en/3.1/topics/db/queries/ [2]: https://docs.djangoproject.com/en/3.1/ref/models/querysets/#field-lookups
- Parameters:
- start
start time (DateTime compatible format)
- stop
stop time (DateTime compatible format)
- obsid
obsid for event
- subset
subset of matching events that are output
- Returns:
- Django query set with matching events