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
64f8f488
Commit
64f8f488
authored
1 year ago
by
Egor Sobolev
Browse files
Options
Downloads
Patches
Plain Diff
Remove copy_and_sanitize_non_cal_data from AgipdCorrections
parent
db32e6a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!982
[AGIPD] Refactor write_file on AgipdCorrections to create indexes using the DataFile
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cal_tools/agipdlib.py
+0
-66
0 additions, 66 deletions
src/cal_tools/agipdlib.py
with
0 additions
and
66 deletions
src/cal_tools/agipdlib.py
+
0
−
66
View file @
64f8f488
...
@@ -1272,72 +1272,6 @@ class AgipdCorrections:
...
@@ -1272,72 +1272,6 @@ class AgipdCorrections:
return
n_img_sel
return
n_img_sel
def
copy_and_sanitize_non_cal_data
(
self
,
infile
,
outfile
,
agipd_base
,
idx_base
,
trains
):
"""
Copy and sanitize data in `infile` that is not touched by
`correctAGIPD`
"""
# these are touched in the correct function, do not copy them here
dont_copy
=
[
"
data
"
,
"
cellId
"
,
"
trainId
"
,
"
pulseId
"
,
"
status
"
,
"
length
"
]
dont_copy
=
[
posixpath
.
join
(
agipd_base
,
"
image
"
,
ds
)
for
ds
in
dont_copy
]
# don't copy index as we may need to adjust if we filter trains
dont_copy
.
append
(
posixpath
.
join
(
idx_base
,
"
image
"
))
h5_copy_except_paths
(
infile
,
outfile
,
dont_copy
)
# sanitize indices
for
do
in
[
"
image
"
,
]:
# uq: INDEX/trainID
# fidxv: INDEX/.../image/first idx values
# cntsv: INDEX/.../image/counts values
# Extract parameters through identifying
# unique trains, index and numbers.
uq
,
fidxv
,
cntsv
=
np
.
unique
(
trains
,
return_index
=
True
,
return_counts
=
True
)
# noqa
# Validate calculated CORR INDEX contents by checking
# difference between trainId stored in RAW data and trains from
train_diff
=
np
.
isin
(
np
.
array
(
infile
[
"
/INDEX/trainId
"
]),
uq
,
invert
=
True
)
# noqa
# Insert zeros for missing trains.
# fidxv and cntsv should have same length as
# raw INDEX/.../image/first and INDEX/.../image/count,
# respectively
# first_inc = first incrementation
first_inc
=
True
for
i
,
diff
in
enumerate
(
train_diff
):
if
diff
:
if
i
<
len
(
cntsv
):
cntsv
=
np
.
insert
(
cntsv
,
i
,
0
)
fidxv
=
np
.
insert
(
fidxv
,
i
,
0
)
if
i
==
0
else
np
.
insert
(
fidxv
,
i
,
fidxv
[
i
])
else
:
# append if at the end of the array
cntsv
=
np
.
append
(
cntsv
,
0
)
# increment fidxv once with the
# no. of processed mem-cells.
if
first_inc
:
fidxv
=
np
.
append
(
fidxv
,
(
2
*
fidxv
[
i
-
1
])
-
fidxv
[
i
-
2
])
first_inc
=
False
else
:
fidxv
=
np
.
append
(
fidxv
,
fidxv
[
i
-
1
])
# save INDEX contents (first, count) in CORR files
outfile
.
create_dataset
(
idx_base
+
"
{}/first
"
.
format
(
do
),
fidxv
.
shape
,
dtype
=
fidxv
.
dtype
,
data
=
fidxv
,
fletcher32
=
True
)
outfile
.
create_dataset
(
idx_base
+
"
{}/count
"
.
format
(
do
),
cntsv
.
shape
,
dtype
=
cntsv
.
dtype
,
data
=
cntsv
,
fletcher32
=
True
)
def
init_constants
(
def
init_constants
(
self
,
cons_data
:
dict
,
module_idx
:
int
,
variant
:
dict
):
self
,
cons_data
:
dict
,
module_idx
:
int
,
variant
:
dict
):
"""
"""
...
...
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