Created
February 11, 2020 17:40
-
-
Save RyanFleck/3a5c689b99fcbb0b952bf9202d811f10 to your computer and use it in GitHub Desktop.
Given a folder of CSV files, return a .png for each with the plotted values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import csv | |
import glob | |
import os | |
print("Gathering CSVs...") | |
csvFiles = sorted(glob.glob(os.getcwd() + "/*.csv")) | |
numpyFileData = [] | |
fig = 1 | |
for x in csvFiles: | |
print("Found " + x) | |
filename = os.path.splitext(os.path.basename(x))[0] | |
saveto = "{}.png".format(filename) | |
ms, SmV, mrad, RmV, CmV = np.loadtxt( | |
x, delimiter=',', skiprows=1, unpack=True) | |
plt.title("Amplitude {}".format(fig)) | |
plt.plot(ms, mrad, marker='x') | |
plt.xlabel('x axis label') | |
plt.ylabel('y axis label') | |
print("Saving graph to {}".format(saveto)) | |
plt.savefig(saveto, bbox_inches='tight') | |
plt.clf() | |
fig = fig + 0.5 | |
# Time (ms) | Raw speed error (mV) | Raw speed (mrad/s) | Reference (mV) | | |
# Control output (mV) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment