Skip to content

Convert angle dtype to float in polar_to_svg_coords#676

Merged
YooSunYoung merged 2 commits intomainfrom
angle-dtype
Mar 3, 2026
Merged

Convert angle dtype to float in polar_to_svg_coords#676
YooSunYoung merged 2 commits intomainfrom
angle-dtype

Conversation

@YooSunYoung
Copy link
Copy Markdown
Member

We had this error while working on Trex choppers.

I think it's safe to convert this to float if it's integer for visualization.

Or should we do this in the constructor itself...?

Comment thread src/scippneutron/chopper/_svg.py Outdated
def polar_to_svg_coords(*, r: sc.Variable, a: sc.Variable) -> tuple[float, float]:
x = to_svg_coord(r * -sc.sin(a))
x = to_svg_coord(r * -sc.sin(a.to(dtype=float)))
y = image_size - to_svg_coord(r * sc.cos(a))
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.

The same should be done for cos here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed it...! Thanks...!

We had this error while working on Trex choppers.

I think it's safe to convert this to float if it's integer for visualization.

Or should we do this in the constructor itself...?
@YooSunYoung YooSunYoung merged commit 8259ccf into main Mar 3, 2026
5 checks passed
@YooSunYoung YooSunYoung deleted the angle-dtype branch March 3, 2026 15:36
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