Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IPI_annot
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
Maxence Ferrari
IPI_annot
Commits
b66c0d27
Commit
b66c0d27
authored
4 years ago
by
ferrari
Browse files
Options
Downloads
Patches
Plain Diff
Add a resume option
parent
fdf067b6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ipi_extract.py
+22
-3
22 additions, 3 deletions
ipi_extract.py
with
22 additions
and
3 deletions
ipi_extract.py
+
22
−
3
View file @
b66c0d27
...
@@ -707,10 +707,22 @@ def main(args):
...
@@ -707,10 +707,22 @@ def main(args):
outpath
=
args
.
input
.
rsplit
(
'
.
'
,
1
)[
0
]
+
'
.pred.h5
'
outpath
=
args
.
input
.
rsplit
(
'
.
'
,
1
)[
0
]
+
'
.pred.h5
'
else
:
else
:
outpath
=
args
.
out
outpath
=
args
.
out
if
os
.
path
.
isfile
(
outpath
)
and
not
args
.
erase
:
if
os
.
path
.
isfile
(
outpath
):
if
not
(
args
.
erase
or
args
.
resume
):
print
(
f
'
Out file
{
outpath
}
already exist and erase option isn
\'
t set.
'
)
print
(
f
'
Out file
{
outpath
}
already exist and erase option isn
\'
t set.
'
)
return
1
return
1
elif
args
.
resume
:
print
(
f
'
Out file
{
outpath
}
does not already exist and resume option is set.
'
)
return
1
ref_dict
=
init
(
args
.
input
,
args
.
channel
)
ref_dict
=
init
(
args
.
input
,
args
.
channel
)
if
args
.
resume
:
df
=
pd
.
read_hdf
(
outpath
)
ref_dict
[
'
callback
'
].
df
=
df
.
to_dict
(
orient
=
'
index
'
)
ref_dict
[
'
callback
'
].
offset
=
np
.
tile
(
np
.
array
(
list
(
ref_dict
[
'
callback
'
].
df
.
keys
()))[:,
np
.
newaxis
],
(
1
,
2
))
ref_dict
[
'
callback
'
].
offset
[:,
1
]
=
ref_dict
[
'
callback
'
].
song_resample
[(
ref_dict
[
'
callback
'
].
offset
[:,
1
]
*
FSSR
).
astype
(
int
)]
ref_dict
[
'
callback
'
].
scat
.
set_offsets
(
ref_dict
[
'
callback
'
].
offset
)
ref_dict
[
'
callback
'
].
scat
.
set_color
(
np
.
array
(
len
(
ref_dict
[
'
callback
'
].
offset
)
*
[[
0.7
,
0.2
,
0.5
,
1
]]))
plt
.
draw
()
plt
.
draw
()
plt
.
pause
(
0.2
)
plt
.
pause
(
0.2
)
ref_dict
[
'
fig
'
].
set_constrained_layout
(
False
)
ref_dict
[
'
fig
'
].
set_constrained_layout
(
False
)
...
@@ -732,8 +744,11 @@ if __name__ == '__main__':
...
@@ -732,8 +744,11 @@ if __name__ == '__main__':
parser
.
add_argument
(
"
input
"
,
type
=
str
,
help
=
"
Input file
"
)
parser
.
add_argument
(
"
input
"
,
type
=
str
,
help
=
"
Input file
"
)
parser
.
add_argument
(
"
--out
"
,
type
=
str
,
default
=
''
,
help
=
"
Output file. Default to the input_path
'
.pred.h5
'"
)
parser
.
add_argument
(
"
--out
"
,
type
=
str
,
default
=
''
,
help
=
"
Output file. Default to the input_path
'
.pred.h5
'"
)
parser
.
add_argument
(
"
--channel
"
,
type
=
int
,
default
=
0
,
help
=
"
Sound channel to be analysed. Indices start from 0.
"
)
parser
.
add_argument
(
"
--channel
"
,
type
=
int
,
default
=
0
,
help
=
"
Sound channel to be analysed. Indices start from 0.
"
)
parser
.
add_argument
(
"
--erase
"
,
action
=
'
store_true
'
,
help
=
"
If out file exist and this option is not given,
"
group
=
parser
.
add_mutually_exclusive_group
()
group
.
add_argument
(
"
--erase
"
,
action
=
'
store_true
'
,
help
=
"
If out file exist and this option is not given,
"
"
the computation will be halted
"
)
"
the computation will be halted
"
)
group
.
add_argument
(
"
--resume
"
,
action
=
'
store_true
'
,
help
=
"
If out file exist and this option is given,
"
"
the previous annotation file will be loaded
"
)
try
:
try
:
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
except
ValueError
as
e
:
except
ValueError
as
e
:
...
@@ -756,6 +771,10 @@ if __name__ == '__main__':
...
@@ -756,6 +771,10 @@ if __name__ == '__main__':
self
.
out
=
input
(
"
What is the out file path? (Leave empty for default)
"
)
self
.
out
=
input
(
"
What is the out file path? (Leave empty for default)
"
)
self
.
channel
=
int
(
input
(
"
Which channel do you want to use starting from 0?
"
))
self
.
channel
=
int
(
input
(
"
Which channel do you want to use starting from 0?
"
))
self
.
erase
=
ask
(
"
Do you want to erase the out file if it already exist?
"
)
self
.
erase
=
ask
(
"
Do you want to erase the out file if it already exist?
"
)
if
not
self
.
erase
:
self
.
resume
=
ask
(
"
Do you want to resume the out file if it already exist?
"
)
else
:
self
.
resume
=
False
args
=
VirtualArgParse
()
args
=
VirtualArgParse
()
...
...
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