ABACUS/scripts/plot_dsf_k_range.py

40 line
698 B
Python
Executable File

#! /usr/bin/env python
"""
Plot DSF.
Usage: python plot_dsf_k_range.py [k file] [omega file] [dsf file]
"""
import matplotlib.pyplot as plt
import numpy as np
import sys
kfile = str(sys.argv[1])
omegafile = str(sys.argv[2])
dsffile = str(sys.argv[3])
k = np.loadtxt(kfile)
omega = np.loadtxt(omegafile)
dsf = np.loadtxt(dsffile)
dsfsmax = 0.5
plt.pcolormesh(k, omega, dsf, vmax=dsfsmax)
plt.colorbar()
plt.xlabel('$k$')
plt.ylabel('$\omega$')
elements = dsffile.split('_')
c_int = elements[3]
L = elements[5]
N = elements[7]
width = elements[22].partition('.')[0]
rho = int(N)/int(L)
plt.title(f'c={c_int}, rho={rho} (N={N}), w={width}')
plt.savefig(dsffile.replace('.', '_') + '.png')