diff --git a/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb index f59eceda1c14960f0243ee7c18417431ec8ba09b..c6025ee092757085593441aade89e4b4405a4e24 100644 --- a/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb +++ b/notebooks/Jungfrau/Jungfrau_Create_Fit_Spectra_Histos_NBC.ipynb @@ -61,7 +61,7 @@ "n_sigma = 5. # n of sigma above pedestal threshold\n", "ratio = 0.99 # ratio of the next peak amplitude in the peak_finder\n", "rebin_factor = 1 # Number of adjacent bins to combine before fitting the histogram.\n", - "\n", + "initial_sigma = 15. # initial sigma used when fitting the histogram\n", "\n", "def find_das(in_folder, runs, karabo_da):\n", " run = runs[0]\n", @@ -99,7 +99,10 @@ "from cal_tools.jungfrau import jungfrau_ff\n", "from cal_tools.jungfrau.jungfraulib import JungfrauCtrl\n", "from cal_tools.step_timing import StepTimer\n", - "from cal_tools.tools import calcat_creation_time" + "from cal_tools.tools import (\n", + " calcat_creation_time,\n", + " write_constants_fragment,\n", + ")" ] }, { @@ -264,7 +267,12 @@ "jf_metadata = jf_cal.metadata(\n", " calibrations=[\"Offset10Hz\", \"Noise10Hz\"])\n", "\n", - "# TODO: display CCV timestamp\n", + "# Record constant details in YAML metadata\n", + "write_constants_fragment(\n", + " out_folder=(metadata_folder or out_folder),\n", + " det_metadata=jf_metadata,\n", + " caldb_root=jf_cal.caldb_root)\n", + "\n", "const_data = jf_cal.ndarray_map(metadata=jf_metadata)\n", "jf_cal.display_markdown_retrieved_constants(metadata=jf_metadata)\n", "\n", @@ -360,8 +368,7 @@ " d -= offset\n", " # Sort correct data based on memory cell order.\n", " sort_indices = np.argsort(m)\n", - " data_corr[index, ...] = d[sort_indices, ...]\n", - " " + " data_corr[index, ...] = d[sort_indices, ...]" ] }, { @@ -537,6 +544,7 @@ " rebin_factor,\n", " ratio,\n", " const_data[da][\"Noise10Hz\"],\n", + " initial_sigma,\n", " )\n", " print(f\"Starting spectra fit for {len(chunks)} chunks\")\n", "\n",