Skip to content

Commit 8b0b37f

Browse files
committed
savemat forces double for numbers
Data columns such as lb and ub as int instead of double can cause crashes in the cobra toolbox.
1 parent 4018373 commit 8b0b37f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cobra/io/mat.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ def create_mat_dict(model):
110110
mat["subSystems"] = _cell(rxns.list_attr("subsystem"))
111111
mat["csense"] = "".join(model._constraint_sense)
112112
mat["S"] = model.S
113-
mat["lb"] = array(rxns.list_attr("lower_bound"))
114-
mat["ub"] = array(rxns.list_attr("upper_bound"))
115-
mat["b"] = array(mets.list_attr("_bound"))
116-
mat["c"] = array(rxns.list_attr("objective_coefficient"))
117113
# multiply by 1 to convert to float, working around scipy bug
118114
# https://github.com/scipy/scipy/issues/4537
119-
mat["rev"] = array(rxns.list_attr("reversibility")) * 1
115+
mat["lb"] = array(rxns.list_attr("lower_bound")) * 1.
116+
mat["ub"] = array(rxns.list_attr("upper_bound")) * 1.
117+
mat["b"] = array(mets.list_attr("_bound")) * 1.
118+
mat["c"] = array(rxns.list_attr("objective_coefficient")) * 1.
119+
mat["rev"] = array(rxns.list_attr("reversibility"))
120120
mat["description"] = str(model.description)
121121
return mat
122122

0 commit comments

Comments
 (0)