@@ -1064,15 +1064,16 @@ def _somd2_extract(parquet_file, T=None, estimator="MBAR"):
1064
1064
lam = float (metadata ["lambda" ])
1065
1065
except :
1066
1066
raise ValueError ("Parquet metadata does not contain 'lambda'." )
1067
- try :
1068
- lambda_array = metadata ["lambda_array" ]
1069
- except :
1070
- raise ValueError ("Parquet metadata does not contain 'lambda array'" )
1071
1067
if not is_mbar :
1072
1068
try :
1073
1069
lambda_grad = metadata ["lambda_grad" ]
1074
1070
except :
1075
1071
raise ValueError ("Parquet metadata does not contain 'lambda grad'" )
1072
+ else :
1073
+ try :
1074
+ lambda_grad = metadata ["lambda_grad" ]
1075
+ except :
1076
+ lambda_grad = []
1076
1077
1077
1078
# Make sure that the temperature is correct.
1078
1079
if not T == temperature :
@@ -1085,8 +1086,8 @@ def _somd2_extract(parquet_file, T=None, estimator="MBAR"):
1085
1086
df = table .to_pandas ()
1086
1087
1087
1088
if is_mbar :
1088
- # Extract the columns corresponding to the lambda array .
1089
- df = df [[x for x in lambda_array ]]
1089
+ # Extract all columns other than those used for the gradient .
1090
+ df = df [[x for x in df . columns if x not in lambda_grad ]]
1090
1091
1091
1092
# Subtract the potential at the simulated lambda.
1092
1093
df = df .subtract (df [lam ], axis = 0 )
@@ -1311,10 +1312,21 @@ def _analyse_internal(files, temperatures, lambdas, engine, estimator, **kwargs)
1311
1312
1312
1313
# Preprocess the data.
1313
1314
try :
1314
- processed_data = Relative ._preprocess_data (data , estimator , ** kwargs )
1315
- processed_data = _alchemlyb .concat (processed_data )
1316
- except :
1317
- _warnings .warn ("Could not preprocess the data!" )
1315
+ preprocess = kwargs .pop ("preprocess" , True )
1316
+ except KeyError :
1317
+ preprocess = True
1318
+
1319
+ if not isinstance (preprocess , bool ):
1320
+ raise TypeError ("'preprocess' must be of type 'bool'." )
1321
+
1322
+ if preprocess :
1323
+ try :
1324
+ processed_data = Relative ._preprocess_data (data , estimator , ** kwargs )
1325
+ processed_data = _alchemlyb .concat (processed_data )
1326
+ except :
1327
+ _warnings .warn ("Could not preprocess the data!" )
1328
+ processed_data = _alchemlyb .concat (data )
1329
+ else :
1318
1330
processed_data = _alchemlyb .concat (data )
1319
1331
1320
1332
mbar_method = None
0 commit comments