Commit 86c3e6ab authored by myron's avatar myron

OK

parent 97adf629
......@@ -435,6 +435,10 @@ void CCreading_infos_PrereadHeaders(CCreading_infos* self, int tryconstheader,
sizeofdatatype[FloatValue] =4;
sizeofdatatype[UnsignedShort]=2;
sizeofdatatype[SignedInteger]=4;
self->Dim_1 = 0;
self->Dim_2 = 0;
self->datatype = UnsignedShort;
if(file_list==self->proj_file_list) {
......@@ -6525,21 +6529,23 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
if(posff!=-1 && posff!=last_posFF[iff]) {
last_posFF[iff]=posff;
if( FF[iff]==NULL) {
FF[iff]= (float *) malloc( self->reading_infos.Dim_2*self->reading_infos.Dim_1 * sizeof(float));
FF[iff]= (float *) malloc( self->params.NUM_IMAGE_1* self->params.NUM_IMAGE_2 * sizeof(float) );
}
int file_seq_pos = min(self->reading_infos.ff_file_list_lenght-1, posff ) ;
int multiplo = 1 ;
if( self->reading_infos.ff_file_list_lenght == 1 ) {
multiplo = 0 ;
}
printf("FFFFFFFFFFFF VADO A LEGGER in pos %d %d %d %s \n", posff - file_seq_pos , posff , file_seq_pos , self->reading_infos.ff_file_list[file_seq_pos] );
read_data_from_h5(self->reading_infos.ff_file_list[file_seq_pos] ,
self->reading_infos.ff_h5_dsname,
posff - file_seq_pos ,
FF[iff] , // target_float
0 ,
0 ,
self->reading_infos.Dim_2 ,
self->reading_infos.Dim_1 ,
self->params.NUM_IMAGE_2,
self->params.NUM_IMAGE_1,
rotation_vertical,
binning,
multiplo,
......@@ -6558,7 +6564,6 @@ 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,
self->params.DZPERPROJ,
Bptr,
self->params.CORRECT_FLATFIELD,
......
......@@ -60,6 +60,14 @@ int cspace_iproc=0;
#include "numpy/arrayobject.h"
#define DEBUG(a) if(cspace_iproc==0) printf("%s \n", a);
#undef NDEBUG
#include<hdf5.h>
herr_t my_hdf5_error_handler (void *unused)
{
fprintf (stderr, "An HDF5 error was detected. Bye.\n");
exit (1);
}
/*
* The error object to expose
......@@ -395,6 +403,11 @@ Cspace_new( PyObject *self, PyObject *args)
char * CCD_FILTER_ptr;
char * RING_FILTER_ptr;
H5Eset_auto1 (my_hdf5_error_handler, NULL);
res= (Cspace*) PyObject_NEW(Cspace , &Cspacetype);
res->myCCspace = (CCspace*) malloc(sizeof( CCspace));
res->myCCspace->ff2_status = -1;
......
......@@ -379,7 +379,15 @@ void extended_fread( char *ptr, /* memory to write in */
}
}
}
herr_t my_hdf5_error_handler2 (void *unused)
{
fprintf (stderr, "An HDF5 error was detected. Bye.\n");
exit (1);
}
void read_data_from_h5( char * filename,
char * dsname,
......@@ -405,7 +413,9 @@ void read_data_from_h5( char * filename,
herr_t status;
int rank ;
H5Eset_auto1 (my_hdf5_error_handler2, NULL);
assert(binning==1);
printf(" reading %s dataset %s at nproj %d \n", filename, dsname, nproj ) ;
......@@ -431,6 +441,11 @@ void read_data_from_h5( char * filename,
offset[0] = nproj;
offset[1] = pos0;
offset[2] = pos1;
printf(" ofsets %d %d %d \n", nproj, pos0, pos1 ) ;
int v_span = 1;
if(multiplo) {
......@@ -438,6 +453,8 @@ void read_data_from_h5( char * filename,
}
printf(" count %d %d %d \n", v_span, size0 , size1 ) ;
count[0] = v_span ;
count[1] = size0;
count[2] = size1;
......@@ -448,6 +465,10 @@ void read_data_from_h5( char * filename,
/*
* descrive la memoria su cui scrivo
*/
printf(" dimsm %d %d %d \n", v_span, size0 , size1 ) ;
dimsm[0] = v_span;
dimsm[1] = size0;
dimsm[2] = size1 ;
......@@ -490,8 +511,8 @@ void read_data_from_h5( char * filename,
float line[v_span];
for( k = 0 ; k < v_span ; k++ ) {
line[ k ] = mytarget[ i + k * size0*size1 ] ;
target[ i ] = quickselect(line, 0, v_span -(v_span%2), (v_span -(v_span%2) -1 )/2 );
}
target[ i ] = quickselect(line, 0, v_span -(v_span%2), (v_span -(v_span%2) -1 )/2 );
}
if(threshold) {
CCD_Filter_Implementation( mytarget, target , size0 , size1 ,threshold , 1);
......@@ -580,6 +601,7 @@ void read_data_from_h5_eli( char * filename,
printf(" reading %s dataset %s at nproj %d \n", filename, dsname, nproj ) ;
file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
dataset = H5Dopen(file, dsname);
dataspace = H5Dget_space(dataset);
......@@ -592,12 +614,16 @@ void read_data_from_h5_eli( char * filename,
/*
* descrive quale parte del dataset leggo
*/
printf(" ofsets %d %d %d \n", nproj, pos0_clipped_, pos1 ) ;
offset[0] = nproj;
offset[1] = pos0_clipped_;
offset[2] = pos1;
int v_span = 1;
printf(" count %d %d %d \n", v_span, size0_clipped_-(pos0_clipped_-pos0_) , size1 ) ;
count[0] = v_span ;
......@@ -611,6 +637,10 @@ void read_data_from_h5_eli( char * filename,
* descrive la memoria su cui scrivo
*/
printf(" dimsm %d %d %d \n", v_span, size0_clipped_-(pos0_clipped_-pos0_) , size1 ) ;
dimsm[0] = v_span;
dimsm[1] = size0_clipped_-(pos0_clipped_-pos0_);
dimsm[2] = size1 ;
......
......@@ -392,15 +392,15 @@ def get_proj_reading(preanalisi=0):
file_list = [ P.FILE_PREFIX for i in file_proj_num_list]
########################################################
# proj_num_list will addresses projections pointed by a list
if P.DZPERPROJ!=0:
my_proj_num_list = numpy.array( seqnum_list )
else:
my_proj_num_list = numpy.arange(len(seqnum_list ))
# con elicoidale sara accompagnato da proj_num_offset_list
########################################################
# proj_num_list will addresses projections pointed by a list
if P.DZPERPROJ!=0:
my_proj_num_list = numpy.array( seqnum_list )
else:
my_proj_num_list = numpy.arange(len(seqnum_list ))
# con elicoidale sara accompagnato da proj_num_offset_list
if Parameters.VERBOSITY>2 :print( " DEBUG ", " my_proj_num_list " , my_proj_num_list[0], " ... ", my_proj_num_list[-1])
if Parameters.VERBOSITY>2 :print( " DEBUG ", " my_proj_num_list " , my_proj_num_list[0], " ... ", my_proj_num_list[-1])
if P.CORR_PROJ_FILE is not None:
......@@ -2870,7 +2870,7 @@ def create_arrays_space_as_dictionary(proj_reading_dict):
if Parameters.VERBOSITY>2 : print( " rawdatatokens " )
if Parameters.VERBOSITY>2 : print( dims)
rawdatatokens = [ numpy.zeros( dims ,"f") for i in range(ntokensraw) ]
rawdatatokens = [ numpy.zeros( dims ,"f") for i in range(ntokensraw) ]
ff_rawdatatokens = [ numpy.zeros(ff_dims ,"f") for i in range(ntokensraw) ]
dims = numpy.max(P.size_s, axis=0)
......
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