sm_bluesky.common.math#

Members

cal_range_num

Calculate the start, end and the number of steps for a scan.

edges_from_centres

Cell edges halfway between nearest point centres.

step_size_to_step_num

Quick conversion to step from step size.

to_float

Convert to a finite float, or None if that is not possible.

binned_axis

Evenly spaced cells, for an axis that moves continuously (fast scans).

extract_xyz

Pull (x, y, z) out of a dictionary of data.

grid_heatmap

Bin scattered (x, y, z) points into a NxM matrix for pcolormesh to draw.

unique_axis

One cell per distinct position.

sm_bluesky.common.math.cal_range_num(cen: float, range: float, size: float) → tuple[float, float, int][source]#

Calculate the start, end and the number of steps for a scan.

sm_bluesky.common.math.edges_from_centres(centres: list[float]) → list[float][source]#

Cell edges halfway between nearest point centres.

sm_bluesky.common.math.step_size_to_step_num(start: float, end: float, step_size: float) → int[source]#

Quick conversion to step from step size.

Parameters:
  • start (float) – Starting position.

  • end (float) – Ending position.

  • step_size (float) – Step size.

Returns:

Number of steps.

Return type:

int

sm_bluesky.common.math.to_float(value: Any) → float | None[source]#

Convert to a finite float, or None if that is not possible.

sm_bluesky.common.math.binned_axis(values: list[float], n_bins: int) → tuple[list[float], list[int]][source]#

Evenly spaced cells, for an axis that moves continuously (fast scans).

sm_bluesky.common.math.extract_xyz(scan_data: dict[str, list[Any]], x_field: str | None, y_field: str | None, z_field: str | None) → tuple[list[float], list[float], list[float]][source]#

Pull (x, y, z) out of a dictionary of data.

sm_bluesky.common.math.grid_heatmap(xs: list[float], ys: list[float], zs: list[float]) → tuple[list[float], list[float], Any] | None[source]#

Bin scattered (x, y, z) points into a NxM matrix for pcolormesh to draw.

sm_bluesky.common.math.unique_axis(values: list[float]) → tuple[list[float], list[int]][source]#

One cell per distinct position.