def test_find_saturations(): sats = saturation.find_saturations(DATA, limit=5., segments=False) assert_array_equal(sats, SATURATIONS) segs = saturation.find_saturations(DATA, limit=5. * DATA.unit, segments=True) assert_segmentlist_equal(segs.active, SEGMENTS)
def test_is_saturated(tsdfetch, remove): cache = [ "X-TEST-0-1.gwf", ] tsdfetch.return_value = TSDICT remove.return_value = ['X1:TEST_LIMIT'] saturated = saturation.is_saturated('X1:TEST', cache, start=0, end=8) assert isinstance(saturated, DataQualityFlag) assert_segmentlist_equal(saturated.active, SEGMENTS) saturated2 = saturation.is_saturated(['X1:TEST_LIMIT'], cache, start=0, end=8) assert isinstance(saturated2, list) assert_segmentlist_equal(saturated2[0].active, saturated.active) with pytest.raises(ValueError) as exc: saturation.is_saturated('X1:TEST', cache, start=0, end=8, indicator='blah') assert str(exc.value).startswith("Don't know how to determine")
def test_get_segments(): # get segments from optic motion fringef = core.get_fringe_frequency(OPTIC, multiplier=1) dqflag = core.get_segments(fringef, 10) assert dqflag.name == fringef.name assert len(dqflag.active) == 640 assert_segmentlist_equal(dqflag.known, [OPTIC.span])
def test_find_overflows_and_segments(cmltv, series): # find overflows times = daq.find_overflows(series, cumulative=cmltv) assert_array_equal(times, OVERFLOW_TIMES) # find segments segments = daq.find_overflow_segments(series, cumulative=cmltv) assert_segmentlist_equal(segments.active, OVERFLOW_SEGMENTS)
def test_segments_from_sngl_burst(): tab = ligolw.sngl_burst_from_times([1, 4, 7, 10], channel='test') segs = ligolw.segments_from_sngl_burst(tab, 1) assert_segmentlist_equal( segs['test'].active, SegmentList([ Segment(0, 2), Segment(3, 5), Segment(6, 8), Segment(9, 11), ]))
def test_find_saturations_wrapper(): segs = saturation._find_saturations((DATA, 5.)) assert_segmentlist_equal(segs.active, SEGMENTS) assert segs.name == DATA.name[:-7]