106 sprintf(HDRSP.
mirpos, buf);
175 HDRSP.
comment =
"Default Comment ";
208 D_VRange(
"Mirroring X axis..", 0, 0, 222, 235);
214 for(x = 0; x <= mx / 2; x++)
222 if((y % 20) == 0 && y > 0)
231 for(x = 0; x <= mx / 2; x++)
239 if((y % 20) == 0 && y > 0)
270 else if (NDFWS.
Pos == 1)
272 else if (NDFWS.
Pos == 2)
274 else if (NDFWS.
Pos == 3)
291 if ((
wl[GRS.
Wl] == 3850))
298 if (
wl[GRS.
Wl] == 4358)
308 if (
wl[GRS.
Wl] == 4861)
315 if ((
wl[GRS.
Wl] == 5332) )
322 if ((
wl[GRS.
Wl] == 4610) )
334 double AutoR_TestMeas(
int mod,
double texpmin,
double texpar,
float level,
float levelinf)
389 sprintf(buf,
"%.3lf",
TExp);
412 FlagTExp = FlagTExp * 2.5;
428 sprintf(buf,
"%.3lf",
TExp);
440 FlagTExp = FlagTExp * 2.5;
443 sprintf(buf,
"%.3lf",
TExp);
452 sprintf(buf,
"%.3lf",
TExp);
471 double TExpAutoR = 0.2;
476 float LevelInf = 1000;
515 TExpMin = treshold * ((((float)DC_CCD.
dy / (
float)DAS.
Paramini.
VBin) * 0.024 + ((
float)DC_CCD.
dy /
569 TExpAutoR = 4*TExpMin;
604 TExp = ( Level * ((1000*(TExpLast- TExpZero))/(
maxar -
maxtt )))/ 1000;
630 double TExpAutoR = 0.2;
634 float LevelInf = 1000;
724 TExpAutoR = 3*TExpMin;
727 TExpAutoR = 2*TExpMin;
752 TExp = TExpMin * (4 + numrip);
768 TExp = (double)( Level * ((10000*(TExpLast- TExpZero))/( fabs(
maxar -
maxtt) )))/ 10000;
807 TExpZero =
AutoR_TestMeas(0, TExpMin, TExpAutoR, Level, LevelInf);
820 TExpZero =
AutoR_TestMeas(0, TExpMin, TExpAutoR, Level, LevelInf);
825 }
while ((TExpZero <= TExpMin) && (numrip < maxrep));
847 if (TExpZero >=TExpAutoR)
848 TExpAutoR= TExpZero*1.1;
849 TExpLast =
AutoR_TestMeas(1, TExpMin, TExpAutoR, Level, LevelInf);
862 TExpZero =
AutoR_TestMeas(0, TExpMin, TExpAutoR, Level, LevelInf);
866 TExpLast =
AutoR_TestMeas(1, TExpMin, TExpAutoR, Level, LevelInf);
882 LevelInf = lowval + Offset;
891 TExp = ( Level * ((1000*(TExpLast- TExpZero))/(
maxar -
maxtt )))/ 1000;
905 double TExpAutoR = 0.2;
915 static int numrip = 0;
924 TExp =(float) (3 - i);
974 sprintf(buf,
"%.3lf",
TExp);
977 Status(
"Autoranging DONE");
1387 today = localtime( <ime );
1389 strftime( tmpbuf, 7,
"%y%m%d", today );
1418 fd = access(tit, 0);
1429 sprintf(tit1,
"%s", tit+5);
1430 fd = access(tit, 0);
1444 today = localtime( <ime );
1446 strftime( BIL.
SPH.
newdate, 7,
"%y%m%d", today );
1448 strftime( tmpbuf, 7,
"%y%m%d", today );
1470 fd = access(tit, 0);
1481 sprintf(tit1,
"%s", tit+5);
1482 fd = access(tit, 0);
1527 sprintf(tit1,
"%05d",
SaveCnt);
1538 void MaskPix(
int a,
int b,
int c,
int d,
int e,
int f)
1573 for(i=0;i<
PItem;i++)
1581 for(i=0;i<
CItem;i++)
1589 for(i=0;i<
RItem;i++)
1611 for(t = 0; t <
IDY; t++)
1620 for(t = 0; t <
IDY; t++)
1622 for(j = 0; j <
IDX ; j++)
1642 D_VRange(
"Find Max/Min..", 0, 192, 195, 192);
1646 for(y = 0; y < yi-1; y++)
1648 for(x = 2; x < xi; x++)
1651 *mi = min(*mi, m[y *
DIL.
Img.
Idx[w] + x]);
1652 *mx = max(*mx, m[y *
DIL.
Img.
Idx[w] + x]);
1656 if((y % 32) == 0 && y > 0)
1661 for(y = 0; y < yi; y++)
1663 for(x = 2; x < xi; x++)
1671 if((y % 32) == 0 && y > 0)
1678 D_VRange(NULL, 100 , 192, 195, 192);
1697 fd = access(buff, 0);
1700 fs = fopen(buff,
"r");
1703 MMessageDialog(
"DAS information",
"Problems in opening file",
" Ok ", NULL);
1712 fs = fopen(buff,
"w");
1715 MMessageDialog(
"DAS information",
"Problems in opening file",
" Ok ", NULL);
1718 fprintf(fs,
"%u\n", 1);
1725 fs = fopen(buff,
"w");
1728 MMessageDialog(
"DAS information",
"Problems in opening file",
" Ok ", NULL);
1755 unsigned long st, et, x;
1765 sprintf(buf,
"%6.1lf",
TExp);
1783 st = GetTickCount();
1786 et = GetTickCount();
1792 sprintf(buf,
"%6.1lf",
TExp - x / 1000.0 );
1800 }
while(labs(et - st) < (
TExp * 1000));
1857 for(t = 0; t <
IDY; t++)
1859 for(j = 0; j <
IDX ; j++)
1901 for(t = 0; t <
IDY; t++)
1903 for(j = 0; j <
IDX ; j++)
2047 for(t = 0; t <
IDY; t++)
2049 for(j = 0; j <
IDX ; j++)
2069 for(t = 0; t <
IDY; t++)
2071 for(j = 0; j <
IDX ; j++)
2149 today = localtime( <ime );
2151 strftime( tmpbuf, 7,
"%y%m%d", today );
2175 sprintf(tit1,
"%s", tit+5);
2187 today = localtime( <ime );
2189 strftime( BIL.
SPH.
newdate, 7,
"%y%m%d", today );
2191 strftime( tmpbuf, 7,
"%y%m%d", today );
2219 sprintf(tit1,
"%s", tit+5);
2244 sprintf(tit1,
"%s", tit+5);
2275 for (i=0; i<17; i++)
2300 for (i=0; i<18; i++)
2319 int x, y, px, DirCal, er = 0, c;
2329 Status(
"Hg Calibration");
2360 if (GRS.
Wl != PosRefWl)
2363 sprintf(buf,
"You are performing HG calibration in the %.1lf nm spectral window!!!\nUsually this operation is performed in the 435.8 nm window \nDo you want to continue ?", (
double)
wl[GRS.
Wl]/10);
2364 er =
MMessageDialog(
"DAS information", buf,
"Yes, in this window",
"Yes, but go to 435.8!",
"Cancel Calibration", NULL);
2381 else if ((exm ==
DBDEMO) ||
2402 sprintf(buf,
"Wait 5 sec. for HG lamp Heating");
2410 for(c = 0; c < 10; c++)
2412 sprintf(buf,
"Guess %d", c+1);
2429 for(x = PxHg - 200; x < PxHg + 200; x++)
2437 sprintf(buf,
"Hg: %u, found at: %d", mx, px);
2440 if((px > (PxHg + 1)) || (px < (PxHg - 1)))
2444 n = (PxHg - px) * (k/200-5) * 4;
2496 sprintf(buf,
"Hg: %u, found at: %d", mx, px);
2507 int l, f, m, a, d, s, g, ss;
2509 extern struct date dok;
2515 sscanf(&
Program[
PrgCnt],
"%d%d%d%d%lf%d%d%d", &m, &l, &f, &a, &t, &d, &s, &g);
2620 NM = (int)(TT /
TExp);
2622 np = (long)
IDX *
IDY * 2;
2630 for(c = 0; c < NM; c++)
2633 sprintf(buf,
"Averaging #: %d on %d", c, NM);
2635 for(n = 0; n < np; n++)
2639 for(n = 0; n < np; n++)
2662 double TT, DeadTime,availabletime;
2669 unsigned long st, et, x;
2681 MMessageDialog(
"DAS information",
"TExp = 0\nThe Average procedure can NOT be executed\nPlease provide a valid TExp\n(Executing a GetCCD or Autoranging)!!",
" Ok ", NULL);
2689 for(n = 0; n < np; n++)
2697 if(
TExp > 0.5 &&
TExp <= 1.0) tmpnavg = 10;
2699 if(
TExp > 1.0) tmpnavg = 2;
2701 for(c = 0; c < tmpnavg; c++)
2705 sprintf(buf,
"Averaging #: %d", c+1);
2709 for(n = 0; n < np; n++)
2715 for(n = 0; n < np; n++)
2750 availabletime = TT - DeadTime;
2752 if (availabletime > 0)
2758 NM = (int)(TT / (
TExp + 0.5));
2811 for(c = 0; c < NM; c++)
2824 sprintf(buf,
"Avg #: %d on %d. TotTExp: %d s", c+1, NM,
TOTTEXP);
2835 for(n = 0; n < np; n++)
2840 for(n = 0; n < np; n++)
2864 sprintf(buf,
"Measuring with TExp = %3.1lf" ,
TExp);
stepm StepM
Stepper motors parameters structure.
gui Gui
Graphic User Interface Structure.
MOBJECT LedSM[AMSMAX][2]
Leds for stepper motors status.
int SD_Grating(int ang)
Positioning Grating. The Grating move to the position specified by ang (Wavelength) ...
int Pos
Filter Wheel current Position.
int SD_Mirror(int where)
Positioning Input Mirror. The Input Mirror reaches the position specified by where.
int IDX
Number of sensible horizontal pixels.
MOBJECT Albl_LS[8]
Active Control Panel Labels for LIS status.
void HgLamp(int mod)
HG Lamp ON/OFF .
void MLoopWhileEvents(int discard)
optionini DOption
Options for DAS execution.
Status of the ND Filter wheel .
int savingmode
Flag to set saving mode: 0=ASCII, 1=Binary.
double alititude
Station altitude.
const char * Mir_Code[]
const char array for the realisation of the Mirrors buttons in the Mirror shell
void SD_FNTorqueM(int mod)
Positioning NDFilter. .
void D_VRange(char *str, int val, int, int g, int b)
Create and display the status bar.
unsigned int imgmin
Image minimum value.
#define TORQUEM
Torque Motor.
C_DEF void DI_Regen(int s)
int ccdwy
Total Number of Y Pixels.
C_DEF double DI_ScanMaxMin(int w, float *mx, float *mi)
int Total
Progressive acquisition number for file (MAX defined = 50)
int plotW
Flag for the plot display.
void MPixmapSetImageFile(MOBJECT pixmap, const char *fname)
das structure (contain all the previous structures) .
void D_Average(int mod)
Performs averaged measurements .
#define TESTSZAMODE
execution driven by SZAPRG file
double latitude
Station latitude.
int ccdwx
Total Number of X Pixels.
char DAILYDATADIRECTORY[_MAX_PATH]
int Pos
Mirror Current Position.
flag Flag
Structure for different flags.
void MaskPix(int a, int b, int c, int d, int e, int f)
int darkremove
Flag to set Dark Removal from measurements; motors0 = No Dark Removal, 1 = Dark Removal.
void MaskRow(int a, int b, int c, int d, int e)
struct date DATE
Registration date.
int filtertype
type of installed filter module: 0=Simple-SM3, 1=Double-SM3+SM4, 2=simpleplus-SM3+TM) ...
#define DBDEMO
execution in demo mode
int SD_FilterW(int filter)
Positioning Filter wheel. The filter wheel move on the filter number specified by filter...
char DATADIRECTORY[_MAX_PATH]
double AutoR_No_Shutt(void)
float ccdtemp
CCD Temperature.
NDFilterWheelSt NDFWS
ND Filter Wheel.
void D_Plot(void)
ViewPlot callback .
#define ROTSHUT
Rotating Shutter.
geographical coordinate structure .
spectrumheader SPH
Spectrum Header Structure.
int avgautor
autoranging for averaged measurement, 0 = NO AutoR before average; 1 = AutoR before average; ...
char * Fil_Code8H[]
const char array for the realisation of the Filters buttons in the Filter shell
MOBJECT Albl_CS[4]
Active Control Panel Labels for Camera Status 4.
void MShellUnrealize(MOBJECT obj)
void DB_Save(char *tit, int mod)
Save the acquired spectrum. Procedure that Save the acquired spectrum.
void MObjectSetText(MOBJECT obj, const char *text)
void D_BuildH(int mod, int s)
Build Header of the measurements . .
int MaskedPix[100][6]
Masked pixel's array.
int Pos
Filter Wheel current Position.
d_geo DGeo
struct for Station location
void MShellDestroy(MOBJECT obj)
#define LIS_
Lampedusa Island Spectrometer - ENEA.
short unsigned U16
2 byte without sign, range 0-65535
double DB_ScanMaxMin(int w, float *mx, float *mi, int bp)
Find Max and Min values for the buffer of order w.
int exec
= 0 -> PRG Execution Paused; = 1 -> PRG Execution Resumed
int Wl
Grating Wavelength.
#define TROPOGAS
TROPOspheric Gas Analyzer Spectrometer.
MOBJECT LblExpP[7]
Label for presetted time exposure.
unsigned int s_alt
station altitude
float s_longitude
station longitude
char * Fil_CodeNG[]
const char array for the realisation of the Filters buttons in the Filter shell for GASCODNG2 and NG3...
char * Program
buffer for the PRG file
char s_name[4]
Station name.
long dp
Grating backslash recovery steps.
unsigned long countsopsh
counting the number of opening shutter
float CCDTemp
Actual CCD Temperature.
struct time TIME
Registration time.
int D_Calibra(void)
Spectral Calibration Procedure for the spectral calibration with HG lamp. Shift of HG spectral line a...
#define FDOUBLE
double filter wheel
#define FPLUS
Filter Wheel Torque Motor.
void DB_DefectPixCorr()
Apply thew pixel correction. .
char binmirpos[8]
Mirror position.
int avgmode
Flag to set Averaging mode: 0 = Repeat measurements for fixed number, 1 = Repeat measurements for fix...
int Lookfor4358(void)
function to scan the wl() array in order to identify the position of the 4358 reference wavelength re...
unsigned short * ImatDark
buffer for the dark image
#define GASCODNG2
GASCODNG 2 (with ATX power supply & HiresIV)
void __stdcall ShowDown(const char *str, int port)
Shows the countdown. Procedure for the visualisation of the countdown.
#define SAVECNT
maximum number of spectra in one file
long PrgCnt
Counter for the position in the PRG file.
MOBJECT MDCreateExpo(char *tit)
Create Exposure/countdown shell. Procedure that build the Exposure/countdown shell during the calcula...
int VBin
CCD Vertical Binning.
paramini structure . It contains some of the parameters defined in the file PARAM.INI .
#define SPATRAM2
SPATRAM2 (with ATX power supply & HiresV)
int imgfmt
Image format: 0 = ASCII, 1 = BIN.
int ViewPlot(int mod)
Create the plot shell. Procedure that build the plot shell for the data visualization.
#define SPATRAMPLUS
As SPATRAM plus AltAzimuth platform.
int RItem
number of Pixel, Column, Row Item
char CONFIGDIREQUIPMENT[_MAX_PATH]
void Status(char *tit)
Writes information's on the Status label .
int emshutter
Presence of the CCD Shutter, emshutter = 1 –> Shutter IS Installed, = 0 –> Shutter NOT Installed...
int ccdnr
Row number (ccdyoff-ccdwx)/ccdvbin.
void delay(unsigned long d)
Pauses for a specified number of milliseconds. .
#define GASCODNG3
GASCODNG 3 (with ATX power supply & HiresIV)
float s_sza
sun solar zenith angles
#define PRGFILE
execution driven by *.prg file
char bincomment[255]
comment
#define VS25
Uniblitz Shutter VS25.
void D_AverageTFix(void)
NOT Used .
int IDY
Number of sensible vertical pixels.
#define GASCODNG1
GASCODNG 1 (with ATX power supply & HiresIV)
double AutoRange(int mod)
Calculate the exposure time The optimum exposure time (TExp) is calculated with an initial TExpAR=0...
FilterWheelSt FWS
Filter Wheel.
#define GASCODNG4
GASCODNG 4.
char * Fil_CodeNG1[]
const char array for the realisation of the Filters buttons in the Filter shell for GASCODNG1 instrum...
void D_Saving(void)
Saving image. Procedure for saving the CCD Image Used since version 2.1.0. The coiche between binary ...
int TOTTEXP
Total Exposure time in Averaging mode.
float s_latitude
station latitude
#define FSIMPLE
simple filter wheel
int MMessageDialog(const char *t, const char *msg, const char *btn1, const char *btn2,...)
#define SPATRAM3
SPATRAM3.
double TExp
CCD Exposure time.
CTYPE void DLL DC_GetCCD(int Mode, double Exposure, U16 *mat, int Camera)
Get an image at full resolution. Procedure that allows you to read an image, given an exposure time e...
char binfilpos[5]
Filter position.
const char * filpos
Filter position.
#define SZAMODE
execution driven by SZAPRG file
int SM_B
Motor B (su Y12) respectively: ID=0->Grating,ID=1->Not Connected,ID=2->Azimuth.
char s_name[4]
station localization
int mirrorimg[2]
Flag to set the mirroring of the CCD image: 0 = NO Mirroring, 1= YES Mirroring (element 0 for X axis;...
char * Fil_Code[]
const char array for the realisation of the Filters buttons in the Filter shell
void E_REM(void)
Flush string since the Carriege Return. Procedure for flushing the readed string since the Carriege R...
int DB_GetCCD(int mod)
Get CCD Image. .
void GetDateTime(struct date *dp, struct time *tp, struct tm *when)
int wl[]
WaveLength definition - for SD_Grating.
int pixcorr
Flag to set defective pixel correction: 0=NOT Corrected, 1=Corrected.
controlpanel ContrPanel
Control Panel Structure.
char mirpos[8]
Mirror position.
d_geo DGEO
geographical coordinates structure
Bortul Image Library Structure .
int imgtype
Flag to set Image type: 0=MONOINT, 1=RGB.
long * AVGmat
buffer for averaging measurements
void MaskCol(int a, int b, int c, int d, int e)
double longitude
Station longitude.
#define AMS1
AMS1 address.
int measmode
measuring mode: 0 = Single; 1 = Averaged
void RemoveBlindPixels(void)
void ShutterOpening(int mod)
MOBJECT Albl_IE[1]
Active Control Panel Labels for In Execution status.
int step[AMSMAX][2]
Stepper Motors Step.
C_DEF void DI_WriteDigit(MOBJECT *pix, char *fmt)
double maxtexp
Maximum exposure time (used in Autorange())
void AutoR_SetND_Filter(void)
int MaskedRow[100][6]
Masked rows array.
char * Fil_CodeTropo[]
const char array for the realisation of the Filters buttons in the Filter shell for TROPOGAS instrume...
int EqType
Spectrometer Type.
int N_RM
Number of measurements for Averaging mode in fixed exposure time mode.
int lambda
wavelength value
int BlindPix
Number of blind pixels (usefull for Dark Current)
int N_AVG
Number of measurements for Averaging mode in fixed number of meas. mode.
int darksource
Flag to set Dark source: 0 = Blind Pixels, 1 = Full Frame.
float ccdtexp
ccd Exposure time
int SD_NDFilterW(int filter)
Positioning Filter wheel. The filter wheel move on the filter number specified by filter...
Status of the Filter wheel .
int shuttertype
type of installed shutter: 0 = VS25, 1 = Rotating Shutter, 2 = TorqueMotor
unsigned int maxlvlar
maximum level of autoranging (max 65000)
unsigned int imgmax
Image maximum value.
MOBJECT LblExpD[7]
Label for time exposure countdown.
int SM_stepr(int t)
AMS 'steps/round' value return the AMS 'steps/round' value (microstepping) depending on the setted st...
int exemode
Set the Execution MODE (Execution modes)
double AutoR_TestMeas(int mod, double texpmin, double texpar, float level, float levelinf)
int ccdvbin
Vertical binning value.
int DB_StepMotor(int id, int motor, long step, int dir)
Send steps to the selected stepper motor. .
#define MANUAL
execution in manual mode (for lab use)
double AutoR_With_Shutt()
marconi Marconi
CCD Sensor struct.
int MaskedCol[100][6]
Masked column array.
const char * Mir_CodeTropo[]
const char array for the realisation of the Mirrors buttons in the Mirror shell for TROPOGAS ...
paramini Paramini
structure for the parameters defined in param.ini configuration file