Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Project: test
Views: 1984
nazwa_lista=['100.txt','200.txt'] import csv import sys x_list_1=[] y_list_1=[] data=[] for str in nazwa_lista: with open(nazwa_lista[0], 'rb') as csvfile: spamreader = csv.reader(csvfile, delimiter='\t') row_list=[] for row in spamreader: #if True: #print((unicode(row[0]).isnumeric())) row_list.append(row) #y_list_1.append(float(row[1])) #data=row_lis probes_no=len(row_list);probes_no data.append(row_list[8:25000])#;data;print('\n') single_data=[float(row[0].replace(',','.')) for row in data[0] ]; # x_list_2=[] # y_list_2=[] # # with open('./dane/'+nazwa_lista[1]+'_node.csv', 'rb') as csvfile: # spamreader = csv.reader(csvfile, delimiter=';') # for row in spamreader: # x_list_2.append(float(row[0])) # y_list_2.append(float(row[1])) #list_plot(x_list,plotjoined=True) # # y_list_2[0:20]
230463 230463
signal_1=single_data signal_2=single_data probes_no_1=len(signal_1) probes_no_2=len(signal_2) #dt_1=x_list_1[1]-x_list_1[0] #dt_2=x_list_2[1]-x_list_2[0] dt=0.000039; import numpy.fft as fft rms_spec_1=abs(fft.fft(signal_1))/probes_no_1 rms_spec_shift_1=fft.fftshift(rms_spec_1) f_span_1=fft.fftshift(fft.fftfreq(probes_no_1,d=dt)) import numpy.fft as fft rms_spec_2=abs(fft.fft(signal_2))/probes_no_2 rms_spec_shift_2=fft.fftshift(rms_spec_2) f_span_2=fft.fftshift(fft.fftfreq(probes_no_2,d=dt))
import matplotlib matplotlib.rcdefaults() #matplotlib.rcParams['text.usetex'] = True #matplotlib.rcParams['text.latex.unicode'] = True #matplotlib.rcParams['font.family'] = 'sans-serif' matplotlib.rcParams['mathtext.fontset'] = 'cm' import matplotlib.pyplot as plt spec_1=plt.plot(f_span_1,rms_spec_shift_1,label=nazwa_lista[0]+' redistributive case') plt.xlabel(r'$f [Hz]$') plt.ylabel(r'$A_{string} \left[\frac {mm^2} {s} \right]$' ) spec_2=plt.plot(f_span_2,rms_spec_shift_2,label=r'Mass redistributive to the first node') #plt.title("Widmo amplitudowe") plt.xlim([0, 300]) #plt.ylim([0, 0.005]) plt.legend() plt.show() plt.savefig('first_node.png') plt.figure() matplotlib.rcdefaults() matplotlib.rcParams['text.usetex'] = True matplotlib.rcParams['text.latex.unicode'] = True #matplotlib.rcParams['font.family'] = 'sans-serif' #matplotlib.rcParams['mathtext.fontset'] = 'cm' spec_1=plt.plot(f_span_1,rms_spec_shift_1,label='Basic redistributive case') plt.xlabel(r'$f [Hz]$') plt.ylabel(r'$A_{string} \left[\frac {mm} {s^2} \right]$' ) spec_2=plt.plot(f_span_2,rms_spec_shift_2,label=r'Mass redistributive to the first node') #plt.title("Widmo amplitudowe") plt.xlim([0, 300]) #plt.ylim([0, 0.0003]) plt.legend() plt.show()
Error in lines 5-5 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> NameError: name 'f_span_1' is not defined