# Plot contours of equilibrium T execdir = os.path.dirname(sys.argv[0]) for col, Av, D in [ [myblue, 0.0, 0.2], [mygreen, 3.0, 0.2], [myred, 30.0, 0.2], [myblue, 0.0, 0.5], [mygreen, 3.0, 0.5], [myred, 30.0, 0.5], [myblue, 0.0, 2.0], [mygreen, 3.0, 2.0], [myred, 30.0, 2.0], ]: f = open(os.path.join(execdir, "hc-equilib-Av%.1f-D%.1f.dat" % (Av, D)), "r") dens, Teq = N.loadtxt(f, unpack=True) g.plot(data.values(x=N.log10(dens), y=N.log10(Teq)), [line([linestyle.solid, linewidth.thin, col])]) # Plot contours of cooling time cooltimes = [1.e2, 1.e3, 1.e4, 1.e5] from hctcool import cooling_time_years from contour import contour_rectgrid dgrid = N.linspace(nmin, nmax, num=200) # finer grid necessary to give smooth contours tgrid = N.linspace(tmin, tmax, num=200) tcgrid = cooling_time_years(*N.meshgrid(10**dgrid, 10**tgrid)) contours = contour_rectgrid(dgrid, tgrid, tcgrid, cooltimes) for i, contourset in enumerate(contours): for contour in contourset: g.plot(data.values(x=contour[0], y=contour[1]), [line([linestyle.dotted])]) gtitle = r'\texttt{%s}, $t = %.3f$~Myr' % (runid, age_Myr)
The instance variable title and defaultstyles contain the data title and the default styles (a list of styles), respectively. """ def dynamiccolumns(self, graph): """create and return dynamic columns data Returns dynamic data matching the given axes (the axes range and other data might be used). The return value is a dictionary similar to the columns instance variable. """ return {} defaultsymbols = [style.symbol()] defaultlines = [style.line()] class values(_data): defaultstyles = defaultsymbols def __init__(self, title="user provided values", **columns): for i, values in enumerate(columns.values()): if i and len(values) != l: raise ValueError("different number of values") else: l = len(values) self.columns = columns self.columnnames = columns.keys() self.title = title
]) + r'\end{tabular}', [pyx.text.valign.top, pyx.trafo.scale(0.7)]) ##### # # New part 12 Apr 2009 - a multitude of lines on the thermodynamics graphs # ##### if varstring.startswith("n-T"): from pyx.style import linestyle, linewidth from pyx.color import transparency from pyx.graph.style import line from pyx.graph import data line.defaultlineattrs += [linewidth.thick, transparency(0.5)] # Free-fall time < 1.e5 years g.plot(data.function("x(y) = 5.31"), [line([linestyle.dashed])]) # Plot contours of Jeans instability for MJeans in (0.0, 1.0): g.plot(data.function("y(x) = 0.491 + 0.6667*MJeans + 0.333*(x-3.0)", context=locals()), [line([linestyle.solid, linewidth.Thick])]) # Plot contours of equilibrium T execdir = os.path.dirname(sys.argv[0]) for Av, D in [ [0.0, 0.3], [2.0, 0.3], [10.0, 0.3], [0.0, 1.0], [2.0, 1.0], [10.0, 1.0], ]:
from pyx.style import linewidth, linestyle from pyx.graph import graphxy from pyx.graph.axis import linear from pyx.graph.axis.painter import regular from pyx.graph.style import line from pyx.graph.data import function mypainter = regular(basepathattrs=[earrow.normal], titlepos=1) def mycos(x): return -cos(x)+.10*x g = graphxy(height=5, x2=None, y2=None, x=linear(min=-2.5*pi, max=3.3*pi, parter=None, painter=mypainter, title=r"$\delta\phi$"), y=linear(min=-2.3, max=2, painter=None)) g.plot(function("y(x)=mycos(x)", context=locals()), [line(lineattrs=[linewidth.Thick])]) g.finish() x1, y1 = g.pos(-pi+.1, mycos(-pi+.1)) x2, y2 = g.pos(-.1, mycos(-.1)) x3, y3 = g.pos(pi+.1, mycos(pi+.1)) g.stroke(path.line(x1-.5, y1, x1+.5, y1), [linestyle.dashed]) g.stroke(path.line(x1-.5, y3, x3+.5, y3), [linestyle.dashed]) g.stroke(path.line(x2-.5, y2, x3+.5, y2), [linestyle.dashed]) g.stroke(path.line(x1, y1, x1, y3), [barrow.normal, earrow.normal]) g.stroke(path.line(x3, y2, x3, y3), [barrow.normal, earrow.normal]) g.text(x1+.2, 0.5*(y1+y3), r"$2\pi\gamma k\Omega$", [text.vshift.middlezero]) g.text(x1-.6, y1-.1, r"$E_{\rm b}$", [text.halign.right]) g.text(x3+.15, y2+.20, r"$2J_k(\varepsilon/\Omega)+\pi\gamma k\Omega$")