{ "cells": [ { "cell_type": "markdown", "id": "atomic-data-summary-title", "metadata": {}, "source": [ "# Creating an atomic-data summary table\n", "\n", "This notebook shows how to create a compact summary of the atomic levels and lines available for each element. The summary is returned as a pandas DataFrame and written as both plain text and LaTeX files." ] }, { "cell_type": "code", "execution_count": null, "id": "atomic-data-summary-imports", "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "from tempfile import TemporaryDirectory\n", "\n", "from tardis.io.atom_data import export_atom_data_summary\n", "from tardis.io.atom_data.util import resolve_atom_data_fname" ] }, { "cell_type": "markdown", "id": "atomic-data-summary-example-description", "metadata": {}, "source": [ "An ion is included in the summary when it has more than one level and at least one line. You can supply an atomic data HDF file or a TARDIS AtomData object. The example here uses a temporary directory to save the output." ] }, { "cell_type": "code", "execution_count": null, "id": "atomic-data-summary-create-table", "metadata": {}, "outputs": [], "source": [ "atomic_data_path = resolve_atom_data_fname(\"kurucz_cd23_chianti_H_He_latest\")\n", "\n", "with TemporaryDirectory() as directory:\n", " summary = export_atom_data_summary(\n", " atomic_data_path,\n", " Path(directory) / \"atomic_data_summary\",\n", " journal=\"aas\",\n", " )\n", "\n", "summary" ] }, { "cell_type": "markdown", "id": "atomic-data-summary-output-description", "metadata": {}, "source": [ "The `journal` argument selects the LaTeX layout. Built-in layouts are available for `aa`, `aas`, `mnras`, and `nature`; a JSON configuration can also be supplied. The output basename above produces `atomic_data_summary.txt` and `atomic_data_summary.tex` in the temporary directory." ] } ], "metadata": { "kernelspec": { "display_name": "tardis", "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.14.5" } }, "nbformat": 4, "nbformat_minor": 5 }