[yt-users] Camera/Off Axis Options

Suoqing Ji suoqing at physics.ucsb.edu
Mon May 2 13:42:32 PDT 2016


Hi Sushil,

What you can do currently is to get the data from fixed resolution buffer and make the plot with quiver callback in matplotlib. The following is a basic draft for this:

L = [1, -1, 0]
north_vector = [0, 0, 1]
slc = yt.OffAxisSlicePlot(ds, L, 'cutting_plane_velocity_x', center=[0,0,0], width=(180,'km'), north_vector=north_vector)

# Now get the fixed resolution buffer
vel = slc._frb['velocity_magnitude’]
U = slc._frb['cutting_plane_velocity_x']
V = slc._frb['cutting_plane_velocity_y']

extentx = [slc.xlim[i].in_units('km') for i in (0, 1)]
extenty = [slc.ylim[i].in_units('km') for i in (0, 1)]
extent = extentx + extenty

x = np.linspace(extentx[0], extentx[1], vel.shape[0])
y = np.linspace(extenty[1], extenty[0], vel.shape[1])

X, Y = np.meshgrid(x, y)

normalize = True
if normalize is True:
	N = np.sqrt(U**2+V**2)
	U /= N
	V /= N

norm = matplotlib.colors.LogNorm(vmin=vel.min(), vmax=vel.max())
factor = 40

plt.quiver(X[::factor, ::factor], Y[::factor, ::factor], U[::factor, ::factor], V[::factor, ::factor])
plt.imshow(vel.d, extent=extent, norm=norm)
plt.colorbar()
plt.savefig('quiver_plot.png')

Best wishes,
--
Suoqing JI
Ph.D Candidate
Department of Physics
University of California, Santa Barbara
http://web.physics.ucsb.edu/~suoqing

> On Apr 30, 2016, at 4:04 PM, Sushilkumar <sushil.sush19us at gmail.com> wrote:
> 
> Dear Suoqing Ji:
> 
> Thanks. In the meanwhile can you suggest any alternate function/method in yt that  I can use for my vector plots? 
> 
> I also have a 3d (streamlines_t000.png) and 2d streamline plot (UniformGridData_Slice_y_field_x_t000.png), which needs to treated in the same way. Can you suggest any approach for these plots?
> 
> Drive link:
> https://drive.google.com/open?id=0B4g8shg4DL7oak5PLWVVdG5UMHc <https://drive.google.com/open?id=0B4g8shg4DL7oak5PLWVVdG5UMHc>
> 
> 
> Thanks in advance
> 
> 
> 
> On Sat, Apr 30, 2016 at 12:56 PM, <yt-users-request at lists.spacepope.org <mailto:yt-users-request at lists.spacepope.org>> wrote:
> Send yt-users mailing list submissions to
>         yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
> or, via email, send a message with subject or body 'help' to
>         yt-users-request at lists.spacepope.org <mailto:yt-users-request at lists.spacepope.org>
> 
> You can reach the person managing the list at
>         yt-users-owner at lists.spacepope.org <mailto:yt-users-owner at lists.spacepope.org>
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of yt-users digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: Camera/Off Axis Options (Suoqing Ji)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 29 Apr 2016 12:35:04 -0700
> From: Suoqing Ji <suoqing at physics.ucsb.edu <mailto:suoqing at physics.ucsb.edu>>
> To: Discussion of the yt analysis package
>         <yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>>
> Subject: Re: [yt-users] Camera/Off Axis Options
> Message-ID: <9D6F4AE6-F3EF-4A4B-A997-32ACA9688E78 at physics.ucsb.edu <mailto:9D6F4AE6-F3EF-4A4B-A997-32ACA9688E78 at physics.ucsb.edu>>
> Content-Type: text/plain; charset="us-ascii"
> 
> Hi Sushil,
> 
> I was able to reproduce your error and created an issue here: https://bitbucket.org/yt_analysis/yt/issues/1214/vector-annotation-of-off-axis-plot <https://bitbucket.org/yt_analysis/yt/issues/1214/vector-annotation-of-off-axis-plot> <https://bitbucket.org/yt_analysis/yt/issues/1214/vector-annotation-of-off-axis-plot <https://bitbucket.org/yt_analysis/yt/issues/1214/vector-annotation-of-off-axis-plot>>
> 
> Best wishes,
> --
> Suoqing JI
> Ph.D Candidate
> Department of Physics
> University of California, Santa Barbara
> http://web.physics.ucsb.edu/~suoqing <http://web.physics.ucsb.edu/~suoqing>
> 
> > On Apr 28, 2016, at 7:17 PM, Sushilkumar <sushil.sush19us at gmail.com <mailto:sushil.sush19us at gmail.com>> wrote:
> >
> > Dear Suoqing Ji:
> >
> > With a combination of center [0,0,0] and adjusting the width w, I was able to eliminate all the warnings mentioned earlier. But the off axis slice plots still wont give me a desired result.
> >
> > Plot available on the drive below below.
> >
> > The two plots L(010),N(0,0,1).png and L(101),N(001).png are plotted for x-z plane and viewing angle of 45 degrees but both are drastically different from each other. In fact the off axis slice plots (L(101),N(001).png) is not in the x-z plane either.
> >
> > I am aiming for a plot similar to vector_rotate.png which is same as vector_original.png but rotated/viewed at an angle.
> >
> > The vector_rotate.png was created using the python image library. I was hoping if yt has any similar options with off axis which would tilt the vector plots and fill all the vector grids (which cannot be done using PIL).
> >
> > The script (yt_velocity_fields.py) and sample data file (Expl_Bt101.mtx.tar.gz) is available on drive link for your reference.
> >
> > Thanks in advance and my sincere apologies for repeated queries. But this is extremely critical in reproducing my result and putting it for publication.
> >
> > https://drive.google.com/open?id=0B4g8shg4DL7oak5PLWVVdG5UMHc <https://drive.google.com/open?id=0B4g8shg4DL7oak5PLWVVdG5UMHc> <https://drive.google.com/open?id=0B4g8shg4DL7oak5PLWVVdG5UMHc <https://drive.google.com/open?id=0B4g8shg4DL7oak5PLWVVdG5UMHc>>
> >
> >
> >
> >
> >
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160429/cf49a1ce/attachment.html <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160429/cf49a1ce/attachment.html>>
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
> 
> 
> ------------------------------
> 
> End of yt-users Digest, Vol 98, Issue 43
> ****************************************
> 
> 
> 
> -- 
> SK2
> 
> "Claiming that something can move faster than light is a good conversation-stopper in physics. People edge away from you in cocktail parties; friends never return phone calls. You just don’t mess with Albert Einstein."
> 
> _______________________________________________
> 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/20160502/953460d9/attachment.htm>


More information about the yt-users mailing list