Quick Start
Installing astroQTpy
Install astroqtpy using pip:
$ pip install astroqtpy
(See the Installation page.)
Getting started
Importing the quadtree module
This is the main module in astroqtpy, which contains various quadtree classes for
different purposes.
In a Python script or Jupyter notebook:
import astroqtpy.quadtree as qt
This should be all you need for most simple applications.
If you wish to define your own quadtree class
with astroqtpy, you will need to import additional modules:
from astroqtpy.basetree import BaseTree
from astroqtpy.quadnode import QuadNode
from astroqtpy.quadpoint import QuadPoint
Instantiating a quadtree class
Once you’ve imported the quadtree module (or defined your own quadtree class), you must create an instance of a quadtree class. For example:
my_random_quadtree = qt.RandomQuadTree(0, 1, 0, 1)
For the RandomQuadTree class, at minimum you must specificy the lower and
upper x and y limits for the quadtree. For a description of all optional arguments
and other quadtree classes, please see the Detailed API Documentation.
Running a quadtree
Each quadtree class has two methods that you are most likely to use: run_quadtree() and draw_tree(). As the names imply, these methods act to run the quadtree algorithm forward, and plot the quadtree on a Matplotlib axis.
my_random_quadtree.run_quadtree()
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
my_random_quadtree.draw_tree(ax)
Learn more
To learn more, continue on to the Tutorials and check out the Detailed API Documentation.