irfpy.vexop.eventfile
¶
A module to read the aspera event file
ASPERA-4 event file is a list of the command that is used for data analysis.
Preparation
Download the file, http://aspera-4.irf.se/archive/commanding/pmrqs/EV_ASPERA.VEX and
put the downloaded path to .irfpyrc
.
[vexop]
default_eventfile = /Volumes/scidata/data/venus/support/EV_ASPERA.VEX
Test
Run the following
>>> from irfpy.vexop import eventfile
>>> ev = eventfile.default_eventfile()
>>> print(ev)
<VEX event file: Nr_of_entry=110134>
How to use?
Sample 1: Find out switch on time of ASPERA-4.
Switch on of ASPERA is done by commanding “A4_ON”.
>>> on_events = list(filter(lambda e: e.eventname == 'A4_ON', ev.list)) # List of ``Event`` object.
>>> print(len(on_events))
5886
>>> print(on_events[0].utc)
2006-05-14 00:43:57
More reading
For more details, look at the tutorial, Event file.
Todo
To make an event catalog. It could be in a form of python code, or in a document.
- class irfpy.vexop.eventfile.EventFile(filename)[source]¶
Bases:
object
The event file.
- Parameters
filename – The file name of the event file.
- Type
string
The event file is loaded, parsed, and stored in the memory as an object. Each event is stored as an instance of
Event
. Usually, one can use direct access to the memberlist
.Below is an sample.
>> event = EventFile(filename) >> for ev in event.list: .. print ev .. # Some processing
- list¶
List of event
- class irfpy.vexop.eventfile.Event(evtname, orbnr, orbtime, utc, cmdname, prms)[source]¶
Bases:
object
Class of an event.
The class behave as a structure. Member variables (attributes) are:
- Eventname
Name of the event, e.g. “A4_ON”.
string
- Orbnr
Orbit nubmer, e.g., 328.
int
- Orbtime
Time relative to the pericenter, e.g.,
datetime.timedelta(0, 8709)
.datetime.timedelta
- Utc
Time in UTC.
datetime.datetime
- Cmdname
Name of the command, e.g. “AASF001A”.
string
- Parameters
Dictionary of parameters.
dict
ofstring
tostring
. For example,{'VASD6561': '0', 'VASD6563': '1', 'VASD6566': '4', 'VASD6567': '116'}
- classmethod parse(str)[source]¶
Parse the given string returning the
Event
instance.>>> str = 'A4_OFF 0046 +03:10:10 2006-06-06T04:53:17 AASF006A' >>> event = Event.parse(str) >>> print(event.eventname) A4_OFF >>> print(list(event.parameters.keys())) []
>>> str = 'ELS_ON_OFF 0081 -02:30:34 2006-07-10T23:25:56 AASF057A VASD6525=0, VASD6528=ON,' >>> event = Event.parse(str) >>> print(event.orbnr) 81 >>> print(event.orbtime) -1 day, 21:29:26 >>> print(sorted(event.parameters.keys())) ['VASD6525', 'VASD6528']
- irfpy.vexop.eventfile.default_eventfile()[source]¶
Return the
EventFile
class of the default event file.Returns the
EventFile
instance corresponding to the default event file.The default event file should be prepared locally, but if not found, this function tries to fetch the default URI,
http://aspera-4.irf.se/archive/commanding/pmrqs/EV_ASPERA.VEX