myokit 1.34.0__py3-none-any.whl → 1.35.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- myokit/__init__.py +5 -23
- myokit/__main__.py +70 -117
- myokit/_aux.py +5 -8
- myokit/_config.py +22 -31
- myokit/_datablock.py +26 -70
- myokit/_datalog.py +23 -53
- myokit/_err.py +13 -15
- myokit/_expressions.py +35 -55
- myokit/_io.py +5 -22
- myokit/_model_api.py +34 -47
- myokit/_myokit_version.py +1 -5
- myokit/_parsing.py +17 -25
- myokit/_progress.py +4 -7
- myokit/_protocol.py +6 -9
- myokit/_sim/__init__.py +7 -24
- myokit/_sim/cable.c +1 -3
- myokit/_sim/cable.py +3 -5
- myokit/_sim/cmodel.h +1 -3
- myokit/_sim/cmodel.py +1 -4
- myokit/_sim/compiler.py +1 -4
- myokit/_sim/cvodessim.c +1 -4
- myokit/_sim/cvodessim.py +1 -4
- myokit/_sim/fiber_tissue.c +2 -6
- myokit/_sim/fiber_tissue.py +3 -5
- myokit/_sim/jacobian.py +6 -7
- myokit/_sim/mcl.h +51 -53
- myokit/_sim/opencl.py +9 -22
- myokit/_sim/openclsim.c +2 -6
- myokit/_sim/openclsim.py +6 -6
- myokit/_sim/pacing.h +2 -6
- myokit/_sim/rhs.c +3 -10
- myokit/_sim/rhs.py +4 -13
- myokit/_sim/sundials.py +1 -4
- myokit/_system.py +10 -16
- myokit/_unit.py +3 -12
- myokit/float.py +0 -3
- myokit/formats/__init__.py +8 -10
- myokit/formats/ansic/__init__.py +0 -3
- myokit/formats/ansic/_ewriter.py +2 -4
- myokit/formats/ansic/_exporter.py +0 -3
- myokit/formats/axon/__init__.py +1 -3
- myokit/formats/axon/_abf.py +12 -15
- myokit/formats/axon/_atf.py +5 -6
- myokit/formats/axon/_importer.py +0 -3
- myokit/formats/cellml/__init__.py +0 -3
- myokit/formats/cellml/_ewriter.py +3 -6
- myokit/formats/cellml/_exporter.py +3 -6
- myokit/formats/cellml/_importer.py +1 -4
- myokit/formats/cellml/v1/__init__.py +0 -4
- myokit/formats/cellml/v1/_api.py +7 -10
- myokit/formats/cellml/v1/_parser.py +2 -5
- myokit/formats/cellml/v1/_writer.py +2 -11
- myokit/formats/cellml/v2/__init__.py +0 -3
- myokit/formats/cellml/v2/_api.py +7 -16
- myokit/formats/cellml/v2/_parser.py +2 -5
- myokit/formats/cellml/v2/_writer.py +1 -4
- myokit/formats/channelml/__init__.py +0 -3
- myokit/formats/channelml/_importer.py +4 -14
- myokit/formats/cpp/__init__.py +1 -3
- myokit/formats/cpp/_ewriter.py +0 -3
- myokit/formats/cuda/__init__.py +0 -3
- myokit/formats/cuda/_ewriter.py +2 -4
- myokit/formats/cuda/_exporter.py +0 -3
- myokit/formats/easyml/__init__.py +0 -3
- myokit/formats/easyml/_ewriter.py +9 -11
- myokit/formats/easyml/_exporter.py +0 -3
- myokit/formats/html/__init__.py +0 -3
- myokit/formats/html/_exporter.py +0 -3
- myokit/formats/html/_flatten.py +5 -21
- myokit/formats/latex/__init__.py +0 -3
- myokit/formats/latex/_ewriter.py +1 -4
- myokit/formats/latex/_exporter.py +3 -5
- myokit/formats/mathml/__init__.py +0 -3
- myokit/formats/mathml/_ewriter.py +2 -11
- myokit/formats/mathml/_parser.py +3 -5
- myokit/formats/matlab/__init__.py +0 -3
- myokit/formats/matlab/_ewriter.py +1 -4
- myokit/formats/matlab/_exporter.py +0 -3
- myokit/formats/opencl/__init__.py +0 -3
- myokit/formats/opencl/_ewriter.py +2 -4
- myokit/formats/opencl/_exporter.py +0 -3
- myokit/formats/python/__init__.py +0 -3
- myokit/formats/python/_ewriter.py +2 -5
- myokit/formats/python/_exporter.py +0 -3
- myokit/formats/python/template/sim.py +10 -10
- myokit/formats/sbml/__init__.py +0 -3
- myokit/formats/sbml/_api.py +17 -11
- myokit/formats/sbml/_importer.py +1 -4
- myokit/formats/sbml/_parser.py +2 -5
- myokit/formats/stan/__init__.py +0 -3
- myokit/formats/stan/_ewriter.py +2 -4
- myokit/formats/stan/_exporter.py +1 -4
- myokit/formats/sympy/__init__.py +0 -3
- myokit/formats/sympy/_ereader.py +1 -4
- myokit/formats/sympy/_ewriter.py +2 -5
- myokit/formats/wcp/__init__.py +0 -3
- myokit/formats/wcp/_wcp.py +1 -7
- myokit/formats/xml/__init__.py +0 -3
- myokit/formats/xml/_exporter.py +0 -3
- myokit/formats/xml/_split.py +0 -3
- myokit/gui/__init__.py +75 -247
- myokit/gui/datablock_viewer.py +100 -83
- myokit/gui/datalog_viewer.py +32 -44
- myokit/gui/explorer.py +15 -21
- myokit/gui/ide.py +105 -125
- myokit/gui/progress.py +9 -9
- myokit/gui/source.py +405 -374
- myokit/gui/vargrapher.py +2 -12
- myokit/lib/deps.py +7 -8
- myokit/lib/guess.py +1 -2
- myokit/lib/hh.py +5 -7
- myokit/lib/markov.py +9 -11
- myokit/lib/multi.py +1 -3
- myokit/lib/plots.py +1 -3
- myokit/pacing.py +0 -3
- myokit/pype.py +7 -18
- myokit/tests/__init__.py +3 -6
- myokit/tests/ansic_event_based_pacing.py +1 -4
- myokit/tests/ansic_fixed_form_pacing.py +1 -4
- myokit/tests/test_aux.py +9 -23
- myokit/tests/test_cellml_v1_api.py +1 -16
- myokit/tests/test_cellml_v1_parser.py +0 -15
- myokit/tests/test_cellml_v1_writer.py +0 -9
- myokit/tests/test_cellml_v2_api.py +1 -16
- myokit/tests/test_cellml_v2_parser.py +0 -15
- myokit/tests/test_cellml_v2_writer.py +0 -9
- myokit/tests/test_cmodel.py +0 -9
- myokit/tests/test_compiler_detection.py +1 -11
- myokit/tests/test_component.py +0 -10
- myokit/tests/test_config.py +33 -66
- myokit/tests/test_datablock.py +1 -9
- myokit/tests/test_datalog.py +4 -21
- myokit/tests/test_dependency_checking.py +8 -23
- myokit/tests/test_expressions.py +0 -9
- myokit/tests/test_float.py +1 -5
- myokit/tests/test_formats.py +0 -9
- myokit/tests/test_formats_axon.py +1 -9
- myokit/tests/test_formats_cellml.py +0 -15
- myokit/tests/test_formats_channelml.py +0 -15
- myokit/tests/test_formats_easyml.py +0 -14
- myokit/tests/test_formats_exporters.py +1 -16
- myokit/tests/test_formats_expression_writers.py +1 -17
- myokit/tests/test_formats_html.py +0 -3
- myokit/tests/test_formats_importers.py +1 -16
- myokit/tests/test_formats_mathml_content.py +0 -9
- myokit/tests/test_formats_mathml_presentation.py +0 -9
- myokit/tests/test_formats_opencl.py +0 -10
- myokit/tests/test_formats_sbml.py +0 -15
- myokit/tests/test_formats_sympy.py +0 -9
- myokit/tests/test_formats_wcp.py +1 -3
- myokit/tests/test_io.py +6 -14
- myokit/tests/test_jacobian_calculator.py +1 -9
- myokit/tests/test_jacobian_tracer.py +0 -9
- myokit/tests/test_lib_deps.py +0 -9
- myokit/tests/test_lib_guess.py +0 -9
- myokit/tests/test_lib_hh.py +1 -9
- myokit/tests/test_lib_markov.py +1 -9
- myokit/tests/test_lib_multi.py +0 -9
- myokit/tests/test_lib_plots.py +0 -3
- myokit/tests/test_meta.py +0 -3
- myokit/tests/test_model.py +0 -10
- myokit/tests/test_model_building.py +2 -17
- myokit/tests/test_opencl_info.py +5 -14
- myokit/tests/test_pacing_factory.py +0 -3
- myokit/tests/test_pacing_system_c.py +0 -9
- myokit/tests/test_pacing_system_py.py +0 -9
- myokit/tests/test_parsing.py +5 -20
- myokit/tests/test_progress_reporters.py +0 -3
- myokit/tests/test_protocol.py +0 -9
- myokit/tests/test_protocol_floating_point.py +0 -9
- myokit/tests/test_protocol_time_series.py +0 -10
- myokit/tests/test_pype.py +0 -9
- myokit/tests/test_quantity.py +0 -9
- myokit/tests/test_rhs_benchmarker.py +1 -9
- myokit/tests/test_sbml_api.py +0 -15
- myokit/tests/test_sbml_parser.py +0 -15
- myokit/tests/test_simulation_1d.py +1 -10
- myokit/tests/test_simulation_cvodes.py +8 -16
- myokit/tests/test_simulation_cvodes_from_disk.py +0 -3
- myokit/tests/test_simulation_fiber_tissue.py +1 -10
- myokit/tests/test_simulation_log_interval.py +0 -9
- myokit/tests/test_simulation_opencl.py +1 -10
- myokit/tests/test_simulation_opencl_log_interval.py +1 -3
- myokit/tests/test_simulation_opencl_vs_cvode.py +1 -10
- myokit/tests/test_simulation_opencl_vs_sim1d.py +1 -10
- myokit/tests/test_system_info.py +1 -11
- myokit/tests/test_tools.py +0 -9
- myokit/tests/test_unit.py +0 -9
- myokit/tests/test_user_functions.py +0 -10
- myokit/tests/test_variable.py +0 -10
- myokit/tools.py +5 -21
- myokit/units.py +0 -3
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/METADATA +7 -7
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/RECORD +198 -200
- myokit/_exec_new.py +0 -15
- myokit/_exec_old.py +0 -15
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/LICENSE.txt +0 -0
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/WHEEL +0 -0
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/entry_points.txt +0 -0
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/top_level.txt +0 -0
myokit/_sim/mcl.h
CHANGED
|
@@ -67,7 +67,6 @@ static int
|
|
|
67
67
|
mcl_flag2(const char* msg, const cl_int flag)
|
|
68
68
|
{
|
|
69
69
|
char sub[1024];
|
|
70
|
-
char err[2048];
|
|
71
70
|
|
|
72
71
|
if(flag == CL_SUCCESS) {
|
|
73
72
|
return 0;
|
|
@@ -82,164 +81,163 @@ mcl_flag2(const char* msg, const cl_int flag)
|
|
|
82
81
|
switch(flag) {
|
|
83
82
|
// OpenCL 1.0 Errors
|
|
84
83
|
case CL_DEVICE_NOT_FOUND:
|
|
85
|
-
|
|
84
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_DEVICE_NOT_FOUND", sub);
|
|
86
85
|
break;
|
|
87
86
|
case CL_DEVICE_NOT_AVAILABLE:
|
|
88
|
-
|
|
87
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_DEVICE_NOT_AVAILABLE", sub);
|
|
89
88
|
break;
|
|
90
89
|
case CL_COMPILER_NOT_AVAILABLE:
|
|
91
|
-
|
|
90
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_COMPILER_NOT_AVAILABLE", sub);
|
|
92
91
|
break;
|
|
93
92
|
case CL_MEM_OBJECT_ALLOCATION_FAILURE:
|
|
94
|
-
|
|
93
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_MEM_OBJECT_ALLOCATION_FAILURE", sub);
|
|
95
94
|
break;
|
|
96
95
|
case CL_OUT_OF_RESOURCES:
|
|
97
|
-
|
|
96
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_OUT_OF_RESOURCES", sub);
|
|
98
97
|
break;
|
|
99
98
|
case CL_OUT_OF_HOST_MEMORY:
|
|
100
|
-
|
|
99
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_OUT_OF_HOST_MEMORY", sub);
|
|
101
100
|
break;
|
|
102
101
|
case CL_PROFILING_INFO_NOT_AVAILABLE:
|
|
103
|
-
|
|
102
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_PROFILING_INFO_NOT_AVAILABLE", sub);
|
|
104
103
|
break;
|
|
105
104
|
case CL_MEM_COPY_OVERLAP:
|
|
106
|
-
|
|
105
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_MEM_COPY_OVERLAP", sub);
|
|
107
106
|
break;
|
|
108
107
|
case CL_IMAGE_FORMAT_MISMATCH:
|
|
109
|
-
|
|
108
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_IMAGE_FORMAT_MISMATCH", sub);
|
|
110
109
|
break;
|
|
111
110
|
case CL_IMAGE_FORMAT_NOT_SUPPORTED:
|
|
112
|
-
|
|
111
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_IMAGE_FORMAT_NOT_SUPPORTED", sub);
|
|
113
112
|
break;
|
|
114
113
|
case CL_BUILD_PROGRAM_FAILURE:
|
|
115
|
-
|
|
114
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_BUILD_PROGRAM_FAILURE", sub);
|
|
116
115
|
break;
|
|
117
116
|
case CL_MAP_FAILURE:
|
|
118
|
-
|
|
117
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_MAP_FAILURE", sub);
|
|
119
118
|
break;
|
|
120
119
|
case CL_MISALIGNED_SUB_BUFFER_OFFSET:
|
|
121
|
-
|
|
120
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_MISALIGNED_SUB_BUFFER_OFFSET", sub);
|
|
122
121
|
break;
|
|
123
122
|
case CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST:
|
|
124
|
-
|
|
123
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST", sub);
|
|
125
124
|
break;
|
|
126
125
|
case CL_INVALID_VALUE:
|
|
127
|
-
|
|
126
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_VALUE", sub);
|
|
128
127
|
break;
|
|
129
128
|
case CL_INVALID_DEVICE_TYPE:
|
|
130
|
-
|
|
129
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_DEVICE_TYPE", sub);
|
|
131
130
|
break;
|
|
132
131
|
case CL_INVALID_PLATFORM:
|
|
133
|
-
|
|
132
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_PLATFORM", sub);
|
|
134
133
|
break;
|
|
135
134
|
case CL_INVALID_DEVICE:
|
|
136
|
-
|
|
135
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_DEVICE", sub);
|
|
137
136
|
break;
|
|
138
137
|
case CL_INVALID_CONTEXT:
|
|
139
|
-
|
|
138
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_CONTEXT", sub);
|
|
140
139
|
break;
|
|
141
140
|
case CL_INVALID_QUEUE_PROPERTIES:
|
|
142
|
-
|
|
141
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_QUEUE_PROPERTIES", sub);
|
|
143
142
|
break;
|
|
144
143
|
case CL_INVALID_COMMAND_QUEUE:
|
|
145
|
-
|
|
144
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_COMMAND_QUEUE", sub);
|
|
146
145
|
break;
|
|
147
146
|
case CL_INVALID_HOST_PTR:
|
|
148
|
-
|
|
147
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_HOST_PTR", sub);
|
|
149
148
|
break;
|
|
150
149
|
case CL_INVALID_MEM_OBJECT:
|
|
151
|
-
|
|
150
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_MEM_OBJECT", sub);
|
|
152
151
|
break;
|
|
153
152
|
case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR:
|
|
154
|
-
|
|
153
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_IMAGE_FORMAT_DESCRIPTOR", sub);
|
|
155
154
|
break;
|
|
156
155
|
case CL_INVALID_IMAGE_SIZE:
|
|
157
|
-
|
|
156
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_IMAGE_SIZE", sub);
|
|
158
157
|
break;
|
|
159
158
|
case CL_INVALID_SAMPLER:
|
|
160
|
-
|
|
159
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_SAMPLER", sub);
|
|
161
160
|
break;
|
|
162
161
|
case CL_INVALID_BINARY:
|
|
163
|
-
|
|
162
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_BINARY", sub);
|
|
164
163
|
break;
|
|
165
164
|
case CL_INVALID_BUILD_OPTIONS:
|
|
166
|
-
|
|
165
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_BUILD_OPTIONS", sub);
|
|
167
166
|
break;
|
|
168
167
|
case CL_INVALID_PROGRAM:
|
|
169
|
-
|
|
168
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_PROGRAM", sub);
|
|
170
169
|
break;
|
|
171
170
|
case CL_INVALID_PROGRAM_EXECUTABLE:
|
|
172
|
-
|
|
171
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_PROGRAM_EXECUTABLE", sub);
|
|
173
172
|
break;
|
|
174
173
|
case CL_INVALID_KERNEL_NAME:
|
|
175
|
-
|
|
174
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_KERNEL_NAME", sub);
|
|
176
175
|
break;
|
|
177
176
|
case CL_INVALID_KERNEL_DEFINITION:
|
|
178
|
-
|
|
177
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_KERNEL_DEFINITION", sub);
|
|
179
178
|
break;
|
|
180
179
|
case CL_INVALID_KERNEL:
|
|
181
|
-
|
|
180
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_KERNEL", sub);
|
|
182
181
|
break;
|
|
183
182
|
case CL_INVALID_ARG_INDEX:
|
|
184
|
-
|
|
183
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_ARG_INDEX", sub);
|
|
185
184
|
break;
|
|
186
185
|
case CL_INVALID_ARG_VALUE:
|
|
187
|
-
|
|
186
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_ARG_VALUE", sub);
|
|
188
187
|
break;
|
|
189
188
|
case CL_INVALID_ARG_SIZE:
|
|
190
|
-
|
|
189
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_ARG_SIZE", sub);
|
|
191
190
|
break;
|
|
192
191
|
case CL_INVALID_KERNEL_ARGS:
|
|
193
|
-
|
|
192
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_KERNEL_ARGS", sub);
|
|
194
193
|
break;
|
|
195
194
|
case CL_INVALID_WORK_DIMENSION:
|
|
196
|
-
|
|
195
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_WORK_DIMENSION", sub);
|
|
197
196
|
break;
|
|
198
197
|
case CL_INVALID_WORK_GROUP_SIZE:
|
|
199
|
-
|
|
198
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_WORK_GROUP_SIZE", sub);
|
|
200
199
|
break;
|
|
201
200
|
case CL_INVALID_WORK_ITEM_SIZE:
|
|
202
|
-
|
|
201
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_WORK_ITEM_SIZE", sub);
|
|
203
202
|
break;
|
|
204
203
|
case CL_INVALID_GLOBAL_OFFSET:
|
|
205
|
-
|
|
204
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_GLOBAL_OFFSET", sub);
|
|
206
205
|
break;
|
|
207
206
|
case CL_INVALID_EVENT_WAIT_LIST:
|
|
208
|
-
|
|
207
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_EVENT_WAIT_LIST", sub);
|
|
209
208
|
break;
|
|
210
209
|
case CL_INVALID_EVENT:
|
|
211
|
-
|
|
210
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_EVENT", sub);
|
|
212
211
|
break;
|
|
213
212
|
case CL_INVALID_OPERATION:
|
|
214
|
-
|
|
213
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_OPERATION", sub);
|
|
215
214
|
break;
|
|
216
215
|
case CL_INVALID_GL_OBJECT:
|
|
217
|
-
|
|
216
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_GL_OBJECT", sub);
|
|
218
217
|
break;
|
|
219
218
|
case CL_INVALID_BUFFER_SIZE:
|
|
220
|
-
|
|
219
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_BUFFER_SIZE", sub);
|
|
221
220
|
break;
|
|
222
221
|
case CL_INVALID_MIP_LEVEL:
|
|
223
|
-
|
|
222
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_MIP_LEVEL", sub);
|
|
224
223
|
break;
|
|
225
224
|
case CL_INVALID_GLOBAL_WORK_SIZE:
|
|
226
|
-
|
|
225
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_GLOBAL_WORK_SIZE", sub);
|
|
227
226
|
break;
|
|
228
227
|
case CL_INVALID_PROPERTY:
|
|
229
|
-
|
|
228
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_INVALID_PROPERTY", sub);
|
|
230
229
|
break;
|
|
231
230
|
// OpenCL 1.1 etc. codes can not be assumed to be defined
|
|
232
231
|
// Might be good to have ifdefs or something
|
|
233
232
|
// OpenCL extensions
|
|
234
233
|
case -1001: // CL_PLATFORM_NOT_FOUND_KHR
|
|
235
|
-
|
|
234
|
+
PyErr_Format(PyExc_Exception, "OpenCL error%s: CL_PLATFORM_NOT_FOUND_KHR", sub);
|
|
236
235
|
break;
|
|
237
236
|
// Unknown error
|
|
238
237
|
default:
|
|
239
|
-
|
|
238
|
+
PyErr_Format(PyExc_Exception, "Unknown OpenCL error%s: %i", sub, (int)flag);
|
|
240
239
|
break;
|
|
241
240
|
};
|
|
242
|
-
PyErr_SetString(PyExc_Exception, err);
|
|
243
241
|
return 1;
|
|
244
242
|
}
|
|
245
243
|
|
myokit/_sim/opencl.py
CHANGED
|
@@ -4,24 +4,14 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
7
|
+
import configparser
|
|
10
8
|
import os
|
|
11
|
-
import myokit
|
|
12
|
-
|
|
13
|
-
try:
|
|
14
|
-
# Python2
|
|
15
|
-
from ConfigParser import ConfigParser
|
|
16
|
-
except ImportError:
|
|
17
|
-
# Python 3
|
|
18
|
-
from configparser import RawConfigParser as ConfigParser
|
|
19
9
|
|
|
10
|
+
import myokit
|
|
20
11
|
|
|
21
12
|
# Settings file
|
|
22
13
|
SETTINGS_FILE = os.path.join(myokit.DIR_USER, 'preferred-opencl-device.ini')
|
|
23
14
|
|
|
24
|
-
|
|
25
15
|
# Location of C source for OpenCL info module
|
|
26
16
|
SOURCE_FILE = 'opencl.c'
|
|
27
17
|
|
|
@@ -41,7 +31,7 @@ class OpenCL(myokit.CModule):
|
|
|
41
31
|
_message = None
|
|
42
32
|
|
|
43
33
|
def __init__(self):
|
|
44
|
-
super(
|
|
34
|
+
super().__init__()
|
|
45
35
|
# Create back-end and cache it
|
|
46
36
|
OpenCL._index += 1
|
|
47
37
|
mname = 'myokit_opencl_info_' + str(OpenCL._index)
|
|
@@ -165,11 +155,8 @@ class OpenCL(myokit.CModule):
|
|
|
165
155
|
# Read ini file
|
|
166
156
|
inifile = os.path.expanduser(SETTINGS_FILE)
|
|
167
157
|
if os.path.isfile(inifile):
|
|
168
|
-
config =
|
|
169
|
-
|
|
170
|
-
config.read(inifile, encoding='ascii') # Python 3
|
|
171
|
-
except TypeError: # pragma: no python 3 cover
|
|
172
|
-
config.read(inifile)
|
|
158
|
+
config = configparser.RawConfigParser()
|
|
159
|
+
config.read(inifile, encoding='ascii')
|
|
173
160
|
|
|
174
161
|
def get(section, option):
|
|
175
162
|
x = None
|
|
@@ -205,7 +192,7 @@ class OpenCL(myokit.CModule):
|
|
|
205
192
|
device = device.encode('ascii').decode('ascii')
|
|
206
193
|
|
|
207
194
|
# Create configuration
|
|
208
|
-
config =
|
|
195
|
+
config = configparser.RawConfigParser()
|
|
209
196
|
config.add_section('selection')
|
|
210
197
|
if platform:
|
|
211
198
|
config.set('selection', 'platform', platform)
|
|
@@ -271,7 +258,7 @@ class OpenCL(myokit.CModule):
|
|
|
271
258
|
'''
|
|
272
259
|
|
|
273
260
|
|
|
274
|
-
class OpenCLInfo
|
|
261
|
+
class OpenCLInfo:
|
|
275
262
|
"""
|
|
276
263
|
Represents information about the available OpenCL platforms and devices.
|
|
277
264
|
|
|
@@ -299,7 +286,7 @@ class OpenCLInfo(object):
|
|
|
299
286
|
return '\n'.join(b)
|
|
300
287
|
|
|
301
288
|
|
|
302
|
-
class OpenCLPlatformInfo
|
|
289
|
+
class OpenCLPlatformInfo:
|
|
303
290
|
"""
|
|
304
291
|
Represents information about an OpenCL platform.
|
|
305
292
|
|
|
@@ -376,7 +363,7 @@ class OpenCLPlatformInfo(object):
|
|
|
376
363
|
return extension in self.extensions
|
|
377
364
|
|
|
378
365
|
|
|
379
|
-
class OpenCLDeviceInfo
|
|
366
|
+
class OpenCLDeviceInfo:
|
|
380
367
|
"""
|
|
381
368
|
Represents information about an OpenCL device.
|
|
382
369
|
|
myokit/_sim/openclsim.c
CHANGED
|
@@ -515,9 +515,7 @@ sim_init(PyObject* self, PyObject* args)
|
|
|
515
515
|
for(i=0; i<nx * ny * n_state; i++) {
|
|
516
516
|
flt = PyList_GetItem(state_in, (Py_ssize_t)i); // Don't decref!
|
|
517
517
|
if(!PyFloat_Check(flt)) {
|
|
518
|
-
|
|
519
|
-
sprintf(errstr, "Item %u in state vector is not a float.", (unsigned int)i);
|
|
520
|
-
PyErr_SetString(PyExc_Exception, errstr);
|
|
518
|
+
PyErr_Format(PyExc_Exception, "Item %u in state vector is not a float.", (unsigned int)i);
|
|
521
519
|
return sim_clean();
|
|
522
520
|
}
|
|
523
521
|
rvec_state[i] = (Real)PyFloat_AsDouble(flt);
|
|
@@ -552,9 +550,7 @@ sim_init(PyObject* self, PyObject* args)
|
|
|
552
550
|
for(i=0; i<n_field_data; i++) {
|
|
553
551
|
flt = PyList_GetItem(field_data, (Py_ssize_t)i); // No need to decref
|
|
554
552
|
if(!PyFloat_Check(flt)) {
|
|
555
|
-
|
|
556
|
-
sprintf(errstr, "Item %u in field data is not a float.", (unsigned int)i);
|
|
557
|
-
PyErr_SetString(PyExc_Exception, errstr);
|
|
553
|
+
PyErr_Format(PyExc_Exception, "Item %u in field data is not a float.", (unsigned int)i);
|
|
558
554
|
return sim_clean();
|
|
559
555
|
}
|
|
560
556
|
rvec_field_data[i] = (Real)PyFloat_AsDouble(flt);
|
myokit/_sim/openclsim.py
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import os
|
|
12
|
-
import myokit
|
|
13
|
-
import numpy as np
|
|
14
9
|
import platform
|
|
10
|
+
|
|
15
11
|
from collections import OrderedDict
|
|
16
12
|
|
|
13
|
+
import numpy as np
|
|
14
|
+
|
|
15
|
+
import myokit
|
|
16
|
+
|
|
17
17
|
|
|
18
18
|
# Location of C and OpenCL sources
|
|
19
19
|
SOURCE_FILE = 'openclsim.c'
|
|
@@ -148,7 +148,7 @@ class SimulationOpenCL(myokit.CModule):
|
|
|
148
148
|
def __init__(
|
|
149
149
|
self, model, protocol=None, ncells=256, diffusion=True,
|
|
150
150
|
precision=myokit.SINGLE_PRECISION, native_maths=False, rl=False):
|
|
151
|
-
super(
|
|
151
|
+
super().__init__()
|
|
152
152
|
|
|
153
153
|
# Require a valid model
|
|
154
154
|
if not model.is_valid():
|
myokit/_sim/pacing.h
CHANGED
|
@@ -353,9 +353,7 @@ ESys_Populate(ESys sys, PyObject* protocol)
|
|
|
353
353
|
if (protocol != Py_None) {
|
|
354
354
|
|
|
355
355
|
// Get PyList from protocol (will need to decref!)
|
|
356
|
-
|
|
357
|
-
// This should have been const char* and has been fixed in python 3
|
|
358
|
-
PyObject* list = PyObject_CallMethod(protocol, (char*)"events", NULL); // Returns a new reference
|
|
356
|
+
PyObject* list = PyObject_CallMethod(protocol, "events", NULL); // Returns a new reference
|
|
359
357
|
if(list == NULL) return ESys_POPULATE_INVALID_PROTOCOL;
|
|
360
358
|
if(!PyList_Check(list)) {
|
|
361
359
|
Py_DECREF(list);
|
|
@@ -766,9 +764,7 @@ FSys_Populate(FSys sys, PyObject* protocol)
|
|
|
766
764
|
if (protocol == Py_None) return FSys_POPULATE_INVALID_PROTOCOL;
|
|
767
765
|
|
|
768
766
|
// Get PyList from protocol (will need to decref!)
|
|
769
|
-
|
|
770
|
-
// This should have been const char* and has been fixed in python 3
|
|
771
|
-
times_list = PyObject_CallMethod(protocol, (char*)"times", NULL); // Returns a new reference
|
|
767
|
+
times_list = PyObject_CallMethod(protocol, "times", NULL); // Returns a new reference
|
|
772
768
|
if(times_list == NULL) return FSys_POPULATE_INVALID_PROTOCOL;
|
|
773
769
|
if(!PyList_Check(times_list)) {
|
|
774
770
|
Py_DECREF(times_list);
|
myokit/_sim/rhs.c
CHANGED
|
@@ -135,15 +135,12 @@ log_extract(PyObject* data, const char* name, const int position, double* var)
|
|
|
135
135
|
PyObject* key;
|
|
136
136
|
PyObject* list;
|
|
137
137
|
PyObject* item;
|
|
138
|
-
char errstr[1000];
|
|
139
138
|
|
|
140
139
|
// Get sequence from dict
|
|
141
140
|
key = PyUnicode_FromString(name);
|
|
142
141
|
if (!PyDict_Contains(data, key)) {
|
|
143
142
|
Py_DECREF(key);
|
|
144
|
-
|
|
145
|
-
sprintf(errstr, "Variable %s not found in log.", name);
|
|
146
|
-
PyErr_SetString(PyExc_Exception, errstr);
|
|
143
|
+
PyErr_Format(PyExc_Exception, "Variable %s not found in log.", name);
|
|
147
144
|
return 0;
|
|
148
145
|
}
|
|
149
146
|
list = PyDict_GetItem(data, key); // Borrowed ref, don't decref
|
|
@@ -154,9 +151,7 @@ log_extract(PyObject* data, const char* name, const int position, double* var)
|
|
|
154
151
|
item = PySequence_GetItem(list, position); // New reference, decref
|
|
155
152
|
if (item == NULL) {
|
|
156
153
|
Py_DECREF(key);
|
|
157
|
-
|
|
158
|
-
sprintf(errstr, "No item found at position %i of log for %s.", position, name);
|
|
159
|
-
PyErr_SetString(PyExc_Exception, errstr);
|
|
154
|
+
PyErr_Format(PyExc_Exception, "No item found at position %i of log for %s.", position, name);
|
|
160
155
|
return 0;
|
|
161
156
|
}
|
|
162
157
|
Py_DECREF(key);
|
|
@@ -164,9 +159,7 @@ log_extract(PyObject* data, const char* name, const int position, double* var)
|
|
|
164
159
|
// Get double from float
|
|
165
160
|
if (!PyFloat_Check(item)) {
|
|
166
161
|
Py_XDECREF(item);
|
|
167
|
-
|
|
168
|
-
sprintf(errstr, "Log for %s can only contain floats (error at index %i).", name, position);
|
|
169
|
-
PyErr_SetString(PyExc_Exception, errstr);
|
|
162
|
+
PyErr_Format(PyExc_Exception, "Log for %s can only contain floats (error at index %i).", name, position);
|
|
170
163
|
return 0;
|
|
171
164
|
}
|
|
172
165
|
|
myokit/_sim/rhs.py
CHANGED
|
@@ -4,20 +4,11 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
import os
|
|
11
|
-
import timeit
|
|
12
|
-
import myokit
|
|
13
8
|
import platform
|
|
9
|
+
import timeit
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
try:
|
|
17
|
-
basestring
|
|
18
|
-
except NameError: # pragma: no cover
|
|
19
|
-
basestring = str
|
|
20
|
-
|
|
11
|
+
import myokit
|
|
21
12
|
|
|
22
13
|
# Location of C source file
|
|
23
14
|
SOURCE_FILE = 'rhs.c'
|
|
@@ -42,7 +33,7 @@ class RhsBenchmarker(myokit.CModule):
|
|
|
42
33
|
_index = 0 # Unique id for the generated module
|
|
43
34
|
|
|
44
35
|
def __init__(self, model, variables=None, exclude_selected=False):
|
|
45
|
-
super(
|
|
36
|
+
super().__init__()
|
|
46
37
|
|
|
47
38
|
# Require a valid model
|
|
48
39
|
model.validate()
|
|
@@ -201,7 +192,7 @@ class RhsBenchmarker(myokit.CModule):
|
|
|
201
192
|
else:
|
|
202
193
|
self._variables = set()
|
|
203
194
|
for var in variables:
|
|
204
|
-
if isinstance(var,
|
|
195
|
+
if isinstance(var, str):
|
|
205
196
|
# String? Then get variable from model
|
|
206
197
|
var = self._model.get(var)
|
|
207
198
|
else:
|
myokit/_sim/sundials.py
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
7
|
import os
|
|
11
8
|
|
|
12
9
|
import myokit
|
|
@@ -32,7 +29,7 @@ class Sundials(myokit.CModule):
|
|
|
32
29
|
_version = None
|
|
33
30
|
|
|
34
31
|
def __init__(self):
|
|
35
|
-
super(
|
|
32
|
+
super().__init__()
|
|
36
33
|
# Create and cache back-end
|
|
37
34
|
Sundials._index += 1
|
|
38
35
|
|
myokit/_system.py
CHANGED
|
@@ -4,13 +4,10 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
7
|
+
import importlib
|
|
10
8
|
import os
|
|
11
|
-
import sys
|
|
12
9
|
import platform
|
|
13
|
-
import
|
|
10
|
+
import sys
|
|
14
11
|
|
|
15
12
|
import myokit
|
|
16
13
|
|
|
@@ -28,7 +25,7 @@ def system(live_printing=False):
|
|
|
28
25
|
out = []
|
|
29
26
|
else:
|
|
30
27
|
# Create fake list interface that just prints
|
|
31
|
-
class Out
|
|
28
|
+
class Out:
|
|
32
29
|
def append(self, x):
|
|
33
30
|
print(x)
|
|
34
31
|
|
|
@@ -68,25 +65,22 @@ def system(live_printing=False):
|
|
|
68
65
|
out.append('== GUI ==')
|
|
69
66
|
|
|
70
67
|
try: # pragma: no cover
|
|
71
|
-
from
|
|
72
|
-
out.append('
|
|
68
|
+
from PyQt6.QtCore import QT_VERSION_STR
|
|
69
|
+
out.append('PyQt6: ' + QT_VERSION_STR)
|
|
73
70
|
out.append(' Sip: ' + _module_version('sip'))
|
|
74
71
|
del QT_VERSION_STR
|
|
75
72
|
except ImportError:
|
|
76
|
-
out.append('
|
|
73
|
+
out.append('PyQt6: Not found')
|
|
77
74
|
|
|
78
75
|
try: # pragma: no cover
|
|
79
|
-
from
|
|
80
|
-
out.append('
|
|
76
|
+
from PyQt5.QtCore import QT_VERSION_STR
|
|
77
|
+
out.append('PyQt5: ' + QT_VERSION_STR)
|
|
81
78
|
out.append(' Sip: ' + _module_version('sip'))
|
|
82
79
|
del QT_VERSION_STR
|
|
83
80
|
except ImportError:
|
|
84
|
-
out.append('
|
|
85
|
-
except RuntimeError: # pragma: no cover
|
|
86
|
-
# Happens if PyQt5 was also found
|
|
87
|
-
out.append('PyQt4: OK')
|
|
81
|
+
out.append('PyQt5: Not found')
|
|
88
82
|
|
|
89
|
-
out.append('
|
|
83
|
+
out.append('PySide6: ' + _module_version('PySide6'))
|
|
90
84
|
out.append('PySide2: ' + _module_version('PySide2'))
|
|
91
85
|
out.append('')
|
|
92
86
|
|
myokit/_unit.py
CHANGED
|
@@ -5,21 +5,12 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
from __future__ import absolute_import, division
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
8
|
import math
|
|
12
9
|
|
|
13
10
|
import myokit
|
|
14
11
|
|
|
15
|
-
# Strings in Python 2 and 3
|
|
16
|
-
try:
|
|
17
|
-
basestring
|
|
18
|
-
except NameError: # pragma: no python 2 cover
|
|
19
|
-
basestring = str
|
|
20
|
-
|
|
21
12
|
|
|
22
|
-
class Unit
|
|
13
|
+
class Unit:
|
|
23
14
|
"""
|
|
24
15
|
Represents a unit.
|
|
25
16
|
|
|
@@ -522,7 +513,7 @@ class Unit(object):
|
|
|
522
513
|
preferred representation format.
|
|
523
514
|
|
|
524
515
|
"""
|
|
525
|
-
if not isinstance(name,
|
|
516
|
+
if not isinstance(name, str):
|
|
526
517
|
raise TypeError('Given name must be a string.')
|
|
527
518
|
if not isinstance(unit, Unit):
|
|
528
519
|
raise TypeError('Given unit must be myokit.Unit')
|
|
@@ -679,7 +670,7 @@ class Unit(object):
|
|
|
679
670
|
self._m - other._m)
|
|
680
671
|
|
|
681
672
|
|
|
682
|
-
class Quantity
|
|
673
|
+
class Quantity:
|
|
683
674
|
"""
|
|
684
675
|
Represents a quantity with a :class:`unit <myokit.Unit>`. Can be used to
|
|
685
676
|
perform unit-safe arithmetic.
|
myokit/float.py
CHANGED
myokit/formats/__init__.py
CHANGED
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
# This file is part of Myokit.
|
|
5
5
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
6
6
|
#
|
|
7
|
-
from __future__ import absolute_import, division
|
|
8
|
-
from __future__ import print_function, unicode_literals
|
|
9
|
-
|
|
10
|
-
import myokit
|
|
11
7
|
import os
|
|
12
8
|
import sys
|
|
13
9
|
import traceback
|
|
14
10
|
import warnings
|
|
15
11
|
|
|
12
|
+
import myokit
|
|
13
|
+
|
|
16
14
|
# Constants
|
|
17
15
|
DIR_FORMATS = os.path.join(myokit.DIR_MYOKIT, 'formats')
|
|
18
16
|
|
|
@@ -23,12 +21,12 @@ _EWRITERS = None
|
|
|
23
21
|
|
|
24
22
|
|
|
25
23
|
# Classes & methods
|
|
26
|
-
class Exporter
|
|
24
|
+
class Exporter:
|
|
27
25
|
"""
|
|
28
26
|
Abstract base class for exporters.
|
|
29
27
|
"""
|
|
30
28
|
def __init__(self):
|
|
31
|
-
super(
|
|
29
|
+
super().__init__()
|
|
32
30
|
|
|
33
31
|
def post_export_info(self):
|
|
34
32
|
"""
|
|
@@ -106,7 +104,7 @@ def exporters():
|
|
|
106
104
|
return sorted(_EXPORTERS.keys())
|
|
107
105
|
|
|
108
106
|
|
|
109
|
-
class ExpressionWriter
|
|
107
|
+
class ExpressionWriter:
|
|
110
108
|
"""
|
|
111
109
|
Base class for expression writers, that take myokit expressions as input
|
|
112
110
|
and convert them to text or other formats.
|
|
@@ -322,12 +320,12 @@ def ewriters():
|
|
|
322
320
|
return sorted(_EWRITERS.keys())
|
|
323
321
|
|
|
324
322
|
|
|
325
|
-
class Importer
|
|
323
|
+
class Importer:
|
|
326
324
|
"""
|
|
327
325
|
Abstract base class for importers.
|
|
328
326
|
"""
|
|
329
327
|
def __init__(self):
|
|
330
|
-
super(
|
|
328
|
+
super().__init__()
|
|
331
329
|
|
|
332
330
|
def component(self, path, model):
|
|
333
331
|
"""
|
|
@@ -411,7 +409,7 @@ class TemplatedRunnableExporter(Exporter):
|
|
|
411
409
|
protocol) into a runnable chunk of code.
|
|
412
410
|
"""
|
|
413
411
|
def __init__(self):
|
|
414
|
-
super(
|
|
412
|
+
super().__init__()
|
|
415
413
|
|
|
416
414
|
def runnable(self, path, model, protocol=None, *args):
|
|
417
415
|
"""
|