-
-
Notifications
You must be signed in to change notification settings - Fork 409
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 value error to ensure active virtual packet logging in SDECPlotter #1597
add value error to ensure active virtual packet logging in SDECPlotter #1597
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1597 +/- ##
==========================================
- Coverage 67.70% 61.88% -5.82%
==========================================
Files 68 62 -6
Lines 6091 5733 -358
==========================================
- Hits 4124 3548 -576
- Misses 1967 2185 +218
Continue to review full report at Codecov.
|
I don't understand why virtual_packet_logging needs to be set to True - I thought we left it so that we could make SDEC plots with either real or virtual packets? |
@jaladh-singhal do you know why this isn't working? |
@yuyizheng1112 can you write tests for the PR? |
@jamesgillanders When calling I also think there is no need to set it to true for those who plot real packets only. But the instruction in Maybe I can put this exception in function |
So can I clarify something? There should be functionality to allow the SDEC plot to generate with real packets, but that does not currently work. And this PR will print an error message to explain that the real packets mode don't work. Is that right? Then at some point, after this fix has been implemented, will we fix the real packets mode so that it does work? |
If all of that is the case, then we will have to come back and remove this fix, so that the code will allow a plot to be generated using real packets. Or am I misunderstanding the problem being addressed here? |
@jamesgillanders The default value for |
@jamesgillanders becuase there are currently no tests for SDEC plot hence test coverage is failing |
@yuyizheng1112 @jamesgillanders I think I understand both of your reasoning. I see an intersecting solution for this problem:
This way even when virtual packets logging is not enabled, SDEC plot can still be obtained for real packets mode (what @jamesgillanders is saying) and will only give error when virtual packets mode is requested by user (what @yuyizheng1112 is trying to do). |
@yuyizheng1112 Good point! The instruction should actually be changed to "The virtual packet logging capability must be active in order to produce SDEC Plot for virtual packets population. Thus ..." and it should be moved right after 5th cell's output. |
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.
@yuyizheng1112 can you please change this as per my comments?
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@jaladh-singhal Sure. I've changed both ValueError and instruction. |
Before a PR is accepted, it must meet the following criteria:
|
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.
Thanks for the changes @yuyizheng1112 - I had a one minor comment.
Also, I hope you've tested this for config files with vpacket logging not enabled - can you post screenshots of that?
@@ -568,6 +576,11 @@ def _calculate_plotting_data( | |||
"allowed values are 'virtual' or 'real'" | |||
) | |||
|
|||
if packets_mode == "virtual" and self.data[packets_mode] is None: | |||
raise ValueError( | |||
'SDECPlotter doesn\'t have any data for virtual packets population and SDEC plot for the same was requested.\nEither set virtual_packet_logging: True in your configuration file to generate SDEC plot with virtual packets, or pass packets_mode="real" in your function call to generate SDEC plot with real packets.' |
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.
It's better to break long string to multiple lines following 80 char limit. Also if you use "..."
for your string you will not need to escape '
used inside your string - see how L575-L576 does this
Before a pull request is accepted, it must meet the following criteria:
|
5b4069c
to
fc9db95
Compare
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.
Excellent!
…ter (tardis-sn#1597) * add value error to ensure active virtual packet logging * move ValueError and edit docs * format * Split long string
This PR allows SDECPlotter to raise error if
virtual_packet_logging
is not set toTrue
.Motivation and context
Before this change, SDECPlotter can work even when
virtual_packet_logging
is not active. In this case, an index error is raised by function inmatplotlib
while calling the functionplotter.generate_plot_mlp()
, and the output is confusing.Since SDECPlotter requires
virtual_packet_logging
, it should ensure the option is set to true.How has this been tested?
Examples
Before change:
After change:
Type of change
Checklist