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
458c91d7
Commit
458c91d7
authored
Dec 12, 2018
by
Alexander Dornheim
Browse files
Fixed bug in GetData.getData (indent)
Ptychography is now using GetData.getData (automatic download of input data)
parent
879ab4c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
proxtoolbox/Problems/ptychography.py
View file @
458c91d7
...
...
@@ -23,6 +23,9 @@ from proxtoolbox.ProxOperators import magproj
from
proxtoolbox.ProxOperators.proxoperators
import
ProxOperator
from
multiprocessing
import
Pool
#for downloading input data
import
proxtoolbox.Utilities.GetData
as
GetData
#choose backend
import
matplotlib
matplotlib
.
use
(
'Qt5Agg'
)
...
...
@@ -1941,6 +1944,10 @@ class Ptychography(Problem):
sample_plane
=
None
;
if
self
.
config
[
'sim_data_type'
]
==
'gaenseliesel'
:
#make sure input data can be found, otherwise download it
GetData
.
getData
(
'Ptychography'
)
g
=
pyplot
.
imread
(
'../InputData/Ptychography/gaenseliesel.png'
).
astype
(
numpy
.
float
);
g
/=
numpy
.
amax
(
g
);
g
=
0.8
*
g
+
0.1
;
...
...
@@ -2445,6 +2452,9 @@ class Ptychography_NTT_01_26210(Ptychography):
Overloads the corresponding method of :class:`Ptychography`
to create other experiment data
"""
#make sure input data can be found, otherwise download it
GetData
.
getData
(
'Ptychography'
)
data
=
scipy
.
io
.
loadmat
(
'../InputData/Ptychography/data_NTT_01_26210_192x192.mat'
);
d1y
=
data
[
'd1y'
][
0
][
0
];
d1x
=
data
[
'd1x'
][
0
][
0
];
...
...
proxtoolbox/Utilities/GetData/GetData.py
View file @
458c91d7
...
...
@@ -36,16 +36,16 @@ def getData(problemFamily):
if
not
(
my_file
.
is_file
()):
print
(
problemFamily
+
" input data is missing."
)
if
query_yes_no
(
"Do you want to download the "
+
problemFamily
+
" input data?"
):
urllib
.
request
.
urlretrieve
(
" http://vaopt.math.uni-goettingen.de/data/"
+
problemFamily
+
".tar.gz"
,
"../InputData/"
+
problemFamily
+
".tar.gz"
,
reporthook
=
dlProgress
)
print
(
"
\n
Extracting data..."
)
tar
=
tarfile
.
open
(
"../InputData/"
+
problemFamily
+
".tar.gz"
,
"r:gz"
)
tar
.
extractall
(
"../InputData/"
+
problemFamily
)
tar
.
close
()
if
not
(
my_file
.
is_file
()):
print
(
'***************************************************************************************'
)
print
(
'* Input data still missing. Please try automatic download again or manually download *'
)
print
(
'* http://vaopt.math.uni-goettingen.de/data/'
+
problemFamily
+
'.tar.gz *'
)
print
(
'* Save and unpack the '
+
problemFamily
+
'.tar.gz datafile in the *'
)
print
(
'* ProxMatlab/InputData subdirectory *'
)
print
(
'***************************************************************************************'
)
if
query_yes_no
(
"Do you want to download the "
+
problemFamily
+
" input data?"
):
urllib
.
request
.
urlretrieve
(
" http://vaopt.math.uni-goettingen.de/data/"
+
problemFamily
+
".tar.gz"
,
"../InputData/"
+
problemFamily
+
".tar.gz"
,
reporthook
=
dlProgress
)
print
(
"
\n
Extracting data..."
)
tar
=
tarfile
.
open
(
"../InputData/"
+
problemFamily
+
".tar.gz"
,
"r:gz"
)
tar
.
extractall
(
"../InputData/"
+
problemFamily
)
tar
.
close
()
if
not
(
my_file
.
is_file
()):
print
(
'***************************************************************************************'
)
print
(
'* Input data still missing. Please try automatic download again or manually download *'
)
print
(
'* http://vaopt.math.uni-goettingen.de/data/'
+
problemFamily
+
'.tar.gz *'
)
print
(
'* Save and unpack the '
+
problemFamily
+
'.tar.gz datafile in the *'
)
print
(
'* ProxMatlab/InputData subdirectory *'
)
print
(
'***************************************************************************************'
)
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