pytomography.io.PET.prd._binary
#
Module Contents#
Classes#
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Base class for protocol classes. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
Functions#
|
|
|
Attributes#
- class pytomography.io.PET.prd._binary.BinaryProtocolWriter(stream, schema)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
stream (pytomography.io.PET.prd.yardl_types.Union[BinaryIO, str]) –
schema (str) –
- class pytomography.io.PET.prd._binary.BinaryProtocolReader(stream, expected_schema)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- Parameters:
stream (pytomography.io.PET.prd.yardl_types.Union[io.BufferedReader, io.BytesIO, BinaryIO, str]) –
expected_schema (Optional[str]) –
- class pytomography.io.PET.prd._binary.CodedOutputStream(stream, *, buffer_size=65536)[source]#
- Parameters:
stream (pytomography.io.PET.prd.yardl_types.Union[BinaryIO, str]) –
buffer_size (int) –
- write(formatter, *args)[source]#
- Parameters:
formatter (struct.Struct) –
args (Any) –
- Return type:
None
- write_bytes(data)[source]#
- Parameters:
data (pytomography.io.PET.prd.yardl_types.Union[bytes, bytearray]) –
- Return type:
None
- write_bytes_directly(data)[source]#
- Parameters:
data (pytomography.io.PET.prd.yardl_types.Union[bytes, bytearray, memoryview]) –
- Return type:
None
- write_unsigned_varint(value)[source]#
- Parameters:
value (pytomography.io.PET.prd.yardl_types.Union[int, pytomography.io.PET.prd.yardl_types.np.uint8, pytomography.io.PET.prd.yardl_types.np.uint16, pytomography.io.PET.prd.yardl_types.np.uint32, pytomography.io.PET.prd.yardl_types.np.uint64]) –
- Return type:
None
- zigzag_encode(value)[source]#
- Parameters:
value (pytomography.io.PET.prd.yardl_types.Union[int, pytomography.io.PET.prd.yardl_types.np.int8, pytomography.io.PET.prd.yardl_types.np.int16, pytomography.io.PET.prd.yardl_types.np.int32, pytomography.io.PET.prd.yardl_types.np.int64]) –
- Return type:
int
- write_signed_varint(value)[source]#
- Parameters:
value (pytomography.io.PET.prd.yardl_types.Union[int, pytomography.io.PET.prd.yardl_types.np.int8, pytomography.io.PET.prd.yardl_types.np.int16, pytomography.io.PET.prd.yardl_types.np.int32, pytomography.io.PET.prd.yardl_types.np.int64]) –
- Return type:
None
- class pytomography.io.PET.prd._binary.CodedInputStream(stream, *, buffer_size=65536)[source]#
- Parameters:
stream (pytomography.io.PET.prd.yardl_types.Union[io.BufferedReader, io.BytesIO, BinaryIO, str]) –
buffer_size (int) –
- class pytomography.io.PET.prd._binary.TypeSerializer(dtype)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.Generic
[T
,T_NP
],pytomography.io.PET.prd.yardl_types.ABC
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
dtype (numpy.typing.DTypeLike) –
- abstract write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (T) –
- Return type:
None
- abstract write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (T_NP) –
- Return type:
None
- abstract read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
T
- abstract read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
T_NP
- class pytomography.io.PET.prd._binary.StructSerializer(numpy_type, format_string)[source]#
Bases:
TypeSerializer
[T
,T_NP
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
numpy_type (type) –
format_string (str) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (T) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (T_NP) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
T
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
T_NP
- class pytomography.io.PET.prd._binary.BoolSerializer[source]#
Bases:
StructSerializer
[bool
,pytomography.io.PET.prd.yardl_types.np.bool_
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
bool
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.bool_
- class pytomography.io.PET.prd._binary.Int8Serializer[source]#
Bases:
StructSerializer
[pytomography.io.PET.prd.yardl_types.Int8
,pytomography.io.PET.prd.yardl_types.np.int8
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.Int8
- class pytomography.io.PET.prd._binary.UInt8Serializer[source]#
Bases:
StructSerializer
[pytomography.io.PET.prd.yardl_types.UInt8
,pytomography.io.PET.prd.yardl_types.np.uint8
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.UInt8
- class pytomography.io.PET.prd._binary.Int16Serializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.Int16
,pytomography.io.PET.prd.yardl_types.np.int16
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.Int16) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.int16) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.Int16
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.int16
- class pytomography.io.PET.prd._binary.UInt16Serializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.UInt16
,pytomography.io.PET.prd.yardl_types.np.uint16
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.UInt16) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.uint16) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.UInt16
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.uint16
- class pytomography.io.PET.prd._binary.Int32Serializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.Int32
,pytomography.io.PET.prd.yardl_types.np.int32
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.Int32) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.int32) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.Int32
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.int32
- class pytomography.io.PET.prd._binary.UInt32Serializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.UInt32
,pytomography.io.PET.prd.yardl_types.np.uint32
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.UInt32) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.uint32) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.UInt32
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.uint32
- class pytomography.io.PET.prd._binary.Int64Serializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.Int64
,pytomography.io.PET.prd.yardl_types.np.int64
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.Int64) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.int64) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.Int64
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.int64
- class pytomography.io.PET.prd._binary.UInt64Serializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.UInt64
,pytomography.io.PET.prd.yardl_types.np.uint64
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.UInt64) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.uint64) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.UInt64
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.uint64
- class pytomography.io.PET.prd._binary.SizeSerializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.Size
,pytomography.io.PET.prd.yardl_types.np.uint64
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.Size) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.uint64) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.Size
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.uint64
- class pytomography.io.PET.prd._binary.Float32Serializer[source]#
Bases:
StructSerializer
[pytomography.io.PET.prd.yardl_types.Float32
,pytomography.io.PET.prd.yardl_types.np.float32
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.Float32
- class pytomography.io.PET.prd._binary.Float64Serializer[source]#
Bases:
StructSerializer
[pytomography.io.PET.prd.yardl_types.Float64
,pytomography.io.PET.prd.yardl_types.np.float64
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.Float64
- class pytomography.io.PET.prd._binary.Complex32Serializer[source]#
Bases:
StructSerializer
[pytomography.io.PET.prd.yardl_types.ComplexFloat
,pytomography.io.PET.prd.yardl_types.np.complex64
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.ComplexFloat) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.ComplexFloat
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.complex64
- class pytomography.io.PET.prd._binary.Complex64Serializer[source]#
Bases:
StructSerializer
[pytomography.io.PET.prd.yardl_types.ComplexDouble
,pytomography.io.PET.prd.yardl_types.np.complex128
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.ComplexDouble) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.ComplexDouble
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.complex128
- class pytomography.io.PET.prd._binary.StringSerializer[source]#
Bases:
TypeSerializer
[str
,pytomography.io.PET.prd.yardl_types.np.object_
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (str) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.object_) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
str
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.object_
- class pytomography.io.PET.prd._binary.DateSerializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.datetime.date
,pytomography.io.PET.prd.yardl_types.np.datetime64
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.datetime.date) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.datetime64) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.datetime.date
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.datetime64
- class pytomography.io.PET.prd._binary.TimeSerializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.Time
,pytomography.io.PET.prd.yardl_types.np.timedelta64
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.Time) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.timedelta64) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.timedelta64
- class pytomography.io.PET.prd._binary.DateTimeSerializer[source]#
Bases:
TypeSerializer
[pytomography.io.PET.prd.yardl_types.DateTime
,pytomography.io.PET.prd.yardl_types.np.datetime64
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.datetime64) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.datetime64
- class pytomography.io.PET.prd._binary.NoneSerializer[source]#
Bases:
TypeSerializer
[None
,Any
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (None) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (Any) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
None
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
Any
- class pytomography.io.PET.prd._binary.EnumSerializer(integer_serializer, enum_type)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.Generic
[TEnum
,T
,T_NP
],TypeSerializer
[TEnum
,T_NP
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
integer_serializer (TypeSerializer[T, T_NP]) –
enum_type (type) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (TEnum) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (T_NP) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
TEnum
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
T_NP
- class pytomography.io.PET.prd._binary.OptionalSerializer(element_serializer)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.Generic
[T
,T_NP
],TypeSerializer
[Optional
[T
],pytomography.io.PET.prd.yardl_types.np.void
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
element_serializer (TypeSerializer[T, T_NP]) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (Optional[T]) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.void) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
Optional[T]
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.void
- class pytomography.io.PET.prd._binary.UnionCaseProtocol[source]#
Bases:
Protocol
Base class for protocol classes.
Protocol classes are defined as:
class Proto(Protocol): def meth(self) -> int: ...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:
class GenProto(Protocol[T]): def meth(self) -> T: ...
- class pytomography.io.PET.prd._binary.UnionSerializer(union_type, cases)[source]#
Bases:
TypeSerializer
[T
,pytomography.io.PET.prd.yardl_types.np.object_
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
union_type (type) –
cases (list[Optional[tuple[type, TypeSerializer[Any, Any]]]]) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (T) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.object_) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
T
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.object_
- class pytomography.io.PET.prd._binary.StreamSerializer(element_serializer)[source]#
Bases:
TypeSerializer
[Iterable
[T
],Any
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
element_serializer (TypeSerializer[T, T_NP]) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (Iterable[T]) –
- Return type:
None
- abstract write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (Any) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
Iterable[T]
- abstract read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.object_
- class pytomography.io.PET.prd._binary.FixedVectorSerializer(element_serializer, length)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.Generic
[T
,T_NP
],TypeSerializer
[list
[T
],pytomography.io.PET.prd.yardl_types.np.object_
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
element_serializer (TypeSerializer[T, T_NP]) –
length (int) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (list[T]) –
- Return type:
None
- abstract write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.object_) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
list[T]
- abstract read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.object_
- class pytomography.io.PET.prd._binary.VectorSerializer(element_serializer)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.Generic
[T
,T_NP
],TypeSerializer
[list
[T
],pytomography.io.PET.prd.yardl_types.np.object_
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
element_serializer (TypeSerializer[T, T_NP]) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (list[T]) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.object_) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
list[T]
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.object_
- class pytomography.io.PET.prd._binary.MapSerializer(key_serializer, value_serializer)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.Generic
[TKey
,TKey_NP
,TValue
,TValue_NP
],TypeSerializer
[dict
[TKey
,TValue
],pytomography.io.PET.prd.yardl_types.np.object_
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
key_serializer (TypeSerializer[TKey, TKey_NP]) –
value_serializer (TypeSerializer[TValue, TValue_NP]) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (dict[TKey, TValue]) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.object_) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
dict[TKey, TValue]
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.object_
- class pytomography.io.PET.prd._binary.NDArraySerializerBase(overall_dtype, element_serializer, dtype)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.Generic
[T
,T_NP
],TypeSerializer
[numpy.typing.NDArray
[Any
],pytomography.io.PET.prd.yardl_types.np.object_
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
overall_dtype (numpy.typing.DTypeLike) –
element_serializer (TypeSerializer[T, T_NP]) –
dtype (numpy.typing.DTypeLike) –
- static _get_dtype_and_subarray_shape(dtype)[source]#
- Parameters:
dtype (pytomography.io.PET.prd.yardl_types.np.dtype[Any]) –
- Return type:
tuple[pytomography.io.PET.prd.yardl_types.np.dtype[Any], tuple[int, Ellipsis]]
- _write_data(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (numpy.typing.NDArray[Any]) –
- Return type:
None
- _read_data(stream, shape)[source]#
- Parameters:
stream (CodedInputStream) –
shape (tuple[int, Ellipsis]) –
- Return type:
numpy.typing.NDArray[Any]
- class pytomography.io.PET.prd._binary.DynamicNDArraySerializer(element_serializer)[source]#
Bases:
NDArraySerializerBase
[T
,T_NP
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
element_serializer (TypeSerializer[T, T_NP]) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (numpy.typing.NDArray[Any]) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.object_) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
numpy.typing.NDArray[Any]
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.object_
- class pytomography.io.PET.prd._binary.NDArraySerializer(element_serializer, ndims)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.Generic
[T
,T_NP
],NDArraySerializerBase
[T
,T_NP
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
element_serializer (TypeSerializer[T, T_NP]) –
ndims (int) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (numpy.typing.NDArray[Any]) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.object_) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
numpy.typing.NDArray[Any]
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.object_
- class pytomography.io.PET.prd._binary.FixedNDArraySerializer(element_serializer, shape)[source]#
Bases:
pytomography.io.PET.prd.yardl_types.Generic
[T
,T_NP
],NDArraySerializerBase
[T
,T_NP
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
element_serializer (TypeSerializer[T, T_NP]) –
shape (tuple[int, Ellipsis]) –
- write(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (numpy.typing.NDArray[Any]) –
- Return type:
None
- write_numpy(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (pytomography.io.PET.prd.yardl_types.np.object_) –
- Return type:
None
- read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
numpy.typing.NDArray[Any]
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.object_
- class pytomography.io.PET.prd._binary.RecordSerializer(field_serializers)[source]#
Bases:
TypeSerializer
[T
,pytomography.io.PET.prd.yardl_types.np.void
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- Parameters:
field_serializers (list[Tuple[str, TypeSerializer[Any, Any]]]) –
- _write(stream, *values)[source]#
- Parameters:
stream (CodedOutputStream) –
values (Any) –
- Return type:
None
- _read(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
tuple[Any, Ellipsis]
- read_numpy(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
pytomography.io.PET.prd.yardl_types.np.void
- pytomography.io.PET.prd._binary.write_fixed_int32(stream, value)[source]#
- Parameters:
stream (CodedOutputStream) –
value (int) –
- Return type:
None
- pytomography.io.PET.prd._binary.read_fixed_int32(stream)[source]#
- Parameters:
stream (CodedInputStream) –
- Return type:
int