def figs7(self): """ returns figure with NPQ trace for Arabidopsis WT simulated, measured and simulated npq4 mutant""" fig = plt.figure() ax = plt.subplot(111) v = visualizeexperiment.VisualizeExperiment('Arabidopsis', 900, 15) v.plotNPQ('r') light = cpfd.cpfd('Arabidopsis', 900) Tfls, PFDs = self.flashes(v, light) # ===================================================== # # integrate over the time # # ===================================================== # model, y0 = loadspecie.loadspecie('Arabidopsis', 'wt') s = simulate.Sim(model) s.piecewiseConstant(PFDs[0:], Tfls[0:], y0) res = npqResults.NPQResults(s) T, F, Fmax, Tm, Fm, Ts, Fs, Bst = res.fluo() timesft = 20 # shift the simulation by an interval to see the experimental points ax.plot(Tm + timesft, (Fm[0] - Fm) / Fm, c=self.col[6], marker='s', linestyle='-', label='wt') model2, y0 = loadspecie.loadspecie('Arabidopsis', 'npq4') s2 = simulate.Sim(model2) s2.piecewiseConstant(PFDs[0:], Tfls[0:], y0) res2 = npqResults.NPQResults(s2) T, F, Fmax, Tm, Fm, Ts, Fs, Bst = res2.fluo() timesft = 20 # shift the simulation by an interval to see the experimental points ax.plot(Tm + timesft, (Fm[0] - Fm) / Fm, c=self.col[1], marker='s', linestyle='-', label='npq4') # add light banner v.setGraphics([-30, 0, 841, 1792, 2147], 1.7, yheight=0.2) handles, labels = ax.get_legend_handles_labels() leg = ax.legend(handles, ['simulated wt', 'simulated npq4', 'measured wt'], bbox_to_anchor=(0., 1.02, 1., .102), loc=10, borderaxespad=0.1) if leg: leg.draggable() plt.title('') self.save_plot(fig, 'FigS7')
def fig6(self): """ :return: figure with fluorescence dynamics for Pothos simulated and measured and simulated and measured photosynthetic yield """ light = cpfd.cpfd('Pothos', 100) fig = plt.figure(figsize=(7, 3)) ax = plt.subplot(211) v = visualizeexperiment.VisualizeExperiment('Pothos', 100, 15) v.plotFluorescence() Tfls, PFDs = self.flashes(v, light) # load the Pothos model, automatically sets the gamma2 parameter to higher value model, y0 = loadspecie.loadspecie('Pothos', 'wt') s = simulate.Sim(model) s.piecewiseConstant(PFDs[0:], Tfls[0:], y0) # load the results into the res object that allow for easier data ansalysis res = npqResults.NPQResults(s) T, F, Fmax, Tm, Fm, Ts, Fs, Bst = res.fluo() timesft = 20 # shift the simulation by an interval to see the experimental points ax.plot(T + timesft, F / max(F), 'r') # collect handles to set the legend with experimental results T_avg, T_sd = v.getAvgValue('T') Fm_avg, Fm_sd = v.getAvgValue('Fm') l1 = plt.errorbar(T_avg, Fm_avg / Fm_avg[0], Fm_sd, color=self.col[5], linestyle='None', marker='^', label='Experiment') l3 = plt.Line2D([], [], linewidth=3, color='r') ax.set_ylabel('Fluorescence (a.u.)', fontsize=18) ax.set_xlabel('') ax.set_xticks([0, 840, 1800, 2100]) ax.set_xticklabels([0, '14', '30', '35']) leg = plt.legend([l1, l3], ["Experiment", "Simulation"]) if leg: leg.draggable() ax2 = plt.subplot(212) v.setGraphics([-100, 0, 841, 1792, 2147], 1, yheight=0.1) ax2.plot(v.getAvgValue('T')[0], (v.getAvgValue('Fm')[0] - v.getAvgValue('Ft')[0]) / v.getAvgValue('Fm')[0], color=self.col[5], marker='^', label='experiment') ax2.plot(Tm, (Fm - Fs) / Fm, color='r', marker='o', label='simulation') ax2.set_xticks([0, 840, 1800, 2100]) ax2.set_xticklabels([0, '14', '30', '35']) ax2.set_xlabel('time [min]', fontsize=16) ax2.set_ylabel('$\Phi$ PSII', fontsize=18) leg = plt.legend() if leg: leg.draggable() self.save_plot(fig, 'Fig6')
def fig4(self): """ :return: three plots with PAM traces simulated and measured experimentally """ timesft = 5 # shift the simulation by an interval to see the experimental points fig = plt.figure(figsize=(17, 5)) gs = gridspec.GridSpec(1, 3, width_ratios=[1, 1, 1]) for i in range(len(self.light_intens)): ax = plt.subplot(gs[i]) v = visualizeexperiment.VisualizeExperiment( 'Arabidopsis', self.light_intens[i], self.dark_dur[i]) v.plotFluorescence() # ===================================================== # # read out time of flashes as applied in the experiment # # ===================================================== # light = cpfd.cpfd('Arabidopsis', int(self.light_intens[i])) Tfls, PFDs = self.flashes(v, light) # ===================================================== # # integrate over the time # # ===================================================== # model, y0 = loadspecie.loadspecie('Arabidopsis', 'wt') s = simulate.Sim(model) s.piecewiseConstant(PFDs[0:], Tfls[0:], y0) res = npqResults.NPQResults(s) T, F, Fmax, Tm, Fm, Ts, Fs, Bst = res.fluo() # plot the simulation plt.plot(T + timesft, F / max(F), 'orchid', label='simulation') # add the legend for the experiment ax = plt.gca() T_avg, T_sd = v.getAvgValue('T') Fm_avg, Fm_sd = v.getAvgValue('Fm') l1 = ax.errorbar(T_avg, Fm_avg / Fm_avg[0], Fm_sd, color='k', linestyle='None', marker='^', label='Fm\'') l3 = plt.Line2D([], [], linewidth=3, color="orchid") leg = plt.legend([l1, l3], ["Experiment", "Simulation"]) if leg: leg.draggable() if i == 0: ax.annotate(str(self.light_intens[i]) + ' $\mu$Em$^{-2}$s$^{-1}$', (T_avg[9] / 2, 1.05), color='k', weight='bold', fontsize=16, ha='center', va='center') ax.set_ylabel('Fluorescence ($\mathrm{F_M\'}/\mathrm{F_M}$)', fontsize=18) else: ax.annotate(str(self.light_intens[i]), (T_avg[9] / 2, 1.05), color='k', weight='bold', fontsize=16, ha='center', va='center') ax.annotate(str(self.dark_dur[i]) + ' min', (T_avg[9] + (T_avg[16] - T_avg[9]) / 2, 1.05), color='w', weight='bold', fontsize=16, ha='center', va='center') if i == 0: ax.set_xticks([0, 840, 1800, 2100]) ax.set_xticklabels([0, '14', '30', '35'], fontsize=16) elif i == 1: ax.set_xticks([0, 840, 2700, 3000]) ax.set_xticklabels([0, '14', '45', '50'], fontsize=16) else: ax.set_xticks([0, 840, 4500, 4800]) ax.set_xticklabels([0, '14', '75', '80'], fontsize=16) ax.set_xlabel('time [min]', fontsize=18) plt.tight_layout() self.save_plot(fig, 'Fig4')
def fig5(self): """ :return: figure visualizing pH dependance of quencher and its components. Upper plot: phase plane trajectories Bottom plots: pH and quencher components for 3 light intensities """ color = list(self.col[i] for i in [1, 3, 5]) # select 3 distinct colours mark = ['x', 'o', 's'] v = visualizeexperiment.VisualizeExperiment('Arabidopsis', 100, 15) # set up the figure fig = plt.figure(figsize=(7, 10)) #make outer gridspec outer_grid = gridspec.GridSpec( 2, 1, hspace=0.2) # gridspec with two adjacent horizontal cellstwo rows ax = plt.subplot(outer_grid[0]) ax.set_ylabel('lumen pH', fontsize=18) ax.set_xlabel('quencher activity [Q]', fontsize=18) ax.set_ylim(3, 8) ax.set_xlim(0.05, 0.4) ax.set_yticks([3, 4, 5, 6, 7, 8]) ax.set_yticklabels(['', 4, 5, 6, 7, 8], fontsize=14) ax.set_xticks([0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4]) ax.set_xticklabels(['', '0.1', '', '0.2', '', '0.3', '', '0.4'], fontsize=14) # add the steady state m, y0 = loadspecie.loadspecie('Arabidopsis', 'wt') ss = simulate.Sim(m) scan = [ 10, 50, 100, 120, 150, 200, 220, 300, 320, 330, 340, 350, 400, 500, 600, 700, 800, 900, 1000, 1250, 1500 ] Y = ss.steadyStateLightScan(scan, y0) ax.plot(m.quencher(Y[:, 3], Y[:, 4]), misc.pH(Y[:, 1]), c='r', linestyle='-') for i in [6, 8, 17]: ax.plot(m.quencher(Y[i, 3], Y[i, 4]), misc.pH(Y[i, 1]), 'o', linestyle='None', markersize=15, mfc='r') upper_cell = outer_grid[1] inner_grid = gridspec.GridSpecFromSubplotSpec(2, 1, upper_cell, hspace=0.0) # From here we can plot using inner_grid's SubplotSpecs ax2 = plt.subplot(inner_grid[0, 0]) # add the three points for the calibrated light intensity PFDs = [ cpfd.cpfd('Arabidopsis', 100), cpfd.cpfd('Arabidopsis', 300), cpfd.cpfd('Arabidopsis', 900) ] time = [0, 30, 930, 1830, 2130] nsteps = [31, 901, 901, 301] # nr of steps for each integration phase v.setGraphics(time, 9, 1) ax2.set_ylabel('lumen pH', fontsize=14) ax2.set_ylim(2, 9) ax2.get_xaxis().set_visible(False) ax2.get_yaxis().set_visible(True) ax2.set_yticks([2, 3, 4, 5, 6, 7, 8]) ax2.set_yticklabels(['', 3, 4, 5, 6, 7, 8], fontsize=14) ax3 = plt.subplot(inner_grid[1, 0]) ax3.set_ylabel('Q components', fontsize=16) ax3.set_xlabel('time [min]', fontsize=18) ax3.set_xlim([0, time[-1]]) ax3.set_xticks(time[1:]) ax3.set_xticklabels(['30', '14', '30', '35'], fontsize=14) ax3.set_yticks([0, 0.2, 0.5, 0.8, 1.]) ax3.set_yticklabels([0, 0.2, 0.5, 0.8, ''], fontsize=14) for i in range(len(PFDs)): s = simulate.Sim(m) s.clearResults() PFD = PFDs[i] light = [0, PFD, 0, PFD] s.piecewiseConstant(light, time[1:], y0, nsteps) res = npqResults.NPQResults(s) ax.plot(m.quencher(res.getVar(3), res.getVar(4)), misc.pH(res.getVar(1)), c=color[i], marker=mark[i], label=str(self.light_intens[i])) ax2.plot(res.getT(), misc.pH(res.getVar(1)), c=color[i], label=str(self.light_intens[i])) ax3.plot(res.getT(), 1 - res.getVar(3), c=color[i], linestyle='--', label=str(self.light_intens[i])) ax3.plot(res.getT(), 1 - res.getVar(4), c=color[i], linestyle='-', label=str(self.light_intens[i])) handles, labels = ax.get_legend_handles_labels() leg1 = ax.legend(handles, labels, bbox_to_anchor=(0., 1.02, 1., .102), loc=10, ncol=1, borderaxespad=0.1) if leg1: leg1.draggable() handles, labels = ax3.get_legend_handles_labels() leg = ax3.legend([ handles[0], handles[2], handles[4], handles[1], handles[3], handles[5] ], [labels[0], labels[2], labels[4], labels[1], labels[3], labels[5]], bbox_to_anchor=(0., 1.02, 1., .102), loc=10, title='PsbS$^P$ Zx', ncol=2, borderaxespad=0.1) if leg: leg.draggable() self.save_plot(fig, 'Fig5')
# Y = [Q, pH, PQ, Fs] Pref = [p.gamma0, p.gamma1, p.gamma2, p.gamma3] Xref = np.zeros([len(PFDs), 4]) for i in range(len(PFDs)): m = npqModel.NPQModel(p, 2) s = simulate.Sim(m) s.clearResults() l = lightProtocol.LightProtocol({'prot': 'const', 'PFD': PFDs[i]}) s.timeCourse(l, T, y0) res = npqResults.NPQResults(s) T, F, Fmax, Tm, Fm, Ts, Fs, Bst = res.fluo() Xref[i] = [ m.quencher(res.getVar(3), res.getVar(4))[-1], misc.pH(res.getVar(1))[-1], res.getVar(0)[-1], F[-1] ] # change the value of gamma parameter by 1% perturb = [1.01, 0.99] # collect new calculated values for perturbated parameters for different light intensities Xgl = np.zeros([len(Pref), 2, len(PFDs), 4]) Rgl = np.zeros([len(Pref), len(PFDs), 4])