From a5f89b0942504c5d0f4ef8833242d97deca8ffd3 Mon Sep 17 00:00:00 2001 From: Laurent Mercadier <laurent.mercadier@xfel.eu> Date: Wed, 14 Apr 2021 21:54:16 +0200 Subject: [PATCH] Fix in doc for load, removed load_run, updated load test and DSSCBinner init accordingly --- doc/load.rst | 2 +- src/toolbox_scs/__init__.py | 4 +--- src/toolbox_scs/detectors/dssc.py | 4 ++-- src/toolbox_scs/load.py | 32 +------------------------- src/toolbox_scs/test/test_top_level.py | 2 +- 5 files changed, 6 insertions(+), 38 deletions(-) diff --git a/doc/load.rst b/doc/load.rst index a21f8d6..6e2df26 100644 --- a/doc/load.rst +++ b/doc/load.rst @@ -30,7 +30,7 @@ run is an extra_data dataCollection and data is an xarray Dataset containing all proposalNr = 2565 runNr = 19 - run, _ = tb.load_run(proposalNr, runNr) + run, _ = tb.load(proposalNr, runNr) data = run.get_array(*mnemonic.values()) run is an extra_data dataCollection and data an xarray dataArray for a single data source. diff --git a/src/toolbox_scs/__init__.py b/src/toolbox_scs/__init__.py index fede7d9..47d2252 100644 --- a/src/toolbox_scs/__init__.py +++ b/src/toolbox_scs/__init__.py @@ -1,5 +1,4 @@ -from .load import (load, concatenateRuns, get_array, - load_run, run_by_path) +from .load import (load, concatenateRuns, get_array, run_by_path) from .constants import mnemonics @@ -8,7 +7,6 @@ __all__ = ( "load", "concatenateRuns", "get_array", - "load_run", "run_by_path", # Classes # Variables diff --git a/src/toolbox_scs/detectors/dssc.py b/src/toolbox_scs/detectors/dssc.py index 48535ab..edcf928 100644 --- a/src/toolbox_scs/detectors/dssc.py +++ b/src/toolbox_scs/detectors/dssc.py @@ -19,7 +19,7 @@ import joblib import numpy as np import xarray as xr -from ..load import load_run +from ..load import load from ..util.exceptions import ToolBoxValueError, ToolBoxFileError from .dssc_data import ( save_xarray, load_xarray, save_attributes_h5, @@ -84,7 +84,7 @@ class DSSCBinner: self.proposal = proposal_nr self.runnr = run_nr self.info = load_dssc_info(proposal_nr, run_nr) - self.run = load_run(proposal_nr, run_nr) + self.run, _ = load(proposal_nr, run_nr) self.binners = {} for b in binners: self.add_binner(b, binners[b]) diff --git a/src/toolbox_scs/load.py b/src/toolbox_scs/load.py index 8cb17d4..61fd815 100644 --- a/src/toolbox_scs/load.py +++ b/src/toolbox_scs/load.py @@ -37,7 +37,7 @@ def load(proposalNB=None, runNB=None, ---------- proposalNB: (str, int) - of the proposal number e.g. 'p002252' or 2252 + proposal number e.g. 'p002252' or 2252 runNB: (str, int) run number as integer fields: list of strings, list of dictionaries @@ -146,36 +146,6 @@ def load(proposalNB=None, runNB=None, return run, result -def load_run(proposal, run, **kwargs): - """ - Get run in given proposal - - Wraps the extra_data open_run routine, out of convenience for the toolbox - user. More information can be found in the extra_data documentation. - - Parameters - ---------- - proposal: str, int - Proposal number - run: str, int - Run number - - **kwargs - -------- - data: str - default -> 'raw' - include: str - default -> '*' - - Returns - ------- - run : extra_data.DataCollection - DataCollection object containing information about the specified - run. Data can be loaded using built-in class methods. - """ - return ed.open_run(proposal, run, **kwargs) - - def run_by_path(path): """ Return specified run diff --git a/src/toolbox_scs/test/test_top_level.py b/src/toolbox_scs/test/test_top_level.py index 60e4d46..24d74bd 100644 --- a/src/toolbox_scs/test/test_top_level.py +++ b/src/toolbox_scs/test/test_top_level.py @@ -71,7 +71,7 @@ class TestToolbox(unittest.TestCase): self.assertEqual(tb_exception.message, exp_msg) def test_openrun(self): - run = tb.load_run(2212, 235) + run, _ = tb.load(2212, 235) src = 'SCS_DET_DSSC1M-1/DET/0CH0:xtdf' self.assertTrue(src in run.all_sources) -- GitLab