diff --git a/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb b/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb index cb1e13f64cfc762a9080a2c63c551e93b582d8ea..f3e8d5cf8d7bdb397b27b50d376eedab3058c9ff 100644 --- a/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb +++ b/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb @@ -45,7 +45,6 @@ "creation_time = \"\" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC.00 e.g. 2019-07-04 11:02:41.00\n", "\n", "# Parameters used for injecting calibration constants.\n", - "set_parameters_manually = False # Boolean for setting parameter values manually instead of reading control values.\n", "fix_temperature_top = 0. # fix temperature of top pnCCD sensor in K. Set to 0, to use the value from slow data\n", "fix_temperature_bot = 0. # fix temperature of bottom pnCCD sensor in K. Set to 0, to use the value from slow data\n", "temp_limits = 5 # temperature limits in which calibration parameters are considered equal\n", @@ -59,7 +58,7 @@ "sigmaNoise = 10. # pixels whose signal value exceeds sigmaNoise*noise will be considered as cosmics and are masked\n", "bad_pixel_offset_sigma = 4. # any pixel whose offset beyond this standard deviations is a bad pixel\n", "bad_pixel_noise_sigma = 4. # any pixel whose noise beyond this standard deviations is a bad pixel\n", - "max_trains = 500 # Maximum number of trains to use for dark processing.\n", + "max_trains = 500 # Maximum number of trains to use for dark processing. Set to 0 to process all trains.\n", "min_trains = 1 # Minimum number of trains to proceed with dark processing.\n", "\n", "# Don't delete. myMDC sends this parameter by default.\n", @@ -185,18 +184,16 @@ "run_dc = RunDirectory(f\"{in_folder}/r{run:04d}\")\n", "\n", "# extract control data\n", - "if not set_parameters_manually:\n", - " ctrl_data = pnccdlib.PnccdCtrl(run_dc, karabo_id)\n", - " \n", - " if bias_voltage == 0:\n", - " bias_voltage = ctrl_data.get_bias_voltage()\n", - " if gain == -1:\n", - " gain = ctrl_data.get_gain()\n", - " if fix_temperature_top == 0:\n", - " fix_temperature_top = ctrl_data.get_fix_temperature_top()\n", - " if fix_temperature_bot == 0:\n", - " fix_temperature_bot = ctrl_data.get_fix_temperature_bot()\n", + "ctrl_data = pnccdlib.PnccdCtrl(run_dc, karabo_id)\n", "\n", + "if bias_voltage == 0:\n", + " bias_voltage = ctrl_data.get_bias_voltage()\n", + "if gain == -1:\n", + " gain = ctrl_data.get_gain()\n", + "if fix_temperature_top == 0:\n", + " fix_temperature_top = ctrl_data.get_fix_temperature_top()\n", + "if fix_temperature_bot == 0:\n", + " fix_temperature_bot = ctrl_data.get_fix_temperature_bot()\n", "\n", "# Printing the Parameters Read from the Data File:\n", "display(Markdown('### Detector Parameters'))\n", @@ -253,7 +250,7 @@ "data = data.astype(np.float32)\n", "\n", "noiseMap = np.std(data, axis=0, dtype=np.float64)\n", - "offsetMap = np.mean(data, axis=0)\n", + "offsetMap = np.mean(data, axis=0, dtype=np.float64)\n", "step_timer.done_step(f'Initial maps are created from {n_trains} trains.')" ] }, diff --git a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb index ed111a76d780b7dafb59f0391c1a33afd047824f..f7bc8a91781e608289f94dd99dd377f4bff0bd23 100644 --- a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb +++ b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb @@ -37,7 +37,6 @@ "saturated_threshold = 32000. # full well capacity in ADU\n", "\n", "# Conditions for retrieving calibration constants\n", - "set_parameters_manually = False # Boolean for setting parameter values manually instead of reading control values.\n", "fix_temperature_top = 0. # fix temperature for top sensor in K, set to 0. to use value from slow data.\n", "fix_temperature_bot = 0. # fix temperature for bottom senspr in K, set to 0. to use value from slow data.\n", "gain = -1 # the detector's gain setting. Set to -1 to use the value from the slow data.\n", @@ -186,23 +185,19 @@ "run_dc = RunDirectory(Path(in_folder) / f\"r{run:04d}\")\n", "ctrl_data = pnccdlib.PnccdCtrl(run_dc, karabo_id)\n", "\n", - "proposal = run_dc.run_metadata()[\"proposalNumber\"]\n", - "print(f'Proposal: {proposal}, Run: {run}')\n", - "\n", "# extract control data\n", - "if not set_parameters_manually:\n", - " step_timer.start()\n", + "step_timer.start()\n", "\n", - " if bias_voltage == 0.:\n", - " bias_voltage = ctrl_data.get_bias_voltage()\n", - " if gain == -1:\n", - " gain = ctrl_data.get_gain()\n", - " if fix_temperature_top == 0:\n", - " fix_temperature_top = ctrl_data.get_fix_temperature_top()\n", - " if fix_temperature_bot == 0:\n", - " fix_temperature_bot = ctrl_data.get_fix_temperature_bot()\n", + "if bias_voltage == 0.:\n", + " bias_voltage = ctrl_data.get_bias_voltage()\n", + "if gain == -1:\n", + " gain = ctrl_data.get_gain()\n", + "if fix_temperature_top == 0:\n", + " fix_temperature_top = ctrl_data.get_fix_temperature_top()\n", + "if fix_temperature_bot == 0:\n", + " fix_temperature_bot = ctrl_data.get_fix_temperature_bot()\n", "\n", - " step_timer.done_step(\"Reading control parameters.\")\n", + "step_timer.done_step(\"Reading control parameters.\")\n", "\n", "# Printing the Parameters Read from the Data File:\n", "display(Markdown('### Detector Parameters'))\n", @@ -791,8 +786,7 @@ " # Copy RAW non-calibrated sources.\n", " with h5py.File(seq_f, 'r') as sfile:\n", " h5_copy_except.h5_copy_except_paths(\n", - " sfile, ofile,\n", - " [\"INSTRUMENT/\"+instrument_src+\"/data/image\"],\n", + " sfile, ofile, [],\n", " )\n", " # TODO: to clear this up: why save corrected data in data/pixels rather than data/image.\n", " write_datasets(corr_arrays, ofile)\n",