Hi Salome,

Ah, I see what you mean.  So this is a bit tricky; the ordering of cells inside a data object (like a sphere, or a cutout) is not well-defined, so we return them as flattened arrays.  In particular, when you have any different resolution points collected within the cutout/sphere, it's not obvious how to return these in 3D.

Is it sufficient to be able to get the x,y,z coordinates, in addition?  Or, would it work to mask out the cells (with either 0 or NaN) in a 3D array that match up with the cutouts?

On Sun, Jan 31, 2021 at 1:36 PM Salome Mtchedlidze <salomchedlidze@gmail.com> wrote:

Ah yes, you are right that will always give me the same shape for that field. The thing is that I have tried before what you said but then I don't get the field in 3D. For example:

def _create_elec_den(ds):
    def _elec_den(field,data):
        N_A = 1/1.6726219e-24       
        X  = 0.70                   
        return ((data['gas','density'])*N_A*(1+X)/2/ds.quan(1,'g'))     
    ds.add_field(('gas','elec_den'), function=_elec_den, units='1/cm**3', force_override=True)

and then:

will have a shape: (85852,) and not e.g.(44,44,44). So, probably there is a proper way of doing it..

Thank you,
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org
Member address: matthewturk@gmail.com