BatAnalysis
A python HEASOFT wrapper for processing Swift-BAT data.
Install / Use
/learn @parsotat/BatAnalysisREADME
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
<a href="https://ascl.net/2304.003"><img src="https://img.shields.io/badge/ascl-2304.003-blue.svg?colorB=262255" alt="ascl:2304.003" /></a>
About The Project
<!-- [![Product Name Screen Shot][product-screenshot]](https://example.com) -->BatAnalysis is a python package that allows for the convenient analysis of BAT Survey and Time-tagged Event (TTE) data. This code allows users to:
- easily download BAT data,
- batch process the observations,
- extract light curves and spectra for each observation for a given source
For survey data in particular it allows users to:
- 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: David Palmer, Sibasish Laha, Amy Lien, and Craig Markwardt.
Built With
- Python 3
- HEASoftPy
- PyXspec
- swiftbat_python
- Swifttools
- typical python modules (astropy, numpy, scipy, etc.)
Getting Started
It is easy to get started on your local computer or on SciServer
Prerequisites
The following software are necessary for the BatAnalysis python module.
- Python 3.9 or greater
- We recommend installing via Anaconda
- swiftbat_python
- This will be installed via the pip command below
- Swifttools
- This will also installed via the pip command below
- HEASoftPy >= v1.4.1 (HEASoft >= v6.33.2)
- The installation is included with HEASoft and the steps can be found here: https://heasarc.gsfc.nasa.gov/docs/software/lheasoft/
- 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 (necessary for the analysis of survey data)
- The pattern maps used by the BAT team are available on zenodo for download.
These maps shoud be downloaded and placed into a place where the BatAnalysis code will be able to access them.
- This data is most easily downloaded using the zenodo_get utility, especially for installation on remote servers
- The pattern maps used by the BAT team are available on zenodo for download.
These maps shoud be downloaded and placed into a place where the BatAnalysis code will be able to access them.
Using the SciServer interface it is easier to start using BatAnalysis since HEASoftpy and pyXspec are already installed.
Getting Started on SciServer
- To get started on Sciserver, first follow the instructions outlined here to get an account set up and get a container up and running.
Be sure that the container that is created has a compatible python and HEASoft version
- With the container created, the user can install BatAnalysis through pip:
pip install BatAnalysis
- The Pattern Noise Maps can easily be downloaded into the
/home/idies/workspace/Temporary/<username>/scratch/directory with the use of the zenodo_get utility. If the analyses that will be conducted will not involve survey data being mosaiced then this step can be skipped.
Getting Started on a Local Computer
To get up and running on a local computer once the prerequisites met is very simple. All that is needed to install the package is either:
A. Pip install the BatAnalysis package:
pip install BatAnalysis
B. Clone the repo and install
git clone https://github.com/parsotat/BatAnalysis.git
cd BatAnalysis/
pip install -e .
<!-- USAGE EXAMPLES -->
Usage
a) Survey Data
The typical BatAnalysis workflow for analyzing survey data 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
b) TTE Data
The typical BatAnalysis workflow for analyzing TTE data is as follows:
- Query TTE data based on different criteria
- Download the data
- Load the data with BatEvent
- Calculate sky images with the data to identify a source
- Mask-weight the data based on the source of interest
- Calculate lightcurves arbitarily binned in time and energy with the mask-weighted data
- Calculate spectra and the detector response matrices for a given time interval
- Fit the spectra to obtain spectral information
- Plot the light curve/spectral information
For more details and additional examples please refer to the Notebooks directory
<!-- ROADMAP -->Roadmap
Next, this package will be modified to:
- include analysis of BAT scaled map data
- interface with 3ML for multi-wavelength spectral fitting
See the open issues for a list of proposed features (and known issues).
<!-- CONTRIBUTING -->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](https://asd.gsfc.nasa.gov/Tyler.Parsotan/
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
