Repository: popsim-consortium/stdpopsim (language: python)

Issue:
failing tests
I'm getting these errors:
```
FAILED tests/test_models.py::TestOrySatBottleneckMigration_3C07::test_mutation_rate_match - assert 9.033333333333333e-09 == 3.2e-09
FAILED tests/test_models.py::TestMutationRates::test_params_match_docs_tables - assert 9.033333333333333e-09 == 9.03e-09
```

One of these is precision. This should be easy to fix.

The other is a legit error, in `OrySat`. What's up with this?


Discussion / hints:
The discussion regarding mutation rate for that OrySat model (vs species mutation rate) is here: https://github.com/popsim-consortium/stdpopsim/issues/1459#issuecomment-1546509693

I'll take a look and try to figure out where the discrepancy came in. Not sure why CI didn't catch it before.
Okay I see what happened here:
1. OrySat was added in #1453 , including this demographic model
2. The model was QC'ed in #1459 in April, but the PR wasn't merged
3. Some of the parameters were *changed* in #1482, in June
4. I noticed today that #1459 with the QC wasn't merged but had passed the tests, so I merged

However, those tests in (2) had passed before the changes in (3).

Note that the only substantive change in #1482 was to the mutation rate; the others are (good) semantic changes.

Fix patch:
diff --git a/docs/catalog.rst b/docs/catalog.rst
index a792c7e83..db294da2c 100644
--- a/docs/catalog.rst
+++ b/docs/catalog.rst
@@ -83,10 +83,14 @@ Then, if you feel ready, make an issue on our
 
 .. speciescatalog:: MusMus
 
+.. speciescatalog:: OrySat
+
 .. speciescatalog:: PanTro
 
 .. speciescatalog:: PapAnu
 
+.. speciescatalog:: PhoSin
+
 .. speciescatalog:: PonAbe
 
 .. speciescatalog:: StrAga
diff --git a/stdpopsim/qc/OrySat.py b/stdpopsim/qc/OrySat.py
index a57fecc13..c09add8de 100644
--- a/stdpopsim/qc/OrySat.py
+++ b/stdpopsim/qc/OrySat.py
@@ -15,9 +15,8 @@ def _BottMig_3C07_qc():
     )
     populations = [rufipogon, indica, japonica]
 
-    # generation time of 1 year and a mutation rate of 3.2e-9 per bp per generation
+    # generation time of 1 year
     generation_time = 1
-    mutation_rate = 3.2e-9
 
     # All demographic parameters were extracted from Caicedo et al. (2007)
     # Table 2, bottleneck + migration model
@@ -35,6 +34,12 @@ def _BottMig_3C07_qc():
         0.0055 * 150000
     )  # bottleneck population size for both indica and tropical japonica
 
+    # "mutation rate estimated from the number of synonymous and noncoding
+    # segregating SNPs assuming O. rufipogon represented a population of
+    # constant size... and is equivalent to using Watterson's (1975) estimator
+    # of θ."
+    mutation_rate = 5.42e-3 / (4 * N_rufi)
+
     # Migration rates
     # to japonica = 0.42, to indica = 0.945, to rufipogon = 3.5
     m_ind = 0.945 / N_ind


Test patch:
diff --git a/tests/test_models.py b/tests/test_models.py
index 98eb3b655..0e024ee37 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -426,9 +426,12 @@ def test_params_match_docs_tables(self):
                                     )
                             if param_data[0].startswith("Mutation rate"):
                                 mutation_rate = float(param_data[1])
-                    assert model.mutation_rate == mutation_rate
+                    if mutation_rate is None:
+                        assert model.mutation_rate is None
+                    else:
+                        assert np.allclose(model.mutation_rate, mutation_rate)
                     if generation_time is None:
                         # default is 1 if unspecified
                         assert model.generation_time == 1
                     else:
-                        assert model.generation_time == generation_time
+                        assert np.allclose(model.generation_time, generation_time)