Skip to content

sgnl.sinks.psd_sink

An element to write out PSDs to xml files.

PSDSink dataclass

Bases: SinkElement

A sink element that dumps a PSD to an LIGOLW XML file

Source code in sgnl/sinks/psd_sink.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@dataclass
class PSDSink(SinkElement):
    """
    A sink element that dumps a PSD to an LIGOLW XML file
    """

    fname: str = None

    def __post_init__(self):
        super().__post_init__()
        self.psd = {}

    def pull(self, pad: SinkPad, frame: Frame) -> None:
        if frame.EOS:
            self.mark_eos(pad)
            self.psd[pad.name.split(":")[-1]] = frame.metadata["psd"]

    def internal(self) -> None:
        if self.at_eos:
            write_psd(self.fname, self.psd)