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


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

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: BatAnalysis-0.0.1.tar.gz
  • Upload date:
  • Size: 49.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/6.0.0 pkginfo/1.9.6 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.16

File hashes

Hashes for BatAnalysis-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9da21ea74baf87ece10fbac1f68a62b61b0c81d23f067f1bbfc256da3149a521
MD5 14c0dc23785c6f72d44838b820f126cb
BLAKE2b-256 af3f37ed2723f2cbbdbb3a25fd991fbec686482fa9873c249cac5105fa7e9926

See more details on using hashes here.

File details

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

File metadata

  • Download URL: BatAnalysis-0.0.1-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.0.0 pkginfo/1.9.6 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.8.16

File hashes

Hashes for BatAnalysis-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5f136af301c467343393d015392db41ca3c1b3524b986f593df9c572c0aa218
MD5 2e66f5ab3c7e34b6592ad29606d18143
BLAKE2b-256 53173742a27205b522daea4807c257d8859d085f1433698c304792da9744eb92

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