pyspinw.path#

Paths through q-space.

Classes

EmpiricalPath1D(q_values)

Path based on data specifying each q value, rather than min, max, n.

Path(points[, n_points_per_segment, labels, ...])

Path through q-space.

Path1D([q_min, q_max, avoid_endpoints, n_q])

1D path, i.e. just values in absolute q.

Path1DBase()

Base class for 1D paths.

Slice([origin, axis_1, axis_2, n_a, n_b, ...])

A 2D rectangular slice through reciprocal space.

class pyspinw.path.EmpiricalPath1D(q_values: ArrayLike)#

Bases: Path1DBase

Path based on data specifying each q value, rather than min, max, n.

q_values()#

Get the q values.

class pyspinw.path.Path(points: ArrayLike, n_points_per_segment: int = 101, labels: list[str] | None = None, avoid_endpoints=True, scale_by_distance=False, convert_to_lattice_units_with: Structure | UnitCell | None = None)#

Bases: object

Path through q-space.

format_plot(plt_or_fig=None)#

Apply formatting to a matplotlib plot/figure/axis.

If None, it will import matplotlib.pyplot and work on that.

q_points()#

Get the list of q-points along the path.

x_tick_labels()#

Get the x-axis tick labels corresponding to the tick positions.

x_ticks()#

Get the x positions of ticks used to mark positions on a plot.

x_values()#

Get the x values used for plotting.

class pyspinw.path.Path1D(q_min: float = 0.0, q_max: float = 1.0, avoid_endpoints=True, n_q: int = 101)#

Bases: Path1DBase

1D path, i.e. just values in absolute q.

q_values()#

Get the q magnitudes.

class pyspinw.path.Path1DBase#

Bases: ABC

Base class for 1D paths.

abstractmethod q_values()#

Get the q values for this path.

class pyspinw.path.Slice(origin: ArrayLike | None = None, axis_1: ArrayLike | None = None, axis_2: ArrayLike | None = None, n_a: int = 101, n_b: int = 101, labels: list[str] | None = None, padding: float = 0.0, e_min: float | None = None, e_max: float | None = None)#

Bases: object

A 2D rectangular slice through reciprocal space.

Parameters:
  • origin – Corner point of the rectangle as a 3D q-vector.

  • axis_1 – First edge vector, defining the horizontal plotting axis.

  • axis_2 – Second edge vector, defining the vertical plotting axis.

  • n_a – Number of points along axis_1.

  • n_b – Number of points along axis_2.

  • labels – Optional [a_label, b_label] for the plot axes.

  • padding – Extra padding beyond the slice boundaries as a fraction of the slice size (e.g. 0.1 extends the slice by 10% on each side).

  • e_min – Optional minimum energy in meV for the intensity_map() integration window.

  • e_max – Optional maximum energy in meV for the intensity_map() integration window.

extent() → list[float]#

Get the parameter-space extent [s_min, s_max, t_min, t_max].

format_plot(plt_or_fig=None)#

Apply axis labels and reciprocal-space ticks to a matplotlib target.

Sets both axis labels and ticks with corresponding tick labels showing actual reciprocal space coordinates.

If None, it will import matplotlib.pyplot and work on that.

grid_shape()#

Get the grid shape (n_a, n_b) for reshaping flattened results.

First dimension corresponds to axis_1 (horizontal), second to axis_2 (vertical).

q_points() → ndarray#

Get all q-points in the slice as an (n_a * n_b, 3) array.

x_tick_labels()#

Get the x-axis tick labels as (hkl) q-vectors.

x_ticks()#

Get the x-axis tick positions along the axis_1 direction.

y_tick_labels()#

Get the y-axis tick labels as (hkl) q-vectors.

y_ticks()#

Get the y-axis tick positions along the axis_2 direction.