diff options
author | Thomas White <taw@physics.org> | 2020-07-10 15:49:35 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:45 +0200 |
commit | 0454d6debe414629d8f5da74347c0c833eff4159 (patch) | |
tree | cfcd0d3b991fc4ae6441e7e9adf5b9c6b5e42fad /libcrystfel | |
parent | 30973775e4bddba8ceebf4b93f58440cbb520617 (diff) |
Don't try to apply shift if no value is given
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/image.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index 52a7f5f5..349b8e20 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -415,6 +415,8 @@ void create_detgeom(struct image *image, const DataTemplate *dtempl) for ( i=0; i<dtempl->n_panels; i++ ) { + double shift_x, shift_y; + detgeom->panels[i].name = safe_strdup(dtempl->panels[i].name); detgeom->panels[i].pixel_pitch = dtempl->panels[i].pixel_pitch; @@ -430,8 +432,15 @@ void create_detgeom(struct image *image, const DataTemplate *dtempl) detgeom->panels[i].cnz /= detgeom->panels[i].pixel_pitch; /* Apply overall shift (already in m) */ - detgeom->panels[i].cnx += get_length(image, dtempl->shift_x_from, 1.0); - detgeom->panels[i].cny += get_length(image, dtempl->shift_y_from, 1.0); + shift_x = get_length(image, dtempl->shift_x_from, 1.0); + shift_y = get_length(image, dtempl->shift_y_from, 1.0); + + if ( !isnan(shift_x) ) { + detgeom->panels[i].cnx += shift_x; + } + if ( !isnan(shift_y) ) { + detgeom->panels[i].cny += shift_y; + } detgeom->panels[i].max_adu = dtempl->panels[i].max_adu; |