Пример #1
0
def conditionAndTestMultiNoSK(data):
    sec_num, sec_loc, Sc0, St0, dSt, start, lag, outpath = data
    from getCells import HayCell
    cell = HayCell()
    stim_seg = cell.apic[sec_num](sec_loc)
    soma_seg = cell.soma[0](0.5)
    ## remove SK_E2 channels
    for sec in h.allsec():
        try:
            sec.uninsert('SK_E2')
        except:
            pass
    print(str(stim_seg))
    print('starting lag: ' + str(np.round(lag, 1)))
    S, traces = conditionAndTestNoSK(stim_seg, soma_seg, Sc0, St0, dSt, start,
                                     lag)
    trace_lists = {}
    for key in traces.keys():
        trace_lists[key] = traces[key].to_python()
    trace_lists['S'] = S
    trace_file = outpath + str(stim_seg.sec) + '_lag' + str(np.round(
        lag, 1)) + '_w' + str(np.round(S, 3)) + '_traces.json'
    with open(trace_file, 'w') as fileObj:
        json.dump(trace_lists, fileObj)
    print('DONE lag: ' + str(np.round(lag, 1)))
    return S
Пример #2
0
def chirpForMulti(invar):
    sec_num, loc, filename = invar
    from getCells import HayCell
    pt_cell = HayCell()
    seg = pt_cell.apic[sec_num](loc)
    from neuron import h
    for sec in h.allsec():
        try:
            sec.uninsert('SK_E2')
        except:
            pass
    from chirpUtils import applyChirp, getChirp
    amp = 0.0025
    f0, f1, t0, Fs, delay = 0.5, 20, 20, 1000, 5  # for looking at bimodal leading phase response in Hay cell
    I, t = getChirp(f0, f1, t0, amp, Fs, delay)
    print('running chirp on ' + str(seg))
    applyChirp(I,
               t,
               seg,
               pt_cell.soma[0](0.5),
               t0,
               delay,
               Fs,
               f1,
               out_file_name=filename)
Пример #3
0
def chirpForMulti(invar):
    model, sec_num, loc, filename = invar
    if model == 'kole':
        from getCells import KoleCell
        cell, _ = KoleCell()
        seg = cell.apic[sec_num](loc)
        soma_seg = cell.soma(0.5)
    if model == 'kolenoim':
        from getCells import KoleCell
        cell, _ = KoleCell()
        from neuron import h 
        for sec in h.allsec():
            try:
                sec.uninsert('Km')
            except:
                pass
        seg = cell.apic[sec_num](loc)
        soma_seg = cell.soma(0.5)
    elif model == 'neymotinkole':
        from getCells import NeymotinKoleCell
        cell = NeymotinKoleCell()
        seg = cell.apic[sec_num](loc)
        soma_seg = cell.soma(0.5)
    elif model == 'neymotinharnett':
        from getCells import NeymotinHarnettCell
        cell = NeymotinHarnettCell()
        seg = cell.apic[sec_num](loc)
        soma_seg = cell.soma(0.5)
    elif model == 'neymotinmigliore':
        from getCells import NeymotinMiglioreCell
        cell = NeymotinMiglioreCell()
        seg = cell.apic[sec_num](loc)
        soma_seg = cell.soma(0.5)
    elif model == 'hay':
        from getCells import HayCell
        cell, _ = HayCell()
        seg = cell.apic[sec_num](loc)
        soma_seg = cell.soma[0](0.5)
    elif model == 'ackerantic':
        from getCells import AckerAnticCell
        cell = AckerAnticCell()
        seg = cell.apical[sec_num](loc)
        soma_seg = cell.soma[0](0.5)
    elif model == 'haymig':
    	from getCells import HayCellMig
    	cell, _ = HayCellMig()
    	seg = cell.apic[sec_num](loc)
    	soma_seg = cell.soma[0](0.5)

    from chirpUtils import applyChirp, getChirp
    amp = 0.025
    f0, f1, t0, Fs, delay = 0.5, 10, 10, 1000, 5 # for looking at bimodal leading phase response in Hay cell
    I, t = getChirp(f0, f1, t0, amp, Fs, delay)
    print('running chirp on ' + str(seg))
    applyChirp(I, t, seg, soma_seg, t0, delay, Fs, f1, out_file_name=filename)
    
    print(str(sec) + ' ' + str(loc) + ': done')
import multiprocessing
from getCells import HayCell
cell = HayCell()
from synUtils import getLagData, getTp, conditionAndTestMulti, conditionAndTestMultiNoSK
import sys

if sys.argv[-1] == '2':
    stim_seg = cell.apic[2](0.5)
    soma_seg = cell.soma[0](0.5)
    weight = 0.125
    start = 200
    factor = 4
    Sc0 = weight / factor
    St0 = weight / (factor*5)
    dSt = weight / (factor*10)
    Tp, _ = getTp(stim_seg, soma_seg, start, Sc0)

    data = getLagData(2, 0.5, Sc0, St0, dSt, start, Tp, 1, '/u/craig/L5PYR_Resonance/timeDomainOutput/HayApic2/')
    data = tuple(data)

