Skip to content

Commit

Permalink
Fixed negative and positive edge finding
Browse files Browse the repository at this point in the history
Refs #7860
  • Loading branch information
DanNixon committed Sep 3, 2014
1 parent a134ee0 commit 9801cb6
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -45,15 +45,15 @@ def PyExec(self):
# Find range of values to flip
delta_x = sample_x[1] - sample_x[0]

negative_diff = np.absolute(sample_x - self._x_cut)
negative_diff = np.absolute(sample_x + self._x_cut)
negative_index = np.where(negative_diff < delta_x)[0][-1]
self._check_bounds(negative_index, num_pts, label='Negative')

positive_diff = np.absolute(sample_x + sample_x[negative_index])
positive_index = np.where(positive_diff < delta_x)[0][-1]
self._check_bounds(positive_index, num_pts, label='Positive')

new_data_size = 2*num_pts - (positive_index + negative_index) + 1
new_data_size = 2 * num_pts - (positive_index + negative_index) + 1

if self._verbose:
logger.notice('No. points = %d' % num_pts)
Expand Down Expand Up @@ -82,14 +82,14 @@ def PyExec(self):
e_out = np.zeros(new_data_size)

# Left hand side of cut
x_out[:num_pts - negative_index] = -x_in[num_pts:negative_index:-1]
y_out[:num_pts - negative_index] = y_in[num_pts:negative_index:-1]
e_out[:num_pts - negative_index] = e_in[num_pts:negative_index:-1]
x_out[:num_pts - positive_index] = -x_in[num_pts:positive_index:-1]
y_out[:num_pts - positive_index] = y_in[num_pts:positive_index:-1]
e_out[:num_pts - positive_index] = e_in[num_pts:positive_index:-1]

# Right hand side of cut
x_out[num_pts - negative_index:] = x_in[positive_index:]
y_out[num_pts - negative_index:] = y_in[positive_index:]
e_out[num_pts - negative_index:] = e_in[positive_index:]
x_out[num_pts - positive_index:] = x_in[negative_index:]
y_out[num_pts - positive_index:] = y_in[negative_index:]
e_out[num_pts - positive_index:] = e_in[negative_index:]

mtd[self._output_workspace].setX(index, x_out)
mtd[self._output_workspace].setY(index, y_out)
Expand Down

0 comments on commit 9801cb6

Please sign in to comment.