diff --git a/gstlal-inspiral/python/stats/inspiral_intrinsics.py b/gstlal-inspiral/python/stats/inspiral_intrinsics.py index 721431d430ac7e9ab1b6bf8eb6246ae3e527718f..268edb032ece903b924e271ea46cf0fd9d273e4e 100644 --- a/gstlal-inspiral/python/stats/inspiral_intrinsics.py +++ b/gstlal-inspiral/python/stats/inspiral_intrinsics.py @@ -112,7 +112,6 @@ class SourcePopulationModel(object): """ if filename is not None: with h5py.File(filename, 'r') as model: - coefficients = model['coefficients'][()] snr_bp = model['SNR'][()] try: model_ids = model['template_id'][()] @@ -136,7 +135,9 @@ class SourcePopulationModel(object): template_indices[template_id] = numpy.where(model_ids==template_id)[0][0] except IndexError: raise IndexError("template ID %d is not in this model" % template_id) - self.polys = dict((template_id, PPoly(coefficients[:,:,[template_indices[template_id]]], snr_bp)) for template_id in template_ids) + with h5py.File(filename, 'r') as model: + coefficients = model['coefficients'][:,:,[template_indices[template_id]]] + self.polys = dict((template_id, PPoly(coefficients, snr_bp)) for template_id in template_ids) self.max_snr = snr_bp.max() else: self.polys = None