{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Run the fusion EasyVVUQ campaign\n", "\n", "Run an EasyVVUQ campaign to analyze the sensitivity of the temperature\n", "profile predicted by a simplified model of heat conduction in a\n", "tokamak plasma.\n", "\n", "This is done with PCE." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T13:53:09.764208Z", "start_time": "2021-06-07T13:53:06.250480Z" }, "code_folding": [ 0 ] }, "outputs": [], "source": [ "# import packages that we will use\n", "\n", "import os\n", "import easyvvuq as uq\n", "import chaospy as cp\n", "import pickle\n", "import time\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib\n", "if not os.getenv(\"DISPLAY\"): matplotlib.use('Agg')\n", "import matplotlib.pylab as plt\n", "from IPython.display import display\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T13:53:09.917267Z", "start_time": "2021-06-07T13:53:09.765242Z" }, "code_folding": [ 0, 2, 4 ] }, "outputs": [], "source": [ "# we need fipy -- install if not already available\n", "\n", "try:\n", " import fipy\n", "except ModuleNotFoundError:\n", " ! pip install future\n", " ! pip install fipy\n", " import fipy" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T13:53:09.920997Z", "start_time": "2021-06-07T13:53:09.918734Z" }, "code_folding": [ 0, 2 ] }, "outputs": [], "source": [ "# routine to write out (if needed) the fusion .template file\n", "\n", "def write_template(params):\n", " str = \"\"\n", " first = True\n", " for k in params.keys():\n", " if first:\n", " str += '{\"%s\": \"$%s\"' % (k,k) ; first = False\n", " else:\n", " str += ', \"%s\": \"$%s\"' % (k,k)\n", " str += '}'\n", " print(str, file=open('fusion.template','w'))" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T13:53:09.925778Z", "start_time": "2021-06-07T13:53:09.922145Z" }, "code_folding": [ 0 ] }, "outputs": [], "source": [ "# define parameters of the fusion model\n", "def define_params():\n", " return {\n", " \"Qe_tot\": {\"type\": \"float\", \"min\": 1.0e6, \"max\": 50.0e6, \"default\": 2e6},\n", " \"H0\": {\"type\": \"float\", \"min\": 0.00, \"max\": 1.0, \"default\": 0},\n", " \"Hw\": {\"type\": \"float\", \"min\": 0.01, \"max\": 100.0, \"default\": 0.1},\n", " \"Te_bc\": {\"type\": \"float\", \"min\": 10.0, \"max\": 1000.0, \"default\": 100},\n", " \"chi\": {\"type\": \"float\", \"min\": 0.01, \"max\": 100.0, \"default\": 1},\n", " \"a0\": {\"type\": \"float\", \"min\": 0.2, \"max\": 10.0, \"default\": 1},\n", " \"R0\": {\"type\": \"float\", \"min\": 0.5, \"max\": 20.0, \"default\": 3},\n", " \"E0\": {\"type\": \"float\", \"min\": 1.0, \"max\": 10.0, \"default\": 1.5},\n", " \"b_pos\": {\"type\": \"float\", \"min\": 0.95, \"max\": 0.99, \"default\": 0.98},\n", " \"b_height\": {\"type\": \"float\", \"min\": 3e19, \"max\": 10e19, \"default\": 6e19},\n", " \"b_sol\": {\"type\": \"float\", \"min\": 2e18, \"max\": 3e19, \"default\": 2e19},\n", " \"b_width\": {\"type\": \"float\", \"min\": 0.005, \"max\": 0.025, \"default\": 0.01},\n", " \"b_slope\": {\"type\": \"float\", \"min\": 0.0, \"max\": 0.05, \"default\": 0.01},\n", " \"nr\": {\"type\": \"integer\", \"min\": 10, \"max\": 1000, \"default\": 100},\n", " \"dt\": {\"type\": \"float\", \"min\": 1e-3, \"max\": 1e3, \"default\": 100},\n", " \"out_file\": {\"type\": \"string\", \"default\": \"output.csv\"}\n", " }" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T13:53:09.931155Z", "start_time": "2021-06-07T13:53:09.926762Z" }, "code_folding": [ 0, 2, 17, 21, 28 ] }, "outputs": [], "source": [ "# define varying quantities\n", "def define_vary():\n", " vary_all = {\n", " \"Qe_tot\": cp.Uniform(1.8e6, 2.2e6),\n", " \"H0\": cp.Uniform(0.0, 0.2),\n", " \"Hw\": cp.Uniform(0.1, 0.5),\n", " \"chi\": cp.Uniform(0.8, 1.2),\n", " \"Te_bc\": cp.Uniform(80.0, 120.0),\n", " \"a0\": cp.Uniform(0.9, 1.1),\n", " \"R0\": cp.Uniform(2.7, 3.3),\n", " \"E0\": cp.Uniform(1.4, 1.6),\n", " \"b_pos\": cp.Uniform(0.95, 0.99),\n", " \"b_height\": cp.Uniform(5e19, 7e19),\n", " \"b_sol\": cp.Uniform(1e19, 3e19),\n", " \"b_width\": cp.Uniform(0.015, 0.025),\n", " \"b_slope\": cp.Uniform(0.005, 0.020)\n", " }\n", " vary_2 = {\n", " \"Qe_tot\": cp.Uniform(1.8e6, 2.2e6),\n", " \"Te_bc\": cp.Uniform(80.0, 120.0)\n", " }\n", " vary_5 = {\n", " \"Qe_tot\": cp.Uniform(1.8e6, 2.2e6),\n", " \"H0\": cp.Uniform(0.0, 0.2),\n", " \"Hw\": cp.Uniform(0.1, 0.5),\n", " \"chi\": cp.Uniform(0.8, 1.2),\n", " \"Te_bc\": cp.Uniform(80.0, 120.0)\n", " }\n", " vary_10 = {\n", " \"Qe_tot\": cp.Uniform(1.8e6, 2.2e6),\n", " \"H0\": cp.Uniform(0.0, 0.2),\n", " \"Hw\": cp.Uniform(0.1, 0.5),\n", " \"chi\": cp.Uniform(0.8, 1.2),\n", " \"Te_bc\": cp.Uniform(80.0, 120.0),\n", " \"b_pos\": cp.Uniform(0.95, 0.99),\n", " \"b_height\": cp.Uniform(5e19, 7e19),\n", " \"b_sol\": cp.Uniform(1e19, 3e19),\n", " \"b_width\": cp.Uniform(0.015, 0.025),\n", " \"b_slope\": cp.Uniform(0.005, 0.020)\n", " }\n", " return vary_5" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T13:53:09.935300Z", "start_time": "2021-06-07T13:53:09.932352Z" }, "code_folding": [ 0 ] }, "outputs": [], "source": [ "# define a model to run the fusion code directly from python, expecting a dictionary and returning a dictionary\n", "def run_fusion_model(input):\n", " import json\n", " import fusion\n", " qois = [\"te\", \"ne\", \"rho\", \"rho_norm\"]\n", " del input['out_file']\n", " return {q: v for q,v in zip(qois, [t.tolist() for t in fusion.solve_Te(**input, plots=False, output=False)])}" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T13:53:09.944308Z", "start_time": "2021-06-07T13:53:09.936384Z" }, "code_folding": [ 0 ] }, "outputs": [], "source": [ "# routine to run a PCE campaign\n", "\n", "def run_pce_case(pce_order=2, local=True, dask=True, batch_size=os.cpu_count(), use_files=True):\n", " \"\"\"\n", " Inputs:\n", " pce_order: order of the PCE expansion\n", " local: if using Dask, whether to use the local option (True)\n", " dask: whether to use dask (True)\n", " batch_size: for the non Dask option, number of cases to run in parallel (16)\n", " Outputs:\n", " results_df: Pandas dataFrame containing inputs to and output from the model\n", " results: Results of the PCE analysis\n", " times: Information about the elapsed time for the various phases of the calculation\n", " pce_order: pce_order \n", " count: number of PCE samples\n", " \"\"\"\n", " \n", " if dask:\n", " if local:\n", " print('Running locally')\n", " import multiprocessing.popen_spawn_posix\n", " from dask.distributed import Client, LocalCluster\n", " cluster = LocalCluster(threads_per_worker=1)\n", " client = Client(cluster) # processes=True, threads_per_worker=1)\n", " else:\n", " print('Running using SLURM')\n", " from dask.distributed import Client\n", " from dask_jobqueue import SLURMCluster\n", " cluster = SLURMCluster(\n", " job_extra=['--qos=p.tok.openmp.2h', '--mail-type=end', '--mail-user=dpc@rzg.mpg.de', '-t 2:00:00'], \n", " queue='p.tok.openmp', \n", " cores=8, \n", " memory='8 GB',\n", " processes=8)\n", " cluster.scale(32)\n", " print(cluster)\n", " print(cluster.job_script())\n", " client = Client(cluster)\n", " print(client)\n", "\n", " else:\n", " import concurrent.futures\n", "# client = concurrent.futures.ProcessPoolExecutor(max_workers=batch_size)\n", " client = concurrent.futures.ThreadPoolExecutor(max_workers=batch_size)\n", "# client = None\n", " \n", " times = np.zeros(7)\n", "\n", " time_start = time.time()\n", " time_start_whole = time_start\n", " # Set up a fresh campaign called \"fusion_pce.\"\n", " my_campaign = uq.Campaign(name='fusion_pce.') \n", "\n", " # Define parameter space\n", " params = define_params()\n", "\n", " # Create an encoder and decoder for PCE test app\n", " if use_files:\n", " encoder = uq.encoders.GenericEncoder(template_fname='fusion.template',\n", " delimiter='$',\n", " target_filename='fusion_in.json')\n", "\n", "\n", " decoder = uq.decoders.SimpleCSV(target_filename=\"output.csv\",\n", " output_columns=[\"te\", \"ne\", \"rho\", \"rho_norm\"])\n", "\n", " execute = uq.actions.ExecuteLocal('python3 %s/fusion_model.py fusion_in.json' % (os.getcwd()))\n", "\n", " actions = uq.actions.Actions(uq.actions.CreateRunDirectory('/tmp'), \n", " uq.actions.Encode(encoder), execute, uq.actions.Decode(decoder))\n", " else:\n", " actions = uq.actions.Actions(uq.actions.ExecutePython(run_fusion_model))\n", "\n", "\n", " # Add the app (automatically set as current app)\n", " my_campaign.add_app(name=\"fusion\", params=params, actions=actions)\n", "\n", " time_end = time.time()\n", " times[1] = time_end-time_start\n", " print('Time for phase 1 = %.3f' % (times[1]))\n", "\n", " time_start = time.time()\n", " # Associate a sampler with the campaign\n", " my_campaign.set_sampler(uq.sampling.PCESampler(vary=define_vary(), polynomial_order=pce_order))\n", " my_campaign.draw_samples()\n", " print('Number of samples = %s' % my_campaign.get_active_sampler().count)\n", "\n", " time_end = time.time()\n", " times[2] = time_end-time_start\n", " print('Time for phase 2 = %.3f' % (times[2]))\n", "\n", " time_start = time.time()\n", " # Perform the actions\n", " my_campaign.execute(pool=client).collate(progress_bar=True)\n", "\n", " if dask:\n", " client.close()\n", " client.shutdown()\n", "\n", " time_end = time.time()\n", " times[3] = time_end-time_start\n", " print('Time for phase 3 = %.3f' % (times[3]))\n", "\n", " time_start = time.time()\n", " # Collate the results\n", " results_df = my_campaign.get_collation_result()\n", "\n", " time_end = time.time()\n", " times[4] = time_end-time_start\n", " print('Time for phase 4 = %.3f' % (times[4]))\n", "\n", " time_start = time.time()\n", " # Post-processing analysis\n", " results = my_campaign.analyse(qoi_cols=[\"te\", \"ne\", \"rho\", \"rho_norm\"])\n", "\n", " time_end = time.time()\n", " times[5] = time_end-time_start\n", " print('Time for phase 5 = %.3f' % (times[5]))\n", "\n", " time_start = time.time()\n", " # Save the results\n", " pickle.dump(results, open('fusion_results.pickle','bw'))\n", " time_end = time.time()\n", " times[6] = time_end-time_start\n", " print('Time for phase 6 = %.3f' % (times[6]))\n", "\n", " times[0] = time_end - time_start_whole\n", "\n", " return results_df, results, times, pce_order, my_campaign.get_active_sampler().count" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T13:53:09.958612Z", "start_time": "2021-06-07T13:53:09.945487Z" }, "code_folding": [ 0, 2, 21, 40, 52, 66, 78 ] }, "outputs": [], "source": [ "# routines for plotting the results\n", "\n", "def plot_Te(results, title=None):\n", " # plot the calculated Te: mean, with std deviation, 1, 10, 90 and 99%\n", " plt.figure()\n", " rho = results.describe('rho', 'mean')\n", " plt.plot(rho, results.describe('te', 'mean'), 'b-', label='Mean')\n", " plt.plot(rho, results.describe('te', 'mean')-results.describe('te', 'std'), 'b--', label='+1 std deviation')\n", " plt.plot(rho, results.describe('te', 'mean')+results.describe('te', 'std'), 'b--')\n", " plt.fill_between(rho, results.describe('te', 'mean')-results.describe('te', 'std'), results.describe('te', 'mean')+results.describe('te', 'std'), color='b', alpha=0.2)\n", " plt.plot(rho, results.describe('te', '10%'), 'b:', label='10 and 90 percentiles')\n", " plt.plot(rho, results.describe('te', '90%'), 'b:')\n", " plt.fill_between(rho, results.describe('te', '10%'), results.describe('te', '90%'), color='b', alpha=0.1)\n", " plt.fill_between(rho, results.describe('te', '1%'), results.describe('te', '99%'), color='b', alpha=0.05)\n", " plt.legend(loc=0)\n", " plt.xlabel('rho [$m$]')\n", " plt.ylabel('Te [$eV$]')\n", " if not title is None: plt.title(title)\n", " plt.savefig('Te.png')\n", " plt.savefig('Te.pdf')\n", "\n", "def plot_ne(results, title=None):\n", " # plot the calculated ne: mean, with std deviation, 1, 10, 90 and 99%\n", " plt.figure()\n", " rho = results.describe('rho', 'mean')\n", " plt.plot(rho, results.describe('ne', 'mean'), 'b-', label='Mean')\n", " plt.plot(rho, results.describe('ne', 'mean')-results.describe('ne', 'std'), 'b--', label='+1 std deviation')\n", " plt.plot(rho, results.describe('ne', 'mean')+results.describe('ne', 'std'), 'b--')\n", " plt.fill_between(rho, results.describe('ne', 'mean')-results.describe('ne', 'std'), results.describe('ne', 'mean')+results.describe('ne', 'std'), color='b', alpha=0.2)\n", " plt.plot(rho, results.describe('ne', '10%'), 'b:', label='10 and 90 percentiles')\n", " plt.plot(rho, results.describe('ne', '90%'), 'b:')\n", " plt.fill_between(rho, results.describe('ne', '10%'), results.describe('ne', '90%'), color='b', alpha=0.1)\n", " plt.fill_between(rho, results.describe('ne', '1%'), results.describe('ne', '99%'), color='b', alpha=0.05)\n", " plt.legend(loc=0)\n", " plt.xlabel('rho [$m$]')\n", " plt.ylabel('ne [$m^{-3}$]')\n", " if not title is None: plt.title(title)\n", " plt.savefig('ne.png')\n", " plt.savefig('ne.pdf')\n", "\n", "def plot_sobols_first(results, title=None, field='te'):\n", " # plot the first Sobol results\n", " plt.figure()\n", " rho = results.describe('rho', 'mean')\n", " for k in results.sobols_first()[field].keys(): plt.plot(rho, results.sobols_first()[field][k], label=k)\n", " plt.legend(loc=0)\n", " plt.xlabel('rho [$m$]')\n", " plt.ylabel('sobols_first')\n", " if not title is None: plt.title(field + ': ' + title)\n", " plt.savefig('sobols_first_%s.png' % (field))\n", " plt.savefig('sobols_first_%s.pdf' % (field))\n", "\n", "def plot_sobols_second(results, title=None, field='te'):\n", " # plot the second Sobol results\n", " plt.figure()\n", " rho = results.describe('rho', 'mean')\n", " for k1 in results.sobols_second()[field].keys():\n", " for k2 in results.sobols_second()[field][k1].keys():\n", " plt.plot(rho, results.sobols_second()[field][k1][k2], label=k1+'/'+k2)\n", " plt.legend(loc=0, ncol=2)\n", " plt.xlabel('rho [$m$]')\n", " plt.ylabel('sobols_second')\n", " if not title is None: plt.title(field + ': ' + title)\n", " plt.savefig('sobols_second_%s.png' % (field))\n", " plt.savefig('sobols_second_%s.pdf' % (field))\n", "\n", "def plot_sobols_total(results, title=None, field='te'):\n", " # plot the total Sobol results\n", " plt.figure()\n", " rho = results.describe('rho', 'mean')\n", " for k in results.sobols_total()[field].keys(): plt.plot(rho, results.sobols_total()[field][k], label=k)\n", " plt.legend(loc=0)\n", " plt.xlabel('rho [$m$]')\n", " plt.ylabel('sobols_total')\n", " if not title is None: plt.title(field + ': ' + title)\n", " plt.savefig('sobols_total_%s.png' % (field))\n", " plt.savefig('sobols_total_%s.pdf' % (field))\n", "\n", "def plot_distribution(results, results_df, title=None):\n", " te_dist = results.raw_data['output_distributions']['te']\n", " rho_norm = results.describe('rho_norm', 'mean')\n", " plt.subplots(3,3,figsize=(12,12))\n", " ip=0\n", " for i in [np.maximum(0, int(i-1)) \n", " for i in np.linspace(0,1,9) * rho_norm.shape]:\n", " ip += 1\n", " plt.subplot(3,3,ip)\n", " pdf_raw_samples = cp.GaussianKDE(results_df.te[i])\n", " pdf_kde_samples = cp.GaussianKDE(te_dist.samples[i])\n", " plt.hist(results_df.te[i], density=True, bins=50, label='histogram of raw samples', alpha=0.25)\n", " if hasattr(te_dist, 'samples'):\n", " plt.hist(te_dist.samples[i], density=True, bins=50, label='histogram of kde samples', alpha=0.25)\n", "\n", " plt.plot(np.linspace(pdf_raw_samples.lower, pdf_raw_samples.upper), pdf_raw_samples.pdf(np.linspace(pdf_raw_samples.lower, pdf_raw_samples.upper)), label='PDF (raw samples)')\n", " plt.plot(np.linspace(pdf_kde_samples.lower, pdf_kde_samples.upper), pdf_kde_samples.pdf(np.linspace(pdf_kde_samples.lower, pdf_kde_samples.upper)), label='PDF (kde samples)')\n", "\n", " plt.legend(loc=0)\n", " plt.xlabel('Te [$eV$]')\n", " plt.title('Distributions for rho_norm = %0.4f' % (rho_norm[i]))\n", " plt.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.925, wspace=0.4, hspace=0.3)\n", " if not title is None: plt.suptitle(title)\n", " plt.savefig('distribution_function.png')\n", " plt.savefig('distribution_function.pdf')" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T14:23:21.421577Z", "start_time": "2021-06-07T13:53:09.961661Z" }, "code_folding": [ 0 ], "scrolled": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\r", " 0%| | 0/32 [00:00, ?it/s]" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Time for phase 1 = 0.027\n", "Number of samples = 32\n", "Time for phase 2 = 0.085\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 32/32 [00:00<00:00, 44.56it/s]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Time for phase 3 = 0.733\n", "Time for phase 4 = 0.021\n", "Time for phase 5 = 0.655\n", "Time for phase 6 = 0.145\n", "Time for phase 1 = 0.046\n", "Number of samples = 243\n", "Time for phase 2 = 0.291\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 243/243 [00:04<00:00, 49.13it/s]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Time for phase 3 = 5.190\n", "Time for phase 4 = 0.051\n", "Time for phase 5 = 1.520\n", "Time for phase 6 = 0.135\n", "Time for phase 1 = 0.028\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\r", " 0%| | 0/1024 [00:00, ?it/s]" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Number of samples = 1024\n", "Time for phase 2 = 0.913\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 1024/1024 [00:21<00:00, 46.98it/s]\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Time for phase 3 = 21.977\n", "Time for phase 4 = 0.234\n", "Time for phase 5 = 4.137\n", "Time for phase 6 = 0.111\n", "Time for phase 1 = 0.030\n", "Number of samples = 3125\n", "Time for phase 2 = 2.335\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 3125/3125 [01:11<00:00, 43.88it/s] \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Time for phase 3 = 71.623\n", "Time for phase 4 = 0.649\n", "Time for phase 5 = 21.128\n", "Time for phase 6 = 0.156\n", "Time for phase 1 = 0.069\n", "Number of samples = 7776\n", "Time for phase 2 = 5.358\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 7776/7776 [03:01<00:00, 42.87it/s] \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Time for phase 3 = 182.221\n", "Time for phase 4 = 1.747\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/Volumes/Samsung8TB/dpc/GIT/EasyVVUQ/env/lib/python3.9/site-packages/chaospy/descriptives/correlation/pearson.py:45: RuntimeWarning: invalid value encountered in sqrt\n", " vvar = numpy.sqrt(numpy.outer(var, var))\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Time for phase 5 = 123.831\n", "Time for phase 6 = 0.269\n", "Time for phase 1 = 0.030\n", "Number of samples = 16807\n", "Time for phase 2 = 11.672\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 16807/16807 [05:50<00:00, 47.89it/s] \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Time for phase 3 = 352.679\n", "Time for phase 4 = 3.640\n", "Time for phase 5 = 997.286\n", "Time for phase 6 = 0.393\n" ] } ], "source": [ "# Calculate the polynomial chaos expansion for a range of orders\n", "\n", "if __name__ == '__main__':\n", " local = False # if True, use local cores; if False, use SLURM\n", " dask = False # if True, use DASK; if False, use a fall-back non-DASK option\n", "\n", " R = {}\n", " for pce_order in range(1, 7):\n", " R[pce_order] = {}\n", " (R[pce_order]['results_df'], \n", " R[pce_order]['results'], \n", " R[pce_order]['times'], \n", " R[pce_order]['order'], \n", " R[pce_order]['number_of_samples']) = run_pce_case(pce_order=pce_order, \n", " local=local, dask=dask, \n", " batch_size=7, use_files=False)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T14:23:22.867338Z", "start_time": "2021-06-07T14:23:21.423543Z" }, "code_folding": [ 0 ] }, "outputs": [], "source": [ "# save the results\n", "\n", "if __name__ == '__main__':\n", "\n", " pickle.dump(R, open('collected_results.pickle','bw'))" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2021-06-07T14:23:22.897977Z", "start_time": "2021-06-07T14:23:22.868308Z" }, "code_folding": [ 0 ], "scrolled": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | Total | \n", "Phase 1 | \n", "Phase 2 | \n", "Phase 3 | \n", "Phase 4 | \n", "Phase 5 | \n", "Phase 6 | \n", "
---|---|---|---|---|---|---|---|
1 | \n", "1.665018 | \n", "0.027074 | \n", "0.084517 | \n", "0.732781 | \n", "0.020903 | \n", "0.654745 | \n", "0.144641 | \n", "
2 | \n", "7.234927 | \n", "0.046289 | \n", "0.291468 | \n", "5.190283 | \n", "0.050776 | \n", "1.520199 | \n", "0.135249 | \n", "
3 | \n", "27.401882 | \n", "0.027880 | \n", "0.913058 | \n", "21.977193 | \n", "0.233972 | \n", "4.137321 | \n", "0.111374 | \n", "
4 | \n", "95.922507 | \n", "0.029644 | \n", "2.335389 | \n", "71.622576 | \n", "0.649332 | \n", "21.128352 | \n", "0.156228 | \n", "
5 | \n", "313.505863 | \n", "0.069170 | \n", "5.357702 | \n", "182.220789 | \n", "1.747490 | \n", "123.831224 | \n", "0.268866 | \n", "
6 | \n", "1365.700972 | \n", "0.030445 | \n", "11.672170 | \n", "352.678623 | \n", "3.639645 | \n", "997.285757 | \n", "0.392905 | \n", "