From ce3e73de7ad45a268cce2cd7951a1a70b885aec4 Mon Sep 17 00:00:00 2001 From: Rick Kirian Date: Wed, 30 Mar 2011 14:25:53 +0200 Subject: detector.h: add function print_detector_geometry --- src/detector.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'src/detector.c') 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; pidet->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; + +} + + + -- cgit v1.2.3