Imports¶
In [2]:
%matplotlib notebook
from activepapers.exploration import ActivePaper
import matplotlib.pyplot as plt
import numpy as np
Open the ActivePaper¶
You can download the ActivePaper created in the previous blog here.
In [3]:
ap = ActivePaper('test.ap')
In [4]:
ap?
If there is README.txt file in the documentation group of your ActivePaper, it will automatically appear with the previous command.
Extract the data¶
In [5]:
dset_1 = ap.data['inputs/dataset_1'][:]
dset_1
Out[5]:
In [6]:
result = ap.data['output/sum'][:]
result
Out[6]:
Plot the data¶
In [7]:
plt.plot(dset_1, result)
plt.show()
Visualize a PDF file from the documentation¶
In [8]:
# A small wrapper around the data to tell Jupyter that this is PDF data
class PDF(object):
def __init__(self, pdf_data):
self.pdf_data = pdf_data
def _repr_pdf_(self):
return self.pdf_data
# Read the internal file
with ap.open_documentation('plot.pdf', mode='rb') as pdf_file:
plot = PDF(pdf_file.read())
plot
Out[8]:
Read the code¶
In [9]:
adding_data_script = ap.read_code('adding_data')
In [10]:
print(adding_data_script)
Extract and interact with the "python-packages" code¶
In this test.ap file, there is no "python-packages" in the code group. If you have one like in this example, you can import the code (see the "import time_series" part) and interact with the code.