Skip to content

Commit

Permalink
Codeclimate
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeb245 committed Oct 26, 2023
1 parent bbc9567 commit 2978cf5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pycbc/results/pygrb_postprocessing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@
import argparse
import copy

import ligo.segments
import numpy
import h5py
from scipy import stats
from pycbc.detector import Detector
from ligo import segments
# All/most of these final imports will become obsolete with hdf5 switch
try:
from ligo import segments
from ligo.lw import utils, lsctables
from ligo.lw.table import Table
from ligo.segments.utils import fromsegwizard
Expand Down Expand Up @@ -652,7 +651,7 @@ def load_segment_dict(hdf_file_path):
{slide_id: segmentlist(segments analyzed)}
"""

# TODO: Long time slides will require mapping between slides and segments
# Long time slides will require mapping between slides and segments
hdf_file = h5py.File(hdf_file_path, 'r')
ifos = extract_ifos(hdf_file_path)
# Get slide IDs
Expand All @@ -661,12 +660,12 @@ def load_segment_dict(hdf_file_path):
seg_starts = hdf_file['network/search/segments/start_time'][:]
seg_ends = hdf_file['network/search/segments/end_time'][:]
# Write list of segments
segments = ligo.segments.segmentlist()
seg_list = segments.segmentlist()
for i in range(len(seg_starts)):
segments.append(ligo.segments.segment(seg_starts[i], seg_ends[i]))
seg_list.append(segments.segment(seg_starts[i], seg_ends[i]))

# Write segment_dict in proper format
segment_dict = {slide: segments.coalesce() for slide in slide_ids}
segment_dict = {slide: seg_list.coalesce() for slide in slide_ids}

return segment_dict

Expand Down

0 comments on commit 2978cf5

Please sign in to comment.