pytmosph3r.plot.plotutils

Module Contents

time_fmt(time, units=None)[source]

Format time in days, hours or seconds.

units_from_dim(dim='wls')[source]

Get units from dim (wls/wns/phases/times).

label_from_dim(dim='wls', units=None)[source]

Returns spectral label (either wavelength or wavenumber).

get_spectral(wl, wn, w_units='wls')[source]

Returns either wavelength or wavenumber based on w_units value (‘wls’, ‘wns’).

clipped_colorbar(CS, extend: pytmosph3r.util.util.Optional[pytmosph3r.util.util.Literal[neither, min, max, both]] = None, **kwargs)[source]
path_leaf(path)[source]
legend_out(ax, x0=1, y0=1, direction='v', padpoints=3, **kwargs)[source]
class BasePlot(name, *args, **kwargs)[source]

Bases: pytmosph3r.log.Logger, exo_k.util.spectral_object.Spectral_object

Standard logging using logger library

Parameters:
  • name (str) – Name used for logging

  • plots. (Default values for) –

x_colors
modes = ['transmission', 'emission', 'lightcurve', 'phasecurve']
interactive = True
altitudes = ['surface', 'middle', 'top']

Altitudes to plot. Possible values are indices or surface, top or middle.

latitudes = ['north', 'equator', 'south']

Latitudes to plot. Possible values are indices or north, south or equator. north is latitude 0.

longitudes = ['day', 'terminator', 'night']

Longitudes to plot. Possible values are indices or day, night or terminator. night is longitude 0.

static figure(ax=None, figsize=None)[source]

Simply create a figure. Returns a boolean ‘save’ on top of fig and ax, to know if we should save the figure or not.

plot_columns(func, latitudes=None, longitudes=None, name='plot', legend=None, figsize=None, nrows=None, ncols=None, title=None, *args, **kwargs)[source]

Iterate over vertical columns (lat,lon).

plot_column(ax, x, y, latitude=None, longitude=None, *args, **kwargs)[source]

Plot something at column (lat,lon).

save_column(label)[source]
set_title(ax=None, title=None, *args, **kwargs)[source]
legend(ax=None, fig=None, ncol=1, prop={'size': 11}, frameon=False, *args, **kwargs)[source]
save_plot(name='plot', suffix=None, out_folder=None, interactive=None, *args, **kwargs)[source]
legend2D(axes)[source]
spectrum_label(mode)[source]

Label for ‘spectra’ plots.

Parameters:

mode (str) – Among transmission/emission/lightcurve/phasecurve. Defaults to transmission.

get_value_dim(index, dim)[source]

Returns the value at index in the dimension dim.

Parameters:
  • index (int) – Index of the value we’re looking for.

  • dim (str) – Dimension of the value we’re looking for. Among “altitude”, “latitude” or “longitude”.

bin_down(resolution=200, spectrum=None, copy=True)[source]
flux(mode=None, phase=None, wl=None, wn=None, resolution=None, noise=True, ax=None, color=None)[source]

Get flux (spectrum or curve) of a mode, with a resolution of N points, noised or not. Equal to \((Rp/Rs)^2\) (if normalized).

Parameters:
  • mode (str, optional) – transmission/emission/lightcurve/phasecurve. Defaults to None.

  • phase (array | float, optional) – Phase(s) to select. Incompatible with wl or wn. Defaults to None.

  • wl (array | float, optional) – Wavelength to select. Incompatible with phase or wn. Defaults to None.

  • wl – Wavenumber to select. Incompatible with phase or wl. Defaults to None.

  • resolution (int, optional) – Number of points to bin to. Not used with wl or wn. Defaults to None.

  • noise (bool, optional) – Noise the spectrum? Defaults to True.

Returns:

flux (exo_k.Spectrum) of which the X axis is either wavelengths, or phases.

curve(mode=None, **kwargs)[source]

Returns light/phasecurve (as an array). Lightcurve is \(1-(Rp/Rs)^2\).

x_axis_curve(x_axis='phases', x_units=None, mode='lightcurve')[source]
init_time(phase=None, time=None, time_units=None)[source]
init_spectral(wl=None, wn=None, default_wl=15, mode=None)[source]

Init both wavelengths and wavenumbers to equivalent values.

Returns:

(ws, wl, wn, w_units) where ws is the spectral array corresponding to w_units (either wls or wns).

Return type:

tuple

get_spectral(wl=None, wn=None, w_units=None, default_wl=15, mode=None)[source]

Choose which spectral units to plot (wavelengths or wavenumbers).

find_spectral(wl=None, wn=None, **kwargs)[source]

Find the index of spectral point equal to either wavelength wl or wavenumber wn. Defines w_index.

mode(mode)[source]

Returns ‘mode’ object (transmission/lightcurve/emission/phasecurve). Returns self if None.

getattr(mode, attr)[source]

Get attribute attr from mode mode.

class LoadPlot[source]

Class to load HDF5 file or model attribute. Inherited by Plot.

property model
property atmosphere

Dict.

property wns
property wnedges
property spectrum
property noised_spectrum
property noise

Planet radius.

property grid
property n_layers
property n_levels
property n_longitudes
property n_latitudes
property Rp

Planet radius.

property Rs

Star radius.

property R

Planet radius scaled using r_factor.

property z_idx
property input_z
property input_z_levels
property z_levels
property z
property altitude
property r
property pressure
property pressure_levels
property p_min
property temperature
property gas_mix_ratio
property aerosols
property shape
set_mode_attr(mode)[source]

Set attributes for modes (emission/phasecurve/transmission/lightcurve), which have parameters both in Model and in Output.

transmission()[source]
emission()[source]
lightcurve()[source]
phasecurve()[source]
mode(mode)[source]

Returns ‘mode’ object (transmission/lightcurve/emission/phasecurve). Returns self if None.

transmittance(phase=None, wl=None, wn=None)[source]
interp_transmittances(phase, wl=None, wn=None)[source]
rays(mode='transmission')[source]
close()[source]
plot_sector_star(rS, aS, Rs, r, a, r_i=None, a_i=None, ax=None)[source]

Plot star at position (rS, aS), radius Rs over sector(s) with bounds r and a. r_i and a_i are (optional) intersection points with a and r, respectively.