23__all__ = [
"noDistort",
"linearXDistort",
"quadraticDistortX",
24 "cubicDistortX",
"manyTermX",
"crossTerms1",
25 "crossTerms2",
"crossTerms3",
"quadraticDistort",
26 "T2DistortX",
"T2DistortX"]
35 """Do no distortion. Used for sanity checking
48 out = src.table.copyRecord(src)
53 """Increase the x value in a Source object by frac. E.g
54 src.x = 1000 --> 1001 if frac=.001
61 How much to change X by
66 A deep copy of src,
with the value of x changed
69 out = src.table.copyRecord(src)
70 out.set(out.table.getCentroidSlot().getMeasKey().getX(), out.getX()*(1+frac))
75 """Distort image by terms with power <=2
76 i.e y, y^2, x, xy, x^2
83 How much to change X by
88 A deep copy of src, with the value of x changed
91 out = src.table.copyRecord(src)
96 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x + val*frac)
97 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y)
102 """Distort image by terms with power <=2
103 i.e y, y^2, x, xy, x^2
110 How much to change X by
115 A deep copy of src, with the value of x changed
118 out = src.table.copyRecord(src)
123 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x + val*frac)
124 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y)
129 """Distort image by multiple powers of x, 'x**3 - 2*x**2 + 4*x - 9'.
136 How much to change X by
141 A deep copy of src, with the value of x changed
144 out = src.table.copyRecord(src)
147 val = x**3 - 2*x**2 + 4*x - 9
149 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x + val*frac)
150 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y)
155 """Increase the y value in a Source object by frac. E.g
156 src.x = 1000 --> 1001 if frac=.001
163 How much to change Y by
168 A deep copy of src,
with the value of Y changed
171 out = src.table.copyRecord(src)
172 out.set(out.table.getCentroidSlot().getMeasKey().getY(), out.getY()*(1+frac))
177 """Distort image by terms with power <=2
178 i.e y, y^2, x, xy, x^2
185 How much to change Y by
190 A deep copy of src, with the value of Y changed
193 out = src.table.copyRecord(src)
198 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x)
199 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y + val*frac)
204 """Distort image by terms with power <=2
205 i.e y, y^2, x, xy, x^2
212 How much to change Y by
217 A deep copy of src, with the value of Y changed
220 out = src.table.copyRecord(src)
225 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x)
226 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y + val*frac)
231 """Distort image by multiple terms of Y, 'y**3 - 2*y**2 + 4*y - 9'.
238 How much to change Y by
243 A deep copy of src, with the value of Y changed
245 out = src.table.copyRecord(src)
248 val = y**3 - 2*y**2 + 4*y - 9
250 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x)
251 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y + val*frac)
256 """Distort image Y by X, leaving X unchanged, 'x**3 - 2*x**2'.
263 How much to change Y by
268 A deep copy of src, with the value of Y changed
270 out = src.table.copyRecord(src)
275 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x)
276 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y + val*frac)
281 """Distort image X by Y, leaving Y unchanged, 'y**3 - 2*y**2 + 4*y - 9'.
288 How much to change X by
293 A deep copy of src, with the value of X changed
295 out = src.table.copyRecord(src)
298 val = y**3 - 2*y**2 + 4*y - 9
300 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x + val*frac)
301 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y)
306 """Distort image X and Y , 'dx=x**3 - 2*x**2 + 4*x - 9',
307 'dy=y**3 - 2*y**2 + 4*y - 9'.
314 How much to change X
and Y by
319 A deep copy of src,
with the value of X
and Y changed
321 out = src.table.copyRecord(src)
324 valx = x**3 - 2*x**2 + 4*x - 9
325 valy = y**3 - 2*y**2 + 4*y - 9
327 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x + valy*frac)
328 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y + valx*frac)
333 """Distort image by terms with power <=2
334 i.e y, y^2, x, xy, x^2
346 A deep copy of src, with the value of X
349 out = src.table.copyRecord(src)
356 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x + val*frac)
357 out.set(out.table.getCentroidSlot().getMeasKey().getY(), y)
362 """Distort image by a 2nd order Cheby polynomial
374 A deep copy of src, with the value of X
377 out = src.table.copyRecord(src)
380 out.set(out.table.getCentroidSlot().getMeasKey().getX(), x + frac*val)
385 """Create a copy of srcList, and apply function to distort the
391 Input list of source to distort.
392 function : `callable`
393 A function that does a deep copy of a single Source
398 Output catalog
with distorted positions.
402 out.reserve(len(srcList))
405 out.append(function(src))
408 for i
in range(len(srcList)):
412 x1, y1 = s.getX(), s.getY()
413 x2, y2 = o.getX(), o.getY()
415 diff = math.hypot(x1-x2, y1-y2)
416 maxDiff = max(diff, maxDiff)
418 print(
"Max deviation is %e pixels" % (maxDiff))
cubicDistortY(src, frac=1e-9)
quadraticDistort(src, frac=1e-6)
manyTermX(src, frac=1e-9)
linearYDistort(src, frac=.001)
crossTerms2(src, frac=1e-11)
crossTerms1(src, frac=1e-11)
distortList(srcList, function)
quadraticDistortX(src, frac=1e-6)
crossTerms3(src, frac=1e-9)
T2DistortX(src, frac=1e-6)
linearXDistort(src, frac=.001)
manyTermY(src, frac=1e-9)
quadraticDistortY(src, frac=1e-6)
cubicDistortX(src, frac=1e-9)