Enumerations | |
enum | ordint { FSEE, WSEE, ISP, M2, FHEFF, HEFF, TC, LAST } |
enum | atmwhat { ATMPAR, CN2PROF } |
enum | poweridx { IFSE, IWSE, IISP, IEFF, IISK } |
Functions | |
void | init (int nchan, double diam, double *eps_inn, double *eps_out, double z0, double zmax, double dz, double dzmin, const char *responsefile) |
Initialize the module local structures for calculations. More... | |
int | loadsed (const char *sedfile) |
Load the spectrum from file and check its validity. More... | |
int | checkwf (const char *wfile) |
Check the weight file to fit the currently set system parameters and loaded spectrum. More... | |
void | calcwf (const char *wfile, void(*progress)(int)) |
Calculate the new set of weight functions and write it in the file. More... | |
void | update (const char *wfile, const char *checkfile, double zshift1, double zshift2) |
Update the data structures for atmospheric calculations with a new weight function file. More... | |
void | alloc (int nmeas) |
Allocate the storages for atmospheric integrals calculated by calcint(). More... | |
void | done () |
Deallocate the memory reserved for module structures. More... | |
double | getval (ordint what) |
Return calibrated atmospheric parameter. More... | |
double | geterr (ordint what) |
Return error of the calibrated atmospheric parameter. More... | |
int | getncn2 () |
Return number of the Turbulence profile altitudes. More... | |
double | getzcn2 (int i) |
Get the altitude of the restored turbulence profile layer. More... | |
double | getcn2 (int i) |
Get the strength of the restored turbulence profile layer or chi-square. More... | |
void | calcint (double *scind, double *scinds) |
Compute the atmosphere integral parameters and Cn2-profile. More... | |
double | calcn2 (double *scind, double *scinds, double *e2scind, double *e2scinds, bool isfixed) |
Restore the low-resolution Cn2 profile. More... | |
void | avgint (double desi, double e2desi, double zdist) |
Average Cn2 integrals and compute from them the atmospheric parameters. More... | |
void | write (FILE *f, const char *stamp, atmwhat what, bool header=false) |
Write computed atmospheric parameters or restored Cn2 profile or the header line for one of them. More... | |
double | getavgint (int i) |
Get the average integral value. More... | |
double | geter2int (int i) |
Get the squared error of the average integral. More... | |
Variables | |
const bool | HEAD = true |
const int | NMODE = 2 |
const double | MINRELW = 1e-4 |
const int | MAXNBASE = 10 |
const char | USESHFT [] = "1100100000" |
const double | POWSEE = 0 |
const double | POWISP = 5/3. |
const double | POWEFF = 1.0 |
const double | POWISK = 2.0 |
const double | HBOUND = 1.0 |
const int | NPOWER = 5 |
const double | KS = 1.73588e+07 |
const double | KP = 0.000756348 |
const double | KT = 0.175 |
const double | DZCN2 = 1 |
const char | INTFMT [][8] |
const char | INTDLM [] = " " |
const char | ALTFMT [] = "%s%2.0f" |
const char | CN2FMT [] = "%s%8.2e" |
|
Writing selector in write(): |
|
Order of atmosphere integrals in their storage matrix and output file line. In a file, each value is followed by its error. LAST must stay always at the end since it gives a number of integrals in enumeration |
|
Arrangement of the moment decomposition coefficients in the coef[] array: it's essential for calcint() that IWSEE goes in advance to IFSEE. |
|
Allocate the storages for atmospheric integrals calculated by calcint().
|
|
Average Cn2 integrals and compute from them the atmospheric parameters.
Then the average integrals are converted into atmospheric parameters - seeing, isoplanatic angle and effective altitude of turbulence. They are available via getval() and - errors - via geterr(). Also, the atmospheric time constant is computed from provided desi and e2desi values. Seeing is computed as ![]() where the zero-moment Mo of the turbulence is: ![]() (integration goes from 0 for whole-atm. seeing and starting from HBOUND for free-atm. seeing) and KS is the calibration constant. Isoplanatic angle is computed as ![]() where the 5/3-th moment of the turbulence profile is: ![]()
and Second moment of the turbulence is related to the differential astrometry precision and the operation of optical interferometers. Unlikely the isoplanatic angle, it is saved in files with no any calibration to any "angle". The free atmosphere effective altitude is computed as ![]() where alpha_1 is 5/3 and alpha_2 is 1. The value of Heff in the whole atmophere is computed by definition: ![]() but only if the shifted indices are available.
The related to adaptive optics atmospheric time constant is computed from Differential Exposure Scintillation Index (DESI)
![]() where KT is the empirical calibration constant.
|
|
Compute the atmosphere integral parameters and Cn2-profile.
The coefficients of multiplication of the indices in normal and shifted mode are already precomputed in init(); the results become accessible after the function call by getval() and geterr(). The atmospheric time constant is computed given the desi parameter. If scind(s) or desi parameters are empty (NULL or 0, respectively), the calculations for supplied not-NULL parameters are only made. The computed quantities are saved in the current ine of the global storage for further averaging by avgint(). The number of calls to calcint() should not exceed the nmeas parameter of alloc(). Performance One calculation of integrals takes 5 ms at PC P-III 667 Mhz. |
|
Restore the low-resolution Cn2 profile.
Performance One restoration takes typically 45 ms at PC P-III 667 Mhz for the method with 6 fixed layers, and 140 ms for placing 4 floating altitude layers. |
|
Calculate the new set of weight functions and write it in the file.
The grid parameters depend on the result of checkfile(). If the checking resulted in error sc::ERZGR (user-supplied grid in init() does not fit the file grid), the weights are calculated with user's grid, otherwise - with the "optimal" grid. Optimal grid parameters are specified in WEIF module - wf::Z0, wf::ZMAX, wf::DZ and wf::DZMIN. |
|
Check the weight file to fit the currently set system parameters and loaded spectrum.
|
|
Deallocate the memory reserved for module structures.
|
|
Get the average integral value.
|
|
Get the strength of the restored turbulence profile layer or chi-square.
|
|
Get the squared error of the average integral.
|
|
Return error of the calibrated atmospheric parameter.
|
|
Return number of the Turbulence profile altitudes.
|
|
Return calibrated atmospheric parameter.
|
|
Get the altitude of the restored turbulence profile layer.
|
|
Initialize the module local structures for calculations.
First, the global structures are initialized, including the normal and shifted weight functions sets. Then the weight-related instrumental parameters are initialized. Finally, the system transmission function is read from the file. The wavelengths, if different from [mkm], are converted into micrometers automatically.
|
|
Load the spectrum from file and check its validity.
Possible errors (see nr::erget()) include:
|
|
Update the data structures for atmospheric calculations with a new weight function file.
First, if the weight function matrix is new (its lastly loaded filename is stored internally), it is read from the file and all the calculations of the Cn2 moments decomposition are made. Also, the calculations are done if the z-shifts zshift1 and zshift2 have changed. Calculations involve the shift of weights by zshift1 and zshift2 and the approximation of the power-law dependences of altitude by shifted weight functions. The SVD method is used for this. Approximation enable us to represent the Cn2-moments by a set of scintillation indices. If zshift1 or zshift2 are non-zero, then both the coefficients for generalized and non-shifted modes are obtained. The coefficients are stored in global arrays to be used in calcint(). The quality of the approximation of the altitude moments with weight functions may be checked if one supplies the non-null file name checkfile. The utility writes then the decomposition coefficients and the approximated relations in this file. The file checkfile is rewritten each time, not appended, and consists of two similar parts - the first for approximations with zshift1 -shifted weights (normally - non-shifted) and the second for approximation with both zshift1 and zshift2 -shifted weights. |
|
Write computed atmospheric parameters or restored Cn2 profile or the header line for one of them.
For what==ATMPAR, the single line is written on disk, consisting of the average atmospheric parameters each followed by its error. Parameters are free seeing ["], seeing ["], isoplanatic angle ["], second moment of turbulence [m^{4/3}], and atmospheric time constant [ms]. For what==CN2PROF, the Cn2-profile data line is written. It consists of 1) the number of adjusted Cn2 layers, 2) Chi-square 3) the getncn2() altitudes of layers and each followed by it strength in [m^-2/3]. If header==true, the header line for respective what -selection is written instead of data. stamp must then contain the name of data which are normally written as a stamp when header==false. |
|
Altitude of layers record format with leading "%s" for a delimiter |
|
Profile values format with leading "%s" for a delimiter |
|
Cn2-profile restoration weight matrix spacing: 1km (integer-like!) |
|
Height of the boundary layer [kilometers] to fit the Cn2-integral for free seeing (h^0 in integral is forced to resemble the AB-pair weight function below this height) |
|
Last (defaulted to "data"==false) parameter in write() |
|
Delimiter of entries in the average data file |
|
Initial value: {"%s%6.3f","%s%6.3f","%s%6.3f","%s%8.2e","%s%5.0f",\ "%s%5.0f","%s%5.2f"} |
|
Calibration constant in isoplanatic angle formula (AstL 45, p.399) |
|
Calibration constant in seeing formula (AstL 45, p.399): |
|
Atmospheric time constant empirical calibration constant for DESI for 1,3ms integrations in diameter=2cm apertures with -1km shift |
|
Maximal number of orthonormal functions to use in h-powers restoration: (to apply after MINRELW based rejection) |
|
Minimal ratio of the singular value to the maximal one |
|
Number of modes: normal and generalized, hense = 2 |
|
Number of power laws to fit: 2 kinds of 0-th, 5/3-th, 1-st, 2-nd |
|
Power of Cn2 moment for Effective altitude |
|
Cn2 second moment power |
|
Power of Cn2 moment for isoplanatic angle |
|
Power of Cn2 moment for seeing |
|
Binary mask for using the shifted weights: "1"="use it". Now we thus use all non-shifted and As, Bs and ABs weights. |