plotastrodata 1.11.1__py3-none-any.whl → 1.11.2__py3-none-any.whl
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/__init__.py +1 -1
- plotastrodata/ext_utils.py +54 -0
- {plotastrodata-1.11.1.dist-info → plotastrodata-1.11.2.dist-info}/METADATA +1 -1
- {plotastrodata-1.11.1.dist-info → plotastrodata-1.11.2.dist-info}/RECORD +7 -7
- {plotastrodata-1.11.1.dist-info → plotastrodata-1.11.2.dist-info}/WHEEL +0 -0
- {plotastrodata-1.11.1.dist-info → plotastrodata-1.11.2.dist-info}/licenses/LICENSE +0 -0
- {plotastrodata-1.11.1.dist-info → plotastrodata-1.11.2.dist-info}/top_level.txt +0 -0
plotastrodata/__init__.py
CHANGED
plotastrodata/ext_utils.py
CHANGED
|
@@ -5,6 +5,7 @@ from typing import Any
|
|
|
5
5
|
|
|
6
6
|
from plotastrodata import const_utils as cu
|
|
7
7
|
from plotastrodata._type_utils import _normalize_float
|
|
8
|
+
from plotastrodata._validation_utils import _require_integer
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def terminal(cmd: str, check: bool = True,
|
|
@@ -86,3 +87,56 @@ def JnuT(T: float | np.floating | np.ndarray = 30,
|
|
|
86
87
|
result = cu.h * nu / cu.k_B / (np.exp(cu.h * nu / cu.k_B / T) - 1)
|
|
87
88
|
array_output = isinstance(T, np.ndarray) or isinstance(nu, np.ndarray)
|
|
88
89
|
return _normalize_float(result, force_float=True, array_output=array_output)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def costaper(shape: tuple[int | np.integer, ...],
|
|
93
|
+
npix: int | np.integer = 0
|
|
94
|
+
) -> np.ndarray:
|
|
95
|
+
"""Return a separable cosine window with a 1D or 2D shape.
|
|
96
|
+
|
|
97
|
+
Multiply the returned window by an array to apply the taper, for
|
|
98
|
+
example, ``data * costaper(data.shape, npix=2)``.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
shape (tuple of int or np.integer): One or two nonnegative axis
|
|
102
|
+
lengths, for example, ``(nx,)`` or ``(ny, nx)``. Boolean axis
|
|
103
|
+
lengths are not accepted.
|
|
104
|
+
npix (int or np.integer, optional): Number of tapered pixels at each
|
|
105
|
+
edge along every axis. Must be nonnegative and no greater than half
|
|
106
|
+
the length of any axis. Zero returns an all-ones window.
|
|
107
|
+
Boolean values are not accepted. Defaults to 0 (no taper).
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
np.ndarray: Float64 weights with the requested ``shape``.
|
|
111
|
+
Along each axis, the weight at distance ``d < npix`` from the
|
|
112
|
+
nearest edge is ``(1 - cos(pi * d / npix)) / 2``; all other
|
|
113
|
+
weights are one. Thus the outermost pixels are zero for a positive
|
|
114
|
+
width. In 2D, the window is the outer product of the axis windows.
|
|
115
|
+
|
|
116
|
+
Raises:
|
|
117
|
+
ValueError: If ``shape`` is not a tuple of one or two nonnegative
|
|
118
|
+
integer axis lengths (excluding booleans), or ``npix`` is not
|
|
119
|
+
a nonnegative Python or NumPy integer (excluding
|
|
120
|
+
booleans), or the two edge tapers would overlap.
|
|
121
|
+
"""
|
|
122
|
+
if not isinstance(shape, tuple) or len(shape) not in (1, 2):
|
|
123
|
+
raise ValueError('shape must be a tuple of one or two axis lengths.')
|
|
124
|
+
for axis, length in enumerate(shape):
|
|
125
|
+
_require_integer(length, f'shape[{axis}]', minimum=0)
|
|
126
|
+
shape = tuple(int(length) for length in shape)
|
|
127
|
+
_require_integer(npix, 'npix', minimum=0)
|
|
128
|
+
npix = int(npix)
|
|
129
|
+
if npix > min(shape) // 2:
|
|
130
|
+
raise ValueError('npix must be at most half each axis length.')
|
|
131
|
+
|
|
132
|
+
def taper1d(nx: int) -> np.ndarray:
|
|
133
|
+
weights = np.ones(nx)
|
|
134
|
+
if npix > 0:
|
|
135
|
+
ramp = (1 - np.cos(np.pi * np.arange(npix) / npix)) / 2
|
|
136
|
+
weights[:npix] = ramp
|
|
137
|
+
weights[-npix:] = ramp[::-1]
|
|
138
|
+
return weights
|
|
139
|
+
|
|
140
|
+
if len(shape) == 1:
|
|
141
|
+
return taper1d(shape[0])
|
|
142
|
+
return taper1d(shape[0])[:, None] * taper1d(shape[1])[None, :]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plotastrodata
|
|
3
|
-
Version: 1.11.
|
|
3
|
+
Version: 1.11.2
|
|
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
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
plotastrodata/__init__.py,sha256=
|
|
1
|
+
plotastrodata/__init__.py,sha256=xEIkQG82q-U5HhA5XUbjCu-LfnR00eCJVOJ6809sywc,87
|
|
2
2
|
plotastrodata/_type_utils.py,sha256=OBFWmDnrIMWKvnpbAjrNqFFqE8RChl0nNUweXB-w1ek,4193
|
|
3
3
|
plotastrodata/_validation_utils.py,sha256=FOIOgzrP1vwuDfjqCMvYcp4yMdRjQUMtZWE-BnUXBgA,2924
|
|
4
4
|
plotastrodata/analysis_utils.py,sha256=pkueWH08ZKSZuD1-8agjb1XihHUQJXCbY7y8VFOrbts,64516
|
|
5
5
|
plotastrodata/const_utils.py,sha256=1rg59_VZrraVCqz974ac8i-utGuzSEY-1KNMDDUUUtI,4809
|
|
6
6
|
plotastrodata/coord_utils.py,sha256=QN2LQJSZfjTwbO1d7pEf14n6KPkK7OXiqw0UgPmsMCM,9854
|
|
7
|
-
plotastrodata/ext_utils.py,sha256=
|
|
7
|
+
plotastrodata/ext_utils.py,sha256=jiHy50cwEO045k3IM9nPdVm44g28y-t_AbXm8AIPWYM,5714
|
|
8
8
|
plotastrodata/fft_utils.py,sha256=nLZR6mjmxh1uAdWiuyuVi6KmQSaPwuV02BqqiK68phw,23177
|
|
9
9
|
plotastrodata/fits_utils.py,sha256=pqJLxocR3wVSZcOEqdmjXzImUxf6R2wZ3j-LV99Q2gE,23297
|
|
10
10
|
plotastrodata/fitting_utils.py,sha256=2swKVkakri7uVqtrlc95RfhYO9cNWHV5M3qr7U-gqXI,36842
|
|
@@ -13,8 +13,8 @@ plotastrodata/matrix_utils.py,sha256=W03es1Gw4LeIqlCMnzvAxsAa99zAShlGxzbbMe6_P3E
|
|
|
13
13
|
plotastrodata/noise_utils.py,sha256=jIIEIJDU4hT2N7mGvgRDx7y-C4c_SstOW7ldF--Y1M4,16338
|
|
14
14
|
plotastrodata/other_utils.py,sha256=M4l0YXI_OVCuBa9owGEtbEw1hudsD7-2_8NHEWrebG4,12123
|
|
15
15
|
plotastrodata/plot_utils.py,sha256=21b3oosgT12ATaDTfcB933skxDestA2q2d5KvSr7QWs,128778
|
|
16
|
-
plotastrodata-1.11.
|
|
17
|
-
plotastrodata-1.11.
|
|
18
|
-
plotastrodata-1.11.
|
|
19
|
-
plotastrodata-1.11.
|
|
20
|
-
plotastrodata-1.11.
|
|
16
|
+
plotastrodata-1.11.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
17
|
+
plotastrodata-1.11.2.dist-info/METADATA,sha256=KKvnSTk1TXsWv5l1b75pwkc-1LPCgLVqYuFCQMdMwQU,3917
|
|
18
|
+
plotastrodata-1.11.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
19
|
+
plotastrodata-1.11.2.dist-info/top_level.txt,sha256=mv2FRRtreGAUE_UF_Z_TYj_NZLECJqkQx7ErkA_Rttg,14
|
|
20
|
+
plotastrodata-1.11.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|