Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 60 lines (51 sloc) 1.587 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
"""
Test the cooling times
"""
import numpy
from hctcool import cooling_time_years, thermal_time_years

dmin, dmax = 0.0, 8.0
tmin, tmax = 0.0, 4.5

# dgrid, tgrid = numpy.meshgrid(
# numpy.logspace(dmin, dmax, num=100), # density 1->10^7
# numpy.logspace(tmin, tmax, num=100), # temperature 10->10^4
# )

dgrid = numpy.linspace(dmin, dmax, num=200)
tgrid = numpy.linspace(tmin, tmax, num=200)

# meshgrid creates 2D arrays from the 1D arrays
ddgrid, ttgrid = numpy.meshgrid(10**dgrid, 10**tgrid)


# numpy.set_printoptions(precision=2, linewidth=150)
# print "Density"
# print numpy.log10(dgrid)
# print "Temperature"
# print numpy.log10(tgrid)
# print "Cooling time"
# print numpy.log10(tcgrid)

import pyx, pyxgraph, contour

for Av, D in [
    [0.0, 0.3],
    [1.0, 0.3],
    [2.0, 0.3],
    [5.0, 0.3],
    [10.0, 0.3],
    [50.0, 0.3],
    [0.0, 1.0],
    [1.0, 1.0],
    [2.0, 1.0],
    [5.0, 1.0],
    [10.0, 1.0],
    [50.0, 1.0],
    [0.0, 2.0],
    [1.0, 2.0],
    [2.0, 2.0],
    [5.0, 2.0],
    [10.0, 2.0],
    [50.0, 2.0],
    ]:
    tcgrid = thermal_time_years(ddgrid, ttgrid, Av, D)
    g = pyxgraph.pyxgraph(xlimits=(dmin, dmax), ylimits=(tmin, tmax), width=10, height=10)
    cooltimes = [1./x for x in [1.e2, 1.e3, 1.e4, 3.e4, 1.e5, 1.e6]]
    g.pyxplotcontour(1./tcgrid, dgrid, tgrid,
levels=cooltimes, colors="color", color=pyx.color.rgb.blue, labels=True)
    g.pyxplotcontour(-1./tcgrid, dgrid, tgrid,
levels=cooltimes, colors="color", color=pyx.color.rgb.red, labels=True)
    g.writePDFfile("hc-tcool-contour-Av%.1f-D%.1f" % (Av, D))
Something went wrong with that request. Please try again.