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

The JoinedData container seems to be missing a getindex() method for indices other than Number #177

Open
gruberchr opened this issue Jul 18, 2024 · 0 comments

Comments

@gruberchr
Copy link

A data container with joined data like e.g.

data = joinobs(1:5, 6:10)

can be accessed successfully via getobs(), if the observation index is a single value, i.e. is of type Number:

getobs(data, 6)

Instead, when accessing multiple observations at once, e.g., as follows

getobs(data, 4:6)

a MethodError is thrown with message no method matching isless(::UnitRange{Int64}, ::Int64) in obstransform.jl.

The getobs() function refers to the getindex() function in this case and currently there seems to be only this getindex() method for JoinedData containers, which is obviously restricted to single value indices.

A possible use case for accessing more than a single observation could be, for instance, the combination of the JoinedData container with a BatchView and batch-sizes larger than 1, as follows:

batched_data = BatchView(data; batchsize=3)

When accessing this batched data container, e.g., as follows

batched_data[2]

the same error is thrown because this expression finally calls getobs() here in the same way as in the example above.

I guess that at least the getindex() method for JoinedData containers should be restricted to indices of type Number. But it would also be nice if JoinedData containers supported other indexing types in the future.

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

1 participant