Exemple #1
0
    # calculates response realiability and select only good cells to improve analysis

    r_vals, goodcells = signal_reliability(sig,
                                           r'\ASTIM_*',
                                           threshold=meta['reliability'])
    goodcells = goodcells.tolist()

    # plots PSTHs of all probes after silence
    # fig, axes = cplot.hybrid(sig, epoch_names=r'\AC0_P\d\Z', channels=goodcells)

    # plots PSHTs of individual best probe after all contexts
    # fig, axes = cplot.hybrid(sig, epoch_names=r'\AC\d_P3\Z', channels=goodcells)

    # takes an example probe
    full_array, invalid_cp, valid_cp, all_contexts, all_probes = \
        tp.make_full_array(sig, channels=goodcells, smooth_window=meta['smoothing_window'])

    # get a specific probe after a set of different transitions

    trialR = full_array[:, 1:, :, :,
                        100:]  # excludes silence as context, only includes response to probe
    all_probes.pop(0)

    # reorders dimentions from Context x Probe x Trial x Neuron x Time  to  Trial x Neuron x Context x Probe x Time
    trialR, R, _ = cdPCA.format_raster(trialR)
    Tr, N, C, P, T = trialR.shape

    n_components = N if N < 10 else 10

    # initializes model
    dpca = dPCA.dPCA(labels='cpt',
Exemple #2
0
fig, axes = cplot.hybrid(sig, epoch_names='C0_P9', channels=goodcells)

# for good cells, all the relevant probes after silence
fig, axes = cplot.hybrid(sig, epoch_names=r'\AC0_P([679]|10)\Z', channels=goodcells)
fig, axes = cplot.hybrid(sig, epoch_names=r'\AC0_P([679]|10)\Z', channels=best_cell)

# best cell, best probe, all the contexts
fig, axes = cplot.hybrid(sig, epoch_names=r'\AC(\d|10)_P6\Z', channels=goodcells)
fig, axes = cplot.hybrid(sig, epoch_names=r'\AC(\d|10)_P6\Z', channels=best_cell)



########################################################################################################################

# organizes relevant data in array with dimensions Context x Probe x Repetition x Unit x Time
full_array, bad_cpp, good_cpp, context_names, probe_names = tp.make_full_array(sig, 'CPN')

# now calculate pairwise difference between context types
valid_probes = [6, 7, 9, 10]
context_transitions = ['silence', 'continuous', 'similar', 'sharp']
diff_arr = src.metrics.distance.pairwise_PSHT_distance(valid_probes, context_transitions, full_array, context_names, probe_names, )

########################################################################################################################
# plot the PSTHs of a probe given two contexts transitions, compares,

p = 7
ct1 = 'continuous'
ct2 = 'sharp'
cell = cellorder.index(best_cell)

arr1 = tp._extract_triplets_sub_arr(p, ct1, full_array, context_names, probe_names) # shape Rep x Unit x Time