Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
binwalk
Commits
74c38e96
Commit
74c38e96
authored
Nov 29, 2013
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished replacing matplotlib with pyqtgraph.
parent
9aed6246
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
entropy.py
src/binwalk/entropy.py
+18
-7
No files found.
src/binwalk/entropy.py
View file @
74c38e96
...
...
@@ -14,9 +14,13 @@ class PlotEntropy(object):
XLABEL
=
'Offset'
YLABEL
=
'Entropy'
COLORS
=
[
'r'
,
'g'
,
'b'
,
'c'
,
'm'
,
'w'
]
XUNITS
=
'B'
YUNITS
=
'E'
FILE_FORMAT
=
'svg'
COLORS
=
[
'r'
,
'g'
,
'c'
,
'b'
,
'm'
]
FILE_WIDTH
=
1024
FILE_FORMAT
=
'png'
def
__init__
(
self
,
x
,
y
,
title
=
'Entropy'
,
average
=
0
,
file_results
=
{},
show_legend
=
True
,
save
=
False
):
'''
...
...
@@ -53,11 +57,16 @@ class PlotEntropy(object):
descriptions
[
offset
]
=
[
description
]
#pg.setConfigOption('background', 'w')
#pg.setConfigOption('foreground', 'k')
plt
=
pg
.
plot
(
title
=
title
,
clear
=
True
)
plt
.
plot
(
x
,
y
,
pen
=
'y'
)
plt
.
plot
(
x
,
y
,
pen
=
'y'
)
#pen='b'
if
file_results
and
show_legend
:
plt
.
addLegend
(
size
=
(
max_description_length
*
10
,
0
))
# Don't really like the way pyqtgraph draws these infinite horizontal lines
#if average:
# plt.addLine(y=average, pen='r')
...
...
@@ -70,11 +79,13 @@ class PlotEntropy(object):
i
=
0
if
save
:
# TODO
pass
#plt.savefig
(common.unique_file_name(title, self.FILE_FORMAT))
exporter
=
pg
.
exporters
.
ImageExporter
.
ImageExporter
(
plt
.
plotItem
)
exporter
.
parameters
()[
'width'
]
=
self
.
FILE_WIDTH
exporter
.
export
(
common
.
unique_file_name
(
title
,
self
.
FILE_FORMAT
))
else
:
plt
.
setWindowTitle
(
title
)
# Only set the axis labels if we're displaying a live window (axis labels aren't well-placed when saving directly to file)
plt
.
setLabel
(
'left'
,
self
.
YLABEL
,
units
=
self
.
YUNITS
)
plt
.
setLabel
(
'bottom'
,
self
.
XLABEL
,
units
=
self
.
XUNITS
)
QtGui
.
QApplication
.
instance
()
.
exec_
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment