[yt-users] psf convolution

Charles Hansen chansen at astro.berkeley.edu
Fri Feb 25 15:17:21 PST 2011


Thanks Dave and Matt,

I got my convolution working without too much effort once I found the 
plot.image.set_data function.  The general strategy is

ConvolvedData = ConvolutionFunction(plot.image._A.data, psf stuff)
plot.image.set_data(ConvolvedData)

Finding the 2nd line was my problem.  This way I can modify the data 
before it gets to pixel space.  There are no examples in the 
documentation that modify the image data like this, but it seems pretty 
powerful.

Charles


On 2/24/2011 4:28 PM, David Collins 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
>>
>
>




More information about the yt-users mailing list