orpheus-npcf 0.1.0__cp310-cp310-macosx_15_0_arm64.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.
Potentially problematic release.
This version of orpheus-npcf might be problematic. Click here for more details.
- orpheus/.dylibs/libgomp.1.dylib +0 -0
- orpheus/__init__.py +6 -0
- orpheus/catalog.py +1202 -0
- orpheus/covariance.py +153 -0
- orpheus/direct.py +1083 -0
- orpheus/flat2dgrid.py +44 -0
- orpheus/npcf.py +3696 -0
- orpheus/orpheus_clib.cpython-310-darwin.so +0 -0
- orpheus/patchutils.py +356 -0
- orpheus/utils.py +152 -0
- orpheus_npcf-0.1.0.dist-info/METADATA +67 -0
- orpheus_npcf-0.1.0.dist-info/RECORD +15 -0
- orpheus_npcf-0.1.0.dist-info/WHEEL +6 -0
- orpheus_npcf-0.1.0.dist-info/licenses/LICENSE +674 -0
- orpheus_npcf-0.1.0.dist-info/top_level.txt +1 -0
orpheus/flat2dgrid.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from scipy.interpolate import RegularGridInterpolator
|
|
3
|
+
|
|
4
|
+
__all__ = ["FlatPixelGrid_2D","FlatDataGrid_2D"]
|
|
5
|
+
|
|
6
|
+
class FlatPixelGrid_2D(object):
|
|
7
|
+
|
|
8
|
+
def __init__(self, start_1, start_2, npix_1, npix_2, dpix_1, dpix_2):
|
|
9
|
+
self.start_1 = start_1
|
|
10
|
+
self.start_2 = start_2
|
|
11
|
+
self.npix_1 = npix_1
|
|
12
|
+
self.npix_2 = npix_2
|
|
13
|
+
self.dpix_1 = dpix_1
|
|
14
|
+
self.dpix_2 = dpix_2
|
|
15
|
+
self.pix1_lbounds = self.start_1 + self.dpix_1*np.arange(self.npix_1)
|
|
16
|
+
self.pix2_lbounds = self.start_2 + self.dpix_2*np.arange(self.npix_2)
|
|
17
|
+
self.pix1_centers = self.pix1_lbounds + self.dpix_1/2.
|
|
18
|
+
self.pix2_centers = self.pix2_lbounds + self.dpix_2/2.
|
|
19
|
+
|
|
20
|
+
def todatagrid(self, data):
|
|
21
|
+
return FlatDataGrid_2D(data, self.start_1, self.start_2, self.dpix_1, self.dpix_2)
|
|
22
|
+
|
|
23
|
+
def _regrid(self, other, data):
|
|
24
|
+
assert(isinstance(other,FlatPixelGrid_2D))
|
|
25
|
+
assert(data.shape == (self.npix_2,self.npix_1))
|
|
26
|
+
data_int = RegularGridInterpolator((self.pix2_centers, self.pix1_centers), data,
|
|
27
|
+
method="linear", bounds_error=False, fill_value=0)
|
|
28
|
+
oc1, oc2 = np.meshgrid(other.pix2_centers,other.pix1_centers, indexing='ij')
|
|
29
|
+
centers_mapgrid = np.array([oc1,oc2]).reshape((2,oc1.shape[1]*oc1.shape[0])).transpose()
|
|
30
|
+
data_regridded = data_int(centers_mapgrid).reshape((oc1.shape[0],oc1.shape[1]))
|
|
31
|
+
return other.todatagrid(data_regridded)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class FlatDataGrid_2D(FlatPixelGrid_2D):
|
|
35
|
+
|
|
36
|
+
def __init__(self, data, start_1, start_2, dpix_1, dpix_2):
|
|
37
|
+
"""
|
|
38
|
+
Convention: O (unmasked) --> 1 (fully masked)
|
|
39
|
+
"""
|
|
40
|
+
super().__init__(start_1, start_2, data.shape[1], data.shape[0], dpix_1, dpix_2)
|
|
41
|
+
self.data = data
|
|
42
|
+
|
|
43
|
+
def regrid(self, other_grid):
|
|
44
|
+
return super()._regrid(other_grid, self.data)
|