Skip to content

Pre made plotting routines

kostahoraites edited this page Aug 14, 2022 · 19 revisions

General guidelines

A number of plotting routines are to be found within the pt.plot module. They have a number of user-definable options which can be set on the command line. Help for these routines is available on the command line by typing e.g. pt.plot.plot_colormap?

plot_colormap

This is the basic 2-dimensional data plotting routine. Detailed instructions for plot_colormap. Sample use:

pt.plot.plot_colormap(filename='/path/to/file/bulk.0001234.vlsv', var='proton/vg_rho', draw=1)

Detailed example:

import pytools as pt

# Defining source and output file locations
run = 'BCH'
dim = '2D'
bulk = 'bulk'
bulkLocation = '/wrk/group/spacephysics/vlasiator/{}/{}/bulk/'.format(dim, run)
fluxLocation = '/wrk/group/spacephysics/vlasiator/{}/{}/flux/'.format(dim, run)
outputLocation = './'

j = 4000            # time step
bulkname = '{}.{}.vlsv'.format(bulk,str(j).zfill(7))       # Bulk file name

pt.plot.plot_colormap(filename=bulkLocation+bulkname,var='Temperature',boxre=[-7,13,-10,10],run=run,colormap='hot_desaturated',vmin=5e5,vmax=5e8,step=j,outputdir=outputLocation,outputfile='test_colormap_{}_{}.png'.format(run,j),fluxdir=fluxLocation,fluxlines=6,Earth=1)

test_colormap_BCH_4000

plot_colormap3dslice

This is an extension of plot_colormap, used to plot two-dimensional slices of 3D AMR data. Detailed instructions for plot_colormap3dslice. Sample use:

pt.plot.plot_colormap3dslice(filename='/path/to/file/bulk.0001234.vlsv', var='proton/vg_rho', draw=1, normal='y')

Detailed example:

import pytools as pt

# Defining source and output file locations
run = 'EGL'
dim = '3D'
bulk = 'bulk1.egl'
bulkLocation = '/wrk/group/spacephysics/vlasiator/{}/{}/bulk/'.format(dim, run)
fluxLocation = '/wrk/group/spacephysics/vlasiator/{}/{}/flux/'.format(dim, run)
outputLocation = './'

#plot paramteers
normal = 'y'              # x-z plot
cutpoint = 0              # y=0 plane
streamlines = 'vg_b_vol'  # overplot magnetic field
j=800
bulkname = '{}.{}.vlsv'.format(bulk,str(j).zfill(7))       # Bulk file name


pt.plot.plot_colormap3dslice(filename=bulkLocation+bulkname,var='proton/vg_rho', boxre=[-15,15,-15,15], normal =normal, run=run,colormap='plasma',vmin=5e5,vmax=2e7,step=j,outputdir=outputLocation,outputfile='test_colormap_3dslice_rho_{}eq{}_{}_{}.png'.format(normal,cutpoint, run, j), Earth=1, streamlines = streamlines, cutpointre=cutpoint)

test_colormap_3dslice_rho_yeq0_EGL_800

plot_vdf

This routine plots slices or projections of a 3V velocity distribution function. Detailed instructions for plot_vdf. Sample use:

pt.plot.plot_colormap(filename='/path/to/file/bulk.0001234.vlsv', cellid=[1], xy=1)

plot_vdf_profiles

This routine plots line profile cuts across a 3V velocity distribution function.

Clone this wiki locally