From 700193fcfab387bc3776ca12b971244ff5e9651e Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Tue, 7 Nov 2023 22:19:43 +0000 Subject: [PATCH 1/3] np.product->np.prod --- burnman/tools/equilibration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/burnman/tools/equilibration.py b/burnman/tools/equilibration.py index 8726bb85..ec55330a 100644 --- a/burnman/tools/equilibration.py +++ b/burnman/tools/equilibration.py @@ -1071,7 +1071,7 @@ def equilibrate( updated_params = True # Finally, make dimensions of sol_array equal the input dimensions - if np.product(sol_array.shape) > 1: + if np.prod(sol_array.shape) > 1: sol_array = np.squeeze(sol_array) else: sol_array = sol_array.flatten()[0] From daabccbc36ddf551960eba2040472e09d1c3a073 Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Tue, 7 Nov 2023 22:48:15 +0000 Subject: [PATCH 2/3] empty list to zero comparison --- burnman/optimize/eos_fitting.py | 8 ++++---- burnman/utils/misc.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/burnman/optimize/eos_fitting.py b/burnman/optimize/eos_fitting.py index 12723a50..663c8533 100644 --- a/burnman/optimize/eos_fitting.py +++ b/burnman/optimize/eos_fitting.py @@ -187,7 +187,7 @@ def fit_PTp_data( ) # Apply mle tolerances if they dont exist - if mle_tolerances == []: + if len(mle_tolerances) == 0: mineral.set_state(1.0e5, 300.0) mle_tolerance_factor = 1.0e-5 mle_tolerances = np.empty(len(flags)) @@ -200,7 +200,7 @@ def fit_PTp_data( # If covariance matrix is not given, apply unit weighting to all pressures # (with zero errors on T and p) covariances_defined = True - if data_covariances == []: + if len(data_covariances) == 0: covariances_defined = False data_covariances = np.zeros((len(data[:, 0]), len(data[0]), len(data[0]))) for i in range(len(data_covariances)): @@ -535,7 +535,7 @@ def fit_XPTp_data( ) # Apply mle tolerances if they dont exist - if mle_tolerances == []: + if len(mle_tolerances) == 0: solution.set_state(1.0e5, 300.0) mle_tolerance_factor = 1.0e-5 mle_tolerances = np.empty(len(flags)) @@ -548,7 +548,7 @@ def fit_XPTp_data( # If covariance matrix is not given, apply unit weighting to all pressures # (with zero errors on T and property) covariances_defined = True - if data_covariances == []: + if len(data_covariances) == 0: covariances_defined = False nX = solution.n_endmembers data_covariances = np.zeros((len(data[:, 0]), len(data[0]), len(data[0]))) diff --git a/burnman/utils/misc.py b/burnman/utils/misc.py index eed35612..99075611 100644 --- a/burnman/utils/misc.py +++ b/burnman/utils/misc.py @@ -214,7 +214,7 @@ def attribute_function(m, attributes, powers=[]): """ if type(attributes) is str: attributes = [attributes] - if powers == []: + if len(powers) == 0: powers = [1.0 for a in attributes] def f(x): From e6de5dfa157bf37036f6b0b2d58e19c03070eb4f Mon Sep 17 00:00:00 2001 From: Bob Myhill Date: Tue, 7 Nov 2023 23:01:26 +0000 Subject: [PATCH 3/3] list to scalar --- burnman/utils/geotherm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/burnman/utils/geotherm.py b/burnman/utils/geotherm.py index 4304d6d6..49318f06 100644 --- a/burnman/utils/geotherm.py +++ b/burnman/utils/geotherm.py @@ -127,7 +127,7 @@ def adiabatic(pressures, T0, rock): rock.set_state(pressures[0], T0) S0 = rock.S - delta_S = lambda T, P, rock, S0: S0 - rock.evaluate(["S"], [P], [T])[0] + delta_S = lambda T, P, rock, S0: S0 - rock.evaluate(["S"], [P], [T])[0][0] temperatures = np.empty_like(pressures) temperatures[0] = T0