gstlal-inspiral  1.9.2
 All Classes Namespaces Files Functions
snglinspiraltable.py
1 # Copyright (C) 2016,2017 Kipp Cannon, Leo Singer
2 #
3 # This program is free software; you can redistribute it and/or modify it
4 # under the terms of the GNU General Public License as published by the
5 # Free Software Foundation; either version 2 of the License, or (at your
6 # option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 # Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 
17 
18 from ligo.lw import lsctables
19 import lal
20 from . import _snglinspiraltable
21 
22 
23 __all__ = ["GSTLALSnglInspiral"]
24 
25 
26 class GSTLALSnglInspiral(_snglinspiraltable.GSTLALSnglInspiral):
27  __slots__ = ()
28 
29  spin1 = lsctables.SnglInspiral.spin1
30  spin2 = lsctables.SnglInspiral.spin2
31 
32  @property
33  def G1_snr_time_series(self):
34  try:
35  name = self._G1_snr_name
36  except ValueError:
37  # C interface raises ValueError if the internal snr
38  # pointer is NULL
39  return None
40  series = lal.CreateCOMPLEX8TimeSeries(
41  name,
42  lal.LIGOTimeGPS(self._G1_snr_epoch_gpsSeconds, self._G1_snr_epoch_gpsNanoSeconds),
43  self._G1_snr_f0,
44  self._G1_snr_deltaT,
45  lal.Unit(self._G1_snr_sampleUnits),
46  self._G1_snr_data_length
47  )
48  # we want to be able to keep the table row object in memory
49  # for an extended period of time so we need to be able to
50  # release the memory used by the SNR time series when we no
51  # longer need it, and so we copy the data here instead of
52  # holding a reference to the original memory. if we
53  # allowed references to the original memory to leak out
54  # into Python land we could never know if it's safe to free
55  # it
56  series.data.data[:] = self._G1_snr_data
57  return series
58 
59  @property
60  def H1_snr_time_series(self):
61  try:
62  name = self._H1_snr_name
63  except ValueError:
64  # C interface raises ValueError if the internal snr
65  # pointer is NULL
66  return None
67  series = lal.CreateCOMPLEX8TimeSeries(
68  name,
69  lal.LIGOTimeGPS(self._H1_snr_epoch_gpsSeconds, self._H1_snr_epoch_gpsNanoSeconds),
70  self._H1_snr_f0,
71  self._H1_snr_deltaT,
72  lal.Unit(self._H1_snr_sampleUnits),
73  self._H1_snr_data_length
74  )
75  # we want to be able to keep the table row object in memory
76  # for an extended period of time so we need to be able to
77  # release the memory used by the SNR time series when we no
78  # longer need it, and so we copy the data here instead of
79  # holding a reference to the original memory. if we
80  # allowed references to the original memory to leak out
81  # into Python land we could never know if it's safe to free
82  # it
83  series.data.data[:] = self._H1_snr_data
84  return series
85 
86  @property
87  def L1_snr_time_series(self):
88  try:
89  name = self._L1_snr_name
90  except ValueError:
91  # C interface raises ValueError if the internal snr
92  # pointer is NULL
93  return None
94  series = lal.CreateCOMPLEX8TimeSeries(
95  name,
96  lal.LIGOTimeGPS(self._L1_snr_epoch_gpsSeconds, self._L1_snr_epoch_gpsNanoSeconds),
97  self._L1_snr_f0,
98  self._L1_snr_deltaT,
99  lal.Unit(self._L1_snr_sampleUnits),
100  self._L1_snr_data_length
101  )
102  # we want to be able to keep the table row object in memory
103  # for an extended period of time so we need to be able to
104  # release the memory used by the SNR time series when we no
105  # longer need it, and so we copy the data here instead of
106  # holding a reference to the original memory. if we
107  # allowed references to the original memory to leak out
108  # into Python land we could never know if it's safe to free
109  # it
110  series.data.data[:] = self._L1_snr_data
111  return series
112 
113  @property
114  def V1_snr_time_series(self):
115  try:
116  name = self._V1_snr_name
117  except ValueError:
118  # C interface raises ValueError if the internal snr
119  # pointer is NULL
120  return None
121  series = lal.CreateCOMPLEX8TimeSeries(
122  name,
123  lal.LIGOTimeGPS(self._V1_snr_epoch_gpsSeconds, self._V1_snr_epoch_gpsNanoSeconds),
124  self._V1_snr_f0,
125  self._V1_snr_deltaT,
126  lal.Unit(self._V1_snr_sampleUnits),
127  self._V1_snr_data_length
128  )
129  # we want to be able to keep the table row object in memory
130  # for an extended period of time so we need to be able to
131  # release the memory used by the SNR time series when we no
132  # longer need it, and so we copy the data here instead of
133  # holding a reference to the original memory. if we
134  # allowed references to the original memory to leak out
135  # into Python land we could never know if it's safe to free
136  # it
137  series.data.data[:] = self._V1_snr_data
138  return series
139 
140  @property
141  def K1_snr_time_series(self):
142  try:
143  name = self._K1_snr_name
144  except ValueError:
145  # C interface raises ValueError if the internal snr
146  # pointer is NULL
147  return None
148  series = lal.CreateCOMPLEX8TimeSeries(
149  name,
150  lal.LIGOTimeGPS(self._K1_snr_epoch_gpsSeconds, self._K1_snr_epoch_gpsNanoSeconds),
151  self._K1_snr_f0,
152  self._K1_snr_deltaT,
153  lal.Unit(self._K1_snr_sampleUnits),
154  self._K1_snr_data_length
155  )
156  # we want to be able to keep the table row object in memory
157  # for an extended period of time so we need to be able to
158  # release the memory used by the SNR time series when we no
159  # longer need it, and so we copy the data here instead of
160  # holding a reference to the original memory. if we
161  # allowed references to the original memory to leak out
162  # into Python land we could never know if it's safe to free
163  # it
164  series.data.data[:] = self._K1_snr_data
165  return series
166 
167  @G1_snr_time_series.deleter
168  def G1_snr_time_series(self):
169  self._G1_snr_time_series_deleter()
170 
171  @H1_snr_time_series.deleter
172  def H1_snr_time_series(self):
173  self._H1_snr_time_series_deleter()
174 
175  @L1_snr_time_series.deleter
176  def L1_snr_time_series(self):
177  self._L1_snr_time_series_deleter()
178 
179  @V1_snr_time_series.deleter
180  def V1_snr_time_series(self):
181  self._V1_snr_time_series_deleter()
182 
183  @K1_snr_time_series.deleter
184  def K1_snr_time_series(self):
185  self._K1_snr_time_series_deleter()