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
File details
Details for the file BatAnalysis-1.1.0.tar.gz
.
File metadata
- Download URL: BatAnalysis-1.1.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24efa31653ff0c05d725bfc453f1a9922628899387e9b8a89c25dffe05dc3161 |
|
MD5 | 45d482790bbbff414e21c64c1866443e |
|
BLAKE2b-256 | 2fb1019850a6a045e6b075d23d2b87c69b89b6ad368fe90733bc77aecac010b6 |
File details
Details for the file BatAnalysis-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: BatAnalysis-1.1.0-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4db5f2d632d1ab93b6f1602d95a065ff2731ca782281f679354a7d4a9fad4e09 |
|
MD5 | c1bdb8cafc6af1c730cd2cbd883047c0 |
|
BLAKE2b-256 | 0851fed4c9a17fa447a32851999cf213b2e832ba8ac181c07ce43e52d15222cc |