foscat 3.0.17__tar.gz → 3.0.19__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.
Files changed (29) hide show
  1. {foscat-3.0.17 → foscat-3.0.19}/PKG-INFO +1 -1
  2. {foscat-3.0.17 → foscat-3.0.19}/setup.py +1 -1
  3. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/FoCUS.py +14 -9
  4. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/backend.py +7 -1
  5. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/scat.py +11 -2
  6. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/scat1D.py +13 -4
  7. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/scat_cov.py +12 -4
  8. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/scat_cov1D.py +12 -2
  9. {foscat-3.0.17 → foscat-3.0.19}/src/foscat.egg-info/PKG-INFO +1 -1
  10. {foscat-3.0.17 → foscat-3.0.19}/README.md +0 -0
  11. {foscat-3.0.17 → foscat-3.0.19}/setup.cfg +0 -0
  12. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/CircSpline.py +0 -0
  13. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/GCNN.py +0 -0
  14. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/GetGPUinfo.py +0 -0
  15. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/Softmax.py +0 -0
  16. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/Spline1D.py +0 -0
  17. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/Synthesis.py +0 -0
  18. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/__init__.py +0 -0
  19. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/backend_tens.py +0 -0
  20. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/loss_backend_tens.py +0 -0
  21. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/loss_backend_torch.py +0 -0
  22. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/scat2D.py +0 -0
  23. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/scat_cov2D.py +0 -0
  24. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/scat_cov_map.py +0 -0
  25. {foscat-3.0.17 → foscat-3.0.19}/src/foscat/scat_cov_map2D.py +0 -0
  26. {foscat-3.0.17 → foscat-3.0.19}/src/foscat.egg-info/SOURCES.txt +0 -0
  27. {foscat-3.0.17 → foscat-3.0.19}/src/foscat.egg-info/dependency_links.txt +0 -0
  28. {foscat-3.0.17 → foscat-3.0.19}/src/foscat.egg-info/requires.txt +0 -0
  29. {foscat-3.0.17 → foscat-3.0.19}/src/foscat.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foscat
3
- Version: 3.0.17
3
+ Version: 3.0.19
4
4
  Summary: Generate synthetic Healpix or 2D data using Cross Scattering Transform
5
5
  Home-page: https://github.com/jmdelouis/FOSCAT
6
6
  Author: Jean-Marc DELOUIS
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
3
3
 
