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@gmail.com>:


On Mon, Jun 22, 2015 at 1:11 PM, Chen Jingjing <chenjj235@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":


It looks like the docstring is incorrect.
 

Thanks,

Jingjing


2015-06-22 16:09 GMT-04:00 Britton Smith <brittonsmith@gmail.com>:
Hi Jingjing,

It's 500 times the critical density.

Britton

On Mon, Jun 22, 2015 at 8:41 PM, Chen Jingjing <chenjj235@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@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:
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@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org




--
Jingjing Chen [ chenjj235@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@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




--
Jingjing Chen [ chenjj235@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@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




--
Jingjing Chen [ chenjj235@gmail.com ]
Department of Astronomy
Columbia University
550 West 120th Street
New York, New York 10027
Cell Phone: +1(347)5746709