+
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ jobs:
- name: Install dependencies
run: |
sudo apt install build-essential python3-dev libfftw3-dev libcfitsio-dev libgsl-dev
pip install -e .[pymaster]
pip install pytest pytest-cov
pip install -e .[pymaster,dev]
- name: Check code style
run: |
ruff format --diff . --config=./pyproject.toml
ruff check . --config=./pyproject.toml
- name: Run tests
run: |
pytest --durations=5 -vv
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="logo_broom.png" width="200">
<img src="broom_logo_new.png" width="200">

# BROOM: Blind Reconstruction Of signals from Observations in the Microwaves

Expand Down Expand Up @@ -69,14 +69,14 @@ Paper on **broom** package is in preparation.

If you use the following methodologies please cite the corresponding papers:

- ILC or NILC: [Delabrouille et al., 2019](https://arxiv.org/abs/0807.0773), [Bennett et al., 2003](https://arxiv.org/abs/astro-ph/0302207)
- ILC or NILC: [Bennett et al., 2003](https://arxiv.org/abs/astro-ph/0302207), [Delabrouille et al., 2009](https://arxiv.org/abs/0807.0773)
- cMILC: [Remazeilles et al., 2021](https://arxiv.org/abs/2006.08628), [Carones et al., 2024](https://arxiv.org/abs/2402.17579)
- MC-ILC or MC-NILC: [Carones et al., 2023](https://arxiv.org/abs/2212.04456)
- PILC: [Fernández-Cobos et al., 2016](https://arxiv.org/abs/1601.01515)
- cPILC: [Adak, 2021](https://arxiv.org/abs/2104.13778)
- GILC, GNILC, GPILC: [Planck Collaboration, 2016](https://arxiv.org/abs/1605.09387), [Remazeilles et al., 2011](https://arxiv.org/abs/1103.1166)
- GILC, GNILC, GPILC: [Remazeilles et al., 2011](https://arxiv.org/abs/1103.1166), [Planck Collaboration, 2016](https://arxiv.org/abs/1605.09387)
- foreground diagnostic: [Carones et al., 2024](https://arxiv.org/abs/2402.17579)
- power spectrum computation: [Gorski et al., 2025](https://arxiv.org/abs/astro-ph/0409513), [Zonca et al., 2019](https://ui.adsabs.harvard.edu/abs/2019JOSS....4.1298Z/abstract), [Alonso et al., 2019](https://arxiv.org/abs/1809.09603)
- power spectrum computation: [Gorski et al., 2005](https://arxiv.org/abs/astro-ph/0409513), [Zonca et al., 2019](https://ui.adsabs.harvard.edu/abs/2019JOSS....4.1298Z/abstract), [Alonso et al., 2019](https://arxiv.org/abs/1809.09603)

## 📦 Dependencies

Expand Down
59 changes: 1 addition & 58 deletions broom/__init__.py
Original file line number Diff line number Diff line change
@@ -1,60 +1,3 @@
"""

# BROOM: Blind Reconstruction Of signals from Observations in the Microwaves

**BROOM** is a Python package for blind component separation and Cosmic Microwave Background (CMB) data analysis.

---

## 📦 Installation

You can install the base package using:

```
pip install cmbroom
```

This installs the core functionality.
If you plan to use the few functions that depend on `pymaster`, **you must install it separately** (version `>=2.4`).

---

### 🔧 To include `pymaster` automatically:

You can install `cmbroom` along with its optional `pymaster` dependency by running:

```
pip install cmbroom[pymaster]
```

However, `pymaster` requires some additional system libraries to be installed **before** running the above command.

#### ✅ On Ubuntu/Debian:
```
sudo apt update
sudo apt install build-essential python3-dev libfftw3-dev libcfitsio-dev
```

#### ✅ On macOS (using Homebrew):
```
brew install fftw cfitsio
```

### 📦 Dependencies

This package relies on several scientific Python libraries:

- [astropy>=6.0.1](https://www.astropy.org/)
- [numpy>1.18.5](https://numpy.org/)
- [scipy>=1.8](https://scipy.org/)
- [healpy>=1.15](https://healpy.readthedocs.io/)
- [pysm3>=3.3.2](https://pysm3.readthedocs.io/en/latest/#)
- [mtneedlet>=0.0.5](https://javicarron.github.io/mtneedlet/)



"""


from .compsep import (
component_separation, estimate_residuals, _combine_products, _load_outputs
Expand All @@ -65,4 +8,4 @@
from .clusters import get_and_save_real_tracers_B


__version__ = "0.1.1"
__version__ = "0.1.2"
3 changes: 1 addition & 2 deletions broom/clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def get_and_save_real_tracers_B(
Saves the generated tracers to the configured output path.
"""
from broom import component_separation
print('new_version')
if "tracers_inputs_path" not in config.real_mc_tracers[0]:
config.real_mc_tracers[0]["tracers_inputs_path"] = f"inputs_mc_tracers/{config.experiment}"

Expand All @@ -95,7 +94,7 @@ def get_and_save_real_tracers_B(

_log("Generating input simulations for MC-ILC tracers", verbose=config_mc.verbose)

mc_data = get_mc_data(config_mc, foregrounds=foregrounds, **kwargs)
mc_data = get_mc_data(config_mc, foregrounds=foregrounds, systematics=systematics, **kwargs)

# if systematics is not None:
# print("Adding systematic effect to the data")
Expand Down
2 changes: 1 addition & 1 deletion broom/gpilcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def _fgd_P_diagnostic_pixel(
def alm_to_polmap(E=None, B=None):
T = np.zeros_like(E if E is not None else B)
return hp.alm2map([T, E if E is not None else T, B if B is not None else T],
config.nside, lmax=lmax, pol=True)[1:]
config.nside, lmax=config.lmax, pol=True)[1:]

for n, channel in enumerate(compsep_run["good_channels"]):
for c in range(input_alms.shape[-1]):
Expand Down
2 changes: 1 addition & 1 deletion broom/masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def threshold_P_tracer(
"""

mask_spectra = np.ones_like(map_[0])
map_ = hp.smoothing([0.*map_,map_[0],map_[1]],fwhm=np.radians(deg_smooth_tracer),lmax=lmax,pol=True)[1:]
map_ = hp.smoothing([0.*map_,map_[0],map_[1]],fwhm=np.radians(smooth_tracer),lmax=lmax,pol=True)[1:]
map_P = np.sqrt((map_[0])**2 + (map_[1])**2)
idx_mask = np.argsort(map_P * mask_in)[-npix_mask:] #
mask_spectra[idx_mask] = 0.
Expand Down
2 changes: 1 addition & 1 deletion broom/pilcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def get_pilc_cov(
fallback_cov_qq_uu = np.mean(np.einsum('ik,jk->ijk', input_maps[:, 0, valid], input_maps[:, 0, valid]), axis=-1) + \
np.mean(np.einsum('ik,jk->ijk', input_maps[:, 1, valid], input_maps[:, 1, valid]), axis=-1)
cov_qq_uu[..., mask == 0.0] = fallback_cov_qq_uu
fallback_qu_uq = np.mean(np.einsum('ik,jk->ijk', input_maps[:, 0, valid], input_maps[:, 1, valid]), axis=-1) - \
fallback_cov_qu_uq = np.mean(np.einsum('ik,jk->ijk', input_maps[:, 0, valid], input_maps[:, 1, valid]), axis=-1) - \
np.mean(np.einsum('ik,jk->ijk', input_maps[:, 1, valid], input_maps[:, 0, valid]), axis=-1)
cov_qu_uq[..., mask == 0.0] = np.repeat(fallback_cov_qu_uq[..., np.newaxis], np.sum(mask == 0.0), axis=-1)

Expand Down
4 changes: 2 additions & 2 deletions broom/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def _get_fres_pixel(

# Convert alms to maps
input_maps = np.zeros((good_channels.shape[0], 12 * config.nside**2, input_alms.shape[-1]))
for n, channel in enumerate(good_channels_nl):
for n, channel in enumerate(good_channels):
input_maps[n] = np.array([
hp.alm2map(np.ascontiguousarray(input_alms[channel, :, c]), config.nside, lmax=config.lmax, pol=False)
for c in range(input_alms.shape[-1])
Expand Down Expand Up @@ -556,7 +556,7 @@ def _get_fres_P_needlet_j(
good_channels_nl = _get_good_channels_nl(config, b_ell)

# Load PILC weights
weights_path = os.path.join(config.path_outputs,
weights_filename = os.path.join(config.path_outputs,
compsep_run["compsep_path"],
f"weights/weights_{compsep_run['field']}_{config.fwhm_out}acm_ns{nside_}_lmax{config.lmax}_nl{nl_scale}"
)
Expand Down
Binary file added broom_logo_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions docs/broom.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ <h2 id="references">References</h2>
<p>If you use the following methodologies please cite the corresponding papers:</p>

<ul>
<li>ILC or NILC: <a href="https://arxiv.org/abs/0807.0773">Delabrouille et al., 2019</a>, <a href="https://arxiv.org/abs/astro-ph/0302207">Bennett et al., 2003</a></li>
<li>ILC or NILC: <a href="https://arxiv.org/abs/astro-ph/0302207">Bennett et al., 2003</a>, <a href="https://arxiv.org/abs/0807.0773">Delabrouille et al., 2009</a></li>
<li>cMILC: <a href="https://arxiv.org/abs/2006.08628">Remazeilles et al., 2021</a>, <a href="https://arxiv.org/abs/2402.17579">Carones et al., 2024</a></li>
<li>MC-ILC or MC-NILC: <a href="https://arxiv.org/abs/2212.04456">Carones et al., 2023</a></li>
<li>PILC: <a href="https://arxiv.org/abs/1601.01515">Fernández-Cobos et al., 2016</a></li>
<li>cPILC: <a href="https://arxiv.org/abs/2104.13778">Adak, 2021</a></li>
<li>GILC, GNILC, GPILC: <a href="https://arxiv.org/abs/1605.09387">Planck Collaboration, 2016</a>, <a href="https://arxiv.org/abs/1103.1166">Remazeilles et al., 2011</a></li>
<li>GILC, GNILC, GPILC: <a href="https://arxiv.org/abs/1103.1166">Remazeilles et al., 2011</a>, <a href="https://arxiv.org/abs/1605.09387">Planck Collaboration, 2016</a></li>
<li>foreground diagnostic: <a href="https://arxiv.org/abs/2402.17579">Carones et al., 2024</a></li>
<li>power spectrum computation: <a href="https://arxiv.org/abs/astro-ph/0409513">Gorski et al., 2025</a>, <a href="https://ui.adsabs.harvard.edu/abs/2019JOSS....4.1298Z/abstract">Zonca et al., 2019</a>, <a href="https://arxiv.org/abs/1809.09603">Alonso et al., 2019</a></li>
<li>power spectrum computation: <a href="https://arxiv.org/abs/astro-ph/0409513">Gorski et al., 2005</a>, <a href="https://ui.adsabs.harvard.edu/abs/2019JOSS....4.1298Z/abstract">Zonca et al., 2019</a>, <a href="https://arxiv.org/abs/1809.09603">Alonso et al., 2019</a></li>
</ul>

<h3 id="dependencies">📦 Dependencies</h3>
Expand Down Expand Up @@ -247,14 +247,14 @@ <h3 id="dependencies">📦 Dependencies</h3>
</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a>
</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a><span class="sd">If you use the following methodologies please cite the corresponding papers:</span>
</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a>
</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a><span class="sd">- ILC or NILC: [Delabrouille et al., 2019](https://arxiv.org/abs/0807.0773), [Bennett et al., 2003](https://arxiv.org/abs/astro-ph/0302207)</span>
</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a><span class="sd">- ILC or NILC: [Bennett et al., 2003](https://arxiv.org/abs/astro-ph/0302207), [Delabrouille et al., 2009](https://arxiv.org/abs/0807.0773)</span>
</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a><span class="sd">- cMILC: [Remazeilles et al., 2021](https://arxiv.org/abs/2006.08628), [Carones et al., 2024](https://arxiv.org/abs/2402.17579)</span>
</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a><span class="sd">- MC-ILC or MC-NILC: [Carones et al., 2023](https://arxiv.org/abs/2212.04456)</span>
</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a><span class="sd">- PILC: [Fernández-Cobos et al., 2016](https://arxiv.org/abs/1601.01515)</span>
</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a><span class="sd">- cPILC: [Adak, 2021](https://arxiv.org/abs/2104.13778)</span>
</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="sd">- GILC, GNILC, GPILC: [Planck Collaboration, 2016](https://arxiv.org/abs/1605.09387), [Remazeilles et al., 2011](https://arxiv.org/abs/1103.1166)</span>
</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="sd">- GILC, GNILC, GPILC: [Remazeilles et al., 2011](https://arxiv.org/abs/1103.1166), [Planck Collaboration, 2016](https://arxiv.org/abs/1605.09387)</span>
</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="sd">- foreground diagnostic: [Carones et al., 2024](https://arxiv.org/abs/2402.17579)</span>
</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a><span class="sd">- power spectrum computation: [Gorski et al., 2025](https://arxiv.org/abs/astro-ph/0409513), [Zonca et al., 2019](https://ui.adsabs.harvard.edu/abs/2019JOSS....4.1298Z/abstract), [Alonso et al., 2019](https://arxiv.org/abs/1809.09603)</span>
</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a><span class="sd">- power spectrum computation: [Gorski et al., 2005](https://arxiv.org/abs/astro-ph/0409513), [Zonca et al., 2019](https://ui.adsabs.harvard.edu/abs/2019JOSS....4.1298Z/abstract), [Alonso et al., 2019](https://arxiv.org/abs/1809.09603)</span>
</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a>
</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a><span class="sd">### 📦 Dependencies</span>
</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a>
Expand Down
Loading
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载