def test_check_and_fail(tc): # There are 823 reflections assert len(tc.refman.get_matches()) == 823 # The parameters affecting the smallest number of reflections are # g_param_0, g_param_3 and g_param_4, all of which have gradients for # 792 reflections. Setting 792 reflections as the minimum should pass. options = ar_phil_scope.extract() options.min_nref_per_parameter = 792 ar = AutoReduce(options, pred_param=tc.pred_param, reflection_manager=tc.refman) ar.check_and_fail() # Setting 793 reflections as the minimum should fail options.min_nref_per_parameter = 793 ar = AutoReduce(options, pred_param=tc.pred_param, reflection_manager=tc.refman) with pytest.raises(DialsRefineConfigError): ar.check_and_fail()
def test_check_and_fail(tc): # There are 823 reflections and the detector parameterisation has 6 free # parameters assert len(tc.refman.get_matches()) == 823 assert tc.det_param.num_free() == 6 # Setting 137 reflections as the minimum should pass (137*6<823) options = ar_phil_scope.extract() options.min_nref_per_parameter = 137 ar = AutoReduce( options, [tc.det_param], [tc.s0_param], [tc.xlo_param], [tc.xluc_param], gon_params=[], reflection_manager=tc.refman, ) ar.check_and_fail() # Setting 138 reflections as the minimum should fail (138*6>823) options.min_nref_per_parameter = 138 ar = AutoReduce( options, [tc.det_param], [tc.s0_param], [tc.xlo_param], [tc.xluc_param], gon_params=[], reflection_manager=tc.refman, ) with pytest.raises(DialsRefineConfigError): ar.check_and_fail()