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
58e90a84
Commit
58e90a84
authored
4 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Explicitly set read mode on h5py.File
parent
4628ab14
No related branches found
No related tags found
2 merge requests
!451
Feat/agipd fixed gain correction
,
!438
Feat/agipd add fixed gain mode to dark notebook
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cal_tools/cal_tools/agipdlib.py
+4
-4
4 additions, 4 deletions
cal_tools/cal_tools/agipdlib.py
with
4 additions
and
4 deletions
cal_tools/cal_tools/agipdlib.py
+
4
−
4
View file @
58e90a84
...
@@ -75,7 +75,7 @@ def get_acq_rate(fast_paths: Tuple[str, str, int],
...
@@ -75,7 +75,7 @@ def get_acq_rate(fast_paths: Tuple[str, str, int],
fast_data_file
=
Path
(
fast_data_file
)
fast_data_file
=
Path
(
fast_data_file
)
if
fast_data_file
.
is_file
():
if
fast_data_file
.
is_file
():
fast_data_path
=
f
'
INSTRUMENT/
{
karabo_id
}
/DET/
{
module
}
CH0:xtdf/image/pulseId
'
# noqa
fast_data_path
=
f
'
INSTRUMENT/
{
karabo_id
}
/DET/
{
module
}
CH0:xtdf/image/pulseId
'
# noqa
with
h5py
.
File
(
fast_data_file
)
as
fin
:
with
h5py
.
File
(
fast_data_file
,
"
r
"
)
as
fin
:
if
fast_data_path
in
fin
:
if
fast_data_path
in
fin
:
# pulses is of shape (NNNN, 1), of type uint8.
# pulses is of shape (NNNN, 1), of type uint8.
# Squeeze out the data, and subtract the 3rd entry from the 2nd
# Squeeze out the data, and subtract the 3rd entry from the 2nd
...
@@ -132,7 +132,7 @@ def get_gain_mode(fname: str, h5path_ctrl: str) -> AgipdGainMode:
...
@@ -132,7 +132,7 @@ def get_gain_mode(fname: str, h5path_ctrl: str) -> AgipdGainMode:
h5path_run
=
h5path_ctrl
.
replace
(
"
CONTROL/
"
,
"
RUN/
"
,
1
)
h5path_run
=
h5path_ctrl
.
replace
(
"
CONTROL/
"
,
"
RUN/
"
,
1
)
h5path_gainmode
=
f
'
{
h5path_run
}
/gainModeIndex/value
'
h5path_gainmode
=
f
'
{
h5path_run
}
/gainModeIndex/value
'
with
h5py
.
File
(
fname
,
'
r
'
)
as
fd
:
with
h5py
.
File
(
fname
,
"
r
"
)
as
fd
:
if
h5path_gainmode
in
fd
:
if
h5path_gainmode
in
fd
:
return
AgipdGainMode
(
fd
[
h5path_gainmode
][
0
])
return
AgipdGainMode
(
fd
[
h5path_gainmode
][
0
])
return
AgipdGainMode
.
ADAPTIVE_GAIN
return
AgipdGainMode
.
ADAPTIVE_GAIN
...
@@ -299,7 +299,7 @@ class AgipdCorrections:
...
@@ -299,7 +299,7 @@ class AgipdCorrections:
data_dict
=
self
.
shared_dict
[
i_proc
]
data_dict
=
self
.
shared_dict
[
i_proc
]
data_dict
[
'
moduleIdx
'
][
0
]
=
module_idx
data_dict
[
'
moduleIdx
'
][
0
]
=
module_idx
try
:
try
:
f
=
h5py
.
File
(
file_name
,
'
r
'
)
f
=
h5py
.
File
(
file_name
,
"
r
"
)
group
=
f
[
agipd_base
][
"
image
"
]
group
=
f
[
agipd_base
][
"
image
"
]
(
_
,
first_index
,
last_index
,
(
_
,
first_index
,
last_index
,
...
@@ -362,7 +362,7 @@ class AgipdCorrections:
...
@@ -362,7 +362,7 @@ class AgipdCorrections:
return
return
trains
=
data_dict
[
'
trainId
'
][:
n_img
]
trains
=
data_dict
[
'
trainId
'
][:
n_img
]
with
h5py
.
File
(
ofile_name
,
'
w
'
)
as
outfile
:
with
h5py
.
File
(
ofile_name
,
"
w
"
)
as
outfile
:
# Copy any other data from the input file.
# Copy any other data from the input file.
# This includes indexes, so it's important that the corrected data
# This includes indexes, so it's important that the corrected data
# we write is aligned with the raw data.
# we write is aligned with the raw data.
...
...
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