mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
Namespaces | |
namespace | impl |
namespace | PSDComponent |
Classes | |
class | aoAtmosphere |
A class to specify atmosphere parameters and perform related calculations. More... | |
class | aoSystem |
Describes an analytic adaptive optics (AO) system. More... | |
struct | calculatedWFS |
The calculated WFS uses sensitivities provided by FITS files. More... | |
struct | clAOLinearPredictor |
Class to manage the calculation of linear predictor coefficients for a closed-loop AO system. More... | |
struct | clGainOpt |
A class to manage optimizing closed-loop gains. More... | |
struct | clGainOptOptGain_OL |
Bisection worker struct for finding optimum closed loop gain from open loop PSDs. More... | |
struct | fourierCovariance |
Structure to manage the Fourier mode covariance calculation, passed to integration functions. More... | |
struct | fourierTemporalPSD |
Class to manage the calculation of temporal PSDs of the Fourier modes in atmospheric turbulence. More... | |
struct | pywfsModAsymptotic |
The asymptotic modulated pyramid wavefront sensor sensitivity function. More... | |
struct | pywfsUnmod |
The unmodulated pyramid wavefront sensor sensitivity function. More... | |
struct | shwfs |
The shack hartmann wavefront sensor sensitivity function. More... | |
struct | vonKarmanSpectrum |
Manage calculations using the von Karman spatial power spectrum. More... | |
struct | wfs |
The ideal wavefront sensor sensitivity function. More... | |
struct | zernikeCovariance |
Structure to manage the zernike mode covariance calculation, passed to integration functions. More... | |
struct | zernikeTemporalPSD |
Class to manage the calculation of temporal PSDs of the Fourier modes in atmospheric turbulence. More... | |
Enumerations | |
enum | basis : unsigned int { basic , modified } |
Functions | |
template<typename realT > | |
realT | maxStableGain (const realT &ll, const realT &ul) |
template<typename realT , typename aosysT > | |
realT | phiInt_basic (realT phi, void *params) |
Worker for the azimuthal integral (in phi) for the basic Fourier mode covariance. | |
template<typename realT , typename aosysT > | |
realT | phiInt_mod (realT phi, void *params) |
Worker for the azimuthal integral (in phi) for the modified Fourier mode covariance. | |
template<typename realT , typename aosysT > | |
realT | kInt (realT k, void *params) |
Worker function for the radial integral in the covariance calculation. | |
template<typename realT , typename aosysT > | |
int | fourierVarVec (const std::string &fname, int N, aosysT &aosys, realT absTol, realT relTol, bool modifed=true) |
Calculate a vector of Fourier mode variances. | |
template<typename realT , typename aosysT > | |
int | fourierPSDMap (improc::eigenImage< realT > &var, improc::eigenImage< realT > &psd, int N, int overSample, aosysT &aosys) |
Calculate a map of Fourier variances by convolution with the PSD. | |
template<typename realT > | |
int | fourierCovarMap (const std::string &fname, int N, realT D, realT L_0, bool subPist, bool subTilt, realT absTol, realT relTol, bool modified=true) |
template<typename realT , typename aosysT > | |
int | fourierCovarMapSeparated (const std::string &fname, int N, aosysT &aosys, realT absTol, realT relTol, bool modified=true) |
template<typename realT > | |
void | calcKLCoeffs (const std::string &outFile, const std::string &cvFile) |
template<typename eigenArrT1 , typename eigenArrT2 , typename eigenArrT3 > | |
void | makeKL (eigenArrT1 &kl, eigenArrT2 &evecs, eigenArrT3 &&rvecs) |
template<typename realT > | |
void | makeFKL (const std::string &outFile, const std::string &coeffs, int N, int pupSize) |
template<typename realT , typename aosysT > | |
realT | F_basic (realT kv, void *params) |
Worker function for GSL Integration for the basic sin/cos Fourier modes. | |
template<typename realT , typename aosysT > | |
realT | F_mod (realT kv, void *params) |
Worker function for GSL Integration for the modified Fourier modes. | |
template<typename realT > | |
void | turbBoilCubic (realT &a, realT &b, realT &c, realT &d, const realT &kv, const realT &f, const realT &Vu, const realT &f0, int pm) |
template<typename realT > | |
int | jincFuncs (realT &Jp, realT &Jm, int mpos, int npos, int mmode, int nmode) |
The +/- Jinc functions for analyzing contrast. | |
template<typename realT > | |
int | speckleAmpPSD (std::vector< realT > &spFreq, std::vector< realT > &spPSD, const std::vector< realT > &freq, const std::vector< realT > &fmPSD, const std::vector< std::complex< realT > > &fmXferFxn, const std::vector< realT > &nPSD, const std::vector< std::complex< realT > > &nXferFxn, int N, std::vector< realT > *vars=nullptr, std::vector< realT > *bins=nullptr, bool noPSD=false) |
Calculate the PSD of the speckle intensity given the PSD of Fourier mode amplitude. | |
template<typename realT > | |
int | speckleAmpVarMean (std::vector< realT > &vars, std::vector< realT > &bins, std::vector< realT > &freq, std::vector< realT > &fmPSD, std::vector< std::complex< realT > > &fmXferFxn, std::vector< realT > &nPSD, std::vector< std::complex< realT > > &nXferFxn, int N) |
Calculate the variance of the mean vs bin size in a speckle time-series. | |
template<typename imageT > | |
void | varmapToImage (imageT &im, imageT &varmap, imageT &psf) |
Convert a wavefront variance map to an intensity image by convolving with the PSF. | |
template<typename realT > | |
void | wfsNoisePSD (std::vector< realT > &PSD, realT beta_p_k, realT Fg, realT tau, realT npx, realT Fb, realT ron) |
Populate a vector with the PSD of measurement noise given WFS parameters. | |
template<typename realT , typename aosysT > | |
realT | F_zernike (realT kv, void *params) |
Worker function for GSL Integration for the Zernike modes. | |
enum mx::AO::analysis::basis : unsigned int |
Enumerator | |
---|---|
basic | The basic sine and cosine Fourier modes. |
modified | The modified Fourier basis from [males_guyon_2017]. |
Definition at line 81 of file fourierTemporalPSD.hpp.
void mx::AO::analysis::calcKLCoeffs | ( | const std::string & | outFile, |
const std::string & | cvFile | ||
) |
Definition at line 633 of file fourierCovariance.hpp.
References mx::sys::get_curr_time(), mx::fits::fitsFile< dataT >::read(), mx::math::six_fifths(), and mx::fits::fitsFile< dataT >::write().
int mx::AO::analysis::fourierCovarMap | ( | const std::string & | fname, |
int | N, | ||
realT | D, | ||
realT | L_0, | ||
bool | subPist, | ||
bool | subTilt, | ||
realT | absTol, | ||
realT | relTol, | ||
bool | modified = true |
||
) |
[out] | fname | the path where the output FITS file will be written |
[in] | N | the linear number of Fourier modes across the aperture. The Nyquist frequency is set by N/2. |
Definition at line 463 of file fourierCovariance.hpp.
References mx::AO::analysis::fourierCovariance< realT, aosysT >::absTol, mx::AO::analysis::fourierCovariance< realT, aosysT >::aosys, mx::fits::fitsHeader::append(), mx::AO::analysis::aoSystem< _realT, _inputSpectT, iosT >::atm, mx::AO::analysis::aoSystem< _realT, _inputSpectT, iosT >::D(), mx::error, mx::AO::analysis::fourierCovariance< realT, aosysT >::getVariance(), mx::ipc::ompLoopWatcher< _outputT, _printPretty, _printLoops, _printPercent, _printNLine, _time >::incrementAndOutputStatus(), mx::AO::analysis::aoAtmosphere< _realT >::L_0(), mx::AO::analysis::aoSystem< _realT, _inputSpectT, iosT >::loadMagAOX(), mx::AO::analysis::fourierCovariance< realT, aosysT >::m, mx::sigproc::makeFourierModeFreqs_Rect(), modified, mx::AO::analysis::fourierCovariance< realT, aosysT >::mp, mx::mxlib_comp_current_sha1(), mx::mxlib_comp_repo_modified(), mx::AO::analysis::fourierCovariance< realT, aosysT >::n, mx::AO::analysis::fourierCovariance< realT, aosysT >::np, mx::AO::analysis::fourierCovariance< realT, aosysT >::p, mx::AO::analysis::fourierCovariance< realT, aosysT >::pp, mx::AO::analysis::aoSystem< _realT, _inputSpectT, iosT >::psd, mx::AO::analysis::aoAtmosphere< _realT >::r_0(), mx::AO::analysis::fourierCovariance< realT, aosysT >::relTol, mx::AO::analysis::fourierCovariance< realT, aosysT >::useBasic, and mx::fits::fitsFile< dataT >::write().
int mx::AO::analysis::fourierCovarMapSeparated | ( | const std::string & | fname, |
int | N, | ||
aosysT & | aosys, | ||
realT | absTol, | ||
realT | relTol, | ||
bool | modified = true |
||
) |
Definition at line 549 of file fourierCovariance.hpp.
References mx::AO::analysis::fourierCovariance< realT, aosysT >::absTol, mx::AO::analysis::fourierCovariance< realT, aosysT >::aosys, mx::fits::fitsHeader::append(), mx::error, mx::AO::analysis::fourierCovariance< realT, aosysT >::getVariance(), mx::ipc::ompLoopWatcher< _outputT, _printPretty, _printLoops, _printPercent, _printNLine, _time >::incrementAndOutputStatus(), mx::AO::analysis::fourierCovariance< realT, aosysT >::m, mx::sigproc::makeFourierModeFreqs_Rect(), mx::AO::analysis::fourierCovariance< realT, aosysT >::mnCon, modified, mx::AO::analysis::fourierCovariance< realT, aosysT >::mp, mx::mxlib_comp_current_sha1(), mx::mxlib_comp_repo_modified(), mx::AO::analysis::fourierCovariance< realT, aosysT >::n, mx::AO::analysis::fourierCovariance< realT, aosysT >::np, mx::AO::analysis::fourierCovariance< realT, aosysT >::p, mx::AO::analysis::fourierCovariance< realT, aosysT >::pp, mx::AO::analysis::fourierCovariance< realT, aosysT >::relTol, mx::AO::analysis::fourierCovariance< realT, aosysT >::useBasic, and mx::fits::fitsFile< dataT >::write().
int mx::AO::analysis::fourierPSDMap | ( | improc::eigenImage< realT > & | var, |
improc::eigenImage< realT > & | psd, | ||
int | N, | ||
int | overSample, | ||
aosysT & | aosys | ||
) |
Calculate a map of Fourier variances by convolution with the PSD.
Uses the Airy pattern for the circularly unobstructed aperture.
[out] | var | The variance estimated by convolution with the PSD |
[out] | psd | the PSD map |
[in] | N | the number of components to analyze |
aosys | [in[ the AO system defining the PSD characteristics. |
Definition at line 405 of file fourierCovariance.hpp.
References mx::math::func::airyPattern(), mx::math::six_fifths(), and varmapToImage().
int mx::AO::analysis::fourierVarVec | ( | const std::string & | fname, |
int | N, | ||
aosysT & | aosys, | ||
realT | absTol, | ||
realT | relTol, | ||
bool | modifed = true |
||
) |
Calculate a vector of Fourier mode variances.
Definition at line 321 of file fourierCovariance.hpp.
References mx::AO::analysis::fourierCovariance< realT, aosysT >::absTol, mx::AO::analysis::fourierCovariance< realT, aosysT >::aosys, mx::error, mx::AO::analysis::fourierCovariance< realT, aosysT >::getVariance(), mx::ipc::ompLoopWatcher< _outputT, _printPretty, _printLoops, _printPercent, _printNLine, _time >::incrementAndOutputStatus(), mx::AO::analysis::fourierCovariance< realT, aosysT >::m, mx::AO::analysis::fourierCovariance< realT, aosysT >::mnCon, mx::AO::analysis::fourierCovariance< realT, aosysT >::mp, mx::AO::analysis::fourierCovariance< realT, aosysT >::n, mx::AO::analysis::fourierCovariance< realT, aosysT >::np, mx::AO::analysis::fourierCovariance< realT, aosysT >::p, mx::AO::analysis::fourierCovariance< realT, aosysT >::pp, mx::AO::analysis::fourierCovariance< realT, aosysT >::relTol, and mx::math::six_fifths().
int mx::AO::analysis::jincFuncs | ( | realT & | Jp, |
realT & | Jm, | ||
int | mpos, | ||
int | npos, | ||
int | mmode, | ||
int | nmode | ||
) |
The +/- Jinc functions for analyzing contrast.
See Males and Guyon
[out] | Jp | |
[out] | Jm | |
[in] | mpos | |
[in] | npos | |
[in] | mmode | |
[in] | nmode |
Definition at line 26 of file jincFuncs.hpp.
References mx::math::func::jinc(), and mx::math::six_fifths().
Worker function for the radial integral in the covariance calculation.
k | the spatial frequency at which to evaluate the integrand |
params | a pointer to a object of type fourierCovariance<realT, aosyT> |
realT | a floating point type used for all calculations. As of Nov 2016 must be double due to gsl_integration. |
aosysT | the type of the AO system structure |
Definition at line 205 of file fourierCovariance.hpp.
References mx::error, mx::AO::analysis::fourierCovariance< realT, aosysT >::k, mx::AO::analysis::fourierCovariance< realT, aosysT >::phi_w, mx::math::two_pi< double >(), mx::AO::analysis::fourierCovariance< realT, aosysT >::useBasic, and WSZ.
void mx::AO::analysis::makeFKL | ( | const std::string & | outFile, |
const std::string & | coeffs, | ||
int | N, | ||
int | pupSize | ||
) |
Definition at line 702 of file fourierCovariance.hpp.
References mx::improc::eigenCube< dataT >::cols(), mx::improc::eigenCube< dataT >::cube(), mx::improc::eigenCube< dataT >::image(), mx::sigproc::makeFourierBasis_Rect(), makeKL(), MX_FOURIER_MODIFIED, mx::improc::eigenCube< dataT >::planes(), mx::fits::fitsFile< dataT >::read(), mx::improc::eigenCube< dataT >::resize(), mx::improc::eigenCube< dataT >::rows(), and mx::fits::fitsFile< dataT >::write().
void mx::AO::analysis::makeKL | ( | eigenArrT1 & | kl, |
eigenArrT2 & | evecs, | ||
eigenArrT3 && | rvecs | ||
) |
Definition at line 673 of file fourierCovariance.hpp.
References mx::math::six_fifths().
Referenced by makeFKL().
realT mx::AO::analysis::maxStableGain | ( | const realT & | ll, |
const realT & | ul | ||
) |
Definition at line 1029 of file clGainOpt.hpp.
References maxStableGain().
Referenced by mx::AO::analysis::clGainOpt< _realT >::maxStableGain(), maxStableGain(), and mx::AO::analysis::clGainOpt< _realT >::optGainOpenLoop().
realT mx::AO::analysis::phiInt_mod | ( | realT | phi, |
void * | params | ||
) |
Worker for the azimuthal integral (in phi) for the modified Fourier mode covariance.
phi | the angle at which to evaluate the integrand |
params | a pointer to a object of type fourierCovariance<realT, aosyT> |
realT | a floating point type used for all calculations |
aosysT | the type of the AO system structure |
Definition at line 127 of file fourierCovariance.hpp.
References mx::AO::analysis::fourierCovariance< realT, aosysT >::aosys, mx::math::func::jinc(), mx::AO::analysis::fourierCovariance< realT, aosysT >::k, mx::AO::analysis::fourierCovariance< realT, aosysT >::m, mx::AO::analysis::fourierCovariance< realT, aosysT >::mnCon, mx::AO::analysis::fourierCovariance< realT, aosysT >::mp, mx::AO::analysis::fourierCovariance< realT, aosysT >::n, mx::AO::analysis::fourierCovariance< realT, aosysT >::np, mx::AO::analysis::fourierCovariance< realT, aosysT >::p, mx::AO::analysis::fourierCovariance< realT, aosysT >::pp, and mx::math::six_fifths().
int mx::AO::analysis::speckleAmpPSD | ( | std::vector< realT > & | spFreq, |
std::vector< realT > & | spPSD, | ||
const std::vector< realT > & | freq, | ||
const std::vector< realT > & | fmPSD, | ||
const std::vector< std::complex< realT > > & | fmXferFxn, | ||
const std::vector< realT > & | nPSD, | ||
const std::vector< std::complex< realT > > & | nXferFxn, | ||
int | N, | ||
std::vector< realT > * | vars = nullptr , |
||
std::vector< realT > * | bins = nullptr , |
||
bool | noPSD = false |
||
) |
Calculate the PSD of the speckle intensity given the PSD of Fourier mode amplitude.
Does so by generating a time-series from the PSD using Fourier-domain convolution, and calculating the average periodogram.
A Hann window is used.
Statistics are not currently normalized. You need to normalize to match expected contrast if desired.
Will also calculate the binned-variances in the generated time-series, if the arguments vars and bins are not null pointers.
Figure out what's going on with psdFilter normalization!
probably need to not do overlapped averaging in periodogram. Could drop mean-sub then.
[out] | spFreq | The frequency grid of the output PSD |
[out] | spPSD | The speckle amplitude PSD corresponding to the freq coordinates. Will be resized. |
[in] | freq | The Frequency grid of the input PSD |
[in] | fmPSD | The Fourier mode PSD. |
[in] | fmXferFxn | The complex error transfer function, as a function of freq |
[in] | nPSD | The open-loop noise PSD |
[in] | nXferFxn | The noise transfer function, as a function of freq |
[in] | N | The number of trials to use in calculating the amplitude PSD. |
[out] | vars | [optional] The binned variances of the time series generated. |
[in] | bins | [optional] The bin sizes to use in calculating vars. |
[in] | noPSD | [optional] if true then the PSD is not actually calculated, only the binned variances |
Definition at line 50 of file speckleAmpPSD.hpp.
References mx::sigproc::augment1SidedPSD(), mx::math::ft::backward, mx::sigproc::window::hann(), mx::sigproc::psdVar(), mx::sigproc::averagePeriodogram< realT >::resize(), mx::math::randomT< typeT, _ranengT, _randistT >::seed(), mx::math::six_fifths(), mx::sigproc::averagePeriodogram< realT >::size(), mx::math::vectorBinMeans(), mx::math::vectorMeanSub(), mx::math::vectorVariance(), and mx::sigproc::averagePeriodogram< realT >::win().
Referenced by mx::AO::analysis::fourierTemporalPSD< _realT, aosysT >::analyzePSDGrid(), and speckleAmpVarMean().
int mx::AO::analysis::speckleAmpVarMean | ( | std::vector< realT > & | vars, |
std::vector< realT > & | bins, | ||
std::vector< realT > & | freq, | ||
std::vector< realT > & | fmPSD, | ||
std::vector< std::complex< realT > > & | fmXferFxn, | ||
std::vector< realT > & | nPSD, | ||
std::vector< std::complex< realT > > & | nXferFxn, | ||
int | N | ||
) |
Calculate the variance of the mean vs bin size in a speckle time-series.
Does so by generating a time-series from the PSD using Fourier-domain convolution, then calculates the binned-variances in the generated time-series.
This is just a wrapper for speckleAmpPSD, with no actual PSD calculation.
[out] | vars | The binned variances of the time series generated. |
[in] | bins | The bin sizes to use to calculate the variances. |
[in] | freq | The Frequency grid of the input PSD |
[in] | fmPSD | The open-loop Fourier mode PSD. |
[in] | fmXferFxn | The complex error transfer function, as a function of freq |
[in] | nPSD | The open-loop noise PSD |
[in] | nXferFxn | The noise transfer function, as a function of freq |
[in] | N | The number of trials to use in calculating the amplitude time-series. |
Definition at line 277 of file speckleAmpPSD.hpp.
References speckleAmpPSD().