import numpy as np;
import matplotlib.pyplot as plt;
plt.rcParams.update({"text.usetex":True});
%config InlineBackend.figure_format = "svg"
import pandas as pd
from scipy.interpolate import interp1d
i_a = np.array([0,1,2,3,4,5,6,9,12])
velo = np.zeros(np.shape(i_a));
stddev = np.zeros(np.shape(i_a));
y = np.zeros(np.shape(i_a));
for i in np.arange(np.size(i_a)):
filename = 'd-%d-2.csv'%i_a[i];
df = pd.read_csv(filename)
y[i] = i_a[i]*0.3
velo[i] = np.mean(df["051 [m/s]"])
stddev[i] = np.std(df["051 [m/s]"])
f = interp1d(y, velo, kind='cubic')
yf = np.linspace(np.min(y), np.max(y), 60)
plt.errorbar(y, velo, stddev)
plt.plot(yf, f(yf), '--k')
plt.xlabel("axial distance from fan (in m)")
plt.ylabel("Averaged velocity (m/s)")
Text(0, 0.5, 'Averaged velocity (m/s)')
i_a = np.array([0,2,4,6])
velo = np.zeros(np.shape(i_a));
stddev = np.zeros(np.shape(i_a));
y = np.zeros(np.shape(i_a));
for i in np.arange(np.size(i_a)):
filename = 'd-9-%d.csv'%i_a[i];
df = pd.read_csv(filename)
y[i] = i_a[i]*0.3
velo[i] = np.mean(df["051 [m/s]"])
stddev[i] = np.std(df["051 [m/s]"])
f = interp1d(y, velo, kind='cubic')
yf = np.linspace(np.min(y), np.max(y), 60)
plt.errorbar(y-np.mean(y), velo, stddev)
plt.plot(yf-np.mean(yf), f(yf), '--k')
plt.xlabel("transerse distance from axis at 2.7m")
plt.ylabel("Averaged velocity (m/s)")
Text(0, 0.5, 'Averaged velocity (m/s)')
import glob
import re
num_files = np.size(glob.glob('*.csv'));
points = np.zeros((num_files,2))
velo = np.zeros(num_files)
i = 0
for filename in glob.glob('*.csv'):
matches = re.match(r'd-(.*)-(.*).csv', filename,flags=0)
xlocs = float(matches.group(2))*0.3
ylocs = float(matches.group(1))*0.3
df = pd.read_csv(filename)
points[i,0] = xlocs; points[i,1] = ylocs;
velo[i] = np.mean(df["051 [m/s]"])
i = i+1
from scipy.interpolate import griddata
xg = np.linspace(np.min(points[:,0]), np.max(points[:,0]))
yg = np.linspace(np.min(points[:,1]), np.max(points[:,1]))
[Xg, Yg] = np.meshgrid(xg,yg)
Vg = griddata(points, velo, (Xg,Yg), method='linear')
plt.pcolor(Xg,Yg,Vg); plt.colorbar();
<ipython-input-6-edc44864bec3>:1: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3. Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading']. This will become an error two minor releases later. plt.pcolor(Xg,Yg,Vg); plt.colorbar();