plotastrodata 1.10.3__tar.gz → 1.11.0__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.
- {plotastrodata-1.10.3/plotastrodata.egg-info → plotastrodata-1.11.0}/PKG-INFO +3 -13
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/README.md +2 -12
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata/__init__.py +1 -1
- plotastrodata-1.11.0/plotastrodata/_type_utils.py +100 -0
- plotastrodata-1.11.0/plotastrodata/analysis_utils.py +1381 -0
- plotastrodata-1.11.0/plotastrodata/const_utils.py +129 -0
- plotastrodata-1.11.0/plotastrodata/coord_utils.py +249 -0
- plotastrodata-1.11.0/plotastrodata/ext_utils.py +88 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata/fft_utils.py +220 -114
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata/fits_utils.py +153 -68
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata/fitting_utils.py +250 -98
- plotastrodata-1.11.0/plotastrodata/los_utils.py +169 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata/matrix_utils.py +16 -9
- plotastrodata-1.11.0/plotastrodata/noise_utils.py +369 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata/other_utils.py +74 -52
- plotastrodata-1.11.0/plotastrodata/plot_utils.py +2673 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0/plotastrodata.egg-info}/PKG-INFO +3 -13
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata.egg-info/SOURCES.txt +1 -0
- plotastrodata-1.10.3/plotastrodata/analysis_utils.py +0 -938
- plotastrodata-1.10.3/plotastrodata/const_utils.py +0 -125
- plotastrodata-1.10.3/plotastrodata/coord_utils.py +0 -194
- plotastrodata-1.10.3/plotastrodata/ext_utils.py +0 -64
- plotastrodata-1.10.3/plotastrodata/los_utils.py +0 -107
- plotastrodata-1.10.3/plotastrodata/noise_utils.py +0 -245
- plotastrodata-1.10.3/plotastrodata/plot_utils.py +0 -1745
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/LICENSE +0 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/MANIFEST.in +0 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata.egg-info/dependency_links.txt +0 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata.egg-info/not-zip-safe +0 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata.egg-info/requires.txt +0 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/plotastrodata.egg-info/top_level.txt +0 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/setup.cfg +0 -0
- {plotastrodata-1.10.3 → plotastrodata-1.11.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.11.0
|
|
4
4
|
Summary: plotastrodata is a tool for astronomers to create figures from FITS files and perform fundamental data analyses with ease.
|
|
5
5
|
Home-page: https://github.com/yusukeaso-astron/plotastrodata
|
|
6
6
|
Download-URL: https://github.com/yusukeaso-astron/plotastrodata
|
|
@@ -102,18 +102,8 @@ More examples and the complete API reference are available in the [online docume
|
|
|
102
102
|
|
|
103
103
|
## Conventions and Limitations
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* By default, the R.A. axis increases toward the left (`xflip=True`), following the usual astronomical image convention. Use `xflip=False` to reverse this behavior.
|
|
108
|
-
* Velocity coordinates and `vsys` are in km/s, while `restfreq` is in Hz. A frequency axis read from FITS is converted to velocity relative to `vsys`.
|
|
109
|
-
* Sky positions may be given as coordinate strings, such as `'ICRS 01h23m45.6s 01d23m45.6s'`. Numeric positions supplied through `poslist`, such as `[0.2, 0.3]`, are relative plotting positions: 0 is the left or bottom edge and 1 is the right or top edge. They are not spatial offsets.
|
|
110
|
-
* Angles are in degrees unless an API explicitly states otherwise. Sky position angles are measured from north toward east. The polar-coordinate arrays `theta` and `phi` used by the line-of-sight utilities are in radians.
|
|
111
|
-
* A beam is represented by `[bmaj, bmin, bpa]`, where the first two values use the current spatial unit and `bpa` is in degrees. `Tb=True` converts data from Jy/beam to brightness temperature and requires a valid rest frequency and spatial-resolution metadata.
|
|
112
|
-
* `sigma` may be a numeric RMS value, a string selecting a noise-estimation method, or `None` to disable noise-dependent behavior. See the API documentation for the available estimation methods.
|
|
113
|
-
* Annotation methods accept a single value or a list of values. `include_chan` selects displayed channels by zero-based index; `None` applies the annotation to all channels.
|
|
114
|
-
* Position-velocity mode (`pv=True`) does not support regions, lines, arrows, or segment maps because its spatial and velocity axes use different units. Markers and text may still be placed using relative plotting positions.
|
|
115
|
-
* Constants in `const_utils` are plain numerical values in SI units, not `astropy.units.Quantity` objects.
|
|
116
|
-
|
|
105
|
+
See [Conventions and usage notes](docs/conventions.rst) for data formats, coordinate and angle conventions, runtime types, and supported usage.
|
|
106
|
+
|
|
117
107
|
## Author
|
|
118
108
|
|
|
119
109
|
* Name: Yusuke Aso
|
|
@@ -73,18 +73,8 @@ More examples and the complete API reference are available in the [online docume
|
|
|
73
73
|
|
|
74
74
|
## Conventions and Limitations
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
* By default, the R.A. axis increases toward the left (`xflip=True`), following the usual astronomical image convention. Use `xflip=False` to reverse this behavior.
|
|
79
|
-
* Velocity coordinates and `vsys` are in km/s, while `restfreq` is in Hz. A frequency axis read from FITS is converted to velocity relative to `vsys`.
|
|
80
|
-
* Sky positions may be given as coordinate strings, such as `'ICRS 01h23m45.6s 01d23m45.6s'`. Numeric positions supplied through `poslist`, such as `[0.2, 0.3]`, are relative plotting positions: 0 is the left or bottom edge and 1 is the right or top edge. They are not spatial offsets.
|
|
81
|
-
* Angles are in degrees unless an API explicitly states otherwise. Sky position angles are measured from north toward east. The polar-coordinate arrays `theta` and `phi` used by the line-of-sight utilities are in radians.
|
|
82
|
-
* A beam is represented by `[bmaj, bmin, bpa]`, where the first two values use the current spatial unit and `bpa` is in degrees. `Tb=True` converts data from Jy/beam to brightness temperature and requires a valid rest frequency and spatial-resolution metadata.
|
|
83
|
-
* `sigma` may be a numeric RMS value, a string selecting a noise-estimation method, or `None` to disable noise-dependent behavior. See the API documentation for the available estimation methods.
|
|
84
|
-
* Annotation methods accept a single value or a list of values. `include_chan` selects displayed channels by zero-based index; `None` applies the annotation to all channels.
|
|
85
|
-
* Position-velocity mode (`pv=True`) does not support regions, lines, arrows, or segment maps because its spatial and velocity axes use different units. Markers and text may still be placed using relative plotting positions.
|
|
86
|
-
* Constants in `const_utils` are plain numerical values in SI units, not `astropy.units.Quantity` objects.
|
|
87
|
-
|
|
76
|
+
See [Conventions and usage notes](docs/conventions.rst) for data formats, coordinate and angle conventions, runtime types, and supported usage.
|
|
77
|
+
|
|
88
78
|
## Author
|
|
89
79
|
|
|
90
80
|
* Name: Yusuke Aso
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Internal helpers for preserving numeric output precision."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import field
|
|
4
|
+
import numpy as np
|
|
5
|
+
from typing import Annotated, Any, Callable, Literal, overload
|
|
6
|
+
from pydantic import WrapValidator
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Shared input types; validated settings are separate from uncoerced inputs.
|
|
10
|
+
RealScalar = float | np.floating | np.integer
|
|
11
|
+
RealSequence = list[RealScalar] | tuple[RealScalar, ...] | np.ndarray
|
|
12
|
+
PositionPair = tuple[RealScalar, RealScalar] | list[RealScalar] | np.ndarray
|
|
13
|
+
Position = str | PositionPair
|
|
14
|
+
Positions = Position | list[Position] | tuple[Position, ...]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _validate_float(value: Any, handler: Callable) -> float | np.longdouble:
|
|
18
|
+
"""Preserve extended precision before Pydantic coerces other values."""
|
|
19
|
+
return value if isinstance(value, np.longdouble) else handler(value)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
ValidatedFloat = Annotated[float | np.longdouble,
|
|
23
|
+
WrapValidator(_validate_float)]
|
|
24
|
+
|
|
25
|
+
# Raw analysis inputs retain their containers and scalar types.
|
|
26
|
+
BeamInput = np.ndarray | list[RealScalar | None] | tuple[RealScalar | None,
|
|
27
|
+
RealScalar | None,
|
|
28
|
+
RealScalar | None]
|
|
29
|
+
# Plotting converts inputs to lists and validates shape/completeness separately.
|
|
30
|
+
ValidatedBeamTriple = list[ValidatedFloat | None]
|
|
31
|
+
ValidatedBeams = ValidatedBeamTriple | list[ValidatedBeamTriple]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
_FloatNormalizationInput = int | float | np.integer | np.floating | np.ndarray
|
|
36
|
+
_FloatNormalizationResult = int | float | np.integer | np.longdouble | np.ndarray
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@overload
|
|
40
|
+
def _normalize_float(value: _FloatNormalizationInput, *,
|
|
41
|
+
force_float: bool = False,
|
|
42
|
+
array_output: Literal[True]
|
|
43
|
+
) -> np.ndarray: ...
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@overload
|
|
47
|
+
def _normalize_float(value: np.ndarray, *,
|
|
48
|
+
force_float: bool = False,
|
|
49
|
+
array_output: None = None
|
|
50
|
+
) -> np.ndarray: ...
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@overload
|
|
54
|
+
def _normalize_float(value: float | np.floating, *,
|
|
55
|
+
force_float: bool = False,
|
|
56
|
+
array_output: Literal[False] | None = None
|
|
57
|
+
) -> float | np.longdouble: ...
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@overload
|
|
61
|
+
def _normalize_float(value: _FloatNormalizationInput, *,
|
|
62
|
+
force_float: bool = False,
|
|
63
|
+
array_output: bool | None = None
|
|
64
|
+
) -> _FloatNormalizationResult: ...
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _normalize_float(value: _FloatNormalizationInput, *,
|
|
68
|
+
force_float: bool = False,
|
|
69
|
+
array_output: bool | None = None
|
|
70
|
+
) -> _FloatNormalizationResult:
|
|
71
|
+
"""Normalize a real numerical result at its public output boundary.
|
|
72
|
+
|
|
73
|
+
By default, convert ordinary NumPy floating scalars to Python floats,
|
|
74
|
+
leaving integers and arrays unchanged. Extended-precision floating
|
|
75
|
+
scalars retain their precision.
|
|
76
|
+
|
|
77
|
+
force_float converts scalar integers to Python floats as well.
|
|
78
|
+
array_output=True preserves or restores array form via np.asarray;
|
|
79
|
+
False unwraps a zero-dimensional temporary before scalar normalization;
|
|
80
|
+
None preserves the result's existing scalar/array form. Arrays with
|
|
81
|
+
dimensions greater than zero always remain arrays. Array dtypes are
|
|
82
|
+
never changed by force_float, including for zero-dimensional arrays
|
|
83
|
+
retained with array_output=True or None.
|
|
84
|
+
"""
|
|
85
|
+
if array_output is True:
|
|
86
|
+
return np.asarray(value)
|
|
87
|
+
if isinstance(value, np.ndarray):
|
|
88
|
+
if array_output is not False or value.ndim != 0:
|
|
89
|
+
return value
|
|
90
|
+
value = value[()]
|
|
91
|
+
if isinstance(value, np.longdouble):
|
|
92
|
+
return value
|
|
93
|
+
if force_float or isinstance(value, np.floating):
|
|
94
|
+
return float(value)
|
|
95
|
+
return value
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _internal_field() -> Any:
|
|
99
|
+
"""Create a fresh field for internal state populated after initialization."""
|
|
100
|
+
return field(init=False, default=None, repr=False, compare=False)
|