:py:mod:`pytmosph3r.plot.modelplot` =================================== .. py:module:: pytmosph3r.plot.modelplot Module Contents --------------- .. py:class:: ModelPlot(name, *args, **kwargs) Bases: :py:obj:`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. .. py:method:: plot_rays(points=True, mid_points=False, rays=False, rays_bottom=False, rays_top=True, rays_terminator=True, figsize=None, mode='transmission') Plot rays with matplotlib. :param rays_bottom: Display the bottom layer (surface) of the planet. Defaults to False. :type rays_bottom: bool, optional :param rays_top: Display the top layer of the planet. Defaults to False. :type rays_top: bool, optional :param rays_terminator: Display the terminator plane. Defaults to False. :type rays_terminator: bool, optional .. py:method:: plot_points(ax, points, mode=None) .. py:method:: plot_points_ray(ax, ray) .. py:method:: 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) Plot a 2D map at a specific location and dimension (core function). Called by :func:`map_2D`. :param location: Name ("equator", ...) or index of location to plot :type location: str, int :param dim: Dimension of location (altitude/latitude/longitude) :type dim: str, int :param x: Meshgrid :type x: ndarray :param y: Meshgrid :type y: ndarray :param z: Values to plot :type z: ndarray :param p_levels: Pressure levels to plot over the map. Defaults to [1e-4, 1, 100, 10**4]. :type p_levels: list, optional :param cmap: Colormap to be used. Defaults to "YlOrRd". :type cmap: str, optional :param log: Log scale for colors. Defaults to False. :type log: bool :param vmin: Minimum value for colorbar. :type vmin: float :param vmax: Maximum value for colorbar. :type vmax: float :param imshow: 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). :type imshow: bool .. py:method:: plot_2D(func, dim=None, altitudes=None, latitudes=None, longitudes=None, *args, **kwargs) Calls :attr:`func` on all `locations` of :attr:`dim` for a 2D plot. Can also select altitudes, latitudes and longitudes separately. .. py:method:: map_2D(array, location='equator', dim='latitude', ax=None, figsize=(5, 3.5), *args, **kwargs) Generic 2D map plot for a specific dimension & location. Selects the data to send to :func:`plot_2Dmap`. .. py:method:: t_map(location='equator', dim='latitude', ax=None, cmap='gnuplot2', *args, **kwargs) Temperature 2D map for a specific dimension & location (calls :func:`map_2D` with identical parameters). .. py:method:: t_maps(dim='latitude', *args, **kwargs) Temperature 2D maps over multiple locations. See :func:`plot_2Dmap` for further parameters. You can select altitudes, latitudes and longitudes using arguments (see :func:`plot_2D`) or by setting them beforehand: - :attr:`self.altitudes ` when :attr:`dim = "altitude"`, - :attr:`self.latitudes ` when :attr:`dim = "latitude"` (default), - :attr:`self.longitudes ` when :attr:`dim = "longitude"` .. py:method:: x_map(gas=None, location='equator', dim='latitude', cmap='PuBuGn', ax=None, *args, **kwargs) VMR 2D map for a specific dimension & location (calls :func:`map_2D` with identical parameters). .. py:method:: x_maps(gases=None, dim='latitude', *args, **kwargs) Gas Volume Mixing ratio 2D maps over multiple locations. See :func:`plot_2Dmap` for further parameters. You should set beforehand: - :attr:`self.altitudes ` when :attr:`dim = "altitude"` (default), - :attr:`self.latitudes ` when :attr:`dim = "latitude"`, - :attr:`self.longitudes ` when :attr:`dim = "longitude"` .. py:method:: a_map(aerosol=None, location='equator', dim='latitude', cmap='BuPu', ax=None, *args, **kwargs) Aerosols MMRs 2D map for a specific dimension & location (calls :func:`map_2D` with identical parameters). .. py:method:: a_maps(aerosols=None, dim='latitude', *args, **kwargs) Aerosols Mass Mixing ratio 2D maps over multiple locations. See :func:`plot_2Dmap` for further parameters. You should set beforehand: - :attr:`self.altitudes ` when :attr:`dim = "altitude"` (default), - :attr:`self.latitudes ` when :attr:`dim = "latitude"`, - :attr:`self.longitudes ` when :attr:`dim = "longitude"` .. py:method:: plot_xprofile(*args, **kwargs) .. py:method:: plot_x(latitude=None, longitude=None, ax=None, title=None, figsize=(5, 3.5), *args, **kwargs) Plot VMRs (gas mix profiles) of one vertical column. .. py:method:: x_legend(ax, fig, *args, **kwargs) .. py:method:: plot_xprofiles(*args, **kwargs) Plot VMRs (gas mix profiles) of multiple columns. Set :attr:`self.latitudes ` and :attr:`self.longitudes ` for this beforehand. .. py:method:: plot_tp(latitude=None, longitude=None, ax=None, title=None, figsize=(5, 3.5), *args, **kwargs) Plot TP profile of one vertical column. .. py:method:: tp_legend(ax, fig=None, *args, **kwargs) .. py:method:: plot_tps(*args, **kwargs) Plot TP profiles of multiple columns. Set :attr:`self.latitudes ` and :attr:`self.longitudes ` for this beforehand. .. py:method:: plot_zp(latitude=None, longitude=None, ax=None, title=None, figsize=(5, 3.5), *args, **kwargs) Plot ZP profile of one vertical column. .. py:method:: zp_legend(ax, fig=None, *args, **kwargs) .. py:method:: plot_zps(*args, **kwargs) Plot ZP profiles of multiple columns. Set :attr:`self.latitudes ` and :attr:`self.longitudes ` for this beforehand. .. py:method:: 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) Plot a spectrum. :param mode: 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. :type mode: str :param noise: Plot noised spectrum. If it is set to a value, it overwrites the current noise using a normal distribution. :type noise: bool :param t: List of times to plot (in curve modes only) in seconds (or astropy). :type t: ndarray, optional :param resolution: Number of points to bin to. Defaults to None. :type resolution: int, optional .. py:method:: transmission_spectrum(*args, **kwargs) Calls :func:`plot_spectrum` with :attr:`mode` = 'transmission'. .. py:method:: emission_spectrum(*args, **kwargs) Calls :func:`plot_spectrum` with :attr:`mode` = 'transmission'. .. py:method:: 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) Plot a map of the transmittance, as seen by the observer. :param wl: Select wavelength (or inferior). Defaults to None. :type wl: float, optional :param wn: Select wavenumber. Defaults to None. :type wn: float, optional :param phase: Select phase (in lightcurve mode). Defaults to None. :type phase: float, optional :param mode: transmission/lightcurve. Defaults to "transmission". :type mode: str, optional :param zmax: Truncate plot at altitude :attr:`zmax`, scaled using :attr:`h_unit`. Defaults to max altitude. :type zmax: float, optional :param r_factor: Scale planet core radius (Rp). Can be used to enlarge (artificially) the atmosphere. Defaults to 1. :type r_factor: float, optional :param cmap: Colormap. Defaults to "gnuplot". :type cmap: str, optional :param overlay: Activates ticks and grid. Defaults to True. :type overlay: bool, optional :param star_out: Hide part of the transmittance that is out of the star. Defaults to True. :type star_out: bool, optional :param save_name: Change name base of output file. Defaults to "transmittance". :type save_name: str, optional :param pcolormesh: Activates use of pcolormesh. Otherwise use contourf. Defaults to False. :type pcolormesh: bool, optional .. py:method:: transmittance_maps(wl=None, wn=None, save_name='transmittances/transmittance', *args, **kwargs) Same parameters as :func:`transmittance_map` but create new files for each wl/wn. .. py:method:: transmittance_animation(wl=None, wn=None, phase=None, filename=None, prefix='transmittances/transmittance', *args, **kwargs) Transforms maps generated by :func:`transmittance_map` to a GIF animation. .. py:method:: emission_map(wl=None, wn=None, mode='emission', ax=None, title='Emission at ', cmap='gnuplot', overlay=True, figsize=(5, 3.5), *args, **kwargs) Plot emission at a specific wavelength :attr:`wl` (or closest inferior wavelength, in micrometer) or wavenumber. .. py:method:: plot_emission(*args, **kwargs) .. py:class:: CurvePlot(name, *args, **kwargs) Bases: :py:obj:`pytmosph3r.plot.plotutils.BasePlot` Plots for (light/phase)curves. Default values for plots. .. py:method:: 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) Plot a curve from a `mode` (phasecurve/lightcurve). Use either `wl` or `wn`, not both. :param mode: phasecurve of lightcurve. Defaults to "phasecurve". :type mode: str, optional :param wl: Wavelength of the curve (can be a list). Defaults to 15. :type wl: float, optional :param wn: Wavenumber of the curve (can be a list). :type wn: float, optional .. py:method:: plot_phasecurve(*args, **kwargs) See parameters of :func:`plot_curve`. .. py:method:: plot_lightcurve(wl=1, *args, **kwargs) See parameters of :func:`plot_curve`. .. py:method:: 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) 2D phase curves (imshow), with the X axis the spectral dimension and the Y axis phases. :param x_axis: Choose X axis as "wls" or "wns", for wavelengths or wavenumbers, respectively. :type x_axis: str :param figsize: Size of the figure. Defaults to (5,3.5). :type figsize: tuple, optional :param cmap: Colormap to use in the imshow(). Defaults to "gnuplot". :type cmap: str, optional .. py:method:: plot_2d_phasecurve(*args, **kwargs) .. py:method:: plot_2d_lightcurve(*args, **kwargs) .. py: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) Bases: :py:obj:`pytmosph3r.plot.plotutils.LoadPlot`, :py:obj:`ModelPlot`, :py:obj:`CurvePlot` Plot class. Can plot a Model() or a HDF5 file generated by Pytmosph3R. Parameters for the Plots: :param model: HDF5 filename from which to read the model (if string), or Model after its computation. :type model: string or :class:`~pytmosph3r.model.model.Model` :param label: Most useful when comparing multiple plots. :type label: str :param suffix: Suffix to append to plot filenames. :type suffix: str :param out_folder: Directory where we will generate the plots. :type out_folder: str :param r_factor: Factor with which the planet radius will be scaled. (Below 1, the radius is smaller, so the atmosphere looks larger). Defaults to 1. :type r_factor: float :param zmax: Maximum height to plot (can be used to crop the atmosphere), scaled via :attr:`h_units`. Defaults to infinity. :type zmax: float :param h_unit: Units of the heightscale. Defaults to 1E6 (= Mm). :type h_unit: float :param interactive: Activate/deactivate showing plots. Plot.interactive can also be changed for all Plot objects. :type interactive: bool .. py:property:: idx_latitude .. py:property:: idx_longitude .. py:attribute:: h_unit Height unit scaling. By default 1e6, i.e., Mm. .. py:attribute:: zmax Max altitude (in Mm) to plot. .. py:attribute:: r_factor Radius factor (for visual purposes). By default 1. .. py:attribute:: vertical_in_pressure Use pressure as vertical axis . .. py:attribute:: substellar_longitude Longitude of the substellar point (in degrees). .. py:method:: inputs()