diff options
author | Rick Kirian <rkirian@asu.edu> | 2011-03-30 14:25:53 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:23 +0100 |
commit | ce3e73de7ad45a268cce2cd7951a1a70b885aec4 (patch) | |
tree | ce2911862b206dd88600e08a392b11bf3ce39495 /src/detector.c | |
parent | fcb380ae630cabcde186f0050aafbb4ccdf79f7a (diff) |
detector.h: add function print_detector_geometry
Diffstat (limited to 'src/detector.c')
-rw-r--r-- | src/detector.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/detector.c b/src/detector.c index a202d5a3..76c3c96c 100644 --- a/src/detector.c +++ b/src/detector.c @@ -938,3 +938,60 @@ void get_pixel_extents(struct detector *det, } } + + +int print_detector_geometry(FILE * file, struct image * image) { + + struct panel * p; + int pi; + + if ( image == NULL ) return 1; + if ( file == NULL ) return 2; + if ( image->det->n_panels < 1 ) return 3; + + for (pi=0; pi<image->det->n_panels; pi++) { + + p = &(image->det->panels[pi]); + + if ( p == NULL ) return 4; + + fprintf(file,"%s/min_fs = %d\n",p->name,p->min_fs); + fprintf(file,"%s/min_ss = %d\n",p->name,p->min_ss); + fprintf(file,"%s/max_fs = %d\n",p->name,p->max_fs); + fprintf(file,"%s/max_ss = %d\n",p->name,p->max_ss); + fprintf(file,"%s/badrow_direction = %C\n",p->name,p->badrow); + fprintf(file,"%s/res = %g\n",p->name,p->res); + fprintf(file,"%s/peak_sep = %g\n",p->name,p->peak_sep); + fprintf(file,"%s/clen = %s\n",p->name,p->clen_from); + //FIXME: the following is sketchy, but it will work for now. we need + // to generalise the parser in detector.c + char coord; + char sign; + if (p->fsx != 0){ + if (p->fsx>0){sign='+';}else{sign='-';} + coord = 'x'; + } else { + if (p->fsy>0){sign='+';}else{sign='-';} + coord = 'y'; + } + fprintf(file,"%s/fs = %C%C\n",p->name, sign, coord); + if (p->ssx != 0){ + if (p->ssx>0){sign='+';}else{sign='-';} + coord = 'x'; + } else { + if (p->ssy>0){sign='+';}else{sign='-';} + coord = 'y'; + } + fprintf(file,"%s/ss = %C%C\n",p->name, sign, coord); + fprintf(file,"%s/corner_x = %g\n",p->name,p->cnx); + fprintf(file,"%s/corner_y = %g\n",p->name,p->cny); + fprintf(file,"%s/no_index = %d\n",p->name,p->no_index); + + } + + return 0; + +} + + + |