Viewing the Data

class pyPLUTO.Image

This Class has all the routines for the imaging the data and plotting various contours and fieldlines on these images. CALLED AFTER pyPLUTO.pload object is defined

field_interp(var1, var2, x, y, dx, dy, xp, yp)

This method interpolates value of vector fields (var1 and var2) on field points (xp and yp). The field points are obtained from the method field_line.

Inputs:

var1 – 2D Vector field in X direction

var2 – 2D Vector field in Y direction

x – 1D X array

y – 1D Y array

dx – 1D grid spacing array in X direction

dy – 1D grid spacing array in Y direction

xp – field point in X direction

yp – field point in Y direction

Outputs:

A list with 2 elements where the first element corresponds to the interpolate field point in ‘x’ direction and the second element is the field point in ‘y’ direction.
field_line(var1, var2, x, y, dx, dy, x0, y0)

This method is used to obtain field lines (same as fieldline.pro in PLUTO IDL tools).

Inputs:

var1 – 2D Vector field in X direction

var2 – 2D Vector field in Y direction

x – 1D X array

y – 1D Y array

dx – 1D grid spacing array in X direction

dy – 1D grid spacing array in Y direction

x0 – foot point of the field line in X direction

y0 – foot point of the field line in Y direction

Outputs:

This routine returns a dictionary with keys -

qx – list of the field points along the ‘x’ direction. qy – list of the field points along the ‘y’ direction.

Usage:

See the myfieldlines routine for the same.
getSphData(Data, w_dir=None, datatype=None, **kwargs)

This method transforms the vector and scalar fields from Spherical co-ordinates to Cylindrical.

Inputs:

Data – pyPLUTO.pload object

w_dir – /path/to/the/working/directory/

datatype – If the data is of ‘float’ type then datatype = ‘float’ else by default the datatype is set to ‘double’.

Optional Keywords:

rphi – [Default] is set to False implies that the r-theta plane is transformed. If set True then the r-phi plane is transformed.

x2cut – Applicable for 3D data and it determines the co-ordinate of the x2 plane while r-phi is set to True.

x3cut – Applicable for 3D data and it determines the co-ordinate of the x3 plane while r-phi is set to False.

myfieldlines(Data, x0arr, y0arr, stream=False, **kwargs)

This method overplots the magnetic field lines at the footpoints given by (x0arr[i],y0arr[i]).

Inputs:

Data – pyPLUTO.pload object

x0arr – array of x co-ordinates of the footpoints

y0arr – array of y co-ordinates of the footpoints

stream – keyword for two different ways of calculating the field lines.

True – plots contours of rAphi (needs to store vector potential)

False – plots the fieldlines obtained from the field_line routine. (Default option)

Optional Keywords:

colors – A list of matplotlib colors to represent the lines. The length of this list should be same as that of x0arr.

lw – Integer value that determines the linewidth of each line.

ls – Determines the linestyle of each line.

Usage:

Assume that the magnetic field is a given as B = B0$hat{y}$. Then to show this field lines we have to define the x and y arrays of field foot points.

x0arr = linspace(0.0,10.0,20)

y0arr = linspace(0.0,0.0,20)

import pyPLUTO as pp

D = pp.pload(45)

I = pp.Image()

I.myfieldlines(D,x0arr,y0arr,colors='k',ls='--',lw=1.0)

pldisplay(var, **kwargs)

This method allows the user to display a 2D data using the matplotlib’s pcolormesh.

Inputs:

var – 2D array that needs to be displayed.

Required Keywords:

x1 – The ‘x’ array

x2 – The ‘y’ array

Optional Keywords:

vmin – The minimum value of the 2D array (Default : min(var))

vmax – The maximum value of the 2D array (Default : max(var))

title – Sets the title of the image.

label1 – Sets the X Label (Default: ‘XLabel’)

label2 – Sets the Y Label (Default: ‘YLabel’)

cbar – Its a tuple to set the colorbar on or off.

cbar = (True,’vertical’) – Displays a vertical colorbar

cbar = (True,’horizontal’) – Displays a horizontal colorbar

cbar = (False,’‘) – Displays no colorbar.

Usage:

import pyPLUTO as pp

wdir = '/path/to/the data files/'

D = pp.pload(1,w_dir=wdir)

I = pp.Image()

f1 = figure()

ax1 = f1.add_subplot(111)

I.pldisplay(D.v2,x1=D.x1,x2=D.x2,cbar=(True,'vertical'),title='Velocity',label1='Radius',label2='Height')

pltSphData(Data, w_dir=None, datatype=None, **kwargs)

This method plots the transformed data obtained from getSphData using the matplotlib’s imshow

Inputs:

Data – pyPLUTO.pload object

w_dir – /path/to/the/working/directory/

datatype – If the data is of ‘float’ type then datatype = ‘float’ else by default the datatype is set to ‘double’.

Required Keywords:

plvar – A string which represents the plot variable.

Optional Keywords:

logvar – [Default = False] Set it True for plotting the log of a variable. rphi – [Default = False - for plotting in r-theta plane] Set it True for plotting the variable in r-phi plane.

Previous topic

Loading the Data

Next topic

Additional tools

This Page