Commit be541f96 authored by Russell Luke's avatar Russell Luke
Browse files

try reading data

parent ac64fba6
......@@ -43,7 +43,7 @@ class Elser_Experiment(PhaseExperiment):
'lambda_switch': 20,
'data_ball': 1e-30,
'diagnostic': True,
'iterate_monitor_name': 'FeasibilityIterateMonitor',
'iterate_monitor_name': 'FeasibilityIterateMonitor',
'verbose': 0,
'graphics': 1
}
......@@ -62,6 +62,7 @@ class Elser_Experiment(PhaseExperiment):
self.FT_conv_kernel = Cell(1)
def loadData(self):
# def loadElserData(filename, M):
"""
Load Elser dataset. Create the initial iterate.
"""
......@@ -82,14 +83,13 @@ class Elser_Experiment(PhaseExperiment):
snr = 1e-8
print('Loading data.')
fn = ['../InputData/Phase/Elser/data', self.Atoms, self.category]
with open(fn,'r') as fid:
# read text file
data = np.fromfile(fid, dtype='int')
data = data.astype(np.float64)
data = data.reshape((128,128)).T
M = (fftshift(data))**(.5)
fn="".join(['../InputData/Phase/Elser/data', str(self.atoms), self.category])
# read text data file as a matrix of numbers
data = np.loadtxt(fn, delimiter="\t")
data = np.sqrt(data)/self.Nx
data = np.c_[data, np.zeros(self.Nx)] # add extra column
data = data.flatten() # make it a one-dimensional array
M = fftshift(data)
# have to look at what Elser is actually doing with his data...
self.magn = 1 # magnification factor
self.farfield = True
......
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