Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nam
ProxPython
Commits
c1cce5f0
Commit
c1cce5f0
authored
Mar 26, 2020
by
Matthijs
Browse files
bugfix
parent
907d6dbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
proxtoolbox/Problems/OrbitalTomog/orbitaltomog_data_processor.py
View file @
c1cce5f0
...
...
@@ -7,11 +7,21 @@ import imageio
def
data_processor
(
config
):
if
config
[
'data_filename'
][
-
4
:]
==
'.mat'
:
inp_data
=
loadmat
(
'../../../InputData/OrbitalTomog/'
+
config
[
'data_filename'
])
inp
=
inp_data
[
"I2"
]
if
config
[
'data_filename'
][
1
]
==
':'
:
path_to_file
=
config
[
'data_filename'
]
else
:
inp
=
imageio
.
imread
(
'../../../InputData/OrbitalTomog/'
+
config
[
'data_filename'
])
path_to_file
=
'../../../InputData/OrbitalTomog/'
+
config
[
'data_filename'
]
try
:
if
config
[
'data_filename'
][
-
4
:]
==
'.mat'
:
# for the old coronene simulations by W. Bennecke
inp_data
=
loadmat
(
path_to_file
)
inp
=
inp_data
[
"I2"
]
else
:
inp
=
imageio
.
imread
(
path_to_file
)
except
FileNotFoundError
:
path_to_file
=
input
(
'Please enter the path to the datafile: '
)
inp
=
imageio
.
imread
(
path_to_file
)
ny
,
nx
=
inp
.
shape
config
[
'data'
]
=
abs
(
inp
)
...
...
proxtoolbox/ProxOperators/P_Sparsity.py
View file @
c1cce5f0
...
...
@@ -56,7 +56,7 @@ class P_Sparsity(ProxOperator):
u
*=
self
.
support
# apply support
p_Sparsity
=
0
*
u
sorting
=
np
.
argsort
(
abs
(
u
),
axis
=
None
)
# gives indices of sorted array in ascending order
indices
=
np
.
asarray
([
unravel_index
(
sorting
[
i
],
u
)
for
i
in
range
(
-
1
*
self
.
sparsity_parameter
,
0
)])
indices
=
np
.
asarray
([
unravel_index
(
sorting
[
i
],
u
.
shape
)
for
i
in
range
(
-
1
*
self
.
sparsity_parameter
,
0
)])
p_Sparsity
[
indices
[:,
0
],
indices
[:,
1
]]
=
u
[
indices
[:,
0
],
indices
[:,
1
]]
return
p_Sparsity
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment