Plot routines for a MCMax3D Model

This module provides routines to plot the output of a MCMax3D model. This is just a starting point, things are likely to change significantly in the future.

Usage example

The following example reads an MCMax3D model from the current working directory and makes a plot. (more precisely a matplotlib figure). The easiest way to test this is a Jupyter notebook

import mcmax3dpy.read as mread

model=mread.read(modelDir=".",outDir="output")

fig=mplot.plot_cuts_zones(model.zones,"temp",rlim=25,vlim=[3,3500])

Source documentation

Created on 15 Nov 2017

@author: rab

mcmax3dpy.plot.scale_figs(scale)[source]

Scale the figure size from matplotlibrc by the factors given in the array scale the first element is for the width the second for the heigth.

mcmax3dpy.plot.plog(array)[source]

Just a utilty function to avoid error-messages when taking the log of an arry

mcmax3dpy.plot.plot_cuts_zones(zones, fieldname, centerZoneIdx=None, vlim=[None, None], vlabel=None, clevels=None, patches=None, rlim=None, ip=0, patchesAzimuthal=None, patchesVertical=None, species=None, plotGrid=False, **kwargs)[source]

Plots the xz (rtheta) and the xy (rphi) planes considering all zones.

Currently the vertical cut (rphi) is made a phi=0 and phi=pi. But this is done for all zones.

TODO: Check if phi=0 is the same in all zones (relative to each other). TODO: provide parameters for the cuts (e.g. not a phi=0). TODO: Currently value is always plotted on a logscale

Parameters:
  • zones (array_like(ndim=1)) – A list of the zones that should be plotted.
  • fieldname (string) – The data (3D structure) the should be printed (e.g. “temp”, “chi”, “rhod”). For details see mcmax3dpy.read.Zone
  • centerZoneIdx (int) – Center the figure to the center of the zone with centerZoneIdx. DEFAULT: None
  • vlim (array_like(ndim=1)) – The range vlim=[vmin,vmax] for the values (also used for the colorbar). DEFAULT: [None,None]
  • rlim (float) – The maximum “radius” around the center that should be shown. However, the plot is of course squared. But this is usefull to zoom in on the center.
mcmax3dpy.plot.plot_midplane_zones(zones, fieldname, centerZoneIdx=None, vlim=[None, None], vlabel=None, clevels=None, patches=None, rlim=None, patchesAzimuthal=None, species=None, plotGrid=False, **kwargs)[source]

Plots the the xy (rphi) planes considering all zones.

TODO: Currently value is always plotted on a logscale

Parameters:
  • zones (array_like(ndim=1)) – A list of the zones that should be plotted.
  • fieldname (string) – The data (3D structure) the should be printed (e.g. “temp”, “chi”, “rhod”). For details see mcmax3dpy.read.Zone
  • centerZoneIdx (int) – Center the figure to the center of the zone with centerZoneIdx. DEFAULT: None
  • vlim (array_like(ndim=1)) – The range vlim=[vmin,vmax] for the values (also used for the colorbar). DEFAULT: [None,None]
  • rlim (float) – The maximum “radius” around the center that should be shown. However, the plot is of course squared. But this is usefull to zoom in on the center.
mcmax3dpy.plot.plot_sd(zones, **kwargs)[source]

Plots the surfacedensity of the Zones.

mcmax3dpy.plot.plot_radial_zone(zone, field, ylabel, ip=0, ylim=[None, None])[source]

Plot a quantity in the midplane as function of radius for a single zone.

Parameters:ip (array_like(int), or int) – index of phi coordinate to plot. if array_like the radial plot is done for all given ips.
mcmax3dpy.plot.plot_sed(model, MC=True, RT=True, RTIdx=0, full=True, zones=True, zonesIdx=None, stars=True, starsIdx=None, **kwargs)[source]

Plots the SED of the model.

Parameters:
  • model (mcmax3dpy.read.DataMCMax3D) – The MCMax3D model
  • zonesIdx (array_like(int,ndim=1)) – Indices of the zones to plot (starting from zero).
  • RTIdx (int) – which RT spectrum should be plotted (useful if there are more than one. Default: 0
mcmax3dpy.plot.plot_image(image, field='I', vlims=None, extend=None, projection='wcs', xlims=None, ylims=None, vlog=True, xlabel='RA', ylabel='Dec', cblabel=None, pa=None, powerNormGamma=None, showGrid=False, **kwargs)[source]

Plots a single image produce by MCMax3D.

Parameters:
  • image (fits hdu) – something that is similar to what comes aut from method:image.prep_image
  • coords (str) – wcs use the wcs coordinate system for plotting wcsrelative use the wcs coordinate system put relative to the center pixel use the pixelcoordinate system clas:astropy.wcs.WCS directly use this object
  • field (str) – can be either I, Q, U or PI, Qphi,Uphi . Default is I If field == ALL a 3 times 2 plot grid is shown,