mne-qt-browser
mne-qt-browser copied to clipboard
ENH: Monitor Calibration, Sensitivity & Custom Scaling
Reference issue
Resolves mne-tools/mne-python#10888
Previous PRs: mne-tools/mne-qt-browser#208, mne-tools/mne-qt-browser#212
What does this implement/fix?
- Monitor Calibration: The user makes two measurements for the width and length of the plot, which are later used for on monitor length calculation and sensitivity.
- Sensitivity: Amplitude unit per length unit, for example
uVas the amplitude unit anduV/mmas the sensitivity unit of measurement for a channel type. - Custom Scaling: Scaling extended from simple +/- buttons, to being able to specify the Amplitude/Sensitivity for each channel type, or specify the duration, seconds/mm and mm/seconds for the time axis scaling.
Information
Created 3 new classes/dialogs to fulfill the above requirements:
CalibrationDialogfor monitor calibration by the user:
Description: Inspired by EDFbrowser. the plot turns in the inverse of the current color, and the user is asked to measure its height and width. Those are saved in mne.height and mne.width for later use for sensitivity.
In order to keep measurements correct, and not being able to account for window resizes, for the time being the window and plot are locked in size while the user has the calibration mode enabled. While this functionality is enabled the user has access to all sensitivity features stated below and the sensitivity values are displayed alongside the amplitudes..
ScalingDialogfor scaling the amplitude and sensitivity of channels:
Description: A simple dialog with a row for each channel type, and two columns of text boxes: one for the amplitude, and one for sensitivity. The new added features is being able to scale a specific channel type as opposed to all data together, and also the sensitivity feature. Sensitivity is defined as amplitude unit per mm, on the user screen. Available only after calibration.
TimeScalingDialogfor time axis scaling:
Description: A simple dialog with 3 textboxes. facilitating the seconds/page (duration), the seconds/mm and the mm/second values. Opposed to the previous dialog, the time scaling occurs for every channel type at once. Again, the values relevant to on-screen lengths are available only after calibration.
Additional information
- The code is somewhat well commented, especially where calculations have been made. I am of course available for clarifications.
- Swapped the old
mne.scale_factorvariable formne.scale_factorsdict in order to scale differently each channel type. - Also created
mne.norms_dict=mne.scalings*mne.unit_scalings, to stop some computations that never change - The dialogs are updated on various instances that call for recalculation of the values.
- Added "Settings" button icons for all new functionalities, I am not yet familiar with the icons design
- Temporarily made the
ScaleBarTextbigger and bold, needs better readability.
@drammock
Hey guys, long time no speak. Hope all is well! Well, I am aware that you wouldn't want a huge PR like this one, but I had a definitive deadline for the project on my part. So I decided to complete it to make the deadline, and now come in touch with you.
I of course had to share my work with you, even if it wasn't exactly per your directions. I get that this will be a lot on your plate, and will respect your decision, should you not want to engage in it.
But, I would very much like to see at least some of my contributions accepted. I will be available for clarifications and reiterations where it is necessary. I want to make your review as easy as possible, and have tried to put explanations above and in comments, but I am sure that more will be needed.
Anyways, I look forward to hearing from you!
Hey guys, long time no speak. Hope all is well!
Thanks, and I must apologize for losing track of PRs #208 and #212. Sorry to have dropped the ball there.
Just looking at the PR description / screenshots this looks like a nice improvement. I'd say the minimum necessary for getting this to mergeable state is to look at the test failures and try to figure out why they fail, and fix the code (or the test, if appropriate) to make them pass. If you're stuck or the failures seem unrelated to the changes here, feel free to ask for help. Once the tests are passing, then we can start in on code review, although the diff is pretty big so I can't promise we won't ask you to split it into multiple smaller PRs later; big changes like this are just much harder/slower to review.
In the meantime, it sounds like you've done what you needed to for your local project needs, right? So this PR can sit for a while if you don't have time immediately to look at the test failures.
@Grifunf I'll close this since I think we now have a lot of this stuff in main and the conflicts will be tough. Feel free to give it a try and if functionality is still missing we'd be happy for follow-up PRs to improve things!