Subtracting datasets
Hi, I was wondering if someone could advise on the following problem. Consider two (Enzo) datasets with identical grids. What is the way to plot the difference between a field in one set and a field in the other. Alternatively is there a way to create a new dataset with the calculated difference, after which plotting will be as usual. Thanks, --Boyan Hristov
Hi Boyan, Since the grids are uniform, you can do one of a few different things. The first would be if you want to set up a derived field, you could do something like: ds1 = ... ds2 = ... @yt.derived_field(name = "my_field", validators = [yt.ValidateSpatial()]) def my_field(field, data): f1 = ds1.index.grids[data.id - data._id_offset][field.name] f2 = data[field.name] return f1 - f2 If you want to simply inspect, you can do ds1.index.grids[whatever][field] - ds2.index.grids[whatever][field]. -Matt On Mon, Jun 15, 2015 at 11:05 PM, bh11e <bh11e@my.fsu.edu> wrote:
Hi,
I was wondering if someone could advise on the following problem. Consider two (Enzo) datasets with identical grids. What is the way to plot the difference between a field in one set and a field in the other. Alternatively is there a way to create a new dataset with the calculated difference, after which plotting will be as usual.
Thanks,
--Boyan Hristov _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Matt, Boyan, Although I'm not currently struggling with this, I will eventually encounter a similar situation... What would one do if the grid was /not/ uniform? Would a derived field still work if the grids were identical? Best, Jonah On 15-06-16 09:34 AM, Matthew Turk wrote:
Hi Boyan,
Since the grids are uniform, you can do one of a few different things. The first would be if you want to set up a derived field, you could do something like:
ds1 = ... ds2 = ...
@yt.derived_field(name = "my_field", validators = [yt.ValidateSpatial()]) def my_field(field, data): f1 = ds1.index.grids[data.id - data._id_offset][field.name] f2 = data[field.name] return f1 - f2
If you want to simply inspect, you can do ds1.index.grids[whatever][field] - ds2.index.grids[whatever][field].
-Matt
On Mon, Jun 15, 2015 at 11:05 PM, bh11e <bh11e@my.fsu.edu> wrote:
Hi,
I was wondering if someone could advise on the following problem. Consider two (Enzo) datasets with identical grids. What is the way to plot the difference between a field in one set and a field in the other. Alternatively is there a way to create a new dataset with the calculated difference, after which plotting will be as usual.
Thanks,
--Boyan Hristov _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Jonah, If they're not identical in shape, you'd have to do some type of regularization stpe, which wouldn't be automated yet. But this is something I hope to make automated, although it's not on the current schedule. -Matt On Tue, Jun 16, 2015 at 8:41 AM, Jonah Miller <jonah.maxwell.miller@gmail.com> wrote:
Hi Matt, Boyan,
Although I'm not currently struggling with this, I will eventually encounter a similar situation... What would one do if the grid was not uniform? Would a derived field still work if the grids were identical?
Best, Jonah
On 15-06-16 09:34 AM, Matthew Turk wrote:
Hi Boyan,
Since the grids are uniform, you can do one of a few different things. The first would be if you want to set up a derived field, you could do something like:
ds1 = ... ds2 = ...
@yt.derived_field(name = "my_field", validators = [yt.ValidateSpatial()]) def my_field(field, data): f1 = ds1.index.grids[data.id - data._id_offset][field.name] f2 = data[field.name] return f1 - f2
If you want to simply inspect, you can do ds1.index.grids[whatever][field] - ds2.index.grids[whatever][field].
-Matt
On Mon, Jun 15, 2015 at 11:05 PM, bh11e <bh11e@my.fsu.edu> wrote:
Hi,
I was wondering if someone could advise on the following problem. Consider two (Enzo) datasets with identical grids. What is the way to plot the difference between a field in one set and a field in the other. Alternatively is there a way to create a new dataset with the calculated difference, after which plotting will be as usual.
Thanks,
--Boyan Hristov _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Matt, I see. Thanks. Best, Jonah On 15-06-16 09:53 AM, Matthew Turk wrote:
Hi Jonah,
If they're not identical in shape, you'd have to do some type of regularization stpe, which wouldn't be automated yet. But this is something I hope to make automated, although it's not on the current schedule.
-Matt
On Tue, Jun 16, 2015 at 8:41 AM, Jonah Miller <jonah.maxwell.miller@gmail.com> wrote:
Hi Matt, Boyan,
Although I'm not currently struggling with this, I will eventually encounter a similar situation... What would one do if the grid was not uniform? Would a derived field still work if the grids were identical?
Best, Jonah
On 15-06-16 09:34 AM, Matthew Turk wrote:
Hi Boyan,
Since the grids are uniform, you can do one of a few different things. The first would be if you want to set up a derived field, you could do something like:
ds1 = ... ds2 = ...
@yt.derived_field(name = "my_field", validators = [yt.ValidateSpatial()]) def my_field(field, data): f1 = ds1.index.grids[data.id - data._id_offset][field.name] f2 = data[field.name] return f1 - f2
If you want to simply inspect, you can do ds1.index.grids[whatever][field] - ds2.index.grids[whatever][field].
-Matt
On Mon, Jun 15, 2015 at 11:05 PM, bh11e <bh11e@my.fsu.edu> wrote:
Hi,
I was wondering if someone could advise on the following problem. Consider two (Enzo) datasets with identical grids. What is the way to plot the difference between a field in one set and a field in the other. Alternatively is there a way to create a new dataset with the calculated difference, after which plotting will be as usual.
Thanks,
--Boyan Hristov _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi, Everybody-- Jonha, for that kind of thing I typically either use covering grids in yt, or force the refinement to be identical during run time. If you're an enzo user I can help with the latter. d. On Tue, Jun 16, 2015 at 9:57 AM, Jonah Miller < jonah.maxwell.miller@gmail.com> wrote:
Hi Matt,
I see. Thanks.
Best, Jonah
On 15-06-16 09:53 AM, Matthew Turk wrote:
Hi Jonah,
If they're not identical in shape, you'd have to do some type of regularization stpe, which wouldn't be automated yet. But this is something I hope to make automated, although it's not on the current schedule.
-Matt
On Tue, Jun 16, 2015 at 8:41 AM, Jonah Miller <jonah.maxwell.miller@gmail.com> wrote:
Hi Matt, Boyan,
Although I'm not currently struggling with this, I will eventually encounter a similar situation... What would one do if the grid was not uniform? Would a derived field still work if the grids were identical?
Best, Jonah
On 15-06-16 09:34 AM, Matthew Turk wrote:
Hi Boyan,
Since the grids are uniform, you can do one of a few different things. The first would be if you want to set up a derived field, you could do something like:
ds1 = ... ds2 = ...
@yt.derived_field(name = "my_field", validators = [yt.ValidateSpatial()]) def my_field(field, data): f1 = ds1.index.grids[data.id - data._id_offset][field.name] f2 = data[field.name] return f1 - f2
If you want to simply inspect, you can do ds1.index.grids[whatever][field] - ds2.index.grids[whatever][field].
-Matt
On Mon, Jun 15, 2015 at 11:05 PM, bh11e <bh11e@my.fsu.edu> wrote:
Hi,
I was wondering if someone could advise on the following problem. Consider two (Enzo) datasets with identical grids. What is the way to plot the difference between a field in one set and a field in the other. Alternatively is there a way to create a new dataset with the calculated difference, after which plotting will be as usual.
Thanks,
--Boyan Hristov _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
Hi David, Everybody, Ah, covering grids were exactly what I was looking for. Thanks! (I'm not an Enzo user, unfortunately.) Best, Jonah On 15-06-16 10:02 AM, David Collins wrote:
Hi, Everybody--
Jonha, for that kind of thing I typically either use covering grids in yt, or force the refinement to be identical during run time. If you're an enzo user I can help with the latter.
d.
On Tue, Jun 16, 2015 at 9:57 AM, Jonah Miller <jonah.maxwell.miller@gmail.com <mailto:jonah.maxwell.miller@gmail.com>> wrote:
Hi Matt,
I see. Thanks.
Best, Jonah
On 15-06-16 09:53 AM, Matthew Turk wrote:
Hi Jonah,
If they're not identical in shape, you'd have to do some type of regularization stpe, which wouldn't be automated yet. But this is something I hope to make automated, although it's not on the current schedule.
-Matt
On Tue, Jun 16, 2015 at 8:41 AM, Jonah Miller <jonah.maxwell.miller@gmail.com <mailto:jonah.maxwell.miller@gmail.com>> wrote:
Hi Matt, Boyan,
Although I'm not currently struggling with this, I will eventually encounter a similar situation... What would one do if the grid was not uniform? Would a derived field still work if the grids were identical?
Best, Jonah
On 15-06-16 09:34 AM, Matthew Turk wrote:
Hi Boyan,
Since the grids are uniform, you can do one of a few different things. The first would be if you want to set up a derived field, you could do something like:
ds1 = ... ds2 = ...
@yt.derived_field(name = "my_field", validators = [yt.ValidateSpatial()]) def my_field(field, data): f1 = ds1.index.grids[data.id <http://data.id> - data._id_offset][field.name <http://field.name>] f2 = data[field.name <http://field.name>] return f1 - f2
If you want to simply inspect, you can do ds1.index.grids[whatever][field] - ds2.index.grids[whatever][field].
-Matt
On Mon, Jun 15, 2015 at 11:05 PM, bh11e <bh11e@my.fsu.edu <mailto:bh11e@my.fsu.edu>> wrote:
Hi,
I was wondering if someone could advise on the following problem. Consider two (Enzo) datasets with identical grids. What is the way to plot the difference between a field in one set and a field in the other. Alternatively is there a way to create a new dataset with the calculated difference, after which plotting will be as usual.
Thanks,
--Boyan Hristov _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <mailto:yt-users@lists.spacepope.org> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <mailto:yt-users@lists.spacepope.org> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <mailto:yt-users@lists.spacepope.org> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <mailto:yt-users@lists.spacepope.org> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org <mailto:yt-users@lists.spacepope.org> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- -- Sent from a computer.
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (4)
-
bh11e -
David Collins -
Jonah Miller -
Matthew Turk