예제 #1
0
파일: html.py 프로젝트: scideb/iminuit
    def print_param(self, mps, merr=None, float_format='%5.3e',
                    smart_latex=True, latex_map=None):
        """print list of parameters
        Arguments:

            *mps* : minuit parameters struct
            *merr* : minos error
            *float_format* : control the format of latex floating point output
                default '%5.3e'
            *smart_latex* : convert greek symbols and underscores to latex 
                symbol. default True
        """
        to_print = ""
        uid = randid()
        header = """
        <table>
            <tr>
                <td><a href="#" onclick="$('#{uid}').toggle()">+</a></td>
                <td title="Variable name">Name</td>
                <td title="Value of parameter">Value</td>
                <td title="Parabolic error">Parab Error</td>
                <td title="Minos lower error">Minos Error-</td>
                <td title="Minos upper error">Minos Error+</td>
                <td title="Lower limit of the parameter">Limit-</td>
                <td title="Upper limit of the parameter">Limit+</td>
                <td title="Is the parameter fixed in the fit">FIXED</td>
            </tr>
        """.format(**locals())
        to_print += header
        for i, mp in enumerate(mps):
            minos_p, minos_m = (0., 0.) if merr is None or mp.name not in merr else\
                               (merr[mp.name].upper, merr[mp.name].lower)
            limit_p = '' if not mp.has_upper_limit else mp.upper_limit
            limit_m = '' if not mp.has_lower_limit else mp.lower_limit
            fixed = 'FIXED' if mp.is_fixed else ''
            j = i+1
            content = """
            <tr>
                <td>{j}</td>
                <td>{mp.name}</td>
                <td>{mp.value:e}</td>
                <td>{mp.error:e}</td>
                <td>{minos_m:e}</td>
                <td>{minos_p:e}</td>
                <td>{limit_m!s}</td>
                <td>{limit_p!s}</td>
                <td>{fixed}</td>
            </tr>
            """.format(**locals())
            to_print += content
        to_print += """
            </table>
        """
        ltable = LatexFactory.build_param_table(mps, merr,
                float_format=float_format, smart_latex=smart_latex,
                latex_map=latex_map)

        #rows = str(ltable).count('\n')+1
        to_print += self.hidden_table(str(ltable), uid)
        display_html(to_print, raw=True)
예제 #2
0
    def print_param(self, mps, merr=None, float_format='%5.3e',
                    smart_latex=True, latex_map=None):
        """print list of parameters
        Arguments:

            *mps* : minuit parameters struct
            *merr* : minos error
            *float_format* : control the format of latex floating point output
                default '%5.3e'
            *smart_latex* : convert greek symbols and underscores to latex 
                symbol. default True
        """
        to_print = ""
        uid = randid()
        header = """
        <table>
            <tr>
                <td><a href="#" onclick="$('#{uid}').toggle()">+</a></td>
                <td title="Variable name">Name</td>
                <td title="Value of parameter">Value</td>
                <td title="Parabolic error">Parab Error</td>
                <td title="Minos lower error">Minos Error-</td>
                <td title="Minos upper error">Minos Error+</td>
                <td title="Lower limit of the parameter">Limit-</td>
                <td title="Upper limit of the parameter">Limit+</td>
                <td title="Is the parameter fixed in the fit">FIXED</td>
            </tr>
        """.format(**locals())
        to_print += header
        for i, mp in enumerate(mps):
            minos_p, minos_m = (0., 0.) if merr is None or mp.name not in merr else \
                (merr[mp.name].upper, merr[mp.name].lower)
            limit_p = '' if not mp.has_upper_limit else mp.upper_limit
            limit_m = '' if not mp.has_lower_limit else mp.lower_limit
            fixed = 'FIXED' if mp.is_fixed else ''
            j = i + 1
            content = """
            <tr>
                <td>{j}</td>
                <td>{mp.name}</td>
                <td>{mp.value:e}</td>
                <td>{mp.error:e}</td>
                <td>{minos_m:e}</td>
                <td>{minos_p:e}</td>
                <td>{limit_m!s}</td>
                <td>{limit_p!s}</td>
                <td>{fixed}</td>
            </tr>
            """.format(**locals())
            to_print += content
        to_print += """
            </table>
        """
        ltable = LatexFactory.build_param_table(mps, merr,
                                                float_format=float_format, smart_latex=smart_latex,
                                                latex_map=latex_map)

        # rows = str(ltable).count('\n')+1
        to_print += self.hidden_table(str(ltable), uid)
        display_html(to_print, raw=True)
예제 #3
0
파일: html.py 프로젝트: jdamp/iminuit
    def print_param(self,
                    mps,
                    merr=None,
                    float_format='%5.3e',
                    smart_latex=True,
                    latex_map=None):
        """print list of parameters
        Arguments:

            *mps* : minuit parameters struct
            *merr* : minos error
            *float_format* : control the format of latex floating point output
                default '%5.3e'
            *smart_latex* : convert greek symbols and underscores to latex
                symbol. default True
        """
        to_print = ""
        uid = randid(self.rng)
        header = """<table>
    <tr>
        <td><a href="#" onclick="$('#{uid}').toggle()">+</a></td>
        <td title="Variable name">Name</td>
        <td title="Value of parameter">Value</td>
        <td title="Hesse error">Hesse Error</td>
        <td title="Minos lower error">Minos Error-</td>
        <td title="Minos upper error">Minos Error+</td>
        <td title="Lower limit of the parameter">Limit-</td>
        <td title="Upper limit of the parameter">Limit+</td>
        <td title="Is the parameter fixed in the fit">Fixed?</td>
    </tr>\n""".format(**locals())
        to_print += header
        for i, mp in enumerate(mps):
            minos_p, minos_m = ('', '') if merr is None or mp.name not in merr else \
                ('%g' % merr[mp.name].upper, '%g' % merr[mp.name].lower)
            limit_p = '' if mp.upper_limit is None else '%g' % mp.upper_limit
            limit_m = '' if mp.lower_limit is None else '%g' % mp.lower_limit
            fixed = 'Yes' if mp.is_fixed else 'No'
            content = """    <tr>
        <td>{i}</td>
        <td>{mp.name}</td>
        <td>{mp.value:g}</td>
        <td>{mp.error:g}</td>
        <td>{minos_m}</td>
        <td>{minos_p}</td>
        <td>{limit_m}</td>
        <td>{limit_p}</td>
        <td>{fixed}</td>
    </tr>\n""".format(**locals())
            to_print += content
        to_print += "</table>\n"
        ltable = LatexFactory.build_param_table(mps,
                                                merr,
                                                float_format=float_format,
                                                smart_latex=smart_latex,
                                                latex_map=latex_map)

        # rows = str(ltable).count('\n')+1
        to_print += self.hidden_table(str(ltable), uid)
        self.display(to_print)