pytmosph3r.plot.modelplot

Module Contents

class ModelPlot(name, *args, **kwargs)[source]

Bases: pytmosph3r.plot.plotutils.BasePlot

Intermediary class that can be inherited from by classes from pytmosph3r, to make plots from them directly.

Default values for plots.

plot_rays(points=True, mid_points=False, rays=False, rays_bottom=False, rays_top=True, rays_terminator=True, figsize=None, mode='transmission')[source]

Plot rays with matplotlib.

Parameters:
  • rays_bottom (bool, optional) – Display the bottom layer (surface) of the planet. Defaults to False.

  • rays_top (bool, optional) – Display the top layer of the planet. Defaults to False.

  • rays_terminator (bool, optional) – Display the terminator plane. Defaults to False.

plot_points(ax, points, mode=None)[source]
plot_points_ray(ax, ray)[source]
plot_2Dmap(ax, location, dim, x, y, z, p_levels=None, cmap='YlOrRd', log=False, vmin=None, imshow=False, figsize=(5, 3.5), *args, **kwargs)[source]

Plot a 2D map at a specific location and dimension (core function). Called by map_2D().

Parameters:
  • location (str, int) – Name (“equator”, …) or index of location to plot

  • dim (str, int) – Dimension of location (altitude/latitude/longitude)

  • x (ndarray) – Meshgrid

  • y (ndarray) – Meshgrid

  • z (ndarray) – Values to plot

  • p_levels (list, optional) – Pressure levels to plot over the map. Defaults to [1e-4, 1, 100, 10**4].

  • cmap (str, optional) – Colormap to be used. Defaults to “YlOrRd”.

  • log (bool) – Log scale for colors. Defaults to False.

  • vmin (float) – Minimum value for colorbar.

  • vmax (float) – Maximum value for colorbar.

  • imshow (bool) – If True, the map will use plt.imshow() instead of plt.contourf(). imshow() shows exactly the temperature map used, while contourf() makes it smoother. Defaults to False (i.e., contourf).

plot_2D(func, dim=None, altitudes=None, latitudes=None, longitudes=None, *args, **kwargs)[source]

Calls func on all locations of dim for a 2D plot. Can also select altitudes, latitudes and longitudes separately.

map_2D(array, location='equator', dim='latitude', ax=None, figsize=(5, 3.5), *args, **kwargs)[source]

Generic 2D map plot for a specific dimension & location. Selects the data to send to plot_2Dmap().

t_map(location='equator', dim='latitude', ax=None, cmap='gnuplot2', *args, **kwargs)[source]

Temperature 2D map for a specific dimension & location (calls map_2D() with identical parameters).

t_maps(dim='latitude', *args, **kwargs)[source]

Temperature 2D maps over multiple locations. See plot_2Dmap() for further parameters. You can select altitudes, latitudes and longitudes using arguments (see plot_2D()) or by setting them beforehand:

  • self.altitudes when dim = "altitude",

  • self.latitudes when dim = "latitude" (default),

  • self.longitudes when dim = "longitude"

x_map(gas=None, location='equator', dim='latitude', cmap='PuBuGn', ax=None, *args, **kwargs)[source]

VMR 2D map for a specific dimension & location (calls map_2D() with identical parameters).

x_maps(gases=None, dim='latitude', *args, **kwargs)[source]

Gas Volume Mixing ratio 2D maps over multiple locations. See plot_2Dmap() for further parameters. You should set beforehand:

  • self.altitudes when dim = "altitude" (default),

  • self.latitudes when dim = "latitude",

  • self.longitudes when dim = "longitude"

a_map(aerosol=None, location='equator', dim='latitude', cmap='BuPu', ax=None, *args, **kwargs)[source]

Aerosols MMRs 2D map for a specific dimension & location (calls map_2D() with identical parameters).

a_maps(aerosols=None, dim='latitude', *args, **kwargs)[source]

Aerosols Mass Mixing ratio 2D maps over multiple locations. See plot_2Dmap() for further parameters. You should set beforehand:

  • self.altitudes when dim = "altitude" (default),

  • self.latitudes when dim = "latitude",

  • self.longitudes when dim = "longitude"

plot_xprofile(*args, **kwargs)[source]
plot_x(latitude=None, longitude=None, ax=None, title=None, figsize=(5, 3.5), *args, **kwargs)[source]

Plot VMRs (gas mix profiles) of one vertical column.

x_legend(ax, fig, *args, **kwargs)[source]
plot_xprofiles(*args, **kwargs)[source]

Plot VMRs (gas mix profiles) of multiple columns. Set self.latitudes and self.longitudes for this beforehand.

plot_tp(latitude=None, longitude=None, ax=None, title=None, figsize=(5, 3.5), *args, **kwargs)[source]

Plot TP profile of one vertical column.

tp_legend(ax, fig=None, *args, **kwargs)[source]
plot_tps(*args, **kwargs)[source]

Plot TP profiles of multiple columns. Set self.latitudes and self.longitudes for this beforehand.

plot_zp(latitude=None, longitude=None, ax=None, title=None, figsize=(5, 3.5), *args, **kwargs)[source]

Plot ZP profile of one vertical column.

zp_legend(ax, fig=None, *args, **kwargs)[source]
plot_zps(*args, **kwargs)[source]

Plot ZP profiles of multiple columns. Set self.latitudes and self.longitudes for this beforehand.

plot_spectrum(mode=None, noise=True, ax=None, save=False, time=None, phase=None, resolution=None, xlabel=None, ylabel=None, dashes=[], linewidth=0.5, x_axis='wls', figsize=(5.3, 3.5), legend=True, xlog=True, ylog=False, color=None, label=None, title=None, time_units=None, *args, **kwargs)[source]

Plot a spectrum.

Parameters:
  • mode (str) – transmission/emission/lightcurve/phasecurve/None. None takes the value of the spectrum in the main model (transmission by default), which can be noised. Defaults to None.

  • noise (bool) – Plot noised spectrum. If it is set to a value, it overwrites the current noise using a normal distribution.

  • t (ndarray, optional) – List of times to plot (in curve modes only) in seconds (or astropy).

  • resolution (int, optional) – Number of points to bin to. Defaults to None.

transmission_spectrum(*args, **kwargs)[source]

Calls plot_spectrum() with mode = ‘transmission’.

emission_spectrum(*args, **kwargs)[source]

Calls plot_spectrum() with mode = ‘transmission’.

transmittance_map(wl=None, wn=None, phase=None, mode='transmission', zmax=None, r_factor=None, ax=None, title='Transmittance at ', cmap='gnuplot', overlay=True, star_out=True, figsize=None, save_name='transmittances/transmittance', pcolormesh=False, core_color='black', *args, **kwargs)[source]

Plot a map of the transmittance, as seen by the observer.

Parameters:
  • wl (float, optional) – Select wavelength (or inferior). Defaults to None.

  • wn (float, optional) – Select wavenumber. Defaults to None.

  • phase (float, optional) – Select phase (in lightcurve mode). Defaults to None.

  • mode (str, optional) – transmission/lightcurve. Defaults to “transmission”.

  • zmax (float, optional) – Truncate plot at altitude zmax, scaled using h_unit. Defaults to max altitude.

  • r_factor (float, optional) – Scale planet core radius (Rp). Can be used to enlarge (artificially) the atmosphere. Defaults to 1.

  • cmap (str, optional) – Colormap. Defaults to “gnuplot”.

  • overlay (bool, optional) – Activates ticks and grid. Defaults to True.

  • star_out (bool, optional) – Hide part of the transmittance that is out of the star. Defaults to True.

  • save_name (str, optional) – Change name base of output file. Defaults to “transmittance”.

  • pcolormesh (bool, optional) – Activates use of pcolormesh. Otherwise use contourf. Defaults to False.

transmittance_maps(wl=None, wn=None, save_name='transmittances/transmittance', *args, **kwargs)[source]

Same parameters as transmittance_map() but create new files for each wl/wn.

transmittance_animation(wl=None, wn=None, phase=None, filename=None, prefix='transmittances/transmittance', *args, **kwargs)[source]

Transforms maps generated by transmittance_map() to a GIF animation.

emission_map(wl=None, wn=None, mode='emission', ax=None, title='Emission at ', cmap='gnuplot', overlay=True, figsize=(5, 3.5), *args, **kwargs)[source]

Plot emission at a specific wavelength wl (or closest inferior wavelength, in micrometer) or wavenumber.

plot_emission(*args, **kwargs)[source]
class CurvePlot(name, *args, **kwargs)[source]

Bases: pytmosph3r.plot.plotutils.BasePlot

Plots for (light/phase)curves.

Default values for plots.

plot_curve(mode='phasecurve', wl=None, wn=None, ax=None, label=None, title='Phasecurve', x_axis: pytmosph3r.util.util.Literal[times, phases] = 'times', xlabel=None, x_units=None, ylabel='Normalized flux', legend=True, figsize=(5, 3.5), *args, **kwargs)[source]

Plot a curve from a mode (phasecurve/lightcurve). Use either wl or wn, not both.

Parameters:
  • mode (str, optional) – phasecurve of lightcurve. Defaults to “phasecurve”.

  • wl (float, optional) – Wavelength of the curve (can be a list). Defaults to 15.

  • wn (float, optional) – Wavenumber of the curve (can be a list).

plot_phasecurve(*args, **kwargs)[source]

See parameters of plot_curve().

plot_lightcurve(wl=1, *args, **kwargs)[source]

See parameters of plot_curve().

plot_2d_flux(mode='phasecurve', ax=None, title='Normalized flux', figsize=(5, 3.5), x=None, y=None, flux=None, x_axis='wls', xlog=True, xlabel=None, ylabel='Phase angle (degrees)', cmap='viridis', colorbar_kwargs=dict(format='%.3f'), savename=None, *args, **kwargs)[source]

2D phase curves (imshow), with the X axis the spectral dimension and the Y axis phases.

Parameters:
  • x_axis (str) – Choose X axis as “wls” or “wns”, for wavelengths or wavenumbers, respectively.

  • figsize (tuple, optional) – Size of the figure. Defaults to (5,3.5).

  • cmap (str, optional) – Colormap to use in the imshow(). Defaults to “gnuplot”.

plot_2d_phasecurve(*args, **kwargs)[source]
plot_2d_lightcurve(*args, **kwargs)[source]
class Plot(model: pytmosph3r.util.util.Union[pytmosph3r.model.Model, str] = None, title: pytmosph3r.util.util.Optional[str] = None, label: pytmosph3r.util.util.Optional[str] = None, suffix=None, out_folder: str = '.', cmap: str = 'Paired', r_factor=1.0, h_unit=1000000.0, zmax=np.inf, pmin=None, substellar_longitude=None, vertical_in_pressure=None, interactive=None, *args, **kwargs)[source]

Bases: pytmosph3r.plot.plotutils.LoadPlot, ModelPlot, CurvePlot

Plot class. Can plot a Model() or a HDF5 file generated by Pytmosph3R.

Parameters for the Plots:

Parameters:
  • model (string or Model) – HDF5 filename from which to read the model (if string), or Model after its computation.

  • label (str) – Most useful when comparing multiple plots.

  • suffix (str) – Suffix to append to plot filenames.

  • out_folder (str) – Directory where we will generate the plots.

  • r_factor (float) – Factor with which the planet radius will be scaled. (Below 1, the radius is smaller, so the atmosphere looks larger). Defaults to 1.

  • zmax (float) – Maximum height to plot (can be used to crop the atmosphere), scaled via h_units. Defaults to infinity.

  • h_unit (float) – Units of the heightscale. Defaults to 1E6 (= Mm).

  • interactive (bool) – Activate/deactivate showing plots. Plot.interactive can also be changed for all Plot objects.

property idx_latitude
property idx_longitude
h_unit

Height unit scaling. By default 1e6, i.e., Mm.

zmax

Max altitude (in Mm) to plot.

r_factor

Radius factor (for visual purposes). By default 1.

vertical_in_pressure

Use pressure as vertical axis .

substellar_longitude

Longitude of the substellar point (in degrees).

inputs()[source]