Skip to content
Snippets Groups Projects
Commit 5e4ef27b authored by Nico Vermaas's avatar Nico Vermaas
Browse files

ongoing

parent b7baf3a1
No related branches found
No related tags found
2 merge requests!367update unit-tests branch with latest from master,!366add unittests
Pipeline #91550 passed
...@@ -27,7 +27,41 @@ def calculate_qualities(task, tasks_for_this_sasid, quality_thresholds): ...@@ -27,7 +27,41 @@ def calculate_qualities(task, tasks_for_this_sasid, quality_thresholds):
def calculate_quality_task(task): def calculate_quality_task(task):
""" """
calculate the quality of this task based on rfi_percent values calculate the quality of this task based on rfi_percent values
The threshold values are written from a configuration json blob The threshold values are read from a configuration json blob
Using this algorithm from SDCO:
rfi_i <= 20 % is good
20% <= rfi_i <= 50 is moderate
rfi_i > 50 is poor.
except when rfi_percent = 0
"""
try:
summary = task.quality_json["summary"]
summary_flavour = get_summary_flavour(task)
if summary_flavour == SummaryFlavour.IMAGING_COMPRESSION.value:
rfi_percent = float(summary['details']['rfi_percent'])
if summary_flavour == SummaryFlavour.DEFAULT.value:
# summary is a dict, with (unknown) filenames as a key, look for 'rfi_percent' in them
for key in summary:
record = summary[key]
rfi_percent = float(record['rfi_percent'])
return rfi_percentage_to_quality(rfi_percent, quality_thresholds['moderate'], quality_thresholds['poor'])
except Exception as error:
# when rfi_percentage is missing, then the quality cannot be calculated.
# Just continue without it
pass
def calculate_quality_task_per_file(task):
"""
calculate the quality of this task based on rfi_percent values per summary file
The threshold values are read from a configuration json blob
Using this algorithm from SDCO: Using this algorithm from SDCO:
rfi_i <= 20 % is good rfi_i <= 20 % is good
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment