Module: sarpyx.processor.core.focus

File: sarpyx/processor/core/focus.py

No module docstring available; module purpose is inferred from implementation.

Exported Symbols (__all__)

No explicit __all__ list. Public symbols inferred from implementation.

Public Functions (9)

timing_decorator function

Decorator to measure and print function execution time.

File location: sarpyx/processor/core/focus.py:44

Signature

timing_decorator(func: Callable) -> Callable

Parameters

ParameterTypeRequiredDefaultDescription
funcCallableyes-The function to measure.

Return Type

Callable

The wrapped function with timing measurement.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import timing_decorator

result = timing_decorator(func=<func>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

print_memory function

Print current RAM memory usage percentage.

File location: sarpyx/processor/core/focus.py:66

Signature

print_memory() -> None

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import print_memory

result = print_memory()

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

flush_mem function

Decorator for memory-efficient operations with monitoring.

File location: sarpyx/processor/core/focus.py:70

Signature

flush_mem(func: Callable) -> Callable

Parameters

ParameterTypeRequiredDefaultDescription
funcCallableyes-The function to wrap.

Return Type

Callable

The wrapped function with memory monitoring and cleanup.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import flush_mem

result = flush_mem(func=<func>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

cleanup_variables function

Explicitly delete variables and run garbage collection.

File location: sarpyx/processor/core/focus.py:101

Signature

cleanup_variables(*variables: Any) -> None

Parameters

ParameterTypeRequiredDefaultDescription
*variablesAnyno-Variables to delete.

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.focus import cleanup_variables

result = cleanup_variables()

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

initialize_params function

Initialize processing parameters dictionary.

File location: sarpyx/processor/core/focus.py:111

Signature

initialize_params(device: Optional[torch.device]=None, slant_range_vec: Optional[np.ndarray]=None, D: Optional[np.ndarray]=None, c: Optional[float]=None, len_range_line: Optional[int]=None, range_sample_freq: Optional[float]=None, wavelength: Optional[float]=None) -> Dict[str, Any]

Parameters

ParameterTypeRequiredDefaultDescription
deviceOptional[torch.device]noNonePyTorch device for computation.
slant_range_vecOptional[np.ndarray]noNoneSlant range vector.
DOptional[np.ndarray]noNoneCosine of instantaneous squint angle.
cOptional[float]noNoneSpeed of light.
len_range_lineOptional[int]noNoneLength of range line.
range_sample_freqOptional[float]noNoneRange sampling frequency.
wavelengthOptional[float]noNoneRadar wavelength.

Return Type

Dict[str, Any]

Dictionary containing all parameters.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.focus import initialize_params

result = initialize_params()

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

multiply_inplace function

Multiply two arrays element-wise in-place with broadcasting support.

File location: sarpyx/processor/core/focus.py:136

Signature

multiply_inplace(a: Union[np.ndarray, torch.Tensor], b: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, torch.Tensor]

Parameters

ParameterTypeRequiredDefaultDescription
aUnion[np.ndarray, torch.Tensor]yes-First array (modified in-place).
bUnion[np.ndarray, torch.Tensor]yes-Second array.

Return Type

Union[np.ndarray, torch.Tensor]

Reference to modified first array.

Exceptions

  • ValueError

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.focus import multiply_inplace

result = multiply_inplace(a=<a>, b=<b>)

Edge Cases

May raise: ValueError.

multiply function

Multiply two arrays element-wise with broadcasting support.

File location: sarpyx/processor/core/focus.py:177

Signature

multiply(a: Union[np.ndarray, torch.Tensor], b: Union[np.ndarray, torch.Tensor], debug: bool=False) -> Union[np.ndarray, torch.Tensor]

Parameters

ParameterTypeRequiredDefaultDescription
aUnion[np.ndarray, torch.Tensor]yes-First array.
bUnion[np.ndarray, torch.Tensor]yes-Second array.
debugboolnoFalseinferred from implementation.

Return Type

Union[np.ndarray, torch.Tensor]

Element-wise multiplication result.

Exceptions

  • ValueError

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import multiply

result = multiply(a=<a>, b=<b>)

Edge Cases

May raise: ValueError. Includes optional parameters with implementation-defined fallback behavior.

ifft2d function

Perform memory-efficient 2D inverse FFT on radar data.

File location: sarpyx/processor/core/focus.py:227

Signature

ifft2d(radar_data: Union[np.ndarray, torch.Tensor], backend: str='numpy', verbose: bool=False) -> Union[np.ndarray, torch.Tensor]

Parameters

ParameterTypeRequiredDefaultDescription
radar_dataUnion[np.ndarray, torch.Tensor]yes-Input radar data array.
backendstrno'numpy'Backend to use ('numpy' or 'torch').
verboseboolnoFalseWhether to print verbose output.

Return Type

Union[np.ndarray, torch.Tensor]

Processed radar data after 2D inverse FFT.

Exceptions

  • ValueError

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import ifft2d

result = ifft2d(radar_data=<radar_data>)

Edge Cases

May raise: ValueError. Includes optional parameters with implementation-defined fallback behavior.

iff_azimuth function

Perform memory-efficient inverse FFT along azimuth dimension.

File location: sarpyx/processor/core/focus.py:269

Signature

iff_azimuth(radar_data: Union[np.ndarray, torch.Tensor], backend: str='numpy', verbose: bool=False) -> Union[np.ndarray, torch.Tensor]

Parameters

ParameterTypeRequiredDefaultDescription
radar_dataUnion[np.ndarray, torch.Tensor]yes-Input radar data array.
backendstrno'numpy'Backend to use ('numpy' or 'torch').
verboseboolnoFalseWhether to print verbose output.

Return Type

Union[np.ndarray, torch.Tensor]

Processed radar data after inverse FFT along azimuth dimension.

Exceptions

  • ValueError

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import iff_azimuth

result = iff_azimuth(radar_data=<radar_data>)

Edge Cases

May raise: ValueError. Includes optional parameters with implementation-defined fallback behavior.

Public Classes (1)

CoarseRDA class

Memory-efficient Coarse Range Doppler Algorithm processor for SAR data. This class implements a memory-optimized coarse Range Doppler Algorithm for processing synthetic aperture radar (SAR) data, specifically designed for Sentinel-1 data. The processing pipeline follows these main steps: 1. Initialization and data loading 2. Transmission replica generation 3. 2D FFT transformation 4. Range compression 5. Range Cell Migration Correction (RCMC) 6. Azimuth compression 7. Final inverse transformations Memory optimizations include: - In-place operations where possible - Explicit memory cleanup - Memory usage monitoring - Efficient data type usage

File location: sarpyx/processor/core/focus.py:304

Class Signature

class CoarseRDA

Constructor Parameters

Return Type

CoarseRDA instances.

Exceptions

Construction/runtime exceptions are inferred from implementation and method-level documentation.

Side Effects

See method-level side effects below.

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

obj = CoarseRDA(...)  # inferred from implementation

Edge Cases

No class-level edge-case section is explicitly documented; rely on method-level checks and raised exceptions.

Public Methods (12)

CoarseRDA.fft2d method

Perform memory-efficient 2D FFT on radar data in range and azimuth dimensions.

File location: sarpyx/processor/core/focus.py:509

Signature

fft2d(self, w_pad: Optional[int]=None, executors: int=12) -> None

Parameters

ParameterTypeRequiredDefaultDescription
w_padOptional[int]noNoneWidth padding for range FFT (ignored for dimension preservation).
executorsintno12Number of executors for custom backend.

Return Type

None

inferred from implementation.

Exceptions

  • ValueError

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.fft2d()

Edge Cases

May raise: ValueError. Includes optional parameters with implementation-defined fallback behavior.

CoarseRDA.ifft_range method

Perform memory-efficient inverse FFT along range dimension and trim to original size.

File location: sarpyx/processor/core/focus.py:664

Signature

ifft_range(self) -> None

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

None

inferred from implementation.

Exceptions

  • ValueError

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.ifft_range()

Edge Cases

May raise: ValueError.

CoarseRDA.ifft_azimuth method

Perform memory-efficient inverse FFT along azimuth dimension.

File location: sarpyx/processor/core/focus.py:689

Signature

ifft_azimuth(self) -> None

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

None

inferred from implementation.

Exceptions

  • ValueError

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.ifft_azimuth()

Edge Cases

May raise: ValueError.

CoarseRDA.pulse_compression method

Perform pulse compression following C++ implementation.

File location: sarpyx/processor/core/focus.py:779

Signature

pulse_compression(self, signal: np.ndarray, reference: np.ndarray) -> np.ndarray

Parameters

ParameterTypeRequiredDefaultDescription
signalnp.ndarrayyes-Input signal array.
referencenp.ndarrayyes-Reference function for compression.

Return Type

np.ndarray

Pulse compressed signal.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.pulse_compression(signal=<signal>, reference=<reference>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

CoarseRDA.get_range_filter method

Compute memory-efficient range filter for radar data compression.

File location: sarpyx/processor/core/focus.py:803

Signature

get_range_filter(self, pad_w: int=0, window_type: str='hamming') -> np.ndarray

Parameters

ParameterTypeRequiredDefaultDescription
pad_wintno0Width padding for FFT length optimization.
window_typestrno'hamming'Type of window to apply ('hamming', 'hanning', 'blackman', 'rectangular').

Return Type

np.ndarray

Range filter array exactly matching radar data range dimension.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.get_range_filter()

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

CoarseRDA.get_rcmc method

Calculate memory-efficient Range Cell Migration Correction filter.

File location: sarpyx/processor/core/focus.py:862

Signature

get_rcmc(self) -> np.ndarray

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

np.ndarray

RCMC filter array matching radar data dimensions.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.get_rcmc()

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

CoarseRDA.get_azimuth_filter method

Calculate memory-efficient azimuth compression filter.

File location: sarpyx/processor/core/focus.py:943

Signature

get_azimuth_filter(self) -> np.ndarray

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

np.ndarray

Azimuth filter array matching radar data dimensions.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.get_azimuth_filter()

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

CoarseRDA.data_focus method

Perform memory-efficient complete SAR data focusing using Range Doppler Algorithm.

File location: sarpyx/processor/core/focus.py:1405

Signature

data_focus(self) -> None

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.data_focus()

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

CoarseRDA.range_compression method

Perform memory-efficient range compression step.

File location: sarpyx/processor/core/focus.py:1465

Signature

range_compression(self) -> None

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.range_compression()

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

CoarseRDA.rcmc method

Perform memory-efficient Range Cell Migration Correction.

File location: sarpyx/processor/core/focus.py:1503

Signature

rcmc(self) -> None

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.rcmc()

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

CoarseRDA.azimuth_compression method

Perform memory-efficient azimuth compression step.

File location: sarpyx/processor/core/focus.py:1532

Signature

azimuth_compression(self) -> None

Parameters

ParameterTypeRequiredDefaultDescription
--no-No explicit public parameters; behavior inferred from implementation.

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.azimuth_compression()

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.

CoarseRDA.save_file method

Save processed radar data to file.

File location: sarpyx/processor/core/focus.py:1663

Signature

save_file(self, save_path: Union[str, Path]) -> None

Parameters

ParameterTypeRequiredDefaultDescription
save_pathUnion[str, Path]yes-Path where to save the data.

Return Type

None

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • io

Example Usage

from sarpyx.processor.core.focus import CoarseRDA

# Constructor arguments are inferred from implementation.
obj = CoarseRDA(...)  # inferred from implementation
result = obj.save_file(save_path=<save_path>)

Edge Cases

No explicit edge-case section found; behavior is inferred from implementation.