this class encapsulates all the knowledge about the geometric distortion pattern of the VIRUS spectrograph. it maps (wavelength, fiber) <-> (x_ccd,y_ccd). it contains routines to fit a solution and to access the solution and its inverse.
Together with FiberModel
and PsfModel
, this forms a complete model of the VIRUS spectrograph.
typedef double Distortion::coeff_t |
Distortion::Distortion | ( | ) |
References fiber_errors_, fiber_par_, fit_niter_, fy_errors_, fy_par_, reference_wavelength_, wave_errors_, wave_par_, x_par_, y_errors_, and y_par_.
Distortion::Distortion | ( | const std::string & | filename | ) |
References init_from_file().
Distortion::Distortion | ( | const Distortion & | other | ) |
References F_, fiber_errors_, fiber_par_, fit_niter_, fy_errors_, fy_par_, reference_f_, reference_w_, reference_wavelength_, wave_errors_, wave_offsets_, wave_par_, x_errors_, x_offsets_, x_par_, y_errors_, and y_par_.
virtual Distortion::~Distortion | ( | ) | [inline, virtual] |
void Distortion::init_from_file | ( | const std::string & | filename | ) |
References fit_niter_.
Referenced by Distortion(), ImStat::ImStat(), main(), plot_data(), and VFrame::read_distortions().
void Distortion::set_niter | ( | const int | i = 1 |
) | [inline] |
References fit_niter_.
Referenced by fit_initial_dist(), and main().
void Distortion::set_reference | ( | const MArray< float, 1 > & | w, | |
const MArray< float, 1 > & | f, | |||
const float | wave | |||
) |
set reference w,f for each fiber for a given single wavelength (for high order offsets from the smooth solution)
References reference_f_, reference_w_, reference_wavelength_, wave_offsets_, and x_offsets_.
Referenced by fit_initial_dist(), and main().
void Distortion::set_reference_f | ( | const MArray< float, 1 > & | f | ) |
References reference_f_.
Referenced by main(), and refit_models().
void Distortion::calculate_offsets | ( | const MArray< DistDataTuple, 2 > & | D | ) |
References _scalf_, _scalw_, _scalx_, _scaly_, c, F_, wave_offsets_, wave_par_, x_offsets_, and x_par_.
Referenced by fit_with_arc().
void Distortion::apply_offsets | ( | MArray< DistDataTuple, 2 > & | D | ) |
References wave_offsets_, and x_offsets_.
Referenced by fit_with_arc().
float Distortion::get_reference_f | ( | int | fibernum | ) | const [inline] |
get the y coordinate on the CCD of the peak of fiber fibernum at the reference wavelength
this number is also the value the distortion solution has at each point along the peak intensity of this fiber
References reference_f_.
Referenced by FiberIterator::beginFiber(), Extractor::extract_aperture(), Extractor::extract_aperture_ac(), Extractor::extract_aperture_x(), Extractor::extract_aperture_x_ac(), Extractor::extract_fiber(), ProfExtractor::extract_profile_fit(), Projector::find_affected_pixels(), fit_with_trace(), FiberModel::flat_from_data(), Continuum::get_continua(), FiberModel::get_fit_parameters(), FiberModel::get_single_fiberflux(), FiberModel::get_single_fiberprofile(), Continuum::get_sn_fiber(), Extractor::get_wavelengths(), main(), ImStat::make_hist(), Measure::measure_at_ref_w(), Measure::measure_fiberpars(), FiberModel::pixelflat(), plot_fibermodel(), Projector::read_fibers(), ProfExtractor::rebin_wavelength(), refit_models(), Measure::remove_spectra(), Measure::remove_spectra_ind(), SuperSky::sample_sky_for_line(), SuperSky::SuperSky(), VirusHealth::validate_peaks(), and write_fiber_data().
float Distortion::get_reference_wavelength | ( | ) | const [inline] |
References reference_wavelength_.
Referenced by Measure::measure_at_ref_w().
MArray< float, 1 > Distortion::get_reference_f | ( | ) | const |
References reference_f_.
MArray< float, 1 > Distortion::get_reference_w | ( | ) | const |
References reference_w_.
void Distortion::get_wavelength_boundaries | ( | int | px, | |
int | py, | |||
float * | wl, | |||
float * | wu | |||
) | const |
References map_xy_wavelength().
Referenced by PointSourceDetector::equivalent_width().
void Distortion::get_fiber_boundaries | ( | int | px, | |
int | py, | |||
float * | fl, | |||
float * | fu | |||
) | const |
References map_xy_fiber().
void Distortion::get_pixel_boundaries | ( | int | px, | |
int | py, | |||
float * | wl, | |||
float * | wu, | |||
float * | fl, | |||
float * | fu | |||
) | const |
References map_xy_fiber(), and map_xy_wavelength().
int Distortion::get_numfibers | ( | ) | const [inline] |
References reference_f_.
Referenced by ProfExtractor::extract_profile_fit(), Measure::fit_fiberthroughput(), FiberModel::get_cumulative_fiberflux(), main(), measure_5577_flux(), Measure::measure_at_ref_w(), Measure::measure_fiberpars(), plot_fibermodel(), plot_fibermodel_data(), refit_models(), Measure::scale_fiberthroughput(), and VirusHealth::validate_peaks().
float Distortion::get_position_angle | ( | const float | w, | |
const float | f | |||
) | const |
return the position angle (the direction along a fiber) at postion {w,f}. the angle is returned in degrees counterclockwise
References map_wf_x(), and map_wf_y().
Referenced by Measure::fit_psf2D(), and PsfModel::get_psf().
TPar Distortion::get_w_coefficients | ( | void | ) | const [inline] |
get arrays of coefficients
References wave_par_.
TPar Distortion::get_f_coefficients | ( | void | ) | const [inline] |
References fiber_par_.
float Distortion::map_xy_wavelength | ( | float | x, | |
float | y | |||
) | const |
References _scalx_, _scaly_, F_, find_closest_index(), map_xy_fiber(), reference_f_, reference_wavelength_, wave_offsets_, and wave_par_.
Referenced by Extractor::extract_aperture(), Extractor::extract_aperture_w_rebin(), Extractor::extract_fiber(), extract_fibers_in_aperture(), Measure::fit_psf1D(), Measure::fit_psf2D(), fit_with_trace(), get_pixel_boundaries(), PsfModel::get_psf(), get_wavelength_boundaries(), Extractor::get_wavelengths(), FiberModel::get_xy_amplitude(), main(), map_forward_x(), mask_wavelength(), DitherEnvironment::mask_wavelength(), Measure::measure_fiberpars(), mkimage(), mkimage_list(), plot_distortion(), plot_fibermodel(), ProfExtractor::rebin_wavelength(), Measure::rectify_to_wf(), Measure::remove_spectra(), Measure::remove_spectra_ind(), DitherEnvironment::setup_grid_limits(), FiberIterator::w(), write_fits_map(), write_qc_files(), and write_reference_files().
float Distortion::map_xy_fiber | ( | float | x, | |
float | y | |||
) | const |
References _scalx_, _scaly_, F_, and fiber_par_.
Referenced by FiberIterator::f(), fit_distortion(), Measure::fit_psf1D(), Measure::fit_psf2D(), fit_with_trace(), Continuum::get_continua(), get_fiber_boundaries(), get_pixel_boundaries(), PsfModel::get_psf(), map_forward_y(), map_xy_fibernum(), map_xy_wavelength(), plot_distortion(), write_fits_map(), write_qc_files(), and write_reference_files().
float Distortion::map_xf_y | ( | float | x, | |
float | f | |||
) | const |
References _scalf_, _scalx_, F_, and fy_par_.
Referenced by FiberIterator::beginFiber(), ProfExtractor::extract_profile_fit(), Measure::fit_peaks3H_initial(), Measure::fit_psf1D(), FiberModel::flat_from_data(), FiberModel::get_fit_parameters(), FiberModel::get_single_fiberflux(), FiberModel::get_single_fiberprofile(), main(), ImStat::make_hist(), Measure::measure_fiberpars(), FiberModel::pixelflat(), plot_fibermodel(), Measure::remove_spectra(), Measure::remove_spectra_ind(), write_fiber_data(), and write_qc_files().
float Distortion::map_wf_x | ( | float | w, | |
float | f | |||
) | const |
References _scalf_, _scalw_, F_, find_closest_index(), reference_f_, reference_wavelength_, x_offsets_, and x_par_.
Referenced by Extractor::extract_aperture_w_rebin(), Projector::find_affected_pixels(), Measure::fit_peaks3H_initial(), Measure::fit_psf1D(), get_position_angle(), main(), map_inverse_x(), mask_wavelength(), DitherEnvironment::mask_wavelength(), Measure::measure_at_ref_w(), Measure::measure_fiberpars(), ProfExtractor::rebin_wavelength(), Measure::remove_spectra(), Measure::remove_spectra_ind(), VirusHealth::validate_peaks(), write_qc_files(), and write_reference_files().
float Distortion::map_wf_y | ( | float | w, | |
float | f | |||
) | const |
References _scalf_, _scalw_, F_, and y_par_.
Referenced by Extractor::extract_aperture_w_rebin(), Projector::find_affected_pixels(), Measure::fit_peaks3H_initial(), Measure::fit_psf1D(), get_position_angle(), main(), map_inverse_y(), Measure::measure_at_ref_w(), Measure::measure_fiberpars(), Measure::remove_spectra(), VirusHealth::validate_peaks(), write_qc_files(), and write_reference_files().
float Distortion::map_xy_yprime | ( | float | x, | |
float | y | |||
) | const |
int Distortion::map_xy_fibernum | ( | float | x, | |
float | y | |||
) | const |
References find_closest_index(), map_xy_fiber(), and reference_f_.
Referenced by FiberModel::flat_from_data(), Continuum::get_continua(), FiberModel::get_cumulative_fiberflux(), FiberModel::get_fit_parameters(), Continuum::get_sn_fiber(), FiberModel::get_xy_amplitude(), main(), FiberIterator::operator++(), FiberModel::pixelflat(), Measure::remove_spectra(), Measure::remove_spectra_ind(), SuperSky::sample_sky_for_line(), and Continuum::subtract_continuum().
float Distortion::map_xy_wavelength_fast | ( | float | x, | |
float | y, | |||
float * | dw | |||
) | const |
References _scalx_, _scaly_, F_, fiber_par_, find_closest_index(), reference_f_, wave_offsets_, and wave_par_.
Referenced by SourceSimulator::add_continuum_source_to_images(), add_flux_in_fibers(), SourceSimulator::add_sersic_source_to_images(), SourceSimulator::addSkyToFrame(), PointSourceDetector::make_image_header(), SuperSky::propagate_error(), SuperSky::sample_sky_for_line(), and SuperSky::subtract_sky_from_line().
float Distortion::map_xy_fiber_fast | ( | float | x, | |
float | y, | |||
float * | df | |||
) | const |
References _scalx_, _scaly_, F_, and fiber_par_.
Referenced by SuperSky::propagate_error(), SuperSky::sample_sky_for_line(), and SuperSky::subtract_sky_from_line().
float Distortion::map_forward_x | ( | const float | x, | |
const float | y | |||
) | const [inline] |
interface compatible with resampler transform objects see resmapler.h / transform.h
References map_xy_wavelength().
Referenced by get_forward_J().
float Distortion::map_forward_y | ( | const float | x, | |
const float | y | |||
) | const [inline] |
References map_xy_fiber().
Referenced by get_forward_J().
float Distortion::get_forward_J | ( | const float | x, | |
const float | y, | |||
const float | dx, | |||
const float | dy | |||
) | const |
References map_forward_x(), and map_forward_y().
float Distortion::map_inverse_x | ( | const float | u, | |
const float | v | |||
) | const [inline] |
References map_wf_x().
Referenced by get_inverse_J().
float Distortion::map_inverse_y | ( | const float | u, | |
const float | v | |||
) | const [inline] |
References map_wf_y().
Referenced by get_inverse_J().
float Distortion::get_inverse_J | ( | const float | u, | |
const float | v, | |||
const float | du, | |||
const float | dv | |||
) | const |
References map_inverse_x(), and map_inverse_y().
void Distortion::write_fits_map | ( | const string & | basename, | |
int | x1, | |||
int | x2, | |||
int | y1, | |||
int | y2 | |||
) | const |
References map_xy_fiber(), map_xy_wavelength(), and prepend_filename().
void Distortion::fit_wavelength | ( | MArray< coeff_t, 1 > & | x, | |
MArray< coeff_t, 1 > & | y, | |||
MArray< coeff_t, 1 > & | wavelengths, | |||
MArray< coeff_t, 1 > & | w_errors | |||
) |
References _scalx_, _scaly_, BivariateLinearLsqFit< T, Function >::fit(), fit_niter_, wave_errors_, and wave_par_.
Referenced by fit_with_arc().
void Distortion::fit_fiberpos | ( | MArray< coeff_t, 1 > & | x, | |
MArray< coeff_t, 1 > & | y, | |||
MArray< coeff_t, 1 > & | fiberpos, | |||
MArray< coeff_t, 1 > & | f_errors | |||
) |
References _scalx_, _scaly_, fiber_errors_, fiber_par_, BivariateLinearLsqFit< T, Function >::fit(), and fit_niter_.
Referenced by fit_distortion(), fit_with_arc(), and fit_with_trace().
void Distortion::fit_x | ( | MArray< coeff_t, 1 > & | w, | |
MArray< coeff_t, 1 > & | f, | |||
MArray< coeff_t, 1 > & | x, | |||
MArray< coeff_t, 1 > & | x_errors | |||
) |
References _scalf_, _scalw_, BivariateLinearLsqFit< T, Function >::fit(), fit_niter_, x_errors_, and x_par_.
Referenced by fit_distortion(), fit_with_arc(), and fit_with_trace().
void Distortion::fit_y | ( | MArray< coeff_t, 1 > & | w, | |
MArray< coeff_t, 1 > & | f, | |||
MArray< coeff_t, 1 > & | y, | |||
MArray< coeff_t, 1 > & | y_errors | |||
) |
References _scalf_, _scalw_, BivariateLinearLsqFit< T, Function >::fit(), fit_niter_, y_errors_, and y_par_.
Referenced by fit_distortion(), fit_with_arc(), and fit_with_trace().
void Distortion::fit_fy | ( | MArray< coeff_t, 1 > & | x, | |
MArray< coeff_t, 1 > & | f, | |||
MArray< coeff_t, 1 > & | y, | |||
MArray< coeff_t, 1 > & | y_errors | |||
) |
References _scalf_, _scalx_, BivariateLinearLsqFit< T, Function >::fit(), fit_niter_, fy_errors_, and fy_par_.
Referenced by fit_distortion(), and fit_with_trace().
void Distortion::fit_yprime | ( | MArray< coeff_t, 1 > & | x, | |
MArray< coeff_t, 1 > & | y, | |||
MArray< coeff_t, 1 > & | yprime, | |||
MArray< coeff_t, 1 > & | yprime_errors | |||
) |
void Distortion::print_w_coefficients | ( | ) |
References Cheby2D_7< coeff_t, coeff_t >::prettyPrint(), and wave_par_.
void Distortion::print_f_coefficients | ( | ) |
References fiber_par_, and Cheby2D_7< coeff_t, coeff_t >::prettyPrint().
void Distortion::print_x_coefficients | ( | ) |
References Cheby2D_7< coeff_t, coeff_t >::prettyPrint(), and x_par_.
void Distortion::print_y_coefficients | ( | ) |
References Cheby2D_7< coeff_t, coeff_t >::prettyPrint(), and y_par_.
void Distortion::print_fy_coefficients | ( | ) |
References fy_par_, and Cheby2D_7< coeff_t, coeff_t >::prettyPrint().
void Distortion::print_yprime_coefficients | ( | ) |
std::ostream& operator<< | ( | std::ostream & | os, | |
const Distortion & | d | |||
) | [friend] |
std::istream& operator>> | ( | std::istream & | is, | |
Distortion & | d | |||
) | [friend] |
string Distortion::version = "$Id: distortion.cpp 1075 2015-10-17 18:44:29Z snigula $" [static] |
Referenced by main().
DistortionPattern Distortion::F_ [protected] |
Referenced by calculate_offsets(), Distortion(), map_wf_x(), map_wf_y(), map_xf_y(), map_xy_fiber(), map_xy_fiber_fast(), map_xy_wavelength(), and map_xy_wavelength_fast().
TPar Distortion::wave_par_ [protected] |
TPar Distortion::wave_errors_ [protected] |
Referenced by Distortion(), fit_wavelength(), operator<<(), and operator>>().
TPar Distortion::fiber_par_ [protected] |
TPar Distortion::fiber_errors_ [protected] |
Referenced by Distortion(), fit_fiberpos(), operator<<(), and operator>>().
MArray<float,1> Distortion::reference_w_ [protected] |
Referenced by Distortion(), get_reference_w(), operator<<(), operator>>(), and set_reference().
MArray<float,1> Distortion::reference_f_ [protected] |
float Distortion::reference_wavelength_ [protected] |
Referenced by Distortion(), get_reference_wavelength(), map_wf_x(), map_xy_wavelength(), operator<<(), operator>>(), and set_reference().
TPar Distortion::x_par_ [protected] |
Referenced by calculate_offsets(), Distortion(), fit_x(), get_x_coefficients(), map_wf_x(), operator<<(), operator>>(), and print_x_coefficients().
TPar Distortion::x_errors_ [protected] |
Referenced by Distortion(), fit_x(), operator<<(), and operator>>().
TPar Distortion::y_par_ [protected] |
Referenced by Distortion(), fit_y(), get_y_coefficients(), map_wf_y(), operator<<(), operator>>(), and print_y_coefficients().
TPar Distortion::y_errors_ [protected] |
Referenced by Distortion(), fit_y(), operator<<(), and operator>>().
TPar Distortion::fy_par_ [protected] |
Referenced by Distortion(), fit_fy(), get_fy_coefficients(), map_xf_y(), operator<<(), operator>>(), and print_fy_coefficients().
TPar Distortion::fy_errors_ [protected] |
Referenced by Distortion(), fit_fy(), operator<<(), and operator>>().
MArray<float,1> Distortion::x_offsets_ [protected] |
Referenced by apply_offsets(), calculate_offsets(), Distortion(), map_wf_x(), operator<<(), operator>>(), and set_reference().
MArray<float,1> Distortion::wave_offsets_ [protected] |
Referenced by apply_offsets(), calculate_offsets(), Distortion(), map_xy_wavelength(), map_xy_wavelength_fast(), operator<<(), operator>>(), and set_reference().
int Distortion::fit_niter_ [protected] |
Referenced by Distortion(), fit_fiberpos(), fit_fy(), fit_wavelength(), fit_x(), fit_y(), init_from_file(), and set_niter().