diff --git a/docs/notebooks/AutoPlot_template.ipynb b/docs/notebooks/AutoPlot_template.ipynb index f598207..257ad2b 100644 --- a/docs/notebooks/AutoPlot_template.ipynb +++ b/docs/notebooks/AutoPlot_template.ipynb @@ -2,53 +2,47 @@ "cells": [ { "cell_type": "markdown", - "metadata": {}, "source": [ "# The `auto_plot` function" - ] + ], + "metadata": {} }, { "cell_type": "code", "execution_count": null, - "metadata": { - "tags": [ - "hide_input" - ] - }, - "outputs": [], "source": [ "%matplotlib inline\n", "\n", "from IPython.display import set_matplotlib_formats\n", "\n", - "set_matplotlib_formats('retina')" - ] + "#set_matplotlib_formats('retina')" + ], + "outputs": [], + "metadata": { + "tags": [ + "hide_input" + ] + } }, { "cell_type": "markdown", - "metadata": {}, "source": [ "## Overview" - ] + ], + "metadata": {} }, { "cell_type": "raw", - "metadata": { - "raw_mimetype": "text/restructuredtext" - }, "source": [ "The easiest way to plot stuff with :py:obj:`vplot` is using the :py:class:`vplot.auto_plot` function. Given a path to a directory containing a :py:obj:`vplanet` run, :py:class:`vplot.auto_plot` will parse the output and generate plots of all of the simulated quantities as a function of time for all of the bodies." - ] + ], + "metadata": { + "raw_mimetype": "text/restructuredtext" + } }, { "cell_type": "code", "execution_count": null, - "metadata": { - "tags": [ - "hide_input" - ] - }, - "outputs": [], "source": [ "# Tar up the example folder\n", "import glob\n", @@ -58,121 +52,123 @@ "with tarfile.open(\"examples/CircumbinaryOrbit.tar.gz\", \"w:gz\") as tar:\n", " for file in glob.glob(\"examples/CircumbinaryOrbit/*.in\"):\n", " tar.add(file, arcname=os.path.basename(file))" - ] + ], + "outputs": [], + "metadata": { + "tags": [ + "hide_input" + ] + } }, { "cell_type": "raw", - "metadata": { - "raw_mimetype": "text/restructuredtext" - }, "source": [ "Let's run :py:class:`vplot.auto_plot` on the :download:`CircumbinaryOrbit ` example." - ] + ], + "metadata": { + "raw_mimetype": "text/restructuredtext" + } }, { "cell_type": "code", "execution_count": null, - "metadata": {}, - "outputs": [], "source": [ "import vplot" - ] + ], + "outputs": [], + "metadata": {} }, { "cell_type": "raw", - "metadata": { - "raw_mimetype": "text/restructuredtext" - }, "source": [ "When we call :py:class:`vplot.auto_plot`, we pass the directory to the :py:obj:`vplanet` run:" - ] + ], + "metadata": { + "raw_mimetype": "text/restructuredtext" + } }, { "cell_type": "code", "execution_count": null, - "metadata": { - "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\")" - }, - "outputs": [], "source": [ "from figure_grid import FigureGrid\n", "\n", "FigureGrid(\n", " vplot.auto_plot(\"examples/CircumbinaryOrbit\", show=False, figsize=(5, 3), dpi=300)\n", ").display()" - ] + ], + "outputs": [], + "metadata": { + "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\")" + } }, { "cell_type": "raw", - "metadata": { - "raw_mimetype": "text/restructuredtext" - }, "source": [ ".. note::\n", " You must actually run :py:obj:`vplanet` before calling :py:obj:`vplot`!" - ] + ], + "metadata": { + "raw_mimetype": "text/restructuredtext" + } }, { "cell_type": "markdown", - "metadata": {}, "source": [ "By default, parameters are grouped by *parameter name*. This means that if there are multiple bodies with the same parameter, they will all show up in the same plot, with labels indicating the body they correspond to. We can disable grouping by running" - ] + ], + "metadata": {} }, { "cell_type": "code", "execution_count": null, - "metadata": { - "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", group=\"none\")" - }, - "outputs": [], "source": [ "FigureGrid(\n", " vplot.auto_plot(\"examples/CircumbinaryOrbit\", show=False, figsize=(5, 3), dpi=300, group=\"none\")\n", ").display()" - ] + ], + "outputs": [], + "metadata": { + "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", group=\"none\")" + } }, { "cell_type": "markdown", - "metadata": {}, "source": [ "Alternatively, we can group by *physical type*. This means that everything that is an angle will be grouped into one plot, everything that has units of distance will be grouped into a different plot, and so forth. It isn't always useful, particularly if you have *lots* of parameters of the same physical type (as is the case here)." - ] + ], + "metadata": {} }, { "cell_type": "code", "execution_count": null, - "metadata": { - "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", group=\"type\")" - }, - "outputs": [], "source": [ "FigureGrid(\n", " vplot.auto_plot(\"examples/CircumbinaryOrbit\", show=False, figsize=(5, 3), dpi=300, group=\"type\")\n", ").display()" - ] + ], + "outputs": [], + "metadata": { + "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", group=\"type\")" + } }, { "cell_type": "markdown", - "metadata": {}, "source": [ "## Useful options" - ] + ], + "metadata": {} }, { "cell_type": "markdown", - "metadata": {}, "source": [ "We can plot only specific parameters:" - ] + ], + "metadata": {} }, { "cell_type": "code", "execution_count": null, - "metadata": { - "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", params=[\"eccentricity\", \"CBPR\"])" - }, - "outputs": [], "source": [ "FigureGrid(\n", " vplot.auto_plot(\n", @@ -183,22 +179,22 @@ " params=[\"eccentricity\", \"CBPR\"],\n", " )\n", ").display()" - ] + ], + "outputs": [], + "metadata": { + "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", params=[\"eccentricity\", \"CBPR\"])" + } }, { "cell_type": "markdown", - "metadata": {}, "source": [ "And we can plot only specific bodies:" - ] + ], + "metadata": {} }, { "cell_type": "code", "execution_count": null, - "metadata": { - "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", params=[\"eccentricity\", \"CBPR\"], bodies=\"earth\")" - }, - "outputs": [], "source": [ "FigureGrid(\n", " vplot.auto_plot(\n", @@ -210,35 +206,35 @@ " bodies=\"earth\",\n", " ),\n", ").display()" - ] + ], + "outputs": [], + "metadata": { + "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", params=[\"eccentricity\", \"CBPR\"], bodies=\"earth\")" + } }, { "cell_type": "raw", - "metadata": { - "raw_mimetype": "text/restructuredtext" - }, "source": [ ".. note::\n", " Body and parameter names are case-insensitive, but otherwise \n", " they must match the values in the ``.in`` files exactly.\n", " Note that the parameter names are those specified in the\n", " ``saOutputOrder`` line of the ``.in`` files." - ] + ], + "metadata": { + "raw_mimetype": "text/restructuredtext" + } }, { "cell_type": "markdown", - "metadata": {}, "source": [ "We can also plot things logarithmically:" - ] + ], + "metadata": {} }, { "cell_type": "code", "execution_count": null, - "metadata": { - "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", params=[\"eccentricity\", \"CBPR\"], bodies=\"earth\", xlog=True, ylog=False)" - }, - "outputs": [], "source": [ "FigureGrid(\n", " vplot.auto_plot(\n", @@ -252,16 +248,20 @@ " ylog=False\n", " ),\n", ").display()" - ] + ], + "outputs": [], + "metadata": { + "replace_input": "vpl.auto_plot(\"examples/CircumbinaryOrbit\", params=[\"eccentricity\", \"CBPR\"], bodies=\"earth\", xlog=True, ylog=False)" + } }, { "cell_type": "raw", - "metadata": { - "raw_mimetype": "text/restructuredtext" - }, "source": [ "Finally, note that :py:class:`vplot.auto_plot` also accepts any keyword arguments accepted by :py:class:`vplot.VPLOTFigure` and :py:class:`matplotlib.figure.Figure`, such as ``figsize`` and ``dpi``." - ] + ], + "metadata": { + "raw_mimetype": "text/restructuredtext" + } } ], "metadata": { @@ -286,4 +286,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/setup.py b/setup.py index 8ff1875..f68a683 100644 --- a/setup.py +++ b/setup.py @@ -23,8 +23,8 @@ "setuptools_scm", "numpy>=1.19.2", "matplotlib>=3.3.4", - "astropy>=4.1", - "vplanet>=2.0.0", + "astropy>=6.0.0", + "vplanet>=2.4.24", ], entry_points={ "console_scripts": ["vplot=vplot.command_line:_entry_point"] diff --git a/vplot/figure.py b/vplot/figure.py index a163a01..1a9d4df 100644 --- a/vplot/figure.py +++ b/vplot/figure.py @@ -19,7 +19,7 @@ def _get_array_info(array, max_label_length=40): unit = None body = None label = None - physical_type = array.unit.physical_type.title() + physical_type = array.unit.physical_type if physical_type == "Dimensionless": physical_type = None else: @@ -30,7 +30,7 @@ def _get_array_info(array, max_label_length=40): label = array.tags.get("description", None) if label is not None and len(label) > max_label_length: label = array.tags.get("name", None) - physical_type = array.unit.physical_type.title() + physical_type = array.unit.physical_type if physical_type == "Dimensionless": physical_type = None else: