def stateLifetimes2(spec, concs, r, labelAddition = '', constants={'q':10e-3, 'O2':0.1*air_sat_O2_conc}, **kwargs): lineSpec = {'lw':2} lineSpec.update(kwargs) #figure() #constants={'q':10e-3, 'O2':0.1*air_sat_O2_conc} I = Stimulus(0, [], []) t = linspace(1, 1e5, 1000) tXs = [] tRs = [] nConc = constants[spec] rates = [] initConc = 1e-3 s = System(r,constants={}, ties={'S1':('0', 'S0')},stimulae={'I':I})# s.GenerateGradAndJacCode() s.initialConditions['S0'] = 1e-3 #conc of fluorophores on an antibody ~ 100M #s.initialConditions['X'] = initConc #s.initialConditions['R'] = initConc s.initialConditions['q'] = constants['q'] s.initialConditions['O2'] = constants['O2'] for i in range(len(concs)): s.initialConditions[spec] = concs[i] rates.append(s.GradFcn(0, s.initialConditions.view('f8')).view(s.dtype)) rates = hstack(rates) loglog(concs, 1e-6/(-rates['X']/initConc), c = 'b', label='X' + labelAddition, **lineSpec) loglog(concs, 1e-6/(-rates['R']/initConc), c = 'g', label='R' + labelAddition, **lineSpec) plot([nConc, nConc], ylim(), 'k--') ylabel('Dark state lifetime [s]') xlabel('[%s]' % spec) legend()
def dyeConc2(concs): constants={'q':5e-3, 'O2':0.1*air_sat_O2_conc} #constants = {} #constants={'q':0, 'O2':0} s = System(r,constants=constants, ties={'S1':('I', 'S0')},stimulae={'I':I})# s.GenerateGradAndJacCode() rates = [] for c in concs: s.initialConditions['S0'] = c res = s.solve([1e3]) rates.append(s.GradFcn(0, res.view('f8')).view(s.dtype)) rates = hstack(rates) figure() #plot(concs, rates['S0']/concs) plot(concs, rates['T1']/concs)