31 #define TINY 1.0e-25 // A small number. 32 #define FREERETURN {free_vector(d,1,n);free_vector(c,1,n);return;} 42 void polint(
float xa[],
float ya[],
int n,
float x,
float *y,
float *dy)
45 float den,dif,dift,ho,hp,w;
47 dif=(float)fabs(x-xa[1]);
52 if((dift=(
float)fabs(x-xa[i])) < dif)
68 if((den=ho-hp) == 0.0)
70 nrerror(
"Error in routine polint");
75 *y += (*dy=(2*ns < (n-m) ? c[ns+1] : d[ns--]));
106 if((nf = fopen(
"In.dat",
"r")) == NULL)
110 fscanf(nf,
"%f%f", &xa[l], &ya[l]);
111 printf(
"%d %12.6f %12.6f \n", l, xa[l],ya[l]);
118 nf = fopen(
"Is.dat",
"w");
122 polint( &xa[i], &ya[i],2,(
float) i+linit,&y,&dy);
123 printf(
"\n%d %12.6f %12.6f ", i, xa[i],ya[i]);
124 printf(
"\n%d %d %12.6f %12.6f", i, i+linit,y,dy);
125 printf(
"\n**************");
127 fprintf(nf,
"%12.6lf %12.6lf %d %12.6lf \n",xa[i],ya[i], i+linit, y);
158 static MOBJECT sts[16], shell[16];
159 if(
D_VRip < 0 && val == 100)
161 if(D_VRip < 0 && val > 0)
194 sprintf(msg,
"%d %%", val);
206 void D_VRange(
char *str,
int val,
int r,
int g,
int b)
209 static MOBJECT sts[16], shell[16];
210 if(
D_VRip < 0 && val == 100)
212 if(D_VRip < 0 && val > 0)
245 sprintf(msg,
"%d %%", val);
258 void D_VRangeSim(
int id,
char *str,
int val,
int r,
int g,
int b,
int x,
int y)
261 static MOBJECT sts[16][16], shell[16][16];
262 if(
DD_VRip[
id] < 0 && val == 100)
296 sprintf(msg,
"%d %%", val);
315 for(x = 200; x < dx - 200 ; x++)
317 sumdata += mis[ dy * dx + x];
320 average = sumdata / (double) (dx - 400);
322 fluxi = average / (double)(te * 1000000);
333 char buf[512],str[512];
335 char string[4] =
".FIN";
344 fs = fopen(nomefile,
"r");
355 D_VRange(
"Flux Index Calculation",0, 0, 222, 235);
358 fs = fopen(nomefile,
"r");
365 fscanf(fs,
"%s", filedatan);
368 strcat(buf, filedatan);
371 fb = open(filedatan, O_RDONLY |
O_BINARY, S_IREAD );
378 if((k % 10) == 0 && k > 0)
379 D_VRange(NULL, (
long) k * 100 / numspettri, 0, 222, 235 );
387 if( (strcmp(BIL.
SPH.
mirpos,
"HorizDX") == 0) | (strcmp(BIL.
SPH.
mirpos,
"Zenith") == 0) )
403 fd = fopen(str,
"a");
407 fprintf(fd,
"%s", str);
445 memset (&fbp, 0,
sizeof (fbp));
522 for(y = 0; y <
IDY; y++)
524 for(x = 0; x <
IDX; x++)
532 fprintf(fff,
"\n", NULL);
537 fprintf(fff,
"\n", NULL);
544 unsigned long info = 0;
588 fprintf(fff,
"SZA: %.2lf\n", BIL.
SPH.
sza);
628 fprintf(fff,
"SZA: %.2lf\n", BIL.
SPH.
sza);
666 char buf[256],str[256];
693 D_VRange(
"Header file correction",0, 0, 222, 235);
703 fscanf(fs,
"%s", filedatan);
706 strcat(buf, filedatan);
708 fc = fopen(buf,
"r");
715 if((k % 10) == 0 && k > 0)
716 D_VRange(NULL, (
long) k * 100 / numspettri, 0, 222, 235 );
732 sprintf(buf,
"%s\\%s",
"CORRECTED",filedatan);
736 fd = fopen(str,
"a");
770 for(y = 0; y < vp; y++)
772 for(x = 0; x < hp; x++)
776 else if((x==1) & (y!=0))
790 char buf[256],str[256];
817 D_VRange(
"Header file correction",0, 0, 222, 235);
827 fscanf(fs,
"%s", filedatan);
830 strcat(buf, filedatan);
832 fc = fopen(buf,
"r");
839 if((k % 10) == 0 && k > 0)
840 D_VRange(NULL, (
long) k * 100 / numspettri, 0, 222, 235 );
862 sprintf(buf,
"%s\\%s",
"CORRECTED",filedatan);
866 fd = fopen(str,
"a");
int DB_CalcFluxI(char *nomefile)
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
int IDX
Number of sensible horizontal pixels.
int ReadHeaderOnly(FILE *fd)
read the ASCII header of the stored spectrum
void MLoopWhileEvents(int discard)
optionini DOption
Options for DAS execution.
int savingmode
Flag to set saving mode: 0=ASCII, 1=Binary.
void MShellRealize(MOBJECT obj)
int DT_CorrFileEvora(void)
Used to correct some data files.
Control Panel and push buttons colors .
char HOMEDIRECTORY[_MAX_PATH]
void MStatusBarSetPos(MOBJECT p, int pos)
char DATADIRECTORY[_MAX_PATH]
void polint(float xa[], float ya[], int n, float x, float *y, float *dy)
spectrumheader SPH
Spectrum Header Structure.
void ReadIMG(FILE *file, unsigned short *mat, int hp, int vp)
Read ASCII Image (Spectral Data only) .
void D_VRange(char *str, int val, int r, int g, int b)
Create and display the status bar.
void MShellUnrealize(MOBJECT obj)
void MObjectSetText(MOBJECT obj, const char *text)
int DT_ColFormat(void)
Callback for Column format.
void MShellDestroy(MOBJECT obj)
File Browser Preferences. Used by the Utility functions MFileBowserExt() and MDirBowserExt().
int DT_LinkSpectra(void)
For the linked spectra (..on going!!!)
void D_PrintSpectrum(FILE *fff)
Print Spectrum.
#define SAVECNT
maximum number of spectra in one file
MOBJECT MCreateStatusBar(MOBJECT parent, const char *text, int max, MTFont font)
unsigned short * ImatOrig
void __stdcall DD_VRange(const char *str, int val, int Port)
void MObjectSetCompositeHeight(MOBJECT obj, int h)
unsigned short * DeallocUSMat(unsigned short *mat)
char DBFILENAME[_MAX_PATH]
int ReadHeader_BIN(int fd)
read the BINARY header of the stored spectrum
MOBJECT MDCreateFM_Shell(int mod, int fmt)
int MFileBrowseExt(const char *t, const char *ext, char *fname, char *dname, FB_PREFS *prefs)
void D_PrintBILSPH(FILE *fff)
Print Header.
void ReadIMG_BIN(int fd, unsigned short *mat, int hp, int vp)
read the BINARY stored spectrum
void MStatusBarSetSliderRGB(MOBJECT p, int r, int g, int b)
int IDY
Number of sensible vertical pixels.
void ShiftImg(int hp, int vp)
Used to correct some data files.
double CalcFluxIndex(unsigned short mis[], int dx, int dy, float te)
calculates the Flux Index of a measurement
void MShellRealizeXY(MOBJECT obj, int x, int y)
const char * bg_image_file
MOBJECT MCreateShell(const char *title, int flags)
short DB_BG[3]
Default Background Color.
unsigned short * ImatGraf
int Model_read(char *buff)
int DT_CorrHeader()
Used to correct the header in some data files.
Bortul Image Library Structure .
char WORKDIRECTORY[_MAX_PATH]
int DT_FluxIndex(void)
Callback for Flux Index Calculation.
void D_PrintBILSPH_BIN(int fd)
Print on file the binary header of the measured spectrum.
unsigned short * AllocUSMat(int hp, int vp)
void D_VRangeSim(int id, char *str, int val, int r, int g, int b, int x, int y)
init progress bar during simultaneous positioning
void MShellSetWMCloseCallback(MOBJECT p, WM_CLOSE_CB cb, void *a_data)
int ReadHeaderOldF(FILE *fd)
read the ASCII header of the stored spectrum (OLD FORMAT - replaced by ReadHeaderOnly(FILE *fd) ...
int DB_Column(char *sourcefilename)
Column format.
void D_Print_BIL_H_ASCII(int mod, FILE *fff)
void D_CloseVR(MOBJECT p, void *od, void *ad)
Callback closing the status bar.
void MObjectResize(MOBJECT obj, int w, int h)