Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geomtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
dataAnalysis
geomtools
Commits
e9f2ebf5
Commit
e9f2ebf5
authored
9 months ago
by
Egor Sobolev
Browse files
Options
Downloads
Patches
Plain Diff
Add parameter to keep temporary files
parent
ffe7d8fe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/geomtools/sfx/report.py
+16
-15
16 additions, 15 deletions
src/geomtools/sfx/report.py
with
16 additions
and
15 deletions
src/geomtools/sfx/report.py
+
16
−
15
View file @
e9f2ebf5
import
argparse
import
argparse
import
pathlib
import
importlib_resources
import
importlib_resources
import
nbformat
import
nbformat
import
papermill
as
pm
import
papermill
as
pm
import
pathlib
import
yaml
import
yaml
from
traitlets.config
import
Config
from
nbconvert
import
PDFExporter
from
extra_data
import
open_run
from
extra_data
import
open_run
from
geomtools.motor
import
(
AGIPD1M_DATA_SELECTOR
,
AGIPD1M_MOTORS
,
get_physical_names
,
read_motor_positions
)
from
nbconvert
import
PDFExporter
from
traitlets.config
import
Config
from
.xwizio
import
parse_xwiz_summary
from
.crystfelio
import
extract_geometry
from
.crystfelio
import
extract_geometry
from
geomtools.motor
import
(
from
.xwizio
import
parse_xwiz_summary
read_motor_positions
,
AGIPD1M_MOTORS
,
AGIPD1M_DATA_SELECTOR
,
get_physical_names
,
)
REPO
=
pathlib
.
Path
(
"
/gpfs/exfel/data/scratch/spb_geom
"
)
REPO
=
pathlib
.
Path
(
"
/gpfs/exfel/data/scratch/spb_geom
"
)
DET
=
{
DET
=
{
...
@@ -25,7 +22,7 @@ DET = {
...
@@ -25,7 +22,7 @@ DET = {
}
}
def
make_report
(
notebook_filename
,
parameters
):
def
make_report
(
notebook_filename
,
parameters
,
clean
=
True
):
report_ref
=
importlib_resources
.
files
(
"
geomtools.sfx
"
)
/
"
report.ipynb
"
report_ref
=
importlib_resources
.
files
(
"
geomtools.sfx
"
)
/
"
report.ipynb
"
with
importlib_resources
.
as_file
(
report_ref
)
as
report_path
:
with
importlib_resources
.
as_file
(
report_ref
)
as
report_path
:
pm
.
execute_notebook
(
pm
.
execute_notebook
(
...
@@ -43,7 +40,8 @@ def make_report(notebook_filename, parameters):
...
@@ -43,7 +40,8 @@ def make_report(notebook_filename, parameters):
(
body
,
resources
)
=
pdf_exporter
.
from_notebook_node
(
notebook
)
(
body
,
resources
)
=
pdf_exporter
.
from_notebook_node
(
notebook
)
notebook_filename
.
with_suffix
(
"
.pdf
"
).
write_bytes
(
body
)
notebook_filename
.
with_suffix
(
"
.pdf
"
).
write_bytes
(
body
)
notebook_filename
.
unlink
()
if
clean
:
notebook_filename
.
unlink
()
def
push_geometry
():
def
push_geometry
():
...
@@ -57,6 +55,7 @@ def push_geometry():
...
@@ -57,6 +55,7 @@ def push_geometry():
help
=
"
Crystfel stream file
"
)
help
=
"
Crystfel stream file
"
)
parser
.
add_argument
(
'
-c
'
,
'
--connected
'
,
default
=
"
modules
"
)
parser
.
add_argument
(
'
-c
'
,
'
--connected
'
,
default
=
"
modules
"
)
parser
.
add_argument
(
'
-r
'
,
'
--report-only
'
,
action
=
"
store_true
"
)
parser
.
add_argument
(
'
-r
'
,
'
--report-only
'
,
action
=
"
store_true
"
)
parser
.
add_argument
(
'
--keep-tmp-files
'
,
action
=
"
store_true
"
,
default
=
False
)
parser
.
add_argument
(
'
detector
'
,
choices
=
DET
.
keys
())
parser
.
add_argument
(
'
detector
'
,
choices
=
DET
.
keys
())
parser
.
add_argument
(
'
tag
'
)
parser
.
add_argument
(
'
tag
'
)
parser
.
add_argument
(
'
sample
'
)
parser
.
add_argument
(
'
sample
'
)
...
@@ -171,11 +170,13 @@ def push_geometry():
...
@@ -171,11 +170,13 @@ def push_geometry():
prefix
=
prefix
,
prefix
=
prefix
,
output_dir
=
str
(
output_dir
.
absolute
()),
output_dir
=
str
(
output_dir
.
absolute
()),
)
)
make_report
(
notebook_filename
,
report_parameters
)
make_report
(
notebook_filename
,
report_parameters
,
clean
=
not
args
.
keep_tmp_files
)
if
args
.
report_only
:
if
args
.
report_only
:
print
(
"
Clean up files...
"
)
if
not
args
.
keep_tmp_files
:
geom_file
.
unlink
()
print
(
"
Clean up files...
"
)
geom_file
.
unlink
()
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
...
...
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