Subaperture methods (sarpy.processing.sicd.subaperture)

Sub-aperture processing methods.

sarpy.processing.sicd.subaperture.frame_definition(array_size: int, frame_count: int = 9, aperture_fraction: float = 0.2, fill: int | float = 1, method: str = 'FULL') Tuple[List[Tuple[int, int]], int]

Get the frame definition along the desired axis for subaperture processing.

Parameters:
  • array_size (int) – The size of the given array.

  • frame_count (int) – The number of frames to calculate.

  • aperture_fraction (float) – The relative size of each aperture window.

  • fill (float|int) – The fft fill value.

  • method (str) – The subaperture processing method, which must be one of (‘NORMAL’, ‘FULL’, ‘MINIMAL’).

Returns:

  • frame_definition (List[Tuple[int, int]])

  • output_resolution (int)

sarpy.processing.sicd.subaperture.subaperture_processing_array(array: ndarray, aperture_indices: Tuple[int, int], output_resolution: int, dimension: int = 0) ndarray

Perform the sub-aperture processing on the given complex array data.

Parameters:
  • array (numpy.ndarray) – The complex array data. Dimension other than 2 is not supported.

  • aperture_indices (Tuple[int, int]) – The start/stop indices for the subaperture processing.

  • output_resolution (int) – The output resolution parameter.

  • dimension (int) – The dimension along which to perform the sub-aperture processing. Must be one of 0 or 1.

Return type:

numpy.ndarray

sarpy.processing.sicd.subaperture.subaperture_processing_phase_history(phase_array: ndarray, aperture_indices: Tuple[int, int], output_resolution: int, dimension: int = 0) ndarray

Perform the sub-aperture processing on the given complex phase history data.

Parameters:
  • phase_array (numpy.ndarray) – The complex array data. Dimension other than 2 is not supported.

  • aperture_indices (Tuple[int, int]) – The start/stop indices for the subaperture processing.

  • output_resolution (int) – The output resolution parameter.

  • dimension (int) – The dimension along which to perform the sub-aperture processing. Must be one of 0 or 1.

Return type:

numpy.ndarray

class sarpy.processing.sicd.subaperture.SubapertureCalculator(reader: str | SICDTypeReader, dimension: int = 0, index: int = 0, block_size: int = 10, frame_count: int = 9, aperture_fraction: float = 0.2, method: str = 'FULL')

Bases: FFTCalculator

Class for performing sub-aperture processing from a reader instance.

It is important to note that full resolution is required for along the processing dimension, so sub-sampling along the processing dimension does not decrease the amount of data which must be fetched.

property frame_count: int

The frame count.

Type:

int

property aperture_fraction: float

The relative aperture fraction size.

Type:

float

property method: str

The subaperture method.

Type:

str

subaperture_generator(row_range: slice | Tuple[int, int, int], col_range: slice | Tuple[int, int, int], frames: None | int | list | tuple | ndarray = None) Generator[ndarray, None, None]

Supplies a generator for the given row and column ranges and frames collection. Note that this IGNORES the block_size parameter in fetching, and fetches the entire required block.

The full resolution data in the processing dimension is required, even if down-sampled by the row_range or col_range parameter.

Parameters:
  • row_range (slice|Tuple[int, int, int]) – The row range.

  • col_range (slice|Tuple[int, int, int]) – The column range.

  • frames (None|int|list|tuple|numpy.ndarray) – The frame or frame collection.

Return type:

Generator[numpy.ndarray]

property block_size: float | None

The approximate processing block size in MB, where None represents processing in a single block.

Type:

None|float

property block_size_in_bytes: int | None

The approximate processing block size in bytes.

Type:

None|int

property data_size: Tuple[int, ...]

The data size for the reader at the given index.

Type:

Tuple[int, …]

property dimension: int

The dimension along which to perform the color subaperture split.

Type:

int

static extract_blocks(the_range: slice | Tuple[int, int, int], index_block_size: None | int | float) Tuple[List[Tuple[int, int, int]], List[Tuple[int, int]]]

Convert the single range definition into a series of range definitions in keeping with fetching of the appropriate block sizes.

Parameters:
  • the_range (slice|Tuple[int, int, int]) – The input (off processing axis) range.

  • index_block_size (None|int|float) – The size of blocks (number of indices).

Returns:

  • range_definitions (List[Tuple[int, int, int]]) – The sequence of range definitions (start index, stop index, step) relative to the overall image.

  • limit_indices (List[Tuple[int, int]]) – The sequence of start/stop indices for positioning of the given range relative to the original range.

property fill: float

The fill factor for the fourier processing.

Type:

float

get_fetch_block_size(start_element: int, stop_element: int) int

Gets the fetch block size for the given full resolution section. This assumes that the fetched data will be 8 bytes per pixel, in accordance with single band complex64 data.

Parameters:
  • start_element (int) –

  • stop_element (int) –

Return type:

int

property index: int

The index of the reader.

Type:

int

property reader: SICDTypeReader

The reader instance.

Type:

SICDTypeReader

property sicd: SICDType

The sicd structure.

Type:

SICDType

class sarpy.processing.sicd.subaperture.SubapertureOrthoIterator(ortho_helper: OrthorectificationHelper, calculator: SubapertureCalculator, bounds: None | ndarray | tuple | list = None, remap_function: RemapFunction | None = None, recalc_remap_globals: bool = False, depth_first: bool = True)

Bases: OrthorectificationIterator

An iterator class for the ortho-rectified subaperture processing.

Iterating depth first requires the least fetching from the reader once for all frames. Otherwise, iterating requires redundantly fetching data once for each frame.

It should be noted that fetching data is not time intensive if working using a local file (i.e. on your computer), but it may be if working using some kind of network file system.

property calculator: SubapertureCalculator

The calculator instance.

Type:

FullResolutionFetcher

next() Tuple[ndarray, Tuple[int, int], int]

Get the next iteration of ortho-rectified data.

Returns:

  • data (numpy.ndarray)

  • normalized_indices (Tuple[int, int]) – The (normalized) indices (start_row, start_col) for this section of data, relative to overall output shape

  • frame (int) – The frame index.

get_ecf_image_corners() ndarray | None

The corner points of the overall ortho-rectified output in ECF coordinates. The ordering of these points follows the SICD convention.

Return type:

numpy.ndarray

get_llh_image_corners() ndarray | None

The corner points of the overall ortho-rectified output in Lat/Lon/HAE coordinates. The ordering of these points follows the SICD convention.

Return type:

None|numpy.ndarray

property ortho_bounds: ndarray

Of the form (row min, row max, col min, col max). Note that these are “unnormalized” orthorectified pixel coordinates.

Type:

numpy.ndarray

property ortho_data_size: Tuple[int, int]

The size of the overall ortho-rectified output.

Type:

Tuple[int, int]

property ortho_helper: OrthorectificationHelper

The ortho-rectification helper.

Type:

OrthorectificationHelper

property pixel_bounds: ndarray

Of the form (row min, row max, col min, col max).

Type:

numpy.ndarray

property remap_function: RemapFunction | None

The remap function to be applied.

Type:

None|RemapFunction

property sicd: SICDType

The sicd structure.

Type:

SICDType

class sarpy.processing.sicd.subaperture.ApertureFilter(reader: SICDTypeReader, dimension: int = 1, index: int = 0, apply_deskew: bool = True, apply_deweighting: bool = False)

Bases: object

This is a calculator for filtering SAR imagery using a subregion of complex fft data over a full resolution subregion of the original SAR data.

This is largely intended as a helper function for the aperture GUI tool, but is included here because it may have wider applicability.

property apply_deskew: bool

Apply deskew to calculated value.

Type:

bool

property apply_deweighting: bool

Apply deweighting to calculated values.

Type:

bool

property sicd: SICDType

The associated SICD structure.

Type:

SICDType

property data_size: Tuple[int, int] | None

The feasible data size

Type:

None|(int, int)

property dimension: int

The processing dimension.

Type:

int

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

The sub-image bounds used for processing.

Type:

Tuple[Tuple[int, int], …]

set_sub_image_bounds(row_bounds: Tuple[int, int] | None, col_bounds: Tuple[int, int] | None)

Sets the full range bounds for the phase history calculation. This subsequently sets the normalized_phase_history value.

Parameters:
  • row_bounds (None|Tuple[int, int]) – Of the form (start row, end row).

  • col_bounds (None|Tuple[int, int]) – Of the form (start column, end column).

Return type:

None

property normalized_phase_history: ndarray | None

The normalized phase history

Type:

None|numpy.ndarray

property frequencies: ndarray

This returns the subaperture frequencies in units of GHz

Return type:

numpy.array