Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mining in Logarithmic Space
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOISON Benjamin
Mining in Logarithmic Space
Commits
4d7259c6
Unverified
Commit
4d7259c6
authored
1 year ago
by
Benjamin Loison
Browse files
Options
Downloads
Patches
Plain Diff
Simplify `plot_statistics.py` code
parent
e9a2a534
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
plot_statistics.py
+13
-17
13 additions, 17 deletions
plot_statistics.py
with
13 additions
and
17 deletions
plot_statistics.py
+
13
−
17
View file @
4d7259c6
...
...
@@ -9,6 +9,7 @@ with open('data.json') as f:
fig
,
targetsAxis
=
plt
.
subplots
()
fig
.
subplots_adjust
(
right
=
0.8
)
axes
=
[
targetsAxis
,
targetsAxis
.
twinx
(),
targetsAxis
.
twinx
()]
targets
=
[
math
.
log2
(
target
)
for
target
in
data
[
'
targets
'
]]
...
...
@@ -17,38 +18,33 @@ for x, (target, nextTarget) in enumerate(zip(targets, targets[1:])):
firstTargetDecreaseCurve
=
plt
.
axvline
(
x
=
x
,
color
=
'
purple
'
,
label
=
'
first target decrease
'
)
break
targetRecomputationCurve
=
[]
if
SHOW_TARGET_RECOMPUTATION
:
for
x
in
range
(
0
,
len
(
data
[
'
targets
'
]),
2016
):
targetRecomputationCurve
=
plt
.
axvline
(
x
=
x
,
alpha
=
0.1
,
label
=
'
target recomputation
'
)
targetRecomputationCurve
=
[
plt
.
axvline
(
x
=
x
,
alpha
=
0.1
,
label
=
'
target recomputation
'
)
]
for
x
,
(
target
,
nextTarget
)
in
enumerate
(
zip
(
targets
,
targets
[
1
:])):
if
nextTarget
>
target
:
targetIncreaseCurve
=
plt
.
axvline
(
x
=
x
,
alpha
=
0.5
,
color
=
'
red
'
,
label
=
'
target increase
'
)
target
sColor
=
'
blue
'
targetsAxis
.
plot
(
targets
,
l
abel
=
'
target
'
,
co
lor
=
targetsColor
)
targetsAxis
.
set_ylabel
(
'
targets
'
,
color
=
targetsColor
)
axe
sColor
s
=
[
'
blue
'
,
'
green
'
,
'
brown
'
]
axesL
abel
s
=
[
'
target
s
'
,
'
co
mpressed blockchain size (in blocks)
'
,
'
compressed blockchain score
'
]
axesYValues
=
[
targets
,
data
[
'
compressSize
'
],
data
[
'
compressScore
'
]]
compressSizeAxis
=
targetsAxis
.
twinx
()
compressScoreAxis
=
targetsAxis
.
twinx
()
for
axis
,
color
,
label
,
yValues
in
zip
(
axes
,
axesColors
,
axesLabels
,
axesYValues
):
axis
.
plot
(
yValues
,
color
=
color
)
axis
.
set_ylabel
(
label
,
color
=
color
)
compressScoreAxis
.
spines
.
right
.
set_position
((
'
axes
'
,
1.1
5
))
axes
[
1
]
.
spines
.
right
.
set_position
((
'
axes
'
,
1.1
))
compressSizeColor
=
'
green
'
compressSizeAxis
.
plot
(
data
[
'
compressSize
'
],
color
=
compressSizeColor
)
compressSizeAxis
.
set_ylabel
(
'
compressed blockchain size (in blocks)
'
,
color
=
compressSizeColor
)
compressScoreColor
=
'
brown
'
compressScoreAxis
.
plot
(
data
[
'
compressScore
'
],
color
=
compressScoreColor
)
compressScoreAxis
.
set_ylabel
(
'
compressed blockchain score
'
,
color
=
compressScoreColor
)
curves
=
([
targetRecomputationCurve
]
if
SHOW_TARGET_RECOMPUTATION
else
[])
+
[
firstTargetDecreaseCurve
]
+
[
targetIncreaseCurve
]
curves
=
targetRecomputationCurve
+
[
firstTargetDecreaseCurve
]
+
[
targetIncreaseCurve
]
labels
=
[
curve
.
get_label
()
for
curve
in
curves
]
plt
.
legend
(
curves
,
labels
,
loc
=
'
upper center
'
,
framealpha
=
1
)
ax1
.
set_xlabel
(
'
Block height
'
)
for
ax
,
color
in
zip
(
[
targetsAxis
,
compressSizeAxis
,
compressScoreAxis
],
[
targetsColor
,
compressSizeColor
,
compressScoreColor
]
):
for
ax
,
color
in
zip
(
axes
,
axesColors
):
ax
.
tick_params
(
axis
=
'
y
'
,
colors
=
color
)
plt
.
title
(
'
Variable difficulty Bitcoin compressed blockchain evolution
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment