Initialize Experiment


In [1]:
%load_ext noworkflow
import numpy as np
import matplotlib.pyplot as plt
from precipitation import read, prepare
%matplotlib inline
"Initialized"


Out[1]:
'Initialized'

Bar graph plot function

  • PREC contains the precipitation data
  • MONTHS defines the interval
  • years is a list of legends

In [2]:
def bar_graph(years):
    global PREC, MONTHS
    prepare(PREC, MONTHS, years, plt)
    plt.savefig("out.png")

Experiment


In [5]:
%%now_run --interactive
MONTHS = np.arange(12) + 1
d12 = read('p12.dat')
prec12 = []
PREC = prec12, prec13, prec14

for i in MONTHS:
    prec12.append(sum(d12[i]))


Out[5]:
{"max_duration": {"19": 12062}, "nodes": [{"node": {"count": 1, "info": "Trial 19\u003cbr\u003eFunction \u003cb\u003e/tmp/now_run_8qBSYn/now_run_NH5Wb8.py\u003c/b\u003e called at line 126\u003cbr/\u003eTotal duration: 12062 microseconds for 1 activations\u003cbr/\u003eMean: 12062.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #524 from 2015-07-04 03:59:31.367439 to 2015-07-04 03:59:31.379501 (12062 microseconds)\u003cbr/\u003eReturned None", "level": 0, "trial_id": 19, "duration": 12062, "line": 126, "mean": 12062.0}, "index": 0, "name": "/tmp/now_run_8qBSYn/now_run_NH5Wb8.py", "caller_id": null, "repr": "C(S(126-/tmp/now_run_8qBSYn/now_run_NH5Wb8.py), G([S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(7-list.append)-1-\u003eS(7-sum)], [S(7-sum)-1-\u003eS(7-list.append)], [S(2-read)-1-\u003eS(7-sum)], [S(1-arange)-1-\u003eS(2-read)]))"}, {"node": {"count": 12, "info": "Trial 19\u003cbr\u003eFunction \u003cb\u003elist.append\u003c/b\u003e called at line 7\u003cbr/\u003eTotal duration: 154 microseconds for 12 activations\u003cbr/\u003eMean: 12.8333333333 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #528 from 2015-07-04 03:59:31.378648 to 2015-07-04 03:59:31.378661 (13 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #530 from 2015-07-04 03:59:31.378729 to 2015-07-04 03:59:31.378742 (13 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #532 from 2015-07-04 03:59:31.378806 to 2015-07-04 03:59:31.378819 (13 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #534 from 2015-07-04 03:59:31.378879 to 2015-07-04 03:59:31.378892 (13 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #536 from 2015-07-04 03:59:31.378956 to 2015-07-04 03:59:31.378970 (14 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #538 from 2015-07-04 03:59:31.379030 to 2015-07-04 03:59:31.379042 (12 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #540 from 2015-07-04 03:59:31.379103 to 2015-07-04 03:59:31.379116 (13 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #542 from 2015-07-04 03:59:31.379171 to 2015-07-04 03:59:31.379183 (12 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #544 from 2015-07-04 03:59:31.379242 to 2015-07-04 03:59:31.379255 (13 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #546 from 2015-07-04 03:59:31.379315 to 2015-07-04 03:59:31.379328 (13 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #548 from 2015-07-04 03:59:31.379385 to 2015-07-04 03:59:31.379397 (12 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #550 from 2015-07-04 03:59:31.379456 to 2015-07-04 03:59:31.379469 (13 microseconds)\u003cbr/\u003eReturned None", "level": 1, "trial_id": 19, "duration": 154, "line": 7, "mean": 12.833333333333334}, "index": 1, "name": "list.append", "caller_id": 524, "repr": "S(7-list.append)"}, {"node": {"count": 12, "info": "Trial 19\u003cbr\u003eFunction \u003cb\u003esum\u003c/b\u003e called at line 7\u003cbr/\u003eTotal duration: 181 microseconds for 12 activations\u003cbr/\u003eMean: 15.0833333333 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #527 from 2015-07-04 03:59:31.378597 to 2015-07-04 03:59:31.378620 (23 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #529 from 2015-07-04 03:59:31.378687 to 2015-07-04 03:59:31.378702 (15 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #531 from 2015-07-04 03:59:31.378767 to 2015-07-04 03:59:31.378782 (15 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #533 from 2015-07-04 03:59:31.378841 to 2015-07-04 03:59:31.378855 (14 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #535 from 2015-07-04 03:59:31.378917 to 2015-07-04 03:59:31.378931 (14 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #537 from 2015-07-04 03:59:31.378993 to 2015-07-04 03:59:31.379007 (14 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #539 from 2015-07-04 03:59:31.379065 to 2015-07-04 03:59:31.379079 (14 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #541 from 2015-07-04 03:59:31.379135 to 2015-07-04 03:59:31.379150 (15 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #543 from 2015-07-04 03:59:31.379205 to 2015-07-04 03:59:31.379220 (15 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #545 from 2015-07-04 03:59:31.379277 to 2015-07-04 03:59:31.379291 (14 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #547 from 2015-07-04 03:59:31.379350 to 2015-07-04 03:59:31.379364 (14 microseconds)\u003cbr/\u003eReturned None\u003cbr/\u003e\u003cbr/\u003eActivation #549 from 2015-07-04 03:59:31.379419 to 2015-07-04 03:59:31.379433 (14 microseconds)\u003cbr/\u003eReturned None", "level": 1, "trial_id": 19, "duration": 181, "line": 7, "mean": 15.083333333333334}, "index": 2, "name": "sum", "caller_id": 524, "repr": "S(7-sum)"}, {"node": {"count": 1, "info": "Trial 19\u003cbr\u003eFunction \u003cb\u003eread\u003c/b\u003e called at line 2\u003cbr/\u003eTotal duration: 10417 microseconds for 1 activations\u003cbr/\u003eMean: 10417.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #526 from 2015-07-04 03:59:31.367731 to 2015-07-04 03:59:31.378148 (10417 microseconds)\u003cbr/\u003eArguments: filename='p12.dat'\u003cbr/\u003eReturned defaultdict(\u003ctype 'list'\u003e, {1: [7.8, 44.2, 30.6, 0.0, 0.0, 0.0, 46.2, 0.0, 2.2, 0.1, 0.8, 0.3, 0.0, 0.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0.0, 0.0, 0.0, 0.0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.6, 0.0, 0.0], 9: [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8, 17.4, 0.0, 0.0, 0.0, 64.7, 2.4, 0.0, 0.0, 0.0], 10: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 17.0, 14.1, 1.6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 24.0, 0.0, 9.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 11: [0.0, 0.4, 1.2, 0.1, 0.0, 2.0, 0.0, 0.0, 0.0, 1.6, 4.9, 0.0, 0.6, 36.2, 8.5, 3.6, 3.7, 4.0, 0.0, 0.3, 0.6, 0.0, 0.0, 0.0, 3.3, 9.1, 3.8, 9.3, 0.0, 0.0], 12: [0.0, 0.0, 3.9, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.3, 11.2, 14.5, 3.0, 3.0, 0.0, 0.0, 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.6]})", "level": 1, "trial_id": 19, "duration": 10417, "line": 2, "mean": 10417.0}, "index": 3, "name": "read", "caller_id": 524, "repr": "S(2-read)"}, {"node": {"count": 1, "info": "Trial 19\u003cbr\u003eFunction \u003cb\u003earange\u003c/b\u003e called at line 1\u003cbr/\u003eTotal duration: 68 microseconds for 1 activations\u003cbr/\u003eMean: 68.0 microseconds per activation\u003cbr/\u003e\u003cbr/\u003eActivation #525 from 2015-07-04 03:59:31.367522 to 2015-07-04 03:59:31.367590 (68 microseconds)\u003cbr/\u003eReturned None", "level": 1, "trial_id": 19, "duration": 68, "line": 1, "mean": 68.0}, "index": 4, "name": "arange", "caller_id": 524, "repr": "S(1-arange)"}], "edges": [{"count": 1, "source": 0, "type": "initial", "target": 0}, {"count": 1, "source": 0, "type": "call", "target": 4}, {"count": 1, "source": 1, "type": "return", "target": 0}, {"count": 12, "source": 2, "type": "sequence", "target": 1}, {"count": 11, "source": 1, "type": "sequence", "target": 2}, {"count": 1, "source": 3, "type": "sequence", "target": 2}, {"count": 1, "source": 4, "type": "sequence", "target": 3}], "min_duration": {"19": 68}}

In [4]:
bar_graph(['2012', '2013', '2014'])



In [ ]: