Open dagewa opened 2 years ago
I'm not sure what the point of the assert is here. It seems to be checking that the polarisation normal and the direction is orthogonal, but why do that here and not when creating the beam. Also, this is an unpolarised beam model.
Further to this, when dials.refine
changes a beam model it does so through the set_s0
method. This does not update the polarisation vector, which is probably how we can get into the above situation in the first place.
Keeping this open, because there is a dxtbx issue in that using set_s0
allows one to set an inconsistent beam model, by not adjusting the polarisation normal vector.
In general, the Beam
constructors allow setting the s0
vector arbitrarily, while setting the polarisation normal along +Y
https://github.com/cctbx/dxtbx/blob/20d4cf201afe4465e0d01bbfb50dfb688b33b463/src/dxtbx/model/beam.h#L115-L125
This allows for the construction of physically inconsistent models.
Note this problem affects files used in tests. Loading experiments from $(dials.data get -q l_cysteine_4_sweeps_scaled)/scaled_35.expt
, then the beam cannot be rotated:
>>> beam.rotate_around_origin((1,0,0), 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: dxtbx Internal Error: /home/fcx32934/sw/cctbx/modules/dxtbx/src/dxtbx/model/beam.h(373): DXTBX_ASSERT(std::abs(direction_ * polarization_normal_) < EPS) failure.
this is because that file dates from before when #1939 was merged.
I have a beam model:
that will not rotate: