Also, you might want to change:

reg = pf.h.region([0.5, 0.5, 0.5], [0.4875, 0.0, 0.0], [5.125, 1.0, 1.0])

to:

reg = pf.h.region([0.5, 0.5, 0.5], [0.4875, 0.0, 0.0], [0.5125, 1.0, 1.0])

(note the change of 5.125 to 0.5125).  That's probably causing hilarity.

B

On Mon, Mar 22, 2010 at 4:57 PM, Matthew Turk <matthewturk@gmail.com> wrote:
Hi Shankar,

You're almost there!  :)

Try:

--
from yt.mods import *

fn = "RedshiftOutput0001"
pf = load(fn) # load data

reg = pf.h.region([0.5, 0.5, 0.5], [0.4875, 0.0, 0.0], [5.125, 1.0, 1.0])
pc = PlotCollection(reg1,center=[0.5,0.5,0.5])
p = pc.add_projection("Dark_Matter_Density", ax, source=reg)
pc.save()
--

It's a bit subtle that data_source supplied to add_projection will do
something different from source=.

-Matt


On Mon, Mar 22, 2010 at 1:55 PM, Agarwal, Shankar <sagarwal@ku.edu> wrote:
> Hi,
>
> I need assistance on this.
>
> I tried taking a density projection of 1/40th (in code units) of the box thickness using the following code. But It gives me the projection of the entire box.
>
>
> from yt.mods import *
>
> fn = "RedshiftOutput0001"
> pf = load(fn) # load data
>
> reg = pf.h.region([0.5, 0.5, 0.5], [0.4875, 0.0, 0.0], [5.125, 1.0, 1.0])
> pf.h.save_object(reg, "region")
>
> reg1 = pf.h.load_object("region")
>
> pc = PlotCollection(reg1,center=[0.5,0.5,0.5])
>
> for ax in range(1):
>  p = pc.add_projection("Dark_Matter_Density", ax)
> pc.save()
>
>
> I will appreciate if somenone can tell me how may I take the projection of the AMR3dDATA object: reg1
>
>
> Shankar
>
>
> -----Original Message-----
> From: yt-users-bounces@lists.spacepope.org on behalf of Matthew Turk
> Sent: Mon 3/22/2010 1:46 PM
> To: Discussion of the yt analysis package
> Subject: Re: [yt-users] DM density field Slice
>
> Hi Shankar,
>
> Not sure I know what you mean by thick slice -- we're back on baryon
> quantities, not on the particle rectangular prisms when using
> Dark_Matter_Density -- but I think the answer is that it might end up
> being more complicated than just replacing values.  IF you want to
> project only a portion of the simulation, that can be done by
> specifying a source argument to the projection routine, where the
> source is any AMR3dData object -- like spheres, prisms, etc etc.
> That's the only mechanism available for thick slicing; for slicing you
> can also provide source arguments (I think ... you could at one
> point!) but it will simply slice through that region, not do any
> combinations.
>
> -Matt
>
> On Mon, Mar 22, 2010 at 11:39 AM, Agarwal, Shankar <sagarwal@ku.edu> wrote:
>> Matt,
>>
>> That makes sense. So, for a thick slice, I will be able to find cells with non-zero density and fill the white spaces. Is it possible to specify the width in code units to the slice or projection routines?
>>
>> Shankar
>>
>>
>> -----Original Message-----
>> From: yt-users-bounces@lists.spacepope.org on behalf of Matthew Turk
>> Sent: Mon 3/22/2010 1:07 PM
>> To: Discussion of the yt analysis package
>> Subject: Re: [yt-users] DM density field Slice
>>
>> Hi Shankar,
>>
>> This is something that Enzo actually does -- the Dark_Matter_Density
>> is generated via the cic_deposit routines, which are cloud-in-cell
>> interpolation.  Where no particles contribute, it gets marked as zero,
>> which shows up as "bad values" in the log slice, and so it marks them
>> as white.  Looks like everything in this image is working!
>>
>> -Matt
>>
>> On Mon, Mar 22, 2010 at 11:06 AM, Agarwal, Shankar <sagarwal@ku.edu> wrote:
>>> Hi Matt,
>>>
>>> I just plotted a slice of Dark_Matter_Density. It looks ok except that there are some white patches (the density legend is VIBGYOR)
>>>
>>> http://drop.io/Dark_Matter_Density#
>>>
>>>
>>> It looks like those white patches are regions from where the density data was not read. Any thoughts?
>>>
>>>
>>> Shankar
>>>
>>> -----Original Message-----
>>> From: yt-users-bounces@lists.spacepope.org on behalf of Matthew Turk
>>> Sent: Mon 3/22/2010 11:58 AM
>>> To: Discussion of the yt analysis package
>>> Subject: Re: [yt-users] DM particles or baryon density field ?
>>>
>>> Yup, you're right.
>>>
>>> On Mon, Mar 22, 2010 at 9:57 AM, Agarwal, Shankar <sagarwal@ku.edu> wrote:
>>>> Yes, "Dark_Matter_Density field projections and slices" is what I meant. I will try replacing "Density" with "Dark_Matter_Density".
>>>>
>>>>
>>>> Also, let me know if I am right...
>>>>
>>>> p = pc.add_projection("Density", 0)    ------- This is baryon density field.
>>>>
>>>> p.modify["nparticles"](1.0)            ------- But this is DM particles (since there is no baryon particles dataset ?).
>>>>
>>>>
>>>> Shankar
>>>>
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: yt-users-bounces@lists.spacepope.org on behalf of Matthew Turk
>>>> Sent: Mon 3/22/2010 11:32 AM
>>>> To: Discussion of the yt analysis package
>>>> Subject: Re: [yt-users] DM particles or baryon density field ?
>>>>
>>>> Hi Shankar,
>>>>
>>>> I guess the question is sort of ill-defined.  Dark matter is
>>>> discretized as particles; the idea of projecting dark matter is not
>>>> the same as projecting a field quantity.  The same goes for plotting
>>>> slices.
>>>>
>>>> However, you can make dark matter plots.  You cna use the
>>>> "add_particles" method on the PlotCollection, which accepts an axis
>>>> and a width -- what it does is plot all the particles within that
>>>> rectangular prism.  This can be mocked up as a projection by setting
>>>> the width equal to the domain width along that axis.
>>>>
>>>> You can also try using "Dark_Matter_Density", which might be easier to
>>>> visualize, as a projection or a slice.
>>>>
>>>> If you run into any problems with the particle plot, let us know --
>>>> it's not as well-used as the other plots, so there might be subtle
>>>> bugs.  :)
>>>>
>>>> -Matt
>>>>
>>>> On Mon, Mar 22, 2010 at 9:27 AM, Agarwal, Shankar <sagarwal@ku.edu> wrote:
>>>>> Hi,
>>>>>
>>>>> The projection, slice, velocity and overplot particles routines: They read the DM particles or gas ?
>>>>>
>>>>> Looking at the density legend, it looks like this is baryon density field.
>>>>>
>>>>> Is there a provision to plot projection and slice for DM ?
>>>>>
>>>>>
>>>>> Also, I get this error when overplotting particles...
>>>>>
>>>>> yt         INFO       2010-03-22 12:17:44,051 Created plot collection with default plot-center = [0.5, 0.5, 0.5]
>>>>> yt         INFO       2010-03-22 12:17:44,144 Getting the binary hierarchy
>>>>> yt         INFO       2010-03-22 12:17:44,153 Finished with binary hierarchy reading
>>>>> yt         INFO       2010-03-22 12:17:46,108 Added slice of Density at x = 0.5 with 'center' = [0.5, 0.5, 0.5]
>>>>> Traceback (most recent call last):
>>>>>  File "slice.py", line 42, in <module>
>>>>>    p.modify["nparticles"](0.005)
>>>>>  File "/autohome/u118/agarwa23/yt-x86_64/src/yt-1.6/yt/raven/PlotTypes.py", line 52, in __getitem__
>>>>>    raise KeyError(item)
>>>>> KeyError: 'nparticles'
>>>>>
>>>>>
>>>>>
>>>>> Shankar
>>>>> _______________________________________________
>>>>> yt-users mailing list
>>>>> yt-users@lists.spacepope.org
>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>
>>>> _______________________________________________
>>>> yt-users mailing list
>>>> yt-users@lists.spacepope.org
>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>
>>>>
>>>> _______________________________________________
>>>> yt-users mailing list
>>>> yt-users@lists.spacepope.org
>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>
>>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users@lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users@lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users@lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users@lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
> _______________________________________________
> yt-users mailing list
> yt-users@lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
> _______________________________________________
> yt-users mailing list
> yt-users@lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org