foscat 3.8.0__py3-none-any.whl → 3.9.0__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.
- foscat/BkBase.py +39 -29
- foscat/BkNumpy.py +56 -47
- foscat/BkTensorflow.py +89 -81
- foscat/BkTorch.py +95 -59
- foscat/FoCUS.py +72 -56
- foscat/Synthesis.py +3 -3
- foscat/alm.py +194 -177
- foscat/backend.py +84 -70
- foscat/scat_cov.py +1876 -2100
- foscat/scat_cov2D.py +146 -53
- {foscat-3.8.0.dist-info → foscat-3.9.0.dist-info}/METADATA +1 -1
- {foscat-3.8.0.dist-info → foscat-3.9.0.dist-info}/RECORD +15 -15
- {foscat-3.8.0.dist-info → foscat-3.9.0.dist-info}/WHEEL +1 -1
- {foscat-3.8.0.dist-info → foscat-3.9.0.dist-info}/LICENSE +0 -0
- {foscat-3.8.0.dist-info → foscat-3.9.0.dist-info}/top_level.txt +0 -0
foscat/scat_cov2D.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import foscat.scat_cov as scat
|
|
2
1
|
import numpy as np
|
|
3
2
|
|
|
3
|
+
import foscat.scat_cov as scat
|
|
4
|
+
|
|
5
|
+
|
|
4
6
|
class scat_cov2D:
|
|
5
7
|
def __init__(self, s0, s2, s3, s4, s1=None, s3p=None, backend=None):
|
|
6
8
|
|
|
@@ -11,12 +13,13 @@ class scat_cov2D:
|
|
|
11
13
|
def fill(self, im, nullval=0):
|
|
12
14
|
return self.fill_2d(im, nullval=nullval)
|
|
13
15
|
|
|
16
|
+
|
|
14
17
|
class funct(scat.funct):
|
|
15
18
|
def __init__(self, *args, **kwargs):
|
|
16
19
|
# Impose que use_2D=True pour la classe scat
|
|
17
|
-
super().__init__(use_2D=True,KERNELSZ=5, *args, **kwargs)
|
|
18
|
-
|
|
19
|
-
def spectrum(self,image):
|
|
20
|
+
super().__init__(use_2D=True, KERNELSZ=5, *args, **kwargs)
|
|
21
|
+
|
|
22
|
+
def spectrum(self, image):
|
|
20
23
|
"""
|
|
21
24
|
Compute the 1D power spectrum of a 2D image by averaging the 2D power spectrum
|
|
22
25
|
over concentric frequency rings (radial averaging), using np.bincount for efficiency.
|
|
@@ -29,7 +32,7 @@ class funct(scat.funct):
|
|
|
29
32
|
- spectrum_1d : corresponding 1D power spectrum
|
|
30
33
|
"""
|
|
31
34
|
import numpy as np
|
|
32
|
-
|
|
35
|
+
|
|
33
36
|
# Compute the 2D Fourier Transform and shift the zero frequency to the center
|
|
34
37
|
F = np.fft.fftshift(np.fft.fft2(image))
|
|
35
38
|
power_spectrum = np.abs(F) ** 2
|
|
@@ -37,7 +40,7 @@ class funct(scat.funct):
|
|
|
37
40
|
# Create coordinate grids and compute the radial distance from the center
|
|
38
41
|
y, x = np.indices(power_spectrum.shape)
|
|
39
42
|
center = np.array(power_spectrum.shape) // 2
|
|
40
|
-
r = np.sqrt((x - center[1])**2 + (y - center[0])**2).astype(int)
|
|
43
|
+
r = np.sqrt((x - center[1]) ** 2 + (y - center[0]) ** 2).astype(int)
|
|
41
44
|
|
|
42
45
|
# Use np.bincount for fast summation and counting
|
|
43
46
|
sum_power = np.bincount(r.ravel(), weights=power_spectrum.ravel())
|
|
@@ -48,71 +51,161 @@ class funct(scat.funct):
|
|
|
48
51
|
|
|
49
52
|
return spectrum_1d
|
|
50
53
|
|
|
51
|
-
def plot_results(
|
|
54
|
+
def plot_results(
|
|
55
|
+
self,
|
|
56
|
+
in_image,
|
|
57
|
+
out_image,
|
|
58
|
+
vmin=None,
|
|
59
|
+
vmax=None,
|
|
60
|
+
cmap="coolwarm",
|
|
61
|
+
spec_range=None,
|
|
62
|
+
):
|
|
52
63
|
import matplotlib.pyplot as plt
|
|
53
|
-
|
|
54
|
-
if len(out_image.shape)>2:
|
|
55
|
-
nimage=out_image.shape[0]
|
|
56
|
-
ndraw=np.min([3,nimage])
|
|
57
|
-
plt.figure(figsize=(16,12))
|
|
58
|
-
plt.subplot(2,ndraw+1,1)
|
|
59
|
-
plt.title(
|
|
60
|
-
plt.imshow(in_image,cmap=cmap,vmin=vmin,vmax=vmax,origin=
|
|
64
|
+
|
|
65
|
+
if len(out_image.shape) > 2:
|
|
66
|
+
nimage = out_image.shape[0]
|
|
67
|
+
ndraw = np.min([3, nimage])
|
|
68
|
+
plt.figure(figsize=(16, 12))
|
|
69
|
+
plt.subplot(2, ndraw + 1, 1)
|
|
70
|
+
plt.title("Original field")
|
|
71
|
+
plt.imshow(in_image, cmap=cmap, vmin=vmin, vmax=vmax, origin="lower")
|
|
61
72
|
plt.xticks([])
|
|
62
73
|
plt.yticks([])
|
|
63
74
|
for k in range(ndraw):
|
|
64
|
-
plt.subplot(2,ndraw+1,2+k)
|
|
65
|
-
plt.title(
|
|
66
|
-
plt.imshow(
|
|
75
|
+
plt.subplot(2, ndraw + 1, 2 + k)
|
|
76
|
+
plt.title("Modeled field #%d" % (k))
|
|
77
|
+
plt.imshow(
|
|
78
|
+
out_image[k], cmap=cmap, vmin=vmin, vmax=vmax, origin="lower"
|
|
79
|
+
)
|
|
67
80
|
plt.xticks([])
|
|
68
81
|
plt.yticks([])
|
|
69
|
-
plt.subplot(2,2,3)
|
|
70
|
-
plt.title(
|
|
82
|
+
plt.subplot(2, 2, 3)
|
|
83
|
+
plt.title("Histogram")
|
|
71
84
|
for k in range(nimage):
|
|
72
|
-
if k==0:
|
|
73
|
-
plt.hist(
|
|
85
|
+
if k == 0:
|
|
86
|
+
plt.hist(
|
|
87
|
+
out_image[k].flatten(),
|
|
88
|
+
bins=100,
|
|
89
|
+
label="modeled",
|
|
90
|
+
color="b",
|
|
91
|
+
histtype="step",
|
|
92
|
+
log=True,
|
|
93
|
+
alpha=0.5,
|
|
94
|
+
)
|
|
74
95
|
else:
|
|
75
|
-
plt.hist(
|
|
76
|
-
|
|
96
|
+
plt.hist(
|
|
97
|
+
out_image[k].flatten(),
|
|
98
|
+
bins=100,
|
|
99
|
+
color="b",
|
|
100
|
+
histtype="step",
|
|
101
|
+
log=True,
|
|
102
|
+
alpha=0.5,
|
|
103
|
+
)
|
|
104
|
+
plt.hist(
|
|
105
|
+
in_image.flatten(),
|
|
106
|
+
bins=100,
|
|
107
|
+
label="original",
|
|
108
|
+
color="r",
|
|
109
|
+
histtype="step",
|
|
110
|
+
log=True,
|
|
111
|
+
)
|
|
77
112
|
plt.legend(frameon=0)
|
|
78
|
-
plt.subplot(2,2,4)
|
|
79
|
-
plt.title(
|
|
113
|
+
plt.subplot(2, 2, 4)
|
|
114
|
+
plt.title("Powerspectra")
|
|
80
115
|
for k in range(nimage):
|
|
81
|
-
if k==0:
|
|
82
|
-
plt.plot(
|
|
116
|
+
if k == 0:
|
|
117
|
+
plt.plot(
|
|
118
|
+
self.spectrum(out_image[k]),
|
|
119
|
+
color="b",
|
|
120
|
+
label="modeled",
|
|
121
|
+
alpha=0.5,
|
|
122
|
+
)
|
|
83
123
|
else:
|
|
84
|
-
plt.plot(self.spectrum(out_image[k]),color=
|
|
85
|
-
plt.plot(self.spectrum(in_image),color=
|
|
86
|
-
plt.xscale(
|
|
87
|
-
plt.yscale(
|
|
124
|
+
plt.plot(self.spectrum(out_image[k]), color="b", alpha=0.5)
|
|
125
|
+
plt.plot(self.spectrum(in_image), color="r", label="original")
|
|
126
|
+
plt.xscale("log")
|
|
127
|
+
plt.yscale("log")
|
|
88
128
|
plt.legend(frameon=0)
|
|
89
129
|
if spec_range is not None:
|
|
90
|
-
plt.ylim(spec_range[0],spec_range[1])
|
|
130
|
+
plt.ylim(spec_range[0], spec_range[1])
|
|
91
131
|
else:
|
|
92
|
-
plt.figure(figsize=(16,3))
|
|
93
|
-
plt.subplot(1,4,1)
|
|
94
|
-
plt.title(
|
|
95
|
-
plt.imshow(in_image,cmap=cmap,vmin=vmin,vmax=vmax,origin=
|
|
132
|
+
plt.figure(figsize=(16, 3))
|
|
133
|
+
plt.subplot(1, 4, 1)
|
|
134
|
+
plt.title("Original field")
|
|
135
|
+
plt.imshow(in_image, cmap=cmap, vmin=vmin, vmax=vmax, origin="lower")
|
|
96
136
|
plt.xticks([])
|
|
97
137
|
plt.yticks([])
|
|
98
|
-
plt.subplot(1,4,2)
|
|
99
|
-
plt.title(
|
|
100
|
-
plt.imshow(out_image,cmap=cmap,vmin=vmin,vmax=vmax,origin=
|
|
138
|
+
plt.subplot(1, 4, 2)
|
|
139
|
+
plt.title("Modeled field")
|
|
140
|
+
plt.imshow(out_image, cmap=cmap, vmin=vmin, vmax=vmax, origin="lower")
|
|
101
141
|
plt.xticks([])
|
|
102
142
|
plt.yticks([])
|
|
103
|
-
plt.subplot(1,4,3)
|
|
104
|
-
plt.title(
|
|
105
|
-
plt.hist(
|
|
106
|
-
|
|
143
|
+
plt.subplot(1, 4, 3)
|
|
144
|
+
plt.title("Histogram")
|
|
145
|
+
plt.hist(
|
|
146
|
+
in_image.flatten(),
|
|
147
|
+
bins=100,
|
|
148
|
+
label="original",
|
|
149
|
+
color="r",
|
|
150
|
+
histtype="step",
|
|
151
|
+
log=True,
|
|
152
|
+
)
|
|
153
|
+
plt.hist(
|
|
154
|
+
out_image.flatten(),
|
|
155
|
+
bins=100,
|
|
156
|
+
label="modeled",
|
|
157
|
+
color="b",
|
|
158
|
+
histtype="step",
|
|
159
|
+
log=True,
|
|
160
|
+
)
|
|
107
161
|
plt.legend(frameon=0)
|
|
108
|
-
plt.subplot(1,4,4)
|
|
109
|
-
plt.title(
|
|
110
|
-
plt.plot(self.spectrum(in_image),color=
|
|
111
|
-
plt.plot(self.spectrum(out_image),color=
|
|
112
|
-
plt.xscale(
|
|
113
|
-
plt.yscale(
|
|
162
|
+
plt.subplot(1, 4, 4)
|
|
163
|
+
plt.title("Powerspectra")
|
|
164
|
+
plt.plot(self.spectrum(in_image), color="b", label="original")
|
|
165
|
+
plt.plot(self.spectrum(out_image), color="r", label="modeled")
|
|
166
|
+
plt.xscale("log")
|
|
167
|
+
plt.yscale("log")
|
|
114
168
|
if spec_range is not None:
|
|
115
|
-
plt.ylim(spec_range[0],spec_range[1])
|
|
169
|
+
plt.ylim(spec_range[0], spec_range[1])
|
|
116
170
|
plt.legend(frameon=0)
|
|
117
|
-
|
|
118
|
-
|
|
171
|
+
|
|
172
|
+
def plot_results(self, in_image, out_image, vmin=None, vmax=None, cmap="coolwarm"):
|
|
173
|
+
import matplotlib.pyplot as plt
|
|
174
|
+
|
|
175
|
+
plt.figure(figsize=(16, 3))
|
|
176
|
+
plt.subplot(1, 4, 1)
|
|
177
|
+
plt.title("Original field")
|
|
178
|
+
plt.imshow(in_image, cmap=cmap, vmin=vmin, vmax=vmax, origin="lower")
|
|
179
|
+
plt.xticks([])
|
|
180
|
+
plt.yticks([])
|
|
181
|
+
plt.subplot(1, 4, 2)
|
|
182
|
+
plt.title("Modeled field")
|
|
183
|
+
plt.imshow(out_image, cmap=cmap, vmin=vmin, vmax=vmax, origin="lower")
|
|
184
|
+
plt.xticks([])
|
|
185
|
+
plt.yticks([])
|
|
186
|
+
plt.subplot(1, 4, 3)
|
|
187
|
+
plt.title("Histogram")
|
|
188
|
+
plt.hist(
|
|
189
|
+
in_image.flatten(),
|
|
190
|
+
bins=100,
|
|
191
|
+
label="original",
|
|
192
|
+
color="r",
|
|
193
|
+
histtype="step",
|
|
194
|
+
log=True,
|
|
195
|
+
)
|
|
196
|
+
plt.hist(
|
|
197
|
+
out_image.flatten(),
|
|
198
|
+
bins=100,
|
|
199
|
+
label="modeled",
|
|
200
|
+
color="b",
|
|
201
|
+
histtype="step",
|
|
202
|
+
log=True,
|
|
203
|
+
)
|
|
204
|
+
plt.legend(frameon=0)
|
|
205
|
+
plt.subplot(1, 4, 4)
|
|
206
|
+
plt.title("Powerspectra")
|
|
207
|
+
plt.plot(self.spectrum(in_image), color="b", label="original")
|
|
208
|
+
plt.plot(self.spectrum(out_image), color="r", label="modeled")
|
|
209
|
+
plt.xscale("log")
|
|
210
|
+
plt.yscale("log")
|
|
211
|
+
plt.legend(frameon=0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: foscat
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.9.0
|
|
4
4
|
Summary: Generate synthetic Healpix or 2D data using Cross Scattering Transform
|
|
5
5
|
Author-email: Jean-Marc DELOUIS <jean.marc.delouis@ifremer.fr>
|
|
6
6
|
Maintainer-email: Theo Foulquier <theo.foulquier@ifremer.fr>
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
foscat/BkBase.py,sha256=
|
|
2
|
-
foscat/BkNumpy.py,sha256=
|
|
3
|
-
foscat/BkTensorflow.py,sha256=
|
|
4
|
-
foscat/BkTorch.py,sha256=
|
|
1
|
+
foscat/BkBase.py,sha256=_iszgMdVIVEB47EBxNt5xemsdaKzsNFPStDF00M_-Ng,21281
|
|
2
|
+
foscat/BkNumpy.py,sha256=zRldS_-L6A7y1zDzEPZXQntuw3Paw2zHZowhD43FHRs,10589
|
|
3
|
+
foscat/BkTensorflow.py,sha256=N5TBacuyFB1-qGTi2kOc8zbgWzj5lVRRN47uZJpJJ10,15713
|
|
4
|
+
foscat/BkTorch.py,sha256=mW0hyLWoCoGlt34a2587zqbAv1FuVgMq32Yu4AjmUpU,14306
|
|
5
5
|
foscat/CNN.py,sha256=j0F2a4Xf3LijhyD_WVZ6Eg_IjGuXw3ddH6Iudj1xVaw,4874
|
|
6
6
|
foscat/CircSpline.py,sha256=CXi49FxF8ZoeZ17Ua8c1AZXe2B5ICEC9aCXb97atB3s,4028
|
|
7
|
-
foscat/FoCUS.py,sha256=
|
|
7
|
+
foscat/FoCUS.py,sha256=h3QCu6if8fh9gEBrprEr3mG07TZ5O7y9eCc4qHbsCYk,103551
|
|
8
8
|
foscat/GCNN.py,sha256=5RV-FKuvqbD-k99TwiM4CttM2LMZE21WD0IK0j5Mkko,7599
|
|
9
9
|
foscat/Softmax.py,sha256=aBLQauoG0q2SJYPotV6U-cxAhsJcspWHNRWdnA_nAiQ,2854
|
|
10
10
|
foscat/Spline1D.py,sha256=rKzzenduaZZ-yBDJd35it6Gyrj1spqb7hoIaUgISPzY,2983
|
|
11
|
-
foscat/Synthesis.py,sha256=
|
|
11
|
+
foscat/Synthesis.py,sha256=NJI1laestYfqTz9iqPlqwTmwPdQWRZoe_-Sp61gozF4,13822
|
|
12
12
|
foscat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
foscat/alm.py,sha256=
|
|
14
|
-
foscat/backend.py,sha256=
|
|
13
|
+
foscat/alm.py,sha256=qZlsYj5HzV1EY9Fdzt0U8bemrZHZziaMOKZ55FU8foM,33806
|
|
14
|
+
foscat/backend.py,sha256=l3aMwDyXP6jURMIvratFMGWCTcQpaR68KnUuuGDezqE,45418
|
|
15
15
|
foscat/backend_tens.py,sha256=9Dp136m9frkclkwifJQLLbIpl3ETI3_txdPUZcKfuMw,1618
|
|
16
16
|
foscat/loss_backend_tens.py,sha256=dCOVN6faDtIpN3VO78HTmYP2i5fnFAf-Ddy5qVBlGrM,1783
|
|
17
17
|
foscat/loss_backend_torch.py,sha256=k3z18Dj3SaLKK6ZIKcm7GO4U_YKYVP6LtHG1aIbxkYk,1627
|
|
18
18
|
foscat/scat.py,sha256=qGYiBIysPt65MdmF07WWA4piVlTfA9-lFDTaicnqC2w,72822
|
|
19
19
|
foscat/scat1D.py,sha256=W5Uu6wdQ4ZsFKXpof0f1OBl-1wjJmW7ruvddRWxe7uM,53726
|
|
20
20
|
foscat/scat2D.py,sha256=boKj0ASqMMSy7uQLK6hPniG87m3hZGJBYBiq5v8F9IQ,532
|
|
21
|
-
foscat/scat_cov.py,sha256=
|
|
21
|
+
foscat/scat_cov.py,sha256=UL-1rkdGKios33gw6IYnhFqQ_hbQPJeURQra13QzV0Y,253970
|
|
22
22
|
foscat/scat_cov1D.py,sha256=XOxsZZ5TYq8f34i2tUgIfzyaqaTDlICB3HzD2l_puro,531
|
|
23
|
-
foscat/scat_cov2D.py,sha256=
|
|
23
|
+
foscat/scat_cov2D.py,sha256=pAm0fKw8wyXram0TFbtw8tGcc8QPKuPXpQk0kh10r4U,7078
|
|
24
24
|
foscat/scat_cov_map.py,sha256=Swt39-nYEaQkBzyX4EOAQBvUuYQpERzJ-uVxSWS2b-Y,2911
|
|
25
25
|
foscat/scat_cov_map2D.py,sha256=FqF45FBcoiQbvuVsrLWUIPRUc95GsKsrnH6fKzB3GlE,2841
|
|
26
|
-
foscat-3.
|
|
27
|
-
foscat-3.
|
|
28
|
-
foscat-3.
|
|
29
|
-
foscat-3.
|
|
30
|
-
foscat-3.
|
|
26
|
+
foscat-3.9.0.dist-info/LICENSE,sha256=i0ukIr8ZUpkSY2sZaE9XZK-6vuSU5iG6IgX_3pjatP8,1505
|
|
27
|
+
foscat-3.9.0.dist-info/METADATA,sha256=NZTyxhm4YIy44NAAp1NhvTRAIRdy__1esRG594Sp94c,7190
|
|
28
|
+
foscat-3.9.0.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
|
29
|
+
foscat-3.9.0.dist-info/top_level.txt,sha256=AGySXBBAlJgb8Tj8af6m_F-aiNg2zNTcybCUPVOKjAg,7
|
|
30
|
+
foscat-3.9.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|