SuperSky Class Reference

Public Member Functions

Static Public Attributes

Protected Member Functions



Protected Attributes


Detailed Description

Measure and subtract the sky spectrum from IFU science frames.

We make use of the fact that the images of the fibers are curved w.r.t. to the pixel grid on the CCD. Therefore, a wavelength resolution element gets sampled differently by the pixel grid in nearby fibers, and we can use this to obtain a drizzled sky spectrum with a higher resolution.

This high-resolution sky spectrum is represented by an approximating spline. The spline will then be sampled at the exact wavelength of each pixel to subtract the sky.


Constructor & Destructor Documentation

SuperSky::SuperSky ( MArray< float, 2 > &  In,
MArray< float, 2 > &  In_e,
const Distortion D,
const FiberModel F,
const float  maxdist,
const float  kappa1,
const float  kappa2,
const float  smoothing,
const bool  modelflat = true 
)

Member Function Documentation

void SuperSky::set_continuum ( MArray< bool, 1 > &  cont  )  [inline]

Set the array containing the continuum flags for each fiber. If true for a fiber, this fiber will be ignored when sampling the image for sky pixels.

References cont_.

Referenced by main().

void SuperSky::set_spline_file ( const string &  file,
const int  line 
) [inline]

Output the data and the spline fit to the sky for an image line

References spline_file_, and spline_line_.

Referenced by main().

MArray< float, 2 > SuperSky::subtract_sky ( const int  startline,
const int  endline,
const int  window,
const SuperSky SkyFrame 
) const

Compute a local sky estimate in the SuperSky object SkyFrame, adding all sky pixles in window lines above and below each image line and spline-approximating them. Subtract from image in the given SkyFrame instance.

Compute a local sky estimate adding all sky pixles in window lines above and below each image line and spline-approximating them. Subtract from image.

References I_, sky_spline_for_line(), and subtract_sky_from_line().

Referenced by main(), and subtract_sky().

MArray<float,2> SuperSky::subtract_sky ( const int  startline,
const int  endline,
const int  window 
) const [inline]

Compute a local sky estimate, adding all sky pixles in window lines above and below each image line and spline-approximating them.

References subtract_sky().

MArray< float, 2 > SuperSky::subtract_sky_quick ( const int  startline,
const int  endline,
const int  window,
const SuperSky SkyFrame 
) const

Compute a sky estimate in the SuperSky object SkyFrame, adding all sky pixles in window lines above and below the middle image line and spline-approximating them. Subtract from image in given SkyFrame instance. Quick and dirty method used for finding continuum fibers and iterating the sky subtraction.

Compute a sky estimate adding all sky pixles in window lines above and below the middle image line and spline-approximating them. Subtract from image. Quick and dirty method used for finding continuum fibers and iterating the sky subtraction.

References I_, sky_spline_for_line(), and subtract_sky_from_line().

Referenced by main(), and subtract_sky_quick().

MArray<float,2> SuperSky::subtract_sky_quick ( const int  startline,
const int  endline,
const int  window 
) const [inline]

Compute a sky estimate from image, adding all sky pixles in window lines above and below the middle image line and spline-approximating them. Quick and dirty method used for finding continuum fibers and iterating the sky subtraction.

References subtract_sky_quick().

BSpline::BSpline< float > SuperSky::sky_error_for_line ( const int  line,
const int  window,
const int  niter = 50 
) const

Calculate the errors on the sky estimate by Bootstrapping using Monte Carlo resampling of the input data within their error bounds. This uses a region of window lines around the target line. Runs niter MC iterations.

Returns a spline that represents the RMS error on the sky as a function of wavelength.

References bootstrap_resample_wf(), filter_sky_linear(), sample_sky_for_line(), and smoothing_.

Referenced by main().

void SuperSky::propagate_error ( const int  startline,
const int  endline,
const BSpline::BSpline< float > &  sky_error,
MArray< float, 2 > &  error_frame 
) const

Propagate the errors from sky estimation and subtraction into the error frame error. Uses MC Bootstrapping to estimate the error on the sky.

References D_, df, BSpline::BSpline< T >::evaluate(), Flat_, Distortion::map_xy_fiber_fast(), Distortion::map_xy_wavelength_fast(), and scaling_.

Referenced by main().

void SuperSky::set_scaling ( const float  s  )  [inline]

Set the scaling factor for the sky. The sky is multiplied by this number before subtraction. Default is 1.0. Useful when used in cross-frame mode (sky comes from different frame) to equalize exposure.

