diff options
-rw-r--r-- | src/index.c | 2 | ||||
-rw-r--r-- | src/index.h | 4 | ||||
-rw-r--r-- | src/peaks.c | 18 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/index.c b/src/index.c index 4191ca0b..62d63d06 100644 --- a/src/index.c +++ b/src/index.c @@ -29,7 +29,7 @@ /* x,y in pixels relative to central beam */ -static int map_position(struct image *image, double x, double y, +int map_position(struct image *image, double x, double y, double *rx, double *ry, double *rz) { /* "Input" space */ diff --git a/src/index.h b/src/index.h index 3f92b96b..076d9fe2 100644 --- a/src/index.h +++ b/src/index.h @@ -21,5 +21,9 @@ extern void index_pattern(struct image *image, int no_index, int dump_peaks, int use_dirax); +/* x,y in pixels relative to central beam */ +extern int map_position(struct image *image, double x, double y, + double *rx, double *ry, double *rz); + #endif /* INDEX_H */ diff --git a/src/peaks.c b/src/peaks.c index d414c912..9722f125 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -22,6 +22,7 @@ #include "image.h" #include "utils.h" +#include "index.h" #define PEAK_WINDOW_SIZE (10) @@ -192,6 +193,10 @@ void search_peaks(struct image *image, int dump_peaks) } image->features = image_feature_list_new(); + if ( dump_peaks ) { + printf("x/px\ty/px\tq/nm^-1\tPeak I\n"); + } + for ( x=1; x<image->width-1; x++ ) { for ( y=1; y<image->height-1; y++ ) { @@ -274,7 +279,18 @@ void search_peaks(struct image *image, int dump_peaks) /* Map and record reflection */ if ( dump_peaks ) { - printf("%i %i\n", x, y); + + double q, rx, ry, rz; + + map_position(image, mask_x, mask_y, + &rx, &ry, &rz); + + + q = modulus(rx, ry, rz); + + printf("%i\t%i\t%f\t%i\n", x, y, q/1.0e9, + data[mask_x+width*mask_y]); + } image_add_feature(image->features, |