diff options
author | Thomas White <taw@physics.org> | 2020-06-08 15:33:28 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:44 +0200 |
commit | c863d99144e6506320a557840f6ae37236a6a3c4 (patch) | |
tree | 4daae9a65be0e69d86352eeb9d73930fb8b748e5 /libcrystfel | |
parent | 7225ef12ff703a332a1eabf846151798357e219a (diff) |
Replace largest_q for detgeom
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/detgeom.c | 43 | ||||
-rw-r--r-- | libcrystfel/src/detgeom.h | 3 | ||||
-rw-r--r-- | libcrystfel/src/geometry.c | 4 |
3 files changed, 49 insertions, 1 deletions
diff --git a/libcrystfel/src/detgeom.c b/libcrystfel/src/detgeom.c index 7633ca54..772a620c 100644 --- a/libcrystfel/src/detgeom.c +++ b/libcrystfel/src/detgeom.c @@ -76,3 +76,46 @@ void detgeom_free(struct detgeom *detgeom) free(detgeom->panels); free(detgeom); } + + +static double panel_max_res(struct detgeom_panel *p, + double wavelength) +{ + double r[3]; + double max_res = 0.0; + + detgeom_transform_coords(p, 0, 0, wavelength, r); + max_res = biggest(max_res, modulus(r[0], r[1], r[2])); + + detgeom_transform_coords(p, 0, p->h, wavelength, r); + max_res = biggest(max_res, modulus(r[0], r[1], r[2])); + + detgeom_transform_coords(p, p->w, 0, wavelength, r); + max_res = biggest(max_res, modulus(r[0], r[1], r[2])); + + detgeom_transform_coords(p, p->w, p->h, wavelength, r); + max_res = biggest(max_res, modulus(r[0], r[1], r[2])); + + return max_res; +} + + +double detgeom_max_resolution(struct detgeom *detgeom, + double wavelength) +{ + int i; + double max_res = 0.0; + + for ( i=0; i<detgeom->n_panels; i++ ) { + + double panel_maxres; + + panel_maxres = panel_max_res(&detgeom->panels[i], + wavelength); + if ( panel_maxres > max_res ) { + max_res = panel_maxres; + } + } + + return max_res; +} diff --git a/libcrystfel/src/detgeom.h b/libcrystfel/src/detgeom.h index 67a33307..61106e32 100644 --- a/libcrystfel/src/detgeom.h +++ b/libcrystfel/src/detgeom.h @@ -103,6 +103,9 @@ extern void detgeom_transform_coords(struct detgeom_panel *p, extern void detgeom_free(struct detgeom *detgeom); +extern double detgeom_max_resolution(struct detgeom *detgeom, + double wavelength); + #ifdef __cplusplus } #endif diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c index 8518d026..0dbabcf2 100644 --- a/libcrystfel/src/geometry.c +++ b/libcrystfel/src/geometry.c @@ -506,6 +506,7 @@ RefList *predict_to_res(Crystal *cryst, double max_res) double mres; signed int h, k, l; UnitCell *cell; + struct image *image; cell = crystal_get_cell(cryst); if ( cell == NULL ) return NULL; @@ -522,7 +523,8 @@ RefList *predict_to_res(Crystal *cryst, double max_res) cell_get_cartesian(cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz); - mres = largest_q(crystal_get_image(cryst)); + image = crystal_get_image(cryst); + mres = detgeom_max_resolution(image->detgeom, image->lambda); if ( mres > max_res ) mres = max_res; hmax = mres * modulus(ax, ay, az); |