Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DITB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DISCO Beamline
DITB
Commits
f55ee7e2
Commit
f55ee7e2
authored
7 months ago
by
Hugo chauvet
Browse files
Options
Downloads
Patches
Plain Diff
add the new normalisation for multi pos excitation
parent
de233263
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ditb/commands/darkwhite.py
+3
-0
3 additions, 0 deletions
ditb/commands/darkwhite.py
ditb/exposure/darkwhite_correction.py
+27
-5
27 additions, 5 deletions
ditb/exposure/darkwhite_correction.py
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
with
31 additions
and
6 deletions
ditb/commands/darkwhite.py
+
3
−
0
View file @
f55ee7e2
...
...
@@ -77,11 +77,14 @@ def darkwhite(images, dark, white, darkofwhite, white_z, force, lower, smooth, v
dark
=
smoothed_names
[
1
]
darkofwhite
=
smoothed_names
[
2
]
print
(
f
'
🪩 Normalize images with:
'
)
print
(
f
'
- dark:
{
dark
}
'
)
print
(
f
'
- white:
{
white
}
'
)
if
version
==
2
:
print
(
f
'
- white for power estimation:
{
original_white
}
'
)
assert
'
smooth
'
not
in
original_white
.
name
.
lower
(),
"
Need to use a non smoothed white to estimate the power of the beam
"
print
(
f
'
- dark of white:
{
darkofwhite
}
'
)
darkwhite_names
=
[
Path
(
dark
).
name
,
Path
(
white
).
name
,
Path
(
darkofwhite
).
name
]
...
...
This diff is collapsed.
Click to expand it.
ditb/exposure/darkwhite_correction.py
+
27
−
5
View file @
f55ee7e2
...
...
@@ -282,13 +282,31 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
dow_stack
=
dow_stack
.
map_blocks
(
remove_cosmic
,
2
,
dtype
=
dow_stack
.
dtype
)
diffwhite
=
white_stack
-
dow_stack
if
version
==
2
:
print
(
'
Two steps normalisation: Spectral power from the mean, then spatial variation of the white
'
)
assert
original_white
is
not
None
,
"
Please provide a non-smoothed white
"
# Estimation of the power
owhite
=
mmzarr_read
(
str
(
original_white
))[
0
,
0
,
:,
zpos
].
map_blocks
(
img_as_float
)
whiteMean
=
owhite
.
mean
(
axis
=
(
-
2
,
-
1
))
powerEstimation
=
whiteMean
/
whiteMean
.
max
()
powerEstimation
=
powerEstimation
.
compute
()
# Create a normed white with a maximum of 1
# for each excitation wavelength
max_white
=
diffwhite
.
max
(
axis
=
(
-
2
,
-
1
))
min_ratio
=
white_stack
.
min
()
/
max_white
normed_white
=
diffwhite
/
max_white
[:,
None
,
None
]
# Cut at the maximum of the minimum ratio
normed_white
[
normed_white
<
min_ratio
.
max
()]
=
min_ratio
.
max
()
else
:
print
(
"
On step normalisation: spectral and sptatial from the white normed by it
'
s stack maximum
"
)
max_white
=
diffwhite
.
max
()
min_ratio
=
white_stack
.
min
()
/
max_white
normed_white
=
diffwhite
/
max_white
normed_white
[
normed_white
<
min_ratio
]
=
min_ratio
final_white
=
normed_white
.
compute
()[
None
,
None
,
:,
None
]
final_white
=
normed_white
.
compute
()[
None
,
None
,
:,
:
]
darks
=
mmzarr_read
(
str
(
darkin
))
darks_meta
=
read_mmzarr_metadata
(
str
(
darkin
))
...
...
@@ -340,6 +358,10 @@ def correct_dark_white(images: str, dark: str = '', white: str = '' ,
diff_im_darks
=
images
-
darks
diff_im_darks
[
diff_im_darks
<
0
]
=
0
if
version
==
2
:
# divide the data by the power estimation
diff_im_darks
=
diff_im_darks
/
powerEstimation
[
None
,
None
,
None
,
:,
None
,
None
]
# Compute the transfert function
# The transfer function is just the inverse of the white
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
1
View file @
f55ee7e2
...
...
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name
=
"DITB"
version
=
"20250108rc
1
"
version
=
"20250108rc
2
"
readme
=
"README.md"
requires-python
=
">
=
3.11
"
authors
=
[
{
name
=
"Hugo Chauvet"
,
email
=
"hugo.chauvet@synchrotron-soleil.fr"
}
]
...
...
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