Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
CorAl-ScanAlignmentClassification/python/plotting.py at master · dan11003/CorAl-ScanAlignmentClassification · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
dan11003
CorAl-ScanAlignmentClassification
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
CorAl-ScanAlignmentClassification
/
python
/
plotting.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
150 lines (123 loc) · 7.59 KB
master
Breadcrumbs
CorAl-ScanAlignmentClassification
/
python
/
plotting.py
Copy path
Top
File metadata and controls
Code
Blame
150 lines (123 loc) · 7.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Statistics output for experiments
import
os
import
argparse
import
pandas
as
pd
import
matplotlib
.
pyplot
as
plt
import
seaborn
as
sns
# Read provided statistics file
bag_location
=
os
.
getenv
(
'BAG_LOCATION'
)
directory
=
bag_location
+
'/CoralRadarEval/'
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--filename"
,
"-f"
,
help
=
"csv or text file containing statistics"
,
default
=
""
)
args
=
parser
.
parse_args
()
# Import statistics file
stats_file
=
directory
+
args
.
filename
data
=
pd
.
read_csv
(
stats_file
)
# Directory to save figures
filename
=
args
.
filename
save_dir
=
directory
+
filename
.
replace
(
".txt"
,
""
)
if
not
os
.
path
.
exists
(
save_dir
) :
os
.
mkdir
(
save_dir
)
# -- Plot 1 (accuracy by method) -- #
# Plot style (seaborn)
sns
.
set_theme
(
style
=
"ticks"
,
color_codes
=
True
)
sns
.
set
(
style
=
"ticks"
)
colors
=
[
"#E59866"
,
"#D35400"
,
"#873600"
,
"#85C1E9"
,
"#3498DB"
,
"#2874A6"
]
#Daniel
color_figures
=
[
"#E59866"
,
"#D35400"
,
"#873600"
,
"#85C1E9"
,
"#3498DB"
,
"#2874A6"
,
"#FF90FA"
,
"#FF00F3"
,
"#8F0088"
,
"#94FF76"
,
"#39FF00"
,
"#26AB00"
]
marker_figures
=
[
'o'
,
'o'
,
'o'
,
'o'
,
'o'
,
'o'
,
'o'
,
'o'
,
'o'
,
'o'
,
'o'
,
'o'
]
#colors = ["#E59866","#2874A6", "#D35400", "#85C1E9", "#3498DB", "#873600"] #Mine
data
=
data
.
rename
(
columns
=
{
'range error'
:
'Range error (m)'
})
data
=
data
.
rename
(
columns
=
{
'scan spacing distance'
:
'Scan spacing distance (m)'
})
data
=
data
.
rename
(
columns
=
{
'accuracy'
:
'Accuracy'
})
data
=
data
.
rename
(
columns
=
{
'method'
:
'Method'
})
data
=
data
.
rename
(
columns
=
{
'auc'
:
'AuC'
})
pal
=
sns
.
color_palette
(
colors
)
mar
=
[
'o'
,
'o'
,
'o'
,
's'
,
's'
,
's'
]
lin
=
[
'-'
,
'--'
,
':'
,
'-'
,
'--'
,
':'
]
# Plot data
#data['method'] = data.apply(lambda row: row['method'].replace('method', ''), axis=1)
#Lineplot (commented)
#sns_plot = sns.pointplot(x = 'Range error (m)', y = 'Accuracy', data = data, hue = 'Method', dodge = False, palette=pal)
#sns_plot.locator_params(axis='x', nbins=5)
# ----- Uncertainty plot (range error)
#sns_plot = sns.catplot(x='Range error (m)', y='Accuracy', hue='Method', kind="box", dodge=True, data=data, legend_out=True) # Old
method_scan
=
'Method and scan spacing (m)'
data
[
method_scan
]
=
data
.
apply
(
lambda
row
:
row
[
'Method'
]
+
', '
+
str
(
row
[
'Scan spacing distance (m)'
]),
axis
=
1
)
data_scan
=
data
[ (
data
[
'Scan spacing distance (m)'
]
==
0
)
|
(
data
[
'Scan spacing distance (m)'
]
==
5
)
|
(
data
[
'Scan spacing distance (m)'
]
==
10
) ]
data_scan_1
=
data_scan
[
data_scan
[
'Method'
]
==
'P2P'
] ;
data_scan_1
=
data_scan_1
.
sort_values
(
'Scan spacing distance (m)'
)
data_scan_2
=
data_scan
[
data_scan
[
'Method'
]
==
'P2D'
] ;
data_scan_2
=
data_scan_2
.
sort_values
(
'Scan spacing distance (m)'
)
data_scan_3
=
data_scan
[
data_scan
[
'Method'
]
==
'P2L'
] ;
data_scan_3
=
data_scan_3
.
sort_values
(
'Scan spacing distance (m)'
)
data_scan_4
=
data_scan
[
data_scan
[
'Method'
]
==
'Coral'
] ;
data_scan_4
=
data_scan_4
.
sort_values
(
'Scan spacing distance (m)'
)
sns_plot
=
sns
.
lineplot
(
x
=
"Range error (m)"
,
y
=
"Accuracy"
,
hue
=
method_scan
,
style
=
method_scan
,
data
=
data_scan_1
,
markers
=
[
'.'
,
'o'
,
's'
],
dashes
=
False
,
palette
=
[
"#E59866"
,
"#D35400"
,
"#873600"
])
# Current
sns_plot
=
sns
.
lineplot
(
x
=
"Range error (m)"
,
y
=
"Accuracy"
,
hue
=
method_scan
,
style
=
method_scan
,
data
=
data_scan_2
,
markers
=
[
'.'
,
'o'
,
's'
],
dashes
=
False
,
palette
=
[
"#85C1E9"
,
"#3498DB"
,
"#2874A6"
])
sns_plot
=
sns
.
lineplot
(
x
=
"Range error (m)"
,
y
=
"Accuracy"
,
hue
=
method_scan
,
style
=
method_scan
,
data
=
data_scan_3
,
markers
=
[
'.'
,
'o'
,
's'
],
dashes
=
False
,
palette
=
[
"#FF90FA"
,
"#FF00F3"
,
"#8F0088"
])
sns_plot
=
sns
.
lineplot
(
x
=
"Range error (m)"
,
y
=
"Accuracy"
,
hue
=
method_scan
,
style
=
method_scan
,
data
=
data_scan_4
,
markers
=
[
'.'
,
'o'
,
's'
],
dashes
=
False
,
palette
=
[
"#94FF76"
,
"#39FF00"
,
"#26AB00"
])
#plt.ylim(0.45,1)
#plt.xlim(0.05,0.95)
plt
.
grid
()
plt
.
show
()
#fig = sns_plot.get_figure()
#fig.savefig(save_dir + '/accuracyByMethod.pdf', format='pdf')
# ----- Uncertainty plot (scan spacing)
#sns_plot = sns.catplot(x='Range error (m)', y='Accuracy', hue='Method', kind="box", dodge=False, data=data, legend_out=True) # Old
method_range
=
'Method and range error (m)'
data
[
method_range
]
=
data
.
apply
(
lambda
row
:
row
[
'Method'
]
+
', '
+
str
(
row
[
'Range error (m)'
]),
axis
=
1
)
data_spacing
=
data
[ (
data
[
'Range error (m)'
]
==
0.3
)
|
(
data
[
'Range error (m)'
]
==
0.6
)
|
(
data
[
'Range error (m)'
]
==
0.9
)]
data_spacing_1
=
data_spacing
[
data_spacing
[
'Method'
]
==
'P2P'
]
data_spacing_2
=
data_spacing
[
data_spacing
[
'Method'
]
==
'P2D'
]
data_spacing_3
=
data_spacing
[
data_spacing
[
'Method'
]
==
'P2L'
]
data_spacing_4
=
data_spacing
[
data_spacing
[
'Method'
]
==
'Coral'
]
sns_plot
=
sns
.
lineplot
(
x
=
"Scan spacing distance (m)"
,
y
=
"Accuracy"
,
hue
=
method_range
,
style
=
method_range
,
data
=
data_spacing_1
,
markers
=
[
'.'
,
'o'
,
's'
],
dashes
=
False
,
palette
=
[
"#E59866"
,
"#D35400"
,
"#873600"
])
# Current
sns_plot
=
sns
.
lineplot
(
x
=
"Scan spacing distance (m)"
,
y
=
"Accuracy"
,
hue
=
method_range
,
style
=
method_range
,
data
=
data_spacing_2
,
markers
=
[
'.'
,
'o'
,
's'
],
dashes
=
False
,
palette
=
[
"#85C1E9"
,
"#3498DB"
,
"#2874A6"
])
sns_plot
=
sns
.
lineplot
(
x
=
"Scan spacing distance (m)"
,
y
=
"Accuracy"
,
hue
=
method_range
,
style
=
method_range
,
data
=
data_spacing_3
,
markers
=
[
'.'
,
'o'
,
's'
],
dashes
=
False
,
palette
=
[
"#FF90FA"
,
"#FF00F3"
,
"#8F0088"
])
sns_plot
=
sns
.
lineplot
(
x
=
"Scan spacing distance (m)"
,
y
=
"Accuracy"
,
hue
=
method_range
,
style
=
method_range
,
data
=
data_spacing_4
,
markers
=
[
'.'
,
'o'
,
's'
],
dashes
=
False
,
palette
=
[
"#94FF76"
,
"#39FF00"
,
"#26AB00"
])
#sns_plot = sns.lineplot(x="scan spacing distance", y="Accuracy", hue="Method", style="Method", data= data[data["Range error (m)"]==0.5], markers=['s','s','s'], dashes=False, palette=["#85C1E9", "#3498DB", "#2874A6"]) # Current
#sns_plot = sns.lineplot(x="scan spacing distance", y="Accuracy", hue="Method", style="Method", data= data[data["Range error (m)"]==0.9], markers=['^','^','^'], dashes=False, palette=["#E59866", "#D35400", "#873600"]) # Current
#plt.ylim(0.45,1)
#plt.xlim(0.05,0.95)
plt
.
grid
()
plt
.
show
()
#fig = sns_plot.get_figure()
#fig.savefig(save_dir + '/accuracyByMethod.pdf', format='pdf')
# Print parameters for 'best' configuration for each method
#data_p2p = data[data['Method'] == 'P2P']
#data_p2d = data[data['Method'] == 'P2D']
#data_p2l = data[data['Method'] == 'P2L']
#print('Best configurations for all methods: ')
#print(data_p2p[data_p2p.Accuracy == data_p2p.Accuracy.max()]) ; print(' ')
#print(data_p2d[data_p2d.Accuracy == data_p2d.Accuracy.max()]) ; print(' ')
#print(data_p2l[data_p2l.Accuracy == data_p2l.Accuracy.max()]) ; print(' ')
# Box plot (accuracies and AuC for all methods)
#sns_plot_2 = sns.boxplot(x=data['Method'], y=data['Accuracy'], width=0.3)
#plt.show()
#fig = sns_plot_2.get_figure()
#fig.savefig(save_dir + '/accuracyBoxplot.pdf', format='pdf')
#sns_plot_3 = sns.boxplot(x=data['Method'], y=data['AuC'], width=0.3)
#plt.show()
#fig = sns_plot_3.get_figure()
#fig.savefig(save_dir + '/aucBoxplot.pdf', format='pdf')
# --- OLD CODE (standalone matplot lib, no seaborn) --- #
# Filter data by method
# data_p2p = data[data['method'] == 'P2P']
# data_p2d = data[data['method'] == 'P2D']
# data_p2l = data[data['method'] == 'P2L']
# # Get data
# x_p2p = data_p2p['range error'] ; y_p2p = data_p2p['accuracy']
# x_p2d = data_p2d['range error'] ; y_p2d = data_p2d['accuracy']
# x_p2l = data_p2l['range error'] ; y_p2l = data_p2l['accuracy']
# # Plot data
# plt.plot(x_p2p,y_p2p,marker='o',label='P2P')
# plt.plot(x_p2d,y_p2d,marker='o',label='P2D')
# plt.plot(x_p2l,y_p2l,marker='o',label='P2L')
# plt.legend(loc="upper left")
# plt.xlabel('Range error (m)')
# plt.ylabel('Classification accuracy')
# plt.savefig(save_dir + '/accuracyByMethod.pdf')
# plt.show()
# # -- Plot 2 (boxplot by method) -- #
# accuracies = [y_p2p, y_p2d, y_p2l]
# plt.boxplot(accuracies)
# plt.xticks([1, 2, 3], ['P2P','P2D','P2L'])
# plt.ylabel('Classification accuracy')
# plt.savefig(save_dir + '/boxplotByMethod.pdf')
# plt.show()
You can’t perform that action at this time.