[yt-users] need to set omega_baryon in yt-3

Brian O'Shea bwoshea at gmail.com
Tue Aug 19 04:16:41 PDT 2014


That fix it.  Thank you!


On Tue, Aug 19, 2014 at 6:53 AM, Britton Smith <brittonsmith at gmail.com>
wrote:

> Hi Brian,
>
> I see the problem.  The argument list for the superclass of region takes a
> different set of arguments that what is being passed in, so one was being
> interpreted as the field_parameters keyword arg.  I have this fixed and
> will issue a PR now.
>
> Britton
>
>
> On Tue, Aug 19, 2014 at 11:36 AM, Brian O'Shea <bwoshea at gmail.com> wrote:
>
>> Hi Britton,
>>
>> That's basically what I'm doing - I was already using ds.region.  When I
>> call ds.region() with these inputs:
>>
>> ad = ds.region((ds.domain_right_edge + ds.domain_left_edge)/2.,
>> ds.domain_left_edge, ds.domain_right_edge,field_parameters =
>> {'omega_baryon':0.046} )
>>
>> (so, modifying ds.region in the way you suggested, though it's
>> functionally equivalent to what I was doing), I get:
>>
>>
>> ---------------------------------------------------------------------------
>> TypeError                                 Traceback (most recent call
>> last)
>> <ipython-input-5-6daee9cdd9b5> in <module>()
>> ----> 1 ad = ds.region((ds.domain_right_edge + ds.domain_left_edge)/2.,
>> ds.domain_left_edge, ds.domain_right_edge,field_parameters =
>> {'omega_baryon':0.046} )
>>
>> /Users/bwoshea/Desktop/yt-3.0/src/yt-hg/yt/data_objects/selection_data_containers.py
>> in __init__(self, center, left_edge, right_edge, fields, ds, **kwargs)
>>     577     def __init__(self, center, left_edge, right_edge, fields =
>> None,
>>     578                  ds = None, **kwargs):
>> --> 579         YTSelectionContainer3D.__init__(self, center, fields, ds,
>> **kwargs)
>>     580         if not isinstance(left_edge, YTArray):
>>     581             self.left_edge = self.ds.arr(left_edge, 'code_length')
>>
>> TypeError: __init__() got multiple values for keyword argument
>> 'field_parameters'
>>
>> Am I doing something wrong with how I use field_parameters in this
>> circumstance?
>>
>> Thanks,
>> Brian
>>
>>
>>
>>
>>
>> On Tue, Aug 19, 2014 at 5:59 AM, Britton Smith <brittonsmith at gmail.com>
>> wrote:
>>
>>> HI Brian,
>>>
>>> ds.all_data is a just a wrapper around ds.region that uses
>>> ds.domain_left_edge and ds.domain_right_edge.  Looking at the source, I can
>>> see that it wasn't set up to accept any additional keyword arguments and
>>> pass them to region.  This can be fixed easily in
>>> yt/data_objects/static_output.py (line 575), but in the mean time, you can
>>> just replace your ds.all_data call with:
>>> ds.region((ds.domain_right_edge + ds.domain_left_edge)/2.,
>>> ds.domain_left_edge, ds.domain_right_edge)
>>> and add your field_parameters keyword there.
>>>
>>> Britton
>>>
>>>
>>> On Tue, Aug 19, 2014 at 10:51 AM, Brian O'Shea <bwoshea at gmail.com>
>>> wrote:
>>>
>>>>
>>>>> >
>>>>> > Now, followup question: I am also attempting to create a 2D phase
>>>>> plot of the same quantity (baryon_overdensity vs. temperature), and
>>>>> yt.PhasePlot does not seem to take the field_parameters dictionary, and
>>>>> neither does yt.create_profile.  Should I try another avenue to create a
>>>>> phase plot?
>>>>> >
>>>>>
>>>>> Nope, you can supply it to your data source when you create it. They
>>>>> all take the same field_parameters argument.
>>>>>
>>>>
>>>> Hmm.  So when I tried that, using:
>>>>
>>>> ad =
>>>> ds.region(center=[0.5,0.5,0.5],left_edge=[0,0,0],right_edge=[1,1,1],field_parameters
>>>> = {'omega_baryon':0.046})
>>>>
>>>> (as ds.all_data() does not accept any additional arguments), I get this
>>>> error:
>>>>
>>>>
>>>> ---------------------------------------------------------------------------
>>>> TypeError                                 Traceback (most recent call
>>>> last)
>>>> <ipython-input-3-a78c8b2667cc> in <module>()
>>>> ----> 1 ad =
>>>> ds.region(center=[0.5,0.5,0.5],left_edge=[0,0,0],right_edge=[1,1,1],field_parameters
>>>> = {'omega_baryon':0.046})
>>>>
>>>> /Users/bwoshea/Desktop/yt-3.0/src/yt-hg/yt/data_objects/selection_data_containers.pyc
>>>> in __init__(self, center, left_edge, right_edge, fields, ds, **kwargs)
>>>>     577     def __init__(self, center, left_edge, right_edge, fields =
>>>> None,
>>>>     578                  ds = None, **kwargs):
>>>> --> 579         YTSelectionContainer3D.__init__(self, center, fields,
>>>> ds, **kwargs)
>>>>     580         if not isinstance(left_edge, YTArray):
>>>>     581             self.left_edge = self.ds.arr(left_edge,
>>>> 'code_length')
>>>>
>>>> TypeError: __init__() got multiple values for keyword argument
>>>> 'field_parameters'
>>>>
>>>> Is that expected behavior, or do I misunderstand what you're saying?
>>>>
>>>> Thanks,
>>>> Brian
>>>>
>>>>
>>>>
>>>>
>>>>>  Matt
>>>>>
>>>>> > --Brian
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >>
>>>>> >>
>>>>> >> -Matt
>>>>> >>
>>>>> >> >
>>>>> >> > (with c, my_region being previously defined).  When I do this, it
>>>>> complains:
>>>>> >> >
>>>>> >> > yt.fields.field_exceptions.NeedsParameter: (['omega_baryon'])
>>>>> >> >
>>>>> >> > which certainly makes sense from a physical perspective, and
>>>>> which Enzo
>>>>> >> > doesn't natively carry around. I tried to set this by hand:
>>>>> >> >
>>>>> >> >
>>>>> >> > _______________________________________________
>>>>> >> > 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
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140819/034c6c0a/attachment.html>


More information about the yt-users mailing list