{ "cells": [ { "cell_type": "markdown", "id": "a1b2c3d4", "metadata": {}, "source": [ "# Downloading Waveforms from Different Catalogs\n", "\n", "This tutorial demonstrates how to download and work with waveforms from various numerical relativity catalogs using PyART. PyART provides a unified interface to access data from multiple catalogs including:\n", "\n", "- **SXS** (Simulating eXtreme Spacetimes)\n", "- **RIT** (Rochester Institute of Technology)\n", "- **CoRe** (Computational Relativity)\n", "- **GRA** (GR-Athena++)\n", "- **ICCUB** (Institute of Cosmos Sciences)\n", "- **SACRA**\n", "\n", "## Setup\n", "\n", "First, let's import the necessary modules:" ] }, { "cell_type": "code", "execution_count": null, "id": "e5f6g7h8", "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "%config InlineBackend.figure_format = 'retina'\n", "\n", "from PyART.catalogs import sxs, rit, core, icc_public\n", "from PyART.catalogs.cataloger import Cataloger" ] }, { "cell_type": "markdown", "id": "i9j0k1l2", "metadata": {}, "source": [ "## Downloading from a Single Catalog\n", "\n", "Let's start by downloading waveforms from the SXS catalog. We specify:\n", "- The catalog name\n", "- The simulation ID\n", "- Whether to download if not locally available" ] }, { "cell_type": "markdown", "id": "67211c4a", "metadata": {}, "source": [ "### SXS" ] }, { "cell_type": "code", "execution_count": null, "id": "m3n4o5p6", "metadata": {}, "outputs": [], "source": [ "# Download and load an SXS waveform\n", "# Note: You may need to adjust the path or set download=True\n", "sxs_id = '0180'\n", "wf_sxs = sxs.Waveform_SXS(path='./', ID=sxs_id, download=True, cut_N=300, ignore_deprecation=True)\n", "\n", "print(f\"SXS Waveform {sxs_id} loaded successfully\")\n", "print(f\"Mass ratio q = {wf_sxs.metadata['q']:.3f}\")\n", "print(f\"Total mass M = {wf_sxs.metadata['M']:.3f}\")\n", "print(f\"Chi1z = {wf_sxs.metadata['chi1z']:.3f}\")\n", "print(f\"Chi2z = {wf_sxs.metadata['chi2z']:.3f}\")" ] }, { "cell_type": "markdown", "id": "3a8caa94", "metadata": {}, "source": [ "### RIT\n", "The RIT catalog waveforms are downloaded via wget from the RIT website, rather than from a dedicated API. Horizon data is not available for RIT waveforms." ] }, { "cell_type": "code", "execution_count": null, "id": "c9d0e1f2", "metadata": {}, "outputs": [], "source": [ "# Note: This requires having a RIT data path set up\n", "# or will download the data if download=True\n", "# For this example, we'll show the structure without executing\n", "\n", "rit_id = 1096\n", "wf_rit = rit.Waveform_RIT(path='./', ID=rit_id, \n", " download=True, nu_rescale=True)\n", "print(f\"RIT Waveform {rit_id} loaded\")\n", "print(f\"Mass ratio q = {wf_rit.metadata['q']:.3f}\")\n", "print(f\"Total mass M = {wf_rit.metadata['M']:.3f}\")\n", "print(f\"Chi1z = {wf_rit.metadata['chi1z']:.3f}\")\n", "print(f\"Chi2z = {wf_rit.metadata['chi2z']:.3f}\")" ] }, { "cell_type": "markdown", "id": "777cc4f0", "metadata": {}, "source": [ "### CoRe database\n", "\n", "CoRe database waveforms are downloaded from the gitlab public repository, using git-lfs.\n", "\n", "For the download of THC waveforms, modify the `code` argument accordingly." ] }, { "cell_type": "code", "execution_count": null, "id": "37473c05", "metadata": {}, "outputs": [], "source": [ "core_id = '0001'\n", "wf_core = core.Waveform_CoRe(path='./', ID=core_id, download=True, code='BAM')\n", "\n", "print(f\"CoRe Waveform {core_id} loaded\")\n", "print(f\"Mass ratio q = {wf_core.metadata['q']:.3f}\")\n", "print(f\"Total mass M = {wf_core.metadata['M']:.3f}\")\n", "print(f\"Chi1z = {wf_core.metadata['chi1z']:.3f}\")\n", "print(f\"Chi2z = {wf_core.metadata['chi2z']:.3f}\")" ] }, { "cell_type": "markdown", "id": "fd4e0b04", "metadata": {}, "source": [ "### ICCUB (public repository)" ] }, { "cell_type": "code", "execution_count": null, "id": "8374183a", "metadata": {}, "outputs": [], "source": [ "wf_icc = icc_public.Waveform_ICC(path='./', ID='0001', download=True, ellmax=4)\n", "\n", "print(f\"ICCUB Waveform 0001 loaded\")\n", "print(f\"Mass ratio q = {wf_icc.metadata['q']:.3f}\")\n", "print(f\"Total mass M = {wf_icc.metadata['M']:.3f}\")\n", "print(f\"Chi1z = {wf_icc.metadata['chi1z']:.3f}\")\n", "print(f\"Chi2z = {wf_icc.metadata['chi2z']:.3f}\")" ] }, { "cell_type": "markdown", "id": "ccbca6fe", "metadata": {}, "source": [ "### GR-Athena++\n", "\n", "TODO: implement and demonstrate" ] }, { "cell_type": "markdown", "id": "g3h4i5j6", "metadata": {}, "source": [ "## Using the Cataloger for Bulk Operations\n", "\n", "The `Cataloger` class provides a convenient way to work with multiple simulations from a catalog at once. This is particularly useful for computing mismatches or other comparative analyses across a set of simulations.\n", "\n", "Here's an example structure:" ] }, { "cell_type": "code", "execution_count": null, "id": "k7l8m9n0", "metadata": {}, "outputs": [], "source": [ "# Example: Working with multiple RIT simulations\n", "sim_list = list(range(1096, 1100)) # List of simulation IDs\n", "\n", "cat = Cataloger(\n", " path='./local_data/rit/', \n", " catalog='rit', \n", " sim_list=sim_list,\n", " add_opts={'download': True, 'nu_rescale': True}\n", ")\n", "\n", "# Plot all waveforms in the catalog\n", "cat.plot_waves()" ] }, { "cell_type": "markdown", "id": "o1p2q3r4", "metadata": {}, "source": [ "## Comparing Waveforms Between Catalogs\n", "\n", "One of PyART's strengths is the ability to easily compare waveforms from different catalogs. Since all catalogs use the same interface, you can load waveforms from different sources and compare them directly.\n", "\n", "For detailed mismatch calculations between catalogs, see the [Mode-by-mode Mismatch tutorial](mismatch.ipynb)." ] }, { "cell_type": "markdown", "id": "s5t6u7v8", "metadata": {}, "source": [ "## Summary\n", "\n", "This tutorial covered:\n", "- How to download waveforms from the SXS catalog\n", "- How to access waveform metadata\n", "- How to compute and plot waveform modes\n", "- The structure for working with other catalogs (RIT, CoRe, etc.)\n", "- Using the `Cataloger` class for bulk operations\n", "\n", "### Next Steps\n", "\n", "- Explore the [Intro to Waveforms](intro_to_waveforms.ipynb) tutorial for more details on waveform manipulation\n", "- Learn about [Phase Alignment](phase_alignment.ipynb) techniques\n", "- Calculate [Mode-by-mode Mismatches](mismatch.ipynb) between waveforms" ] } ], "metadata": { "kernelspec": { "display_name": "pyart-dev-3.11", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.11" } }, "nbformat": 4, "nbformat_minor": 5 }