aboutsummaryrefslogtreecommitdiff
path: root/src/stream.c
diff options
context:
space:
mode:
authorRick Kirian <rkirian@asu.edu>2011-03-25 16:24:19 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:23 +0100
commitc28092f7908dc88d1e8c4fe3efa3924fbe192051 (patch)
treecc773c3de69f27b73e6e77eba354a92c08012217 /src/stream.c
parent1d7c4d838224b4ac7e61453454b5164d9878211a (diff)
calibrate_detector.c: work in progress
Diffstat (limited to 'src/stream.c')
-rw-r--r--src/stream.c17
1 files changed, 17 insertions, 0 deletions
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;