Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
outillage
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alice Brenon
outillage
Commits
6af016b8
Commit
6af016b8
authored
1 year ago
by
Alice Brenon
Browse files
Options
Downloads
Patches
Plain Diff
Add a script to visualise the profiles computed
parent
64564a6b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/textometry/visualiseProfile.py
+75
-0
75 additions, 0 deletions
scripts/textometry/visualiseProfile.py
with
75 additions
and
0 deletions
scripts/textometry/visualiseProfile.py
0 → 100755
+
75
−
0
View file @
6af016b8
#!/usr/bin/env -S PYTHONPATH=lib/python python3
from
GEODE
import
fromTSV
,
toKey
,
toTSV
from
GEODE.store
import
prepare
from
GEODE.signal
import
gate
,
resample
import
matplotlib.pyplot
as
plot
import
seaborn
from
sys
import
argv
def
plotSingle
(
measure
):
return
gate
(
measure
[
'
position
'
],
measure
[
'
totalSize
'
],
offset
=
1
)
histData
=
[
0.3741792369121561
,
0.7607808340727595
,
0.8889086069210292
,
0.7491570541259982
,
1.2057675244010648
,
1.0869565217391306
,
1.096095829636202
,
0.7124223602484473
,
0.7251109139307897
,
0.9335403726708075
,
1.2277728482697428
,
0.9582963620230699
,
0.8540372670807452
,
1.0281277728482696
,
1.4221827861579415
,
0.9218278615794143
,
0.46814551907719604
,
0.7717834960070986
,
1.083762200532387
,
0.65226264418811
,
0.5771073646850046
,
0.8025732031943212
,
0.5266193433895296
,
0.8911268855368234
,
0.6836734693877551
,
0.9039041703637977
,
0.8720496894409939
,
0.7113575865128662
,
0.8984028393966283
,
0.8993788819875776
,
1.0016858917480034
,
0.5857142857142857
,
0.7364685004436559
,
0.8047914818101152
,
0.7055900621118011
,
0.9018633540372669
,
0.944010647737356
,
0.9955634427684119
,
1.0425909494232473
,
0.9046140195208519
,
0.8504880212954751
,
1.1251109139307898
,
0.44631765749778174
,
0.49893522626441883
,
0.6860692102928126
,
0.7024844720496894
,
0.4693877551020407
,
1.5570541259982251
,
0.8903283052351374
,
0.6923691215616682
,
0.8062999112688553
,
1.0178349600709848
,
0.5559006211180125
,
0.7621118012422359
,
0.848447204968944
,
0.5782608695652174
,
0.8464063886424137
,
0.5537710736468501
,
0.7160603371783496
,
0.7982253771073646
,
0.8371783496007098
,
0.9143744454303461
,
1.0799467613132205
,
0.9581188997338067
,
0.8597160603371785
,
0.864685004436557
,
1.2598935226264418
,
1.3385093167701863
,
0.45891748003549254
,
0.9355811889973382
,
0.6289263531499556
,
0.7637089618456078
,
0.7324755989352264
,
0.754924578527063
,
0.568589174800355
,
0.49778172138420584
,
0.7707187222715175
,
1.0097604259094939
,
0.8621118012422362
,
0.8971606033717835
,
1.1584738243123336
,
1.1568766637089618
,
0.7698314108251997
,
0.9032830523513753
,
0.5743566992014197
,
0.8896184560780832
,
0.7858917480035492
,
0.9899733806566103
,
1.617657497781721
,
1.066725820763088
,
0.6067435669920143
,
1.1874001774622889
,
1.0669920141969833
,
1.1996450754214731
,
1.4835847382431233
,
1.6580301685891752
,
2.2103815439219168
,
2.4215616681455185
,
2.7979591836734694
,
5.278970718722271
]
def
plotProfile
(
profile
,
outputPath
):
plot
.
figure
(
figsize
=
(
16
,
13
))
ax
=
seaborn
.
lineplot
(
profile
)
ax
.
set_xlabel
(
"
Position
"
)
ax
.
set_xlim
(
0
,
100
)
ax
.
set_ylim
(
0
)
ax
.
xaxis
.
set_major_formatter
(
'
{x}%
'
)
ax
.
set_ylabel
(
"
Density
"
)
ax
.
yaxis
.
set_major_formatter
(
'
{x}%
'
)
curve
=
ax
.
lines
[
0
]
x
,
y
=
curve
.
get_xydata
()[:,
0
],
curve
.
get_xydata
()[:,
1
]
ax
.
fill_between
(
x
,
y
,
alpha
=
0.3
)
plot
.
savefig
(
prepare
(
outputPath
),
dpi
=
300
,
bbox_inches
=
'
tight
'
)
def
computeProfile
(
measures
,
resolution
=
100
):
profile
=
[
0
]
*
resolution
for
resampled
in
map
(
resample
(
resolution
),
map
(
plotSingle
,
measures
)):
profile
=
list
(
map
(
sum
,
zip
(
profile
,
resampled
)))
return
[
100
*
x
/
len
(
measures
)
for
x
in
profile
]
def
drawProfile
(
measures
,
outputPath
):
profile
=
computeProfile
(
measures
)
toTSV
(
prepare
(
f
"
{
outputPath
}
/profile.tsv
"
),
profile
,
sortBy
=
None
)
plotProfile
(
profile
,
f
"
{
outputPath
}
/profile.png
"
)
if
__name__
==
'
__main__
'
:
drawProfile
([
measure
for
_
,
measure
in
fromTSV
(
argv
[
1
]).
iterrows
()],
argv
[
2
])
#plotProfile(histData, argv[2])
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