Quadtree Node
The QuadNode class for each quadtree node in an astroQTpy quadtree.
- class astroqtpy.quadnode.QuadNode(x_min: float, x_max: float, y_min: float, y_max: float, depth: int = 0)
Quadtree node.
A class for astroQTpy quadtree nodes. Each node is defined by its given boundary limits and ‘depth’, and may contain up to any given number of quadtree points.
- Parameters:
x_min (float) – Minimum x value of this node.
x_max (float) – Maximum x value of this node.
y_min (float) – Minimum y value of this node.
y_max (float) – Maximum y value of this node.
depth (int, optional) – Depth of this node. Defaults to 0.
- draw_node(ax: Axes, mappable: ScalarMappable, show_colors: bool, show_lines: bool, show_points: bool, show_values: bool, statistic: str) None
Draw node.
Plot this node on a matplotlib axis.
- Parameters:
ax (
matplotlib.axes.Axes) – Axis for plotting.mappable (
matplotlib.cm.ScalarMappable) – Scalar mappable for color mapping.show_colors (bool) – Whether to draw colors inside nodes.
show_lines (bool) – Whether to draw boundary lines between nodes.
show_points (bool) – Whether to plot points contained within this node.
show_values (bool) – Whether to print the value of this node on the plot.
statistic (str) – Statistic to pass to ‘get_node_value’. Choose from [‘count’, ‘mean’, ‘std’, or ‘median’].
- get_node_value(statistic: str) float
Get node value.
Convenience function to grab this node’s value.
- Parameters:
statistic (str) – Statistic to pass to ‘_generate_node_value’. Choose from [‘count’, ‘mean’, ‘std’, or ‘median’].
- Returns:
Node value.
- Return type:
float
- print_node_points() None
Print node points.
Convenience function to print each point contained within this node to a given file.
- print_node_value(statistic: str) None
Print node value.
Convenience function to print the value of this node to a given file.
- Parameters:
statistic (str) – Statistic to pass to ‘get_node_value’. Choose from [‘count’, ‘mean’, ‘std’, or ‘median’].
- split_node() None
Split node.
Split this node into 4 equal ‘child’ nodes. Distribute any points contained within this node to its children.