Beispiel #1
0
def snuffle(config):
    global _lassie_config
    _lassie_config = copy.deepcopy(config)
    for _ifc in _lassie_config.image_function_contributions:
        _ifc.setup(config)

    def load_snuffling(win):
        s = LassieSnuffling()
        s.config = _lassie_config
        s.setup()
        win.pile_viewer.viewer.add_snuffling(s, reloaded=True)
        win.pile_viewer.viewer.add_blacklist_pattern('*.SMAX.i.*')
        for bl in _lassie_config.blacklist:
            win.pile_viewer.viewer.add_blacklist_pattern('%s.*' % bl)

        detections_path = _lassie_config.get_detections_path()

        if os.path.exists(detections_path):
            s.detections = detections_to_event_markers(detections_path)
            s.add_markers(s.detections)

        for _ifc in s.config.image_function_contributions:
            if isinstance(_ifc, ifc.ManualPickIFC):
                markers_path_extra = _ifc.picks_path
            elif isinstance(_ifc, ifc.TemplateMatchingIFC):
                markers_path_extra = _ifc.template_markers_path
            else:
                continue

            if os.path.exists(markers_path_extra):
                s.add_markers(pmarker.load_markers(markers_path_extra))
            else:
                logger.warn(
                    'No such file: %s (referenced in %s, named %s)' %
                    (markers_path_extra, _ifc.__class__.__name__, _ifc.name))

    receivers = config.get_receivers()
    stations = set()
    lats, lons = geo.points_coords(receivers, system='latlon')
    for ir, (lat, lon) in enumerate(zip(lats, lons)):
        n, s, l = receivers[ir].codes[:3]
        stations.add(
            model.Station(lat=lat, lon=lon, network=n, station=s, location=l))

    paths = config.expand_path(config.data_paths)
    paths.append(config.get_ifm_dir_path())

    p = pile.make_pile(paths=paths, fileformat='detect')

    meta = {'tabu': True}
    for tr in p.iter_traces(trace_selector=lambda x: x.station == 'SMAX'):
        if tr.meta:
            tr.meta.update(meta)
        else:
            tr.meta = meta

    snuffler.snuffle(p, stations=stations, launch_hook=load_snuffling)
Beispiel #2
0
    def snuffle(self, **kwargs):
        '''Visualize it.

        :param stations: list of `pyrocko.model.Station` objects or ``None``
        :param events: list of `pyrocko.model.Event` objects or ``None``
        :param markers: list of `pyrocko.gui_util.Marker` objects or ``None``
        :param ntracks: float, number of tracks to be shown initially
            (default: 12)
        :param follow: time interval (in seconds) for real time follow mode or
            ``None``
        :param controls: bool, whether to show the main controls (default:
            ``True``)
        :param opengl: bool, whether to use opengl (default: ``False``)
        '''

        from pyrocko.gui.snuffler import snuffle
        snuffle(self, **kwargs)
    def snuffle(self, **kwargs):
        '''Visualize it.

        :param stations: list of `pyrocko.model.Station` objects or ``None``
        :param events: list of `pyrocko.model.Event` objects or ``None``
        :param markers: list of `pyrocko.gui_util.Marker` objects or ``None``
        :param ntracks: float, number of tracks to be shown initially
            (default: 12)
        :param follow: time interval (in seconds) for real time follow mode or
            ``None``
        :param controls: bool, whether to show the main controls (default:
            ``True``)
        :param opengl: bool, whether to use opengl (default: ``False``)
        '''

        from pyrocko.gui.snuffler import snuffle
        snuffle(self, **kwargs)
Beispiel #4
0
def command_snuffle(args):
    from pyrocko.gui import snuffler
    parser, options, args = cl_parse('map', args)

    if len(args) == 0:
        args.append('.')

    fn = get_scenario_yml(args[0])

    if not fn:
        parser.print_help()
        sys.exit(1)

    engine = get_engine()
    scenario = guts.load(filename=fn)
    scenario.init_modelling(engine)

    return snuffler.snuffle(scenario.get_pile(),
                            stations=scenario.get_stations(),
                            events=scenario.get_events())
def command_snuffle(args):
    from pyrocko.gui import snuffler
    parser, options, args = cl_parse('map', args)

    if len(args) == 0:
        args.append('.')

    fn = get_scenario_yml(args[0])

    if not fn:
        parser.print_help()
        sys.exit(1)

    engine = get_engine()
    scenario = guts.load(filename=fn)
    scenario.init_modelling(engine)

    return snuffler.snuffle(
        scenario.get_pile(),
        stations=scenario.get_stations(),
        events=scenario.get_events())