Generation of bounded random walks and analysis thereof.
Random walk data is generated using C++
and analysed using Python 3
.
For detailed examples, please see examples.
The bounded_rand_walkers.cpp
sub-package contains compiled code for fast data generation, and a Python module meant for coordinating this process and reading (and binning) the resulting saved data files.
Within bounded_rand_walkers.cpp
:
generate_data
: Generate random walk data using one of a set of pre-defined pdfs in either 1D or 2D and a selection of pre-defined boundaries for 2D.get_binned_2D
: Iteratively load saved data files generated usinggenerate_data
, while aggregating the results using binning.
For required Python
packages (and both xtensor
and xtensor-python
which are required for the C++
code) see requirements.yaml
.
It is recommended to install the required packages into a new conda
environment using:
conda env create --file requirements.yaml
Followed by
pip install ./bounded-rand-walkers
where bounded-rand-walkers
refers to the directory containing this repository.
For the C++
code, the following dependencies are required:
xtensor
(installed viaconda
)xtensor-python
(installed viaconda
)nlopt
boost
On Linux, nlopt
and boost
can usually be installed using your package manager.
You may need to run ldconfig
post-installation.
Using Ubuntu
, for example, nlopt
and boost
can be installed using
sudo apt-get install libnlopt-cxx-dev libboost-all-dev
sudo ldconfig
Jupyter notebook extensions may be installed using the commands below.
jupyter nbextensions_configurator enable --user
JupyterLab ipywidgets:
conda install ipywidgets
jupyter nbextension enable --py widgetsnbextension
jupyter labextension install @jupyter-widgets/jupyterlab-manager
To install Jupyterlab Code Formatter (more details at (https://jupyterlab-code-formatter.readthedocs.io/en/latest/installation.html):
jupyter labextension install @ryantam626/jupyterlab_code_formatter
conda install -c conda-forge jupyterlab_code_formatter
jupyter serverextension enable --py jupyterlab_code_formatter
On Unix (Linux, OS X)
- clone this repository
pip install ./bounded-random-walkers
On Windows (Requires Visual Studio 2015)
-
For Python 3.5:
- clone this repository
pip install ./bounded-random-walkers
-
For earlier versions of Python, including Python 2.7:
xtensor requires a C++14 compliant compiler (i.e. Visual Studio 2015 on Windows). Running a regular
pip install
command will detect the version of the compiler used to build Python and attempt to build the extension with it. We must force the use of Visual Studio 2015.- clone this repository
"%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x64
set DISTUTILS_USE_SDK=1
set MSSdk=1
pip install ./bounded-random-walkers
Note that this requires the user building
bounded-random-walkers
to have registry edition rights on the machine, to be able to run thevcvarsall.bat
script.
On Windows, the Visual C++ 2015 redistributable packages are a runtime requirement for this project. It can be found here.
If you use the Anaconda python distribution, you may require the Visual Studio runtime as a platform-dependent runtime requirement for you package:
requirements:
build:
- python
- setuptools
- pybind11
run:
- python
- vs2015_runtime # [win]