Ejemplo n.º 1
0
    def to_report_lab(cls, alphabeta_chl, reportlabconfig, make_graphs):
        from reportlab.platypus import Paragraph, Table
        local_elements = []
        local_elements.append(Paragraph("Overview", reportlabconfig.styles['Heading3']))

        # Summary:
        overview_table_data = [
                             ["Max Conductance (gBar)", alphabeta_chl.conductance.rescale("mS/cm2")],
                             ["Reversal Potential", alphabeta_chl.reversalpotential.rescale("mV")],
                             ["Conductance Equation", "gBar * " + alphabeta_chl.eqn],
                           ]

        local_elements.append(Table(overview_table_data, style=reportlabconfig.listTableStyle))


        # Plot out the States:
        for state, params in alphabeta_chl.statevars.iteritems():
            local_elements.append(Paragraph("State: %s" % state, reportlabconfig.styles['Heading3']))


            #Equations:
            eqns = [
                    "alpha(V) = (A+BV)/(C+exp((V+D)/E))",
                    "beta(V) = (A+BV)/(C+exp((V+D)/E))",
                   ]
            for eqn in eqns:
                local_elements.append(Paragraph(eqn, reportlabconfig.styles['Normal']))
            # Alpha Beta
            ReportLabTools.build_alpha_beta_table(elements=local_elements,
                                     reportlabconfig=reportlabconfig,
                                     title="Alpha", params=params[0])
            ReportLabTools.build_alpha_beta_table(elements=local_elements,
                                     reportlabconfig=reportlabconfig,
                                     title="Beta1", params=params[1])


            if make_graphs:
                # Figures:
                fig = cls.plot_state_curve_summary(alphabeta_chl, state, figsize=(5, 5))
                local_elements.append(reportlabconfig.save_mpl_to_rl_image(fig, "somestate"))
                import pylab
                pylab.close(fig.fig)


        return local_elements
        def to_report_lab(cls, calciumAlphaBetaBetaChannel, reportlabconfig, make_graphs):
            chl = calciumAlphaBetaBetaChannel

            localElements = []
            localElements.append(Paragraph("Overview", reportlabconfig.styles['Heading3']))

            # Summary:
            overviewTableData = [
                                 ["permeability", chl.permeability],
                                 ["intracellular_concentration",  chl.intracellular_concentration],
                                 ["extracellular_concentration",  chl.extracellular_concentration],
                                 ["Equation EXPLAIN", chl.eqn],
                                 ["beta2threshold", chl.beta2threshold],
                                 ["Temperature ", chl.T],
                                 ["F", chl.F],
                                 ["R", chl.R],
                                 ["CaZ", chl.CaZ],
                               ]


            localElements.append(Table(overviewTableData, style=reportlabconfig.listTableStyle))

            #GHK Max Current Flow
            localElements.append(Paragraph("MaxCurrentFlow From GHK", reportlabconfig.styles['Heading3']))
            fig = cls.PlotGHKMaxCurrentFlow(calciumAlphaBetaBetaChannel, figsize=(4, 4))
            localElements.append(reportlabconfig.save_mpl_to_rl_image(fig, "ghk"))

            # Plot out the States:
            for state, params in calciumAlphaBetaBetaChannel.statevars.iteritems():
                localElements.append(Paragraph("State: %s" % state, reportlabconfig.styles['Heading3']))

                if make_graphs:
                    fig = cls.plot_state_curve_summary(chl, state, figsize=(5, 5))
                    localElements.append(reportlabconfig.save_mpl_to_rl_image(fig, "somestate"))
                    fig.close()

                #Equations:
                eqns = [
                        "beta2Threshold = %s" % calciumAlphaBetaBetaChannel.beta2threshold,
                        "beta = beta1 if V less than beta2Threshold otherwise beta2",
                        "alpha(V) = (A+BV)/(C+exp((V+D)/E))",
                        "beta(V) = (A+BV)/(C+exp((V+D)/E))",
                       ]
                for eqn in eqns:
                    localElements.append(Paragraph(eqn, reportlabconfig.styles['Normal']))

                # Alpha Beta
                ReportLabTools.build_alpha_beta_table(elements=localElements,
                                         reportlabconfig=reportlabconfig,
                                         title="Alpha", params=params[0])
                ReportLabTools.build_alpha_beta_table(elements=localElements,
                                         reportlabconfig=reportlabconfig,
                                         title="Beta1", params=params[1])
                ReportLabTools.build_alpha_beta_table(elements=localElements,
                                         reportlabconfig=reportlabconfig,
                                         title="Beta2", params=params[2])

            return localElements
Ejemplo n.º 3
0
        def to_report_lab(cls, alphabeta_beta_chl, reportlabconfig, make_graphs):
            from reportlab.platypus import Paragraph, Table
            local_elements = []
            local_elements.append(Paragraph("Overview", reportlabconfig.styles['Heading3']))

            # Summary:
            overview_table_data = [
                                 ["Channel Type", "AlphaBetaBetaChl"],
                                 ["Max Conductance (gBar)", alphabeta_beta_chl.conductance],
                                 ["Reversal Potential", alphabeta_beta_chl.reversalpotential],
                                 ["Conductance Equation", "gBar * " + alphabeta_beta_chl.eqn],
                               ]
            local_elements.append(Table(overview_table_data, style=reportlabconfig.listTableStyle))


            # Plot out the States:
            for state, params in alphabeta_beta_chl.statevars.iteritems():
                local_elements.append(Paragraph("State: %s" % state, reportlabconfig.styles['Heading3']))


                if make_graphs:
                    fig = Summarise_MM_AlphaBetaChannel.plot_state_curve_summary(alphabeta_beta_chl, state, figsize=(5, 5))
                    local_elements.append(reportlabconfig.save_mpl_to_rl_image(fig, "somestate"))


                local_elements.append(Paragraph("Equations", reportlabconfig.styles['Heading4']))

                #Equations:
                eqns = [
                        "beta2Threshold = %s" % alphabeta_beta_chl.beta2threshold,
                        "beta = beta1 if V less than beta2Threshold otherwise beta2",
                        "alpha(V) = (A+BV)/(C+exp((V+D)/E))",
                        "beta(V) = (A+BV)/(C+exp((V+D)/E))",
                       ]
                for eqn in eqns:
                    local_elements.append(Paragraph(eqn, reportlabconfig.styles['Normal']))

                # Alpha Beta
                ReportLabTools.build_alpha_beta_table(elements=local_elements,
                                         reportlabconfig=reportlabconfig,
                                         title="Alpha", params=params[0])
                ReportLabTools.build_alpha_beta_table(elements=local_elements,
                                         reportlabconfig=reportlabconfig,
                                         title="Beta1", params=params[1])
                ReportLabTools.build_alpha_beta_table(elements=local_elements,
                                         reportlabconfig=reportlabconfig,
                                         title="Beta2", params=params[2])



            return local_elements
Ejemplo n.º 4
0
 def toReportLab(cls, alphaBetaBetaChl, reportlabconfig, make_graphs):
     from reportlab.platypus import Paragraph, Table
     localElements = []
     localElements.append( Paragraph("Overview",reportlabconfig.styles['Heading3']) )
     
     # Summary:
     overviewTableData = [
                          ["Channel Type", "AlphaBetaBetaChl"],
                          ["Max Conductance (gBar)", alphaBetaBetaChl.conductance],
                          ["Reversal Potential", alphaBetaBetaChl.reversalpotential],
                          ["Conductance Equation", "gBar * " + alphaBetaBetaChl.eqn],
                         ]
     localElements.append( Table(overviewTableData, style=reportlabconfig.listTableStyle) )
     
     
     # Plot out the States:
     for state,params in alphaBetaBetaChl.statevars.iteritems():
         localElements.append( Paragraph("State: %s"%state,reportlabconfig.styles['Heading3']) )
         
         
         if make_graphs:
             fig = Summarise_MM_AlphaBetaChannel.PlotStateCurveSummary(alphaBetaBetaChl, state, figsize=(5,5))
             localElements.append( reportlabconfig.saveMPLToRLImage(fig, "somestate") )
         
         
         localElements.append( Paragraph("Equations",reportlabconfig.styles['Heading4']) )
         
         #Equations:
         eqns = [
                 "beta2Threshold = %s"%alphaBetaBetaChl.beta2threshold,
                 "beta = beta1 if V less than beta2Threshold otherwise beta2",
                 "alpha(V) = (A+BV)/(C+exp( (V+D)/E) )",
                 "beta(V) = (A+BV)/(C+exp( (V+D)/E) )",
                 ]
         for eqn in eqns:
             localElements.append( Paragraph(eqn,reportlabconfig.styles['Normal']) )  
         
         # Alpha Beta
         ReportLabTools.buildAlphaBetaTable( elements=localElements, 
                                  reportlabconfig=reportlabconfig, 
                                  title="Alpha", params=params[0] )   
         ReportLabTools.buildAlphaBetaTable( elements=localElements, 
                                  reportlabconfig=reportlabconfig, 
                                  title="Beta1", params=params[1] )
         ReportLabTools.buildAlphaBetaTable( elements=localElements, 
                                  reportlabconfig=reportlabconfig, 
                                  title="Beta2", params=params[2] )
         
         
         
     return localElements
Ejemplo n.º 5
0
    def to_report_lab(cls, calciumAlphaBetaBetaChannel, reportlabconfig,
                      make_graphs):
        chl = calciumAlphaBetaBetaChannel

        localElements = []
        localElements.append(
            Paragraph("Overview", reportlabconfig.styles['Heading3']))

        # Summary:
        overviewTableData = [
            ["permeability", chl.permeability],
            ["intracellular_concentration", chl.intracellular_concentration],
            ["extracellular_concentration", chl.extracellular_concentration],
            ["Equation EXPLAIN", chl.eqn],
            ["beta2threshold", chl.beta2threshold],
            ["Temperature ", chl.T],
            ["F", chl.F],
            ["R", chl.R],
            ["CaZ", chl.CaZ],
        ]

        localElements.append(
            Table(overviewTableData, style=reportlabconfig.listTableStyle))

        #GHK Max Current Flow
        localElements.append(
            Paragraph("MaxCurrentFlow From GHK",
                      reportlabconfig.styles['Heading3']))
        fig = cls.PlotGHKMaxCurrentFlow(calciumAlphaBetaBetaChannel,
                                        figsize=(4, 4))
        localElements.append(reportlabconfig.save_mpl_to_rl_image(fig, "ghk"))

        # Plot out the States:
        for state, params in calciumAlphaBetaBetaChannel.statevars.iteritems():
            localElements.append(
                Paragraph("State: %s" % state,
                          reportlabconfig.styles['Heading3']))

            if make_graphs:
                fig = cls.plot_state_curve_summary(chl, state, figsize=(5, 5))
                localElements.append(
                    reportlabconfig.save_mpl_to_rl_image(fig, "somestate"))
                fig.close()

            #Equations:
            eqns = [
                "beta2Threshold = %s" %
                calciumAlphaBetaBetaChannel.beta2threshold,
                "beta = beta1 if V less than beta2Threshold otherwise beta2",
                "alpha(V) = (A+BV)/(C+exp((V+D)/E))",
                "beta(V) = (A+BV)/(C+exp((V+D)/E))",
            ]
            for eqn in eqns:
                localElements.append(
                    Paragraph(eqn, reportlabconfig.styles['Normal']))

            # Alpha Beta
            ReportLabTools.build_alpha_beta_table(
                elements=localElements,
                reportlabconfig=reportlabconfig,
                title="Alpha",
                params=params[0])
            ReportLabTools.build_alpha_beta_table(
                elements=localElements,
                reportlabconfig=reportlabconfig,
                title="Beta1",
                params=params[1])
            ReportLabTools.build_alpha_beta_table(
                elements=localElements,
                reportlabconfig=reportlabconfig,
                title="Beta2",
                params=params[2])

        return localElements