[yt-users] Please help

Matthew Turk matthewturk at gmail.com
Wed Feb 20 10:51:57 PST 2013


Hi Reju,

Thanks for writing, and welcome to yt!  Suoqing's suggestion will
definitely work.  We also have a simpler shorthand for this, where you
can do this with data series:

ts = TimeSeriesData.from_filenames("RD*/RedshiftOutput*")
for pf in ts:
    c = pf.h.find_max('Density')[1]
    proj = pf.h.proj(1, 'Density')

    width = 96/pf['mpc'] # we want a 1.5 mpc view
    res = [1000, 1000] # create an image with 1000x1000 pixels
    frb = proj.to_frb(width, res, center=[0.5,0.5,0.5])

    P.imshow(frb['Density'])
    P.savefig('Density_y.png')

There's even a simpler way if you want to do some processing on the data:

ts = TimeSeriesData.from_filenames("RD*/RedshiftOutput*")
for pf in ts:
    p = ProjectionPlot(pf, "y", "Density", center="max", width=(96.0, "max"))
    p.save()

-Matt

On Wed, Feb 20, 2013 at 11:25 AM, Reju Sam John <rejusamjohn at gmail.com> wrote:
> In the following code (c attachment also)
>
> import pylab as P
> from yt.mods import *
> pf = load("RD0002/RedshiftOutput0002")
>
> c = pf.h.find_max('Density')[1]
> proj = pf.h.proj(1, 'Density')
>
> width = 96/pf['mpc'] # we want a 1.5 mpc view
> res = [1000, 1000] # create an image with 1000x1000 pixels
> frb = proj.to_frb(width, res, center=[0.5,0.5,0.5])
>
> P.imshow(frb['Density'])
> P.xlabel(r'$x\ \mathrm{kpc}$')
> P.ylabel(r'$x\ \mathrm{furlongs}$')
> P.savefig('Density_y.png')
>
>
> My problem is to develop a new code which automatically take `n' input files
> (RD0001/RedshiftOutput0001, RD0002/RedshiftOutput0002,
> RD0003/RedshiftOutput0003, ....)    and want to save each output files in a
> folder.
>
>
>
> Please help me.....
>
> --
> Reju Sam John
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list