Skip to main content

Interface to data produced by the Simulating eXtreme Spacetimes collaboration

Project description

Test Status Documentation Status PyPI Version Conda Version MIT License Binder

Simulating eXtreme Spacetimes package

The sxs python package provides a high-level interface for using data produced by the SXS collaboration. In particular, the function sxs.load can automatically find, download, and load data, returning objects that provide common interfaces to the various types of data, without forcing the user to worry about details like data formats or where to find the data. It can also automatically select the newest or highest-resolution dataset for a given simulation, or return a range of versions or resolutions. Currently, the high-level objects encapsulate

  • Dataframe — a catalog of all simulations produced by the SXS collaboration
  • Simulation — an object encapsulating all data for a single simulation
  • Metadata — data describing the simulation parameters
  • Horizons — time-series data describing the apparent horizons
  • Waveform — time-series data describing the extrapolated gravitational-wave modes

Installation

Because this package is pure python code, installation is very simple. In particular, with a reasonably modern installation, you can just run a command like

python -m pip install sxs

or

mamba install -c conda-forge sxs

Here, the first command assumes that you have an appropriate python environment set up in some other way; mamba is the newer replacement for conda, and is a convenient way to install python and manage environments. Either of these commands will download and install the sxs package and its most vital requirements.

You may also want to set some convenient defaults to automatically download and cache data:

python -c "import sxs; sxs.write_config(download=True, cache=True)"

This will write a configuration file in the directory returned by sxs.sxs_directory("config"), and downloaded data will be cached in the directory returned by sxs.sxs_directory("cache"). See that function's documentation for details.

Citing this package and/or data

If you use this package and/or the data it provides in your research, please cite them, including the specific version of the data that you use (see below). To help with this, we provide the function sxs.cite, which will print out a citation — in BibTeX format or just the DOIs — for the package, the most recent paper describing the catalog, the catalog data itself, and optionally individual simulations.

Usage

An extensive demonstration of this package's capabilities is available here, in the form of interactive jupyter notebooks that are actually running this code and some pre-downloaded data. The following is just a very brief overview of the sxs package's main components.

Loading a specific version of the catalog

For the purposes of reproducibility — both reproducing your own results and allowing others to reproduce them — it is important to be aware of which version of the catalog you are using, and to cite it when you publish results using SXS data. Whenever sxs tries to load data, it most first load some version of the catalog. If you do not specify a version, it will automatically find and load the most recent version available via github, and print out a message telling you which version it is using, like

Loading SXS simulations using latest tag 'v3.0.0', published at 2025-05-12T10:00:00Z.

For the rest of that Python session, all data loaded will be from that version of the catalog. If you want to use a different version, you can specify it explicitly while loading the catalog — preferably as

sxs.load("dataframe", tag="3.0.0")

Even if you do not use the returned object from this command, it will ensure that all data will be loaded from the specified version of the catalog. Thus, it is best practice to make this call as soon as you import the sxs package.

Interacting with the data

There are four important objects to understand in this package:

import sxs

# Load a specific version of the catalog for reproducibility
df = sxs.load("dataframe", tag="3.0.0")

# Load a specific simulation
sim = sxs.load("SXS:BBH:4001")

# Obtain data about the horizons
horizons = sim.horizons

# Obtain data about the gravitational-wave strain
h = sim.h

Note that tag is optional, but is good to include because it sets the version of the catalog from which data is loaded, which ensures reproducibility. Leave it out to see the most recent version available, and then use that version consistently in any analysis. Be sure to cite the specific version of the catalog you used in any publications.

The "dataframe" df contains information about every simulation in the catalog, including all available data files, and information about how to get them. You probably don't need to actually know about details like where to get the data, but df can help you find the simulations you care about. It is a pandas.DataFrame object, where the rows are names of simulations (like "SXS:BBH:0123") and the columns include the metadata for the simulations — things like mass ratio, spins, eccentricity, etc. — in addition to extra refinements like spin magnitudes, etc.

Once you have found a simulation you want to work with, you can load it with, e.g., sxs.load("SXS:BBH:4001"), which will return a Simulation object, which contains metadata about the simulation, and allows you to load data from the simulation. By default, it uses the highest-resolution run of the simulation, though this lower resolutions can be specified.

The actual data itself is primarily contained in the next two objects. The horizons object has three attributes — horizons.A, horizons.B, and horizons.C — typically representing the original two horizons of the black-hole binary and the common horizon that forms at merger. In matter simulations, one or more of these may be None. Otherwise, each of these three is a HorizonQuantities object, containing several timeseries relating to mass, spin, and position.

Finally, the h waveform encapsulates the modes of the strain waveform and the corresponding time information, along with relevant metadata like data type, spin weight, etc., with useful features like numpy-array-style slicing.

There is also psi4 data available, which is computed with entirely different methods; h and psi4 are not just computed one from the other by a double integral or differentiation. As a result, we generally recommend using h instead of psi4 unless you have very specific requirements.

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

sxs-2025.0.13.tar.gz (9.9 MB view details)

Uploaded Source

Built Distribution

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

sxs-2025.0.13-py3-none-any.whl (223.6 kB view details)

Uploaded Python 3

File details

Details for the file sxs-2025.0.13.tar.gz.

File metadata

  • Download URL: sxs-2025.0.13.tar.gz
  • Upload date:
  • Size: 9.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for sxs-2025.0.13.tar.gz
Algorithm Hash digest
SHA256 45b8f084aa20036948bc4a0e81f8151caf19fdfa1e58949b18aefde145e9c69a
MD5 5407c71e7862db00cb64e2658dfe2746
BLAKE2b-256 b8040ec46ad4d5880f0e960e9928eda139c5eac7ba106b8fbdc5ad9f7b629cc4

See more details on using hashes here.

File details

Details for the file sxs-2025.0.13-py3-none-any.whl.

File metadata

  • Download URL: sxs-2025.0.13-py3-none-any.whl
  • Upload date:
  • Size: 223.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for sxs-2025.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 0dfcd8135bf15eecf3bad37235d331288817277d6c49f0c44e55b8d4a36c40a4
MD5 0c13967cfc271a8ddc0f3c07be21d350
BLAKE2b-256 a0bfa717444ab256065cff4d1dabb9dcbfa9272726ea12bbba8f95e6764c2fc5

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