Plotting routines for a single model

Collections of plotting routines for ProDiMo model output. All the routines use matplotlib. Typically the output is a pdf file.

Usage example

# the prodimopy modules for reading and plotting
import prodimopy.read as pread
import prodimopy.plot as pplot
# this is for the PDF output
from matplotlib.backends.backend_pdf import PdfPages

# Load the default prodimopy style
pplot.load_style()


# read the model from the current directory
model=pread.read_prodimo()

# Create an out.pdf where all the various plots are stored
with PdfPages("out.pdf") as pdf:
   # create a prodimo Plot object for the various plotting routines
   pp=pplot.Plot(pdf)
   # vertical hydrogen number density
   pp.plot_NH(model,ylim=[1.e20,None])
   # a generic contour plot routine with many options
   pp.plot_cont(model, model.nHtot, r"$\mathsf{n_{<H>} [cm^{-3}]}$",
                zlim=[1.e4,None],extend="both")

   # Here follows an example for a more complex contour plot, showing
   # some of the plenty options of this routine

   # Define some additional contours, with also showing labels
   # as the automatic positioning of labels does not work very well,
   # you likely have to tweak the label locations (see next line)
   tcont=pplot.Contour(model.td, [20,100,1000], linestyles=["-","--",":"],
                      showlabels=True,label_fontsize=10,label_fmt="%.0f")
   #tcont.label_locations=[(100,100),(55,5),(40,5)]

   # another contour, a simple one
   avcont=pplot.Contour(model.AV,[1.0],colors="black")

   # define the ticks shown in the colorbar
   cbticks=[10,30,100,300,1000]
   pp.plot_cont(model, model.td, r"$\mathrm{T_{dust}\,[K]}$",zr=True,xlog=True,
                ylim=[0,0.5], zlim=[5,1500],extend="both",
                oconts=[tcont,avcont],   # here the addtional contour added
                contour=False,           # switch of the standard contours
                clevels=cbticks,         # explictly set ticks for the cbar
                clabels=map(str,cbticks),# and make some nice labels
                cb_format="%.0f")

Source documentation

prodimopy.plot.Plot(pdf[, fs_legend, title])

Plot routines for a single ProDiMo model.

prodimopy.plot.Contour(field, levels[, ...])

Define a Contour that can be used in the contour plotting routines.

prodimopy.plot.load_style([style])

Simple utility function to load a matplotlib style

class prodimopy.plot.Plot(pdf, fs_legend=None, title=None)[source]

Plot routines for a single ProDiMo model.

plot_grid(model, zr=False, ax=None, **kwargs)[source]

Plots the spatial grid.

Also all the standard parameter like xlim, ylim etc. can be used.

Parameters:
  • model (Data_ProDiMo) – the model data

  • zr (boolean) – show the height z as z/r (scaled by the radius)

plot_NH(model, sdscale=False, muH=None, marker=None, ax=None, **kwargs)[source]

Plots the total vertical hydrogen column number density as a function of radius.

Parameters:
  • model (Data_ProDiMo) – the model data

  • sdscale (boolean) – show additionally a scale with units in g cm-2

Returns:

object if self.pdf is None the Figure object is reqturned, otherwise otherwise the plot is written directly into the pdf object(file) and None is returned.

Return type:

Figure or None

plot_cont_dion(model, zr=True, oconts=None, ax=None, **kwargs)[source]

plot routine for 2D contour plots. plots the regions where either X-rays, CR or SP are the dominant H2 ionization source

plot_cont(model, values, label='value', zlog=True, grid=False, zlim=[None, None], zr=True, cmap=None, clevels=None, clabels=None, contour=True, extend='neither', oconts=None, acont=None, acontl=None, nbins=70, bgcolor=None, cb_format='%.1f', scalexy=[1, 1], patches=None, rasterized=False, returnFig=False, fig=None, ax=None, movie=False, **kwargs)[source]

Plot routine for 2D filled contour plots.

If an ax object is passed to this routine, it is use use to do the plotting. This is especially useful if you want to use that routine together with subplots (e.g. a grid of plots). See for example plot_abuncont_grid().

Parameters:
  • model (Data_ProDiMo) – the model data

  • values (array_like(float,ndim=2)) – a 2D array with numeric values for the plotting. E.g. any 2D array of the Data_ProDiMo object.

  • label (str) – The label for the colorbar (color scale). Default: value Should be the quqntity and unit of the field that is shown.

  • zlog (boolean) – Using log scaling for the values. Default: True

  • grid (boolean) – Use the grid (ix,iz) as spatial coordinates. Default: False

  • zlim (array_like(float,ndim=2)) – The minimum and maximum values for the color scale. Default: [None,None]

  • zr (boolean) – Use z/r as the spatial coordinate for the y-axis. Default: True

  • cmap (str or matplotlib.colors.Colormap) – this is simply passed on to the contourf routine of matplotlib see matplotlib.pyplot.contourf() for detail

  • clevels (array_like(float,ndim=1)) – The contour levels to plot. Default: None This will also set the labels shown in the colour bar. If None the levels are determined by the MaxNLocator routine and will be 6.

  • clabels (array_like(str,ndim=1)) – Overwrite the labels for the colorbar. Default: None

  • contour (boolean) – Show contour lines for the clevels. Default: True

  • extend (str) – The extend of the colorbar. Default: neither (see matplotlib.pyplot.colorbar())

  • oconts (array_like(Contour,ndim=1)) – list of Contour objects which will be drawn as additional contour levels. See also the example at the top of the page.

  • acont (array_like(float,ndim=2)) – Should not be used anymore. Default: None Use oconts instead.

  • acontl (array_like(float,ndim=1)) – Should not be used anymore. Default: None

  • nbins (int) – The number of bins for the color scale. Default: 70

  • bgcolor (str) – The background color of the plot. Default: None Can be useful to set the background color in the plot to black for example.

  • cb_format (str) – The format string for the colorbar labels. Default: %.1f

  • scalexy (array_like(float,ndim=1)) – A scaling factor (multiplicative) for the x and y coordinates. Default: [1,1] W.g. plot in 1000 of au instead of au.

  • ax (matplotlib.axes.Axes) – a matplotlib axis object which will be used for plotting

  • patches (array_like(matplotlib.patches.Patch,ndim=1)) – a list of patches objects. For each object in the list, simply ax.add_patch() is called (at the very end of the routine)

  • movie (boolean) – Special mode for movies …

Todo

  • Option for passing a norm (:class:matplotlib.colors.LogNorm). But that does not work nicely with contourf and colorbars … works with imshow and pcolormesh though … maybe switch to pcolormesh.

streamplot_overlay(model, axes, resolution=0.1, streamprops={})[source]

Creates a streamplot using the plt.streamplot routine from for the vx and vz velocity components of the model. Is plotted on top of the passed axes object (e.g. from a contour plot). Please note for a “normal” ProDiMo model the vx and vz components are zero and so nothing will be plotted.

Parameters:
  • model (Data_ProDiMo) – The ProDiMo model data.

  • axes (matplotlib.axes.Axes) – The axes object on which the streamplot should be plotted.

  • resolution (float) – The resolution of the regular grid on which the velocity components are interpolated. Unit: au. Default: 0.1

  • streamprops (dict) – A dictionary with properties for the streamplot. This is passed on to the streamplot routine of matplotlib. Default: {}

plot_abuncont(model, species='O', rel2H=True, label=None, zlog=True, zlim=[None, None], zr=True, cmap=None, clevels=None, clabels=None, contour=True, extend='neither', oconts=None, acont=None, acontl=None, nbins=70, bgcolor=None, cb_format='%.1f', scalexy=[1, 1], patches=None, rasterized=False, ax=None, movie=False, **kwargs)[source]

Plots the 2D abundance structure of a species.

This is a convenience function and is simply a wrapper for plot_cont() routine.

The routine checks if the species exists, calculates the abundance and sets some defaults (e.g. label) for the plot_cont() routine and calls it. However, all the defaults can be overwritten by providing the corresponding parameter.

Contributors: L. Klarmann, Ch. Rab

Todo

can be improved with better and smarter default values (e.g. for the colorbar)

Parameters:
  • model (prodimopy.read.Data_ProDiMo) – the model data

  • species (str) – the name of the species as given in ProDiMo

  • rel2H (boolean) – plot abundances relative to the total H nuclei number density. If False the number density of the species is plotted

  • label (str) – the label for the colorbar. If None the default is plotted

For all other parameters see plot_cont()

plot_abuncont_grid(model, speciesList=['e-', 'H2', 'CO', 'H2O'], nrows=2, ncols=2, rel2H=True, label=None, zlog=True, zlim=[None, None], zr=True, cmap=None, clevels=None, clabels=None, contour=True, extend='neither', oconts=None, acont=None, acontl=None, nbins=70, bgcolor=None, cb_format='%.1f', scalexy=[1, 1], patches=None, rasterized=False, **kwargs)[source]

Convenience routine to plot a grid of abundance plots in the same way as plot_abuncont().

The number of plots is given by nrows times ncols and should be equal to the number of species in speciesList

Parameters:
  • model (Data_ProDiMo) – the model data

  • speciesList (array_like(str,ndim=1) :) – a list of species names that should be plotted. The plots will be made in order of that list, starting from top left to the bottom right of the grid.

  • nrows (int) – how many rows should the subplots grid have.

  • ncols (in) – how many columns should teh subplots grid have.

  • zlim (array_like) – can either be of the form [zmin,zmax] ore a list of such entries ([zmin1,zmax1],[zmin1,zmax1], ….). For the latter the number of entries must be equal to the number of species.

For the other parameters see plot_abuncont()

plot_reaccont(model, chemana, rtype, level=1, showAbun=False, values=None, label=None, cmap=None, zlog=True, zlim=[None, None], clevels=None, clabels=None, contour=True, extend='neither', oconts=None, nbins=70, bgcolor=None, cb_format='%.1f', patches=None, rasterized=True, ax=None, **kwargs)[source]

Make a contour plot with the reactions numbers from chemanalyse on top. As spatial coordinates the indices of the spatial grid are used.

This is a convenience function and is simply a wrapper for plot_cont() routine.

The same can be achieved by simply using plot_cont and plot the numbers on top (see last part of this routine). Then one has more flexibility.

Parameters:
  • model (prodimopy.read.Data_ProDiMo) – the model data

  • chemana (class:prodimopy.read.Chemistry) – data resulting from prodimopy.read.analise_chemistry on a single species

  • rtype (str) – keyword which sets the type of reactions to be shown (destruction or formation) must be set to either ‘d’ (destruction) or ‘f’ (formation)

  • level (int) – 1 means most important, 2 second most important etc.

  • showAbun (boolean) – Show the abundances of the species that is analysed as filled contours.

  • values (array_like(float,ndim=2)) – a 2D array with numeric values for the plotting like in plot_cont(). Howver, it an also be None (default) in that case the total formation/destruction rate is plotted.

sfigsarray_like(float,ndim=2)

Is part of kwargs. But this one is relevant here as one might needs to make the figure larger to see the reactoins numbers. e.g. just pass sfigs=[2.,2.]

plot_line_origin(model, lineIdents, field, label='value', boxcolors=None, showBox=True, showRadialLines=True, showztauD1=True, boxlinewidths=1.5, boxlinestyles=None, boxhatches=None, lineLabels=None, showLineLabels=True, lineLabelsFontsize=6.0, lineLabelsAlign='left', showContOrigin=False, zlog=True, zlim=[None, None], zr=True, clevels=None, clabels=None, contour=False, extend='neither', oconts=None, nbins=70, bgcolor=None, cb_format='%.1f', scalexy=[1, 1], patches=None, rasterized=False, ax=None, **kwargs)[source]

Plots the line origins for a list of lineestimates given by their lineIdents ([“ident”,wavelength]).

Does not give the exact same results as the corresponding idl routines as we do not use interpolation here. We rather use the same method for calculating the averaged values over the emission area and for plotting this area.

Note most other parameters, especially for plotting styles (line widths), are also arrays/lists. Those lists should have the same lenght as the lineIdents list.

The routine uses plot_cont() for plotting, hence a number of parameters have the same meaning as in plot_cont. They are just passed through to plot_cont).

Parameters:
  • model (Data_ProDiMo) – the model data

  • lineIdents (array_like()) – list of line identifactor of the form [[“ident”,wl],[“ident2”,wl2]].

  • field (array_like(float,ndim=2)) – a 2D array with numeric values for the plotting. E.g. any 2D array of the Data_ProDiMo object.

  • boxcolors (array_like) – list of colors for the boxes for each line one wants to plot (should have the same number of entries as lineIdents). If not given the default colors are used.

  • showBox (boolean) – if True (default) the box for the emitting region for each line is shown.

  • showRadialLines (boolean) – if True (default) than two dotted lines are shown for the z15 and z85 values at each radius. This is the main line emitting layer at each radius.

  • showztauD1 (boolean) – show the z_level where taudust_ver=1 for each line. For detail of this quantity see DataLineEstimateRInfo

  • boxlinewidths (array_like) – the widths of the line for each box showing the line origin. Can be a scalar, in that case all boxes have the same linewidth.

  • boxlinestyles (array_like) – the line styles for the boxes (line emitting regions). Can be a scalar, in that case all boxes have the same linestyle.

  • boxhatches (array_like) – use hatching for the vertical line emitting regions. Only used if showRadialLines is True. Hatches are the ones from matplotlib (e.g. [“//”])

  • lineLabels (array_like) – list of labels for the lines. If not given the labels are generated from the lineIdents.

  • showLineLabels (boolean) – show the labels for the lines. Default: True.

  • lineLabelsFontsize (float) – fontsize for the line labels. Default: 6.0.

  • lineLabelsAlign (str) – alignment of the line labels. Default: left. Other options is right.

  • showContOrigin (boolean) – Also show the box for the continuum emitting regions (at the wavelength of the line). Default: False.

plot_ionrates_midplane(model, ax=None, **kwargs)[source]
plot_ionrates(model, r, ax=None, **kwargs)[source]
plot_avgabun(model, species, ax=None, **kwargs)[source]

Plots the average abundance for the given species (can be more than one) as a function of radius

plot_radial(model, values, ylabel, zidx=0, color=None, ax=None, **kwargs)[source]

Plots a quantity along the radial grid for the given zidx (from the ProDiMo Array) as a function of radius.

Parameters:
  • values (array_like(float,ndim=2) or array_like(float,ndim=2)) – values is any ProDiMo 2D array in the Data_ProDiMo object, or a 1D array with dim nx if zidx is None.

  • ylabel (str) – The lable for the y axis.

  • zidx (int) – The index of the z coordinate that should be plotted. If zidx is None the values array has to be 1D and needs to be filled with the proper values. Default: 0 (midplane)

  • color (str) – A matplotlib color for the line to plot. Default: None

  • ax (matplotlib.axes.Axes) – A matplotlib axes object that will be use to do the actual plotting. No new instance is created. Default: None (make a new figure and axes object).

plot_cdnmol(model, species, colors=None, styles=None, scalefacs=None, norm=None, normidx=None, ylabel='$\\mathrm{N_{ver}\\,[cm^{-2}}]$', patches=None, ax=None, **kwargs)[source]

Plots the vertical column densities as a function of radius for the given species.

Parameters:
  • model (prodimopy.read.Data_ProDiMo) – the ProDiMo model data.

  • species (array_like(str,ndim=1)) – a list of species names that should be plotted.

  • scalefacs (array_like(float,ndim=1)) – scale the column density to plot by the given factor. len(scalefacs) must be equal to len(species).

  • norm (float) – an abritary normalizatoin factor (i.e. allo column density are divided by norm)

  • normidx (int) – normalize the plotted column densities to the column density given by normidx. Where normidx is the index of any species in the list of species in the model. TODO: Could actually just use a species name, would be easier to use.

plot_midplane(model, field, ylabel, xRelTo=None, ax=None, **kwargs)[source]

Plots a quantitiy in in the midplane as a function of radius fieldname is any field in Data_ProDiMo

Parameters:

xRelTo (float) – use x-xRelTo as the x axis. Default: None (no shif)

FIXME: remove the fieldname stuff passe the whole array …

plot_reac_ixiz(ix, iz, rtype, chemanas, ages, chemana_steadystate=None, ax=None, **kwargs)[source]

Plots the rates for the most important reactions and the point ix,iz for the given models and chemanalysis list (i.e. a time-dependent ProDiMo disk model.

Parameters:
  • ix (int) – The ix index of the grid (starts at 0)

  • iz (int) – The iz index of the grid (starts at 0)

  • rtype (str) – f for formation reactions, d for destruction reactions.

  • models (list) – a list of prodimopy.read.Data_ProDiMo objects (e.g. for each age in a time-dependent model).

  • chemanas (list) – a list of prodimopy.read.Chemistry objects (e.g. for each age in a time-dependent model). Must have the same length as models

  • ages (array_like(float)) – a list of the ages for the time-dependent model. Most have the same lengh as models. This will be the x-Axis

  • chemana_steadystate (tuple) – A tuple (prodimopy.read.Data_ProDiMo, prodimopy.read.Chemistry) representing a steady state model. This is useful to compare the results with the time-dependent model. Optional parameter

plot_reac(model, chemistry, rtype, level=1, plot_size=10, lograte=True, grid=True, with_abun=False, vmin=None, **kwargs)[source]

Plots the 2D main formation/destruction reaction structure for a given species, in each grid point. Each number corresponds to the reaction indices in prodimo.read.chemistry.sorted_form_info or prodimo.read.chemistry.sorted_form_info

By default it is plotted along the 2D main formation/reaction rate structure, but it can also be plotted along the abundance of the species.

The routine checks if the reaction type is set plots the data (lograte, rate or abundance) as an image, and fills in the reaction indices for each grid point.

An index of 0 means that the total rate at that point was so low it didn’t get registered in chemanalysis.out (in ProDiMo)

Contributors: G. Chaparro, Ch. Rab

Warning

This routine is deprected please use plot_reaccont instead.

Parameters:
  • model (prodimopy.read.Data_ProDiMo) – the model data

  • chemistry (class:prodimopy.read.Chemistry) – data resulting from prodimopy.read.analise_chemistry on a single species

  • rtype (str) – keyword which sets the type of reactions to be shown (destruction or formation) must be set to either ‘d’ (destruction) or ‘f’ (formation)

  • level (int) – 1 means most important, 2 second most important etc.

  • plot_size (int) – plot size, it is set to square for now

  • lograte (bool) – plot log rate instead of rate, default to True (the difference are more noticeable)

  • grid (bool) – plot nx,ny instead of r, z, default to False

  • with_abun (bool) – plot abundance instead of formation or destruction rate, overrides lograte, default to False

  • vmin (float) – sets the minimum value for plt.imshow (abundance, rate or lograte) default min(array)

plot_abunvert(model, r, species, useZr=False, useNH=True, useT=False, scaling_fac=None, norm=None, styles=None, colors=None, markers=None, linewidths=None, ax=None, **kwargs)[source]

Plots the abundances of all the given species as a function of height at the given radius.

If useZr, useNH and useT are all False the abundances are plotted as function of z in au. By default useNH=True.

FIXME: Make the inferface consistent with plot_vert. Especially the treatment of the xaxis (i.e. what should be use to indicate the height)

Parameters:
  • model (prodimopy.read.Data_ProDiMo) – the model data

  • r (float) – The radius at which the vertical cut is taken. UNIT: au

  • species (array_like(str,ndim=1) :) – List of species names to plot.

  • useZr (boolean) – plot the abundances as function of z/r: Default: True

  • useNH (boolean) – plot the abundances as function of vertical column densities Default: False

  • useT (boolean) – plot the abundances as function of dust temperature.

plot_abunrad(model, species, useNH=True, norm=None, styles=None, colors=None, markers=None, linewidths=None, ax=None, **kwargs)[source]

Plots species abundances as function of radius in the midplane (z=0) Similar to abunvert but radially is more usefull for e.g. envelope structures.

Parameters:
  • model (prodimopy.read.Data_ProDiMo) – the model data

  • species (array_like(str,ndim=1) :) – List of species names to plot.

  • useNH (boolean) – plot the abundances as function of radial column densities Default: False

  • norm (float) – normalize the y values by the given number (i.e. y=y/norm) Default: None (i.e. no normalisation)

plot_abun_midp(model, species, norm=None, styles=None, colors=None, ax=None, **kwargs)[source]

Plots the abundances in the midplane for the given species (can be more than one)

Parameters:
  • model (prodimopy.read.Data_ProDiMo) – the model data

  • species (array_like(str,ndim=1) :) – List of species names to plot.

  • norm (float) – normalize the y values by the given number (i.e. y=y/norm) Default: None (i.e. no normalisation)

plot_dust_opac(model, dust=None, ax=None, pseudoaniso=False, **kwargs)[source]

Plots the dust opacities (dust_opac.out) or the data given in the dust object

Parameters:

pseudoaniso (boolean) – Use the pseudo anisotropic scattering opacity (Default: False).

plot_vertical(model, r, values, ylabel, zr=True, xfield='zr', marker=None, ax=None, **kwargs)[source]

Plots a quantity (values) as a function of height at a certain radius radius.

valuesarray_like(float,ndim=2)

a 2D array with numeric values for the plotting. E.g. any 2D array of the Data_ProDiMo object.

xfieldstr

What field should be used a x-axis. Options are zr,`NHver`,`tg`,`AVver` .

FIXME: Make the inferface consistent with plot_abunvert. Especially the treatment of the xaxis (i.e. what should be use to indicate the height)

plot_taus(model, r, ax=None, **kwargs)[source]

Plot’s taus (A_V, X-rays) as a function of vertical column density

plot_starspec(model, ax=None, step=10, xunit='micron', nuInu=True, **kwargs)[source]

Plots the full Stellar Spectrum

Parameters:
  • step (int) – only every step point is plotted from teh Spectrum (makes is less dens)

  • xunit (str) – the unit for the x-axes. Current options are micron or eV.

plot_sed(model, plot_starSpec=True, incidx=0, unit='erg', sedObs=None, reddening=False, ax=None, **kwargs)[source]

Plots the sed(s) including the stellar spectrum and observations (last two are optional).

Parameters:
  • model (Data_ProDiMo) – the model data. Only required if wl,ident and or lineObs are passed.

  • plot_starSpec (boolean) – also show the (unobscured) stellar spectrum. Default: True

  • incidx (int or array_like(ndim=1)) –

    which inclination (index) should be used for plotting (0 is the first one and default). If it is a single value only the profile for that inclination index is plotted.

    If it is an array of values all profiles for that chosen inclinations are plotted. If incidx=[] profiles for all inclinations will be plotted.

  • unit (str) – in what unit should the sed be plotted. Possible valuees: erg, W, Jy

  • sedObs (DataContinuumObs) – if sedObs (e.g. sedObs=model.sedOBS) is provided also the observational data is plotted. But in principal can be any object of type DataContinuumObs.

  • reddening (boolean) – Apply reddening. Only possible if sedObs is provided None.

plot_sedAna(model, lams=[1.0, 3.0, 6.0, 10.0, 30.0, 60.0, 100.0, 200.0, 1000.0], field=None, label=None, boxcolors=None, zlog=True, zlim=[None, None], zr=True, clevels=None, clabels=None, extend='neither', oconts=None, nbins=70, bgcolor=None, cb_format='%.1f', scalexy=[1, 1], patches=None, rasterized=False, ax=None, **kwargs)[source]

Plots the SED analysis stuff (origin of the emission).

Parameters:
  • model (prodimopy.read.Data_ProDiMo) – the ProDiMo model.

  • lams (array_like(float,ndim=1)) – list of wavelengths in micrometer.

  • field (array_like(float,ndim=2)) – And array with dimension (nx,nz) with values that should be plotted as filled contours. DEFAULT: the nHtot field of prodimopy.read.Data_ProDiMo.

plot_taulines(model, lineIdents, showCont=True, ax=None, **kwargs)[source]

Plots the line optical depth as a function of radius for the given lines. The lines are identified via a list of lineIdents containt of an array with ident and wavelength of the line e.g. [“CO”,1300.0]. It searches for the closest lines.

Parameters:
  • model (Data_ProDiMo) – the model data

  • lineIdents (array_like()) – list of line identifactors of the form [[“ident”,wl],[“ident2”,wl2]].

  • TODO (there are no options for linestyles and colors yet (the defaults are used).) –

plot_lineprofile(model=None, wl=None, ident=None, lineObj=None, linetxt=None, lineObs=None, incidx=0, unit='Jy', normalized=False, convolved=False, removecont=True, style=None, color=None, ax=None, **kwargs)[source]

Plots the line profile for the given line (id wavelength and optionally the line ident)

Parameters:
  • model (Data_ProDiMo) – the model data. Only required if wl,ident and or lineObs are passed.

  • wl (float) – The wavelength of the line in micrometer. Plotted is the line with the wavelength closest to wl.

  • ident (str) – The optional line ident which is additionally use to identify the line.

  • lineObj (DataLine) – Pass DataLine object. In that case wl and ident are ignored.

  • linetxt (str) – A string that is used as the label for the line.

  • lineObs (array_like(ndim=1)) – list of DataLineObs objects. Must be consistent with the list of lines from the line radiative transfer.

  • incidx (int or array_like(ndim=1)) –

    which inclination (index) should be used for plotting (0 is the first one and default). If it is a single value only the profile for that inclination index is plotted.

    If it is an array of values all profiles for that chosen inclinations are plotted. If normalized=True the profiles will be normalized to the first one, in that case. If incidx=[] profiles for all inclinations will be plotted.

    If lineObj is passed only one inclination (the one set in that obj) will be plotted.

  • unit (str) – In what unit should the line flux be plotted. Current options unit=”Jy” (default) and unit=”ErgAng”

  • normalized (boolean) – if True normalize the profile to the peak flux

  • convolved (boolean) – if True plot the convolved profile.

  • removecont (boolean) – if True remove the continuum from the profile. Default: True

  • color (str) – the color for the plotted profile.

  • style (str) – if style is step the profile is plotted as a step function assuming the values are the mid point of the bin.

plot_lines(model, lineIdents, useLineEstimate=True, jansky=False, showBoxes=True, lineObs=None, lineObsLabel='Obs.', peakFlux=False, showCont=False, xLabelGHz=False, showGrid=True, **kwargs)[source]

Plots a selection of lines or lineEstimates.

See plot_lines() for more details.

Parameters:
  • model (Data_ProDiMo) – the model data

  • lineIdents (array_like) – a list of line identifiers. Each entry should contain [“ident”,wl] (e.g. [“CO”,1300],[“CO”,800]]. Those values are passed to getLineEstimate(). The order of the lineIdents also defines the plotting order of the lines (from left to right)

plot_heat_cool(model, zr=True, oconts=None, showidx=(0, 0), **kwargs)[source]

Plots the dominant heating and cooling processes.

The initial python code for this routine is from Frank Backs

Parameters:
  • model (Data_ProDiMo) – the model data

  • zr (boolean) – use z/r for y axis Default: True

  • oconts (array_like(Contour,ndim=1)) – list of Contour objects which will be drawn contours (like in plot_cont().

  • showidx (tuple(ndim=1)) – Default is (0,0): will show the most dominant heating and cooling process. For example (1,1) will show the second most dominant heating and cooling process. For example (-1,-1) will show the least dominant heating and cooling process.

Todo

  • possibility to have different oconts for the heating and cooling figures

  • possibility to map certain heating/cooling processes always to the same color

plot_contImage(model, wl, zlim=[None, None], cmap='inferno', rlim=[None, None], cb_show=True, cb_fraction=0.15, ax=None, **kwargs)[source]

Simple plot for the continuum Images as produced by PRoDiMo. (The output in image.out).

The scale is fixed to LogNorm at the moment.

Parameters:
  • model (Data_ProDiMo) – The model data.

  • wl (float) – The wavelength in micron for which we should plot the image. The routine simple selected the closest one to the given image.

  • zlim (array_like(ndim=1)) – the min and max value for the data to plot. Optional.

  • rlim (array_like(ndim=1)) – the extension of the image eg. rlim[-1,1] plot the x and y coordinate from -1 to 1 au. Optional

  • cmap (str) – The name of a matplotlib colormap. Optional.

  • cb_show (boolean) – show colorbar or not. Optional.

  • cb_fraction (float) – fractoin of the image use for the colorbar. Useful for subplots. Optional

plot_sled(models, lineIdents, units='W', ax=None, title='SLED', **kwargs)[source]

Plots the Spectral Line Energy Distribution

Parameters:
  • models (list(Data_ProDiMo)) – or a single model the model(s) to plot

  • lineIdents (array_like) –

    a list of line identifiers. Examples

    lineIdents = [‘CO’]

    lineIdents = [‘CO’, ‘o-H2’, ‘p-H2O’]

  • units (str, optional) – In which units should be plotted. Allowed values: erg [erg/s/cm^2], W [W/m^2] default : W

Example

In the directory of the ProDiMo model

from matplotlib.backends.backend_pdf import PdfPages
import prodimopy.plot as pplot
import prodimopy.read as pread

outfile = "out_test.pdf"
model=pread.read_prodimo()

with PdfPages(outfile) as pdf:
  pp=pplot.Plot(pdf, title=model.name)
  pp.plot_sled(model, ["CO", "o-H2"])
class prodimopy.plot.Contour(field, levels, colors='white', linestyles='solid', linewidths=1.5, showlabels=False, label_locations=None, label_fmt='%.1f', label_fontsize=7, label_inline_spacing=5, filled=False)[source]

Define a Contour that can be used in the contour plotting routines.

Objects of this class can be passed to e.g. the plot_cont() routine and will be drawn their.

TODO: provide a field for label strings (arbitrary values) need to be the same size as levels

field

array_like(float,ndim=2): A 2D array of values used for the Contours. Needs to have the same dimensions as the array used for the contour plotting routine. So any 2D array of the prodimopy.read.Data_ProDiMo will do.

levels

array_like(float,ndim=1): list of values for which contour lines should be drawn.

colors

array_like(ndim=1): list of colors for the idividual contours. If only a single value is provided (i.e. no array) this value is applied to all contours. The values of colors can be given in the same way as it is done for matplotlib.

linestyles

array_like(ndim=1): linestyles for the contours. Works like the colors parameter. Any style that matplotlib understands will work.

linewidths

array_like(ndim=1): linewidths for the individual contour levels. Works the same as the colors parameter.

showlabels

False show text label for each level or not (default: False) Still kind of experimental

Type:

boolean

label_fmt

“%.1f” Format string for the labels if shown. Example: r”A$_V$=%1.0f”

Type:

str

label_fontsize

7 The fontsize of the contour levedl if they are shown

Type:

int

label_inline_spacing

5 Control the space around the contour label (i.e. if it overlaps with the line)

Type:

int

filled

False Use filled contours (contourf) instead of lines. Can be usefull sometimes. But not supported everywhere (just try).

Type:

boolean

prodimopy.plot.spnToLatex(spname)[source]

Utilitiy function to convert species names to proper latex math strings.

The returned string can directly be embedded in a latex $ $ statement.

prodimopy.plot.nhver_to_zr(ir, nhver, model, log=True)[source]
prodimopy.plot.plog(array)[source]
prodimopy.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.

prodimopy.plot.load_style(style='prodimopy')[source]

Simple utility function to load a matplotlib style

Parameters:

style (str) – The name of the style that should be loaded. Default: prodimopy