Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 14, 2024
1 parent fc1a657 commit 123625d
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/dials/algorithms/scaling/scaleit.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -52,24 +55,25 @@ 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"]
t2["intensity.sum.value"] = t2["intensity"]
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")
print("done")

0 comments on commit 123625d

Please sign in to comment.