LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Functions
lsst.meas.astrom.sip.genDistortedImage Namespace Reference

Functions

def noDistort
 
def linearXDistort
 
def quadraticDistortX
 
def cubicDistortX
 
def manyTermX
 
def linearYDistort
 
def quadraticDistortY
 
def cubicDistortY
 
def manyTermY
 
def crossTerms1
 
def crossTerms2
 
def crossTerms3
 
def quadraticDistort
 
def T2DistortX
 
def distortList
 

Function Documentation

def lsst.meas.astrom.sip.genDistortedImage.crossTerms1 (   src,
  frac = 1e-11 
)

Definition at line 153 of file genDistortedImage.py.

154 def crossTerms1(src, frac=1e-11):
155  out = src.table.copyRecord(src)
156  x = out.getX()
157  y = out.getY()
158  val = x**3 - 2*x**2 #+ 4*x - 9
159 
160  out.set(out.table.getCentroidKey().getX(), x)
161  out.set(out.table.getCentroidKey().getY(), y + val*frac)
162  return out
163 
def lsst.meas.astrom.sip.genDistortedImage.crossTerms2 (   src,
  frac = 1e-11 
)

Definition at line 164 of file genDistortedImage.py.

165 def crossTerms2(src, frac=1e-11):
166  out = src.table.copyRecord(src)
167  x = out.getX()
168  y = out.getY()
169  val = y**3 - 2*y**2 + 4*y - 9
170 
171  out.set(out.table.getCentroidKey().getX(), x+ val*frac)
172  out.set(out.table.getCentroidKey().getY(), y)
173  return out
174 
def lsst.meas.astrom.sip.genDistortedImage.crossTerms3 (   src,
  frac = 1e-9 
)

Definition at line 175 of file genDistortedImage.py.

176 def crossTerms3(src, frac=1e-9):
177  out = src.table.copyRecord(src)
178  x = out.getX()
179  y = out.getY()
180  valx = x**3 - 2*x**2 + 4*x - 9
181  valy = y**3 - 2*y**2 + 4*y - 9
182 
183  out.set(out.table.getCentroidKey().getX(), x + valy*frac)
184  out.set(out.table.getCentroidKey().getY(), y + valx*frac)
185  return out
186 
def lsst.meas.astrom.sip.genDistortedImage.cubicDistortX (   src,
  frac = 1e-9 
)
Distort image by terms with power <=2
i.e y, y^2, x, xy, x^2

Definition at line 68 of file genDistortedImage.py.

68 
69 def cubicDistortX(src, frac=1e-9):
70  """Distort image by terms with power <=2
71  i.e y, y^2, x, xy, x^2
72  """
73 
74  out = src.table.copyRecord(src)
75  x = out.getX()
76  y = out.getY()
77  val = x**3
78 
79  out.set(out.table.getCentroidKey().getX(), x + val*frac)
80  out.set(out.table.getCentroidKey().getY(), y)
81  return out
82 
def lsst.meas.astrom.sip.genDistortedImage.cubicDistortY (   src,
  frac = 1e-9 
)
Distort image by terms with power <=2
i.e y, y^2, x, xy, x^2

Definition at line 127 of file genDistortedImage.py.

128 def cubicDistortY(src, frac=1e-9):
129  """Distort image by terms with power <=2
130  i.e y, y^2, x, xy, x^2
131  """
132 
133  out = src.table.copyRecord(src)
134  x = out.getX()
135  y = out.getY()
136  val = x**3
137 
138  out.set(out.table.getCentroidKey().getX(), x)
139  out.set(out.table.getCentroidKey().getY(), y + val*frac)
140  return out
141 
def lsst.meas.astrom.sip.genDistortedImage.distortList (   srcList,
  function 
)
Create a copy of srcList, and apply function to distort the 
values of x and y. 

Input:
srcList     a SourceSet object
function:   A function that does a deep copy of a single Source

Definition at line 213 of file genDistortedImage.py.

214 def distortList(srcList, function):
215  """Create a copy of srcList, and apply function to distort the
216  values of x and y.
217 
218  Input:
219  srcList a SourceSet object
220  function: A function that does a deep copy of a single Source
221  """
222 
223  out = afwTable.SourceCatalog(srcList.table)
224 
225  for src in srcList:
226  out.append( function(src) )
227 
228  maxDiff=0
229  for i in range(len(srcList)):
230  s = srcList[i]
231  o = out[i]
232 
233  x1, y1 = s.getX(), s.getY()
234  x2, y2 = o.getX(), o.getY()
235 
236  diff = math.hypot(x1-x2, y1-y2)
237  maxDiff = max(diff, maxDiff)
238 
239  print "Max deviation is %e pixels" %(maxDiff)
240 
241  return out
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:55
def lsst.meas.astrom.sip.genDistortedImage.linearXDistort (   src,
  frac = .001 
)
Increase the x value in a Source object by frac. E.g
src.x = 1000 --> 1001 if frac=.001

Input:
src     A Source object
frac    How much to change X by

Output:
A deep copy of src, with the value of x changed

Definition at line 35 of file genDistortedImage.py.

