Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
c34e168b
Commit
c34e168b
authored
Jan 28, 2019
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaks
parent
e1ded885
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
nifty5/minimization/iteration_controllers.py
nifty5/minimization/iteration_controllers.py
+1
-1
nifty5/plot.py
nifty5/plot.py
+20
-8
No files found.
nifty5/minimization/iteration_controllers.py
View file @
c34e168b
...
...
@@ -133,7 +133,7 @@ class GradientNormController(IterationController):
if
self
.
_iteration_limit
is
not
None
:
if
self
.
_itcount
>=
self
.
_iteration_limit
:
logger
.
warning
(
"{}
Iteration limit reached. Assuming convergence"
"{}Iteration limit reached. Assuming convergence"
.
format
(
""
if
self
.
_name
is
None
else
self
.
_name
+
": "
))
return
self
.
CONVERGED
if
self
.
_ccount
>=
self
.
_convergence_level
:
...
...
nifty5/plot.py
View file @
c34e168b
...
...
@@ -168,17 +168,29 @@ def _rgb_data(spectral_cube):
res
[:,
i
]
=
lambda2xyz
(
1.
/
E
[
i
])
return
res
def
to_logscale
(
arr
,
lo
,
hi
):
res
=
arr
.
clip
(
lo
,
hi
)
res
=
np
.
log
(
res
/
hi
)
tmp
=
np
.
log
(
hi
/
lo
)
res
+=
tmp
res
/=
tmp
return
res
spectral_cube
=
spectral_cube
.
reshape
((
-
1
,
spectral_cube
.
shape
[
-
1
]))
xyz
=
getxyz
(
spectral_cube
.
shape
[
-
1
])
xyz_data
=
np
.
tensordot
(
spectral_cube
,
xyz
,
axes
=
[
-
1
,
-
1
])
xyz_data
/=
xyz_data
.
max
()
# vmax = max(xyz_data[:,0].max()/0.9505,
# xyz_data[:,1].max(),
# xyz_data[:,2].max()/1.0890)
vmax
=
xyz_data
.
max
()
xyz_data
/=
vmax
xyz_data
=
to_logscale
(
xyz_data
,
1e-3
,
1.
)
rgb_data
=
xyz_data
.
copy
()
it
=
np
.
nditer
(
xyz_data
[:,:,
0
],
flags
=
[
'multi_index'
])
while
not
it
.
finished
:
rgb_data
[
it
.
multi_index
]
=
_gammacorr
(
np
.
matmul
(
MATRIX_SRGB_D65
,
xyz_data
[
it
.
multi_index
]))
it
.
iternext
()
rgb_data
=
rgb_data
.
clip
(
0.
,
1.
)
return
rgb_data
it
=
np
.
nditer
(
xyz_data
[:,
0
],
flags
=
[
'multi_index'
])
for
x
in
range
(
xyz_data
.
shape
[
0
]):
rgb_data
[
x
]
=
_gammacorr
(
np
.
matmul
(
MATRIX_SRGB_D65
,
xyz_data
[
x
]))
rgb_data
=
rgb_data
.
clip
(
1e-13
,
1.
)
return
rgb_data
.
reshape
(
spectral_cube
.
shape
[:
-
1
]
+
(
-
1
,))
def
_find_closest
(
A
,
target
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment