pyxc.core.layer

Module Contents

Classes

Layer

Manage a data container and transformation object.

Attributes

LAYERS

pyxc.core.layer.LAYERS
class pyxc.core.layer.Layer(data, dataloader: Type[pyxc.core.loader.DataLoaderBase], transformer: Type[pyxc.transform.transform_base.TransformationBase], container: Type[pyxc.core.container.Container2D] = Container2D, name: str | None = None, parent: Layer | None = None, layer_manager: pyxc.core.layer_manager.LayerRegistry | None = LAYERS, **kwargs)[source]

Bases: object

Manage a data container and transformation object.

Parameters:
dataarray_like

Data to be stored in the layer.

dataloaderCallable

Function to load the data into the container.

transformerHomography | Affine2D

Transformation class for the layer.

containerContainer2D, optional

Container class to hold the data. Default is Container2D.

namestr, optional

Name for the layer. Default is None.

parentLayer, optional

Parent Layer to inherit transformations from. Default is None.

layer_managerLayerRegistry, optional

LayerRegistry instance to manage the layer. Default is None.

**kwargsdict, optional

Additional parameters to be passed to the container.

Attributes:
is_transformedbool

Indicates whether the layer has been calibrated.

managerLayerRegistry, optional

A reference to the layer registry.

transformerHomography | Affine2D

An instance of a transformation object.

parentLayer, optional

A reference to the parent Layer, if one exists.

containerContainer2D

Container for the data.

Methods

apply_transformation(self)

Apply the transformation to the raw x and y coordinates in the container.

get_x(self, interval=None)

Return the x-coordinates, applying transformation if not already done.

get_y(self, interval=None)

Return the y-coordinates, applying transformation if not already done.

get_xy(self, interval=None)

Return the x and y-coordinates, applying transformation if not already done.

get_x_raw(self, interval=None)

Return the raw x-coordinates.

get_y_raw(self, interval=None)

Return the raw y-coordinates.

get_xy_raw(self, interval=None)

Return the raw x and y-coordinates.

get_data(self, interval=None)

Return the data at a specified interval.

query(self, x, y, cutoff=1, output_number=1, reducer=None, idx=None)

Return the data at a query point (x, y) within the cutoff distance.

execute_queries(self, xs, ys, cutoff=1, output_number=1, reducer=None, max_workers=-1)

Execute multiple queries in parallel using lists of x and y coordinates.

_integrity_check(self)

Check the integrity of the layer by verifying the container’s validity.

set_parent(self, layer_object)

Set a parent for this layer.

property x_raw: numpy.ndarray
property y_raw
property xy_raw
property x
property y
property xy
reset_tree() NoReturn[source]

Reset the cKDTree in the current object.

build_tree() NoReturn[source]

Build a cKDTree for the nearest neighbour calculations.

get_layer_manager() pyxc.core.layer_manager.LayerRegistry[source]
apply_transformation() NoReturn[source]

Apply the transformation to the raw x and y coordinates in the container and mark the layer as transformed.

get_x(interval: int | None = None) numpy.ndarray[source]
get_y(interval: int | None = None) numpy.ndarray[source]
get_xy(interval: int | None = None) numpy.ndarray[source]
get_x_raw(interval: int | None = None) numpy.ndarray[source]
get_y_raw(interval: int | None = None) numpy.ndarray[source]
get_xy_raw(interval: int | None = None) numpy.ndarray[source]
query(x: float, y: float, cutoff: float = 1, output_number: int = 1, reducer: pyxc.core.processor.reducer.Reducer = None, idx: int | None = None) numpy.ndarray[source]

Execute a single query with given x and y coordinates.

Parameters:
xfloat

The x-coordinate for the query.

yfloat

The y-coordinate for the query.

cutofffloat, optional

The maximum distance from the query point to consider data.

output_numberint, optional

The number of closest points to return for the query.

reducerReducer, optional

Reducer object to reduce multiple query results into a single result.

idxint | None, optional

The index of the query. This option is used when executing multiple queries in parallel by the execute_queries method. This parameter is obsolete for single query execution.

Returns:
np.ndarray

An array of query results, sorted by the original index of the query.

execute_queries(xs: list[float], ys: list[float], cutoff: float = 1, output_number: int = 1, reducer: pyxc.core.processor.reducer.Reducer | None = None, **kwargs) numpy.ndarray[source]

Execute multiple queries in parallel, given lists of x and y coordinates.

Parameters:
xslist[float]

List of x coordinates for queries.

yslist[float]

List of y coordinates for queries.

cutofffloat, optional

The maximum distance from the query point to consider data.

output_numberint, optional

The number of closest points to return for each query.

reducerReducer, optional

Reducer object to reduce multiple query results into a single result.

**kwargsdict, optional

Additional parameters to be passed to the ThreadPoolExecutor.

Returns:
np.ndarray

An array of query results, sorted by the original index of the query.

set_parent(layer_object: Type[Layer]) NoReturn[source]

Set a parent for this layer. The parent’s transformation is also set to this layer’s transformer’s parent.

Parameters:
layer_objectLayer

The parent Layer to be set.

Raises:
TypeError

If layer_object is not an instance of Layer.

set_transformation_matrix(transformation_matrix) NoReturn[source]

Set the transformation matrix for the layer.

Parameters:
transformation_matrixnp.ndarray

The transformation matrix to be set.

Notes

..deprecated:: 1.0.0

This method will be removed in PyXC 2.0.0.