cosmoforge 1.0.0__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.
- cosmoforge-1.0.0/.gitignore +70 -0
- cosmoforge-1.0.0/PKG-INFO +249 -0
- cosmoforge-1.0.0/README.md +225 -0
- cosmoforge-1.0.0/pyproject.toml +42 -0
- cosmoforge-1.0.0/tests/test_integration.py +83 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
htmlcov/
|
|
9
|
+
coverage.xml
|
|
10
|
+
src/graphify-out/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv
|
|
14
|
+
*inputs/
|
|
15
|
+
*outputs/
|
|
16
|
+
*logs/
|
|
17
|
+
*slurms/
|
|
18
|
+
*plots/
|
|
19
|
+
.coverage
|
|
20
|
+
|
|
21
|
+
# Ignore maps/templates except in test directories
|
|
22
|
+
*maps/
|
|
23
|
+
*templates/
|
|
24
|
+
!**/tests/data/**/maps/
|
|
25
|
+
!**/tests/data/**/templates/
|
|
26
|
+
|
|
27
|
+
# Test intermediate artifacts (regenerated during test runs)
|
|
28
|
+
**/tests/data/**/cov_matrix.dat
|
|
29
|
+
**/tests/data/**/errors.dat
|
|
30
|
+
**/tests/data/**/fisher.dat
|
|
31
|
+
**/tests/data/**/geometry.dat
|
|
32
|
+
**/tests/data/**/invCOV*.bin
|
|
33
|
+
**/tests/data/**/reduced_NCVM*.bin
|
|
34
|
+
# Exception: keep Fortran reference files for validation tests
|
|
35
|
+
!**/tests/data/**/fortran_reference/**
|
|
36
|
+
|
|
37
|
+
run_*.py
|
|
38
|
+
/src/*/.library
|
|
39
|
+
/.claude
|
|
40
|
+
/papers
|
|
41
|
+
/sync_to_cluster.sh
|
|
42
|
+
|
|
43
|
+
# Fortran reference/build directories
|
|
44
|
+
/src/*/.fortran
|
|
45
|
+
|
|
46
|
+
# Generated output files in test data
|
|
47
|
+
**/tests/data/**/output_*.bin
|
|
48
|
+
**/tests/data/**/output_*.dat
|
|
49
|
+
**/tests/data/**/*.png
|
|
50
|
+
*.png
|
|
51
|
+
!logos/*.png
|
|
52
|
+
!docs/source/_static/*.png
|
|
53
|
+
!src/**/logos/*.png
|
|
54
|
+
/src/cosmoforge.picslike/tests/data/nside8/B/fortran_reference/theory_spectra
|
|
55
|
+
/src/cosmoforge.qube/benchmarks/sims/bench_T*
|
|
56
|
+
/src/cosmoforge.qube/benchmarks/sims/bench_QU*
|
|
57
|
+
/src/cosmoforge.qube/benchmarks/sims/bench_mpi*
|
|
58
|
+
|
|
59
|
+
# Heavy benchmark fixtures (kept locally, synced to cluster manually)
|
|
60
|
+
/src/cosmoforge.qube/benchmarks/data/
|
|
61
|
+
|
|
62
|
+
src/cosmoforge.qube/scripts/qml_vs_pcl_results.json
|
|
63
|
+
/src/cosmoforge.qube/benchmarks/results
|
|
64
|
+
/src/cosmoforge.qube/benchmarks/sims
|
|
65
|
+
*.json
|
|
66
|
+
|
|
67
|
+
# Local git worktrees
|
|
68
|
+
.worktrees/
|
|
69
|
+
/src/cosmoforge.qube/benchmarks/results
|
|
70
|
+
/src/cosmoforge.qube/benchmarks/sbatch
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cosmoforge
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: CosmoForge: umbrella metapackage installing cosmocore, qube-qml, and picslike.
|
|
5
|
+
Author-email: Giacomo Galloni <giacomo.galloni@unife.it>
|
|
6
|
+
Classifier: Development Status :: 4 - Beta
|
|
7
|
+
Classifier: Intended Audience :: Science/Research
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: MacOS
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
17
|
+
Requires-Python: <3.14,>=3.11
|
|
18
|
+
Requires-Dist: cosmocore
|
|
19
|
+
Requires-Dist: picslike
|
|
20
|
+
Requires-Dist: qube-qml
|
|
21
|
+
Provides-Extra: mpi
|
|
22
|
+
Requires-Dist: cosmocore[mpi]; extra == 'mpi'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<img src="https://raw.githubusercontent.com/ggalloni/CosmoForge/master/logos/logo_cosmoforge_light.png#gh-light-mode-only" alt="CosmoForge logo (light)" width="60%"/>
|
|
27
|
+
<img src="https://raw.githubusercontent.com/ggalloni/CosmoForge/master/logos/logo_cosmoforge_dark.png#gh-dark-mode-only" alt="CosmoForge logo (dark)" width="60%"/>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
[](https://github.com/ggalloni/CosmoForge/actions/workflows/test.yml)
|
|
31
|
+
[](https://cosmoforge.readthedocs.io/en/latest/?badge=latest)
|
|
32
|
+
[](https://codecov.io/gh/ggalloni/CosmoForge)
|
|
33
|
+
[](https://pypi.org/project/cosmoforge/)
|
|
34
|
+
[](https://github.com/charliermarsh/ruff)
|
|
35
|
+
[](https://pypi.org/project/cosmoforge/)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
|
|
38
|
+
> **📚 [Complete Documentation](https://cosmoforge.readthedocs.io/en/latest/) | [Installation Guide](https://cosmoforge.readthedocs.io/en/latest/installation.html) | [Quick Start](https://cosmoforge.readthedocs.io/en/latest/quickstart.html) | [API Reference](https://cosmoforge.readthedocs.io/en/latest/api/cosmocore.html)**
|
|
39
|
+
|
|
40
|
+
CosmoForge is a comprehensive Python framework for power spectrum estimation and likelihood analysis of spin-0 and spin-2 fields on the sphere, using Fisher matrix, Quadratic Maximum Likelihood (QML), and pixel-based likelihood methods. While widely applicable to any sky signal (e.g. CMB, galaxy surveys, 21 cm), it is particularly optimized for the analysis of partial-sky, noisy observations with complex noise covariance.
|
|
41
|
+
|
|
42
|
+
## Overview
|
|
43
|
+
|
|
44
|
+
CosmoForge consists of several interconnected packages designed for efficient and accurate cosmological parameter estimation:
|
|
45
|
+
|
|
46
|
+
- **cosmocore**: Core functionality for cosmological analysis including field management, matrix operations, and I/O utilities
|
|
47
|
+
- **qube-qml**: QML and Fisher matrix implementations for power spectrum estimation (imported as `qube`)
|
|
48
|
+
- **picslike**: Pixel-based Inference with Correlated-Skies Likelihood — pixel-space likelihood analysis for parameter estimation
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
- **Fisher Matrix Analysis**: Fast Fisher matrix computation for cosmological parameter forecasting
|
|
53
|
+
- **QML Power Spectrum Estimation**: Quadratic Maximum Likelihood estimation for optimal power spectrum recovery
|
|
54
|
+
- **Pixel-Based Likelihood**: Direct likelihood evaluation in map pixel space for parameter estimation
|
|
55
|
+
- **MPI Parallelization**: Efficient parallel computation support for large-scale analyses
|
|
56
|
+
- **HEALPix Integration**: Full support for HEALPix pixelization scheme
|
|
57
|
+
- **Flexible Field Management**: Support for scalar (spin-0) and tensor (spin-2) fields
|
|
58
|
+
- **Beam and Noise Modeling**: Comprehensive instrumental effects modeling
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
> **📖 For detailed installation instructions, see the [Installation Guide](https://cosmoforge.readthedocs.io/en/latest/installation.html)**
|
|
63
|
+
|
|
64
|
+
### Requirements
|
|
65
|
+
|
|
66
|
+
- Python 3.11–3.13
|
|
67
|
+
- NumPy, SciPy
|
|
68
|
+
- healpy
|
|
69
|
+
- mpi4py (for parallel computation)
|
|
70
|
+
|
|
71
|
+
### Install from PyPI
|
|
72
|
+
|
|
73
|
+
The umbrella distribution installs all three subpackages:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install cosmoforge
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Or pick subpackages individually:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install cosmocore # core utilities only
|
|
83
|
+
pip install qube-qml # adds QML / Fisher (imported as `qube`)
|
|
84
|
+
pip install picslike # adds pixel-space likelihood
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Install from source
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/ggalloni/CosmoForge.git
|
|
91
|
+
cd CosmoForge
|
|
92
|
+
uv sync --all-packages --all-extras --dev
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Quick Start
|
|
96
|
+
|
|
97
|
+
> **🚀 For comprehensive tutorials and examples, visit the [Quick Start Guide](https://cosmoforge.readthedocs.io/en/latest/quickstart.html) and [Tutorials](https://cosmoforge.readthedocs.io/en/latest/tutorials/index.html)**
|
|
98
|
+
|
|
99
|
+
### Fisher Matrix Analysis
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from qube import Fisher
|
|
103
|
+
|
|
104
|
+
# Initialize Fisher analysis
|
|
105
|
+
fisher = Fisher("config/fisher_config.yaml")
|
|
106
|
+
fisher.run()
|
|
107
|
+
|
|
108
|
+
# Get Fisher matrix
|
|
109
|
+
fisher_matrix = fisher.get_fisher_matrix()
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### QML Power Spectrum Estimation
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from qube import Spectra
|
|
116
|
+
|
|
117
|
+
# Initialize QML analysis
|
|
118
|
+
qml = Spectra("config/qml_config.yaml")
|
|
119
|
+
qml.run()
|
|
120
|
+
|
|
121
|
+
# Get power spectra
|
|
122
|
+
power_spectra = qml.get_power_spectra()
|
|
123
|
+
noise_bias = qml.get_noise_bias()
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Pixel-Based Likelihood Analysis
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from picslike import PICSLike
|
|
130
|
+
|
|
131
|
+
# Initialize pixel-based likelihood
|
|
132
|
+
picslike = PICSLike(params_file="config/picslike_config.yaml")
|
|
133
|
+
picslike.run()
|
|
134
|
+
|
|
135
|
+
# Get results
|
|
136
|
+
chi_squared = picslike.get_chi_squared()
|
|
137
|
+
best_fit = picslike.get_best_fit()
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Using with Precomputed Fisher
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
from qube import Fisher, Spectra
|
|
144
|
+
|
|
145
|
+
# Compute Fisher matrix first
|
|
146
|
+
fisher = Fisher("config/fisher_config.yaml")
|
|
147
|
+
fisher.run()
|
|
148
|
+
|
|
149
|
+
# Reuse Fisher computation for QML
|
|
150
|
+
qml = Spectra("config/qml_config.yaml", fisher=fisher)
|
|
151
|
+
qml.run()
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Package Structure
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
CosmoForge/
|
|
158
|
+
├── src/
|
|
159
|
+
│ ├── cosmoforge.cosmocore/ # Core functionality (published as `cosmocore`)
|
|
160
|
+
│ ├── cosmoforge.qube/ # QML and Fisher analysis (published as `qube-qml`, imported as `qube`)
|
|
161
|
+
│ ├── cosmoforge.picslike/ # Pixel-space likelihood (published as `picslike`)
|
|
162
|
+
│ └── cosmoforge.meta/ # Umbrella metapackage (published as `cosmoforge`)
|
|
163
|
+
├── tests/ # Test suite
|
|
164
|
+
├── docs/ # Documentation
|
|
165
|
+
└── examples/ # Example configurations
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Configuration
|
|
169
|
+
|
|
170
|
+
CosmoForge uses YAML configuration files to specify analysis parameters:
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
# Example configuration
|
|
174
|
+
nside: 4
|
|
175
|
+
lmax: 16
|
|
176
|
+
fields: "TEB"
|
|
177
|
+
maskfile: "data/mask.fits"
|
|
178
|
+
inputclfile: "data/fiducial_cls.txt"
|
|
179
|
+
# ... additional parameters
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Testing
|
|
183
|
+
|
|
184
|
+
Run the test suite:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Run all tests
|
|
188
|
+
uv run pytest
|
|
189
|
+
|
|
190
|
+
# Run specific package tests
|
|
191
|
+
uv run --package cosmocore pytest src/cosmoforge.cosmocore/tests/
|
|
192
|
+
uv run --package qube pytest src/cosmoforge.qube/tests/
|
|
193
|
+
uv run --package picslike pytest src/cosmoforge.picslike/tests/
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Performance
|
|
197
|
+
|
|
198
|
+
CosmoForge is designed for high-performance cosmological analysis:
|
|
199
|
+
|
|
200
|
+
- **Numba JIT compilation** for critical mathematical operations
|
|
201
|
+
- **MPI parallelization** for distributed computing
|
|
202
|
+
- **Optimized matrix operations** using LAPACK/BLAS
|
|
203
|
+
- **Memory-efficient algorithms** for large datasets
|
|
204
|
+
|
|
205
|
+
## Contributing
|
|
206
|
+
|
|
207
|
+
1. Fork the repository
|
|
208
|
+
2. Create a feature branch
|
|
209
|
+
3. Make your changes
|
|
210
|
+
4. Add tests for new functionality
|
|
211
|
+
5. Submit a pull request
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
[Add license information]
|
|
216
|
+
|
|
217
|
+
## Citation
|
|
218
|
+
|
|
219
|
+
If you use CosmoForge in your research, please cite:
|
|
220
|
+
|
|
221
|
+
> Galloni, G. & Pagano, L., *CosmoForge I: A unified framework for QML power spectrum estimation and pixel-based likelihood analysis*, in preparation (2026).
|
|
222
|
+
|
|
223
|
+
```bibtex
|
|
224
|
+
@article{GalloniPagano_CosmoForgeI,
|
|
225
|
+
author = {Galloni, G. and Pagano, L.},
|
|
226
|
+
title = {{CosmoForge I}: A unified framework for {QML} power spectrum estimation and pixel-based likelihood analysis},
|
|
227
|
+
year = {2026},
|
|
228
|
+
note = {in preparation}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
This entry will be updated with the arXiv identifier and journal reference once available.
|
|
233
|
+
|
|
234
|
+
## Support
|
|
235
|
+
|
|
236
|
+
> **📖 Complete documentation is available at: [https://cosmoforge.readthedocs.io/en/latest/](https://cosmoforge.readthedocs.io/en/latest/)**
|
|
237
|
+
|
|
238
|
+
For questions and support:
|
|
239
|
+
|
|
240
|
+
- Open an issue on GitHub
|
|
241
|
+
- Contact: [contact information]
|
|
242
|
+
|
|
243
|
+
## Acknowledgments
|
|
244
|
+
|
|
245
|
+
CosmoForge builds upon established cosmological analysis methods and libraries:
|
|
246
|
+
|
|
247
|
+
- HEALPix for pixelization
|
|
248
|
+
- NumPy/SciPy for numerical computations
|
|
249
|
+
- MPI for parallelization
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/ggalloni/CosmoForge/master/logos/logo_cosmoforge_light.png#gh-light-mode-only" alt="CosmoForge logo (light)" width="60%"/>
|
|
3
|
+
<img src="https://raw.githubusercontent.com/ggalloni/CosmoForge/master/logos/logo_cosmoforge_dark.png#gh-dark-mode-only" alt="CosmoForge logo (dark)" width="60%"/>
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
[](https://github.com/ggalloni/CosmoForge/actions/workflows/test.yml)
|
|
7
|
+
[](https://cosmoforge.readthedocs.io/en/latest/?badge=latest)
|
|
8
|
+
[](https://codecov.io/gh/ggalloni/CosmoForge)
|
|
9
|
+
[](https://pypi.org/project/cosmoforge/)
|
|
10
|
+
[](https://github.com/charliermarsh/ruff)
|
|
11
|
+
[](https://pypi.org/project/cosmoforge/)
|
|
12
|
+
[](LICENSE)
|
|
13
|
+
|
|
14
|
+
> **📚 [Complete Documentation](https://cosmoforge.readthedocs.io/en/latest/) | [Installation Guide](https://cosmoforge.readthedocs.io/en/latest/installation.html) | [Quick Start](https://cosmoforge.readthedocs.io/en/latest/quickstart.html) | [API Reference](https://cosmoforge.readthedocs.io/en/latest/api/cosmocore.html)**
|
|
15
|
+
|
|
16
|
+
CosmoForge is a comprehensive Python framework for power spectrum estimation and likelihood analysis of spin-0 and spin-2 fields on the sphere, using Fisher matrix, Quadratic Maximum Likelihood (QML), and pixel-based likelihood methods. While widely applicable to any sky signal (e.g. CMB, galaxy surveys, 21 cm), it is particularly optimized for the analysis of partial-sky, noisy observations with complex noise covariance.
|
|
17
|
+
|
|
18
|
+
## Overview
|
|
19
|
+
|
|
20
|
+
CosmoForge consists of several interconnected packages designed for efficient and accurate cosmological parameter estimation:
|
|
21
|
+
|
|
22
|
+
- **cosmocore**: Core functionality for cosmological analysis including field management, matrix operations, and I/O utilities
|
|
23
|
+
- **qube-qml**: QML and Fisher matrix implementations for power spectrum estimation (imported as `qube`)
|
|
24
|
+
- **picslike**: Pixel-based Inference with Correlated-Skies Likelihood — pixel-space likelihood analysis for parameter estimation
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **Fisher Matrix Analysis**: Fast Fisher matrix computation for cosmological parameter forecasting
|
|
29
|
+
- **QML Power Spectrum Estimation**: Quadratic Maximum Likelihood estimation for optimal power spectrum recovery
|
|
30
|
+
- **Pixel-Based Likelihood**: Direct likelihood evaluation in map pixel space for parameter estimation
|
|
31
|
+
- **MPI Parallelization**: Efficient parallel computation support for large-scale analyses
|
|
32
|
+
- **HEALPix Integration**: Full support for HEALPix pixelization scheme
|
|
33
|
+
- **Flexible Field Management**: Support for scalar (spin-0) and tensor (spin-2) fields
|
|
34
|
+
- **Beam and Noise Modeling**: Comprehensive instrumental effects modeling
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
> **📖 For detailed installation instructions, see the [Installation Guide](https://cosmoforge.readthedocs.io/en/latest/installation.html)**
|
|
39
|
+
|
|
40
|
+
### Requirements
|
|
41
|
+
|
|
42
|
+
- Python 3.11–3.13
|
|
43
|
+
- NumPy, SciPy
|
|
44
|
+
- healpy
|
|
45
|
+
- mpi4py (for parallel computation)
|
|
46
|
+
|
|
47
|
+
### Install from PyPI
|
|
48
|
+
|
|
49
|
+
The umbrella distribution installs all three subpackages:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install cosmoforge
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or pick subpackages individually:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install cosmocore # core utilities only
|
|
59
|
+
pip install qube-qml # adds QML / Fisher (imported as `qube`)
|
|
60
|
+
pip install picslike # adds pixel-space likelihood
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Install from source
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
git clone https://github.com/ggalloni/CosmoForge.git
|
|
67
|
+
cd CosmoForge
|
|
68
|
+
uv sync --all-packages --all-extras --dev
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Quick Start
|
|
72
|
+
|
|
73
|
+
> **🚀 For comprehensive tutorials and examples, visit the [Quick Start Guide](https://cosmoforge.readthedocs.io/en/latest/quickstart.html) and [Tutorials](https://cosmoforge.readthedocs.io/en/latest/tutorials/index.html)**
|
|
74
|
+
|
|
75
|
+
### Fisher Matrix Analysis
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from qube import Fisher
|
|
79
|
+
|
|
80
|
+
# Initialize Fisher analysis
|
|
81
|
+
fisher = Fisher("config/fisher_config.yaml")
|
|
82
|
+
fisher.run()
|
|
83
|
+
|
|
84
|
+
# Get Fisher matrix
|
|
85
|
+
fisher_matrix = fisher.get_fisher_matrix()
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### QML Power Spectrum Estimation
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from qube import Spectra
|
|
92
|
+
|
|
93
|
+
# Initialize QML analysis
|
|
94
|
+
qml = Spectra("config/qml_config.yaml")
|
|
95
|
+
qml.run()
|
|
96
|
+
|
|
97
|
+
# Get power spectra
|
|
98
|
+
power_spectra = qml.get_power_spectra()
|
|
99
|
+
noise_bias = qml.get_noise_bias()
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Pixel-Based Likelihood Analysis
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from picslike import PICSLike
|
|
106
|
+
|
|
107
|
+
# Initialize pixel-based likelihood
|
|
108
|
+
picslike = PICSLike(params_file="config/picslike_config.yaml")
|
|
109
|
+
picslike.run()
|
|
110
|
+
|
|
111
|
+
# Get results
|
|
112
|
+
chi_squared = picslike.get_chi_squared()
|
|
113
|
+
best_fit = picslike.get_best_fit()
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Using with Precomputed Fisher
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from qube import Fisher, Spectra
|
|
120
|
+
|
|
121
|
+
# Compute Fisher matrix first
|
|
122
|
+
fisher = Fisher("config/fisher_config.yaml")
|
|
123
|
+
fisher.run()
|
|
124
|
+
|
|
125
|
+
# Reuse Fisher computation for QML
|
|
126
|
+
qml = Spectra("config/qml_config.yaml", fisher=fisher)
|
|
127
|
+
qml.run()
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Package Structure
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
CosmoForge/
|
|
134
|
+
├── src/
|
|
135
|
+
│ ├── cosmoforge.cosmocore/ # Core functionality (published as `cosmocore`)
|
|
136
|
+
│ ├── cosmoforge.qube/ # QML and Fisher analysis (published as `qube-qml`, imported as `qube`)
|
|
137
|
+
│ ├── cosmoforge.picslike/ # Pixel-space likelihood (published as `picslike`)
|
|
138
|
+
│ └── cosmoforge.meta/ # Umbrella metapackage (published as `cosmoforge`)
|
|
139
|
+
├── tests/ # Test suite
|
|
140
|
+
├── docs/ # Documentation
|
|
141
|
+
└── examples/ # Example configurations
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Configuration
|
|
145
|
+
|
|
146
|
+
CosmoForge uses YAML configuration files to specify analysis parameters:
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
# Example configuration
|
|
150
|
+
nside: 4
|
|
151
|
+
lmax: 16
|
|
152
|
+
fields: "TEB"
|
|
153
|
+
maskfile: "data/mask.fits"
|
|
154
|
+
inputclfile: "data/fiducial_cls.txt"
|
|
155
|
+
# ... additional parameters
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Testing
|
|
159
|
+
|
|
160
|
+
Run the test suite:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Run all tests
|
|
164
|
+
uv run pytest
|
|
165
|
+
|
|
166
|
+
# Run specific package tests
|
|
167
|
+
uv run --package cosmocore pytest src/cosmoforge.cosmocore/tests/
|
|
168
|
+
uv run --package qube pytest src/cosmoforge.qube/tests/
|
|
169
|
+
uv run --package picslike pytest src/cosmoforge.picslike/tests/
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Performance
|
|
173
|
+
|
|
174
|
+
CosmoForge is designed for high-performance cosmological analysis:
|
|
175
|
+
|
|
176
|
+
- **Numba JIT compilation** for critical mathematical operations
|
|
177
|
+
- **MPI parallelization** for distributed computing
|
|
178
|
+
- **Optimized matrix operations** using LAPACK/BLAS
|
|
179
|
+
- **Memory-efficient algorithms** for large datasets
|
|
180
|
+
|
|
181
|
+
## Contributing
|
|
182
|
+
|
|
183
|
+
1. Fork the repository
|
|
184
|
+
2. Create a feature branch
|
|
185
|
+
3. Make your changes
|
|
186
|
+
4. Add tests for new functionality
|
|
187
|
+
5. Submit a pull request
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
[Add license information]
|
|
192
|
+
|
|
193
|
+
## Citation
|
|
194
|
+
|
|
195
|
+
If you use CosmoForge in your research, please cite:
|
|
196
|
+
|
|
197
|
+
> Galloni, G. & Pagano, L., *CosmoForge I: A unified framework for QML power spectrum estimation and pixel-based likelihood analysis*, in preparation (2026).
|
|
198
|
+
|
|
199
|
+
```bibtex
|
|
200
|
+
@article{GalloniPagano_CosmoForgeI,
|
|
201
|
+
author = {Galloni, G. and Pagano, L.},
|
|
202
|
+
title = {{CosmoForge I}: A unified framework for {QML} power spectrum estimation and pixel-based likelihood analysis},
|
|
203
|
+
year = {2026},
|
|
204
|
+
note = {in preparation}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
This entry will be updated with the arXiv identifier and journal reference once available.
|
|
209
|
+
|
|
210
|
+
## Support
|
|
211
|
+
|
|
212
|
+
> **📖 Complete documentation is available at: [https://cosmoforge.readthedocs.io/en/latest/](https://cosmoforge.readthedocs.io/en/latest/)**
|
|
213
|
+
|
|
214
|
+
For questions and support:
|
|
215
|
+
|
|
216
|
+
- Open an issue on GitHub
|
|
217
|
+
- Contact: [contact information]
|
|
218
|
+
|
|
219
|
+
## Acknowledgments
|
|
220
|
+
|
|
221
|
+
CosmoForge builds upon established cosmological analysis methods and libraries:
|
|
222
|
+
|
|
223
|
+
- HEALPix for pixelization
|
|
224
|
+
- NumPy/SciPy for numerical computations
|
|
225
|
+
- MPI for parallelization
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "cosmoforge"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "CosmoForge: umbrella metapackage installing cosmocore, qube-qml, and picslike."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Giacomo Galloni", email = "giacomo.galloni@unife.it" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.11,<3.14"
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Science/Research",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Operating System :: POSIX :: Linux",
|
|
15
|
+
"Operating System :: MacOS",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Astronomy",
|
|
21
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"cosmocore",
|
|
25
|
+
"qube-qml",
|
|
26
|
+
"picslike",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
mpi = ["cosmocore[mpi]"]
|
|
31
|
+
|
|
32
|
+
[build-system]
|
|
33
|
+
requires = ["hatchling"]
|
|
34
|
+
build-backend = "hatchling.build"
|
|
35
|
+
|
|
36
|
+
[tool.hatch.build.targets.wheel]
|
|
37
|
+
bypass-selection = true
|
|
38
|
+
|
|
39
|
+
[tool.uv.sources]
|
|
40
|
+
qube-qml = { workspace = true }
|
|
41
|
+
cosmocore = { workspace = true }
|
|
42
|
+
picslike = { workspace = true }
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""Basic integration tests for the Meta package."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_import_cosmocore():
|
|
7
|
+
"""Test that cosmocore can be imported successfully."""
|
|
8
|
+
try:
|
|
9
|
+
import cosmocore
|
|
10
|
+
|
|
11
|
+
assert hasattr(cosmocore, "__version__") or True # Package imported successfully
|
|
12
|
+
except ImportError as e:
|
|
13
|
+
pytest.fail(f"Failed to import cosmocore: {e}")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_import_qube():
|
|
17
|
+
"""Test that qube can be imported successfully."""
|
|
18
|
+
try:
|
|
19
|
+
import qube
|
|
20
|
+
|
|
21
|
+
# Check for main classes
|
|
22
|
+
assert hasattr(qube, "Fisher") or hasattr(qube, "Spectra")
|
|
23
|
+
except ImportError as e:
|
|
24
|
+
pytest.fail(f"Failed to import qube: {e}")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_import_picslike():
|
|
28
|
+
"""Test that picslike can be imported successfully."""
|
|
29
|
+
try:
|
|
30
|
+
import picslike
|
|
31
|
+
|
|
32
|
+
# Check for main classes
|
|
33
|
+
assert hasattr(picslike, "PICSLike")
|
|
34
|
+
except ImportError as e:
|
|
35
|
+
pytest.fail(f"Failed to import picslike: {e}")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_workspace_integration():
|
|
39
|
+
"""Test that all workspace packages can be imported together."""
|
|
40
|
+
try:
|
|
41
|
+
import cosmocore
|
|
42
|
+
import picslike
|
|
43
|
+
import qube
|
|
44
|
+
|
|
45
|
+
# Test that packages are properly installed
|
|
46
|
+
assert cosmocore is not None
|
|
47
|
+
assert qube is not None
|
|
48
|
+
assert picslike is not None
|
|
49
|
+
|
|
50
|
+
# Test that we can access main functionality
|
|
51
|
+
assert hasattr(qube, "Fisher")
|
|
52
|
+
assert hasattr(picslike, "PICSLike")
|
|
53
|
+
|
|
54
|
+
except Exception as e:
|
|
55
|
+
pytest.fail(f"Workspace integration test failed: {e}")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_meta_package_exists():
|
|
59
|
+
"""Test that the meta package itself can be imported."""
|
|
60
|
+
try:
|
|
61
|
+
import meta # noqa: F401
|
|
62
|
+
|
|
63
|
+
# Meta package should exist even if minimal
|
|
64
|
+
assert True # Import succeeded
|
|
65
|
+
except ImportError:
|
|
66
|
+
# If meta package doesn't exist, that's also fine
|
|
67
|
+
# This test just ensures no unexpected errors
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def test_basic_functionality():
|
|
72
|
+
"""Test basic functionality across packages."""
|
|
73
|
+
try:
|
|
74
|
+
# Test importing core functionality
|
|
75
|
+
from cosmocore import create_field
|
|
76
|
+
|
|
77
|
+
# Test that functions are callable
|
|
78
|
+
assert callable(create_field)
|
|
79
|
+
|
|
80
|
+
except ImportError as e:
|
|
81
|
+
pytest.skip(f"Skipping functionality test due to import error: {e}")
|
|
82
|
+
except Exception as e:
|
|
83
|
+
pytest.fail(f"Basic functionality test failed: {e}")
|