neuroscout/populate/extract.py
def _create_efs(results):
    """ Create ExtractedFeature models from Pliers results.
        Only creates one object per unique feature
    Args:
        results - list of zipped pairs of Stimulus objects and ExtractedResult
                  objects
    Returns:
        ext_feats - dictionary of hash of ExtractedFeatures to EF objects
    """
    ext_feats = {}
    bulk_ees = []

    print("Creating ExtractedFeatures...")
    for stim_id, ser in tqdm(results):
        for ee_props, ef_props in ser:
            # Hash extractor name + feature name
            feat_hash = ef_props['sha1_hash']

            # If we haven't already added this feature
            if feat_hash not in ext_feats:
                # Create/get feature
                ef_model = ExtractedFeature(**ef_props)
                db.session.add(ef_model)
                db.session.commit()
                ext_feats[feat_hash] = ef_model

            # Create ExtractedEvents
            bulk_ees.append(
                dict(stimulus_id=stim_id, ef_id=ext_feats[feat_hash].id, 
                    **ee_props))
    db.session.execute(ExtractedEvent.__table__.insert(), bulk_ees)
    db.session.commit()

    return ext_feats
 Create ExtractedFeature models from Pliers results.
        Only creates one object per unique feature
    Args:
        results - list of zipped pairs of Stimulus objects and ExtractedResult
                  objects
    Returns:
        ext_feats - dictionary of hash of ExtractedFeatures to EF objects
    
Create ExtractedFeature models from Pliers results.
Only creates one object per unique feature
Args:
results - list of zipped pairs of Stimulus objects and ExtractedResult
objects
Returns:
ext_feats - dictionary of hash of ExtractedFeatures to EF objects
Create ExtractedFeature models from Pliers results . Only creates one object per unique feature Args : results - list of zipped pairs of Stimulus objects and ExtractedResult objects Returns : ext_feats - dictionary of hash of ExtractedFeatures to EF objects
def _create_efs(results):
    ext_feats = {}
    bulk_ees = []
    print("Creating ExtractedFeatures...")
    for stim_id, ser in tqdm(results):
        for ee_props, ef_props in ser:
            feat_hash = ef_props['sha1_hash']
            if feat_hash not in ext_feats:
                ef_model = ExtractedFeature(**ef_props)
                db.session.add(ef_model)
                db.session.commit()
                ext_feats[feat_hash] = ef_model
            bulk_ees.append(
                dict(stimulus_id=stim_id, ef_id=ext_feats[feat_hash].id, 
                    **ee_props))
    db.session.execute(ExtractedEvent.__table__.insert(), bulk_ees)
    db.session.commit()
    return ext_feats
def _create_efs ( results ) : ext_feats = { } bulk_ees = [ ] print ( "Creating ExtractedFeatures..." ) for stim_id , ser in tqdm ( results ) : for ee_props , ef_props in ser : feat_hash = ef_props [ 'sha1_hash' ] if feat_hash not in ext_feats : ef_model = ExtractedFeature ( ** ef_props ) db . session . add ( ef_model ) db . session . commit ( ) ext_feats [ feat_hash ] = ef_model bulk_ees . append ( dict ( stimulus_id = stim_id , ef_id = ext_feats [ feat_hash ] . id , ** ee_props ) ) db . session . execute ( ExtractedEvent . __table__ . insert ( ) , bulk_ees ) db . session . commit ( ) return ext_feats
Create ExtractedFeature models from Pliers results.
Create ExtractedFeature models from Pliers results .
""" Create ExtractedFeature models from Pliers results.
        Only creates one object per unique feature
    Args:
        results - list of zipped pairs of Stimulus objects and ExtractedResult
                  objects
    Returns:
        ext_feats - dictionary of hash of ExtractedFeatures to EF objects
    """ # Hash extractor name + feature name # If we haven't already added this feature # Create/get feature # Create ExtractedEvents
results