pyxc.core.layer
Module Contents
Classes
Manage a data container and transformation object. |
Attributes
- 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:
objectManage a data container and transformation object.
- Parameters:
- dataarray_like
Data to be stored in the layer.
- dataloader
Callable Function to load the data into the container.
- transformer
Homography|Affine2D Transformation class for the layer.
- container
Container2D, optional Container class to hold the data. Default is Container2D.
- name
str, optional Name for the layer. Default is None.
- parent
Layer, optional Parent Layer to inherit transformations from. Default is None.
- layer_manager
LayerRegistry, optional LayerRegistry instance to manage the layer. Default is None.
- **kwargs
dict, optional Additional parameters to be passed to the container.
- Attributes:
- is_transformedbool
Indicates whether the layer has been calibrated.
- manager
LayerRegistry, optional A reference to the layer registry.
- transformer
Homography|Affine2D An instance of a transformation object.
- parent
Layer, optional A reference to the parent Layer, if one exists.
- container
Container2D 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
- 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:
- x
float The x-coordinate for the query.
- y
float The y-coordinate for the query.
- cutoff
float, optional The maximum distance from the query point to consider data.
- output_number
int, optional The number of closest points to return for the query.
- reducer
Reducer, optional Reducer object to reduce multiple query results into a single result.
- idx
int|None, optional The index of the query. This option is used when executing multiple queries in parallel by the
execute_queriesmethod. This parameter is obsolete for single query execution.
- x
- Returns:
np.ndarrayAn 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:
- xs
list[float] List of x coordinates for queries.
- ys
list[float] List of y coordinates for queries.
- cutoff
float, optional The maximum distance from the query point to consider data.
- output_number
int, optional The number of closest points to return for each query.
- reducer
Reducer, optional Reducer object to reduce multiple query results into a single result.
- **kwargs
dict, optional Additional parameters to be passed to the ThreadPoolExecutor.
- xs
- Returns:
np.ndarrayAn 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.
- set_transformation_matrix(transformation_matrix) NoReturn[source]
Set the transformation matrix for the layer.
- Parameters:
- transformation_matrix
np.ndarray The transformation matrix to be set.
- transformation_matrix
Notes
- ..deprecated:: 1.0.0
This method will be removed in PyXC 2.0.0.