Skip to content

Commit

Permalink
Merge pull request #868 from mantidproject/release-next
Browse files Browse the repository at this point in the history
Merge release-next into main for release
  • Loading branch information
SilkeSchomann authored Feb 23, 2023
2 parents b963cbd + 219e7ca commit 3275a6d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mslice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
on Mantid (http://www.mantidproject.org).
"""

version_info = (2, 5, 0)
version_info = (2, 6, 0)
__version__ = '.'.join(map(str, version_info))
__project_url__ = 'https://github.com/mantidproject/mslice'
4 changes: 2 additions & 2 deletions mslice/models/cut/cut.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from mslice.models.intensity_correction_algs import (compute_chi, compute_d2sigma,
compute_symmetrised, cut_compute_gdos)
from mslice.models.labels import is_momentum, is_twotheta
from mslice.models.labels import are_units_equivalent, is_momentum, is_twotheta
from mslice.util.intensity_correction import IntensityType

import numpy as np
Expand Down Expand Up @@ -227,7 +227,7 @@ def q_axis(self):

def _update_cut_axis(self):
x_dim = self._cut_ws.raw_ws.getXDimension()
if self.cut_axis.units == x_dim.getUnits() or self.cut_axis.units in x_dim.getDimensionId():
if are_units_equivalent(self.cut_axis.units, x_dim.getUnits()) or self.cut_axis.units in x_dim.getDimensionId():
ws_cut_axis = x_dim
else:
ws_cut_axis = self._cut_ws.raw_ws.getYDimension()
Expand Down
15 changes: 15 additions & 0 deletions mslice/models/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ def is_momentum(unit):
return any([unit in val for val in MOMENTUM_UNITS])


def is_energy(unit):
return unit == DELTA_E_LABEL


def are_units_equivalent(unit_lhs, unit_rhs):
if is_twotheta(unit_lhs) and is_twotheta(unit_rhs):
return True
elif is_momentum(unit_lhs) and is_momentum(unit_rhs):
return True
elif is_energy(unit_lhs) and is_energy(unit_rhs):
return True
else:
return False


def get_recoil_key(label):
for key, value in recoil_labels.items():
if value == label:
Expand Down

0 comments on commit 3275a6d

Please sign in to comment.