Better error when lock index is different in the same measurement
This commit is contained in:
parent
d4c7a367ae
commit
a260856297
1 changed files with 23 additions and 4 deletions
|
@ -2,10 +2,12 @@ from astropy.units import (
|
|||
Quantity,
|
||||
W, # pyright: ignore[reportAttributeAccessIssue]
|
||||
mW, # pyright: ignore[reportAttributeAccessIssue]
|
||||
s, # pyright: ignore[reportAttributeAccessIssue]
|
||||
Unit,
|
||||
)
|
||||
from astropy.units.physical import time
|
||||
from gwpy.time import Time
|
||||
from gwpy.time import Time, from_gps
|
||||
from numpy import array, where
|
||||
|
||||
from ..component import Component
|
||||
from ..lockingstate import LockingState
|
||||
|
@ -99,10 +101,27 @@ class MeasurementFactory:
|
|||
frame="trend",
|
||||
force_virgotools=force_virgotools,
|
||||
)
|
||||
if sum(data["V1:META_ITF_LOCK_index"].diff().abs()) != 0:
|
||||
raise Exception(
|
||||
"The state of the interferometer change in this measurement"
|
||||
state_data = data["V1:META_ITF_LOCK_index"].data.astype(int)
|
||||
if sum(state_data.diff().abs()) != 0:
|
||||
indexes = where(array(state_data.diff().data) != 0)[0]
|
||||
times_change = (
|
||||
data["V1:META_ITF_LOCK_index"].t0
|
||||
+ indexes * data["V1:META_ITF_LOCK_index"].dt
|
||||
)
|
||||
message = (
|
||||
"state of the interferometer changed in '{}'".format(
|
||||
name
|
||||
)
|
||||
)
|
||||
for i in range(len(indexes)):
|
||||
time_change = times_change[i]
|
||||
index = int(indexes[i])
|
||||
message += "\nat {}, from {} to {}".format(
|
||||
from_gps(time_change.to(s).value),
|
||||
LockingState(state_data[index]).name,
|
||||
LockingState(state_data[index + 1]).name,
|
||||
)
|
||||
raise Exception(message)
|
||||
state = LockingState(data["V1:META_ITF_LOCK_index"].data[0])
|
||||
injection_power = data["V1:INJ_IMC_TRA_DC_mean"].mean()
|
||||
dark_fringe_power = data["V1:DET_B1p_DC_mean"].mean()
|
||||
|
|
Loading…
Reference in a new issue