Skip to content
Snippets Groups Projects
Commit 10cc9f5b authored by Rafael Gort's avatar Rafael Gort Committed by Martin Teichmann
Browse files

Altered logging in dssc module. Started doc

parent 33896191
No related branches found
No related tags found
2 merge requests!98WIP: Separate digitizers from XGM, assign absolute pulse ID to XGM and digitizers data,!87Introduce package structure, generalized binning principle, ...
``Getting started`` ``Getting started``
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
Installation
------------
The ToolBox may be installed in any environment. However, it depends on the extra_data and the euxfel_bunch_pattern package, which are no official third party python modules. Within environments where the latter are not present, they need to be installed by hand.
Furthermore, as long as the ToolBox is not yet added to one of our custom environments, it needs to be installed locally. Activate your preferred environment and check installation of scs_toolbox by typing:
.. code:: bash
pip show toolbox_scs
If the toolbox has been installed in your home directory previously, everything is set up. Otherwise it needs to be installed (only once). In that case enter following command from the the ToolBox top-level directory:
.. code:: bash
pip install --user .
Alternatively, use the -e flag for installation to install the package in development mode.
.. code:: bash
pip install --user -e .
``How to`` ``How to``
~~~~~~~~~~ ~~~~~~~~~~
Top level
---------
.. code:: python3
import toolbox_scs as tb
misc
----
detectors:dssc
``Contribute`` ``Contribute``
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Code structuring, pep8
https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds
...@@ -10,4 +10,20 @@ The SCS Toolbox ...@@ -10,4 +10,20 @@ The SCS Toolbox
Module index Module index
============ ============
*to be done* *to to* (automatized doc generation)
**toolbox_scs**: Top-level entry point
**detectors**: detector specific routines
**plot**: Collected plotting routines
**routines**: Automatized evaluations involving several instruments
**misc**: Various sub-routines and helper functions
**test**: Test environment
**util**: Package related routines
...@@ -317,7 +317,6 @@ def process_dssc_module(job): ...@@ -317,7 +317,6 @@ def process_dssc_module(job):
""" """
log.info(f"processing dssc module {module}: start")
proposal = job['proposal'] proposal = job['proposal']
run_nr = job['run_nr'] run_nr = job['run_nr']
module = job['module'] module = job['module']
...@@ -331,8 +330,9 @@ def process_dssc_module(job): ...@@ -331,8 +330,9 @@ def process_dssc_module(job):
include=f'*DSSC{module:02d}*') include=f'*DSSC{module:02d}*')
ntrains = len(collection.train_ids) ntrains = len(collection.train_ids)
# read preprocessed scan variable from file - selection and (possibly) log.info(f"Processing dssc module {module}: start")
# rounding already done.
# read preprocessed scan variable from file
scan = xr.open_dataarray(scanfile, 'data', engine='h5netcdf') scan = xr.open_dataarray(scanfile, 'data', engine='h5netcdf')
# read binary pulse/train mask - e.g. from XGM thresholding # read binary pulse/train mask - e.g. from XGM thresholding
......
def dssc_safe_processed():
pass
def dssc_safe_dark():
pass
def dssc_load_mask():
pass
\ No newline at end of file
...@@ -43,7 +43,6 @@ suites = {"no-processing": ( ...@@ -43,7 +43,6 @@ suites = {"no-processing": (
"test_prepareempty", "test_prepareempty",
"test_loadchunkdata", "test_loadchunkdata",
"test_splitframes", "test_splitframes",
"test_mergechunks",
), ),
"full": ( "full": (
"test_info", "test_info",
...@@ -52,7 +51,6 @@ suites = {"no-processing": ( ...@@ -52,7 +51,6 @@ suites = {"no-processing": (
"test_prepareempty", "test_prepareempty",
"test_loadchunkdata", "test_loadchunkdata",
"test_splitframes", "test_splitframes",
"test_mergechunks",
"test_processmodule", "test_processmodule",
) )
} }
...@@ -88,6 +86,7 @@ class TestDSSC(unittest.TestCase): ...@@ -88,6 +86,7 @@ class TestDSSC(unittest.TestCase):
log_root.info("Finished global setup, start tests") log_root.info("Finished global setup, start tests")
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
log_root.info("Clean up test environment....") log_root.info("Clean up test environment....")
...@@ -159,12 +158,12 @@ class TestDSSC(unittest.TestCase): ...@@ -159,12 +158,12 @@ class TestDSSC(unittest.TestCase):
log_root.debug(f"Loaded {ntrains} trains for {sourcename}") log_root.debug(f"Loaded {ntrains} trains for {sourcename}")
@unittest.skipIf(is_dark == True, "No xgm data")
def test_splitframes(self): def test_splitframes(self):
pass cls = self.__class__
pulses_no_dark = [p for p in framepattern if 'dark' not in p]
data = tbdet.split_frames(cls._xgm, pulses_no_dark, prefix='xgm_')
def test_mergechunks(self): self.assertIsNotNone(data)
pass
def test_processmodule(self): def test_processmodule(self):
...@@ -175,7 +174,7 @@ class TestDSSC(unittest.TestCase): ...@@ -175,7 +174,7 @@ class TestDSSC(unittest.TestCase):
print('processing', chunksize, 'trains per chunk') print('processing', chunksize, 'trains per chunk')
jobs = [] jobs = []
for m in range(16): for m in range(2):
jobs.append(dict( jobs.append(dict(
proposal=proposal, proposal=proposal,
run_nr=run_nr, run_nr=run_nr,
...@@ -188,11 +187,11 @@ class TestDSSC(unittest.TestCase): ...@@ -188,11 +187,11 @@ class TestDSSC(unittest.TestCase):
print(f'start processing modules:', strftime('%X')) print(f'start processing modules:', strftime('%X'))
with multiprocessing.Pool(16) as pool: with multiprocessing.Pool(2) as pool:
module_data = pool.map(tbdet.process_dssc_module, jobs) module_data = pool.map(tbdet.process_dssc_module, jobs)
print('finished processing modules:', strftime('%X')) print('finished processing modules:', strftime('%X'))
def list_suites(): def list_suites():
print("""\nPossible test suites:\n-------------------------""") print("""\nPossible test suites:\n-------------------------""")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment