Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/workflow_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12'] # should test the versions we allow for in pyproject.toml
python-version: ['3.10', '3.11', '3.12'] # should test the versions we allow for in pyproject.toml

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
build_release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: build
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
2,543 changes: 1,334 additions & 1,209 deletions poetry.lock

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
[tool.poetry]
name = "radas"
# Version is year.month.version
version = "2024.8.0"
version = "2025.6.0"
description = "Plasma radiated power calculated using OpenADAS"
authors = ["Commonwealth Fusion Systems"]
readme = "README.md"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -24,7 +23,7 @@ run_radas = 'radas.cli:run_radas_cli'
radas_config = 'radas.cli:write_config_template'

[tool.poetry.dependencies]
python = "<3.13,>=3.9"
python = ">=3.10"
numpy = ">=1.22"
scipy = ">=1.8"
matplotlib = ">=3.6"
Expand All @@ -33,9 +32,9 @@ pyyaml = ">=6.0"
xarray = ">=2023"
pint-xarray = ">=0.3"
click = ">=8.1"
meson = "^1.5.0"
ninja = "^1.11.1.1"
fortranformat = "^2.0.0"
meson = ">=1.5.0"
ninja = ">=1.11.1.1"
fortranformat = ">=2.0.0"

[tool.poetry.group.dev.dependencies]
# Install pytest into all development environments
Expand All @@ -45,7 +44,7 @@ pytest-order = ">=1.1"
pytest-cov = ">=4.1"
coverage = ">=7.2"
black = ">=23.0"
ipdb = "^0.13.13"
ipdb = ">=0.13.13"

[tool.poetry.group.ipykernel]
optional = true
Expand Down
2 changes: 0 additions & 2 deletions radas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
UnitStrippedWarning,
ureg,
Quantity,
suppress_downcast_warning,
convert_units,
magnitude,
dimensionless_magnitude,
Expand All @@ -26,7 +25,6 @@
"UnitStrippedWarning",
"ureg",
"Quantity",
"suppress_downcast_warning",
"convert_units",
"magnitude",
"dimensionless_magnitude",
Expand Down
2 changes: 1 addition & 1 deletion radas/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_git_revision_short_hash() -> str:
.decode("ascii")
.strip()
)
except:
except: # noqa:E722
# If git isn't available (sometimes the case in tests), return a blank
return ""

Expand Down
20 changes: 0 additions & 20 deletions radas/unit_handling.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Set up the pint library for unit handling."""

import warnings
from functools import wraps
from typing import Any, Union

import numpy as np
Expand All @@ -20,22 +18,6 @@

Quantity = ureg.Quantity


def suppress_downcast_warning(func):
"""Suppresses a common warning about downcasting quantities to arrays."""

@wraps(func)
def wrapper(*args, **kwargs):
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="The unit of the quantity is stripped when downcasting to ndarray.",
)
return func(*args, **kwargs)

return wrapper


def convert_units(
array: Union[xr.DataArray, pint.Quantity], units: Any
) -> Union[xr.DataArray, pint.Quantity]:
Expand All @@ -53,7 +35,6 @@ def convert_units(
)


@suppress_downcast_warning
def magnitude(
array: Union[xr.DataArray, pint.Quantity]
) -> Union[npt.NDArray[np.float32], float]:
Expand Down Expand Up @@ -89,6 +70,5 @@ def magnitude_in_units(
"Quantity",
"convert_units",
"magnitude",
"suppress_downcast_warning",
"dimensionless_magnitude",
]
23 changes: 0 additions & 23 deletions tests/test_unit_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@

from radas.unit_handling import (
DimensionalityError,
UnitStrippedWarning,
ureg,
Quantity,
suppress_downcast_warning,
convert_units,
magnitude,
suppress_downcast_warning,
dimensionless_magnitude,
)

Expand All @@ -28,26 +25,6 @@ def test_invalid_conversion():
Quantity(1.2, ureg.m).to(ureg.W)


@pytest.mark.filterwarnings("error")
def test_suppress_downcast():
values = Quantity([1.2, 2.4], ureg.m)

with pytest.warns(UnitStrippedWarning):
np.array(values)

def unwrapped(input):
return np.array(input)

with pytest.warns(UnitStrippedWarning):
unwrapped(values)

@suppress_downcast_warning
def wrapped(input):
return np.array(input)

wrapped(values)


@pytest.mark.filterwarnings(
"ignore:The unit of the quantity is stripped when downcasting to ndarray."
)
Expand Down