void PopulateELSpecSheet(ELSpecVM spec) { activeELSpecVM = spec; //string legendName = string.Concat(spec.TheELSpectrum.Pixel.Device.Label, spec.TheELSpectrum.Pixel.Site.Replace("Site", string.Empty)); var roundPeak = Math.Round(spec.TheELSpectrum.ELPeakLambda, 1); var roundFWHM = Math.Round(spec.TheELSpectrum.ELFWHM, 1); string legendName = string.Concat(spec.TheELSpectrum.Pixel.Site.Replace("Site", string.Empty), " peak: ", roundPeak, " FWHM: ", roundFWHM); var data = spec.ELSpecArray(); activeSheet.Cols = 2; activeSheet.Columns[0].LongName = "Wavelength"; activeSheet.Columns[0].Units = "nm"; activeSheet.Columns[0].Comments = legendName; activeSheet.Columns[1].LongName = "Intensity"; activeSheet.Columns[1].Units = "a.u."; activeSheet.Columns[1].Comments = legendName; activeSheet.SetData(data, 0, 0); }
private async Task UpdateELSpecEntities() { await Task.Run(() => { List <string> elspecPathsFromEntities = new List <string>(); foreach (ELSpectrum spec in TheLJVScanSummaryVM.TheLJVScanSummary.ELSpectrums) { elspecPathsFromEntities.Add(spec.FilePath); } List <string> newSpecPaths = elspecPaths.Except(elspecPathsFromEntities).ToList(); foreach (string path in newSpecPaths) { ELSpecVM newSpecVM = new ELSpecVM(path); newSpecVM.TheELSpectrum.DeviceLJVScanSummary = TheLJVScanSummaryVM.TheLJVScanSummary; newSpecVM.TheELSpectrum.Pixel = ctx.Pixels.Where(x => x.PixelId == SelectedPixel.PixelId).First(); ctx.ELSpectra.Add(newSpecVM.TheELSpectrum); } }).ConfigureAwait(false); }