From e6c88137bc32617099f05badeb3748516caa0c30 Mon Sep 17 00:00:00 2001 From: Ida Lindegaard <82438141+idalindegaard@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:20:58 +0100 Subject: [PATCH] Volume as process udf to calculate amount (#577) ### Added - The option to calculate the amount with the volume as a process udf in the step --- cg_lims/EPPs/udf/calculate/calculate_amount_ng.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cg_lims/EPPs/udf/calculate/calculate_amount_ng.py b/cg_lims/EPPs/udf/calculate/calculate_amount_ng.py index 3b50513e..5e814f99 100644 --- a/cg_lims/EPPs/udf/calculate/calculate_amount_ng.py +++ b/cg_lims/EPPs/udf/calculate/calculate_amount_ng.py @@ -15,6 +15,7 @@ @options.concentration_udf() @options.amount_udf_option() @options.volume_udf() +@options.total_volume_process_udf() @options.subtract_volume() @options.preset_volume() @options.measurement() @@ -24,6 +25,7 @@ def calculate_amount_ng( ctx: click.Context, amount_udf: str, volume_udf: str, + total_volume_pudf: str, concentration_udf: str, subtract_volume: str, preset_volume: float, @@ -47,9 +49,11 @@ def calculate_amount_ng( artifacts_with_missing_udf: List = [] for artifact in artifacts: if preset_volume: - vol = float(preset_volume) + vol: float = float(preset_volume) + elif total_volume_pudf: + vol: float = process.udf.get(total_volume_pudf) elif volume_udf: - vol = artifact.udf.get(volume_udf) + vol: float = artifact.udf.get(volume_udf) conc: float = artifact.udf.get(concentration_udf) if None in [conc, vol]: missing_udfs_count += 1