本文整理汇总了Python中lalburst.SnglBurstUtils.coinc_sngl_bursts方法的典型用法代码示例。如果您正苦于以下问题:Python SnglBurstUtils.coinc_sngl_bursts方法的具体用法?Python SnglBurstUtils.coinc_sngl_bursts怎么用?Python SnglBurstUtils.coinc_sngl_bursts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lalburst.SnglBurstUtils
的用法示例。
在下文中一共展示了SnglBurstUtils.coinc_sngl_bursts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: coords
# 需要导入模块: from lalburst import SnglBurstUtils [as 别名]
# 或者: from lalburst.SnglBurstUtils import coinc_sngl_bursts [as 别名]
def coords(self, contents, coinc_event_id):
x = y = None
for burst in SnglBurstUtils.coinc_sngl_bursts(contents, coinc_event_id):
if burst.ifo == self.x_instrument:
x = self.magnitude(burst)
elif burst.ifo == self.y_instrument:
y = self.magnitude(burst)
return x, y
示例2: add_contents
# 需要导入模块: from lalburst import SnglBurstUtils [as 别名]
# 或者: from lalburst.SnglBurstUtils import coinc_sngl_bursts [as 别名]
def add_contents(self, contents):
# this outer loop assumes each injection can only be found
# in at most one coinc, otherwise the "found" count is
# wrong.
for values in contents.connection.cursor().execute("""
SELECT
sim_burst.*,
coinc_event.coinc_event_id
FROM
coinc_event
JOIN coinc_event_map ON (
coinc_event_map.coinc_event_id == coinc_event.coinc_event_id
)
JOIN sim_burst ON (
coinc_event_map.table_name == 'sim_burst'
AND coinc_event_map.event_id == sim_burst.simulation_id
)
WHERE
coinc_def_id == ?
""", (contents.sb_definer_id,)):
sim = contents.sim_burst_table.row_from_cols(values)
coinc_event_id = values[-1]
sim_peak = sim.time_at_instrument(self.instrument)
self.found += 1
bursts = tuple(SnglBurstUtils.coinc_sngl_bursts(contents, coinc_event_id))
coinc_dt = 0
for burst in bursts:
dt = float(burst.peak - sim_peak)
if burst.ifo == self.instrument:
try:
self.offsets.count[dt,] += 1.0
except IndexError:
# outside plot range
pass
coinc_dt += dt * burst.ms_snr
coinc_dt /= sum(burst.ms_snr for burst in bursts)
try:
self.coinc_offsets.count[coinc_dt,] += 1.0
except IndexError:
# outside plot range
pass