Skip to content

Commit

Permalink
Merge pull request #66 from wright-group/cap_workup
Browse files Browse the repository at this point in the history
Cap changes to the scan window
  • Loading branch information
untzag committed Aug 7, 2019
2 parents 68e37df + c04f75b commit fbd1a04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions attune/workup/_intensity.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def _intensity(data, channel_name, tune_points, *, spline=True, **spline_kwargs)

if spline:
spline = wt.kit.Spline(tune_points, offsets, **spline_kwargs)
return spline(tune_points)
return spline(tune_points).clip(data.axes[1].min(), data.axes[1].max())
if np.allclose(data.axes[0].points, tune_points):
return offsets
return offsets.clip(data.axes[1].min(), data.axes[1].max())
else:
raise ValueError("Data points and curve points do not match, and splining disabled")

Expand Down
4 changes: 2 additions & 2 deletions attune/workup/_setpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def _setpoint(data, channel_name, tune_points, *, spline=True, **spline_kwargs):
offsets = np.array(offsets)
if spline:
spline = wt.kit.Spline(data.axes[0].points, offsets, **spline_kwargs)
return spline(tune_points)
return spline(tune_points).clip(data.axes[1].min(), data.axes[1].max())
if np.allclose(data.axes[0].points, tune_points):
return offsets[::-1]
return offsets[::-1].clip(data.axes[1].min(), data.axes[1].max())
else:
raise ValueError("Data points and curve points do not match, and splining disabled")

Expand Down
4 changes: 2 additions & 2 deletions attune/workup/_tune_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def _offsets(data, channel_name, tune_points, *, spline=True, **spline_kwargs):

if spline:
spline = wt.kit.Spline(data.axes[0].points, offsets, **spline_kwargs)
return spline(tune_points)
return spline(tune_points).clip(data.axes[1].min(), data.axes[1].max())
if np.allclose(data.axes[0].points, tune_points):
return offsets
return offsets.clip(data.axes[1].min(), data.axes[1].max())
else:
raise ValueError("Data points and curve points do not match, and splining disabled")

Expand Down

0 comments on commit fbd1a04

Please sign in to comment.