4
4
  setup(
5
5
  name='foscat',
6
- version='3.0.17',
6
+ version='3.0.19',
7
7
  description='Generate synthetic Healpix or 2D data using Cross Scattering Transform' ,
8
8
  long_description='Utilize the Cross Scattering Transform (described in https://arxiv.org/abs/2207.12527) to synthesize Healpix or 2D data that is suitable for component separation purposes, such as denoising. \n A demo package for this process can be found at https://github.com/jmdelouis/FOSCAT_DEMO. \n Complete doc can be found at https://foscat-documentation.readthedocs.io/en/latest/index.html. \n\n List of developers : J.-M. Delouis, T. Foulquier, L. Mousset, T. Odaka, F. Paul, E. Allys ' ,
9
9
  license='MIT',
@@ -5,7 +5,7 @@ import foscat.backend as bk
5
5
  from scipy.interpolate import griddata
6
6
 
7
7
 
8
- TMPFILE_VERSION='V2_6'
8
+ TMPFILE_VERSION='V3_0'
9
9
 
10
10
  class FoCUS:
11
11
  def __init__(self,
@@ -32,7 +32,7 @@ class FoCUS:
32
32
  mpi_size=1,
33
33
  mpi_rank=0):
34
34
 
35
- self.__version__ = '3.0.17'
35
+ self.__version__ = '3.0.19'
36
36
  # P00 coeff for normalization for scat_cov
37
37
  self.TMPFILE_VERSION=TMPFILE_VERSION
38
38
  self.P1_dic = None
@@ -872,7 +872,7 @@ class FoCUS:
872
872
  except:
873
873
  if self.use_2D==False:
874
874
  if self.KERNELSZ*self.KERNELSZ>12*nside*nside:
875
- l_kernel=2*nside
875
+ l_kernel=3
876
876
 
877
877
  aa=np.cos(np.arange(self.NORIENT)/self.NORIENT*np.pi).reshape(1,self.NORIENT)
878
878
  bb=np.sin(np.arange(self.NORIENT)/self.NORIENT*np.pi).reshape(1,self.NORIENT)
@@ -890,14 +890,19 @@ class FoCUS:
890
890
  lidx=np.arange(12*nside*nside)
891
891
 
892
892
  pw=np.pi/4.0
893
- pw2=1/2.0
894
-
893
+ pw2=1/2
894
+ amp=1.0
895
+
895
896
  if l_kernel==5:
896
897
  pw=np.pi/4.0
897
- pw2=1/2.0
898
+ pw2=1/2.25
899
+ amp=1.0/9.2038
900
+
898
901
  elif l_kernel==3:
899
- pw=1.0
902
+ pw=1.0/np.sqrt(2)
900
903
  pw2=1.0
904
+ amp=1/8.45
905
+
901
906
  elif l_kernel==7:
902
907
  pw=np.pi/4.0
903
908
  pw2=1.0/3.0
@@ -920,7 +925,7 @@ class FoCUS:
920
925
  w=np.exp(-pw2*delta[pidx]*(nside**2))
921
926
  pidx=pidx[np.argsort(-w)[0:l_kernel**2]]
922
927
  pidx=pidx[np.argsort(lidx[pidx])]
923
-
928
+
924
929
  w=np.exp(-pw2*delta[pidx]*(nside**2))
925
930
  iwav[k]=lidx[pidx]
926
931
  wwav[k]=w
@@ -935,7 +940,7 @@ class FoCUS:
935
940
  wav[k,:,:]=(np.cos(xx*aa+yy*bb)+complex(0.0,1.0)*np.sin(xx*aa+yy*bb))*np.expand_dims(w,-1)
936
941
 
937
942
  wav=wav-np.expand_dims(np.mean(wav,1),1)
938
- wav=wav/np.expand_dims(np.std(wav,1),1)
943
+ wav=amp*wav/np.expand_dims(np.std(wav,1),1)
939
944
  wwav=wwav/np.expand_dims(np.sum(wwav,1),1)
940
945
 
941
946
  nk=l_kernel*l_kernel
@@ -38,17 +38,20 @@ class foscat_backend:
38
38
  self.BACKEND=self.TENSORFLOW
39
39
  #tf.config.threading.set_inter_op_parallelism_threads(1)
40
40
  #tf.config.threading.set_intra_op_parallelism_threads(1)
41
+ self.tf_function = tf.function
41
42
 
42
43
  if self.BACKEND=='torch':
43
44
  import torch
44
45
  self.BACKEND=self.TORCH
45
46
  self.backend=torch
47
+ self.tf_function = self.tf_loc_function
46
48
 
47
49
  if self.BACKEND=='numpy':
48
50
  self.BACKEND=self.NUMPY
49
51
  self.backend=np
50
52
  import scipy as scipy
51
53
  self.scipy=scipy
54
+ self.tf_function = self.tf_loc_function
52
55
 
53
56
  self.float64=self.backend.float64
54
57
  self.float32=self.backend.float32
@@ -114,7 +117,10 @@ class foscat_backend:
114
117
  except RuntimeError as e:
115
118
  # Memory growth must be set before GPUs have been initialized
116
119
  print(e)
117
-
120
+
121
+ def tf_loc_function(self,func):
122
+ return func
123
+
118
124
  def calc_iso_orient(self,norient):
119
125
  tmp=np.zeros([norient*norient,norient])
120
126
  for i in range(norient):
@@ -1,10 +1,19 @@
1
1
  import foscat.FoCUS as FOC
2
2
  import numpy as np
3
- import tensorflow as tf
4
3
  import pickle
5
4
  import foscat.backend as bk
6
5
  import healpy as hp
6
+ import sys
7
7
 
8
+ # Vérifier si TensorFlow est importé et défini
9
+ tf_defined = 'tensorflow' in sys.modules
10
+
11
+ if tf_defined:
12
+ tf_function = tf.function # Facultatif : si vous voulez utiliser TensorFlow dans ce script
13
+ else:
14
+ def tf_function(func):
15
+ return func
16
+
8
17
  def read(filename):
9
18
  thescat=scat(1,1,1,1,1,[0],[0])
10
19
  return thescat.read(filename)
@@ -1392,7 +1401,7 @@ class funct(FOC.FoCUS):
1392
1401
  def one(self):
1393
1402
  return scat(1.0,1.0,1.0,1.0,1.0,[0],[0],backend=self.backend)
1394
1403
 
1395
- @tf.function
1404
+ @tf_function
1396
1405
  def eval_comp_fast(self, image1, image2=None,mask=None,Auto=True,s0_off=1E-6):
1397
1406
 
1398
1407
  res=self.eval(image1, image2=image2,mask=mask,Auto=Auto,s0_off=s0_off)
@@ -1,9 +1,18 @@
1
1
  import foscat.FoCUS as FOC
2
2
  import numpy as np
3
- import tensorflow as tf
4
3
  import pickle
5
4
  import foscat.backend as bk
6
-
5
+ import sys
6
+
7
+ # Vérifier si TensorFlow est importé et défini
8
+ tf_defined = 'tensorflow' in sys.modules
9
+
10
+ if tf_defined:
11
+ tf_function = tf.function # Facultatif : si vous voulez utiliser TensorFlow dans ce script
12
+ else:
13
+ def tf_function(func):
14
+ return func
15
+
7
16
  def read(filename):
8
17
  thescat=scat1D(1,1,1,1,1,[0],[0])
9
18
  return thescat.read(filename)
@@ -1050,12 +1059,12 @@ class funct(FOC.FoCUS):
1050
1059
  def one(self):
1051
1060
  return scat1D(1.0,1.0,1.0,1.0,1.0,[0],[0],backend=self.backend)
1052
1061
 
1053
- @tf.function
1054
1062
  def eval_comp_fast(self, image1, image2=None,mask=None,Auto=True,s0_off=1E-6):
1055
1063
 
1056
- res=self.eval(image1, image2=image2,mask=mask,Auto=Auto,s0_off=s0_off)
1064
+ res=self.eval_fast(image1, image2=image2,mask=mask,Auto=Auto,s0_off=s0_off)
1057
1065
  return res.P00,res.S0,res.S1,res.S2,res.S2L,res.j1,res.j2
1058
1066
 
1067
+ @tf_function
1059
1068
  def eval_fast(self, image1, image2=None,mask=None,Auto=True,s0_off=1E-6):
1060
1069
  p0,s0,s1,s2,s2l,j1,j2=self.eval_comp_fast(image1, image2=image2,mask=mask,Auto=Auto,s0_off=s0_off)
1061
1070
  return scat1D(p0,s0,s1,s2,s2l,j1,j2,backend=self.backend)
@@ -1,10 +1,19 @@
1
1
  import foscat.FoCUS as FOC
2
2
  import numpy as np
3
3
  import foscat.backend as bk
4
- #import tensorflow as tf
5
4
  import pickle
6
5
  import healpy as hp
6
+ import sys
7
7
 
8
+ # Vérifier si TensorFlow est importé et défini
9
+ tf_defined = 'tensorflow' in sys.modules
10
+
11
+ if tf_defined:
12
+ tf_function = tf.function # Facultatif : si vous voulez utiliser TensorFlow dans ce script
13
+ else:
14
+ def tf_function(func):
15
+ return func
16
+
8
17
  def read(filename):
9
18
  thescat = scat_cov(1, 1, 1, 1)
10
19
  return thescat.read(filename)
@@ -2418,9 +2427,8 @@ class funct(FOC.FoCUS):
2418
2427
  x.domult(sig.C11,x.C11)*x.domult(sig.C11,x.C11),
2419
2428
  backend=self.backend)
2420
2429
  return(self.NORIENT)
2421
- """
2422
- @tf.function
2423
- """
2430
+
2431
+ @tf_function
2424
2432
  def eval_comp_fast(self, image1, image2=None,mask=None,norm=None, Auto=True,cmat=None,cmat2=None):
2425
2433
 
2426
2434
  res=self.eval(image1, image2=image2,mask=mask,Auto=Auto,cmat=cmat,cmat2=cmat2)
@@ -1,10 +1,20 @@
1
1
  import foscat.FoCUS as FOC
2
2
  import numpy as np
3
3
  import foscat.backend as bk
4
- import tensorflow as tf
5
4
  import pickle
6
5
  import matplotlib.pyplot as plt
6
+ import sys
7
7
 
8
+
9
+ # Vérifier si TensorFlow est importé et défini
10
+ tf_defined = 'tensorflow' in sys.modules
11
+
12
+ if tf_defined:
13
+ tf_function = tf.function # Facultatif : si vous voulez utiliser TensorFlow dans ce script
14
+ else:
15
+ def tf_function(func):
16
+ return func
17
+
8
18
  def read(filename):
9
19
  thescat = scat_cov1D(1, 1, 1)
10
20
  return thescat.read(filename)
@@ -1461,7 +1471,7 @@ class funct(FOC.FoCUS):
1461
1471
 
1462
1472
  return result
1463
1473
 
1464
- @tf.function
1474
+ @tf_function
1465
1475
  def eval_comp_fast(self, image1, image2=None,mask=None,norm=None, Auto=True,Add_R45=False):
1466
1476
 
1467
1477
  res=self.eval(image1, image2=image2,mask=mask,Auto=Auto,Add_R45=Add_R45)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foscat
3
- Version: 3.0.17
3
+ Version: 3.0.19
4
4
  Summary: Generate synthetic Healpix or 2D data using Cross Scattering Transform
5
5
  Home-page: https://github.com/jmdelouis/FOSCAT
6
6
  Author: Jean-Marc DELOUIS
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes