add protection when applying log to negative elements in arrays
Summary
When applying scaling/shifting to a lognorm
variable, it can occur that the variable becomes negative and then taking the logarithm results in an error.
Steps to reproduce
While the problem does not occur on the training dataset, applying the scale/shift dictionary values (which were derived from the training dataset) to the validation dataset can result in this error (because the scale/shift values are not based on the validation dataset).
Relevant logs and/or screenshots
ValueError: Inf value(s) encountered when applying the scaling/shifting for the tracks! The probablematic variable is ptfrac. Scale value: 1.169292688369751, Shift value: -2.724959135055542
Possible fixes
A protection against these values by setting the variable to a very low value (e.g. 1e-12
).