Hello hope you are doing well. I am trying to save some projection and slice field data within a sphere by doing the following :
my_sphere = stuff.sphere([0.5,0.5,0.5],(214,"kpc")) prj1 = yt.SlicePlot(stuff,'z',('gas','radius'),data_source=my_sphere) rad = prj1.frb['gas','radius'] prj1.save()
I then save rad to a pickle file to read in by another code. The full simulation domain is 800 kpc. When I load the pickle file and print out the values I am getting many 0's. And this is also the same when I make a projection of some field and save it in the same way to a pickle file.
My question is, even though I am limiting the data to within a sphere, does rad also hold values that are not within that sphere and saving them as 0's? Is there a better way to go about this?
I think if you just set the width in the projection or slice plot the same as the radius of "my_sphere" data container, it will reduce too many 0's in the plot as well as in the pickle file. Try this:
my_sphere = stuff.sphere([0.5,0.5,0.5],(radius,"kpc")) prj1 = yt.SlicePlot(stuff,'z',('gas','some_field'),data_source=my_sphere, width = (radius, "kpc"))
Give some value to the variable "radius" say 214 (in kpc). I hope this will work for you.