This repository contains code for performing background subtraction on light curves using data from FITS files. The main script is implemented in a Jupyter Notebook (Bag_sub.ipynb).
- Python 3.9
- Jupyter Notebook
- NumPy
- Matplotlib
- SciPy
- Astropy
You can install the required packages using pip: pip install numpy matplotlib scipy astropy jupyter
-
Load FITS Data: The function load_fits_data in the notebook loads the time data from a specified FITS file.
-
Create Histogram: Generate a histogram of the time data to get counts.
-
Define Background Regions: Define the regions for background data.
-
Select Background Data: Use the select_background function to select background data.
-
Fit Polynomial to Background: Fit a polynomial to the background data.
-
Subtract Background: Subtract the background model from the original histogram.
-
Plot Results: Plot the original histogram, background model, and background-subtracted data.
This project uses data from the Fermi Gamma-ray Space Telescope.