From 46eadd16fdbf4904ae20240e4b497e0e66e34f40 Mon Sep 17 00:00:00 2001 From: Bruno Stuyts Date: Sat, 14 Sep 2024 17:52:06 +0200 Subject: [PATCH] Update to Numpy >= 2.1 --- CHANGES.txt | 1 + .../axialcapacity/endbearing.py | 12 +++--- .../deepfoundations/axialcapacity/koppejan.py | 2 +- .../axialcapacity/skinfriction.py | 24 +++++------ .../boreholestability/cavityexpansion.py | 2 +- groundhog/general/validation.py | 4 +- groundhog/shallowfoundations/capacity.py | 40 +++++++++--------- groundhog/shallowfoundations/settlement.py | 2 +- .../siteinvestigation/correlations/general.py | 4 +- .../insitutests/pcpt_correlations.py | 24 +++++------ .../insitutests/pcpt_processing.py | 4 +- .../insitutests/spt_correlations.py | 16 +++---- .../labtesting/compressibility.py | 4 +- groundhog/soildynamics/liquefaction.py | 8 ++-- .../eurocode7/parameter_selection.py | 4 +- requirements.txt | 3 +- tests/deepfoundations/test_cavityexpansion.py | 2 +- tests/general/test_parameter_mapping.py | 4 +- tests/general/test_validation.py | 16 +++---- .../insitutests/data/output_pcpt.xlsx | Bin 79120 -> 79139 bytes .../insitutests/test_pcpt_correlations.py | 2 +- .../insitutests/test_pcpt_processing.py | 4 +- .../insitutests/test_spt_processing.py | 2 +- 23 files changed, 93 insertions(+), 91 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 16429d2..ca76eb9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ v0.13.0, TBD + - Update of requirements to Numpy >= 2.1 - Ensured the cv arrays in consolidation calcs are treated as Numpy arrays - Increased the timeout for interactive parameter selection to two minutes - Added formula for calculation of void ratio from dry density diff --git a/groundhog/deepfoundations/axialcapacity/endbearing.py b/groundhog/deepfoundations/axialcapacity/endbearing.py index 3127760..315f650 100644 --- a/groundhog/deepfoundations/axialcapacity/endbearing.py +++ b/groundhog/deepfoundations/axialcapacity/endbearing.py @@ -19,8 +19,8 @@ } API_UNIT_END_BEARING_CLAY_ERRORRETURN = { - 'q_b_coring [kPa]': np.NaN, - 'q_b_plugged [kPa]': np.NaN, + 'q_b_coring [kPa]': np.nan, + 'q_b_plugged [kPa]': np.nan, 'plugged': None, 'internal_friction': False } @@ -63,12 +63,12 @@ def API_unit_end_bearing_clay(undrained_shear_strength,N_c=9.0,**kwargs): } API_UNIT_END_BEARING_SAND_RP2GEO_ERRORRETURN = { - 'q_b_coring [kPa]': np.NaN, - 'q_b_plugged [kPa]': np.NaN, + 'q_b_coring [kPa]': np.nan, + 'q_b_plugged [kPa]': np.nan, 'plugged': None, 'internal_friction': False, - 'q_b_lim [kPa]': np.NaN, - 'Nq [-]': np.NaN + 'q_b_lim [kPa]': np.nan, + 'Nq [-]': np.nan } @Validator(API_UNIT_END_BEARING_SAND_RP2GEO, API_UNIT_END_BEARING_SAND_RP2GEO_ERRORRETURN) diff --git a/groundhog/deepfoundations/axialcapacity/koppejan.py b/groundhog/deepfoundations/axialcapacity/koppejan.py index a252a22..3069231 100644 --- a/groundhog/deepfoundations/axialcapacity/koppejan.py +++ b/groundhog/deepfoundations/axialcapacity/koppejan.py @@ -263,7 +263,7 @@ def calculate_base_resistance(self, alpha_p, base_coefficient=1, crosssection_co self.qcavg = 0.5 * (0.5 * (self.qcI + self.qcII) + self.qcIII) self.qbmax = min(15.0, alpha_p * base_coefficient * crosssection_coefficient * self.qcavg) - if coring and np.math.isnan(wall_thickness): + if coring and np.isnan(wall_thickness): raise ValueError("For a coring pile, a wall thickness needs to be provided (in mm)") if coring: diff --git a/groundhog/deepfoundations/axialcapacity/skinfriction.py b/groundhog/deepfoundations/axialcapacity/skinfriction.py index 0d60307..281cfc2 100644 --- a/groundhog/deepfoundations/axialcapacity/skinfriction.py +++ b/groundhog/deepfoundations/axialcapacity/skinfriction.py @@ -21,12 +21,12 @@ } API_UNIT_SHAFT_FRICTION_SAND_RP2GEO_ERRORRETURN = { - 'f_s_comp_out [kPa]': np.NaN, - 'f_s_comp_in [kPa]': np.NaN, - 'f_s_tens_out [kPa]': np.NaN, - 'f_s_tens_in [kPa]': np.NaN, - 'f_s_lim [kPa]': np.NaN, - 'beta [-]': np.NaN, + 'f_s_comp_out [kPa]': np.nan, + 'f_s_comp_in [kPa]': np.nan, + 'f_s_tens_out [kPa]': np.nan, + 'f_s_tens_in [kPa]': np.nan, + 'f_s_lim [kPa]': np.nan, + 'beta [-]': np.nan, } @Validator(API_UNIT_SHAFT_FRICTION_SAND_RP2GEO, API_UNIT_SHAFT_FRICTION_SAND_RP2GEO_ERRORRETURN) @@ -104,12 +104,12 @@ def API_unit_shaft_friction_sand_rp2geo(api_relativedensity, api_soildescription } API_UNIT_SHAFT_FRICTION_CLAY_ERRORRETURN = { - 'f_s_comp_out [kPa]': np.NaN, - 'f_s_comp_in [kPa]': np.NaN, - 'f_s_tens_out [kPa]': np.NaN, - 'f_s_tens_in [kPa]': np.NaN, - 'psi [-]': np.NaN, - 'alpha [-]': np.NaN, + 'f_s_comp_out [kPa]': np.nan, + 'f_s_comp_in [kPa]': np.nan, + 'f_s_tens_out [kPa]': np.nan, + 'f_s_tens_in [kPa]': np.nan, + 'psi [-]': np.nan, + 'alpha [-]': np.nan, } @Validator(API_UNIT_SHAFT_FRICTION_CLAY, API_UNIT_SHAFT_FRICTION_CLAY_ERRORRETURN) diff --git a/groundhog/deepfoundations/boreholestability/cavityexpansion.py b/groundhog/deepfoundations/boreholestability/cavityexpansion.py index 626cb58..b3119a6 100644 --- a/groundhog/deepfoundations/boreholestability/cavityexpansion.py +++ b/groundhog/deepfoundations/boreholestability/cavityexpansion.py @@ -77,7 +77,7 @@ def stress_cylinder_elastic_isotropic( borehole_radius / radius) ** 2) _tangential_stress = farfield_pressure - (internal_pressure - farfield_pressure) * (( borehole_radius / radius) ** 2) - if np.math.isnan(shear_modulus): + if np.isnan(shear_modulus): try: _radial_displacement = list(map(lambda _x: np.nan, _radial_stress)) except: diff --git a/groundhog/general/validation.py b/groundhog/general/validation.py index 2ac6b0c..74b86d1 100644 --- a/groundhog/general/validation.py +++ b/groundhog/general/validation.py @@ -121,7 +121,7 @@ def validate_list(var_name,value,elementtype=None,order=None,unique=None,empty_a if order=='ascending': try: - if sorted(value)==value and (np.NaN not in value): + if sorted(value)==value and (np.nan not in value): pass else: raise ValueError("List %s is not ascending" % str(value)) @@ -129,7 +129,7 @@ def validate_list(var_name,value,elementtype=None,order=None,unique=None,empty_a raise ValueError("%s" % str(err)) elif order=='descending': try: - if sorted(value)==list(reversed(value)) and (np.NaN not in value): + if sorted(value)==list(reversed(value)) and (np.nan not in value): pass else: raise ValueError("List %s is not descending" % str(value)) diff --git a/groundhog/shallowfoundations/capacity.py b/groundhog/shallowfoundations/capacity.py index e5a3d91..42e815c 100644 --- a/groundhog/shallowfoundations/capacity.py +++ b/groundhog/shallowfoundations/capacity.py @@ -165,7 +165,7 @@ def verticalcapacity_undrained_api(effective_length, effective_width, su_base, s else: # Correction factors for linearly increasing su dimensionless_increase = su_increase * effective_width / su_base - if not np.math.isnan(factor_f_override): + if not np.isnan(factor_f_override): F_factor = factor_f_override else: if 0.0 <= dimensionless_increase <= 25.0: @@ -190,7 +190,7 @@ def verticalcapacity_undrained_api(effective_length, effective_width, su_base, s i_c = 0.5 - 0.5 * (1.0 - horizontal_load / (su_base * effective_length * effective_width)) ** 0.5 s_c = s_cv * (1.0 - 2.0 * i_c) * (effective_width / effective_length) su2 = F_factor * (bearing_capacity_factor * su_base + 0.25 * su_increase * effective_width) / bearing_capacity_factor - if np.math.isnan(su_above_base): + if np.isnan(su_above_base): raise ValueError("Undrained shear strength above base (su_above_base) must be specified for linearly increasing undrained shear strength cases") d_c = 0.3 * (su_above_base / su2) * np.arctan(base_depth / effective_width) b_c = 2.0 * np.radians(foundation_inclination) / (np.pi + 2.0) @@ -484,7 +484,7 @@ def slidingcapacity_drained_api(vertical_load, effective_friction_angle, effecti """ base_capacity = vertical_load * np.tan(np.radians(effective_friction_angle)) K_p = (np.tan(np.radians(45.0 + 0.5 * effective_friction_angle))) ** 2.0 - if np.math.isnan(reaction_factor_override): + if np.isnan(reaction_factor_override): K_rd = K_p - (1.0 / K_p) else: K_rd = reaction_factor_override @@ -559,14 +559,14 @@ def effectivearea_rectangle_api(length, width, vertical_load=np.nan, moment_leng Reference - API RP 2GEO, 2011. API RP 2GEO Geotechnical and Foundation Design Considerations """ - if (not np.math.isnan(vertical_load)) and (not np.math.isnan(moment_length)) and \ - (not np.math.isnan(moment_width)) and np.math.isnan(eccentricity_length) and \ - np.math.isnan(eccentricity_width): + if (not np.isnan(vertical_load)) and (not np.isnan(moment_length)) and \ + (not np.isnan(moment_width)) and np.isnan(eccentricity_length) and \ + np.isnan(eccentricity_width): e1 = moment_length / vertical_load e2 = moment_width / vertical_load - elif (not np.math.isnan(eccentricity_length)) and (not np.math.isnan(eccentricity_width)) and \ - np.math.isnan(moment_length) and np.math.isnan(moment_width) and \ - np.math.isnan(vertical_load): + elif (not np.isnan(eccentricity_length)) and (not np.isnan(eccentricity_width)) and \ + np.isnan(moment_length) and np.isnan(moment_width) and \ + np.isnan(vertical_load): e1 = eccentricity_length e2 = eccentricity_width else: @@ -634,11 +634,11 @@ def effectivearea_circle_api(foundation_radius, vertical_load=np.nan, overturnin Reference - API RP 2GEO, 2011. API RP 2GEO Geotechnical and Foundation Design Considerations """ - if not np.math.isnan(overturning_moment) and (not np.math.isnan(vertical_load)) and \ - np.math.isnan(eccentricity): + if not np.isnan(overturning_moment) and (not np.isnan(vertical_load)) and \ + np.isnan(eccentricity): e2 = overturning_moment / vertical_load - elif np.math.isnan(overturning_moment) and np.math.isnan(vertical_load) and \ - not np.math.isnan(eccentricity): + elif np.isnan(overturning_moment) and np.isnan(vertical_load) and \ + not np.isnan(eccentricity): e2 = eccentricity else: raise ValueError("Eccentricity needs to be specified either through moment or direct specification") @@ -731,7 +731,7 @@ def envelope_drained_api(vertical_effective_stress, """ - if np.math.isnan(effective_friction_angle_sliding): + if np.isnan(effective_friction_angle_sliding): effective_friction_angle_sliding = effective_friction_angle - 5 _inclinations = np.linspace(0.0, 90.0, 100) @@ -1223,14 +1223,14 @@ def set_geometry(self, option='rectangle', length=np.nan, width=np.nan, diameter self.option = option if option == 'rectangle': - if (np.math.isnan(length)) or (np.math.isnan(width)): + if (np.isnan(length)) or (np.isnan(width)): raise ValueError("Length and width should be specified for a rectangular foundation") self.length = length self.width = width self.diameter = np.nan self.full_area = self.length * self.width elif option == 'circle': - if np.math.isnan(diameter): + if np.isnan(diameter): raise ValueError("Diameter should be specified for a circular foundation") self.diameter = diameter self.full_area = 0.25 * np.pi * (self.diameter ** 2) @@ -1250,7 +1250,7 @@ def set_eccentricity(self, eccentricity_width, eccentricity_length=np.nan): :return: Calculates the effective area of the foundation """ if self.option == 'rectangle': - if np.math.isnan(eccentricity_length): + if np.isnan(eccentricity_length): raise ValueError("Eccentricity in the length direction needs to be specified") eccentricity_result = effectivearea_rectangle_api( length=self.length, @@ -1352,7 +1352,7 @@ def set_soilparameters_undrained(self, unit_weight, su_base, su_increase=0.0, su self.unit_weight = unit_weight self.su_base = su_base self.su_increase = su_increase - if np.math.isnan(su_above_base): + if np.isnan(su_above_base): self.su_above_base = self.su_base else: self.su_above_base = su_above_base @@ -1385,7 +1385,7 @@ def calculate_sliding_capacity(self, **kwargs): :return: ``sliding`` attribute contains the results of the analysis, ``sliding_base_only`` gives the sliding capacity at the foundation base :math:`H_d` in kN, ``sliding_full`` gives the ultimate sliding resistance considering both base sliding and passive resistance :math:`H_d + \\Delta H` in kN """ - if np.math.isnan(self.su_above_base): + if np.isnan(self.su_above_base): self.su_above_base = 0 if self.option == 'circle': @@ -1516,7 +1516,7 @@ def calculate_sliding_capacity(self, vertical_load, interface_frictionangle=np.n else: outofplane_dimension = self.length - if np.math.isnan(interface_frictionangle): + if np.isnan(interface_frictionangle): interface_frictionangle = self.friction_angle - 5 else: pass diff --git a/groundhog/shallowfoundations/settlement.py b/groundhog/shallowfoundations/settlement.py index 6c25ffc..66d2287 100644 --- a/groundhog/shallowfoundations/settlement.py +++ b/groundhog/shallowfoundations/settlement.py @@ -356,7 +356,7 @@ def set_foundation(self, width, shape="strip", length=np.nan, skirt_depth=0): else: raise ValueError("Foundation shape must be one of: 'strip', 'circular', 'rectangular'") if shape == 'rectangular': - if np.math.isnan(length): + if np.isnan(length): raise ValueError("Length needs to be defined for a rectangular foundation") self.length = length self.skirt_depth = skirt_depth diff --git a/groundhog/siteinvestigation/correlations/general.py b/groundhog/siteinvestigation/correlations/general.py index 0219ce8..a206edf 100644 --- a/groundhog/siteinvestigation/correlations/general.py +++ b/groundhog/siteinvestigation/correlations/general.py @@ -168,12 +168,12 @@ def shearwavevelocity_compressionindex_cha( Reference - Cha et al (2014). Small-Strain Stiffness, Shear-Wave Velocity and Soil Compressibilitys. Journal of Geotechnical and Geoenvironmental Engineering. """ - if np.math.isnan(alpha): + if np.isnan(alpha): _alpha = calibration_factor_alpha_1 * (Cc ** calibration_factor_alpha_2) else: _alpha = alpha - if np.math.isnan(beta): + if np.isnan(beta): _beta = calibration_factor_beta_1 * np.log10(Cc) + calibration_factor_beta_2 else: _beta = beta diff --git a/groundhog/siteinvestigation/insitutests/pcpt_correlations.py b/groundhog/siteinvestigation/insitutests/pcpt_correlations.py index 261d14a..6751efa 100644 --- a/groundhog/siteinvestigation/insitutests/pcpt_correlations.py +++ b/groundhog/siteinvestigation/insitutests/pcpt_correlations.py @@ -26,15 +26,15 @@ } PCPT_NORMALISATIONS_ERRORRETURN = { - 'qt [MPa]': np.NaN, - 'qc [MPa]': np.NaN, - 'u2 [MPa]': np.NaN, - 'Delta u2 [MPa]': np.NaN, - 'Rf [pct]': np.NaN, - 'Bq [-]': np.NaN, - 'Qt [-]': np.NaN, - 'Fr [-]': np.NaN, - 'qnet [MPa]': np.NaN, + 'qt [MPa]': np.nan, + 'qc [MPa]': np.nan, + 'u2 [MPa]': np.nan, + 'Delta u2 [MPa]': np.nan, + 'Rf [pct]': np.nan, + 'Bq [-]': np.nan, + 'Qt [-]': np.nan, + 'Fr [-]': np.nan, + 'qnet [MPa]': np.nan, } @@ -778,8 +778,8 @@ def undrainedshearstrength_clay_radlunne( } FRICTIONANGLE_OVERBURDEN_KLEVEN_ERRORRETURN = { - 'phi [deg]': np.NaN, - 'sigma_m [kPa]': np.NaN + 'phi [deg]': np.nan, + 'sigma_m [kPa]': np.nan } @Validator(FRICTIONANGLE_OVERBURDEN_KLEVEN, FRICTIONANGLE_OVERBURDEN_KLEVEN_ERRORRETURN) @@ -934,7 +934,7 @@ def ocr_cpt_lunne(Qt, Bq=np.nan, **kwargs): 0.671677717, 0.749877749, 0.810239222, 0.8645448, 0.942964248 ])) - if np.math.isnan(Bq): + if np.isnan(Bq): _OCR_Bq_LE = np.nan _OCR_Bq_BE = np.nan _OCR_Bq_HE = np.nan diff --git a/groundhog/siteinvestigation/insitutests/pcpt_processing.py b/groundhog/siteinvestigation/insitutests/pcpt_processing.py index 364242a..45f30b5 100644 --- a/groundhog/siteinvestigation/insitutests/pcpt_processing.py +++ b/groundhog/siteinvestigation/insitutests/pcpt_processing.py @@ -1059,7 +1059,7 @@ def downhole_pcpt_corrections(self, area_ratio_override=np.nan): push_data = self.data[self.data['Push'] == _push] _push_z_min = push_data["z [m]"].min() for i, row in push_data.iterrows(): - if np.math.isnan(area_ratio_override): + if np.isnan(area_ratio_override): area_ratio = row['area ratio [-]'] else: area_ratio = area_ratio_override @@ -1131,7 +1131,7 @@ def normalise_pcpt(self, qc_for_rf=False): self.data.loc[i, "ft [MPa]"] = row['fs [MPa]'] - row['u2 [MPa]'] * ( (row['Sleeve cross-sectional area bottom [cm2]'] - row['Sleeve cross-sectional area top [cm2]']) / row['Cone sleeve_area [cm2]'] ) - if np.math.isnan(self.data.loc[i, "ft [MPa]"]): + if np.isnan(self.data.loc[i, "ft [MPa]"]): self.data.loc[i, "ft [MPa]"] = row['fs [MPa]'] except: self.data.loc[i, "ft [MPa]"] = row['fs [MPa]'] diff --git a/groundhog/siteinvestigation/insitutests/spt_correlations.py b/groundhog/siteinvestigation/insitutests/spt_correlations.py index c2e94db..a02937c 100644 --- a/groundhog/siteinvestigation/insitutests/spt_correlations.py +++ b/groundhog/siteinvestigation/insitutests/spt_correlations.py @@ -182,7 +182,7 @@ def spt_N60_correction( """ # Hammer efficiency correction - if np.math.isnan(eta_H): + if np.isnan(eta_H): if country == 'Japan': if hammertype == 'Donut': if hammerrelease == 'Free fall': @@ -225,7 +225,7 @@ def spt_N60_correction( else: raise ValueError("Hammer type not recognised for China.") elif country == 'Other': - if np.math.isnan(eta_H): + if np.isnan(eta_H): raise ValueError("For country='Other', an override for eta_H should be specified.") else: pass @@ -235,7 +235,7 @@ def spt_N60_correction( _eta_H = eta_H # Borehole diameter correction - if np.math.isnan(eta_B): + if np.isnan(eta_B): if 60 < borehole_diameter < 120: _eta_B = 1 elif borehole_diameter == 150: @@ -248,7 +248,7 @@ def spt_N60_correction( _eta_B = eta_B # Sample type correction - if np.math.isnan(eta_S): + if np.isnan(eta_S): if samplertype == 'Standard sampler': _eta_S = 1.0 elif samplertype == 'With liner for dense sand and clay': @@ -261,7 +261,7 @@ def spt_N60_correction( _eta_S = eta_S # Rod length correction - if np.math.isnan(eta_R): + if np.isnan(eta_R): if 0 <= rod_length < 4: _eta_R = 0.75 elif 4 <= rod_length < 6: @@ -350,14 +350,14 @@ def relativedensity_spt_kulhawymayne( Reference - Kulhawy FH, Mayne PW (1990) Manual on estimating soil properties for foundation design. Electric Power Research Institute, Palo Alto """ - if np.math.isnan(ca_override): + if np.isnan(ca_override): if time_since_deposition == 1: _C_A = 1 else: _C_A = 1.2 + 0.05 * np.log10(time_since_deposition / 100) else: _C_A = ca_override - if np.math.isnan(cocr_override): + if np.isnan(cocr_override): _C_OCR = ocr ** 0.18 else: _C_OCR = cocr_override @@ -427,7 +427,7 @@ def undrainedshearstrength_spt_salgado( Reference - Salgado R (2008) The engineering of foundations. McGraw-Hill, New York """ - if np.math.isnan(alpha_prime_override): + if np.isnan(alpha_prime_override): _pi = [15, 20, 25, 30, 40, 60] _alpha = [0.068, 0.055, 0.048, 0.045, 0.044, 0.043] _alpha_prime = np.interp(pi, _pi, _alpha) diff --git a/groundhog/siteinvestigation/labtesting/compressibility.py b/groundhog/siteinvestigation/labtesting/compressibility.py index dabe0ca..b11686b 100644 --- a/groundhog/siteinvestigation/labtesting/compressibility.py +++ b/groundhog/siteinvestigation/labtesting/compressibility.py @@ -121,7 +121,7 @@ def roottimemethod(times, settlements, drainagelength, initialguess_override=np. def intersection(x): return OB_func(x) - data_func(x) - if np.math.isnan(initialguess_override): + if np.isnan(initialguess_override): initial_guess = pointA[0] else: initial_guess = initialguess_override @@ -267,7 +267,7 @@ def logtimemethod(times, settlements, drainagelength, initialguess_override=np.n def intersection_primary_secondary(x): return primary_func(x) - secondary_func(x) - if np.math.isnan(initialguess_override): + if np.isnan(initialguess_override): initial_guess = 1.5 * x1_primary else: initial_guess = initialguess_override diff --git a/groundhog/soildynamics/liquefaction.py b/groundhog/soildynamics/liquefaction.py index d3e8808..d5ca928 100644 --- a/groundhog/soildynamics/liquefaction.py +++ b/groundhog/soildynamics/liquefaction.py @@ -76,7 +76,7 @@ def cyclicstressratio_moss( """ - if np.math.isnan(rd_override): + if np.isnan(rd_override): if depth >= 20: _rd = (1 + ((-9.147 - 4.173 * (acceleration / gravity) + 0.652 * magnitude) / @@ -100,7 +100,7 @@ def cyclicstressratio_moss( else: _rd = rd_override - if np.math.isnan(DWF_override): + if np.isnan(DWF_override): _DWF = 17.84 * (magnitude ** (-1.43)) else: _DWF = DWF_override @@ -419,7 +419,7 @@ def liquefactionprobability_moss( _spline = interpolate.UnivariateSpline(_csr_array, _qc_array) qcpl_array = np.append(qcpl_array, _spline(CSR_star)) - if np.math.isnan(c_override): + if np.isnan(c_override): _qc = qc for i in range(10): f_1 = x1 * (qc ** x2) @@ -431,7 +431,7 @@ def liquefactionprobability_moss( else: _c = c_override - if np.math.isnan(delta_qc_override): + if np.isnan(delta_qc_override): if Rf < 0.5: _delta_qc = 0 else: diff --git a/groundhog/standards/eurocode7/parameter_selection.py b/groundhog/standards/eurocode7/parameter_selection.py index ae9a8b1..275ba7f 100644 --- a/groundhog/standards/eurocode7/parameter_selection.py +++ b/groundhog/standards/eurocode7/parameter_selection.py @@ -59,7 +59,7 @@ def constant_value(data, mode='Low', cov=np.nan, confidence=0.95, **kwargs): t_nminus1 = t.ppf(confidence, r) if mode == 'Low': - if np.math.isnan(cov): + if np.isnan(cov): # COV unknown kn = t_nminus1 * np.sqrt((1 / n) + 1) cov = np.array(data).std() / np.array(data).mean() @@ -67,7 +67,7 @@ def constant_value(data, mode='Low', cov=np.nan, confidence=0.95, **kwargs): # COV known kn = 1.64 * np.sqrt((1 / n) + 1) elif mode == "Mean": - if np.math.isnan(cov): + if np.isnan(cov): # COV unknown kn = t_nminus1 * np.sqrt(1 / n) cov = np.array(data).std() / np.array(data).mean() diff --git a/requirements.txt b/requirements.txt index ba4a2c9..ffe6923 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -pandas>=2.0.3 +numpy>=2.1 +pandas>=1.0.3 plotly scipy>=1.4.1 xlrd==1.2.0 diff --git a/tests/deepfoundations/test_cavityexpansion.py b/tests/deepfoundations/test_cavityexpansion.py index d224377..661f460 100644 --- a/tests/deepfoundations/test_cavityexpansion.py +++ b/tests/deepfoundations/test_cavityexpansion.py @@ -80,4 +80,4 @@ def test_expansion_cylinder_tresca(self): undrained_shear_strength=10, shear_modulus=1000) self.assertTrue(collapsed_result['yielding']) - self.assertTrue(np.math.isnan(collapsed_result['elastic wall expansion [m]'])) \ No newline at end of file + self.assertTrue(np.isnan(collapsed_result['elastic wall expansion [m]'])) \ No newline at end of file diff --git a/tests/general/test_parameter_mapping.py b/tests/general/test_parameter_mapping.py index 68592e8..6425537 100644 --- a/tests/general/test_parameter_mapping.py +++ b/tests/general/test_parameter_mapping.py @@ -56,7 +56,7 @@ def test_map_depth_properties(self): result[result["z [m]"] == 5]["Undrained shear strength [kPa]"].iloc[0], 50 ) self.assertTrue( - np.math.isnan(result[result["z [m]"] == 5]["Effective friction angle [deg]"].iloc[0])) + np.isnan(result[result["z [m]"] == 5]["Effective friction angle [deg]"].iloc[0])) result = parameter_mapping.map_depth_properties( target_df=self.target_df_altcol, layering_df=self.layering_df_altcols, @@ -74,7 +74,7 @@ def test_map_depth_properties(self): result[result["Depth [m]"] == 5]["Undrained shear strength [kPa]"].iloc[0], 50 ) self.assertTrue( - np.math.isnan(result[result["Depth [m]"] == 5]["Effective friction angle [deg]"].iloc[0]) + np.isnan(result[result["Depth [m]"] == 5]["Effective friction angle [deg]"].iloc[0]) ) class Test_offsets(unittest.TestCase): diff --git a/tests/general/test_validation.py b/tests/general/test_validation.py index 090c8ad..02a8000 100644 --- a/tests/general/test_validation.py +++ b/tests/general/test_validation.py @@ -35,7 +35,7 @@ def test_nonfloat(self): self.assertRaises(TypeError,validate_float,"example_list",example_list) def test_nan(self): - self.assertEqual(validate_float("example_float",np.NaN),True) + self.assertEqual(validate_float("example_float",np.nan),True) def test_float(self): example_float = 1.1 @@ -79,7 +79,7 @@ def test_integer(self): self.assertEqual(validate_integer("example_int",example_int),True) def test_nan(self): - self.assertEqual(validate_float("example_float",np.NaN),True) + self.assertEqual(validate_float("example_float",np.nan),True) def test_min(self): value = 5 @@ -194,9 +194,9 @@ def test_ascending(self): self.assertEqual(validate_list("example_list",example_list,order="ascending"),True) example_list = [1.0,3.0,2.0] self.assertRaises(ValueError,validate_list,"example_list",example_list,order="ascending") - example_list = [np.NaN,3.0,2.0] + example_list = [np.nan,3.0,2.0] self.assertRaises(ValueError,validate_list,"example_list",example_list,order="ascending") - example_list = [3.0,np.NaN,2.0] + example_list = [3.0,np.nan,2.0] self.assertRaises(ValueError,validate_list,"example_list",example_list,order="ascending") def test_descending(self): @@ -204,9 +204,9 @@ def test_descending(self): self.assertEqual(validate_list("example_list",example_list,order="descending"),True) example_list = [2.0,3.0,1.0] self.assertRaises(ValueError,validate_list,"example_list",example_list,order="descending") - example_list = [3.0,2.0,np.NaN] + example_list = [3.0,2.0,np.nan] self.assertRaises(ValueError,validate_list,"example_list",example_list,order="descending") - example_list = [3.0,np.NaN,2.0,1.0,] + example_list = [3.0,np.nan,2.0,1.0,] self.assertRaises(ValueError,validate_list,"example_list",example_list,order="descending") def test_unique(self): @@ -251,7 +251,7 @@ def test_override(self): class Test_validate_new(unittest.TestCase): def setUp(self): - self.ERROR_DICT = {'value': np.NaN} + self.ERROR_DICT = {'value': np.nan} self.CUSTOM_ERROR_DICT = {'value': 0.0} @@ -295,7 +295,7 @@ def test_validate_correct(self): def test_fail_silent(self): self.assertRaises(Exception,self.test_fail_silentfunc,0.0,'bruno',fail_silently=False) - self.assertTrue(np.math.isnan(self.test_fail_silentfunc(0.0,'bruno')['value'])) + self.assertTrue(np.isnan(self.test_fail_silentfunc(0.0,'bruno')['value'])) self.assertEqual(self.test_fail_silentfunc(0.0,'bruno', customerroroutput=self.CUSTOM_ERROR_DICT)['value'], 0.0) def test_additional_call(self): diff --git a/tests/siteinvestigation/insitutests/data/output_pcpt.xlsx b/tests/siteinvestigation/insitutests/data/output_pcpt.xlsx index b8fbc32daa11cf7a7dab7e34fdf6d0194adadaeb..5c1b849996b7f14067f92aa0b6708ecbf167104a 100644 GIT binary patch delta 1022 zcmbR6ie>RDmihp1W)=|!1_lm>*gm~Tx8uGZQ-Qp*Kr8^nDf!6(MfnBA`iTVvdKI}j zzUO_p4;k>VJ=h;qwtZ%o+!8()+pc+g&g+%7Zqv+d`St!Si+x^YI0;hOR!^bbqjl2PS#Q~7^VSogE< z5=ZsJqzJ#4?}2XDW@2CvMD{~+eo-pO6K5wK^gC?8(-zPA^j`h0w_!_MWAzmL6ci0P zkLVWd(Os0e=*Wt@w=YjyE8N8XK;rlL=jSI$^9a>0dH#agb=#CYw(Dh{NjJKbizhH} z_CF~(b=<|=?7N-S*~i9m3K@Scus5yJ$U7*Qy*TnP%b7z?BC8BF3@4?@pRZ`u2B8+xTw6vG|i-cC5F$PCvPR_3qzyjw@EJxE8tb3t9CZc;;mt1@4cJ&fQNLN1;~XP| z^`29Z3BqFGX=4Vnn)~>-_wh3xmICv(hiWlifGC-+smu5jA}FNCI0<6H^cDJyUm$`D z3>d>0c~R2VbY>$)!#I!-dQ<^p3k(_<4+Cj<;)6w8fHxzP2s0wJqWA==6+|^KKAb+u zh*3!aWXI&!h5U0E85q7XGcZUXD{55Yn4VzFC_34JgLV2lBSs#ugQx#9Vw7U~!U>j| zu5ZjJ2sR~VN2_)S(1cJvbW=EaKuXmhn!AjFnkVx^H17s#h6rB(3NuDce{IYt0}T;AQk}Pl>Fp?qWpql{ltO-y^7o% z-#%MzCPM+2|ECJ~Zg)KBl;m(BXu~G{YH9rmDbAam>h@V4?9Y?SmvFn!m9F(@C7*6v zNdIG{N&F0=;$7SPVwdO1OwU-FT*+YleB!yD^B$fF&a1D;t>9cb^O^5IzCO44MSOB= zEBv0l+E|dPet4-OEARiJ+hv)`X`ZkfH_o2O%9c8Q?3%}~Z{C~CQgiq>EM7X_zLx2#gvu`u{fq2f zIhuFBuFIT!WP_;tGX+K=xsxxa@OPGFysIsl)t+wSaG~N7d($e7YY#fMUR;yNl9s5( z6)HVN!gF)K_@0B3@^;C_2YHxGpVY5-%90w_6!7>+!MoW~c@2WcL}GvGO_ z6~;o(Zzs>KT=)7@p5fCrS+9!vx~jR?&gRUH*zR$7eTwRQ=G>#DpKd?;m-t;HBsApo znuye^Y2nj~c1~RV_4tclhu^Ec*|V|wcYp8trd4h6bNJqKxaOrx`IS zK#c4%Vw7S$H+`uQqY^~mG*EzvpJTEBm+16AMvQ_GQ9)y%=tEARsFY5CHzSh>Ga_}y z>}b^vVP;?m1U&+M4AjZwW zzzfq1q#GFBr~fl%l!3TF&V*5_URsxtA-*Uzr&wPPM54PSPvGq0Okmhv2fBtI#UvIz zMuv(U{qp>x?44P=L7fs)8!l(#w&K;n07$;5t OZo;U>_R0`wCj$U^#!^ZE diff --git a/tests/siteinvestigation/insitutests/test_pcpt_correlations.py b/tests/siteinvestigation/insitutests/test_pcpt_correlations.py index f875106..ff7b0e9 100644 --- a/tests/siteinvestigation/insitutests/test_pcpt_correlations.py +++ b/tests/siteinvestigation/insitutests/test_pcpt_correlations.py @@ -122,7 +122,7 @@ def test_values(self): self.assertAlmostEqual(result['OCR_Qt_LE [-]'], 2.28, 2) self.assertAlmostEqual(result['OCR_Qt_BE [-]'], 3.01, 2) self.assertAlmostEqual(result['OCR_Qt_HE [-]'], 4.68, 2) - self.assertTrue(np.math.isnan(result['OCR_Bq_LE [-]'])) + self.assertTrue(np.isnan(result['OCR_Bq_LE [-]'])) result = pcpt_correlations.ocr_cpt_lunne( Qt=10, Bq=0.6) diff --git a/tests/siteinvestigation/insitutests/test_pcpt_processing.py b/tests/siteinvestigation/insitutests/test_pcpt_processing.py index ce44d80..60d1b82 100644 --- a/tests/siteinvestigation/insitutests/test_pcpt_processing.py +++ b/tests/siteinvestigation/insitutests/test_pcpt_processing.py @@ -283,14 +283,14 @@ def test_pcpt_correlations(self): self.assertAlmostEqual( self.pandas_pcpt.data.loc[275, "Ic [-]"], 2.993, 2 ) - self.assertTrue(np.math.isnan(self.pandas_pcpt.data.loc[275, "Gmax sand [kPa]"])) + self.assertTrue(np.isnan(self.pandas_pcpt.data.loc[275, "Gmax sand [kPa]"])) self.assertAlmostEqual( self.pandas_pcpt.data.loc[275, "Gmax clay [kPa]"], 45333, 0 ) self.assertAlmostEqual( self.pandas_pcpt.data.loc[605, "Ic [-]"], 1.505, 3 ) - self.assertTrue(np.math.isnan(self.pandas_pcpt.data.loc[605, "Gmax clay [kPa]"])) + self.assertTrue(np.isnan(self.pandas_pcpt.data.loc[605, "Gmax clay [kPa]"])) self.assertAlmostEqual( self.pandas_pcpt.data.loc[605, "Gmax sand [kPa]"], 107283, 0 ) diff --git a/tests/siteinvestigation/insitutests/test_spt_processing.py b/tests/siteinvestigation/insitutests/test_spt_processing.py index cd4f53c..48bdabe 100644 --- a/tests/siteinvestigation/insitutests/test_spt_processing.py +++ b/tests/siteinvestigation/insitutests/test_spt_processing.py @@ -148,5 +148,5 @@ def test_spt_N60correction_withNaNs(self): name='N60 correction', outputs={'N60 [-]': 'N60 [-]'} ) - self.assertTrue(np.math.isnan(self.pandas_spt.data['N60 [-]'].iloc[2])) + self.assertTrue(np.isnan(self.pandas_spt.data['N60 [-]'].iloc[2]))