elif sys.argv[-1] == '36':
    stim_seg = cell.apic[36](0.8)
    soma_seg = cell.soma[0](0.5)
    weight = 0.065
    start = 200
    factor = 4
    Sc0 = weight / factor
    St0 = weight / (factor*5)
    dSt = weight / (factor*10)
    Tp, _ = getTp(stim_seg, soma_seg, start, Sc0)
# load in packages
import sys
import os

# Handle command line arguments
## load cell
if sys.argv[-1] == 'Hay':
    from getCells import HayCell
    pt_cell = HayCell()
elif sys.argv[-1] == 'Neymotin':
    from getCells import NeymotinCell
    pt_cell = NeymotinCell()
elif sys.argv[-1] == 'AckerAntic':
    from getCells import AckerAnticCell
    pt_cell = AckerAnticCell()
elif sys.argv[-1] == 'Kole':
    from getCells import KoleCell
    pt_cell = KoleCell()
else:
    from getCells import AllenCell
    try:
        pt_cell = AllenCell(sys.argv[-1])
    except:
        print('Error: invalid cell type')

## create output directories
out_path = '/home/craig_kelley_downstate_edu/L5PYR_Resonance/' + sys.argv[
    -1] + '/'
try:
    os.mkdir(out_path + 'impedance_measures')
except:
Пример #6
0
        else:
            for loc in np.linspace(1/(nseg+1), nseg/(nseg+1), nseg):
                data.append([model, sec_num, loc, '/u/craig/L5PYR_Resonance/Neymotin/harnett_trunk_data/'+str(cell.apic[sec_num](loc))])
if model == 'neymotinmigliore':
    from getCells import NeymotinMiglioreCell
    cell = NeymotinMiglioreCell()
    for sec_num, sec in enumerate(cell.apical_maintrunk):
        nseg = sec.nseg 
        if nseg == 1:
            data.append([model, sec_num, 0.5, '/u/craig/L5PYR_Resonance/Neymotin/migliore_trunk_data/'+str(cell.apic[sec_num](0.5))])
        else:
            for loc in np.linspace(1/(nseg+1), nseg/(nseg+1), nseg):
                data.append([model, sec_num, loc, '/u/craig/L5PYR_Resonance/Neymotin/migliore_trunk_data/'+str(cell.apic[sec_num](loc))])
if model == 'hay':
    from getCells import HayCell
    cell, trunk = HayCell()
    for sec_num in trunk:
        nseg = cell.apic[sec_num].nseg 
        if nseg == 1:
            data.append([model, sec_num, 0.5, '/u/craig/L5PYR_Resonance/Hay/trunk_data/'+str(cell.apic[sec_num](0.5))])
        else:
            for loc in np.linspace(1/(nseg+1), nseg/(nseg+1), nseg):
                data.append([model, sec_num, loc, '/u/craig/L5PYR_Resonance/Hay/trunk_data/'+str(cell.apic[sec_num](loc))])
if model == 'haymig':
    from getCells import HayCellMig
    cell, trunk = HayCellMig()
    for sec_num in trunk:
        nseg = cell.apic[sec_num].nseg 
        if nseg == 1:
            data.append([model, sec_num, 0.5, '/u/craig/L5PYR_Resonance/Hay/mig_trunk_data/'+str(cell.apic[sec_num](0.5))])
        else:
Пример #7
0
# Load in the goods
import numpy as np
import sys
from scipy.io import savemat
from math import nan

# parse cmd line inputs, load PT cell template
## load cell
from getCells import HayCell
morph_file = sys.argv[-2]
pt_cell = HayCell(morphology_file=morph_file)

## specify stimulated section and soma segment
section = sys.argv[-1]
if section.split('.')[1][:4] == 'apic':
    sec = pt_cell.apic[int(section.split('.')[1].split('[')[1].split(']')[0])]
else:
    sec = pt_cell.dend[int(section.split('.')[1].split('[')[1].split(']')[0])]

soma_seg = pt_cell.soma[0](0.5)

# define current stimulus
from chirpUtils import applyChirp
from chirpUtils import getChirp
amp = 0.0025
f0, f1, t0, Fs, delay = 0.5, 50, 50, 1000, 12
I, t = getChirp(f0, f1, t0, amp, Fs, delay)

# define output variables
ZinResAmp = []
ZinResFreq = []
def chirpForMulti(invar):
    sec_num, loc, filename = invar
    from getCells import HayCell
    pt_cell = HayCell()
    seg = pt_cell.apic[sec_num](loc)
    # from neuron import h
    # for sec in h.allsec():
    #     try: sec.uninsert('SK_E2')
    #     except: pass
    from chirpUtils import applyChirp, getChirp
    amp = 0.0025
    f0, f1, t0, Fs, delay = 0.5, 20, 20, 1000, 5  # for looking at bimodal leading phase response in Hay cell
    I, t = getChirp(f0, f1, t0, amp, Fs, delay)
    print('running chirp on ' + str(seg))
    out = applyChirp(I, t, seg, pt_cell.soma[0](0.5), t0, delay, Fs, f1)
    ZinResAmp = []
    ZinResFreq = []
    ZcResAmp = []
    ZcResFreq = []
    dist = []
    QfactorIn = []
    QfactorTrans = []
    fVarIn = []
    fVarTrans = []
    ZinPeakPhaseFreq = []
    ZinLeadPhaseBW = []
    ZinLeadPhaseMinFreq = []
    ZinSynchFreq = []
    ZinLeadPhaseBool = []
    ZcPeakPhaseFreq = []
    ZcLeadPhaseBW = []
    ZcLeadPhaseMinFreq = []
    ZcSynchFreq = []
    ZcLeadPhaseBool = []
    ZinResAmp.append(out['ZinResAmp'])
    ZinResFreq.append(out['ZinResFreq'])
    ZcResAmp.append(out['ZcResAmp'])
    ZcResFreq.append(out['ZcResFreq'])
    dist.append(out['dist'])
    QfactorIn.append(out['QfactorIn'])
    QfactorTrans.append(out['QfactorTrans'])
    fVarIn.append(out['fVarIn'])
    fVarTrans.append(out['fVarTrans'])

    freqs = out['Freq'][np.argwhere(out['ZinPhase'] > 0)]
    if len(freqs) > 0:
        ZinPeakPhaseFreq.append(out['Freq'][np.argwhere(
            out['ZinPhase'] == np.max(out['ZinPhase']))])
        ZinLeadPhaseBW.append(freqs[-1] - freqs[0])
        ZinLeadPhaseMinFreq.append(freqs[0])
        ZinSynchFreq.append(freqs[-1])
        ZinLeadPhaseBool.append(out['ZinPhase'] > 0)
    else:
        ZinPeakPhaseFreq.append(nan)
        ZinLeadPhaseBW.append(0)
        ZinLeadPhaseMinFreq.append(nan)
        ZinSynchFreq.append(nan)
        ZinLeadPhaseBool.append(out['ZinPhase'] > 0)

    freqs = out['Freq'][np.argwhere(out['ZcPhase'] > 0)]
    if len(freqs) > 0:
        ZcPeakPhaseFreq.append(
            out['Freq'][np.argwhere(out['ZcPhase'] == np.max(out['ZcPhase']))])
        ZcLeadPhaseBW.append(freqs[-1] - freqs[0])
        ZcLeadPhaseMinFreq.append(freqs[0])
        ZcSynchFreq.append(freqs[-1])
        ZcLeadPhaseBool.append(out['ZcPhase'])
    else:
        ZcPeakPhaseFreq.append(nan)
        ZcLeadPhaseBW.append(0)
        ZcLeadPhaseMinFreq.append(nan)
        ZcSynchFreq.append(nan)
        ZcLeadPhaseBool.append(out['ZcPhase'])
    print(str(sec) + ' ' + str(loc) + ': done')

    output = {
        'ZinResAmp': ZinResAmp,
        'ZinResFreq': ZinResFreq,
        'ZcResAmp': ZcResAmp,
        'ZcResFreq': ZcResFreq,
        'dist': dist,
        'QfactorIn': QfactorIn,
        'QfactorTrans': QfactorTrans,
        'fVarIn': fVarIn,
        'fVarTrans': fVarTrans,
        'ZinPeakPhaseFreq': ZinPeakPhaseFreq,
        'ZinLeadPhaseBW': ZinLeadPhaseBW,
        'ZinLeadPhaseMinFreq': ZinLeadPhaseMinFreq,
        'ZinSynchFreq': ZinSynchFreq,
        'ZinLeadPhaseBool': ZinLeadPhaseBool,
        'ZcPeakPhaseFreq': ZcPeakPhaseFreq,
        'ZcLeadPhaseBW': ZcLeadPhaseBW,
        'ZcLeadPhaseMinFreq': ZcLeadPhaseMinFreq,
        'ZcSynchFreq': ZcSynchFreq,
        'ZcLeadPhaseBool': ZcLeadPhaseBool
    }

    savemat(filename + '.mat', output)
# Load in the goods
import numpy as np
import sys
from scipy.io import savemat
from math import nan

# parse cmd line inputs, load PT cell template
## load cell
if sys.argv[-2] == 'Hay':
    from getCells import HayCell
    pt_cell = HayCell()
elif sys.argv[-2] == 'Neymotin':
    from getCells import NeymotinCell
    pt_cell = NeymotinCell(slope=100)
elif sys.argv[-2] == 'AckerAntic':
    from getCells import AckerAnticCell
    pt_cell = AckerAnticCell()
elif sys.argv[-2] == 'Kole':
    from getCells import KoleCell
    pt_cell = KoleCell()
else:
    from getCells import AllenCell
    # try:
    pt_cell = AllenCell(sys.argv[-2])
    # except:
    #     print('Error: invalid cell type')

## specify stimulated section and soma segment
section = sys.argv[-1]
if sys.argv[-2] == 'Neymotin' or sys.argv[-2] == 'Hay' or sys.argv[
        -2] == 'Kole':