[yt-users] Subtracting datasets
bh11e
bh11e at my.fsu.edu
Tue Jun 16 08:54:36 PDT 2015
Hi Matthew and Jonah,
Firstly, thanks to Matt for the answer!
Secondly, to add to the answer to Johah's question - without knowing the details, I've heard about "covering grid" in yt that interpolates the data from the existing grid hierarchy onto a uniform mesh. Perhaps someone else can elaborate.
I already tried something like Matt suggested:
ds1.index.grids[0][field] = ds1.index.grids[0][field] - ds2.index.grids[0][field]
print ds1.index.grids[0][field]
plot = SlicePlot(ds1, "y", field)
It printed the modified values but SlicePlot didn't know about it. Some time ago I noticed that derived fields don't preserve the calculated values if they are being accessed more than once. I wonder if it is for the same reason.
Best regards,
--Boyan
> Today's Topics (Digest, Vol 88, Issue 38, Jun 16, 2015, at 9:57)
>
> 1. Subtracting datasets (bh11e)
> 2. An error when using yt on PLUTO 4.1 (=?GBK?B?t72+/A==?=)
> 3. Re: Subtracting datasets (Matthew Turk)
> 4. Re: Subtracting datasets (Jonah Miller)
> 5. Re: Subtracting datasets (Matthew Turk)
> 6. Re: Subtracting datasets (Jonah Miller)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 16 Jun 2015 00:05:52 -0400
> From: bh11e <bh11e at my.fsu.edu>
> To: <yt-users at lists.spacepope.org>
> Subject: [yt-users] Subtracting datasets
> Message-ID: <D0CA8853-F36E-4FA8-815C-93676BF4E6EC at my.fsu.edu>
> Content-Type: text/plain; charset="us-ascii"
>
> 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
>
> ------------------------------
>
> Message: 2
> Date: Tue, 16 Jun 2015 20:57:22 +0800
> From: "=?GBK?B?t72+/A==?=" <fangjun at ynu.edu.cn>
> To: yt-users at lists.spacepope.org
> Subject: [yt-users] An error when using yt on PLUTO 4.1
> Message-ID: <15061620572294f6197f024e15786d70ba0f25fa12a9 at ynu.edu.cn>
> Content-Type: text/plain; charset="gbk"
>
> Dear everyone,
> I recently used yt to plot the slice files for the hdf5 file from PLUTO 4.1.
> An error exists when ploting, i.e.,
> [('chombo', 'rho'), ('chombo', 'vx1'), ('chombo', 'vx2'), ('chombo', 'vx3'), ('chombo', 'prs')]
> Traceback (most recent call last):
> File "simple_slice.py", line 18, in <module>
> p = yt.ProjectionPlot(ds, "y", "density")
> File "/home/fangjun/yt/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 1227, in __init__
> field_parameters = field_parameters, method = method)
> File "/home/fangjun/yt/yt-x86_64/src/yt-hg/yt/data_objects/construction_data_containers.py", line 250, in __init__
> self.get_data(field)
> File "/home/fangjun/yt/yt-x86_64/src/yt-hg/yt/data_objects/construction_data_containers.py", line 295, in get_data
> chunk_fields, "io", local_only = True)):
> File "/home/fangjun/yt/yt-x86_64/src/yt-hg/yt/utilities/parallel_tools/parallel_analysis_interface.py", line 506, in parallel_objects
> for obj_id, obj in oiter:
> File "/home/fangjun/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 592, in chunks
> self.get_data(fields)
> File "/home/fangjun/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 681, in get_data
> fluids, self, self._current_chunk)
> File "/home/fangjun/yt/yt-x86_64/src/yt-hg/yt/geometry/geometry_handler.py", line 252, in _read_fluid_fields
> chunk_size)
> File "/home/fangjun/yt/yt-x86_64/src/yt-hg/yt/frontends/chombo/io.py", line 147, in _read_fluid_selection
> data = self._read_data(g, fname)
> File "/home/fangjun/yt/yt-x86_64/src/yt-hg/yt/frontends/chombo/io.py", line 104, in _read_data
> shape = grid.ActiveDimensions + 2*self.ghost
>
> AttributeError: 'IOHandlerPlutoHDF5' object has no attribute 'ghost'
>
> Could you give some instructions on it?
> Best wishes,
> Jun
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150616/52d73197/attachment-0001.htm>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 16 Jun 2015 08:34:04 -0500
> From: Matthew Turk <matthewturk at gmail.com>
> To: Discussion of the yt analysis package
> <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] Subtracting datasets
> Message-ID:
> <CALO3=5EKquRGiftUryyqGROnWKsrcNEvuKruwv21VCXXwfcnTw at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> 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 at 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 at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 16 Jun 2015 09:41:31 -0400
> From: Jonah Miller <jonah.maxwell.miller at gmail.com>
> To: yt-users at lists.spacepope.org
> Subject: Re: [yt-users] Subtracting datasets
> Message-ID: <5580278B.90506 at gmail.com>
> Content-Type: text/plain; charset="windows-1252"; Format="flowed"
>
> 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 at 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 at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150616/e707a86f/attachment-0001.htm>
>
> ------------------------------
>
> Message: 5
> Date: Tue, 16 Jun 2015 08:53:38 -0500
> From: Matthew Turk <matthewturk at gmail.com>
> To: Discussion of the yt analysis package
> <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] Subtracting datasets
> Message-ID:
> <CALO3=5FWJsvt30EKniAeBQS0KG9XzhexyVf-EQaKgwCCO+m8Bw at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> 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 at 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 at 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 at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 16 Jun 2015 09:57:39 -0400
> From: Jonah Miller <jonah.maxwell.miller at gmail.com>
> To: yt-users at lists.spacepope.org
> Subject: Re: [yt-users] Subtracting datasets
> Message-ID: <55802B53.8060406 at gmail.com>
> Content-Type: text/plain; charset=windows-1252; format=flowed
>
> 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 at 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 at 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 at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
> ------------------------------
>
> End of yt-users Digest, Vol 88, Issue 38
> ****************************************
More information about the yt-users
mailing list