|
124 | 124 | "for reaction in sbml_model.getListOfReactions():\n", |
125 | 125 | " reactants = \" + \".join(\n", |
126 | 126 | " [\n", |
127 | | - " \"%s %s\"\n", |
128 | | - " % (\n", |
| 127 | + " \"{} {}\".format(\n", |
129 | 128 | " int(r.getStoichiometry()) if r.getStoichiometry() > 1 else \"\",\n", |
130 | 129 | " r.getSpecies(),\n", |
131 | 130 | " )\n", |
|
134 | 133 | " )\n", |
135 | 134 | " products = \" + \".join(\n", |
136 | 135 | " [\n", |
137 | | - " \"%s %s\"\n", |
138 | | - " % (\n", |
| 136 | + " \"{} {}\".format(\n", |
139 | 137 | " int(r.getStoichiometry()) if r.getStoichiometry() > 1 else \"\",\n", |
140 | 138 | " r.getSpecies(),\n", |
141 | 139 | " )\n", |
|
144 | 142 | " )\n", |
145 | 143 | " reversible = \"<\" if reaction.getReversible() else \"\"\n", |
146 | 144 | " print(\n", |
147 | | - " \"%3s: %10s %1s->%10s\\t\\t[%s]\"\n", |
| 145 | + " \"%3s: %10s %1s->%10s\\t\\t[%s]\" # noqa: UP031\n", |
148 | 146 | " % (\n", |
149 | 147 | " reaction.getId(),\n", |
150 | 148 | " reactants,\n", |
|
370 | 368 | "\n", |
371 | 369 | "# np.set_printoptions(threshold=8, edgeitems=2)\n", |
372 | 370 | "for key, value in rdata.items():\n", |
373 | | - " print(\"%12s: \" % key, value)" |
| 371 | + " print(f\"{key:12s}: \", value)" |
374 | 372 | ] |
375 | 373 | }, |
376 | 374 | { |
|
664 | 662 | "Since the Eigenvalues of the Jacobian are negative and since the Jacobian at steady state is a fixed matrix, this system has a simple algebraic solution:\n", |
665 | 663 | "\n", |
666 | 664 | " $$p(t) = e^{t J(x^*, \\theta)^T} p_{\\text{end}}.$$\n", |
667 | | - " \n", |
| 665 | + "\n", |
668 | 666 | "As a consequence, the quadratures in adjoint computation also reduce to a matrix-vector product:\n", |
669 | 667 | "\n", |
670 | 668 | " $$Q(x, \\theta) = Q(x^*, \\theta) = p_{\\text{integral}} * \\frac{\\partial f}{\\partial \\theta}$$\n", |
671 | 669 | "\n", |
672 | 670 | "with\n", |
673 | 671 | "\n", |
674 | | - " $$p_{\\text{integral}} = \\int_0^\\infty p(s) ds = (J(x^*, \\theta)^T)^{-1} p_{\\text{end}}.$$ \n", |
675 | | - " \n", |
| 672 | + " $$p_{\\text{integral}} = \\int_0^\\infty p(s) ds = (J(x^*, \\theta)^T)^{-1} p_{\\text{end}}.$$\n", |
| 673 | + "\n", |
676 | 674 | "However, this solution is given in terms of a linear system of equations defined by the transposed Jacobian of the right hand side. Hence, if the (transposed) Jacobian is singular, it is not applicable.\n", |
677 | 675 | "In this case, standard integration must be carried out." |
678 | 676 | ] |
|
922 | 920 | "\n", |
923 | 921 | "for key, value in rdata.items():\n", |
924 | 922 | " if key[0:6] == \"preeq_\":\n", |
925 | | - " print(\"%20s: \" % key, value)" |
| 923 | + " print(f\"{key:20s}:\", value)" |
926 | 924 | ] |
927 | 925 | }, |
928 | 926 | { |
|
960 | 958 | "\n", |
961 | 959 | "for key, value in rdata.items():\n", |
962 | 960 | " if key[0:6] == \"preeq_\":\n", |
963 | | - " print(\"%20s: \" % key, value)" |
| 961 | + " print(f\"{key:20s}:\", value)" |
964 | 962 | ] |
965 | 963 | }, |
966 | 964 | { |
|
993 | 991 | "\n", |
994 | 992 | "for key, value in rdata_reduced.items():\n", |
995 | 993 | " if key[0:6] == \"preeq_\":\n", |
996 | | - " print(\"%20s: \" % key, value)" |
| 994 | + " print(f\"{key:20s}:\", value)" |
997 | 995 | ] |
998 | 996 | }, |
999 | 997 | { |
|
1044 | 1042 | "\n", |
1045 | 1043 | "for key, value in rdata_reduced.items():\n", |
1046 | 1044 | " if key[0:6] == \"preeq_\":\n", |
1047 | | - " print(\"%20s: \" % key, value)\n", |
| 1045 | + " print(f\"{key:20s}:\", value)\n", |
1048 | 1046 | "print(\"Gradient:\", rdata_reduced[\"sllh\"])" |
1049 | 1047 | ] |
1050 | 1048 | }, |
|
1079 | 1077 | "\n", |
1080 | 1078 | "for key, value in rdata_reduced.items():\n", |
1081 | 1079 | " if key[0:6] == \"preeq_\":\n", |
1082 | | - " print(\"%20s: \" % key, value)\n", |
| 1080 | + " print(f\"{key:20s}:\", value)\n", |
1083 | 1081 | "print(\"Gradient:\", rdata_reduced[\"sllh\"])" |
1084 | 1082 | ] |
1085 | 1083 | }, |
|
1117 | 1115 | "\n", |
1118 | 1116 | "for key, value in rdata_reduced.items():\n", |
1119 | 1117 | " if key[0:6] == \"preeq_\":\n", |
1120 | | - " print(\"%20s: \" % key, value)\n", |
| 1118 | + " print(f\"{key:20s}:\", value)\n", |
1121 | 1119 | "print(\"Gradient:\", rdata_reduced[\"sllh\"])" |
1122 | 1120 | ] |
1123 | 1121 | }, |
|
1160 | 1158 | "\n", |
1161 | 1159 | "for key, value in rdata.items():\n", |
1162 | 1160 | " if key[0:6] == \"preeq_\":\n", |
1163 | | - " print(\"%20s: \" % key, value)\n", |
| 1161 | + " print(f\"{key:20s}:\", value)\n", |
1164 | 1162 | "print(\"Gradient:\", rdata[\"sllh\"])" |
1165 | 1163 | ] |
1166 | 1164 | }, |
|
0 commit comments