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

wt.data.join does not work if any individual piece being joined is a single point #1110

Open
DLafayetteII opened this issue Jan 4, 2023 · 2 comments
Labels

Comments

@DLafayetteII
Copy link
Contributor

test.txt

I was confident I had done this successfully ~ a year ago, but this fails in WrightTools 3.4.4 and 3.4.6.
Guessing something the slice inside the transpose:

`
File "C:\Users\David Lafayette\miniconda3\lib\site-packages\WrightTools\data_join.py", line 262, in join
combine(data, out, channel_name, new_idx, transpose, slice_)

File "C:\Users\David Lafayette\miniconda3\lib\site-packages\WrightTools\data_join.py", line 199, in combine
vals[valid_index] = old[:].transpose(transpose)[slice_]

ValueError: axes don't match array
`

@DLafayetteII DLafayetteII changed the title wt.data.join does not work if any pieces are a single point wt.data.join does not work if any individual piece being joined is a single point Jan 4, 2023
@DLafayetteII
Copy link
Contributor Author

The issue arises from lines 245 - 250 of _join.py. np.ndim() of the 1 point variable returns a dimensionality of zero (np.ndim(d1.freq.points) = 0). Therefore, nothing is appended to the transpose, and an empty transpose (transpose = []) is passed to the combine method (If instead transpose = [0], the combine and join methods work as intended).

@DLafayetteII
Copy link
Contributor Author

DLafayetteII commented Jan 4, 2023

I'll propose a fix for the issue but I'm not sure I understand the initial intention of what should be done with 'scalar' (single-value) variables. There is a comment on line 248 about the transpose being unnecessary for scalar variables, but we pass the transpose to the combine method regardless of whether the variable is scalar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant