In [1]:
import pandas as pd
import matplotlib.pyplot as plt
import sys
import os
from downloader import download_latest
%matplotlib inline


Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=30560946615-aasjetjgpo70hpsujs9a3qmpd6hglkeg.apps.googleusercontent.com&access_type=offline

Authentication successful.
---------------------------------------------------------------------------
NotMatching                               Traceback (most recent call last)
<ipython-input-1-a5c9fbcc67e5> in <module>()
      3 import sys
      4 import os
----> 5 from downloader import download_latest
      6 get_ipython().magic(u'matplotlib inline')

/Users/kathryncogert/Reference/BioReactor-Data-Logging/Project/downloader.py in <module>()
     25     return
     26 
---> 27 download_latest()

/Users/kathryncogert/Reference/BioReactor-Data-Logging/Project/downloader.py in download_latest(reactorno, filename)
     22     if os.path.isfile(save_to):
     23         remove_file(save_to)
---> 24     read_from_reactordrive(reactorno, filename, save_to)
     25     return
     26 

/Users/kathryncogert/Reference/BioReactor-Data-Logging/Project/googledriveutils.pyc in read_from_reactordrive(reactorno, filename, save_file_as)
    282     file_to_read = find_reactorfileid(reactorno, filename)
    283     if file_to_read is False:
--> 284         raise NotMatching('The file specified: '+filename+' does not exist')
    285     else:
    286         file_to_read.GetContentFile(save_file_as)

NotMatching: The file specified: R1data does not exist

In [ ]:
download_latest()
curdir = os.getcwd()
pardir = os.path.abspath(os.path.join(curdir, os.pardir))
RDataPath = pardir+'/Data_Management/'+'R1data'
RData=pd.DataFrame.from_csv(RDataPath)
Cycles = RData[RData['Reactor Status'].shift() != RData['Reactor Status']]
Cycles = Cycles[Cycles['Reactor Status'] == 1]
IdxDates=Cycles.index

In [ ]:
len(IdxDates)

In [ ]:
def PlotDOOverCycle(CycleNo):
    RDataCycle1=RData[RData.index >= IdxDates[CycleNo]]
    if CycleNo!=len(IdxDates)-1:
        RDataCycle1=RDataCycle1[RDataCycle1.index < IdxDates[CycleNo+1]]
    print(IdxDates[CycleNo])
    fig, ax1 = plt.subplots()
    ax1.plot(RDataCycle1.index, RDataCycle1['DO mg/L'], 'b-')
    ax1.set_xlabel('time (s)')
    # Make the y-axis label and tick labels match the line color.
    ax1.set_ylabel('DO mg/L', color='b')
    for tl in ax1.get_yticklabels():
        tl.set_color('b')
    ax2 = ax1.twinx()
    ax2.plot(RDataCycle1.index, RDataCycle1['N2 Mass Flow Controller'], 'r-')
    ax2.set_ylabel('N2 Mass Flow Controller', color='r')
    for tl in ax2.get_yticklabels():
        tl.set_color('r')
    plt.show()

In [ ]:
from IPython.html.widgets import *
nocycles=len(IdxDates)
interact(PlotDOOverCycle, CycleNo=(0,nocycles-1,1))