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
2e9c25af
Commit
2e9c25af
authored
1 year ago
by
Egor Sobolev
Browse files
Options
Downloads
Patches
Plain Diff
Add script to refine geometry using SFX data
parent
3143f84e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyproject.toml
+1
-0
1 addition, 0 deletions
pyproject.toml
src/geomtools/detector/crystfel_frm.py
+1
-1
1 addition, 1 deletion
src/geomtools/detector/crystfel_frm.py
src/geomtools/sfx/optimiser.py
+45
-0
45 additions, 0 deletions
src/geomtools/sfx/optimiser.py
with
47 additions
and
1 deletion
pyproject.toml
+
1
−
0
View file @
2e9c25af
...
...
@@ -29,3 +29,4 @@ dependencies = [
]
[project.scripts]
geomtools-push
=
"geomtools.sfx.report:push_geometry"
geomtools-refine-sfx
=
"geomtools.sfx.optimiser:refine"
This diff is collapsed.
Click to expand it.
src/geomtools/detector/crystfel_frm.py
+
1
−
1
View file @
2e9c25af
...
...
@@ -6,7 +6,7 @@ from natsort import natsorted
HEADER_TEMPLATE
=
"""
\
; {detector} geometry file written by geomtools
-optimiser-sfx
; {detector} geometry file written by geomtools
; You may need to edit this file to add:
; - data and mask locations in the file
; - mask_good & mask_bad values to interpret the mask
...
...
This diff is collapsed.
Click to expand it.
src/geomtools/sfx/optimiser.py
0 → 100644
+
45
−
0
View file @
2e9c25af
import
argparse
import
pathlib
import
tempfile
from
.refine
import
refine_geometry
from
.crystfelio
import
extract_geometry
,
read_crystfel_streamfile
from
..detector
import
read_crystfel_geom
,
write_crystfel_geom
def
refine
():
parser
=
argparse
.
ArgumentParser
(
description
=
'
Makes the detector geometry report
'
)
parser
.
add_argument
(
'
-i
'
,
'
--stream
'
,
type
=
pathlib
.
Path
,
required
=
True
,
help
=
"
Crystfel stream file
"
)
parser
.
add_argument
(
'
-c
'
,
'
--connected
'
,
default
=
"
modules
"
,
help
=
"
Collection of rigid groups to pose
"
)
parser
.
add_argument
(
'
-o
'
,
'
--output
'
,
type
=
pathlib
.
Path
,
default
=
pathlib
.
Path
(
"
refined.geom
"
),
help
=
"
File to store refined geometry
"
)
args
=
parser
.
parse_args
()
stream_filename
=
args
.
stream
.
absolute
()
geom_file
=
extract_geometry
(
stream_filename
)
temp_geom_file
=
tempfile
.
NamedTemporaryFile
(
"
w+t
"
,
prefix
=
'
geomtools
'
)
temp_geom_file
.
write
(
geom_file
.
read
())
geom_file
.
seek
(
0
)
panels
,
beam
=
read_crystfel_geom
(
temp_geom_file
.
name
,
indexes
=
{
'
modno
'
:
1
})
temp_geom_file
.
close
()
fr
,
pe
,
la
,
re
,
ma
=
read_crystfel_streamfile
(
stream_filename
,
panels
,
args
.
connected
,
disp
=
True
)
panels_new
,
transform
,
clen
=
refine_geometry
(
ma
,
panels
,
1.0
)
with
open
(
args
.
output
.
absolute
(),
"
w
"
)
as
f
:
write_crystfel_geom
(
f
,
panels_new
,
beam
,
[
"
modules
"
,
"
quads
"
])
if
__name__
==
"
__main__
"
:
refine
()
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