Skip to content

Commit

Permalink
Use old curve setpoints for offsets (#77)
Browse files Browse the repository at this point in the history
* Use old curve setpoints for offsets

Closes #52 Closes #69

* modify curve _before_ plotting
  • Loading branch information
ksunden authored and untzag committed Nov 19, 2019
1 parent c64a223 commit d0847d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion attune/workup/_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ def plot_tune_test(data, channel, curve, prior_curve, raw_offsets=None):
ax.plot(curve.setpoints[:], raw_offsets, c="grey", lw=5, alpha=0.5)

ax.plot(
curve.setpoints[:], curve.setpoints[:] - prior_curve.setpoints[:], c="k", lw=5, alpha=0.5
prior_curve.setpoints[:],
curve.setpoints[:] - prior_curve.setpoints[:],
c="k",
lw=5,
alpha=0.5,
)
ax.axhline(c="k", lw=1)
ax.grid()
Expand Down
6 changes: 3 additions & 3 deletions attune/workup/_tune_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ def tune_test(
new_curve = old_curve.copy()
new_curve.setpoints.positions += offsets
new_curve.interpolate()
new_curve.map_setpoints(setpoints[:], units=setpoints.units)
new_curve.convert(curve.setpoints.units)
data.axes[0].convert(curve.setpoints.units)

# plot ----------------------------------------------------------------------------------------

fig, _ = plot_tune_test(
data, channel.natural_name, new_curve, prior_curve=old_curve, raw_offsets=raw_offsets
)

new_curve.map_setpoints(setpoints[:], units=setpoints.units)
new_curve.convert(curve.setpoints.units)
data.axes[0].convert(curve.setpoints.units)
# finish --------------------------------------------------------------------------------------
if autosave:
save(new_curve, fig, "tune_test", save_directory)
Expand Down

0 comments on commit d0847d4

Please sign in to comment.