Пример #1
0
def draw_dos(jobname, modes, custom_plotter=None, title=''):
    """Draw density of states with matplotlib in one subplot. """
    if custom_plotter is None:
        plotter = BandPlotter()
        callnextplot = False
    else:
        plotter = custom_plotter
        callnextplot = True

    for i, mode in enumerate(modes):
        fname = '{0}_{1}dos.csv'.format(jobname, mode)
        try:
            #freqs, dos = loadtxt(fname, delimiter=',', unpack=True)
            # genfromtxt does not throw an error if there is a '#.#':
            freqs, dos = np.genfromtxt(fname, delimiter=',', unpack=True)
        except IOError:
            log.error("in graphics.draw_dos: "
                      "File not found: {0}\n".format(fname) +
                      "Did you save DOS data in the simulation?")
            return plotter
        if callnextplot:
            callnextplot = False
            plotter.next_plot()

        plotter.plot_dos(dos, freqs)

    plotter.set_plot_title(title)

    return plotter
Пример #2
0
def draw_dos(jobname, modes, custom_plotter=None, title=''):
    """Draw density of states with matplotlib in one subplot. """
    if custom_plotter is None:
        plotter = BandPlotter()
        callnextplot = False
    else:
        plotter = custom_plotter
        callnextplot = True
    
    for i, mode in enumerate(modes):
        fname = '{0}_{1}dos.csv'.format(jobname, mode)
        try:
            #freqs, dos = loadtxt(fname, delimiter=',', unpack=True)
            # genfromtxt does not throw an error if there is a '#.#':
            freqs, dos = np.genfromtxt(fname, delimiter=',', unpack=True)
        except IOError:
            log.error("in graphics.draw_dos: "
                "File not found: {0}\n".format(fname) + 
                "Did you save DOS data in the simulation?")
            return plotter
        if callnextplot:
            callnextplot=False
            plotter.next_plot()
        
        plotter.plot_dos(dos, freqs)
            
    plotter.set_plot_title(title)
        
    return plotter