diff --git a/bilby/core/result.py b/bilby/core/result.py index e2c5894f87146880f6f7b9d49b7ab52750b11847..65424c651e103f3357cc51350f4f3609644bdd26 100644 --- a/bilby/core/result.py +++ b/bilby/core/result.py @@ -5,7 +5,6 @@ from distutils.version import LooseVersion from collections import OrderedDict, namedtuple import numpy as np -import deepdish import pandas as pd import corner import json @@ -190,6 +189,7 @@ class Result(object): If no bilby.core.result.Result is found in the path """ + import deepdish filename = _determine_file_name(filename, outdir, label, 'hdf5') if os.path.isfile(filename): @@ -423,6 +423,7 @@ class Result(object): with open(file_name, 'w') as file: json.dump(dictionary, file, indent=2, cls=BilbyResultJsonEncoder) elif extension == 'hdf5': + import deepdish deepdish.io.save(file_name, dictionary) else: raise ValueError("Extension type {} not understood".format(extension)) diff --git a/bilby/gw/detector.py b/bilby/gw/detector.py index 2d68559921f0c696e386c92be7a5b29af2ccf7d3..059da0b65c85a4a2c86d4b6dad2dab64254b662d 100644 --- a/bilby/gw/detector.py +++ b/bilby/gw/detector.py @@ -7,7 +7,6 @@ import matplotlib.pyplot as plt import numpy as np from scipy.signal.windows import tukey from scipy.interpolate import interp1d -import deepdish as dd from . import utils as gwutils from ..core import utils @@ -206,12 +205,13 @@ class InterferometerList(list): Output file name, is 'ifo_list' if not given otherwise. A list of the included interferometers will be appended. """ + import deepdish if sys.version_info[0] < 3: raise NotImplementedError('Pickling of InterferometerList is not supported in Python 2.' 'Use Python 3 instead.') label = label + '_' + ''.join(ifo.name for ifo in self) utils.check_directory_exists_and_if_not_mkdir(outdir) - dd.io.save(self._hdf5_filename_from_outdir_label(outdir, label), self) + deepdish.io.save(self._hdf5_filename_from_outdir_label(outdir, label), self) @classmethod def from_hdf5(cls, filename=None): @@ -223,10 +223,11 @@ class InterferometerList(list): If given, try to load from this filename """ + import deepdish if sys.version_info[0] < 3: raise NotImplementedError('Pickling of InterferometerList is not supported in Python 2.' 'Use Python 3 instead.') - res = dd.io.load(filename) + res = deepdish.io.load(filename) if res.__class__ == list: res = cls(res) if res.__class__ != cls: @@ -1685,6 +1686,7 @@ class Interferometer(object): label: str, optional Output file name, is self.name if not given otherwise. """ + import deepdish if sys.version_info[0] < 3: raise NotImplementedError('Pickling of Interferometer is not supported in Python 2.' 'Use Python 3 instead.') @@ -1692,7 +1694,7 @@ class Interferometer(object): label = self.name utils.check_directory_exists_and_if_not_mkdir('outdir') filename = self._hdf5_filename_from_outdir_label(outdir, label) - dd.io.save(filename, self) + deepdish.io.save(filename, self) @classmethod def from_hdf5(cls, filename=None): @@ -1704,11 +1706,12 @@ class Interferometer(object): If given, try to load from this filename """ + import deepdish if sys.version_info[0] < 3: raise NotImplementedError('Pickling of Interferometer is not supported in Python 2.' 'Use Python 3 instead.') - res = dd.io.load(filename) + res = deepsish.io.load(filename) if res.__class__ != cls: raise TypeError('The loaded object is not an Interferometer') return res diff --git a/requirements.txt b/requirements.txt index 08303c62d22dcc3b8d35447f3dfc1cb17e0b4b14..bb184b6a62790c07f5b232056a2d89b0291f398e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,4 @@ numpy>=1.9 matplotlib>=2.0 scipy>=0.16 pandas -deepdish mock diff --git a/setup.py b/setup.py index 20f5e55776ec0549e9b6114f06fda22d9afc4d70..3f18cc07be1ab2b01eca8d122fe84980cc33b721 100644 --- a/setup.py +++ b/setup.py @@ -81,7 +81,6 @@ setup(name='bilby', 'corner', 'numpy>=1.9', 'matplotlib>=2.0', - 'deepdish', 'pandas', 'scipy'], entry_points={'console_scripts':