11import numpy as np
22import pandas as pd
33from statsmodels .stats .weightstats import DescrStatsW
4-
4+ import re
55from isicle import io
66from isicle .geometry import Geometry , XYZGeometry
77from isicle .utils import TypedList , safelist , scaling_factors
@@ -431,7 +431,7 @@ def select_scaling_factors(self, index):
431431 self .scaling_factors .update (tempdict )
432432
433433 def _transform_quadratic (
434- self , value , a = float , b = float , c = float , constant = float , coefficient = float
434+ self , value , a : float , b : float , c : float , constant : float , coefficient : float
435435 ):
436436 """
437437 Apply quadratic value coefficients in the form of
@@ -442,13 +442,17 @@ def _transform_quadratic(
442442 quadratic_result = a * value ** 2 + b * value + c
443443 return constant - coefficient * quadratic_result
444444
445- def _transform_slope_intercept (self , value , slope = float , intercept = float ):
445+ def _transform_slope_intercept (self , value , slope : float , intercept : float ):
446446 if not isinstance (slope , float ):
447- slope = float (slope )
447+ try :
448+ slope = float (slope )
449+ except :
450+ slope = np .nan
448451 if not isinstance (intercept , float ):
449- intercept = float (intercept )
450- if np .isnan (slope ) or np .isnan (intercept ):
451- return np .nan
452+ try :
453+ intercept = float (intercept )
454+ except :
455+ intercept = np .nan
452456 return (intercept - value ) / (- slope )
453457
454458 def apply_scaling_factors (self ):
0 commit comments