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

Cameron Hummels chummels at gmail.com
Tue Jun 2 14:14:45 PDT 2015


My script basically did this:

1) Make a projection (of a galaxy)
2) Identify a central point (ie the center of the galaxy i cared about)
3) Measure the projected distance from the central point to each pixel in
the projection.
4) Bin these projected pixels into radial bins
5) Take the median value of different projected fields for each radial bin
(e.g. column density, density-weighted temperature, etc.)
6) Plot up each of these fields as they vary for projected radius

If I were to do it again, I'd probably rely on the new FRB interface as it
seems cleaner.  And, it looks like it would better address what you're
trying to do right now.

Cameron

On Tue, Jun 2, 2015 at 1:57 PM, David Collins <dcollins4096 at gmail.com>
wrote:

>
>
>
>> Just to clarify, you want to make a phase plot of a projected object?  So
>> you want something like how column density varies with density-weighted
>> temperature in a 2D plot?  Or something like this?  I only ever did a
>> radial
>>
>
> That's exactly right.  I'll give the FRB a shot first.  Since the ultimate
> goal is comparison to the sky, FRB is probably just fine.
>
> How different was your code?
>
>
>
>> profile of projected fields (column density, or metal column density,
>> etc.), but I could try to help you put something together.  The FRB idea
>> suggested by John might be the easiest approach depending on what you want.
>>
>> On Tue, Jun 2, 2015 at 8:21 AM, David Collins <dcollins4096 at gmail.com>
>> wrote:
>>
>>> Hi, Everybody--
>>>
>>> This was discussed a while back, but I wanted to further clarify, and
>>> possibly mooch a script or two off y'all.
>>>
>>> I'd like a PhasePlot from a projected region.  Earlier FRBs were
>>> discussed; has anyone successfully done the same on a YTQuadTreeProj?  I'd
>>> like to retain all the high resolution data, if possible.
>>>
>>> Cameron, back in Jan you mentioned you had a script.  Did you manage to
>>> track it down, and/or would you be willing to send it my way?
>>>
>>> Thanks!
>>> d.
>>>
>>>
>>>
>>> On Fri, Jan 16, 2015 at 10:31 PM, John ZuHone <jzuhone at gmail.com> wrote:
>>>
>>>> This is a bit of a long way around, but you could write the FRB to a
>>>> FITS file and read it in as a dataset. You would get the coordinate system,
>>>> units, etc., and the whole YT machinery.
>>>>
>>>> Use the export_fits method:
>>>>
>>>> my_frb.export_fits("myfile.fits", fields)
>>>>
>>>> Then:
>>>>
>>>> ds = yt.load("my_file.fits")
>>>>
>>>> I'm not at a computer so I don't remember the exact signature, but it
>>>> should be in the code and you can check using help(my_frb.export_fits). If
>>>> you're interested I can write back with more info later.
>>>>
>>>> The other advantage of this is that you can store the data to disk.
>>>> You'll have to install the AstroPy package.
>>>>
>>>> Kavli Center for Astrophysics and Space Research
>>>> Massachusetts Institute of Technology
>>>> 77 Massachusetts Ave., 37-582G
>>>> Cambridge, MA 02139
>>>> (w) 617-253-2354
>>>> (m) 781-708-5004
>>>> jzuhone at space.mit.edu
>>>> jzuhone at gmail.com
>>>> http://www.jzuhone.com
>>>>
>>>> On Jan 16, 2015, at 8:34 PM, Ben Thompson <bthompson2090 at gmail.com>
>>>> wrote:
>>>>
>>>> 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
>>>>>
>>>>> _______________________________________________
>>>> 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
>>>>
>>>>
>>>
>>>
>>> --
>>> -- Sent from a computer.
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>>
>> --
>> Cameron Hummels
>> Postdoctoral Researcher
>> Steward Observatory
>> University of Arizona
>> http://chummels.org
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
>
> --
> -- Sent from a computer.
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>


-- 
Cameron Hummels
Postdoctoral Researcher
Steward Observatory
University of Arizona
http://chummels.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150602/aa528a6a/attachment.html>


More information about the yt-users mailing list