physpyx 2.2.0__tar.gz → 2.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {physpyx-2.2.0 → physpyx-2.2.1}/PKG-INFO +1 -1
- {physpyx-2.2.0 → physpyx-2.2.1}/pyproject.toml +1 -1
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/__init__.py +2 -1
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/context.py +13 -2
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/quantity.py +5 -0
- {physpyx-2.2.0 → physpyx-2.2.1}/README.md +0 -0
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/astronomy.py +0 -0
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/data/all-nuclides.csv +0 -0
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/helper.py +0 -0
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/manager.py +0 -0
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/nuclide.py +0 -0
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/physpyx.py +0 -0
- {physpyx-2.2.0 → physpyx-2.2.1}/src/physpyx/qty.py +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from .astronomy import Orbit
|
|
2
|
+
from .context import NuclearContext
|
|
2
3
|
from .nuclide import NuclideTable
|
|
3
4
|
from .physpyx import PhysPyX
|
|
4
5
|
from .qty import Qty
|
|
5
6
|
|
|
6
|
-
__all__ = ["NuclideTable", "
|
|
7
|
+
__all__ = ["NuclideTable", "NuclearContext", "Orbit", "PhysPyX", "Qty"]
|
|
@@ -7,7 +7,7 @@ class SiunitxContext(Context):
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class NuclearContext(SiunitxContext):
|
|
10
|
-
def __init__(self,
|
|
10
|
+
def __init__(self, preferred_units: bool = True):
|
|
11
11
|
super().__init__("nuclear")
|
|
12
12
|
self.add_transformation(
|
|
13
13
|
"[mass]",
|
|
@@ -20,5 +20,16 @@ class NuclearContext(SiunitxContext):
|
|
|
20
20
|
lambda ureg, x: x / ureg.speed_of_light / ureg.speed_of_light,
|
|
21
21
|
)
|
|
22
22
|
self.preferred_units = (
|
|
23
|
-
{
|
|
23
|
+
{
|
|
24
|
+
UnitsContainer({"[mass]": 1}): "amu",
|
|
25
|
+
UnitsContainer(
|
|
26
|
+
{
|
|
27
|
+
"[mass]": 1,
|
|
28
|
+
"[length]": 2,
|
|
29
|
+
"[time]": -2,
|
|
30
|
+
}
|
|
31
|
+
): "megaelectronvolt",
|
|
32
|
+
}
|
|
33
|
+
if preferred_units
|
|
34
|
+
else {}
|
|
24
35
|
)
|
|
@@ -146,6 +146,11 @@ class SiunitxQuantity(Quantity):
|
|
|
146
146
|
# "PlainQuantity[Unknown]"'
|
|
147
147
|
return cast(SiunitxQuantity, super().__neg__())
|
|
148
148
|
|
|
149
|
+
def __add__(self, other: object) -> "SiunitxQuantity":
|
|
150
|
+
# NOTE: to fix typing warning 'Cannot access attribute "???" for class
|
|
151
|
+
# "PlainQuantity[Unknown]"'
|
|
152
|
+
return cast(SiunitxQuantity, super().__add__(other))
|
|
153
|
+
|
|
149
154
|
def _format_unit(self) -> str:
|
|
150
155
|
num = ""
|
|
151
156
|
den = ""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|