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
302fca9f
Commit
302fca9f
authored
6 years ago
by
Steffen Hauf
Browse files
Options
Downloads
Patches
Plain Diff
Autogenerate available notebook docs
parent
3ea78f34
No related branches found
No related tags found
1 merge request
!6
Clean
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+3
-0
3 additions, 0 deletions
.gitignore
docs/source/available_notebooks.rst
+0
-103
0 additions, 103 deletions
docs/source/available_notebooks.rst
docs/source/conf.py
+61
-0
61 additions, 0 deletions
docs/source/conf.py
xfel_calibrate/calibrate.py
+3
-2
3 additions, 2 deletions
xfel_calibrate/calibrate.py
with
67 additions
and
105 deletions
.gitignore
+
3
−
0
View file @
302fca9f
...
...
@@ -24,3 +24,6 @@ Test
slurm_tmp*
./temp
*egg*
docs/source/available_notebooks.rst
docs/build
This diff is collapsed.
Click to expand it.
docs/source/available_notebooks.rst
deleted
100644 → 0
+
0
−
103
View file @
3ea78f34
.. _available_notebooks:
Available Notebooks
===================
The following notebooks are currently integrated into the European XFEL
Offline Calibration tool chain.
LPD
----
Dark Images Evaluation
~~~~~~~~~~~~~~~~~~~~~~
This notebook produces offset, noise and derived bad pixel data from LPD
dark images for one capacitor setting.
.. code::
% python calibrate.py LPD dark --help
Pulse Capacitor Evaluation
~~~~~~~~~~~~~~~~~~~~~~~~~~
This notebook produces per-pixel relative gain, normalizing all memory cells
for a given pixel w.r.t. the three gain stages for a given capacitor setting.
It requires offset maps as input.
.. code::
% python calibrate.py LPD PC --help
Correction
~~~~~~~~~~
Corrects an LPD run with calibration constants from the database and/or files.
.. code::
% python calibrate.py LPD correct --help
AGIPD
-----
Dark Images Evaluation
~~~~~~~~~~~~~~~~~~~~~~
This notebook produces offset, noise and derived bad pixel data from AGIPD
dark images.
.. code::
% python calibrate.py AGIPD dark --help
Pulse Capacitor Evaluation
~~~~~~~~~~~~~~~~~~~~~~~~~~
This notebook produces per-pixel relative gain, normalizing all memory cells
for a given pixel w.r.t. the three gain stages.
.. code::
% python calibrate.py AGIPD PC --help
Flat Field Evaluation
~~~~~~~~~~~~~~~~~~~~~
This notebook produces flat field deduced correction constants, which are used
to normalize the pulse capacitor data.
.. code::
% python calibrate.py AGIPD FF --help
Combine
~~~~~~~
This notebook combines inputs from the other characterization notebooks into
a consolidated, normalized set of correction constants.
.. code::
% python calibrate.py AGIPD combine --help
Correction
~~~~~~~~~~
Corrects an AGIPD run with calibration constants from the database and/or files.
.. code::
% python calibrate.py AGIPD correct --help
This diff is collapsed.
Click to expand it.
docs/source/conf.py
+
61
−
0
View file @
302fca9f
...
...
@@ -346,3 +346,64 @@ texinfo_documents = [
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping
=
{
'
https://docs.python.org/
'
:
None
}
# generate the list of available notebooks
from
xfel_calibrate
import
notebooks
from
subprocess
import
check_output
from
textwrap
import
dedent
,
indent
from
nbconvert
import
RSTExporter
import
os
import
nbformat
rst_exporter
=
RSTExporter
()
with
open
(
"
available_notebooks.rst
"
,
"
w
"
)
as
f
:
f
.
write
(
dedent
(
"""
.. _available_notebooks:
Available Notebooks
===================
The following notebooks are currently integrated into the European XFEL
Offline Calibration tool chain.
"""
))
for
detector
in
sorted
(
notebooks
.
notebooks
.
keys
()):
values
=
notebooks
.
notebooks
[
detector
]
f
.
write
(
"
{}
\n
"
.
format
(
detector
))
f
.
write
(
"
{}
\n
"
.
format
(
"
-
"
*
len
(
detector
)))
f
.
write
(
"
\n
"
)
for
caltype
in
sorted
(
values
.
keys
()):
data
=
values
[
caltype
]
nbpath
=
os
.
path
.
abspath
(
"
{}/../../../{}
"
.
format
(
__file__
,
data
[
"
notebook
"
]))
with
open
(
nbpath
,
"
r
"
)
as
nf
:
nb
=
nbformat
.
read
(
nf
,
as_version
=
4
)
def
first_markdown_cell
(
nb
):
for
cell
in
nb
.
cells
:
if
cell
.
cell_type
==
'
markdown
'
:
return
cell
mdcell
=
first_markdown_cell
(
nb
)
nb
.
cells
=
[
mdcell
]
# we only want this single cell
body
,
_
=
rst_exporter
.
from_notebook_node
(
nb
)
adjusted
=
[]
# adjust titles
for
line
in
body
.
split
(
"
\n
"
):
if
line
.
startswith
(
"
==
"
):
line
=
line
.
replace
(
"
=
"
,
"
+
"
)
if
line
.
startswith
(
"
--
"
):
line
=
line
.
replace
(
"
-
"
,
"
~
"
)
adjusted
.
append
(
line
)
f
.
write
(
"
\n
"
.
join
(
adjusted
))
f
.
write
(
"
\n
"
)
f
.
write
(
"
To invoke this notebook and display help use:
\n\n
"
)
f
.
write
(
"
.. code-block:: bash
\n\n
"
)
f
.
write
(
"
xfel-calibrate {} {} --help
\n\n
"
.
format
(
detector
,
caltype
))
f
.
write
(
"
The full parameter list of this notebook (with defaults is):
\n\n
"
)
f
.
write
(
"
.. code-block:: bash
\n\n
"
)
nb_help
=
[
"
xfel-calibrate
"
,
detector
,
caltype
,
"
--help
"
]
output
=
check_output
(
nb_help
).
decode
(
'
utf8
'
)
f
.
write
(
indent
(
output
.
replace
(
"
DETECTOR
"
,
detector
).
replace
(
"
TYPE
"
,
caltype
),
"
"
*
4
))
f
.
write
(
"
\n\n
"
)
This diff is collapsed.
Click to expand it.
xfel_calibrate/calibrate.py
+
3
−
2
View file @
302fca9f
...
...
@@ -161,7 +161,8 @@ if len(sys.argv) == 3 and "-h" in sys.argv[2]:
# The information is extracted from the first markdown cell of
# the notebook.
for
caltype
,
notebook
in
det_notebooks
.
items
():
with
open
(
os
.
path
.
abspath
(
notebook
[
"
notebook
"
]),
"
r
"
)
as
f
:
nbpath
=
os
.
path
.
abspath
(
"
{}/../../{}
"
.
format
(
__file__
,
notebook
[
"
notebook
"
]))
with
open
(
nbpath
,
"
r
"
)
as
f
:
nb
=
nbformat
.
read
(
f
,
as_version
=
4
)
msg
+=
make_epilog
(
nb
,
caltype
=
caltype
)
...
...
@@ -176,7 +177,7 @@ elif len(sys.argv) >= 3:
detector
=
sys
.
argv
[
1
].
upper
()
caltype
=
sys
.
argv
[
2
].
upper
()
try
:
notebook
=
os
.
path
.
abspath
(
notebooks
[
detector
][
caltype
][
"
notebook
"
])
notebook
=
os
.
path
.
abspath
(
"
{}/../../{}
"
.
format
(
__file__
,
notebooks
[
detector
][
caltype
][
"
notebook
"
])
)
cvar
=
notebooks
[
detector
][
caltype
].
get
(
"
concurrency
"
,
{
"
parameter
"
:
None
,
"
default concurrency
"
:
None
,
...
...
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