Skip to content

stemflow.gridding.Q_blocks

I call this Q_blocks because they are essential blocks for QTree methods

QGrid

Grid class for STEM (fixed gird size)

Source code in stemflow/gridding/Q_blocks.py
class QGrid:
    """Grid class for STEM (fixed gird size)"""

    def __init__(self, x_index, y_index, x_range, y_range):
        self.x_index = x_index
        self.y_index = y_index
        self.x_range = x_range
        self.y_range = y_range
        self.points = []

QNode

A tree-like division node class

Source code in stemflow/gridding/Q_blocks.py
class QNode:
    """A tree-like division node class"""

    def __init__(
        self,
        x0: Union[float, int],
        y0: Union[float, int],
        w: Union[float, int],
        h: Union[float, int],
        points: Sequence,
    ):
        self.x0 = x0
        self.y0 = y0
        self.width = w
        self.height = h
        self.points = points
        self.children = []

    def get_width(self):
        return self.width

    def get_height(self):
        return self.height

    def get_points(self):
        return self.points

QPoint

A Point class for recording data points

Source code in stemflow/gridding/Q_blocks.py
class QPoint:
    """A Point class for recording data points"""

    def __init__(self, index, x, y):
        self.x = x
        self.y = y
        self.index = index

QPoint_3D

A 3D Point class for recording data points

Source code in stemflow/gridding/Q_blocks.py
class QPoint_3D:
    """A 3D Point class for recording data points"""

    def __init__(self, index, x, y, z):
        self.x = x
        self.y = y
        self.z = z
        self.index = index

Sphere_QTriangle

A tree-like division triangle node class for Sphere Quadtree

Source code in stemflow/gridding/Q_blocks.py
class Sphere_QTriangle:
    """A tree-like division triangle node class for Sphere Quadtree"""

    def __init__(
        self, p1: QPoint_3D, p2: QPoint_3D, p3: QPoint_3D, points: Sequence, length: Union[float, int], radius=6371.0
    ):
        self.p1 = p1
        self.p2 = p2
        self.p3 = p3
        self.length = length

        self.points = points
        self.children = []

    def get_points(self):
        return self.points