Loading INAF.Apps.Uwp.SLabDataManager/Charts/Containers/SpectraContainer.cs +32 −0 Original line number Diff line number Diff line Loading @@ -235,5 +235,37 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers return Summaries.FirstOrDefault(x => x.Type == spectrumType); } #endregion #region retrieve aligned spectrum (by smoothing type) public SpectrumModel getAlignedSpectrum() { SpectrumModel spectrum = null; /* look for the right aligned type by descending order of importance */ if (isAnySpectrumOfType(SpectrumType.AlignedSmoothed)) spectrum = tryGetSpectrumOfType(SpectrumType.AlignedSmoothed); else if (isAnySpectrumOfType(SpectrumType.AlignedSmoothedBySegments)) spectrum = tryGetSpectrumOfType(SpectrumType.AlignedSmoothedBySegments); else if (isAnySpectrumOfType(SpectrumType.Aligned)) spectrum = tryGetSpectrumOfType(SpectrumType.Aligned); return spectrum; } public SpectrumType getAlignedSpectrumType() { SpectrumType spectrumType = SpectrumType.None; /* look for the right aligned type by descending order of importance */ if (isAnySpectrumOfType(SpectrumType.AlignedSmoothed)) spectrumType = SpectrumType.AlignedSmoothed; else if (isAnySpectrumOfType(SpectrumType.AlignedSmoothedBySegments)) spectrumType = SpectrumType.AlignedSmoothedBySegments; else if (isAnySpectrumOfType(SpectrumType.Aligned)) spectrumType = SpectrumType.Aligned; return spectrumType; } #endregion } } INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ChartAnnotationsHelper.cs +1 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart var segmentsFitModelContainer = serviceProvider.GetRequiredService<SegmentsFitModelHelper>(); /* find closest points on spectrum to mouse position */ var spectrum = workingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.Aligned); (PointModel lowBoundary, PointModel highBoundary) boundaries = getSegmentBoundaries(spectrum, (PointModel lowBoundary, PointModel highBoundary) boundaries = getSegmentBoundaries(workingItems.SpectraContainer.getAlignedSpectrum(), (double)point.Item1, (double)point.Item2); Loading INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ContinuumRemovalHelper.cs +1 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart IsContinuumRemovalCompleted = false; /* retrieve spectra for removing continuum */ CloneForContinuumRemoval = spectraContainer.getClonedSpectrum(SpectrumType.Aligned, CloneForContinuumRemoval = spectraContainer.getClonedSpectrum(spectraContainer.getAlignedSpectrumType(), SpectrumType.ContinuumRemoved); Continuum = spectraContainer.tryGetSpectrumOfType(SpectrumType.Continuum); Loading INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ProcessingHelpers/SmoothingProcessingHelper.cs +5 −0 Original line number Diff line number Diff line Loading @@ -58,5 +58,10 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart.ProcessingHelpers return (clonedSpectrum, isOk); }); } //public async Task<(SpectrumModel filteredSpectrum, bool isOk)> applySmoothingToSpectrum(SpectrumModel clonedSpectrum) //{ //} } } INAF.Apps.Uwp.SLabDataManager/Helpers/XmlReaders/SmoothingDefaultBoundariesReader.cs +5 −5 Original line number Diff line number Diff line Loading @@ -11,15 +11,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.XmlReaders { public sealed class SmoothingDefaultBoundariesReader : XmlReader { private readonly SmoothingBoundariesContainer smoothingBoundaries; private readonly SmoothingBoundariesContainer smoothingBoundariesContainer; public SmoothingDefaultBoundariesReader(IServiceProvider serviceProvider, SmoothingBoundariesContainer smoothingBoundaries, SmoothingBoundariesContainer smoothingBoundariesContainer, XmlHelper xmlHelper, Logger logger) : base(serviceProvider, xmlHelper, logger) { this.smoothingBoundaries = smoothingBoundaries; smoothingBoundaries.init(); this.smoothingBoundariesContainer = smoothingBoundariesContainer; smoothingBoundariesContainer.init(); } public override async Task readFileAsync() Loading @@ -46,7 +46,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.XmlReaders string _currentValue = node.InnerText; double currentValue = _currentValue.ToDoubleInvariant(); smoothingBoundaries.add(currentValue); smoothingBoundariesContainer.add(currentValue); } } catch (Exception ex) Loading Loading
INAF.Apps.Uwp.SLabDataManager/Charts/Containers/SpectraContainer.cs +32 −0 Original line number Diff line number Diff line Loading @@ -235,5 +235,37 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers return Summaries.FirstOrDefault(x => x.Type == spectrumType); } #endregion #region retrieve aligned spectrum (by smoothing type) public SpectrumModel getAlignedSpectrum() { SpectrumModel spectrum = null; /* look for the right aligned type by descending order of importance */ if (isAnySpectrumOfType(SpectrumType.AlignedSmoothed)) spectrum = tryGetSpectrumOfType(SpectrumType.AlignedSmoothed); else if (isAnySpectrumOfType(SpectrumType.AlignedSmoothedBySegments)) spectrum = tryGetSpectrumOfType(SpectrumType.AlignedSmoothedBySegments); else if (isAnySpectrumOfType(SpectrumType.Aligned)) spectrum = tryGetSpectrumOfType(SpectrumType.Aligned); return spectrum; } public SpectrumType getAlignedSpectrumType() { SpectrumType spectrumType = SpectrumType.None; /* look for the right aligned type by descending order of importance */ if (isAnySpectrumOfType(SpectrumType.AlignedSmoothed)) spectrumType = SpectrumType.AlignedSmoothed; else if (isAnySpectrumOfType(SpectrumType.AlignedSmoothedBySegments)) spectrumType = SpectrumType.AlignedSmoothedBySegments; else if (isAnySpectrumOfType(SpectrumType.Aligned)) spectrumType = SpectrumType.Aligned; return spectrumType; } #endregion } }
INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ChartAnnotationsHelper.cs +1 −2 Original line number Diff line number Diff line Loading @@ -46,8 +46,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart var segmentsFitModelContainer = serviceProvider.GetRequiredService<SegmentsFitModelHelper>(); /* find closest points on spectrum to mouse position */ var spectrum = workingItems.SpectraContainer.tryGetSpectrumOfType(SpectrumType.Aligned); (PointModel lowBoundary, PointModel highBoundary) boundaries = getSegmentBoundaries(spectrum, (PointModel lowBoundary, PointModel highBoundary) boundaries = getSegmentBoundaries(workingItems.SpectraContainer.getAlignedSpectrum(), (double)point.Item1, (double)point.Item2); Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ContinuumRemovalHelper.cs +1 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart IsContinuumRemovalCompleted = false; /* retrieve spectra for removing continuum */ CloneForContinuumRemoval = spectraContainer.getClonedSpectrum(SpectrumType.Aligned, CloneForContinuumRemoval = spectraContainer.getClonedSpectrum(spectraContainer.getAlignedSpectrumType(), SpectrumType.ContinuumRemoved); Continuum = spectraContainer.tryGetSpectrumOfType(SpectrumType.Continuum); Loading
INAF.Apps.Uwp.SLabDataManager/Helpers/UI/Chart/ProcessingHelpers/SmoothingProcessingHelper.cs +5 −0 Original line number Diff line number Diff line Loading @@ -58,5 +58,10 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart.ProcessingHelpers return (clonedSpectrum, isOk); }); } //public async Task<(SpectrumModel filteredSpectrum, bool isOk)> applySmoothingToSpectrum(SpectrumModel clonedSpectrum) //{ //} } }
INAF.Apps.Uwp.SLabDataManager/Helpers/XmlReaders/SmoothingDefaultBoundariesReader.cs +5 −5 Original line number Diff line number Diff line Loading @@ -11,15 +11,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.XmlReaders { public sealed class SmoothingDefaultBoundariesReader : XmlReader { private readonly SmoothingBoundariesContainer smoothingBoundaries; private readonly SmoothingBoundariesContainer smoothingBoundariesContainer; public SmoothingDefaultBoundariesReader(IServiceProvider serviceProvider, SmoothingBoundariesContainer smoothingBoundaries, SmoothingBoundariesContainer smoothingBoundariesContainer, XmlHelper xmlHelper, Logger logger) : base(serviceProvider, xmlHelper, logger) { this.smoothingBoundaries = smoothingBoundaries; smoothingBoundaries.init(); this.smoothingBoundariesContainer = smoothingBoundariesContainer; smoothingBoundariesContainer.init(); } public override async Task readFileAsync() Loading @@ -46,7 +46,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers.XmlReaders string _currentValue = node.InnerText; double currentValue = _currentValue.ToDoubleInvariant(); smoothingBoundaries.add(currentValue); smoothingBoundariesContainer.add(currentValue); } } catch (Exception ex) Loading