return self.scene.get_elevation()
self.config.patch_coords = (xmin, ymin, xsize, ysize)
if self.config.patch_coords is None: frame = self.scene.frame scene = self.scene rstate = num.random.RandomState(123)
while True: llE = rstate.uniform(0, frame.lengthE * (4/5)) llN = rstate.uniform(0, frame.lengthN * (4/5)) urE = frame.lengthE / 5 urN = frame.lengthN / 5
colmin, colmax = frame.mapENMatrix(llE, llE + urE) rowmin, rowmax = frame.mapENMatrix(llN, llN + urN)
displacement = scene._displacement[ rowmin:rowmax, colmin:colmax] if num.any(displacement): return llE, llN, urE, urN
return self.config.patch_coords
scene = self.scene frame = self.scene.frame coords = self.get_patch_coords() if not coords: raise AttributeError('Set coordinates for APS.')
colmin, colmax = frame.mapENMatrix(coords[0], coords[0] + coords[2]) rowmin, rowmax = frame.mapENMatrix(coords[1], coords[1] + coords[3]) displacement = scene._displacement[rowmin:rowmax, colmin:colmax] elevation = self.get_elevation()[rowmin:rowmax, colmin:colmax]
mask = num.isfinite(displacement) elevation = elevation[mask] displacement = displacement[mask]
return elevation, displacement
elevation, displacement = self.get_data() slope, intercept, _, _, _ = stats.linregress( elevation.ravel(), displacement.ravel())
return slope, intercept
self._log.info('Applying APS model to displacement')
scene = self.scene elevation = scene.get_elevation() slope, intercept = self.get_correlation()
correction = elevation * slope + intercept displacement -= correction return displacement |