Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Echotime requires Tuples to be homogeneous #14

Open
StevenWhitaker opened this issue Jan 5, 2023 · 1 comment
Open

Echotime requires Tuples to be homogeneous #14

StevenWhitaker opened this issue Jan 5, 2023 · 1 comment

Comments

@StevenWhitaker
Copy link
Contributor

With the current definition of Echotime, one can't pass in a Tuple with various element types, so, e.g., (0, 2.3) will throw an error. This is because of the <: in NTuple{N,<:T}; removing <: would allow for (0, 2.3).

Not sure if you intended to force all the types of the Tuple elements to be the same, but if not, it should be an easy change.

@JeffFessler
Copy link
Member

JeffFessler commented Jan 8, 2023

My intension is to ensure that units are handled correctly:

using Unitful: ms
et = (0, 2.3ms)
et isa NTuple{2,<:Number} # false, as intended
et isa NTuple{2,Number} # true, which will cause downstream problems with incompatible units

I use oneunit(Te) in a few places...

I am open to other suggestions, but I don't want to have a package dependence on Unitful.

I just realized that [0, 2ms] isa Vector{<:Number} holds, so I am enforcing it more strongly for tuples than for vectors. Hmm.

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

No branches or pull requests

2 participants