Esempio n. 1
0
def update_concept_maps():
    ncm_fields, ecm_fields, nedm_fields = load()
    datatables = m.DataTable.objects.all()
    print 'Getting or creating data sources'
    for i,x in enumerate(datatables):
        prog(i,datatables.count())
        m.DataSource.objects.get_or_create(data_table=x)
    
    anon_user = m.get_anon_user()
    robot_user = m.get_robot_user()
    print 'Updating nedm fields'
    for i,nedm_field in enumerate(nedm_fields):
        prog(i, len(nedm_fields))
        nedm=m.NeuronEphysDataMap.objects.get(pk=nedm_field['pk'])
        data_source = m.DataSource.objects.get(data_table=nedm_field['fields']['data_table'])
        nedm.source = data_source
        # if nedm.added_by_old == 'human':
        #     nedm.added_by = anon_user
        # else:
        #     nedm.added_by = robot_user
        nedm.save()

    print 'Updating ncm fields'
    for i,ncm_field in enumerate(ncm_fields):
        prog(i, len(ncm_fields))
        ncm=m.NeuronConceptMap.objects.get(pk=ncm_field['pk'])
        data_source = m.DataSource.objects.get(data_table=ncm_field['fields']['data_table'])
        ncm.source = data_source
        # if ncm.added_by_old == 'human':
        #     ncm.added_by = anon_user
        # else:
        #     ncm.added_by = robot_user
        ncm.save()
    
    print 'Updating ecm fields'

    for ecm_field in ecm_fields:
        prog(i, len(ecm_fields))

        ecm=m.EphysConceptMap.objects.get(pk=ecm_field['pk'])
        data_source = m.DataSource.objects.get(data_table=ecm_field['fields']['data_table'])
        ecm.source = data_source
        # if ecm.added_by_old == 'human':
        #     ecm.added_by = anon_user
        # else:
        #     ecm.added_by = robot_user
        ecm.save()
Esempio n. 2
0
def get_old_shreejoy_user_list():
    old_shreejoy_user_list = list(m.User.objects.filter(email='*****@*****.**'))
    old_shreejoy_user_list.append(m.User.objects.get(username = '******'))
    old_shreejoy_user_list.append(m.get_anon_user())

    return old_shreejoy_user_list
        afts.save()
            
        us_ob = m.UserSubmission.objects.get_or_create(user = user, article = a)[0]
        ds_ob = m.DataSource.objects.get_or_create(user_submission = us_ob)[0]
        ncm_ob = m.NeuronConceptMap.objects.get_or_create(source = ds_ob, added_by = user, neuron = n, 
                                                          times_validated = 1)[0]
        
        add_ephys_nedm(tm_mean, tm_sem, 4, ds_ob, ncm_ob, user)
        add_ephys_nedm(hw_mean, hw_sem, 6, ds_ob, ncm_ob, user)
        add_ephys_nedm(thresh_mean, thresh_sem, 7, ds_ob, ncm_ob, user)
        add_ephys_nedm(ir_mean, ir_sem, 2, ds_ob, ncm_ob, user)
        add_ephys_nedm(rmp_mean, rmp_sem, 3, ds_ob, ncm_ob, user)
        add_ephys_nedm(amp_mean, amp_sem, 5, ds_ob, ncm_ob, user)
        

anon_user = m.get_anon_user()
def process_table(table, ncols, nrows):
    user = m.User.objects.get(username = '******') 
    table_norm = [ [ 0 for i in range(6) ] for j in range(nrows ) ]
    table_norm = np.zeros([nrows, 6], dtype='a16')
    for i in range(1,nrows):
        ref = table[i][0]
#        neuron_type = table[i][5]
#n = m.Neuron.objects.filter(name = neuron_type)[0]
        species = table[i][2]
        strain = table[i][3]
        age = table[i][4]
        electrode = table[i][6]
        prep_type = table[i][7]
        temp = table[i][5]
        neuron_type = table[i][1]