Dear yt-users, I am having some trouble with the yt clump finder. Mostly, my issue is that I don't understand what I am getting when I annotate the projectionplot. Instead of the nice lines in the example, I get strange filled-in circles? My figure is attached, and here is my code: ################## ds = yt.load("/mnt/ceph/users/stonnesen/runs/JO204wind/DD"+loop[i]+"/JO204cw"+loop[i]) ad = ds.all_data() data_source = ad.cut_region(["obj['z'] > 0.27"]) #ds.disk([0.5, 0.5, 0.5], [0., 0., 1.],(80, 'kpc'), (145, 'kpc')) # the field to be used for contouring field = ("gas", "density") # This is the multiplicative interval between contours. step = 2.0 # Now we set some sane min/max values between which we want to find contours # This is how we tell the clump finder what to look for -- it won't look for # contours connected below or above these threshold values. c_min = 2e-25 #10**np.floor(np.log10(data_source[field]).min()+3 ) c_max = 10**np.floor(np.log10(data_source[field]).max()+1) # Now find get our 'base' clump -- this one just covers the whole domain. master_clump = Clump(data_source, 'density') # Add a "validator" to weed out clumps with less than 16 cells. # As many validators can be added as you want. master_clump.add_validator("min_cells", 16) # Calculate center of mass for all clumps. master_clump.add_info_item("center_of_mass") # Begin clump finding. find_clumps(master_clump, c_min, c_max, step) # Save the clump tree as a reloadable dataset fn = master_clump.save_as_dataset(fields=["density"]) # Traverse the clump hierarchy to get a list of all of the 'leaf' clumps leaf_clumps = get_lowest_clumps(master_clump) # To visualize these clumps, a list of clumps can be supplied to # the "clumps" callback on a plot. First, we create a projection plot: prj = yt.ProjectionPlot(ds, 0, 'density', center=[0.5,0.5,0.5],width=(160,'kpc')) prj.set_buff_size(4000) # Next we annotate the plot with contours on the borders of the clumps prj.annotate_clumps(leaf_clumps) # Save the plot to disk. prj.save('JO204cw'+loop[i]+'_clumps_16pix') ########################## Also, when I have
print (leaf_clumps[0]["gas","density"])
I get 22 outputs, which seems like a lot less than what is getting put on the figure? Anyway, I am lost and any help would be greatly appreciated. Best, Stephanie -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY stonnes@gmail.com
Hi Stephanie, No idea what's happening here. Does it still look weird when you zoom in? If I were in your shoes right now, I'd look very carefully right here after this for loop: https://github.com/yt-project/yt/blob/master/yt/visualization/plot_modificat... In particular, I'd probably make an imshow plot of the "buff" array. I'd also put a breakpoint inside the for loop look carefully at the data being passed to the pixelize_cartesian function, which is accepting the x, dx, y, and dy fields for the each clump (e.g. the x, and y positions of all the zones in each clump as well as the cell spacing in x and y for the same zones), along with an integer mask. -Nathan On Tue, Aug 28, 2018 at 10:20 PM Stephanie Tonnesen <stonnes@gmail.com> wrote:
Dear yt-users,
I am having some trouble with the yt clump finder. Mostly, my issue is that I don't understand what I am getting when I annotate the projectionplot. Instead of the nice lines in the example, I get strange filled-in circles?
My figure is attached, and here is my code:
################## ds = yt.load("/mnt/ceph/users/stonnesen/runs/JO204wind/DD"+loop[i]+"/JO204cw"+loop[i])
ad = ds.all_data() data_source = ad.cut_region(["obj['z'] > 0.27"]) #ds.disk([0.5, 0.5, 0.5], [0., 0., 1.],(80, 'kpc'), (145, 'kpc'))
# the field to be used for contouring field = ("gas", "density")
# This is the multiplicative interval between contours. step = 2.0
# Now we set some sane min/max values between which we want to find contours # This is how we tell the clump finder what to look for -- it won't look for # contours connected below or above these threshold values. c_min = 2e-25 #10**np.floor(np.log10(data_source[field]).min()+3 ) c_max = 10**np.floor(np.log10(data_source[field]).max()+1)
# Now find get our 'base' clump -- this one just covers the whole domain. master_clump = Clump(data_source, 'density')
# Add a "validator" to weed out clumps with less than 16 cells. # As many validators can be added as you want. master_clump.add_validator("min_cells", 16)
# Calculate center of mass for all clumps. master_clump.add_info_item("center_of_mass")
# Begin clump finding. find_clumps(master_clump, c_min, c_max, step)
# Save the clump tree as a reloadable dataset fn = master_clump.save_as_dataset(fields=["density"])
# Traverse the clump hierarchy to get a list of all of the 'leaf' clumps leaf_clumps = get_lowest_clumps(master_clump)
# To visualize these clumps, a list of clumps can be supplied to # the "clumps" callback on a plot. First, we create a projection plot: prj = yt.ProjectionPlot(ds, 0, 'density', center=[0.5,0.5,0.5],width=(160,'kpc')) prj.set_buff_size(4000) # Next we annotate the plot with contours on the borders of the clumps prj.annotate_clumps(leaf_clumps)
# Save the plot to disk. prj.save('JO204cw'+loop[i]+'_clumps_16pix')
##########################
Also, when I have
print (leaf_clumps[0]["gas","density"])
I get 22 outputs, which seems like a lot less than what is getting put on the figure?
Anyway, I am lost and any help would be greatly appreciated.
Best, Stephanie
-- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY
stonnes@gmail.com _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Hi Nathan, Thanks for the response! The problem still shows up when I zoom in on the png, although I am wondering if there are so many clumps that need to be annotated in a single pixel that it is just freaking out? I am trying with a smaller side-length to see if it makes a difference (although this has instigated my other question about set_buff_size in a different email). I will take a look at what you suggested, but I think I may have a fundamental misunderstanding of what I am asking yt to do for me. My clumps are little clouds that get more dense towards the center, so don't really look like the cookbook example (stretched out overdensities to my eye). I thought that because in my script I have:
leaf_clumps = get_lowest_clumps(master_clump)
then leaf_clumps are my "ends" that don't have anything lower? Yet when I type
prj.annotate_clumps(leaf_clumps)
yt seems to be trying to annotate a *lot* of clumps! As evidenced by the figure I attached before and the .o file which has a list that ends at "Pixelizing contour 391". BUT, when I type
print (leaf_clumps[0]["gas","density"])
I get 22 outputs. Do I need to annotate_clumps(leaf_clumps[0])? If so then leaf_clumps wouldn't actually be the "get_lowest_clumps".... Not sure what is going on... Thanks again, Stephanie -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY stonnes@gmail.com On Tue, Aug 28, 2018 at 10:43 PM Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Stephanie,
No idea what's happening here. Does it still look weird when you zoom in?
If I were in your shoes right now, I'd look very carefully right here after this for loop:
https://github.com/yt-project/yt/blob/master/yt/visualization/plot_modificat...
In particular, I'd probably make an imshow plot of the "buff" array. I'd also put a breakpoint inside the for loop look carefully at the data being passed to the pixelize_cartesian function, which is accepting the x, dx, y, and dy fields for the each clump (e.g. the x, and y positions of all the zones in each clump as well as the cell spacing in x and y for the same zones), along with an integer mask.
-Nathan
On Tue, Aug 28, 2018 at 10:20 PM Stephanie Tonnesen <stonnes@gmail.com> wrote:
Dear yt-users,
I am having some trouble with the yt clump finder. Mostly, my issue is that I don't understand what I am getting when I annotate the projectionplot. Instead of the nice lines in the example, I get strange filled-in circles?
My figure is attached, and here is my code:
################## ds = yt.load("/mnt/ceph/users/stonnesen/runs/JO204wind/DD"+loop[i]+"/JO204cw"+loop[i])
ad = ds.all_data() data_source = ad.cut_region(["obj['z'] > 0.27"]) #ds.disk([0.5, 0.5, 0.5], [0., 0., 1.],(80, 'kpc'), (145, 'kpc'))
# the field to be used for contouring field = ("gas", "density")
# This is the multiplicative interval between contours. step = 2.0
# Now we set some sane min/max values between which we want to find contours # This is how we tell the clump finder what to look for -- it won't look for # contours connected below or above these threshold values. c_min = 2e-25 #10**np.floor(np.log10(data_source[field]).min()+3 ) c_max = 10**np.floor(np.log10(data_source[field]).max()+1)
# Now find get our 'base' clump -- this one just covers the whole domain. master_clump = Clump(data_source, 'density')
# Add a "validator" to weed out clumps with less than 16 cells. # As many validators can be added as you want. master_clump.add_validator("min_cells", 16)
# Calculate center of mass for all clumps. master_clump.add_info_item("center_of_mass")
# Begin clump finding. find_clumps(master_clump, c_min, c_max, step)
# Save the clump tree as a reloadable dataset fn = master_clump.save_as_dataset(fields=["density"])
# Traverse the clump hierarchy to get a list of all of the 'leaf' clumps leaf_clumps = get_lowest_clumps(master_clump)
# To visualize these clumps, a list of clumps can be supplied to # the "clumps" callback on a plot. First, we create a projection plot: prj = yt.ProjectionPlot(ds, 0, 'density', center=[0.5,0.5,0.5],width=(160,'kpc')) prj.set_buff_size(4000) # Next we annotate the plot with contours on the borders of the clumps prj.annotate_clumps(leaf_clumps)
# Save the plot to disk. prj.save('JO204cw'+loop[i]+'_clumps_16pix')
##########################
Also, when I have
print (leaf_clumps[0]["gas","density"])
I get 22 outputs, which seems like a lot less than what is getting put on the figure?
Anyway, I am lost and any help would be greatly appreciated.
Best, Stephanie
-- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY
stonnes@gmail.com _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Hi Stephanie, I'll step in here since I'm responsible for a good amount of the clump finder. BUT, when I type
print (leaf_clumps[0]["gas","density"])
I get 22 outputs.
What you're seeing in the above code is the number of cells in the first leave clump. To see how many leaf_clumps you have, you would do: print (len(leaf_clumps)) The message, "Pixelizing contour 391", may be a red herring. Many clumps will get created and destroyed during the clump finding process, but the unique clump id is always increments, so you could end up with 4 clumps with ids of 0, 8, 42, 391, just as an example. Still, I suspect you'll find that there are an awful lot of leaf clumps, just based on the image you sent. If there is a large number of clumps along the line of sight, then annotate_clumps may always look a bit messy. If you think there are too many clumps, you can try adding a clump_validator <http://yt-project.org/docs/dev/analyzing/analysis_modules/clump_finding.html#clump-validators> to set some lower limits on what should be considered a clump. It may very well be the case that you have a large number of single-cell clumps just due to fluctuations in the density field. Adding some validation criterion, like a minimum number of cells, or gravitational boundedness, may help cut that down. Britton
Ah-ha! Thank you! Alright, I will work with that. Also, once I beefed up the resolution of the png file the spheres did turn into contours. However, I am not sure why my contours are colored? I feel like I am following the example pretty closely and that doesn’t happen there... Thanks again! Stephanie On Thu, Aug 30, 2018 at 8:02 PM Britton Smith <brittonsmith@gmail.com> wrote:
Hi Stephanie,
I'll step in here since I'm responsible for a good amount of the clump finder.
BUT, when I type
print (leaf_clumps[0]["gas","density"])
I get 22 outputs.
What you're seeing in the above code is the number of cells in the first leave clump. To see how many leaf_clumps you have, you would do: print (len(leaf_clumps))
The message, "Pixelizing contour 391", may be a red herring. Many clumps will get created and destroyed during the clump finding process, but the unique clump id is always increments, so you could end up with 4 clumps with ids of 0, 8, 42, 391, just as an example.
Still, I suspect you'll find that there are an awful lot of leaf clumps, just based on the image you sent. If there is a large number of clumps along the line of sight, then annotate_clumps may always look a bit messy. If you think there are too many clumps, you can try adding a clump_validator <http://yt-project.org/docs/dev/analyzing/analysis_modules/clump_finding.html#clump-validators> to set some lower limits on what should be considered a clump. It may very well be the case that you have a large number of single-cell clumps just due to fluctuations in the density field. Adding some validation criterion, like a minimum number of cells, or gravitational boundedness, may help cut that down.
Britton _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
-- -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY stonnes@gmail.com
Hi Stephanie, They’re colored in the example on this page: http://yt-project.org/doc/visualizing/callbacks.html The colors are supposed to illustrate distinct clumps. On Thu, Aug 30, 2018 at 7:14 PM Stephanie Tonnesen <stonnes@gmail.com> wrote:
Ah-ha! Thank you! Alright, I will work with that.
Also, once I beefed up the resolution of the png file the spheres did turn into contours. However, I am not sure why my contours are colored? I feel like I am following the example pretty closely and that doesn’t happen there...
Thanks again! Stephanie
On Thu, Aug 30, 2018 at 8:02 PM Britton Smith <brittonsmith@gmail.com> wrote:
Hi Stephanie,
I'll step in here since I'm responsible for a good amount of the clump finder.
BUT, when I type
print (leaf_clumps[0]["gas","density"])
I get 22 outputs.
What you're seeing in the above code is the number of cells in the first leave clump. To see how many leaf_clumps you have, you would do: print (len(leaf_clumps))
The message, "Pixelizing contour 391", may be a red herring. Many clumps will get created and destroyed during the clump finding process, but the unique clump id is always increments, so you could end up with 4 clumps with ids of 0, 8, 42, 391, just as an example.
Still, I suspect you'll find that there are an awful lot of leaf clumps, just based on the image you sent. If there is a large number of clumps along the line of sight, then annotate_clumps may always look a bit messy. If you think there are too many clumps, you can try adding a clump_validator <http://yt-project.org/docs/dev/analyzing/analysis_modules/clump_finding.html#clump-validators> to set some lower limits on what should be considered a clump. It may very well be the case that you have a large number of single-cell clumps just due to fluctuations in the density field. Adding some validation criterion, like a minimum number of cells, or gravitational boundedness, may help cut that down.
Britton _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
-- -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY
stonnes@gmail.com _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
So they are! Thanks! I think I got myself confused because they are using the same color scheme as the gas density projection, so I was trying to think about if the colors were related. But just outlining different clumps makes sense. Best, Stephanie On Thu, Aug 30, 2018 at 9:06 PM Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Stephanie,
They’re colored in the example on this page:
http://yt-project.org/doc/visualizing/callbacks.html
The colors are supposed to illustrate distinct clumps.
On Thu, Aug 30, 2018 at 7:14 PM Stephanie Tonnesen <stonnes@gmail.com> wrote:
Ah-ha! Thank you! Alright, I will work with that.
Also, once I beefed up the resolution of the png file the spheres did turn into contours. However, I am not sure why my contours are colored? I feel like I am following the example pretty closely and that doesn’t happen there...
Thanks again! Stephanie
On Thu, Aug 30, 2018 at 8:02 PM Britton Smith <brittonsmith@gmail.com> wrote:
Hi Stephanie,
I'll step in here since I'm responsible for a good amount of the clump finder.
BUT, when I type
print (leaf_clumps[0]["gas","density"])
I get 22 outputs.
What you're seeing in the above code is the number of cells in the first leave clump. To see how many leaf_clumps you have, you would do: print (len(leaf_clumps))
The message, "Pixelizing contour 391", may be a red herring. Many clumps will get created and destroyed during the clump finding process, but the unique clump id is always increments, so you could end up with 4 clumps with ids of 0, 8, 42, 391, just as an example.
Still, I suspect you'll find that there are an awful lot of leaf clumps, just based on the image you sent. If there is a large number of clumps along the line of sight, then annotate_clumps may always look a bit messy. If you think there are too many clumps, you can try adding a clump_validator <http://yt-project.org/docs/dev/analyzing/analysis_modules/clump_finding.html#clump-validators> to set some lower limits on what should be considered a clump. It may very well be the case that you have a large number of single-cell clumps just due to fluctuations in the density field. Adding some validation criterion, like a minimum number of cells, or gravitational boundedness, may help cut that down.
Britton _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
-- -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY
stonnes@gmail.com _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
-- -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY stonnes@gmail.com
participants (3)
-
Britton Smith
-
Nathan Goldbaum
-
Stephanie Tonnesen