Skip to content

Fix bug with repeated calls to form_pattern#274

Merged
bhawkins merged 1 commit into
isce-framework:developfrom
bhawkins:fix_eap_rx_weights
May 27, 2026
Merged

Fix bug with repeated calls to form_pattern#274
bhawkins merged 1 commit into
isce-framework:developfrom
bhawkins:fix_eap_rx_weights

Conversation

@bhawkins
Copy link
Copy Markdown
Contributor

I was trying to optimize the antenna pattern weights and thought I was going crazy because I'd get different patterns every time I called AntennaPattern.form_pattern. It turns out #231 introduced a bug where the receive pattern weights mutate the stored LNA/caltone ratio on every call.

In focus.py we only call form_pattern twice on each instance, once for the science data and then again for the noise data. So in production the image is fine but the noise equivalent backscatter is calculating the wrong RX pattern whenever the weights aren't unity.

@bhawkins bhawkins requested review from hfattahi and rad-eng-59 May 24, 2026 02:04
Comment thread python/packages/nisar/antenna/pattern.py
@hfattahi hfattahi added this to the R05.02.0 milestone May 26, 2026
Copy link
Copy Markdown
Contributor

@rad-eng-59 rad-eng-59 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for the fix.
I thought we could fix the problem earlier in case somebody add another line in the future and make the same mistake I did.
Btw, that makes me realize that elements of a numpy-array type member of so-called immutable frozen dataclass is still mutable! Very annoying.

Copy link
Copy Markdown
Contributor

@hfattahi hfattahi left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @bhawkins

@bhawkins bhawkins merged commit 4956242 into isce-framework:develop May 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants