rosemckeon / ploidy

How does disturbance on a landscape affect the establishment of new polyploid plant species?
3 stars 0 forks source link

Stop infinite values appearing for growth rate #59

Closed rosemckeon closed 5 years ago

rosemckeon commented 5 years ago

@bradduthie I thought I'd managed to code what you explained for get_growth_rate to constrain it below a max value, but as generations continue values of Inf begin to appear.

Please can you take a look at traits.R and see what you think?

bradduthie commented 5 years ago

@rozeykex I can only seem to replicate the appearance of Inf when genome values are very large (ca 10000000). Is it possible that values are greatly exceeding 100, then causing Inf (due to limitations of double) and running into an issue with L65 where the maximum of 100 is hard coded?

rosemckeon commented 5 years ago

@bradduthie hmmm. Weird that you're not seeing this happen, or maybe weirder that I am! I can't see how allele values could increase. They have only 2 opportunities to change; when they are set originally, and when they mutate. In both cases, random uniform numbers between 0 and 100 are chosen https://github.com/rozeykex/ploidy/blob/b11a87e82ace493410e404d7cab109a55eada85d/R/functions.R#L1002 and https://github.com/rozeykex/ploidy/blob/b11a87e82ace493410e404d7cab109a55eada85d/R/functions.R#L567

I'll try and plot the allele values to make sure.

rosemckeon commented 5 years ago

@bradduthie yeah, I'm not getting the issue either anymore! Though I'm getting extinction appearing earlier so maybe need to tweak settings that allow the population to persist for longer. I've fixed the unnesting issues with genomes though to examine the values, and they're definitely constrained.

Let's just keep an eye on it for now.