diff --git a/src/dials/algorithms/scaling/scaleit.py b/src/dials/algorithms/scaling/scaleit.py index ef736c06b73..f1c2835e623 100644 --- a/src/dials/algorithms/scaling/scaleit.py +++ b/src/dials/algorithms/scaling/scaleit.py @@ -1,29 +1,32 @@ +from __future__ import annotations + mtz1 = "merged_3.mtz" mtz2 = "merged_1.mtz" expts = "scaled.expt" anomalous = False -from dials.array_family import flex from dxtbx.model import Experiment, ExperimentList -from dials.util.reference import intensities_from_reference_data_file -from iotbx.mtz.crystal_symmetry_from_mtz import extract_from -from dxtbx.model import Crystal -from iotbx import mtz from dxtbx.serialize import load + +from dials.array_family import flex +from dials.util.reference import intensities_from_reference_data_file + elist = load.experiment_list(expts) +import logging from copy import deepcopy -from unittest.mock import Mock -from dials.algorithms.scaling.model.model import KBScalingModel + from dxtbx.util import ersatz_uuid4 +from libtbx import phil -from dials.util.options import ArgumentParser -from libtbx import Auto, phil -import logging +from dials.algorithms.scaling.model.model import KBScalingModel from dials.util import log +from dials.util.options import ArgumentParser + log.config() logger = logging.getLogger("dials") + def datafiles_from_mtz(mtzfile, id_=0): intensities = intensities_from_reference_data_file(mtzfile) if anomalous: @@ -52,14 +55,15 @@ def datafiles_from_mtz(mtzfile, id_=0): params.model = "KB" params.KB.decay_correction = False expt.scaling_model = KBScalingModel.from_data(params, [], []) - #expt.scaling_model.set_scaling_model_as_scaled() # Set as scaled to fix scale. + # expt.scaling_model.set_scaling_model_as_scaled() # Set as scaled to fix scale. expt.identifier = ersatz_uuid4() table.experiment_identifiers()[id_] = expt.identifier return table, expt -t1,e1 = datafiles_from_mtz(mtz1, 0) + +t1, e1 = datafiles_from_mtz(mtz1, 0) e1 = ExperimentList([e1]) -t2,e2 = datafiles_from_mtz(mtz2, 1) +t2, e2 = datafiles_from_mtz(mtz2, 1) e2 = ExperimentList([e2]) t1["intensity.sum.value"] = t1["intensity"] t1["intensity.sum.variance"] = t1["variance"] @@ -67,9 +71,9 @@ def datafiles_from_mtz(mtzfile, id_=0): t2["intensity.sum.variance"] = t2["variance"] from dials.algorithms.scaling.scaling_library import scale_against_target -result = scale_against_target(t1,e1,t2,e2) +result = scale_against_target(t1, e1, t2, e2) print(e1.scaling_models()[0].to_dict()) print(e1.scaling_models()[1].to_dict()) -print("done") \ No newline at end of file +print("done")