Loading INAF.Apps.Uwp.SLabDataManager/Assets/icons/Ok_big.png +902 B (2.37 KiB) Loading image diff... INAF.Apps.Uwp.SLabDataManager/Assets/icons/Warning_big.png 0 → 100644 +1.73 KiB Loading image diff... INAF.Apps.Uwp.SLabDataManager/Charts/SpectraContainer.cs +43 −14 Original line number Diff line number Diff line Loading @@ -56,13 +56,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts } #region properties public string ErrorMessage { get; private set; } public string DialogMessage { get; private set; } private bool isError; public bool IsError public DialogMessageType DialogMessageType { get; private set; } private bool isDialogRequired; public bool IsDialogRequired { get { return isError; } set { SetProperty(ref isError, value); } get { return isDialogRequired; } set { SetProperty(ref isDialogRequired, value); } } private bool isAnySummaryUpdated; Loading Loading @@ -330,8 +332,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts public async Task alignRawSpectrumAsync() { IsError = false; ErrorMessage = string.Empty; IsDialogRequired = false; DialogMessage = string.Empty; SpectrumModel aligningSpectrum = null; Loading @@ -342,11 +344,39 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts { aligningSpectrum = createAligningSpectrum(); /* try to retrieve the ref white max value for normalizing raw spectrum during alignment process */ double refWhiteMaxY = 1d; var refWhiteSpectrum = tryGetSpectrumOfType(SpectrumType.RefWhite); if (refWhiteSpectrum != null) if (refWhiteSpectrum == null) { UpdateUIHelper.UpdateUIAsync(() => { DialogMessageType = DialogMessageType.Warning; DialogMessage = "RefWhiteSpectrumNotAvailable".GetText(); IsDialogRequired = true; }); } else refWhiteMaxY = refWhiteSpectrum.Elements.Max(x => x.Y); /* try to retrieve ref spectrum for normalizing raw spectrum during alignment process */ var refSpectrum = tryGetSpectrumOfType(SpectrumType.Ref); if (refSpectrum == null) { UpdateUIHelper.UpdateUIAsync(() => { DialogMessageType = DialogMessageType.Warning; DialogMessage = "NoNormalizationAvailableMessage".GetText(); IsDialogRequired = true; }); } /* normalize spectrum, if possible */ if (refWhiteSpectrum != null && refSpectrum != null) { multiplyByRef(ref aligningSpectrum, refWhiteSpectrum); refWhiteMaxY, refSpectrum); } /* retrieve the reference segment and calculate the mean values at the borders of the segment for aligning other segments */ Loading Loading @@ -380,8 +410,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts Spectra.Add(aligningSpectrum); else { ErrorMessage = exMsg; IsError = true; DialogMessage = exMsg; IsDialogRequired = true; } } Loading Loading @@ -429,16 +459,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts } private void multiplyByRef(ref SpectrumModel aligningSpectrum, double refWhiteMaxY, SpectrumModel refSpectrum) { double refMaxY = refSpectrum.Elements.Max(x => x.Y); aligningSpectrum.Elements .AsParallel() .ForAll(x => { var refElement = refSpectrum.Elements.FirstOrDefault(y => y.X == x.X); x.updateY(x.Y * refElement.Y / refMaxY); x.updateY(x.Y * refElement.Y / refWhiteMaxY); }); } #endregion Loading INAF.Apps.Uwp.SLabDataManager/INAF.Apps.Uwp.SLabDataManager.csproj +1 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,7 @@ <Content Include="Assets\icons\Ok.png" /> <Content Include="Assets\icons\Ok_big.png" /> <Content Include="Assets\icons\Warning.png" /> <Content Include="Assets\icons\Warning_big.png" /> <Content Include="Assets\images\em_spectrum_400x400.png" /> <Content Include="Assets\LargeTile.scale-100.png" /> <Content Include="Assets\LargeTile.scale-125.png" /> Loading INAF.Apps.Uwp.SLabDataManager/Strings/en-us/Resources.resw +6 −0 Original line number Diff line number Diff line Loading @@ -372,4 +372,10 @@ <data name="RefWhiteSpectrumSummaryLabel" xml:space="preserve"> <value>REF WHITE Spectrum summary</value> </data> <data name="NoNormalizationAvailableMessage" xml:space="preserve"> <value>Couldn't normalize spectrum since ref spectrum has not been loaded</value> </data> <data name="RefWhiteSpectrumNotAvailable" xml:space="preserve"> <value>Couldn't normalize spectrum since ref white spectrum has not been loaded</value> </data> </root> No newline at end of file Loading
INAF.Apps.Uwp.SLabDataManager/Assets/icons/Warning_big.png 0 → 100644 +1.73 KiB Loading image diff...
INAF.Apps.Uwp.SLabDataManager/Charts/SpectraContainer.cs +43 −14 Original line number Diff line number Diff line Loading @@ -56,13 +56,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts } #region properties public string ErrorMessage { get; private set; } public string DialogMessage { get; private set; } private bool isError; public bool IsError public DialogMessageType DialogMessageType { get; private set; } private bool isDialogRequired; public bool IsDialogRequired { get { return isError; } set { SetProperty(ref isError, value); } get { return isDialogRequired; } set { SetProperty(ref isDialogRequired, value); } } private bool isAnySummaryUpdated; Loading Loading @@ -330,8 +332,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts public async Task alignRawSpectrumAsync() { IsError = false; ErrorMessage = string.Empty; IsDialogRequired = false; DialogMessage = string.Empty; SpectrumModel aligningSpectrum = null; Loading @@ -342,11 +344,39 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts { aligningSpectrum = createAligningSpectrum(); /* try to retrieve the ref white max value for normalizing raw spectrum during alignment process */ double refWhiteMaxY = 1d; var refWhiteSpectrum = tryGetSpectrumOfType(SpectrumType.RefWhite); if (refWhiteSpectrum != null) if (refWhiteSpectrum == null) { UpdateUIHelper.UpdateUIAsync(() => { DialogMessageType = DialogMessageType.Warning; DialogMessage = "RefWhiteSpectrumNotAvailable".GetText(); IsDialogRequired = true; }); } else refWhiteMaxY = refWhiteSpectrum.Elements.Max(x => x.Y); /* try to retrieve ref spectrum for normalizing raw spectrum during alignment process */ var refSpectrum = tryGetSpectrumOfType(SpectrumType.Ref); if (refSpectrum == null) { UpdateUIHelper.UpdateUIAsync(() => { DialogMessageType = DialogMessageType.Warning; DialogMessage = "NoNormalizationAvailableMessage".GetText(); IsDialogRequired = true; }); } /* normalize spectrum, if possible */ if (refWhiteSpectrum != null && refSpectrum != null) { multiplyByRef(ref aligningSpectrum, refWhiteSpectrum); refWhiteMaxY, refSpectrum); } /* retrieve the reference segment and calculate the mean values at the borders of the segment for aligning other segments */ Loading Loading @@ -380,8 +410,8 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts Spectra.Add(aligningSpectrum); else { ErrorMessage = exMsg; IsError = true; DialogMessage = exMsg; IsDialogRequired = true; } } Loading Loading @@ -429,16 +459,15 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts } private void multiplyByRef(ref SpectrumModel aligningSpectrum, double refWhiteMaxY, SpectrumModel refSpectrum) { double refMaxY = refSpectrum.Elements.Max(x => x.Y); aligningSpectrum.Elements .AsParallel() .ForAll(x => { var refElement = refSpectrum.Elements.FirstOrDefault(y => y.X == x.X); x.updateY(x.Y * refElement.Y / refMaxY); x.updateY(x.Y * refElement.Y / refWhiteMaxY); }); } #endregion Loading
INAF.Apps.Uwp.SLabDataManager/INAF.Apps.Uwp.SLabDataManager.csproj +1 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,7 @@ <Content Include="Assets\icons\Ok.png" /> <Content Include="Assets\icons\Ok_big.png" /> <Content Include="Assets\icons\Warning.png" /> <Content Include="Assets\icons\Warning_big.png" /> <Content Include="Assets\images\em_spectrum_400x400.png" /> <Content Include="Assets\LargeTile.scale-100.png" /> <Content Include="Assets\LargeTile.scale-125.png" /> Loading
INAF.Apps.Uwp.SLabDataManager/Strings/en-us/Resources.resw +6 −0 Original line number Diff line number Diff line Loading @@ -372,4 +372,10 @@ <data name="RefWhiteSpectrumSummaryLabel" xml:space="preserve"> <value>REF WHITE Spectrum summary</value> </data> <data name="NoNormalizationAvailableMessage" xml:space="preserve"> <value>Couldn't normalize spectrum since ref spectrum has not been loaded</value> </data> <data name="RefWhiteSpectrumNotAvailable" xml:space="preserve"> <value>Couldn't normalize spectrum since ref white spectrum has not been loaded</value> </data> </root> No newline at end of file