# picca
[](https://coveralls.io/github/igmhub/picca?branch=master)
Package for Igm Cosmological-Correlations Analyses.
This package contains tools used for the analysis of the Lyman-alpha forest sample from the extended Baryon Oscillation Spectroscopic Survey (eBOSS) and the Dark Energy Spectroscopic Instrument (DESI). Here you will find tools to
- fit continua of forests
- compute correlation functions (1D and 3D) and power-spectra (1D)
- compute covariance matrices
- fit models for the correlation functions
The current reference is du Mas des Bourboux et al. 2020 (https://arxiv.org/abs/2007.08995).
## Installation
First, create a clean environment with `version`>=3.9:
```
conda create -n my_picca_env python==version
conda activate my_picca_env
```
If you already have an environment, you just need to activate it.
After you have the environment, you can install picca with:
```
pip install picca
```
If you are a developer, or want the most recent version of picca, you can download and install manually:
```
git clone https://github.com/igmhub/picca.git
cd picca
pip install -e .
```
Optionally, you can add the path to picca to your bashrc:
```
export PICCA_BASE=<path to your picca>
```
Or you can add `picca/py/` to your `PYTHONPATH`. Both of these are optional and picca will work without them.
If you are at working at NERSC, we recommend to keep everything clean by adding a function like this in your bashrc:
```
picca_env () {
module load python
conda activate my_picca_env
}
```
Whenever you need picca just write:
```
picca_env
```
This is cleaner than directly adding the commands to the bashrc file, and avoids potential issues with the transition to Perlmutter.
If you want to compute models for the correlations computed with picca, or you want to fit these correlations, see https://github.com/andreicuceu/vega.
If you are running MPI code (only needed for some tasks in fitter2), see https://docs.nersc.gov/development/languages/python/parallel-python/#mpi4py-in-your-custom-conda-environment. If want to run the PolyChord sampler for fitter2, see https://github.com/andreicuceu/fitter2_tutorial. Note that fitter2 is deprecated, and will be removed in the future.
If you need to run the "picca_compute_pk_pksb.py" script you will also need to install the following packages:
```
pip install camb
pip install cython
pip install nbodykit
```
## Reproducing the BAO measurement in eBOSS DR16 (du Mas des Bourboux et al. 2020)
Picca v4.0 was used in du Mas des Bourboux et al. (2020) to compute the final Lyman-alpha BAO measurement from eBOSS DR16.
You can find a tutorial describing the different steps needed to reproduce the analysis (starting from the public catalogs) in `tutorials/eboss_dr16`.
## Examples
example run over 1000 spectra (the DLA catalog is not required):
### delta field
```
picca_delta_extraction.py config.ini
```
* To reproduce the eBOSS analysis (du Mas des Bourboux et al. 2020) this needs to be run four times, two for calibration purposes, one for the Lyman $\alpha$ region and one for the Lyman $\beta$ region
* Check the tutorial `picca_delta_extraction_configuration_tutorial` to review the available options. Find it under `tutorials/delta_extraction`
* Check the folder `examples/delta_extraction` with examples to reproduce the eBOSS analysis
### old delta field (deprecated)
```
picca_deltas.py
--in-dir data/
--drq ../DR14Q_v1_1.fits
--dla-vac ../dlas/DLA_DR14_v1b.dat
--out-dir deltas/
--mode pix
```
* for eBOSS, currently `--mode` can be `spplate`, `spec`, `pix`, or `spcframe`, all but the first 2 are about to be retired
* NOTE: reading the spec files is *very* slow
* for DESI currently `--mode` can be `desi_mocks` (for reading healpix based mocks), `desi_survey_tilebased` (for reading cumulative tiles directories and coadding data across tiles) or `desi_sv_no_coadd` (for reading tile based directories without coadding, will probably be retired)
* `--in-dir` points to the directory containing the data (in case of `desi_survey_tilebased` the full path until and including `cumulative` is needed, in case of `desi-mocks` the full path until `spectra-16`)
* the `--drq` points towards a quasar catalog in either the DESI format or eBOSS format
### correlation function
```bash
picca_cf.py
--in-dir deltas/
--out cf.fits.gz
--nside 32
```
* `nside` determines the healpixelization used for the subsamples. `nside=32` gives ~3200 subsamples for DR12.
### distortion matrix
```bash
picca_dmat.py
--in-dir deltas/
--out dmat.fits.gz
--rej 0.95
```
* `--rej` is 1-fraction of pairs used for the calculation
### wick covariance (optional)
Only T123 implemented
```bash
# first calculate cf_1d from data
picca_cf1d.py
--in-dir deltas/
--out cf1d.fits.gz
# then use it for wick
picca_wick.py
--in-dir deltas/
--out t123.fits.gz
--rej 0.999
--cf1d cf1d.fits.gz
## use the export script to export to picca fitter format
picca_export.py
--data cf.fits.gz
--dmat dmat.fits.gz
--out cf-exp.out.gz
```
### Name of tags
The tags name follow the names of the king of France:<br/>
https://fr.wikipedia.org/wiki/Liste_des_monarques_de_France#Liste_des_monarques_de_France
### For Developers
Before submitting a PR please make sure to:
1. Check the tutorials. Update them if necessary (typically the tutorial `picca_delta_extraction_configuration_tutorial` will need to be updated.
2. Update the data model
3. For every file you have modified run
```
yapf --style google file.py -i
```
to ensure the coding styles are maintained.
4. Consider using pylint to help in the debug process. From the repo folder run
```
pylint py/picca/delta_extraction/
pylint py/picca/pk1d/
```
depending on the module you are working on.
New scripts should be added to `pyproject.toml` file under the [project.scripts] section.
When merging PRs (or committing to master directly):
- by default the patch version is increased via a github action, so every change of master will generate a new version
This behaviour can be changed by adding one of the following to the commit-msg of the merge commit:
- by specifying [bump minor] or [bump major] a new minor or major version will be generated instead, but tags and releases need to be created manually (and are auto-pushed to pypi when they are created)
- by specifying [no bump] the version bump can be circumvented altogether when some other behaviour is wanted, in that case bump2version should be run manually
Raw data
{
"_id": null,
"home_page": null,
"name": "picca",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "cosmology, lyman-alpha, bao",
"author": "Nicolas Busca, Helion du Mas des Bourboux, Michael Walther, The DESI Lya forest picca topical group",
"author_email": "Ignasi P\u00e9rez-R\u00e0fols <iprafols@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/b8/84/304ef81ed362c8d669448a909991b215eaaeadc5fbe51411b6bfe5a614ee/picca-9.16.0.tar.gz",
"platform": null,
"description": "# picca\n[](https://coveralls.io/github/igmhub/picca?branch=master)\n\nPackage for Igm Cosmological-Correlations Analyses.\n\nThis package contains tools used for the analysis of the Lyman-alpha forest sample from the extended Baryon Oscillation Spectroscopic Survey (eBOSS) and the Dark Energy Spectroscopic Instrument (DESI). Here you will find tools to\n\n- fit continua of forests\n- compute correlation functions (1D and 3D) and power-spectra (1D)\n- compute covariance matrices\n- fit models for the correlation functions\n\nThe current reference is du Mas des Bourboux et al. 2020 (https://arxiv.org/abs/2007.08995).\n\n## Installation\nFirst, create a clean environment with `version`>=3.9:\n```\nconda create -n my_picca_env python==version\nconda activate my_picca_env\n```\nIf you already have an environment, you just need to activate it.\nAfter you have the environment, you can install picca with:\n```\npip install picca\n```\nIf you are a developer, or want the most recent version of picca, you can download and install manually:\n```\ngit clone https://github.com/igmhub/picca.git\ncd picca\npip install -e .\n```\nOptionally, you can add the path to picca to your bashrc:\n```\nexport PICCA_BASE=<path to your picca>\n```\nOr you can add `picca/py/` to your `PYTHONPATH`. Both of these are optional and picca will work without them.\n\nIf you are at working at NERSC, we recommend to keep everything clean by adding a function like this in your bashrc:\n```\npicca_env () {\n module load python\n conda activate my_picca_env\n}\n```\nWhenever you need picca just write:\n```\npicca_env\n```\nThis is cleaner than directly adding the commands to the bashrc file, and avoids potential issues with the transition to Perlmutter.\n\nIf you want to compute models for the correlations computed with picca, or you want to fit these correlations, see https://github.com/andreicuceu/vega.\n\nIf you are running MPI code (only needed for some tasks in fitter2), see https://docs.nersc.gov/development/languages/python/parallel-python/#mpi4py-in-your-custom-conda-environment. If want to run the PolyChord sampler for fitter2, see https://github.com/andreicuceu/fitter2_tutorial. Note that fitter2 is deprecated, and will be removed in the future.\n\nIf you need to run the \"picca_compute_pk_pksb.py\" script you will also need to install the following packages:\n```\npip install camb\npip install cython\npip install nbodykit\n```\n\n## Reproducing the BAO measurement in eBOSS DR16 (du Mas des Bourboux et al. 2020)\n\nPicca v4.0 was used in du Mas des Bourboux et al. (2020) to compute the final Lyman-alpha BAO measurement from eBOSS DR16.\n\nYou can find a tutorial describing the different steps needed to reproduce the analysis (starting from the public catalogs) in `tutorials/eboss_dr16`.\n\n\n## Examples\n\nexample run over 1000 spectra (the DLA catalog is not required):\n\n### delta field\n```\npicca_delta_extraction.py config.ini\n```\n\n* To reproduce the eBOSS analysis (du Mas des Bourboux et al. 2020) this needs to be run four times, two for calibration purposes, one for the Lyman $\\alpha$ region and one for the Lyman $\\beta$ region\n\n* Check the tutorial `picca_delta_extraction_configuration_tutorial` to review the available options. Find it under `tutorials/delta_extraction`\n\n* Check the folder `examples/delta_extraction` with examples to reproduce the eBOSS analysis\n\n### old delta field (deprecated)\n\n```\npicca_deltas.py\n--in-dir data/\n--drq ../DR14Q_v1_1.fits\n--dla-vac ../dlas/DLA_DR14_v1b.dat\n--out-dir deltas/\n--mode pix\n```\n\n* for eBOSS, currently `--mode` can be `spplate`, `spec`, `pix`, or `spcframe`, all but the first 2 are about to be retired\n* NOTE: reading the spec files is *very* slow\n* for DESI currently `--mode` can be `desi_mocks` (for reading healpix based mocks), `desi_survey_tilebased` (for reading cumulative tiles directories and coadding data across tiles) or `desi_sv_no_coadd` (for reading tile based directories without coadding, will probably be retired)\n* `--in-dir` points to the directory containing the data (in case of `desi_survey_tilebased` the full path until and including `cumulative` is needed, in case of `desi-mocks` the full path until `spectra-16`)\n* the `--drq` points towards a quasar catalog in either the DESI format or eBOSS format\n\n### correlation function\n\n```bash\npicca_cf.py\n--in-dir deltas/\n--out cf.fits.gz\n--nside 32\n```\n* `nside` determines the healpixelization used for the subsamples. `nside=32` gives ~3200 subsamples for DR12.\n\n### distortion matrix\n\n```bash\npicca_dmat.py\n--in-dir deltas/\n--out dmat.fits.gz\n--rej 0.95\n```\n\n* `--rej` is 1-fraction of pairs used for the calculation\n\n### wick covariance (optional)\n\nOnly T123 implemented\n\n```bash\n# first calculate cf_1d from data\npicca_cf1d.py\n--in-dir deltas/\n--out cf1d.fits.gz\n\n# then use it for wick\npicca_wick.py\n--in-dir deltas/\n--out t123.fits.gz\n--rej 0.999\n--cf1d cf1d.fits.gz\n\n## use the export script to export to picca fitter format\npicca_export.py\n--data cf.fits.gz\n--dmat dmat.fits.gz\n--out cf-exp.out.gz\n```\n\n### Name of tags\n\nThe tags name follow the names of the king of France:<br/>\nhttps://fr.wikipedia.org/wiki/Liste_des_monarques_de_France#Liste_des_monarques_de_France\n\n### For Developers\nBefore submitting a PR please make sure to:\n1. Check the tutorials. Update them if necessary (typically the tutorial `picca_delta_extraction_configuration_tutorial` will need to be updated.\n2. Update the data model\n3. For every file you have modified run\n ```\n yapf --style google file.py -i\n ```\n to ensure the coding styles are maintained.\n4. Consider using pylint to help in the debug process. From the repo folder run\n ```\n pylint py/picca/delta_extraction/\n pylint py/picca/pk1d/\n ```\n depending on the module you are working on.\n\nNew scripts should be added to `pyproject.toml` file under the [project.scripts] section.\n\nWhen merging PRs (or committing to master directly):\n- by default the patch version is increased via a github action, so every change of master will generate a new version\nThis behaviour can be changed by adding one of the following to the commit-msg of the merge commit:\n- by specifying [bump minor] or [bump major] a new minor or major version will be generated instead, but tags and releases need to be created manually (and are auto-pushed to pypi when they are created)\n- by specifying [no bump] the version bump can be circumvented altogether when some other behaviour is wanted, in that case bump2version should be run manually\n",
"bugtrack_url": null,
"license": null,
"summary": "Package for Igm Cosmological-Correlations Analyses",
"version": "9.16.0",
"project_urls": {
"Homepage": "https://github.com/igmhub/picca"
},
"split_keywords": [
"cosmology",
" lyman-alpha",
" bao"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fd14e0747eb7959b4ab88d4fba32dc4761c2044e700f46749e6e74a28b11e762",
"md5": "66ab3b067a04be3435b1f75e6bc5bc21",
"sha256": "71279bc40ab7ccb6f1f5ba63b923ffa80d9d9b1dca496691369728542b531e73"
},
"downloads": -1,
"filename": "picca-9.16.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "66ab3b067a04be3435b1f75e6bc5bc21",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 542091,
"upload_time": "2025-08-26T07:16:43",
"upload_time_iso_8601": "2025-08-26T07:16:43.868716Z",
"url": "https://files.pythonhosted.org/packages/fd/14/e0747eb7959b4ab88d4fba32dc4761c2044e700f46749e6e74a28b11e762/picca-9.16.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b884304ef81ed362c8d669448a909991b215eaaeadc5fbe51411b6bfe5a614ee",
"md5": "d44379917a5ace5149057c6848707599",
"sha256": "88e8d7e85b7ea2cc63d1515c10f9630c8cdf0bf7d5dff031c628a517141122c8"
},
"downloads": -1,
"filename": "picca-9.16.0.tar.gz",
"has_sig": false,
"md5_digest": "d44379917a5ace5149057c6848707599",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 454838,
"upload_time": "2025-08-26T07:16:45",
"upload_time_iso_8601": "2025-08-26T07:16:45.775617Z",
"url": "https://files.pythonhosted.org/packages/b8/84/304ef81ed362c8d669448a909991b215eaaeadc5fbe51411b6bfe5a614ee/picca-9.16.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-26 07:16:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "igmhub",
"github_project": "picca",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
">=",
"2.0.0"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.14.0"
]
]
},
{
"name": "iminuit",
"specs": [
[
">=",
"2.26.0"
]
]
},
{
"name": "healpy",
"specs": [
[
">=",
"1.17.1"
]
]
},
{
"name": "fitsio",
"specs": [
[
">=",
"1.2.4"
]
]
},
{
"name": "llvmlite",
"specs": [
[
">=",
"0.43.0"
]
]
},
{
"name": "numba",
"specs": [
[
">=",
"0.60.0"
]
]
},
{
"name": "h5py",
"specs": [
[
">=",
"3.11.0"
]
]
},
{
"name": "future",
"specs": [
[
">=",
"1.0.0"
]
]
},
{
"name": "setuptools",
"specs": [
[
">=",
"69.5.1"
]
]
},
{
"name": "gitpython",
"specs": [
[
">=",
"3.1.43"
]
]
}
],
"lcname": "picca"
}