From 2bc5bf6c149ed246944341fc2991aa85039d6a42 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Mon, 15 Jun 2026 12:14:14 +0100 Subject: [PATCH 01/17] Fail on warnings for hatch-sphinx --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 71b1b2cff..1f15143b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,6 +94,7 @@ header = "SasData" [[tool.hatch.build.targets.wheel.hooks.sphinx.tools]] tool = "build" format = "html" +warnings = true source = "source" out_dir = "../build/docs" environment = { PYTHONPATH=".." } From 9f1c8989cb9b92b493079e235e29475b04a53c1f Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Mon, 15 Jun 2026 15:18:01 +0100 Subject: [PATCH 02/17] Include scipy at build time for docs --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 1f15143b6..83970595e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,8 @@ requires = [ "h5py", "lxml", "numpy", + "scipy", + "matplotlib", ] build-backend = "hatchling.build" From 09879d292446e29acd61418398d516ba3b3d29bf Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Mon, 15 Jun 2026 15:49:45 +0100 Subject: [PATCH 03/17] Remove absolute_temperature The accessors framework is no longer present, so we don't need an absolute_temperature accessor --- sasdata/quantities/absolute_temperature.py | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 sasdata/quantities/absolute_temperature.py diff --git a/sasdata/quantities/absolute_temperature.py b/sasdata/quantities/absolute_temperature.py deleted file mode 100644 index 045c7de97..000000000 --- a/sasdata/quantities/absolute_temperature.py +++ /dev/null @@ -1,14 +0,0 @@ -from typing import TypeVar - -from sasdata.quantities.accessors import TemperatureAccessor -from sasdata.quantities.quantity import Quantity - -DataType = TypeVar("DataType") -class AbsoluteTemperatureAccessor(TemperatureAccessor[DataType]): - """ Parsing for absolute temperatures """ - @property - def value(self) -> Quantity[DataType] | None: - if self._numerical_part() is None: - return None - else: - return Quantity.parse(self._numerical_part(), self._unit_part(), absolute_temperature=True) From 2747d0fe2746244621fead0b720e26512fd85f8f Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Mon, 15 Jun 2026 16:19:30 +0100 Subject: [PATCH 04/17] Fix up blockquote in units.py and si.py Lines aren't supposed to have unexpected indentation --- sasdata/quantities/si.py | 132 ++++++++++++++++++------------------ sasdata/quantities/units.py | 132 ++++++++++++++++++------------------ 2 files changed, 132 insertions(+), 132 deletions(-) diff --git a/sasdata/quantities/si.py b/sasdata/quantities/si.py index 947cc4a11..24023c1d7 100644 --- a/sasdata/quantities/si.py +++ b/sasdata/quantities/si.py @@ -7,72 +7,72 @@ -DDDDDDDDDDDDD NNNNNNNN NNNNNNNN tttt -D::::::::::::DDD N:::::::N N::::::N ttt:::t -D:::::::::::::::DD N::::::::N N::::::N t:::::t -DDD:::::DDDDD:::::D N:::::::::N N::::::N t:::::t - D:::::D D:::::D ooooooooooo N::::::::::N N::::::N ooooooooooo ttttttt:::::ttttttt - D:::::D D:::::D oo:::::::::::oo N:::::::::::N N::::::N oo:::::::::::oo t:::::::::::::::::t - D:::::D D:::::Do:::::::::::::::o N:::::::N::::N N::::::No:::::::::::::::ot:::::::::::::::::t - D:::::D D:::::Do:::::ooooo:::::o N::::::N N::::N N::::::No:::::ooooo:::::otttttt:::::::tttttt - D:::::D D:::::Do::::o o::::o N::::::N N::::N:::::::No::::o o::::o t:::::t - D:::::D D:::::Do::::o o::::o N::::::N N:::::::::::No::::o o::::o t:::::t - D:::::D D:::::Do::::o o::::o N::::::N N::::::::::No::::o o::::o t:::::t - D:::::D D:::::D o::::o o::::o N::::::N N:::::::::No::::o o::::o t:::::t tttttt -DDD:::::DDDDD:::::D o:::::ooooo:::::o N::::::N N::::::::No:::::ooooo:::::o t::::::tttt:::::t -D:::::::::::::::DD o:::::::::::::::o N::::::N N:::::::No:::::::::::::::o tt::::::::::::::t -D::::::::::::DDD oo:::::::::::oo N::::::N N::::::N oo:::::::::::oo tt:::::::::::tt -DDDDDDDDDDDDD ooooooooooo NNNNNNNN NNNNNNN ooooooooooo ttttttttttt - - - - - - - - - dddddddd -EEEEEEEEEEEEEEEEEEEEEE d::::::d iiii tttt BBBBBBBBBBBBBBBBB -E::::::::::::::::::::E d::::::d i::::i ttt:::t B::::::::::::::::B -E::::::::::::::::::::E d::::::d iiii t:::::t B::::::BBBBBB:::::B -EE::::::EEEEEEEEE::::E d:::::d t:::::t BB:::::B B:::::B - E:::::E EEEEEE ddddddddd:::::d iiiiiiittttttt:::::ttttttt B::::B B:::::Byyyyyyy yyyyyyy - E:::::E dd::::::::::::::d i:::::it:::::::::::::::::t B::::B B:::::B y:::::y y:::::y - E::::::EEEEEEEEEE d::::::::::::::::d i::::it:::::::::::::::::t B::::BBBBBB:::::B y:::::y y:::::y - E:::::::::::::::E d:::::::ddddd:::::d i::::itttttt:::::::tttttt B:::::::::::::BB y:::::y y:::::y - E:::::::::::::::E d::::::d d:::::d i::::i t:::::t B::::BBBBBB:::::B y:::::y y:::::y - E::::::EEEEEEEEEE d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y y:::::y - E:::::E d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y:::::y - E:::::E EEEEEEd:::::d d:::::d i::::i t:::::t tttttt B::::B B:::::B y:::::::::y -EE::::::EEEEEEEE:::::Ed::::::ddddd::::::ddi::::::i t::::::tttt:::::t BB:::::BBBBBB::::::B y:::::::y -E::::::::::::::::::::E d:::::::::::::::::di::::::i tt::::::::::::::t B:::::::::::::::::B y:::::y -E::::::::::::::::::::E d:::::::::ddd::::di::::::i tt:::::::::::tt B::::::::::::::::B y:::::y -EEEEEEEEEEEEEEEEEEEEEE ddddddddd dddddiiiiiiii ttttttttttt BBBBBBBBBBBBBBBBB y:::::y - y:::::y - y:::::y - y:::::y - y:::::y - yyyyyyy - - - - dddddddd -HHHHHHHHH HHHHHHHHH d::::::d -H:::::::H H:::::::H d::::::d -H:::::::H H:::::::H d::::::d -HH::::::H H::::::HH d:::::d - H:::::H H:::::H aaaaaaaaaaaaa nnnn nnnnnnnn ddddddddd:::::d - H:::::H H:::::H a::::::::::::a n:::nn::::::::nn dd::::::::::::::d - H::::::HHHHH::::::H aaaaaaaaa:::::an::::::::::::::nn d::::::::::::::::d - H:::::::::::::::::H a::::ann:::::::::::::::nd:::::::ddddd:::::d - H:::::::::::::::::H aaaaaaa:::::a n:::::nnnn:::::nd::::::d d:::::d - H::::::HHHHH::::::H aa::::::::::::a n::::n n::::nd:::::d d:::::d - H:::::H H:::::H a::::aaaa::::::a n::::n n::::nd:::::d d:::::d - H:::::H H:::::H a::::a a:::::a n::::n n::::nd:::::d d:::::d -HH::::::H H::::::HHa::::a a:::::a n::::n n::::nd::::::ddddd::::::dd -H:::::::H H:::::::Ha:::::aaaa::::::a n::::n n::::n d:::::::::::::::::d -H:::::::H H:::::::H a::::::::::aa:::a n::::n n::::n d:::::::::ddd::::d -HHHHHHHHH HHHHHHHHH aaaaaaaaaa aaaa nnnnnn nnnnnn ddddddddd ddddd +# DDDDDDDDDDDDD NNNNNNNN NNNNNNNN tttt +# D::::::::::::DDD N:::::::N N::::::N ttt:::t +# D:::::::::::::::DD N::::::::N N::::::N t:::::t +# DDD:::::DDDDD:::::D N:::::::::N N::::::N t:::::t +# D:::::D D:::::D ooooooooooo N::::::::::N N::::::N ooooooooooo ttttttt:::::ttttttt +# D:::::D D:::::D oo:::::::::::oo N:::::::::::N N::::::N oo:::::::::::oo t:::::::::::::::::t +# D:::::D D:::::Do:::::::::::::::o N:::::::N::::N N::::::No:::::::::::::::ot:::::::::::::::::t +# D:::::D D:::::Do:::::ooooo:::::o N::::::N N::::N N::::::No:::::ooooo:::::otttttt:::::::tttttt +# D:::::D D:::::Do::::o o::::o N::::::N N::::N:::::::No::::o o::::o t:::::t +# D:::::D D:::::Do::::o o::::o N::::::N N:::::::::::No::::o o::::o t:::::t +# D:::::D D:::::Do::::o o::::o N::::::N N::::::::::No::::o o::::o t:::::t +# D:::::D D:::::D o::::o o::::o N::::::N N:::::::::No::::o o::::o t:::::t tttttt +# DDD:::::DDDDD:::::D o:::::ooooo:::::o N::::::N N::::::::No:::::ooooo:::::o t::::::tttt:::::t +# D:::::::::::::::DD o:::::::::::::::o N::::::N N:::::::No:::::::::::::::o tt::::::::::::::t +# D::::::::::::DDD oo:::::::::::oo N::::::N N::::::N oo:::::::::::oo tt:::::::::::tt +# DDDDDDDDDDDDD ooooooooooo NNNNNNNN NNNNNNN ooooooooooo ttttttttttt +# +# +# +# +# +# +# +# +# dddddddd +# EEEEEEEEEEEEEEEEEEEEEE d::::::d iiii tttt BBBBBBBBBBBBBBBBB +# E::::::::::::::::::::E d::::::d i::::i ttt:::t B::::::::::::::::B +# E::::::::::::::::::::E d::::::d iiii t:::::t B::::::BBBBBB:::::B +# EE::::::EEEEEEEEE::::E d:::::d t:::::t BB:::::B B:::::B +# E:::::E EEEEEE ddddddddd:::::d iiiiiiittttttt:::::ttttttt B::::B B:::::Byyyyyyy yyyyyyy +# E:::::E dd::::::::::::::d i:::::it:::::::::::::::::t B::::B B:::::B y:::::y y:::::y +# E::::::EEEEEEEEEE d::::::::::::::::d i::::it:::::::::::::::::t B::::BBBBBB:::::B y:::::y y:::::y +# E:::::::::::::::E d:::::::ddddd:::::d i::::itttttt:::::::tttttt B:::::::::::::BB y:::::y y:::::y +# E:::::::::::::::E d::::::d d:::::d i::::i t:::::t B::::BBBBBB:::::B y:::::y y:::::y +# E::::::EEEEEEEEEE d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y y:::::y +# E:::::E d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y:::::y +# E:::::E EEEEEEd:::::d d:::::d i::::i t:::::t tttttt B::::B B:::::B y:::::::::y +# EE::::::EEEEEEEE:::::Ed::::::ddddd::::::ddi::::::i t::::::tttt:::::t BB:::::BBBBBB::::::B y:::::::y +# E::::::::::::::::::::E d:::::::::::::::::di::::::i tt::::::::::::::t B:::::::::::::::::B y:::::y +# E::::::::::::::::::::E d:::::::::ddd::::di::::::i tt:::::::::::tt B::::::::::::::::B y:::::y +# EEEEEEEEEEEEEEEEEEEEEE ddddddddd dddddiiiiiiii ttttttttttt BBBBBBBBBBBBBBBBB y:::::y +# y:::::y +# y:::::y +# y:::::y +# y:::::y +# yyyyyyy +# +# +# +# dddddddd +# HHHHHHHHH HHHHHHHHH d::::::d +# H:::::::H H:::::::H d::::::d +# H:::::::H H:::::::H d::::::d +# HH::::::H H::::::HH d:::::d +# H:::::H H:::::H aaaaaaaaaaaaa nnnn nnnnnnnn ddddddddd:::::d +# H:::::H H:::::H a::::::::::::a n:::nn::::::::nn dd::::::::::::::d +# H::::::HHHHH::::::H aaaaaaaaa:::::an::::::::::::::nn d::::::::::::::::d +# H:::::::::::::::::H a::::ann:::::::::::::::nd:::::::ddddd:::::d +# H:::::::::::::::::H aaaaaaa:::::a n:::::nnnn:::::nd::::::d d:::::d +# H::::::HHHHH::::::H aa::::::::::::a n::::n n::::nd:::::d d:::::d +# H:::::H H:::::H a::::aaaa::::::a n::::n n::::nd:::::d d:::::d +# H:::::H H:::::H a::::a a:::::a n::::n n::::nd:::::d d:::::d +# HH::::::H H::::::HHa::::a a:::::a n::::n n::::nd::::::ddddd::::::dd +# H:::::::H H:::::::Ha:::::aaaa::::::a n::::n n::::n d:::::::::::::::::d +# H:::::::H H:::::::H a::::::::::aa:::a n::::n n::::n d:::::::::ddd::::d +# HHHHHHHHH HHHHHHHHH aaaaaaaaaa aaaa nnnnnn nnnnnn ddddddddd ddddd diff --git a/sasdata/quantities/units.py b/sasdata/quantities/units.py index 7d03abda0..8615c5ca4 100644 --- a/sasdata/quantities/units.py +++ b/sasdata/quantities/units.py @@ -7,72 +7,72 @@ -DDDDDDDDDDDDD NNNNNNNN NNNNNNNN tttt -D::::::::::::DDD N:::::::N N::::::N ttt:::t -D:::::::::::::::DD N::::::::N N::::::N t:::::t -DDD:::::DDDDD:::::D N:::::::::N N::::::N t:::::t - D:::::D D:::::D ooooooooooo N::::::::::N N::::::N ooooooooooo ttttttt:::::ttttttt - D:::::D D:::::D oo:::::::::::oo N:::::::::::N N::::::N oo:::::::::::oo t:::::::::::::::::t - D:::::D D:::::Do:::::::::::::::o N:::::::N::::N N::::::No:::::::::::::::ot:::::::::::::::::t - D:::::D D:::::Do:::::ooooo:::::o N::::::N N::::N N::::::No:::::ooooo:::::otttttt:::::::tttttt - D:::::D D:::::Do::::o o::::o N::::::N N::::N:::::::No::::o o::::o t:::::t - D:::::D D:::::Do::::o o::::o N::::::N N:::::::::::No::::o o::::o t:::::t - D:::::D D:::::Do::::o o::::o N::::::N N::::::::::No::::o o::::o t:::::t - D:::::D D:::::D o::::o o::::o N::::::N N:::::::::No::::o o::::o t:::::t tttttt -DDD:::::DDDDD:::::D o:::::ooooo:::::o N::::::N N::::::::No:::::ooooo:::::o t::::::tttt:::::t -D:::::::::::::::DD o:::::::::::::::o N::::::N N:::::::No:::::::::::::::o tt::::::::::::::t -D::::::::::::DDD oo:::::::::::oo N::::::N N::::::N oo:::::::::::oo tt:::::::::::tt -DDDDDDDDDDDDD ooooooooooo NNNNNNNN NNNNNNN ooooooooooo ttttttttttt - - - - - - - - - dddddddd -EEEEEEEEEEEEEEEEEEEEEE d::::::d iiii tttt BBBBBBBBBBBBBBBBB -E::::::::::::::::::::E d::::::d i::::i ttt:::t B::::::::::::::::B -E::::::::::::::::::::E d::::::d iiii t:::::t B::::::BBBBBB:::::B -EE::::::EEEEEEEEE::::E d:::::d t:::::t BB:::::B B:::::B - E:::::E EEEEEE ddddddddd:::::d iiiiiiittttttt:::::ttttttt B::::B B:::::Byyyyyyy yyyyyyy - E:::::E dd::::::::::::::d i:::::it:::::::::::::::::t B::::B B:::::B y:::::y y:::::y - E::::::EEEEEEEEEE d::::::::::::::::d i::::it:::::::::::::::::t B::::BBBBBB:::::B y:::::y y:::::y - E:::::::::::::::E d:::::::ddddd:::::d i::::itttttt:::::::tttttt B:::::::::::::BB y:::::y y:::::y - E:::::::::::::::E d::::::d d:::::d i::::i t:::::t B::::BBBBBB:::::B y:::::y y:::::y - E::::::EEEEEEEEEE d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y y:::::y - E:::::E d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y:::::y - E:::::E EEEEEEd:::::d d:::::d i::::i t:::::t tttttt B::::B B:::::B y:::::::::y -EE::::::EEEEEEEE:::::Ed::::::ddddd::::::ddi::::::i t::::::tttt:::::t BB:::::BBBBBB::::::B y:::::::y -E::::::::::::::::::::E d:::::::::::::::::di::::::i tt::::::::::::::t B:::::::::::::::::B y:::::y -E::::::::::::::::::::E d:::::::::ddd::::di::::::i tt:::::::::::tt B::::::::::::::::B y:::::y -EEEEEEEEEEEEEEEEEEEEEE ddddddddd dddddiiiiiiii ttttttttttt BBBBBBBBBBBBBBBBB y:::::y - y:::::y - y:::::y - y:::::y - y:::::y - yyyyyyy - - - - dddddddd -HHHHHHHHH HHHHHHHHH d::::::d -H:::::::H H:::::::H d::::::d -H:::::::H H:::::::H d::::::d -HH::::::H H::::::HH d:::::d - H:::::H H:::::H aaaaaaaaaaaaa nnnn nnnnnnnn ddddddddd:::::d - H:::::H H:::::H a::::::::::::a n:::nn::::::::nn dd::::::::::::::d - H::::::HHHHH::::::H aaaaaaaaa:::::an::::::::::::::nn d::::::::::::::::d - H:::::::::::::::::H a::::ann:::::::::::::::nd:::::::ddddd:::::d - H:::::::::::::::::H aaaaaaa:::::a n:::::nnnn:::::nd::::::d d:::::d - H::::::HHHHH::::::H aa::::::::::::a n::::n n::::nd:::::d d:::::d - H:::::H H:::::H a::::aaaa::::::a n::::n n::::nd:::::d d:::::d - H:::::H H:::::H a::::a a:::::a n::::n n::::nd:::::d d:::::d -HH::::::H H::::::HHa::::a a:::::a n::::n n::::nd::::::ddddd::::::dd -H:::::::H H:::::::Ha:::::aaaa::::::a n::::n n::::n d:::::::::::::::::d -H:::::::H H:::::::H a::::::::::aa:::a n::::n n::::n d:::::::::ddd::::d -HHHHHHHHH HHHHHHHHH aaaaaaaaaa aaaa nnnnnn nnnnnn ddddddddd ddddd +# DDDDDDDDDDDDD NNNNNNNN NNNNNNNN tttt +# D::::::::::::DDD N:::::::N N::::::N ttt:::t +# D:::::::::::::::DD N::::::::N N::::::N t:::::t +# DDD:::::DDDDD:::::D N:::::::::N N::::::N t:::::t +# D:::::D D:::::D ooooooooooo N::::::::::N N::::::N ooooooooooo ttttttt:::::ttttttt +# D:::::D D:::::D oo:::::::::::oo N:::::::::::N N::::::N oo:::::::::::oo t:::::::::::::::::t +# D:::::D D:::::Do:::::::::::::::o N:::::::N::::N N::::::No:::::::::::::::ot:::::::::::::::::t +# D:::::D D:::::Do:::::ooooo:::::o N::::::N N::::N N::::::No:::::ooooo:::::otttttt:::::::tttttt +# D:::::D D:::::Do::::o o::::o N::::::N N::::N:::::::No::::o o::::o t:::::t +# D:::::D D:::::Do::::o o::::o N::::::N N:::::::::::No::::o o::::o t:::::t +# D:::::D D:::::Do::::o o::::o N::::::N N::::::::::No::::o o::::o t:::::t +# D:::::D D:::::D o::::o o::::o N::::::N N:::::::::No::::o o::::o t:::::t tttttt +# DDD:::::DDDDD:::::D o:::::ooooo:::::o N::::::N N::::::::No:::::ooooo:::::o t::::::tttt:::::t +# D:::::::::::::::DD o:::::::::::::::o N::::::N N:::::::No:::::::::::::::o tt::::::::::::::t +# D::::::::::::DDD oo:::::::::::oo N::::::N N::::::N oo:::::::::::oo tt:::::::::::tt +# DDDDDDDDDDDDD ooooooooooo NNNNNNNN NNNNNNN ooooooooooo ttttttttttt +# +# +# +# +# +# +# +# +# dddddddd +# EEEEEEEEEEEEEEEEEEEEEE d::::::d iiii tttt BBBBBBBBBBBBBBBBB +# E::::::::::::::::::::E d::::::d i::::i ttt:::t B::::::::::::::::B +# E::::::::::::::::::::E d::::::d iiii t:::::t B::::::BBBBBB:::::B +# EE::::::EEEEEEEEE::::E d:::::d t:::::t BB:::::B B:::::B +# E:::::E EEEEEE ddddddddd:::::d iiiiiiittttttt:::::ttttttt B::::B B:::::Byyyyyyy yyyyyyy +# E:::::E dd::::::::::::::d i:::::it:::::::::::::::::t B::::B B:::::B y:::::y y:::::y +# E::::::EEEEEEEEEE d::::::::::::::::d i::::it:::::::::::::::::t B::::BBBBBB:::::B y:::::y y:::::y +# E:::::::::::::::E d:::::::ddddd:::::d i::::itttttt:::::::tttttt B:::::::::::::BB y:::::y y:::::y +# E:::::::::::::::E d::::::d d:::::d i::::i t:::::t B::::BBBBBB:::::B y:::::y y:::::y +# E::::::EEEEEEEEEE d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y y:::::y +# E:::::E d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y:::::y +# E:::::E EEEEEEd:::::d d:::::d i::::i t:::::t tttttt B::::B B:::::B y:::::::::y +# EE::::::EEEEEEEE:::::Ed::::::ddddd::::::ddi::::::i t::::::tttt:::::t BB:::::BBBBBB::::::B y:::::::y +# E::::::::::::::::::::E d:::::::::::::::::di::::::i tt::::::::::::::t B:::::::::::::::::B y:::::y +# E::::::::::::::::::::E d:::::::::ddd::::di::::::i tt:::::::::::tt B::::::::::::::::B y:::::y +# EEEEEEEEEEEEEEEEEEEEEE ddddddddd dddddiiiiiiii ttttttttttt BBBBBBBBBBBBBBBBB y:::::y +# y:::::y +# y:::::y +# y:::::y +# y:::::y +# yyyyyyy +# +# +# +# dddddddd +# HHHHHHHHH HHHHHHHHH d::::::d +# H:::::::H H:::::::H d::::::d +# H:::::::H H:::::::H d::::::d +# HH::::::H H::::::HH d:::::d +# H:::::H H:::::H aaaaaaaaaaaaa nnnn nnnnnnnn ddddddddd:::::d +# H:::::H H:::::H a::::::::::::a n:::nn::::::::nn dd::::::::::::::d +# H::::::HHHHH::::::H aaaaaaaaa:::::an::::::::::::::nn d::::::::::::::::d +# H:::::::::::::::::H a::::ann:::::::::::::::nd:::::::ddddd:::::d +# H:::::::::::::::::H aaaaaaa:::::a n:::::nnnn:::::nd::::::d d:::::d +# H::::::HHHHH::::::H aa::::::::::::a n::::n n::::nd:::::d d:::::d +# H:::::H H:::::H a::::aaaa::::::a n::::n n::::nd:::::d d:::::d +# H:::::H H:::::H a::::a a:::::a n::::n n::::nd:::::d d:::::d +# HH::::::H H::::::HHa::::a a:::::a n::::n n::::nd::::::ddddd::::::dd +# H:::::::H H:::::::Ha:::::aaaa::::::a n::::n n::::n d:::::::::::::::::d +# H:::::::H H:::::::H a::::::::::aa:::a n::::n n::::n d:::::::::ddd::::d +# HHHHHHHHH HHHHHHHHH aaaaaaaaaa aaaa nnnnnn nnnnnn ddddddddd ddddd From 8d6ced7820a26780b004975d5c723b8979a6cd17 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Tue, 16 Jun 2026 12:39:01 +0100 Subject: [PATCH 05/17] Handle field warnings --- sasdata/data_util/binning.py | 2 +- sasdata/data_util/manipulations.py | 1 + sasdata/metadata.py | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sasdata/data_util/binning.py b/sasdata/data_util/binning.py index fdacda103..6eae17cd8 100644 --- a/sasdata/data_util/binning.py +++ b/sasdata/data_util/binning.py @@ -153,7 +153,7 @@ def get_bin_index(self, value): 2pi to 0 discontinuity. :param value: A coordinate value in the binning interval along the major axis, - whose bin index should be returned. Must be between min_value and max_value. + whose bin index should be returned. Must be between min_value and max_value. The general formula logarithm binning is: bin = floor(N * (log(x) - log(min)) / (log(max) - log(min))) diff --git a/sasdata/data_util/manipulations.py b/sasdata/data_util/manipulations.py index b7d17f41c..004b61d93 100644 --- a/sasdata/data_util/manipulations.py +++ b/sasdata/data_util/manipulations.py @@ -323,6 +323,7 @@ class SlabX(SlabX): Old signature: SlabX(x_min=0, x_max=0, y_min=0, y_max=0, bin_width=0.001, fold=False) + New signature uses nbins; translate bin_width -> nbins using ceil(range/bin_width) """ def __init__(self, x_min=0.0, x_max=0.0, y_min=0.0, diff --git a/sasdata/metadata.py b/sasdata/metadata.py index 588a4de76..12cd450fc 100644 --- a/sasdata/metadata.py +++ b/sasdata/metadata.py @@ -763,11 +763,11 @@ def meta_tags(obj: dataclass) -> list[str]: Example: - >@dataclass - class Thermometer: - temperature: float - units: str - params: list + > @dataclass + > class Thermometer: + > temperature: float + > units: str + > params: list > item = Example() > item.temperature = 273 > item.units = "K" From 986f5fc55de75ff5a53b1ee97d50022c97a94841 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Tue, 16 Jun 2026 13:11:58 +0100 Subject: [PATCH 06/17] Escape absolute values --- sasdata/data_util/averaging.py | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sasdata/data_util/averaging.py b/sasdata/data_util/averaging.py index 2e9f0f1b0..84d34e2c8 100644 --- a/sasdata/data_util/averaging.py +++ b/sasdata/data_util/averaging.py @@ -273,8 +273,8 @@ def __call__(self, data2d: Data2D) -> Data1D: class CircularAverage(PolarROI): - """ - Calculate I(|Q|) by circularly averaging 2D data between 2 radial limits. + r""" + Calculate I(\|Q\|) by circularly averaging 2D data between 2 radial limits. This class is initialised by specifying lower and upper limits on the magnitude of Q values to consider during the averaging, though currently @@ -290,13 +290,13 @@ def __init__( nbins: int = 100, base: float | None = None, ) -> None: - """ + r""" Set up the lower and upper radial limits as well as the number of bins. The units are A^-1 for the radial parameters. - :param r_min: Lower limit for |Q| values to use during averaging. - :param r_max: Upper limit for |Q| values to use during averaging. - :param nbins: The number of bins data is sorted into along |Q| the axis + :param r_min: Lower limit for \|Q\| values to use during averaging. + :param r_max: Upper limit for \|Q\| values to use during averaging. + :param nbins: The number of bins data is sorted into along \|Q\| the axis """ super().__init__(r_range=r_range, center=center) self.nbins: int = nbins @@ -396,12 +396,12 @@ def __init__( nbins: int = 100, base: float | None = None, ) -> None: - """ + r""" Set up the lower and upper radial limits as well as the number of bins. The units are A^-1 for the radial parameters. - :param r_min: Lower limit for |Q| values to use during averaging. - :param r_max: Upper limit for |Q| values to use during averaging. + :param r_min: Lower limit for \|Q\| values to use during averaging. + :param r_max: Upper limit for \|Q\| values to use during averaging. :param nbins: The number of bins data is sorted into along Phi the axis """ super().__init__(r_range=r_range, center=center) @@ -549,7 +549,7 @@ def __call__(self, data2d: Data2D = None) -> Data1D: class SectorQ(PolarROI): - """ + r""" Project I(Q, φ) data onto I(Q) within a region defined by Cartesian limits. The projection is computed by averaging together datapoints with the same @@ -558,7 +558,7 @@ class SectorQ(PolarROI): This class is initialised by specifying lower and upper limits on both the magnitude of Q and the angle φ. These four parameters specify the primary - Region Of Interest, however there is a secondary ROI with the same |Q| + Region Of Interest, however there is a secondary ROI with the same \|Q\| values on the opposite side of the origin (φ + π). How this secondary ROI is treated depends on the value of the `fold` parameter. If fold is set to True, data on opposite sides of the origin are averaged together and the @@ -579,14 +579,14 @@ def __init__( fold: bool = True, base: float | None = None, ) -> None: - """ + r""" Set up the ROI boundaries, the binning of the output 1D data, and fold. The units are A^-1 for radial parameters, and radians for anglar ones. - :param r_range: Tuple (r_min, r_max) defining limits for |Q| values to use during averaging. + :param r_range: Tuple (r_min, r_max) defining limits for \|Q\| values to use during averaging. :param phi_range: Tuple (phi_min, phi_max) defining limits for φ in radians (in the primary ROI). :Defaults to full circle (0, 2*pi). - :param nbins: The number of bins data is sorted into along the |Q| axis + :param nbins: The number of bins data is sorted into along the \|Q\| axis :param fold: Whether the primary and secondary ROIs should be folded together during averaging. """ @@ -709,14 +709,14 @@ def __init__( nbins: int = 100, base: float | None = None, ) -> None: - """ + r""" Set up the ROI boundaries, and the binning of the output 1D data. The units are A^-1 for radial parameters, and radians for anglar ones. - :param r_range: Tuple (r_min, r_max) defining limits for |Q| values to use during averaging. + :param r_range: Tuple (r_min, r_max) defining limits for \|Q\| values to use during averaging. :param phi_range: Tuple (phi_min, phi_max) defining limits for φ in radians (in the primary ROI). :Defaults to full circle (0, 2*pi). - :param nbins: The number of bins data is sorted into along the |Q| axis + :param nbins: The number of bins data is sorted into along the \|Q\| axis """ super().__init__(r_range=r_range, phi_range=phi_range, center=center) self.nbins: int = nbins @@ -791,11 +791,11 @@ def __init__( nbins: int = 100, base: float | None = None, ) -> None: - """ + r""" Set up the ROI boundaries, and the binning of the output 1D data. The units are A^-1 for radial parameters, and radians for anglar ones. - :param r_range: Tuple (r_min, r_max) defining limits for |Q| values to use during averaging. + :param r_range: Tuple (r_min, r_max) defining limits for \|Q\| values to use during averaging. :param phi_range: Tuple (phi_min, phi_max) defining angular bounds in radians. Defaults to full circle (0, 2*pi). :param nbins: The number of bins data is sorted into along the φ axis. From 5e23c091862c01ecac0976a1c742e4f67c10e5bf Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Tue, 16 Jun 2026 14:02:43 +0100 Subject: [PATCH 07/17] Try to explicitly list missing references --- docs/source/conf.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 252f257b6..7c84b3bde 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -32,3 +32,19 @@ html_theme = 'default' html_static_path = ['_static'] + + +# Ignore missing references to sections in SasView documentation +def on_missing_reference(app, env, node, contnode): + if node["reftarget"] in [ + "file_converter_tool", + "image_viewer_tool", + "sans_calculator_tool", + ]: + return contnode + else: + return None + + +def setup(app): + app.connect("missing-reference", on_missing_reference) From 9856e17237a9ee959faf3c8c1ad9450a3b08ba45 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Tue, 16 Jun 2026 14:46:02 +0100 Subject: [PATCH 08/17] Include generated modules in toc tree --- docs/source/dev/dev.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/source/dev/dev.rst b/docs/source/dev/dev.rst index 47b820804..ee73ad7c9 100644 --- a/docs/source/dev/dev.rst +++ b/docs/source/dev/dev.rst @@ -8,4 +8,6 @@ Developer Documentation .. toctree:: :maxdepth: 8 - SasData \ No newline at end of file + SasData + + Modules From ea667f764c975d95affa49130abd6bce8819b087 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Tue, 16 Jun 2026 14:49:14 +0100 Subject: [PATCH 09/17] Remove dead html static path --- docs/source/conf.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 7c84b3bde..2ef97df0c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -31,8 +31,6 @@ # -- Options for HTML output ------------------------------------------------- html_theme = 'default' -html_static_path = ['_static'] - # Ignore missing references to sections in SasView documentation def on_missing_reference(app, env, node, contnode): From f7b5256d914c06ec7b861708f6ef29df40dd5402 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Tue, 16 Jun 2026 15:41:36 +0100 Subject: [PATCH 10/17] Try and get around stupid sphinx resolution of type --- docs/source/conf.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 2ef97df0c..81acabae1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -4,6 +4,8 @@ import datetime import os +from sphinx.domains.python import PythonDomain + from sasdata import __version__ as sasdata_version if os.path.exists('rst_prolog'): @@ -43,6 +45,14 @@ def on_missing_reference(app, env, node, contnode): else: return None +# Bypass stupid sphinx handling of multiple classes with members named *type* +class PatchedPythonDomain(PythonDomain): + def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): + if 'refspecific' in node: + del node['refspecific'] + return super(PatchedPythonDomain, self).resolve_xref( + env, fromdocname, builder, typ, target, node, contnode) def setup(app): app.connect("missing-reference", on_missing_reference) + app.add_domain(PatchedPythonDomain, override=True) From 76110ce05ae85d8b27c9a5b41f0bc40cf742272b Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Mon, 13 Jul 2026 11:25:27 +0100 Subject: [PATCH 11/17] Copy sphinx math extensions from sasview --- docs/source/_extensions/dollarmath.py | 48 +++++++++++ docs/source/_extensions/mathjax.py | 114 ++++++++++++++++++++++++++ docs/source/conf.py | 38 ++++++--- 3 files changed, 188 insertions(+), 12 deletions(-) create mode 100644 docs/source/_extensions/dollarmath.py create mode 100644 docs/source/_extensions/mathjax.py diff --git a/docs/source/_extensions/dollarmath.py b/docs/source/_extensions/dollarmath.py new file mode 100644 index 000000000..3a5e0e1fc --- /dev/null +++ b/docs/source/_extensions/dollarmath.py @@ -0,0 +1,48 @@ +# This program is public domain +# Author: Paul Kienzle +r""" +Allow $math$ markup in text and docstrings, ignoring \$. + +The $math$ markup should be separated from the surrounding text by spaces. To +embed markup within a word, place backslash-space before and after. For +convenience, the final $ can be followed by punctuation (period, comma or +semicolon). +""" + +import re + +_dollar = re.compile(r"(?:^|(?<=\s|[-(]))[$]([^\n]*?)(?`_ to be used to display math in + Sphinx's HTML writer -- requires the MathJax JavaScript library on your + webserver/computer. + + :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. + + sample lines in conf.py to use this:: + + mathjax_path = ['https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js', + 'http://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/contrib/auto-render.min.js', + 'rendermath.js'] + mathjax_css = 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css' + + with rendermath.js containing:: + + document.addEventListener("DOMContentLoaded", function(event) { + renderMathInElement(document.body); + }); + + 2016-08-09 Jason Sachs + * allow list of URLS for mathjax_path, which permits use of katex.js +""" + +import sphinx +from docutils import nodes +from sphinx.errors import ExtensionError +from sphinx.ext.mathbase import setup_math as mathbase_setup +from sphinx.locale import _ + + +def html_visit_math(self, node): + self.body.append(self.starttag(node, 'span', '', CLASS='math')) + self.body.append(self.builder.config.mathjax_inline[0] + + self.encode(node['latex']) + + self.builder.config.mathjax_inline[1] + '') + raise nodes.SkipNode + + +def html_visit_displaymath(self, node): + self.body.append(self.starttag(node, 'div', CLASS='math')) + if node['nowrap']: + self.body.append(self.encode(node['latex'])) + self.body.append('') + raise nodes.SkipNode + + # necessary to e.g. set the id property correctly + if node['number']: + self.body.append('(%s)' % node['number']) + self.add_permalink_ref(node, _('Permalink to this equation')) + self.body.append('') + self.body.append(self.builder.config.mathjax_display[0]) + parts = [prt for prt in node['latex'].split('\n\n') if prt.strip()] + if len(parts) > 1: # Add alignment if there are more than 1 equation + self.body.append(r' \begin{align}\begin{aligned}') + for i, part in enumerate(parts): + part = self.encode(part) + if r'\\' in part: + self.body.append(r'\begin{split}' + part + r'\end{split}') + else: + self.body.append(part) + if i < len(parts) - 1: # append new line if not the last equation + self.body.append(r'\\') + if len(parts) > 1: # Add alignment if there are more than 1 equation + self.body.append(r'\end{aligned}\end{align} ') + self.body.append(self.builder.config.mathjax_display[1]) + self.body.append('\n') + raise nodes.SkipNode + +try: + basestring +except: + basestring = str + +def builder_inited(app): + jaxpath = app.config.mathjax_path + if not jaxpath: + raise ExtensionError('mathjax_path config value must be set for the ' + 'mathjax extension to work') + + # app.config.mathjax_path can be a string or a list of strings + if isinstance(jaxpath, basestring): + app.add_javascript(jaxpath) + else: + for p in jaxpath: + app.add_javascript(p) + + if app.config.mathjax_css: + app.add_stylesheet(app.config.mathjax_css) + + +def setup(app): + try: + mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None)) + except ExtensionError: + raise ExtensionError('sphinx.ext.mathjax: other math package is already loaded') + + # more information for mathjax secure url is here: + # http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn + app.add_config_value('mathjax_path', + 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?' + 'config=TeX-MML-AM_CHTML', + False) + app.add_config_value('mathjax_css', None, 'html') + app.add_config_value('mathjax_use_katex', False, 'html') + app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html') + app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html') + app.connect('builder-inited', builder_inited) + + return {'version': sphinx.__display_version__, 'parallel_read_safe': True} diff --git a/docs/source/conf.py b/docs/source/conf.py index 81acabae1..50b61649a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -8,31 +8,42 @@ from sasdata import __version__ as sasdata_version -if os.path.exists('rst_prolog'): - with open('rst_prolog') as fid: + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath("_extensions")) # for sphinx extensions +print("-- path --") +print("\n".join(sys.path)) + +if os.path.exists("rst_prolog"): + with open("rst_prolog") as fid: rst_prolog = fid.read() # General information about the project. year = datetime.datetime.now().year -project = 'SasData' -copyright = f'{year}, The SasView Project' -author = 'SasView' +project = "SasData" +copyright = f"{year}, The SasView Project" +author = "SasView" release = sasdata_version # -- General configuration --------------------------------------------------- extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.autosummary', + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "dollarmath", + "mathjax", ] -templates_path = ['_templates'] +templates_path = ["_templates"] exclude_patterns = [] # -- Options for HTML output ------------------------------------------------- -html_theme = 'default' +html_theme = "default" + # Ignore missing references to sections in SasView documentation def on_missing_reference(app, env, node, contnode): @@ -45,13 +56,16 @@ def on_missing_reference(app, env, node, contnode): else: return None + # Bypass stupid sphinx handling of multiple classes with members named *type* class PatchedPythonDomain(PythonDomain): def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): - if 'refspecific' in node: - del node['refspecific'] + if "refspecific" in node: + del node["refspecific"] return super(PatchedPythonDomain, self).resolve_xref( - env, fromdocname, builder, typ, target, node, contnode) + env, fromdocname, builder, typ, target, node, contnode + ) + def setup(app): app.connect("missing-reference", on_missing_reference) From 0e02a9e4e94e10504b7ef27105d61ce01c8deccc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 11:12:28 +0000 Subject: [PATCH 12/17] [pre-commit.ci lite] apply automatic fixes for ruff linting errors --- docs/source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 50b61649a..9e1ae726f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -8,7 +8,6 @@ from sasdata import __version__ as sasdata_version - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. From b729a6c11064e9c2ff283b6219504da03d82b108 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Mon, 13 Jul 2026 12:14:53 +0100 Subject: [PATCH 13/17] Import sys --- docs/source/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 9e1ae726f..5a009cbee 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -3,6 +3,7 @@ # -- Project information ---------------------------------------------------- import datetime import os +import sys from sphinx.domains.python import PythonDomain From 225388bc6d38843cc9f5dcd2d256ecc2cc4d3120 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Mon, 13 Jul 2026 12:24:17 +0100 Subject: [PATCH 14/17] Add mathbase to sphinx --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 5a009cbee..220fb8769 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -33,8 +33,8 @@ extensions = [ "sphinx.ext.autodoc", "sphinx.ext.autosummary", + "sphinx.ext.mathjax", "dollarmath", - "mathjax", ] templates_path = ["_templates"] From 2ab1f187d157e40bb22d5a6dbf51f28178d25da0 Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Mon, 13 Jul 2026 14:03:40 +0100 Subject: [PATCH 15/17] User dollar math in averaging.py --- sasdata/data_util/averaging.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sasdata/data_util/averaging.py b/sasdata/data_util/averaging.py index 84d34e2c8..ee36ecdb0 100644 --- a/sasdata/data_util/averaging.py +++ b/sasdata/data_util/averaging.py @@ -274,7 +274,7 @@ def __call__(self, data2d: Data2D) -> Data1D: class CircularAverage(PolarROI): r""" - Calculate I(\|Q\|) by circularly averaging 2D data between 2 radial limits. + Calculate $I(|Q|)$ by circularly averaging 2D data between 2 radial limits. This class is initialised by specifying lower and upper limits on the magnitude of Q values to consider during the averaging, though currently @@ -294,9 +294,9 @@ def __init__( Set up the lower and upper radial limits as well as the number of bins. The units are A^-1 for the radial parameters. - :param r_min: Lower limit for \|Q\| values to use during averaging. - :param r_max: Upper limit for \|Q\| values to use during averaging. - :param nbins: The number of bins data is sorted into along \|Q\| the axis + :param r_min: Lower limit for $|Q|$ values to use during averaging. + :param r_max: Upper limit for $|Q|$ values to use during averaging. + :param nbins: The number of bins data is sorted into along $|Q|$ the axis """ super().__init__(r_range=r_range, center=center) self.nbins: int = nbins @@ -400,8 +400,8 @@ def __init__( Set up the lower and upper radial limits as well as the number of bins. The units are A^-1 for the radial parameters. - :param r_min: Lower limit for \|Q\| values to use during averaging. - :param r_max: Upper limit for \|Q\| values to use during averaging. + :param r_min: Lower limit for $|Q|$ values to use during averaging. + :param r_max: Upper limit for $|Q|$ values to use during averaging. :param nbins: The number of bins data is sorted into along Phi the axis """ super().__init__(r_range=r_range, center=center) @@ -558,7 +558,7 @@ class SectorQ(PolarROI): This class is initialised by specifying lower and upper limits on both the magnitude of Q and the angle φ. These four parameters specify the primary - Region Of Interest, however there is a secondary ROI with the same \|Q\| + Region Of Interest, however there is a secondary ROI with the same $|Q|$ values on the opposite side of the origin (φ + π). How this secondary ROI is treated depends on the value of the `fold` parameter. If fold is set to True, data on opposite sides of the origin are averaged together and the @@ -583,10 +583,10 @@ def __init__( Set up the ROI boundaries, the binning of the output 1D data, and fold. The units are A^-1 for radial parameters, and radians for anglar ones. - :param r_range: Tuple (r_min, r_max) defining limits for \|Q\| values to use during averaging. + :param r_range: Tuple (r_min, r_max) defining limits for $|Q|$ values to use during averaging. :param phi_range: Tuple (phi_min, phi_max) defining limits for φ in radians (in the primary ROI). :Defaults to full circle (0, 2*pi). - :param nbins: The number of bins data is sorted into along the \|Q\| axis + :param nbins: The number of bins data is sorted into along the $|Q|$ axis :param fold: Whether the primary and secondary ROIs should be folded together during averaging. """ @@ -713,10 +713,10 @@ def __init__( Set up the ROI boundaries, and the binning of the output 1D data. The units are A^-1 for radial parameters, and radians for anglar ones. - :param r_range: Tuple (r_min, r_max) defining limits for \|Q\| values to use during averaging. + :param r_range: Tuple (r_min, r_max) defining limits for $|Q|$ values to use during averaging. :param phi_range: Tuple (phi_min, phi_max) defining limits for φ in radians (in the primary ROI). :Defaults to full circle (0, 2*pi). - :param nbins: The number of bins data is sorted into along the \|Q\| axis + :param nbins: The number of bins data is sorted into along the $|Q|$ axis """ super().__init__(r_range=r_range, phi_range=phi_range, center=center) self.nbins: int = nbins @@ -795,7 +795,7 @@ def __init__( Set up the ROI boundaries, and the binning of the output 1D data. The units are A^-1 for radial parameters, and radians for anglar ones. - :param r_range: Tuple (r_min, r_max) defining limits for \|Q\| values to use during averaging. + :param r_range: Tuple (r_min, r_max) defining limits for $|Q|$ values to use during averaging. :param phi_range: Tuple (phi_min, phi_max) defining angular bounds in radians. Defaults to full circle (0, 2*pi). :param nbins: The number of bins data is sorted into along the φ axis. From cb6fc1c3cfa3633b1b4470313a6d80d29b2d346e Mon Sep 17 00:00:00 2001 From: Adam Washington Date: Thu, 16 Jul 2026 11:29:06 +0100 Subject: [PATCH 16/17] Update units.py correctly --- sasdata/quantities/_autogen_warning.py | 132 ++++++++++++------------- sasdata/quantities/_build_tables.py | 30 ------ sasdata/quantities/si.py | 38 ++++--- sasdata/quantities/units.py | 71 +++++++------ 4 files changed, 118 insertions(+), 153 deletions(-) diff --git a/sasdata/quantities/_autogen_warning.py b/sasdata/quantities/_autogen_warning.py index 9a8c9372e..d796d04fe 100644 --- a/sasdata/quantities/_autogen_warning.py +++ b/sasdata/quantities/_autogen_warning.py @@ -7,72 +7,72 @@ -DDDDDDDDDDDDD NNNNNNNN NNNNNNNN tttt -D::::::::::::DDD N:::::::N N::::::N ttt:::t -D:::::::::::::::DD N::::::::N N::::::N t:::::t -DDD:::::DDDDD:::::D N:::::::::N N::::::N t:::::t - D:::::D D:::::D ooooooooooo N::::::::::N N::::::N ooooooooooo ttttttt:::::ttttttt - D:::::D D:::::D oo:::::::::::oo N:::::::::::N N::::::N oo:::::::::::oo t:::::::::::::::::t - D:::::D D:::::Do:::::::::::::::o N:::::::N::::N N::::::No:::::::::::::::ot:::::::::::::::::t - D:::::D D:::::Do:::::ooooo:::::o N::::::N N::::N N::::::No:::::ooooo:::::otttttt:::::::tttttt - D:::::D D:::::Do::::o o::::o N::::::N N::::N:::::::No::::o o::::o t:::::t - D:::::D D:::::Do::::o o::::o N::::::N N:::::::::::No::::o o::::o t:::::t - D:::::D D:::::Do::::o o::::o N::::::N N::::::::::No::::o o::::o t:::::t - D:::::D D:::::D o::::o o::::o N::::::N N:::::::::No::::o o::::o t:::::t tttttt -DDD:::::DDDDD:::::D o:::::ooooo:::::o N::::::N N::::::::No:::::ooooo:::::o t::::::tttt:::::t -D:::::::::::::::DD o:::::::::::::::o N::::::N N:::::::No:::::::::::::::o tt::::::::::::::t -D::::::::::::DDD oo:::::::::::oo N::::::N N::::::N oo:::::::::::oo tt:::::::::::tt -DDDDDDDDDDDDD ooooooooooo NNNNNNNN NNNNNNN ooooooooooo ttttttttttt - - - - - - - - - dddddddd -EEEEEEEEEEEEEEEEEEEEEE d::::::d iiii tttt BBBBBBBBBBBBBBBBB -E::::::::::::::::::::E d::::::d i::::i ttt:::t B::::::::::::::::B -E::::::::::::::::::::E d::::::d iiii t:::::t B::::::BBBBBB:::::B -EE::::::EEEEEEEEE::::E d:::::d t:::::t BB:::::B B:::::B - E:::::E EEEEEE ddddddddd:::::d iiiiiiittttttt:::::ttttttt B::::B B:::::Byyyyyyy yyyyyyy - E:::::E dd::::::::::::::d i:::::it:::::::::::::::::t B::::B B:::::B y:::::y y:::::y - E::::::EEEEEEEEEE d::::::::::::::::d i::::it:::::::::::::::::t B::::BBBBBB:::::B y:::::y y:::::y - E:::::::::::::::E d:::::::ddddd:::::d i::::itttttt:::::::tttttt B:::::::::::::BB y:::::y y:::::y - E:::::::::::::::E d::::::d d:::::d i::::i t:::::t B::::BBBBBB:::::B y:::::y y:::::y - E::::::EEEEEEEEEE d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y y:::::y - E:::::E d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y:::::y - E:::::E EEEEEEd:::::d d:::::d i::::i t:::::t tttttt B::::B B:::::B y:::::::::y -EE::::::EEEEEEEE:::::Ed::::::ddddd::::::ddi::::::i t::::::tttt:::::t BB:::::BBBBBB::::::B y:::::::y -E::::::::::::::::::::E d:::::::::::::::::di::::::i tt::::::::::::::t B:::::::::::::::::B y:::::y -E::::::::::::::::::::E d:::::::::ddd::::di::::::i tt:::::::::::tt B::::::::::::::::B y:::::y -EEEEEEEEEEEEEEEEEEEEEE ddddddddd dddddiiiiiiii ttttttttttt BBBBBBBBBBBBBBBBB y:::::y - y:::::y - y:::::y - y:::::y - y:::::y - yyyyyyy - - - - dddddddd -HHHHHHHHH HHHHHHHHH d::::::d -H:::::::H H:::::::H d::::::d -H:::::::H H:::::::H d::::::d -HH::::::H H::::::HH d:::::d - H:::::H H:::::H aaaaaaaaaaaaa nnnn nnnnnnnn ddddddddd:::::d - H:::::H H:::::H a::::::::::::a n:::nn::::::::nn dd::::::::::::::d - H::::::HHHHH::::::H aaaaaaaaa:::::an::::::::::::::nn d::::::::::::::::d - H:::::::::::::::::H a::::ann:::::::::::::::nd:::::::ddddd:::::d - H:::::::::::::::::H aaaaaaa:::::a n:::::nnnn:::::nd::::::d d:::::d - H::::::HHHHH::::::H aa::::::::::::a n::::n n::::nd:::::d d:::::d - H:::::H H:::::H a::::aaaa::::::a n::::n n::::nd:::::d d:::::d - H:::::H H:::::H a::::a a:::::a n::::n n::::nd:::::d d:::::d -HH::::::H H::::::HHa::::a a:::::a n::::n n::::nd::::::ddddd::::::dd -H:::::::H H:::::::Ha:::::aaaa::::::a n::::n n::::n d:::::::::::::::::d -H:::::::H H:::::::H a::::::::::aa:::a n::::n n::::n d:::::::::ddd::::d -HHHHHHHHH HHHHHHHHH aaaaaaaaaa aaaa nnnnnn nnnnnn ddddddddd ddddd +# DDDDDDDDDDDDD NNNNNNNN NNNNNNNN tttt +# D::::::::::::DDD N:::::::N N::::::N ttt:::t +# D:::::::::::::::DD N::::::::N N::::::N t:::::t +# DDD:::::DDDDD:::::D N:::::::::N N::::::N t:::::t +# D:::::D D:::::D ooooooooooo N::::::::::N N::::::N ooooooooooo ttttttt:::::ttttttt +# D:::::D D:::::D oo:::::::::::oo N:::::::::::N N::::::N oo:::::::::::oo t:::::::::::::::::t +# D:::::D D:::::Do:::::::::::::::o N:::::::N::::N N::::::No:::::::::::::::ot:::::::::::::::::t +# D:::::D D:::::Do:::::ooooo:::::o N::::::N N::::N N::::::No:::::ooooo:::::otttttt:::::::tttttt +# D:::::D D:::::Do::::o o::::o N::::::N N::::N:::::::No::::o o::::o t:::::t +# D:::::D D:::::Do::::o o::::o N::::::N N:::::::::::No::::o o::::o t:::::t +# D:::::D D:::::Do::::o o::::o N::::::N N::::::::::No::::o o::::o t:::::t +# D:::::D D:::::D o::::o o::::o N::::::N N:::::::::No::::o o::::o t:::::t tttttt +# DDD:::::DDDDD:::::D o:::::ooooo:::::o N::::::N N::::::::No:::::ooooo:::::o t::::::tttt:::::t +# D:::::::::::::::DD o:::::::::::::::o N::::::N N:::::::No:::::::::::::::o tt::::::::::::::t +# D::::::::::::DDD oo:::::::::::oo N::::::N N::::::N oo:::::::::::oo tt:::::::::::tt +# DDDDDDDDDDDDD ooooooooooo NNNNNNNN NNNNNNN ooooooooooo ttttttttttt +# +# +# +# +# +# +# +# +# dddddddd +# EEEEEEEEEEEEEEEEEEEEEE d::::::d iiii tttt BBBBBBBBBBBBBBBBB +# E::::::::::::::::::::E d::::::d i::::i ttt:::t B::::::::::::::::B +# E::::::::::::::::::::E d::::::d iiii t:::::t B::::::BBBBBB:::::B +# EE::::::EEEEEEEEE::::E d:::::d t:::::t BB:::::B B:::::B +# E:::::E EEEEEE ddddddddd:::::d iiiiiiittttttt:::::ttttttt B::::B B:::::Byyyyyyy yyyyyyy +# E:::::E dd::::::::::::::d i:::::it:::::::::::::::::t B::::B B:::::B y:::::y y:::::y +# E::::::EEEEEEEEEE d::::::::::::::::d i::::it:::::::::::::::::t B::::BBBBBB:::::B y:::::y y:::::y +# E:::::::::::::::E d:::::::ddddd:::::d i::::itttttt:::::::tttttt B:::::::::::::BB y:::::y y:::::y +# E:::::::::::::::E d::::::d d:::::d i::::i t:::::t B::::BBBBBB:::::B y:::::y y:::::y +# E::::::EEEEEEEEEE d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y y:::::y +# E:::::E d:::::d d:::::d i::::i t:::::t B::::B B:::::B y:::::y:::::y +# E:::::E EEEEEEd:::::d d:::::d i::::i t:::::t tttttt B::::B B:::::B y:::::::::y +# EE::::::EEEEEEEE:::::Ed::::::ddddd::::::ddi::::::i t::::::tttt:::::t BB:::::BBBBBB::::::B y:::::::y +# E::::::::::::::::::::E d:::::::::::::::::di::::::i tt::::::::::::::t B:::::::::::::::::B y:::::y +# E::::::::::::::::::::E d:::::::::ddd::::di::::::i tt:::::::::::tt B::::::::::::::::B y:::::y +# EEEEEEEEEEEEEEEEEEEEEE ddddddddd dddddiiiiiiii ttttttttttt BBBBBBBBBBBBBBBBB y:::::y +# y:::::y +# y:::::y +# y:::::y +# y:::::y +# yyyyyyy +# +# +# +# dddddddd +# HHHHHHHHH HHHHHHHHH d::::::d +# H:::::::H H:::::::H d::::::d +# H:::::::H H:::::::H d::::::d +# HH::::::H H::::::HH d:::::d +# H:::::H H:::::H aaaaaaaaaaaaa nnnn nnnnnnnn ddddddddd:::::d +# H:::::H H:::::H a::::::::::::a n:::nn::::::::nn dd::::::::::::::d +# H::::::HHHHH::::::H aaaaaaaaa:::::an::::::::::::::nn d::::::::::::::::d +# H:::::::::::::::::H a::::ann:::::::::::::::nd:::::::ddddd:::::d +# H:::::::::::::::::H aaaaaaa:::::a n:::::nnnn:::::nd::::::d d:::::d +# H::::::HHHHH::::::H aa::::::::::::a n::::n n::::nd:::::d d:::::d +# H:::::H H:::::H a::::aaaa::::::a n::::n n::::nd:::::d d:::::d +# H:::::H H:::::H a::::a a:::::a n::::n n::::nd:::::d d:::::d +# HH::::::H H::::::HHa::::a a:::::a n::::n n::::nd::::::ddddd::::::dd +# H:::::::H H:::::::Ha:::::aaaa::::::a n::::n n::::n d:::::::::::::::::d +# H:::::::H H:::::::H a::::::::::aa:::a n::::n n::::n d:::::::::ddd::::d +# HHHHHHHHH HHHHHHHHH aaaaaaaaaa aaaa nnnnnn nnnnnn ddddddddd ddddd diff --git a/sasdata/quantities/_build_tables.py b/sasdata/quantities/_build_tables.py index ba07aee80..391e95018 100644 --- a/sasdata/quantities/_build_tables.py +++ b/sasdata/quantities/_build_tables.py @@ -403,36 +403,6 @@ def format_name(name: str): fid.write("}\n\n") -with open("accessors.py", 'w', encoding=encoding) as fid: - - - fid.write('"""'+(warning_text%"_build_tables.py, _accessor_base.py")+'"""\n\n') - - with open("_accessor_base.py") as base: - for line in base: - fid.write(line) - - for dimension_name, dimensions in dimension_names: - - accessor_name = dimension_name.capitalize().replace("_", "") + "Accessor" - - fid.write(f"\n" - f"class {accessor_name}[T](QuantityAccessor[T]):\n" - f" dimension_name = '{dimension_name}'\n" - f" \n") - - for unit_name in unit_types[hash(dimensions)]: - fid.write(f" @property\n" - f" def {unit_name}(self) -> T:\n" - f" quantity = self.quantity\n" - f" if quantity is None:\n" - f" return None\n" - f" else:\n" - f" return quantity.in_units_of(units.{unit_name})\n" - f"\n") - - fid.write("\n") - with open("si.py", 'w') as fid: fid.write('"""'+(warning_text%"_build_tables.py")+'"""\n\n') diff --git a/sasdata/quantities/si.py b/sasdata/quantities/si.py index 24023c1d7..0df4e5637 100644 --- a/sasdata/quantities/si.py +++ b/sasdata/quantities/si.py @@ -78,26 +78,24 @@ """ -from sasdata.quantities.units import ( - amperes, - coulombs, - farads, - henry, - hertz, - joules, - kelvin, - kilograms, - meters, - newtons, - ohms, - pascals, - seconds, - siemens, - tesla, - volts, - watts, - webers, -) +from sasdata.quantities.units import meters +from sasdata.quantities.units import seconds +from sasdata.quantities.units import amperes +from sasdata.quantities.units import kelvin +from sasdata.quantities.units import hertz +from sasdata.quantities.units import newtons +from sasdata.quantities.units import pascals +from sasdata.quantities.units import joules +from sasdata.quantities.units import watts +from sasdata.quantities.units import coulombs +from sasdata.quantities.units import volts +from sasdata.quantities.units import ohms +from sasdata.quantities.units import farads +from sasdata.quantities.units import siemens +from sasdata.quantities.units import webers +from sasdata.quantities.units import tesla +from sasdata.quantities.units import henry +from sasdata.quantities.units import kilograms all_si = [ meters, diff --git a/sasdata/quantities/units.py b/sasdata/quantities/units.py index 8615c5ca4..5007cdeb0 100644 --- a/sasdata/quantities/units.py +++ b/sasdata/quantities/units.py @@ -88,7 +88,6 @@ from typing import Self import numpy as np - from sasdata.quantities.unicode_superscript import int_as_unicode_superscript @@ -157,7 +156,7 @@ def __truediv__(self: Self, other: Self): def __pow__(self, power: int | float): - if not isinstance(power, (int, float)): + if not isinstance(power, (int | float)): return NotImplemented frac = Fraction(power).limit_denominator(500) # Probably way bigger than needed, 10 would probably be fine @@ -316,7 +315,7 @@ def __truediv__(self: Self, other: "Unit"): def __rtruediv__(self: Self, other: "Unit"): if isinstance(other, Unit): return Unit(other.scale / self.scale, other.dimensions / self.dimensions) - elif isinstance(other, (int, float)): + elif isinstance(other, (int | float)): return Unit(other / self.scale, self.dimensions ** -1) else: return NotImplemented @@ -433,6 +432,7 @@ def apply(self, scale, dimensions) -> tuple[float, Dimensions, ProcessedUnitToke token = ProcessedUnitToken(self.unit, self.power) return new_scale, new_dimensions, token + class GreedyAbsDimensionUnitFormatProcessor(UnitFormatProcessor): """ This processor minimises the dimensionality of the unit by multiplying by as many units of the specified type as needed """ @@ -442,9 +442,6 @@ def __init__(self, unit: Unit): def apply(self, scale, dimensions) -> tuple[ProcessedUnitToken, float, Dimensions]: pass -class GreedyAbsDimensionUnitFormatProcessor(UnitFormatProcessor): - pass - class UnitGroup: """ A group of units that all have the same dimensionality """ def __init__(self, name: str, units: list[NamedUnit]): @@ -454,7 +451,7 @@ def __init__(self, name: str, units: list[NamedUnit]): # -# Specific units +# Specific units # meters = NamedUnit(1, Dimensions(1, 0, 0, 0, 0, 0, 0),name='meters',ascii_symbol='m',symbol='m') @@ -2119,12 +2116,12 @@ def __init__(self, name: str, units: list[NamedUnit]): # -# Units by type +# Units by type # length = UnitGroup( - name = 'length', + name = 'length', units = [ meters, exameters, @@ -2150,7 +2147,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) area = UnitGroup( - name = 'area', + name = 'area', units = [ square_meters, square_exameters, @@ -2176,7 +2173,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) volume = UnitGroup( - name = 'volume', + name = 'volume', units = [ litres, cubic_meters, @@ -2203,7 +2200,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) inverse_length = UnitGroup( - name = 'inverse_length', + name = 'inverse_length', units = [ per_meter, per_exameter, @@ -2229,7 +2226,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) inverse_area = UnitGroup( - name = 'inverse_area', + name = 'inverse_area', units = [ per_square_meter, per_square_exameter, @@ -2255,7 +2252,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) inverse_volume = UnitGroup( - name = 'inverse_volume', + name = 'inverse_volume', units = [ per_cubic_meter, per_cubic_exameter, @@ -2281,7 +2278,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) time = UnitGroup( - name = 'time', + name = 'time', units = [ seconds, milliseconds, @@ -2297,7 +2294,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) rate = UnitGroup( - name = 'rate', + name = 'rate', units = [ hertz, exahertz, @@ -2315,7 +2312,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) speed = UnitGroup( - name = 'speed', + name = 'speed', units = [ meters_per_second, meters_per_millisecond, @@ -2551,7 +2548,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) acceleration = UnitGroup( - name = 'acceleration', + name = 'acceleration', units = [ meters_per_square_second, meters_per_square_millisecond, @@ -2787,7 +2784,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) density = UnitGroup( - name = 'density', + name = 'density', units = [ grams_per_cubic_meter, exagrams_per_cubic_meter, @@ -3128,7 +3125,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) force = UnitGroup( - name = 'force', + name = 'force', units = [ newtons, exanewtons, @@ -3148,7 +3145,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) pressure = UnitGroup( - name = 'pressure', + name = 'pressure', units = [ pascals, exapascals, @@ -3167,7 +3164,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) energy = UnitGroup( - name = 'energy', + name = 'energy', units = [ joules, exajoules, @@ -3198,7 +3195,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) power = UnitGroup( - name = 'power', + name = 'power', units = [ watts, exawatts, @@ -3216,7 +3213,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) charge = UnitGroup( - name = 'charge', + name = 'charge', units = [ coulombs, exacoulombs, @@ -3234,7 +3231,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) potential = UnitGroup( - name = 'potential', + name = 'potential', units = [ volts, exavolts, @@ -3252,7 +3249,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) resistance = UnitGroup( - name = 'resistance', + name = 'resistance', units = [ ohms, exaohms, @@ -3270,7 +3267,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) capacitance = UnitGroup( - name = 'capacitance', + name = 'capacitance', units = [ farads, exafarads, @@ -3288,7 +3285,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) conductance = UnitGroup( - name = 'conductance', + name = 'conductance', units = [ siemens, exasiemens, @@ -3306,7 +3303,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) magnetic_flux = UnitGroup( - name = 'magnetic_flux', + name = 'magnetic_flux', units = [ webers, exawebers, @@ -3324,7 +3321,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) magnetic_flux_density = UnitGroup( - name = 'magnetic_flux_density', + name = 'magnetic_flux_density', units = [ tesla, exatesla, @@ -3342,7 +3339,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) inductance = UnitGroup( - name = 'inductance', + name = 'inductance', units = [ henry, exahenry, @@ -3360,7 +3357,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) temperature = UnitGroup( - name = 'temperature', + name = 'temperature', units = [ kelvin, exakelvin, @@ -3379,14 +3376,14 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) dimensionless = UnitGroup( - name = 'dimensionless', + name = 'dimensionless', units = [ none, percent, ]) angle = UnitGroup( - name = 'angle', + name = 'angle', units = [ degrees, radians, @@ -3394,13 +3391,13 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) solid_angle = UnitGroup( - name = 'solid_angle', + name = 'solid_angle', units = [ stradians, ]) amount = UnitGroup( - name = 'amount', + name = 'amount', units = [ moles, millimoles, @@ -3412,7 +3409,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) concentration = UnitGroup( - name = 'concentration', + name = 'concentration', units = [ moles_per_cubic_meter, millimoles_per_cubic_meter, From cca5fdaf830a6ec943725a4dfa2c3e9113367ca6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2026 10:57:20 +0000 Subject: [PATCH 17/17] [pre-commit.ci lite] apply automatic fixes for ruff linting errors --- sasdata/quantities/si.py | 38 +++++++++++----------- sasdata/quantities/units.py | 63 +++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 49 deletions(-) diff --git a/sasdata/quantities/si.py b/sasdata/quantities/si.py index 0df4e5637..24023c1d7 100644 --- a/sasdata/quantities/si.py +++ b/sasdata/quantities/si.py @@ -78,24 +78,26 @@ """ -from sasdata.quantities.units import meters -from sasdata.quantities.units import seconds -from sasdata.quantities.units import amperes -from sasdata.quantities.units import kelvin -from sasdata.quantities.units import hertz -from sasdata.quantities.units import newtons -from sasdata.quantities.units import pascals -from sasdata.quantities.units import joules -from sasdata.quantities.units import watts -from sasdata.quantities.units import coulombs -from sasdata.quantities.units import volts -from sasdata.quantities.units import ohms -from sasdata.quantities.units import farads -from sasdata.quantities.units import siemens -from sasdata.quantities.units import webers -from sasdata.quantities.units import tesla -from sasdata.quantities.units import henry -from sasdata.quantities.units import kilograms +from sasdata.quantities.units import ( + amperes, + coulombs, + farads, + henry, + hertz, + joules, + kelvin, + kilograms, + meters, + newtons, + ohms, + pascals, + seconds, + siemens, + tesla, + volts, + watts, + webers, +) all_si = [ meters, diff --git a/sasdata/quantities/units.py b/sasdata/quantities/units.py index 5007cdeb0..6e5e68121 100644 --- a/sasdata/quantities/units.py +++ b/sasdata/quantities/units.py @@ -88,6 +88,7 @@ from typing import Self import numpy as np + from sasdata.quantities.unicode_superscript import int_as_unicode_superscript @@ -451,7 +452,7 @@ def __init__(self, name: str, units: list[NamedUnit]): # -# Specific units +# Specific units # meters = NamedUnit(1, Dimensions(1, 0, 0, 0, 0, 0, 0),name='meters',ascii_symbol='m',symbol='m') @@ -2116,12 +2117,12 @@ def __init__(self, name: str, units: list[NamedUnit]): # -# Units by type +# Units by type # length = UnitGroup( - name = 'length', + name = 'length', units = [ meters, exameters, @@ -2147,7 +2148,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) area = UnitGroup( - name = 'area', + name = 'area', units = [ square_meters, square_exameters, @@ -2173,7 +2174,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) volume = UnitGroup( - name = 'volume', + name = 'volume', units = [ litres, cubic_meters, @@ -2200,7 +2201,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) inverse_length = UnitGroup( - name = 'inverse_length', + name = 'inverse_length', units = [ per_meter, per_exameter, @@ -2226,7 +2227,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) inverse_area = UnitGroup( - name = 'inverse_area', + name = 'inverse_area', units = [ per_square_meter, per_square_exameter, @@ -2252,7 +2253,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) inverse_volume = UnitGroup( - name = 'inverse_volume', + name = 'inverse_volume', units = [ per_cubic_meter, per_cubic_exameter, @@ -2278,7 +2279,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) time = UnitGroup( - name = 'time', + name = 'time', units = [ seconds, milliseconds, @@ -2294,7 +2295,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) rate = UnitGroup( - name = 'rate', + name = 'rate', units = [ hertz, exahertz, @@ -2312,7 +2313,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) speed = UnitGroup( - name = 'speed', + name = 'speed', units = [ meters_per_second, meters_per_millisecond, @@ -2548,7 +2549,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) acceleration = UnitGroup( - name = 'acceleration', + name = 'acceleration', units = [ meters_per_square_second, meters_per_square_millisecond, @@ -2784,7 +2785,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) density = UnitGroup( - name = 'density', + name = 'density', units = [ grams_per_cubic_meter, exagrams_per_cubic_meter, @@ -3125,7 +3126,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) force = UnitGroup( - name = 'force', + name = 'force', units = [ newtons, exanewtons, @@ -3145,7 +3146,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) pressure = UnitGroup( - name = 'pressure', + name = 'pressure', units = [ pascals, exapascals, @@ -3164,7 +3165,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) energy = UnitGroup( - name = 'energy', + name = 'energy', units = [ joules, exajoules, @@ -3195,7 +3196,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) power = UnitGroup( - name = 'power', + name = 'power', units = [ watts, exawatts, @@ -3213,7 +3214,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) charge = UnitGroup( - name = 'charge', + name = 'charge', units = [ coulombs, exacoulombs, @@ -3231,7 +3232,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) potential = UnitGroup( - name = 'potential', + name = 'potential', units = [ volts, exavolts, @@ -3249,7 +3250,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) resistance = UnitGroup( - name = 'resistance', + name = 'resistance', units = [ ohms, exaohms, @@ -3267,7 +3268,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) capacitance = UnitGroup( - name = 'capacitance', + name = 'capacitance', units = [ farads, exafarads, @@ -3285,7 +3286,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) conductance = UnitGroup( - name = 'conductance', + name = 'conductance', units = [ siemens, exasiemens, @@ -3303,7 +3304,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) magnetic_flux = UnitGroup( - name = 'magnetic_flux', + name = 'magnetic_flux', units = [ webers, exawebers, @@ -3321,7 +3322,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) magnetic_flux_density = UnitGroup( - name = 'magnetic_flux_density', + name = 'magnetic_flux_density', units = [ tesla, exatesla, @@ -3339,7 +3340,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) inductance = UnitGroup( - name = 'inductance', + name = 'inductance', units = [ henry, exahenry, @@ -3357,7 +3358,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) temperature = UnitGroup( - name = 'temperature', + name = 'temperature', units = [ kelvin, exakelvin, @@ -3376,14 +3377,14 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) dimensionless = UnitGroup( - name = 'dimensionless', + name = 'dimensionless', units = [ none, percent, ]) angle = UnitGroup( - name = 'angle', + name = 'angle', units = [ degrees, radians, @@ -3391,13 +3392,13 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) solid_angle = UnitGroup( - name = 'solid_angle', + name = 'solid_angle', units = [ stradians, ]) amount = UnitGroup( - name = 'amount', + name = 'amount', units = [ moles, millimoles, @@ -3409,7 +3410,7 @@ def __init__(self, name: str, units: list[NamedUnit]): ]) concentration = UnitGroup( - name = 'concentration', + name = 'concentration', units = [ moles_per_cubic_meter, millimoles_per_cubic_meter,