Exemplo n.º 1
0
 private void LoadSetupFiles(CovidScenario scenario)
 {
     Wards                      = WardRecord.LoadFromCsv(scenario.GeographyFile);
     AgeDistributions           = AgeDistributionCollection.LoadFromCsv(scenario.AgeDistributionsFile);
     HouseHoldSizeDistributions = HouseSizeDistributionCollection.LoadFromCsv(scenario.HouseHoldSizesFile);
     HomeContactMatrix          = ContactMatrix.LoadFromCsv(scenario.HomeContactMatrixFile);
     OtherContactMatrix         = ContactMatrix.LoadFromCsv(scenario.OtherContactMatrixFile);
     TravelMatrix               = TravelMatrix.LoadFromCsv(scenario.TravelMatrixFile);
 }
        public static AgeDistributionCollection LoadFromCsv(string fileName)
        {
            var ageRecords = LoadAgeRecords(fileName);

            var ageDistributions = new AgeDistributionCollection();

            foreach (var record in ageRecords)
            {
                if (!ageDistributions.ContainsKey(record.WardId))
                {
                    ageDistributions.Add(record.WardId, new WardAgeDistribution());
                }
                var wardAges = ageDistributions[record.WardId];
                wardAges[record.AgeBand] = record.Probability;
            }

            Log.Verbose($"Loaded age distributions from {fileName}");

            return(ageDistributions);
        }