Routines for analyzing data from BAT on the Neil Gehrels Swift Observatory
Project description
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
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
- Python 3
- HEASoftPy
- PyXspec
- swiftbat_python
- Swifttools
- typical python modules (astropy, numpy, scipy, etc.)
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.
- Python 3.8 or larger
- We recommend installing via Anaconda
- swiftbat_python
- This can be easily installed via pip
- Swifttools
- This can also be easily installed via pip
- HEASoftPy >= v1.2.1 (HEASoft >= v6.31.1)
- The installation is included with HEASoft and the steps can be found here: https://heasarc.gsfc.nasa.gov/lheasoft/install.html
- PyXspec
- The installation is included with HEASoft but there may be additional steps to take if you have changed your anaconda version after building HEASoft. More information can be found here: https://heasarc.gsfc.nasa.gov/xanadu/xspec/python/html/buildinstall.html
- Swift BAT Pattern Noise Maps
- The pattern maps used by the BAT team are available at: https://zenodo.org/record/7595904#.Y9q7pS-B3T8 for download. These maps shoud be downloaded and placed into a place where the BatAnalysis code will be able to access them.
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:
- Use astroquery to queue HEASARC for obervations within a given date range for an RA/DEC coordinate corresponding to a source of interest
- Download the data
- Run batsurvey on each observation ID
- Calculate the detector response matrix for each survey pointing
- Calculate the spectrum in each pointing
- Fit the spectra to obtain spectral information
- Calculate the light curve for the time period of interest
- Plot the light curve/spectral information
- Create mosaiced images for the time binning of interest (days, weeks, months, years)
- Create the total "time-integrated" mosaiced image
- Extract the spectra of the mosaiced images and fit them
- Calculate the light curve of the source from the mosaiced images
- 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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - 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
- In using the BatAnalysis code, we ask that you cite the following paper:
- README Template from: othneildrew/Best-README-Template
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for BatAnalysis-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c74f8625a307324433554bac34aeacc64ebffa338220dfbda6b23816b8c0698e |
|
MD5 | 894257f00f812b7fc90d78945b30d0b9 |
|
BLAKE2b-256 | 2bb4a99727740a489ef7f7170638591153f210e04d7f26786efe49074a25d0ff |