{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "To obtain the data to run this tutorial, download the tar.gz file from https://zenodo.org/records/10668525 and unzip it. Then run the creating_h5 tutorial to create a .h5 file to use with this tutorial. Then set example_h5_filepath to be the path to that .h5 file.\n", "\n", "Once you have run the tutorial on the sample simulation, you can also try downloading a file from the MAYA catalog in the MAYA format (https://cgp.ph.utexas.edu/waveform) and using it with the tutorial." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Exporting to LVK Catalog Format" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "from mayawaves.coalescence import Coalescence\n", "from mayawaves.utils.postprocessingutils import export_to_lvcnr_catalog, export_to_lal_compatible_format" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create a Coalescence object using the simulation h5 file" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "example_h5_filepath = \"D11_q5_a1_-0.362_-0.0548_-0.64_a2_-0.0013_0.001_-0.0838_m533.33.h5\"\n", "output_direcory = \"\"" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "coalescence = Coalescence(example_h5_filepath)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Export to the LVC NR catalog format\n", "### Exporting to this format requires extrapolating the waveforms to infinite radius.\n", "### The exported file will have the same name as the initial simulation h5 file. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This simulation is not part of a catalog and does not have a catalog id.\n", "Storing (l, m)=(2, -2)\n", "Storing (l, m)=(2, -1)\n", "Storing (l, m)=(2, 0)\n", "Storing (l, m)=(2, 1)\n", "Storing (l, m)=(2, 2)\n", "Storing (l, m)=(3, -3)\n", "Storing (l, m)=(3, -2)\n", "Storing (l, m)=(3, -1)\n", "Storing (l, m)=(3, 0)\n", "Storing (l, m)=(3, 1)\n", "Storing (l, m)=(3, 2)\n", "Storing (l, m)=(3, 3)\n", "Storing (l, m)=(4, -4)\n", "Storing (l, m)=(4, -3)\n", "Storing (l, m)=(4, -2)\n", "Storing (l, m)=(4, -1)\n", "Storing (l, m)=(4, 0)\n", "Storing (l, m)=(4, 1)\n", "Storing (l, m)=(4, 2)\n", "Storing (l, m)=(4, 3)\n", "Storing (l, m)=(4, 4)\n" ] } ], "source": [ "export_to_lvcnr_catalog(coalescence, output_direcory, NR_group='UT Austin', NR_code='MAYA', bibtex_keys='Jani:2016wkt', contact_email='email@email.com')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### An optional name can be provided which will be used as the name of the exported file" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This simulation is not part of a catalog and does not have a catalog id.\n", "Storing (l, m)=(2, -2)\n", "Storing (l, m)=(2, -1)\n", "Storing (l, m)=(2, 0)\n", "Storing (l, m)=(2, 1)\n", "Storing (l, m)=(2, 2)\n", "Storing (l, m)=(3, -3)\n", "Storing (l, m)=(3, -2)\n", "Storing (l, m)=(3, -1)\n", "Storing (l, m)=(3, 0)\n", "Storing (l, m)=(3, 1)\n", "Storing (l, m)=(3, 2)\n", "Storing (l, m)=(3, 3)\n", "Storing (l, m)=(4, -4)\n", "Storing (l, m)=(4, -3)\n", "Storing (l, m)=(4, -2)\n", "Storing (l, m)=(4, -1)\n", "Storing (l, m)=(4, 0)\n", "Storing (l, m)=(4, 1)\n", "Storing (l, m)=(4, 2)\n", "Storing (l, m)=(4, 3)\n", "Storing (l, m)=(4, 4)\n" ] } ], "source": [ "export_to_lvcnr_catalog(coalescence, output_direcory, name='SIM0001', NR_group='UT Austin', NR_code='MAYA', bibtex_keys='Jani:2016wkt', contact_email='email@email.com')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### You can optionally correct for the center of mass drift before exporting" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This simulation is not part of a catalog and does not have a catalog id.\n", "Storing (l, m)=(2, -2)\n", "Storing (l, m)=(2, -1)\n", "Storing (l, m)=(2, 0)\n", "Storing (l, m)=(2, 1)\n", "Storing (l, m)=(2, 2)\n", "Storing (l, m)=(3, -3)\n", "Storing (l, m)=(3, -2)\n", "Storing (l, m)=(3, -1)\n", "Storing (l, m)=(3, 0)\n", "Storing (l, m)=(3, 1)\n", "Storing (l, m)=(3, 2)\n", "Storing (l, m)=(3, 3)\n", "Storing (l, m)=(4, -4)\n", "Storing (l, m)=(4, -3)\n", "Storing (l, m)=(4, -2)\n", "Storing (l, m)=(4, -1)\n", "Storing (l, m)=(4, 0)\n", "Storing (l, m)=(4, 1)\n", "Storing (l, m)=(4, 2)\n", "Storing (l, m)=(4, 3)\n", "Storing (l, m)=(4, 4)\n" ] } ], "source": [ "export_to_lvcnr_catalog(coalescence, output_direcory, center_of_mass_correction=True, NR_group='UT Austin', NR_code='MAYA', bibtex_keys='Jani:2016wkt', contact_email='email@email.com')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Export to LAL Compatible format\n", "### This format lets you use the waveform with LALSimulation and PyCBC. It is of the same format as the LVC NR catalog but allows you to specify a finite extraction radius if so desired." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Storing (l, m)=(2, -2)\n", "Storing (l, m)=(2, -1)\n", "Storing (l, m)=(2, 0)\n", "Storing (l, m)=(2, 1)\n", "Storing (l, m)=(2, 2)\n", "Storing (l, m)=(3, -3)\n", "Storing (l, m)=(3, -2)\n", "Storing (l, m)=(3, -1)\n", "Storing (l, m)=(3, 0)\n", "Storing (l, m)=(3, 1)\n", "Storing (l, m)=(3, 2)\n", "Storing (l, m)=(3, 3)\n", "Storing (l, m)=(4, -4)\n", "Storing (l, m)=(4, -3)\n", "Storing (l, m)=(4, -2)\n", "Storing (l, m)=(4, -1)\n", "Storing (l, m)=(4, 0)\n", "Storing (l, m)=(4, 1)\n", "Storing (l, m)=(4, 2)\n", "Storing (l, m)=(4, 3)\n", "Storing (l, m)=(4, 4)\n" ] } ], "source": [ "export_to_lal_compatible_format(coalescence, output_direcory, extraction_radius=75, NR_group='UT Austin', NR_code='MAYA', bibtex_keys='Jani:2016wkt', contact_email='email@email.com')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Close the Coalescence object to close the associated h5 file" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "coalescence.close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "mayawaves_dev", "language": "python", "name": "mayawaves_dev" }, "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.8.15" } }, "nbformat": 4, "nbformat_minor": 4 }