y_axon_tp_rand = 30 y_soma_tp_rand_norm = 30 y_axon_tp_rand_norm = 26 #Just add types as you go TEST_TYPE = 21 #Catalog #Square wave distance finder if TEST_TYPE == 1: y0 = 90 mydur = .3 stim_params = [mydelay, mydur, mysimtime, mydt, myrho] baseline_thr = ptl.get_thresh(cell, 'sq', init_amp, init_step, x_soma, y0, stim_params) print 'baseline:',baseline_thr for dely in range(0,50,2): y_new = y0 - dely print 'y:',y_new thr = ptl.get_thresh(cell, 'sq', init_amp, init_step, x_axon, y_new, stim_params) print thr #Triphasic wave distance finder if TEST_TYPE == 2: y0 = 30 mydur = .3 stim_params = [mydelay, mydur, mysimtime, mydt, myrho] baseline_thr = ptl.get_thresh(cell, 'sq', init_amp, init_step, x_soma, y0, stim_params) print 'baseline:',baseline_thr for dely in range(0,y0,2):
#plt.figure() #plt.plot(t,i) #plt.show() #make 3d square wave plot duration vs. distance if TEST_TYPE == 2: cntlim = 30 durlist = [np.round(i,1) for i in np.linspace(.1,3,20)] distlist = np.linspace(1,400,30) outsoma = np.zeros((len(durlist),len(distlist))) for durind, dur in enumerate(durlist): stim_params = [mydelay, dur, mysimtime, mydt, myrho] for distind, dist in enumerate(distlist): print 'dur:',dur,'dist:',dist thr = ptl.get_thresh(cell, 'sq', init_amp, init_step, dist, y, stim_params, cnt_lim = cntlim) print thr outsoma[durind, distind] = thr fig, ax = plt.subplots() im = ax.imshow(outsoma, cmap=plt.cm.RdBu, vmin=0, vmax=8, extent=[min(distlist), max(distlist), min(durlist), max(durlist)], aspect = 'auto') im.set_interpolation('none') cb = fig.colorbar(im, ax=ax) plt.xlabel('Electrode Distance along cell [microns]') plt.ylabel('Pulse duration [ms]') plt.title('Threshold vs. Square Pulse Location and Duration (Soma)') plt.show() save_obj(outsoma, 'outsoma.p') #make 3d DPP Balanced plot prepulse duration vs. distance
x_soma = 15 x_ah = 50 x_ais = 120 x_axon = 500 x_list = [x_soma, x_ah, x_ais, x_axon] x_list_label = ["Soma", "AIS", "Narrow Segment", "Distal Axon"] y_list = [5, 10, 20, 40, 60, 100] # microns durange = np.linspace(0.01, 10, 20) for y in y_list: data = np.zeros((len(x_list), len(durange))) for ix, x in enumerate(x_list): for imydur, mydur in enumerate(durange): print "y=", y, x, mydur stim_params = [mydelay, mydur, mysimtime, mydt, myrho] thr = ptl.get_thresh(cell, "sq", init_amp, init_step, x, y, stim_params, cnt_lim=30) print thr data[ix, imydur] = thr # plot plt.figure() hlist = [] # for ii,i in enumerate(np.transpose(data)): for ii, i in enumerate(data): grot = plt.plot(durange, i, label=x_list_label[ii]) hlist.append(grot) legend(hlist) plt.title("Strength Duration Curves at " + str(y) + " microns") plt.xlabel("Time [ms]") plt.ylabel("Threshold [uA]")