References scaling_.

Referenced by main().

void SuperSky::debug_output_spline ( BSpline::BSpline< float > &  Spl,
const std::vector< sky::WF > &  wfmap 
) const [protected]

Write a file with the spline fit for one line.

void SuperSky::subtract_sky_from_line ( MArray< float, 2 > &  Out,
const int  line,
const BSpline::BSpline< float > &  Sky 
) const [protected]

Subtract the sky spline from an image line. Actually, we use the same spline for 3 lines for speed.

References D_, df, BSpline::BSpline< T >::evaluate(), Flat_, I_, Distortion::map_xy_fiber_fast(), Distortion::map_xy_wavelength_fast(), and scaling_.

Referenced by subtract_sky(), and subtract_sky_quick().

BSpline::BSpline< float > SuperSky::sky_spline_for_line ( const int  window,
const int  line 
) const [protected]

Calculate the approximating spline to the sky spectrum for a given image line using all pixels in a region of window lines around the target line. Fibers whose cont_ value is true will be ignored.

Internally calls sample_sky_for_line() and filter_sky_linear().

Calculate the approximating spline to the sky spectrum for a given image line using all pixels in a region of window lines around the target line. Fibers whose cont value is true will be ignored.

Internally calls sample_sky_for_line() and filter_sky_linear().

References filter_sky_linear(), sample_sky_for_line(), and spline_line_.

Referenced by subtract_sky(), and subtract_sky_quick().

vector< WF > SuperSky::sample_sky_for_line ( const int  skyw,
const int  line 
) const [protected]

Put all sky samples into a sorted map (wavelength, flux) ignoring samples from fibers with continuum.

References clamp_window_high(), clamp_window_low(), cont_, D_, df, Flat_, Distortion::get_reference_f(), I_, Ie_, Distortion::map_xy_fiber_fast(), Distortion::map_xy_fibernum(), Distortion::map_xy_wavelength_fast(), and maxdist_.

Referenced by sky_error_for_line(), and sky_spline_for_line().

BSpline::BSpline<float> SuperSky::filter_sky_linear ( std::vector< sky::WF > &  wfmap,
const int  nsky,
const bool  write = false 
) const [protected]

Filter a vector of sky samples to reject outliers based on residuals from linear fits to short wavelength ranges.

Referenced by sky_error_for_line(), and sky_spline_for_line().

float SuperSky::get_lower_clipping_value ( float  mu  )  const [protected]

Return the lower clipping value to obtain an unbiased mean out of a Poisson distribution with mean mu.

References c, and lin_interp().

BSpline::BSpline< float > SuperSky::fix_spline_average ( MArray< float, 1 > &  w,
MArray< float, 1 > &  f,
BSpline::BSpline< float > &  s 
) const [protected]

Fix the spline by subtracting the average difference between s and the data.

References BSpline::BSpline< T >::evaluate(), and smoothing_.

int SuperSky::clamp_window_low ( const int  value,
const int  low,
const int  high,
const int  delta 
) const [protected]

Clamp a value such that it is always between low and high with a margin of delta. Used for sliding a window across a frame.

Referenced by sample_sky_for_line().

int SuperSky::clamp_window_high ( const int  value,
const int  low,
const int  high,
const int  delta 
) const [protected]

Clamp a value such that it is always between low and high with a margin of delta. Used for sliding a window across a frame.

Referenced by sample_sky_for_line().


Field Documentation

string SuperSky::version = "$Id: supersky.cpp 998 2015-05-22 12:23:42Z drory $" [static]
MArray<float,2> SuperSky::I_ [protected]
MArray<float,2> SuperSky::Ie_ [protected]

Referenced by sample_sky_for_line().

MArray<float,2> SuperSky::Flat_ [protected]
MArray<bool,1> SuperSky::cont_ [protected]
const Distortion& SuperSky::D_ [protected]
const FiberModel& SuperSky::F_ [protected]
const float SuperSky::maxdist_ [protected]

Referenced by sample_sky_for_line().

const float SuperSky::kappal_ [protected]
const float SuperSky::kappah_ [protected]
const float SuperSky::smoothing_ [protected]
string SuperSky::spline_file_ [protected]

Referenced by set_spline_file().

int SuperSky::spline_line_ [protected]
float SuperSky::scaling_ [protected]

Generated on 4 Nov 2015 for CURE by  doxygen 1.6.1