Installation
Requirements
At least Python 3.12 is required to run ComPyTools with the following packages, which will be installed automatically via the steps outlined in Using pip:
Astropy: for displaying data in tabular form and to attach metadata and units to the data. We also use physical constants defined within
astropy,lalsuite: for solving the Tolman-Oppenheimer-Volkoff equations in order to calculate neutron star static properties for a given quation of state,
Matplotlib: for plotting EoS data,
Pandas: for writing out tabulated data into text files,
pdg: for accessing particle masses via the Particle Data Group database,
requests: for downloading sample data,
Rich: for log output and tabulating metadata information,
Scipy: for performing numerical integration.
The optional package Jupyterlab is also available for those who wish to run ComPyTools via a notebook.
Additional libraries are also needed in order to build and install ComPyTools:
CompOSE: a set of Fortran routines for computing the interpolated tables. This is included as part of the
ComPyToolspackage,gfortran: compiler for the Fortran routines,
micromamba or conda: for creating the software environment within which to install
ComPyTools.tectonic: required for compiling the CompOSE latex datasheet and converting it into PDF format.
Using pip
The first step is to create an environment within which to install the minimum required version of Python and the software needed to build and install ComPyTools.
Note
You can use conda in the following steps if you already have it. However, micromamba is a faster, drop-in alternative to conda and works in the same way as conda. If you don’t already have micromamba installed on your machine, you can install it with the command "${SHELL}" <(curl -L micro.mamba.pm/install.sh) for MacOS and Linux systems. Further information can be found here. If you prefer to use conda then replace the command micromamba with conda in the instructions below.
Note
mamba is similar to micromamba except that it is installed as a separate package within the conda environment. micromamba, on the other hand, works independently from conda. If you have mamba installed, then you will need to replace the conda in the following commands with mamba.
To create the environment run the following command in your terminal:
Note
For some users you may need to first run source ~/.bashrc.
micromamba create -n compytools-env -c conda-forge python=3.12 cmake make gfortran tectonic
Note
For Mac users, you may need to append source to the start of the above command.
and then activate it with:
micromamba activate compytools-env
Note
When the environment is no longer needed it can be deactivated with micromamba deactivate.
Finally, ComPyTools can be installed with:
pip install compytools
which will also automatically compile the CompOSE software on your machine. If you wish to run ComPyTools or follow the tutorials presented in this documentation within a Jupyter lab notebook, you can install ComPyTools with
pip install compytools[jupyter]
Note
Jupyter lab can then be run from the command line with jupyter lab. This will open a web interface from which you can create a new notebook. See Jupyterlab for further details.
You can test the installation of ComPyTools by running the following command on your terminal:
python -c "import compytools"
For developers
For those who wish to make developments to the code, the repository can be cloned with
git clone --recursive https://gitlab.in2p3.fr/lpc-caen/compytools.git
and then enter the code directory with
cd compytools
The environment can be created and activated using
micromamba create -n compytools-env -c conda-forge python=3.12 cmake make gfortran tectonic
micromamba activate compytools-env
Finally, the package can be installed (with additional packages needed for developments) with
pip install -e .[dev]
To check that the installation proceeded correctly, the unit tests can be run with:
python -m pytest