コード例 #1
0
for i in range(len(eids)):
    print('\nProcessing session %d of %d' % (i+1, len(eids)))

    # Load in data
    eid = eids[i]
    try:
        spikes, clusters, channels = bbone.load_spike_sorting_with_channel(
                                                                    eid, aligned=True, one=one)
        ses_path = one.path_from_eid(eid)
        trials = load_trials(eid)
    except Exception as error_message:
        print(error_message)
        continue

    # Check data integrity
    if check_trials(trials) is False:
        continue

    # Extract session data
    ses_info = one.get_details(eid)
    subject = ses_info['subject']
    date = ses_info['start_time'][:10]
    probes_to_use = probes[i]

    # Process per probe
    for p, probe in enumerate(probes_to_use):
        print('Processing %s (%d of %d)' % (probe, p + 1, len(probes_to_use)))

        # Check if data is available for this probe
        if probe not in clusters.keys():
            continue
コード例 #2
0
from oneibl.one import ONE
one = ONE()

# Settings
INCL_SESSIONS = 'aligned-behavior'

# Query sessions
eids, _ = query_sessions(selection=INCL_SESSIONS)

# Loop over sessions
all_trials = pd.DataFrame()
for i, eid in enumerate(eids):
    print(f'Loading trails of session {i+1} of {len(eids)}')
    try:
        trials = load_trials(eid, invert_stimside=True)
    except:
        continue
    if check_trials(trials):
        ses_info = one.get_details(eid)
        trials['subject'] = ses_info['subject']
        trials['date'] = ses_info['start_time'][:10]
        trials = trials.drop(columns=[
            'stimOn_times', 'feedback_times', 'contrastLeft', 'contrastRight',
            'goCue_times', 'right_choice', 'correct', 'firstMovement_times'
        ])
        all_trials = all_trials.append(
            trials[trials['probabilityLeft'] != 0.5])
        print(f'Added {len(trials)} trial (total {len(all_trials)})')
print('Saving results..')
all_trials.to_pickle(join(paths()[2], 'Ephys', 'Decoding', 'all_trials.p'))
print('Done')