prsctrl.data.merge.merge_spectra#

merge_spectra(*datas: PrsData, merge_options: MergeOptions, columns: list[str] | None = None, xkey: str = 'E', **get_spectrum_kw) → PrsData[source]#

Merge multiple photoreflectance-type spectra into one.

TODO: describe merging process and reason for it

The “fit_overlap_or_gradient” method falls back to gradient extrapolation if two datas do not overlap. TODO: Implement simple “overwrite” merge. TODO: only scale required columns dI-X and dI-Y? or only dI? Use normal dI-X and dI-Y and normalize to fitted dI should be most useful result.

although angle might change if illumination changes. Scaling dI-X and dI-Y also not useful, since dI might be vastly different. -> Only sensible thing is scaling only dI/I, dI-X/I, dI-Y/I and calculate theta-corr from that.

Parameters:
  • * – PrsData objects to merge in any order.

  • merge_options – MergeOptions describing how to merge the data.

  • columns – Columns to merge. Defaults to DEFAULT_MERGE_COLUMNS.

  • xkey – Which x-values to use to merge. Defaults to “E”.

Raises:
  • ValueError – If an invalid merge option is given, or if the datas do not overlap in exactly one region with another data.

  • NotImplementedError –

  • RuntimeError – If getting spectrum data fails.

Returns:

The merged data object, with its hierarchy set to the hierarchy of the highest-priority data but with its part set to ‘+’. The data_path argument will be initialized with the series_dir_path from the highest-priority data.