This tool performs aperture photometry on stars in a FITS image to calculate their magnitudes, errors, signal-to-noise ratios (SNR), and fluxes. It finds the optimal flux for each star and uses a reference star to calculate magnitudes.
- Reads FITS images.
- Performs aperture photometry to find optimal flux.
- Calculates magnitudes, errors, SNRs, and fluxes for specified stars.
- Adjusts aperture size for stars near nebulae.
astropy
: For handling FITS images.numpy
: For numerical operations.photutils
: For aperture photometry.
You can install these dependencies using the following command:
pip install astropy numpy photutils
- Clone the repository:
git clone https://github.com/yourusername/fits-star-photometry-tool.git
cd fits-star-photometry-tool
-
Place your FITS image file in a
data
directory inside the project folder and name itstars.fits
. -
Run the script:
python main.py
Reference Star:
Reference Star Magnitude: 8.88
Reference Star Raw Flux: 12345.67
Reference Star Analysis:
Reference Star at position (425.01049660550996, 786.8934083356211):
Magnitude = 8.88, Error = 0.01023, SNR = 25.78, Flux = 12345.67
The calculate_magnitude
function calculates the magnitude of a star given its flux, using a reference star's magnitude and flux.
The find_optimal_flux
function performs aperture photometry on a star to find the optimal flux and SNR by trying different aperture sizes.
The main
function:
- Loads the FITS image.
- Defines the reference star's position and magnitude.
- Finds the optimal flux for the reference star.
- Prints the magnitude, error, SNR, and flux for the reference star.