Some cosmetics on DCfc of class magnitude.

This commit is contained in:
Ludger Küperkoch 2015-09-29 14:55:15 +02:00
parent f4b905c2e6
commit 708f0a1f1a

View File

@ -184,12 +184,11 @@ class DCfc(Magnitude):
[optspecfit, pcov] = curve_fit(synthsourcespec, F, YY.real, [DCin, Fcin]) [optspecfit, pcov] = curve_fit(synthsourcespec, F, YY.real, [DCin, Fcin])
self.w0 = optspecfit[0] self.w0 = optspecfit[0]
self.fc = optspecfit[1] self.fc = optspecfit[1]
print ("DCfc: Determined DC-value: %f, \n" \ print ("DCfc: Determined DC-value: %e m/Hz, \n" \
"Determined corner frequency: %f" % (self.w0, self.fc)) "Determined corner frequency: %f Hz" % (self.w0, self.fc))
if self.getiplot() > 1: if self.getiplot() > 1:
if iplot > 1:
f1 = plt.figure() f1 = plt.figure()
plt.subplot(2,1,1) plt.subplot(2,1,1)
# show displacement in mm # show displacement in mm
@ -200,13 +199,14 @@ class DCfc(Magnitude):
plt.ylabel('Displacement [mm]') plt.ylabel('Displacement [mm]')
plt.subplot(2,1,2) plt.subplot(2,1,2)
plt.semilogy(f, Y.real, 'k') plt.loglog(f, Y.real, 'k')
plt.semilogy(F, YY.real) plt.loglog(F, YY.real)
plt.semilogy(F, fit, 'g') plt.loglog(F, fit, 'g')
plt.title('Source Spectrum from P Pulse, DC=%f m/Hz, fc=%4.1f Hz' \ plt.title('Source Spectrum from P Pulse, DC=%e m/Hz, fc=%4.1f Hz' \
% (self.w0, self.fc)) % (self.w0, self.fc))
plt.xlabel('Frequency [Hz]') plt.xlabel('Frequency [Hz]')
plt.ylabel('Amplitude [m/Hz]') plt.ylabel('Amplitude [m/Hz]')
plt.grid()
plt.show() plt.show()
raw_input() raw_input()
plt.close(f1) plt.close(f1)
@ -230,9 +230,5 @@ def synthsourcespec(f, omega0, fcorner):
#ssp = omega0 / (pow(2, (1 + f / fcorner))) #ssp = omega0 / (pow(2, (1 + f / fcorner)))
ssp = omega0 / (1 + pow(2, (f / fcorner))) ssp = omega0 / (1 + pow(2, (f / fcorner)))
#plt.plot(f, ssp)
#plt.show()
#raw_input()
return ssp return ssp