Пример #1
0
            continue
#        print 'Doing ', exp
        dat = load_PopData(exp)
        dat_c = dat['dat_c'].mean(2)
        dat_c = normalize(dat_c, axis=0)
        dat_w = dat['dat_w'].mean(2)
        dat_w = normalize(dat_w, axis=0)

        active = dat['active']
        d = np.where(active[:, 1])[0]
        lum_mask, con_mask, flow_mask, four_mask, four_mask_shape,\
                freq_mask, orient_mask,\
                lum_surr, con_surr, flow_surr, four_surr, four_surr_shape,\
                freq_surr, orient_surr,\
                lum_whole, con_whole, flow_whole, four_whole, four_whole_shape,\
                freq_whole, orient_whole = load_parsed_movie_dat(exp, 'POP', None)
        all_dat = {'Data': {'Centre': dat_c, 'Whole': dat_w}, 'Movie': {}}
        all_dat['Movie']['Contrast'] = con_mask
        all_dat['Movie']['Luminence'] = lum_mask
        all_dat['Movie']['Fourier'] = np.append(four_mask.real,
                                                four_mask.imag,
                                                axis=2).astype(np.float)
        all_dat['Movie']['Frequency'] = freq_mask
        all_dat['Movie']['Orientation'] = orient_mask

        for d in all_dat['Data']:
            #            print d
            X = all_dat['Data'][d]
            for m in all_dat['Movie']:
                #                print m
                ys = all_dat['Movie'][m]
Пример #2
0
def get_mov_data(comb,
                 targ_type,
                 src_type,
                 e,
                 cellid,
                 exp_type,
                 four_downsample=None,
                 shift=0,
                 randomise=None):

    lum_mask, con_mask, flow_mask, four_mask, four_mask_shape,\
            freq_mask, orient_mask,\
            lum_surr, con_surr, flow_surr, four_surr, four_surr_shape,\
            freq_surr, orient_surr,\
            lum_whole, con_whole, flow_whole, four_whole, four_whole_shape,\
            freq_whole, orient_whole\
                    = load_parsed_movie_dat(cellid, exp_type, four_downsample)

    flow_mask = bin_flow(flow_mask)
    flow_surr = bin_flow(flow_surr)
    flow_whole = bin_flow(flow_whole)

    idx_bar = []
    idx_flow = []
    idx_four = []
    idx_freq = []
    idx_orient = []
    lbl_bar = []
    four_shape = []
    all_dat = None
    if randomise is None:
        if targ_type == 'Center':
            source = e['psth_c_shift'][shift]
        elif targ_type == 'Surround':
            source = e['psth_s_shift'][shift]
        elif targ_type == 'Whole':
            source = e['psth_w_shift'][shift]
    elif randomise == 'random':
        if targ_type == 'Center':
            source = e['psth_c_rand']
        elif targ_type == 'Surround':
            source = e['psth_s_rand']
        elif targ_type == 'Whole':
            source = e['psth_w_rand']
    elif randomise == 'generated':
        if targ_type == 'Center':
            source = e['psth_c_gen']
        elif targ_type == 'Surround':
            source = e['psth_s_gen']
        elif targ_type == 'Whole':
            source = e['psth_w_gen']

    source = source.mean(0)

    edge = e['edge']

    if src_type == 'Center':
        if 'Luminance' in comb:
            for l in lum_mask:
                all_dat = append_Nones(all_dat, l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_mask:
                all_dat = append_Nones(all_dat, c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]
            for f in flow_mask:
                all_dat = append_Nones(all_dat, f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                f = np.append(f.real, f.imag, 1)
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_mask_shape)
        if 'Frequency' in comb:
            for f in freq_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_freq += [range(pre_len, all_dat.shape[1])]
        if 'Orientation' in comb:
            for f in orient_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_orient += [range(pre_len, all_dat.shape[1])]
    elif src_type == 'Surround':
        if 'Luminance' in comb:
            for l in lum_surr:
                all_dat = append_Nones(all_dat, l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_surr:
                all_dat = append_Nones(all_dat, c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]

            for f in flow_surr:
                all_dat = append_Nones(all_dat, f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_surr_shape)
        if 'Frequency' in comb:
            for f in freq_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_freq += [range(pre_len, all_dat.shape[1])]
        if 'Orientation' in comb:
            for f in orient_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_orient += [range(pre_len, all_dat.shape[1])]

    elif src_type == 'Whole':
        if 'Luminance' in comb:
            for l in lum_whole:
                all_dat = append_Nones(all_dat, l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_whole:
                all_dat = append_Nones(all_dat, c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]

            for f in flow_whole:
                all_dat = append_Nones(all_dat, f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_whole_shape)
        if 'Frequency' in comb:
            for f in freq_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_freq += [range(pre_len, all_dat.shape[1])]
        if 'Orientation' in comb:
            for f in orient_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_orient += [range(pre_len, all_dat.shape[1])]
    #all_dat = np.tile(all_dat, [source.shape[0], 1, 1])
    plot_params = {}
    plot_params['idx_bar'] = idx_bar
    plot_params['idx_flow'] = idx_flow
    plot_params['idx_four'] = idx_four
    plot_params['lbl_bar'] = lbl_bar
    plot_params['four_shape'] = four_shape
    return all_dat, source, plot_params
def get_mov_data(comb, targ_type, src_type, e, cellid, exp_type,
                 four_downsample=None, shift=0, randomise=None):

    lum_mask, con_mask, flow_mask, four_mask, four_mask_shape,\
            freq_mask, orient_mask,\
            lum_surr, con_surr, flow_surr, four_surr, four_surr_shape,\
            freq_surr, orient_surr,\
            lum_whole, con_whole, flow_whole, four_whole, four_whole_shape,\
            freq_whole, orient_whole\
                    = load_parsed_movie_dat(cellid, exp_type, four_downsample)

    flow_mask = bin_flow(flow_mask)
    flow_surr = bin_flow(flow_surr)
    flow_whole = bin_flow(flow_whole)

    idx_bar = []
    idx_flow = []
    idx_four = []
    idx_freq = []
    idx_orient = []
    lbl_bar = []
    four_shape = []
    all_dat = None
    if randomise is None:
        if targ_type == 'Center':
            source = e['psth_c_shift'][shift]
        elif targ_type == 'Surround':
            source = e['psth_s_shift'][shift]
        elif targ_type == 'Whole':
            source = e['psth_w_shift'][shift]
    elif randomise == 'random':
        if targ_type == 'Center':
            source = e['psth_c_rand']
        elif targ_type == 'Surround':
            source = e['psth_s_rand']
        elif targ_type == 'Whole':
            source = e['psth_w_rand']
    elif randomise == 'generated':
        if targ_type == 'Center':
            source = e['psth_c_gen']
        elif targ_type == 'Surround':
            source = e['psth_s_gen']
        elif targ_type == 'Whole':
            source = e['psth_w_gen']

    source = source.mean(0)
    
    edge = e['edge']

    if src_type == 'Center':
        if 'Luminance' in comb:
            for l in lum_mask:
                all_dat = append_Nones(all_dat,
                                   l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_mask:
                all_dat = append_Nones(all_dat,
                                       c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat,
                                       f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]
            for f in flow_mask:
                all_dat = append_Nones(all_dat,
                                       f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                f = np.append(f.real, f.imag, 1)
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_mask_shape)
        if 'Frequency' in comb:
            for f in freq_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_freq += [range(pre_len, all_dat.shape[1])]
        if 'Orientation' in comb:
            for f in orient_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_orient += [range(pre_len, all_dat.shape[1])]
    elif src_type == 'Surround':
        if 'Luminance' in comb:
            for l in lum_surr:
                all_dat = append_Nones(all_dat,
                                       l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_surr:
                all_dat = append_Nones(all_dat,
                                       c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]

            for f in flow_surr:
                all_dat = append_Nones(all_dat, f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_surr_shape)
        if 'Frequency' in comb:
            for f in freq_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_freq += [range(pre_len, all_dat.shape[1])]
        if 'Orientation' in comb:
            for f in orient_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_orient += [range(pre_len, all_dat.shape[1])]

    elif src_type == 'Whole':
        if 'Luminance' in comb:
            for l in lum_whole:
                all_dat = append_Nones(all_dat,
                                   l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_whole:
                all_dat = append_Nones(all_dat,
                                       c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat,
                                       f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]

            for f in flow_whole:
                all_dat = append_Nones(all_dat,
                                       f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_whole_shape)
        if 'Frequency' in comb:
            for f in freq_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_freq += [range(pre_len, all_dat.shape[1])]
        if 'Orientation' in comb:
            for f in orient_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_orient += [range(pre_len, all_dat.shape[1])]
    #all_dat = np.tile(all_dat, [source.shape[0], 1, 1])
    plot_params = {}
    plot_params['idx_bar'] = idx_bar
    plot_params['idx_flow'] = idx_flow
    plot_params['idx_four'] = idx_four
    plot_params['lbl_bar'] = lbl_bar
    plot_params['four_shape'] = four_shape
    return all_dat, source, plot_params
Пример #4
0
            continue
#        print 'Doing ', exp
        dat = load_PopData(exp)
        dat_c = dat['dat_c'].mean(2)
        dat_c = normalize(dat_c, axis=0)
        dat_w = dat['dat_w'].mean(2)
        dat_w = normalize(dat_w, axis=0)
    
        active = dat['active']
        d = np.where(active[:, 1])[0]
        lum_mask, con_mask, flow_mask, four_mask, four_mask_shape,\
                freq_mask, orient_mask,\
                lum_surr, con_surr, flow_surr, four_surr, four_surr_shape,\
                freq_surr, orient_surr,\
                lum_whole, con_whole, flow_whole, four_whole, four_whole_shape,\
                freq_whole, orient_whole = load_parsed_movie_dat(exp, 'POP', None)
        all_dat = {'Data': {'Centre': dat_c, 'Whole': dat_w}, 'Movie': {}}
        all_dat['Movie']['Contrast'] = con_mask
        all_dat['Movie']['Luminence'] = lum_mask
        all_dat['Movie']['Fourier'] = np.append(four_mask.real, four_mask.imag,
                                                axis=2).astype(np.float)
        all_dat['Movie']['Frequency'] = freq_mask
        all_dat['Movie']['Orientation'] = orient_mask
    
        for d in all_dat['Data']:
#            print d
            X = all_dat['Data'][d]
            for m in all_dat['Movie']:
#                print m
                ys = all_dat['Movie'][m]
                if len(ys.shape) < 3:
def get_mov_data(targ_type, e, expdate, exp_type, four_downsample=None):

    lum_mask, con_mask, flow_mask,\
                    four_mask, four_mask_shape,\
                    lum_surr, con_surr, flow_surr,\
                    four_surr, four_surr_shape,\
                    lum_whole, con_whole, flow_whole,\
                    four_whole, four_whole_shape \
                    = load_parsed_movie_dat(expdate, exp_type, four_downsample)

    flow_mask = bin_flow(flow_mask)
    flow_surr = bin_flow(flow_surr)
    flow_whole = bin_flow(flow_whole)

    idx_bar = []
    idx_flow = []
    idx_four = []
    lbl_bar = []
    four_shape = []
    all_dat = None
    if targ_type == 'Center':
        source = e['psth_c']
        for f in four_mask:
            if all_dat != None:
                pre_len = all_dat.shape[1]
            else:
                pre_len = 0
            all_dat = append_Nones(all_dat, f, 1)
            idx_four += [range(pre_len, all_dat.shape[1])]
            four_shape.append(four_mask_shape)
    elif targ_type == 'Surround':
        source = e['psth_s']
        for f in four_surr:
            if all_dat != None:
                pre_len = all_dat.shape[1]
            else:
                pre_len = 0
            all_dat = append_Nones(all_dat, f, 1)
            idx_four += [range(pre_len, all_dat.shape[1])]
            four_shape.append(four_surr_shape)

    elif targ_type == 'Whole':
        source = e['psth_w']
        for f in four_mask:
            if all_dat != None:
                pre_len = all_dat.shape[1]
            else:
                pre_len = 0
            all_dat = append_Nones(all_dat, f, 1)
            idx_four += [range(pre_len, all_dat.shape[1])]
            four_shape.append(four_mask_shape)


#
    all_dat = np.tile(all_dat, [source.shape[0], 1, 1])
    plot_params = {}
    plot_params['idx_bar'] = idx_bar
    plot_params['idx_flow'] = idx_flow
    plot_params['idx_four'] = idx_four
    plot_params['lbl_bar'] = lbl_bar
    plot_params['four_shape'] = four_shape

    return all_dat, source, plot_params
def get_mov_data(targ_type, e, expdate, exp_type, four_downsample=None):

    lum_mask, con_mask, flow_mask,\
                    four_mask, four_mask_shape,\
                    lum_surr, con_surr, flow_surr,\
                    four_surr, four_surr_shape,\
                    lum_whole, con_whole, flow_whole,\
                    four_whole, four_whole_shape \
                    = load_parsed_movie_dat(expdate, exp_type, four_downsample)

    flow_mask = bin_flow(flow_mask)
    flow_surr = bin_flow(flow_surr)
    flow_whole = bin_flow(flow_whole)

    idx_bar = []
    idx_flow = []
    idx_four = []
    lbl_bar = []
    four_shape = []
    all_dat = None
    if targ_type == 'Center':
        source = e['psth_c']
        for f in four_mask:
            if all_dat != None:
                pre_len = all_dat.shape[1]
            else:
                pre_len = 0
            all_dat = append_Nones(all_dat, f, 1)
            idx_four += [range(pre_len, all_dat.shape[1])]
            four_shape.append(four_mask_shape)
    elif targ_type == 'Surround':
        source = e['psth_s']
        for f in four_surr:
            if all_dat != None:
                pre_len = all_dat.shape[1]
            else:
                pre_len = 0
            all_dat = append_Nones(all_dat, f, 1)
            idx_four += [range(pre_len, all_dat.shape[1])]
            four_shape.append(four_surr_shape)

    elif targ_type == 'Whole':
        source = e['psth_w']
        for f in four_mask:
            if all_dat != None:
                pre_len = all_dat.shape[1]
            else:
                pre_len = 0
            all_dat = append_Nones(all_dat, f, 1)
            idx_four += [range(pre_len, all_dat.shape[1])]
            four_shape.append(four_mask_shape)
#
    all_dat = np.tile(all_dat, [source.shape[0], 1, 1])
    plot_params = {}
    plot_params['idx_bar'] = idx_bar
    plot_params['idx_flow'] = idx_flow
    plot_params['idx_four'] = idx_four
    plot_params['lbl_bar'] = lbl_bar
    plot_params['four_shape'] = four_shape

    return all_dat, source, plot_params
Пример #7
0
def get_mov_data(comb, targ_type, src_type, e, expdate, exp_type, four_downsample=None):

    lum_mask, con_mask, flow_mask,\
                    four_mask, four_mask_shape,\
                    lum_surr, con_surr, flow_surr,\
                    four_surr, four_surr_shape,\
                    lum_whole, con_whole, flow_whole,\
                    four_whole, four_whole_shape \
                    = load_parsed_movie_dat(expdate, exp_type, four_downsample)

    flow_mask = bin_flow(flow_mask)
    flow_surr = bin_flow(flow_surr)
    flow_whole = bin_flow(flow_whole)

    idx_bar = []
    idx_flow = []
    idx_four = []
    lbl_bar = []
    four_shape = []
    all_dat = None
    if targ_type == 'Center':
        source = e['psth_c']
    elif targ_type == 'Surround':
        source = e['psth_s']
    elif targ_type == 'Whole':
        source = e['psth_w']

    if src_type == 'Center':
        if 'Luminance' in comb:
            for l in lum_mask:
                all_dat = append_Nones(all_dat,
                                   l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_mask:
                all_dat = append_Nones(all_dat,
                                       c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat,
                                       f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]
            for f in flow_mask:
                all_dat = append_Nones(all_dat,
                                       f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_mask_shape)
    elif src_type == 'Surround':
        if 'Luminance' in comb:
            for l in lum_surr:
                all_dat = append_Nones(all_dat,
                                       l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_surr:
                all_dat = append_Nones(all_dat,
                                       c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]

            for f in flow_surr:
                all_dat = append_Nones(all_dat, f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_surr_shape)

    elif src_type == 'Whole':
        if 'Luminance' in comb:
            for l in lum_whole:
                all_dat = append_Nones(all_dat,
                                   l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_whole:
                all_dat = append_Nones(all_dat,
                                       c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat,
                                       f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]

            for f in flow_whole:
                all_dat = append_Nones(all_dat,
                                       f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_whole_shape)

    all_dat = np.tile(all_dat, [source.shape[0], 1, 1])
    plot_params = {}
    plot_params['idx_bar'] = idx_bar
    plot_params['idx_flow'] = idx_flow
    plot_params['idx_four'] = idx_four
    plot_params['lbl_bar'] = lbl_bar
    plot_params['four_shape'] = four_shape

    return all_dat, source, plot_params
Пример #8
0
def get_mov_data(comb,
                 targ_type,
                 src_type,
                 e,
                 expdate,
                 exp_type,
                 four_downsample=None):

    lum_mask, con_mask, flow_mask,\
                    four_mask, four_mask_shape,\
                    lum_surr, con_surr, flow_surr,\
                    four_surr, four_surr_shape,\
                    lum_whole, con_whole, flow_whole,\
                    four_whole, four_whole_shape \
                    = load_parsed_movie_dat(expdate, exp_type, four_downsample)

    flow_mask = bin_flow(flow_mask)
    flow_surr = bin_flow(flow_surr)
    flow_whole = bin_flow(flow_whole)

    idx_bar = []
    idx_flow = []
    idx_four = []
    lbl_bar = []
    four_shape = []
    all_dat = None
    if targ_type == 'Center':
        source = e['psth_c']
    elif targ_type == 'Surround':
        source = e['psth_s']
    elif targ_type == 'Whole':
        source = e['psth_w']

    if src_type == 'Center':
        if 'Luminance' in comb:
            for l in lum_mask:
                all_dat = append_Nones(all_dat, l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_mask:
                all_dat = append_Nones(all_dat, c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]
            for f in flow_mask:
                all_dat = append_Nones(all_dat, f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_mask:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_mask_shape)
    elif src_type == 'Surround':
        if 'Luminance' in comb:
            for l in lum_surr:
                all_dat = append_Nones(all_dat, l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_surr:
                all_dat = append_Nones(all_dat, c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]

            for f in flow_surr:
                all_dat = append_Nones(all_dat, f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_surr:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_surr_shape)

    elif src_type == 'Whole':
        if 'Luminance' in comb:
            for l in lum_whole:
                all_dat = append_Nones(all_dat, l[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Luminance']
        if 'Contrast' in comb:
            for c in con_whole:
                all_dat = append_Nones(all_dat, c[:, np.newaxis], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Contrast']
        if 'Flow' in comb:
            for f in flow_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f[:, :-1], 1)
                idx_flow += [range(pre_len, all_dat.shape[1])]

            for f in flow_whole:
                all_dat = append_Nones(all_dat, f[:, -1:], 1)
                idx_bar += [all_dat.shape[1] - 1]
                lbl_bar += ['Flow Vel']
        if 'Fourier' in comb:
            for f in four_whole:
                if all_dat != None:
                    pre_len = all_dat.shape[1]
                else:
                    pre_len = 0
                all_dat = append_Nones(all_dat, f, 1)
                idx_four += [range(pre_len, all_dat.shape[1])]
                four_shape.append(four_whole_shape)

    all_dat = np.tile(all_dat, [source.shape[0], 1, 1])
    plot_params = {}
    plot_params['idx_bar'] = idx_bar
    plot_params['idx_flow'] = idx_flow
    plot_params['idx_four'] = idx_four
    plot_params['lbl_bar'] = lbl_bar
    plot_params['four_shape'] = four_shape

    return all_dat, source, plot_params