Skip to content

Force bool to float32, add explicit error message - #14

Open
tjgalvin wants to merge 3 commits into
mainfrom
beth-fix
Open

Force bool to float32, add explicit error message#14
tjgalvin wants to merge 3 commits into
mainfrom
beth-fix

Conversation

@tjgalvin

Copy link
Copy Markdown

Beth, of GASKAP-OH fame, pointed out two issues.

The first was that in some circumstances a bool mask array is passed for fits.writeto, which subsequently raises an error. I don't know how long this one has been around for - I feel like I should have seen it long ago. We may have overlooked something when removing the logic from flint to eye-patch. An easy fix anyway.

The next was around how the gaussian kernels are constructed in the beam erosion stage. It is possible for the scale to be so small that a gaussian kernel can not be created. The sigma width is so small that it is well within a single pixel, which then breaks the coordinate system we evaluate the kernel over. In this case I have added a more informative error as there is really nothing I think we ought to be doing here. This error would only be tripped for a very small scale, like --beam-shape-erode-scales 1, otherwise no change.

@tjgalvin
tjgalvin requested a review from AlecThomson August 17, 2026 12:51
@tjgalvin

Copy link
Copy Markdown
Author

I also

  • added a logger sub-module like our other packages
  • copied over the flint precommit yaml. This one was complaining about an older version of python not being compatible with the type alias we are using

Comment thread eye_patch/masking.py
if pix_sigma < 1:
# linspace can only take integer inputs, and if sigma is too small then this array comes
# out as length zero.
msg = f"{scale=} is too small and an appropriately sized kernel can not be formed. Consider removing it. "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"Consider removing it."

What does "it" mean here? Can we make this message more explicit on what to change?

Comment thread .pre-commit-config.yaml
Comment on lines +28 to +40
# - repo: https://github.com/pre-commit/pygrep-hooks
# rev: "v1.10.0"
# hooks:
# - id: rst-backticks
# - id: rst-directive-colons
# - id: rst-inline-touching-normal

- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.8.3"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]
# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: "v4.0.0-alpha.8"
# hooks:
# - id: prettier
# types_or: [yaml, markdown, html, css, scss, javascript, json]
# args: [--prose-wrap=always]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are these removed?

Comment thread .pre-commit-config.yaml
hooks:
- id: mypy
files: eye_patch|tests
files: flint|tests

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
files: flint|tests
files: eye_patch|tests

Bad copy-paste

Comment thread .pre-commit-config.yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why were changes needed here?

@AlecThomson

Copy link
Copy Markdown
Contributor

@tjgalvin - can we revert the pre-commit changes? I'd rather address more explicitly, I think its a numpy / mypy / python version clash.

We're also running to an issue I've hit bunch lately with my CD.yml

The fix is to bump to hynek/build-and-inspect-python-package@v3.0.1 Lemme know if you like me to sort that

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.

2 participants