skultrafast.plot_helpers ======================== .. py:module:: skultrafast.plot_helpers .. autoapi-nested-parse:: Created on Tue May 27 15:35:22 2014 @author: tillsten Attributes ---------- .. autoapisummary:: skultrafast.plot_helpers.ma skultrafast.plot_helpers.linewidth skultrafast.plot_helpers.time_label skultrafast.plot_helpers.time_unit skultrafast.plot_helpers.sig_label skultrafast.plot_helpers.vib_label skultrafast.plot_helpers.freq_label skultrafast.plot_helpers.inv_freq skultrafast.plot_helpers.freq_unit skultrafast.plot_helpers.line_width Classes ------- .. autoapisummary:: skultrafast.plot_helpers.MidPointNorm Functions --------- .. autoapisummary:: skultrafast.plot_helpers.ir_mode skultrafast.plot_helpers.vis_mode skultrafast.plot_helpers.plot_singular_values skultrafast.plot_helpers.make_dual_axis skultrafast.plot_helpers.plot_svd_components skultrafast.plot_helpers.make_angle_plot skultrafast.plot_helpers.make_angle_plot2 skultrafast.plot_helpers.lbl_spec skultrafast.plot_helpers.lbl_trans skultrafast.plot_helpers.lbl_map skultrafast.plot_helpers.plot_trans skultrafast.plot_helpers.mean_tup skultrafast.plot_helpers.plot_ints skultrafast.plot_helpers.plot_diff skultrafast.plot_helpers.time_formatter skultrafast.plot_helpers.plot_spec skultrafast.plot_helpers.mean_spec skultrafast.plot_helpers.nice_map skultrafast.plot_helpers.nice_lft_map skultrafast.plot_helpers.plot_freqs skultrafast.plot_helpers.plot_fft skultrafast.plot_helpers.plot_coef_spec skultrafast.plot_helpers.fit_semiconductor skultrafast.plot_helpers.stack_ax skultrafast.plot_helpers.nsf skultrafast.plot_helpers.error_string skultrafast.plot_helpers.error_string_lmfit skultrafast.plot_helpers.fig_fixed_axes skultrafast.plot_helpers.symticks skultrafast.plot_helpers.lbl_axes skultrafast.plot_helpers.ci_plot skultrafast.plot_helpers.get_fonts skultrafast.plot_helpers.enable_style skultrafast.plot_helpers.scale_y skultrafast.plot_helpers.fill_between_gradient Module Contents --------------- .. py:data:: ma .. py:data:: linewidth :value: 2 .. py:function:: ir_mode() .. py:function:: vis_mode() .. py:data:: time_label :value: 'Delay time [ps]' .. py:data:: time_unit :value: 'ps' .. py:data:: sig_label :value: 'Absorbance change [mOD]' .. py:data:: vib_label :value: 'Wavenumber [cm$^{-1}$]' .. py:data:: freq_label :value: 'Wavelength [nm]' .. py:data:: inv_freq :value: False .. py:data:: freq_unit :value: 'nm' .. py:data:: line_width :value: 1 .. py:function:: plot_singular_values(dat) .. py:function:: make_dual_axis(ax: matplotlib.pyplot.Axes = None, axis='x', unit='nm', minor_ticks=True) .. py:function:: plot_svd_components(tup, n=4, from_t=None) .. py:function:: make_angle_plot(wl, t, para, senk, t_range) .. py:function:: make_angle_plot2(wl, t, para, senk, t_range) .. py:function:: lbl_spec(ax=None) .. py:function:: lbl_trans(ax=None, use_symlog=True) .. py:function:: lbl_map(ax=None, use_symlog=True) .. py:function:: plot_trans(tup, wls, symlog=True, norm=False, marker=None, ax=None, **kwargs) .. py:function:: mean_tup(tup, time) .. py:function:: plot_ints(tup, wls, factors=None, symlog=True, norm=False, is_wavelength=True, ax=None, **kwargs) .. py:function:: plot_diff(tup, t0, t_list, **kwargs) .. py:function:: time_formatter(time, unit='ps') .. py:function:: plot_spec(tup, t_list, ax=None, norm=False, **kwargs) .. py:function:: mean_spec(wl, t, p, t_range, ax=None, pos=(0.1, 0.1), markers=['o', '^']) .. py:function:: nice_map(wl, t, d, lvls=20, linthresh=10, linscale=1, norm=None, linscaley=1, cmap='coolwarm', **kwargs) .. py:function:: nice_lft_map(tup, taus, coefs, show_sums=False, **kwargs) .. py:function:: plot_freqs(tup, wl, from_t, to_t, taus=[1]) .. py:function:: plot_fft(x, y, min_amp=0.2, order=1, padding=2, power=1, ax=None) .. py:function:: plot_coef_spec(taus, wl, coefs, div) .. py:class:: MidPointNorm(midpoint=0, vmin=None, vmax=None, clip=False) Bases: :py:obj:`matplotlib.colors.Normalize` A class which, when called, maps values within the interval ``[vmin, vmax]`` linearly to the interval ``[0.0, 1.0]``. The mapping of values outside ``[vmin, vmax]`` depends on *clip*. .. rubric:: Examples :: x = [-2, -1, 0, 1, 2] norm = mpl.colors.Normalize(vmin=-1, vmax=1, clip=False) norm(x) # [-0.5, 0., 0.5, 1., 1.5] norm = mpl.colors.Normalize(vmin=-1, vmax=1, clip=True) norm(x) # [0., 0., 0.5, 1., 1.] .. seealso:: :ref:`colormapnorms` .. py:attribute:: midpoint :value: 0 .. py:method:: __call__(value, clip=None) Normalize the data and return the normalized data. :param value: Data to normalize. :param clip: See the description of the parameter *clip* in `.Normalize`. If ``None``, defaults to ``self.clip`` (which defaults to ``False``). :type clip: bool, optional .. rubric:: Notes If not already initialized, ``self.vmin`` and ``self.vmax`` are initialized using ``self.autoscale_None(value)``. .. py:method:: inverse(value) Maps the normalized value (i.e., index in the colormap) back to image data value. :param value: Normalized value. .. py:function:: fit_semiconductor(t, data, sav_n=11, sav_deg=4, mode='sav', tr=0.4) .. py:function:: stack_ax(num_rows=2, num_cols=1, height_rations=[2, 1]) .. py:function:: nsf(num, n=1) n-Significant Figures .. py:function:: error_string(val: float, err: float, valname: Optional[str] = None, unit: Optional[str] = None) -> str Returns a string with the value and error with correct siginificant figures .. py:function:: error_string_lmfit(param: lmfit.Parameter, valname: Optional[str] = None, unit: Optional[str] = None) -> str Returns a string with the value and error with correct siginificant figures .. py:function:: fig_fixed_axes(axes_shape: Tuple[int, int], axes_size: Tuple[float, float], padding: float = 0.3, left_margin: float = 0.45, bot_margin: float = 0.42, hspace: float = 0.1, vspace: float = 0.1, xlabel: Optional[str] = None, ylabel: Optional[str] = None, **kwargs) Helper funtion to generate a figure form axes sizes given in inches .. py:function:: symticks(ax, linthresh=1, linstep=0.2, axis='x') .. py:function:: lbl_axes(axs=None, pos=(-0.2, -0.2), fmt='(%s)', labels=None, **kwargs) Labels the axes in figure :param axs: The axes to label, by default None :type axs: List[plt.Axes], optional :param pos: x, y position of the label in axis coordinates , by default (-.2, -.2) :type pos: tuple, optional :param fmt: Format string, by default "(%s)" :type fmt: str, optional :param labels: The label, by default None, resulting in a, b, c, ... :type labels: [type], optional :param kwargs: will be passed to ax.text. .. py:function:: ci_plot(ci_dict, trace) Plots the given CI intervals. Needs the trace output from coinfidence intervals. Currently assumes the CI are calculated for 1,2 and 3 sigmas. :param ci_dict: Out :type ci_dict: dict :param trace: Trace dict :type trace: dict .. py:function:: get_fonts() -> List[str] .. py:function:: enable_style() .. py:function:: scale_y(lines: List[matplotlib.pyplot.Line2D], scale: float, x_range: Tuple[float, float]) Muliplies the y-data of the given lines by the given scale in the given range. Also inserts a Nan at the beginning and end of the range to prevent the line from being connected to the rest of the data. :param lines: The lines to scale :type lines: List[plt.Line2D] :param scale: The scale factor :type scale: float :param range: The range in which to scale :type range: Tuple[float, float] .. py:function:: fill_between_gradient(x, y1, y2, ax=None, **kwargs) Fill between two lines with a gradient color. This is surprisingly difficult in matplotlib. This function fills the area between two lines with a gradient color. The gradient is perpendicular to the lines.