PyCosmoMMF 0.0.6__tar.gz → 0.0.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyCosmoMMF
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: A package for detecting structures in the Cosmic Web.
5
5
  Home-page: https://github.com/James11222/PyCosmoMMF/
6
6
  Author: James Sunseri
@@ -26,9 +26,9 @@ def wavevectors3D(dims, box_size=(2*np.pi, 2*np.pi, 2*np.pi)):
26
26
  The wavevectors in each dimension.
27
27
  """
28
28
  sample_rate = 2*np.pi * (np.array(dims) / box_size)
29
- kx = np.fft.fftfreq(dims[0], 1/sample_rate[0]) * (2*np.pi / dims[0])
30
- ky = np.fft.fftfreq(dims[1], 1/sample_rate[1]) * (2*np.pi / dims[1])
31
- kz = np.fft.fftfreq(dims[2], 1/sample_rate[2]) * (2*np.pi / dims[2])
29
+ kx = (np.fft.fftfreq(dims[0], 1/sample_rate[0]) * (2*np.pi / dims[0])).astype(np.float32)
30
+ ky = (np.fft.fftfreq(dims[1], 1/sample_rate[1]) * (2*np.pi / dims[1])).astype(np.float32)
31
+ kz = (np.fft.fftfreq(dims[2], 1/sample_rate[2]) * (2*np.pi / dims[2])).astype(np.float32)
32
32
  return kx, ky, kz
33
33
 
34
34
  @jit_compiler
@@ -50,7 +50,7 @@ def kspace_gaussian_filter(R_S, kv):
50
50
  """
51
51
  kx, ky, kz = kv
52
52
  nx, ny, nz = len(kx), len(ky), len(kz)
53
- filter_k = np.zeros((nx, ny, nz))
53
+ filter_k = np.zeros((nx, ny, nz), dtype=np.float32)
54
54
  for ix in nb.prange(nx):
55
55
  for iy in range(ny):
56
56
  for iz in range(nz):
@@ -78,7 +78,7 @@ def kspace_top_hat_filter(R_S, kv):
78
78
 
79
79
  kx, ky, kz = kv
80
80
  nx, ny, nz = len(kx), len(ky), len(kz)
81
- filter_k = np.zeros((nx, ny, nz))
81
+ filter_k = np.zeros((nx, ny, nz), dtype=np.float32)
82
82
 
83
83
  for ix in nb.prange(nx):
84
84
  for iy in range(ny):
@@ -112,7 +112,7 @@ def smooth_top_hat(f, R_S, kv):
112
112
  GF = kspace_top_hat_filter(R_S, kv)
113
113
  f_Rn = np.real(np.fft.ifftn(GF * np.fft.fftn(f)))
114
114
  f_Rn = f_Rn * (np.sum(f) / np.sum(f_Rn))
115
- return f_Rn
115
+ return f_Rn.astype(np.float32)
116
116
 
117
117
  def smooth_gauss(f, R_S, kv):
118
118
  """
@@ -135,7 +135,7 @@ def smooth_gauss(f, R_S, kv):
135
135
  GF = kspace_gaussian_filter(R_S, kv)
136
136
  f_Rn = np.real(np.fft.ifftn(GF * np.fft.fftn(f)))
137
137
  f_Rn = f_Rn * (np.sum(f) / np.sum(f_Rn))
138
- return f_Rn
138
+ return f_Rn.astype(np.float32)
139
139
 
140
140
 
141
141
  def smooth_loggauss(f, R_S, kv):
@@ -178,5 +178,5 @@ def smooth_loggauss(f, R_S, kv):
178
178
  norm = np.sum(f) / np.sum(f_result)
179
179
  f_result *= norm
180
180
 
181
- return f_result
181
+ return f_result.astype(np.float32)
182
182
 
@@ -30,7 +30,7 @@ def fast_hessian_from_smoothed(f_Rn, R_S, kv):
30
30
 
31
31
  f_Rn_hat = np.fft.fftn(f_Rn)
32
32
  dims = f_Rn_hat.shape
33
- hessian = np.zeros((dims[0], dims[1], dims[2], 6), dtype=np.complex128)
33
+ hessian = np.zeros((dims[0], dims[1], dims[2], 6), dtype=np.complex64)
34
34
  kx, ky, kz = kv[0], kv[1], kv[2]
35
35
 
36
36
  @jit_compiler
@@ -29,7 +29,7 @@ def signatures_from_hessian(hessian):
29
29
  """
30
30
 
31
31
  hsize = hessian.shape[:3]
32
- sigs = np.zeros((hsize[0], hsize[1], hsize[2], 3))
32
+ sigs = np.zeros((hsize[0], hsize[1], hsize[2], 3), dtype=np.float32)
33
33
 
34
34
  #helper functions
35
35
  def θ(x):
@@ -95,15 +95,16 @@ def maximum_signature(Rs, field, alg='NEXUSPLUS'):
95
95
  raise ValueError("alg must be either 'NEXUS' or 'NEXUSPLUS'")
96
96
 
97
97
  nx, ny, nz = field.shape
98
+ eps = 1e-5
98
99
 
99
100
  # Make sure the field has no 0 values
100
- field = field + 0.0001
101
+ field = field + eps
101
102
 
102
103
  # Calculate wave vectors for our field
103
104
  wave_vecs = wavevectors3D((nx, ny, nz))
104
105
 
105
106
  # Calculate signatures at each scale Rn, determine max
106
- sigmax = np.ones((nx, ny, nz, 3)) * 0.00001
107
+ sigmax = np.ones((nx, ny, nz, 3), dtype=np.float32) * eps
107
108
 
108
109
  @jit_compiler
109
110
  def perform_loop(sigmax, sigs_Rn, nx, ny, nz):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyCosmoMMF
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: A package for detecting structures in the Cosmic Web.
5
5
  Home-page: https://github.com/James11222/PyCosmoMMF/
6
6
  Author: James Sunseri
@@ -12,7 +12,7 @@ here = pathlib.Path(__file__).parent.resolve()
12
12
 
13
13
  setup(
14
14
  name='PyCosmoMMF', # Required
15
- version='0.0.6', # Required
15
+ version='0.0.7', # Required
16
16
  description='A package for detecting structures in the Cosmic Web.', # Optional
17
17
  long_description=(here / 'README.md').read_text(encoding='utf-8'), # Optional
18
18
  long_description_content_type='text/markdown', # Optional (see note above)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes