Python FITS Decompressor




 Astronomy data often comes in the form of FITS files. To save space, many surveys and observatories provide them as .fits.fz compressed files. Before using these files for analysis or astrophotography, they need to be converted back into standard .fits.


I created a small Python script called fits-decompressor. It takes all the .fits.fz files from a folder, decompresses them, and saves them as normal .fits files in another folder. If the file contains image data, the script can also display it using Matplotlib.


Why use this tool?


Quick way to handle large numbers of compressed FITS files

Works automatically on all files in the chosen folder

The output can be used in most astronomy software

Allows a direct preview of numeric image data


How to use it

1. Install the requirements
Make sure Python 3.8 or newer is installed, then install the needed libraries:

pip install astropy numpy matplotlib

2. Prepare your folders

  • Place your .fits.fz files in an input folder

  • Choose an output folder for the decompressed .fits files

3. Edit the script


Update the folder paths in the script:

input_folder = r"C:\Users\admin\Desktop\my_data" output_folder = r"C:\Users\admin\Desktop\YOUR FITS"

4. Run the script


In the terminal, move to the folder where decompress_fits.py is located and run:

python decompress_fits.py

5. Check the results


The script will decompress all .fits.fz files into .fits and save them in the output folder. If there is image data, a preview will appear on the screen.


Download

The script is available on GitHub:
πŸ‘‰ https://github.com/MohammedHaimoud/fits-decompressor

Comments

Popular posts from this blog

COSMAN ASTRONOMICAL OBSERVATORY – A Dream Realized

Certificate of Attendance – Turning Earth Observations to Natural Language Dialogues

🌟 Bridging the Gap Between Color and Temperature in Astronomy! 🌟