From 8436ac29262cf26befb31b041b73b1e95d4e028d Mon Sep 17 00:00:00 2001 From: Romain Bazile Date: Tue, 8 Jun 2021 16:16:18 +0200 Subject: [PATCH] segmenter: fix ecotaxa export again (cherry picked from commit 253408b5a8156171f5853ed1420f63ebcac0dc7b) --- scripts/planktoscope/segmenter/__init__.py | 5 +++-- scripts/planktoscope/segmenter/ecotaxa.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/planktoscope/segmenter/__init__.py b/scripts/planktoscope/segmenter/__init__.py index d22b343..21474e3 100644 --- a/scripts/planktoscope/segmenter/__init__.py +++ b/scripts/planktoscope/segmenter/__init__.py @@ -601,7 +601,8 @@ class SegmenterProcess(multiprocessing.Process): # Publish the object_id to via MQTT to Node-RED self.segmenter_client.client.publish( - "status/segmenter", f'{{"status":"Segmenting image {filename}"}}' + "status/segmenter", + f'{{"status":"Segmenting image {filename}, image {i+1}/{images_count}"}}', ) # we recalculate the flat if the heuristics detected we should @@ -696,7 +697,7 @@ class SegmenterProcess(multiprocessing.Process): self.__working_obj_path, keep_files=True, ): - logger.succes("Ecotaxa archive export completed for this folder") + logger.success("Ecotaxa archive export completed for this folder") else: logger.error("The ecotaxa export could not be completed") else: diff --git a/scripts/planktoscope/segmenter/ecotaxa.py b/scripts/planktoscope/segmenter/ecotaxa.py index a67f4f0..b6f59c7 100644 --- a/scripts/planktoscope/segmenter/ecotaxa.py +++ b/scripts/planktoscope/segmenter/ecotaxa.py @@ -241,13 +241,13 @@ def ecotaxa_export(archive_filepath, metadata, image_base_path, keep_files=False # add the tsv to the archive archive.writestr( - "export_ecotaxa.tsv", + "ecotaxa_export.tsv", io.BytesIO( tsv_content.to_csv(sep="\t", encoding="utf-8", index=False).encode() ).read(), ) if keep_files: - tsv_file = os.path.join(image_base_path, "export_ecotaxa.tsv") + tsv_file = os.path.join(image_base_path, "ecotaxa_export.tsv") tsv_content.to_csv( path_or_buf=tsv_file, sep="\t", encoding="utf-8", index=False )