diff --git a/.travis.yml b/.travis.yml index d977493af..22c0998f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ before_install: - pip install -U pytest mock - pip install -U statsmodels==0.8.0rc1 - pip install -U tables + - pip install -U h5py - pip install -U tornado - pip install matplotlib==2.0.0 - ls -al diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9adfa54e4..a0afca67d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Unreleased changes ------------------ + +6.8.0 / 2017-06-13 +------------------ +* minor bugfixes +* git repository changed, ``km3pipe update develop`` is broken for + all versions below 6.8.0 + 6.7.1 / 2017-06-08 ------------------ * ControlHost improvements diff --git a/dev-requirements.txt b/dev-requirements.txt index 45b79f281..dd53c0171 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,5 @@ mock pytest pytest-cov +pytest-flake8 twine diff --git a/docs/dev.rst b/docs/dev.rst index 06f18cbbe..864063232 100644 --- a/docs/dev.rst +++ b/docs/dev.rst @@ -14,7 +14,7 @@ Enter the virtualenv:: Make a Fork of KM3Pipe ~~~~~~~~~~~~~~~~~~~~~~ -Go to ``http://git.km3net.de/tgal/km3pipe`` and click on "Fork". +Go to ``http://git.km3net.de/km3py/km3pipe`` and click on "Fork". Install in Developer Mode diff --git a/docs/install.rst b/docs/install.rst index 94f186089..fedb61580 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -46,7 +46,7 @@ To install the latest stable version::: To get the development version, use::: - $ pip install git+http://git.km3net.de/tgal/km3pipe.git@develop + $ pip install git+http://git.km3net.de/km3py/km3pipe.git@develop Updating diff --git a/docs/version.txt b/docs/version.txt index 917e16905..7e2a8fc8f 100755 --- a/docs/version.txt +++ b/docs/version.txt @@ -1,2 +1,2 @@ -KM3Pipe 6.7.1 +KM3Pipe 6.8.0 ============= diff --git a/km3pipe/__version__.py b/km3pipe/__version__.py index 109ea8d48..ec5e1d130 100644 --- a/km3pipe/__version__.py +++ b/km3pipe/__version__.py @@ -28,7 +28,7 @@ log = logging.getLogger(__name__) # pylint: disable=C0103 -version_info = (6, 7, 1, 'final', 0) +version_info = (6, 8, 0, 'final', 0) def _get_version(version_info): diff --git a/km3pipe/cmd.py b/km3pipe/cmd.py index 58878e77d..87cbb53ae 100644 --- a/km3pipe/cmd.py +++ b/km3pipe/cmd.py @@ -107,7 +107,7 @@ def runinfo(run_id, det_id, temporary=False): def update_km3pipe(git_branch=''): if git_branch == '' or git_branch is None: git_branch = 'master' - os.system("pip install -U git+http://git.km3net.de/tgal/km3pipe.git@{0}" + os.system("pip install -U git+http://git.km3net.de/km3py/km3pipe.git@{0}" .format(git_branch)) diff --git a/km3pipe/constants.py b/km3pipe/constants.py index f0e908ff2..179cb86db 100644 --- a/km3pipe/constants.py +++ b/km3pipe/constants.py @@ -43,12 +43,3 @@ # Default values for time residuals dt_window_l = -15 # ns dt_window_h = +25 # ns - -# taken from the LOI -orca_longitude = 42 + (48/60) # degree -orca_latitude = 6 + (2/60) # degree -orca_height = -2450 # m - -arca_longitude = 36 + (16/60) # degree -arca_latitude = 10 + (6/60) # degree -arca_height = -3500 # m diff --git a/km3pipe/io/pandas.py b/km3pipe/io/pandas.py index d898eb0ad..8621c9e93 100644 --- a/km3pipe/io/pandas.py +++ b/km3pipe/io/pandas.py @@ -13,7 +13,6 @@ import numpy as np import pandas as pd import tables as tb -import h5py from km3pipe.logger import logging from km3pipe.tools import insert_prefix_to_dtype @@ -38,6 +37,7 @@ class H5Chain(object): Parameters ---------- filenames: list(str), or dict(fname -> h5file) + verbose: bool [default: False] Examples -------- @@ -52,8 +52,9 @@ class H5Chain(object): >>> reco = h5['/reco'] """ - def __init__(self, filenames): + def __init__(self, filenames, verbose=False): self.filenames = filenames + self.verbose = verbose def close(self): pass @@ -67,12 +68,19 @@ def __enter__(self): def __getitem__(self, key): dfs = [] for fname in self.filenames: - with h5py.File(fname, 'r') as h5: + if self.verbose: + print('opening ', fname) + with tb.File(fname, 'r') as h5: try: - tab = h5[key][:] + tab = h5.get_node(key)[:] except KeyError as ke: log.error('{} does not exist in {}!'.format(key, fname)) raise ke + except tb.exceptions.NodeError as ne: + log.error('{} does not exist in {}!'.format(key, fname)) + raise ne + if self.verbose: + print(tab.shape) df = pd.DataFrame(tab) dfs.append(df) dfs = pd.concat(dfs, axis=0, ignore_index=True) diff --git a/km3pipe/srv.py b/km3pipe/srv.py index bec324a74..aa0b9c78b 100644 --- a/km3pipe/srv.py +++ b/km3pipe/srv.py @@ -278,7 +278,7 @@ def srv_event(token, hits, url=RBA_URL): time = list(hits['time']) tot = list(hits['tot']) if isinstance(hits, HitSeries): - pos = [(h.pos.x, h.pos.y, h.pos.z) for h in hits] + pos = [(h.pos_x, h.pos_y, h.pos_z) for h in hits] time = [h.time for h in hits] tot = [h.tot for h in hits] diff --git a/km3pipe/tests/test_cmd.py b/km3pipe/tests/test_cmd.py index 0c160fdb0..0935745c8 100644 --- a/km3pipe/tests/test_cmd.py +++ b/km3pipe/tests/test_cmd.py @@ -17,7 +17,7 @@ __status__ = "Development" -KM3PIPE_GIT = "http://git.km3net.de/tgal/km3pipe.git" +KM3PIPE_GIT = "http://git.km3net.de/km3py/km3pipe.git" class TestDetx(TestCase): diff --git a/km3pipe/utils/hdf2root.py b/km3pipe/utils/hdf2root.py index 140e2c8f7..19e83893d 100644 --- a/km3pipe/utils/hdf2root.py +++ b/km3pipe/utils/hdf2root.py @@ -52,7 +52,8 @@ def hdf2root(infile, outfile, verbose=False): if arr.dtype.names is None: dt = np.dtype((arr.dtype, [(leafname, arr.dtype)])) arr = arr.view(dt) - tree = asrootpy(array2tree(arr, name=leaf._v_pathname)) + treename = leaf._v_pathname.strip('/') + tree = asrootpy(array2tree(arr, name=treename)) tree.write() rf.close() h5.close() diff --git a/release.sh b/release.sh index 3899f8d41..d2e9b0b6d 100755 --- a/release.sh +++ b/release.sh @@ -49,10 +49,11 @@ git checkout develop git push git push --tags +set +e git checkout svn git merge master git svn dcommit svn copy "${KP_SVN}/git" "${SVN}/tag/v${VERSION}" -m "KM3Pipe Release ${VERSION}" - +# git checkout develop diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..057ef4693 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[tool:pytest] +flake8-ignore = E265