Skip to content

Commit f78216c

Browse files
timothymillarpentschev
authored andcommitted
Use .data property in diversity and Tajimas_D methods to avoid type error sgkit-dev#638
1 parent 95031ca commit f78216c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sgkit/stats/popgen.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def diversity(
124124
{
125125
variables.stat_diversity: (
126126
("variants", "cohorts"),
127-
pi,
127+
pi.data,
128128
)
129129
}
130130
)
@@ -604,10 +604,12 @@ def Tajimas_D(
604604
D = d / d_stdev[:, np.newaxis]
605605

606606
if has_windows(ds):
607-
new_ds = create_dataset({variables.stat_Tajimas_D: (["windows", "cohorts"], D)})
607+
new_ds = create_dataset(
608+
{variables.stat_Tajimas_D: (["windows", "cohorts"], D.data)}
609+
)
608610
else:
609611
new_ds = create_dataset(
610-
{variables.stat_Tajimas_D: (["variants", "cohorts"], D)}
612+
{variables.stat_Tajimas_D: (["variants", "cohorts"], D.data)}
611613
)
612614
return conditional_merge_datasets(ds, new_ds, merge)
613615

0 commit comments

Comments
 (0)