Skip to content

Commit

Permalink
Merge pull request #13 from lsst-camera-dh/LSSTTD-968
Browse files Browse the repository at this point in the history
Fixes bug with ITL absolute height analysis, adds unit test, sets Znom = 12.992 mm
  • Loading branch information
sethdigel authored Mar 24, 2017
2 parents ce32d06 + 81e0a3d commit 09c46c0
Show file tree
Hide file tree
Showing 4 changed files with 5,486 additions and 3 deletions.
15 changes: 14 additions & 1 deletion python/MetrologyData.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def xyzPlane_fit(self, nsigma=4, p0=(0, 0, 0)):
pars, _ = scipy.optimize.curve_fit(xyz_plane, positions, self.z, p0=p0)
dz = xyz_plane(positions, *pars) - self.z
mean, stdev = np.mean(dz), np.std(dz)

# Refit iteratively until the standard deviation of residuals does not
# change
stdev_last = -1
Expand Down Expand Up @@ -112,7 +111,21 @@ def set_ref_plane(self, plane_functor, zoffset=0, nsigma=5):
pos, z = self.sensor.data()
dz = z - plane_functor(pos) + zoffset
self.resids = dz

# Also define residuals with outliers removed (nsigma clipping)
if self.sensor.mean_filt is None:
# For absolute height analysis for ITL sensors no plane will
# have been fit at this point, so the mean and standard
# deviations of residuals with outliers filtered will not
# have been evaluated. No plane needs to be fit here, but
# the code expects to be able to reference the mean and
# standard deviations of the filtered residuals.
mean, stdev = np.mean(dz), np.std(dz)
index = np.where((dz > mean-nsigma*stdev) &
(dz < mean+nsigma*stdev))
self.sensor.mean_filt = np.mean(dz[index])
self.sensor.stdev_filt = np.std(dz[index])

mean, stdev = self.sensor.mean_filt, self.sensor.stdev_filt
index = np.where((dz > mean-nsigma*stdev) & (dz < mean+nsigma*stdev))
self.resids_filt = dz[index]
Expand Down
4 changes: 2 additions & 2 deletions python/absoluteHeightTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def absoluteHeightTask(sensor_id, infile, dtype='OGP', zoffset=0,
zoffset=zoffset)
elif dtype == 'ITL':
#
# Set reference plane at znom=12.998 mm
# Set reference plane at znom=12.992 mm
#
sensorData.set_ref_plane(XyzPlane(0, 0, 12998.))
sensorData.set_ref_plane(XyzPlane(0, 0, 12992.))
else:
raise RuntimeError("%s not supported for absolute height analysis"
% dtype)
Expand Down
Loading

0 comments on commit 09c46c0

Please sign in to comment.