The CSI methods (sarpy.processing.sicd.csi)

The methods for computing a color sub-aperture image for SICD type images.

As noted in the CSICalculator class, the full resolution data along the split dimension is required, so sub-sampling along the split dimension does not decrease the amount of data which must be fetched and/or processing which must be performed.

Examples

from matplotlib import pyplot
from sarpy.io.complex.converter import open_complex
from sarpy.processing.sicd.csi import CSICalculator
from sarpy.visualization.remap import Density

# open a sicd type file
reader = open_complex("<file name>")
# see the sizes of all image segments
print(reader.get_data_size_as_tuple())

# construct the csi performer instance
# make sure to set the index and dimension as appropriate
csi_calculator = CSICalculator(reader, dimension=0, index=0)
# see the size for this particular image element
# this is identical to the data size from the reader at index
print(csi_calculator.data_size)

# set a different index or change the dimension
# csi_calculator.index = 2
# csi_calculator.dimension = 1

# calculate the csi for an image segment
csi_data = csi_calculator[300:500, 200:600]

# create our remap function
density = Density()

# let's view this csi image using matplotlib
fig, axs = pyplot.subplots(nrows=1, ncols=1)
axs.imshow(density(csi_data), aspect='equal')
pyplot.show()
sarpy.processing.sicd.csi.filter_map_construction(siz: int | float) ndarray

Provides the RGB filter array for sub-aperture processing.

Parameters:

siz (int|float) – the size of the colormap

Returns:

the siz x 3 colormap array

Return type:

numpy.ndarray

sarpy.processing.sicd.csi.csi_array(array: ndarray, dimension: int = 0, platform_direction: str = 'R', fill: int | float = 1, filter_map: ndarray | None = None) ndarray

Creates a color subaperture array from a complex array.

Parameters:
  • array (numpy.ndarray) – The complex valued SAR data, assumed to be in the “image” domain. Required to be two-dimensional.

  • dimension (int) – The dimension over which to split the sub-aperture.

  • platform_direction (str) – The (case insensitive) platform direction, required to be one of (‘R’, ‘L’).

  • fill (float) – The fill factor. This will be ignored if filter_map is provided.

  • filter_map (None|numpy.ndarray) – The RGB filter mapping. This is assumed constructed using filter_map_construction().

Return type:

numpy.ndarray

class sarpy.processing.sicd.csi.CSICalculator(reader: str | SICDTypeReader, dimension: int = 0, index: int = 0, block_size: None | int | float = 50)

Bases: FFTCalculator

Class for creating color sub-aperture image from a reader instance.

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

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 24 bytes per pixel, in accordance with 3-band complex64 data.

Parameters:
  • start_element (int) –

  • stop_element (int) –

Return type:

int

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

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