Skip to content

Commit

Permalink
Remove deprecated code (#347)
Browse files Browse the repository at this point in the history
Remove deprecated classes (previously deprecated in #302)
  dxtbx.datablock.*Diff
  dxtbx.model.experiment_list.SequenceDiff

Remove deprecated function (previously deprecated in #316)
  dxtbx.serialize.load.imageset_from_string
  • Loading branch information
Anthchirp authored Apr 23, 2021
1 parent 107b62c commit 002bd46
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 136 deletions.
115 changes: 1 addition & 114 deletions datablock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import libtbx

import dxtbx.imageset
import dxtbx.model.compare
import dxtbx.model
from dxtbx.format.FormatMultiImage import FormatMultiImage
from dxtbx.format.image import ImageBool, ImageDouble
from dxtbx.format.Registry import get_format_class_for_file
Expand Down Expand Up @@ -930,116 +930,3 @@ def __call__(self, a, b):
fixed_rotation_tolerance=self.fixed_rotation_tolerance,
setting_rotation_tolerance=self.setting_rotation_tolerance,
)


class BeamDiff:
def __init__(
self,
wavelength_tolerance=1e-6,
direction_tolerance=1e-6,
polarization_normal_tolerance=1e-6,
polarization_fraction_tolerance=1e-6,
):
warnings.warn(
"dxtbx.datablock.BeamDiff is deprecated. "
"Use dxtbx.model.compare.beam_diff instead",
DeprecationWarning,
stacklevel=2,
)
self.wavelength_tolerance = wavelength_tolerance
self.direction_tolerance = direction_tolerance
self.polarization_normal_tolerance = polarization_normal_tolerance
self.polarization_fraction_tolerance = polarization_fraction_tolerance

def __call__(self, a, b):
return dxtbx.model.compare.beam_diff(
a,
b,
wavelength_tolerance=self.wavelength_tolerance,
direction_tolerance=self.direction_tolerance,
polarization_normal_tolerance=self.polarization_normal_tolerance,
polarization_fraction_tolerance=self.polarization_fraction_tolerance,
).split("\n")


class DetectorDiff:
def __init__(
self, fast_axis_tolerance=1e-6, slow_axis_tolerance=1e-6, origin_tolerance=1e-6
):
warnings.warn(
"dxtbx.datablock.DetectorDiff is deprecated. "
"Use dxtbx.model.compare.detector_diff instead",
DeprecationWarning,
stacklevel=2,
)
self.fast_axis_tolerance = fast_axis_tolerance
self.slow_axis_tolerance = slow_axis_tolerance
self.origin_tolerance = origin_tolerance

def __call__(self, a, b):
return dxtbx.model.compare.detector_diff(
a,
b,
fast_axis_tolerance=self.fast_axis_tolerance,
slow_axis_tolerance=self.slow_axis_tolerance,
origin_tolerance=self.origin_tolerance,
).split("\n")


class GoniometerDiff:
def __init__(
self,
rotation_axis_tolerance=1e-6,
fixed_rotation_tolerance=1e-6,
setting_rotation_tolerance=1e-6,
):
warnings.warn(
"dxtbx.datablock.GoniometerDiff is deprecated. "
"Use dxtbx.model.compare.goniometer_diff instead",
DeprecationWarning,
stacklevel=2,
)
self.rotation_axis_tolerance = rotation_axis_tolerance
self.fixed_rotation_tolerance = fixed_rotation_tolerance
self.setting_rotation_tolerance = setting_rotation_tolerance

def __call__(self, a, b):
return dxtbx.model.compare.goniometer_diff(
a,
b,
rotation_axis_tolerance=self.rotation_axis_tolerance,
fixed_rotation_tolerance=self.fixed_rotation_tolerance,
setting_rotation_tolerance=self.setting_rotation_tolerance,
).split("\n")


class ScanDiff:
def __init__(self, scan_tolerance=0.03):
warnings.warn(
"dxtbx.datablock.ScanDiff is deprecated. "
"Use dxtbx.model.compare.scan_diff instead",
DeprecationWarning,
stacklevel=2,
)
self.scan_tolerance = scan_tolerance

def __call__(self, a, b):
return dxtbx.model.compare.scan_diff(
a, b, scan_tolerance=self.scan_tolerance
).split("\n")


class SequenceDiff:
def __init__(self, tolerance):
warnings.warn(
"dxtbx.datablock.SequenceDiff is deprecated. "
"Use dxtbx.model.compare.sequence_diff instead",
DeprecationWarning,
stacklevel=2,
)
self._tolerance = tolerance

def __call__(self, sequence1, sequence2):
return dxtbx.model.compare.sequence_diff(
sequence1, sequence2, tolerance=self._tolerance
).split("\n")
2 changes: 0 additions & 2 deletions model/experiment_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
DataBlockTemplateImporter,
DetectorComparison,
GoniometerComparison,
SequenceDiff,
)
from dxtbx.format.Format import Format
from dxtbx.format.FormatMultiImage import FormatMultiImage
Expand Down Expand Up @@ -59,7 +58,6 @@
"DetectorComparison",
"ExperimentListFactory",
"GoniometerComparison",
"SequenceDiff",
]


Expand Down
1 change: 1 addition & 0 deletions newsfragments/347.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove classes and functions deprecated in the previous release: ``dxtbx.datablock.*Diff``, ``dxtbx.model.experiment_list.SequenceDiff``, ``dxtbx.serialize.load.imageset_from_string``.
20 changes: 0 additions & 20 deletions serialize/load.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
import json
import os
import warnings

from dxtbx.model.crystal import CrystalFactory
from dxtbx.serialize.imageset import imageset_from_dict


def imageset_from_string(string, directory=None):
"""Load the string and return the models.
Params:
string The JSON string to load
Returns:
The models
"""
warnings.warn(
"This function is deprecated and will be removed in the next release",
DeprecationWarning,
stacklevel=2,
)

return imageset_from_dict(json.loads(string), directory=directory)


def imageset(filename):
"""Load the given JSON file.
Expand Down

0 comments on commit 002bd46

Please sign in to comment.