Common CRSD-Type objects (sarpy.io.received.base)¶
Base structures for received signal data readers and usage
- class sarpy.io.received.base.CRSDTypeReader(data_segment: None | DataSegment | Sequence[DataSegment], crsd_meta: None | CRSDType, close_segments: bool = True, delete_files: None | str | Sequence[str] = None)¶
Bases:
BaseReader
A class for ensuring common CRSD reading functionality.
Updated in version 1.3.0 for reading changes.
- read_support_array(index: int | str, *ranges: Sequence[None | int | Tuple[int, ...] | slice]) ndarray ¶
Read the support array.
- Parameters:
index (int|str) – The support array integer index.
ranges (Sequence[None|int|Tuple[int, ...]|slice]) – The slice definition appropriate for support array usage.
- Return type:
numpy.ndarray
- Raises:
TypeError – If called on a reader which doesn’t support this.
- read_support_block() Dict[str, ndarray] ¶
Reads the entirety of support block(s).
- Returns:
Dictionary of numpy.ndarray containing the support arrays.
- Return type:
Dict[str, numpy.ndarray]
- read_pvp_variable(variable: str, index: int | str, the_range: None | int | Tuple[int, ...] | slice = None) ndarray | None ¶
Read the vector parameter for the given variable and CRSD channel.
- Parameters:
variable (str) –
index (int|str) – The channel index or identifier.
the_range (None|int|Tuple[int, ...]|slice) – The indices for the vector parameter. None returns all, a integer returns the single value at that location, otherwise the input determines a slice.
- Returns:
This will return None if there is no such variable, otherwise the data.
- Return type:
None|numpy.ndarray
- read_pvp_array(index: int | str, the_range: None | int | Tuple[int, ...] | slice = None) ndarray ¶
Read the PVP array from the requested channel.
- Parameters:
index (int|str) – The support array integer index (of cphd.Data.Channels list) or identifier.
the_range (None|int|Tuple[int, ...]|slice) – The indices for the vector parameter. None returns all, a integer returns the single value at that location, otherwise the input determines a slice.
- Returns:
pvp_array
- Return type:
numpy.ndarray
- read_pvp_block() Dict[str, ndarray] ¶
Reads the entirety of the PVP block(s).
- Returns:
Dictionary containing the PVP arrays.
- Return type:
Dict[str, numpy.ndarray]
- read_signal_block() Dict[str, ndarray] ¶
Reads the entirety of signal block(s), with data formatted as complex64 (after accounting for AmpSF).
- Returns:
Dictionary of numpy.ndarray containing the signal arrays.
- Return type:
Dict[str, numpy.ndarray]
- close() None ¶
This should perform any necessary clean-up operations, like closing open file handles, deleting any temp files, etc.
- property closed: bool¶
Is the reader closed? Reading will result in a ValueError
- Type:
bool
- property data_segment: DataSegment | Tuple[DataSegment, ...]¶
The data segment collection.
- Type:
DataSegment|Tuple[DataSegment, …]
- property data_size: Tuple[int, ...] | Tuple[Tuple[int, ...]]¶
the output/formatted data size(s) of the data segment(s). If there is a single data segment, then this will be Tuple[int, …], otherwise it will be Tuple[Tuple, int, …], …].
- Type:
Tuple[int, …]|Tuple[Tuple[int, …], …]
- property file_name: str | None¶
Defined as a convenience property.
- Type:
None|str
- property files_to_delete_on_close: List[str]¶
A collection of files to delete on the close operation.
- Type:
List[str]
- get_data_segment_as_tuple() Tuple[DataSegment, ...] ¶
Get the data segment collection as a tuple, to avoid the need for redundant checking issues.
- Return type:
Tuple[DataSegment, …]
- get_data_size_as_tuple() Tuple[Tuple[int, ...], ...] ¶
Get the data size collection as a tuple of tuples, to avoid the need for redundant checking issues.
- Return type:
Tuple[Tuple[int, …], …]
- get_raw_data_size_as_tuple() Tuple[Tuple[int, ...], ...] ¶
Get the raw data size collection as a tuple of tuples, to avoid the need for redundant checking issues.
- Return type:
Tuple[Tuple[int, …], …]
- property image_count: int¶
The number of images/data segments from which to read.
- Type:
int
- property raw_data_size: Tuple[int, ...] | Tuple[Tuple[int, ...]]¶
the raw data size(s) of the data segment(s). If there is a single data segment, then this will be Tuple[int, …], otherwise it will be Tuple[Tuple, int, …], …].
- Type:
Tuple[int, …]|Tuple[Tuple[int, …], …]
- read(*ranges: None | int | Tuple[int, ...] | slice, index: int = 0, squeeze: bool = True) ndarray ¶
Read formatted data from the given data segment. Note this is an alias to the
__call__()
called asreader(*ranges, index=index, raw=False, squeeze=squeeze)
.- Parameters:
ranges (Sequence[Union[None, int, Tuple[int, ...], slice]]) – The slice definition appropriate for data_segment[index].read() usage.
index (int) – The data_segment index. This is ignored if image_count== 1.
squeeze (bool) – Squeeze length 1 dimensions out of the shape of the return array?
- Return type:
numpy.ndarray
See also
See
meth:sarpy.io.general.data_segment.DataSegment.read.
- read_chip(*ranges: Sequence[None | int | Tuple[int, ...] | slice], index: int = 0, squeeze: bool = True) ndarray ¶
This is identical to
read()
, and presented for backwards compatibility.- Parameters:
ranges (Sequence[Union[None, int, Tuple[int, ...], slice]]) –
index (int) –
squeeze (bool) –
- Return type:
numpy.ndarray
See also
- read_raw(*ranges: None | int | Tuple[int, ...] | slice, index: int = 0, squeeze: bool = True) ndarray ¶
Read raw data from the given data segment. Note this is an alias to the
__call__()
called asreader(*ranges, index=index, raw=True, squeeze=squeeze)
.- Parameters:
ranges (Sequence[Union[None, int, Tuple[int, ...], slice]]) – The slice definition appropriate for data_segment[index].read() usage.
index (int) – The data_segment index. This is ignored if image_count== 1.
squeeze (bool) – Squeeze length 1 dimensions out of the shape of the return array?
- Return type:
numpy.ndarray
See also
See
meth:sarpy.io.general.data_segment.DataSegment.read_raw.
- read_signal_block_raw() Dict[str, ndarray] ¶
Reads the entirety of signal block(s), with data formatted in file storage format (no converting to complex, no consideration of AmpSF).
- Returns:
Dictionary of numpy.ndarray containing the signal arrays.
- Return type:
Dict[str, numpy.ndarray]
- property reader_type: str¶
A descriptive string for the type of reader
- Type:
str