Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TaggingBackends
Manage
Activity
Members
Labels
Plan
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
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
Nyx
TaggingBackends
Commits
07b69622
Commit
07b69622
authored
2 years ago
by
François LAURENT
Browse files
Options
Downloads
Patches
Plain Diff
revert locking
parent
3228ce82
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#104139
passed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Manifest.toml
+1
-1
1 addition, 1 deletion
Manifest.toml
src/LarvaDatasets.jl
+27
-43
27 additions, 43 deletions
src/LarvaDatasets.jl
with
28 additions
and
44 deletions
Manifest.toml
+
1
−
1
View file @
07b69622
...
@@ -312,7 +312,7 @@ version = "1.9.0"
...
@@ -312,7 +312,7 @@ version = "1.9.0"
[[deps.PlanarLarvae]]
[[deps.PlanarLarvae]]
deps
=
[
"DelimitedFiles"
,
"HDF5"
,
"JSON3"
,
"LinearAlgebra"
,
"MAT"
,
"Meshes"
,
"OrderedCollections"
,
"Random"
,
"SHA"
,
"StaticArrays"
,
"Statistics"
,
"StatsBase"
,
"StructTypes"
]
deps
=
[
"DelimitedFiles"
,
"HDF5"
,
"JSON3"
,
"LinearAlgebra"
,
"MAT"
,
"Meshes"
,
"OrderedCollections"
,
"Random"
,
"SHA"
,
"StaticArrays"
,
"Statistics"
,
"StatsBase"
,
"StructTypes"
]
git-tree-sha1
=
"
bff9bdff96050dffcb681e950ac2547e33c5341
7"
git-tree-sha1
=
"
fe89d5f592c8ba763a13330cde6696f721f828c
7"
repo-rev
=
"dev"
repo-rev
=
"dev"
repo-url
=
"https://gitlab.pasteur.fr/nyx/planarlarvae.jl"
repo-url
=
"https://gitlab.pasteur.fr/nyx/planarlarvae.jl"
uuid
=
"c2615984-ef14-4d40-b148-916c85b43307"
uuid
=
"c2615984-ef14-4d40-b148-916c85b43307"
...
...
This diff is collapsed.
Click to expand it.
src/LarvaDatasets.jl
+
27
−
43
View file @
07b69622
...
@@ -628,12 +628,7 @@ function new_write_larva_dataset_hdf5(output_dir, input_data;
...
@@ -628,12 +628,7 @@ function new_write_larva_dataset_hdf5(output_dir, input_data;
output_file
=
joinpath
(
output_dir
,
output_file
)
output_file
=
joinpath
(
output_dir
,
output_file
)
c
=
Threads
.
Condition
()
c
=
Threads
.
Condition
()
h5open
(
output_file
,
"w"
)
do
h5
h5open
(
output_file
,
"w"
)
do
h5
lock
(
c
)
create_group
(
h5
,
"samples"
)
g
=
try
create_group
(
h5
,
"samples"
)
finally
unlock
(
c
)
end
sample
(
loader
,
:
spine
)
do
_
,
file
,
counts
,
segments
sample
(
loader
,
:
spine
)
do
_
,
file
,
counts
,
segments
sampleid
,
nsegments
=
counts
sampleid
,
nsegments
=
counts
@assert
length
(
segments
)
==
nsegments
@assert
length
(
segments
)
==
nsegments
...
@@ -662,45 +657,34 @@ function new_write_larva_dataset_hdf5(output_dir, input_data;
...
@@ -662,45 +657,34 @@ function new_write_larva_dataset_hdf5(output_dir, input_data;
name
=
"sample_
$
sampleid"
name
=
"sample_
$
sampleid"
# transpose for compatibility with h5py
# transpose for compatibility with h5py
# see issue https://github.com/JuliaIO/HDF5.jl/issues/785
# see issue https://github.com/JuliaIO/HDF5.jl/issues/785
lock
(
c
)
g
[
name
]
=
permutedims
(
sample
,
reverse
(
1
:
ndims
(
sample
)))
try
sampleid
+=
1
g
[
name
]
=
permutedims
(
sample
,
reverse
(
1
:
ndims
(
sample
)))
#
sampleid
+=
1
d
=
g
[
name
]
#
attributes
(
d
)[
"larva_number"
]
=
convert
(
Int
,
trackid
)
d
=
g
[
name
]
# we should set `start_point` instead of `reference_time`, to comply with the
attributes
(
d
)[
"larva_number"
]
=
convert
(
Int
,
trackid
)
# original format, but this would not make sense here due to interpolation:
# we should set `start_point` instead of `reference_time`, to comply with
attributes
(
d
)[
"reference_time"
]
=
anchortime
# the original format, but this would not make sense here due to
attributes
(
d
)[
"behavior"
]
=
string
(
label
)
# interpolation:
attributes
(
d
)[
"path"
]
=
file
.
source
attributes
(
d
)[
"reference_time"
]
=
anchortime
attributes
(
d
)[
"behavior"
]
=
string
(
label
)
attributes
(
d
)[
"path"
]
=
file
.
source
finally
unlock
(
c
)
end
end
end
end
end
lock
(
c
)
attributes
(
g
)[
"len_traj"
]
=
window_length
try
attributes
(
g
)[
"len_pred"
]
=
window_length
attributes
(
g
)[
"len_traj"
]
=
window_length
attributes
(
g
)[
"n_samples"
]
=
total_sample_size
attributes
(
g
)[
"len_pred"
]
=
window_length
# extensions
attributes
(
g
)[
"n_samples"
]
=
total_sample_size
counts
=
Dataloaders
.
total
(
index
.
targetcounts
)
# extensions
if
isnothing
(
labels
)
counts
=
Dataloaders
.
total
(
index
.
targetcounts
)
h5
[
"labels"
]
=
string
.
(
keys
(
classcounts
))
if
isnothing
(
labels
)
h5
[
"label_counts"
]
=
collect
(
values
(
classcounts
))
h5
[
"labels"
]
=
string
.
(
keys
(
classcounts
))
else
h5
[
"label_counts"
]
=
collect
(
values
(
classcounts
))
# ensure labels are ordered as provided in input;
else
# see https://gitlab.pasteur.fr/nyx/TaggingBackends/-/issues/24
# ensure labels are ordered as provided in input;
h5
[
"labels"
]
=
labels
# see https://gitlab.pasteur.fr/nyx/TaggingBackends/-/issues/24
h5
[
"label_counts"
]
=
[
classcounts
[
Symbol
(
label
)]
for
label
in
labels
]
h5
[
"labels"
]
=
labels
end
h5
[
"label_counts"
]
=
[
classcounts
[
Symbol
(
label
)]
for
label
in
labels
]
if
!
isnothing
(
frameinterval
)
end
attributes
(
g
)[
"frame_interval"
]
=
frameinterval
if
!
isnothing
(
frameinterval
)
attributes
(
g
)[
"frame_interval"
]
=
frameinterval
end
finally
unlock
(
c
)
end
end
end
end
return
output_file
return
output_file
...
...
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