Skip to content

Commit

Permalink
Add minimal example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
riemarc committed May 9, 2023
1 parent 3d25019 commit 4112bca
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
42 changes: 40 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
Jupyter widgets for scheduling processes and visualizing the resulting (live) data.
# Juts

**Ju**pyter widgets for scheduling processes and visualizing the resulting (live) data.
While it is designed to use custom data-specific visualizations based on
ipywidgets, visualizations for time series data (bqplot), animations
ipywidgets, visualizations for **t**ime **s**eries data (bqplot), animations
(matplotlib) and 3D data (ipyvolume) are included.

## Quickstart

To start a process a so called job has to be setup. A job consists of a python function and a configuration. The function contains the code (machine learning, simulation, ....) to be executed, for [example](juts/examples/minimal_example.ipynb):
```
def wait_n_times_x_ms(config, process_queue=None, return_dict=None):
n = config["parameter"]["n"]
x = config["parameter"]["x"]
time = list()
time_series = list()
for i in range(n):
time.append(i)
time_series.append(i / x)
process_queue.put(dict(progress=int(i/n * 100),
time=i,
time_series=i/x))
tim.sleep(x)
```
The configuration(s) can be read from a yaml file like [this](juts/examples/wait_n_times_x_ms.yml):
```
wait_40_times_100_ms:
parameter:
n: 40
x: 0.1
wait_10_times_300_ms:
parameter:
n: 10
x: 0.3
```
or can be defined as python dictionary.
[Screencast from 09.05.2023 13:35:58.webm](https://github.com/riemarc/juts/assets/18379817/e0aae907-8cf1-4958-9e8e-42dc5024e16a)
Also live data can be monitored during script execution:
[Screencast from 09.05.2023 13:37:38.webm](https://github.com/riemarc/juts/assets/18379817/bc3878a8-29fa-457f-b6f8-3287c849405e)
4 changes: 1 addition & 3 deletions juts/examples/minimal_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
},
"outputs": [],
"source": [
"import time\n",
"from juts import UserInterface, load_configs_from_file, TimeSeriesPlot\n",
"import time as tim"
]
Expand Down Expand Up @@ -41,8 +40,7 @@
" return_dict.update(dict(a=1,\n",
" b=2,\n",
" time=time,\n",
" time_series=time_series))\n",
" print(\"done\")"
" time_series=time_series))"
]
},
{
Expand Down

0 comments on commit 4112bca

Please sign in to comment.