From 632bc8574ef4049c9b15f65fe80096ec529aee49 Mon Sep 17 00:00:00 2001 From: Steffen Korn <steffen.korn@cern.ch> Date: Tue, 9 May 2023 09:50:58 +0200 Subject: [PATCH] Adding input variable check before scaling --- python/HelperModules/datascaler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/HelperModules/datascaler.py b/python/HelperModules/datascaler.py index 80009b4c..d61c958d 100644 --- a/python/HelperModules/datascaler.py +++ b/python/HelperModules/datascaler.py @@ -4,6 +4,7 @@ import json import numpy as np import pandas as pd +from HelperModules.messagehandler import ErrorMessage def getminmax(xin, xin_min, xin_max, maximum=1, minimum=0): @@ -89,6 +90,8 @@ class scaler(): """ for variable in self.m_cfgset.get("VARIABLE"): + if max(xin[variable.get("Name")]) == min(xin[variable.get("Name")]): + ErrorMessage(f"Input variable '{variable.get('Name')}' only contains {min(xin[variable.get('Name')])}. You need to check this!") scaleoption = variable.get("Scaling") if not variable.get("Scaling") is None else self.m_cfgset.get("GENERAL").get("InputScaling") if scaleoption is None: scale = 1 -- GitLab