From b60f175f6e9509c0cb3aa333ccb80ce34c310265 Mon Sep 17 00:00:00 2001 From: juacrumar Date: Fri, 5 Jun 2020 10:13:17 +0200 Subject: [PATCH] add a mwe to the readme --- README.md | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b57b85f..b6207b2 100644 --- a/README.md +++ b/README.md @@ -28,16 +28,18 @@ The package can be installed with pip: python3 -m pip install vegasflow ``` -as well as with `conda`, from the `conda-forge` channel: +as well as `conda`, from the `conda-forge` channel: ``` conda install vegasflow -c conda-forge ``` -If you prefer a manual installation just use: +If you prefer a manual installation you can clone the repository and run: ``` +git clone https://github.com/N3PDF/vegasflow.git +cd vegasflow python setup.py install ``` -or if you are planning to extend or develop code just use: +or if you are planning to extend or develop the code just use: ``` python setup.py develop ``` @@ -46,6 +48,30 @@ python setup.py develop There are some examples in the `examples/` folder. +## Minimum Working Example +``` +import tensorflow as tf +from vegasflow.vflow import vegas_wrapper + +def integrand(x, **kwargs): + """ Function: + x_{1} * x_{2} ... * x_{n} + x: array of dimension (events, n) + """ + return tf.reduce_prod(x, axis=1) + +dimensions = 8 +iterations = 5 +events_per_iteration = int(1e5) +vegas_wrapper(integrand, dimensions, iterations, events_per_iteration, compilable=True) +``` + +For more complicated examples please see the [documentation](https://vegasflow.readthedocs.io/en/latest) +or the [examples](https://github.com/N3PDF/vegasflow/tree/master/examples) folder. + +Please feel free to [open an issue](https://github.com/N3PDF/vegasflow/issues/new) if you would like +some specific example or find any problems at all with the code or the documentation. + ## Citation policy If you use the package please cite the following paper and zenodo references: