|
36 | 36 | #define NPY_NO_DEPRECATED_API NPY_2_0_API_VERSION |
37 | 37 | #undef NPY_FEATURE_VERSION |
38 | 38 | #define NPY_FEATURE_VERSION NPY_2_0_API_VERSION |
39 | | -#define HAVE_NUMPY_2 1 |
| 39 | +#define HAVE_NUMPY_2 1 |
40 | 40 | #else |
41 | 41 | #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION |
42 | | -#define HAVE_NUMPY_2 0 |
| 42 | +#define HAVE_NUMPY_2 0 |
43 | 43 | #endif |
44 | 44 | #include <numpy/arrayobject.h> |
45 | 45 |
|
|
49 | 49 | #include "kastore.h" |
50 | 50 | #include "tskit.h" |
51 | 51 |
|
52 | | -#define SET_COLS 0 |
| 52 | +#define SET_COLS 0 |
53 | 53 | #define APPEND_COLS 1 |
54 | 54 |
|
55 | 55 | /* TskitException is the superclass of all exceptions that can be thrown by |
@@ -6216,15 +6216,11 @@ TreeSequence_decode_alignments(TreeSequence *self, PyObject *args, PyObject *kwd |
6216 | 6216 | } |
6217 | 6217 | buf = PyBytes_AS_STRING(buf_obj); |
6218 | 6218 |
|
6219 | | - // clang-format off |
6220 | | - Py_BEGIN_ALLOW_THREADS |
6221 | | - err = tsk_treeseq_decode_alignments(self->tree_sequence, |
6222 | | - ref_seq, (tsk_size_t) ref_len, nodes, num_nodes, left, right, missing_char, buf, |
6223 | | - options); |
| 6219 | + Py_BEGIN_ALLOW_THREADS |
| 6220 | + err = tsk_treeseq_decode_alignments(self->tree_sequence, ref_seq, |
| 6221 | + (tsk_size_t) ref_len, nodes, num_nodes, left, right, missing_char, buf, options); |
6224 | 6222 | Py_END_ALLOW_THREADS |
6225 | | - // clang-format on |
6226 | | - if (err != 0) |
6227 | | - { |
| 6223 | + if (err != 0) { |
6228 | 6224 | handle_library_error(err); |
6229 | 6225 | goto out; |
6230 | 6226 | } |
@@ -6337,11 +6333,12 @@ TreeSequence_genealogical_nearest_neighbours( |
6337 | 6333 | goto out; |
6338 | 6334 | } |
6339 | 6335 |
|
6340 | | - Py_BEGIN_ALLOW_THREADS err = tsk_treeseq_genealogical_nearest_neighbours( |
6341 | | - self->tree_sequence, PyArray_DATA(focal_array), num_focal, reference_sets, |
6342 | | - reference_set_size, num_reference_sets, 0, PyArray_DATA(ret_array)); |
6343 | | - Py_END_ALLOW_THREADS if (err != 0) |
6344 | | - { |
| 6336 | + Py_BEGIN_ALLOW_THREADS |
| 6337 | + err = tsk_treeseq_genealogical_nearest_neighbours(self->tree_sequence, |
| 6338 | + PyArray_DATA(focal_array), num_focal, reference_sets, reference_set_size, |
| 6339 | + num_reference_sets, 0, PyArray_DATA(ret_array)); |
| 6340 | + Py_END_ALLOW_THREADS |
| 6341 | + if (err != 0) { |
6345 | 6342 | handle_library_error(err); |
6346 | 6343 | goto out; |
6347 | 6344 | } |
@@ -6457,11 +6454,11 @@ TreeSequence_mean_descendants(TreeSequence *self, PyObject *args, PyObject *kwds |
6457 | 6454 | goto out; |
6458 | 6455 | } |
6459 | 6456 |
|
6460 | | - Py_BEGIN_ALLOW_THREADS err |
6461 | | - = tsk_treeseq_mean_descendants(self->tree_sequence, reference_sets, |
6462 | | - reference_set_size, num_reference_sets, 0, PyArray_DATA(ret_array)); |
6463 | | - Py_END_ALLOW_THREADS if (err != 0) |
6464 | | - { |
| 6457 | + Py_BEGIN_ALLOW_THREADS |
| 6458 | + err = tsk_treeseq_mean_descendants(self->tree_sequence, reference_sets, |
| 6459 | + reference_set_size, num_reference_sets, 0, PyArray_DATA(ret_array)); |
| 6460 | + Py_END_ALLOW_THREADS |
| 6461 | + if (err != 0) { |
6465 | 6462 | handle_library_error(err); |
6466 | 6463 | goto out; |
6467 | 6464 | } |
@@ -7265,12 +7262,12 @@ TreeSequence_weighted_stat_vector_method( |
7265 | 7262 | if (result_array == NULL) { |
7266 | 7263 | goto out; |
7267 | 7264 | } |
7268 | | - Py_BEGIN_ALLOW_THREADS err |
7269 | | - = method(self->tree_sequence, w_shape[1], PyArray_DATA(weights_array), |
7270 | | - num_windows, PyArray_DATA(windows_array), num_focal_nodes, |
7271 | | - PyArray_DATA(focal_nodes_array), PyArray_DATA(result_array), options); |
7272 | | - Py_END_ALLOW_THREADS if (err != 0) |
7273 | | - { |
| 7265 | + Py_BEGIN_ALLOW_THREADS |
| 7266 | + err = method(self->tree_sequence, w_shape[1], PyArray_DATA(weights_array), |
| 7267 | + num_windows, PyArray_DATA(windows_array), num_focal_nodes, |
| 7268 | + PyArray_DATA(focal_nodes_array), PyArray_DATA(result_array), options); |
| 7269 | + Py_END_ALLOW_THREADS |
| 7270 | + if (err != 0) { |
7274 | 7271 | handle_library_error(err); |
7275 | 7272 | goto out; |
7276 | 7273 | } |
@@ -7492,18 +7489,12 @@ TreeSequence_divergence_matrix(TreeSequence *self, PyObject *args, PyObject *kwd |
7492 | 7489 | options |= TSK_STAT_SPAN_NORMALISE; |
7493 | 7490 | } |
7494 | 7491 |
|
7495 | | - // clang-format off |
7496 | 7492 | Py_BEGIN_ALLOW_THREADS |
7497 | | - err = tsk_treeseq_divergence_matrix( |
7498 | | - self->tree_sequence, |
7499 | | - num_sample_sets, sample_set_sizes, sample_sets, |
7500 | | - num_windows, PyArray_DATA(windows_array), |
7501 | | - options, PyArray_DATA(result_array)); |
| 7493 | + err = tsk_treeseq_divergence_matrix(self->tree_sequence, num_sample_sets, |
| 7494 | + sample_set_sizes, sample_sets, num_windows, PyArray_DATA(windows_array), options, |
| 7495 | + PyArray_DATA(result_array)); |
7502 | 7496 | Py_END_ALLOW_THREADS |
7503 | | - // clang-format on |
7504 | | - /* Clang-format insists on doing this in spite of the "off" instruction above */ |
7505 | | - if (err != 0) |
7506 | | - { |
| 7497 | + if (err != 0) { |
7507 | 7498 | handle_library_error(err); |
7508 | 7499 | goto out; |
7509 | 7500 | } |
@@ -8035,17 +8026,13 @@ TreeSequence_ld_matrix(TreeSequence *self, PyObject *args, PyObject *kwds, |
8035 | 8026 | goto out; |
8036 | 8027 | } |
8037 | 8028 |
|
8038 | | - // clang-format off |
8039 | 8029 | Py_BEGIN_ALLOW_THREADS |
8040 | 8030 | err = method(self->tree_sequence, num_sample_sets, |
8041 | 8031 | PyArray_DATA(sample_set_sizes_array), PyArray_DATA(sample_sets_array), |
8042 | 8032 | result_dim[0], row_sites_parsed, row_positions_parsed, result_dim[1], |
8043 | 8033 | col_sites_parsed, col_positions_parsed, options, PyArray_DATA(result_matrix)); |
8044 | 8034 | Py_END_ALLOW_THREADS |
8045 | | - // clang-format on |
8046 | | - |
8047 | | - if (err != 0) |
8048 | | - { |
| 8035 | + if (err != 0) { |
8049 | 8036 | handle_library_error(err); |
8050 | 8037 | goto out; |
8051 | 8038 | } |
@@ -8218,17 +8205,14 @@ TreeSequence_k_way_ld_matrix(TreeSequence *self, PyObject *args, PyObject *kwds, |
8218 | 8205 | goto out; |
8219 | 8206 | } |
8220 | 8207 |
|
8221 | | - // clang-format off |
8222 | 8208 | Py_BEGIN_ALLOW_THREADS |
8223 | 8209 | err = method(self->tree_sequence, num_sample_sets, |
8224 | 8210 | PyArray_DATA(sample_set_sizes_array), PyArray_DATA(sample_sets_array), |
8225 | 8211 | num_set_index_tuples, PyArray_DATA(indexes_array), result_dim[0], |
8226 | 8212 | row_sites_parsed, row_positions_parsed, result_dim[1], col_sites_parsed, |
8227 | 8213 | col_positions_parsed, options, PyArray_DATA(result_matrix)); |
8228 | 8214 | Py_END_ALLOW_THREADS |
8229 | | - // clang-format on |
8230 | | - if (err != 0) |
8231 | | - { |
| 8215 | + if (err != 0) { |
8232 | 8216 | handle_library_error(err); |
8233 | 8217 | goto out; |
8234 | 8218 | } |
|
0 commit comments