[yt-users] Please help

Ji Suoqing jisuoqing at gmail.com
Wed Feb 20 10:40:04 PST 2013


Hi Reju,

An easy way that comes to my mind first is that you could set up a double-loop of n1 and n2, in which you specify the path and file name, say:

path = "RD%04d/RedshiftOutput%04d" % (n1,n2)

where n1 and n2 loop over the number of your directories and files.

Then you could load the files one by one:

pf = load(path)

Best wishes,
Suoqing


On 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
> <simple-slice.py>_______________________________________________
> 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