Skip to content
Merged
Changes from 1 commit
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: 2 additions & 2 deletions galsim/chromatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1903,9 +1903,9 @@ def sed(self):
@np.vectorize
def detjac(w):
return np.linalg.det(np.asarray(self._jac(w)).reshape(2,2))
sed *= detjac
sed *= np.abs(detjac)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not correct. abs needs to be inside the function. Note that detjac here is a function, not a number.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I didn't notice this at first. Moved inside the function.

Copy link
Copy Markdown
Contributor

@sidneymau sidneymau Feb 20, 2026

Choose a reason for hiding this comment

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

If we wanted to keep detjac as returning a signed number and to only apply the absolute value when doing the SED transformation, then the following should work

sed *= lambda w: np.abs(detjac(w))

Python could really do with better support for functional composition...

elif self._jac is not None:
sed *= np.linalg.det(np.asarray(self._jac).reshape(2,2))
sed *= np.abs(np.linalg.det(np.asarray(self._jac).reshape(2,2)))

return sed

Expand Down
Loading