LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Functions | Variables
lsst::meas::algorithms::interp Namespace Reference

Functions

template<typename MaskedImageT >
std::pair< bool, typename
MaskedImageT::Image::Pixel > 
singlePixel (int x, int y, MaskedImageT const &image, bool horizontal, double minval)
 

Variables

double const lpc_1_c1 = 0.7737
 
double const lpc_1_c2 = -0.2737
 
double const lpc_1s2_c1 = 0.7358
 
double const lpc_1s2_c2 = -0.2358
 
double const min2GaussianBias = -0.5641895835
 Mean value of the minimum of two N(0,1) variates. More...
 

Function Documentation

template<typename MaskedImageT >
std::pair< bool, typename MaskedImageT::Image::Pixel > lsst::meas::algorithms::interp::singlePixel ( int  x,
int  y,
MaskedImageT const &  image,
bool  horizontal,
double  minval 
)

Return a boolean status (true: interpolation is OK) and the interpolated value for a pixel, ignoring pixels given by badmask

Interpolation can either be vertical or horizontal

Note
: This is a pretty expensive routine, so use only after suitable thought.
Parameters
xx: column coordinate of the pixel in question
yy: row coordinate of the pixel in question
imageimage: in this image
horizontalhorizontal: interpolate horizontally?
minvalminval: minimum acceptable value

Definition at line 2134 of file Interp.cc.

2141 {
2142 #if defined(SDSS)
2143  BADCOLUMN defect; /* describe a bad column */
2144  PIX *data; /* temp array to interpolate in */
2145  int i;
2146  int i0, i1; /* data corresponds to range of
2147  {row,col} == [i0,i1] */
2148  int ndata; /* dimension of data */
2149  static int ndatamax = 40; /* largest allowable defect. XXX */
2150  int nrow, ncol; /* == reg->n{row,col} */
2151  PIX *val; /* pointer to pixel (rowc, colc) */
2152  int z1, z2; /* range of bad {row,columns} */
2153 
2154  shAssert(badmask != NULL && badmask->type == shTypeGetFromName("OBJMASK"));
2155  shAssert(reg != NULL && reg->type == TYPE_PIX);
2156  nrow = reg->nrow;
2157  ncol = reg->ncol;
2158 
2159  if (horizontal) {
2160  for (z1 = colc - 1; z1 >= 0; z1--) {
2161  if (!phPixIntersectMask(badmask, z1, rowc)) {
2162  break;
2163  }
2164  }
2165  z1++;
2166 
2167  for (z2 = colc + 1; z2 < ncol; z2++) {
2168  if (!phPixIntersectMask(badmask, z2, rowc)) {
2169  break;
2170  }
2171  }
2172  z2--;
2173 
2174  i0 = (z1 > 2) ? z1 - 2 : 0; /* origin of available required data */
2175  i1 = (z2 < ncol - 2) ? z2 + 2 : ncol - 1; /* end of " " " " */
2176 
2177  if (i0 < 2 || i1 >= ncol - 2) { /* interpolation will fail */
2178  return(-1); /* failure */
2179  }
2180 
2181  ndata = (i1 - i0 + 1);
2182  if (ndata > ndatamax) {
2183  return(-1); /* failure */
2184  }
2185 
2186  data = alloca(ndata*sizeof(PIX));
2187  for (i = i0; i <= i1; i++) {
2188  data[i - i0] = reg->ROWS[rowc][i];
2189  }
2190  val = &data[colc - i0];
2191  } else {
2192  for (z1 = rowc - 1; z1 >= 0; z1--) {
2193  if (!phPixIntersectMask(badmask, colc, z1)) {
2194  break;
2195  }
2196  }
2197  z1++;
2198 
2199  for (z2 = rowc + 1; z2 < nrow; z2++) {
2200  if (!phPixIntersectMask(badmask, colc, z2)) {
2201  break;
2202  }
2203  }
2204  z2--;
2205 
2206  i0 = (z1 > 2) ? z1 - 2 : 0; /* origin of available required data */
2207  i1 = (z2 < nrow - 2) ? z2 + 2 : nrow - 1; /* end of " " " " */
2208 
2209  if (i0 < 2 || i1 >= ncol - 2) { /* interpolation will fail */
2210  return(-1); /* failure */
2211  }
2212 
2213  ndata = (i1 - i0 + 1);
2214  if (ndata > ndatamax) {
2215  return(-1); /* failure */
2216  }
2217 
2218  data = alloca(ndata*sizeof(PIX));
2219  for (i = i0; i <= i1; i++) {
2220  data[i - i0] = reg->ROWS[i][colc];
2221  }
2222  val = &data[rowc - i0];
2223  }
2224 
2225  defect.x1 = z1 - i0;
2226  defect.x2 = z2 - i0;
2227  classify_defects(&defect, 1, ndata);
2228  do_defect(&defect, 1, data, ndata, minval);
2229 
2230  return(*val);
2231 #endif
2232 
2233  return std::make_pair(false, std::numeric_limits<typename MaskedImageT::Image::Pixel>::min());
2234 }
ImageT val
Definition: CR.cc:154

Variable Documentation

double const lsst::meas::algorithms::interp::lpc_1_c1 = 0.7737

LPC coefficients for sigma = 1, S/N = infty

Definition at line 49 of file Interp.h.

double const lsst::meas::algorithms::interp::lpc_1_c2 = -0.2737

Definition at line 50 of file Interp.h.

double const lsst::meas::algorithms::interp::lpc_1s2_c1 = 0.7358

LPC coefficients for sigma = 1/sqrt(2), S/N = infty. These are the coeffs to use when interpolating at 45degrees to the row/column

Definition at line 55 of file Interp.h.

double const lsst::meas::algorithms::interp::lpc_1s2_c2 = -0.2358

Definition at line 56 of file Interp.h.

double const lsst::meas::algorithms::interp::min2GaussianBias = -0.5641895835

Mean value of the minimum of two N(0,1) variates.

Definition at line 60 of file Interp.h.