jar_project/plot_eigenmannia_jar.py
2020-09-02 10:47:31 +02:00

50 lines
1.2 KiB
Python

import matplotlib.pyplot as plt
import numpy as np
import os
import nix_helpers as nh
from IPython import embed
res_df1 = np.load('res_df1.npy')
res_df2 = np.load('res_df2.npy')
res_df = np.load('res_df.npy')
mres = []
mdf = []
currf = None
idxlist = []
for i, d in enumerate(res_df):
if currf is None or currf == d[0]:
currf = d[0]
idxlist.append(i)
else: # currf != f
meanres = [] # lists to make mean of
meandf = []
for x in idxlist:
meanres.append(res_df[x][1])
meandf.append(res_df[x][0])
meanedres = np.mean(meanres)
meaneddf = np.mean(meandf)
mres.append(meanedres)
mdf.append(meaneddf)
currf = d[0] # set back for next loop
idxlist = [i]
meanres = [] # lists to make mean of
meandf = []
for y in idxlist:
meanres.append(res_df[y][1])
meandf.append(res_df[y][0])
meanedres = np.mean(meanres)
meaneddf = np.mean(meandf)
mres.append(meanedres)
mdf.append(meaneddf)
plt.plot(mdf, mres, 'o')
plt.xlabel('deltaf [Hz]')
plt.ylabel('JAR_respones [Hz]')
plt.axhline(0, color='grey', lw =1)
plt.axvline(0, color='grey', lw = 1)
plt.title('JAR_response_to_deltaf_eigenmannia')
plt.show()