Skip to content
Snippets Groups Projects
Commit 500ccd94 authored by Philipp Arras's avatar Philipp Arras
Browse files

Make h5py optional

parent ff4f61af
No related branches found
No related tags found
1 merge request!36Pypi
...@@ -19,7 +19,6 @@ import os ...@@ -19,7 +19,6 @@ import os
import pickle import pickle
from warnings import warn from warnings import warn
import h5py
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import nifty8 as ift import nifty8 as ift
import numpy as np import numpy as np
...@@ -85,6 +84,11 @@ def visualize_sky_hdf5(hdf5_file, output_file, what, stokes, norm="linear", vmin ...@@ -85,6 +84,11 @@ def visualize_sky_hdf5(hdf5_file, output_file, what, stokes, norm="linear", vmin
dpi : int dpi : int
""" """
try:
import h5py
except ImportError:
raise ImportError("Need to install the optional dependency h5py")
with h5py.File(hdf5_file, "r") as f: with h5py.File(hdf5_file, "r") as f:
if what == "mean": if what == "mean":
if "stats" in f.keys() and "mean" in f["stats"].keys(): if "stats" in f.keys() and "mean" in f["stats"].keys():
......
...@@ -142,8 +142,8 @@ setup( ...@@ -142,8 +142,8 @@ setup(
packages=find_packages(include=["resolve", "resolve.*", "resolve_support", "resolve_support.*"]), packages=find_packages(include=["resolve", "resolve.*", "resolve_support", "resolve_support.*"]),
zip_safe=True, zip_safe=True,
dependency_links=[], dependency_links=[],
install_requires=["ducc0", "matplotlib", "h5py", "scipy", "nifty8"], install_requires=["ducc0", "matplotlib", "scipy", "nifty8"],
extras_require={"full": ("astropy", "pytest", "pytest-cov", "mpi4py", "python-casacore")}, extras_require={"full": ("astropy", "pytest", "pytest-cov", "mpi4py", "python-casacore", "h5py")},
ext_modules=extensions, ext_modules=extensions,
entry_points={"console_scripts": entry_points={"console_scripts":
[ [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment