FITS Align
Align a sequence of astronomical FITS files based on sources extracted in each image. The aligned files will be geometrically reprojected so all the images are the same size and shape.
It is designed to work exclusively with reduced data from Las Cumbres Observatory. FITS data from LCO is Rice compressed and contains sources extracted using SEP during our data pipeline processing in a catalogue (CAT) FITS Header Data Unit (HDU).
Installation
Download this repository :
python setup.py install
Example usage
from fits_align.ident import make_transforms
from fits_align.align import affineremap
from glob import glob
from numpy import shape
tmp_dir = "<FULL PATH TO INPUT FILES>"
img_list = sorted(glob(os.path.join(tmp_dir,"*.fz")))
ref_image = img_list[0]
images_to_align = img_list[1:]
identifications = make_transforms(ref_image, images_to_align)
If you have FITS files with image data you could use the following to reproject them.
aligned_images = [ref_image]
for id in identifications:
if id.ok:
alignedimg = affineremap(id.ukn.filepath, id.trans, outdir=tmpdir)
aligned_images.append(alignedimg)
If you just have FITS files which contain on photometry catalogues, which have pixel coordinate values (e.g. x, y) that you want to align (ie. no image data):
import pandas as pd
identifications = make_transforms(img_list[0], img_list[1:], hdu='CAT')
catalogues = []
for i, catfile in enumerate(img_list):
with fits.open(catfile) as hdul:
data = pd.DataFrame.from_records(hdul['CAT'].data)
if i != 0:
(matrix, offset) = identifications[i-1].trans.matrixform()
newcoords = np.dot(data[['x','y']], matrix) + offset
(x,y) = np.transpose(newcoords)
data.update({'x':x, 'y':y})
catalogues.append(data)
HDU containing catalogues
If you are using a none standard place for your catalogue HDU, that can be passed in a parameter to the make_transforms() function i.e.
identifications = make_transforms(ref_image, images_to_align, hdu=0)
About
This is a customised fork of AliPy by Malte Tewes. I have removed the dependency on SciPy in favour of pure NumPy (for linear algebra) and Pillow (for image array transforms).
Metadata
Release files for fits-align 0.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fits_align-0.4.4.tar.gz | 26.5 kB | Without provenance | Details for fits_align-0.4.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fits_align-0.4.4-py3-none-any.whl | Python 3 | none | any | Details for fits_align-0.4.4-py3-none-any.whl |
Total release size: 56.5 kB
Release files / fits_align-0.4.4.tar.gz
| Download URL | fits_align-0.4.4.tar.gz |
|---|---|
| Size | 26.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22df2973d25a60325fb9c41c89247a27eb2396e31e8dd72aa96e3d2423cb6814
|
|
BLAKE2b-256 checksum How to use checksums |
015f681daaac8ff0f565e8ff4d65052b00018e166976b4223d6bfcad5351002e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / fits_align-0.4.4-py3-none-any.whl
| Download URL | fits_align-0.4.4-py3-none-any.whl |
|---|---|
| Size | 29.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a195f9ec9072df2778181e44a22ee433200ce6baa37d35a806e73441012a1fb
|
|
BLAKE2b-256 checksum How to use checksums |
64a732d638d299393e4f302d66a38a311357cfa697afc54a5e9e1a62eb030c5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for fits-align 0.4.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.