foscat 3.6.1__py3-none-any.whl → 3.7.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/CircSpline.py +19 -22
- foscat/FoCUS.py +58 -51
- foscat/Spline1D.py +12 -13
- foscat/Synthesis.py +16 -13
- foscat/alm.py +718 -580
- foscat/backend.py +98 -29
- foscat/scat_cov.py +597 -371
- foscat/scat_cov2D.py +61 -1
- foscat/scat_cov_map.py +15 -2
- {foscat-3.6.1.dist-info → foscat-3.7.0.dist-info}/METADATA +2 -2
- foscat-3.7.0.dist-info/RECORD +26 -0
- {foscat-3.6.1.dist-info → foscat-3.7.0.dist-info}/WHEEL +1 -1
- foscat/alm_tools.py +0 -11
- foscat-3.6.1.dist-info/RECORD +0 -27
- {foscat-3.6.1.dist-info → foscat-3.7.0.dist-info}/LICENCE +0 -0
- {foscat-3.6.1.dist-info → foscat-3.7.0.dist-info}/top_level.txt +0 -0
foscat/scat_cov2D.py
CHANGED
|
@@ -11,8 +11,68 @@ class scat_cov2D:
|
|
|
11
11
|
def fill(self, im, nullval=0):
|
|
12
12
|
return self.fill_2d(im, nullval=nullval)
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
class funct(scat.funct):
|
|
16
15
|
def __init__(self, *args, **kwargs):
|
|
17
16
|
# Impose que use_2D=True pour la classe scat
|
|
18
17
|
super().__init__(use_2D=True, *args, **kwargs)
|
|
18
|
+
|
|
19
|
+
def spectrum(self,image):
|
|
20
|
+
"""
|
|
21
|
+
Compute the 1D power spectrum of a 2D image by averaging the 2D power spectrum
|
|
22
|
+
over concentric frequency rings (radial averaging), using np.bincount for efficiency.
|
|
23
|
+
|
|
24
|
+
Parameters:
|
|
25
|
+
- image : ndarray (2D), input image
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
- freq : radial frequencies
|
|
29
|
+
- spectrum_1d : corresponding 1D power spectrum
|
|
30
|
+
"""
|
|
31
|
+
import numpy as np
|
|
32
|
+
|
|
33
|
+
# Compute the 2D Fourier Transform and shift the zero frequency to the center
|
|
34
|
+
F = np.fft.fftshift(np.fft.fft2(image))
|
|
35
|
+
power_spectrum = np.abs(F) ** 2
|
|
36
|
+
|
|
37
|
+
# Create coordinate grids and compute the radial distance from the center
|
|
38
|
+
y, x = np.indices(power_spectrum.shape)
|
|
39
|
+
center = np.array(power_spectrum.shape) // 2
|
|
40
|
+
r = np.sqrt((x - center[1])**2 + (y - center[0])**2).astype(int)
|
|
41
|
+
|
|
42
|
+
# Use np.bincount for fast summation and counting
|
|
43
|
+
sum_power = np.bincount(r.ravel(), weights=power_spectrum.ravel())
|
|
44
|
+
counts = np.bincount(r.ravel())
|
|
45
|
+
|
|
46
|
+
# Compute the mean power for each radial bin
|
|
47
|
+
spectrum_1d = sum_power / counts
|
|
48
|
+
|
|
49
|
+
return spectrum_1d
|
|
50
|
+
|
|
51
|
+
def plot_results(self,in_image,out_image,vmin=None,vmax=None,cmap='coolwarm'):
|
|
52
|
+
import matplotlib.pyplot as plt
|
|
53
|
+
|
|
54
|
+
plt.figure(figsize=(16,3))
|
|
55
|
+
plt.subplot(1,4,1)
|
|
56
|
+
plt.title('Original field')
|
|
57
|
+
plt.imshow(in_image,cmap=cmap,vmin=vmin,vmax=vmax,origin='lower')
|
|
58
|
+
plt.xticks([])
|
|
59
|
+
plt.yticks([])
|
|
60
|
+
plt.subplot(1,4,2)
|
|
61
|
+
plt.title('Modeled field')
|
|
62
|
+
plt.imshow(out_image,cmap=cmap,vmin=vmin,vmax=vmax,origin='lower')
|
|
63
|
+
plt.xticks([])
|
|
64
|
+
plt.yticks([])
|
|
65
|
+
plt.subplot(1,4,3)
|
|
66
|
+
plt.title('Histogram')
|
|
67
|
+
plt.hist(in_image.flatten(),bins=100,label='original',color='r',histtype='step',log=True)
|
|
68
|
+
plt.hist(out_image.flatten(),bins=100,label='modeled',color='b',histtype='step',log=True)
|
|
69
|
+
plt.legend(frameon=0)
|
|
70
|
+
plt.subplot(1,4,4)
|
|
71
|
+
plt.title('Powerspectra')
|
|
72
|
+
plt.plot(self.spectrum(in_image),color='b',label='original')
|
|
73
|
+
plt.plot(self.spectrum(out_image),color='r',label='modeled')
|
|
74
|
+
plt.xscale('log')
|
|
75
|
+
plt.yscale('log')
|
|
76
|
+
plt.legend(frameon=0)
|
|
77
|
+
|
|
78
|
+
|
foscat/scat_cov_map.py
CHANGED
|
@@ -24,10 +24,23 @@ class funct(scat.funct):
|
|
|
24
24
|
super().__init__(return_data=True, *args, **kwargs)
|
|
25
25
|
|
|
26
26
|
def eval(
|
|
27
|
-
|
|
27
|
+
self,
|
|
28
|
+
image1,
|
|
29
|
+
image2=None,
|
|
30
|
+
mask=None,
|
|
31
|
+
norm=None,
|
|
32
|
+
Auto=True,
|
|
33
|
+
calc_var=False,
|
|
34
|
+
out_nside=None,
|
|
28
35
|
):
|
|
29
36
|
r = super().eval(
|
|
30
|
-
image1,
|
|
37
|
+
image1,
|
|
38
|
+
image2=image2,
|
|
39
|
+
mask=mask,
|
|
40
|
+
norm=norm,
|
|
41
|
+
Auto=Auto,
|
|
42
|
+
calc_var=calc_var,
|
|
43
|
+
out_nside=out_nside,
|
|
31
44
|
)
|
|
32
45
|
return scat_cov_map(
|
|
33
46
|
r.S2, r.S0, r.S3, r.S4, S1=r.S1, S3P=r.S3P, backend=r.backend
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: foscat
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.7.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>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
foscat/CNN.py,sha256=j0F2a4Xf3LijhyD_WVZ6Eg_IjGuXw3ddH6Iudj1xVaw,4874
|
|
2
|
+
foscat/CircSpline.py,sha256=CXi49FxF8ZoeZ17Ua8c1AZXe2B5ICEC9aCXb97atB3s,4028
|
|
3
|
+
foscat/FoCUS.py,sha256=Bkq-DZLKnu_KDF9EGJhzGKtuWciHTv0vAU0tKNd_-ao,102595
|
|
4
|
+
foscat/GCNN.py,sha256=5RV-FKuvqbD-k99TwiM4CttM2LMZE21WD0IK0j5Mkko,7599
|
|
5
|
+
foscat/Softmax.py,sha256=aBLQauoG0q2SJYPotV6U-cxAhsJcspWHNRWdnA_nAiQ,2854
|
|
6
|
+
foscat/Spline1D.py,sha256=rKzzenduaZZ-yBDJd35it6Gyrj1spqb7hoIaUgISPzY,2983
|
|
7
|
+
foscat/Synthesis.py,sha256=3oL-WIwOzjO6jYn-7J3TfAQSiPaQTqGtrmxcGBh1Gvs,13787
|
|
8
|
+
foscat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
foscat/alm.py,sha256=PaAaq82CH3JzH520eQpqTCivxE4VeJmmc6I_9HXIhcA,32480
|
|
10
|
+
foscat/backend.py,sha256=ednCoHUenHClbShG6cBWnlqjYHtN4jAzMf8tzZ_7X_w,43429
|
|
11
|
+
foscat/backend_tens.py,sha256=9Dp136m9frkclkwifJQLLbIpl3ETI3_txdPUZcKfuMw,1618
|
|
12
|
+
foscat/loss_backend_tens.py,sha256=dCOVN6faDtIpN3VO78HTmYP2i5fnFAf-Ddy5qVBlGrM,1783
|
|
13
|
+
foscat/loss_backend_torch.py,sha256=k3z18Dj3SaLKK6ZIKcm7GO4U_YKYVP6LtHG1aIbxkYk,1627
|
|
14
|
+
foscat/scat.py,sha256=qGYiBIysPt65MdmF07WWA4piVlTfA9-lFDTaicnqC2w,72822
|
|
15
|
+
foscat/scat1D.py,sha256=W5Uu6wdQ4ZsFKXpof0f1OBl-1wjJmW7ruvddRWxe7uM,53726
|
|
16
|
+
foscat/scat2D.py,sha256=boKj0ASqMMSy7uQLK6hPniG87m3hZGJBYBiq5v8F9IQ,532
|
|
17
|
+
foscat/scat_cov.py,sha256=vyeOpnhfSZyOexEmWlYdr4w_udWLw01HlzbHhWUWHNk,157259
|
|
18
|
+
foscat/scat_cov1D.py,sha256=XOxsZZ5TYq8f34i2tUgIfzyaqaTDlICB3HzD2l_puro,531
|
|
19
|
+
foscat/scat_cov2D.py,sha256=gABI0nztBU9HUdHJ0fLLITOZ9895wB1hKm_Fjp9D3ns,2830
|
|
20
|
+
foscat/scat_cov_map.py,sha256=Swt39-nYEaQkBzyX4EOAQBvUuYQpERzJ-uVxSWS2b-Y,2911
|
|
21
|
+
foscat/scat_cov_map2D.py,sha256=FqF45FBcoiQbvuVsrLWUIPRUc95GsKsrnH6fKzB3GlE,2841
|
|
22
|
+
foscat-3.7.0.dist-info/LICENCE,sha256=i0ukIr8ZUpkSY2sZaE9XZK-6vuSU5iG6IgX_3pjatP8,1505
|
|
23
|
+
foscat-3.7.0.dist-info/METADATA,sha256=OkQy2zp4wDIKh_Zma9jABKGJIqkAala9zwV7f7fVVoE,7216
|
|
24
|
+
foscat-3.7.0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
25
|
+
foscat-3.7.0.dist-info/top_level.txt,sha256=AGySXBBAlJgb8Tj8af6m_F-aiNg2zNTcybCUPVOKjAg,7
|
|
26
|
+
foscat-3.7.0.dist-info/RECORD,,
|
foscat/alm_tools.py
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
|
|
3
|
-
#====================================================================================================================
|
|
4
|
-
# This class is an automatic traduction of the fortran healpix software
|
|
5
|
-
#====================================================================================================================
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class alm_tools():
|
|
9
|
-
def __init__(self):
|
|
10
|
-
pass
|
|
11
|
-
|
foscat-3.6.1.dist-info/RECORD
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
foscat/CNN.py,sha256=j0F2a4Xf3LijhyD_WVZ6Eg_IjGuXw3ddH6Iudj1xVaw,4874
|
|
2
|
-
foscat/CircSpline.py,sha256=DjP1gy88cnXu2O21ww_lNnsHAHXc3OAWk_8ey84yicg,4053
|
|
3
|
-
foscat/FoCUS.py,sha256=YoZqPiDLQanUXGgN4RyN6S4_F2rHn273P6QQjq0hlBU,101774
|
|
4
|
-
foscat/GCNN.py,sha256=5RV-FKuvqbD-k99TwiM4CttM2LMZE21WD0IK0j5Mkko,7599
|
|
5
|
-
foscat/Softmax.py,sha256=aBLQauoG0q2SJYPotV6U-cxAhsJcspWHNRWdnA_nAiQ,2854
|
|
6
|
-
foscat/Spline1D.py,sha256=a5Jb8I9tb8y20iM8W-z6iZsIqDFByRp6eZdChpmuI5k,3010
|
|
7
|
-
foscat/Synthesis.py,sha256=3_Lq5-gUM-WmO2h15kajMES8XjRo2BGseoxvTLW_xEc,13626
|
|
8
|
-
foscat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
foscat/alm.py,sha256=IIvYOz0kAtufhlBzS_QOx891-Y30ARmofyqomOFmJDY,29335
|
|
10
|
-
foscat/alm_tools.py,sha256=BMObyIMF3_v04JdvMWBMMaF2F8s2emvDKmirKDnHWDA,387
|
|
11
|
-
foscat/backend.py,sha256=bN-b0CWcJXVsLCyqMhJACom0JlSStgrMWyD0uB6HqoU,40218
|
|
12
|
-
foscat/backend_tens.py,sha256=9Dp136m9frkclkwifJQLLbIpl3ETI3_txdPUZcKfuMw,1618
|
|
13
|
-
foscat/loss_backend_tens.py,sha256=dCOVN6faDtIpN3VO78HTmYP2i5fnFAf-Ddy5qVBlGrM,1783
|
|
14
|
-
foscat/loss_backend_torch.py,sha256=k3z18Dj3SaLKK6ZIKcm7GO4U_YKYVP6LtHG1aIbxkYk,1627
|
|
15
|
-
foscat/scat.py,sha256=qGYiBIysPt65MdmF07WWA4piVlTfA9-lFDTaicnqC2w,72822
|
|
16
|
-
foscat/scat1D.py,sha256=W5Uu6wdQ4ZsFKXpof0f1OBl-1wjJmW7ruvddRWxe7uM,53726
|
|
17
|
-
foscat/scat2D.py,sha256=boKj0ASqMMSy7uQLK6hPniG87m3hZGJBYBiq5v8F9IQ,532
|
|
18
|
-
foscat/scat_cov.py,sha256=gQvGC2s93oDurBDW0A6mGyzzMETjYAuBsBsDOI-ZqUY,150642
|
|
19
|
-
foscat/scat_cov1D.py,sha256=XOxsZZ5TYq8f34i2tUgIfzyaqaTDlICB3HzD2l_puro,531
|
|
20
|
-
foscat/scat_cov2D.py,sha256=3gn6xjKvfKsyHJoPfYIu8q9LLVAbU3tsiS2l1LAJ0XM,531
|
|
21
|
-
foscat/scat_cov_map.py,sha256=9Yymbr1MxUNY5nJd9kIEEHt1x2IoOjc0EW4kkJVtmQ4,2783
|
|
22
|
-
foscat/scat_cov_map2D.py,sha256=FqF45FBcoiQbvuVsrLWUIPRUc95GsKsrnH6fKzB3GlE,2841
|
|
23
|
-
foscat-3.6.1.dist-info/LICENCE,sha256=i0ukIr8ZUpkSY2sZaE9XZK-6vuSU5iG6IgX_3pjatP8,1505
|
|
24
|
-
foscat-3.6.1.dist-info/METADATA,sha256=6t347EDYxBbM5qhlC5T6pwbJDBwvAnJ5VJnNppblC6A,7216
|
|
25
|
-
foscat-3.6.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
26
|
-
foscat-3.6.1.dist-info/top_level.txt,sha256=AGySXBBAlJgb8Tj8af6m_F-aiNg2zNTcybCUPVOKjAg,7
|
|
27
|
-
foscat-3.6.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|