plesty.pow_pl.analysis ====================== .. py:module:: plesty.pow_pl.analysis .. autoapi-nested-parse:: Power dependence of a quantum dot's emission, and its report. A power series records one spectrum per excitation power, each frame carrying the power it was measured at (``power_w``) and its exposure (``exposure_s``). Two analyses read it: 1. **Integrated counts** — every frame, background-subtracted, summed over the dot's lines and divided by its exposure, against the power. 2. **Line fit** — :class:`plesty.lib.analyzer.SpectrumFit` fits every line in every frame; each line's fitted height and area per second against the power. Each gets a power law :math:`I \propto P^k` over the frames where it stands above the noise; the exponent *k* counts the excitons a line needs (1 for an exciton, 2 for a biexciton). The brightest line also gets a saturation curve :math:`I = I_\mathrm{sat} P/(P + P_\mathrm{sat})`, quoted only when the data constrain it. :func:`power_dependence` returns the numbers, the line fit and a :class:`plesty.lib.report.Report`, which the experiment saves under the run's ``analysis/``. ``python -m plesty.pow_pl.analysis `` analyses a finished run again. Attributes ---------- .. autoapisummary:: plesty.pow_pl.analysis.COORDINATES plesty.pow_pl.analysis.FIT_DEFAULTS plesty.pow_pl.analysis._MICRO plesty.pow_pl.analysis._COUNTERS plesty.pow_pl.analysis._COUNTER_MEANING Classes ------- .. autoapisummary:: plesty.pow_pl.analysis._PowerLaw plesty.pow_pl.analysis._Saturation plesty.pow_pl.analysis._PowerDependence Functions --------- .. autoapisummary:: plesty.pow_pl.analysis.power_law plesty.pow_pl.analysis.saturation plesty.pow_pl.analysis._band plesty.pow_pl.analysis.legend_space plesty.pow_pl.analysis.power_dependence plesty.pow_pl.analysis._k plesty.pow_pl.analysis._report plesty.pow_pl.analysis._quality_table plesty.pow_pl.analysis.analyze_run plesty.pow_pl.analysis.main Module Contents --------------- .. py:data:: COORDINATES :value: ('power_w', 'exposure_s', 'hwp_deg') .. py:data:: FIT_DEFAULTS :type: dict[str, Any] .. py:data:: _MICRO :value: 1000000.0 .. py:class:: _PowerLaw ``I ∝ P^k`` fitted on log–log axes. .. py:attribute:: k :type: float .. py:attribute:: k_err :type: float .. py:attribute:: intercept :type: float .. py:attribute:: p_min_uw :type: float .. py:attribute:: p_max_uw :type: float .. py:attribute:: points :type: int .. py:class:: _Saturation ``I = I_sat · P / (P + P_sat)``. .. py:attribute:: i_sat :type: float .. py:attribute:: i_sat_err :type: float .. py:attribute:: p_sat_uw :type: float .. py:attribute:: p_sat_err_uw :type: float .. py:class:: _PowerDependence What :func:`power_dependence` found. .. py:attribute:: integral :type: Optional[_PowerLaw] .. py:attribute:: integral_saturation :type: Optional[_Saturation] .. py:attribute:: lines :type: list[dict[str, Any]] .. py:attribute:: saturation :type: Optional[_Saturation] .. py:attribute:: saturation_line_nm :type: Optional[float] .. py:attribute:: fit :type: plesty.lib.data.SpectrumFitData .. py:attribute:: warnings :type: list[str] .. py:attribute:: report :type: plesty.lib.report.Report .. py:function:: power_law(power_uw: numpy.ndarray, intensity: numpy.ndarray, use: numpy.ndarray) -> Optional[_PowerLaw] Fit ``log10 I = k · log10 P + c`` over the points in *use*; None below four points. :param power_uw: Excitation power per point, µW. :param intensity: Intensity per point, counts/s. :param use: Which points enter the fit. :returns: The fitted law with the slope's standard error, or None. .. py:function:: saturation(power_uw: numpy.ndarray, intensity: numpy.ndarray, use: numpy.ndarray) -> Optional[_Saturation] Fit ``I = I_sat · P / (P + P_sat)``; None when the data do not constrain ``P_sat``. A line still linear over the range gives a ``P_sat`` larger than its own error — a number the data cannot carry, so it is not quoted. .. py:function:: _band(wavelength: numpy.ndarray, band: Optional[collections.abc.Sequence[float]]) -> numpy.ndarray Pixels inside *band*, or every pixel when no band is given. .. py:function:: legend_space(drawables: list[Any], rows: int) -> plesty.lib.monitor.Line An invisible trace that raises the y axis so the legend clears the data. plesty-lib draws a figure's legend in the top-right corner whatever lies there (plesty-lib#61). A zero-length line at the top of the range — no stroke, no legend entry — makes room above the data for *rows* legend rows. Remove once the renderer places the legend itself. .. py:function:: power_dependence(spectrum: plesty.lib.data.SpectrumData, *, qd: str = '', region_nm: Optional[collections.abc.Sequence[float]] = None, background_nm: Optional[collections.abc.Sequence[float]] = None, snr: float = 5.0, fit_options: Optional[collections.abc.Mapping[str, Any]] = None, provenance: Optional[dict[str, Any]] = None) -> _PowerDependence Analyse a power series and write its report. :param spectrum: One frame per acquisition, with the coordinates of :data:`COORDINATES`. :param qd: The dot, for the report's words. :param region_nm: ``[start, stop]`` of the dot's lines; every pixel when None. :param background_nm: ``[start, stop]`` free of emission, for each frame's background and noise; the whole frame's median when None. :param snr: A point enters a fit only this many noise σ above zero. :param fit_options: Passed to :class:`~plesty.lib.analyzer.SpectrumFit` over :data:`FIT_DEFAULTS`. :param provenance: Stamped on the report. :returns: The two analyses, the line fit and the report. .. py:function:: _k(law: Optional[_PowerLaw]) -> Any A table cell for an exponent. .. py:function:: _report(qd: str, spectrum: plesty.lib.data.SpectrumData, wl: numpy.ndarray, counts: numpy.ndarray, background: numpy.ndarray, power: numpy.ndarray, exposure: numpy.ndarray, region_nm: Optional[collections.abc.Sequence[float]], snr: float, integral: numpy.ndarray, above: numpy.ndarray, law: Optional[_PowerLaw], integral_sat: Optional[_Saturation], lines: list[dict[str, Any]], brightest: Optional[dict[str, Any]], line_sat: Optional[_Saturation], diagnostics: collections.abc.Sequence[collections.abc.Mapping[str, int]]) -> plesty.lib.report.Report The sentence, the two tables and the three figures. .. py:data:: _COUNTERS .. py:data:: _COUNTER_MEANING .. py:function:: _quality_table(lines: list[dict[str, Any]], diagnostics: collections.abc.Sequence[collections.abc.Mapping[str, int]], frames: int) -> Optional[plesty.lib.report.Table] The line fit's quality counters, one row per line; None when all are zero. Only the counters that are non-zero for some line get a column. .. py:function:: analyze_run(run_dir: pathlib.Path, qd: str, analysis: Optional[collections.abc.Mapping[str, Any]] = None) -> dict[str, Any] Analyse one dot of a run and save the line fit and the report under ``analysis/``. :param run_dir: The run directory. :param qd: Quantum-dot identifier. :param analysis: The configuration's ``analysis`` block. :returns: exponents, saturation, warnings and the paths of what was saved, relative to the run. :rtype: The record of the analysis step .. py:function:: main(argv: Optional[collections.abc.Sequence[str]] = None) -> None Analyse a finished run again: ``python -m plesty.pow_pl.analysis ``.