neuroscout/populate/extract.py
def _extract_to_serial(graphs, stim_object, serializer):
    """ For a stim_object, load stim and apply graphs, and serialize """
    results = []
    for stim_obj, pliers_stim in _load_stim(stim_object):
        # For each graph, check compatability, and then extract
        for graph in graphs:
            ext = graph.roots[0].transformer
            if ext._stim_matches_input_types(pliers_stim):
                # Hacky workaround. Look for compatible AVI
                if 'GoogleVideoAPIShotDetectionExtractor' in str(ext.__class__):
                    pliers_stim.filename = str(
                        Path(pliers_stim.filename).with_suffix('.avi'))
                try:
                    res = graph.transform(pliers_stim, merge=False)[0]
                except Exception:
                    # Try again (may be connection error)
                    res = graph.transform(pliers_stim, merge=False)[0]
                res = serializer.load(res)
                results.append((stim_obj.id, res))
    return results
 For a stim_object, load stim and apply graphs, and serialize 
For a stim_object, load stim and apply graphs, and serialize
For a stim_object load stim and apply graphs and serialize
def _extract_to_serial(graphs, stim_object, serializer):
    results = []
    for stim_obj, pliers_stim in _load_stim(stim_object):
        for graph in graphs:
            ext = graph.roots[0].transformer
            if ext._stim_matches_input_types(pliers_stim):
                if 'GoogleVideoAPIShotDetectionExtractor' in str(ext.__class__):
                    pliers_stim.filename = str(
                        Path(pliers_stim.filename).with_suffix('.avi'))
                try:
                    res = graph.transform(pliers_stim, merge=False)[0]
                except Exception:
                    res = graph.transform(pliers_stim, merge=False)[0]
                res = serializer.load(res)
                results.append((stim_obj.id, res))
    return results
def _extract_to_serial ( graphs , stim_object , serializer ) : results = [ ] for stim_obj , pliers_stim in _load_stim ( stim_object ) : for graph in graphs : ext = graph . roots [ 0 ] . transformer if ext . _stim_matches_input_types ( pliers_stim ) : if 'GoogleVideoAPIShotDetectionExtractor' in str ( ext . __class__ ) : pliers_stim . filename = str ( Path ( pliers_stim . filename ) . with_suffix ( '.avi' ) ) try : res = graph . transform ( pliers_stim , merge = False ) [ 0 ] except Exception : res = graph . transform ( pliers_stim , merge = False ) [ 0 ] res = serializer . load ( res ) results . append ( ( stim_obj . id , res ) ) return results
For a stim_object, load stim and apply graphs, and serialize
For a stim_object load stim and apply graphs and serialize
""" For a stim_object, load stim and apply graphs, and serialize """ # For each graph, check compatability, and then extract # Hacky workaround. Look for compatible AVI # Try again (may be connection error)
graphs
stim_object
serializer