-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add notebook data file removal API, add sample plotting notebook, fix…
… jupyterhub URL sent to portal Signed-off-by: Lance-Drane <[email protected]>
- Loading branch information
1 parent
0ed658b
commit 11ef677
Showing
8 changed files
with
355 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ebc12009", | ||
"metadata": {}, | ||
"source": [ | ||
"# Next cell generated by IPS Framework" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "41186aa1", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"### This cell autogenerated by IPS Framework. DO NOT EDIT UNTIL IPS RUN IS FINALIZED. ###\n", | ||
"\n", | ||
"import os\n", | ||
"\n", | ||
"# NOTE: directory should be sim_name plus the run id from the Portal\n", | ||
"IPS_DATA_DIR = '/tmp/ipsframework/runs/localhost_5000/1/data/'\n", | ||
"# Uncomment below line to implicitly use any state files saved in the data directory, note that the IPS framework explicitly lists out each file used\n", | ||
"#IPS_STATE_FILES = os.listdir('data')\n", | ||
"# files created during the run\n", | ||
"IPS_STATE_FILES = [\n", | ||
"f'{IPS_DATA_DIR}1.0',\n", | ||
"f'{IPS_DATA_DIR}1.9666666666666668',\n", | ||
"f'{IPS_DATA_DIR}2.9333333333333336',\n", | ||
"f'{IPS_DATA_DIR}3.9',\n", | ||
"f'{IPS_DATA_DIR}4.866666666666667',\n", | ||
"f'{IPS_DATA_DIR}5.833333333333333',\n", | ||
"f'{IPS_DATA_DIR}6.8',\n", | ||
"f'{IPS_DATA_DIR}7.766666666666667',\n", | ||
"f'{IPS_DATA_DIR}8.733333333333334',\n", | ||
"f'{IPS_DATA_DIR}9.7',\n", | ||
"f'{IPS_DATA_DIR}10.666666666666666',\n", | ||
"f'{IPS_DATA_DIR}11.633333333333333',\n", | ||
"f'{IPS_DATA_DIR}12.6',\n", | ||
"f'{IPS_DATA_DIR}13.566666666666666',\n", | ||
"f'{IPS_DATA_DIR}14.533333333333333',\n", | ||
"f'{IPS_DATA_DIR}15.5',\n", | ||
"f'{IPS_DATA_DIR}16.46666666666667',\n", | ||
"f'{IPS_DATA_DIR}17.433333333333334',\n", | ||
"f'{IPS_DATA_DIR}18.4',\n", | ||
"f'{IPS_DATA_DIR}19.366666666666667',\n", | ||
"f'{IPS_DATA_DIR}20.333333333333332',\n", | ||
"f'{IPS_DATA_DIR}21.3',\n", | ||
"f'{IPS_DATA_DIR}22.266666666666666',\n", | ||
"f'{IPS_DATA_DIR}23.233333333333334',\n", | ||
"f'{IPS_DATA_DIR}24.2',\n", | ||
"f'{IPS_DATA_DIR}25.166666666666668',\n", | ||
"f'{IPS_DATA_DIR}26.133333333333333',\n", | ||
"f'{IPS_DATA_DIR}27.1',\n", | ||
"f'{IPS_DATA_DIR}28.066666666666666',\n", | ||
"f'{IPS_DATA_DIR}29.033333333333335',\n", | ||
"f'{IPS_DATA_DIR}30.0',\n", | ||
"]\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5d75faa3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Notebook template, the IPS Framework will add a cell before this one\n", | ||
"# defining IPS_STATE_FILES as a list of state file paths.\n", | ||
"\n", | ||
"# In this example, this notebook is only generated at the end of the run.\n", | ||
"\n", | ||
"# Bokeh is installed by default on the NERSC Jupyter environment, so works well for this example.\n", | ||
"from bokeh.io import output_notebook\n", | ||
"from bokeh.plotting import figure, show\n", | ||
"import json\n", | ||
"\n", | ||
"output_notebook()\n", | ||
"\n", | ||
"DATA = []\n", | ||
"# create DATA list, will depend on user input type (i.e. 'hdf5', 'json')\n", | ||
"for file in IPS_STATE_FILES:\n", | ||
" with open(file, 'rb') as f:\n", | ||
" DATA.append(json.load(f))\n", | ||
"x = [float(f.rpartition('/')[2]) for f in IPS_STATE_FILES]\n", | ||
"\n", | ||
"COLORS = ['red', 'green', 'blue']\n", | ||
"\n", | ||
"GRAPHS = [\n", | ||
" {'title': 'IPS full results', 'graph_format': 'line', 'data_paths': [['y1'], ['y2'], ['y3']]},\n", | ||
" {'title': 'IPS partial results', 'graph_format': 'line', 'data_paths': [['y1']]},\n", | ||
"]\n", | ||
"\n", | ||
"# get data function - will depend on user input (i.e. 'hdf5', 'json', etc.)\n", | ||
"def get_data(d, prop_path):\n", | ||
" data = d[prop_path[0]]\n", | ||
" for inner in prop_path[1:]:\n", | ||
" data = data[inner]\n", | ||
" return data\n", | ||
"\n", | ||
"# generate two simple line graphs from data\n", | ||
"for g in GRAPHS:\n", | ||
" paths = g['data_paths']\n", | ||
" \n", | ||
" graph = figure(title=g['title'])\n", | ||
" graph.xaxis.axis_label = 'IPS Timestep'\n", | ||
" graph.yaxis.axis_label = 'data values'\n", | ||
" \n", | ||
" for idx, prop in enumerate(paths):\n", | ||
" y = [get_data(d, prop) for d in DATA]\n", | ||
" graph.line(x, y, line_color=COLORS[idx % len(COLORS)], line_dash='solid', legend_label='_'.join(prop))\n", | ||
" show(graph)\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PYTHONPATH=$PWD PSCRATCH=${PSCRATCH:-/tmp} EXAMPLE_DELAY=true ips.py --config=sim.conf --platform=platform.conf --log=ips.log #--debug --verbose |
30 changes: 0 additions & 30 deletions
30
examples-proposed/004-time-loop/sim/input_dir/base-notebook-one-pass.ipynb
This file was deleted.
Oops, something went wrong.
File renamed without changes.
65 changes: 65 additions & 0 deletions
65
examples-proposed/004-time-loop/sim/input_dir/bokeh-plots.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5d75faa3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Notebook template, the IPS Framework will add a cell before this one\n", | ||
"# defining IPS_STATE_FILES as a list of state file paths.\n", | ||
"\n", | ||
"# In this example, this notebook is only generated at the end of the run.\n", | ||
"\n", | ||
"# Bokeh is installed by default on the NERSC Jupyter environment, so works well for this example.\n", | ||
"from bokeh.io import output_notebook\n", | ||
"from bokeh.plotting import figure, show\n", | ||
"import json\n", | ||
"\n", | ||
"output_notebook()\n", | ||
"\n", | ||
"DATA = []\n", | ||
"# create DATA list, will depend on user input type (i.e. 'hdf5', 'json')\n", | ||
"for file in IPS_STATE_FILES:\n", | ||
" with open(file, 'rb') as f:\n", | ||
" DATA.append(json.load(f))\n", | ||
"x = [float(f.rpartition('/')[2]) for f in IPS_STATE_FILES]\n", | ||
"\n", | ||
"COLORS = ['red', 'green', 'blue']\n", | ||
"\n", | ||
"GRAPHS = [\n", | ||
" {'title': 'IPS full results', 'graph_format': 'line', 'data_paths': [['y1'], ['y2'], ['y3']]},\n", | ||
" {'title': 'IPS partial results', 'graph_format': 'line', 'data_paths': [['y1']]},\n", | ||
"]\n", | ||
"\n", | ||
"# get data function - will depend on user input (i.e. 'hdf5', 'json', etc.)\n", | ||
"def get_data(d, prop_path):\n", | ||
" data = d[prop_path[0]]\n", | ||
" for inner in prop_path[1:]:\n", | ||
" data = data[inner]\n", | ||
" return data\n", | ||
"\n", | ||
"# generate two simple line graphs from data\n", | ||
"for g in GRAPHS:\n", | ||
" paths = g['data_paths']\n", | ||
" \n", | ||
" graph = figure(title=g['title'])\n", | ||
" graph.xaxis.axis_label = 'IPS Timestep'\n", | ||
" graph.yaxis.axis_label = 'data values'\n", | ||
" \n", | ||
" for idx, prop in enumerate(paths):\n", | ||
" y = [get_data(d, prop) for d in DATA]\n", | ||
" graph.line(x, y, line_color=COLORS[idx % len(COLORS)], line_dash='solid', legend_label='_'.join(prop))\n", | ||
" show(graph)\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.