Exemple #1
0
def run(args, config):
    """Execute the flag study
    """
    if (args.label == 'Vetoes' and len(args.flag) == 1
            and not os.path.isfile(args.flag[0])):
        args.label = args.flag[0]

    vprint("\n-------------------------------------------------\n")
    vprint("Processing %s\n" % args.label)

    span = Segment(args.gps_start_time, args.gps_end_time)

    # format analysis state
    if args.analysis_flag:
        state = SummaryState(args.analysis_flag,
                             definition=args.analysis_flag,
                             known=[span])
        state.fetch(config=config)
    else:
        state = generate_all_state(*span)

    tab = FlagTab(args.label,
                  args.gps_start_time,
                  args.gps_end_time,
                  args.flag,
                  states=[state],
                  metrics=args.metrics,
                  channel=args.channel,
                  etg=args.trigger_format,
                  intersection=args.intersection)
    tab.index = 'index.html'
    tab.process(config=config)
    tab.write_html(ifo='VET')
Exemple #2
0
 def process_state(self, state, *args, **kwargs):
     config = kwargs.get('config', None)
     # first get all of the segments
     if self.segmentfile:
         get_segments(self.flags, state, config=config,
                      cache=self.segmentfile, return_=False)
         segs = get_segments(self.metaflag, state, padding=self.padding,
                             config=config, query=False)
         kwargs['segmentcache'] = Cache()
     else:
         segs = get_segments(self.metaflag, state, config=config,
                             segdb_error=kwargs.get('segdb_error', 'raise'),
                             padding=self.padding)
     # then get all of the triggers
     if self.channel:
         cache = kwargs.pop('trigcache', None)
         before = get_triggers(str(self.channel), self.etg, state,
                               config=config, cache=cache,
                               format=self.etgformat)
     else:
         before = None
     # then apply all of the metrics
     self.results[state] = evaluate_flag(
         segs, triggers=before, metrics=self.metrics, injections=None,
         minduration=self.minseglength, vetotag=str(state),
         channel=str(self.channel), etg=self.etg)[0]
     vprint("    Veto evaluation results:\n")
     for metric, val in self.results[state].iteritems():
         vprint('        %s: %s\n' % (metric, val))
     # then pass to super to make the plots
     kwargs['trigcache'] = Cache()
     return super(FlagTab, self).process_state(state, *args, **kwargs)
Exemple #3
0
def run(args, config):
    """Execute the flag study
    """
    if (args.label == 'Vetoes' and len(args.flag) == 1 and
            not os.path.isfile(args.flag[0])):
        args.label = args.flag[0]

    vprint("\n-------------------------------------------------\n")
    vprint("Processing %s\n" % args.label)

    span = Segment(args.gps_start_time, args.gps_end_time)

    # format analysis state
    if args.analysis_flag:
        state = SummaryState(args.analysis_flag, definition=args.analysis_flag,
                             known=[span])
        state.fetch(config=config)
    else:
        state = generate_all_state(*span)

    tab = FlagTab(args.label, args.gps_start_time, args.gps_end_time,
                  args.flag, states=[state], metrics=args.metrics,
                  channel=args.channel, etg=args.trigger_format,
                  intersection=args.intersection)
    tab.index = 'index.html'
    tab.process(config=config)
    tab.write_html(ifo='VET')
Exemple #4
0
 def test_vprint(self, capsys):
     # test non-verbose
     globalv.VERBOSE = False
     utils.vprint('anything', stream=sys.stdout)
     out, err = capsys.readouterr()
     assert out == ''
     # test verbose
     globalv.VERBOSE = True
     utils.vprint('anything', stream=sys.stdout)
     out, err = capsys.readouterr()
     assert out == 'anything'
     # test profiled
     globalv.PROFILE = True
     utils.vprint('anything\n', stream=sys.stdout)
     out, err = capsys.readouterr()
     assert re.match('\Aanything \(\d+\.\d\d\)\n\Z', out) is not None
Exemple #5
0
def test_vprint(capsys):
    # test non-verbose
    globalv.VERBOSE = False
    utils.vprint('anything', stream=sys.stdout)
    out, err = capsys.readouterr()
    assert out == ''

    # test verbose
    globalv.VERBOSE = True
    utils.vprint('anything', stream=sys.stdout)
    out, err = capsys.readouterr()
    assert out == 'anything'

    # test profiled
    globalv.PROFILE = True
    utils.vprint('anything\n', stream=sys.stdout)
    out, err = capsys.readouterr()
    assert re.match(r'\Aanything \(\d+\.\d\d\)\n\Z', out) is not None