Statistics via Python API

Hello ShapeWorks!

Is it possible to use the Python API to compute a mean shape, median shape, and other statistics?

For example, something like the follow would be extremely useful:

model = shapeworks.load_model("myssm.xlsx")
mean_particles = sw.stats.mean(model)
median_particles = sw.stats.median(model)

(A related question: Is the Python API fully documented somewhere?)

thanks!

The python documentation is here:

There is an Analyze module available that accomplishes some of this:

import shapeworks as sw
project = sw.Project()
project.load("d2_pre_only.xlsx")
analyze = sw.Analyze(project)
mean_particles = analyze.get_mean_shape_points()

But it looks like there isn’t yet a method to return the median shape particles. It should be pretty easy to add if desired.

Thanks Alan! I’m not sure how I didn’t find the documentation, but now it is clear.