Commit 6b8a20d9 authored by Matthijs's avatar Matthijs
Browse files

Basic algorithm running for 3D, not actually getting a good solution yet

parent c2046861
......@@ -8,8 +8,12 @@ from numpy.linalg import norm
def phase_offset_compensated_norm(arr1, arr2, norm_factor=1, norm_type='fro'):
phase_offset = angle(sum(arr1 * arr2.conj()))
return norm(arr1 - arr2 * exp(1j * phase_offset), norm_type) / norm_factor
if arr1.ndim < 3:
phase_offset = angle(sum(arr1 * arr2.conj()))
return norm(arr1 - arr2 * exp(1j * phase_offset), norm_type) / norm_factor
else:
phase_offset = angle(sum(arr1 * arr2.conj()))
return sqrt(sum((arr1 - arr2 * exp(1j * phase_offset))**2)) / norm_factor
class SimpleAlgorithm:
......@@ -211,7 +215,6 @@ class SimpleAlgorithm:
u2 = u2[:, :, 0]
change = change[1:iter + 1]
output = {'u': u, 'u1': u1, 'u2': u2, 'iter': iter, 'change': change}
if self.diagnostic:
gap = gap[1:iter + 1]
......
......@@ -156,8 +156,8 @@ new_config = {
# default is 1.
'graphics_display': 'Phase_graphics_3d', # name of the plotting routine
'dataprocessor_plotting': True,
'interpolate_result': True,
'zoomin_on_result': True
'interpolate_result': False,
'zoomin_on_result': False
}
......@@ -173,7 +173,7 @@ class Phase(Problem):
print("Calculation time:")
print(self.elapsed_time)
_graphics = getattr(Graphics, self.config['graphics_display'])
_graphics(self.config, self.output)
self.output_plots = _graphics(self.config, self.output)
def save(self, save_dir=None):
"""
......
......@@ -37,6 +37,8 @@ def roll_to_pos(arr: np.ndarray, y: int = 0, x: int = 0, pos: tuple = None, move
temp = np.roll(arr, shift=shifts, axis=dims)
else: # old method
temp = shift_array(arr, int(y - old[0]), int(x - old[1]))
if temp.shape != arr.shape:
raise Exception('Non-matching input and output shapes')
return temp
......
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