Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

OpenCosmo


CI PyPI - Version Conda Version GitHub License

The OpenCosmo Python Toolkit provides utilities for reading, writing and manipulating data from cosmological simulations produced by the Cosmolgical Physics and Advanced Computing (CPAC) group at Argonne National Laboratory. It can be used to work with smaller quantities data retrieved with the CosmoExplorer, as well as the much larget datasets these queries draw from. The OpenCosmo toolkit integrates with standard tools such as AstroPy, and allows you to manipulate data in a fully-consistent cosmological context.

Installation

The OpenCosmo library is available for Python 3.12 and up on Linux and MacOS (and Windows via WSL). It can be installed easily with pip:

pip install opencosmo

There's a good chance the default version of Python on your system is less than 3.12. Whether or not this is the case, we recommend installing opencosmo into a virtual environment. If you're using Conda, you can create a new environment and install opencosmo into it automatically:

conda create -n opencosmo_env conda-forge::opencosmo
conda activate opencosmo_env

or if you already have a virtual environment to use:

conda install conda-forge::opencosmo

If you plan to use opencosmo in a Jupyter notebook, you can install the ipykernel package to make the environment available as a kernel:

pip install ipykernel # can also be installed with conda
python -m ipykernel install --user --name=opencosmo

Be sure you have run the "activate" command shown above before running the ipykernel command.

Getting Started

To get started, download the "haloproperites.hdf5" from the OpenCosmo Google Drive. This file contains properties of dark-matter halos from a small hydrodynamical simulation run with HACC. You can easily open the data with the open command:

import opencosmo as oc

dataset = oc.open("haloproperties.hdf5")
print(dataset)
OpenCosmo Dataset (length=237441)
Cosmology: FlatLambdaCDM(name=None, H0=<Quantity 67.66 km / (Mpc s)>, Om0=0.3096446816186967, Tcmb0=<Quantity 0. K>, Neff=3.04, m_nu=None, Ob0=0.04897468161869667)
First 10 rows:
block fof_halo_1D_vel_disp fof_halo_center_x ... sod_halo_sfr unique_tag
             km / s               Mpc        ... solMass / yr
int32       float32             float32      ...   float32      int64
----- -------------------- ----------------- ... ------------ ----------
    0            32.088795         1.4680439 ...       -101.0      21674
    0             41.14525        0.19616994 ...       -101.0      44144
    0             73.82962         1.5071135 ...    3.1447952      48226
    0             31.17231         0.7526525 ...       -101.0      58472
    0            23.038841         5.3246417 ...       -101.0      60550
    0            37.071426         0.5153746 ...       -101.0     537760
    0            26.203058         2.1734374 ...       -101.0     542858
    0              78.7636         2.1477687 ...          0.0     548994
    0             37.12636         6.9660196 ...       -101.0     571540
    0             58.09235          6.072006 ...    1.5439711     576648

The open function returns a Dataset object, which can retrieve the relevant data from disk with a simple method call. It also holds metadata about the simulation, such as the comsology. You can easily access the data and cosmology as Astropy objects:

dataset.get_data()
dataset.cosmology

The first will return an astropy table of the data, with all associated units already applied. The second will return the astropy cosmology object that represents the cosmology the simulation was run with.

Basic Querying

Although you can access data directly, opencosmo provides tools for querying and transforming the data in a fully cosmology-aware context. For example, suppose we wanted to plot the concentration-mass relationship for the halos in our simulation above a certain mass. One way to perform this would be as follows:

dataset = dataset
    .filter(oc.col("fof_halo_mass") > 1e13)
    .take(1000, at="random")
    .select(("fof_halo_mass", "sod_halo_cdelta"))

print(dataset)
OpenCosmo Dataset (length=1000)
Cosmology: FlatLambdaCDM(name=None, H0=<Quantity 67.66 km / (Mpc s)>, Om0=0.3096446816186967, Tcmb0=<Quantity 0. K>, Neff=3.04, m_nu=None, Ob0=0.04897468161869667)
First 10 rows:
 fof_halo_mass   sod_halo_cdelta
    solMass
    float32          float32
