Esempio n. 1
0
def process_public():

    from ibl_pipeline import public
    from ibl_pipeline.common import subject, acquisition

    ingest_alyx_raw.insert_to_alyxraw(ingest_alyx_raw.get_alyx_entries())

    excluded_tables = [
        'Weighing', 'WaterType', 'WaterAdministration', 'WaterRestriction',
        'ProbeModel', 'ProbeInsertion', 'ProbeTrajectory'
    ]

    ingest_shadow.main(excluded_tables=excluded_tables)

    excluded_membership_tables = [
        'WaterRestrictionUser',
        'WaterRestrictionProcedure',
        'SurgeryUser',
        'WaterAdministrationSession',
    ]

    ingest_membership.main(excluded_tables=excluded_membership_tables)

    ingest_real.main(excluded_tables=excluded_tables +
                     excluded_membership_tables,
                     public=True)

    # delete non-releasing tables
    from ibl_pipeline.ingest import InsertBuffer

    table = InsertBuffer(acquisition.Session)
    for key in tqdm((acquisition.Session - public.PublicSession -
                     behavior.TrialSet).fetch('KEY')):
        table.delete1(key)
        if table.flush_delete(chunksz=100):
            print('Deleted 100 sessions')

    table.flush_delete()
    print('Deleted the rest of the sessions')

    subjs = subject.Subject & acquisition.Session

    for key in tqdm((subject.Subject - public.PublicSubjectUuid -
                     subjs.proj()).fetch('KEY')):
        (subject.Subject & key).delete()

    excluded_behavior_tables = [
        'AmbientSensorData', 'Settings', 'SessionDelay'
    ]

    populate_behavior.main(excluded_tables=excluded_behavior_tables)
Esempio n. 2
0
def delete_histology_alyx_shadow(verbose=False):

    CHANNEL_TABLES = [
        histology_ingest.ChannelBrainLocationTemp,
        histology_ingest.ChannelBrainLocation, alyxraw.AlyxRaw.Field,
        alyxraw.AlyxRaw
    ]

    channel_loc_keys = update_utils.get_deleted_keys('experiments.channel')
    for t in CHANNEL_TABLES:
        print(f'Deleting from table {t.__name__}')
        uuid_name = t.heading.primary_key[0]
        keys = [{uuid_name: k['uuid']} for k in tqdm(channel_loc_keys)]
        table = InsertBuffer(t)

        for k in tqdm(keys, position=0):
            table.delete1(k)
            if table.flush_delete(chunksz=1000, quick=True) and verbose:
                print(f'Deleted 1000 entries from {t.__name__}')

        table.flush_delete(quick=True)

    traj_keys = update_utils.get_deleted_keys('experiments.trajectoryestimate') + \
        update_utils.get_updated_keys('experiments.trajectoryestimate')

    TRAJ_TABLES = [
        histology_ingest.ProbeTrajectoryTemp, histology_ingest.ProbeTrajectory,
        alyxraw.AlyxRaw.Field, alyxraw.AlyxRaw
    ]

    for t in TRAJ_TABLES:
        uuid_name = t.heading.primary_key[0]
        keys = [{uuid_name: k['uuid']} for k in traj_keys]
        table = InsertBuffer(t)
        for k in tqdm(keys, position=0):
            table.delete1(k)
            if table.flush_delete(chunksz=1000, quick=True) and verbose:
                print(f'Deleted 1000 entries from {t.__name__}')
        table.flush_delete(quick=True)