Getting started


You can install the latest release of fruitbat from PyPi by running the following:

pip install fruitbat

You can install the latest development version of fruitbat by cloning the repository:

git clone
cd fruitbat
pip install .

If you are installing the latest development version of FRUITBAT then you will also need to install git-lfs. Instructions for installing git-lfs for your operating system can be found here.


Below are the listed requirements for running fruitbat and the purpose for each requirement.

  • numpy: Array manipulation
  • scipy: Modules for integration and interpolation
  • astropy: Modules for cosmology, coordinates, constants and units
  • matplotlib: Modules for plotting
  • pandas: Reading csv files from FRBCAT
  • pyymw16: Python wrapper for YMW16 galactic dispersion measure model.
  • e13tools: Utility tools for writing docstrings.

Running Tests

Fruitbat uses pytests to perform all its testing. If you would like to run the tests yourself you will need to install all the packages in requirements_dev. The easiest way of doing this is by cloning the source directory, install all requirements and running pytest:

git clone
cd fruitbat
pip install -r requirements_dev.txt

Pytest should take around 5 minutes.

Simple Example

A detailed explanation of this example can be viewed at Using Fruitbat.

>>> import fruitbat

# Create a Frb Object with DM and Galactic Coordinates
>>> FRB180110 = fruitbat.Frb(715.7, gl="7.8", gb="-51.9", name="FRB180110")

# Calculate the DM contribution from the Milky Way
>>> FRB180110.calc_dm_galaxy()

# Calculate the Redshift of the FRB using the relation from Zhang (2018)
>>> FRB180110.calc_redshift(method="Zhang2018", cosmology="Planck18")