Maintenance will be performed on git.ligo.org, chat.ligo.org, containers.ligo.org, and docs.ligo.org tomorrow, 2020/08/04, starting at approximately 9am PDT. It is expected to take around 15 minutes and there will be a short period of downtime towards the end of the maintenance window. Please direct any comments, questions or concerns to computing-help@ligo.org.

Commit ccb5c392 authored by Leo Pound Singer's avatar Leo Pound Singer

lalinference.io.events: rename single.detector to single.instrument

This is more consistent with usage elsewhere in the code.
Original: 07019313082d3ff7d5b2688622d3330a708aa6bd
parent 4c08262e
......@@ -147,7 +147,7 @@ def localize(
if not enable_snr_series:
singles = [single for single in singles if single.snr is not None]
ifos = [single.instrument for single in singles]
ifos = [single.detector for single in singles]
# Extract SNRs from table.
snrs = np.ma.asarray([
......@@ -362,7 +362,7 @@ def localize(
skymap.meta['vcs_info'] = vcs_info
skymap.meta['gps_time'] = float(epoch)
skymap.meta['runtime'] = float(end_time - start_time)
skymap.meta['instruments'] = {single.instrument for single in singles}
skymap.meta['instruments'] = {single.detector for single in singles}
skymap.meta['gps_creation_time'] = end_time
return skymap
......
......@@ -78,7 +78,7 @@ class SingleEvent(six.with_metaclass(ABCMeta)):
"""Abstraction of a single-detector trigger."""
@abstractproperty
def instrument(self):
def detector(self):
"""Instrument name (e.g. 'H1')"""
raise NotImplementedError
......@@ -113,7 +113,7 @@ class SingleEvent(six.with_metaclass(ABCMeta)):
"""SNR time series (COMPLEX8TimeSeries)"""
return None
__str_keys = ('instrument', 'snr', 'phase', 'time')
__str_keys = ('detector', 'snr', 'phase', 'time')
def __str__(self):
keys = self.__str_keys
......
......@@ -49,7 +49,7 @@ class DetectorDisabledEvent(Event):
def singles(self):
disabled_detectors = self.source.disabled_detectors
if self.source.raises:
detectors = {s.instrument for s in self.base_event.singles}
detectors = {s.detector for s in self.base_event.singles}
if not detectors & disabled_detectors:
raise ValueError(
'Disabling detectors {{{}}} would have no effect on this '
......@@ -63,7 +63,7 @@ class DetectorDisabledEvent(Event):
' '.join(disabled_detectors),
' '.join(detectors)))
return tuple(s for s in self.base_event.singles
if s.instrument not in disabled_detectors)
if s.detector not in disabled_detectors)
@property
def template_args(self):
......
......@@ -166,9 +166,9 @@ class HDFEvent(Event):
class HDFSingleEvent(SingleEvent):
def __init__(
self, instrument, _coinc_id, _detector_num, _trigger_id,
self, detector, _coinc_id, _detector_num, _trigger_id,
_timeslide_interval, _triggers, _timeslide_ids, _psds):
self._instrument = instrument
self._detector = detector
self._coinc_id = _coinc_id
self._detector_num = _detector_num
self._trigger_id = _trigger_id
......@@ -178,8 +178,8 @@ class HDFSingleEvent(SingleEvent):
self._psds = _psds
@property
def instrument(self):
return self._instrument
def detector(self):
return self._detector
@property
def snr(self):
......@@ -217,7 +217,7 @@ class HDFSingleEvent(SingleEvent):
except ValueError:
raise ValueError(
'No PSD found for detector {} at zero-lag GPS time {}'.format(
self.instrument, self.zerolag_time))
self.detector, self.zerolag_time))
dyn_range_fac = psd.file.attrs['dynamic_range_factor']
flow = psd.file.attrs['low_frequency_cutoff']
......
......@@ -226,10 +226,10 @@ class LigoLWEvent(Event):
class LigoLWSingleEvent(SingleEvent):
def __init__(self, source, instrument, snr, phase, time, zerolag_time,
def __init__(self, source, detector, snr, phase, time, zerolag_time,
psd_file, snr_series, invert_phases):
self._source = source
self._instrument = instrument
self._detector = detector
self._snr = snr
self._phase = phase
self._time = time
......@@ -239,8 +239,8 @@ class LigoLWSingleEvent(SingleEvent):
self._invert_phases = invert_phases
@property
def instrument(self):
return self._instrument
def detector(self):
return self._detector
@property
def snr(self):
......@@ -263,7 +263,7 @@ class LigoLWSingleEvent(SingleEvent):
@property
def psd(self):
return self._source._psds_for_file(self._psd_file)[self._instrument]
return self._source._psds_for_file(self._psd_file)[self._detector]
@property
def snr_series(self):
......
......@@ -42,7 +42,7 @@ def test_ligolw():
event = source[821759]
assert len(event.singles) == 2
assert event.singles[0].snr_series is event.singles[1].snr_series is None
assert event.singles[0].instrument == 'H1'
assert event.singles[0].detector == 'H1'
assert event.singles[0].snr == 8.5362396
assert event.singles[0].phase == -0.81192881
assert (event.singles[0].time == event.singles[0].zerolag_time ==
......@@ -50,7 +50,7 @@ def test_ligolw():
psd = event.singles[0].psd
assert psd.f0 == 0.0
assert psd.deltaF == 0.125
assert event.singles[1].instrument == 'L1'
assert event.singles[1].detector == 'L1'
assert event.singles[1].snr == 10.36818
assert event.singles[1].phase == 1.9740163
assert (event.singles[1].time == event.singles[1].zerolag_time ==
......@@ -79,7 +79,7 @@ def test_gracedb():
assert event_id == 'G211117'
assert (event.singles[0].snr_series is event.singles[1].snr_series
is None)
assert event.singles[0].instrument == 'H1'
assert event.singles[0].detector == 'H1'
assert event.singles[0].snr == 9.0802174
assert event.singles[0].phase == -0.13969257
assert (event.singles[0].time == event.singles[0].zerolag_time ==
......@@ -87,7 +87,7 @@ def test_gracedb():
psd = event.singles[0].psd
assert psd.f0 == 0.0
assert psd.deltaF == 0.125
assert event.singles[1].instrument == 'L1'
assert event.singles[1].detector == 'L1'
assert event.singles[1].snr == 7.3947201
assert event.singles[1].phase == -2.7356486
assert (event.singles[1].time == event.singles[1].zerolag_time ==
......@@ -108,7 +108,7 @@ def test_gracedb():
assert event_id == 'G197392'
assert (event.singles[0].snr_series is event.singles[1].snr_series
is None)
assert event.singles[0].instrument == 'H1'
assert event.singles[0].detector == 'H1'
assert event.singles[0].snr == 6.9068823
assert event.singles[0].phase == 1.8298783
assert (event.singles[0].time == event.singles[0].zerolag_time ==
......@@ -116,7 +116,7 @@ def test_gracedb():
psd = event.singles[0].psd
assert psd.f0 == 30.0
assert psd.deltaF == 0.125
assert event.singles[1].instrument == 'L1'
assert event.singles[1].detector == 'L1'
assert event.singles[1].snr == 6.8389997
assert event.singles[1].phase == -1.0297496
assert (event.singles[1].time == event.singles[1].zerolag_time ==
......@@ -146,7 +146,7 @@ def test_detector_disabled():
for graceid, (event_id, event) in zip(graceids, source.items()):
assert event_id == graceid
assert len(event.singles) == 1
assert event.singles[0].instrument == 'L1'
assert event.singles[0].detector == 'L1'
# Now test that exceptions are raised when they are called for.
expected_message = ('Disabling detectors {H1, L1} would have no effect on '
......@@ -224,7 +224,7 @@ def test_hdf(tmpdir):
assert len(source) == 5
for coinc_id, coinc in source.items():
for i, (ifo, single) in enumerate(zip(ifos, coinc.singles)):
assert single.instrument == ifo
assert single.detector == ifo
assert single.snr == i + coinc_id * np.pi
assert single.phase == i + coinc_id * np.pi**2
assert single.time == (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment