def set_save_file ( fname_ ) :
	close_save_file()
	global document
	if type(fname_) is str :
		if fname_[-4:] != ".pdf" : fname_ = fname_ + ".pdf"
		msg.info("Plotting.plotting.set_save_file", "Opening pdf file {0}".format(fname_), verbose_level=0)
		document = PdfPages(fname_)
	else :
		msg.error("Plotting.plotting.set_save_file", "Filename must be a str")
Example #2
0
def save_toys_file(toys, fname, **kwargs):
    if utils.path_exists(fname) is True:
        msg.warning(
            "save_toys_file",
            "Path provided {0} already exists and will be overwritten".format(
                fname))
    to_save = {}
    for option, value in kwargs.items():
        to_save[option] = value
    to_save["toys"] = toys
    try:
        pickle.dump(to_save, open(fname, "w+b"))
    except Exception as exc:
        msg.error(
            "save_toys_file",
            "File {0} could not be written. The following error was thrown:".
            format(fname))
        msg.check_verbosity_and_print(exc)
def set_style (stylename="Confidence/Plotting/my_style.mplstyle") :
	try : plt.style.use(stylename)
	except OSError :
		msg.error("Plotting.plotting.set_style","Style {0} could not be found. Available styles are {1}.".format(stylename,plt.style.available))