---------------- ---------------
11220446000000.0       4.5797048
17266723000000.0       7.4097505
51242150000000.0       1.8738283
70097712000000.0       4.2764015
51028305000000.0        2.678151
11960567000000.0       3.9594727
15276915000000.0        5.793542
16002001000000.0       2.4318497
47030307000000.0       3.7146702
15839942000000.0        3.245569

We could then plot the data, or perform further transformations. This is cool on its own, but the real power of opencosmo comes from its ability to work with different data types. Go ahead and download the "haloparticles" file from the OpenCosmo Google Drive and try the following:

import opencosmo as oc

data = oc.open("haloproperties.hdf5", "haloparticles.hdf5")

This will return a data collection that will allow you to query and transform the data as before, but will associate the halos with their particles.

data = data
    .filter(oc.col("fof_halo_mass") > 1e13)
    .take(1000, at="random")

for halo in data.halos():
    halo_properties = halo["halo_properties"]
    dm_particles = halo["dm_particles"]
    star_particles = halo["star_particles"]

In each iteration, "halo properties" will be a dictionary containing the properties of the halo (such as its total mass), while "dm_particles" and "star_particles" will be OpenCosmo datasets containing the dark matter and stars associated with the halo, respectively. Because these are just like the dataset object we saw eariler, we can further query and transform the particles as needed for our analysis. For more details on how to use the library, check out the full documentation.

Testing

To run tests, first download the test data from Google Drive. Extract it into test_data/ at the repository root, or set OPENCOSMO_DATA_PATH to an extracted data directory elsewhere. See test/TEST_DATA.md for the expected layout. Then run the tests with pytest:

export OPENCOSMO_DATA_PATH=/path/to/data
# From the repository root
pytest --ignore test/parallel 

Although opencosmo does support multi-core processing via MPI, the default installation does not include the necessary dependencies to work in an MPI environment. If you need these capabilities, check out the guide in our documentation.

Contributing

We welcome bug reports and feature requests from the community. If you would like to contribute to the project, please check out the contributing guide for more information.

Citation

If you use OpenCosmo in your work, please cite the release paper in any publications:

