diff --git a/doc/index.rst b/doc/index.rst index 50b3c80a115e4b6e47ba3769a0aa45ca706601ab..8b99ebf08e9dc7b5f9d9319ba236e86430cf9d9c 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,10 +1,48 @@ ``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`` ~~~~~~~~~~ +Top level +--------- + +.. code:: python3 + + import toolbox_scs as tb + +misc +---- + +detectors:dssc + ``Contribute`` ~~~~~~~~~~~~~~ + +Code structuring, pep8 + +https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds diff --git a/index.rst b/index.rst index 0f838a4bbc0251459ec0fd733121920988fef92d..46e3b922ec55557d7a6375966fb1263ca31fdb3a 100644 --- a/index.rst +++ b/index.rst @@ -10,4 +10,20 @@ The SCS Toolbox 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 + + diff --git a/src/toolbox_scs/detectors/dssc.py b/src/toolbox_scs/detectors/dssc.py index 1bb38f13ebe9cd536dc9617f1457b30e21d9b0bf..31b32fcb295a00a04fdedeb6040a159a40bfe7a9 100644 --- a/src/toolbox_scs/detectors/dssc.py +++ b/src/toolbox_scs/detectors/dssc.py @@ -317,7 +317,6 @@ def process_dssc_module(job): """ - log.info(f"processing dssc module {module}: start") proposal = job['proposal'] run_nr = job['run_nr'] module = job['module'] @@ -331,8 +330,9 @@ def process_dssc_module(job): include=f'*DSSC{module:02d}*') ntrains = len(collection.train_ids) - # read preprocessed scan variable from file - selection and (possibly) - # rounding already done. + log.info(f"Processing dssc module {module}: start") + + # read preprocessed scan variable from file scan = xr.open_dataarray(scanfile, 'data', engine='h5netcdf') # read binary pulse/train mask - e.g. from XGM thresholding diff --git a/src/toolbox_scs/misc/data_handling.py b/src/toolbox_scs/misc/data_handling.py new file mode 100644 index 0000000000000000000000000000000000000000..caaef8d820d878747b574016e2cc00ab7f5379b4 --- /dev/null +++ b/src/toolbox_scs/misc/data_handling.py @@ -0,0 +1,8 @@ +def dssc_safe_processed(): + pass + +def dssc_safe_dark(): + pass + +def dssc_load_mask(): + pass \ No newline at end of file diff --git a/src/toolbox_scs/test/test_detectors_dssc.py b/src/toolbox_scs/test/test_detectors_dssc.py index eb54fac6809ff503fd940fe1428955e762befa8d..ce3757bf1f2ac00b3dfddbe1eba5f29ea04598ff 100644 --- a/src/toolbox_scs/test/test_detectors_dssc.py +++ b/src/toolbox_scs/test/test_detectors_dssc.py @@ -43,7 +43,6 @@ suites = {"no-processing": ( "test_prepareempty", "test_loadchunkdata", "test_splitframes", - "test_mergechunks", ), "full": ( "test_info", @@ -52,7 +51,6 @@ suites = {"no-processing": ( "test_prepareempty", "test_loadchunkdata", "test_splitframes", - "test_mergechunks", "test_processmodule", ) } @@ -88,6 +86,7 @@ class TestDSSC(unittest.TestCase): log_root.info("Finished global setup, start tests") + @classmethod def tearDownClass(cls): log_root.info("Clean up test environment....") @@ -159,12 +158,12 @@ class TestDSSC(unittest.TestCase): log_root.debug(f"Loaded {ntrains} trains for {sourcename}") + @unittest.skipIf(is_dark == True, "No xgm data") def test_splitframes(self): - pass - - - def test_mergechunks(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_') + self.assertIsNotNone(data) def test_processmodule(self): @@ -175,7 +174,7 @@ class TestDSSC(unittest.TestCase): print('processing', chunksize, 'trains per chunk') jobs = [] - for m in range(16): + for m in range(2): jobs.append(dict( proposal=proposal, run_nr=run_nr, @@ -188,11 +187,11 @@ class TestDSSC(unittest.TestCase): 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) print('finished processing modules:', strftime('%X')) - + def list_suites(): print("""\nPossible test suites:\n-------------------------""")