[yt-users] Getting error in Worked Example of Halo Analysis

Chen Jingjing chenjj235 at gmail.com
Mon Jun 22 13:11:56 PDT 2015


Thanks! And I just got an error from this line:

hc.add_callback('virial_quantities',['radius'],critical_density=500)

The error is:

TypeError: virial_quantities() got an unexpected keyword argument
'critical_density'

Do you know what might be wrong?

Thanks,

Jingjing

2015-06-22 16:09 GMT-04:00 Britton Smith <brittonsmith at gmail.com>:

> Hi Jingjing,
>
> It's 500 times the critical density.
>
> Britton
>
> On Mon, Jun 22, 2015 at 8:41 PM, Chen Jingjing <chenjj235 at gmail.com>
> wrote:
>
>> Hi Britton,
>> When I set critical_density=500, does it mean 500 times of the average
>> density, or 500 times of the critical density?
>>
>> Thanks,
>> Jingjing
>>
>> 2015-03-20 4:22 GMT-04:00 Britton Smith <brittonsmith at gmail.com>:
>>
>>> Hi Reju,
>>>
>>> It looks like the version of the notebook you are working from is a
>>> little out of date as the syntax for some of those callbacks has changed.
>>> Please, have a look here for an updated version:
>>> http://yt-project.org/doc/cookbook/halo_analysis_example.html
>>> I just ran this myself and confirmed everything to be working.
>>>
>>> As for your other questions:
>>>
>>> 1) How to find the center of mass of the halos(
>>>> hc.add_quantity('center_of_mass') is not working )
>>>>
>>>
>>> By default, the halo catalog is storing the center of the halo as
>>> calculated by the halo finder that you used.  If you reload the halo
>>> catalog that you produce, the x, y, and z position of each halo are the
>>> "particle_position_x", "particle_position_y", "particle_position_z"
>>> fields.  For example, you could do:
>>> ds = yt.load(your_halo_catalog)
>>> ad = ds.all_data()
>>> print ad["particle_position_x"]
>>>
>>> Additionally, the halo catalog has a callback called
>>> "iterative_center_of_mass" which starts from the original center and
>>> iteratively recalculates the center of mass while reducing the radius of
>>> the sphere.  I have found this to work very well for calculating halo
>>> centers.  If you use this callback, it will rewrite the particle_position
>>> fields to contain the new center for each halo.  To get more information on
>>> this callback, do the following:
>>>
>>> from yt.analysis_modules.halo_analysis.halo_callbacks import *
>>> help(iterative_center_of_mass)
>>>
>>>
>>>> 2) How to find virial mass (both M_500 and M_200 ) of the halas
>>>>
>>>
>>> You can find these using the virial_quantities callback.  In the example
>>> you are working from, you can add another field to the virial_quantities
>>> callback you use and it would calculate the value of that field where the
>>> overdensity = 200.  For total mass, the field you want is called
>>> "matter_mass".  To get M_500 instead of M_200, you can call the
>>> virial_quantities callback again and give the keyword argument
>>> critical_density=500.
>>>
>>> Britton
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>>
>> --
>>
>> Jingjing Chen [ chenjj235 at gmail.com ]
>> Department of Astronomy
>> Columbia University
>> 550 West 120th Street
>> New York, New York 10027
>> Cell Phone: +1(347)5746709
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>


-- 

Jingjing Chen [ chenjj235 at gmail.com ]
Department of Astronomy
Columbia University
550 West 120th Street
New York, New York 10027
Cell Phone: +1(347)5746709
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150622/55291772/attachment.htm>


More information about the yt-users mailing list