17 Generate simulated Advanced Virgo h(t) based on the baseline document
18 https://wwwcascina.virgo.infn.it/advirgo/docs/AdV_refsens_100512.txt
20 __author__ =
"Drew Keppel <drew.keppel@ligo.org>"
22 from gstlal
import pipeutil
24 from math
import cos, pi, sqrt
30 'Fake Advanced Virgo Source',
40 'Number of samples in each outgoing buffer',
41 0, gobject.G_MAXULONG, 16384 * 8 * 1,
42 gobject.PARAM_WRITABLE
47 'Instrument name (e.g., "V1")',
49 gobject.PARAM_WRITABLE
54 'Channel name (e.g., "h_16384Hz")',
56 gobject.PARAM_WRITABLE
61 gst.PadTemplate(
"src",
62 gst.PAD_SRC, gst.PAD_ALWAYS,
63 gst.caps_from_string(
"""
66 endianness = (int) BYTE_ORDER,
73 def do_set_property(self, prop, val):
74 if prop.name ==
'blocksize':
76 for elem
in self.iterate_sources():
77 elem.set_property(
'blocksize', val)
78 elif prop.name
in (
'instrument',
'channel-name'):
79 self.
__tags[prop.name] = val
80 tagstring =
','.join(
'%s="%s"' % kv
for kv
in self.__tags.iteritems())
81 self.__taginject.set_property(
'tags', tagstring)
86 Send SEEK and EOS events to the source elements, all others
87 to the by default bins send all events to the sink
92 if event.type
in (gst.EVENT_SEEK, gst.EVENT_EOS):
93 for elem
in self.iterate_sources():
94 success &= elem.send_event(event)
96 for elem
in self.iterate_sinks():
97 success &= elem.send_event(event)
102 super(lal_fakeadvvirgosrc, self).__init__()
104 self.
__tags = {
'units':
'strain'}
109 peak_width = 1 - 1e-3
112 b = [-1.0, 4 * peak_width, -6 * peak_width**2, 4 * peak_width**3, -peak_width**4]
113 chains.append(pipeutil.mkelems_in_bin(self,
114 (
'audiotestsrc', {
'wave':
'gaussian-noise',
'volume': vol,
'samplesperbuffer': 16384}),
115 (
'audioiirfilter', {
'a': a,
'b': b}),
119 central_freq = cos(2*pi*16.85/16384)
120 peak_width = 1. - 2e-5
123 b = [-1.0, 2 * central_freq * peak_width, -peak_width**2]
124 chains.append(pipeutil.mkelems_in_bin(self,
125 (
'audiotestsrc', {
'wave':
'gaussian-noise',
'volume': vol,
'samplesperbuffer': 16384}),
126 (
'audioiirfilter', {
'a': a,
'b': b}),
130 peak_width = 1. - 1e-3
133 b = [-1.0, 2 * peak_width, -peak_width**2]
134 chains.append(pipeutil.mkelems_in_bin(self,
135 (
'audiotestsrc', {
'wave':
'gaussian-noise',
'volume': vol,
'samplesperbuffer': 16384}),
136 (
'audioiirfilter', {
'a': a,
'b': b}),
140 central_freq = cos(2*pi*50./16384)
141 peak_width = 1. - 1.1e-1
144 b = [-1.0, 2 * central_freq * peak_width, -peak_width**2]
145 chains.append(pipeutil.mkelems_in_bin(self,
146 (
'audiotestsrc', {
'wave':
'gaussian-noise',
'volume': vol,
'samplesperbuffer': 16384}),
147 (
'audioiirfilter', {
'a': a,
'b': b}),
151 central_freq = cos(2*pi*438./16384)
152 peak_width = 1. - 7e-5
155 b = [-1.0, 2 * central_freq * peak_width, -peak_width**2]
156 chains.append(pipeutil.mkelems_in_bin(self,
157 (
'audiotestsrc', {
'wave':
'gaussian-noise',
'volume': vol,
'samplesperbuffer': 16384}),
158 (
'audioiirfilter', {
'a': a,
'b': b}),
166 ker = [1.0, -2.0, 1.0]
167 chains.append(pipeutil.mkelems_in_bin(self,
168 (
'audiotestsrc', {
'wave':
'gaussian-noise',
'volume': vol,
'samplesperbuffer': 16384}),
169 (
'audiofirfilter', {
'kernel': ker}),
172 outputchain = pipeutil.mkelems_in_bin(self,
173 (
'lal_adder', {
'sync':
True}),
174 (
'audioamplify', {
'clipping-method': 3,
'amplification': sqrt(16384.)*3/4}),
179 chain[-1].link(outputchain[0])
182 self.add_pad(gst.ghost_pad_new_from_template(
'src', outputchain[-1].get_static_pad(
'src'), self.
__gsttemplates__[0]))
187 gobject.type_register(lal_fakeadvvirgosrc)
189 __gstelementfactory__ = (
190 lal_fakeadvvirgosrc.__name__,