UNEQUAL ARRAY SIZES FOR PARTICLE AND GAS FIELDS FOR FIXED RESOLUTION DATA
Hi, I am trying to add value of a particle field to the gas field (same units) by accessing a data region of fixed resolution. I expect the fields to have same sizes but it doesn't seem to be the case. Could someone please shed some light on this? Thank you. DIM=256
dd=ds.arbitrary_grid(left_edge= ds.arr([(com_x_1.value-10), (com_y_1.value-10), (com_z_1.value-10)], 'kpc'), right_edge= ds.arr([(com_x_1.value+10), (com_y_1.value+10), (com_z_1.value+10)], 'kpc'), dims=[DIM,DIM,DIM])
m=dd["gas", "cell_mass"].in_units('Msun') starmass=dd[("new_stars", "particle_mass")].in_units('Msun') b=m.value+starmass.value
Error: Traceback (most recent call last): File "gasinflow.py", line 95, in <module> b=m.value+starmass.value ValueError: operands could not be broadcast together with shapes (16777216,) (8978,)
Hi, The stars will be flat arrays unless you deposit them -- you might want to check out the particle deposition routines, like cic and deposit. -Matt On Mon, Apr 29, 2019 at 5:56 AM Vadlamani Samhitha <vadlamani.samhitha@gmail.com> wrote:
Hi,
I am trying to add value of a particle field to the gas field (same units) by accessing a data region of fixed resolution. I expect the fields to have same sizes but it doesn't seem to be the case. Could someone please shed some light on this? Thank you.
DIM=256
dd=ds.arbitrary_grid(left_edge= ds.arr([(com_x_1.value-10), (com_y_1.value-10), (com_z_1.value-10)], 'kpc'), right_edge= ds.arr([(com_x_1.value+10), (com_y_1.value+10), (com_z_1.value+10)], 'kpc'), dims=[DIM,DIM,DIM])
m=dd["gas", "cell_mass"].in_units('Msun')
starmass=dd[("new_stars", "particle_mass")].in_units('Msun')
b=m.value+starmass.value
Error:
Traceback (most recent call last):
File "gasinflow.py", line 95, in <module>
b=m.value+starmass.value
ValueError: operands could not be broadcast together with shapes (16777216,) (8978,)
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (2)
-
Matthew Turk
-
Vadlamani Samhitha