this class encapsulates all the knowledge about the fiber model pattern of the VIRUS spectrograph.
The form of the spectrum from each fiber is described by a gaussian with second and third hermite polynomials. The variation of fibermodel parameters sigma, h2 and h3 over the chip area are fitted with 7th order Chebychev polynoms.
The amplitudes are fitted for each fiber individually. First the amplitdude profile of the fiducial fiber is fitted with a one dimensional 7th order polynomial. The measured amplitudes of the remaining fibers are divided by the amplitude of the fiducial fiber and the remaining variation again individually fitted with a 7th order polynomial.
Together with Distortion
and PsfModel
, this forms a complete model of the VIRUS spectrograph.
typedef Cheby2D_7<double,double> FiberModel::FiberModelPattern |
typedef Poly1D<double, double,7> FiberModel::FiberThroughput |
FiberModel::FiberModel | ( | ) |
References fiducial_fib_, FIDUCIAL_FIBER, fit_niter_, h2_errors_, h2_par_, H2_PARAM, h3_errors_, h3_par_, H3_PARAM, sigma_errors_, sigma_mult_, and sigma_par_.
FiberModel::FiberModel | ( | const bool | fixed_h2, | |
const bool | fixed_h3 | |||
) |
FiberModel::FiberModel | ( | const std::string & | filename | ) |
References init_from_file().
FiberModel::FiberModel | ( | const FiberModel & | other | ) |
References amplitudes_, F_, fiducial_fib_, fit_niter_, h2_errors_, h2_par_, h3_errors_, h3_par_, sigma_errors_, sigma_mult_, and sigma_par_.
virtual FiberModel::~FiberModel | ( | ) | [inline, virtual] |
void FiberModel::init_from_file | ( | const std::string & | filename | ) |
References fit_niter_, and sigma_mult_.
Referenced by FiberModel(), main(), plot_data(), VFrame::read_fibermodels(), and refit_models().
std::vector<FiberThroughputPars> FiberModel::get_amplitudes | ( | ) | const [inline] |
References amplitudes_.
void FiberModel::set_amplitudes | ( | const std::vector< FiberThroughputPars > & | amplitudes | ) |
sets the amplitudes of the fibers
References amplitudes_.
Referenced by fit_initial_dist(), main(), and refit_models().
void FiberModel::set_h2 | ( | const FiberModel & | other | ) |
References h2_errors_, and h2_par_.
Referenced by main(), and refit_models().
void FiberModel::set_h3 | ( | const FiberModel & | other | ) |
References h3_errors_, and h3_par_.
Referenced by main(), and refit_models().
void FiberModel::set_sigma | ( | const FiberModel & | other | ) |
References sigma_errors_, and sigma_par_.
Referenced by main(), and refit_models().
void FiberModel::set_sigma_mult | ( | double | multiplier | ) |
References sigma_mult_.
void FiberModel::fit_sigma | ( | MArray< double, 1 > & | x, | |
MArray< double, 1 > & | y, | |||
MArray< double, 1 > & | sigma, | |||
MArray< double, 1 > & | sigma_errors | |||
) |
References _scalx_, _scaly_, BivariateLinearLsqFit< T, Function >::fit(), fit_niter_, sigma_errors_, and sigma_par_.
Referenced by fit_fibermodel().
void FiberModel::fit_h2 | ( | MArray< double, 1 > & | x, | |
MArray< double, 1 > & | y, | |||
MArray< double, 1 > & | h2, | |||
MArray< double, 1 > & | h2_errors | |||
) |
References _scalx_, _scaly_, BivariateLinearLsqFit< T, Function >::fit(), fit_niter_, h2_errors_, and h2_par_.
Referenced by fit_fibermodel().
void FiberModel::fit_h3 | ( | MArray< double, 1 > & | x, | |
MArray< double, 1 > & | y, | |||
MArray< double, 1 > & | h3, | |||
MArray< double, 1 > & | h3_errors | |||
) |
References _scalx_, _scaly_, BivariateLinearLsqFit< T, Function >::fit(), fit_niter_, h3_errors_, and h3_par_.
Referenced by fit_fibermodel().
void FiberModel::print_amplitude_coefficients | ( | ) | const |
References amplitudes_, and Poly1D< T, Tpar, N >::prettyPrint().
void FiberModel::print_sigma_coefficients | ( | ) | const |
References Cheby2D_7< double, double >::prettyPrint(), and sigma_par_.
Referenced by fit_fibermodel().
void FiberModel::print_h2_coefficients | ( | ) | const |
References h2_par_, and Cheby2D_7< double, double >::prettyPrint().
Referenced by fit_fibermodel().
void FiberModel::print_h3_coefficients | ( | ) | const |
References h3_par_, and Cheby2D_7< double, double >::prettyPrint().
Referenced by fit_fibermodel().
float FiberModel::get_single_fiberflux | ( | const int | x, | |
const int | y, | |||
const Distortion & | D | |||
) | const |
return the model flux of the nearest fiber, for a pixel x,y on the chip
return the flux of the nearest fiber, for a pixel x,y on the chip
Referenced by SourceSimulator::add_continuum_source_to_images(), SourceSimulator::add_sersic_source_to_images(), get_cumulative_fiberflux(), main(), PointSourceDetector::make_image(), single_fiber_flat(), and FiberIterator::single_fiberflux().
float FiberModel::get_single_fiberflux | ( | const double | x, | |
const double | y, | |||
const Distortion & | D | |||
) | const |
return the flux of the nearest fiber, for a position x,y on the chip
References get_fit_parameters(), MAX_FIBER_DIST, and sigma_mult_.
float FiberModel::get_single_fiberflux | ( | const double | x, | |
const double | y, | |||
const int | fiber, | |||
const Distortion & | D | |||
) | const |
return the flux of a given fiber, for a position x,y on the chip
References get_fit_parameters(), Distortion::get_reference_f(), Distortion::map_xf_y(), MAX_FIBER_DIST, and sigma_mult_.
float FiberModel::get_single_fiberprofile | ( | const int | x, | |
const int | y, | |||
const Distortion & | D | |||
) | const |
float FiberModel::get_single_fiberprofile | ( | const double | x, | |
const double | y, | |||
const Distortion & | D | |||
) | const |
References get_fit_parameters(), MAX_FIBER_DIST, and sigma_mult_.
float FiberModel::get_single_fiberprofile | ( | const int | x, | |
const int | y, | |||
const int | fiber, | |||
const Distortion & | D | |||
) | const |
return the profile of a fiber normalized to one at the center of the fiber, for a pixel x,y on the chip
References get_single_fiberprofile().
float FiberModel::get_single_fiberprofile | ( | const double | x, | |
const double | y, | |||
const int | fiber, | |||
const Distortion & | D | |||
) | const |
References get_fit_parameters(), Distortion::get_reference_f(), Distortion::map_xf_y(), MAX_FIBER_DIST, and sigma_mult_.
float FiberModel::get_cumulative_fiberflux | ( | const int | x, | |
const int | y, | |||
const Distortion & | D | |||
) | const |
return the flux of all 3 adjacent fibers, for a pixel x,y on the chip
Referenced by SourceSimulator::addSkyToFrame(), FiberIterator::cumulative_flux(), flat_from_model(), main(), mask_cosmics(), pixelflat(), and refit_models().
float FiberModel::get_cumulative_fiberflux | ( | const double | x, | |
const double | y, | |||
const Distortion & | D | |||
) | const |
return the flux of all 3 adjacent fibers, for a position x,y on the chip
References Distortion::get_numfibers(), get_single_fiberflux(), and Distortion::map_xy_fibernum().
float FiberModel::get_xy_amplitude | ( | const float | x, | |
const float | y, | |||
const Distortion & | D | |||
) | const |
References get_wf_amplitude(), Distortion::map_xy_fibernum(), and Distortion::map_xy_wavelength().
Referenced by flat_from_data(), get_fit_parameters(), and Measure::remove_spectra().
float FiberModel::get_wf_amplitude | ( | const float | w, | |
const int | f | |||
) | const |
References _scalw_, and amplitudes_.
Referenced by get_xy_amplitude(), main(), plot_fibermodel(), and Measure::scale_fiberthroughput().
float FiberModel::get_fiducial_amplitude | ( | const float | w | ) | const |
References _scalw_, amplitudes_, and FIDUCIAL_FIBER.
float FiberModel::get_xy_sigma | ( | const float | x, | |
const float | y | |||
) | const |
References _scalx_, _scaly_, F_, and sigma_par_.
Referenced by fit_fibermodel(), Measure::fit_peaks3H_initial(), Measure::fit_psf1D(), get_fit_parameters(), main(), and plot_fibermodel().
float FiberModel::get_xy_h2 | ( | const float | x, | |
const float | y | |||
) | const |
References _scalx_, _scaly_, F_, and h2_par_.
Referenced by fit_fibermodel(), Measure::fit_peaks3H_initial(), Measure::fit_psf1D(), get_fit_parameters(), main(), and plot_fibermodel().
float FiberModel::get_xy_h3 | ( | const float | x, | |
const float | y | |||
) | const |
References _scalx_, _scaly_, F_, and h3_par_.
Referenced by fit_fibermodel(), Measure::fit_peaks3H_initial(), Measure::fit_psf1D(), get_fit_parameters(), and plot_fibermodel().
MArray< float, 2 > FiberModel::flat_from_data | ( | const MArray< float, 2 > & | A, | |
const Distortion & | D, | |||
const int | length | |||
) | const |
create a flat field from science frame with sky signal
References clamp_window(), Distortion::get_reference_f(), get_xy_amplitude(), interpolate_at_xy(), Distortion::map_xf_y(), Distortion::map_xy_fibernum(), Resampler< Interpolator, Transform >::resample_xf_xy(), and Resampler< Interpolator, Transform >::resample_xy_xf().
Referenced by main(), and SuperSky::SuperSky().
MArray< float, 2 > FiberModel::flat_from_model | ( | const int | lx, | |
const int | ly, | |||
const Distortion & | D | |||
) | const |
References get_cumulative_fiberflux().
Referenced by main(), and SuperSky::SuperSky().
MArray< float, 2 > FiberModel::single_fiber_flat | ( | const int | lx, | |
const int | ly, | |||
const int | fiber, | |||
const Distortion & | D | |||
) | const |
References get_single_fiberflux().
Referenced by Extractor::extract_core_ac(), Extractor::extract_core_x_ac(), and main().
MArray< float, 2 > FiberModel::pixelflat | ( | const MArray< float, 2 > & | Flat, | |
const Distortion & | D | |||
) | const |
References get_cumulative_fiberflux(), Distortion::get_reference_f(), interpolate_at_xy(), Distortion::map_xf_y(), and Distortion::map_xy_fibernum().
Referenced by main().
float FiberModel::interpolate_at_xy | ( | const MArray< float, 2 > & | I, | |
const float | x, | |||
const float | y | |||
) | const |
interpolate an image at fractional coordinates x
,y
References BiCubicInterpolator::interpolate().
Referenced by flat_from_data(), main(), and pixelflat().
int FiberModel::get_fit_parameters | ( | const double | x, | |
const double | y, | |||
const Distortion & | D, | |||
double * | Amp, | |||
double * | H2, | |||
double * | H3, | |||
double * | y0, | |||
double * | s | |||
) | const [protected] |
References Distortion::get_reference_f(), get_xy_amplitude(), get_xy_h2(), get_xy_h3(), get_xy_sigma(), Distortion::map_xf_y(), and Distortion::map_xy_fibernum().
Referenced by get_single_fiberflux(), and get_single_fiberprofile().
std::ostream& operator<< | ( | std::ostream & | os, | |
const FiberModel & | d | |||
) | [friend] |
std::istream& operator>> | ( | std::istream & | is, | |
FiberModel & | d | |||
) | [friend] |
string FiberModel::version = "$Id: fibermodel.cpp 1079 2015-11-02 16:11:19Z snigula $" [static] |
Referenced by copy_org_models(), fit_initial_dist(), main(), and refit_models().
FiberModelPattern FiberModel::F_ [protected] |
Referenced by FiberModel(), get_xy_h2(), get_xy_h3(), and get_xy_sigma().
std::vector<FiberThroughputPars> FiberModel::amplitudes_ [protected] |
Fit of the amplitudes relative to the fiducial fiber see full description above
Referenced by FiberModel(), get_amplitudes(), get_fiducial_amplitude(), get_wf_amplitude(), operator<<(), operator>>(), print_amplitude_coefficients(), and set_amplitudes().
TPar FiberModel::sigma_par_ [protected] |
Referenced by FiberModel(), fit_sigma(), get_xy_sigma(), operator<<(), operator>>(), print_sigma_coefficients(), and set_sigma().
TPar FiberModel::sigma_errors_ [protected] |
Referenced by FiberModel(), fit_sigma(), operator<<(), operator>>(), and set_sigma().
TPar FiberModel::h2_par_ [protected] |
Referenced by FiberModel(), fit_h2(), get_xy_h2(), operator<<(), operator>>(), print_h2_coefficients(), and set_h2().
TPar FiberModel::h2_errors_ [protected] |
Referenced by FiberModel(), fit_h2(), operator<<(), operator>>(), and set_h2().
TPar FiberModel::h3_par_ [protected] |
Referenced by FiberModel(), fit_h3(), get_xy_h3(), operator<<(), operator>>(), print_h3_coefficients(), and set_h3().
TPar FiberModel::h3_errors_ [protected] |
Referenced by FiberModel(), fit_h3(), operator<<(), operator>>(), and set_h3().
double FiberModel::sigma_mult_ [protected] |
Multiplicative factor applied to sigma when deriving the fiberflux. usually only by simfmod to simulate different optics / fiberbundles. Defaults to 1.
Referenced by FiberModel(), get_single_fiberflux(), get_single_fiberprofile(), init_from_file(), and set_sigma_mult().
int FiberModel::fit_niter_ [protected] |
Number of iterations to do when fitting variation of the fibermodel parameters currently not used and defaults to 1.
Referenced by FiberModel(), fit_h2(), fit_h3(), fit_sigma(), and init_from_file().
int FiberModel::fiducial_fib_ [protected] |
Fiducial fiber used for fitting the amplitudes, see full description above default defined in specconf.h
Referenced by FiberModel(), operator<<(), and operator>>().