Commit 785258b5 authored by Francesco Carraro's avatar Francesco Carraro
Browse files

added reading of fit functions from xml

parent 14af6952
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -2,9 +2,9 @@
using INAF.Apps.Uwp.SLabDataManager.Charts;
using INAF.Apps.Uwp.SLabDataManager.Charts.Containers;
using INAF.Apps.Uwp.SLabDataManager.Helpers;
using INAF.Apps.Uwp.SLabDataManager.Helpers.ConfigHelpers;
using INAF.Apps.Uwp.SLabDataManager.Helpers.RemoteOperations;
using INAF.Apps.Uwp.SLabDataManager.Helpers.UI.Chart;
using INAF.Apps.Uwp.SLabDataManager.Helpers.XmlReaders;
using INAF.Apps.Uwp.SLabDataManager.Models;
using INAF.Apps.Uwp.SLabDataManager.Models.Spectrum;
using INAF.Apps.Uwp.SLabDataManager.Services;
@@ -24,8 +24,6 @@ using Microsoft.Toolkit.Mvvm.DependencyInjection;
using System;
using System.Collections.Generic;
using Windows.ApplicationModel.Activation;
using Windows.UI;
using Windows.UI.WindowManagement;
using Windows.UI.Xaml;

namespace INAF.Apps.Uwp.SLabDataManager
@@ -116,13 +114,16 @@ namespace INAF.Apps.Uwp.SLabDataManager
                new ServiceCollection()
                /* singletons */
                .AddSingleton<ChartAnnotationsHelper>()
                .AddSingleton<ContinuumSpectraContainer>()
                .AddSingleton<CustomLinesAnnotationsRepository>()
                .AddSingleton<FitMethodsContainer>()
                .AddSingleton<Logger>(logger)
                .AddSingleton<RecentFilesHelper>()
                .AddSingleton<RemoteOperationsRepository>()
                .AddSingleton<SecondaryWindowHelper>()
                .AddSingleton<SelectedRefBand>()
                .AddSingleton<SettingsHelper>()
                .AddSingleton<SpectraContainer>()
                .AddSingleton<SpectrumAlignmentConfigModel>()
                .AddSingleton<SpectrumChartOptionsModel>()
                .AddSingleton<StorageItemsSettingsHelper>()
@@ -133,11 +134,10 @@ namespace INAF.Apps.Uwp.SLabDataManager
                /* transient */
                .AddTransient<AuthenticationManager>()
                .AddTransient<ConfigReader>()
                .AddTransient<ContinuumSpectraContainer>()
                .AddTransient<FitFunctionsReader>()
                .AddTransient<RemoteOperationsHelper>()
                .AddTransient<RemoteOperationsManager>()
                .AddTransient<RemoteOperationsXmlReader>()
                .AddTransient<SpectraContainer>()
                .AddTransient<SpectrumModelFactory>()
                .AddTransient<SpectrumProcessingHelper>()
                .AddTransient<SpectrumReader>()
+30 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8" ?>
<functions>
	<function name="Linear spline">
		<methodName>buildSpline1DFitInterpolant</methodName>
		<parameter name="Regularization constant">
			<default>0.0001</default>
			<minimum>0.0001</minimum>
			<maximum>1</maximum>
		</parameter>
		<explanation>"Param:Regularization constant passed by user;Meaning:Value must be >= 0"</explanation>
	</function>
	<function name="Cubic spline">
		<methodName>buildSpline1DFitCubicInterpolant</methodName>
		<parameter name="Number of basis functions">
			<default>4</default>
			<minimum>4</minimum>
			<maximum>100</maximum>
		</parameter>
		<explanation>"Param:Number of basis functions;Meaning:Value must be >= 4"</explanation>
	</function>
	<function name="Hermite spline">
		<methodName>buildSpline1DFitHermiteInterpolant</methodName>
		<parameter name="Number of basis functions">
			<default>4</default>
			<minimum>4</minimum>
			<maximum>100</maximum>
		</parameter>
		<explanation>"Param:Number of basis functions;Meaning:Value must be >= 4"</explanation>
	</function>
</functions>
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers
            tasks.Add(Task.Run(() =>
            {
                List<double> xvalues = new List<double>();
                foreach (var spectrum in spectra)
                foreach (var spectrum in Spectra)
                {
                    if (spectrum.IsVisible)
                        xvalues.AddRange(spectrum.Elements.Select(x => x.X));
@@ -167,7 +167,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts.Containers
            tasks.Add(Task.Run(() =>
            {
                List<double> yvalues = new List<double>();
                foreach (var spectrum in spectra)
                foreach (var spectrum in Spectra)
                {
                    if (spectrum.IsVisible)
                        yvalues.AddRange(spectrum.Elements.Select(x => x.Y));
+5 −0
Original line number Diff line number Diff line
@@ -70,5 +70,10 @@ namespace INAF.Apps.Uwp.SLabDataManager.Helpers
            Colors.Add("#ff494368".ToSolidColorBrush());
            Colors.Add("#ff92AFD7".ToSolidColorBrush());
        }

        public void reset()
        {
            Index = 0;
        }
    }
}
+20 −0
Original line number Diff line number Diff line
using INAF.Apps.Uwp.SLabDataManager.Models.Fit;
using System.Collections.Generic;

namespace INAF.Apps.Uwp.SLabDataManager.Helpers
{
    public  class FitMethodsContainer
    {
        public FitMethodsContainer()
        {
            FitMethods = new List<FitMethodModel>();
        }

        public List<FitMethodModel> FitMethods { get; private set; }

        public void add(FitMethodModel fitMethod)
        {
            FitMethods.Add(fitMethod);
        }
    }
}
Loading