You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switching the symbolic backend to SymEngine broke espei.utils.formatted_parameter. Here's a test to validate (run from the tests directory for the testing_data module to be importable).
# espei/tests/test_utils.pyfrompycalphadimportDatabasefromespei.utilsimportformatted_parameter, database_symbols_to_fitfrom .testing_dataimportCU_MG_TDBdeftest_cu_mg_parameters_can_be_formatted_to_strings():
"""Formating parameters should work for common variables parameters"""dbf=Database(CU_MG_TDB)
forsymindatabase_symbols_to_fit(dbf):
assertisinstance(formatted_parameter(dbf, sym), str), f"Formatted parameter for symbol {sym} (value = {dbf.symbols[sym]}) in database not a string"
Running this gives an error:
Traceback (mostrecentcalllast):
File"/Users/bocklund1/src/calphad/espei/tests/dummy.py", line11, in<module>test_cu_mg_parameters_can_be_formatted_to_strings()
File"/Users/bocklund1/src/calphad/espei/tests/dummy.py", line9, intest_cu_mg_parameters_can_be_formatted_to_stringsassertisinstance(formatted_parameter(dbf, sym), str), f"Formatted parameter for symbol {sym} (value = {dbf.symbols[sym]}) in database not a string"File"/Users/bocklund1/src/calphad/espei/espei/utils.py", line295, informatted_parameterterm=parameter_term(result['parameter'], symbol)
File"/Users/bocklund1/src/calphad/espei/espei/utils.py", line218, inparameter_termcoeff, root=term_coeff.as_coeff_mul(symbol)
AttributeError: 'symengine.lib.symengine_wrapper.Symbol'objecthasnoattribute'as_coeff_mul'
I think the breakage might be because espei.utils.parameter_term isn't correctly picking up the first condition, since for the case of symbol being a symengine.lib.symengine_wrapper.Symbol, I think expression == symbol should evaluate to true, but evidently (via the traceback) it is evaluating to false.
The text was updated successfully, but these errors were encountered:
Switching the symbolic backend to SymEngine broke
espei.utils.formatted_parameter
. Here's a test to validate (run from thetests
directory for thetesting_data
module to be importable).Running this gives an error:
I think the breakage might be because
espei.utils.parameter_term
isn't correctly picking up the first condition, since for the case ofsymbol
being asymengine.lib.symengine_wrapper.Symbol
, I thinkexpression == symbol
should evaluate to true, but evidently (via the traceback) it is evaluating to false.The text was updated successfully, but these errors were encountered: