SQLAlchemy extensions for HEALPix spatially indexed astronomy data
Project description
HEALPix Alchemy
The healpix_alchemy Python package extends SQLAlchemy will provide spatial
indexing for astronomical sky coordinates, regions, and raster images (e.g.
LIGO/Virgo and Fermi probability sky maps) in a relational database. It does
not rely on any database extensions.
This package is a work in progress. Initially, healpix_alchemy focuses on
spatial indexing of point clouds while we work out the SQLAlchemy abstraction
design. Once this is mature, we will incorporate the raster indexing strategies
from https://github.com/growth-astro/healpix-intersection-example.
Installation
You can install healpix_alchemy the Python Package Index:
$ pip install healpix-alchemy
Usage
from healpix_alchemy.point import Point
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
# Create two tables Catalog1 and Catalog2 that both have spherical coordinates.
class Catalog1(Point, Base):
__tablename__ = 'catalog1'
id = Column(Integer, primary_key=True)
class Catalog2(Point, Base):
__tablename__ = 'catalog2'
id = Column(Integer, primary_key=True)
...
# Populate Catalog1 and Catalog2 tables with some sample data...
session.add(Catalog1(id=0, ra=320.5, dec=-23.5))
...
session.add(Catalog2(id=0, ra=18.1, dec=18.3))
...
session.commit()
# Cross-match the two tables.
separation = 1 # separation in degrees
query = session.query(
Catalog1.id, Catalog2.id
).join(
Catalog2,
Catalog1.within(point, separation)
).order_by(
Catalog1.id, Catalog2.id
)
for row in query:
... # do something with the query results
# Do a cone search around literal ra, dec values.
separation = 1 # separation in degrees
point = Point(ra=212.5, dec=-33.2)
query = session.query(
Catalog1.id
).filter(
Catalog1.within(point, separation)
).order_by(
Catalog1.id
)
for row in query:
... # do something with the query results
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file healpix-alchemy-0.2.0.tar.gz.
File metadata
- Download URL: healpix-alchemy-0.2.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67fff81ebb96384642a381c1b6c2d496c6f37d1f50edffa20ed5b378c4d7345d
|
|
| MD5 |
37c6b04fce6ece544bd979a32c3355c9
|
|
| BLAKE2b-256 |
5fe18e19c5d6018b039c1fa0ecff7f520de9656162ea0929bea07718780d31c3
|
File details
Details for the file healpix_alchemy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: healpix_alchemy-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cb1034295552ed678b67ca393b8042f795a829eb4df4c080ef3e920dda00ce9
|
|
| MD5 |
202a92f616ad9c468ff21db27ab93d38
|
|
| BLAKE2b-256 |
ccb64e857723a9a90540fb331d863fd8122cb7414e6881de03c4d987d796af7d
|