[yt-users] psf convolution

Matthew Turk matthewturk at gmail.com
Fri Feb 25 13:00:41 PST 2011


Hi Charles,

I think Dave's right, you should subclass PlotCallback, add it to:

yt/visualization/plot_modifications.py

and then give it an appropriate name.  I think this would be a great
addition to the code base; I agree, it is important to have functions
like this available.  I'd recommend you fork the yt repo at

http://hg.enzotools.org/yt/fork

and then make these changes.  Then you can issue a pull request, and
we'll incorporate them into the main repository.  The BitBucket site
(which you can log into with a Google Account) has more info about how
to set up your hg username, but if you have a yt install you already
have mercurial, so it should be pretty easy.

Thanks!

Matt

On Thu, Feb 24, 2011 at 7:28 PM, David Collins
<dcollins at physics.ucsd.edu> wrote:
> Hi, Charles--
>
> I think you want to write a new callback.  Check out what's done in
> yt/visualizations/plot_modifications.py.  (raven/PlotCallbacks if
> you're not o yt2.0) Basically, you:
>
> 1.) Subclass PlotCallback
> 2.) Give it a _type_name
> 3.) it needs an __init__ with whatever args you want
> 4.) it needs a __call__ that takes (self, plot).  This does the work
> 5.) Most everything you need is hung off  plot.image and plot._axis.
> There are a ton of good examples in the file I mentioned above
> 6.) You can add the callback by doing
>>>> ploot= pc.add_projection(whatevz)
>>>> ploot.modify['ConvolveCharles']()
> (this might require registering your callback somewhere, I can't remember)
>
> From there, make sure your convolution is done before other callbacks,
> and you're set.
>
> The MarkerAnnotateCallback is a good one to look at for callback syntax.
>
> d.
>
> On Thu, Feb 24, 2011 at 4:02 PM, Charles Hansen
> <chansen at astro.berkeley.edu> wrote:
>> Does anyone know a way to convolve a yt image (preferably pc.add_projection)
>> with a telescope psf?  This would be useful for simulated observations.  At
>> the moment, the best I can do is make an image in yt and then convolve that
>> image in pixel space, but this ends up blurring out things I do not want
>> blurred (like particle markers, or velocity arrows).  The psf does not need
>> to be fancy, I just want a 2D gaussian with an adjustable width.
>>
>> Ideally, there would be a call
>> pc.add_projection("Density", 0, psf_width = 1.5e13)
>> #create a projection with a psf width of 1 AU at the observed distance
>>
>> Charles
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>
>
>
> --
> Sent from my Stone Tablet and carried by my Pterodactyl.
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list