Due to maintenance reasons, gitlab.gwdg.de will not be available on Saturday 2021-07-24 from 10:30 to approximately 11:30 CEST.

Commit eac39412 authored by Schellhorn's avatar Schellhorn
Browse files

local path to absolute path reference in GetData

parent 71895a36
......@@ -3,6 +3,8 @@ import sys
import urllib.request
import tarfile
datadir = Path(__file__).parent.parent.parent.parent / 'InputData'
#shows progress of download
def dlProgress(counter, blocksize, size):
p = counter*blocksize*100.0/size
......@@ -25,11 +27,11 @@ def query_yes_no(question):
#downloads the input data to the InputData folder. problemFamily has to be either Phase, CT or Ptychography
def getData(problemFamily):
if problemFamily == 'Phase':
my_file = Path("../InputData/Phase/pupil.pmod")
my_file = datadir/'Phase'/'pupil.pmod'
elif problemFamily == 'CT':
my_file = Path("../InputData/CT/ART_SheppLogan.mat")
my_file = datadir/'CT'/'ART_SheppLogan.mat'
elif problemFamily == 'Ptychography':
my_file = Path("../InputData/Ptychography/gaenseliesel.png")
my_file = datadir/'Ptychography'/'gaenseliesel.png'
else:
print("Invalid input in GetData.GetData. problemFamily has to be Phase, CT or Ptychography")
return -1
......@@ -37,10 +39,10 @@ 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)
urllib.request.urlretrieve(" http://vaopt.math.uni-goettingen.de/data/" + problemFamily + ".tar.gz", datadir/(problemFamily + '.tar.gz'), reporthook=dlProgress)
print("\nExtracting data...")
tar = tarfile.open("../InputData/" + problemFamily + ".tar.gz", "r:gz")
tar.extractall("../InputData/" + problemFamily)
tar = tarfile.open(datadir/(problemFamily + '.tar.gz'), "r:gz")
tar.extractall(datadir/problemFamily)
tar.close()
if not(my_file.is_file()):
print('***************************************************************************************')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment