neuroscout/tasks/utils/build.py
def impute_confounds(dense):
    """ Impute first TR for confounds that may have n/as """
    for imputable in ('framewise_displacement', 'std_dvars', 'dvars'):
        if imputable in dense.columns:
            vals = dense[imputable].values
            if not np.isnan(vals[0]):
                continue

            # Impute the mean non-zero, non-NaN value
            dense[imputable][0] = np.nanmean(vals[vals != 0])
    return dense
 Impute first TR for confounds that may have n/as 
Impute first TR for confounds that may have n/as
Impute first TR for confounds that may have n / as
def impute_confounds(dense):
    for imputable in ('framewise_displacement', 'std_dvars', 'dvars'):
        if imputable in dense.columns:
            vals = dense[imputable].values
            if not np.isnan(vals[0]):
                continue
            dense[imputable][0] = np.nanmean(vals[vals != 0])
    return dense
def impute_confounds ( dense ) : for imputable in ( 'framewise_displacement' , 'std_dvars' , 'dvars' ) : if imputable in dense . columns : vals = dense [ imputable ] . values if not np . isnan ( vals [ 0 ] ) : continue dense [ imputable ] [ 0 ] = np . nanmean ( vals [ vals != 0 ] ) return dense
Impute first TR for confounds that may have n/as
Impute first TR for confounds that may have n / as
""" Impute first TR for confounds that may have n/as """ # Impute the mean non-zero, non-NaN value
dense