In [1]:
%matplotlib inline
from minke import sources
In [2]:
supernova = sources.Scheidegger2010(0, 0, 118, filepath="../nrdata/Scheidegger2010/R1E1CA_L.txt")
In [3]:
supernova.plot()
In [4]:
muller = sources.Mueller2012(0,0, 118, filepath="../nrdata/Mueller2012/L15-3.dat")
In [5]:
muller.plot()
In [ ]:
import matplotlib.pyplot as plt
import numpy as np
In [ ]:
hp, hx, _, _ = muller._generate(half=True)
#plt.specgram(hp.data.data)
In [ ]:
from scipy.signal import detrend
In [16]:
plt.plot(detrend(hp.data.data))
Out[16]:
In [17]:
from scipy import signal
In [35]:
>>> b, a = signal.butter(15, 50*np.pi, 'high', analog=True)
>>> w, h = signal.freqs(b, a)
>>> plt.semilogx(w, 20 * np.log10(abs(h)))
>>> plt.title('Butterworth filter frequency response')
>>> plt.xlabel('Frequency [radians / second]')
>>> plt.ylabel('Amplitude [dB]')
>>> plt.margins(0, 0.1)
>>> plt.grid(which='both', axis='both')
In [43]:
interpolator = interp.interp1d(x_old, y_old)
Out[43]:
In [75]:
#plt.plot(hp.data.data)
# zero pad the data to the next highest power of 2
data = np.zeros(int(2**np.ceil(np.log2(len(hp.data.data)))))
data[:len(hp.data.data)] = hp.data.data
# calculate the filtering frequency
sample_rate = 16384.0
filter_freq = 50
knee = (2*filter_freq / sample_rate)*np.pi
# construct a high-pass filter
b, a = signal.butter(20, knee, 'highpass', analog=True)
plt.plot(data)
data = signal.filtfilt(b,a, data)
# Apply the filter to the padded data
plt.plot(data)
Out[75]:
In [65]:
win = signal.windows.hann(99)
winstart = win[:50]
winend = win[50:]
data[:50] *= winstart
data[-49:] *= winend
plt.plot(data)
Out[65]:
In [ ]:
% ramp for 1.5 cycles @ 500 Hz (i.e. 3 ms, or 50 samples at 16384)
if (doRampdown)
win = hann(99);
winstart = win(1:50)';
winend = win(50:99)';
y(1:50) = y(1:50).*winstart;
y(end-49:end) = y(end-49:end).*winend;
end
In [33]:
np.sum(hp.data.data)
Out[33]:
In [ ]:
def condition_waveform(self, times, strain):
In [10]:
plt.specgram(np.sqrt(hp.data.data**2+hx.data.data**2), Fs=50);
In [11]:
plt.specgram?
In [12]:
from minke import distribution
In [13]:
angles = distribution.supernova_angle(100)
In [14]:
for angle in angles:
muller = sources.Mueller2012(angle[0], angle[1], 118, filepath="../nrdata/Mueller2012/L15-3.dat")
muller.plot()
In [15]:
for angle in angles:
muller = sources.Mueller2012(angle[0], angle[1], 118, filepath="../nrdata/Mueller2012/N20-2.dat")
muller.plot()
In [ ]:
for angle in angles:
muller = sources.Mueller2012(angle[0], angle[1], 118, filepath="../nrdata/Mueller2012/W15-4.dat")
muller.plot()
In [ ]: