@@ -0,0 +1,1664 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# Documentation:%0A# - http://docs.astropy.org/en/stable/io/fits/%0A# - http://docs.astropy.org/en/stable/io/fits/api/files.html%0A# - http://www.astropy.org/astropy-tutorials/FITS-tables.html%0A# - http://www.astropy.org/astropy-tutorials/FITS-images.html%0A# - http://www.astropy.org/astropy-tutorials/FITS-header.html%0A%0Aimport argparse%0Afrom astropy.io import fits%0A%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0A%0A# PARSE OPTIONS ###############################################################%0A%0Aparser = argparse.ArgumentParser(description=%22An astropy snippet%22)%0Aparser.add_argument(%22filearg%22, nargs=1, metavar=%22FILE%22, help=%22the FITS file to read%22)%0Aargs = parser.parse_args()%0Afile_path = args.filearg%5B0%5D%0A%0A# READ DATA ###################################################################%0A%0A# Open the FITS file%0Ahdu_list = fits.open(file_path)%0A%0A# For each blocks%0Afor hdu_index, hdu in enumerate(hdu_list):%0A    print(%22HDU %7B%7D%22.format(hdu_index))%0A%0A    # Print header%0A    header = hdu.header%0A    for key, value in header.items():%0A        print(key, %22:%22, value)%0A%0A    # Print data%0A    try:%0A        data = hdu.data   # %22hdu.data%22 is a Numpy Array%0A        print(data)%0A        print(type(data))%0A        print(data.shape)%0A    except:%0A        pass%0A%0A    print(%22---%22)%0A%0A    # GET DATA FROM ONE GIVEN COLUMN EXAMPLE ##############%0A%0A    # Print column named %22column1%22 of hdu1 (if it exist)%0A    # See './write_binary_tqble.py'%0A    if hdu_index == 1:%0A        try:%0A            print(hdu.data%5B'column1'%5D)%0A%0A            #plt.plot(hdu.data%5B'column1'%5D)%0A            #plt.show()%0A        except:%0A            pass%0A%0A# Close the FITS file%0Ahdu_list.close()%0A%0A

Add a snippet.