Skip to content

Commit

Permalink
Remove HFile from pycbc/types
Browse files Browse the repository at this point in the history
  • Loading branch information
GarethCabournDavies committed Jun 25, 2024
1 parent d6cd24b commit 8193f25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pycbc/types/frequencyseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
Provides a class representing a frequency series.
"""
import os as _os
import h5py
from pycbc.types.array import Array, _convert, zeros, _noreal
from pycbc.io.hdf import HFile
import lal as _lal
import numpy as _numpy

Expand Down Expand Up @@ -421,7 +421,7 @@ def save(self, path, group=None, ifo='P1'):
)
elif ext == '.hdf':
key = 'data' if group is None else group
with HFile(path, 'a') as f:
with h5py.File(path, 'a') as f:
ds = f.create_dataset(key, data=self.numpy(),
compression='gzip',
compression_opts=9, shuffle=True)
Expand Down Expand Up @@ -611,7 +611,7 @@ def load_frequencyseries(path, group=None):
data = _numpy.loadtxt(path)
elif ext == '.hdf':
key = 'data' if group is None else group
with HFile(path, 'r') as f:
with h5py.File(path, 'r') as f:
data = f[key][:]
delta_f = f[key].attrs['delta_f']
epoch = f[key].attrs['epoch'] if 'epoch' in f[key].attrs else None
Expand Down
6 changes: 3 additions & 3 deletions pycbc/types/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
Provides a class representing a time series.
"""
import os as _os
import h5py
from pycbc.types.array import Array, _convert, complex_same_precision_as, zeros
from pycbc.types.array import _nocomplex
from pycbc.types.frequencyseries import FrequencySeries
from pycbc.io.hdf import HFile
import lal as _lal
import numpy as _numpy
from scipy.io.wavfile import write as write_wav
Expand Down Expand Up @@ -934,7 +934,7 @@ def save(self, path, group = None):
_numpy.savetxt(path, output)
elif ext =='.hdf':
key = 'data' if group is None else group
with HFile(path, 'a') as f:
with h5py.File(path, 'a') as f:
ds = f.create_dataset(key, data=self.numpy(),
compression='gzip',
compression_opts=9, shuffle=True)
Expand Down Expand Up @@ -1170,7 +1170,7 @@ def load_timeseries(path, group=None):
data = _numpy.loadtxt(path)
elif ext == '.hdf':
key = 'data' if group is None else group
with HFile(path, 'r') as f:
with h5py.File(path, 'r') as f:
data = f[key][:]
series = TimeSeries(data, delta_t=f[key].attrs['delta_t'],
epoch=f[key].attrs['start_time'])
Expand Down

0 comments on commit 8193f25

Please sign in to comment.