In [1]:
%matplotlib inline
from minke import sources


/home/daniel/.virtualenvs/IGRlaptop21/minke/local/lib/python2.7/site-packages/matplotlib/__init__.py:1405: UserWarning: 
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)

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]:
[<matplotlib.lines.Line2D at 0x7f7410abef10>]

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]:
32768

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]:
[<matplotlib.lines.Line2D at 0x7f740ade9ad0>]

In [65]:
win = signal.windows.hann(99)
winstart = win[:50]
winend = win[50:]
data[:50] *= winstart
data[-49:] *= winend

plt.plot(data)


Out[65]:
[<matplotlib.lines.Line2D at 0x7f7407541b10>]

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]:
1.3000027124613842e-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()


/home/daniel/.virtualenvs/IGRlaptop21/minke/local/lib/python2.7/site-packages/matplotlib/pyplot.py:524: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).
  max_open_warning, RuntimeWarning)

In [15]:
for angle in angles:
    muller = sources.Mueller2012(angle[0], angle[1], 118, filepath="../nrdata/Mueller2012/N20-2.dat")
    muller.plot()


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-15-31d2f825fe79> in <module>()
      1 for angle in angles:
      2     muller = sources.Mueller2012(angle[0], angle[1], 118, filepath="../nrdata/Mueller2012/N20-2.dat")
----> 3     muller.plot()

/home/daniel/.virtualenvs/IGRlaptop21/minke/lib/python2.7/site-packages/minke-1.0.1-py2.7.egg/minke/sources.pyc in plot(self)
     92         Produce a plot of the injection.
     93         """
---> 94         hp, hx, _, _ = self._generate(half=True)
     95         f, ax = plt.subplots(1,2)
     96         times = np.arange(0, hp.deltaT*len(hp.data.data), hp.deltaT)

/home/daniel/.virtualenvs/IGRlaptop21/minke/lib/python2.7/site-packages/minke-1.0.1-py2.7.egg/minke/sources.pyc in _generate(self, rate, half, distance)
    139             except: pass
    140 
--> 141         hp, hx = lalburst.GenerateSimBurst(swig_row, 1.0/rate)
    142         # FIXME: Totally inefficent --- but can we deep copy a SWIG SimBurst?
    143         # DW: I tried that, and it doesn't seem to work :/

KeyboardInterrupt: 

In [ ]:
for angle in angles:
    muller = sources.Mueller2012(angle[0], angle[1], 118, filepath="../nrdata/Mueller2012/W15-4.dat")
    muller.plot()

In [ ]: