当前位置: 首页>>代码示例>>Python>>正文


Python DataQualityFlag.active方法代码示例

本文整理汇总了Python中gwpy.segments.DataQualityFlag.active方法的典型用法代码示例。如果您正苦于以下问题:Python DataQualityFlag.active方法的具体用法?Python DataQualityFlag.active怎么用?Python DataQualityFlag.active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gwpy.segments.DataQualityFlag的用法示例。


在下文中一共展示了DataQualityFlag.active方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: downtime

# 需要导入模块: from gwpy.segments import DataQualityFlag [as 别名]
# 或者: from gwpy.segments.DataQualityFlag import active [as 别名]
def downtime(vetosegs, segments, channel):
  myflag = DataQualityFlag()
  myflag.active = vetosegs
  myflag.known = segments
  plot = myflag.plot()
  plot.set_title(r'Active and vetoed segments for %s' %channel)
  plot.savefig(r'%s_downtime.png'%channel)
开发者ID:WanduiAlbert,项目名称:SummerResearch,代码行数:9,代码来源:VETplotter.py

示例2: evaluate_flag

# 需要导入模块: from gwpy.segments import DataQualityFlag [as 别名]
# 或者: from gwpy.segments.DataQualityFlag import active [as 别名]
def evaluate_flag(flag, triggers=None, metrics=['deadtime'], injections=None,
                  minduration=0, vetotag='', channel=None, etg=None):
    """Evaluate the performance of a set of a `~gwpy.segments.DataQualityFlag`

    Parameters
    ----------
    flag : `~gwpy.segments.DataQualityFlag`
        the data-quality flag to be tested
    triggers : `~glue.ligolw.table.Table`, optional
        the set of analysis event triggers against which to test
    metrics : `list`, optional
        the list of `Metrics <~gwvet.Metric>`
    injections : `~glue.ligolw.table.Table`, `~gwpy.segments.SegmentList`, optional
        a list of injections, or injection segments, against which to test
        flag safety
    minduration : `float`, optional
        the minimum duration of post-veto segments, if applicable, default: 0

    Returns
    -------
    results, after : `OrderedDict`, `~glue.ligolw.table.Table`
        the results of each metric test, and the triggers after vetoes have
        been applied (or `None` if not given)
    """
    # format as flag
    if not isinstance(flag, DataQualityFlag):
        flag = DataQualityFlag(active=flag)
    else:
        flag = flag.copy()
    # get inverse of veto segments
    if minduration:
        post = type(flag.known)([s for s in (flag.known - flag.active)
                             if float(abs(s)) >= minduration])
        flag.active = flag.known - post

    # apply vetoes to triggers
    triggers.etg = etg
    if triggers is not None:
        after = veto(triggers, flag, tag=vetotag, channel=channel, etg=etg)
    else:
        after = None

    # test each metric
    out = OrderedDict()
    for metric in metrics:
        if isinstance(metric, Metric):
            _metric = metric
        else:
            _metric = get_metric(metric)
        if _metric.name.lower() == 'safety':
            out[metric] = _metric(flag, injections)
        elif _metric.needs_triggers:
            out[metric] = _metric(flag, triggers, after=after)
        else:
            out[metric] = _metric(flag)

    return out, after
开发者ID:duncanmmacleod,项目名称:vet,代码行数:59,代码来源:core.py

示例3: summary_stats

# 需要导入模块: from gwpy.segments import DataQualityFlag [as 别名]
# 或者: from gwpy.segments.DataQualityFlag import active [as 别名]
def summary_stats(statistics, bbh_trigs, omicron_trigs, channel, vetosegs, segments):
  # Metrics being considered
  eff = get_metric('efficiency')
  dt = get_metric('deadtime')
  eff_over_dt = get_metric('efficiency/deadtime')
  usep = get_metric('my use percentage')
  loudbysnr = get_metric('loudest event by snr')
  get_percentile= get_metric('percentile')
  myflag = DataQualityFlag()
  myflag.active = vetosegs
  myflag.known = segments
  statistics[i] = (channel, eff(myflag, bbh_trigs).value, dt(myflag).value,\
      eff_over_dt(myflag, bbh_trigs).value, usep(myflag, omic_trigs).value,\
      loudbysnr(myflag, bbh_trigs).value)
开发者ID:WanduiAlbert,项目名称:SummerResearch,代码行数:16,代码来源:VETplotter.py

示例4: argwhere

# 需要导入模块: from gwpy.segments import DataQualityFlag [as 别名]
# 或者: from gwpy.segments.DataQualityFlag import active [as 别名]
	idxhighscat = argwhere(scatf2>=thresh)
	highscatf2 = scatf2[idxhighscat]
	highscattimes = times[idxhighscat]
	highscattimesgps = highscattimes+start_time

	# save text file with values above threshold [GPS f2 index]
	outdata = hstack((highscattimesgps,highscatf2,idxhighscat))
	savetxt('%s-ALL-TIMES-SCATTER-GT%dHZ-%d-%d.txt' % (ifo,thresh,start_time,dur),outdata,fmt='%f %f %i')

	# save segments XML file with segments (based off code from Duncan Macleod)
	from math import (floor, ceil)
	from gwpy.segments import (Segment, DataQualityFlag)

	flag = '%s:DCH-SCATTERED_LIGHT_GT%dHZ:1' % (ifo,thresh) 
	flag = DataQualityFlag(flag)
	segs = []
	append = segs.append

	for gps in highscattimesgps:
    		if len(segs) and gps in segs[-1]:
        		continue
    		seg = Segment(floor(gps), ceil(gps))
    		append(seg)

	flag.active = segs
	flag.known = [Segment(start_time, end_time)]
	flag.coalesce()
	flag.write('%s-%s_%d-%d-%d.xml.gz' % (flag.ifo, flag.tag.replace('-', '_'), flag.version,start_time, dur))

#EOF
开发者ID:andrew-lundgren,项目名称:ligo-detchar,代码行数:32,代码来源:scatMon3.py


注:本文中的gwpy.segments.DataQualityFlag.active方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。