From b90a3ad223cd0d50b27de39e08681c499c186334 Mon Sep 17 00:00:00 2001 From: ahmedk <karim.ahmed@xfel.eu> Date: Wed, 6 Jul 2022 13:04:05 +0200 Subject: [PATCH] remove src/cal_tools/gotthard2algs.pyx --- notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb | 5 +++-- src/cal_tools/gotthard2/__init__.py | 0 src/cal_tools/{ => gotthard2}/gotthard2algs.pyx | 0 tests/test_cythonalgs.py | 2 +- tests/test_gotthard2algs.py | 5 +++-- 5 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 src/cal_tools/gotthard2/__init__.py rename src/cal_tools/{ => gotthard2}/gotthard2algs.pyx (100%) diff --git a/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb b/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb index 621025e92..3832165cc 100644 --- a/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb +++ b/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb @@ -20,7 +20,7 @@ "outputs": [], "source": [ "in_folder = \"/gpfs/exfel/exp/FXE/202221/p003225/raw\" # the folder to read data from, required\n", - "out_folder = \"/gpfs/exfel/data/scratch/ahmedk/test/gotthard2\" # the folder to output to, required\n", + "out_folder = \"/gpfs/exfel/data/scratch/ahmedk/test/gotthard2\" # the folder to output to, required\n", "run = 50 # run to process, required\n", "sequences = [-1] # sequences to correct, set to [-1] for all, range allowed\n", "sequences_per_node = 1 # number of sequence files per node if notebook executed through xfel-calibrate, set to 0 to not run SLURM parallel\n", @@ -81,7 +81,8 @@ "from extra_data import RunDirectory, H5File\n", "from pathlib import Path\n", "\n", - "from cal_tools import gotthard2algs, gotthard2lib, h5_copy_except\n", + "from cal_tools import h5_copy_except\n", + "from cal_tools.gotthard2 import gotthard2algs, gotthard2lib\n", "from cal_tools.step_timing import StepTimer\n", "from cal_tools.tools import (\n", " get_constant_from_db_and_time,\n", diff --git a/src/cal_tools/gotthard2/__init__.py b/src/cal_tools/gotthard2/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/cal_tools/gotthard2algs.pyx b/src/cal_tools/gotthard2/gotthard2algs.pyx similarity index 100% rename from src/cal_tools/gotthard2algs.pyx rename to src/cal_tools/gotthard2/gotthard2algs.pyx diff --git a/tests/test_cythonalgs.py b/tests/test_cythonalgs.py index a20d23703..cff7fe33b 100644 --- a/tests/test_cythonalgs.py +++ b/tests/test_cythonalgs.py @@ -1,3 +1,3 @@ def test_import(): from cal_tools import agipdalgs # noqa - from cal_tools import gotthard2algs # noqa + from cal_tools.gotthard2 import gotthard2algs # noqa diff --git a/tests/test_gotthard2algs.py b/tests/test_gotthard2algs.py index eb461ec6d..6b5fbbd63 100644 --- a/tests/test_gotthard2algs.py +++ b/tests/test_gotthard2algs.py @@ -1,11 +1,11 @@ import numpy as np import pytest -from cal_tools.gotthard2algs import convert_to_10bit, correct_train +from cal_tools.gotthard2.gotthard2algs import convert_to_10bit, correct_train def test_convert_to_10bit(): - + """Test converting 12bit Gotthard2 image to 10bit.""" n_stripes = 10 n_pulses = 500 @@ -31,6 +31,7 @@ def test_convert_to_10bit(): @pytest.mark.parametrize("gain_corr", [True, False]) def test_correct_train(gain_corr): + """Test gotthard2 correction function.""" raw_d = np.random.randn(2700, 1280).astype(np.float32) gain = np.random.choice([0, 1, 2], size=(2700, 1280)).astype(np.uint8) -- GitLab