From cdf6f8c4af69c36b8ed9bb9488cd8d261183e54d Mon Sep 17 00:00:00 2001 From: Rory Barnes Date: Fri, 9 Feb 2024 13:19:35 -0800 Subject: [PATCH 1/3] Removed title() from reference's to astropy's physical type. --- docs/notebooks/AutoPlot_template.ipynb | 178 ++++++++++++------------- setup.py | 4 +- vplot/figure.py | 4 +- 3 files changed, 93 insertions(+), 93 deletions(-) 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: From 83888017960142a20a1aadac1c8c3be540f44a20 Mon Sep 17 00:00:00 2001 From: Rory Barnes Date: Tue, 3 Sep 2024 16:54:34 -0700 Subject: [PATCH 2/3] Updated download-artifact to v4 --- .github/workflows/docs.yml | 4 +--- .github/workflows/pip-install.yml | 2 +- .github/workflows/tests.yml | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f1afedc..3a02d11 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,9 +3,7 @@ name: docs on: push: branches: [main] - pull_request: - branches: [main] - + jobs: tests: name: "Build docs" diff --git a/.github/workflows/pip-install.yml b/.github/workflows/pip-install.yml index f783326..c59d3d2 100644 --- a/.github/workflows/pip-install.yml +++ b/.github/workflows/pip-install.yml @@ -51,7 +51,7 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'release' && github.event.action == 'published' steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: artifact path: dist diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1a56bb6..f47da1a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,6 @@ name: tests on: pull_request: branches: [main] - push: jobs: tests: From 648e7b6342b51f4a25e8602e6bef837ceb867fc1 Mon Sep 17 00:00:00 2001 From: Rory Barnes Date: Thu, 5 Sep 2024 13:47:16 -0700 Subject: [PATCH 3/3] Updated tests.yml to only publish unit tests for Ubuntu 22 and Python 3.9. --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f47da1a..99446a0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,14 +22,14 @@ jobs: steps: - name: Clone vplot repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: vplot environment-file: environment.yml @@ -63,8 +63,8 @@ jobs: run: python -m pytest -v tests --junitxml=junit/test-results.xml - name: Publish unit test results - uses: EnricoMi/publish-unit-test-result-action@v1 - if: always() + uses: EnricoMi/publish-unit-test-result-action@v2 + if: ${{ matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9' }} with: files: junit/test-*.xml comment_mode: update last