hic

hic is a collection of Python modules for analyzing heavy-ion collision simulation data, e.g. calculating flow coefficients \(v_n\) and initial condition eccentricities \(\varepsilon_n\). It’s a community project designed to facilitate computational heavy-ion research and reduce code duplication.

hic is open source on github, and contributions are welcome!

Installation

Requirements: Python 2.7 or 3.3+ with numpy.

Install the latest release with pip:

pip install hic

To run the tests, install nose and run

nosetests -v hic

Simple examples

Here are a few quick examples of what hic can do.

Calculate flow cumulants:

from hic import flow

vnk = flow.Cumulant(mult, q2, q3)
v22 = vnk.flow(2, 2)

Randomly sample events with specified flows:

sampler = flow.Sampler(v2, v3)
phi = sampler.sample(mult)

Calculate initial condition eccentricities:

from hic import initial

ic = initial.IC(profile, dxy)
e2 = ic.ecc(2)

User guide

hic consists of several logically distinct modules. Each has a tutorial with examples and an API reference.

Note

The user guide is a work in progress, and some sections are incomplete. More examples and visualizations will be added over time.

Contributing

hic is a community project—all heavy-ion physicists are encouraged to contribute! Anything is welcome, from a small code snippet to a completely new module to an extra example for the docs. Here’s a short wish list:

  • flow cumulant statistical error
  • differential flow
  • input/output for common formats (e.g. UrQMD)
  • an HBT module
  • a heavy-flavor module

Submit contributions through the github fork & pull request system. Create a fork, clone it, and install hic in editable mode:

git clone git@github.com:USERNAME/hic.git
pip install --user -e hic

Please follow these general coding guidelines:

  • Mimic the existing code structure and style. If it makes logical sense, create a new module with tests and docs, e.g. a module hello should have source file hic/hello.py, tests hic/test/test_hello.py, and docs doc/hello.rst.

  • Write descriptive docstrings and examples. Docs are generated by sphinx.

  • Write high-coverage unit tests. Install nose and coverage, then the easiest way to simultaneously run tests and check coverage is

    nosetests -v --with-coverage --cover-package=hic
    
  • Follow the PEP 8 style guide. Check for errors with flake8.

  • Make topic branches and submit a pull request for each branch.