plesty.pow_pl.analysis

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 — 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 \(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 \(I = I_\mathrm{sat} P/(P + P_\mathrm{sat})\), quoted only when the data constrain it.

power_dependence() returns the numbers, the line fit and a plesty.lib.report.Report, which the experiment saves under the run’s analysis/. python -m plesty.pow_pl.analysis <run_dir> <qd> analyses a finished run again.

Attributes

COORDINATES

FIT_DEFAULTS

_MICRO

_COUNTERS

_COUNTER_MEANING

Classes

_PowerLaw

I ∝ P^k fitted on log–log axes.

_Saturation

I = I_sat · P / (P + P_sat).

_PowerDependence

What power_dependence() found.

Functions

power_law(→ Optional[_PowerLaw])

Fit log10 I = k · log10 P + c over the points in use; None below four points.

saturation(→ Optional[_Saturation])

Fit I = I_sat · P / (P + P_sat); None when the data do not constrain P_sat.

_band(→ numpy.ndarray)

Pixels inside band, or every pixel when no band is given.

legend_space(→ plesty.lib.monitor.Line)

An invisible trace that raises the y axis so the legend clears the data.

power_dependence(→ _PowerDependence)

Analyse a power series and write its report.

_k(→ Any)

A table cell for an exponent.

_report(→ plesty.lib.report.Report)

The sentence, the two tables and the three figures.

_quality_table(→ Optional[plesty.lib.report.Table])

The line fit's quality counters, one row per line; None when all are zero.

analyze_run(→ dict[str, Any])

Analyse one dot of a run and save the line fit and the report under analysis/.

main(→ None)

Analyse a finished run again: python -m plesty.pow_pl.analysis <run_dir> <qd>.

Module Contents

plesty.pow_pl.analysis.COORDINATES = ('power_w', 'exposure_s', 'hwp_deg')
plesty.pow_pl.analysis.FIT_DEFAULTS: dict[str, Any]
plesty.pow_pl.analysis._MICRO = 1000000.0
class plesty.pow_pl.analysis._PowerLaw

I ∝ P^k fitted on log–log axes.

k: float
k_err: float
intercept: float
p_min_uw: float
p_max_uw: float
points: int
class plesty.pow_pl.analysis._Saturation

I = I_sat · P / (P + P_sat).

i_sat: float
i_sat_err: float
p_sat_uw: float
p_sat_err_uw: float
class plesty.pow_pl.analysis._PowerDependence

What power_dependence() found.

integral: _PowerLaw | None
integral_saturation: _Saturation | None
lines: list[dict[str, Any]]
saturation: _Saturation | None
saturation_line_nm: float | None
fit: plesty.lib.data.SpectrumFitData
warnings: list[str]
report: plesty.lib.report.Report
plesty.pow_pl.analysis.power_law(power_uw: numpy.ndarray, intensity: numpy.ndarray, use: numpy.ndarray) → _PowerLaw | None

Fit log10 I = k · log10 P + c over the points in use; None below four points.

Parameters:
  • power_uw (numpy.ndarray) – Excitation power per point, µW.

  • intensity (numpy.ndarray) – Intensity per point, counts/s.

  • use (numpy.ndarray) – Which points enter the fit.

Returns:

The fitted law with the slope’s standard error, or None.

Return type:

Optional[_PowerLaw]

plesty.pow_pl.analysis.saturation(power_uw: numpy.ndarray, intensity: numpy.ndarray, use: numpy.ndarray) → _Saturation | None

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.

Parameters:
  • power_uw (numpy.ndarray)

  • intensity (numpy.ndarray)

  • use (numpy.ndarray)

Return type:

Optional[_Saturation]

plesty.pow_pl.analysis._band(wavelength: numpy.ndarray, band: collections.abc.Sequence[float] | None) → numpy.ndarray

Pixels inside band, or every pixel when no band is given.

Parameters:
  • wavelength (numpy.ndarray)

  • band (Optional[collections.abc.Sequence[float]])

Return type:

numpy.ndarray

plesty.pow_pl.analysis.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.

Parameters:
  • drawables (list[Any])

  • rows (int)

Return type:

plesty.lib.monitor.Line

plesty.pow_pl.analysis.power_dependence(spectrum: plesty.lib.data.SpectrumData, *, qd: str = '', region_nm: collections.abc.Sequence[float] | None = None, background_nm: collections.abc.Sequence[float] | None = None, snr: float = 5.0, fit_options: collections.abc.Mapping[str, Any] | None = None, provenance: dict[str, Any] | None = None) → _PowerDependence

Analyse a power series and write its report.

Parameters:
  • spectrum (plesty.lib.data.SpectrumData) – One frame per acquisition, with the coordinates of COORDINATES.

  • qd (str) – The dot, for the report’s words.

  • region_nm (Optional[collections.abc.Sequence[float]]) – [start, stop] of the dot’s lines; every pixel when None.

  • background_nm (Optional[collections.abc.Sequence[float]]) – [start, stop] free of emission, for each frame’s background and noise; the whole frame’s median when None.

  • snr (float) – A point enters a fit only this many noise σ above zero.

  • fit_options (Optional[collections.abc.Mapping[str, Any]]) – Passed to SpectrumFit over FIT_DEFAULTS.

  • provenance (Optional[dict[str, Any]]) – Stamped on the report.

Returns:

The two analyses, the line fit and the report.

Return type:

_PowerDependence

plesty.pow_pl.analysis._k(law: _PowerLaw | None) → Any

A table cell for an exponent.

Parameters:

law (Optional[_PowerLaw])

Return type:

Any

plesty.pow_pl.analysis._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: collections.abc.Sequence[float] | None, snr: float, integral: numpy.ndarray, above: numpy.ndarray, law: _PowerLaw | None, integral_sat: _Saturation | None, lines: list[dict[str, Any]], brightest: dict[str, Any] | None, line_sat: _Saturation | None, diagnostics: collections.abc.Sequence[collections.abc.Mapping[str, int]]) → plesty.lib.report.Report

The sentence, the two tables and the three figures.

Parameters:
  • 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]])

Return type:

plesty.lib.report.Report

plesty.pow_pl.analysis._COUNTERS
plesty.pow_pl.analysis._COUNTER_MEANING
plesty.pow_pl.analysis._quality_table(lines: list[dict[str, Any]], diagnostics: collections.abc.Sequence[collections.abc.Mapping[str, int]], frames: int) → plesty.lib.report.Table | None

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.

Parameters:
  • lines (list[dict[str, Any]])

  • diagnostics (collections.abc.Sequence[collections.abc.Mapping[str, int]])

  • frames (int)

Return type:

Optional[plesty.lib.report.Table]

plesty.pow_pl.analysis.analyze_run(run_dir: pathlib.Path, qd: str, analysis: collections.abc.Mapping[str, Any] | None = None) → dict[str, Any]

Analyse one dot of a run and save the line fit and the report under analysis/.

Parameters:
  • run_dir (pathlib.Path) – The run directory.

  • qd (str) – Quantum-dot identifier.

  • analysis (Optional[collections.abc.Mapping[str, Any]]) – The configuration’s analysis block.

Returns:

exponents, saturation, warnings and the paths of what was saved, relative to the run.

Return type:

The record of the analysis step

plesty.pow_pl.analysis.main(argv: collections.abc.Sequence[str] | None = None) → None

Analyse a finished run again: python -m plesty.pow_pl.analysis <run_dir> <qd>.

Parameters:

argv (Optional[collections.abc.Sequence[str]])

Return type:

None