Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-physt for openSUSE:Factory checked in at 2025-08-29 18:36:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-physt (Old) and /work/SRC/openSUSE:Factory/.python-physt.new.1977 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-physt" Fri Aug 29 18:36:30 2025 rev:11 rq:1301858 version:0.8.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-physt/python-physt.changes 2025-02-09 20:01:48.899339682 +0100 +++ /work/SRC/openSUSE:Factory/.python-physt.new.1977/python-physt.changes 2025-08-29 18:38:37.438814847 +0200 @@ -1,0 +2,12 @@ +Fri Aug 29 04:17:05 UTC 2025 - Steve Kowalik <steven.kowa...@suse.com> + +- Actually switch to using flit-core. +- Skip a broken test. + +------------------------------------------------------------------- +Mon Apr 28 14:10:04 UTC 2025 - Dirk Müller <dmuel...@suse.com> + +- update to 0.8.6: + * Plotting: fixed ASCII heatmaps (swapped axes) + +------------------------------------------------------------------- Old: ---- physt-0.8.5.tar.gz New: ---- physt-0.8.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-physt.spec ++++++ --- /var/tmp/diff_new_pack.HwBpG3/_old 2025-08-29 18:38:37.958836931 +0200 +++ /var/tmp/diff_new_pack.HwBpG3/_new 2025-08-29 18:38:37.958836931 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-physt # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,16 +17,15 @@ Name: python-physt -Version: 0.8.5 +Version: 0.8.6 Release: 0 Summary: Python histogram library License: MIT URL: https://github.com/janpipek/physt Source: https://github.com/janpipek/physt/archive/v%{version}.tar.gz#/physt-%{version}.tar.gz BuildRequires: %{python_module base >= 3.9} +BuildRequires: %{python_module flit-core >= 3.4} BuildRequires: %{python_module pip} -BuildRequires: %{python_module setuptools >= 65} -BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-hypothesis >= 6.96.1 @@ -79,9 +78,8 @@ %check # no polars ignore="--ignore tests/compat/test_polars.py" -# gh#janpipek/physt#121 -python313_donttest=("-k" "not test_zero_statistics") -%pytest $ignore "${$python_donttest[@]}" +donttest="test_array_at_least_two_different_values or test_zero_statistics" +%pytest $ignore -k "not ($donttest)" %files %{python_files} %doc README.md ++++++ physt-0.8.5.tar.gz -> physt-0.8.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/.github/workflows/app.yaml new/physt-0.8.6/.github/workflows/app.yaml --- old/physt-0.8.5/.github/workflows/app.yaml 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/.github/workflows/app.yaml 2025-02-25 15:24:20.000000000 +0100 @@ -18,57 +18,61 @@ runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v2 + - name: Install uv + uses: astral-sh/setup-uv@v5 with: - python-version: ${{ matrix.python }} + # Install a specific version of uv. + version: "0.5.24" + python-version: ${{ matrix.python-version }} + enable-cache: true - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools wheel - pip install .[all] + - name: Install the project + run: uv sync --all-extras --dev - name: Run pytest - run: pytest + run: uv run pytest mypy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v2 + - name: Install uv + uses: astral-sh/setup-uv@v5 with: - python-version: "3.12" + # Install a specific version of uv. + version: "0.5.24" + python-version: 3.12 + enable-cache: true - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools wheel - pip install .[all] + - name: Install the project + run: uv sync --all-extras --dev - name: Run mypy (on source) - run: mypy src/physt + run: uv run mypy src/physt - name: Run mypy (on tests) - run: mypy tests + run: uv run mypy tests build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v2 + - name: Install uv + uses: astral-sh/setup-uv@v5 with: - python-version: "3.12" + # Install a specific version of uv. + version: "0.5.24" + python-version: 3.12 + enable-cache: true - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools wheel build + - name: Install the project + run: uv sync --all-extras --dev - name: Build - run: python -m build + run: uv build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/HISTORY.txt new/physt-0.8.6/HISTORY.txt --- old/physt-0.8.5/HISTORY.txt 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/HISTORY.txt 2025-02-25 15:24:20.000000000 +0100 @@ -1,3 +1,12 @@ +0.8.6 (25 Feb 2025) +------------------- +- Plotting: fixed ASCII heatmaps (swapped axes) + +0.8.5 (27 Jan 2025) +------------------- +- Plotting: improved ASCII plotting +- Build system: changed to flit + 0.8.4 (11 Oct 2024) ------------------- - UX: a bit of rich support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/README.md new/physt-0.8.6/README.md --- old/physt-0.8.5/README.md 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/README.md 2025-02-25 15:24:20.000000000 +0100 @@ -18,7 +18,7 @@ ## See it in action -With [`uv`](https://docs.astral.sh/uv/) installed, you can run the following command without needing to install +With [`uv`](https://docs.astral.sh/uv/) installed, you can run the following command without needing to install anything to see some examples in action: ```bash @@ -121,7 +121,7 @@ * Simple statistics for original data (mean, std, sem) - only for 1D histograms * Plotting with several backends - matplotlib (static plots with many options) - - vega (interactive plots, beta, help wanted!) + - vega (interactive plots, broken, help wanted!) - folium (experimental for geo-data) - plotly (very basic, help wanted!) - ascii (experimental) @@ -155,10 +155,8 @@ - (optional) polars (1.0+), pandas (1.5+), dask, xarray - if you want to histogram those - (optional) matplotlib - simple visualization - (optional) xarray - I/O -- (optional) uproot - I/O - (optional) astropy - additional binning algorithms - (optional) folium - map plotting -- (optional) vega3 - for vega in-line in IPython notebook (note that to generate vega JSON, this is not necessary) - (optional) rich - console output including plots - (testing) pytest - (docs) sphinx, sphinx_rtd_theme, ipython diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/conda/meta.yaml new/physt-0.8.6/conda/meta.yaml --- old/physt-0.8.5/conda/meta.yaml 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/conda/meta.yaml 2025-02-25 15:24:20.000000000 +0100 @@ -1,4 +1,4 @@ -{% set version = "0.8.5" %} +{% set version = "0.8.6" %} package: name: physt @@ -34,5 +34,7 @@ about: home: https://github.com/janpipek/physt - license: MIT License + license: MIT + license_family: MIT + license_file: LICENSE.txt summary: 'P(i/y)thon h(i/y)stograms.' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/doc/ascii.ipynb new/physt-0.8.6/doc/ascii.ipynb --- old/physt-0.8.5/doc/ascii.ipynb 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/doc/ascii.ipynb 2025-02-25 15:24:20.000000000 +0100 @@ -4,9 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# ASCII plotting\n", - "\n", - "**Note: For this notebook to work properly, you need to install the `xtermcolor` package.**" + "# ASCII plotting" ] }, { @@ -29,24 +27,138 @@ "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "#\n", - "####\n", - "#############\n", - "#######################\n", - "#######################\n", - "############\n", - "####\n", - "#\n", - "\n" - ] + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">▏ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10</span>\n", + "</pre>\n" + ], + "text/plain": [ + "▏ \u001b[1;36m10\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">█ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">88</span>\n", + "</pre>\n" + ], + "text/plain": [ + "█ \u001b[1;36m88\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">████ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">485</span>\n", + "</pre>\n" + ], + "text/plain": [ + "████ \u001b[1;36m485\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">█████████████ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1605</span>\n", + "</pre>\n" + ], + "text/plain": [ + "█████████████ \u001b[1;36m1605\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">███████████████████████ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2831</span>\n", + "</pre>\n" + ], + "text/plain": [ + "███████████████████████ \u001b[1;36m2831\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">███████████████████████ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2844</span>\n", + "</pre>\n" + ], + "text/plain": [ + "███████████████████████ \u001b[1;36m2844\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">████████████ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1543</span>\n", + "</pre>\n" + ], + "text/plain": [ + "████████████ \u001b[1;36m1543\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">████ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">498</span>\n", + "</pre>\n" + ], + "text/plain": [ + "████ \u001b[1;36m498\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">█ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">88</span>\n", + "</pre>\n" + ], + "text/plain": [ + "█ \u001b[1;36m88\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">▏ <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>\n", + "</pre>\n" + ], + "text/plain": [ + "▏ \u001b[1;36m8\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "examples.normal_h1().plot()" + "examples.normal_h1().plot(show_values=True)" ] }, { @@ -55,45 +167,230 @@ "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - " 4.48 →\n", - "+----------+\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|3.69 ↑\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;233m\u001b[48;5;16m█\u001b[0m\u001b[38;5;233m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;233m\u001b[48;5;16m█\u001b[0m\u001b[38;5;236m\u001b[48;5;16m█\u001b[0m\u001b[38;5;238m\u001b[48;5;16m█\u001b[0m\u001b[38;5;240m\u001b[48;5;16m█\u001b[0m\u001b[38;5;237m\u001b[48;5;16m█\u001b[0m\u001b[38;5;233m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;235m\u001b[48;5;16m█\u001b[0m\u001b[38;5;244m\u001b[48;5;16m█\u001b[0m\u001b[38;5;7m\u001b[48;5;16m█\u001b[0m\u001b[38;5;250m\u001b[48;5;16m█\u001b[0m\u001b[38;5;243m\u001b[48;5;16m█\u001b[0m\u001b[38;5;235m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;237m\u001b[48;5;16m█\u001b[0m\u001b[38;5;247m\u001b[48;5;16m█\u001b[0m\u001b[38;5;231m\u001b[48;5;16m█\u001b[0m\u001b[38;5;255m\u001b[48;5;16m█\u001b[0m\u001b[38;5;245m\u001b[48;5;16m█\u001b[0m\u001b[38;5;237m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;235m\u001b[48;5;16m█\u001b[0m\u001b[38;5;243m\u001b[48;5;16m█\u001b[0m\u001b[38;5;247m\u001b[48;5;16m█\u001b[0m\u001b[38;5;248m\u001b[48;5;16m█\u001b[0m\u001b[38;5;59m\u001b[48;5;16m█\u001b[0m\u001b[38;5;235m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;235m\u001b[48;5;16m█\u001b[0m\u001b[38;5;237m\u001b[48;5;16m█\u001b[0m\u001b[38;5;236m\u001b[48;5;16m█\u001b[0m\u001b[38;5;234m\u001b[48;5;16m█\u001b[0m\u001b[38;5;233m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;233m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;232m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|\n", - "|\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m|-3.66 ↓\n", - "+----------+\n", - "← -3.86\n", - "\n", - "↓ 0\n", - "\u001b[38;5;16m\u001b[48;5;16m█\u001b[0m\u001b[38;5;233m\u001b[48;5;16m█\u001b[0m\u001b[38;5;235m\u001b[48;5;16m█\u001b[0m\u001b[38;5;238m\u001b[48;5;16m█\u001b[0m\u001b[38;5;240m\u001b[48;5;16m█\u001b[0m\u001b[38;5;242m\u001b[48;5;16m█\u001b[0m\u001b[38;5;244m\u001b[48;5;16m█\u001b[0m\u001b[38;5;246m\u001b[48;5;16m█\u001b[0m\u001b[38;5;248m\u001b[48;5;16m█\u001b[0m\u001b[38;5;7m\u001b[48;5;16m█\u001b[0m\u001b[38;5;188m\u001b[48;5;16m█\u001b[0m\u001b[38;5;255m\u001b[48;5;16m█\u001b[0m\n", - " 879 ↑\n" - ] + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4.48</span> →\n", + "</pre>\n" + ], + "text/plain": [ + " \u001b[1;36m4.48\u001b[0m →\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┌──────────┐\n", + "</pre>\n" + ], + "text/plain": [ + "┌──────────┐\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #ffffff; text-decoration-color: #ffffff\">██</span><span style=\"color: #fefefe; text-decoration-color: #fefefe\">██</span><span style=\"color: #fcfcfc; text-decoration-color: #fcfcfc\">█</span><span style=\"color: #fefefe; text-decoration-color: #fefefe\">█</span><span style=\"color: #ffffff; text-decoration-color: #ffffff\">████</span>│<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3.69</span> ↑\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;252;252;252m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m│\u001b[1;36m3.69\u001b[0m ↑\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #ffffff; text-decoration-color: #ffffff\">█</span><span style=\"color: #fefefe; text-decoration-color: #fefefe\">█</span><span style=\"color: #fdfdfd; text-decoration-color: #fdfdfd\">█</span><span style=\"color: #f9f9f9; text-decoration-color: #f9f9f9\">█</span><span style=\"color: #f6f6f6; text-decoration-color: #f6f6f6\">█</span><span style=\"color: #f7f7f7; text-decoration-color: #f7f7f7\">█</span><span style=\"color: #fcfcfc; text-decoration-color: #fcfcfc\">█</span><span style=\"color: #fefefe; text-decoration-color: #fefefe\">██</span><span style=\"color: #ffffff; text-decoration-color: #ffffff\">█</span>│\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;253;253;253m█\u001b[0m\u001b[38;2;249;249;249m█\u001b[0m\u001b[38;2;246;246;246m█\u001b[0m\u001b[38;2;247;247;247m█\u001b[0m\u001b[38;2;252;252;252m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m│\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #fefefe; text-decoration-color: #fefefe\">█</span><span style=\"color: #fdfdfd; text-decoration-color: #fdfdfd\">█</span><span style=\"color: #f1f1f1; text-decoration-color: #f1f1f1\">█</span><span style=\"color: #dbdbdb; text-decoration-color: #dbdbdb\">█</span><span style=\"color: #c8c8c8; text-decoration-color: #c8c8c8\">█</span><span style=\"color: #d8d8d8; text-decoration-color: #d8d8d8\">█</span><span style=\"color: #efefef; text-decoration-color: #efefef\">█</span><span style=\"color: #fbfbfb; text-decoration-color: #fbfbfb\">█</span><span style=\"color: #fefefe; text-decoration-color: #fefefe\">██</span>│\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;253;253;253m█\u001b[0m\u001b[38;2;241;241;241m█\u001b[0m\u001b[38;2;219;219;219m█\u001b[0m\u001b[38;2;200;200;200m█\u001b[0m\u001b[38;2;216;216;216m█\u001b[0m\u001b[38;2;239;239;239m█\u001b[0m\u001b[38;2;251;251;251m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m│\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #fefefe; text-decoration-color: #fefefe\">█</span><span style=\"color: #fafafa; text-decoration-color: #fafafa\">█</span><span style=\"color: #e4e4e4; text-decoration-color: #e4e4e4\">█</span><span style=\"color: #a0a0a0; text-decoration-color: #a0a0a0\">█</span><span style=\"color: #747474; text-decoration-color: #747474\">█</span><span style=\"color: #8a8a8a; text-decoration-color: #8a8a8a\">█</span><span style=\"color: #c3c3c3; text-decoration-color: #c3c3c3\">█</span><span style=\"color: #f4f4f4; text-decoration-color: #f4f4f4\">█</span><span style=\"color: #fdfdfd; text-decoration-color: #fdfdfd\">█</span><span style=\"color: #ffffff; text-decoration-color: #ffffff\">█</span>│\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;250;250;250m█\u001b[0m\u001b[38;2;228;228;228m█\u001b[0m\u001b[38;2;160;160;160m█\u001b[0m\u001b[38;2;116;116;116m█\u001b[0m\u001b[38;2;138;138;138m█\u001b[0m\u001b[38;2;195;195;195m█\u001b[0m\u001b[38;2;244;244;244m█\u001b[0m\u001b[38;2;253;253;253m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m│\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #fefefe; text-decoration-color: #fefefe\">█</span><span style=\"color: #f3f3f3; text-decoration-color: #f3f3f3\">█</span><span style=\"color: #cdcdcd; text-decoration-color: #cdcdcd\">█</span><span style=\"color: #575757; text-decoration-color: #575757\">█</span><span style=\"color: #090909; text-decoration-color: #090909\">█</span><span style=\"color: #454545; text-decoration-color: #454545\">█</span><span style=\"color: #a4a4a4; text-decoration-color: #a4a4a4\">█</span><span style=\"color: #ededed; text-decoration-color: #ededed\">█</span><span style=\"color: #fdfdfd; text-decoration-color: #fdfdfd\">█</span><span style=\"color: #ffffff; text-decoration-color: #ffffff\">█</span>│\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;243;243;243m█\u001b[0m\u001b[38;2;205;205;205m█\u001b[0m\u001b[38;2;87;87;87m█\u001b[0m\u001b[38;2;9;9;9m█\u001b[0m\u001b[38;2;69;69;69m█\u001b[0m\u001b[38;2;164;164;164m█\u001b[0m\u001b[38;2;237;237;237m█\u001b[0m\u001b[38;2;253;253;253m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m│\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #fdfdfd; text-decoration-color: #fdfdfd\">█</span><span style=\"color: #f1f1f1; text-decoration-color: #f1f1f1\">█</span><span style=\"color: #c6c6c6; text-decoration-color: #c6c6c6\">█</span><span style=\"color: #5d5d5d; text-decoration-color: #5d5d5d\">█</span><span style=\"color: #000000; text-decoration-color: #000000\">█</span><span style=\"color: #3c3c3c; text-decoration-color: #3c3c3c\">█</span><span style=\"color: #b9b9b9; text-decoration-color: #b9b9b9\">█</span><span style=\"color: #efefef; text-decoration-color: #efefef\">█</span><span style=\"color: #fcfcfc; text-decoration-color: #fcfcfc\">█</span><span style=\"color: #fefefe; text-decoration-color: #fefefe\">█</span>│\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;253;253;253m█\u001b[0m\u001b[38;2;241;241;241m█\u001b[0m\u001b[38;2;198;198;198m█\u001b[0m\u001b[38;2;93;93;93m█\u001b[0m\u001b[38;2;0;0;0m█\u001b[0m\u001b[38;2;60;60;60m█\u001b[0m\u001b[38;2;185;185;185m█\u001b[0m\u001b[38;2;239;239;239m█\u001b[0m\u001b[38;2;252;252;252m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m│\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #fefefe; text-decoration-color: #fefefe\">█</span><span style=\"color: #f7f7f7; text-decoration-color: #f7f7f7\">█</span><span style=\"color: #dadada; text-decoration-color: #dadada\">█</span><span style=\"color: #8a8a8a; text-decoration-color: #8a8a8a\">█</span><span style=\"color: #5d5d5d; text-decoration-color: #5d5d5d\">█</span><span style=\"color: #838383; text-decoration-color: #838383\">█</span><span style=\"color: #d0d0d0; text-decoration-color: #d0d0d0\">█</span><span style=\"color: #f5f5f5; text-decoration-color: #f5f5f5\">█</span><span style=\"color: #fefefe; text-decoration-color: #fefefe\">█</span><span style=\"color: #ffffff; text-decoration-color: #ffffff\">█</span>│\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;247;247;247m█\u001b[0m\u001b[38;2;218;218;218m█\u001b[0m\u001b[38;2;138;138;138m█\u001b[0m\u001b[38;2;93;93;93m█\u001b[0m\u001b[38;2;131;131;131m█\u001b[0m\u001b[38;2;208;208;208m█\u001b[0m\u001b[38;2;245;245;245m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m│\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #ffffff; text-decoration-color: #ffffff\">█</span><span style=\"color: #fcfcfc; text-decoration-color: #fcfcfc\">█</span><span style=\"color: #f3f3f3; text-decoration-color: #f3f3f3\">█</span><span style=\"color: #dadada; text-decoration-color: #dadada\">█</span><span style=\"color: #c7c7c7; text-decoration-color: #c7c7c7\">█</span><span style=\"color: #d4d4d4; text-decoration-color: #d4d4d4\">█</span><span style=\"color: #eeeeee; text-decoration-color: #eeeeee\">█</span><span style=\"color: #fafafa; text-decoration-color: #fafafa\">█</span><span style=\"color: #ffffff; text-decoration-color: #ffffff\">██</span>│\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;252;252;252m█\u001b[0m\u001b[38;2;243;243;243m█\u001b[0m\u001b[38;2;218;218;218m█\u001b[0m\u001b[38;2;199;199;199m█\u001b[0m\u001b[38;2;212;212;212m█\u001b[0m\u001b[38;2;238;238;238m█\u001b[0m\u001b[38;2;250;250;250m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m│\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #ffffff; text-decoration-color: #ffffff\">██</span><span style=\"color: #fdfdfd; text-decoration-color: #fdfdfd\">█</span><span style=\"color: #f8f8f8; text-decoration-color: #f8f8f8\">█</span><span style=\"color: #f3f3f3; text-decoration-color: #f3f3f3\">█</span><span style=\"color: #f6f6f6; text-decoration-color: #f6f6f6\">█</span><span style=\"color: #f9f9f9; text-decoration-color: #f9f9f9\">█</span><span style=\"color: #fefefe; text-decoration-color: #fefefe\">██</span><span style=\"color: #ffffff; text-decoration-color: #ffffff\">█</span>│\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;253;253;253m█\u001b[0m\u001b[38;2;248;248;248m█\u001b[0m\u001b[38;2;243;243;243m█\u001b[0m\u001b[38;2;246;246;246m█\u001b[0m\u001b[38;2;249;249;249m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m│\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">│<span style=\"color: #ffffff; text-decoration-color: #ffffff\">███</span><span style=\"color: #fdfdfd; text-decoration-color: #fdfdfd\">██</span><span style=\"color: #fefefe; text-decoration-color: #fefefe\">███</span><span style=\"color: #ffffff; text-decoration-color: #ffffff\">██</span>│<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">-3.66</span> ↓\n", + "</pre>\n" + ], + "text/plain": [ + "│\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;253;253;253m█\u001b[0m\u001b[38;2;253;253;253m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;254;254;254m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m│\u001b[1;36m-3.66\u001b[0m ↓\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">└──────────┘\n", + "</pre>\n" + ], + "text/plain": [ + "└──────────┘\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">← <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">-3.86</span>\n", + "</pre>\n" + ], + "text/plain": [ + "← \u001b[1;36m-3.86\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">↓<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>\n", + "</pre>\n" + ], + "text/plain": [ + "↓\u001b[1;36m0\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #118118118; text-decoration-color: #118118118\">█</span><span style=\"color: #ffffff; text-decoration-color: #ffffff\">█</span><span style=\"color: #e5e5e5; text-decoration-color: #e5e5e5\">█</span><span style=\"color: #cccccc; text-decoration-color: #cccccc\">█</span><span style=\"color: #b2b2b2; text-decoration-color: #b2b2b2\">█</span><span style=\"color: #999999; text-decoration-color: #999999\">█</span><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">█</span><span style=\"color: #666666; text-decoration-color: #666666\">█</span><span style=\"color: #4c4c4c; text-decoration-color: #4c4c4c\">█</span><span style=\"color: #333333; text-decoration-color: #333333\">█</span><span style=\"color: #191919; text-decoration-color: #191919\">█</span><span style=\"color: #000000; text-decoratio n-color: #000000\">█</span>\n", + "</pre>\n" + ], + "text/plain": [ + "\u001b[38;2;280;280;280m█\u001b[0m\u001b[38;2;255;255;255m█\u001b[0m\u001b[38;2;229;229;229m█\u001b[0m\u001b[38;2;204;204;204m█\u001b[0m\u001b[38;2;178;178;178m█\u001b[0m\u001b[38;2;153;153;153m█\u001b[0m\u001b[38;2;127;127;127m█\u001b[0m\u001b[38;2;102;102;102m█\u001b[0m\u001b[38;2;76;76;76m█\u001b[0m\u001b[38;2;51;51;51m█\u001b[0m\u001b[38;2;25;25;25m█\u001b[0m\u001b[38;2;0;0;0m█\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">879</span> ↑\n", + "</pre>\n" + ], + "text/plain": [ + " \u001b[1;36m879\u001b[0m ↑\n" + ] + }, + "metadata": {}, + "output_type": "display_data" } ], "source": [ - "examples.normal_h2().plot(cmap='Greys_r')" + "examples.normal_h2().plot(cmap='Greys')" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": false, - "jupyter": { - "outputs_hidden": false - } - }, - "outputs": [], - "source": [] } ], "metadata": { @@ -113,7 +410,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.12.7" } }, "nbformat": 4, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/pyproject.toml new/physt-0.8.6/pyproject.toml --- old/physt-0.8.5/pyproject.toml 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/pyproject.toml 2025-02-25 15:24:20.000000000 +0100 @@ -1,6 +1,6 @@ [project] name = "physt" -version = "0.8.5" +version = "0.8.6" description = "P(i/y)thon h(i/y)stograms." readme = "README.md" requires-python = "~=3.9" @@ -45,8 +45,8 @@ ] [build-system] -requires = ["setuptools>=65.0", "build"] -build-backend = "setuptools.build_meta" +requires = ["flit_core>=3.4"] +build-backend = "flit_core.buildapi" [tool.black] line-length = 100 @@ -79,7 +79,7 @@ [tool.bumpver] -current_version = "v0.8.5" +current_version = "v0.8.6" version_pattern = "vMAJOR.MINOR.PATCH[PYTAGNUM]" commit_message = "Bump version: {old_version} → {new_version}" commit = false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/src/physt/examples/__main__.py new/physt-0.8.6/src/physt/examples/__main__.py --- old/physt-0.8.5/src/physt/examples/__main__.py 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/src/physt/examples/__main__.py 2025-02-25 15:24:20.000000000 +0100 @@ -34,7 +34,7 @@ console.print() console.print("[bold]And the plot:[/bold]") -h1.plot(backend="ascii", show_values=True) +h1.plot(backend="ascii", show_values=True, color="green") console.print() console.print("[bold]JSON fully describing the histogram:[/bold]") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/src/physt/plotting/ascii.py new/physt-0.8.6/src/physt/plotting/ascii.py --- old/physt-0.8.5/src/physt/plotting/ascii.py 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/src/physt/plotting/ascii.py 2025-02-25 15:24:20.000000000 +0100 @@ -16,6 +16,8 @@ from physt.plotting.common import get_value_format if typing.TYPE_CHECKING: + from typing import Any, Optional, Union + from physt.types import Histogram1D, Histogram2D @@ -27,18 +29,33 @@ } -def hbar(h1: "Histogram1D", width: int = 80, show_values: bool = False) -> None: +def hbar( + h1: "Histogram1D", + width: int = 80, + show_values: bool = False, + color: Optional[str] = None, +) -> None: """Horizontal bar plot in block characters.""" console = rich.console.Console() data = (h1.normalize().frequencies * width).round().astype(int) + style_kwargs: dict[str, Any] = {} + if color: + style_kwargs["color"] = color + style = Style(**style_kwargs) + for i in range(h1.bin_count): # TODO: Print bin labels somehow + if data[i] == 0: + bar_text = LEFT_LINE_CHAR + else: + bar_text = FULL_SQUARE_CHAR * data[i] if show_values: - console.print("█" * data[i], h1.frequencies[i]) + console.print(Text(bar_text, style=style), h1.frequencies[i]) else: - console.print("█" * data[i]) + console.print(Text(bar_text), style=style) +# TODO: Support more maps SUPPORTED_CMAPS = ("Greys", "Greys_r") DEFAULT_CMAP = SUPPORTED_CMAPS[1] @@ -46,6 +63,10 @@ """Characters used for shading in the ASCII map.""" FULL_SQUARE_CHAR = SHADING_CHARS[-1] +"""Character used for horizontal bar plots.""" + +LEFT_LINE_CHAR = "▏" +# TODO: Include more varying width characters for the bar def map(h2: "Histogram2D", use_color: typing.Optional[bool] = None, **kwargs) -> None: @@ -98,20 +119,22 @@ colorbar_range = np.arange(h2.shape[1] + 1) / h2.shape[1] console.print( - (value_format(h2.get_bin_right_edges(0)[-1]) + " →").rjust(h2.shape[1] + 2, " ") + (value_format(h2.get_bin_right_edges(0)[-1].item()) + " →").rjust( + h2.shape[0] + 2, " " + ) ) - console.print("+" + "-" * h2.shape[1] + "+") - for i in range(h2.shape[0] - 1, -1, -1): - line_frags = ["|"] - line_frags += [_render_cell(cmap_data[i, j]) for j in range(h2.shape[1])] - line_frags.append("|") - if i == h2.shape[0] - 1: - line_frags.append(value_format(h2.get_bin_right_edges(1)[-1]) + " ↑") - if i == 0: - line_frags.append(value_format(h2.get_bin_left_edges(1)[0]) + " ↓") + console.print("┌" + "─" * h2.shape[0] + "┐") + for y in range(h2.shape[1] - 1, -1, -1): + line_frags: list[Union[Text, str]] = ["│"] + line_frags += [_render_cell(cmap_data[x, y].item()) for x in range(h2.shape[0])] + line_frags.append("│") + if y == h2.shape[1] - 1: + line_frags.append(value_format(h2.get_bin_right_edges(1)[-1].item()) + " ↑") + if y == 0: + line_frags.append(value_format(h2.get_bin_left_edges(1)[0].item()) + " ↓") console.print(*line_frags, sep="") - console.print("+" + "-" * h2.shape[1] + "+") - console.print("←", value_format(h2.get_bin_left_edges(0)[0])) + console.print("└" + "─" * h2.shape[0] + "┘") + console.print("←", value_format(h2.get_bin_left_edges(0)[0].item())) colorbar_frags = [_render_cell(j) for j in colorbar_range] console.print("↓", 0, sep="") console.print(*colorbar_frags, sep="") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/src/physt/plotting/matplotlib.py new/physt-0.8.6/src/physt/plotting/matplotlib.py --- old/physt-0.8.5/src/physt/plotting/matplotlib.py 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/src/physt/plotting/matplotlib.py 2025-02-25 15:24:20.000000000 +0100 @@ -1043,7 +1043,7 @@ if h1.overflow: text_frags.append(f"Overflow: {h1.overflow}") if "mean" in used_stats: - mean = h1.statistics.mean() + mean = h1.statistics.mean if mean is not None: text_frags.append(f"Mean: {mean:.2f}") if "median" in used_stats: @@ -1051,7 +1051,7 @@ if median is not None: text_frags.append(f"Median: {median:.2f}") if "std" in used_stats: - std = h1.statistics.std() + std = h1.statistics.std if std is not None: text_frags.append(f"Std.dev: {std:.2f}") if "min" in used_stats: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/src/physt/statistics.py new/physt-0.8.6/src/physt/statistics.py --- old/physt-0.8.5/src/physt/statistics.py 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/src/physt/statistics.py 2025-02-25 15:24:20.000000000 +0100 @@ -15,8 +15,6 @@ class Statistics: """Container of statistics accumulative data.""" - # TODO: Reconsider changing mean, std to properties - sum: float = 0.0 """Weighted sum of all values entered into histogram.""" @@ -39,6 +37,7 @@ value (unlike some other summary statistics.) """ + @property def mean(self) -> float: """Statistical mean of all values entered into histogram (weighted).""" try: @@ -46,19 +45,18 @@ except ZeroDivisionError: return np.nan - def std(self) -> float: # , ddof=0): + @property + def std(self) -> float: """Standard deviation of all values entered into histogram.""" - # TODO: Add DOF - return np.sqrt(self.variance()) + return np.sqrt(self.variance) - def variance(self) -> float: # , ddof: int = 0) -> float: + @property + def variance(self) -> float: """Statistical variance of all values entered into histogram. This number is precise, because we keep the necessary data separate from bin contents. """ - # TODO: Add DOF - # http://stats.stackexchange.com/questions/6534/how-do-i-calculate-a-weighted-standard-deviation-in-excel if self.weight > 0: return (self.sum2 - self.sum**2 / self.weight) / self.weight return np.nan @@ -102,3 +100,4 @@ INVALID_STATISTICS: Statistics = Statistics( sum=np.nan, sum2=np.nan, min=np.nan, max=np.nan, weight=np.nan ) +"""Invalid statistics object used as placeholder when not enough information is available.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/tests/plotting/test_ascii.py new/physt-0.8.6/tests/plotting/test_ascii.py --- old/physt-0.8.5/tests/plotting/test_ascii.py 1970-01-01 01:00:00.000000000 +0100 +++ new/physt-0.8.6/tests/plotting/test_ascii.py 2025-02-25 15:24:20.000000000 +0100 @@ -0,0 +1,39 @@ +from textwrap import dedent + +from physt.plotting.ascii import hbar, map + + +def test_plot_hbar(simple_h1, capsys): + hbar(simple_h1, show_values=True) + captured = capsys.readouterr() + assert captured.out == EXPECTED_HBAR + + +def test_plot_map(simple_h2, capsys): + map(simple_h2) + captured = capsys.readouterr() + assert captured.out == EXPECTED_MAP + + +EXPECTED_HBAR = dedent( + """██ 1 +█████████████████████████████████████████████████████ 25 +▏ 0 +█████████████████████████ 12 +""" +) + + +EXPECTED_MAP = dedent( + """\ +3.00 → +┌───┐ +│░▓█│6.00 ↑ +│ ▒█│4.00 ↓ +└───┘ +← 0.00 +↓0 + ▒█ + 6 ↑ +""" +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/tests/test_adaptive.py new/physt-0.8.6/tests/test_adaptive.py --- old/physt-0.8.5/tests/test_adaptive.py 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/tests/test_adaptive.py 2025-02-25 15:24:20.000000000 +0100 @@ -18,8 +18,8 @@ assert h.bin_count == 0 assert h.total == 0 assert np.allclose(h.bin_widths, 10) - assert np.isnan(h.statistics.mean()) - assert np.isnan(h.statistics.std()) + assert np.isnan(h.statistics.mean) + assert np.isnan(h.statistics.std) assert h.overflow == 0 assert h.underflow == 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/tests/test_stats.py new/physt-0.8.6/tests/test_stats.py --- old/physt-0.8.5/tests/test_stats.py 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/tests/test_stats.py 2025-02-25 15:24:20.000000000 +0100 @@ -73,15 +73,15 @@ def test_mean(self, histogram, use_weights): if use_weights: - assert histogram.statistics.mean() == 2.8 + assert histogram.statistics.mean == 2.8 else: - assert histogram.statistics.mean() == 2.5 + assert histogram.statistics.mean == 2.5 def test_std(self, histogram, use_weights): if use_weights: - assert np.allclose(histogram.statistics.std(), np.sqrt(6.8 / 5)) + assert np.allclose(histogram.statistics.std, np.sqrt(6.8 / 5)) else: - assert np.allclose(histogram.statistics.std(), np.sqrt(5 / 4)) + assert np.allclose(histogram.statistics.std, np.sqrt(5 / 4)) class TestEmptyHistogram: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/physt-0.8.5/uv.lock new/physt-0.8.6/uv.lock --- old/physt-0.8.5/uv.lock 2025-01-27 14:08:52.000000000 +0100 +++ new/physt-0.8.6/uv.lock 2025-02-25 15:24:20.000000000 +0100 @@ -1038,7 +1038,7 @@ [[package]] name = "physt" -version = "0.8.5" +version = "0.8.6" source = { editable = "." } dependencies = [ { name = "hypothesis" },