Notebook integration

We will explain in this document how to use AllGO with a python notebook.

An example is available here : https://gitlab.inria.fr/allgo/notebooks/ndsafir

1. Install allgo module

A client library is available at https://pypi.org/project/allgo/

Install it with :

pip install allgo

2. Create an application

app = allgo.App('ndsafir', token="ead123baaef55412")

Note

token in optional, if you already provide your token with an env variable ALLGO_TOKEN or create a file ~/.allgo_token (without breakline)

3. Submit a job :

files = {'files[0]': open('tmp.png', 'rb')}
params = '-nopeaks 1 -2dt false -noise 0 -p 1 -bits 8 -iter 5 -adapt 0'
app.run(files=files, params=params)

In this example, we send one file ‘tmp.png’ and a string of parameters ‘params’. Run is blocking, when finish all files produce by A||Go are downloaded in the current directory. ndsafir application create a file output.png in that case, so display the result with :

import matplotlib.pyplot as plt
img = mpimg.imread('output.png')
plt.imshow(img)

Complex GUI

You will discover in this example more complex GUI with IPyWidgets

https://gitlab.inria.fr/allgo/notebooks/ndsafir/raw/master/images/illustration_interactif.png