-
Notifications
You must be signed in to change notification settings - Fork 7
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
Option for normalizing data in waterfall plot #31
Changes from 1 commit
31e3ca3
ea2d9d8
f0e87dd
c567762
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ def __init__(self, key_list, data_dict, fig, canvas): | |
self.x_offset = 0 | ||
self.y_offset = 0 | ||
self.normalized_data = dict() | ||
self.is_normalized = True | ||
|
||
def generate_waterfall(self): | ||
"""This method handles the plotting of the 2d waterfall | ||
|
@@ -50,15 +51,28 @@ def generate_waterfall(self): | |
None | ||
""" | ||
self.ax.cla() | ||
# self.ax.hold(True) | ||
for i in range(0, len(self.key_list)): | ||
temp_x = self.normalized_data[self.key_list[i]][0].copy() | ||
temp_y = self.normalized_data[self.key_list[i]][1].copy() | ||
temp_x += self.x_offset * i | ||
temp_y += self.y_offset * i | ||
self.ax.plot(temp_x, temp_y) | ||
self.ax.autoscale() | ||
self.canvas.draw() | ||
if self.is_normalized: | ||
print("normy") | ||
for i in range(0, len(self.key_list)): | ||
temp_x = self.normalized_data[self.key_list[i]][0].copy() | ||
temp_y = self.normalized_data[self.key_list[i]][1].copy() | ||
temp_x += self.x_offset * i | ||
temp_y += self.y_offset * i | ||
self.ax.plot(temp_x, temp_y) | ||
self.ax.title("Data Normalized") | ||
self.ax.autoscale() | ||
self.canvas.draw() | ||
else: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might compress this into two chunks, the part which does the normalizeation (or not) and the part which does the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could compress this even more, since the if self.is_normalized:
data = norm_blob
else:
data = blob
# Now put your temp_x, temp_y logic |
||
print("4chan") | ||
for i in range(0, len(self.key_list)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can just be |
||
temp_x = self.data_dict[self.key_list[i]][0].copy() | ||
temp_y = self.data_dict[self.key_list[i]][1].copy() | ||
temp_x += self.x_offset * i | ||
temp_y += self.y_offset * i | ||
self.ax.plot(temp_x, temp_y) | ||
self.ax.title("Data not normalized") | ||
self.ax.autoscale() | ||
self.canvas.draw() | ||
|
||
def normalize_data(self): | ||
"""This method normalizes data for plotting | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also note that you could do this with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also you might look into using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean the |
||
|
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.
you can just write
range(len(...))
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.
or even better
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.
for even more compactness:
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.
Actually, you might not need the
sub_blob
. Do you allow the number of data sets to not equal the number of keys? If not then just skip the sub_blob line.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, you can only get the data if there is a key for it. There should never be a time there is not a key for the 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.
Great than you can just do a two liner
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.
Also, you don't need 0 in the range call.