1+ import logging
12from typing import Any , Dict , List , Optional , Tuple , Union
23
34import numpy as np
@@ -330,7 +331,9 @@ def find_ridge_points(
330331 )[:2 ]
331332 else :
332333 # Univariate case
333- amplitude , inst_frequency = calculate_univariate_inst_moments (wavelet_transform , axis = - 1 )[:2 ]
334+ amplitude , inst_frequency = calculate_univariate_inst_moments (
335+ wavelet_transform , axis = - 1
336+ )[:2 ]
334337
335338 # Determine ridge quantity based on ridge type
336339 if ridge_type .lower ().startswith ("amp" ):
@@ -496,7 +499,7 @@ def ridge_shift_interpolation(
496499 """
497500 # Skip if no ridge points
498501 if not np .any (ridge_points ):
499- print ("No ridge points found, returning empty result." )
502+ logging . info ("No ridge points found, returning empty result." )
500503
501504 return [np .array ([], dtype = y_array .dtype ) for y_array in y_arrays ]
502505
@@ -1030,7 +1033,6 @@ def calculate_ridge_lengths(
10301033
10311034 # Process each ridge to calculate its length
10321035 for ridge_id in range (1 , num_ridges + 1 ):
1033-
10341036 if ridge_id not in ridge_data :
10351037 ridge_lengths .append (0.0 )
10361038 continue
@@ -1051,7 +1053,7 @@ def calculate_ridge_lengths(
10511053 )
10521054 ridge_lengths .append (ridge_length )
10531055 except Exception as e :
1054- print (f"Error calculating length for ridge { ridge_id } : { e } " )
1056+ logging . error (f"Error calculating length for ridge { ridge_id } : { e } " )
10551057 ridge_lengths .append (0.0 )
10561058
10571059 return ridge_lengths
@@ -1102,11 +1104,13 @@ def ridge_analysis(
11021104 """
11031105
11041106 # Find ridge points in wavelet transform
1105- ridge_points , ridge_quantity , processed_transform , inst_frequency = find_ridge_points (
1106- wavelet_transform = wavelet ,
1107- scale_frequencies = freqs ,
1108- amplitude_threshold = amplitude_threshold ,
1109- ridge_type = ridge_type ,
1107+ ridge_points , ridge_quantity , processed_transform , inst_frequency = (
1108+ find_ridge_points (
1109+ wavelet_transform = wavelet ,
1110+ scale_frequencies = freqs ,
1111+ amplitude_threshold = amplitude_threshold ,
1112+ ridge_type = ridge_type ,
1113+ )
11101114 )
11111115
11121116 # Create frequency meshgrid for ridge point shifting
0 commit comments