aiida_pythonjob_ins.workflows.tosca

WorkChains composing the TOSCA scattering-intensity operations.

Two chains, split by input rather than combined into one with an either/or port (see proposal.md and Decision 1 in design.md): a required parameter for one input (q_spacing) would be meaningless for the other, which a flat process spec cannot express honestly.

ToscaFromModesWorkChain runs three provenance steps, split so that a change to one input does not invalidate the others under caching (Decision 5):

  1. compute_intensities – a PythonJob computing the full, ungrouped line set (every atom x quantum-order x detector-angle component). Expensive; the step this design exists to make reusable.

  2. group_spectra – a cheap calcfunction grouping/summing that line set by caller-supplied metadata keys (Decision 6).

  3. broaden_spectra – a cheap calcfunction applying TOSCA’s resolution broadening to the grouped result (Decision 9). Broadening after grouping is exact, not approximate: the resolution operator is linear, so broaden(sum(y)) == sum(broaden(y)).

Functions

group_spectra(→ aiida.orm.XyData)

Group/sum the full TOSCA line set by the requested metadata keys.

broaden_spectra(→ aiida.orm.XyData)

Apply TOSCA resolution broadening to an already-grouped line set.

Module Contents

aiida_pythonjob_ins.workflows.tosca.group_spectra(components: aiida.orm.XyData, group_by: aiida.orm.List) aiida.orm.XyData[source]

Group/sum the full TOSCA line set by the requested metadata keys.

Empty keys yield a single total line: Euphonic’s group_by() with no keys already returns a one-line Spectrum1DCollection (unlike sum(), which returns a bare Spectrum1D), so routing both cases through group_by keeps this function’s return type – and therefore the conversion back to XyData – uniform (Decision 6).

aiida_pythonjob_ins.workflows.tosca.broaden_spectra(grouped: aiida.orm.XyData, resolution_model: aiida.orm.Str) aiida.orm.XyData[source]

Apply TOSCA resolution broadening to an already-grouped line set.