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
254ffaf7
Commit
254ffaf7
authored
6 years ago
by
Steffen Hauf
Browse files
Options
Downloads
Patches
Plain Diff
Add LPD Flatfield
parent
117b816d
No related branches found
No related tags found
1 merge request
!6
Clean
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
LPD/LPD_FlatField_Radial_per_pixel_CI_NBC.ipynb
+276
-204
276 additions, 204 deletions
LPD/LPD_FlatField_Radial_per_pixel_CI_NBC.ipynb
calibrate.py
+28
-13
28 additions, 13 deletions
calibrate.py
notebooks.py
+6
-0
6 additions, 0 deletions
notebooks.py
setup.py
+13
-6
13 additions, 6 deletions
setup.py
with
323 additions
and
223 deletions
LPD/LPD_FlatField_Radial_per_pixel_CI_NBC.ipynb
+
276
−
204
View file @
254ffaf7
This diff is collapsed.
Click to expand it.
calibrate.py
+
28
−
13
View file @
254ffaf7
#!/usr/bin/env python
import
argparse
from
datetime
import
datetime
import
nbconvert
...
...
@@ -114,6 +116,30 @@ def first_markdown_cell(nb):
if
cell
.
cell_type
==
'
markdown
'
:
return
cell
def
make_epilog
(
nb
,
caltype
=
None
):
"""
Make an epilog from the notebook to add to parser help
"""
msg
=
""
header_cell
=
first_markdown_cell
(
nb
)
lines
=
header_cell
.
source
.
split
(
"
\n
"
)
if
caltype
:
msg
+=
"
{:<15} {}
"
.
format
(
caltype
,
lines
[
0
])
+
"
\n
"
else
:
msg
+=
"
{}
"
.
format
(
lines
[
0
])
+
"
\n
"
pp
=
pprint
.
PrettyPrinter
(
indent
=
(
17
if
caltype
else
0
))
if
len
(
lines
[
1
:]):
plines
=
pp
.
pformat
(
lines
[
1
:])[
1
:
-
1
].
split
(
"
\n
"
)
for
line
in
plines
:
sline
=
line
.
replace
(
"'"
,
""
,
1
)
sline
=
sline
.
replace
(
"'
,
'"
,
"
"
*
(
17
if
caltype
else
0
),
1
)
sline
=
sline
[::
-
1
].
replace
(
"'"
,
""
,
1
)[::
-
1
]
sline
=
sline
.
replace
(
"
,
"
,
"
"
)
if
sline
[
0
]
==
"
,
"
:
sline
=
sline
[
1
:]
msg
+=
sline
+
"
\n
"
msg
+=
"
\n
"
return
msg
# extend the parser according to user input
# the first case is if a detector was given, but no calibration type
if
len
(
sys
.
argv
)
==
3
and
"
-h
"
in
sys
.
argv
[
2
]:
...
...
@@ -137,19 +163,7 @@ if len(sys.argv) == 3 and "-h" in sys.argv[2]:
for
caltype
,
notebook
in
det_notebooks
.
items
():
with
open
(
notebook
[
"
notebook
"
],
"
r
"
)
as
f
:
nb
=
nbformat
.
read
(
f
,
as_version
=
4
)
header_cell
=
first_markdown_cell
(
nb
)
lines
=
header_cell
.
source
.
split
(
"
\n
"
)
msg
+=
"
{:<15} {}
"
.
format
(
caltype
,
lines
[
0
])
+
"
\n
"
pp
=
pprint
.
PrettyPrinter
(
indent
=
17
)
if
len
(
lines
[
1
:]):
plines
=
pp
.
pformat
(
lines
[
1
:])[
1
:
-
1
].
split
(
"
\n
"
)
for
line
in
plines
:
sline
=
line
.
replace
(
"'"
,
""
,
1
)
sline
=
sline
.
replace
(
"'
,
'"
,
"
"
*
17
,
1
)
sline
=
sline
[::
-
1
].
replace
(
"'"
,
""
,
1
)[::
-
1
]
sline
=
sline
.
replace
(
"
,
"
,
"
"
)
msg
+=
sline
+
"
\n
"
msg
+=
"
\n
"
msg
+=
make_epilog
(
nb
,
caltype
=
caltype
)
parser
.
epilog
=
msg
# second case is if no detector was given either
...
...
@@ -172,6 +186,7 @@ elif len(sys.argv) >= 3:
exit
()
with
open
(
notebook
,
"
r
"
)
as
f
:
nb
=
nbformat
.
read
(
f
,
as_version
=
4
)
parser
.
description
=
make_epilog
(
nb
)
parms
=
extract_parameters
(
nb
)
for
p
in
parms
:
helpstr
=
(
"
Default: %(default)s
"
if
not
p
.
comment
...
...
This diff is collapsed.
Click to expand it.
notebooks.py
+
6
−
0
View file @
254ffaf7
...
...
@@ -44,6 +44,12 @@ notebooks = {
"
default concurrency
"
:
16
,
"
cluster cores
"
:
32
},
},
"
FF
"
:
{
"
notebook
"
:
"
LPD/LPD_FlatField_Radial_per_pixel_CI_NBC.ipynb
"
,
"
concurrency
"
:
{
"
parameter
"
:
None
,
"
default concurrency
"
:
None
,
"
cluster cores
"
:
8
},
},
"
CORRECT
"
:
{
"
notebook
"
:
"
LPD/LPD_Correct_and_Verify.ipynb
"
,
"
concurrency
"
:
{
"
parameter
"
:
None
,
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
13
−
6
View file @
254ffaf7
...
...
@@ -16,18 +16,19 @@ class PostInstallCommand(install):
print
(
"
...found!
"
)
return
except
:
"
No
t
PyDetLib installation found, attempting to install
"
"
No PyDetLib installation found, attempting to install
"
check_call
(
"
karabo -g https://in.xfel.eu/gitlab install pyDetLib master
"
.
split
())
else
:
print
(
"
Python environment seems to not be a Karabo environment.
"
+
"
Please in
n
stall PyDetLib manually.
"
)
"
Please install PyDetLib manually.
"
)
setup
(
name
=
'
European XFEL Offline Calibration
'
,
version
=
'
1.0
'
,
packages
=
[
'
cal_tools
'
,],
package_dir
=
{
'
cal_tools
'
:
'
cal_tools/cal_tools
'
},
version
=
"
1.0
"
,
packages
=
[
'
cal_tools
'
,
'
calibrate
'
],
package_dir
=
{
'
cal_tools
'
:
'
cal_tools/cal_tools
'
,
'
calibrate
'
:
'
./
'
},
cmdclass
=
{
'
install
'
:
PostInstallCommand
,
},
...
...
@@ -35,6 +36,12 @@ setup(
license
=
'
(c) European XFEL GmbH 2018
'
,
author
=
'
Steffen Hauf
'
,
author_email
=
'
steffen.hauf@xfel.eu
'
,
description
=
''
description
=
''
,
entry_points
=
{
'
console_scripts
'
:
[
'
xfel-calibrate = calibrate:run
'
,
],
},
)
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