UTA-REST / PyBoltz

This is a repository for PyBoltz, which is a Cython translation of Magboltz.
9 stars 11 forks source link

PyBoltz_Tests

PyBoltz

This software package is a translation of the Fortran based Magboltz code (Biagi, 2001) into Cython. This project was built to allow for more productive work to be done with magboltz.

General information.

About PyBoltz

PyBoltz is an electron swarm Monte Carlo package for calcualting transport parameters of electrons in different gas mixtures that are relevant to particle detectors.

To cite PyBoltz, and for more information:

Electron transport in gaseous detectors with a Python-based Monte Carlo simulation code
B. Al Atoum et al, Comp Phys Comm 254 (2020) 107357
https://www.sciencedirect.com/science/article/abs/pii/S0010465520301533

About Magboltz.

The Magboltz program computes drift gas properties by "numerically integrating the Boltzmann transport equation"-- i.e., simulating an electron bouncing around inside a gas. By tracking how far the virtual electron propagates, the program can compute the drift velocity. By including a magnetic field, the program can also calculate the Lorentz angle. Read more.

Why Cython?

Cython's static typing improves the speed of python code by about a hundred times. In other words, Cython provides us with the simplicity of python and the speed of Fortran/C. Read more.

Setting up and running instructions.

Setting up.

To be able to run this project you will need python3+, cython, and numpy installed. Our setup has python 3.6.7, Cython 0.29.3, and numpy 1.16.1.

First method.

For simple running purposes, one can simply install PyBoltz using the following command. Note: This method needs a new version of PIP.

python3 -m pip install --upgrade  git+https://github.com/UTA-REST/PyBoltz.git --user

Second method.

For developing purposes, follow the steps below.

Cloning.

Start off by simply cloning this repository.

Gasmix module.

Before building the code make sure to run the following command to install the PyGasMix module.

$ sudo pip3 install --upgrade  git+https://github.com/UTA-REST/PyGasMix --user

Notice If you are planning to develop upon the Gasmix module as well, you should be installing the PyGasMix module by following the steps in the repository link below. (steps detailed in the readme). PyGasMix.

Building.

Finally, to build the code, run the following command. This should compile all of the Cython files and add the path of the repository directory to your PYTHONPATH so you can access the libraries from anywhere. This will take a few minutes the first time.

$ source setup.sh

Please note that you might need to change the commands inside the setup.sh file to match your python version.

Running PyBoltz.

To run the code, you will need to import PyBoltz and instantiate an instance of the PyBoltz object, fill in the input parameters and call the PyBoltz.Start() function. There are examples in the Examples directory on to how to use PyBoltz. The main example is the Test_PyBoltz_NoWrapper.py code. This example also has a list of the gases in PyBoltz.

Input parameters.

Output parameters.

Please note that the following are only the main output parameters. One can still get any value from the parameters within the Magboltz class.

Compilation issues.

This sections is written here to help troubleshoot compilation issues. The following are links to the two main issues:

Gas list.

The current PyBoltz version has the following gases. Please note that the number of the gas is used as an indicator to that gas in the code.

Testing

To be able to run the tests for this module, you will need to have pytest installed on your machine. Also, you need to run the following to install the testing data package.

$ sudo pip3 install --upgrade  git+https://github.com/UTA-REST/PyBoltz_Test_Data --user

After doing so, go to the test directory and run the following.

$ pytest

This will run all the tests. If you are intrested in a single test, add the name of the testing python file to the end of the above command.

For more information on the testing data package, check the following repository. Testing Data Package.

Documentaion link

Documentaion....