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

Britton Smith brittonsmith at gmail.com
Mon Jun 22 15:40:02 PDT 2015


Hi Jingjing,

You are missing a couple of steps in between calculating the center of mass
and doing the virial quantities.  You need to create a sphere object and
also create the radial profiles.  If you have a look at this recipe, you'll
see how to do those steps.  Look for the "sphere" callback and the
"profile" callback.
http://yt-project.org/doc/cookbook/cosmological_analysis.html#halo-profiling-and-custom-analysis

Perhaps this is a place where we should make a callback that does all of
these steps together.

Britton

On Mon, Jun 22, 2015 at 10:49 PM, Chen Jingjing <chenjj235 at gmail.com> wrote:

> I changed the keyword, there raised another error:
>
> AttributeError: 'Halo' object has no attribute 'data_object'
>
> My code is like below, everything before I add the callback of virial
> radius works
>
> data_ds = yt.load('RD0043/RedshiftOutput0043')
>
> hc = HaloCatalog(data_ds=data_ds, finder_method='hop')
>
> hc.add_filter(...)
>
> hc.add_callback("iterative_center_of_mass")
>
> hc.add_callback('virial_quantities',['radius'],critical_overdensity=500)
>
> hc.create()
>
>
> Does anyone have an idea of whats wrong?
>
> Thanks,
>
> Jingjing
>
> 2015-06-22 16:35 GMT-04:00 Nathan Goldbaum <nathan12343 at gmail.com>:
>
>>
>>
>> On Mon, Jun 22, 2015 at 1:11 PM, Chen Jingjing <chenjj235 at gmail.com>
>> wrote:
>>
>>> 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?
>>>
>>
>> They keyword is "critical_overdensity", not "critical_density":
>>
>>
>> https://bitbucket.org/yt_analysis/yt/src/dc2467c4eae70b9f185adf2cba8f61b95f65fea0/yt/analysis_modules/halo_analysis/halo_callbacks.py?at=yt#cl-385
>>
>> It looks like the docstring is incorrect.
>>
>>
>>> 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
>>>
>>>
>>> _______________________________________________
>>> 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
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150622/a2300ab1/attachment.htm>


More information about the yt-users mailing list