cmbstack 0.0.5__tar.gz → 0.1.1__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,24 +1,25 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmbstack
3
- Version: 0.0.5
3
+ Version: 0.1.1
4
4
  Summary: Stack patches of the CMB temperature sky around local maxima
5
5
  Author-email: Isaac Alexis López Paredes <isaacalexis.lopezparedes@students.uniroma2.eu>, Anushka Sanjay Tilekar <anushka.tilekar.23@alumni.ucl.ac.uk>
6
6
  License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/IsaacLP/cmbstack
7
+ Project-URL: Homepage, https://cmbstack-docs.readthedocs.io/en/latest/index.html
8
8
  Project-URL: Repository, https://github.com/IsaacLP/cmbstack.git
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.8
12
12
  Description-Content-Type: text/markdown
13
13
  Requires-Dist: numpy
14
+ Requires-Dist: pandas
14
15
  Requires-Dist: healpy
15
16
  Requires-Dist: matplotlib
16
17
 
17
- [![Made at Code/Astro](https://img.shields.io/badge/Made%20at-Code/Astro-blueviolet.svg)](https://semaphorep.github.io/codeastro/)
18
- [![PyPI version](https://img.shields.io/pypi/v/cmbstack.svg)](https://pypi.org/project/cmbstack/)
19
- [![Python version](https://img.shields.io/pypi/pyversions/cmbstack.svg)](https://pypi.org/project/cmbstack/)
20
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
- ![Development Status](https://img.shields.io/badge/Status-In_Development-brightgreen.svg)
18
+ [![Made at Code/Astro](https://img.shields.io/badge/Made%20at-Code/Astro-blueviolet)](https://semaphorep.github.io/codeastro/)
19
+ [![PyPI version](https://img.shields.io/pypi/v/cmbstack)](https://pypi.org/project/cmbstack/)
20
+ [![Python version](https://img.shields.io/pypi/pyversions/cmbstack)](https://pypi.org/project/cmbstack/)
21
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow)](https://opensource.org/licenses/MIT)
22
+ ![Development Status](https://img.shields.io/badge/Status-In_Development-brightgreen)
22
23
 
23
24
  # cmbstack
24
25
 
@@ -44,7 +45,7 @@ pip install -e .
44
45
 
45
46
  **From a power spectrum file:**
46
47
  ```python
47
- from cmbstack.main import StackingPipeline
48
+ from cmbstack import StackingPipeline
48
49
 
49
50
  pipeline = StackingPipeline.from_cl("path/to/spectrum.cl", nside=1024, seed=42)
50
51
  stacked_result = pipeline.run()
@@ -1,8 +1,8 @@
1
- [![Made at Code/Astro](https://img.shields.io/badge/Made%20at-Code/Astro-blueviolet.svg)](https://semaphorep.github.io/codeastro/)
2
- [![PyPI version](https://img.shields.io/pypi/v/cmbstack.svg)](https://pypi.org/project/cmbstack/)
3
- [![Python version](https://img.shields.io/pypi/pyversions/cmbstack.svg)](https://pypi.org/project/cmbstack/)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- ![Development Status](https://img.shields.io/badge/Status-In_Development-brightgreen.svg)
1
+ [![Made at Code/Astro](https://img.shields.io/badge/Made%20at-Code/Astro-blueviolet)](https://semaphorep.github.io/codeastro/)
2
+ [![PyPI version](https://img.shields.io/pypi/v/cmbstack)](https://pypi.org/project/cmbstack/)
3
+ [![Python version](https://img.shields.io/pypi/pyversions/cmbstack)](https://pypi.org/project/cmbstack/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow)](https://opensource.org/licenses/MIT)
5
+ ![Development Status](https://img.shields.io/badge/Status-In_Development-brightgreen)
6
6
 
7
7
  # cmbstack
8
8
 
@@ -28,7 +28,7 @@ pip install -e .
28
28
 
29
29
  **From a power spectrum file:**
30
30
  ```python
31
- from cmbstack.main import StackingPipeline
31
+ from cmbstack import StackingPipeline
32
32
 
33
33
  pipeline = StackingPipeline.from_cl("path/to/spectrum.cl", nside=1024, seed=42)
34
34
  stacked_result = pipeline.run()
@@ -0,0 +1,5 @@
1
+ __version__ = "0.1.1"
2
+
3
+ from cmbstack.pipeline import StackingPipeline
4
+
5
+ __all__ = ["StackingPipeline", "maps", "stacking"]
@@ -13,6 +13,7 @@ power spectrum (temperature TT, lensing convergence, y-map, ...).
13
13
 
14
14
  import numpy as np
15
15
  import healpy as hp
16
+ import pandas as pd
16
17
 
17
18
 
18
19
  def dl_to_cl(ell, dl,lmax):
@@ -46,12 +47,13 @@ def dl_to_cl(ell, dl,lmax):
46
47
 
47
48
  return cl
48
49
 
49
- # Function 1
50
- def load_cl(path):
50
+
51
+ def load_cl(path, column="TT"):
51
52
  """Load a power-spectrum file and return C_ell for the requested spectrum.
52
53
 
53
- The expected file columns are ell, Dl_TT, Dl_TE, Dl_EE, Dl_BB, Dl_dd, with
54
- D_ell in uK^2. The chosen column is converted from D_ell to C_ell via
54
+ The expected file columns are ell, Dl_TT, Dl_TE, Dl_EE, Dl_BB, Dl_pp, with
55
+ D_ell in uK^2 (with names L, TT, TE, EE, BB, PP).
56
+ The chosen column is converted from D_ell to C_ell via
55
57
  :func:`dl_to_cl` before being returned.
56
58
 
57
59
  Parameters
@@ -59,7 +61,7 @@ def load_cl(path):
59
61
  path : str
60
62
  Path to the whitespace-delimited spectrum file.
61
63
  column : str, optional
62
- Which spectrum to return: one of "TT", "TE", "EE", "BB", "dd".
64
+ Which spectrum to return: one of "TT", "TE", "EE", "BB", "PP".
63
65
  Default "TT".
64
66
 
65
67
  Returns
@@ -68,14 +70,22 @@ def load_cl(path):
68
70
  C_ell array indexed from ell=0, suitable for passing to
69
71
  :func:`simulate_map`.
70
72
  """
71
- ell, dl = np.loadtxt(path,usecols=(0,1),unpack=True)
72
- ell = ell.astype(int)
73
- lmax = ell.max()
74
- cl = dl_to_cl(ell,dl,lmax)
73
+
74
+ df = pd.read_csv(
75
+ path,
76
+ sep=r"\s+",
77
+ comment="#",
78
+ header=None,
79
+ names=["L", "TT", "TE", "EE", "BB", "PP"],
80
+ )
81
+ ell = df['L'].values.astype(int)
82
+ dl = df[column].values
83
+ lmax = ell.max()
84
+ cl = dl_to_cl(ell, dl, lmax)
75
85
 
76
86
  return cl
77
87
 
78
- # Function 2
88
+
79
89
  def simulate_map(cl, nside=128, seed=None):
80
90
  """Simulate a Gaussian random HEALPix map from a power spectrum.
81
91
 
@@ -34,6 +34,16 @@ class StackingPipeline:
34
34
  ----------
35
35
  normalized : numpy.ndarray or None
36
36
  Set after run(); the normalized map.
37
+ positions : numpy.ndarray or None
38
+ Set after run(); the peak positions in (theta, phi) radians.
39
+ patches : numpy.ndarray or None
40
+ Set after run(); the extracted patches.
41
+ stacked : numpy.ndarray or None
42
+ Set after run(); the stacked image.
43
+ radius : numpy.ndarray or None
44
+ Set after run(); the radial distances of the profile in arcmin.
45
+ profile : numpy.ndarray or None
46
+ Set after run(); the radial profile of the stacked image.
37
47
  """
38
48
 
39
49
  def __init__(self, sky_map, nside):
@@ -86,7 +96,9 @@ class StackingPipeline:
86
96
 
87
97
  Returns
88
98
  -------
89
- result : cmbstack.stack.StackResult
99
+ self : StackingPipeline
100
+ The pipeline object itself, with all intermediate products stored as
101
+ attributes.
90
102
  """
91
103
 
92
104
  self.normalized = maps.normalize_map(self.map)
@@ -100,4 +112,6 @@ class StackingPipeline:
100
112
  if profile:
101
113
  self.radius, self.profile = stacking.radial_profile(self.stacked,reso_arcmin=reso_arcmin)
102
114
 
103
- return self
115
+ return self
116
+
117
+ StackingPipeline.__module__ = "cmbstack"
@@ -1,24 +1,25 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cmbstack
3
- Version: 0.0.5
3
+ Version: 0.1.1
4
4
  Summary: Stack patches of the CMB temperature sky around local maxima
5
5
  Author-email: Isaac Alexis López Paredes <isaacalexis.lopezparedes@students.uniroma2.eu>, Anushka Sanjay Tilekar <anushka.tilekar.23@alumni.ucl.ac.uk>
6
6
  License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/IsaacLP/cmbstack
7
+ Project-URL: Homepage, https://cmbstack-docs.readthedocs.io/en/latest/index.html
8
8
  Project-URL: Repository, https://github.com/IsaacLP/cmbstack.git
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.8
12
12
  Description-Content-Type: text/markdown
13
13
  Requires-Dist: numpy
14
+ Requires-Dist: pandas
14
15
  Requires-Dist: healpy
15
16
  Requires-Dist: matplotlib
16
17
 
17
- [![Made at Code/Astro](https://img.shields.io/badge/Made%20at-Code/Astro-blueviolet.svg)](https://semaphorep.github.io/codeastro/)
18
- [![PyPI version](https://img.shields.io/pypi/v/cmbstack.svg)](https://pypi.org/project/cmbstack/)
19
- [![Python version](https://img.shields.io/pypi/pyversions/cmbstack.svg)](https://pypi.org/project/cmbstack/)
20
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
- ![Development Status](https://img.shields.io/badge/Status-In_Development-brightgreen.svg)
18
+ [![Made at Code/Astro](https://img.shields.io/badge/Made%20at-Code/Astro-blueviolet)](https://semaphorep.github.io/codeastro/)
19
+ [![PyPI version](https://img.shields.io/pypi/v/cmbstack)](https://pypi.org/project/cmbstack/)
20
+ [![Python version](https://img.shields.io/pypi/pyversions/cmbstack)](https://pypi.org/project/cmbstack/)
21
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow)](https://opensource.org/licenses/MIT)
22
+ ![Development Status](https://img.shields.io/badge/Status-In_Development-brightgreen)
22
23
 
23
24
  # cmbstack
24
25
 
@@ -44,7 +45,7 @@ pip install -e .
44
45
 
45
46
  **From a power spectrum file:**
46
47
  ```python
47
- from cmbstack.main import StackingPipeline
48
+ from cmbstack import StackingPipeline
48
49
 
49
50
  pipeline = StackingPipeline.from_cl("path/to/spectrum.cl", nside=1024, seed=42)
50
51
  stacked_result = pipeline.run()
@@ -1,8 +1,8 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  cmbstack/__init__.py
4
- cmbstack/main.py
5
4
  cmbstack/maps.py
5
+ cmbstack/pipeline.py
6
6
  cmbstack/stacking.py
7
7
  cmbstack.egg-info/PKG-INFO
8
8
  cmbstack.egg-info/SOURCES.txt
@@ -10,4 +10,5 @@ cmbstack.egg-info/dependency_links.txt
10
10
  cmbstack.egg-info/requires.txt
11
11
  cmbstack.egg-info/top_level.txt
12
12
  tests/test_find_peaks.py
13
- tests/test_round.py
13
+ tests/test_round.py
14
+ tests/test_runtime.py
@@ -1,3 +1,4 @@
1
1
  numpy
2
+ pandas
2
3
  healpy
3
4
  matplotlib
@@ -19,12 +19,13 @@ classifiers = [
19
19
  requires-python = ">=3.8"
20
20
  dependencies = [
21
21
  "numpy",
22
+ "pandas",
22
23
  "healpy",
23
24
  "matplotlib",
24
25
  ]
25
26
 
26
27
  [project.urls]
27
- Homepage = "https://github.com/IsaacLP/cmbstack"
28
+ Homepage = "https://cmbstack-docs.readthedocs.io/en/latest/index.html"
28
29
  Repository = "https://github.com/IsaacLP/cmbstack.git"
29
30
 
30
31
  [tool.setuptools.dynamic]
@@ -1,9 +1,6 @@
1
- import sys
2
1
  import numpy as np
3
2
  import healpy as hp
4
3
 
5
- sys.path.append("..")
6
-
7
4
  from cmbstack.stacking import find_peaks
8
5
  from cmbstack.maps import normalize_map
9
6
 
@@ -1,13 +1,9 @@
1
- import sys
2
1
  import healpy as hp
3
2
  import numpy as np
4
3
  from pathlib import Path
5
4
  import tempfile
6
5
 
7
- sys.path.append("..")
8
-
9
- from cmbstack.main import StackingPipeline
10
- from cmbstack import maps
6
+ from cmbstack import StackingPipeline, maps
11
7
 
12
8
  def test_fits_roundtrip(tmp_path):
13
9
  '''Test that the Stacking Pipeline gives the same result from a map saved in memory and loading a .fits file'''
@@ -0,0 +1,3 @@
1
+ # pStats
2
+ # cProfiler
3
+
@@ -1 +0,0 @@
1
- __version__ = "0.0.5"
File without changes
File without changes