
Dear yt-users, I am having a little problem on finding the exact center of a halo. I used to do
"hc = HaloCatalog(data_ds=data_ds, finder_method='hop')"
to create a halo catalog. But I think the position in the catalog is a little bit off the exact center judging from the plots I made. I need the exact center to compute the angular momentum so the off-center result could cause some problem. I tried to recenter at the maximum gas density by adding this line
"hc.sphere_field_max_recenter('density')"
But I got an error, AttributeError: 'HaloCatalog' object has no attribute 'sphere_field_max_recenter'.
Can anyone tell me what is the right way to find the center as the location of maximum gas density?
Thanks, Jingjing

Hi Jingjing,
To add that function to the HaloCatalog analysis, you need to do the following:
hc.add_callback("sphere_field_max_recenter", "density")
Note, this callback recenters an existing sphere, so you will need to have added a sphere with:
hc.add_callback("sphere")
Make sure you add the sphere first. Additionally, you might try the "iterative_center_of_mass" callback, which will calculate new centers by calculating the center of mass on a continually smaller sphere. This one does not require a sphere callback and will actually write out the recentered positions.
Britton
On Mon, Mar 30, 2015 at 7:27 PM, Chen Jingjing chenjj235@gmail.com wrote:
Dear yt-users, I am having a little problem on finding the exact center of a halo. I used to do
"hc = HaloCatalog(data_ds=data_ds, finder_method='hop')"
to create a halo catalog. But I think the position in the catalog is a little bit off the exact center judging from the plots I made. I need the exact center to compute the angular momentum so the off-center result could cause some problem. I tried to recenter at the maximum gas density by adding this line
"hc.sphere_field_max_recenter('density')"
But I got an error, AttributeError: 'HaloCatalog' object has no attribute 'sphere_field_max_recenter'.
Can anyone tell me what is the right way to find the center as the location of maximum gas density?
Thanks, Jingjing
--
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

Hi Britton, I tried to use the iterative_center_of_mass callback like this. Since you said it does not require a sphere callback, I assumed that I don't need to specify a sphere.
data_ds = yt.load('RD0008/RedshiftOutput0008')
hc = HaloCatalog(data_ds=data_ds, finder_method='hop')
hc.add_callback("iterative_center_of_mass")
hc.add_filter("quantity_value", "particle_mass", ">", 1e11, "Msun")
hc.create()
I got a error
NameError: global name 'periodic_distance' is not defined
So can you tell me what would be the right way?
Thanks, Jingjing
2015-03-30 15:08 GMT-04:00 Britton Smith brittonsmith@gmail.com:
Hi Jingjing,
To add that function to the HaloCatalog analysis, you need to do the following:
hc.add_callback("sphere_field_max_recenter", "density")
Note, this callback recenters an existing sphere, so you will need to have added a sphere with:
hc.add_callback("sphere")
Make sure you add the sphere first. Additionally, you might try the "iterative_center_of_mass" callback, which will calculate new centers by calculating the center of mass on a continually smaller sphere. This one does not require a sphere callback and will actually write out the recentered positions.
Britton
On Mon, Mar 30, 2015 at 7:27 PM, Chen Jingjing chenjj235@gmail.com wrote:
Dear yt-users, I am having a little problem on finding the exact center of a halo. I used to do
"hc = HaloCatalog(data_ds=data_ds, finder_method='hop')"
to create a halo catalog. But I think the position in the catalog is a little bit off the exact center judging from the plots I made. I need the exact center to compute the angular momentum so the off-center result could cause some problem. I tried to recenter at the maximum gas density by adding this line
"hc.sphere_field_max_recenter('density')"
But I got an error, AttributeError: 'HaloCatalog' object has no attribute 'sphere_field_max_recenter'.
Can anyone tell me what is the right way to find the center as the location of maximum gas density?
Thanks, Jingjing
--
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

Hi Jingjing,
This is a bug that I thought I had fixed already. The file is just missing an import of that function. I have issued a pull request to fix this and it should be incorporated shortly. Sorry about that.
Britton
On Tue, Mar 31, 2015 at 1:55 AM, Chen Jingjing chenjj235@gmail.com wrote:
Hi Britton, I tried to use the iterative_center_of_mass callback like this. Since you said it does not require a sphere callback, I assumed that I don't need to specify a sphere.
data_ds = yt.load('RD0008/RedshiftOutput0008')
hc = HaloCatalog(data_ds=data_ds, finder_method='hop')
hc.add_callback("iterative_center_of_mass")
hc.add_filter("quantity_value", "particle_mass", ">", 1e11, "Msun")
hc.create()
I got a error
NameError: global name 'periodic_distance' is not defined
So can you tell me what would be the right way?
Thanks, Jingjing
2015-03-30 15:08 GMT-04:00 Britton Smith brittonsmith@gmail.com:
Hi Jingjing,
To add that function to the HaloCatalog analysis, you need to do the following:
hc.add_callback("sphere_field_max_recenter", "density")
Note, this callback recenters an existing sphere, so you will need to have added a sphere with:
hc.add_callback("sphere")
Make sure you add the sphere first. Additionally, you might try the "iterative_center_of_mass" callback, which will calculate new centers by calculating the center of mass on a continually smaller sphere. This one does not require a sphere callback and will actually write out the recentered positions.
Britton
On Mon, Mar 30, 2015 at 7:27 PM, Chen Jingjing chenjj235@gmail.com wrote:
Dear yt-users, I am having a little problem on finding the exact center of a halo. I used to do
"hc = HaloCatalog(data_ds=data_ds, finder_method='hop')"
to create a halo catalog. But I think the position in the catalog is a little bit off the exact center judging from the plots I made. I need the exact center to compute the angular momentum so the off-center result could cause some problem. I tried to recenter at the maximum gas density by adding this line
"hc.sphere_field_max_recenter('density')"
But I got an error, AttributeError: 'HaloCatalog' object has no attribute 'sphere_field_max_recenter'.
Can anyone tell me what is the right way to find the center as the location of maximum gas density?
Thanks, Jingjing
--
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

Works perfectly! Thank you so much!
Jingjing
2015-03-31 4:12 GMT-04:00 Britton Smith brittonsmith@gmail.com:
Hi Jingjing,
This is a bug that I thought I had fixed already. The file is just missing an import of that function. I have issued a pull request to fix this and it should be incorporated shortly. Sorry about that.
Britton
On Tue, Mar 31, 2015 at 1:55 AM, Chen Jingjing chenjj235@gmail.com wrote:
Hi Britton, I tried to use the iterative_center_of_mass callback like this. Since you said it does not require a sphere callback, I assumed that I don't need to specify a sphere.
data_ds = yt.load('RD0008/RedshiftOutput0008')
hc = HaloCatalog(data_ds=data_ds, finder_method='hop')
hc.add_callback("iterative_center_of_mass")
hc.add_filter("quantity_value", "particle_mass", ">", 1e11, "Msun")
hc.create()
I got a error
NameError: global name 'periodic_distance' is not defined
So can you tell me what would be the right way?
Thanks, Jingjing
2015-03-30 15:08 GMT-04:00 Britton Smith brittonsmith@gmail.com:
Hi Jingjing,
To add that function to the HaloCatalog analysis, you need to do the following:
hc.add_callback("sphere_field_max_recenter", "density")
Note, this callback recenters an existing sphere, so you will need to have added a sphere with:
hc.add_callback("sphere")
Make sure you add the sphere first. Additionally, you might try the "iterative_center_of_mass" callback, which will calculate new centers by calculating the center of mass on a continually smaller sphere. This one does not require a sphere callback and will actually write out the recentered positions.
Britton
On Mon, Mar 30, 2015 at 7:27 PM, Chen Jingjing chenjj235@gmail.com wrote:
Dear yt-users, I am having a little problem on finding the exact center of a halo. I used to do
"hc = HaloCatalog(data_ds=data_ds, finder_method='hop')"
to create a halo catalog. But I think the position in the catalog is a little bit off the exact center judging from the plots I made. I need the exact center to compute the angular momentum so the off-center result could cause some problem. I tried to recenter at the maximum gas density by adding this line
"hc.sphere_field_max_recenter('density')"
But I got an error, AttributeError: 'HaloCatalog' object has no attribute 'sphere_field_max_recenter'.
Can anyone tell me what is the right way to find the center as the location of maximum gas density?
Thanks, Jingjing
--
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
participants (2)
-
Britton Smith
-
Chen Jingjing