Skip to content

Commit

Permalink
doc tweak for pointDeviated()
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaller committed Oct 24, 2023
1 parent 0800cc3 commit 0aad3f9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
4 changes: 2 additions & 2 deletions QtSLiM/help/SLiMHelpClasses.html
Original file line number Diff line number Diff line change
Expand Up @@ -1007,9 +1007,9 @@
<p class="p6"><span class="s3">The parameters </span><span class="s4">outputMultiallelics</span><span class="s3">, </span><span class="s4">simplifyNucleotides</span><span class="s3">, and </span><span class="s4">outputNonnucleotides</span><span class="s3"> affect the format of the output produced; see the reference documentation for further discussion.</span></p>
<p class="p4">See <span class="s1">outputMSSample()</span> and <span class="s1">outputSample()</span> for other output formats.<span class="Apple-converted-space">  </span>Output is generally done in a <span class="s1">late()</span> event, so that the output reflects the state of the simulation at the end of a tick.</p>
<p class="p5">– (float)pointDeviated(integer$ n, float point, string$ boundary, numeric$ maxDistance, string$ functionType, ...)</p>
<p class="p6">Returns a vector containing <span class="s1">n</span> points that are derived from <span class="s1">point</span> by adding a deviation drawn from a dispersal kernel (specified by <span class="s1">maxDistance</span>, <span class="s1">functionType</span>, and the ellipsis parameters <span class="s1">...</span>) and then applying a boundary condition specified by <span class="s1">boundary</span>.<span class="Apple-converted-space">  </span>This method therefore performs the steps of a simple dispersal algorithm in a single vectorized call.</p>
<p class="p6">Returns a vector containing <span class="s1">n</span> points that are derived from <span class="s1">point</span> by adding a deviation drawn from a dispersal kernel (specified by <span class="s1">maxDistance</span>, <span class="s1">functionType</span>, and the ellipsis parameters <span class="s1">...</span>, as detailed below) and then applying a boundary condition specified by <span class="s1">boundary</span>.<span class="Apple-converted-space">  </span>This method therefore performs the steps of a simple dispersal algorithm in a single vectorized call.</p>
<p class="p6">The parameter <span class="s1">point</span> may contain a single point which is deviated and bounded <span class="s1">n</span> times, or may contain <span class="s1">n</span> points each of which is deviated and bounded.<span class="Apple-converted-space">  </span>In any case, each point in <span class="s1">point</span> should match the dimensionality of the model – one element in a 1D model, two elements in a 2D model, or three elements in a 3D model.<span class="Apple-converted-space">  </span>This method should not be called in a non-spatial model.</p>
<p class="p6">The dispersal kernel is specified similarly to other kernel-based methods, such as <span class="s1">setInteractionFunction()</span> and <span class="s1">smooth()</span>; see the <span class="s1">InteractionType</span> class documentation for detailed discussion of the available spatial kernel types and their parameters (supplied in the ellipsis, <span class="s1">...</span>).<span class="Apple-converted-space">  </span>For <span class="s1">pointDeviated()</span>, the Cauchy (<span class="s1">"c"</span>) kernel is not allowed since it is not well-behaved for this purpose, and the Student’s <i>t</i> (<span class="s1">"t"</span>) kernel is not allowed in 3D models at present simply because it hasn’t been implemented.<span class="Apple-converted-space">  </span>The random points returned from this method are drawn from the probability distribution that is radially symmetric and has density proportional to the interaction strength – in other words, at distance <i>r</i> the density is proportional to the functional form referred to by <span class="s1">functionType</span>.<span class="Apple-converted-space">  </span>For instance, the density of the probability distribution for type <span class="s1">"e"</span> with rate <i>a</i> at distance <i>r</i> is proportional to exp(−<i>ra</i>); and so the distribution of the distance in 1D is exponential, while in 2D it is proportional to <i>r</i> exp(−<i>ra</i>) (i.e., Gamma with shape parameter 1).</p>
<p class="p6">The dispersal kernel is specified similarly to other kernel-based methods, such as <span class="s1">setInteractionFunction()</span> and <span class="s1">smooth()</span>.<span class="Apple-converted-space">  </span>For <span class="s1">pointDeviated()</span>, <span class="s1">functionType</span> may be <span class="s1">“f"</span> with no ellipsis arguments <span class="s1">...</span> to use a flat kernel out to <span class="s1">maxDistance</span>; <span class="s1">“l"</span> with no ellpises arguments for a kernel that decreases linearly from the center to zero at <span class="s1">maxDistance</span>; <span class="s1">"e"</span>, in which case the ellipsis should supply a <span class="s1">numeric$</span> lambda (rate) parameter for a negative exponential function; <span class="s1">"n"</span>, in which case the ellipsis should supply a <span class="s1">numeric$</span> sigma (standard deviation) parameter for a Gaussian function; or <span class="s1">"t"</span>, in which case the ellipsis should supply a <span class="s1">numeric$</span> degrees of freedom and a <span class="s1">numeric$</span> scale parameter for a <i>t</i>-distribution function.<span class="Apple-converted-space">  </span>The Cauchy (<span class="s1">"c"</span>) kernel is not supported by <span class="s1">pointDeviated()</span> since it is not well-behaved for this purpose, and the Student’s <i>t</i> (<span class="s1">"t"</span>) kernel is not allowed in 3D models at present simply because it hasn’t been implemented.<span class="Apple-converted-space">  </span>See the <span class="s1">InteractionType</span> class documentation (section 25.8) for more detailed discussion of the available kernel types and their parameters and probability distribution functions.<span class="Apple-converted-space">  </span>The random points returned from this method are drawn from the probability distribution that is radially symmetric and has density proportional to the kernel – in other words, at distance <i>r</i> the density is proportional to the kernel type referred to by <span class="s1">functionType</span>.<span class="Apple-converted-space">  </span>For instance, the density of the probability distribution for type <span class="s1">"e"</span> with rate <i>a</i> at distance <i>r</i> is proportional to exp(−<i>ra</i>); and so the distribution of the distance in 1D is exponential, while in 2D it is proportional to <i>r</i> exp(−<i>ra</i>) (i.e., Gamma with shape parameter 1).</p>
<p class="p6">The boundary condition must be one of <span class="s1">"none"</span>, <span class="s1">"periodic"</span>, <span class="s1">"reflecting"</span>, <span class="s1">"stopping"</span>, or <span class="s1">"reprising"</span>.<span class="Apple-converted-space">  </span>For <span class="s1">"none"</span>, no boundary condition is enforced; the deviated points are simply returned as is.<span class="Apple-converted-space">  </span>For <span class="s1">"periodic"</span>, <span class="s1">"reflecting"</span>, and <span class="s1">"stopping"</span>, the boundary condition is enforced just as it is by the <span class="s1">pointPeriodic()</span>, <span class="s1">pointReflected()</span>, and <span class="s1">pointStopped()</span> methods; see their documentation for further details.<span class="Apple-converted-space">  </span>For <span class="s1">"reprising"</span>, if the deviated point is out of bounds a new deviated point will be chosen, based upon the same original point, until a point inside bounds is obtained.<span class="Apple-converted-space">  </span>Note that absorbing boundaries (for which being out-of-bounds is lethal) would be implemented in script; this method cannot enforce them.</p>
<p class="p6">In the typical usage case, <span class="s1">point</span> comes from the <span class="s1">spatialPosition</span> property for a vector of individuals, and the result is then set back onto the same vector of individuals using the <span class="s1">setSpatialPosition()</span> method; however, this method might be useful in other situations too.</p>
<p class="p3">– (logical)pointInBounds(float point)</p>
Expand Down
48 changes: 38 additions & 10 deletions SLiMgui/SLiMHelpClasses.rtf
Original file line number Diff line number Diff line change
Expand Up @@ -9159,7 +9159,7 @@ The parameters
\f3\fs18 functionType
\f4\fs20 , and the ellipsis parameters
\f3\fs18 ...
\f4\fs20 ) and then applying a boundary condition specified by
\f4\fs20 , as detailed below) and then applying a boundary condition specified by
\f3\fs18 boundary
\f4\fs20 . This method therefore performs the steps of a simple dispersal algorithm in a single vectorized call.\
The parameter
Expand All @@ -9175,21 +9175,49 @@ The dispersal kernel is specified similarly to other kernel-based methods, such
\f3\fs18 setInteractionFunction()
\f4\fs20 and
\f3\fs18 smooth()
\f4\fs20 ; see the
\f3\fs18 InteractionType
\f4\fs20 class documentation for detailed discussion of the available spatial kernel types and their parameters (supplied in the ellipsis,
\f3\fs18 ...
\f4\fs20 ). For
\f4\fs20 . For
\f3\fs18 pointDeviated()
\f4\fs20 , the Cauchy (
\f4\fs20 ,
\f3\fs18 functionType
\f4\fs20 may be
\f3\fs18 \'93f"
\f4\fs20 with no ellipsis arguments
\f3\fs18 ...
\f4\fs20 to use a flat kernel out to
\f3\fs18 maxDistance
\f4\fs20 ;
\f3\fs18 \'93l"
\f4\fs20 with no ellpises arguments for a kernel that decreases linearly from the center to zero at
\f3\fs18 maxDistance
\f4\fs20 ;
\f3\fs18 "e"
\f4\fs20 , in which case the ellipsis should supply a
\f3\fs18 numeric$
\f4\fs20 lambda (rate) parameter for a negative exponential function;
\f3\fs18 "n"
\f4\fs20 , in which case the ellipsis should supply a
\f3\fs18 numeric$
\f4\fs20 sigma (standard deviation) parameter for a Gaussian function; or
\f3\fs18 "t"
\f4\fs20 , in which case the ellipsis should supply a
\f3\fs18 numeric$
\f4\fs20 degrees of freedom and a
\f3\fs18 numeric$
\f4\fs20 scale parameter for a
\f1\i t
\f4\i0 -distribution function. The Cauchy (
\f3\fs18 "c"
\f4\fs20 ) kernel is not allowed since it is not well-behaved for this purpose, and the Student\'92s
\f4\fs20 ) kernel is not supported by
\f3\fs18 pointDeviated()
\f4\fs20 since it is not well-behaved for this purpose, and the Student\'92s
\f1\i t
\f4\i0 (
\f3\fs18 "t"
\f4\fs20 ) kernel is not allowed in 3D models at present simply because it hasn\'92t been implemented. The random points returned from this method are drawn from the probability distribution that is radially symmetric and has density proportional to the interaction strength \'96 in other words, at distance
\f4\fs20 ) kernel is not allowed in 3D models at present simply because it hasn\'92t been implemented. See the
\f3\fs18 InteractionType
\f4\fs20 class documentation (section 25.8) for more detailed discussion of the available kernel types and their parameters and probability distribution functions. The random points returned from this method are drawn from the probability distribution that is radially symmetric and has density proportional to the kernel \'96 in other words, at distance
\f1\i r
\f4\i0 the density is proportional to the functional form referred to by
\f4\i0 the density is proportional to the kernel type referred to by
\f3\fs18 functionType
\f4\fs20 . For instance, the density of the probability distribution for type
\f3\fs18 "e"
Expand Down

0 comments on commit 0aad3f9

Please sign in to comment.