In [1]:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os

In [21]:
print(os.getcwd())


/Users/cflannery/Documents/github/MAE170/jupyter/Lab2

In [25]:
list_of_files = {}
path = '/Users/cflannery/Documents/github/MAE170/jupyter/Lab2/raw_data'
for (dirpath, dirnames, filenames) in os.walk(path):
    for filename in filenames:
        if filename.endswith('.xlsx'): 
            list_of_files[filename] = os.sep.join([dirpath, filename])
            
i = 0
for fileName in list_of_files:
    filePath = list_of_files[fileName]
    df = pd.read_excel(filePath,header=0)
    cols = df.columns
    
    plot = df.plot(x=cols[0], y=cols[1])
    plot.grid()
    plot.set_ylabel('Amplitude (V)')
    plot.set_xlabel('Time (s)')
    fig = plot.get_figure()
    saveName = ''
    for char in fileName:
        if char == '.':
            break
        saveName = saveName + char

    saveName = saveName + '.png'
    print(saveName)
    fig.savefig(saveName)
    i = i +1


/Users/cflannery/anaconda/lib/python3.6/site-packages/matplotlib/pyplot.py:524: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).
  max_open_warning, RuntimeWarning)
part2_1000.png
part2_10000.png
part2_1100.png
part2_2000.png
part2_500.png
part2_900.png
q5_200000_f10000.png
q5_20000_f10000.png
q5_900000_f100000.png

In [6]:
plt.show()

In [4]:
focusFile = '/Users/cflannery/Documents/github/UCSD-MAE170/jupyter/Lab2/Focus2.xlsx'
df = pd.read_excel(focusFile,header=0)
cols = df.columns

df[cols[0]] = df[cols[0]] *10**6
df[cols[1]] = df[cols[1]] *10**6

plot = df.plot.scatter(x=cols[0], y=cols[1], yerr=100)
plot.grid()
plot.set_xlabel('Vset (uV)')
plot.set_ylabel('Vout (uV)')
plot.set_title('Vout vs Vset')
# plot.set_xlim([-0.0005, 0.0015])
# plot.set_ylim([-0.0005, 0.0020])

fig = plot.get_figure()


saveName = 'focus2.png'

fig.savefig(saveName)


---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-4-9386e35b47ec> in <module>()
      1 focusFile = '/Users/cflannery/Documents/github/UCSD-MAE170/jupyter/Lab2/Focus2.xlsx'
----> 2 df = pd.read_excel(focusFile,header=0)
      3 cols = df.columns
      4 
      5 df[cols[0]] = df[cols[0]] *10**6

/Users/cflannery/anaconda/lib/python3.6/site-packages/pandas/io/excel.py in read_excel(io, sheetname, header, skiprows, skip_footer, index_col, names, parse_cols, parse_dates, date_parser, na_values, thousands, convert_float, has_index_names, converters, true_values, false_values, engine, squeeze, **kwds)
    189 
    190     if not isinstance(io, ExcelFile):
--> 191         io = ExcelFile(io, engine=engine)
    192 
    193     return io._parse_excel(

/Users/cflannery/anaconda/lib/python3.6/site-packages/pandas/io/excel.py in __init__(self, io, **kwds)
    247             self.book = xlrd.open_workbook(file_contents=data)
    248         elif isinstance(io, compat.string_types):
--> 249             self.book = xlrd.open_workbook(io)
    250         else:
    251             raise ValueError('Must explicitly set engine if not passing in'

/Users/cflannery/anaconda/lib/python3.6/site-packages/xlrd/__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows)
    393         peek = file_contents[:peeksz]
    394     else:
--> 395         with open(filename, "rb") as f:
    396             peek = f.read(peeksz)
    397     if peek == b"PK\x03\x04": # a ZIP file

FileNotFoundError: [Errno 2] No such file or directory: '/Users/cflannery/Documents/github/UCSD-MAE170/jupyter/Lab2/Focus2.xlsx'

In [ ]: