Skip to main content

An object-oriented Python package for analysis of (cosmological) simulations performed with Arepo.

Project description

CircleCI pylint flake8 Documentation Status

Paicos

A somewhat bare-bones Python package for making projections and slices of Arepo simulations. Please note that while Paicos has its visibility set to public, it is still in beta mode and under active development.

Installation on your laptop

Warning Please do not try to pip install paicos. This is not yet supported and the mess that such an attempt creates will make the instructions below fail.

We clone the repo, pip install the requirements and then compile the code:

git clone git@github.com:tberlok/paicos.git
cd paicos
pip install -r requirements.txt
make

Assuming this succeeds, you will then need to add the paicos directory to your Python path, For instance, I have

export PYTHONPATH=$PYTHONPATH:/Users/berlok/projects/paicos

in my .bash_profile.

You can then check that everything works by doing

make checks

Note for installation on MacOs

Paicos requires a compiler with OpenMP support. I have installed gcc-12 via Homebrew and this is currently hardcoded in setup.py. You will have to manually modify setup.py if you do not have this compiler installed.

Installation for use with Jupyter notebooks on the AIP Newton cluster

First clone the repo onto the AIP newton cluster and then add the path to your .bash_profile (on the cluster!). I have, for instance,

export PYTHONPATH=$PYTHONPATH:/llust21/berlok/paicos

You might need to restart singularity in order for this change to the PYTHONPATH to be visible inside the jupyter notebooks.

Now compile the code from inside a notebook using bash magic (replace with path to your own clone of paicos):

%%bash

cd /llust21/berlok/paicos
make clean
make

Using the code

The examples require an Arepo snapshot. You can download one here (1 GB Dropbox link).

The main functionality is contained inside some main classes. These are:

  • Snapshot (arepo_snap.py)

  • Catalog (arepo_catalog.py)

  • Slicer (slicer.py)

  • Projector (projector.py)

  • NestedProjector (nested_projector.py)

  • ArepoImage (arepo_image.py)

  • PaicosWriter (paicos_writer.py)

  • PaicosReader (paicos_readers.py)

Each of these can by run in python, displaying their functionality, e.g.,

#### Basic features

# Simple example of loading a snapshot
python3 examples/loading_data_example.py

# Slicing
python3 examples/slicer_example.py

# Projections
python3 examples/projector_example.py
python3 examples/nested_projector_example.py

# Histograms
python3 examples/histogram1D_example.py
python3 examples/histogram2d_example.py

# Loading images
python3 examples/image_reader_example.py

# Creating radial profiles
python3 examples/create_radial_profiles_hdf5file_example.py
python3 examples/read_radial_profile_example.py

# Make a time series
python3 examples/paicos_time_series_example.py

# Select an index of a snapshot
python3 examples/select_subset_of_snap.py

#### Advanced features

# Setting up user-defined functions for obtaining derived variables
python3 examples/user_defined_functions_example.py

# Using a configuration script
python3 examples/using_a_paicos_config.py
python3 examples/example_paicos_config.py

# Saving a reduced snapshot file
python3 examples/save_reduced_file_example.py

# Using aliases
python3 examples/using_aliases_example.py

Tutorial Jupyter notebooks

I have uploaded a few tutorial notebooks in notebook-tutorials which displays the functionality.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

paicos-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.8 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

paicos-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.6 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page