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

python version numbers all frozen + test testPredictWithConflictingInput

parent 349d0e3c
No related branches found
No related tags found
1 merge request!17Set of commits to be tagged v0.18
......@@ -1037,11 +1037,11 @@ version = "0.3.3"
[[deps.PlanarLarvae]]
deps = ["DelimitedFiles", "HDF5", "JSON3", "LinearAlgebra", "MAT", "Meshes", "OrderedCollections", "Random", "SHA", "StaticArrays", "Statistics", "StatsBase", "StructTypes"]
git-tree-sha1 = "6b2dc28d56bcef101672cbf2bb784bbd5d88d579"
git-tree-sha1 = "d964d040e319fe3bd9140e5bf91d648de6acc96f"
repo-rev = "main"
repo-url = "https://gitlab.pasteur.fr/nyx/PlanarLarvae.jl"
uuid = "c2615984-ef14-4d40-b148-916c85b43307"
version = "0.15.0"
version = "0.16.0"
[[deps.PlotUtils]]
deps = ["ColorSchemes", "Colors", "Dates", "PrecompileTools", "Printf", "Random", "Reexport", "Statistics"]
......
......@@ -77,6 +77,7 @@ RUN if [ -z $TAGGINGBACKENDS_BRANCH ]; then \
&& git clone --depth 1 --no-tags --single-branch -b $(echo $BACKEND | cut -d/ -f2) https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter MaggotUBA \
&& cd MaggotUBA \
&& rm -rf .git \
&& (cat requirements.txt | xargs -I % sh -c 'poetry add "%"') \
&& poetry install --only main \
&& poetry add "pynvml==11.4.1" \
&& if [ "$(echo $BACKEND | cut -d/ -f2)" = "main" ] || [ "$(echo $BACKEND | cut -d/ -f2)" = "dev" ]; then \
......
......@@ -97,7 +97,7 @@ if [ -f ../../LarvaTagger_test_data.tgz ]; then
# KEEP_MODEL_FILES=1 ./deploy_and_test.sh
# cd LarvaTagger/LarvaTagger.jl
# rm -rf test/data/test_train_*
# cp -ra ../MaggotUBA/models/test_train_* test/data/
# cp -Rp ../MaggotUBA/models/test_train_* test/data/
# tar zcvf LarvaTagger_test_data.tgz test/data/*
# mv LarvaTagger_test_data.tgz ../../
tar zxvf ../../LarvaTagger_test_data.tgz
......
......@@ -50,9 +50,10 @@ endTest() {
prepareTestData() {
tmpdir="$SHUNIT_TMPDIR/$1"
shift
rm -rf "$tmpdir"
mkdir -p "$tmpdir"
for file in sample.spine sample.outline; do
for file in sample.spine sample.outline $@; do
cp "$datapath/$file" "$tmpdir/" || exit 1
done
echo $tmpdir
......@@ -123,6 +124,33 @@ testPredictDefault() {
endTest
}
# requires: sample.spine sample.outline trx.mat original_predictions.label test_train_default/predicted.label
testPredictWithConflictingInput() {
tagger="test_train_default$tagger_suffix"
# make test data
touch "$datapath/spurious.txt"
tmpdir=$(prepareTestData $tagger trx.mat original_predictions.label spurious.txt)
# restore the model
mkdir -p "$maggotuba/models"
rm -rf "$maggotuba/models/$tagger"
echo "cp -Rp \"$datapath/$tagger\" \"$maggotuba/models/\""
cp -Rp "$datapath/$tagger" "$maggotuba/models/"
[ -f "$maggotuba/models/$tagger/clf_config.json" ] || exit 1
# run
cd "$project_root"
echo "\"$larvataggerjl\" predict \"$maggotuba\" $tagger \"$tmpdir\" --debug"
"$larvataggerjl" predict "$maggotuba" $tagger "$tmpdir" --debug
# compare
filename=predicted.label
predictions="$tmpdir/$filename"
expected_labels="$datapath/$tagger/$filename"
assertFalse "\`predict\` failed to generate file $filename" '[ -z "$predictions" ]'
assertTrue "\`predict\` failed to reproduce file $filename" '$(cmp "$expected_labels" "$predictions")'
# clean up
rm -f "$datapath/spurious.txt"
endTest
}
# requires: sample.spine sample.outline original_predictions.label test_train_default/*
testTrainDefault() {
tagger="test_train_default$tagger_suffix"
......@@ -238,7 +266,7 @@ postTrain() {
assertTrue "\`train\` failed to reproduce file $enc_weights" '$(cmp "$expected_tagger_dir/$enc_weights" "$enc_weights_path")'
assertTrue "\`train\` failed to reproduce file $enc_config" '$(cmp "$expected_tagger_dir/$enc_config" "$enc_config_path")'
assertTrue "\`train\` failed to reproduce file $clf_weights" '$(cmp "$expected_tagger_dir/$clf_weights" "$clf_weights_path")'
assertTrue "\`train\` failed to reproduce file $clf_config" '$(cmp "$expected_tagger_dir/$clf_config" "$clf_config_path")'
assertTrue "\`train\` failed to reproduce file $clf_config" '[ -z "$(diff "$expected_tagger_dir/$clf_config" "$clf_config_path" | grep -E "^[<>] " | grep -vE larva_dataset_.*[.]hdf5)" ]'
# test the predictions
echo "\"$larvataggerjl\" predict \"$maggotuba\" $tagger \"$tmpdir/sample.spine\""
......
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