Module psfdata.psf
Classes
class PsfFile
-
Expand source code
class PsfFile(ABC): """Base class for ASCII and binary PSF files (and other file formats?)""" @staticmethod def load(path: Path | str) -> PsfFile: """ Load a PSF (binary/ASCII) file from the given file path. """ path = Path(path) with open(path, 'rb') as f: header_bytes = f.read(6) if header_bytes == str.encode('HEADER'): from psfdata.psfascii import PsfAsciiFile return PsfAsciiFile(path) else: from psfdata.psfbin import PsfBinFile return PsfBinFile(path) @property @abstractmethod def header(self) -> dict[str, Any]: ... @property @abstractmethod def sweep_info(self) -> dict[str, Any] | SignalDef | None: ... @property @abstractmethod def names(self) -> list[str]: ... @abstractmethod def signal_info(self, name: str) -> dict[str, Any]: ... @abstractmethod def get_signal(self, name: str) -> Waveform | dict | int | float: ... def print_info(self) -> None: print("HEADER") for k, v in self.header.items(): print(f" {k+':':<24} {str(v)[:80]}") print("VALUES") for n in self.names: print(f" {n}")
Base class for ASCII and binary PSF files (and other file formats?)
Ancestors
- abc.ABC
Subclasses
Static methods
def load(path: Path | str) ‑> PsfFile
-
Expand source code
@staticmethod def load(path: Path | str) -> PsfFile: """ Load a PSF (binary/ASCII) file from the given file path. """ path = Path(path) with open(path, 'rb') as f: header_bytes = f.read(6) if header_bytes == str.encode('HEADER'): from psfdata.psfascii import PsfAsciiFile return PsfAsciiFile(path) else: from psfdata.psfbin import PsfBinFile return PsfBinFile(path)
Load a PSF (binary/ASCII) file from the given file path.
Instance variables
prop header : dict[str, Any]
-
Expand source code
@property @abstractmethod def header(self) -> dict[str, Any]: ...
prop names : list[str]
-
Expand source code
@property @abstractmethod def names(self) -> list[str]: ...
prop sweep_info : dict[str, Any] | SignalDef | None
-
Expand source code
@property @abstractmethod def sweep_info(self) -> dict[str, Any] | SignalDef | None: ...
Methods
def get_signal(self, name: str) ‑> Waveform | dict | int | float
-
Expand source code
@abstractmethod def get_signal(self, name: str) -> Waveform | dict | int | float: ...
def print_info(self) ‑> None
-
Expand source code
def print_info(self) -> None: print("HEADER") for k, v in self.header.items(): print(f" {k+':':<24} {str(v)[:80]}") print("VALUES") for n in self.names: print(f" {n}")
def signal_info(self, name: str) ‑> dict[str, typing.Any]
-
Expand source code
@abstractmethod def signal_info(self, name: str) -> dict[str, Any]: ...