Annotate UnitBase.bases as list[NamedUnit] #17779 Merged 1 task Contributor Author mhvk commented Feb 14, 2025 I looked a bit more into this, and the real problem is that unit.decompose(bases) requires that the bases are either irreducible units or scaled versions of those, i.e., ...
units.errors import UnitsWarning from astropy.units.utils import maybe_simple_fraction from astropy.utils.misc import did_you_mean from . import core if TYPE_CHECKING: from collections.abc import Iterable from typing import ClassVar, Literal import numpy as np from astropy.extern.ply.lex import...
from astropy import units as u # 创建一个带有单位的物理量 length = 10 * u.m # 获取物理量的数值,去掉单位 length_value = length.value print(length_value) # 输出:10.0 在上面的代码中,length是一个带有单位的物理量,表示长度为10米。通过访问length.value,可以获取物理量的数值,即去掉了单位的长度...
ENBlazor 是将 C# 引入浏览器的 Microsoft 试验框架,正好可以填补欠缺的 C# 一环。如今,C# 程序员可...
To see the actual implementation, given astropy is open-source, you could see the source code in astropy/visualization/units.py. How do you make custom stretch in astropy.visualization? You can subclass from BaseStretch. That said, there is an exhaustive list of the various stretches, ...
table.dat --- Bytes Format Units Label Explanations --- 1- 9 E9.4 m nandata Description of nans 11-19 E9.4 m data1 [1.0/1.0] Description of data1 21-29 E9.4 m data2 [2.71/2.72] Description of data2 ---
WilliamJamieson added the units label Jul 18, 2023 Contributor saimn commented Jul 18, 2023 You must have a quite old Astropy version, this was fixed in 5.0 (#12535). 👍 1 Member eerovaher commented Jul 21, 2023 As pointed out already the problem occurs only when running numpy ...
astropy/units format base.py console.py latex.py utils.py function logarithmic.py 5 files changed +17 -18 lines changed astropy/units/format/base.py +10-11 Original file line numberDiff line numberDiff line change @@ -73,12 +73,12 @@ def _format_unit_list(cls, units): ...
_units.dtype)[()] if NUMPY_LT_1_24: results = np.array(applied, self._units.dtype)[()] else: results = np.void(applied, self._units.dtype) if cls is not None: return results.view((cls, results.dtype)) 10 changes: 1 addition & 9 deletions 10 astropy/units/tests/test_quantity...
[1].name IndexError: list index out of range During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test_astropy.py", line 1, in <module> import astropy.units as apunit File "~/venv/lib/python3.6/site-packages/astropy/units/__...