Skip to main content

Routines for analyzing data from BAT on the Neil Gehrels Swift Observatory

Project description

Contributors Forks Stargazers Issues MIT License
Google Scholar Badge ResearchGate Badge DOI ascl:2304.003


Logo

The BatAnalysis Pipeline

The BatAnalysis python pipeline is brings the analysis of BAT data to the convenience offered by Python.
Explore the docs »

Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

BatAnalysis is a python package that allows for the convenient analysis of BAT Survey data. This code allows users to:

  • easily download BAT survey data,
  • batch process the survey observations,
  • extract light curves and spectra for each survey observation for a given source,
  • create mosaiced images at different time bins, and
  • extract light curves and spectra from the mosaiced images for a given source.

This project was developed in collaboration with the members of the BAT Team including: Sibasish Laha, David Palmer, Amy Lien and Craig Markwardt.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

The following software are necessary for the BatAnalysis python module.

  1. Python 3.8 or larger
    • We recommend installing via Anaconda
  2. swiftbat_python
    • This can be easily installed via pip
  3. Swifttools
    • This can also be easily installed via pip
  4. HEASoftPy >= v1.2.1 (HEASoft >= v6.31.1)
  5. PyXspec
  6. Swift BAT Pattern Noise Maps

Installation

1a. Install the BatAnalysis package with Pip

pip install BatAnalysis

1b. Clone the repo and install

git clone https://github.com/parsotat/BatAnalysis.git
cd BatAnalysis/
pip install -e .

Usage

The typical BatAnalysis workflow is as follows:

  1. Use astroquery to queue HEASARC for obervations within a given date range for an RA/DEC coordinate corresponding to a source of interest
  2. Download the data
  3. Run batsurvey on each observation ID
  4. Calculate the detector response matrix for each survey pointing
  5. Calculate the spectrum in each pointing
  6. Fit the spectra to obtain spectral information
  7. Calculate the light curve for the time period of interest
  8. Plot the light curve/spectral information
  9. Create mosaiced images for the time binning of interest (days, weeks, months, years)
  10. Create the total "time-integrated" mosaiced image
  11. Extract the spectra of the mosaiced images and fit them
  12. Calculate the light curve of the source from the mosaiced images
  13. Plot the light curve/spectral information for the mosaiced images

Following these steps for the first 5 survey observation IDs for the Crab (although see the notebooks directory for recommended analysis steps):

import batanalysis as ba
import swiftbat
import numpy as np 
import matplotlib.pyplot as plt
from pathlib import Path
plt.ion()

object_name='Crab'
catalog_name="Crab_Nebula_Pulsar"
table = ba.from_heasarc(object_name)
result = ba.download_swiftdata(table[:5])

batsurvey_obs=ba.parallel.batsurvey_analysis(table["OBSID"][:5], nprocs=2)

#the name of the source in the included survey catalog must be used here 
noise_map_dir=Path("/path/to/downloaded/PATTERN_MAPS/")
batsurvey_obs=ba.parallel.batspectrum_analysis(batsurvey_obs, catalog_name, patt_noise_dir=noise_map_dir, nprocs=2)

ba.plot_survey_lc(batsurvey_obs, id_list=catalog_name, calc_lc=True)

outventory_file=ba.merge_outventory(batsurvey_obs)

#bin into 1 month time bins
time_bins=ba.group_outventory(outventory_file, np.timedelta64(1,'M'))

#bin into daily time bin
mosaic_list, total_mosaic=ba.parallel.batmosaic_analysis(batsurvey_obs, outventory_file, time_bins, nprocs=3)

mosaic_list=ba.parallel.batspectrum_analysis(mosaic_list, catalog_name, nprocs=2)

ba.plot_survey_lc(mosaic_list, id_list=catalog_name, calc_lc=True)

For more details and additional examples please refer to the Notebooks directory

Roadmap

This package will soon be modified to include analysis of BAT event data.

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Tyler Parsotan - Personal Website - parsotat@umbc.edu

Project Link: https://github.com/parsotat/BatAnalysis.git

Acknowledgements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BatAnalysis-1.0.0.tar.gz (49.5 MB view hashes)

Uploaded Source

Built Distribution

BatAnalysis-1.0.0-py3-none-any.whl (49.5 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page