1
1
import numpy as np
2
2
import pandas as pd
3
3
from statsmodels .stats .weightstats import DescrStatsW
4
-
4
+ import re
5
5
from isicle import io
6
6
from isicle .geometry import Geometry , XYZGeometry
7
7
from isicle .utils import TypedList , safelist , scaling_factors
@@ -431,7 +431,7 @@ def select_scaling_factors(self, index):
431
431
self .scaling_factors .update (tempdict )
432
432
433
433
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
435
435
):
436
436
"""
437
437
Apply quadratic value coefficients in the form of
@@ -442,13 +442,17 @@ def _transform_quadratic(
442
442
quadratic_result = a * value ** 2 + b * value + c
443
443
return constant - coefficient * quadratic_result
444
444
445
- def _transform_slope_intercept (self , value , slope = float , intercept = float ):
445
+ def _transform_slope_intercept (self , value , slope : float , intercept : float ):
446
446
if not isinstance (slope , float ):
447
- slope = float (slope )
447
+ try :
448
+ slope = float (slope )
449
+ except :
450
+ slope = np .nan
448
451
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
452
456
return (intercept - value ) / (- slope )
453
457
454
458
def apply_scaling_factors (self ):
0 commit comments