Skip to content
Snippets Groups Projects
Commit 254b4a15 authored by Rebecca Ewing's avatar Rebecca Ewing Committed by Rebecca Ewing
Browse files

gstlal-ugly/bin/gstlal_ifo_stat: add additional states for HL detectors

parent 2ba4f49b
Branches master
No related tags found
1 merge request!522gstlal_ifo_stat updates for gwistat
......@@ -66,12 +66,40 @@ class IFOStatusTracker(object):
# set up deques for storing data
self.timedeq = defaultdict(lambda: deque(maxlen=10000))
routes = ['hoft_ok', 'duration']
routes = ['state', 'hoft_ok', 'duration']
self.datadeq = {route: defaultdict(lambda: deque(maxlen=10000)) for route in routes}
self.previous = defaultdict(lambda: (None, None))
self.duration = defaultdict(lambda: 0)
@staticmethod
def LIGO_parse_state(bitmask):
hoftbit = int(bitmask[31])
intentbit = int(bitmask[30])
injbits = int(bitmask[23:26])
logging.debug(f'hoftbit: {hoftbit} | intentbit: {intentbit} | injbits: {injbits}')
if hoftbit:
if intentbit:
if injbits == 111:
state = "Observing"
else:
state = "Injection"
elif injbits == 111:
state = "Ready"
else:
state = "Injection study"
elif injbits == 111:
if intentbit:
state = "Calib not ready"
else:
state = "Down"
else:
state = "Injection study"
return state
def bufhandler(self, elem, ifo):
buf = elem.emit("pull-sample").get_buffer()
(result, mapinfo) = buf.map(Gst.MapFlags.READ)
......@@ -82,13 +110,24 @@ class IFOStatusTracker(object):
bit = int(bit)
time = float(time)
## FIXME hacky
if ifo == "K1":
if ifo == "H1" or ifo == "L1":
bitmask = bin(bit)
npad = 32 - len(bitmask)
bitmask = "0" * npad + bitmask
state = self.LIGO_parse_state(bitmask)
elif ifo == "K1":
# only check 0th bit
state = 1 if (bit & 0b1 == 0b1) else 0
state = "Observing" if (bit & 0b1 == 0b1) else "Down"
else:
# for Virgo check 0th and 1st bit
state = "Observing" if (bit & 0b11 == 0b11) else "Down"
# keep this metric for backwards compatibility
if state == "Observing":
hoft_ok = 1
else:
# for HLV check 0th and 1st bit
state = 1 if (bit & 0b11 == 0b11) else 0
hoft_ok = 0
statechange = False
......@@ -103,7 +142,8 @@ class IFOStatusTracker(object):
## store data
self.timedeq[ifo].append(int(time))
self.datadeq['hoft_ok'][ifo].append(state)
self.datadeq['state'][ifo].append(state)
self.datadeq['hoft_ok'][ifo].append(hoft_ok)
self.datadeq['duration'][ifo].append(self.duration[ifo])
if self.last_reduce is None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment