diff --git a/CAD_Engine.ipynb b/CAD_Engine.ipynb index a3fd59e..58f4bf0 100644 --- a/CAD_Engine.ipynb +++ b/CAD_Engine.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 65, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -20,13 +20,14 @@ "from decimal import Decimal, getcontext, ROUND_DOWN\n", "TWOPLACES = Decimal(10) ** -2 # same as Decimal('0.01')\n", "import pandas as pd\n", + "import pprint\n", "# getcontext().prec=None\n", "# getcontext().rounding = ROUND_DOWN" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 85, "metadata": {}, "outputs": [], "source": [ @@ -52,8 +53,10 @@ "def env_proc(trigger_step, update_f):\n", " def env_step_trigger(trigger_step, update_f, step):\n", " if step == trigger_step:\n", + " print('trigered: '+step)\n", " return update_f\n", " else:\n", + " print('NOT trigered: '+step)\n", " return lambda x: x\n", " return partial(env_step_trigger, trigger_step, update_f)\n", "\n", @@ -74,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 86, "metadata": {}, "outputs": [], "source": [ @@ -85,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 99, "metadata": {}, "outputs": [], "source": [ @@ -98,35 +101,33 @@ "\n", "# UI Behaviors per Mechanism\n", "def b1m1(step, sL, s):\n", - " return s['s1']\n", + " return s['s1'] + 1\n", "def b2m1(step, sL, s):\n", - " return s['s1'] * s['s2']\n", + " return s['s1'] + 1\n", "\n", "def b1m2(step, sL, s):\n", - " return s['s1']\n", + " return s['s1'] + 1\n", "def b2m2(step, sL, s):\n", - " return s['s1'] / s['s2']\n", + " return s['s1'] + 1\n", "\n", "def b1m3(step, sL, s):\n", - " return s['s1'] + seed['z'].randint(1000)\n", + " return s['s1'] + 1\n", "def b2m3(step, sL, s):\n", - " ps = retrieve_state(sL, -3)\n", - " return ps['s2']\n", + " return s['s2'] + 1\n", "\n", "# UI Internal States per Mechanism\n", "def s1m1(step, sL, s, _input):\n", - "# print(s['s1'])\n", " s['s1'] = s['s1'] + _input\n", "def s2m1(step, sL, s, _input):\n", - " s['s2'] = s['s2'] + 1 + _input\n", + " s['s2'] = s['s2'] + _input\n", "\n", "def s1m2(step, sL, s, _input):\n", " s['s1'] = s['s1'] + _input\n", "def s2m2(step, sL, s, _input):\n", - " s['s2'] = s['s2']\n", + " s['s2'] = s['s2'] + _input\n", " \n", "def s1m3(step, sL, s, _input):\n", - " s['s1'] = s['s1']\n", + " s['s1'] = s['s1'] + _input\n", "def s2m3(step, sL, s, _input):\n", " s['s2'] = s['s2'] + _input\n", "\n", @@ -144,22 +145,26 @@ "# add env process f(s) read from time es\n", "# funcs execute in order\n", "def env_a(x): \n", - " return x + 1\n", + " return -1\n", "def env_b(x): \n", - " return x + 2\n", + " return -1\n", " \n", "def what_ever(x): \n", " return x + 1\n", "\n", "# Genesis States \n", "state_dict = {\n", - " 's1': Decimal(2.0),\n", - " 's2': Decimal(4.0),\n", - " 's3': Decimal(0.0),\n", - " 's4': Decimal(0.0),\n", + " 's1': Decimal(0.0),\n", + " 's2': Decimal(0.0),\n", + " 's3': Decimal(1.0),\n", + " 's4': Decimal(1.0),\n", " 'timestamp': '2018-10-01 15:16:24'\n", "}\n", "\n", + "# simulation = {\n", + "# \"s3\": es3p1\n", + "# }\n", + "\n", "exogenous_states = {\n", " \"s3\": es3p1,\n", " \"s4\": es4p2,\n", @@ -169,8 +174,8 @@ "# Update time at the end of each pipeline (once per 'block')\n", "# Enable the acceptance of user defined time\n", "env_processes = {\n", - " \"s3\": env_proc(1, env_a),\n", - " \"s4\": env_proc(1, pipe | env_b | what_ever)\n", + " \"s3\": env_proc('2018-10-01 15:16:25', env_a),\n", + " \"s4\": env_proc('2018-10-01 15:16:25', env_b)\n", "}\n", " \n", "mechanisms = {\n", @@ -209,7 +214,7 @@ }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 100, "metadata": {}, "outputs": [], "source": [ @@ -241,7 +246,6 @@ "# return state_dict\n", " \n", "def mech_step(m_step, sL, state_funcs, behavior_funcs, env_processes, t_step):\n", - " # Purge Memory accociated with certain objs\n", " # Truncate reffs\n", " in_copy, mutatable_copy, out_copy = deepcopy(sL), deepcopy(sL), deepcopy(sL)\n", " last_in_obj, last_mut_obj = in_copy[-1], mutatable_copy[-1]\n", @@ -249,13 +253,8 @@ " # * force eval of _input withing state functions\n", " _input = getBehaviorInput(m_step, sL, last_in_obj, behavior_funcs)\n", "\n", - " apply_env_proc(env_processes, last_mut_obj, t_step)\n", - " \n", - "# print(last_mut_obj)\n", - " \n", - "# non_numeric = {k: v for k, v in last_mut_obj.items() if type(v) != Decimal}\n", - "# last_mut_obj = {k: round_down(v) for k, v in last_mut_obj.items() if type(v) == Decimal}\n", - "# last_mut_obj.update(non_numeric)\n", + " apply_env_proc(env_processes, last_mut_obj, last_mut_obj['timestamp'])\n", + "# apply_env_proc(env_processes, last_mut_obj, t_step)\n", "\n", " for f in state_funcs:\n", " f(m_step, sL, last_mut_obj, _input)\n", @@ -277,9 +276,9 @@ " for config in configs:\n", " s_conf, b_conf = config[0], config[1]\n", " states_list = mech_step(m_step, states_list, s_conf, b_conf, env_processes, t_step) \n", - " m_step += 1\n", + " m_step += 1 \n", " \n", - " t_step += 1 \n", + " t_step += 1\n", " \n", " return states_list\n", "\n", @@ -291,67 +290,136 @@ " head, *pipeline_run = pipeline_run\n", " simulation_list.append(pipeline_run)\n", " \n", - " # should only occur once for genesis state, placed before loop\n", - " head, *tail = simulation_list\n", - " head[-1]['mech_step'], head[-1]['time_step'] = 0, 0\n", - " simulation_list = [head] + tail\n", - " return simulation_list" + " return simulation_list\n", + "\n", + "def simulation(states_list, configs, env_processes, time_seq, runs):\n", + " pipeline_run = []\n", + " for run in range(runs):\n", + " if run == 0:\n", + " head, *tail = pipeline(states_list, configs, env_processes, time_seq)\n", + " head[-1]['mech_step'], head[-1]['time_step'] = 0, 0\n", + " simulation_list = [head] + tail\n", + " pipeline_run += simulation_list\n", + " else:\n", + " transient_states_list = [pipeline_run[-1][-1]]\n", + " head, *tail = pipeline(transient_states_list, configs, env_processes, time_seq)\n", + " pipeline_run += tail\n", + " \n", + " return pipeline_run" ] }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 101, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "{'s1': Decimal('2'),\n", - " 's2': Decimal('4'),\n", - " 's3': Decimal('0'),\n", - " 's4': Decimal('0'),\n", - " 'timestamp': '2018-10-01 15:16:24',\n", - " 'mech_step': 0,\n", - " 'time_step': 0}" - ] - }, - "execution_count": 31, - "metadata": {}, - "output_type": "execute_result" + "name": "stdout", + "output_type": "stream", + "text": [ + "NOT trigered: 2018-10-01 15:16:24\n", + "NOT trigered: 2018-10-01 15:16:24\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:28\n", + "NOT trigered: 2018-10-01 15:16:28\n", + "NOT trigered: 2018-10-01 15:16:28\n", + "NOT trigered: 2018-10-01 15:16:28\n", + "NOT trigered: 2018-10-01 15:16:28\n", + "NOT trigered: 2018-10-01 15:16:28\n", + "NOT trigered: 2018-10-01 15:16:29\n", + "NOT trigered: 2018-10-01 15:16:29\n", + "NOT trigered: 2018-10-01 15:16:29\n", + "NOT trigered: 2018-10-01 15:16:29\n", + "NOT trigered: 2018-10-01 15:16:29\n", + "NOT trigered: 2018-10-01 15:16:29\n", + "NOT trigered: 2018-10-01 15:16:30\n", + "NOT trigered: 2018-10-01 15:16:30\n", + "NOT trigered: 2018-10-01 15:16:30\n", + "NOT trigered: 2018-10-01 15:16:30\n", + "NOT trigered: 2018-10-01 15:16:30\n", + "NOT trigered: 2018-10-01 15:16:30\n", + "NOT trigered: 2018-10-01 15:16:31\n", + "NOT trigered: 2018-10-01 15:16:31\n", + "NOT trigered: 2018-10-01 15:16:31\n", + "NOT trigered: 2018-10-01 15:16:31\n", + "NOT trigered: 2018-10-01 15:16:31\n", + "NOT trigered: 2018-10-01 15:16:31\n", + "NOT trigered: 2018-10-01 15:16:32\n", + "NOT trigered: 2018-10-01 15:16:32\n", + "NOT trigered: 2018-10-01 15:16:32\n", + "NOT trigered: 2018-10-01 15:16:32\n", + "NOT trigered: 2018-10-01 15:16:32\n", + "NOT trigered: 2018-10-01 15:16:32\n", + "NOT trigered: 2018-10-01 15:16:33\n", + "NOT trigered: 2018-10-01 15:16:33\n", + "NOT trigered: 2018-10-01 15:16:33\n", + "NOT trigered: 2018-10-01 15:16:33\n", + "NOT trigered: 2018-10-01 15:16:33\n", + "NOT trigered: 2018-10-01 15:16:33\n", + "NOT trigered: 2018-10-01 15:16:34\n", + "NOT trigered: 2018-10-01 15:16:34\n", + "NOT trigered: 2018-10-01 15:16:34\n", + "NOT trigered: 2018-10-01 15:16:34\n", + "NOT trigered: 2018-10-01 15:16:24\n", + "NOT trigered: 2018-10-01 15:16:24\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "trigered: 2018-10-01 15:16:25\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:26\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:27\n", + "NOT trigered: 2018-10-01 15:16:28\n", + "NOT trigered: 2018-10-01 15:16:28\n", + "NOT trigered: 2018-10-01 15:16:28\n", + "NOT trigered: 2018-10-01 15:16:28\n" + ] } ], "source": [ - "states_list[-1]" + "states_list = [state_dict]\n", + "configs = generate_config(mechanisms, exogenous_states)\n", + "p = pipeline(states_list, configs, env_processes, range(10))\n", + "s = simulation(states_list, configs, env_processes, range(2), 2)\n", + "x = flatten(s)\n", + "# transient_state = p[-1][1]\n", + "# transient_state['mech_step'], transient_state['time_step'] = 0, 0\n", + "# head, *tail = pipeline([transient_state], configs, env_processes, range(1))\n", + "# head" ] }, { "cell_type": "code", - "execution_count": 71, - "metadata": { - "collapsed": true - }, - "outputs": [ - { - "data": { - "text/plain": [ - "\"[{'s1': Decimal('2'), 's2': Decimal('4'), 's3': Decimal('0'), 's4': Decimal('0'), 'timestamp': '2018-10-01 15:16:24', 'mech_step': 0, 'time_step': 0}, {'s1': Decimal('12'), 's2': Decimal('15'), 's3': Decimal('1.027943375654487123682656602'), 's4': Decimal('2.873162181767157652423350100'), 'timestamp': '2018-10-01 15:16:25', 'mech_step': 1, 'time_step': 1}, {'s1': Decimal('24.8'), 's2': Decimal('15'), 's3': Decimal('1.658405192679980226295085390'), 's4': Decimal('5.350515951995874829597979645'), 'timestamp': '2018-10-01 15:16:25', 'mech_step': 2, 'time_step': 1}, {'s1': Decimal('24.8'), 's2': Decimal('513.8'), 's3': Decimal('2.771923735333028371712141099'), 's4': Decimal('7.030344993582647198055332758'), 'timestamp': '2018-10-01 15:16:25', 'mech_step': 3, 'time_step': 1}, {'s1': Decimal('12791.84'), 's2': Decimal('13281.84'), 's3': Decimal('2.884737635508387705829249992'), 's4': Decimal('6.383750387315317896150130866'), 'timestamp': '2018-10-01 15:16:26', 'mech_step': 1, 'time_step': 2}, {'s1': Decimal('25584.64310752124705613077706'), 's2': Decimal('13281.84'), 's3': Decimal('2.641176859741037975691526862'), 's4': Decimal('7.563409402906505259061057559'), 'timestamp': '2018-10-01 15:16:26', 'mech_step': 2, 'time_step': 2}, {'s1': Decimal('25584.64310752124705613077706'), 's2': Decimal('39578.28310752124705613077706'), 's3': Decimal('2.493318466952763629633252152'), 's4': Decimal('5.891297175440944153224023488'), 'timestamp': '2018-10-01 15:16:26', 'mech_step': 3, 'time_step': 2}, {'s1': Decimal('1012647417.400583119401298502'), 's2': Decimal('1012661412.040583119401298502'), 's3': Decimal('2.343589605293861443271839926'), 's4': Decimal('5.974841965491865064823816188'), 'timestamp': '2018-10-01 15:16:27', 'mech_step': 1, 'time_step': 3}, {'s1': Decimal('2025294835.801152419139051417'), 's2': Decimal('1012661412.040583119401298502'), 's3': Decimal('2.722049618518731799375577601'), 's4': Decimal('6.419153303484813228317291423'), 'timestamp': '2018-10-01 15:16:27', 'mech_step': 2, 'time_step': 3}, {'s1': Decimal('2025294835.801152419139051417'), 's2': Decimal('3037996532.124843059787406050'), 's3': Decimal('2.829557844805450150205458129'), 's4': Decimal('6.506538668695062046307737283'), 'timestamp': '2018-10-01 15:16:27', 'mech_step': 3, 'time_step': 3}, {'s1': Decimal('6152838691744844166.823201459'), 's2': Decimal('6152838692757545864.146892100'), 's3': Decimal('2.488931860190471537369309149'), 's4': Decimal('6.300408321924320755651096195'), 'timestamp': '2018-10-01 15:16:28', 'mech_step': 1, 'time_step': 4}, {'s1': Decimal('12305677383489688334.64640292'), 's2': Decimal('6152838692757545864.146892100'), 's3': Decimal('2.178444472215797343328528750'), 's4': Decimal('6.784326268377325448300165109'), 'timestamp': '2018-10-01 15:16:28', 'mech_step': 2, 'time_step': 4}, {'s1': Decimal('12305677383489688334.64640292'), 's2': Decimal('18458516079285231057.91813808'), 's3': Decimal('2.161551452331358618745550185'), 's4': Decimal('6.035792378762528032341888172'), 'timestamp': '2018-10-01 15:16:28', 'mech_step': 3, 'time_step': 4}, {'s1': Decimal('2.271445438496410226588727850E+38'), 's2': Decimal('2.271445438496410226650256237E+38'), 's3': Decimal('2.158667996440737307324876748'), 's4': Decimal('6.371107803673317814010318446'), 'timestamp': '2018-10-01 15:16:29', 'mech_step': 1, 'time_step': 5}, {'s1': Decimal('4.542890876992820453177455700E+38'), 's2': Decimal('2.271445438496410226650256237E+38'), 's3': Decimal('1.992812515458891464887812476'), 's4': Decimal('7.282620522632285439020785561'), 'timestamp': '2018-10-01 15:16:29', 'mech_step': 2, 'time_step': 5}, {'s1': Decimal('4.542890876992820453177455700E+38'), 's2': Decimal('6.814336315489230680012297098E+38'), 's3': Decimal('2.050849993464547990799409445'), 's4': Decimal('6.524227074744597056029341316'), 'timestamp': '2018-10-01 15:16:29', 'mech_step': 3, 'time_step': 5}, {'s1': Decimal('3.095678628039689600133475180E+77'), 's2': Decimal('3.095678628039689600133475180E+77'), 's3': Decimal('2.010380376097353148038039474'), 's4': Decimal('5.989349144044895224884420424'), 'timestamp': '2018-10-01 15:16:30', 'mech_step': 1, 'time_step': 6}, {'s1': Decimal('6.191357256079379200266950360E+77'), 's2': Decimal('3.095678628039689600133475180E+77'), 's3': Decimal('2.226864095678880891887671486'), 's4': Decimal('6.070768581048944995923972497'), 'timestamp': '2018-10-01 15:16:30', 'mech_step': 2, 'time_step': 6}, {'s1': Decimal('6.191357256079379200266950360E+77'), 's2': Decimal('9.287035884119068800400425540E+77'), 's3': Decimal('2.324269409720218352898828188'), 's4': Decimal('6.671515324796301588344886525'), 'timestamp': '2018-10-01 15:16:30', 'mech_step': 3, 'time_step': 6}, {'s1': Decimal('5.749935700861016926665423233E+155'), 's2': Decimal('5.749935700861016926665423233E+155'), 's3': Decimal('2.302607714744926584899159503'), 's4': Decimal('7.564930163192297989174091445'), 'timestamp': '2018-10-01 15:16:31', 'mech_step': 1, 'time_step': 7}, {'s1': Decimal('1.149987140172203385333084647E+156'), 's2': Decimal('5.749935700861016926665423233E+155'), 's3': Decimal('2.333838309242175687275651869'), 's4': Decimal('8.079819700247225677794342322'), 'timestamp': '2018-10-01 15:16:31', 'mech_step': 2, 'time_step': 7}, {'s1': Decimal('1.149987140172203385333084647E+156'), 's2': Decimal('1.724980710258305077999626970E+156'), 's3': Decimal('2.127828342872591238967325177'), 's4': Decimal('7.538873530077748135396698368'), 'timestamp': '2018-10-01 15:16:31', 'mech_step': 3, 'time_step': 7}, {'s1': Decimal('1.983705633842164435837016890E+312'), 's2': Decimal('1.983705633842164435837016890E+312'), 's3': Decimal('2.316086720133955499001671373'), 's4': Decimal('6.698731880418827259665498103'), 'timestamp': '2018-10-01 15:16:32', 'mech_step': 1, 'time_step': 8}, {'s1': Decimal('3.967411267684328871674033780E+312'), 's2': Decimal('1.983705633842164435837016890E+312'), 's3': Decimal('2.404840197025546934576512657'), 's4': Decimal('6.861496713777041844809717113'), 'timestamp': '2018-10-01 15:16:32', 'mech_step': 2, 'time_step': 8}, {'s1': Decimal('3.967411267684328871674033780E+312'), 's2': Decimal('5.951116901526493307511050670E+312'), 's3': Decimal('2.304559767911563562114836868'), 's4': Decimal('7.134761053609609291468324912'), 'timestamp': '2018-10-01 15:16:32', 'mech_step': 3, 'time_step': 8}, {'s1': Decimal('2.361052825042286016164133532E+625'), 's2': Decimal('2.361052825042286016164133532E+625'), 's3': Decimal('2.331706686848056480258922690'), 's4': Decimal('6.349543276872486350505972604'), 'timestamp': '2018-10-01 15:16:33', 'mech_step': 1, 'time_step': 9}, {'s1': Decimal('4.722105650084572032328267064E+625'), 's2': Decimal('2.361052825042286016164133532E+625'), 's3': Decimal('2.206567414513102300934412097'), 's4': Decimal('6.387507504315002156007687646'), 'timestamp': '2018-10-01 15:16:33', 'mech_step': 2, 'time_step': 9}, {'s1': Decimal('4.722105650084572032328267064E+625'), 's2': Decimal('7.083158475126858048492400596E+625'), 's3': Decimal('2.755381458293744817475387505'), 's4': Decimal('6.599724434632028086026631189'), 'timestamp': '2018-10-01 15:16:33', 'mech_step': 3, 'time_step': 9}, {'s1': Decimal('3.344742265584095796507860632E+1251'), 's2': Decimal('3.344742265584095796507860632E+1251'), 's3': Decimal('2.631014270278374984244193109'), 's4': Decimal('7.289437871820951073267599940'), 'timestamp': '2018-10-01 15:16:34', 'mech_step': 1, 'time_step': 10}, {'s1': Decimal('6.689484531168191593015721264E+1251'), 's2': Decimal('3.344742265584095796507860632E+1251'), 's3': Decimal('2.767520795662379664467196631'), 's4': Decimal('6.567373343213126668766057155'), 'timestamp': '2018-10-01 15:16:34', 'mech_step': 2, 'time_step': 10}, {'s1': Decimal('6.689484531168191593015721264E+1251'), 's2': Decimal('1.003422679675228738952358190E+1252'), 's3': Decimal('2.868382538980392112200644477'), 's4': Decimal('6.933152742813279229430635728'), 'timestamp': '2018-10-01 15:16:34', 'mech_step': 3, 'time_step': 10}]\"" - ] - }, - "execution_count": 71, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "flatten(pipeline(states_list, configs, env_processes, range(10)))" - ] - }, - { - "cell_type": "code", - "execution_count": 75, - "metadata": { - "collapsed": true - }, + "execution_count": 102, + "metadata": {}, "outputs": [ { "data": { @@ -387,310 +455,310 @@ " \n", " 0\n", " 0\n", - " 2\n", - " 4\n", " 0\n", " 0\n", + " 1\n", + " 1\n", " 0\n", " 2018-10-01 15:16:24\n", " \n", " \n", " 1\n", " 1\n", - " 12\n", - " 15\n", - " 0.9134790035783337813768412161\n", - " 2.502245379381494383430606376\n", + " 2\n", + " 2\n", + " 0.9583242152594528828757347583\n", + " 1.178862847343031816649272514\n", " 1\n", " 2018-10-01 15:16:25\n", " \n", " \n", " 2\n", " 2\n", - " 24.8\n", - " 15\n", - " 2.248685730584553218869219712\n", - " 5.512870077468841289396533774\n", + " 8\n", + " 8\n", + " -0.9943733172773669970467835810\n", + " -1.043650985051199020503531756\n", " 1\n", " 2018-10-01 15:16:25\n", " \n", " \n", " 3\n", " 3\n", - " 24.8\n", - " 548.8\n", - " 3.431275232953615539312717484\n", - " 9.152222843429326282106045717\n", + " 26\n", + " 26\n", + " -0.7863803904331545524541979830\n", + " -1.009649746807200765275069898\n", " 1\n", " 2018-10-01 15:16:25\n", " \n", " \n", " 4\n", " 1\n", - " 13659.84\n", - " 14184.84\n", - " 3.322814672054344544572535039\n", - " 7.708815382252544561603904880\n", + " 80\n", + " 80\n", + " -1.164027080840498884484190967\n", + " -0.8136507296635508978965845017\n", " 2\n", " 2018-10-01 15:16:26\n", " \n", " \n", " 5\n", " 2\n", - " 27320.64298865549417547184177\n", - " 14184.84\n", - " 2.897641633315681179441300144\n", - " 7.871440379399112665270434205\n", + " 242\n", + " 242\n", + " -0.9552663219495139965448022608\n", + " -0.7910810183259607231361307612\n", " 2\n", " 2018-10-01 15:16:26\n", " \n", " \n", " 6\n", " 3\n", - " 27320.64298865549417547184177\n", - " 43033.28298865549417547184177\n", - " 3.109937351467413775751721194\n", - " 8.630776907929052893315997214\n", + " 728\n", + " 728\n", + " -0.8748570309494044673003324683\n", + " -0.7630167088679219022217039179\n", " 2\n", " 2018-10-01 15:16:26\n", " \n", " \n", " 7\n", " 1\n", - " 1175751602.448815787831625727\n", - " 1175767316.088815787831625727\n", - " 3.176228364900735157136598597\n", - " 9.476875554027664732983490933\n", + " 2186\n", + " 2186\n", + " -0.9188519653028559191494015290\n", + " -0.7567033955791616230139770538\n", " 3\n", " 2018-10-01 15:16:27\n", " \n", " \n", " 8\n", " 2\n", - " 2351503205.897618211080153268\n", - " 1175767316.088815787831625727\n", - " 3.669342085393265738584747393\n", - " 9.078969322902328500177642109\n", + " 6560\n", + " 6560\n", + " -0.8044284247281271626156064005\n", + " -0.7092580414608578009534232301\n", " 3\n", " 2018-10-01 15:16:27\n", " \n", " \n", " 9\n", " 3\n", - " 2351503205.897618211080153268\n", - " 3527313580.269422654405954467\n", - " 3.349759960987064464357988348\n", - " 11.17144391140400526366105626\n", + " 19682\n", + " 19682\n", + " -0.7193237410424213328031717259\n", + " -0.7061502025900309886278489863\n", " 3\n", " 2018-10-01 15:16:27\n", " \n", " \n", " 10\n", " 1\n", - " 8294489196912759452.970615494\n", - " 8294489198088569828.342419937\n", - " 3.291621062675780626360283198\n", - " 11.79158573801193721089527021\n", + " 59048\n", + " 59048\n", + " -0.6539366652218983625162031954\n", + " -0.6724514417082331246032767463\n", " 4\n", " 2018-10-01 15:16:28\n", " \n", " \n", " 11\n", " 2\n", - " 16588978393825518906.94123099\n", - " 8294489198088569828.342419937\n", - " 3.190260401352364227902370309\n", - " 10.83521005284223728823800392\n", + " 177146\n", + " 177146\n", + " -0.6899982671132800609186798069\n", + " -0.5841004169473963344090097995\n", " 4\n", " 2018-10-01 15:16:28\n", " \n", " \n", " 12\n", " 3\n", - " 16588978393825518906.94123099\n", - " 24883467595441402812.55307358\n", - " 3.121085581653047084982738199\n", - " 11.90171862969807780698158412\n", + " 531440\n", + " 531440\n", + " -0.8481602227838296888984432921\n", + " -0.6357712470764768954378425061\n", " 4\n", " 2018-10-01 15:16:28\n", " \n", " \n", " 13\n", " 1\n", - " 4.127913063042348695585266519E+38\n", - " 4.127913063042348695668211411E+38\n", - " 3.451182382495768883556480363\n", - " 10.56564601562031452828101181\n", + " 1594322\n", + " 1594322\n", + " -0.8516834288658128498292162290\n", + " -0.6918029141530049801981010335\n", " 5\n", " 2018-10-01 15:16:29\n", " \n", " \n", " 14\n", " 2\n", - " 8.255826126084697391170533038E+38\n", - " 4.127913063042348695668211411E+38\n", - " 3.741899406797318610377156551\n", - " 11.51155602900725002724979131\n", + " 4782968\n", + " 4782968\n", + " -0.7564715712347508471660595074\n", + " -0.8100716768922640850217596754\n", " 5\n", " 2018-10-01 15:16:29\n", " \n", " \n", " 15\n", " 3\n", - " 8.255826126084697391170533038E+38\n", - " 1.238373918912704608708757912E+39\n", - " 3.502261092993842545620034035\n", - " 10.05873509959087676986164634\n", + " 14348906\n", + " 14348906\n", + " -0.7972498007104424508069565774\n", + " -0.8141247605341878163109060019\n", " 5\n", " 2018-10-01 15:16:29\n", " \n", " \n", " 16\n", " 1\n", - " 1.022379975362139926212390600E+78\n", - " 1.022379975362139926212390600E+78\n", - " 3.469927066535463898981122193\n", - " 10.85392093270310114268283059\n", + " 43046720\n", + " 43046720\n", + " -0.7497209805242121767590917327\n", + " -0.7811789702086333252792060853\n", " 6\n", " 2018-10-01 15:16:30\n", " \n", " \n", " 17\n", " 2\n", - " 2.044759950724279852424781200E+78\n", - " 1.022379975362139926212390600E+78\n", - " 3.389836636120093053817568517\n", - " 10.22052760419210320393222941\n", + " 129140162\n", + " 129140162\n", + " -0.7482867270632369112542703363\n", + " -0.7385765979811874340325446713\n", " 6\n", " 2018-10-01 15:16:30\n", " \n", " \n", " 18\n", " 3\n", - " 2.044759950724279852424781200E+78\n", - " 3.067139926086419778637171800E+78\n", - " 3.691234576837118749676110598\n", - " 11.37778574423056181482523150\n", + " 387420488\n", + " 387420488\n", + " -0.8362105087467554066801144981\n", + " -0.6243574025213526594286498522\n", " 6\n", " 2018-10-01 15:16:30\n", " \n", " \n", " 19\n", " 1\n", - " 6.271564884128939055277180913E+156\n", - " 6.271564884128939055277180913E+156\n", - " 3.626178019358236806863551566\n", - " 12.22051263705128606140551412\n", + " 1162261466\n", + " 1162261466\n", + " -0.7736727540481614067105454386\n", + " -0.6856922404788517098662982715\n", " 7\n", " 2018-10-01 15:16:31\n", " \n", " \n", " 20\n", " 2\n", - " 1.254312976825787811055436183E+157\n", - " 6.271564884128939055277180913E+156\n", - " 3.220785150433332555990604134\n", - " 12.76702364001153681852439011\n", + " 3486784400\n", + " 3486784400\n", + " -0.7743710131258121981198043907\n", + " -0.6101928874578639314836629090\n", " 7\n", " 2018-10-01 15:16:31\n", " \n", " \n", " 21\n", " 3\n", - " 1.254312976825787811055436183E+157\n", - " 1.881469465238681716583154274E+157\n", - " 3.109568780275700333829257981\n", - " 12.84187980705835257162799234\n", + " 10460353202\n", + " 10460353202\n", + " -0.7063728832335825898433752401\n", + " -0.5378821912484286591847767647\n", " 7\n", " 2018-10-01 15:16:31\n", " \n", " \n", " 22\n", " 1\n", - " 2.359951565750353965511297842E+314\n", - " 2.359951565750353965511297842E+314\n", - " 3.094712150387259242879567261\n", - " 14.23781301925247300696747254\n", + " 31381059608\n", + " 31381059608\n", + " -0.6953227976364985577364199016\n", + " -0.5268206493952871350225227710\n", " 8\n", " 2018-10-01 15:16:32\n", " \n", " \n", " 23\n", " 2\n", - " 4.719903131500707931022595684E+314\n", - " 2.359951565750353965511297842E+314\n", - " 3.378565486073127515381700473\n", - " 11.67024852265485110882840117\n", + " 94143178826\n", + " 94143178826\n", + " -0.7131627260841388238904800896\n", + " -0.6051140135471004727959631198\n", " 8\n", " 2018-10-01 15:16:32\n", " \n", " \n", " 24\n", " 3\n", - " 4.719903131500707931022595684E+314\n", - " 7.079854697251061896533893526E+314\n", - " 3.809611959404135920760842724\n", - " 12.17505018426059517257186215\n", + " 282429536480\n", + " 282429536480\n", + " -0.6426466898925962665114815185\n", + " -0.6194380466004569997723915385\n", " 8\n", " 2018-10-01 15:16:32\n", " \n", " \n", " 25\n", " 1\n", - " 3.341622835612528353592630685E+629\n", - " 3.341622835612528353592630685E+629\n", - " 4.301344465829686078698769231\n", - " 12.67840657289609612005491378\n", + " 847288609442\n", + " 847288609442\n", + " -0.6208724083994397579976835846\n", + " -0.5560208998789942763800310913\n", " 9\n", " 2018-10-01 15:16:33\n", " \n", " \n", " 26\n", " 2\n", - " 6.683245671225056707185261370E+629\n", - " 3.341622835612528353592630685E+629\n", - " 4.457960124936451008116824228\n", - " 13.39112306206467797206188957\n", + " 2541865828328\n", + " 2541865828328\n", + " -0.6062083935933455693844456101\n", + " -0.5163769878056036987096507975\n", " 9\n", " 2018-10-01 15:16:33\n", " \n", " \n", " 27\n", " 3\n", - " 6.683245671225056707185261370E+629\n", - " 1.002486850683758506077789206E+630\n", - " 4.227067068495197251330279996\n", - " 14.49753624543580349429923643\n", + " 7625597484986\n", + " 7625597484986\n", + " -0.5675532115148602461045555170\n", + " -0.5486631990323815800734232257\n", " 9\n", " 2018-10-01 15:16:33\n", " \n", " \n", " 28\n", " 1\n", - " 6.699865905292268815365221375E+1259\n", - " 6.699865905292268815365221375E+1259\n", - " 4.472780660763391823717436106\n", - " 14.66684234187518294415503523\n", + " 22876792454960\n", + " 22876792454960\n", + " -0.5001498947976128312700433357\n", + " -0.5398564214990231691461820341\n", " 10\n", " 2018-10-01 15:16:34\n", " \n", " \n", " 29\n", " 2\n", - " 1.339973181058453763073044275E+1260\n", - " 6.699865905292268815365221375E+1259\n", - " 4.387384290717904567103987857\n", - " 15.84678912512812579758546608\n", + " 68630377364882\n", + " 68630377364882\n", + " -0.4290677301255414288053960084\n", + " -0.4983502974188522986087216116\n", " 10\n", " 2018-10-01 15:16:34\n", " \n", " \n", " 30\n", " 3\n", - " 1.339973181058453763073044275E+1260\n", - " 2.009959771587680644609566412E+1260\n", - " 4.113061544409890922044795202\n", - " 16.08824426908686380482178405\n", + " 205891132094648\n", + " 205891132094648\n", + " -0.4224817466061129854881621614\n", + " -0.4868867095325838908165051117\n", " 10\n", " 2018-10-01 15:16:34\n", " \n", @@ -699,107 +767,585 @@ "" ], "text/plain": [ - " mech_step s1 \\\n", - "0 0 2 \n", - "1 1 12 \n", - "2 2 24.8 \n", - "3 3 24.8 \n", - "4 1 13659.84 \n", - "5 2 27320.64298865549417547184177 \n", - "6 3 27320.64298865549417547184177 \n", - "7 1 1175751602.448815787831625727 \n", - "8 2 2351503205.897618211080153268 \n", - "9 3 2351503205.897618211080153268 \n", - "10 1 8294489196912759452.970615494 \n", - "11 2 16588978393825518906.94123099 \n", - "12 3 16588978393825518906.94123099 \n", - "13 1 4.127913063042348695585266519E+38 \n", - "14 2 8.255826126084697391170533038E+38 \n", - "15 3 8.255826126084697391170533038E+38 \n", - "16 1 1.022379975362139926212390600E+78 \n", - "17 2 2.044759950724279852424781200E+78 \n", - "18 3 2.044759950724279852424781200E+78 \n", - "19 1 6.271564884128939055277180913E+156 \n", - "20 2 1.254312976825787811055436183E+157 \n", - "21 3 1.254312976825787811055436183E+157 \n", - "22 1 2.359951565750353965511297842E+314 \n", - "23 2 4.719903131500707931022595684E+314 \n", - "24 3 4.719903131500707931022595684E+314 \n", - "25 1 3.341622835612528353592630685E+629 \n", - "26 2 6.683245671225056707185261370E+629 \n", - "27 3 6.683245671225056707185261370E+629 \n", - "28 1 6.699865905292268815365221375E+1259 \n", - "29 2 1.339973181058453763073044275E+1260 \n", - "30 3 1.339973181058453763073044275E+1260 \n", + " mech_step s1 s2 \\\n", + "0 0 0 0 \n", + "1 1 2 2 \n", + "2 2 8 8 \n", + "3 3 26 26 \n", + "4 1 80 80 \n", + "5 2 242 242 \n", + "6 3 728 728 \n", + "7 1 2186 2186 \n", + "8 2 6560 6560 \n", + "9 3 19682 19682 \n", + "10 1 59048 59048 \n", + "11 2 177146 177146 \n", + "12 3 531440 531440 \n", + "13 1 1594322 1594322 \n", + "14 2 4782968 4782968 \n", + "15 3 14348906 14348906 \n", + "16 1 43046720 43046720 \n", + "17 2 129140162 129140162 \n", + "18 3 387420488 387420488 \n", + "19 1 1162261466 1162261466 \n", + "20 2 3486784400 3486784400 \n", + "21 3 10460353202 10460353202 \n", + "22 1 31381059608 31381059608 \n", + "23 2 94143178826 94143178826 \n", + "24 3 282429536480 282429536480 \n", + "25 1 847288609442 847288609442 \n", + "26 2 2541865828328 2541865828328 \n", + "27 3 7625597484986 7625597484986 \n", + "28 1 22876792454960 22876792454960 \n", + "29 2 68630377364882 68630377364882 \n", + "30 3 205891132094648 205891132094648 \n", "\n", - " s2 s3 \\\n", - "0 4 0 \n", - "1 15 0.9134790035783337813768412161 \n", - "2 15 2.248685730584553218869219712 \n", - "3 548.8 3.431275232953615539312717484 \n", - "4 14184.84 3.322814672054344544572535039 \n", - "5 14184.84 2.897641633315681179441300144 \n", - "6 43033.28298865549417547184177 3.109937351467413775751721194 \n", - "7 1175767316.088815787831625727 3.176228364900735157136598597 \n", - "8 1175767316.088815787831625727 3.669342085393265738584747393 \n", - "9 3527313580.269422654405954467 3.349759960987064464357988348 \n", - "10 8294489198088569828.342419937 3.291621062675780626360283198 \n", - "11 8294489198088569828.342419937 3.190260401352364227902370309 \n", - "12 24883467595441402812.55307358 3.121085581653047084982738199 \n", - "13 4.127913063042348695668211411E+38 3.451182382495768883556480363 \n", - "14 4.127913063042348695668211411E+38 3.741899406797318610377156551 \n", - "15 1.238373918912704608708757912E+39 3.502261092993842545620034035 \n", - "16 1.022379975362139926212390600E+78 3.469927066535463898981122193 \n", - "17 1.022379975362139926212390600E+78 3.389836636120093053817568517 \n", - "18 3.067139926086419778637171800E+78 3.691234576837118749676110598 \n", - "19 6.271564884128939055277180913E+156 3.626178019358236806863551566 \n", - "20 6.271564884128939055277180913E+156 3.220785150433332555990604134 \n", - "21 1.881469465238681716583154274E+157 3.109568780275700333829257981 \n", - "22 2.359951565750353965511297842E+314 3.094712150387259242879567261 \n", - "23 2.359951565750353965511297842E+314 3.378565486073127515381700473 \n", - "24 7.079854697251061896533893526E+314 3.809611959404135920760842724 \n", - "25 3.341622835612528353592630685E+629 4.301344465829686078698769231 \n", - "26 3.341622835612528353592630685E+629 4.457960124936451008116824228 \n", - "27 1.002486850683758506077789206E+630 4.227067068495197251330279996 \n", - "28 6.699865905292268815365221375E+1259 4.472780660763391823717436106 \n", - "29 6.699865905292268815365221375E+1259 4.387384290717904567103987857 \n", - "30 2.009959771587680644609566412E+1260 4.113061544409890922044795202 \n", + " s3 s4 \\\n", + "0 1 1 \n", + "1 0.9583242152594528828757347583 1.178862847343031816649272514 \n", + "2 -0.9943733172773669970467835810 -1.043650985051199020503531756 \n", + "3 -0.7863803904331545524541979830 -1.009649746807200765275069898 \n", + "4 -1.164027080840498884484190967 -0.8136507296635508978965845017 \n", + "5 -0.9552663219495139965448022608 -0.7910810183259607231361307612 \n", + "6 -0.8748570309494044673003324683 -0.7630167088679219022217039179 \n", + "7 -0.9188519653028559191494015290 -0.7567033955791616230139770538 \n", + "8 -0.8044284247281271626156064005 -0.7092580414608578009534232301 \n", + "9 -0.7193237410424213328031717259 -0.7061502025900309886278489863 \n", + "10 -0.6539366652218983625162031954 -0.6724514417082331246032767463 \n", + "11 -0.6899982671132800609186798069 -0.5841004169473963344090097995 \n", + "12 -0.8481602227838296888984432921 -0.6357712470764768954378425061 \n", + "13 -0.8516834288658128498292162290 -0.6918029141530049801981010335 \n", + "14 -0.7564715712347508471660595074 -0.8100716768922640850217596754 \n", + "15 -0.7972498007104424508069565774 -0.8141247605341878163109060019 \n", + "16 -0.7497209805242121767590917327 -0.7811789702086333252792060853 \n", + "17 -0.7482867270632369112542703363 -0.7385765979811874340325446713 \n", + "18 -0.8362105087467554066801144981 -0.6243574025213526594286498522 \n", + "19 -0.7736727540481614067105454386 -0.6856922404788517098662982715 \n", + "20 -0.7743710131258121981198043907 -0.6101928874578639314836629090 \n", + "21 -0.7063728832335825898433752401 -0.5378821912484286591847767647 \n", + "22 -0.6953227976364985577364199016 -0.5268206493952871350225227710 \n", + "23 -0.7131627260841388238904800896 -0.6051140135471004727959631198 \n", + "24 -0.6426466898925962665114815185 -0.6194380466004569997723915385 \n", + "25 -0.6208724083994397579976835846 -0.5560208998789942763800310913 \n", + "26 -0.6062083935933455693844456101 -0.5163769878056036987096507975 \n", + "27 -0.5675532115148602461045555170 -0.5486631990323815800734232257 \n", + "28 -0.5001498947976128312700433357 -0.5398564214990231691461820341 \n", + "29 -0.4290677301255414288053960084 -0.4983502974188522986087216116 \n", + "30 -0.4224817466061129854881621614 -0.4868867095325838908165051117 \n", "\n", - " s4 time_step timestamp \n", - "0 0 0 2018-10-01 15:16:24 \n", - "1 2.502245379381494383430606376 1 2018-10-01 15:16:25 \n", - "2 5.512870077468841289396533774 1 2018-10-01 15:16:25 \n", - "3 9.152222843429326282106045717 1 2018-10-01 15:16:25 \n", - "4 7.708815382252544561603904880 2 2018-10-01 15:16:26 \n", - "5 7.871440379399112665270434205 2 2018-10-01 15:16:26 \n", - "6 8.630776907929052893315997214 2 2018-10-01 15:16:26 \n", - "7 9.476875554027664732983490933 3 2018-10-01 15:16:27 \n", - "8 9.078969322902328500177642109 3 2018-10-01 15:16:27 \n", - "9 11.17144391140400526366105626 3 2018-10-01 15:16:27 \n", - "10 11.79158573801193721089527021 4 2018-10-01 15:16:28 \n", - "11 10.83521005284223728823800392 4 2018-10-01 15:16:28 \n", - "12 11.90171862969807780698158412 4 2018-10-01 15:16:28 \n", - "13 10.56564601562031452828101181 5 2018-10-01 15:16:29 \n", - "14 11.51155602900725002724979131 5 2018-10-01 15:16:29 \n", - "15 10.05873509959087676986164634 5 2018-10-01 15:16:29 \n", - "16 10.85392093270310114268283059 6 2018-10-01 15:16:30 \n", - "17 10.22052760419210320393222941 6 2018-10-01 15:16:30 \n", - "18 11.37778574423056181482523150 6 2018-10-01 15:16:30 \n", - "19 12.22051263705128606140551412 7 2018-10-01 15:16:31 \n", - "20 12.76702364001153681852439011 7 2018-10-01 15:16:31 \n", - "21 12.84187980705835257162799234 7 2018-10-01 15:16:31 \n", - "22 14.23781301925247300696747254 8 2018-10-01 15:16:32 \n", - "23 11.67024852265485110882840117 8 2018-10-01 15:16:32 \n", - "24 12.17505018426059517257186215 8 2018-10-01 15:16:32 \n", - "25 12.67840657289609612005491378 9 2018-10-01 15:16:33 \n", - "26 13.39112306206467797206188957 9 2018-10-01 15:16:33 \n", - "27 14.49753624543580349429923643 9 2018-10-01 15:16:33 \n", - "28 14.66684234187518294415503523 10 2018-10-01 15:16:34 \n", - "29 15.84678912512812579758546608 10 2018-10-01 15:16:34 \n", - "30 16.08824426908686380482178405 10 2018-10-01 15:16:34 " + " time_step timestamp \n", + "0 0 2018-10-01 15:16:24 \n", + "1 1 2018-10-01 15:16:25 \n", + "2 1 2018-10-01 15:16:25 \n", + "3 1 2018-10-01 15:16:25 \n", + "4 2 2018-10-01 15:16:26 \n", + "5 2 2018-10-01 15:16:26 \n", + "6 2 2018-10-01 15:16:26 \n", + "7 3 2018-10-01 15:16:27 \n", + "8 3 2018-10-01 15:16:27 \n", + "9 3 2018-10-01 15:16:27 \n", + "10 4 2018-10-01 15:16:28 \n", + "11 4 2018-10-01 15:16:28 \n", + "12 4 2018-10-01 15:16:28 \n", + "13 5 2018-10-01 15:16:29 \n", + "14 5 2018-10-01 15:16:29 \n", + "15 5 2018-10-01 15:16:29 \n", + "16 6 2018-10-01 15:16:30 \n", + "17 6 2018-10-01 15:16:30 \n", + "18 6 2018-10-01 15:16:30 \n", + "19 7 2018-10-01 15:16:31 \n", + "20 7 2018-10-01 15:16:31 \n", + "21 7 2018-10-01 15:16:31 \n", + "22 8 2018-10-01 15:16:32 \n", + "23 8 2018-10-01 15:16:32 \n", + "24 8 2018-10-01 15:16:32 \n", + "25 9 2018-10-01 15:16:33 \n", + "26 9 2018-10-01 15:16:33 \n", + "27 9 2018-10-01 15:16:33 \n", + "28 10 2018-10-01 15:16:34 \n", + "29 10 2018-10-01 15:16:34 \n", + "30 10 2018-10-01 15:16:34 " ] }, - "execution_count": 75, + "execution_count": 102, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pd.DataFrame(flatten(p))" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "# pd.DataFrame(flatten(p))" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "# flatten(pipeline(states_list, configs, env_processes, range(10)))" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
mech_steps1s2s3s4time_steptimestamp
0NaN0011NaN2018-10-01 15:16:24
11.0220.81319093454362367801024902290.96437292405532548666968750691.02018-10-01 15:16:25
22.0880.95396930218324841446774916320.79626912217056149938579538681.02018-10-01 15:16:25
33.026261.0939812789408900453953824790.74875975352783575452054345331.02018-10-01 15:16:25
41.080801.0572588065299107530798413800.70468817526151192436485017402.02018-10-01 15:16:26
52.02422421.1218933488294280710979458070.64310672308116671617171769472.02018-10-01 15:16:26
63.07287281.1272751376250613465209112340.64501763852387293707089991562.02018-10-01 15:16:26
71.0218621861.0338087779216684005916198590.50000104692035120095551772833.02018-10-01 15:16:27
82.0656065601.0428763372920644606416906790.48661292564551380840727014823.02018-10-01 15:16:27
93.019682196821.1472021284638563250410266990.53591574153271162450867699663.02018-10-01 15:16:27
101.059048590481.1034831137403304150647175620.58161852026395546016986493724.02018-10-01 15:16:28
112.01771461771461.0620286272687062695923892690.64607275765267579801267386144.02018-10-01 15:16:28
123.05314405314401.0541196190599114603641466640.71839353840992708199563172324.02018-10-01 15:16:28
131.0159432215943221.0998153176923298634776246540.82525767582287762468296861855.02018-10-01 15:16:29
142.0478296847829681.2404134236196030175305779470.73296905345493975485213283675.02018-10-01 15:16:29
153.014348906143489061.1616869506357986919448950170.79496602463006666867911259465.02018-10-01 15:16:29
161.043046720430467201.2207466787235599332375416730.64703162952018373588162227426.02018-10-01 15:16:30
172.01291401621291401621.2471289684100989741701275250.60802305639426016010867911156.02018-10-01 15:16:30
183.03874204883874204881.0153360336320558857028319210.49161874207296333267696539766.02018-10-01 15:16:30
191.0116226146611622614660.97276132024951014018402627290.54314763822070435315083097857.02018-10-01 15:16:31
202.0348678440034867844000.95988887685446117235210198980.61558929288428622843163541487.02018-10-01 15:16:31
213.010460353202104603532020.95609057356082544831921874550.60343665660948570276051859117.02018-10-01 15:16:31
221.031381059608313810596080.98725945452180115113027905650.71052524305150900577089471678.02018-10-01 15:16:32
232.094143178826941431788260.78582663250818409843403405240.66258415022573203397828801788.02018-10-01 15:16:32
243.02824295364802824295364800.78946151470671844263287926450.67256378500048676324435762918.02018-10-01 15:16:32
251.08472886094428472886094420.73596163593100386081842915470.68285035907543615460239461019.02018-10-01 15:16:33
262.0254186582832825418658283280.63002444583685532065599457320.61018174658204235960234066329.02018-10-01 15:16:33
273.0762559748498676255974849860.66305640261400650635255394770.63690444940009909734406966939.02018-10-01 15:16:33
281.022876792454960228767924549600.71180958567614096632277337630.760398850272102047205369124910.02018-10-01 15:16:34
292.068630377364882686303773648820.66531060543015323930431236780.682463224406065149434214782510.02018-10-01 15:16:34
303.02058911320946482058911320946480.72136011530421961866270530740.743839765964151266725025037710.02018-10-01 15:16:34
\n", + "
" + ], + "text/plain": [ + " mech_step s1 s2 \\\n", + "0 NaN 0 0 \n", + "1 1.0 2 2 \n", + "2 2.0 8 8 \n", + "3 3.0 26 26 \n", + "4 1.0 80 80 \n", + "5 2.0 242 242 \n", + "6 3.0 728 728 \n", + "7 1.0 2186 2186 \n", + "8 2.0 6560 6560 \n", + "9 3.0 19682 19682 \n", + "10 1.0 59048 59048 \n", + "11 2.0 177146 177146 \n", + "12 3.0 531440 531440 \n", + "13 1.0 1594322 1594322 \n", + "14 2.0 4782968 4782968 \n", + "15 3.0 14348906 14348906 \n", + "16 1.0 43046720 43046720 \n", + "17 2.0 129140162 129140162 \n", + "18 3.0 387420488 387420488 \n", + "19 1.0 1162261466 1162261466 \n", + "20 2.0 3486784400 3486784400 \n", + "21 3.0 10460353202 10460353202 \n", + "22 1.0 31381059608 31381059608 \n", + "23 2.0 94143178826 94143178826 \n", + "24 3.0 282429536480 282429536480 \n", + "25 1.0 847288609442 847288609442 \n", + "26 2.0 2541865828328 2541865828328 \n", + "27 3.0 7625597484986 7625597484986 \n", + "28 1.0 22876792454960 22876792454960 \n", + "29 2.0 68630377364882 68630377364882 \n", + "30 3.0 205891132094648 205891132094648 \n", + "\n", + " s3 s4 time_step \\\n", + "0 1 1 NaN \n", + "1 0.8131909345436236780102490229 0.9643729240553254866696875069 1.0 \n", + "2 0.9539693021832484144677491632 0.7962691221705614993857953868 1.0 \n", + "3 1.093981278940890045395382479 0.7487597535278357545205434533 1.0 \n", + "4 1.057258806529910753079841380 0.7046881752615119243648501740 2.0 \n", + "5 1.121893348829428071097945807 0.6431067230811667161717176947 2.0 \n", + "6 1.127275137625061346520911234 0.6450176385238729370708999156 2.0 \n", + "7 1.033808777921668400591619859 0.5000010469203512009555177283 3.0 \n", + "8 1.042876337292064460641690679 0.4866129256455138084072701482 3.0 \n", + "9 1.147202128463856325041026699 0.5359157415327116245086769966 3.0 \n", + "10 1.103483113740330415064717562 0.5816185202639554601698649372 4.0 \n", + "11 1.062028627268706269592389269 0.6460727576526757980126738614 4.0 \n", + "12 1.054119619059911460364146664 0.7183935384099270819956317232 4.0 \n", + "13 1.099815317692329863477624654 0.8252576758228776246829686185 5.0 \n", + "14 1.240413423619603017530577947 0.7329690534549397548521328367 5.0 \n", + "15 1.161686950635798691944895017 0.7949660246300666686791125946 5.0 \n", + "16 1.220746678723559933237541673 0.6470316295201837358816222742 6.0 \n", + "17 1.247128968410098974170127525 0.6080230563942601601086791115 6.0 \n", + "18 1.015336033632055885702831921 0.4916187420729633326769653976 6.0 \n", + "19 0.9727613202495101401840262729 0.5431476382207043531508309785 7.0 \n", + "20 0.9598888768544611723521019898 0.6155892928842862284316354148 7.0 \n", + "21 0.9560905735608254483192187455 0.6034366566094857027605185911 7.0 \n", + "22 0.9872594545218011511302790565 0.7105252430515090057708947167 8.0 \n", + "23 0.7858266325081840984340340524 0.6625841502257320339782880178 8.0 \n", + "24 0.7894615147067184426328792645 0.6725637850004867632443576291 8.0 \n", + "25 0.7359616359310038608184291547 0.6828503590754361546023946101 9.0 \n", + "26 0.6300244458368553206559945732 0.6101817465820423596023406632 9.0 \n", + "27 0.6630564026140065063525539477 0.6369044494000990973440696693 9.0 \n", + "28 0.7118095856761409663227733763 0.7603988502721020472053691249 10.0 \n", + "29 0.6653106054301532393043123678 0.6824632244060651494342147825 10.0 \n", + "30 0.7213601153042196186627053074 0.7438397659641512667250250377 10.0 \n", + "\n", + " timestamp \n", + "0 2018-10-01 15:16:24 \n", + "1 2018-10-01 15:16:25 \n", + "2 2018-10-01 15:16:25 \n", + "3 2018-10-01 15:16:25 \n", + "4 2018-10-01 15:16:26 \n", + "5 2018-10-01 15:16:26 \n", + "6 2018-10-01 15:16:26 \n", + "7 2018-10-01 15:16:27 \n", + "8 2018-10-01 15:16:27 \n", + "9 2018-10-01 15:16:27 \n", + "10 2018-10-01 15:16:28 \n", + "11 2018-10-01 15:16:28 \n", + "12 2018-10-01 15:16:28 \n", + "13 2018-10-01 15:16:29 \n", + "14 2018-10-01 15:16:29 \n", + "15 2018-10-01 15:16:29 \n", + "16 2018-10-01 15:16:30 \n", + "17 2018-10-01 15:16:30 \n", + "18 2018-10-01 15:16:30 \n", + "19 2018-10-01 15:16:31 \n", + "20 2018-10-01 15:16:31 \n", + "21 2018-10-01 15:16:31 \n", + "22 2018-10-01 15:16:32 \n", + "23 2018-10-01 15:16:32 \n", + "24 2018-10-01 15:16:32 \n", + "25 2018-10-01 15:16:33 \n", + "26 2018-10-01 15:16:33 \n", + "27 2018-10-01 15:16:33 \n", + "28 2018-10-01 15:16:34 \n", + "29 2018-10-01 15:16:34 \n", + "30 2018-10-01 15:16:34 " + ] + }, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -813,332 +1359,7 @@ }, { "cell_type": "code", - "execution_count": 42, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0\n", - "1\n", - "2\n", - "3\n", - "4\n" - ] - } - ], - "source": [ - "for x in list(range(5)):\n", - " print(x)" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "metadata": {}, - "outputs": [], - "source": [ - "def simulation(states_list, configs, env_processes, time_seq, runs):\n", - " pipeline_run = []\n", - " for run in range(runs):\n", - " if run == 0:\n", - " pipeline_run += pipeline(states_list, configs, env_processes, time_seq)\n", - "# pipeline_run += [run]\n", - " else:\n", - " pipeline_run += pipeline(pipeline_run[-1], configs, env_processes, time_seq)\n", - "# pipeline_run += [run]\n", - " return pipeline_run" - ] - }, - { - "cell_type": "code", - "execution_count": 79, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0, 1]" - ] - }, - "execution_count": 79, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "list(range(2))" - ] - }, - { - "cell_type": "code", - "execution_count": 77, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
mech_steps1s2s3s4time_steptimestamp
00240002018-10-01 15:16:24
1112150.96133742191122872888797701313.05262791623336182667003413412018-10-01 15:16:25
2224.8151.7878418867054752478439788316.14210807562603620769166584212018-10-01 15:16:25
3324.8463.82.6603514160051104294423873439.30572704359699394374669537612018-10-01 15:16:25
4111551.8411991.842.4646451853433646554407158469.33777728437343571731501191922018-10-01 15:16:26
5223104.6433083830337963148274211991.842.30463914826193806262431798010.2960246753892924374554966522018-10-01 15:16:26
6023104.6433083830337963148274236429.283308383033796314827421.74501435017167714302639392610.7983192271393526493051916502018-10-01 15:16:26
7111551.8411991.842.4646451853433646554407158469.33777728437343571731501191922018-10-01 15:16:26
8223104.6433083830337963148274211991.842.30463914826193806262431798010.2960246753892924374554966522018-10-01 15:16:26
9023104.6433083830337963148274236429.283308383033796314827421.74501435017167714302639392610.7983192271393526493051916502018-10-01 15:16:26
101841731806.1068385748529941713841745131.74683857485299417132.67443317714085638901916999613.0006236569486193745271504912018-10-01 15:16:27
1121683463613.213661318738279214841745131.74683857485299417133.62410141757133180976719867316.2064237531334924799690398512018-10-01 15:16:27
1231683463613.2136613187382792142525245934.2438082766250697005.62404596810520747959405439719.0605228567092632757599263112018-10-01 15:16:27
1314251159648082116507.1228759154251159648923898829.1530228735.99385581199740180262345385019.9848285645724548773428862922018-10-01 15:16:28
1428502319296164233015.2457518304251159648923898829.1530228735.89779674502673599164725994120.3451883001598149011174066822018-10-01 15:16:28
1538502319296164233015.24575183012753478947613377799.642582985.92907068676888572790928438921.1886549224812131716461903422018-10-01 15:16:28
\n", - "
" - ], - "text/plain": [ - " mech_step s1 s2 \\\n", - "0 0 2 4 \n", - "1 1 12 15 \n", - "2 2 24.8 15 \n", - "3 3 24.8 463.8 \n", - "4 1 11551.84 11991.84 \n", - "5 2 23104.64330838303379631482742 11991.84 \n", - "6 0 23104.64330838303379631482742 36429.28330838303379631482742 \n", - "7 1 11551.84 11991.84 \n", - "8 2 23104.64330838303379631482742 11991.84 \n", - "9 0 23104.64330838303379631482742 36429.28330838303379631482742 \n", - "10 1 841731806.1068385748529941713 841745131.7468385748529941713 \n", - "11 2 1683463613.213661318738279214 841745131.7468385748529941713 \n", - "12 3 1683463613.213661318738279214 2525245934.243808276625069700 \n", - "13 1 4251159648082116507.122875915 4251159648923898829.153022873 \n", - "14 2 8502319296164233015.245751830 4251159648923898829.153022873 \n", - "15 3 8502319296164233015.245751830 12753478947613377799.64258298 \n", - "\n", - " s3 s4 time_step \\\n", - "0 0 0 0 \n", - "1 0.9613374219112287288879770131 3.052627916233361826670034134 1 \n", - "2 1.787841886705475247843978831 6.142108075626036207691665842 1 \n", - "3 2.660351416005110429442387343 9.305727043596993943746695376 1 \n", - "4 2.464645185343364655440715846 9.337777284373435717315011919 2 \n", - "5 2.304639148261938062624317980 10.29602467538929243745549665 2 \n", - "6 1.745014350171677143026393926 10.79831922713935264930519165 0 \n", - "7 2.464645185343364655440715846 9.337777284373435717315011919 2 \n", - "8 2.304639148261938062624317980 10.29602467538929243745549665 2 \n", - "9 1.745014350171677143026393926 10.79831922713935264930519165 0 \n", - "10 2.674433177140856389019169996 13.00062365694861937452715049 1 \n", - "11 3.624101417571331809767198673 16.20642375313349247996903985 1 \n", - "12 5.624045968105207479594054397 19.06052285670926327575992631 1 \n", - "13 5.993855811997401802623453850 19.98482856457245487734288629 2 \n", - "14 5.897796745026735991647259941 20.34518830015981490111740668 2 \n", - "15 5.929070686768885727909284389 21.18865492248121317164619034 2 \n", - "\n", - " timestamp \n", - "0 2018-10-01 15:16:24 \n", - "1 2018-10-01 15:16:25 \n", - "2 2018-10-01 15:16:25 \n", - "3 2018-10-01 15:16:25 \n", - "4 2018-10-01 15:16:26 \n", - "5 2018-10-01 15:16:26 \n", - "6 2018-10-01 15:16:26 \n", - "7 2018-10-01 15:16:26 \n", - "8 2018-10-01 15:16:26 \n", - "9 2018-10-01 15:16:26 \n", - "10 2018-10-01 15:16:27 \n", - "11 2018-10-01 15:16:27 \n", - "12 2018-10-01 15:16:27 \n", - "13 2018-10-01 15:16:28 \n", - "14 2018-10-01 15:16:28 \n", - "15 2018-10-01 15:16:28 " - ] - }, - "execution_count": 77, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "pd.DataFrame(flatten(simulation(states_list, configs, env_processes, range(2), 2)))" - ] - }, - { - "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -1148,7 +1369,7 @@ "traceback": [ "\u001b[0;31m--------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mstate_dict\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m's1'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'3323'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m's2'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'2572'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m's3'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'2.657'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m's4'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'7.914'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'timestamp'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'2018-10-01 15:16:26'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'mech_step'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'time_step'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mstate_dict\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mv\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mquantize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mTWOPLACES\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mROUND_DOWN\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mv\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mstate_dict\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mv\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mstate_dict\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnon_numeric\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0mstate_dict\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mstate_dict\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m's1'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'3323'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m's2'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'2572'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m's3'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'2.657'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m's4'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'7.914'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'timestamp'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'2018-10-01 15:16:26'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'mech_step'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'time_step'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mstate_dict\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mv\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mquantize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mTWOPLACES\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mROUND_DOWN\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mv\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mstate_dict\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mv\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mDecimal\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mstate_dict\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnon_numeric\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0mstate_dict\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mNameError\u001b[0m: name 'non_numeric' is not defined" ] }