diff --git a/bilby/core/result.py b/bilby/core/result.py index 9fb59d2adcc58c664bcf2ec0e09953ac91fef890..fb26371cbb821fcc671cbb6783f003d97e165cf5 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 @@ -191,6 +190,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): @@ -424,6 +424,7 @@ class Result(object): with open(file_name, 'w') as file: json.dump(dictionary, file, indent=2, cls=BilbyJsonEncoder) 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 30bf744352d3d5a97e94f2c7e4e784f479caba8a..1db3f6336d47e464959a5a5ab71fbddab94734d8 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 = deepdish.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 c7a3f577f588989fe1e967b2cc06b659c7ffd87c..02df8d39a3fba50000228726d142d4773a36f344 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':