ess.bifrost.live.CutAxis#

class ess.bifrost.live.CutAxis(*, output, fn, bins)[source]#

Axis and bins for cutting 4D Q - delta E data.

Each axis defines a projection of the \(Q\) - \(\Delta E\) space onto a 1D line as well as bin edges on that line.

Examples

Cut along \(Q_x\): (see also CutAxis.from_q_vector())

>>> from ess.bifrost.live import CutAxis
>>> axis = CutAxis(
...     output='Qx',
...     fn=lambda sample_table_momentum_transfer: sc.dot(
...         sc.vector([1, 0, 0]),
...         sample_table_momentum_transfer,
...     ),
...     bins=sc.linspace(dim='Qx', start=-0.5, stop=0.5, num=100, unit='1/Å'),
... )

Cut along the norm \(|Q|\): (Note that sc.norm is wrapped in a lambda to use the proper name for the input coordinate, see CutAxis.fn.)

>>> axis = CutAxis(
...     output='|Q|',
...     fn=lambda sample_table_momentum_transfer: sc.norm(
...         sample_table_momentum_transfer
...     ),
...     bins=sc.linspace(dim='|Q|', start=-0.9, stop=3.0, num=100, unit='1/Å'),
... )

Cut along \(\Delta E\):

>>> axis = CutAxis(
...     output='E',
...     fn=lambda energy_transfer: energy_transfer,
...     bins=sc.linspace('E', -0.1, 0.1, 300, unit='meV')
... )
__init__(*, output, fn, bins)#

Methods

__init__(*, output, fn, bins)

from_q_vector(output, vec, bins)

Construct from an arbitrary direction in Q.

Attributes

output

Name of the output coordinate.

fn

Function to perform the cut.

bins

Bin edges for the cut.

bins: Variable#

Bin edges for the cut.

fn: Callable[..., Variable]#

Function to perform the cut.

Used in scipp.transform_coords() and so should request input coordinates by name.

classmethod from_q_vector(output, vec, bins)[source]#

Construct from an arbitrary direction in Q.

output: str#

Name of the output coordinate.