@article{wells2026_opencosmo,
      title={OpenCosmo: Community Portal and Analysis Framework for Flagship Cosmological Simulations}, 
      author={Patrick R. Wells and Michael Buelhmann and Patricia Larsen and William M. Hicks and Manpreet Dhillon and Idunnuoluwa A. Adeniji and Katrin Heitmann and Salman Habib and Benoit Côté and Thomas Uram and Gideon McFarland and Andrew Hearin and Ezar Shinabro and Michael E. Papka},
      year={2026},
      eprint={2607.16059},
      archivePrefix={arXiv},
      primaryClass={astro-ph.IM},
      url={https://arxiv.org/abs/2607.16059}, 
}

Release files for opencosmo 1.4.0b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for opencosmo 1.4.0b2
File
opencosmo-1.4.0b2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details
opencosmo-1.4.0b2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ ARM64 Details
opencosmo-1.4.0b2-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
opencosmo-1.4.0b2-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details
opencosmo-1.4.0b2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
opencosmo-1.4.0b2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
opencosmo-1.4.0b2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
opencosmo-1.4.0b2-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
opencosmo-1.4.0b2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
opencosmo-1.4.0b2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
opencosmo-1.4.0b2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
opencosmo-1.4.0b2-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details

Total release size: 6.9 MB

Release files / opencosmo-1.4.0b2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL opencosmo-1.4.0b2-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 597.7 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
865d9e311725514329586a1ef473a0017a1cfe70bf2b7d870e479d58de4b4a56
BLAKE2b-256 checksum
How to use checksums
43815906ac2d6980f4f75390ee08620a3e41951b5731a3dd90e173f0529ed31f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL opencosmo-1.4.0b2-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 589.7 kB
Tags CPython 3.14 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
405d8485d9c1f589f11c56f89c750a8bb04dd2066ad0ddcf30cd43f193919b33
BLAKE2b-256 checksum
How to use checksums
e4e1faa2ef6fc8243e6a3dcd1463e0f6a7c8c0ac141b3f0dbe31cfa4ebcf1420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp314-cp314-macosx_11_0_arm64.whl

Download URL opencosmo-1.4.0b2-cp314-cp314-macosx_11_0_arm64.whl
Size 553.0 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c4ac0f09d27e99f143edb228a1fe4e90f81ca6182289124c3975ed3dae02bf18
BLAKE2b-256 checksum
How to use checksums
d97b26ccb944784eeb60711c8cd2372dafee436d4eb59bcadeb8ce6f50c21a1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp314-cp314-macosx_10_12_x86_64.whl

Download URL opencosmo-1.4.0b2-cp314-cp314-macosx_10_12_x86_64.whl
Size 557.9 kB
Tags CPython 3.14 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
46126901e0095afdea305e3c6d2ba521a818aabf3af5fc185f979a23125176c5
BLAKE2b-256 checksum
How to use checksums
7a456a9816ce4ecafbc9fdeade6cbf737f66db5d9b4516af4c0cab8764418699
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL opencosmo-1.4.0b2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 597.4 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c705b7181ab1018c171735d5c22643142458bc84b7f7d9a05d6ac77ef63d7402
BLAKE2b-256 checksum
How to use checksums
01f997eefa55cd1a9c570a0571ff3c992db56efcb23b27615e722176d188b35f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL opencosmo-1.4.0b2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 589.3 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
1e999653b5f6d562b0bd67b0017eb2f190dce593d0e5433091ed5d6daf525ca5
BLAKE2b-256 checksum
How to use checksums
f083c8eb40e18e319acaf6c3f09ee4756c95f5a1f8ce743340924cf6a45ff0c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp313-cp313-macosx_11_0_arm64.whl

Download URL opencosmo-1.4.0b2-cp313-cp313-macosx_11_0_arm64.whl
Size 551.8 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c993ddfa3a63e3af644ca95ca00d2ad38495befb8bddc81366a538388b0e0d6e
BLAKE2b-256 checksum
How to use checksums
5f8e438a88bc5e80d8ab608ed42aaeda63798360a46d0868dd9dc5a812e7c9d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp313-cp313-macosx_10_12_x86_64.whl

Download URL opencosmo-1.4.0b2-cp313-cp313-macosx_10_12_x86_64.whl
Size 557.2 kB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
12ac77a53b9cd3832509249e5819a1312b764a85363c94658e861cc779b39f83
BLAKE2b-256 checksum
How to use checksums
41392eda6d8336f0637c2de8baa5ebe45693e79e758f548bfb306ce655c57ba8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL opencosmo-1.4.0b2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 596.9 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7119717b88aa98a72016828d9d964ccefdbe9f4f27a56d224931245351e09eaf
BLAKE2b-256 checksum
How to use checksums
6ba0e31c59c47f9f8aa73e77521567f5c09daabe6aa0b9663bc44204233b5307
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL opencosmo-1.4.0b2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 588.9 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
36855704a3887a7ea0d116a9b9effe556b2310dbd779b35811026ffd343462c1
BLAKE2b-256 checksum
How to use checksums
c39e5e67d408732a476514135668517bb90d50f2be24bfa88b43fb612e483e6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp312-cp312-macosx_11_0_arm64.whl

Download URL opencosmo-1.4.0b2-cp312-cp312-macosx_11_0_arm64.whl
Size 551.4 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8bf9ebd233d782def9e2626f2ea4e3dad10f5a29166db5b19e2621a48b75293f
BLAKE2b-256 checksum
How to use checksums
0652cc29d5ec2afcaf2ae8c1cace2ea5e5f4e3057f1f04de3ac517b11dad4d8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / opencosmo-1.4.0b2-cp312-cp312-macosx_10_12_x86_64.whl

Download URL opencosmo-1.4.0b2-cp312-cp312-macosx_10_12_x86_64.whl
Size 556.7 kB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f122f258a47d9d784afb9f8f4a57ba8b877161c5b6300c898fc802ff23615250
BLAKE2b-256 checksum
How to use checksums
19e8b335caccf89eb8d7b26eacc9b17e5a8b4d773f6400c0252e11ffebd10be5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release history Release notifications | RSS feed

1.4.1

12 release files

1.4.0

12 release files

This release

1.4.0b2 This release

12 release files

1.3.9

12 release files

1.3.8

12 release files

1.3.7

12 release files

1.3.5

12 release files

1.3.1

12 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page