Commit a897a375 authored by Schellhorn's avatar Schellhorn
Browse files

changed reference to the Data Folder globally

parent e1f59dbb
...@@ -69,7 +69,7 @@ A concrete experiment class needs to override the ...@@ -69,7 +69,7 @@ A concrete experiment class needs to override the
GetData.getData('Phase') GetData.getData('Phase')
print('Loading data file CDI_intensity') print('Loading data file CDI_intensity')
f = loadmat('../InputData/Phase/CDI_intensity.mat') f = loadmat(datadir/'Phase'/'CDI_intensity.mat')
# diffraction pattern # diffraction pattern
dp = f['intensity']['img'][0, 0] dp = f['intensity']['img'][0, 0]
orig_res = max(dp.shape[0], dp.shape[1]) # actual data size orig_res = max(dp.shape[0], dp.shape[1]) # actual data size
......
...@@ -6,6 +6,7 @@ from proxtoolbox.utils.graphics import addColorbar ...@@ -6,6 +6,7 @@ from proxtoolbox.utils.graphics import addColorbar
#for downloading data #for downloading data
import proxtoolbox.utils.GetData as GetData import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
import numpy as np import numpy as np
from scipy.io import loadmat from scipy.io import loadmat
...@@ -74,7 +75,7 @@ class ART_Experiment(Experiment): ...@@ -74,7 +75,7 @@ class ART_Experiment(Experiment):
# load data # load data
if not self.silent: if not self.silent:
print('Loading data file ART_SheppLogan.mat ') print('Loading data file ART_SheppLogan.mat ')
data_Shepp = loadmat('../InputData/CT/ART_SheppLogan.mat') data_Shepp = loadmat(datadir/'CT'/'ART_SheppLogan.mat')
N = data_Shepp['N'].item() N = data_Shepp['N'].item()
p = data_Shepp['p'].item() p = data_Shepp['p'].item()
theta = data_Shepp['theta'] theta = data_Shepp['theta']
......
...@@ -5,14 +5,16 @@ from proxtoolbox.experiments.orbitaltomography.planar_molecule import PlanarMole ...@@ -5,14 +5,16 @@ from proxtoolbox.experiments.orbitaltomography.planar_molecule import PlanarMole
from proxtoolbox.utils.orbitaltomog import shifted_fft, fourier_interpolate from proxtoolbox.utils.orbitaltomog import shifted_fft, fourier_interpolate
from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb
from proxtoolbox.utils.GetData import datadir
class DegenerateOrbital(PlanarMolecule): class DegenerateOrbital(PlanarMolecule):
@staticmethod @staticmethod
def getDefaultParameters(): def getDefaultParameters():
defaultParams = { defaultParams = {
'experiment_name': '2D ARPES', 'experiment_name': '2D ARPES',
'data_filename': '..\\Inputdata\\OrbitalTomog' 'data_filename': datadir
+ '\\2020_10_27_coronene_Homo1+2_ARPES_2e6counts_corrected_80x80.tif', + '\OrbitalTomog'
+ '\\2020_10_27_coronene_Homo1+2_ARPES_2e6counts_corrected_80x80.tif',
'from_intensity_data': True, 'from_intensity_data': True,
'object': 'real', 'object': 'real',
'degeneracy': 2, # Number of degenerate states to reconstruct 'degeneracy': 2, # Number of degenerate states to reconstruct
......
...@@ -7,6 +7,8 @@ from proxtoolbox.experiments.orbitaltomography.planar_molecule import PlanarMole ...@@ -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.orbitaltomog import shifted_fft, fourier_interpolate, bin_array, shifted_ifft
from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb
from proxtoolbox.utils.GetData import datadir
class OrbitalMomentumMicroscope(PlanarMolecule): class OrbitalMomentumMicroscope(PlanarMolecule):
""" """
...@@ -17,8 +19,9 @@ class OrbitalMomentumMicroscope(PlanarMolecule): ...@@ -17,8 +19,9 @@ class OrbitalMomentumMicroscope(PlanarMolecule):
def getDefaultParameters(): def getDefaultParameters():
defaultParams = { defaultParams = {
'experiment_name': 'Momentum microscopy', 'experiment_name': 'Momentum microscopy',
'data_filename': '..\\Inputdata\\OrbitalTomog' 'data_filename': datadir
+ '\\2020_11_05_Coronene_HOMO_near_degenerate_noisefree.tif', + '\OrbitalTomog'
+ '\\2020_11_05_Coronene_HOMO_near_degenerate_noisefree.tif',
'from_intensity_data': False, 'from_intensity_data': False,
'object': 'real', 'object': 'real',
'constraint': 'sparse real', 'constraint': 'sparse real',
......
...@@ -7,13 +7,16 @@ from proxtoolbox.experiments.orbitaltomography.planar_molecule import PlanarMole ...@@ -7,13 +7,16 @@ from proxtoolbox.experiments.orbitaltomography.planar_molecule import PlanarMole
from proxtoolbox.utils.orbitaltomog import shifted_fft, fourier_interpolate, bin_array, shifted_ifft from proxtoolbox.utils.orbitaltomog import shifted_fft, fourier_interpolate, bin_array, shifted_ifft
from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb
from proxtoolbox.utils.GetData import datadir
class OrthogonalOrbitals(PlanarMolecule): class OrthogonalOrbitals(PlanarMolecule):
@staticmethod @staticmethod
def getDefaultParameters(): def getDefaultParameters():
defaultParams = { defaultParams = {
'experiment_name': '2D ARPES', 'experiment_name': '2D ARPES',
'data_filename': '..\\Inputdata\\OrbitalTomog' 'data_filename': datadir
+ '\OrbitalTomog'
+ '\\2020_10_27_coronene_Homo_stack_ARPES_2e6counts_corrected_80x80.tif', + '\\2020_10_27_coronene_Homo_stack_ARPES_2e6counts_corrected_80x80.tif',
'from_intensity_data': False, 'from_intensity_data': False,
'object': 'real', 'object': 'real',
......
...@@ -7,6 +7,7 @@ from proxtoolbox.experiments.orbitaltomography.orbitExperiment import OrbitalTom ...@@ -7,6 +7,7 @@ from proxtoolbox.experiments.orbitaltomography.orbitExperiment import OrbitalTom
from proxtoolbox.utils.visualization.complex_field_visualization import complex_to_rgb 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 from proxtoolbox.utils.orbitaltomog import bin_array, shifted_fft, shifted_ifft, fourier_interpolate, roll_to_pos
from proxtoolbox.utils.GetData import datadir
class PlanarMolecule(OrbitalTomographyExperiment): class PlanarMolecule(OrbitalTomographyExperiment):
@staticmethod @staticmethod
...@@ -14,7 +15,7 @@ class PlanarMolecule(OrbitalTomographyExperiment): ...@@ -14,7 +15,7 @@ class PlanarMolecule(OrbitalTomographyExperiment):
# TODO: optimize parameters and proxoperators to get good & consistent phase retrieval using the demo # TODO: optimize parameters and proxoperators to get good & consistent phase retrieval using the demo
defaultParams = { defaultParams = {
'experiment_name': 'noisy 2D ARPES', # '2D ARPES', # 'experiment_name': 'noisy 2D ARPES', # '2D ARPES', #
'data_filename': '../InputData/OrbitalTomog/coronene_homo1.tif', 'data_filename': datadir/'OrbitalTomog'/'coronene_homo1.tif',
'from_intensity_data': False, 'from_intensity_data': False,
'object': 'real', 'object': 'real',
'constraint': 'sparse real', 'constraint': 'sparse real',
......
...@@ -7,6 +7,7 @@ from proxtoolbox.utils.graphics import addColorbar ...@@ -7,6 +7,7 @@ from proxtoolbox.utils.graphics import addColorbar
#for downloading data #for downloading data
import proxtoolbox.utils.GetData as GetData import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
import numpy as np import numpy as np
from numpy import exp, sqrt, log2, log10, ceil, floor, unravel_index, argmax, zeros from numpy import exp, sqrt, log2, log10, ceil, floor, unravel_index, argmax, zeros
...@@ -77,7 +78,7 @@ class CDI_Experiment(PhaseExperiment): ...@@ -77,7 +78,7 @@ class CDI_Experiment(PhaseExperiment):
GetData.getData('Phase') GetData.getData('Phase')
if not self.silent: if not self.silent:
print('Loading data file CDI_intensity') print('Loading data file CDI_intensity')
f = loadmat('../InputData/Phase/CDI_intensity.mat') f = loadmat(datadir/'Phase'/'CDI_intensity.mat')
# diffraction pattern # diffraction pattern
dp = f['intensity']['img'][0, 0] dp = f['intensity']['img'][0, 0]
orig_res = max(dp.shape[0], dp.shape[1]) # actual data size orig_res = max(dp.shape[0], dp.shape[1]) # actual data size
......
...@@ -13,6 +13,8 @@ from numpy.linalg import norm ...@@ -13,6 +13,8 @@ from numpy.linalg import norm
from numpy.fft import fft2, ifft2 from numpy.fft import fft2, ifft2
import time import time
from proxtoolbox.utils.GetData import datadir
class CDP_Experiment(PhaseExperiment): class CDP_Experiment(PhaseExperiment):
""" """
...@@ -91,18 +93,18 @@ class CDP_Experiment(PhaseExperiment): ...@@ -91,18 +93,18 @@ class CDP_Experiment(PhaseExperiment):
# make image # make image
if debug: if debug:
if n2 == 1: if n2 == 1:
x_dict = loadMatFile('../InputData/Phase/CDP_1D_x.mat') x_dict = loadMatFile(datadir/'Phase'/'CDP_1D_x.mat')
debug_image = x_dict['x'] debug_image = x_dict['x']
masks_dict = loadMatFile('../InputData/Phase/CDP_1D_Masks.mat') masks_dict = loadMatFile(datadir/'Phase'/'CDP_1D_Masks.mat')
debug_masks = masks_dict['Masks'] debug_masks = masks_dict['Masks']
z0_dict = loadMatFile('../InputData/Phase/CDP_1D_z0.mat') z0_dict = loadMatFile(datadir/'Phase'/'CDP_1D_z0.mat')
debug_z0 = z0_dict['z0'] debug_z0 = z0_dict['z0']
elif n2 == 256: elif n2 == 256:
x_dict = loadMatFile('../InputData/Phase/CDP_2D_x.mat') x_dict = loadMatFile(datadir/'Phase'/'CDP_2D_x.mat')
debug_image = x_dict['x'] debug_image = x_dict['x']
masks_dict = loadMatFile('../InputData/Phase/CDP_2D_Masks.mat') masks_dict = loadMatFile(datadir/'Phase'/'CDP_2D_Masks.mat')
debug_masks = masks_dict['Masks'] debug_masks = masks_dict['Masks']
z0_dict = loadMatFile('../InputData/Phase/CDP_2D_z0.mat') z0_dict = loadMatFile(datadir/'Phase'/'CDP_2D_z0.mat')
debug_z0 = z0_dict['z0'] debug_z0 = z0_dict['z0']
x = debug_image x = debug_image
else: else:
......
...@@ -12,6 +12,7 @@ from proxtoolbox.utils.cell import Cell, isCell ...@@ -12,6 +12,7 @@ from proxtoolbox.utils.cell import Cell, isCell
#for downloading data #for downloading data
import proxtoolbox.utils.GetData as GetData import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
import matplotlib import matplotlib
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
...@@ -91,7 +92,7 @@ class JWST_Experiment(PhaseExperiment): ...@@ -91,7 +92,7 @@ class JWST_Experiment(PhaseExperiment):
if not self.silent: if not self.silent:
print('Loading data.') print('Loading data.')
with open('../InputData/Phase/pupil.pmod','r') as fid: with open(datadir/'Phase'/'pupil.pmod','r') as fid:
# read lower endian float <f # read lower endian float <f
Xi_A = np.fromfile(fid, dtype='<f') Xi_A = np.fromfile(fid, dtype='<f')
Xi_A = Xi_A.astype(np.float64) Xi_A = Xi_A.astype(np.float64)
...@@ -99,13 +100,13 @@ class JWST_Experiment(PhaseExperiment): ...@@ -99,13 +100,13 @@ class JWST_Experiment(PhaseExperiment):
diversity = 3 diversity = 3
with open('../InputData/Phase/phase_p37.pmod','r') as fid: with open(datadir/'Phase'/'phase_p37.pmod','r') as fid:
# read lower endian float <f # read lower endian float <f
temp1 = np.fromfile(fid, dtype='<f') temp1 = np.fromfile(fid, dtype='<f')
temp1 = temp1.astype(np.float64) temp1 = temp1.astype(np.float64)
temp1 = temp1.reshape(512,512).T temp1 = temp1.reshape(512,512).T
with open('../InputData/Phase/phase_m37.pmod','r') as fid: with open(datadir/'Phase'/'phase_m37.pmod','r') as fid:
# read lower endian float <f # read lower endian float <f
temp2 = np.fromfile(fid, dtype='<f') temp2 = np.fromfile(fid, dtype='<f')
temp2 = temp2.astype(np.float64) temp2 = temp2.astype(np.float64)
......
...@@ -6,6 +6,7 @@ from proxtoolbox.utils.graphics import addColorbar ...@@ -6,6 +6,7 @@ from proxtoolbox.utils.graphics import addColorbar
#for downloading data #for downloading data
import proxtoolbox.utils.GetData as GetData import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
import numpy as np import numpy as np
from numpy import exp, sqrt, log2, log10, ceil, floor, unravel_index, argmax, zeros from numpy import exp, sqrt, log2, log10, ceil, floor, unravel_index, argmax, zeros
...@@ -81,13 +82,13 @@ class Krueger_Experiment(PhaseExperiment): ...@@ -81,13 +82,13 @@ class Krueger_Experiment(PhaseExperiment):
# parameters see below # parameters see below
# empty waveguide (WG) beam # empty waveguide (WG) beam
WG = loadmat('../InputData/Phase/WG_beam.mat') WG = loadmat(datadir/'Phase'/'WG_beam.mat')
WG = WG['WG'] WG = WG['WG']
# hologram # hologram
if not self.silent: if not self.silent:
print('Loading data hologram_not-normalized.mat') print('Loading data hologram_not-normalized.mat')
I_exp = loadmat('../InputData/Phase/hologram_not-normalized.mat') I_exp = loadmat(datadir/'Phase'/'hologram_not-normalized.mat')
I_exp = I_exp['I_exp'] I_exp = I_exp['I_exp']
I_exp[np.isnan(I_exp)] = 1 I_exp[np.isnan(I_exp)] = 1
......
...@@ -17,6 +17,7 @@ from matplotlib.pyplot import subplots, show, figure ...@@ -17,6 +17,7 @@ from matplotlib.pyplot import subplots, show, figure
import os.path import os.path
import time import time
from proxtoolbox.utils.GetData import datadir
class Phasepack_Experiment(PhaseExperiment): class Phasepack_Experiment(PhaseExperiment):
''' '''
...@@ -70,7 +71,7 @@ class Phasepack_Experiment(PhaseExperiment): ...@@ -70,7 +71,7 @@ class Phasepack_Experiment(PhaseExperiment):
# so that we can use the automatic data loading feature (i.e., GetData.getData("Phasepack")). # so that we can use the automatic data loading feature (i.e., GetData.getData("Phasepack")).
# Another possibility is to write code that downloads the data files directly from # Another possibility is to write code that downloads the data files directly from
# the original website (https://rice.app.box.com/v/TransmissionMatrices) # the original website (https://rice.app.box.com/v/TransmissionMatrices)
data_dir = "../InputData/Phase/" + self.dataset + '/' data_dir = datadir/'Phase' + self.dataset
filenames = ['A_GS.mat', 'YH_squared_test.mat', 'XH_test.mat'] filenames = ['A_GS.mat', 'YH_squared_test.mat', 'XH_test.mat']
for filename in filenames: for filename in filenames:
data_path = data_dir + filename data_path = data_dir + filename
......
...@@ -11,6 +11,7 @@ from proxtoolbox.experiments.ptychography.ptychographyUtils import circ, \ ...@@ -11,6 +11,7 @@ from proxtoolbox.experiments.ptychography.ptychographyUtils import circ, \
#for downloading data #for downloading data
import proxtoolbox.utils.GetData as GetData import proxtoolbox.utils.GetData as GetData
from proxtoolbox.utils.GetData import datadir
import numpy as np import numpy as np
from numpy import exp, sqrt, log2, log10, ceil, floor, unravel_index, argmax, zeros from numpy import exp, sqrt, log2, log10, ceil, floor, unravel_index, argmax, zeros
...@@ -44,7 +45,7 @@ class PtychographyExperiment(Experiment): ...@@ -44,7 +45,7 @@ class PtychographyExperiment(Experiment):
'experiment_name' : 'Ptychography', 'experiment_name' : 'Ptychography',
'object': 'complex', 'object': 'complex',
'constraint': 'amplitude only', 'constraint': 'amplitude only',
'data_dir': '../InputData/Ptychography/', 'data_dir': datadir/'Ptychography',
'datafile': 'data_NTT_01_26210_192x192', 'datafile': 'data_NTT_01_26210_192x192',
'farfield': True, 'farfield': True,
'noise': None, 'noise': None,
...@@ -93,7 +94,7 @@ class PtychographyExperiment(Experiment): ...@@ -93,7 +94,7 @@ class PtychographyExperiment(Experiment):
def __init__(self, def __init__(self,
data_dir = '../InputData/Ptychography/', data_dir = datadir/'Ptychography',
datafile = 'data_NTT_01_26210_192x192', datafile = 'data_NTT_01_26210_192x192',
farfield = True, farfield = True,
poissonfactor = 5, poissonfactor = 5,
......
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