Skip to content

DIA Windows

tdfpy.DiaWindow dataclass

DiaWindow(
    _timsdata: TimsData,
    window_index: int,
    window_group: int,
    scan_num_begin: int,
    scan_num_end: int,
    isolation_mz: float,
    isolation_width: float,
    collision_energy: float,
    frame_id: int,
    rt: float,
    polarity: Polarity,
)

Bases: DiaWindowGroup, _TdfData

A DIA isolation window bound to a specific frame.

Extends DiaWindowGroup with per-frame context (frame_id, rt, polarity). Provides raw and centroided spectrum access and ion mobility conversion properties.

frame_id instance-attribute

frame_id: int

Frame ID this window belongs to.

rt instance-attribute

rt: float

Retention time of the parent frame in seconds.

polarity instance-attribute

polarity: Polarity

Ion polarity.

peaks property

peaks: list[npt.NDArray[np.float64]]

Read raw peaks for this DIA window and return as list of (mz, intensity) arrays.

raw_peaks

raw_peaks(
    *,
    exclude: ChargeStateRegion | None = None,
    smooth: Smooth | None = None,
    noise: NoiseSpec = None,
    ion_mobility_type: Literal[
        "ook0", "ccs", "voltage"
    ] = "ook0"
) -> np.ndarray

Return raw peaks for this DIA window — restricted to the window's scan range [scan_num_begin, scan_num_end).

Mirrors :meth:Frame.raw_peaks.

Source code in src/tdfpy/elems.py
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
def raw_peaks(
    self,
    *,
    exclude: ChargeStateRegion | None = None,
    smooth: Smooth | None = None,
    noise: NoiseSpec = None,
    ion_mobility_type: Literal["ook0", "ccs", "voltage"] = "ook0",
) -> np.ndarray:
    """Return raw peaks for this DIA window — restricted to the
    window's scan range ``[scan_num_begin, scan_num_end)``.

    Mirrors :meth:`Frame.raw_peaks`.
    """
    return _frame_raw_peaks(
        self.timsdata,
        self.frame_id,
        scan_range=(self.scan_num_begin, self.scan_num_end),
        exclude=exclude,
        smooth=smooth,
        noise=noise,
        ion_mobility_type=ion_mobility_type,
    )

centroid

centroid(
    *,
    exclude: ChargeStateRegion | None = None,
    smooth: Smooth | None = None,
    noise: NoiseSpec = None,
    ion_mobility_type: Literal[
        "ook0", "ccs", "voltage"
    ] = "ook0",
    centroid: Centroider | None = None
) -> np.ndarray

Centroid the spectrum for this DIA window — restricted to the window's scan range [scan_num_begin, scan_num_end).

Mirrors :meth:Frame.centroid.

Source code in src/tdfpy/elems.py
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
def centroid(
    self,
    *,
    exclude: ChargeStateRegion | None = None,
    smooth: Smooth | None = None,
    noise: NoiseSpec = None,
    ion_mobility_type: Literal["ook0", "ccs", "voltage"] = "ook0",
    centroid: Centroider | None = None,
) -> np.ndarray:
    """Centroid the spectrum for this DIA window — restricted to the
    window's scan range ``[scan_num_begin, scan_num_end)``.

    Mirrors :meth:`Frame.centroid`.
    """
    return _frame_centroid(
        self.timsdata,
        self.frame_id,
        scan_range=(self.scan_num_begin, self.scan_num_end),
        exclude=exclude,
        smooth=smooth,
        noise=noise,
        ion_mobility_type=ion_mobility_type,
        centroid=centroid,
    )

tdfpy.DiaWindowGroup dataclass

DiaWindowGroup(
    window_index: int,
    window_group: int,
    scan_num_begin: int,
    scan_num_end: int,
    isolation_mz: float,
    isolation_width: float,
    collision_energy: float,
)

A DIA isolation window definition (shared across frames in the same group).

Defines the m/z isolation range, mobility scan range, and collision energy for one window within a DIA window group. DiaWindow extends this with per-frame fields (frame_id, rt, polarity).

Field Type Description
window_index int Index of this window within its group
window_group int Window group ID
scan_num_begin int First mobility scan (inclusive)
scan_num_end int Last mobility scan (inclusive)
isolation_mz float Isolation window center m/z
isolation_width float Isolation window width in Th
collision_energy float Collision energy in eV