public static WriteData Basic(SimParams par, bool repAll = true, bool matchAll = true,
                                      bool ageAll     = true, bool lrnThrshAll         = true, bool accAll = true, bool chanForAll = true,
                                      bool chanInvAll = true)
        {
            Population Pop     = new Population(par);
            WriteData  SimData = new WriteData();

            SimData.Write(par, Pop, repAll, matchAll, ageAll,
                          lrnThrshAll, accAll, chanForAll, chanInvAll);
            //Simulation and saving data
            for (int i = 0; i < par.NumSim; i++)
            {
                Pop = BirthDeathCycle.Step(par, Pop);
                SimData.Write(par, Pop, repAll, matchAll, ageAll,
                              lrnThrshAll, accAll, chanForAll, chanInvAll);
            }
            return(SimData);
        }
        public static InvasionData Invasion(SimParams par, string type, float invaderStat, int numInvaders = 1, int burnIn = 500)
        {
            CheckStatValue(par, type, invaderStat);
            Population Pop = new Population(par);

            //Get to Equilibrium
            for (int i = 0; i < burnIn; i++)
            {
                Pop = BirthDeathCycle.Step(par, Pop);
            }

            //Invade
            int[] InvaderIndex = par.RandomSampleEqualNoReplace(Enumerable.Range(0, par.NumBirds).ToList(), numInvaders);
            for (int i = 0; i < numInvaders; i++)
            {
                CreateInvader(Pop, type, InvaderIndex[i], invaderStat);
                //Pop.Age[InvaderIndex[i]] = 1;
                //Pop.LearningThreshold[InvaderIndex[i]] = invaderStat;
            }

            //Postinvasion run
            int Counter    = 1;
            int Categories = 2;

            while (Categories != 1)
            {
                Counter += 1;
                Pop      = BirthDeathCycle.Step(par, Pop);
                if (Counter == 400)
                {
                    break;
                }
                else
                {
                    Categories = CountCategories(Pop, type);//Pop.LearningThreshold.Distinct().Count();
                }
            }
            InvasionData Results = new InvasionData(Counter, GetAverage(Pop, type));//Pop.LearningThreshold.Average());

            return(Results);
        }