Skip to content

Commit

Permalink
Add oscillation fix for Scan.set_image_range. (#667)
Browse files Browse the repository at this point in the history
Add oscillation fix for Scan.set_image_range.
  • Loading branch information
toastisme authored Nov 20, 2023
1 parent 6883714 commit 5851627
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions newsfragments/667.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix oscillation not being set correctly in ``Scan.set_image_range``.
22 changes: 13 additions & 9 deletions src/dxtbx/model/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,19 +365,23 @@ namespace dxtbx { namespace model {
*/
image_range_ = image_range;
num_images_ = 1 + image_range_[1] - image_range_[0];
properties_.resize(num_images_);

// Edge case where num_images_ was 1 and has been increased
if (properties_.contains("oscillation_width") && num_images_ > 1) {
scitbx::af::shared<double> osc_width =
properties_.get<double>("oscillation_width");

vec2<double> osc = vec2<double>(get_oscillation()[0], osc_width[0]);
// Fix for dxtbx #497 for oscillation
if (properties_.contains("oscillation")) {
vec2<double> osc = get_oscillation();
properties_.resize(num_images_);
set_oscillation(osc);

// oscillation_width only needed when num_images_ == 1
dxtbx::af::flex_table_suite::delitem_column(properties_, "oscillation_width");
// Edge case where num_images_ was 1 and has been increased
if (properties_.contains("oscillation_width") && num_images_ > 1) {
// oscillation_width only needed when num_images_ == 1
dxtbx::af::flex_table_suite::delitem_column(properties_, "oscillation_width");
}
DXTBX_ASSERT(num_images_ > 0);
return;
}

properties_.resize(num_images_);
DXTBX_ASSERT(num_images_ > 0);
}

Expand Down

0 comments on commit 5851627

Please sign in to comment.