def dyeConc(concs): from PYME.Analysis._fithelpers import FitModel figure() constants={'q':0, 'O2':0} I = Stimulus(I0, [], []) t = linspace(1, 1e6, 1000) tXs = [] tRs = [] s = System(r,constants=constants, ties={'S1':('I', 'S0')},stimulae={'I':I})# s.GenerateGradAndJacCode() for i in range(len(concs)): s.initialConditions['S0'] = concs[i] #conc of fluorophores on an antibody ~ 100M res = s.solve(t) r1 = FitModel(emod, [1e-3, 3], res['X'][t>1e6], t[t>1e6]/1e6 - 1) tXs.append(r1[0][1]) r1 = FitModel(emod, [1e-3, 3], res['R'][t>1e6], t[t>1e6]/1e6 - 1) tRs.append(r1[0][1]) loglog(concs, tXs, label='X', lw=2) loglog(concs, tRs, label='R', lw=2) ylabel('Time constant [$s^{-1}$]') legend()
def stateLifetimes3(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(I0, [9e4], [0]) t = linspace(1, 1e5, 10000) tXs = [] tRs = [] nConc = constants[spec] rates = [] initConc = 1e-3 s = System(r,constants={}, ties={'S1':('I', '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] res, r = s.solve(t, True) #print res[-1].dtype #print res[-1].view('9f8') rates.append(r[-1]) rates = hstack(rates) #plot(concs, 1e-6/(-rates['X']/initConc)) 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 stateLifetimes(spec, concs): from PYME.Analysis._fithelpers import * plt.figure() constants = {'q': 10e-3, 'O2': 0.05 * air_sat_O2_conc} I = Stimulus(0, [], []) t = np.linspace(1, 10e6, 1000) tXs = [] tRs = [] nConc = constants[spec] for i in range(len(concs)): constants[spec] = concs[i] s = System(r, constants=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'] = 1e-3 s.initialConditions['R'] = 1e-3 res = s.solve(t) r1 = FitModel(emod, [1e-3, 3], res['X'], t / 1e6) tXs.append(r1[0][1]) r1 = FitModel(emod, [1e-3, 3], res['R'], t / 1e6) tRs.append(r1[0][1]) print(max(tXs[-1], tRs[-1])) #t = linspace(1, 5e6*max(max(tXs[-1], tRs[-1]), 1e-3), 1000) plt.loglog(concs, tXs, label='X', lw=2) plt.loglog(concs, tRs, label='R', lw=2) plt.plot([nConc, nConc], plt.ylim(), 'k--') plt.ylabel('Time constant [s]') plt.xlabel('[%s]' % spec) plt.legend()
def viscLifetimes(viscs): from PYME.Analysis._fithelpers import FitModel plt.figure() constants = {'q': 1e-6, 'O2': 0.1 * air_sat_O2_conc} I = Stimulus(I0, [1e6], [0]) tXs = [] tRs = [] for i in range(len(viscs)): visc = viscs[i] visc2 = visc if visc <= 10: t = np.linspace(1, 10e6, 10000) else: t = np.linspace(1, 10e6, 1000) r = genReactionScheme(visc, visc2) s = System(r, constants=constants, ties={'S1': ('I', 'S0')}, stimulae={'I': I}) # s.GenerateGradAndJacCode() s.initialConditions[ 'S0'] = 1e-3 #conc of fluorophores on an antibody ~ 100M res = s.solve(t) r1 = FitModel(emod, [1e-3, 3], res['X'][t > 1e6], t[t > 1e6] / 1e6 - 1) tXs.append(r1[0][1]) r1 = FitModel(emod, [1e-3, 3], res['R'][t > 1e6], t[t > 1e6] / 1e6 - 1) tRs.append(r1[0][1]) plt.loglog(viscs, tXs, label='X', lw=2) plt.loglog(viscs, tRs, label='R', lw=2) plt.ylabel('Time constant [$s^{-1}$]') plt.legend()
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 = np.linspace(1, 10e6, 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 = np.hstack(rates) plt.loglog(concs, 1e-6 / (-rates['X'] / initConc), c='b', label='X' + labelAddition, **lineSpec) plt.loglog(concs, 1e-6 / (-rates['R'] / initConc), c='g', label='R' + labelAddition, **lineSpec) plt.plot([nConc, nConc], plt.ylim(), 'k--') plt.ylabel('Dark state lifetime [s]') plt.xlabel('[%s]' % spec) plt.legend()
k15 / visc), #postulated permanent bleaching pathway Reaction( 'R + O2 <-> S0 + HO2', 5e2 / visc ), #oxidation of R by 02 - rate constant from [kaske & linquist `64] ] r = genReactionScheme(visc, visc2) #Intensity as a fraction of saturation intensity I0 = 1e-1 #intensity function #I = Stimulus(1e-3*I0, 1e6*np.array([1, 3, 4, 5, 6, 8, 9, 15, 16, 25, 26, 50, 51, 100]), # [0, I0, 0, I0, 0, I0, 0, I0, 0, I0, 0, I0, 0, I0]) I = Stimulus(I0, [], []) #s = System(r,constants={'I':I0, 'q':1e-6, 'O2':0.1*air_sat_O2_conc}, ties={'S1':('I', 'S0')})# constants = {'q': 5e-7, 'O2': (0.5e-5) * air_sat_O2_conc} #constants = {} #constants={'q':10e-3} s = System(r, constants=constants, ties={'S1': ('I', 'S0')}, stimulae={'I': I}) # s.GenerateGradAndJacCode() s.initialConditions['S0'] = 1e-6 #conc of fluorophores on an antibody ~ 100M #s.initialConditions['q'] = .25e-3 #s.initialConditions['O2'] = .1*air_sat_O2_conc exPower = I0 * k_emmision / excitations_per_W_per_cm2_per_us print(u'Excitation Power: %3.2g W/cm\xB2' % (exPower)) print(u' = %3.2g mW over a 15 \u03BCm field' %