Skip to content

Commit

Permalink
Merge pull request #64 from wright-group/all_nan_slice
Browse files Browse the repository at this point in the history
Add case for all nan slice in setpoint
  • Loading branch information
untzag committed Aug 7, 2019
2 parents 0ef5e2d + 0368d42 commit 1ec53d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion attune/workup/_setpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ def _setpoint(data, channel_name, tune_points, *, spline=True, **spline_kwargs):
xi = c.axes[0].points
yi = c[channel_name].points
xi, yi = wt.kit.remove_nans_1D(xi, yi)
if np.nanmin(yi) <= 0 <= np.nanmax(yi):
if np.all(np.isnan(yi)):
offsets.append(np.nan)
elif np.nanmin(yi) <= 0 <= np.nanmax(yi):
p = np.polynomial.Polynomial.fit(yi, xi, 2)
offsets.append(p(0))
else:
Expand Down

0 comments on commit 1ec53d9

Please sign in to comment.