LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
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 1967 of file Interp.cc.

1974 {
1975 #if defined(SDSS)
1976  BADCOLUMN defect; /* describe a bad column */
1977  PIX *data; /* temp array to interpolate in */
1978  int i;
1979  int i0, i1; /* data corresponds to range of
1980  {row,col} == [i0,i1] */
1981  int ndata; /* dimension of data */
1982  static int ndatamax = 40; /* largest allowable defect. XXX */
1983  int nrow, ncol; /* == reg->n{row,col} */
1984  PIX *val; /* pointer to pixel (rowc, colc) */
1985  int z1, z2; /* range of bad {row,columns} */
1986 
1987  shAssert(badmask != NULL && badmask->type == shTypeGetFromName("OBJMASK"));
1988  shAssert(reg != NULL && reg->type == TYPE_PIX);
1989  nrow = reg->nrow;
1990  ncol = reg->ncol;
1991 
1992  if (horizontal) {
1993  for (z1 = colc - 1; z1 >= 0; z1--) {
1994  if (!phPixIntersectMask(badmask, z1, rowc)) {
1995  break;
1996  }
1997  }
1998  z1++;
1999 
2000  for (z2 = colc + 1; z2 < ncol; z2++) {
2001  if (!phPixIntersectMask(badmask, z2, rowc)) {
2002  break;
2003  }
2004  }
2005  z2--;
2006 
2007  i0 = (z1 > 2) ? z1 - 2 : 0; /* origin of available required data */
2008  i1 = (z2 < ncol - 2) ? z2 + 2 : ncol - 1; /* end of " " " " */
2009 
2010  if (i0 < 2 || i1 >= ncol - 2) { /* interpolation will fail */
2011  return(-1); /* failure */
2012  }
2013 
2014  ndata = (i1 - i0 + 1);
2015  if (ndata > ndatamax) {
2016  return(-1); /* failure */
2017  }
2018 
2019  data = alloca(ndata*sizeof(PIX));
2020  for (i = i0; i <= i1; i++) {
2021  data[i - i0] = reg->ROWS[rowc][i];
2022  }
2023  val = &data[colc - i0];
2024  } else {
2025  for (z1 = rowc - 1; z1 >= 0; z1--) {
2026  if (!phPixIntersectMask(badmask, colc, z1)) {
2027  break;
2028  }
2029  }
2030  z1++;
2031 
2032  for (z2 = rowc + 1; z2 < nrow; z2++) {
2033  if (!phPixIntersectMask(badmask, colc, z2)) {
2034  break;
2035  }
2036  }
2037  z2--;
2038 
2039  i0 = (z1 > 2) ? z1 - 2 : 0; /* origin of available required data */
2040  i1 = (z2 < nrow - 2) ? z2 + 2 : nrow - 1; /* end of " " " " */
2041 
2042  if (i0 < 2 || i1 >= ncol - 2) { /* interpolation will fail */
2043  return(-1); /* failure */
2044  }
2045 
2046  ndata = (i1 - i0 + 1);
2047  if (ndata > ndatamax) {
2048  return(-1); /* failure */
2049  }
2050 
2051  data = alloca(ndata*sizeof(PIX));
2052  for (i = i0; i <= i1; i++) {
2053  data[i - i0] = reg->ROWS[i][colc];
2054  }
2055  val = &data[rowc - i0];
2056  }
2057 
2058  defect.x1 = z1 - i0;
2059  defect.x2 = z2 - i0;
2060  classify_defects(&defect, 1, ndata);
2061  do_defect(&defect, 1, data, ndata, minval);
2062 
2063  return(*val);
2064 #endif
2065 
2066  return std::make_pair(false, std::numeric_limits<typename MaskedImageT::Image::Pixel>::min());
2067 }
double min
Definition: attributes.cc:216
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.