dfcosmic.utils¶
Functions¶
|
|
|
Exact chunked implementation of the LA Cosmic subsampled Laplacian step: |
|
Memory-efficient chunked convolution |
|
|
|
Median filter with optional IRAF-like zloreject. |
|
Fast CPU median filter using the C++ extension. |
|
|
|
Module Contents¶
- dfcosmic.utils.block_replicate_torch(data: torch.Tensor, block_size: int | list[int], conserve_sum: bool = False) torch.Tensor¶
- dfcosmic.utils.laplacian_pool_chunked(image: torch.Tensor, block_size: torch.Tensor, laplacian_kernel: torch.Tensor, chunk_size: int = 256) torch.Tensor¶
Exact chunked implementation of the LA Cosmic subsampled Laplacian step: 2x block replication -> Laplacian convolution -> clamp(min=0) -> 2x2 average pool.
- dfcosmic.utils.convolve_chunked(image: torch.Tensor, kernel: torch.Tensor, chunk_size: int = 256) torch.Tensor¶
Memory-efficient chunked convolution
- dfcosmic.utils.convolve(image: torch.Tensor, kernel: torch.Tensor, chunk_size: int = 512) torch.Tensor¶
- dfcosmic.utils.median_filter_torch(image: torch.Tensor, kernel_size: int = 3, zloreject: float | None = None) torch.Tensor¶
Median filter with optional IRAF-like zloreject.
If zloreject is not None, values < zloreject are ignored when computing the median (mimics IRAF median(…, zloreject=…)).
- dfcosmic.utils.median_filter_cpp_torch(image: torch.Tensor, kernel_size: int = 3, zloreject: float | None = None) torch.Tensor¶
Fast CPU median filter using the C++ extension.
NOTE: The current extension does not support zloreject. If zloreject is requested, we fall back to the torch implementation to preserve IRAF-parity behavior.
- dfcosmic.utils.sigma_clip_pytorch(data: torch.Tensor, sigma: tuple[float, float] | float = 3.0, maxiters: int = 10) tuple[torch.Tensor, dict]¶
- dfcosmic.utils.cpp_median_available() bool¶