MesserLab / SLiM

SLiM is a genetically explicit forward simulation software package for population genetics and evolutionary biology. It is highly flexible, with a built-in scripting language, and has a cross-platform graphical modeling environment called SLiMgui.
https://messerlab.org/slim/
GNU General Public License v3.0
160 stars 30 forks source link

Vectorized parameters for kernel functions #453

Closed silastittes closed 1 month ago

silastittes commented 2 months ago

Hi SLiM team! I've been thinking about dispersal as a quantitative trait. It would be a nice feature to vectorize the parameters of the kernels in newer methods like sampleNearbyPoint, i.e., p1.deviatePositions(inds, "reprising", INF, "n", inds.tagF) or MAP.sampleNearbyPoint(inds.spatialPosition, 10.0 * SD, "n", inds.tagF). I have no idea how to do this, but I would excitedly watch on the sidelines to see how it would be implemented!

bhaller commented 1 month ago

I notice that supplying a vector of values doesn't even throw an error right now; the usual checking doesn't occur, because the arguments defining the kernel are ellipsis "..." arguments that are unchecked, and the existing code doesn't check their count.

bhaller commented 1 month ago

Fixed! @silastittes please try this out and let me know if you see any problems! :->

silastittes commented 1 month ago

Yay, thank you @bhaller! Will do asap!