[yt-users] Profile plot of a 2d projection FRB object

Ben Thompson bthompson2090 at gmail.com
Fri Jan 16 17:34:26 PST 2015


Hey guys.

I have a solution together for myself involving the new
particle_position_relative_[xyz] fields and multiple instances of
np.histogram and np.linspace which seems to do the trick.

Although I would not complain if a piece of code that would be more native
to the inner workings of YT existed that made use of the FRB data objects
:). So that would be very nice Cameron. Don't feel the need to rush with it
though, as I made a numpy solution for myself. But I would be interested to
see that code.

Ben
On 17 Jan 2015 01:27, "Britton Smith" <brittonsmith at gmail.com> wrote:

> Hi Ben,
>
> I seem to recall people on this list doing similar things in the past with
> their own external code.  Does anyone still have their 2D radial profile
> code around anymore?
>
> Would it perhaps work to create a uniform grid dataset from an FRB array?
>
> Britton
>
> On Tue, Jan 13, 2015 at 12:49 PM, Ben Thompson <bthompson2090 at gmail.com>
> wrote:
>
>> Hello everyone.
>>
>> I was wondering if anyone has had experience with producing a profile
>> plot from a 2d projection object (FRB object).
>>
>> Essentially, what I am trying to do is plot the stellar surface density
>> of a galaxy as a function of radius.
>>
>> This is achieved by doing the following from a disk YT object called
>> cylinder (in which the origional simulation object is called shot)
>>
>> center = cylinder.get_field_parameter("center")
>> normal = cylinder.get_field_parameter("normal")
>> image_width = (100,"kpc")
>> three_image_width = YTArray((image_width[0], image_width[0],
>> image_width[0]),image_width[1])
>> left = center - image_width
>> right = center + image_width
>> region = shot.region(center, left, right)
>>
>> proj =
>> yt.ProjectionPlot(cylinder.ds,"z",[("deposit","stars_density")],center=center,width=image_width,data_source=region,axes_unit="kpc")
>>
>> the error arrises here
>>
>> prof =
>> yt.create_profile(proj,bin_fields="cylindrical_r",fields=[("deposit","stars_density")],n_bins=128,weight_field=None
>> )
>>
>> where I get the error
>>
>>
>> /gpfs/home/........./profiles.pyc in create_profile(data_source,
>> bin_fields, fields, n_bins, extrema, logs, units, weight_field,
>> accumulation, fractional)
>>    1304     else:
>>    1305         raise NotImplementedError
>> -> 1306     bin_fields = data_source._determine_fields(bin_fields)
>>    1307     fields = data_source._determine_fields(fields)
>>    1308     if units is not None:
>>
>> AttributeError: 'FixedResolutionBuffer' object has no attribute
>> '_determine_fields'
>>
>> Any ideas how to get around this error?
>>
>>
>> Also some other things to add as a postscript. Since how the projection
>> works, if I provide weights=None as a keyword argument within the
>> ProjectionPlot object, I get a surface density (g/cm^2). But also a
>> "cylindrical_r" in cm^2 as well. I *think* the way to get around this is to
>> do another projection where weights="ones", get the radius values out of
>> that profile.. and then in matplotlib, useing the surface density array
>> from the former profile, and the radius bin array from the latter...
>> Produce a plot of the surface density as a function of radius from those
>> two arrays (I might check by hand afterwards to see if this does the
>> trick). This seems kinda convoluted so I am wondering if there is an easier
>> way than this.
>>
>>
>>
>> _______________________________________________
>> 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/20150117/02017c52/attachment.htm>


More information about the yt-users mailing list