示例#1
0
'''
This script copies tuples in the shadow tables into the real tables for alyx.
'''

import datajoint as dj
from ibl_pipeline.ingest import reference as reference_ingest
from ibl_pipeline.ingest import subject as subject_ingest
from ibl_pipeline.ingest import action as action_ingest
from ibl_pipeline.ingest import acquisition as acquisition_ingest
from ibl_pipeline import reference, subject, action, acquisition
from ibl_pipeline.ingest.ingest_utils import copy_table
from table_names import *

if __name__ = '__main__':

    mods = [
        [reference, reference_ingest, REF_TABLES],
        [subject, subject_ingest, SUBJECT_TABLES],
        [action, action_ingest, ACTION_TABLES],
        [acquisition, acquisition_ingest, ACQUISITION_TABLES],
        [data, data_ingest, DATA_TABLES]
    ]

    for (target, source, table_list) in mods:
        for table in table_list:
            print(table)
            copy_table(target, source, table)
import datajoint as dj
from ibl_pipeline.ingest import reference as reference_ingest
from ibl_pipeline.ingest import subject as subject_ingest
from ibl_pipeline.ingest import action as action_ingest
from ibl_pipeline.ingest import acquisition as acquisition_ingest
from ibl_pipeline.ingest import data as data_ingest
from ibl_pipeline import reference, subject, action, acquisition, data
from ibl_pipeline.ingest.ingest_utils import copy_table
import table_names as tables

tables.init()

for table in tables.REF_TABLES:
    print(table)
    copy_table(reference, reference_ingest, table)


for table in tables.SUBJECT_TABLES:
    print(table)
    copy_table(subject, subject_ingest, table)


for table in tables.ACTION_TABLES:
    print(table)
    copy_table(action, action_ingest, table)


for table in tables.ACQUISITION_TABLES:
    print(table)
    copy_table(acquisition, acquisition_ingest, table)
示例#3
0
              (alyxraw.AlyxRaw.Field & 'fname="datetime"').proj(
                ts='cast(fvalue as datetime)') & 'ts!=trajectory_ts'

    print('Deleting alyxraw entries for histology...')
    (alyxraw.AlyxRaw & changed).delete()

    print('Repopulate alyxraw.AlyxRaw for updates...')
    insert_to_alyxraw(
        get_alyx_entries(models='experiments.trajectoryestimate'))

    print(
        'Repopulate shadow histology.ProbeTrajectory and ChannelBrainRegion...'
    )
    histology_ingest.ProbeTrajectory.populate(**kwargs)
    histology_ingest.ChannelBrainRegion.populate(**kwargs)

    print(
        'Updating and populate real histology.ProbeTrajectory and ChannelBrainRegion...'
    )
    for key in tqdm(
        (histology.ProbeTrajectory
         & changed.proj(probe_trajectory_uuid='uuid')).fetch('KEY'),
            position=0):
        (histology.ProbeTrajectory & key).delete()
        histology.ProbeTrajectory.populate(key, **kwargs)
        copy_table(histology, histology_ingest, 'ChannelBrainRegion')
        (histology.ClusterBrainRegion & key).delete()
        histology.ClusterBrainRegion.populate(key, **kwargs)
        (histology.SessionBrainRegion & key).delete()
        histology.SessionBrainRegion.populate(key, **kwargs)