Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
calibration
pycalibration
Commits
49d31851
Commit
49d31851
authored
4 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Stripping some trailing spaces
parent
fdd736f4
No related branches found
No related tags found
1 merge request
!438
Feat/agipd add fixed gain mode to dark notebook
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb
+24
-24
24 additions, 24 deletions
notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb
with
24 additions
and
24 deletions
notebooks/AGIPD/Characterize_AGIPD_Gain_Darks_NBC.ipynb
+
24
−
24
View file @
49d31851
...
...
@@ -136,7 +136,7 @@
"gains = np.arange(3)\n",
"\n",
"max_cells = mem_cells\n",
"
\n",
"\n",
"offset_runs = OrderedDict()\n",
"offset_runs[\"high\"] = run_high\n",
"offset_runs[\"med\"] = run_med\n",
...
...
@@ -204,7 +204,7 @@
" gsettings.append(get_gain_setting(control_fname, h5path_ctrl))\n",
" if not all(g == gsettings[0] for g in gsettings):\n",
" raise ValueError(f\"Different gain settings for the 3 input runs {gsettings}\")\n",
" gain_setting = gsettings[0]
\n",
" gain_setting = gsettings[0]\n",
" except Exception as e:\n",
" print(f'Error while reading gain setting from: \\n{control_fname}')\n",
" print(f'Error: {e}')\n",
...
...
@@ -229,7 +229,7 @@
"h5path = h5path.format(karabo_id, receiver_id)\n",
"h5path_idx = h5path_idx.format(karabo_id, receiver_id)\n",
"\n",
"if bias_voltage == 0:
\n",
"if bias_voltage == 0:\n",
" # Read the bias voltage from files, if recorded.\n",
" # If not available, make use of the historical voltage the detector is running at\n",
" bias_voltage = get_bias_voltage(control_names[0], karabo_id_control)\n",
...
...
@@ -621,15 +621,15 @@
" acquisition_rate=acq_rate,\n",
" gain_setting=gain_setting)\n",
" if db_output:\n",
" md = send_to_db(db_module, karabo_id, dconst, condition, file_loc,
\n",
" md = send_to_db(db_module, karabo_id, dconst, condition, file_loc,\n",
" report, cal_db_interface, creation_time=creation_time,\n",
" timeout=cal_db_timeout)\n",
"\n",
" if local_output:\n",
" md = save_const_to_h5(db_module, karabo_id, dconst, condition, dconst.data,
\n",
" md = save_const_to_h5(db_module, karabo_id, dconst, condition, dconst.data,\n",
" file_loc, report, creation_time, out_folder)\n",
" print(f\"Calibration constant {const} is stored locally.\\n\")\n",
"
\n",
"\n",
" print(\"Constants parameter conditions are:\\n\")\n",
" print(f\"• memory_cells: {max_cells}\\n• bias_voltage: {bias_voltage}\\n\"\n",
" f\"• acquisition_rate: {acq_rate}\\n• gain_setting: {gain_setting}\\n\"\n",
...
...
@@ -724,18 +724,18 @@
" BadPixels.OFFSET_OUT_OF_THRESHOLD.value: (BadPixels.OFFSET_OUT_OF_THRESHOLD.name, '#00FF0080'),\n",
" BadPixels.GAIN_THRESHOLDING_ERROR.value: (BadPixels.GAIN_THRESHOLDING_ERROR.name, '#FF40FF40'),\n",
" BadPixels.OFFSET_OUT_OF_THRESHOLD.value | BadPixels.NOISE_OUT_OF_THRESHOLD.value: ('OFFSET_OUT_OF_THRESHOLD + NOISE_OUT_OF_THRESHOLD', '#DD00DD80'),\n",
" BadPixels.OFFSET_OUT_OF_THRESHOLD.value | BadPixels.NOISE_OUT_OF_THRESHOLD.value |
\n",
" BadPixels.OFFSET_OUT_OF_THRESHOLD.value | BadPixels.NOISE_OUT_OF_THRESHOLD.value |\n",
" BadPixels.GAIN_THRESHOLDING_ERROR.value: ('MIXED', '#BFDF009F')}\n",
"\n",
"if high_res_badpix_3d:\n",
" display(Markdown(\"\"\"\n",
"
\n",
"\n",
" ## Global Bad Pixel Behaviour ##\n",
"\n",
" The following plots show the results of bad pixel evaluation for all evaluated memory cells.
\n",
" Cells are stacked in the Z-dimension, while pixels values in x/y are rebinned with a factor of 2.
\n",
" This excludes single bad pixels present only in disconnected pixels.
\n",
" Hence, any bad pixels spanning at least 4 pixels in the x/y-plane, or across at least two memory cells are indicated.
\n",
" The following plots show the results of bad pixel evaluation for all evaluated memory cells.\n",
" Cells are stacked in the Z-dimension, while pixels values in x/y are rebinned with a factor of 2.\n",
" This excludes single bad pixels present only in disconnected pixels.\n",
" Hence, any bad pixels spanning at least 4 pixels in the x/y-plane, or across at least two memory cells are indicated.\n",
" Colors encode the bad pixel type, or mixed type.\n",
"\n",
" \"\"\"))\n",
...
...
@@ -848,10 +848,10 @@
" for bit in bits:\n",
" l_data_old.append(np.count_nonzero(old_const['BadPixelsDark'][:, :, :, gain] & bit.value))\n",
"\n",
" l_data_name = ['All bad pixels', 'NOISE_OUT_OF_THRESHOLD',
\n",
" l_data_name = ['All bad pixels', 'NOISE_OUT_OF_THRESHOLD',\n",
" 'OFFSET_OUT_OF_THRESHOLD', 'OFFSET_NOISE_EVAL_ERROR', 'GAIN_THRESHOLDING_ERROR']\n",
"\n",
" l_threshold = ['', f'{thresholds_noise_sigma}' f'{thresholds_noise_hard[gain]}',
\n",
" l_threshold = ['', f'{thresholds_noise_sigma}' f'{thresholds_noise_hard[gain]}',\n",
" f'{thresholds_offset_sigma}' f'{thresholds_offset_hard[gain]}',\n",
" '', f'{thresholds_gain_sigma}']\n",
"\n",
...
...
@@ -874,9 +874,9 @@
"\n",
"'''))\n",
"if len(table)>0:\n",
" md = display(Latex(tabulate.tabulate(table, tablefmt='latex',
\n",
" headers=[\"Pixel type\", \"Threshold\",
\n",
" \"New constant\", \"Old constant\"])))
"
" md = display(Latex(tabulate.tabulate(table, tablefmt='latex',\n",
" headers=[\"Pixel type\", \"Threshold\",\n",
" \"New constant\", \"Old constant\"])))"
]
},
{
...
...
@@ -885,9 +885,9 @@
"metadata": {},
"outputs": [],
"source": [
"header = ['Parameter',
\n",
" \"New constant\", \"Old constant \",
\n",
" \"New constant\", \"Old constant \",
\n",
"header = ['Parameter',\n",
" \"New constant\", \"Old constant \",\n",
" \"New constant\", \"Old constant \",\n",
" \"New constant\", \"Old constant \",\n",
" \"New constant\", \"Old constant \"]\n",
"\n",
...
...
@@ -897,15 +897,15 @@
" ['Offset', 'Noise', 'ThresholdsDark']\n",
"\n",
"for const in constants:\n",
"
\n",
"\n",
" if const == 'ThresholdsDark':\n",
" table = [['','HG-MG threshold', 'HG-MG threshold', 'MG-LG threshold', 'MG-LG threshold']]\n",
" else:
\n",
" else:\n",
" table = [['','High gain', 'High gain', 'Medium gain', 'Medium gain', 'Low gain', 'Low gain']]\n",
"\n",
" for qm in res.keys():\n",
" data = np.copy(res[qm][const])\n",
"
\n",
"\n",
" if const == 'ThresholdsDark':\n",
" data[...,0][res[qm]['BadPixelsDark'][...,0]>0] = np.nan\n",
" data[...,1][res[qm]['BadPixelsDark'][...,1]>0] = np.nan\n",
...
...
@@ -938,7 +938,7 @@
" table.append(line)\n",
"\n",
" display(Markdown('### {} [ADU], good pixels only ###'.format(const)))\n",
" md = display(Latex(tabulate.tabulate(table, tablefmt='latex', headers=header)))
"
" md = display(Latex(tabulate.tabulate(table, tablefmt='latex', headers=header)))"
]
}
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment