Plot.MultiLineResampler

class MultiLineResampler(sampling=None)

A resampler for resampling data in a Plot-Density item. Works really well for data representing multiple intersecting lines.

This resampler is essential if the size of the saved plot should not explode.

Provide 1D x-data and an array of multiple line data e.g. 2D y-data, and perhaps some extra weights data in the same shape as the y-data.

The resampler then upsamples the data using sampling number of linear spaced points in the x-data.

Parameters:

sampling (int | NoneType) – The number of sampling points to use.

copy()

Make a copy of the plot storable by using the serialize/deserialize functionality.

This creates a new instance with a new id, but all other properties copied.

classmethod fromProperties(properties)

Create a plot storable from a dict of properties.

Used when deserializing a PlotStorable.

Parameters:

properties (dict) – The properties which are used to populate the properties dict of the newly created plot storable.

Returns:

The newly created PlotStorable.

Return type:

PlotStorable

resample(x_data, y_data, weights=None)

Resample the data.

Parameters:
  • x_data (PhysicalQauntity | ndarray) – The 1D x-data.

  • y_data (PhysicalQauntity | ndarray) – The 1D or 2D y-data.

  • weights (ndarray) – Optional weirhts

Returns:

The upsampled data.

Return type:

2 or 3-tuple of ndarrays

sampling()
Returns:

The sampling.

Return type:

int

setSampling(sampling)

Set the sampling.

Parameters:

sampling (int) – The sampling.