Skip to content

Commit 8f7d514

Browse files
committed
Address comments
1 parent 2e0142d commit 8f7d514

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

python/CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**Features**
66

7-
- Add ``TreeSequence.individual_nodes`` method to return the nodes
7+
- Add ``TreeSequence.individual_nodes`` attribute to return the nodes
88
associated with each individual as a numpy array.
99
(:user:`benjeffery`, :pr:`3153`)
1010

python/_tskitmodule.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8731,11 +8731,12 @@ TreeSequence_get_individuals_nodes(TreeSequence *self)
87318731
PyArrayObject *ret_array = NULL;
87328732
npy_intp dims[2];
87338733
tsk_size_t num_individuals;
8734+
tsk_size_t ploidy;
87348735
tsk_size_t max_ploidy = 0;
87358736
tsk_id_t *node_mem;
87368737
tsk_size_t j;
8737-
tsk_id_t **individual_nodes;
8738-
tsk_size_t *individual_nodes_length;
8738+
const tsk_id_t **individual_nodes;
8739+
const tsk_size_t *individual_nodes_length;
87398740

87408741
if (TreeSequence_check_state(self) != 0) {
87418742
goto out;
@@ -8747,7 +8748,7 @@ TreeSequence_get_individuals_nodes(TreeSequence *self)
87478748
individual_nodes_length = self->tree_sequence->individual_nodes_length;
87488749

87498750
for (tsk_id_t i = 0; i < (tsk_id_t)num_individuals; i++) {
8750-
tsk_size_t ploidy = individual_nodes_length[i];
8751+
ploidy = individual_nodes_length[i];
87518752
if (ploidy > max_ploidy) {
87528753
max_ploidy = ploidy;
87538754
}
@@ -8765,7 +8766,7 @@ TreeSequence_get_individuals_nodes(TreeSequence *self)
87658766
memset(node_mem, 0xFF, PyArray_NBYTES(ret_array));
87668767

87678768
for (tsk_id_t i = 0; i < (tsk_id_t)num_individuals; i++) {
8768-
tsk_size_t ploidy = individual_nodes_length[i];
8769+
ploidy = individual_nodes_length[i];
87698770
for (j = 0; j < ploidy; j++) {
87708771
node_mem[i * max_ploidy + j] = individual_nodes[i][j];
87718772
}

0 commit comments

Comments
 (0)