Skip to content

Commit

Permalink
don't keep file open within injectionset (gwastro#4667)
Browse files Browse the repository at this point in the history
* don't keep file open within injectionset

* update docstring
  • Loading branch information
ahnitz authored Mar 20, 2024
1 parent 62a4921 commit 9a7ef50
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pycbc/inject/inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ class _HDFInjectionSet(metaclass=ABCMeta):
Attributes
----------
filehandler
table
static_args
extra_args
Expand All @@ -365,7 +364,6 @@ def __init__(self, sim_file, hdf_group=None, **kwds):
# open the file
fp = h5py.File(sim_file, 'r')
group = fp if hdf_group is None else fp[hdf_group]
self.filehandler = fp
# get parameters
parameters = list(group.keys())
# get all injection parameter values
Expand Down Expand Up @@ -414,6 +412,7 @@ def __init__(self, sim_file, hdf_group=None, **kwds):
self.table = self._tableclass.from_kwargs(**injvals)
# save the extra arguments
self.extra_args = kwds
fp.close()

@abstractmethod
def apply(self, strain, detector_name, distance_scale=1,
Expand Down

0 comments on commit 9a7ef50

Please sign in to comment.