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

Allow loop_plugin for multi_output #357

Merged
merged 8 commits into from Nov 30, 2020
Merged

Conversation

JoranAngevaare
Copy link
Member

@JoranAngevaare JoranAngevaare commented Nov 23, 2020

What is the problem / what does the code in this PR do
Allow loop-plugins to be used with multiple outputs.

I tried to write a new loop plugin, but this yielded quite an incomprehensible traceback that the dtype was wrong. We should at least make a better error. So I just modified the loop plugin to just work in this case. There is some copy pasting but given it's only 10 lines, I don't care too much.

The only downside is that, while solving this, I realized I don't actually need it.

Can you briefly describe how it works?
Loop over assumed a single output, when a dict is returned for the different outputs, it got confused. Especially when setting up the results buffer.

Copy link
Collaborator

@WenzDaniel WenzDaniel left a comment

Choose a reason for hiding this comment

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

In general I think it is fine, though I think this is one of the fundamental changes which should be covered with a test. Given that this PR is not urgent may I ask you to add one, when there is time. I can also check and add something when I have a free minute this week.

strax/plugin.py Outdated
# Convert from dict to array row:
for k, v in r.items():
results[i][k] = v
if not self.multi_output:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor comment can we revert the logic, if self.multi_output: is a nano bit simpler.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, if it makes you but a nano bit more happy, I'm completely fine with it. Just though most people read from top to bottom and no one has been having self.multi_output issues .

@WenzDaniel
Copy link
Collaborator

Btw, you reached the next level solving problems by accident without need :D

@JoranAngevaare
Copy link
Member Author

The tests are a good point, will put this in the refrigerator for a bit and make the tests (and undraft)

@JoranAngevaare JoranAngevaare marked this pull request as draft November 23, 2020 19:47
@JoranAngevaare JoranAngevaare marked this pull request as ready for review November 26, 2020 10:24
@JoranAngevaare
Copy link
Member Author

Am I missing something or is it really strange that the coverage does not increase after I just spend time on writing a unit test?

@JoranAngevaare JoranAngevaare merged commit a1b814c into master Nov 30, 2020
@JoranAngevaare JoranAngevaare deleted the loop_plugin_multioutput branch November 30, 2020 08:08
@JoranAngevaare JoranAngevaare restored the loop_plugin_multioutput branch November 30, 2020 08:53
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.

None yet

2 participants