Skip to content
Snippets Groups Projects
Commit 3629f113 authored by Patrick Godwin's avatar Patrick Godwin
Browse files

datasource.py: fix issue where state vector channels passed in were not being saved

parent 036ca367
No related branches found
No related tags found
1 merge request!61datasource.py: fix issue where state vector channels passed in were not being saved
Pipeline #265107 failed
......@@ -249,7 +249,7 @@ class DataSourceInfo:
self.dq_vector_off_bits = {} if dq_vector_off_bits is None else dq_vector_off_bits
if state_channel_name:
self.state_channel_name.update(channel_name)
self.state_channel_name.update(state_channel_name)
if dq_channel_name:
self.dq_channel_name.update(dq_channel_name)
......
......@@ -481,32 +481,6 @@ class TestDataSourceInfoBasicSourceOptParse:
info = datasource.DataSourceInfo.from_optparse(options)
assert_info_mkbasicsrc(info, Detector.H1.value)
def test_on_off_bits_coercion(self):
"""Test that on off bits are being coerced"""
with GstLALTestManager() as gsttm:
args = [
'--data-source=white',
'--frame-cache={}'.format(gsttm.cache_path),
'--channel-name=H1=CHANNEL',
'--gps-start-time=1234567',
'--gps-end-time=1234568',
'--state-vector-on-bits=H1=3',
'--state-vector-on-bits=L1=3',
'--state-vector-on-bits=V1=1027',
'--state-vector-off-bits=H1=0',
'--state-vector-off-bits=L1=0',
'--state-vector-off-bits=V1=0'
]
parser = optparse.OptionParser(description="test legacy on off coercion")
datasource.append_options(parser)
options, filenames = parser.parse_args(args)
info = datasource.DataSourceInfo.from_optparse(options)
assert_info_mkbasicsrc(info, Detector.H1.value)
for k in ('H1', 'H2', 'V1', 'L1'):
for v in info.state_vector_on_off_bits[k]:
assert isinstance(v, int)
@pytest.mark.requires_gstlal_ugly
class TestDataSourceInfoBasicSourceOptParseUgly:
......@@ -580,3 +554,58 @@ class TestDataSourceInfoBasicSourceOptParseUgly:
info = datasource.DataSourceInfo.from_optparse(options)
assert_info_mkbasicsrc(info, Detector.H1.value)
def test_on_off_bits_coercion(self):
"""Test that on off bits are being coerced"""
with GstLALTestManager() as gsttm:
args = [
'--data-source=lvshm',
'--channel-name=H1=CHANNEL',
'--state-vector-on-bits=H1=3',
'--state-vector-on-bits=L1=3',
'--state-vector-on-bits=V1=1027',
'--state-vector-off-bits=H1=0',
'--state-vector-off-bits=L1=0',
'--state-vector-off-bits=V1=0'
]
parser = optparse.OptionParser(description="test legacy on off coercion")
datasource.append_options(parser)
options, filenames = parser.parse_args(args)
info = datasource.DataSourceInfo.from_optparse(options)
assert_info_mkbasicsrc(info, Detector.H1.value)
for k in ('H1', 'H2', 'V1', 'L1'):
for v in info.state_vector_on_off_bits[k]:
assert isinstance(v, int)
def test_state_vector_channel(self):
"""Test that state vector channel is being updated"""
with GstLALTestManager() as gsttm:
args = [
'--data-source=lvshm',
'--channel-name=H1=CHANNEL',
'--state-channel-name=H1=STATE',
]
parser = optparse.OptionParser(description="test state vector channel")
datasource.append_options(parser)
options, filenames = parser.parse_args(args)
info = datasource.DataSourceInfo.from_optparse(options)
assert_info_mkbasicsrc(info, Detector.H1.value)
assert info.state_channel_name[Detector.H1.value] == 'STATE'
def test_dq_vector_channel(self):
"""Test that dq vector channel is being updated"""
with GstLALTestManager() as gsttm:
args = [
'--data-source=lvshm',
'--channel-name=H1=CHANNEL',
'--dq-channel-name=H1=DQVECTOR',
]
parser = optparse.OptionParser(description="test dq vector channel")
datasource.append_options(parser)
options, filenames = parser.parse_args(args)
info = datasource.DataSourceInfo.from_optparse(options)
assert_info_mkbasicsrc(info, Detector.H1.value)
assert info.dq_channel_name[Detector.H1.value] == 'DQVECTOR'
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