From 6309221fcc3c573cdb20a7c953b8964fb85f78c5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 7 Apr 2016 17:36:57 +0200 Subject: No more slab-relative coordinates in libcrystfel --- libcrystfel/src/integration.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'libcrystfel/src/integration.c') diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c index 7380f836..d50f8d6b 100644 --- a/libcrystfel/src/integration.c +++ b/libcrystfel/src/integration.c @@ -3,11 +3,11 @@ * * Integration of intensities * - * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2016 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2010-2014 Thomas White + * 2010-2016 Thomas White * * This file is part of CrystFEL. * @@ -271,8 +271,8 @@ static void show_peak_box(struct intcontext *ic, struct peak_box *bx, get_indices(bx->refl, &h, &k, &l); get_detector_pos(bx->refl, &fs, &ss); /* Convert coordinates to match arrangement of panels in HDF5 file */ - fs = fs - bx->p->min_fs + bx->p->orig_min_fs; - ss = ss - bx->p->min_ss + bx->p->orig_min_ss; + fs = fs + bx->p->orig_min_fs; + ss = ss + bx->p->orig_min_ss; printw("Indices %i %i %i\nPanel %s\nPosition fs = %.1f, ss = %.1f\n\n", h, k, l, bx->p->name, fs, ss); @@ -1280,6 +1280,12 @@ static void setup_profile_boxes(struct intcontext *ic, RefList *list) set_redundancy(refl, 0); get_detector_pos(refl, &pfs, &pss); + p = get_panel(refl); + pn = panel_number(ic->image->det, p); + if ( pn == ic->image->det->n_panels ) { + ERROR("Couldn't find panel %p\n", p); + continue; + } /* Explicit truncation of digits after the decimal point. * This is actually the correct thing to do here, not @@ -1289,12 +1295,11 @@ static void setup_profile_boxes(struct intcontext *ic, RefList *list) * belongs to pixel index 2. */ fid_fs = pfs; fid_ss = pss; - pn = find_panel_number(ic->image->det, fid_fs, fid_ss); - p = &ic->image->det->panels[pn]; - cfs = (fid_fs-p->min_fs) - ic->halfw; - css = (fid_ss-p->min_ss) - ic->halfw; + cfs = fid_fs - ic->halfw; + css = fid_ss - ic->halfw; + /* Add the box */ bx = add_box(ic); bx->refl = refl; bx->cfs = cfs; @@ -1414,6 +1419,12 @@ static void integrate_rings_once(Reflection *refl, struct image *image, set_redundancy(refl, 0); get_detector_pos(refl, &pfs, &pss); + p = get_panel(refl); + pn = panel_number(image->det, p); + if ( pn == image->det->n_panels ) { + ERROR("Couldn't find panel %p\n", p); + return; + } /* Explicit truncation of digits after the decimal point. * This is actually the correct thing to do here, not @@ -1423,11 +1434,9 @@ static void integrate_rings_once(Reflection *refl, struct image *image, * belongs to pixel index 2. */ fid_fs = pfs; fid_ss = pss; - pn = find_panel_number(image->det, fid_fs, fid_ss); - p = &image->det->panels[pn]; - cfs = (fid_fs-p->min_fs) - ic->halfw; - css = (fid_ss-p->min_ss) - ic->halfw; + cfs = fid_fs - ic->halfw; + css = fid_ss - ic->halfw; bx = add_box(ic); bx->refl = refl; -- cgit v1.2.3