Lead Derivation

Pure numpy, no scipy required. Validates that sample rates and lengths match.

  • Raw leads with the same resolution and resolution_unit are combined in ADC counts (offsets folded in), and the derived leads stay raw on that scale.

  • Otherwise both leads are converted to physical values in lead I’s unit first, and the derived leads are physical. derive_standard_12 then also converts I, II and V1 to V6, so all 12 leads share one scale.

  • Raw leads with different scales and no voltage unit raise ValueError.

  • Derived leads do not copy file-specific metadata from lead I: annotations, quality, transducer and adc_resolution are reset.

derive_lead_iii()

Derive Lead III from Leads I and II (Einthoven’s law)

derive_augmented()

Derive augmented limb leads aVR, aVL, aVF

derive_standard_12()

Assemble a full 12-lead ECG

find_lead()

Find a lead by label (case-insensitive)

ecgdatakit.processing.derive_lead_iii(lead_i, lead_ii, *, fs=None)[source]

Derive Lead III from Leads I and II (Einthoven’s law: III = II - I).

Parameters:
Return type:

Lead

ecgdatakit.processing.derive_augmented(lead_i, lead_ii, *, fs=None)[source]

Derive augmented limb leads aVR, aVL, aVF from Leads I and II.

Parameters:
Returns:

[aVR, aVL, aVF] in that order.

Return type:

list[Lead]

ecgdatakit.processing.derive_standard_12(lead_i, lead_ii, v1, v2, v3, v4, v5, v6, *, fs=None)[source]

Assemble a full 12-lead ECG, deriving III, aVR, aVL, aVF.

Parameters:
  • lead_i (Lead | NDArray[double]) – Limb leads I and II.

  • lead_ii (Lead | NDArray[double]) – Limb leads I and II.

  • v1..v6 (Lead | NDArray[np.float64]) – Precordial leads.

  • fs (int | None) – Sample rate in Hz. Required when passing numpy arrays.

  • v1 (Lead | NDArray[float64])

  • v2 (Lead | NDArray[float64])

  • v3 (Lead | NDArray[float64])

  • v4 (Lead | NDArray[float64])

  • v5 (Lead | NDArray[float64])

  • v6 (Lead | NDArray[float64])

Returns:

12 leads in standard order: I, II, III, aVR, aVL, aVF, V1–V6. When the limb leads had to be converted to physical values (see the module notes), I, II and V1–V6 are returned converted as well, so all 12 leads share one scale.

Return type:

list[Lead]

ecgdatakit.processing.find_lead(leads, label)[source]

Find a lead by label (case-insensitive).

Parameters:
  • leads (list[Lead]) – List of leads to search.

  • label (str) – Lead label to find (e.g., “II”, “avl”, “V1”).

Return type:

Lead | None