Wow, this is amazing. Well done, Corentin!

On Jul 16, 2025 at 10:57:34 AM, Matthew Turk via yt-dev <yt-dev@python.org> wrote:
Hi folks,

I wanted to highlight this PR that Corentin Cadiou just issued:

https://github.com/yt-project/yt/pull/5208

I love love love this syntax for adding new derived fields.  Here's his example:

---
ds = yt.load(...)

ds.fields.gas.density_square = ds.fields.gas.density * ds.fields.gas.density
ds.add_field(("gas", "double_density"), ds.fields.gas.density * 2)

ds.r["gas", "density_square"]
ds.r["gas", "double_density"]
---

Check out the way he's using ds.fields.gas.density for input *and*
he's assigning to ds.fields.gas.density_square.  This is so much more
user friendly.

Corentin implemented this after the presentations at the Higgs
workshop about defining derived fields.

Even if we workshop this, fiddle around, whatever, I think this is a
great concept that will be good for users both new and experienced!

-Matt
_______________________________________________
yt-dev mailing list -- yt-dev@python.org
To unsubscribe send an email to yt-dev-leave@python.org
https://mail.python.org/mailman3//lists/yt-dev.python.org
Member address: jzuhone@gmail.com