.. index:: TEM emission, emission data structure, detectors TEM emission data ================= ``TEMCell.Measure_Emission`` stores corrected receiver voltages for noise, EUT orientations, and optional detector remeasurements. Evaluation proceeds in stages through ``Calculate_Prad``, ``Calculate_Emax``, and optionally ``Calculate_EmissionLimitComparison``:: raw = history.rawData_Emission[description] result = history.processedData_Emission[description] Raw data -------- The canonical measurement paths are:: raw["voltage"][detector][frequency][port][position][sample] raw["noise"][detector][frequency][port][0][sample] Detector names are normalized, typically to ``"PK"``, ``"QP"``, or ``"AV"``. ``frequency`` is a numeric frequency value in Hz; ``port`` and ``sample`` are integer indices. The noise position key ``0`` represents a position-independent measurement. Older histories without a detector level (``voltage[frequency][port][position]``) remain readable and are assigned to the fallback detector. A measurement entry contains ``value``, ``pfwd``, ``pbwd``, ``detector``, ``receiver``, and ``acquisition_source``. ``value`` is a voltage quantity after path correction. The two power keys are normally ``None`` in this receiver workflow and exist only for compatibility with the shared entry structure. .. list-table:: Further raw-data keys :header-rows: 1 :widths: 34 66 * - Key - Meaning * - ``geometry``, ``eut_position`` - GTEM geometry and optional EUT coordinates. * - ``prescan_detector`` - Detector used for the fast initial scan. * - ``acquisition`` - Measurement-run ``mode``, ``scan_chunk_size``, ``progress_log_batch_size``, and ``detailed_point_logging``. * - ``Prescreen`` - Frequency-, port-, and position-specific prescreen assessment. * - ``RemeasureRequiredFrequencies`` - Sorted frequencies requiring remeasurement. * - ``RemeasurementCoverage`` - ``complete``, ``operator_decision``, and remaining ``missing`` detector/position/frequency combinations. * - ``prescreen_e0y_source`` - Field-factor provenance used for prescreening. * - ``mg`` - Persisted measurement-graph description, not an open device connection. ``Prescreen[frequency][port][position]`` contains ``field_limit``, ``voltage_limit``, ``measured_peak_voltage``, ``margin_db``, ``remeasure_required``, ``prescreen_margin_db``, ``position_count_assumption``, ``prescan_detector``, ``remeasure_detector``, ``e0y_source_family``, and ``e0y_source_name``. Evaluation structure -------------------- Evaluation adds to one shared dataset, so the available keys depend on the stages executed. ``Evaluate_Emission`` runs ``Calculate_Prad`` and ``Calculate_Emax`` and also adds the comparison when a limit is configured. After ``Calculate_Prad`` the following are present: ``Prad``, ``Prad_noise`` ``[frequency][port][result_index]`` contains a power quantity in W. ``detector_used`` ``[frequency][port][position]`` names the detector used for each voltage. ``correlation_positions`` ``[frequency][port][result_index]`` is the tuple of three orthogonal EUT orientations entering the correlation. ``correlation_detectors`` Same index; list of detectors actually used. ``e0y_source`` Field-factor provenance including ``family``, ``name``, and ``component``. Depending on the selection it contains further geometry, position, or verification metadata. After ``Calculate_Emax``, ``Emax`` and ``Emax_noise`` are added. Their path is ``[frequency][port][result_index]`` and each entry has ``h``, ``v``, and ``total`` field-strength quantities. ``total`` is the larger polarized result. Assumptions are recorded explicitly as ``Assumed_Distance``, ``Gmax_Model``, ``Assumed_hg``, ``Assumed_RH``, ``Assumed_Zc``, and ``Assumed_Directivity[frequency]``. Detector and limit assessment ----------------------------- Processed prescreening can also create ``Prescreen``, ``RemeasureRequiredFrequencies``, ``EmissionLimit``, and ``prescreen_e0y_source``. The raw prescreen nevertheless controls the actual measurement workflow and remeasurement decision. ``LimitComparison[frequency][port][result_index]`` has ``Emax``, ``limit``, ``margin_db``, ``passed``, ``detector_required``, ``detector_used``, and ``detector_fallback``. ``passed`` is ``None`` when no valid limit exists at a frequency. ``detector_fallback == True`` indicates that at least one required final detector was missing. This information must not be ignored when interpreting an apparently passing limit comparison. Missing or unresolved limit variants keep the existing ``passed=None``, ``limit=None`` and ``margin_db=None`` semantics. The global variant status differs from the optional per-frequency assessment fields. See :doc:`../framework/limit-references`. New ``LimitComparison`` entries additionally contain optional ``limit_status`` (str: applicable/exempt/unresolved/out_of_range) and ``limit_reason`` (str). Exempt/unresolved assessments retain ``limit=None``, ``margin_db=None`` and ``passed=None``. Old histories without the fields remain readable; missing status is unknown, never inferred as exemption. Numeric field values and all existing keys/indices retain their established meanings. ``EmissionLimit`` may contain the optional operating_frequency attribute described in the reference matrix. Prescreen entries keep their existing structure. Resolver-created ``EmissionLimit`` objects may additionally contain ``profile_id`` (string): the registered model identity, independent of its selection parameters. It is optional for direct construction and old pickles. A detector mismatch no longer produces ``passed=True``: below-limit results with ``detector_fallback=True`` have ``passed=None``; the numerical margin remains available. This does not change existing result keys or units. Retained orientation sweeps --------------------------- The ``tem-emission.py`` script is interactive by default. After each complete orientation sweep it shows corrected voltages in dBµV, the voltage screening limit and the threshold ``limit - prescreen_margin_db``. Noise is included when available. These are single-orientation screening curves, not a final radiated-field compliance result; absent limit segments remain unassessed. The operator can repeat the orientation, continue, or finish early. Variant and notes describe the EUT state **during the displayed sweep**. After choosing repeat, prepare the next EUT state before starting the next sweep. Set top-level ``cdict["interactive_sweeps"] = False`` for unattended operation; a per-description ``measure_parameters`` entry can override this. Direct ``TEMCell.Measure_Emission`` calls retain ``interactive_sweeps=False`` by default. Optional ``sweep_variant`` (default ``"default"``) and ``sweep_notes`` (default empty string) initialize the labels. Review can use Qt or the terminal with saved PNG plots. Live plotting during acquisition and selection of older curves for display overlays are not yet implemented. Interactive histories add the following **optional** raw-data keys. Old histories without them remain readable; existing voltage/noise units and index hierarchy are unchanged. The working ``voltage`` dictionary contains the latest sweep per orientation; use the retained snapshots for repetitions, not aligned sample-list indices across orientations:: raw["orientation_sweeps"][sweep_id] # dict, independent snapshot raw["active_orientation_sweep"] # str, only while pending raw["selected_orientation_sweeps"][position] # str, latest accepted ID raw["sweep_selections"][evaluation_name]["sweeps"] # dict: position -> ID raw["interactive_session_incomplete"] # bool, retain resume file ``sweep_id`` is a stable UUID hex string. Each record contains ``id`` (str), ``position`` (orientation string), ``variant`` and ``notes`` (str), ``acquisition_id`` (zero-based acquisition integer), ``frequencies`` (tuple of floats in Hz), ``prescan_detector`` (str), ``started_at_utc`` (ISO UTC str), and ``status`` (``running``, ``awaiting_review``, ``complete`` or ``interrupted``). Snapshots add ``updated_at_utc``; accepted sweeps also have ``finished_at_utc``. ``limit_title`` (str) and ``screening_parameters`` (``prescreen_margin_db`` in dB and ``position_count_assumption`` as integer) record the screening context when available. Snapshot ``voltage`` retains the detector/frequency/port/position/sample hierarchy, limited to that orientation. Available ``noise``, ``Prescreen``, ``RemeasurementCoverage``, ``acquisition`` and ``prescreen_e0y_source`` are copied as context. Prescreen context may include other orientations; only the record's ``position`` belongs to that sweep. New receiver samples may carry ``orientation_sweep_id`` (str). Snapshots and working dictionaries do not share mutable containers. Interrupted sweeps resume with the same ID and existing samples; a deliberate repetition receives a new ID. Autosave remains available when finishing before all requested orientations are acquired. Legacy samples are archived before an interactive measurement replaces a working orientation. Imported records have ``legacy_import=True``, ``variant="legacy"``, ``started_at_utc=None`` and notes naming their original sample index. ``acquisition_id`` is taken from sample metadata or is the string ``"legacy"`` when unavailable. Mixed acquisition metadata makes an imported record ``interrupted`` and ineligible for final selection. Legacy records may lack the optional context and timestamp fields above. The final selection dialog accepts one complete sweep per orientation, for one canonical orthogonal triplet or all twelve orientations (Annex A.3.2.3.2 of the maintained IEC 61000-4-20 draft). Frequency grids, acquisition IDs and EUT variants must agree, with complete prescan coverage. Several named sets can be added without enumerating every possible combination. Unequal repeat counts are allowed. Display selection and evaluation selection remain separate concepts; retained IDs and notes support future comparison overlays. Each ``sweep_selections`` entry contains ``sweeps`` (position-to-ID dict), ``created_at_utc`` (ISO UTC str), and, after evaluation, ``result_description`` (str). The creation time is captured when each named set is added in Qt or the terminal, and survives a later Finish action and pickle restoration unchanged. Custom adapters using the original two-argument ``SweepEvaluationSelection`` constructor may omit the time; only then does the workflow use its commit time. Supplied times must be ISO timestamps in UTC. All proposals are validated before any selection is stored; this adds no persisted key or schema change. Evaluation creates an independent legacy-shaped raw view and processed result under ``description + "::" + evaluation_name``; its ``selected_orientation_sweeps`` records the provenance. The correlation formulas and final-detector checks are unchanged. No set is evaluated implicitly: closing the dialog without adding a set saves all measurements without creating a new final result. All retained records and selections are included in the measurement pickle; ordinary raw-table export represents the working dictionary rather than every retained repetition. The sweep review distinguishes two ways to stop: **Finish acquisition & select results** ends acquisition and proceeds to final selection. **Save & exit without evaluation** retains measured sweeps and exits without new final evaluations. In the selection dialog, this latter action discards newly staged selection sets; previous selections/results remain. Both buttons have explanatory tooltips. The TEM emission main window calls its interruption control **Stop measurement**; other measurement types retain their RF-off control. Terminal review without PySide6 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The default ``sweep_review="auto"`` uses installed Qt with a display or GUI dispatcher, otherwise terminal review. To force terminal review, configure:: cdict["interactive_sweeps"] = True cdict["sweep_review"] = "terminal" cdict["sweep_review_dir"] = "output/sweep-review" Individual ``measure_parameters`` entries override these settings. Direct ``Measure_Emission`` calls accept the same two review arguments. ``qt`` explicitly requires Qt. Terminal review needs interactive stdin; if no usable display or terminal exists, availability checking stops before device creation. No review is silently accepted. Unattended runs still use ``interactive_sweeps=False``. Before each review the program saves a PNG and prints its full path, sweep ID and orientation. The image uses the same helper as Qt: corrected voltages, available noise, screening limits and margin thresholds. Open it in an image viewer, copying it from the measurement computer if needed. The program does not launch another application. Single-orientation screening is not a final radiation result; missing limit segments remain unassessed. After variant/notes prompts, explicitly choose ``1`` to repeat, ``2`` to proceed, ``3`` to finish acquisition and select evaluations, or ``4`` to save and exit without accepting the pending sweep or creating a new evaluation. Empty variant/notes input keeps existing values; ``-`` clears notes. An empty/invalid decision repeats the prompt. EOF or Ctrl-C means save/exit, never approval. Pending data retains ``awaiting_review`` and ``interactive_session_incomplete=True``; resume reuses its ID and samples. RF-off/quit cleanup still runs. Metadata is committed only after validation. Final selection lists complete sweeps with IDs, variants and notes. Choose a group number or ``a`` for all twelve orientations, then one sweep number per orientation and an unused evaluation name. Several named sets are possible; ``f`` finishes and submits them. ``x``, EOF or Ctrl-C discards newly staged sets; previously stored results remain. The same coverage, variant, grid and acquisition-ID checks apply to Qt and terminal; no incomplete set is evaluated. Without an explicit directory, PNGs go beside the autosave file in ``-sweep-review``; without an autosave path the default is ``tem-emission-review`` in the working directory. Names derive from sweep IDs and are reused when a retained sweep is shown again. Images are external review artifacts, not new pickle attributes or final reports; keep them with measurement output outside the source repository. Adapters and callbacks are local, are not pickled and are recreated from configuration when resuming.