diff --git a/notebooks/LPD/LPDChar_Darks_NBC.ipynb b/notebooks/LPD/LPDChar_Darks_NBC.ipynb index 7b77d0416f6aab665b4808e12832c58f0e526daf..b9cb5083e48f0d9a07b8783b89065e9d61ddc08d 100644 --- a/notebooks/LPD/LPDChar_Darks_NBC.ipynb +++ b/notebooks/LPD/LPDChar_Darks_NBC.ipynb @@ -228,7 +228,7 @@ " cellid = np.squeeze(np.array(infile[\"{}/cellId\".format(instrument_src, channel)][first_image:last_image, ...]))\n", " infile.close()\n", " \n", - " cellid_pattern = cellid[count[0]]\n", + " cellid_pattern = cellid[:count[0]]\n", "\n", " im, g = splitOffGainLPD(im[:, 0, ...])\n", " im = im.astype(np.float32)\n", @@ -273,8 +273,8 @@ " noise > thresholds_noise_hard[1])] |= BadPixels.NOISE_OUT_OF_THRESHOLD.value\n", " bp[~np.isfinite(noise)] |= BadPixels.OFFSET_NOISE_EVAL_ERROR.value\n", "\n", - " idx = cellid == 12\n", - " return offset, noise, channel, gg, cap, bp, im[12, 12, idx], normal_test" + " idx = (cellid == cellid[0])\n", + " return offset, noise, channel, gg, cap, bp, im[12, 12, idx], normal_test, cellid_pattern" ] }, { @@ -332,7 +332,7 @@ " ntest_g[cap][qm] = np.zeros_like(offset_g[cap][qm])\n", " cellid_patterns_g[cap][qm] = cellid_pattern\n", " else:\n", - " if cellid_patterns_g[cap][qm] != cellid_pattern:\n", + " if not np.array_equal(cellid_pattern, cellid_patterns_g[cap][qm]):\n", " raise ValueError(\"Inconsistent cell ID pattern between gain stages\")\n", " \n", "\n", @@ -489,7 +489,9 @@ " # Do not store empty constants\n", " # In case of 0 trains data_g is initiated with nans and never refilled.\n", " if np.count_nonzero(~np.isnan(data_g[cap][qm]))==0:\n", + " print(f\"Constant ({cap}, {qm}) would be empty, skipping saving\")\n", " continue\n", + "\n", " for const in res[cap][qm]:\n", "\n", " dconst = getattr(Constants.LPD, const)()\n", @@ -516,8 +518,10 @@ " print(f\"Calibration constant {const} is stored locally.\\n\")\n", "\n", " print(\"Constants parameter conditions are:\\n\")\n", - " print(f\"• memory_cells: {max_cells}\\n• bias_voltage: {bias_voltage}\\n\"\n", + " print(f\"• memory_cells: {max_cells}\\n\"\n", + " f\"• bias_voltage: {bias_voltage}\\n\"\n", " f\"• capacitor: {cap}\\n\"\n", + " f\"• memory cell order: {mem_cell_order}\\n\"\n", " f\"• creation_time: {md.calibration_constant_version.begin_at if md is not None else creation_time}\\n\")" ] },