One way you can do this is with the bulk_velocity field parameter. You would utilize data.get_field_parameters("bulk_velocity") and you would set it beforehand with data_object.set_field_parameter("bulk_velocity"). I think, though, from parsing your exact question, that you are likely in a situation where you need a derived field rather than using an on-disk field, as the on-disk field doesn't work with in-memory modifications.
I also suspect you might be able to speed up your calculation a fair bit if you got rid of the iteration:
ds.r['Gas','Velocities'] - ds.arr( ... )
You also probably want to assign this to another variable, as well.
On Tue, Dec 25, 2018 at 12:07 PM email@example.com wrote:
Is there any possible way to modify a (non-derived) field in a Gadget Binary Dataset and update the computation of the derived (in particular, deposited) fields to reflect this change? For example, I would like to substract a fixed velocity from all Gas particles (as to account for the Sun's velocity) and recalculate the smoothed velocity fields accordingly.
As a reference, modifying the in-disk fields the following way works, but has no effect on the derived_fields:
ds = yt.load('path/to/dataset', unit_base = unit_base) for i in range(num_particles): ds.r['Gas', 'Velocities'][i] -= ds.arr([100,100,100], 'code_velocity') #substracting some fixed array
Any help would be very much appreciated. Thanks is advance (and happy holidays!) Martin _______________________________________________ yt-users mailing list -- firstname.lastname@example.org To unsubscribe send an email to email@example.com