Commit c4aca462 authored by Chris Smith's avatar Chris Smith
Browse files

Loop Fitting bugfix

Fixed issue with doing loop fitting when the only non-FORC spectroscopic dimension is the Voltage dimension.
parent 09230197
...@@ -259,6 +259,8 @@ class BELoopFitter(Fitter): ...@@ -259,6 +259,8 @@ class BELoopFitter(Fitter):
projected_loops_2d2 = self._reshape_projected_loops_for_h5(projected_loops_2d.T, projected_loops_2d2 = self._reshape_projected_loops_for_h5(projected_loops_2d.T,
order_dc_offset_reverse, order_dc_offset_reverse,
nd_mat_shape_dc_first) nd_mat_shape_dc_first)
else:
projected_loops_2d2 = projected_loops_2d
metrics_2d = self._reshape_results_for_h5(loop_metrics_1d, nd_mat_shape_dc_first) metrics_2d = self._reshape_results_for_h5(loop_metrics_1d, nd_mat_shape_dc_first)
guessed_loops_2 = self._reshape_results_for_h5(guessed_loops, nd_mat_shape_dc_first) guessed_loops_2 = self._reshape_results_for_h5(guessed_loops, nd_mat_shape_dc_first)
...@@ -538,6 +540,9 @@ class BELoopFitter(Fitter): ...@@ -538,6 +540,9 @@ class BELoopFitter(Fitter):
all_spec_dims.remove(forc_repeat_pos) all_spec_dims.remove(forc_repeat_pos)
# calculate number of loops: # calculate number of loops:
if len(all_spec_dims) == 0:
loop_dims = 1
else:
loop_dims = get_dimensionality(self._sho_spec_inds, all_spec_dims) loop_dims = get_dimensionality(self._sho_spec_inds, all_spec_dims)
loops_per_forc = np.product(loop_dims) loops_per_forc = np.product(loop_dims)
...@@ -694,7 +699,7 @@ class BELoopFitter(Fitter): ...@@ -694,7 +699,7 @@ class BELoopFitter(Fitter):
print('Loop metrics of shape:', raw_results.shape) print('Loop metrics of shape:', raw_results.shape)
# Step 9: Reshape back to same shape as fit_Nd2: # Step 9: Reshape back to same shape as fit_Nd2:
if not self._met_all_but_forc_inds: if not self._met_all_but_forc_inds:
spec_inds = None spec_inds = np.array([[1]])
loop_metrics_nd = np.reshape(raw_results, [-1, 1]) loop_metrics_nd = np.reshape(raw_results, [-1, 1])
else: else:
spec_inds = self._met_spec_inds[self._met_all_but_forc_inds, self._current_met_spec_slice] spec_inds = self._met_spec_inds[self._met_all_but_forc_inds, self._current_met_spec_slice]
......
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