diff --git a/ObservationSim/Instrument/Chip/libBF/libmoduleBF.so b/ObservationSim/Instrument/Chip/libBF/libmoduleBF.so deleted file mode 100755 index 63400befa404b98806d231811541d12d6fa8f613..0000000000000000000000000000000000000000 Binary files a/ObservationSim/Instrument/Chip/libBF/libmoduleBF.so and /dev/null differ diff --git a/ObservationSim/Instrument/Chip/libCTI/CTI_modeling.py b/ObservationSim/Instrument/Chip/libCTI/CTI_modeling.py index eced09ebdce098876b67c9de3c555241163fb6d5..77b5ced461928b1d6451c0c05cde8ca89285a7b7 100644 --- a/ObservationSim/Instrument/Chip/libCTI/CTI_modeling.py +++ b/ObservationSim/Instrument/Chip/libCTI/CTI_modeling.py @@ -16,7 +16,7 @@ lib = CDLL(lib_path) CTI_simul = lib.__getattr__('CTI_simul') CTI_simul.argtypes = [POINTER(POINTER(c_int)),c_int,c_int,c_int,c_int,POINTER(c_float),POINTER(c_float),\ c_float,c_float,c_float,c_int,POINTER(c_int),c_int,POINTER(POINTER(c_int))] - +''' get_trap_h = lib.__getattr__('save_trap_map') get_trap_h.argtypes = [POINTER(c_int), c_int, c_int, c_int, c_int, POINTER(c_float), c_float, c_float, c_char_p] @@ -44,6 +44,7 @@ def bin2fits(bin_file,fits_dir,nsp,nx,ny,nmax): h[np.where(ntrap> add_CTI.c +add_CTIfinal.c >> add_CTI.c diff --git a/ObservationSim/Instrument/Chip/libCTI/src/add_CTI.c b/ObservationSim/Instrument/Chip/libCTI/src/add_CTI.c index 74bb6c187ddae1f58baab0f65f2274a1e9949ae2..331c7e8ce9fe6ec4a8ff9055dbf303e9ccb29ceb 100644 --- a/ObservationSim/Instrument/Chip/libCTI/src/add_CTI.c +++ b/ObservationSim/Instrument/Chip/libCTI/src/add_CTI.c @@ -5,11 +5,13 @@ #include "nrutil.h" #include -float poidev(float x, int *idum); -void creattraps(int *seed,int ntrap,int ny,int nmax,float c,float beta,float **sp); +float poidev(float x, long *idum); +void creattraps(long *seed,int ntrap,int ny,int nmax,float c,float beta,float **sp); void addCTI(int *a0,int ny,int noverscan,int nsp,float beta,float w, float c,float *t, float ***ntrap, int *acti, int release_seed,float *randv); -float ran1(int *idum); -void CTI_simul(int **image, int nx, int ny, int noverscan, int nsp, float *rho_trap, float *t, float beta, float w, float c, int nmax, int *trap_seeds, int release_seed,int **imagecti){ +//int read_fits_2D(const char *argv,float *galaxy,int imagesize); +//int write_fits_2D(const char *argv,float **stars,int *dim); +float ran1(long *idum); +void CTI_simul(int **image, int nx, int ny, int noverscan, int nsp, float *rho_trap, float *t, float beta, float w, float c, int nmax, long *trap_seeds, int release_seed,int **imagecti){ int ntotal; printf("image parameters: nx=%i ny=%i noverscan=%i\n",nx,ny,noverscan); printf("input image: image[0][0]=%i image[50][60]=%i image[1000][20]=%i image[20][1000]=%i\n",image[0][0],image[50][60],image[1000][20],image[20][1000]); @@ -17,301 +19,219 @@ void CTI_simul(int **image, int nx, int ny, int noverscan, int nsp, float *rho_t printf("t t1=%f t2=%f t3=%f\n",t[0],t[1],t[2]); printf("volume parameter beta=%f,w=%f,c=%f\n",beta,w,c); printf("nsp=%i,nmax=%i\n",nsp,nmax); - printf("trap_seeds = %i,%i,%i\n",trap_seeds[0],trap_seeds[1],trap_seeds[2]); + //printf("trap_seeds = %i,%i,%i\n",trap_seeds[0],trap_seeds[1],trap_seeds[2]); printf("release_seed = %i\n",release_seed); printf("begin CTI simulation\n"); float ***ntrap; - float tmp,*randv; + float *randv; + float tmp; int ntrap_tmp,nrandv=100000; int *a0,*acti,dim[2]; - int i,j,k,l,iseed=-1; + int i,j,k,l; + long iseed=-1; ntotal=ny+noverscan; ntrap = f3tensor(0,nsp-1,0,ny,0,nmax+1); a0=ivector(0,ny); acti=ivector(0,ntotal); randv=vector(0,nrandv); for(i=0;i0){ - ntraped=0; - tmpntrap=ntrap[0][i]; - while(tmpntrap[ntraped+1]<=height){ntraped++;} - if(flow[i]0){ - ntraped=0; - tmpntrap=ntrap[1][i]; - while(tmpntrap[ntraped+1]<=height){ntraped++;} - if(flow[i]0){ ntraped=0; - tmpntrap=ntrap[2][i]; + tmpntrap=ntrap[j][i]; while(tmpntrap[ntraped+1]<=height){ntraped++;} if(flow[i]noverscan)nmove=ntotal-i; - for(j=0;j0){ - ntraped=0; - //height=flow[j]*wre; - tmpntrap=ntrap[0][j]; - tmptraped=traped[0]; - while(tmpntrap[ntraped+1]<=height){ntraped++;} - topoftrap=tmptraped[j]-ntraped; - if(topoftrap==0){} //do nothing - else if (topoftrap>0){ // release - for(k=0;k0){ - ntraped=0; - //height=flow[j]*wre; - tmpntrap=ntrap[1][j]; - tmptraped=traped[1]; - while(tmpntrap[ntraped+1]<=height){ntraped++;} - topoftrap=tmptraped[j]-ntraped; - if(topoftrap==0){} //do nothing - else if (topoftrap>0){ // release - for(k=0;k0){ - ntraped=0; - //height=flow[j]*wre; - tmpntrap=ntrap[2][j]; - tmptraped=traped[2]; - while(tmpntrap[ntraped+1]<=height){ntraped++;} - topoftrap=tmptraped[j]-ntraped; - if(topoftrap==0){} //do nothing - else if (topoftrap>0){ // release - for(k=0;k=0;j--){ + //flow[i]+=poidev(0.01, &hotseed); + ncumran=randv[j+i]*10000; + height=flow[i]*wre; - //if(nsp==3)continue; + isp=0; + tmpntrap=ntrap[isp][j]; + ntraped=0; + tmptraped=traped[isp]; + while(tmpntrap[ntraped+1]<=height){ntraped++;} + topoftrap=tmptraped[j]-ntraped; + if(topoftrap!=0){trap_release(&flow[i], &tmptraped[j],topoftrap,randv,&ncumran,f[isp]);} - /*isp=3; - ntraptot=ntrap[isp][j][0]; - if(ntraptot>0){ - ntraped=0; - //height=flow[j]*wre; - tmpntrap=ntrap[isp][j]; - tmptraped=traped[isp]; - while(tmpntrap[ntraped+1]<=height){ntraped++;} - topoftrap=tmptraped[j]-ntraped; - if(topoftrap==0){} //do nothing - else if (topoftrap>0){ // release - for(k=0;k0){ // release + for(k=0;k