serialization
Tools to load and save hereditary stratigraphic columns.
Functions
|
Deserialize a population of HereditaryStratigraphicColumn`s into a `HereditaryStratigraphicAssemblage from a dict composed of builtin types. |
|
Deserialize a HereditaryStratigraphicColumn from an integer representation. |
|
Deserialize a HereditaryStratigraphicColumn from a differentia packet and column configuration specification information. |
|
Deserialize a HereditaryStratigraphicColumn from a buffer containing the differentia packet at the front, then stored differentia values. |
|
Deserialize a HereditaryStratigraphicColumn from a dict composed of builtin data types. |
|
Create a pandas DataFrame with retained strata as rows. |
|
Serialize a HereditaryStratigraphicColumn to a binary representation as a Python int. |
|
Serialize a HereditaryStratigraphicColumn to a binary buffer. |
|
Serialize a HereditaryStratigraphicColumn to a dict composed of builtin types. |
|
Create a postprocessing representation of the differentia retained by an extant HereditaryStratigraphicColumn, indexed by deposition rank. |
|
Pack a sequence of differentiae together into a compact representation. |
|
Pack a sequence of differentiae together into a compact representation. |
|
Pack a sequence of differentiae together into a compact string representation. |
|
Deserialize a stratum retention policy from a dict composed of builtin data types. |
|
Serialize a stratum retention policy to a dict composed of builtin types. |
|
Deserialize a sequence of `HereditaryStratigraphicColumn`s from a dict composed of builtin types. |
|
Create a postprocessing representation of the differentia retained by a collection of HereditaryStratigraphicColumns. |
|
Create a pandas DataFrame summarizing several columns, with retained strata as rows. |
|
Serialize a sequence of `HereditaryStratigraphicColumn`s to a dict composed of builtin types. |
|
Deserialize a HereditaryStratigraphicSpecimen from a dict composed of builtin data types. |
|
Deserialize a population of HereditaryStratigraphicColumn`s into a list of `HereditaryStratigraphiSpecimen from a dict composed of builtin types. |
|
Unpack a compact, concatenated base 64 representation into a sequence with each element represented as a distinct integer. |
|
Unpack a compact, concatenated byte buffer representation into a sequence with each element represented as a distinct integer. |
|
Unpack a compact, concatenated base 64 representation into a sequence with each element represented as a distinct integer. |
- assemblage_from_records(records: ~typing.Dict, progress_wrap: ~typing.Callable = <function <lambda>>, mutate: bool = False) HereditaryStratigraphicAssemblage
Deserialize a population of HereditaryStratigraphicColumn`s into a `HereditaryStratigraphicAssemblage from a dict composed of builtin types.
Parameters
- recordsdict
Data to deserialize.
- progress_wrapCallable, default identity function
Wrapper applied around generation iterator and row generator for final phylogeny compilation process.
Pass tqdm or equivalent to display progress bars.
- mutatebool, default False
Are side effects on the input argument records allowed?
See Also
- HereditaryStratigraphicAssemblage
A collection of HereditaryStratigraphicSpecimens, padded to include entries for all ranks retained by any specimen within the assemblage.
- col_from_int(value: int, differentia_bit_width: int, stratum_retention_policy: Callable, differentiae_byte_bit_order: Literal['big', 'little'] = 'big', num_strata_deposited_byte_order: Literal['big', 'little'] = 'big', num_strata_deposited_byte_width: int = 4, value_byte_width: int | None = None) HereditaryStratigraphicColumn
Deserialize a HereditaryStratigraphicColumn from an integer representation.
Integer representation is packet binary representation plus a sentry bit at the most significant bit position. Sentry bit prevents loss of leading zero bits. If value_byte_width is not None, an appropriate sentry bit is added to the value if it is not already present.
Assumes big endian byte order.
- col_from_packet(packet: Buffer, differentia_bit_width: int, stratum_retention_policy: Callable, differentiae_byte_bit_order: Literal['big', 'little'] = 'big', num_strata_deposited_byte_order: Literal['big', 'little'] = 'big', num_strata_deposited_byte_width: int = 4) HereditaryStratigraphicColumn
Deserialize a HereditaryStratigraphicColumn from a differentia packet and column configuration specification information.
Use when buffer size equals packet size.
See Also
col_from_packet_buffer: use when buffer size exceeds packet size.
- col_from_packet_buffer(packet_buffer: Buffer, differentia_bit_width: int, stratum_retention_policy: Callable, differentiae_byte_bit_order: Literal['big', 'little'] = 'big', num_strata_deposited_byte_order: Literal['big', 'little'] = 'big', num_strata_deposited_byte_width: int = 4) HereditaryStratigraphicColumn
Deserialize a HereditaryStratigraphicColumn from a buffer containing the differentia packet at the front, then stored differentia values.
Use when buffer size exceeds packet size.
See Also
col_from_packet: use when buffer size equals packet size.
- col_from_records(records: Dict, differentiae_byte_bit_order: Literal['big', 'little'] = 'big') HereditaryStratigraphicColumn
Deserialize a HereditaryStratigraphicColumn from a dict composed of builtin data types.
- col_to_dataframe(column: HereditaryStratigraphicColumn) DataFrame
Create a pandas DataFrame with retained strata as rows.
- col_to_int(column: HereditaryStratigraphicColumn, num_strata_deposited_byte_order: Literal['big', 'little'] = 'big', num_strata_deposited_byte_width: int = 4) int
Serialize a HereditaryStratigraphicColumn to a binary representation as a Python int.
Integer representation is packet binary representation plus a sentry bit at the most significant bit position, to prevent loss of leading zero bits.
Uses big endian byte order.
- col_to_packet(column: HereditaryStratigraphicColumn, num_strata_deposited_byte_order: Literal['big', 'little'] = 'big', num_strata_deposited_byte_width: int = 4) Buffer
Serialize a HereditaryStratigraphicColumn to a binary buffer.
- col_to_records(column: HereditaryStratigraphicColumn) Dict
Serialize a HereditaryStratigraphicColumn to a dict composed of builtin types.
- col_to_specimen(column: HereditaryStratigraphicColumn) HereditaryStratigraphicSpecimen
Create a postprocessing representation of the differentia retained by an extant HereditaryStratigraphicColumn, indexed by deposition rank.
- pack_differentiae(strata: Iterable[HereditaryStratum], differentia_bit_width: int) str
Pack a sequence of differentiae together into a compact representation.
Returns a string with base 64 encoded concatenation of diffferentiae. If differentia_bit_width is not an even byte multiple, the first encoded byte tells how many empty padding bits, if any, were placed at the end of the concatenation in order to align the bitstring end to byte boundaries.
Deprecated since version 1.8.0: Use pack_differentiae_str instead.
- pack_differentiae_bytes(strata: Iterable[HereditaryStratum], differentia_bit_width: int, always_omit_num_padding_bits_header: bool = False) Buffer
Pack a sequence of differentiae together into a compact representation.
Returns a byte buffer concatenation of diffferentiae. If differentia_bit_width is not an even byte multiple, the first encoded byte tells how many empty padding bits, if any, were placed at the end of the concatenation in order to align the bitstring end to byte boundaries.
- pack_differentiae_str(strata: Iterable[HereditaryStratum], differentia_bit_width: int) str
Pack a sequence of differentiae together into a compact string representation.
Returns a string with base 64 encoded concatenation of diffferentiae. If differentia_bit_width is not an even byte multiple, the first encoded byte tells how many empty padding bits, if any, were placed at the end of the concatenation in order to align the bitstring end to byte boundaries.
- policy_from_records(records: Dict) Callable
Deserialize a stratum retention policy from a dict composed of builtin data types.
- policy_to_records(policy: Callable) Dict
Serialize a stratum retention policy to a dict composed of builtin types.
- pop_from_records(records: ~typing.Dict, progress_wrap: ~typing.Callable = <function <lambda>>, mutate: bool = False) List[HereditaryStratigraphicColumn]
Deserialize a sequence of `HereditaryStratigraphicColumn`s from a dict composed of builtin types.
Parameters
- recordsdict
Data to deserialize.
- progress_wrapCallable, default identity function
Wrapper applied around generation iterator and row generator for final phylogeny compilation process.
Pass tqdm or equivalent to display progress bars.
- mutatebool, default False
Are side effects on the input argument records allowed?
Returns
- populationList[HereditaryStratigraphicColumn]
Deserialized population of HereditaryStratigraphicColumns.
- pop_to_assemblage(columns: ~typing.Iterable[~hstrat.genome_instrumentation.HereditaryStratigraphicColumn], progress_wrap: ~typing.Callable = <function <lambda>>) HereditaryStratigraphicAssemblage
Create a postprocessing representation of the differentia retained by a collection of HereditaryStratigraphicColumns.
Parameters
- columnsiterable of HereditaryStratigraphicColumn
Data to serialize.
- progress_wrapCallable, default identity function
Wrapper applied around generation iterator and row generator for final phylogeny compilation process.
Pass tqdm or equivalent to display progress bars.
- pop_to_dataframe(columns: ~typing.Iterable[~hstrat.genome_instrumentation.HereditaryStratigraphicColumn], progress_wrap: ~typing.Callable = <function <lambda>>) DataFrame
Create a pandas DataFrame summarizing several columns, with retained strata as rows.
Parameters
- columnsiterable of HereditaryStratigraphicColumn
Data to serialize.
- progress_wrapCallable, default identity function
Wrapper applied around generation iterator and row generator for final phylogeny compilation process.
Pass tqdm or equivalent to display progress bars.
- pop_to_records(columns: ~typing.Iterable[~hstrat.genome_instrumentation.HereditaryStratigraphicColumn], progress_wrap: ~typing.Callable = <function <lambda>>) Dict
Serialize a sequence of `HereditaryStratigraphicColumn`s to a dict composed of builtin types.
Parameters
- columnsiterable of HereditaryStratigraphicColumn
Data to serialize.
- progress_wrapCallable, default identity function
Wrapper applied around generation iterator and row generator for final phylogeny compilation process.
Pass tqdm or equivalent to display progress bars.
- specimen_from_records(records: Dict) HereditaryStratigraphicSpecimen
Deserialize a HereditaryStratigraphicSpecimen from a dict composed of builtin data types.
See Also
- HereditaryStratigraphicSpecimen
Postprocessing representation of the differentia retained by an extant HereditaryStratigraphicColumn, indexed by deposition rank.
- unassemblage_from_records(records: ~typing.Dict, progress_wrap: ~typing.Callable = <function <lambda>>, mutate: bool = False) List[HereditaryStratigraphicSpecimen]
Deserialize a population of HereditaryStratigraphicColumn`s into a list of `HereditaryStratigraphiSpecimen from a dict composed of builtin types.
Parameters
- recordsdict
Data to deserialize.
- progress_wrapCallable, default identity function
Wrapper applied around generation iterator and row generator for final phylogeny compilation process.
Pass tqdm or equivalent to display progress bars.
- mutatebool, default False
Are side effects on the input argument records allowed?
See Also
- HereditaryStratigraphicSpecimen
Postprocessing representation of the differentia retained by an extant HereditaryStratigraphicColumn, indexed by deposition rank.
- HereditaryStratigraphicAssemblage
A collection of HereditaryStratigraphicSpecimens, padded to include entries for all ranks retained by any specimen within the assemblage.
- unpack_differentiae(packed_differentiae: str, differentia_bit_width: int) Iterator[int]
Unpack a compact, concatenated base 64 representation into a sequence with each element represented as a distinct integer.
Deprecated since version 1.8.0: Use unpack_differentiae_str instead.
- unpack_differentiae_bytes(packed_differentiae: Buffer, differentia_bit_width: int, differentiae_byte_bit_order: Literal['big', 'little'] = 'big', num_packed_differentia: int | None = None) Iterator[int]
Unpack a compact, concatenated byte buffer representation into a sequence with each element represented as a distinct integer.
- unpack_differentiae_str(packed_differentiae: str, differentia_bit_width: int, differentiae_byte_bit_order: Literal['big', 'little'] = 'big', num_packed_differentia: int | None = None) Iterator[int]
Unpack a compact, concatenated base 64 representation into a sequence with each element represented as a distinct integer.
Notes
Specifying num_packed_differentia implies that packed_differentiae has no header specifying num padding bits.