pencil.read.pdfs

Reads the output of the pdf subroutine (power_spectrum.f90)

03-Nov-2025/Kishore: coded

Classes

pdf

Reads the output of the power_xy subroutine

PDFContainer

Attributes

Module Contents

class pencil.read.pdfs.pdf(datadir='data', filename=None, debug=False)

Reads the output of the power_xy subroutine

Arguments

datadir: path to the data directory. Default: “data” filename: name of the file to read. Default: all files named pdf_*.dat

Examples
>>> p = pc.read.pdfs()
>>> p.t #1D array, length nt
>>> p.lnrho #PDFContainer instance
>>> p.lnrho.bins: #1D array, length nb
>>> p.lnrho.counts #2D array, size (nt,nb): counts in each bin at a particular timestep
>>> plt.semilogy(p.lnrho.bin_centers, p.lnrho.calc_counts(t_min=10)) #plots the PDF of lnrho for t>10
Attributes

t: 1D array, times Remaining attributes are PDFContainer instances, named after the variables whose PDFs are being calculated.

keys()
class pencil.read.pdfs.PDFContainer(bins, ts, counts, logscale)
Attributes

bins: 1D array, bin edges counts: 2D array, counts in bins (second axis) at different times (first axis)

bins
counts
property bin_centers
calc_counts(t_min=None, t_max=None)
calc_pdf(*args, **kwargs)

Calculate the PDF of the variable ‘variable’ by summing over the counts saved between t_min and t_max.