Module: sarpyx.processor.core.aux
File: sarpyx/processor/core/aux.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)
pad_array function
Pad array with specified padding on each side.
File location: sarpyx/processor/core/aux.py:18
Signature
pad_array(array: Union[np.ndarray, torch.Tensor], left: int=0, right: int=0, top: int=0, bottom: int=0, mode: str='constant', constant_value: float=0.0) -> Union[np.ndarray, torch.Tensor]
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
array | Union[np.ndarray, torch.Tensor] | yes | - | Input array to pad. |
left | int | no | 0 | Number of elements to pad on the left (axis=1 for 2D). |
right | int | no | 0 | Number of elements to pad on the right (axis=1 for 2D). |
top | int | no | 0 | Number of elements to pad on the top (axis=0 for 2D). |
bottom | int | no | 0 | Number of elements to pad on the bottom (axis=0 for 2D). |
mode | str | no | 'constant' | Padding mode ('constant', 'edge', 'reflect', 'wrap'). |
constant_value | float | no | 0.0 | Value to use for constant padding. |
Return Type
Union[np.ndarray, torch.Tensor]
Padded array with same type as input.
Exceptions
TypeError
Side Effects
- inferred from implementation
Example Usage
from sarpyx.processor.core.aux import pad_array
result = pad_array(array=<array>)
Edge Cases
May raise: TypeError. Includes optional parameters with implementation-defined fallback behavior.
trim_array function
Trim array by removing specified number of elements from each side.
File location: sarpyx/processor/core/aux.py:84
Signature
trim_array(array: Union[np.ndarray, torch.Tensor], left: int=0, right: int=0, top: int=0, bottom: int=0) -> Union[np.ndarray, torch.Tensor]
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
array | Union[np.ndarray, torch.Tensor] | yes | - | Input array to trim. |
left | int | no | 0 | Number of elements to remove from the left (axis=1 for 2D). |
right | int | no | 0 | Number of elements to remove from the right (axis=1 for 2D). |
top | int | no | 0 | Number of elements to remove from the top (axis=0 for 2D). |
bottom | int | no | 0 | Number of elements to remove from the bottom (axis=0 for 2D). |
Return Type
Union[np.ndarray, torch.Tensor]
Trimmed array with same type as input.
Exceptions
None explicitly documented; inferred from implementation.
Side Effects
- inferred from implementation
Example Usage
from sarpyx.processor.core.aux import trim_array
result = trim_array(array=<array>)
Edge Cases
Includes optional parameters with implementation-defined fallback behavior.
timing_decorator function
Decorator to measure and print function execution time.
File location: sarpyx/processor/core/aux.py:147
Signature
timing_decorator(func: Callable) -> Callable
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
func | Callable | yes | - | 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.aux 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/aux.py:169
Signature
print_memory() -> None
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
- | - | 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.aux 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/aux.py:173
Signature
flush_mem(func: Callable) -> Callable
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
func | Callable | yes | - | 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.aux 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/aux.py:204
Signature
cleanup_variables(*variables: Any) -> None
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
*variables | Any | no | - | 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.aux 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/aux.py:214
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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
device | Optional[torch.device] | no | None | PyTorch device for computation. |
slant_range_vec | Optional[np.ndarray] | no | None | Slant range vector. |
D | Optional[np.ndarray] | no | None | Cosine of instantaneous squint angle. |
c | Optional[float] | no | None | Speed of light. |
len_range_line | Optional[int] | no | None | Length of range line. |
range_sample_freq | Optional[float] | no | None | Range sampling frequency. |
wavelength | Optional[float] | no | None | Radar 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.aux 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/aux.py:239
Signature
multiply_inplace(a: Union[np.ndarray, torch.Tensor], b: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, torch.Tensor]
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
a | Union[np.ndarray, torch.Tensor] | yes | - | First array (modified in-place). |
b | Union[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.aux 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/aux.py:280
Signature
multiply(a: Union[np.ndarray, torch.Tensor], b: Union[np.ndarray, torch.Tensor], debug: bool=False) -> Union[np.ndarray, torch.Tensor]
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
a | Union[np.ndarray, torch.Tensor] | yes | - | First array. |
b | Union[np.ndarray, torch.Tensor] | yes | - | Second array. |
debug | bool | no | False | inferred from implementation. |
Return Type
Union[np.ndarray, torch.Tensor]
Element-wise multiplication result.
Exceptions
ValueError
Side Effects
- io
Example Usage
from sarpyx.processor.core.aux import multiply
result = multiply(a=<a>, b=<b>)
Edge Cases
May raise: ValueError. Includes optional parameters with implementation-defined fallback behavior.
Public Classes (0)
No public classes detected.