FITS File Analysis Tool Python

1 reply•108 views
Kevin Guion avatar

fits-analyser.py

astronomical_analysis_description.pdf

Hello fellow astrophotographers!

I've developed a Python script to help me quickly analyze my FITS files and track my progress across different targets and filters. The main goal was to get a clear overview of my observation time per target and per filter, plus detailed breakdowns by night and filter to help fill in my AstroBin information more efficiently.

What it does:

- Scans your FITS files (and all subfolders) without modifying anything

- Generates comprehensive graphs in both PNG (high resolution) and SVG (vector) formats

- Creates a complete LaTeX report with detailed analysis

- Automatically compiles the LaTeX report if you have a distribution installed (Windows/Mac/Linux)

- If no LaTeX is installed, you can compile the generated .tex file online (Overleaf, etc.)

- Creates a specific output folder where it stores all generated results

Key features:

- Recognizes most filter names regardless of how they're written

- Handles mosaic panels properly

- Ignores flats, darks, and bias files

- Provides detailed night-by-night and filter-by-filter breakdowns

- Shows total observation time per target

- Generates professional-looking reports

Installation Instructions:

Download Python 3.12 from https://www.python.org/downloads/

Install required packages with:

python -m pip install matplotlib numpy pandas reportlab tqdm astropy pillow scipy requests

I run this script using PyCharm 2025 (https://www.jetbrains.com/pycharm/) with Python 3.12 interpreter.

I have also tested it successfully in Windows Terminal (console) with python 3.13.8

Usage:

Simply place the script in the folder you want to analyze. It will recursively scan all subfolders and generate the analysis files in the same directory. The program creates a specific output folder where it stores all its results.

Requirements:

Python Requirements:

- Python 3.x

- Required Python packages:

matplotlib, numpy, pandas, reportlab, tqdm, astropy, pillow, scipy, requests

LaTeX Requirements:

For LaTeX compilation: Any LaTeX distribution (TeXLive, MiKTeX, MacTeX, etc.)

Required LaTeX packages:

1. amsmath (Mathematical typesetting)

2. amsfonts (Mathematical fonts)

3. amssymb (Mathematical symbols)

4. geometry (Page layout)

5. graphicx (Graphics inclusion)

6. booktabs (Professional tables)

7. longtable (Multi-page tables)

8. hyperref (Hyperlinks)

9. xcolor (Colors)

10. tikz (Vector graphics)

11. pgf (TikZ backend)

12. siunitx (SI units)

13. float (Float positioning)

14. needspace (Space control)

15. translations (Internationalization)

16. array (Table extensions)

17. url (URL formatting)

Performance:

The program features intelligent system adaptation that automatically optimizes performance based on your computer's capabilities.

If you want to do a complete analysis of all your astrophotos, I've tested it with 50,000 FITS files and the program processes approximately 4000 files per second.

Important Notes:

I've only tested this on my own setup, so there might be some FITS files it misses. Feel free to modify and improve it - it's far from perfect! I'm not sure if similar tools already exist elsewhere, but this one works well for my needs.

The script is completely safe to test as it only reads files and doesn't modify anything. However, don't hesitate to test it on separate folders first if you want to be sure. Feel free to modify and improve it - it's far from perfect!

Well Written Helpful Insightful Respectful Engaging Supportive
Kevin Guion avatar

fits-analyser.py

FITS Analyzer Update: Thumbnail Generation & Telescope Data Fix

New Feature: Thumbnail GenerationThe program now supports automatic thumbnail generation for each astronomical target! When enabled, the LaTeX report will include thumbnail images of your observations, making it much easier to visually identify and review your targets. The thumbnails are generated in parallel for optimal performance and can be toggled on/off based on your preferences.Bug Fix: Telescope Data OrganizationFixed a critical issue where observation data was being mixed between different telescopes in the LaTeX report. Previously, when a target was observed with multiple telescopes, the night-by-night analysis within each telescope subsection was incorrectly showing data from all telescopes instead of the specific telescope's data.What's Fixed:

  • Each telescope subsection now correctly displays only its own observation data

  • Night-by-night analysis is properly organized per telescope

  • No more data mixing between different telescopes

  • Maintains all existing parallel processing performance

Technical Details:

  • Thumbnail generation uses optimized parallel processing

  • Telescope data filtering preserves the existing fast analysis workflow

  • LaTeX report structure improved for better data organization

  • All user messages and comments are now consistently in English

Usage:The program automatically detects your setup and generates thumbnails when requested. The telescope data fix is applied automatically - no configuration changes needed.This update significantly improves the visual presentation of your astronomical analysis reports while ensuring data accuracy across multiple telescope setups!