In [ ]:
"""Run this cell to add the start_new_dagpy_block to you namespace. Call it from any cell to start a new block there."""
from IPython.display import display_javascript
def start_new_dagpy_block():
    header_code = """### Block_id\\n\\n##### Description\\n\\n##### Parents\\n\\n##### Filter\\n\\n##### File\\n"""
    display_javascript("""var t_cell = IPython.notebook.get_selected_cell()
    var t_index  = IPython.notebook.get_cells().indexOf(t_cell)-1
    var t_cell = IPython.notebook.get_cell(t_index)
    t_cell.set_text("{header_code}");
    t_cell.metadata = {{"dagpy": {{"cell_type": "delimiter"}}}};
    IPython.notebook.to_markdown(t_index);
    IPython.notebook.get_cell(t_index).render();""".format(header_code = header_code), raw=True)

DAGpy Flow notebook

If you want to start a new block, just run the start_new_dagpy_block() in the cell!

Block_id

A

Description

This is the description of the block A.

Parents
Filter

var_a

File

A.ipynb


In [1]:
# DAGpy input filter
import dill

In [2]:
var_a = 5

In [3]:
print('var_a = {}'.format(var_a))


var_a = 5

In [4]:
# DAGpy output filter
# To change the filter, edit the block properties, not this cell.
import dill
import os
os.makedirs(os.path.dirname('cache/A_var_a.dill'), exist_ok=True)
dill.dump(var_a, open('cache/A_var_a.dill', 'wb+'))

Block_id

B

Description

This is the description of the block A.

Parents

A

Filter

var_b

File

B.ipynb


In [1]:
# DAGpy input filter
import dill
A_var_a = dill.load(open('cache/A_var_a.dill','rb'))

In [2]:
var_b = A_var_a / 2

In [3]:
print('var_b = {}'.format(var_b))


var_b = 2.5

In [4]:
# DAGpy output filter
# To change the filter, edit the block properties, not this cell.
import dill
import os
os.makedirs(os.path.dirname('cache/B_var_b.dill'), exist_ok=True)
dill.dump(var_b, open('cache/B_var_b.dill', 'wb+'))

Block_id

C

Description

This is the description of the block C.

Parents

A

Filter

var_c

File

C.ipynb


In [1]:
# DAGpy input filter
import dill
A_var_a = dill.load(open('cache/A_var_a.dill','rb'))

In [2]:
var_c = A_var_a * 2

In [3]:
print('var_c = {}'.format(var_c))


var_c = 10

In [4]:
# DAGpy output filter
# To change the filter, edit the block properties, not this cell.
import dill
import os
os.makedirs(os.path.dirname('cache/C_var_c.dill'), exist_ok=True)
dill.dump(var_c, open('cache/C_var_c.dill', 'wb+'))

Block_id

D

Description

This is the description of the block D.

Parents

B, C

Filter
File

D.ipynb


In [1]:
# DAGpy input filter
import dill
B_var_b = dill.load(open('cache/B_var_b.dill','rb'))
C_var_c = dill.load(open('cache/C_var_c.dill','rb'))

In [2]:
print('var_b = {}'.format(B_var_b + C_var_c))


var_b = 12.5

In [3]:
# DAGpy output filter
# To change the filter, edit the block properties, not this cell.
import dill
import os