Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sotrplib/config/blind_search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from abc import ABC, abstractmethod
from typing import Literal

import astropy.units as u
from astropydantic import AstroPydanticQuantity
from numpydantic import NDArray
from pydantic import BaseModel
from structlog.types import FilteringBoundLogger
Expand Down Expand Up @@ -36,13 +38,15 @@ class PhotutilsBlindSearchConfig(BlindSearchConfig):
search_type: Literal["photutils"] = "photutils"
parameters: BlindSearchParameters | None = None
pixel_mask: NDArray | None = None
thumbnail_half_width: AstroPydanticQuantity[u.deg] | None = None

def to_search_provider(
self, log: FilteringBoundLogger | None = None
) -> SigmaClipBlindSearch:
return SigmaClipBlindSearch(
parameters=self.parameters,
pixel_mask=self.pixel_mask,
thumbnail_half_width=self.thumbnail_half_width,
log=log,
)
Comment on lines 46 to 51
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When thumbnail_half_width is None in the config (line 41), passing it to SigmaClipBlindSearch will override the default value of 0.1 deg defined in the constructor (blind.py lines 44-46). This means the default won't be used when the config value is explicitly None. Consider using thumbnail_half_width=self.thumbnail_half_width or AstroPydanticQuantity(u.Quantity(0.1, "deg")) to ensure the default is applied when the config value is None.

Suggested change
return SigmaClipBlindSearch(
parameters=self.parameters,
pixel_mask=self.pixel_mask,
thumbnail_half_width=self.thumbnail_half_width,
log=log,
)
kwargs = {
"parameters": self.parameters,
"pixel_mask": self.pixel_mask,
"log": log,
}
if self.thumbnail_half_width is not None:
kwargs["thumbnail_half_width"] = self.thumbnail_half_width
return SigmaClipBlindSearch(**kwargs)

Copilot uses AI. Check for mistakes.

Expand Down
1 change: 0 additions & 1 deletion sotrplib/filters/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ def matched_filter_depth1_map(
):
# Get band-local versions of the map etc.
bmap, bivar, bhit = [a[..., r.i1 : r.i2, :] for a in [imap, ivarmap, hit]]

bny, _ = bmap.shape[-2:]
if shift > 0:
bS = ShiftMatrix(bmap.shape, bmap.wcs, info.profile)
Expand Down
6 changes: 5 additions & 1 deletion sotrplib/maps/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ def subtract_sources(
src_model = make_model_source_map(
input_map.flux,
sources,
nominal_fwhm=get_fwhm(input_map.frequency),
nominal_fwhm=get_fwhm(
input_map.frequency,
arr=input_map.array,
instrument=input_map.instrument,
),
matched_filtered=True,
verbose=verbose,
cuts=cuts,
Expand Down
6 changes: 4 additions & 2 deletions sotrplib/maps/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ def preprocess(self, input_map: ProcessableMap) -> ProcessableMap:
rho, kappa = matched_filter_depth1_map(
imap=input_map.intensity * input_map.intensity_units.to(u.K),
ivarmap=input_map.inverse_variance / input_map.intensity_units.to(u.K) ** 2,
band_center=get_frequency(input_map.frequency),
band_center=get_frequency(
input_map.frequency, instrument=input_map.instrument
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The arr parameter is not being passed to get_frequency. For consistency with the API design and to support potential per-array frequency values in the future, consider passing input_map.array as the arr parameter, similar to how it's done in other calls throughout the codebase.

Suggested change
input_map.frequency, instrument=input_map.instrument
input_map.frequency,
instrument=input_map.instrument,
arr=input_map.array,

Copilot uses AI. Check for mistakes.
),
infofile=self.infofile,
maskfile=self.maskfile,
source_mask=input_map.mask,
beam_fwhm=get_fwhm(input_map.frequency),
beam_fwhm=get_fwhm(input_map.frequency, instrument=input_map.instrument),
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The arr parameter is not being passed to get_fwhm, while it is being passed in other calls throughout the codebase (e.g., in force.py lines 149-153 and maps.py lines 86-90). For consistency and to support potential per-array FWHM values in the future, consider passing input_map.array as the arr parameter.

Suggested change
beam_fwhm=get_fwhm(input_map.frequency, instrument=input_map.instrument),
beam_fwhm=get_fwhm(
input_map.frequency,
instrument=input_map.instrument,
arr=input_map.array,
),

Copilot uses AI. Check for mistakes.
beam1d=self.beam1d,
shrink_holes=self.shrink_holes,
apod_edge=self.apod_edge,
Expand Down
3 changes: 1 addition & 2 deletions sotrplib/sifter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ def __init__(
self.ra_jitter = ra_jitter
self.dec_jitter = dec_jitter
self.cuts = cuts or {
"fwhm_ra": [0.5 * u.arcmin, 5.0 * u.arcmin],
"fwhm_dec": [0.5 * u.arcmin, 5.0 * u.arcmin],
"fwhm": [0.2, 5.0],
"snr": [5.0, np.inf],
}
self.crossmatch_with_gaia = crossmatch_with_gaia
Expand Down
Loading
Loading