Skip to content
Snippets Groups Projects
Commit 07b69622 authored by François  LAURENT's avatar François LAURENT
Browse files

revert locking

parent 3228ce82
Branches
Tags
No related merge requests found
Pipeline #104139 passed
......@@ -312,7 +312,7 @@ version = "1.9.0"
[[deps.PlanarLarvae]]
deps = ["DelimitedFiles", "HDF5", "JSON3", "LinearAlgebra", "MAT", "Meshes", "OrderedCollections", "Random", "SHA", "StaticArrays", "Statistics", "StatsBase", "StructTypes"]
git-tree-sha1 = "bff9bdff96050dffcb681e950ac2547e33c53417"
git-tree-sha1 = "fe89d5f592c8ba763a13330cde6696f721f828c7"
repo-rev = "dev"
repo-url = "https://gitlab.pasteur.fr/nyx/planarlarvae.jl"
uuid = "c2615984-ef14-4d40-b148-916c85b43307"
......
......@@ -628,12 +628,7 @@ function new_write_larva_dataset_hdf5(output_dir, input_data;
output_file = joinpath(output_dir, output_file)
c = Threads.Condition()
h5open(output_file, "w") do h5
lock(c)
g = try
create_group(h5, "samples")
finally
unlock(c)
end
sample(loader, :spine) do _, file, counts, segments
sampleid, nsegments = counts
@assert length(segments) == nsegments
......@@ -662,26 +657,18 @@ function new_write_larva_dataset_hdf5(output_dir, input_data;
name = "sample_$sampleid"
# transpose for compatibility with h5py
# see issue https://github.com/JuliaIO/HDF5.jl/issues/785
lock(c)
try
g[name] = permutedims(sample, reverse(1:ndims(sample)))
sampleid += 1
#
d = g[name]
attributes(d)["larva_number"] = convert(Int, trackid)
# we should set `start_point` instead of `reference_time`, to comply with
# the original format, but this would not make sense here due to
# interpolation:
# we should set `start_point` instead of `reference_time`, to comply with the
# original format, but this would not make sense here due to interpolation:
attributes(d)["reference_time"] = anchortime
attributes(d)["behavior"] = string(label)
attributes(d)["path"] = file.source
finally
unlock(c)
end
end
end
lock(c)
try
attributes(g)["len_traj"] = window_length
attributes(g)["len_pred"] = window_length
attributes(g)["n_samples"] = total_sample_size
......@@ -699,9 +686,6 @@ function new_write_larva_dataset_hdf5(output_dir, input_data;
if !isnothing(frameinterval)
attributes(g)["frame_interval"] = frameinterval
end
finally
unlock(c)
end
end
return output_file
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment