Beispiel #1
0
def write_code_versions(path, cp):
    code_version_dict = get_code_version_numbers(cp)
    html_text = ""
    for key, value in code_version_dict.items():
        html_text += "<li><b>%s</b>: %s </li>\n" % (key, value.replace("@", "&#64;"))
    kwds = {"render-function": "render_text", "title": "Version Information from Executables"}
    save_fig_with_metadata(
        html_escape(html_text), os.path.join(path, "version_information_from_executables.html"), **kwds
    )
Beispiel #2
0
def write_code_versions(path, cp):
    code_version_dict = get_code_version_numbers(cp)
    html_text = ''
    for key,value in code_version_dict.items():
        html_text+= '<li><b>%s</b>: %s </li>\n' %(key,value.replace('@', '&#64;'))
    kwds = {'render-function' : 'render_text',
            'title' : 'Version Information from Executables',
    }
    save_fig_with_metadata(html_text, os.path.join(path,'version_information_from_executables.html'), **kwds)
Beispiel #3
0
def write_code_versions(path, cp):
    code_version_dict = get_code_version_numbers(cp)
    html_text = ''
    for key,value in code_version_dict.items():
        html_text+= '<li><b>%s</b>: %s </li>\n' %(key,value.replace('@', '&#64;'))
    kwds = {'render-function' : 'render_text',
            'title' : 'Version Information from Executables',
    }
    save_fig_with_metadata(html_escape(html_text), 
        os.path.join(path,'version_information_from_executables.html'), **kwds)
Beispiel #4
0
def write_library_information(path):
    library_list = get_library_version_info()
    for curr_lib in library_list:
        lib_name = curr_lib['Name']
        text = ''
        for key, value in curr_lib.items():
            text+='<li> %s : %s </li>\n' %(key,value)
        kwds = {'render-function' : 'render_text',
                'title' : '%s Version Information'%lib_name,
        }
        save_fig_with_metadata(text, os.path.join(path,'%s_version_information.html' %(lib_name)), **kwds)
Beispiel #5
0
def write_library_information(path):
    library_list = get_library_version_info()
    for curr_lib in library_list:
        lib_name = curr_lib["Name"]
        text = ""
        for key, value in curr_lib.items():
            text += "<li> %s : %s </li>\n" % (key, value)
        kwds = {"render-function": "render_text", "title": "%s Version Information" % lib_name}

        save_fig_with_metadata(
            html_escape(text), os.path.join(path, "%s_version_information.html" % (lib_name)), **kwds
        )
Beispiel #6
0
def write_library_information(path):
    library_list = get_library_version_info()
    for curr_lib in library_list:
        lib_name = curr_lib['Name']
        text = ''
        for key, value in curr_lib.items():
            text+='<li> %s : %s </li>\n' %(key,value)
        kwds = {'render-function' : 'render_text',
                'title' : '%s Version Information'%lib_name,
        }
        
        save_fig_with_metadata(html_escape(text), 
          os.path.join(path,'%s_version_information.html' %(lib_name)), **kwds)
Beispiel #7
0
def pygrb_plotter(trigs,
                  injs,
                  xlabel,
                  ylabel,
                  opts,
                  snr_vals=None,
                  conts=None,
                  shade_cont_value=None,
                  colors=None,
                  vert_spike=False,
                  cmd=None):
    """Master function to plot PyGRB results"""
    from matplotlib import pyplot as plt

    # Set up plot
    fig = plt.figure()
    cax = fig.gca()
    # Plot trigger-related and (if present) injection-related quantities
    cax_plotter = cax.loglog if opts.use_logs else cax.plot
    cax_plotter(trigs[0], trigs[1], 'bx')
    if not (injs[0] is None and injs[1] is None):
        cax_plotter(injs[0], injs[1], 'r+')
    cax.grid()
    # Plot contours
    if conts is not None:
        contour_plotter(cax, snr_vals, conts, colors, vert_spike=vert_spike)
    # Add shading above a specific contour (typically used for vetoed area)
    if shade_cont_value is not None:
        limy = cax.get_ylim()[1]
        polyx = copy.deepcopy(snr_vals)
        polyy = copy.deepcopy(conts[shade_cont_value])
        polyx = numpy.append(polyx, [max(snr_vals), min(snr_vals)])
        polyy = numpy.append(polyy, [limy, limy])
        cax.fill(polyx, polyy, color='#dddddd')
    # Axes: labels and limits
    cax.set_xlabel(xlabel)
    cax.set_ylabel(ylabel)
    if opts.x_lims:
        x_lims = map(float, opts.x_lims.split(','))
        cax.set_xlim(x_lims)
    if opts.y_lims:
        y_lims = map(float, opts.y_lims.split(','))
        cax.set_ylim(y_lims)
    # Wrap up
    plt.tight_layout()
    save_fig_with_metadata(fig,
                           opts.output_file,
                           cmd=cmd,
                           title=opts.plot_title,
                           caption=opts.plot_caption)
    plt.close()
def pygrb_plotter(trig_x, trig_y, inj_x, inj_y, inj_file, xlabel, ylabel,
                  fig_path, snr_vals=None, conts=None,
                  shade_cont_value=None, colors=None, vert_spike=False,
                  xlims=None, ylims=None, use_logs=True,
                  cmd=None, plot_title=None, plot_caption=None):
    """Master function to plot PyGRB results"""

    fig_name = os.path.split(os.path.abspath(fig_path))[1]
    logging.info(" * %s (%s vs %s)...", fig_name, xlabel, ylabel)
    # Set up plot
    fig = plt.figure()
    cax = fig.gca()
    # Plot trigger-related quantities
    if use_logs:
        cax.loglog(trig_x, trig_y, 'bx')
    else:
        cax.plot(trig_x, trig_y, 'bx')
    cax.grid()
    # Plot injection-related quantities
    if inj_file:
        if use_logs:
            cax.loglog(inj_x, inj_y, 'r+')
        else:
            cax.plot(inj_x, inj_y, 'r+')
    # Plot contours
    if conts is not None:
        contour_plotter(cax, snr_vals, conts, colors, vert_spike=vert_spike)
    # Add shading above a specific contour (typically used for vetoed area)
    if shade_cont_value is not None:
        limy = cax.get_ylim()[1]
        polyx = copy.deepcopy(snr_vals)
        polyy = copy.deepcopy(conts[shade_cont_value])
        polyx = numpy.append(polyx, [max(snr_vals), min(snr_vals)])
        polyy = numpy.append(polyy, [limy, limy])
        cax.fill(polyx, polyy, color='#dddddd')
    # Axes: labels and limits
    cax.set_xlabel(xlabel)
    cax.set_ylabel(ylabel)
    if xlims:
        cax.set_xlim(xlims)
    if ylims:
        cax.set_ylim(ylims)
    # Wrap up
    plt.tight_layout()
    save_fig_with_metadata(fig, fig_path, cmd=cmd, title=plot_title,
                           caption=plot_caption)
    # fig_kwds=fig_kwds,
    plt.close()
Beispiel #9
0
def write_code_versions(path, cp):
    code_version_dict = get_code_version_numbers(cp)
    html_text = ''
    for key,value in code_version_dict.items():
        # value might be a str or a bytes object in python3. python2 is happy
        # to combine these objects (or uniocde and str, their equivalents)
        # but python3 is not.
        try:
            value = value.decode()
        except AttributeError:
            pass
        html_text+= '<li><b>%s</b>:<br><pre>%s</pre></li><hr><br><br>\n' \
            % (key, str(value).replace('@', '&#64;'))
    kwds = {'render-function' : 'render_text',
            'title' : 'Version Information from Executables',
    }
    save_fig_with_metadata(html_escape(html_text),
        os.path.join(path,'version_information_from_executables.html'), **kwds)