kelpie
The kelpie galaxy groupfinder
Install
pip install kelpie-groupfinder
The package installs as kelpie-groupfinder but is imported as kelpie, and provides a
kelpie command. For development, clone the repository and run pip install -e ..
numba-kdtree is compiled from source on some platforms. If its build fails with missing
C++ headers (e.g. 'cstdlib' file not found), fix your compiler setup or install into a
fresh conda environment.
See examples/example_notebook.ipynb for a full walk-through
on a random mock catalogue.
Run from a config file
Copy and edit examples/example_config.yaml, then:
kelpie path/to/config.yaml # or: python -m kelpie path/to/config.yaml
This loads the catalogue, runs the finder and writes the membership and group-property
parquet files given in file_locations. With run_mock_comparison: True (and
column_names.group_id set) it also prints the S-score.
The same thing from Python: kelpie.run_from_config("config.yaml").
Run as a package
Everything goes through RedshiftCatalog:
from kelpie import RedshiftCatalog
cat = RedshiftCatalog(ra, dec, redshift, stellar_mass, completeness=completeness)
# or: RedshiftCatalog.from_file("cat.parquet", {"ra": "RAcen", "dec": "Deccen",
# "redshift": "Z", "stellar_mass": "stellar_mass"})
cat.set_cosmology(h=0.6751, omega_matter=0.3121) # optional: omega_baryon=, sigma8=, ns=
cat.set_free_parameters(alpha=6.0, beta=2.3, completeness_coefficient=0.33)
cat.set_shmr("Li") # or set_shmr("custom_constant", constant_ratio=100)
cat.set_centre_definition("iter_centre") # or "bcg"
cat.run()
cat.galaxy_groups # astropy Table: galaxy_id, kelpie_group_id
cat.groups # astropy Table: one row per group
cat.save("members.parquet", "groups.parquet")
All setters return the catalogue, so calls can be chained. Re-running after changing the free parameters reuses the distances, KD-tree and lookup grids, so tuning on a mock is cheap.
Optimising on a mock
optimise_on_mock tunes alpha and beta with scipy's Nelder-Mead to maximise the
S-score. Both are kept in 1.0-10.0 and rounded to 2 significant figures, starting from
the current values (6.0, 2.3 by default); completeness_coefficient is held fixed.
mock = RedshiftCatalog(ra, dec, z, sm, mock_group_ids=true_ids)
best = mock.optimise_on_mock()
best["alpha"], best["beta"], best["s_score"] # mock is left run at the best values
From a config, set run_options.optimise_on_mock: True (needs column_names.group_id);
the outputs are written using the optimised parameters.
The halo concentration-mass relation (colossus) needs a full cosmology. Beyond h and
omega_matter you can optionally pass omega_baryon (default 0.02226 / h²), sigma8
(default 0.8150) and ns (default 0.9653) to set_cosmology, or the same keys under
cosmology: in a config.
Stellar masses must be given in linear units of Msun/h (not log10). If your catalogue has
log masses, convert them first, e.g. stellar_mass=10**cat["logmstar"].
Tests
pip install -e ".[test]"
pytest
The cosmology and geometry helpers are checked against astropy, and the group finder is tested end to end on randomly generated mock catalogues. The first run takes a minute or so while numba compiles.
Metadata
Release files for kelpie-groupfinder 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kelpie_groupfinder-0.1.0.tar.gz | 48.9 kB | Without provenance | Details for kelpie_groupfinder-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kelpie_groupfinder-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for kelpie_groupfinder-0.1.0-py3-none-any.whl |
Total release size: 79.1 kB
Release files / kelpie_groupfinder-0.1.0.tar.gz
| Download URL | kelpie_groupfinder-0.1.0.tar.gz |
|---|---|
| Size | 48.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c882d021ffcef3a6b5dc013b37cc4683ca207f88e87b4a027ac3a8c8f06aa184
|
|
BLAKE2b-256 checksum How to use checksums |
c5da48effbfed443e5816db1d3eb3a9509a4fe5c8571ce78ee93272835ef5752
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.17
|
Release files / kelpie_groupfinder-0.1.0-py3-none-any.whl
| Download URL | kelpie_groupfinder-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3dc515bac1c11a9c3b0247c7d6e243716452677e36a48412b25e73fc27c13226
|
|
BLAKE2b-256 checksum How to use checksums |
b3762c93a8f8140f74e816c5e5d864493ebb8dbd4d53a134781cdffee0414f38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.17
|
Security for kelpie-groupfinder 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.