| 1 | /* | 
|---|
| 2 | Ecriture des courbes de lumieres individuelles pour database ErosI | 
|---|
| 3 | */ | 
|---|
| 4 | #include "sopnamsp.h" | 
|---|
| 5 | #include "machdefs.h" | 
|---|
| 6 | #include <iostream> | 
|---|
| 7 | #include <string> | 
|---|
| 8 | #include <stdlib.h> | 
|---|
| 9 | #include <math.h> | 
|---|
| 10 | #include <stdio.h> | 
|---|
| 11 | #include <string.h> | 
|---|
| 12 |  | 
|---|
| 13 | #include "nbmath.h" | 
|---|
| 14 | #include "fsvcache.h" | 
|---|
| 15 | #include "fsvst.h" | 
|---|
| 16 | #include "nbsread.h" | 
|---|
| 17 | #include "nbgene.h" | 
|---|
| 18 |  | 
|---|
| 19 | int icount = 0; | 
|---|
| 20 |  | 
|---|
| 21 | /*================================================================*/ | 
|---|
| 22 | void UINIT(void) {} | 
|---|
| 23 |  | 
|---|
| 24 | void UDATCLEAN(int coul) | 
|---|
| 25 | /* pour tuer une photo selon des criteres utilisateur, mettre date a GRAND2 */ | 
|---|
| 26 | { | 
|---|
| 27 | int_4 ic = coul-1; | 
|---|
| 28 | if(nmes[ic]<=0) return; | 
|---|
| 29 | for(int i=0;i<nmes[ic];i++) { | 
|---|
| 30 | if(date[ic][i]<0.)  date[ic][i] = GRAND2; | 
|---|
| 31 | if(timeu[ic][i].FgCalib<=0) date[ic][i] = GRAND2; | 
|---|
| 32 | } | 
|---|
| 33 | } | 
|---|
| 34 |  | 
|---|
| 35 | void UINITCCD(void) {} | 
|---|
| 36 | void UENDCCD(void) {} | 
|---|
| 37 | void UEND(void) {} | 
|---|
| 38 |  | 
|---|
| 39 | /*================================================================*/ | 
|---|
| 40 | void UEVT(void) | 
|---|
| 41 | { | 
|---|
| 42 | int ic, i; | 
|---|
| 43 |  | 
|---|
| 44 | if((icount++)%1000==0) | 
|---|
| 45 | printf("> Et=%d (%d) %d (%d)  fref=%g %g\n" | 
|---|
| 46 | ,iet[0],staru[0].XRef,iet[1],staru[1].XRef,staru[0].FluxRef,staru[1].FluxRef); | 
|---|
| 47 |  | 
|---|
| 48 | if(nmesure[0]<=0 || nmesure[1]<=0) return; | 
|---|
| 49 | if(iet[0]<=0 || iet[1]<=0) return; | 
|---|
| 50 |  | 
|---|
| 51 | char str[1024]; | 
|---|
| 52 | sprintf(str,"%d.time",staru[0].NumEt); | 
|---|
| 53 | FILE* fstlist = fopen(str,"w"); | 
|---|
| 54 |  | 
|---|
| 55 | fprintf(fstlist,"# %d %.3f %.3f %.3f  %d %.3f %.3f %.3f\n", | 
|---|
| 56 | staru[0].NumEt,staru[0].XPos,staru[0].YPos,staru[0].FluxRef, | 
|---|
| 57 | staru[1].NumEt,staru[1].XPos,staru[1].YPos,staru[1].FluxRef); | 
|---|
| 58 | fprintf(fstlist,"# %d %d  ntime R=0 B=1\n",nmesure[0],nmesure[1]); | 
|---|
| 59 |  | 
|---|
| 60 | for(ic=0;ic<NCOULMX;ic++) { | 
|---|
| 61 | for(i=0;i<nmesure[ic];i++) { | 
|---|
| 62 | int j; | 
|---|
| 63 | double t, f, ef; | 
|---|
| 64 | j = indexu[ic][i]; | 
|---|
| 65 | t = date[ic][j]; // origine 1/1/1990 a 0:0:0 | 
|---|
| 66 | f = mesu[ic][j].Flux; | 
|---|
| 67 | ef = mesu[ic][j].ErrFlux; | 
|---|
| 68 | fprintf(fstlist,"%d %.6f %.3f %.3f\n",ic,t,f,ef); | 
|---|
| 69 | } | 
|---|
| 70 | } | 
|---|
| 71 |  | 
|---|
| 72 | fclose(fstlist); fstlist = NULL; | 
|---|
| 73 |  | 
|---|
| 74 | } | 
|---|