Skip to main content

A package to extract stars from an astronomical image

Project description

Welcome to the STAREXTRACTOR package

PyPI version shields.io PyPI pyversions PyPI status GitHub contributors Maintenance GitHub license Documentation Status Build Status

This package is an archive of scientific routines for data processing related to the source extraction from an astronomical image. Currently, operations on source extraction include:

  1. Read an astronomical image in .fits format or in generic image format, such as .bmp;
  2. Extract the centroid coordinates of the star spots and do photometry using photutils;
  3. Show raw image with star spots marked;

How to Install

On Linux, macOS and Windows architectures, the binary wheels can be installed using pip by executing one of the following commands:

pip install starextractor
pip install starextractor --upgrade # to upgrade a pre-existing installation

How to use

Read an astronomical image

Currently, supported image formats include .fits, generic image format(such as .bmp), .npy, and numpy array.

>>> from starextractor import AstroImage
>>> imagefile = 'obs/fits/img_00000.fits' 
>>> #imagefile = 'obs/bmp/img_00000.bmp'
>>> #imagefile = 'obs/npy/img_00000.npy'
>>> image = AstroImage.read_image(imagefile)
>>> # image = AstroImage.read_image(image_array)

Print the raw grayscale image with the origin at the center of the bottom(the first row of array) left pixel.

>>> print(image.image_raw,image.res) # original grayscale image and its resolution

Show the raw image

>>> image.show()
>>> #image.show('figs/raw_image.png') # save image to a file

Extract the centroid coordinates of the star spots and do photometry

Estimate the centroids coordinates, brightness(sum of gray value within an aperture), and SNR of star spots.

>>> sources = image.find_source(fwhm=12,mask=True)
>>> print(sources.xy,sources.brightness,sources.snr,sources.offset)

Calculate the triangle invariants and construct a 2D Tree; and record the asterism indices for each triangle.

>>> sources.invariantfeatures()
>>> print(sources.invariants,sources.asterisms,sources.kdtree)

Show the extracted sources in image

>>> sources.show()
>>> #sources.show('figs/sources.png') # save image to a file

Change log

  • 0.1.7 — Sep 23, 2023

    • Fixed a warning caused by determining whether an array is empty in Python of version > 3.9.
  • 0.1.6 — Jun 29, 2023

    • Added support for image file formats .npy and numpy array in function AstroImage.read_image()
  • 0.1.5 — May 14, 2023

    • The class Centriod is deprecated, and the class Source is used instead
    • Add method .invariantfeatures() to class Source, which calculates the triangle invariants and constructs a 2D Tree; and records the asterism indices for each triangle.
  • 0.1.0 — Apr 5, 2023

    • The starextractor package was released.

Reference

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

starextractor-0.1.7-py3-none-any.whl (10.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page