PyCosmoMMF 0.0.4__tar.gz → 0.0.5__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.4
3
+ Version: 0.0.5
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
@@ -6,10 +6,14 @@ from PyCosmoMMF.hessian import *
6
6
  from PyCosmoMMF.tagging import *
7
7
  from PyCosmoMMF.utils import *
8
8
  from PyCosmoMMF.signatures import *
9
-
10
-
11
9
  import pkg_resources
10
+
12
11
  test_field = np.load(pkg_resources.resource_filename(__name__, 'test_density_cube.npy'))
13
12
 
13
+ __version__ = '0.0.5'
14
+
15
+
16
+
17
+
14
18
 
15
19
 
@@ -1,5 +1,13 @@
1
1
  import numpy as np
2
2
  import numba as nb
3
+ from PyCosmoMMF.utils import *
4
+
5
+ # if parallel_flag == True:
6
+ # jit_compiler = nb.njit(parallel=True, fastmath=True)
7
+ # else:
8
+ # jit_compiler = nb.njit(fastmath=True)
9
+
10
+ jit_compiler = nb.njit(fastmath=True)
3
11
 
4
12
  def wavevectors3D(dims, box_size=(2*np.pi, 2*np.pi, 2*np.pi)):
5
13
  """
@@ -23,7 +31,7 @@ def wavevectors3D(dims, box_size=(2*np.pi, 2*np.pi, 2*np.pi)):
23
31
  kz = np.fft.fftfreq(dims[2], 1/sample_rate[2]) * (2*np.pi / dims[2])
24
32
  return kx, ky, kz
25
33
 
26
- @nb.njit(parallel=True, fastmath=True)
34
+ @jit_compiler
27
35
  def kspace_gaussian_filter(R_S, kv):
28
36
  """
29
37
  create a Gaussian filter in k-space.
@@ -50,7 +58,7 @@ def kspace_gaussian_filter(R_S, kv):
50
58
  -(kx[ix]**2 + ky[iy]**2 + kz[iz]**2) * R_S**2 / 2)
51
59
  return filter_k
52
60
 
53
- @nb.njit(parallel=True, fastmath=True)
61
+ @jit_compiler
54
62
  def kspace_top_hat_filter(R_S, kv):
55
63
  """
56
64
  create a top-hat filter in k-space.
@@ -1,5 +1,13 @@
1
1
  import numpy as np
2
2
  import numba as nb
3
+ from PyCosmoMMF.utils import *
4
+
5
+ # if parallel_flag == True:
6
+ # jit_compiler = nb.njit(parallel=True, fastmath=True)
7
+ # else:
8
+ # jit_compiler = nb.njit(fastmath=True)
9
+
10
+ jit_compiler = nb.njit(fastmath=True)
3
11
 
4
12
  def fast_hessian_from_smoothed(f_Rn, R_S, kv):
5
13
  """
@@ -25,7 +33,7 @@ def fast_hessian_from_smoothed(f_Rn, R_S, kv):
25
33
  hessian = np.zeros((dims[0], dims[1], dims[2], 6), dtype=np.complex128)
26
34
  kx, ky, kz = kv[0], kv[1], kv[2]
27
35
 
28
- @nb.njit(parallel=True, fastmath=True)
36
+ @jit_compiler
29
37
  def perform_loop(hessian):
30
38
  """
31
39
  This function is a loop that calculates the hessian matrix
@@ -3,8 +3,16 @@ import numba as nb
3
3
 
4
4
  from PyCosmoMMF.filter import *
5
5
  from PyCosmoMMF.hessian import *
6
+ from PyCosmoMMF.utils import *
6
7
 
7
- @nb.njit(parallel=True)
8
+ # if parallel_flag == True:
9
+ # jit_compiler = nb.njit(parallel=True)
10
+ # else:
11
+ # jit_compiler = nb.njit
12
+
13
+ jit_compiler = nb.njit
14
+
15
+ @jit_compiler
8
16
  def signatures_from_hessian(hessian):
9
17
  """
10
18
  Function to calculate the signatures from a given hessian.
@@ -97,7 +105,7 @@ def maximum_signature(Rs, field, alg='NEXUSPLUS'):
97
105
  # Calculate signatures at each scale Rn, determine max
98
106
  sigmax = np.ones((nx, ny, nz, 3)) * 0.00001
99
107
 
100
- @nb.njit(parallel=True)
108
+ @jit_compiler
101
109
  def perform_loop(sigmax, sigs_Rn, nx, ny, nz):
102
110
  for ix in nb.prange(nx):
103
111
  for iy in range(ny):
@@ -3,7 +3,14 @@ import numpy as np
3
3
  import matplotlib.pyplot as plt
4
4
  from skimage.measure import label
5
5
  import numba as nb
6
+ from PyCosmoMMF.utils import *
6
7
 
8
+ # if parallel_flag == True:
9
+ # jit_compiler = nb.njit(parallel=True, fastmath=True)
10
+ # else:
11
+ # jit_compiler = nb.njit(fastmath=True)
12
+
13
+ jit_compiler = nb.njit(fastmath=True)
7
14
 
8
15
  def make_the_clusbool(data, max_sigs, verbose, Δ):
9
16
  """
@@ -68,7 +75,7 @@ def make_the_clusbool(data, max_sigs, verbose, Δ):
68
75
  volume = np.zeros(total_clusters_detected + 1)
69
76
  signatures = np.zeros(total_clusters_detected + 1)
70
77
 
71
- @nb.njit(parallel=True, fastmath=True)
78
+ @jit_compiler
72
79
  def perform_loop(density, volume, signatures, data, max_sigs):
73
80
  for i in nb.prange(nx):
74
81
  for j in range(ny):
@@ -1,4 +1,8 @@
1
1
  import numpy as np
2
+ import os
3
+
4
+ #by default we set the parallel flag to False
5
+ # parallel_flag = False
2
6
 
3
7
  def test_print():
4
8
  """
@@ -15,4 +19,4 @@ def shrink(data, new_size):
15
19
  zs = new_size
16
20
  return data.reshape(xs, data.shape[0]//xs,
17
21
  ys, data.shape[1]//ys,
18
- zs, data.shape[2]//zs).sum(axis=1).sum(axis=2).sum(axis=3)
22
+ zs, data.shape[2]//zs).sum(axis=1).sum(axis=2).sum(axis=3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyCosmoMMF
3
- Version: 0.0.4
3
+ Version: 0.0.5
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.4', # Required
15
+ version='0.0.5', # 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