Commit 12749647 authored by myron's avatar myron

compila

parent 40ef8641
g
#/*##########################################################################
# Copyright (C) 2001-2013 European Synchrotron Radiation Facility
#
......@@ -688,8 +688,8 @@ void CCspace_prepare_concurrent_ff_reading(CCspace * self) {
self->ff_read_status = (int**) malloc( sizeof(int* )* self-> ff_rawdatatokens-> ntokens ) ;
for( k = 0; k < self->ff_rawdatatokens->ntokens ; k++ ) {
self->snXtoken[k] =-1; // reinitialise ff_read_status when it changes
self->ff_read_status[k] = (int* ) malloc( sizeof(int )* self->reading_infos . ff_file_list_lenght) ;
}
self->ff_read_status[k] = (int* ) malloc( sizeof(int )* self->reading_infos . NFF) ;
}
}
void CCspace_ffstatus_dealloc(CCspace * self ) {
......@@ -5677,6 +5677,18 @@ void CCspace_InterleavedReadingPreProcessing_chunk(CCspace * self ,int sn,int
/* size1 = size_s[2*sn_nb +1] ; */
Rawptr = self-> rawdatatokens->datatokens[ntok] +npj_reshifted*Size0*Size1;
// {
// int i,j;
// double sum=0;
// for(i=0; i<Size0; i++) {
// for(j=0; j< Size1; j++) {
// sum+=(Rawptr[i*Size1 +j]);
// }
// }
// printf("SUSUM INIZIO di ff %e\n", sum ) ;
// }
if(self->params.DZPERPROJ==0) {
long int posff_a = (long int) self->reading_infos.ff_indexes_coefficients[ 6*npj+0 ];
long int posff_b = (long int) self->reading_infos.ff_indexes_coefficients[ 6*npj+1 ];
......@@ -5706,6 +5718,17 @@ void CCspace_InterleavedReadingPreProcessing_chunk(CCspace * self ,int sn,int
current = 1.0;
}
// {
// int i,j;
// double sum=0;
// for(i=0; i<Size0; i++) {
// for(j=0; j< Size1; j++) {
// sum+=(Rawptr[i*Size1 +j]);
// }
// }
// printf("SUSUM PRIMA DI BACK %e\n", sum ) ;
// }
if(self->params.SUBTRACT_BACKGROUND ) {
......@@ -5743,7 +5766,7 @@ void CCspace_InterleavedReadingPreProcessing_chunk(CCspace * self ,int sn,int
}
}
}
}
}
if(self->params.TAKE_LOGARITHM) {
......@@ -6264,7 +6287,7 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
sem_wait( &(self->ff_sem) );
if( (sn/npbunches) != self->snXtoken[ntok] ) {
self->snXtoken[ntok] = (sn/npbunches) ;
for(k=0; k<self->reading_infos.ff_file_list_lenght; k++) {
for(k=0; k<self->reading_infos.NFF; k++) {
self->ff_read_status[ntok][k] = NOT_ACQUIRED;
}
}
......@@ -6416,8 +6439,6 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
}
} else if (strcmp(self->reading_infos.proj_reading_type , "h5")==0){
if(self->params.DZPERPROJ==0) {
read_data_from_h5( proj_file_list[ 0 ],
self->reading_infos.proj_h5_dsname,
my_proj_num_list[iread],
......@@ -6474,8 +6495,7 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
size_s_[2*sn_nb +0], size_s_[2*sn_nb +1],
rotation_vertical,
binning,
0, // multiplo
0.0, // threshold
self->params.DZPERPROJ,
Bptr,
self->params.CORRECT_FLATFIELD,
......@@ -6538,7 +6558,6 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
if( self->reading_infos.ff_file_list_lenght == 1 ) {
multiplo = 0 ;
}
read_data_from_h5(self->reading_infos.ff_file_list[ file_seq_pos ] ,
self->reading_infos.ff_h5_dsname,
posff - file_seq_pos ,
......@@ -7265,6 +7284,8 @@ void Paganin(CCspace * self, float * RawptrA,
self->gpu_is_apriori_usable = 1;
sem_wait( &(self->gpustat_pag_sem));
if( self->params.MYGPU ==-1 )
self->gpu_is_apriori_usable = 0;
if( self->gpu_is_apriori_usable) {
if(selfP->gpu_pag_context==NULL && self->params.TRYGPU){
......@@ -7316,7 +7337,14 @@ void Paganin(CCspace * self, float * RawptrA,
}
} else {
}
selfP->gpu_pag_context = ( Gpu_pag_Context*) malloc(sizeof(Gpu_pag_Context));
selfP->gpu_pag_context->gpuctx = NULL;
selfP->gpu_pag_context->inuse=0;
selfP->gpu_pag_context->gpu_pagCtx_initialised = 0;
selfP->gpu_pag_context->MYGPU = self->params.MYGPU ;
// selfP->gpu_pag_context->gpu_pagCtxCreate( selfP->gpu_pag_context ) ;
}
sem_post( &(self->gpustat_pag_sem));
......@@ -7480,12 +7508,12 @@ void Paganin(CCspace * self, float * RawptrA,
if(self->params.DO_OUTPUT_PAGANIN) {
char output_name[1000];
sprintf(output_name, "%s_%04d.edf",self->params.OUTPUT_PAGANIN_FILE, (int) mystart + npj - pstart );
sprintf(output_name, "%s_%04ld.edf",self->params.OUTPUT_PAGANIN_FILE, (int) mystart + npj - pstart );
if (self->params.verbosity>0) printf(" writing projection on %s \n", output_name);
write_data_to_edf(Rawptr , Size0, Size1 , output_name);
if(npj+1 <= pend-1 ) {
char output_name[1000];
sprintf(output_name, "%s_%04d.edf",self->params.OUTPUT_PAGANIN_FILE, (int) mystart + npj+1 - pstart );
sprintf(output_name, "%s_%04ld.edf",self->params.OUTPUT_PAGANIN_FILE, (int) mystart + npj+1 - pstart );
if (self->params.verbosity>0) printf(" writing projection on %s \n", output_name);
write_data_to_edf(Rawptr + proj_step , Size0, Size1 , output_name);
}
......
......@@ -86,6 +86,7 @@ typedef struct {
int ff_file_list_lenght;
char **ff_file_list;
float *ff_indexes_coefficients;
int NFF;
int * my_proj_num_list;
int * tot_proj_num_list;
int * proj_num_offset_list;
......
......@@ -1144,9 +1144,18 @@ Cspace_configure_readings(PyObject *self_a, PyObject *args)
INITIALISEARRAY2D( self->myCCspace->reading_infos.ff_indexes_coefficients , "ff_indexes_coefficients",
self->myCCspace->reading_infos.proj_file_list_lenght, 6, NPY_FLOAT32);
{
int NFF=0;
int i;
for( i=0; i< self->myCCspace->reading_infos.proj_file_list_lenght; i++) {
NFF = max(NFF,self->myCCspace->reading_infos.ff_indexes_coefficients[6*i+0] ) ;
NFF = max(NFF,self->myCCspace->reading_infos.ff_indexes_coefficients[6*i+1] ) ;
}
self->myCCspace->reading_infos.NFF = NFF+1 ;
}
if(self->myCCspace->params.CORRECT_FLATFIELD) {
if( self->myCCspace->params.STEAM_INVERTER==0) {
......
......@@ -415,7 +415,7 @@ void read_data_from_h5( char * filename,
dataspace = H5Dget_space(dataset);
rank = H5Sget_simple_extent_ndims(dataspace);
assert(rank==3);
// assert(rank==3);
hsize_t dims_out[rank];
H5Sget_simple_extent_dims( dataspace , dims_out , NULL );
......@@ -531,6 +531,14 @@ void read_data_from_h5_eli( char * filename,
assert(binning==1);
long int i, j ;
/* int dims[1],strides[1]; */
/* FILE *edffile; */
/* int res; */
for(i=0; i < size0; i++){
for(j=0; j < size1; j++){
target[i*size1+j]= NAN ;
......@@ -550,7 +558,7 @@ void read_data_from_h5_eli( char * filename,
int rank ;
float shift = iread * DZPERPROJ;
float shift = nproj * DZPERPROJ;
int ishift = ((int) shift);
shift = shift-ishift; // si assume dzperproj sempre positivo
pos0 = pos0 -ishift ;
......@@ -1062,7 +1070,27 @@ void read_data_from_edf_eli( char * filename,
/* memcpy( target_float, bufferF,size0*size1*sizeof(float) ); */
/* return; */
for(j=0; j<n1*binning; j++){
for(i=0; i< n2*binning; i++){
if((j+pos0_)>=0) {
if(Ddark) {
bufferF[j*n2*binning+i ] = (bufferF[j*n2*binning+i ] - Ddark[(j+pos0_)*Dim_1+i])/curr ;
} else {
bufferF[j*n2*binning+i ] = (bufferF[j*n2*binning+i ] )/ curr ;
}
if(correct_ff) {
float deno=1;
if(ff_infos[0]!=-1.0f) {
deno = FFs[0][ (j+pos0_)*Dim_1+i] ;
}
if(ff_infos[1]!=-1.0f) {
deno = FFs[1][ (j+pos0_)*Dim_1+i]*ff_infos[3] + ff_infos[2]*deno ;
}
bufferF[j*n2*binning+i ] /= deno;
}
}
}
}
if(doubleffcorrection) {
if(takelog ) {
......
......@@ -473,7 +473,6 @@ def get_proj_reading(preanalisi=0):
ff_file_list = []
ff_indexes_coefficients =[[-1 ,-1 , 0.0, 0.0,-1,-1]]*len(file_proj_num_list) # *len(my_proj_num_list)
## each proch irank will processes proj_mpi_numpjs[iproc] projections
# starting from Nproj = proj_mpi_offsets[irank]
......
......@@ -30,5 +30,5 @@
# is a problem for you.
#############################################################################*/
version = "tilt"
version = "h5eli"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment