Skip to content

Consolidate beam calc functions with generics#16

Open
cjordan wants to merge 5 commits into
MWATelescope:mainfrom
cjordan:traits
Open

Consolidate beam calc functions with generics#16
cjordan wants to merge 5 commits into
MWATelescope:mainfrom
cjordan:traits

Conversation

@cjordan
Copy link
Copy Markdown
Contributor

@cjordan cjordan commented May 14, 2025

Note that only the last commit in this PR is a breaking change; let me know if you want me to split it.

The last commit allows users to call the "calc beam" functions with anything we recognise as a "direction". Before this commit, there were two functions to allow (1) an AzEl or (2) a tuple of floats. With the generic approach, only a single function is needed; this is much tidier and could possibly be extended in the future.

I freely admit that I needed help with understanding the generics. You can see the discussion here: https://users.rust-lang.org/t/make-a-new-iterator-trait-to-replace-d-or-f64-f64/126644

Also, don't feel like this work has to be merged; I'm mostly doing this because I felt like this approach should've been there from the start, but I wasn't good enough/didn't have time to implement it. And now I'm a little bored and find myself missing Rust 🥲

cjordan added 5 commits May 14, 2025 13:30
Some examples were unintentionally using integer division, causing multiple
coordinate pairs to have the same values.
The useless conversion warning only happens when GpuFloat is f64; it wouldn't
happen if it's f32. I wondered why this wasn't triggering in the past.

Some constants were referenced in doc strings that didn't exist. I must've
ripped out the constants after writing the docs. Anyway, this commit adds them
back in and makes them public.
This commit removes superfluous functions by allowing a single function for each
beam type to use generics.
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.

1 participant