1 from __future__
import print_function
2 from builtins
import range
32 """Do no distortion. Used for sanity checking"""
34 out = src.table.copyRecord(src)
39 """Increase the x value in a Source object by frac. E.g
40 src.x = 1000 --> 1001 if frac=.001
44 frac How much to change X by
47 A deep copy of src, with the value of x changed
50 out = src.table.copyRecord(src)
51 out.set(out.table.getCentroidKey().getX(), out.getX()*(1+frac))
56 """Distort image by terms with power <=2
57 i.e y, y^2, x, xy, x^2
60 out = src.table.copyRecord(src)
65 out.set(out.table.getCentroidKey().getX(), x + val*frac)
66 out.set(out.table.getCentroidKey().getY(), y)
71 """Distort image by terms with power <=2
72 i.e y, y^2, x, xy, x^2
75 out = src.table.copyRecord(src)
80 out.set(out.table.getCentroidKey().getX(), x + val*frac)
81 out.set(out.table.getCentroidKey().getY(), y)
86 out = src.table.copyRecord(src)
89 val = x**3 - 2*x**2 + 4*x - 9
91 out.set(out.table.getCentroidKey().getX(), x + val*frac)
92 out.set(out.table.getCentroidKey().getY(), y)
97 """Increase the y value in a Source object by frac. E.g
98 src.x = 1000 --> 1001 if frac=.001
102 frac How much to change Y by
105 A deep copy of src, with the value of y changed
108 out = src.table.copyRecord(src)
109 out.set(out.table.getCentroidKey().getY(), out.getY()*(1+frac))
114 """Distort image by terms with power <=2
115 i.e y, y^2, x, xy, x^2
118 out = src.table.copyRecord(src)
123 out.set(out.table.getCentroidKey().getX(), x)
124 out.set(out.table.getCentroidKey().getY(), y + val*frac)
129 """Distort image by terms with power <=2
130 i.e y, y^2, x, xy, x^2
133 out = src.table.copyRecord(src)
138 out.set(out.table.getCentroidKey().getX(), x)
139 out.set(out.table.getCentroidKey().getY(), y + val*frac)
144 out = src.table.copyRecord(src)
147 val = y**3 - 2*y**2 + 4*y - 9
149 out.set(out.table.getCentroidKey().getX(), x)
150 out.set(out.table.getCentroidKey().getY(), y + val*frac)
155 out = src.table.copyRecord(src)
160 out.set(out.table.getCentroidKey().getX(), x)
161 out.set(out.table.getCentroidKey().getY(), y + val*frac)
166 out = src.table.copyRecord(src)
169 val = y**3 - 2*y**2 + 4*y - 9
171 out.set(out.table.getCentroidKey().getX(), x + val*frac)
172 out.set(out.table.getCentroidKey().getY(), y)
177 out = src.table.copyRecord(src)
180 valx = x**3 - 2*x**2 + 4*x - 9
181 valy = y**3 - 2*y**2 + 4*y - 9
183 out.set(out.table.getCentroidKey().getX(), x + valy*frac)
184 out.set(out.table.getCentroidKey().getY(), y + valx*frac)
189 """Distort image by terms with power <=2
190 i.e y, y^2, x, xy, x^2
193 out = src.table.copyRecord(src)
200 out.set(out.table.getCentroidKey().getX(), x + val*frac)
201 out.set(out.table.getCentroidKey().getY(), y)
206 """Distort image by a 2nd order Cheby polynomial"""
208 out = src.table.copyRecord(src)
211 out.set(out.table.getCentroidKey().getX(), x + frac*val)
216 """Create a copy of srcList, and apply function to distort the
220 srcList a SourceSet object
221 function: A function that does a deep copy of a single Source
227 out.append(function(src))
230 for i
in range(len(srcList)):
234 x1, y1 = s.getX(), s.getY()
235 x2, y2 = o.getX(), o.getY()
237 diff = math.hypot(x1-x2, y1-y2)
238 maxDiff = max(diff, maxDiff)
240 print(
"Max deviation is %e pixels" % (maxDiff))
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.