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

fixes #24

parent ce46f805
No related branches found
No related tags found
No related merge requests found
Pipeline #102072 passed
...@@ -23,6 +23,7 @@ using HDF5 ...@@ -23,6 +23,7 @@ using HDF5
using Dates using Dates
using Statistics using Statistics
using Memoization using Memoization
using OrderedCollections
export write_larva_dataset_hdf5, first_stimulus, labelcounts export write_larva_dataset_hdf5, first_stimulus, labelcounts
...@@ -591,6 +592,9 @@ function write_larva_dataset_hdf5(output_dir::String, ...@@ -591,6 +592,9 @@ function write_larva_dataset_hdf5(output_dir::String,
isnothing(sample_size) || @error "Argument sample_size not supported for the specified balancing strategy" isnothing(sample_size) || @error "Argument sample_size not supported for the specified balancing strategy"
sample_sizes, total_sample_size = thresholdedcounts(counts) sample_sizes, total_sample_size = thresholdedcounts(counts)
end end
# ensure label order is preserved
sample_sizes = OrderedDict((label => sample_sizes[label]) for label in labels if label in keys(sample_sizes))
#
@info "Sample sizes (observed, selected):" [Symbol(label) => (get(counts, label, 0), get(sample_sizes, label, 0)) for label in labels]... @info "Sample sizes (observed, selected):" [Symbol(label) => (get(counts, label, 0), get(sample_sizes, label, 0)) for label in labels]...
date = Dates.format(Dates.now(), "yyyy_mm_dd") date = Dates.format(Dates.now(), "yyyy_mm_dd")
output_file = joinpath(output_dir, "larva_dataset_$(date)_$(window_length)_$(window_length)_$(total_sample_size).hdf5") output_file = joinpath(output_dir, "larva_dataset_$(date)_$(window_length)_$(window_length)_$(total_sample_size).hdf5")
......
...@@ -37,6 +37,10 @@ class LarvaDataset: ...@@ -37,6 +37,10 @@ class LarvaDataset:
return self._full_set return self._full_set
""" """
*list* of *bytes*: Set of distinct labels. *list* of *bytes*: Set of distinct labels.
If the hdf5 file does not feature a top-level `labels` element that lists
the labels, the fallback labels and their order are:
RUN, BEND, STOP, HUNCH, BACK, ROLL.
""" """
@property @property
def labels(self): def labels(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment