Skip to content

Commit

Permalink
Clip outlying stationary positioners from turbulence fits at 10 microns.
Browse files Browse the repository at this point in the history
  • Loading branch information
schlafly committed Oct 26, 2021
1 parent e575f22 commit e222e96
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion py/desimeter/turbulence.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def solve_files(expectedfn, measuredfn, mode='independent', **kw):


def correct_using_stationary(xs, ys, x0s, y0s, xc, yc,
scale_covar=1):
scale_covar=1, clip_resid=0.01):
"""Remove correlated turbulent signals from measured locations of fibers,
using subset of stationary fibers.
Expand All @@ -376,6 +376,8 @@ def correct_using_stationary(xs, ys, x0s, y0s, xc, yc,
yc : array_like(n), measured y position of fibers to be corrected
scale_covar : bool, amount to scale covariance by
(pix / micron for FVC instead of FP, e.g.)
clip_resid: float, exclude positioners with residuals larger than
X mm, default 0.01 mm = 10 microns.
Returns:
xturb, yturb: derived turbulent offsets. Turbulence corrected
Expand All @@ -388,6 +390,19 @@ def correct_using_stationary(xs, ys, x0s, y0s, xc, yc,
data['y'] = ys
data['dx'] = xs-x0s
data['dy'] = ys-y0s
if clip_resid > 0:
# here using only stationary positioners
xturb, yturb, _ = solve_independent(
data, nuse=500, excludeself=False,
method='powell', fix_covar=True,
scale_covar=scale_covar)
offset = np.hypot(data['dx'] - xturb, data['dy'] - yturb)
m = offset < 0.01 # 10 microns
if np.sum(~m) > 0:
log.info('Excluding %d stationary positioners with turbulence '
'corrected offsets larger than 10 microns.' % np.sum(~m))
data = data[m]

xturb, yturb, _ = solve_independent(
data, nuse=500, excludeself=False,
predict_at=(xc, yc), method='powell',
Expand Down

0 comments on commit e222e96

Please sign in to comment.