Skip to content

Commit 702ce64

Browse files
areedaJoseph Areeda
andauthored
Merge day boundary (#146)
* Address issue #126. Allow pyomicron to run from a frame cache without accessing dqsegdb. Add documentation for this * Do not merge files if they overlap "metric days" * Do not cross metric day boundaries. Co-authored-by: Joseph Areeda <[email protected]>
1 parent bd8a497 commit 702ce64

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Documentation
4646

4747
workflow/index
4848
configuration/index
49+
workflow/simulations
4950

5051
**Utilities**
5152

omicron/cli/merge_with_gaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def valid_file(path, uint_bug):
145145
table = EventTable.read(path, path='/triggers')
146146
elif path.name.endswith('.xml.gz') or path.name.endswith('.xml'):
147147
if uint_bug:
148-
sed_cmd = ['sed', '-i', '-e', 's/uint_8s/int_8u/g', str(path.absolute())]
148+
sed_cmd = ['sed', '-i', '', '-e', 's/uint_8s/int_8u/g', str(path.absolute())]
149149
subprocess.run(sed_cmd)
150150
table = EventTable.read(path, tablename='sngl_burst')
151151
elif path.name.endswith('.root'):

omicron/cli/process.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
6060
"""
6161
import time
62+
63+
from gwpy.segments import SegmentList, Segment
64+
6265
prog_start = time.time()
6366
import argparse
6467
import configparser
@@ -751,6 +754,13 @@ def main(args=None):
751754
pad=statepad)
752755
logger.info(f'Segment query took {time.time() - seg_qry_strt:.2f}s')
753756

757+
# Get segments from frame cache
758+
elif args.cache_file:
759+
cache = read_cache(str(args.cache_file))
760+
cache_segs = segments.cache_segments(cache)
761+
srch_span = SegmentList([Segment(datastart, dataend)])
762+
segs = cache_segs & srch_span
763+
754764
# get segments from frame availability
755765
else:
756766
segs = segments.get_frame_segments(ifo, frametype, datastart, dataend)
@@ -855,6 +865,18 @@ def main(args=None):
855865
logger.warning("Not all state times are available in frames")
856866
segs = (cachesegs & segs).coalesce()
857867

868+
# Deal with segments that cross a metric day (100,000 boundary)
869+
seg_tmp = SegmentList()
870+
for seg in segs:
871+
sday = int(seg[0] / 1e5)
872+
eday = int(seg[1] / 1e5)
873+
if sday == eday:
874+
seg_tmp.append(seg)
875+
else:
876+
seg1 = Segment(seg[0], eday)
877+
seg2 = Segment(eday, seg[1])
878+
seg_tmp.append(seg1)
879+
seg_tmp.append(seg2)
858880
# apply minimum duration requirement
859881
segs = type(segs)(s for s in segs if abs(s) >= segdur)
860882

0 commit comments

Comments
 (0)