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/src/detgeom.c | |
parent | 7225ef12ff703a332a1eabf846151798357e219a (diff) |
Replace largest_q for detgeom
Diffstat (limited to 'libcrystfel/src/detgeom.c')
-rw-r--r-- | libcrystfel/src/detgeom.c | 43 |
1 files changed, 43 insertions, 0 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; +} |