Commit 8f9cc260 authored by Schellhorn's avatar Schellhorn
Browse files

automatic data download

parent f8985bcb
......@@ -5,6 +5,8 @@ from proxtoolbox.experiments.orbitaltomography.planar_molecule import PlanarMole
from proxtoolbox.utils.orbitaltomog import shifted_fft, fourier_interpolate
from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb
#for downloading data
import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
class DegenerateOrbital(PlanarMolecule):
......@@ -59,6 +61,10 @@ class DegenerateOrbital(PlanarMolecule):
- threshold_for_support: float, in range [0,1], fraction of the maximum at which to threshold when
determining support or support for sparsity
"""
# make sure input data can be found, otherwise download it
GetData.getData('OrbitalTomog')
super(DegenerateOrbital, self).loadData()
def createRandomGuess(self):
......
......@@ -7,6 +7,9 @@ from proxtoolbox.experiments.orbitaltomography.orbitExperiment import OrbitalTom
from proxtoolbox.utils.visualization.stack_viewer import XYZStackViewer
from proxtoolbox.utils.orbitaltomog import shifted_fft
#for downloading data
import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
class Molecule3D(OrbitalTomographyExperiment):
@staticmethod
......@@ -56,6 +59,9 @@ class Molecule3D(OrbitalTomographyExperiment):
"""
Load data and set in the correct format for reconstruction
"""
# make sure input data can be found, otherwise download it
GetData.getData('OrbitalTomog')
# TODO: copy from data processor
raise NotImplementedError
......
......@@ -6,6 +6,9 @@ from glob import glob
from proxtoolbox.utils.h5 import write_dict_to_h5
import numpy as np
#for downloading data
import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
class OrbitalTomographyExperiment(Experiment):
@staticmethod
......@@ -30,6 +33,10 @@ class OrbitalTomographyExperiment(Experiment):
self.output_ignore_keys = ['u1', 'u2', 'plots']
def loadData(self):
# make sure input data can be found, otherwise download it
GetData.getData('OrbitalTomog')
"""
Load or generate the dataset that will be used for
this experiment. Create the initial iterate.
......
......@@ -7,6 +7,8 @@ from proxtoolbox.experiments.orbitaltomography.planar_molecule import PlanarMole
from proxtoolbox.utils.orbitaltomog import shifted_fft, fourier_interpolate, bin_array, shifted_ifft
from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb
#for downloading data
import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
......@@ -55,6 +57,10 @@ class OrbitalMomentumMicroscope(PlanarMolecule):
self.momentum_axes = (-1, -2)
def loadData(self):
# make sure input data can be found, otherwise download it
GetData.getData('OrbitalTomog')
"""
Load data and set in the correct format for reconstruction
Parameters are taken from experiment class (self) properties, which must include::
......
......@@ -7,6 +7,8 @@ from proxtoolbox.experiments.orbitaltomography.planar_molecule import PlanarMole
from proxtoolbox.utils.orbitaltomog import shifted_fft, fourier_interpolate, bin_array, shifted_ifft
from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb
#for downloading data
import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
......@@ -55,6 +57,10 @@ class OrthogonalOrbitals(PlanarMolecule):
- threshold_for_support: float, in range [0,1], fraction of the maximum at which to threshold when
determining support or support for sparsity
"""
# make sure input data can be found, otherwise download it
GetData.getData('OrbitalTomog')
# load data
if self.data_filename is None:
self.data_filename = input('Please enter the path to the datafile: ')
......
......@@ -7,6 +7,8 @@ from proxtoolbox.experiments.orbitaltomography.orbitExperiment import OrbitalTom
from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb
from proxtoolbox.utils.orbitaltomog import bin_array, shifted_fft, shifted_ifft, fourier_interpolate, roll_to_pos
#for downloading data
import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
class PlanarMolecule(OrbitalTomographyExperiment):
......@@ -75,6 +77,9 @@ class PlanarMolecule(OrbitalTomographyExperiment):
- threshold_for_support: float, in range [0,1], fraction of the maximum at which to threshold when
determining support or support for sparsity
"""
# make sure input data can be found, otherwise download it
GetData.getData('OrbitalTomog')
# load data
if self.data_filename is None:
self.data_filename = input('Please enter the path to the datafile: ')
......
......@@ -13,7 +13,10 @@ from numpy.linalg import norm
from numpy.fft import fft2, ifft2
import time
#for downloading data
import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
print(datadir)
class CDP_Experiment(PhaseExperiment):
......@@ -71,6 +74,9 @@ class CDP_Experiment(PhaseExperiment):
"""
Load CDP dataset. Create the initial iterate.
"""
#make sure input data can be found, otherwise download it
GetData.getData('Phase')
# Implementation of the Wirtinger Flow (WF) algorithm presented in the paper
# "Phase Retrieval via Wirtinger Flow: Theory and algorithms"
# by E. J. Candes, X. Li, and M. Soltanolkotabi
......
......@@ -17,6 +17,8 @@ from matplotlib.pyplot import subplots, show, figure
import os.path
import time
#for downloading data
import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
class Phasepack_Experiment(PhaseExperiment):
......@@ -64,6 +66,8 @@ class Phasepack_Experiment(PhaseExperiment):
"""
Load Phasepack dataset. Create the initial iterate.
"""
#make sure input data can be found, otherwise download it
GetData.getData('Phase')
# check if data exists
# TODO: All the data corresponding to this experiment should be placed
......
......@@ -15,6 +15,7 @@ from proxtoolbox.utils.gaussian import gaussian
#for downloading data
import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
import matplotlib
import matplotlib.pyplot as plt
......
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