35 
36 def linearXDistort(src, frac=.001):
37  """Increase the x value in a Source object by frac. E.g
38  src.x = 1000 --> 1001 if frac=.001
39 
40  Input:
41  src A Source object
42  frac How much to change X by
43 
44  Output:
45  A deep copy of src, with the value of x changed
46  """
47 
48 
49  out = src.table.copyRecord(src)
50  out.set(out.table.getCentroidKey().getX(), out.getX()*(1+frac) )
51  return out
52 
def lsst.meas.astrom.sip.genDistortedImage.linearYDistort (   src,
  frac = .001 
)
Increase the y value in a Source object by frac. E.g
src.x = 1000 --> 1001 if frac=.001

Input:
src     A Source object
frac    How much to change Y by

Output:
A deep copy of src, with the value of y changed

Definition at line 95 of file genDistortedImage.py.

95 
96 def linearYDistort(src, frac=.001):
97  """Increase the y value in a Source object by frac. E.g
98  src.x = 1000 --> 1001 if frac=.001
99 
100  Input:
101  src A Source object
102  frac How much to change Y by
103 
104  Output:
105  A deep copy of src, with the value of y changed
106  """
107 
108  out = src.table.copyRecord(src)
109  out.set(out.table.getCentroidKey().getY(), out.getY()*(1+frac) )
110  return out
111 
def lsst.meas.astrom.sip.genDistortedImage.manyTermX (   src,
  frac = 1e-9 
)

Definition at line 83 of file genDistortedImage.py.

83 
84 def manyTermX(src, frac=1e-9):
85  out = src.table.copyRecord(src)
86  x = out.getX()
87  y = out.getY()
88  val = x**3 - 2*x**2 + 4*x - 9
89 
90  out.set(out.table.getCentroidKey().getX(), x + val*frac)
91  out.set(out.table.getCentroidKey().getY(), y)
92  return out
93 
94 
def lsst.meas.astrom.sip.genDistortedImage.manyTermY (   src,
  frac = 1e-9 
)

Definition at line 142 of file genDistortedImage.py.

143 def manyTermY(src, frac=1e-9):
144  out = src.table.copyRecord(src)
145  x = out.getX()
146  y = out.getY()
147  val = y**3 - 2*y**2 + 4*y - 9
148 
149  out.set(out.table.getCentroidKey().getX(), x)
150  out.set(out.table.getCentroidKey().getY(), y + val*frac)
151  return out
152 
def lsst.meas.astrom.sip.genDistortedImage.noDistort (   src)
Do no distortion. Used for sanity checking

Definition at line 28 of file genDistortedImage.py.

28 
29 def noDistort(src):
30  """Do no distortion. Used for sanity checking"""
31 
32  out = src.table.copyRecord(src)
33  return out
34 
def lsst.meas.astrom.sip.genDistortedImage.quadraticDistort (   src,
  frac = 1e-6 
)
Distort image by terms with power <=2
i.e y, y^2, x, xy, x^2

Definition at line 187 of file genDistortedImage.py.

188 def quadraticDistort(src, frac=1e-6):
189  """Distort image by terms with power <=2
190  i.e y, y^2, x, xy, x^2
191  """
192 
193  out = src.table.copyRecord(src)
194  x = out.getX()
195  y = out.getY()
196  val = y + 2*y**2
197  val += 3*x + 4*x*y
198  val += x**2
199 
200  out.set(out.table.getCentroidKey().getX(), x + val*frac)
201  out.set(out.table.getCentroidKey().getY(), y)
202  return out
def lsst.meas.astrom.sip.genDistortedImage.quadraticDistortX (   src,
  frac = 1e-6 
)
Distort image by terms with power <=2
i.e y, y^2, x, xy, x^2

Definition at line 53 of file genDistortedImage.py.

53 
54 def quadraticDistortX(src, frac=1e-6):
55  """Distort image by terms with power <=2
56  i.e y, y^2, x, xy, x^2
57  """
58 
59  out = src.table.copyRecord(src)
60  x = out.getX()
61  y = out.getY()
62  val = x**2
63 
64  out.set(out.table.getCentroidKey().getX(), x + val*frac)
65  out.set(out.table.getCentroidKey().getY(), y)
66  return out
67 
def lsst.meas.astrom.sip.genDistortedImage.quadraticDistortY (   src,
  frac = 1e-6 
)
Distort image by terms with power <=2
i.e y, y^2, x, xy, x^2

Definition at line 112 of file genDistortedImage.py.

113 def quadraticDistortY(src, frac=1e-6):
114  """Distort image by terms with power <=2
115  i.e y, y^2, x, xy, x^2
116  """
117 
118  out = src.table.copyRecord(src)
119  x = out.getX()
120  y = out.getY()
121  val = y**2
122 
123  out.set(out.table.getCentroidKey().getX(), x)
124  out.set(out.table.getCentroidKey().getY(), y + val*frac)
125  return out
126 
def lsst.meas.astrom.sip.genDistortedImage.T2DistortX (   src,
  frac = 1e-6 
)
Distort image by a 2nd order Cheby polynomial

Definition at line 203 of file genDistortedImage.py.

204 def T2DistortX(src, frac=1e-6):
205  """Distort image by a 2nd order Cheby polynomial"""
206 
207  out = src.table.copyRecord(src)
208  x = src.getX()
209  val = 2*(x**2) -1
210  out.set(out.table.getCentroidKey().getX(), x + frac*val)
211  return out
212