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.2.tar.gz (49.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

BatAnalysis-1.0.2-py3-none-any.whl (49.5 MB view details)

Uploaded Python 3

File details

Details for the file BatAnalysis-1.0.2.tar.gz.

File metadata

  • Download URL: BatAnalysis-1.0.2.tar.gz
  • Upload date:
  • Size: 49.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/6.6.0 pkginfo/1.9.6 requests/2.31.0 requests-toolbelt/0.9.1 tqdm/4.65.0 CPython/3.8.16

File hashes

Hashes for BatAnalysis-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f76292600b138abedee50736dacfdc85d767c7854262aa8e987f65b8bb4e0365
MD5 d8069f12672e5a3036c27a1a436c10df
BLAKE2b-256 23731c2f50270e0e5dd93eed248f6c6527df98c62e73a46a630574a8dc096285

See more details on using hashes here.

File details

Details for the file BatAnalysis-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: BatAnalysis-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 49.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/6.6.0 pkginfo/1.9.6 requests/2.31.0 requests-toolbelt/0.9.1 tqdm/4.65.0 CPython/3.8.16

File hashes

Hashes for BatAnalysis-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a8735a5ed9cd61b1340fcca4d2892a8014bf0166388734251ab58b9ac29f90ec
MD5 ac6af5c4a4457a1ecc741d5020d05ce4
BLAKE2b-256 e22460ee0f98927bf4002e781950d5ac0961bbe2c55bd94a8c5a0c46efd03988

See more details on using hashes here.

Supported by

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