Commit c1cce5f0 authored by Matthijs's avatar Matthijs
Browse files

bugfix

parent 907d6dbf
......@@ -7,11 +7,21 @@ import imageio
def data_processor(config):
if config['data_filename'][-4:] == '.mat':
inp_data = loadmat('../../../InputData/OrbitalTomog/' + config['data_filename'])
inp = inp_data["I2"]
if config['data_filename'][1] == ':':
path_to_file = config['data_filename']
else:
inp = imageio.imread('../../../InputData/OrbitalTomog/' + config['data_filename'])
path_to_file = '../../../InputData/OrbitalTomog/' + config['data_filename']
try:
if config['data_filename'][-4:] == '.mat': # for the old coronene simulations by W. Bennecke
inp_data = loadmat(path_to_file)
inp = inp_data["I2"]
else:
inp = imageio.imread(path_to_file)
except FileNotFoundError:
path_to_file = input('Please enter the path to the datafile: ')
inp = imageio.imread(path_to_file)
ny, nx = inp.shape
config['data'] = abs(inp)
......
......@@ -56,7 +56,7 @@ class P_Sparsity(ProxOperator):
u *= self.support # apply support
p_Sparsity = 0 * u
sorting = np.argsort(abs(u), axis=None) # gives indices of sorted array in ascending order
indices = np.asarray([unravel_index(sorting[i], u) for i in range(-1 * self.sparsity_parameter, 0)])
indices = np.asarray([unravel_index(sorting[i], u.shape) for i in range(-1 * self.sparsity_parameter, 0)])
p_Sparsity[indices[:, 0], indices[:, 1]] = u[indices[:, 0], indices[:, 1]]
return p_Sparsity
......
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