Go to the documentation of this file.
7 __version__ =
'1.3.0_2023-01-23'
9 from l0info_utils
import read_packet, read_apid, get_anc_packet_time, is_bad_packet
14 if (apid < 800)
or (apid > 849):
15 print(
"Invalid packet header at byte %d."%fh.tell())
21 print(
"Running l0info_spex (version: %s) \n" % __version__)
25 print(
"Reading SPEXone science data.")
35 while ((apid != 848)
or (
not firstp))
and (packetLength > 7):
39 if fpacket: firstp = (fpacket[2] & 64)>>6
45 print(
"No science packets found in file.")
47 output.write(
"datatype=SPEX\n")
53 while ((apid != 800)
or (csec<1000000000))
and (packetLength > 7):
56 csec = int.from_bytes(fpacket[6:10],
'big')
64 print(
"start_time=%s" % stime.strftime(
'%Y-%m-%dT%H:%M:%S.%f'))
66 output.write(
"start_time=%s\n" % stime.strftime(
'%Y-%m-%dT%H:%M:%S.%f'))
70 while packetLength > 7:
73 if (apid == 800)
and fpacket: mpacket = fpacket
82 imrlen = int.from_bytes(fpacket[296:300],
'big')
84 if (fmode == 2)
and (omode == 1)
and (imrlen > 0): dtype = 1
85 if (fmode == 1)
and (omode == 3)
and (imrlen > 0): dtype = 2
89 print(
"datatype=SPEX")
91 output.write(
"datatype=SPEX_SCI\n")
94 print(
"datatype=SPEX_DIAG")
96 output.write(
"datatype=SPEX_DIAG\n")
98 print(
"Invalid SPEXone data type")
104 print(
"start_time=%s" % stime.strftime(
'%Y-%m-%dT%H:%M:%S.%f'))
106 output.write(
"start_time=%s\n" % stime.strftime(
'%Y-%m-%dT%H:%M:%S.%f'))
112 while packetLength > 0:
115 while ((apid != 848)
or (
not firstp))
and (packetLength > 7):
119 if fpacket: firstp = (fpacket[2] & 64)>>6
123 if fpacket: epacket = fpacket
127 print(
"stop_time=%s" % etime.strftime(
'%Y-%m-%dT%H:%M:%S.%f'))
129 output.write(
"stop_time=%s\n" % etime.strftime(
'%Y-%m-%dT%H:%M:%S.%f'))
int get_anc_packet_time(uint8_t *apacket, int32_t &iyear, int32_t &iday, double &stime)
int read_packet(FILE *infile, uint8_t packet[], int *len, long int *endfile)
def is_bad_apid(apid, fh)
def is_bad_packet(packetLength, fh)
def l0info_spex(args, fh, output)