-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add support for binning data to the Scan component #124
Conversation
src/extra/components/scan.py
Outdated
@@ -163,6 +162,83 @@ def plot(self, ax=None): | |||
|
|||
return ax | |||
|
|||
def bin(self, data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer a more expressive name here, as it initially confused me what is actually binned here to what. On top of that, I'm not a fan of collisions with builtins.
As I understand, this method can take arbitrary train-resolved data and averages it for each bin this scan represents. Binning in itself doesn't mean averaging to me, it just means combining results based on some metric. What do you think of explicitly calling it .step_averages()
.average_by_steps()
or something similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, renamed it to step_average()
in dd35a73 (average_by_steps()
is a bit long methinks).
src/extra/components/scan.py
Outdated
"motor": self.name | ||
}) | ||
|
||
def plot_bin(self, data, title=None, xlabel=None, ylabel=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see naming above, this could correspondingly be called something like .plot_step_averages()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to plot_step_average()
in dd35a73.
As discussed this morning, I also added support in dd35a73 for specifying the standard error to be used instead of the standard deviation: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No comments on the actual implementation, but I would prefer some less ambiguous naming. Really cool functionality!
I'm already wondering what other reduction may be useful next to average. Maybe that could also be a naming direction...
How about |
Somehow these suggest something is done to steps, rather than the steps being used to sort/bin/reduce/average something else. But this may simply be due to English being a second language. Maybe Thomas has a good idea when he's back. But I'd also be fine to use the existing names for average here, and later implement it as a specific case of a more general function. |
Yeah, I'm using it more loosely in a 'bin the data that was collected during these steps' way. But I don't feel very strongly about it, how about |
I didn't dare to suggest that, but it strongly communicates the meaning to me 🙈 |
Alrighty, renamed to |
Ok one more naming bikeshed 🙃 Is it confusing that the label on the plots is |
Ah yes, error is indeed a loaded term. I spoke to Danilo, and he strongly preferred the term "Statistical uncertainty" instead. In the docs, we should explicitly mention it's the 68% confidence interval (also called 1-sigma region). |
Roger that, renamed everything to 'uncertainty' in f0fc09f. |
This is usually the entire point of a scan so everyone will end up doing this anyway.
- Uncommented installation admonition - Fixed formatting - Added links
f0fc09f
to
cfcc35e
Compare
(I will sneakily take your earlier LGTM 😏 ) |
This is usually the entire point of a scan so everyone will end up doing this anyway. I also took the liberty of cleaning up the changelog a bit in 9c39677.
One thing I wasn't sure about: some people prefer the standard error instead of the standard deviation. Should we use that by default? Or make it an option?