From c28092f7908dc88d1e8c4fe3efa3924fbe192051 Mon Sep 17 00:00:00 2001 From: Rick Kirian Date: Fri, 25 Mar 2011 16:24:19 +0100 Subject: calibrate_detector.c: work in progress --- src/stream.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/stream.c') diff --git a/src/stream.c b/src/stream.c index 0d315dcb..4d0a35bd 100644 --- a/src/stream.c +++ b/src/stream.c @@ -249,6 +249,9 @@ void write_chunk(FILE *ofh, struct image *i, int f) fprintf(ofh, "photon_energy_eV = %f\n", J_to_eV(ph_lambda_to_en(i->lambda))); + + //FIXME:we're writing camera length from first panel only. + //this should actually write camera length for all panels. fprintf(ofh, "camera_length = %f\n",i->det->panels[0].clen); if ( (f & STREAM_PEAKS) @@ -334,6 +337,20 @@ int read_chunk(FILE *fh, struct image *image) have_filename = 1; } + if ( strncmp(line, "camera_length = ",16) == 0 ) { + //FIXME: assuming here that we have loaded detector + //geometry into image prior to calling this routine. + //otherise, we don't know how many panels there are! + if ( !( image->det == NULL ) ) { + int k; + double clen; + clen = atof( line+16 ); + for ( k=0; k< image->det->n_panels; k++ ) { + image->det->panels[k].clen = clen; + } + } + } + if ( strncmp(line, "I0 = ", 5) == 0 ) { image->i0 = atof(line+5); image->i0_available = 1; -- cgit v1.2.3