public override void Expose(ActorExposureRecord exposureRecord)
 {
     if (GroupDescriptions == null || GroupDescriptions.Count < GroupLevel) throw new InvalidOperationException("There is no GroupDescription defined for this grouping level");
     var groupDescription = GroupDescriptions[GroupLevel];
     if (groupDescription.RecordToKey == null) throw new InvalidOperationException("RecordToKey cannot be null for the current grouping level");
     if (groupDescription.GroupName == null) throw new InvalidOperationException("GroupName cannot be null for the current grouping level");
     if (groupDescription.RecordFilter != null && (!groupDescription.RecordFilter(exposureRecord))) return;
     var key = groupDescription.RecordToKey(exposureRecord);
     HistogramBins[] bins;
     if (!_groupedExposures.TryGetValue(key, out bins))
     {
         bins = new HistogramBins[2];
         bins[0] = new HistogramBins(HistogramSource, LowBinValue, BinWidth, BinCount)
         {
             DataSetName = groupDescription.GroupName(exposureRecord),
             BarSeriesViewModel = { Fill = new SolidColorBrush(HistogramSource.GuidToColorMap[groupDescription.RecordToGuid(exposureRecord)]) },
         };
         GroupedBarSeriesViewModels[0].BarSeriesCollection.Add(bins[0].BarSeriesViewModel);
         bins[1] = new HistogramBins(HistogramSource, LowBinValue, BinWidth, BinCount)
         {
             DataSetName = groupDescription.GroupName(exposureRecord),
             BarSeriesViewModel = { Fill = new SolidColorBrush(HistogramSource.GuidToColorMap[groupDescription.RecordToGuid(exposureRecord)]) },
         };
         GroupedBarSeriesViewModels[1].BarSeriesCollection.Add(bins[1].BarSeriesViewModel);
         if (_groupedExposures.TryAdd(key, bins))
         {
             Debug.WriteLine(string.Format("Adding histograms for {0} at level {1}", groupDescription.GroupName(exposureRecord), GroupLevel));
         }
         else if (!_groupedExposures.TryGetValue(key, out bins)) throw new ApplicationException("Could not add exposure bins to GroupedExposuresHistogram.");
     }
     bins[0].Add(exposureRecord.PeakSPL);
     bins[1].Add(exposureRecord.Energy);
 }
 internal GroupedExposuresHistogram(IHistogramSource histogramSource, double lowBinValue, double binWidth, int binCount, int groupLevel)
     : base(histogramSource, lowBinValue, binWidth, binCount, groupLevel)
 {
     GroupedBarSeriesViewModels = new GroupedBarSeriesViewModel[2];
     GroupedBarSeriesViewModels[0] = new GroupedBarSeriesViewModel();
     GroupedBarSeriesViewModels[1] = new GroupedBarSeriesViewModel();
     var bins = new HistogramBins(HistogramSource, LowBinValue, BinWidth, BinCount);
     BinNames = new string[bins.BinNames.Length];
     Array.Copy(bins.BinNames, BinNames, bins.BinNames.Length);
     //_cvs = new CollectionViewSource();
     //var speciesPlatformConverter = new GroupingConverter(a => _simulationLog.RecordFromActorID(((ActorExposureRecord)a).ActorID) is SpeciesNameGuid ? "Species" : "Platforms");
     //var actorNameConverter = new GroupingConverter(a => _simulationLog.RecordFromActorID(((ActorExposureRecord)a).ActorID).Name);
     //_cvs.GroupDescriptions.Add(new PropertyGroupDescription(null, speciesPlatformConverter));
     //_cvs.GroupDescriptions.Add(new PropertyGroupDescription(null, actorNameConverter));
     //_cvs.Source = simulationLog;
 }