"""Drawing density plots"""
import plots as p
import os

#------------------------------------------------------------------------------
#   DENSITY
#------------------------------------------------------------------------------

PLOTS_NAME = [f for f in os.listdir("./output/") if
              f.startswith("ascii-density-contrast-grid")]

PLOTS = {}

for pl in PLOTS_NAME:
    plot_path = "./plots/" + os.path.splitext(pl)[0]
    PLOTS[pl] = p.DensityPlot()
    PLOTS[pl].read_density("./output/" + pl)
    PLOTS[pl].draw_density(cMap=True, zShift=1)
    p.save(plot_path.replace("ascii-", "", 1))
"""Drawing power spectrum plots"""
import plots as p
import os

#------------------------------------------------------------------------------
#   POWER SPECTRUM
#------------------------------------------------------------------------------

PS = [f for f in os.listdir("./output/") if f.startswith("power-spectrum-")]

PS_PLOTS = {}

for dat in PS:
    PS_PLOTS[dat] = p.PowerSpectrumPlot()
    PS_PLOTS[dat].read_power_spectrum("./output/" + dat, skiprows=1)
    PS_PLOTS[dat].draw_power_spectrum(color="#5b7c7d", ecolor="#fe5e31",
                                      linestyle="solid", shaded='true',
                                      xerr='false', yerr='true',
                                      # xmin=1e-3, xmax=10,
                                      # ymin=1e2, ymax=1e5,
                                      xaxislog='linear', yaxislog='log')
    p.save("./plots/" + os.path.splitext(dat)[0], xlabel="$k$",
           ylabel="$\log P$")