CPHD reading/writing objects (sarpy.io.phase_history.cphd)

Module for reading and writing CPHD files. Support reading CPHD version 0.3 and 1 and writing version 1.

class sarpy.io.phase_history.cphd.AmpScalingFunction(raw_dtype: str | dtype, raw_shape: Tuple[int, ...] | None = None, formatted_shape: Tuple[int, ...] | None = None, reverse_axes: Tuple[int, ...] | None = None, transpose_axes: Tuple[int, ...] | None = None, band_dimension: int = -1, amplitude_scaling: ndarray | None = None)

Bases: ComplexFormatFunction

property amplitude_scaling: ndarray | None

The scaling multiplier array, for CPHD/CRSD usage.

Return type:

Optional[numpy.ndarray]

set_amplitude_scaling(array: ndarray | None) None

Set the amplitude scaling array.

Parameters:

array (None|numpy.ndarray) –

Return type:

None

validate_shapes() None

Validates that the provided raw_shape and formatted_shape are sensible.

This should be called only after setting the appropriate values for the raw_shape, formatted_shape, reverse_axes and transpose_axes properties.

Raises:

ValueError – Raises a ValueError if the shapes are not compatible according to this function and the transpose axes argument.

property band_dimension: int

The band dimension, in raw data after the transpose operation.

Type:

int

property formatted_shape: Tuple[int, ...] | None

The expected output shape basis.

Type:

None|Tuple[int, …]

has_inverse = True

Indicates whether this format function has the inverse call implemented.

inverse(array: ndarray, subscript: Tuple[slice, ...]) ndarray

Inverse operation which takes in formatted data, and returns corresponding raw data.

Parameters:
  • array (numpy.ndarray) – The input formatted data.

  • subscript (Tuple[slice, ...]) – The slice definition which yielded the formatted data.

Return type:

numpy.ndarray

Raises:

ValueError – A value error should be raised if inverse=True and has_inverse=False.

property order: str

The order string, once of (‘IQ’, ‘QI’, ‘MP’, ‘PM’).

Type:

str

property raw_shape: Tuple[int, ...] | None

The expected full possible raw shape.

Type:

None|Tuple[int, …]

property reverse_axes: Tuple[int, ...] | None

The collection of axes (with respect to raw order) along which we will reverse as part of transformation to output data order. If not None, then this will be a tuple in strictly increasing order.

Type:

None|Tuple[int, …]

transform_formatted_slice(subscript: Tuple[slice, ...]) Tuple[slice, ...]

Transform from the subscript definition in formatted coordinates to subscript definition with respect to raw coordinates.

Parameters:

subscript (Tuple[slice, ...]) –

Return type:

Tuple[slice, …]

Raises:

ValueError – Raised if the desired requirement cannot be met.

transform_raw_slice(subscript: Tuple[slice, ...]) Tuple[slice, ...]

Transform from the subscript definition in raw coordinates to subscript definition with respect to formatted coordinates.

Parameters:

subscript (Tuple[slice, ...]) –

Return type:

Tuple[slice, …]

Raises:

ValueError – Raised if the desired requirement cannot be met.

property transpose_axes: Tuple[int, ...]

The transpose order for switching from raw order to output order, prior to applying any format function.

Type:

None|Tuple[int, …]

class sarpy.io.phase_history.cphd.CPHDDetails(file_object: str)

Bases: object

The basic CPHD element parser.

property file_name: str

The CPHD filename.

Type:

str

property file_object: BinaryIO

The binary file object

Type:

BinaryIO

property cphd_version: str

The CPHD version.

Type:

str

property cphd_meta: CPHDType | CPHDType

The CPHD metadata object, which is version dependent.

Type:

CPHDType1|CPHDType0_3

property cphd_header: CPHDHeader | CPHDHeader

The CPHD header object, which is version dependent.

Type:

CPHDHeader1|CPHDHeader0_3

get_cphd_bytes() bytes

Extract the (uninterpreted) bytes representation of the CPHD structure.

Return type:

bytes

class sarpy.io.phase_history.cphd.CPHDReader(*args, **kwargs)

Bases: CPHDTypeReader

The Abstract CPHD reader instance, which just selects the proper CPHD reader class based on the CPHD version. Note that there is no __init__ method for this class, and it would be skipped regardless. Ensure that you make a direct call to the BaseReader.__init__() method when extending this class.

Updated in version 1.3.0 for reading changes.

property cphd_details: CPHDDetails

The cphd details object.

Type:

CPHDDetails

property cphd_version: str

The CPHD version.

Type:

str

property cphd_header: CPHDHeader | CPHDHeader

The CPHD header object, which is version dependent.

Type:

CPHDHeader1|CPHDHeader0_3

property file_name: str

Defined as a convenience property.

Type:

None|str

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 CPHD 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[int | str, ndarray]

Reads the entirety of the PVP block(s).

Returns:

Dictionary containing the PVP arrays.

Return type:

Dict[Union[int, str], numpy.ndarray]

read_signal_block() Dict[int | 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[Union[int, str], numpy.ndarray]

read_signal_block_raw() Dict[int | 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[Union[int, str], numpy.ndarray]

close()

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 cphd_meta: None | CPHDType | CPHDType

the cphd meta_data.

Type:

None|CPHDType1_0|CPHDType0_3

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 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 as reader(*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()

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 as reader(*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_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]

property reader_type: str

A descriptive string for the type of reader

Type:

str

class sarpy.io.phase_history.cphd.CPHDReader1(*args, **kwargs)

Bases: CPHDReader

The CPHD version 1 reader.

Updated in version 1.3.0 for reading changes.

property cphd_meta: CPHDType

The CPHD structure.

Type:

CPHDType1

property cphd_header: CPHDHeader

The CPHD header object.

Type:

CPHDHeader1

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 CPHD 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[Union[int, 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[Union[int, str], numpy.ndarray]

read_signal_block_raw() Dict[int | 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[Union[int, str], numpy.ndarray]

read_chip(*ranges: Sequence[None | int | Tuple[int, ...] | slice], index: int | str = 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|str) –

  • squeeze (bool) –

Return type:

numpy.ndarray

See also

read()

read(*ranges: Sequence[None | int | Tuple[int, ...] | slice], index: int | str = 0, squeeze: bool = True) ndarray

Read formatted data from the given data segment. Note this is an alias to the __call__() called as reader(*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|str) – The data_segment index or channel identifier.

  • 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_raw(*ranges: Sequence[None | int | Tuple[int, ...] | slice], index: int | str = 0, squeeze: bool = True) ndarray

Read raw data from the given data segment. Note this is an alias to the __call__() called as reader(*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|str) – The data_segment index or cphd channel identifier.

  • 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.

close()

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 cphd_details: CPHDDetails

The cphd details object.

Type:

CPHDDetails

property cphd_version: str

The CPHD version.

Type:

str

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

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, …], …]

property reader_type: str

A descriptive string for the type of reader

Type:

str

class sarpy.io.phase_history.cphd.CPHDReader0_3(*args, **kwargs)

Bases: CPHDReader

The CPHD version 0.3 reader.

Updated in version 1.3.0 for reading changes.

property cphd_meta: CPHDType

The CPHD structure, which is version dependent.

Type:

CPHDType0_3

property cphd_header: CPHDHeader

The CPHD header object.

Type:

CPHDHeader0_3

read_pvp_variable(variable: str, index: int, the_range: None | int | Tuple[int, ...] | slice = None) ndarray | None

Read the vector parameter for the given variable and CPHD 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, 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[int, ndarray]

Reads the entirety of the PVP block(s).

Returns:

Dictionary of numpy.ndarray containing the PVP arrays.

Return type:

Dict[int, numpy.ndarray]

read_signal_block() Dict[int, 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[Union[int, str], numpy.ndarray]

read_signal_block_raw() Dict[int, 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[Union[int, str], numpy.ndarray]

close()

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 cphd_details: CPHDDetails

The cphd details object.

Type:

CPHDDetails

property cphd_version: str

The CPHD version.

Type:

str

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

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 as reader(*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()

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 as reader(*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_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]

property reader_type: str

A descriptive string for the type of reader

Type:

str

sarpy.io.phase_history.cphd.is_a(file_name: str) CPHDReader | None

Tests whether a given file_name corresponds to a CPHD file. Returns a reader instance, if so.

Parameters:

file_name (str) – the file_name to check

Returns:

Appropriate CPHDTypeReader instance if CPHD file, None otherwise

Return type:

CPHDReader|None

class sarpy.io.phase_history.cphd.CPHDWriter1(file_object: str | BinaryIO, meta: CPHDType | None = None, writing_details: CPHDWritingDetails | None = None, check_older_version: bool = False, check_existence: bool = True)

Bases: BaseWriter

The CPHD version 1 writer.

Updated in version 1.3.0 for writing changes.

property file_name: str | None

Defined as a convenience property.

Type:

None|str

property meta: CPHDType

The metadata

Type:

CPHDType1

property closed: bool

Is the writer closed? Reading file after writing can result in a ValueError if writer was not closed.

Type:

bool

property data_segment: Tuple[DataSegment, ...]

The data segment collection.

Type:

Tuple[DataSegment, …]

property data_size: Tuple[Tuple[int, ...]]

the formatted data sizes of the data segments.

Type:

Tuple[Tuple[int, …], …]

property image_count: int

The number of overall images/data segments.

Type:

int

property raw_data_size: Tuple[int, ...] | Tuple[Tuple[int, ...]]

the raw data sizes of the data segments.

Type:

Tuple[Tuple[int, …], …]

write_support_array(identifier: int | str, data: ndarray) None

Write support array data to the file.

Parameters:
  • identifier (int|str) –

  • data (numpy.ndarray) –

write_pvp_array(identifier: int | str, data: ndarray) None

Write the PVP array data to the file.

Parameters:
  • identifier (int|str) –

  • data (numpy.ndarray) –

write_support_block(support_block: Dict[int | str, ndarray]) None

Write support block to the file.

Parameters:

support_block (dict) – Dictionary of numpy.ndarray containing the support arrays.

write_pvp_block(pvp_block: Dict[int | str, ndarray]) None

Write PVP block to the file.

Parameters:

pvp_block (dict) – Dictionary of numpy.ndarray containing the PVP arrays.

write_signal_block(signal_block: Dict[int | str, ndarray]) None

Write signal block to the file.

Parameters:

signal_block (dict) – Dictionary of numpy.ndarray containing the signal arrays in complex64 format.

write_signal_block_raw(signal_block)

Write signal block to the file.

Parameters:

signal_block (dict) – Dictionary of numpy.ndarray containing the raw formatted (i.e. file storage format) signal arrays.

write_file(pvp_block: Dict[int | str, ndarray], signal_block: Dict[int | str, ndarray], support_block: Dict[int | str, ndarray] | None = None)

Write the blocks to the file.

Parameters:
  • pvp_block (Dict[str, numpy.ndarray]) – Dictionary of numpy.ndarray containing the PVP arrays. Keys must be consistent with self.meta

  • signal_block (Dict[str, numpy.ndarray]) – Dictionary of numpy.ndarray containing the complex64 formatted signal arrays. Keys must be consistent with self.meta

  • support_block (None|Dict[str, numpy.ndarray]) – Dictionary of numpy.ndarray containing the support arrays.

write_file_raw(pvp_block: Dict[int | str, ndarray], signal_block: Dict[int | str, ndarray], support_block: Dict[int | str, ndarray] | None = None)

Write the blocks to the file.

Parameters:
  • pvp_block (Dict[str, numpy.ndarray]) – Dictionary of numpy.ndarray containing the PVP arrays. Keys must be consistent with self.meta

  • signal_block (Dict[str, numpy.ndarray]) – Dictionary of numpy.ndarray containing the raw formatted (i.e. file storage format) signal arrays. Keys must be consistent with self.meta

  • support_block (None|Dict[str, numpy.ndarray]) – Dictionary of numpy.ndarray containing the support arrays.

write_chip(data: ndarray, start_indices: None | int | Tuple[int, ...] = None, subscript: None | Tuple[slice, ...] = None, index: int | str = 0) None

This is identical to write(), and presented for backwards compatibility.

Parameters:
  • data (numpy.ndarray) –

  • start_indices (None|int|Tuple[int, ...]) –

  • subscript (None|Tuple[slice, ...]) –

  • index (int) –

See also

See

meth:sarpy.io.general.data_segment.DataSegment.write.

write(data: ndarray, start_indices: None | int | Tuple[int, ...] = None, subscript: None | Tuple[slice, ...] = None, index: int | str = 0) None

Write the data to the appropriate data segment. This is an alias to writer(data, start_indices=start_indices, subscript=subscript, index=index, raw=False).

Only one of `start_indices` and `subscript` should be specified.

Parameters:
  • data (numpy.ndarray) – The data to write.

  • start_indices (None|int|Tuple[int, ...]) – Assuming a contiguous chunk of data, this provides the starting indices of the chunk. Any missing (tail) coordinates will be filled in with 0’s.

  • subscript (None|Tuple[slice, ...]) – In contrast to providing start_indices, the slicing definition in formatted coordinates pertinent to the specified data segment.

  • index (int) – The index of the

See also

See

meth:sarpy.io.general.data_segment.DataSegment.write.

write_raw(data: ndarray, start_indices: None | int | Tuple[int, ...] = None, subscript: None | Tuple[slice, ...] = None, index: int | str = 0) None

Write the raw data to the file(s). This is an alias to writer(data, start_indices=start_indices, subscript=subscript, index=index, raw=True).

Only one of `start_indices` and `subscript` should be specified.

Parameters:
  • data (numpy.ndarray) – The data to write.

  • start_indices (None|int|Tuple[int, ...]) – Assuming a contiguous chunk of data, this provides the starting indices of the chunk. Any missing (tail) coordinates will be filled in with 0’s.

  • subscript (None|Tuple[slice, ...]) – In contrast to providing start_indices, the slicing definition in raw coordinates pertinent to the specified data segment.

  • index (int) –

See also

See

meth:sarpy.io.general.data_segment.DataSegment.write_raw.

flush(force: bool = False) None

Try to perform any necessary steps to flush written data to the disk/buffer.

Parameters:

force (bool) – Try force flushing, even for incompletely written data.

Return type:

None

close()

This should perform any necessary final steps, like closing open file handles, deleting any temp files, etc. Trying to read newly created file without closing may raise a ValueError.