diff --git a/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb index 6a8eef93999bc34a4980993c15b83a2a7df9838c..be566bb2cfff4a960830a2da8485eb3a8f8b2223 100644 --- a/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb +++ b/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb @@ -41,7 +41,7 @@ "det_src_template = '{}/DET/{}:daqOutput'\n", "control_src_template = '{}/DET/CONTROL'\n", "extra_dims = ['cell', 'row', 'col'] # labels for the DataArray dims after the first\n", - "_fit_func = 'CHARGE_SHARING' # function used to fit the single photon peak\n", + "fit_func = 'CHARGE_SHARING' # function used to fit the single photon peak\n", "off_sub = True\n", "adc_fit = True\n", "is_strixel = False\n", @@ -481,7 +481,7 @@ "metadata": {}, "outputs": [], "source": [ - "fout_temp = f\"R{runs[0]:04d}_{proposal.upper()}_Gain_Spectra_{{}}_{_fit_func}_Fit.h5\"\n", + "fout_temp = f\"R{runs[0]:04d}_{proposal.upper()}_Gain_Spectra_{{}}_{fit_func}_Fit.h5\"\n", "\n", "for da in karabo_da:\n", " _edges = np.array(edges[da])\n", @@ -497,7 +497,7 @@ " partial_fit = partial(\n", " jungfrau_ff.fit_histogram,\n", " x,\n", - " _fit_func,\n", + " fit_func,\n", " n_sigma,\n", " rebin,\n", " ratio,\n", diff --git a/notebooks/Jungfrau/Jungfrau_Create_Gain_maps_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Create_Gain_maps_NBC.ipynb index c13351f6ccabebb59f61d8ab7d7c5c75d78cad57..52e339e81a5004f53cc856eb89151fb915116199 100755 --- a/notebooks/Jungfrau/Jungfrau_Create_Gain_maps_NBC.ipynb +++ b/notebooks/Jungfrau/Jungfrau_Create_Gain_maps_NBC.ipynb @@ -31,7 +31,7 @@ "\n", "karabo_id = 'MID_EXP_JF500K2' # karabo prefix of Jungfrau devices\n", "karabo_da = ['']\n", - "_fit_func = 'CHARGE_SHARING' # function used to fit the single photon peak\n", + "fit_func = 'CHARGE_SHARING' # function used to fit the single photon peak\n", "gains = [0, 1, 2]\n", "# Parameter conditions\n", "bias_voltage = -1 # detector bias voltage\n", @@ -44,7 +44,7 @@ "# Condition limits\n", "bias_voltage_lims = [0, 200]\n", "integration_time_lims = [0.1, 1000]\n", - "spectra_fit_temp = 'R{:04d}_{}_Gain_Spectra_{}_{}_Fit.h5' # 'R{:04d}_{proposal.upper()}_Gain_Spectra_{da}_{_fit_func}_Fit.h5'\n", + "spectra_fit_temp = 'R{:04d}_{}_Gain_Spectra_{}_{}_Fit.h5' # 'R{:04d}_{proposal.upper()}_Gain_Spectra_{da}_{fit_func}_Fit.h5'\n", "creation_time = \"\" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. \"2022-06-28 13:00:00\"\n", "g_map_old = '' # '/gpfs/exfel/data/user/mramilli/jungfrau/module_PSI_gainmaps/M302/gainMaps_M302_2022-02-23.h5' # old gain map file path to calculate gain ratios G0/G1 and G1/G2. Set to \"\" to get last gain constant from the database.\n", "old_gain_dataset_name = 'gain_map_g0' # name of the data structure in the old gain map\n", @@ -55,11 +55,11 @@ "g0_fit_dataset = 'gainMap_fit' # name of the data structure in the fit files\n", "E_ph = 8.048 # photon energy of the peak fitted\n", "badpixel_threshold_sigma = 3. # number of std in gain distribution to mark bad pixels\n", - "_roi = [0, 1024, 0, 256] # ROI to consider to evaluate gain distribution (for bad pixels evaluation)\n", + "roi = [0, 1024, 0, 256] # ROI to consider to evaluate gain distribution (for bad pixels evaluation)\n", "control_src_template = '{}/DET/CONTROL'\n", "\n", "# CALCAT API parameters\n", - "cal_db_interface = \"tcp://max-exfl-cal-001:8020\" # the database interface to use\n", + "cal_db_interface = \"tcp://max-exfl-cal001:8020\" # the database interface to use\n", "cal_db_timeout = 180000\n", "\n", "\n", @@ -121,7 +121,7 @@ "outputs": [], "source": [ "run = runs[0]\n", - "out_folder = Path(out_folder) # TODO\n", + "out_folder = Path(out_folder)\n", "proposal = list(filter(None, in_folder.strip('/').split('/')))[-2]\n", "file_loc = f\"proposal:{proposal} runs:{run}\"\n", "report = get_report(metadata_folder)\n", @@ -154,7 +154,7 @@ "g0_new = dict()\n", "for da in karabo_da:\n", " with h5file(\n", - " out_folder / spectra_fit_temp.format(run, proposal.upper(), da, _fit_func),\n", + " out_folder / spectra_fit_temp.format(run, proposal.upper(), da, fit_func),\n", " 'r'\n", " ) as f:\n", " if is_strixel:\n", @@ -337,7 +337,7 @@ " if correct_offset:\n", " display(Markdown(\"#### Correct with better pedestal estimation\"))\n", " with h5file(\n", - " out_folder / spectra_fit_temp.format(run, proposal.upper(), da, _fit_func),\n", + " out_folder / spectra_fit_temp.format(run, proposal.upper(), da, fit_func),\n", " 'r'\n", " ) as fc:\n", " corr = np.array(fc[g0_fit_dataset])\n", @@ -445,7 +445,7 @@ " \n", " return mskd\n", "\n", - "def eval_bpidx(d_in, badpixel_threshold_sigma=badpixel_threshold_sigma, roi=_roi):\n", + "def eval_bpidx(d_in, badpixel_threshold_sigma=badpixel_threshold_sigma, roi=roi):\n", " \"\"\"\n", " evaluates the indexes of the pixels with high deviation from the median value\n", " args:\n", diff --git a/notebooks/Jungfrau/Jungfrau_gain_Spectra_Fit_Summary_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_gain_Spectra_Fit_Summary_NBC.ipynb index 853ec36c59753feb63ba2daef5c1d4e3b3ec79a8..2873982acaf2773caff82eff5a93aba7aa30febd 100644 --- a/notebooks/Jungfrau/Jungfrau_gain_Spectra_Fit_Summary_NBC.ipynb +++ b/notebooks/Jungfrau/Jungfrau_gain_Spectra_Fit_Summary_NBC.ipynb @@ -25,7 +25,7 @@ "karabo_da = [] # list of data aggregators, which corresponds to different JF modules. This is only needed for the detectors of one module.\n", "karabo_id = \"SPB_IRDA_JF4M\" # detector identifier.\n", "creation_time = \"\" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. \"2022-06-28 13:00:00\"\n", - "_fit_func = 'CHARGE_SHARING' # function used to fit the single photon peak\\\n", + "fit_func = 'CHARGE_SHARING' # function used to fit the single photon peak\\\n", "g0_fit_dataset = 'gainMap_fit' # name of the data structure in the fit files\n", "spectra_fit_temp = 'R{:04d}_{}_Gain_Spectra_{}_{}_Fit.h5'" ] @@ -46,7 +46,7 @@ "import matplotlib.gridspec as gridspec\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "from IPython.display import Markdown, display\n", + "from IPython.display import display\n", "\n", "matplotlib.use(\"agg\")\n", "%matplotlib inline\n", @@ -93,7 +93,7 @@ "\n", "for i, da in enumerate (da_to_pdu.keys()):\n", " with h5file(\n", - " Path(out_folder) / spectra_fit_temp.format(run, proposal.upper(), da, _fit_func),\n", + " Path(out_folder) / spectra_fit_temp.format(run, proposal.upper(), da, fit_func),\n", " 'r'\n", " ) as f:\n", " stacked_constants[i] = np.moveaxis(\n", @@ -128,7 +128,7 @@ "\n", "for i, da in enumerate (da_to_pdu.keys()):\n", " with h5file(\n", - " Path(out_folder) / spectra_fit_temp.format(run, proposal.upper(), da, _fit_func),\n", + " Path(out_folder) / spectra_fit_temp.format(run, proposal.upper(), da, fit_func),\n", " 'r'\n", " ) as f:\n", " stacked_constants[i] = np.moveaxis(\n", diff --git a/notebooks/Jungfrau/Jungfrau_gain_map_Summary_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_gain_map_Summary_NBC.ipynb index 5939c1e2a0bc76be9bed9e1a4879de3c5a51d29a..3f70fcc90a122b1dde2e6cfd703108cbe0d91437 100644 --- a/notebooks/Jungfrau/Jungfrau_gain_map_Summary_NBC.ipynb +++ b/notebooks/Jungfrau/Jungfrau_gain_map_Summary_NBC.ipynb @@ -25,7 +25,6 @@ "karabo_da = [] # list of data aggregators, which corresponds to different JF modules. This is only needed for the detectors of one module.\n", "karabo_id = \"SPB_IRDA_JF4M\" # detector identifier.\n", "creation_time = \"\" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. \"2022-06-28 13:00:00\"\n", - "_fit_func = 'CHARGE_SHARING' # function used to fit the single photon peak\n", "g0_fit_dataset = 'gainMap_fit' # name of the data structure in the fit files" ] },