Skip to content

Instantly share code, notes, and snippets.

@klarh
Last active January 30, 2020 00:34
Show Gist options
  • Save klarh/cced8b8f1a32a2656c5c0db85803a55b to your computer and use it in GitHub Desktop.
Save klarh/cced8b8f1a32a2656c5c0db85803a55b to your computer and use it in GitHub Desktop.
Example flowws-based workflow in a notebook

Launch a binder notebook with the button below:

Binder

povray
xvfb
libglu1-mesa
libgl1-mesa-dri
# specify dependencies for myblender.org operation (see also apt.txt
# for the full set)
channels:
- conda-forge
dependencies:
- fresnel
- pyglet
- pip
- pip:
- freud-analysis
- matplotlib
- pythreejs
- vispy
- pyriodic-aflow
- git+https://github.com/glotzerlab/plato@copy_from
- git+https://github.com/klarh/flowws
- git+https://github.com/klarh/flowws-analysis
- git+https://github.com/klarh/flowws-freud
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Overview\n",
"\n",
"This notebook demonstrates a very barebones structure analysis workflow using `flowws`. \n",
"\n",
"You'll need vispy installed and functional to see the vispy widgets. Note that vispy's implementation of jupyter widgets is not currently robust enough for us to be able to properly control their layout, but in theory we have somewhat detailed control over the display configuration of other types of widgets. Another option is to enable a desktop backend of vispy (`%gui qt5` and then `vispy.app.use_app('pyside2')`, for example) and vispy displays can pop up on your desktop."
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"# this cell can be used to get rid of some of the margins on the side of the notebook\n",
"from IPython.display import display, HTML\n",
"\n",
"display(HTML(data=\"\"\"\n",
"<style>\n",
" div#notebook-container { width: 98%; }\n",
" div#menubar-container { width: 65%; }\n",
" div#maintoolbar-container { width: 99%; }\n",
"</style>\n",
"\"\"\"))"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import flowws"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "860d42f8dcaf4896811e1e227b14833a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"GridBox(children=(VBox(children=(HTML(value='<center><b>Pyriodic</b></center>'), Dropdown(description='structu…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c95bd684be0c46ae8a68969199520ffe",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "798b7463ccac479abd03dd80a3d99374",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VispyWidget(height=600, width=800)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bf74c7117d0a436ca7f2422931927c0e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "236fa0ad5294467f81d0739064c942ea",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VispyWidget(height=300, width=300)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d3583d5aa327488e93d7f10347315396",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"flowws.Workflow.from_command(\"\"\"\n",
"Pyriodic -s tP30-CrFe -n 256 --noise 1e-2\n",
"Plato\n",
"SmoothBOD\n",
"flowws_freud.RDF --r-max 2\n",
"ViewNotebook\n",
"\"\"\".split()).run()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
#!/bin/bash
xvfb-run -a -s "-screen 0 1600x1200x24 +extension GLX +render +iglx" "${@}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment