DAS
3.1.6 - 18/09/2017
|
DAS high level functions. More...
#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <direct.h>
#include <time.h>
#include <math.h>
#include <errno.h>
#include "mgui.h"
#include "DAS_Spatram.h"
#include "dcl.h"
#include "dil.h"
#include "bil.h"
#include "DOAS.h"
Go to the source code of this file.
Functions | |
double | AutoR_No_Shutt (void) |
void | AutoR_SetND_Filter (void) |
double | AutoR_TestMeas (int mod, double texpmin, double texpar, float level, float levelinf) |
double | AutoR_With_Shutt () |
double | AutoRange (int mod) |
Calculate the exposure time The optimum exposure time (TExp) is calculated with an initial TExpAR=0.1 s, and assuming the linearity between the CCD signal and the exposure time. If TExp calculated is lower than the minimum TExp allowed (0.02s) (meaning a saturation of the CCD), the appropriate filter is positioned and the procedure is repeated. If with TExpAR the delta(CCD(x,y))=Max(CCD(x,y))-Min(CCD(x,y)) is lower than 2000 counts (meaning very low radiation intensity) TExpAR is increased and the procedure repeated for at least 4 times (Max TExpAR ~ 5 s) More... | |
void | D_Average (int mod) |
Performs averaged measurements . More... | |
void | D_AverageTFix (void) |
NOT Used . More... | |
void | D_BuildH (int mod, int s) |
Build Header of the measurements . . More... | |
int | D_Calibra (void) |
Spectral Calibration Procedure for the spectral calibration with HG lamp. Shift of HG spectral line at 4358.4 on pixel 512. More... | |
void | D_Measure (void) |
void | D_Plot (void) |
ViewPlot callback . More... | |
void | D_Saving (void) |
Saving image. Procedure for saving the CCD Image Used since version 2.1.0. The coiche between binary and ASCII saving mode is obtained with the mode Flag optionini. More... | |
void | DB_DefectPixCorr () |
Apply thew pixel correction. . More... | |
int | DB_GetCCD (int mod) |
Get CCD Image. . More... | |
void | DB_MirrorX (int w) |
double | DB_ScanMaxMin (int w, float *mx, float *mi, int bp) |
Find Max and Min values for the buffer of order w. More... | |
int | Lookfor4358 (void) |
function to scan the wl() array in order to identify the position of the 4358 reference wavelength return value: er = -1 –> value 4358 not encountered er >= 0 –> value 4358 found at er position More... | |
int | LookforWl_X (int x) |
void | MaskCol (int a, int b, int c, int d, int e) |
void | MaskPix (int a, int b, int c, int d, int e, int f) |
void | MaskRow (int a, int b, int c, int d, int e) |
void | RemoveBlindPixels (void) |
void | SaveCalib (int mod) |
void | ShutterOpening (int mod) |
Variables | |
AzimuthSt | AST |
bil | BIL |
config | Cfg |
das | DAS |
DAS structure. More... | |
ccd | DC_CCD |
ptf | DC_HP |
d_geo | DGEO |
geographical coordinates structure More... | |
int | ExeREM |
int | fftprh = 1 |
int | fftsavecal = 1 |
flag | FLAG |
flags structure More... | |
FilterWheelSt | FWS |
Filter Wheel. More... | |
GratingSt | GRS |
Grating. More... | |
hdrsp | HDRSP |
float | maxar |
float | maxtt |
float | minar |
float | mintt |
MirrorSt | MIS |
Mirror. More... | |
NDFilterWheelSt | NDFWS |
ND Filter Wheel. More... | |
paramini | PARAM |
Param.ini. More... | |
int | SaveCnt = 1 |
int | ShuttDelay = 0 |
ZenithSt | ZST |
DAS high level functions.
Definition in file Procedures.c.
double AutoR_No_Shutt | ( | void | ) |
Definition at line 468 of file Procedures.c.
References AutoR_SetND_Filter(), BlindPix, DB_GetCCD(), DB_ScanMaxMin(), DI_Regen(), DIL, das::DOption, ccd::dx, ccd::dy, FDOUBLE, optionini::filtertype, GetDateTime(), img::High, img::IHigh, img::ILow, dil::Img, img::Low, image::Mat, maxar, optionini::maxlvlar, paramini::maxtexp, maxtt, minar, mintt, das::Paramini, Server, TExp, and paramini::VBin.
Referenced by AutoRange().
void AutoR_SetND_Filter | ( | void | ) |
Definition at line 261 of file Procedures.c.
References delay(), das::DOption, paramini::EqType, FDOUBLE, optionini::filtertype, FPLUS, FSIMPLE, GASCODNG3, das::Paramini, FilterWheelSt::Pos, NDFilterWheelSt::Pos, SD_FilterW(), SD_FNTorqueM(), SD_NDFilterW(), SPATRAM2, SPATRAM3, SPATRAMPLUS, wl, and GratingSt::Wl.
Referenced by AutoR_No_Shutt(), and AutoR_With_Shutt().
double AutoR_TestMeas | ( | int | mod, |
double | texpmin, | ||
double | texpar, | ||
float | level, | ||
float | levelinf | ||
) |
Definition at line 334 of file Procedures.c.
References controlpanel::Albl_IE, BlindPix, paramini::ccdWx, gui::ContrPanel, DB_GetCCD(), DB_ScanMaxMin(), DI_Regen(), DIL, ccd::dx, FlagTExp, das::Gui, img::High, img::IHigh, img::ILow, dil::Img, img::Low, image::Mat, MObjectSetText(), das::Paramini, Server, Status(), and TExp.
Referenced by AutoR_With_Shutt().
double AutoR_With_Shutt | ( | ) |
mha!!!!
Definition at line 627 of file Procedures.c.
References AutoR_SetND_Filter(), AutoR_TestMeas(), BlindPix, paramini::ccdWx, DB_GetCCD(), DB_ScanMaxMin(), DI_Regen(), DIL, das::DOption, ccd::dx, paramini::EqType, FDOUBLE, optionini::filtertype, GASCODNG2, GetDateTime(), img::High, img::IHigh, img::ILow, dil::Img, img::Low, image::Mat, maxar, optionini::maxlvlar, paramini::maxtexp, maxtt, minar, mintt, das::Paramini, ROTSHUT, Server, optionini::shuttertype, TExp, TORQUEM, TROPOGAS, and VS25.
Referenced by AutoRange().
double AutoRange | ( | int | mod | ) |
Calculate the exposure time
The optimum exposure time (TExp) is calculated with an initial TExpAR=0.1 s, and assuming the linearity between the CCD signal and the exposure time.
If TExp calculated is lower than the minimum TExp allowed (0.02s) (meaning a saturation of the CCD), the appropriate filter is positioned and the procedure is repeated.
If with TExpAR the delta(CCD(x,y))=Max(CCD(x,y))-Min(CCD(x,y)) is lower than 2000 counts (meaning very low radiation intensity) TExpAR is increased and the procedure repeated for at least 4 times (Max TExpAR ~ 5 s)
mod |
|
Definition at line 899 of file Procedures.c.
References controlpanel::Albl_IE, AutoR_No_Shutt(), AutoR_With_Shutt(), gui::ContrPanel, DB_GetCCD(), DBDEMO, delay(), das::DOption, optionini::emshutter, paramini::EqType, flag::exemode, das::Flag, FlagTExp, GASCODNG1, das::Gui, MObjectSetText(), das::Paramini, MirrorSt::Pos, S_zenetr, ShuttDelay, Status(), TESTSZAMODE, and TExp.
Referenced by D_Average(), D_AverageTFix(), D_Calibra(), D_Measure(), DB_HorComm_CB(), DB_KeyB_CB(), E_AutoRange(), E_ChkExLamp(), E_HgScan(), E_QjScan(), GetDefPix(), and PerformMeas().
void D_Average | ( | int | mod | ) |
Performs averaged measurements
.
mod | = 1 –> perform AutoRanging, = 0 –> DO NOT PERFORM AutoRange |
Definition at line 2655 of file Procedures.c.
References AutoRange(), optionini::avgautor, marconi::AVGmat, optionini::avgmode, BlindPix, DB_GetCCD(), DB_ScanMaxMin(), delay(), DI_Regen(), DIL, das::DOption, HGFlg, img::High, IDX, IDY, img::IHigh, img::ILow, img::Imat, dil::Img, img::Low, das::Marconi, image::Mat, MLoopWhileEvents(), MMessageDialog(), N_AVG, N_RM, QJFlg, Server, ShuttDelay, st, Status(), TExp, and TOTTEXP.
Referenced by DB_HorComm_CB(), DB_KeyB_CB(), and PerformMeas().
void D_AverageTFix | ( | void | ) |
NOT Used
.
Definition at line 2597 of file Procedures.c.
References AutoRange(), marconi::AVGmat, D_Plot(), DB_GetCCD(), DIL, HGFlg, IDX, IDY, img::Imat, dil::Img, das::Marconi, image::Mat, QJFlg, Server, Status(), and TExp.
void D_BuildH | ( | int | mod, |
int | s | ||
) |
Build Header of the measurements .
.
mod |
|
s |
|
Definition at line 63 of file Procedures.c.
References d_geo::alititude, optionini::avgmode, hdrsp::bincomment, hdrsp::binfilpos, hdrsp::binmirpos, hdrsp::ccdnr, marconi::CCDTemp, hdrsp::ccdtemp, hdrsp::ccdtexp, hdrsp::ccdvbin, paramini::ccdWx, hdrsp::ccdwx, paramini::ccdWy, hdrsp::ccdwy, hdrsp::ccdxe, paramini::ccdXoff, hdrsp::ccdxs, hdrsp::ccdye, paramini::ccdYoff, hdrsp::ccdys, hdrsp::comment, img::DATE, hdrsp::DATE, das::DGeo, DIL, das::DOption, hdrsp::dummy1, hdrsp::dummy2, hdrsp::dummy3, hdrsp::dummy4, ccd::dx, ccd::dy, paramini::EqType, FDOUBLE, Fil_Code, Fil_Code8H, Fil_CodeNG, Fil_CodeNG1, Fil_CodeTropo, hdrsp::filpos, optionini::filtertype, FPLUS, GASCODNG1, GASCODNG2, GASCODNG3, GASCODNG4, img::High, dil::Img, hdrsp::imgfmt, hdrsp::imgmax, hdrsp::imgmin, hdrsp::lambda, d_geo::latitude, LIS_, d_geo::longitude, img::Low, das::Marconi, image::Mat, optionini::measmode, Mir_Code, Mir_CodeTropo, hdrsp::mirpos, N_AVG, N_RM, das::Paramini, FilterWheelSt::Pos, NDFilterWheelSt::Pos, MirrorSt::Pos, AzimuthSt::realazpos, ZenithSt::realzenpos, hdrsp::s_alt, hdrsp::s_latitude, hdrsp::s_longitude, d_geo::s_name, hdrsp::s_name, hdrsp::s_sza, S_zenetr, optionini::savingmode, Server, SPATRAM3, TExp, img::TIME, hdrsp::TIME, TMFlg, TROPOGAS, paramini::VBin, wl, and GratingSt::Wl.
Referenced by DB_GetCCD(), and DB_Save().
int D_Calibra | ( | void | ) |
Spectral Calibration
Procedure for the spectral calibration with HG lamp. Shift of HG spectral line at 4358.4 on pixel 512.
Definition at line 2313 of file Procedures.c.
References controlpanel::Albl_LS, AMS1, AutoRange(), BlindPix, gui::ContrPanel, D_Plot(), DB_GetCCD(), DB_StepMotor(), DBDEMO, delay(), DIL, GratingSt::dp, paramini::EqType, flag::exec, flag::exemode, ExeREM, das::Flag, GASCODNG1, GASCODNG2, GASCODNG3, GASCODNG4, das::Gui, HgLamp(), IDX, IDY, img::Imat, dil::Img, controlpanel::LedSM, LookforWl_X(), MANUAL, image::Mat, MMessageDialog(), MObjectSetText(), MPixmapSetImageFile(), das::Paramini, flag::plotW, PRGFILE, SaveCalib(), SD_FilterW(), SD_Grating(), SD_Mirror(), Server, stepm::SM_B, SM_stepr(), SPATRAM2, SPATRAM3, SPATRAMPLUS, Status(), stepm::step, das::StepM, SZAMODE, TESTSZAMODE, TROPOGAS, wl, and GratingSt::Wl.
Referenced by DB_HorComm_CB(), DB_KeyB_CB(), E_Calibra(), and E_HGratCal().
void D_Measure | ( | void | ) |
Definition at line 2504 of file Procedures.c.
References AutoRange(), D_Plot(), D_Saving(), DB_GetCCD(), E_REM(), PrgCnt, Program, SD_FilterW(), SD_Grating(), SD_Mirror(), and TExp.
void D_Plot | ( | void | ) |
ViewPlot callback
.
Definition at line 192 of file Procedures.c.
References ViewPlot().
Referenced by D_AverageTFix(), D_Calibra(), D_Measure(), E_HgScan(), E_Meashor(), E_Meashor2(), E_QjScan(), and PerformMeas().
void D_Saving | ( | void | ) |
Saving image.
Procedure for saving the CCD Image Used since version 2.1.0. The coiche between binary and ASCII saving mode is obtained with the mode Flag optionini.
Definition at line 1369 of file Procedures.c.
References _MAX_PATH, controlpanel::Albl_CS, gui::ContrPanel, d_fileman::DAILYDATADIRECTORY, d_fileman::DATADIRECTORY, DB_Save(), bil::DFILEM, das::DGeo, das::DOption, fftprh, das::Gui, MObjectSetText(), spectrumheader::newdate, spectrumheader::olddate, d_geo::s_name, SaveCnt, SAVECNT, optionini::savingmode, bil::SPH, and Total.
Referenced by D_Measure(), DB_HorComm_CB(), DB_KeyB_CB(), E_Meashor(), E_Meashor2(), E_Save(), GetDefPix(), and PerformMeas().
void DB_DefectPixCorr | ( | void | ) |
Apply thew pixel correction.
.
Choose the buttons to enable/disable. Repaced with DB_KB_ButtonActive();
.
Definition at line 1568 of file Procedures.c.
References CItem, MaskCol(), MaskedCol, MaskedPix, MaskedRow, MaskPix(), MaskRow(), PItem, and RItem.
Referenced by DB_GetCCD(), and E_Dark().
int DB_GetCCD | ( | int | mod | ) |
Get CCD Image.
.
mod |
|
Definition at line 1749 of file Procedures.c.
References img::BHigh, BlindPix, img::BLow, countsopsh, D_BuildH(), optionini::darkremove, optionini::darksource, img::DATE, DB_DefectPixCorr(), DB_MirrorX(), DB_ScanMaxMin(), DBDEMO, DC_GetCCD(), delay(), DI_Regen(), DI_ScanMaxMin(), DI_WriteDigit(), DIL, das::DOption, flag::exemode, das::Flag, GetDateTime(), img::GHigh, img::GLow, img::High, IDX, IDY, img::IHigh, img::ILow, img::Imat, ImatDark, dil::Img, optionini::imgtype, INTIMG, marconi::LblExpD, marconi::LblExpP, img::Low, das::Marconi, image::Mat, MDCreateExpo(), optionini::measmode, optionini::mirrorimg, MLoopWhileEvents(), MShellDestroy(), MShellUnrealize(), optionini::pixcorr, RemoveBlindPixels(), RGBIMG, img::RHigh, img::RLow, optionini::savingmode, Server, ShowDown(), ShuttDelay, st, TESTSZAMODE, TExp, img::TIME, img::type, and XAX.
Referenced by AutoR_No_Shutt(), AutoR_TestMeas(), AutoR_With_Shutt(), AutoRange(), D_Average(), D_AverageTFix(), D_Calibra(), D_Measure(), DB_AskCB(), DB_HorComm_CB(), DB_KeyB_CB(), E_GetCCD(), E_HgScan(), E_Meashor(), E_Meashor2(), E_QjScan(), GetDefPix(), and PerformMeas().
void DB_MirrorX | ( | int | w | ) |
Definition at line 201 of file Procedures.c.
References D_VRange(), DIL, das::DOption, FLTIMG, img::Fmat, image::Idx, image::Idy, img::Imat, dil::Img, image::Mat, optionini::measmode, and img::type.
Referenced by DB_GetCCD().
double DB_ScanMaxMin | ( | int | w, |
float * | mx, | ||
float * | mi, | ||
int | bp | ||
) |
Find Max and Min values for the buffer of order w.
w | = index of the image (0 or 1) . |
bp | = number of the CCD blind pixels . |
Definition at line 1632 of file Procedures.c.
References D_VRange(), DIL, das::DOption, FLTIMG, img::Fmat, image::Idx, image::Idy, img::Imat, dil::Img, INTIMG, image::Mat, img::MaxNumbers, optionini::measmode, RGBIMG, and img::type.
Referenced by AutoR_No_Shutt(), AutoR_TestMeas(), AutoR_With_Shutt(), D_Average(), and DB_GetCCD().
int Lookfor4358 | ( | void | ) |
function to scan the wl() array in order to identify the position of the 4358 reference wavelength return value: er = -1 –> value 4358 not encountered er >= 0 –> value 4358 found at er position
Definition at line 2270 of file Procedures.c.
References wl.
int LookforWl_X | ( | int | x | ) |
Definition at line 2295 of file Procedures.c.
References wl.
Referenced by D_Calibra(), DemoInitMotor(), E_AAMeasure(), E_Almucantar(), E_Average(), E_AvgCCDHor(), E_DFMeasure(), E_DirectSun(), E_IRefSun(), E_Lambda(), E_Meashor(), E_Meashor2(), E_Measure(), HomeGratingFast(), PRG_ChkGrating(), and WinRes().
void MaskCol | ( | int | a, |
int | b, | ||
int | c, | ||
int | d, | ||
int | e | ||
) |
Definition at line 1548 of file Procedures.c.
References DIL, IDX, img::Imat, dil::Img, image::Mat, and Server.
Referenced by DB_DefectPixCorr().
void MaskPix | ( | int | a, |
int | b, | ||
int | c, | ||
int | d, | ||
int | e, | ||
int | f | ||
) |
Definition at line 1538 of file Procedures.c.
References DIL, IDX, img::Imat, dil::Img, image::Mat, and Server.
Referenced by DB_DefectPixCorr().
void MaskRow | ( | int | a, |
int | b, | ||
int | c, | ||
int | d, | ||
int | e | ||
) |
Definition at line 1557 of file Procedures.c.
References DIL, IDX, img::Imat, dil::Img, image::Mat, and Server.
Referenced by DB_DefectPixCorr().
void RemoveBlindPixels | ( | void | ) |
Definition at line 1600 of file Procedures.c.
References BlindPix, DIL, IDX, IDY, img::Imat, dil::Img, image::Mat, and Server.
Referenced by DB_GetCCD().
void SaveCalib | ( | int | mod | ) |
Definition at line 2130 of file Procedures.c.
References _MAX_PATH, d_fileman::DAILYDATADIRECTORY, d_fileman::DATADIRECTORY, DB_Save(), bil::DFILEM, das::DGeo, das::DOption, fftsavecal, spectrumheader::newdate, spectrumheader::olddate, d_geo::s_name, optionini::savingmode, bil::SPH, and Total.
Referenced by D_Calibra(), E_HgScan(), and E_QjScan().
void ShutterOpening | ( | int | mod | ) |
Definition at line 1685 of file Procedures.c.
References _MAX_PATH, d_fileman::CONFIGDIREQUIPMENT, countsopsh, bil::DFILEM, and MMessageDialog().
Referenced by InitCCD_AMS(), ShutCB(), Task_LOG(), and WinRes().
AzimuthSt AST |
Definition at line 45 of file Procedures.c.
bil BIL |
Definition at line 42 of file Procedures.c.
config Cfg |
Definition at line 31 of file Procedures.c.
das DAS |
DAS structure.
Definition at line 47 of file Procedures.c.
ccd DC_CCD |
Definition at line 29 of file Procedures.c.
ptf DC_HP |
Definition at line 30 of file Procedures.c.
d_geo DGEO |
geographical coordinates structure
Definition at line 41 of file Procedures.c.
int ExeREM |
Definition at line 143 of file DAS_Spat.c.
Referenced by D_Calibra().
int fftprh = 1 |
Definition at line 50 of file Procedures.c.
Referenced by D_Saving().
int fftsavecal = 1 |
Definition at line 51 of file Procedures.c.
Referenced by SaveCalib().
flag FLAG |
flags structure
Definition at line 37 of file Procedures.c.
FilterWheelSt FWS |
Filter Wheel.
Definition at line 34 of file Procedures.c.
GratingSt GRS |
Grating.
Definition at line 36 of file Procedures.c.
hdrsp HDRSP |
Definition at line 32 of file Procedures.c.
float maxar |
Definition at line 252 of file Procedures.c.
Referenced by AutoR_No_Shutt(), and AutoR_With_Shutt().
float maxtt |
Definition at line 252 of file Procedures.c.
Referenced by AutoR_No_Shutt(), and AutoR_With_Shutt().
float minar |
Definition at line 252 of file Procedures.c.
Referenced by AutoR_No_Shutt(), and AutoR_With_Shutt().
float mintt |
Definition at line 252 of file Procedures.c.
Referenced by AutoR_No_Shutt(), and AutoR_With_Shutt().
MirrorSt MIS |
Mirror.
Definition at line 33 of file Procedures.c.
NDFilterWheelSt NDFWS |
ND Filter Wheel.
Definition at line 35 of file Procedures.c.
paramini PARAM |
Param.ini.
Definition at line 39 of file Procedures.c.
int SaveCnt = 1 |
Definition at line 49 of file Procedures.c.
Referenced by D_Saving(), DB_HorComm_CB(), DB_KeyB_CB(), E_QjScan(), and ExMaster().
int ShuttDelay = 0 |
Definition at line 255 of file Procedures.c.
Referenced by AutoRange(), D_Average(), and DB_GetCCD().
ZenithSt ZST |
Definition at line 44 of file Procedures.c.