Exemple #1
0
        public FFTForm(Result1D source, DisplayGuidPane parent)
        {
            InitializeComponent( );

            fft             = new FFTCalculator(source);
            this.parentForm = parent;
        }
        /// <summary>
        /// Read the result from xml file
        /// </summary>
        public override Result Load()
        {
            XPathDocument  document  = new XPathDocument(outputResultFile);
            XPathNavigator navigator = document.CreateNavigator( );

            navigator.MoveToChild("Document", string.Empty);
            float unitKeyValue = float.Parse(navigator.GetAttribute(keyAttribute, string.Empty));

            XPathNodeIterator nodes  = navigator.Select(xPath);
            Result1D          result = new Result1D(DataDomainType.TimeDomain, "Time", name);
            int index = 0;

            while (nodes.MoveNext( ))
            {
                //Value
                XPathNavigator elementNode = nodes.Current.Clone( );
                float          value       = float.Parse(elementNode.GetAttribute(valueAttribute, string.Empty));
                result.Keys.Add(unitKeyValue * index);
                result.Values.Add(value);

                index++;
            }

            return(result);
        }
        private void btnFFT_Click(object sender, EventArgs e)
        {
            if (tvResultGuide.SelectedNode != null &&
                tvResultGuide.SelectedNode.Tag != null)
            {
                OutputReader reader = tvResultGuide.SelectedNode.Tag as OutputReader;

                Result1D result1d = reader.Load() as Result1D;

                if (result1d != null && result1d.Domain == DataDomainType.TimeDomain)
                {
                    FFTForm fft = new FFTForm(result1d, this);
                    fft.Show( );
                }
            }
        }
        /// <summary>
        /// Read the result from xml file
        /// </summary>
        public override Result Load()
        {
            XPathDocument     document  = new XPathDocument(outputResultFile);
            XPathNavigator    navigator = document.CreateNavigator( );
            XPathNodeIterator nodes     = navigator.Select(xPath);

            Result1D result = new Result1D(DataDomainType.FrequencyDomain, keyAttribute, name);

            while (nodes.MoveNext( ))
            {
                //Value
                XPathNavigator elementNode = nodes.Current.Clone( );
                float          value       = float.Parse(elementNode.GetAttribute(valueAttribute, string.Empty));
                result.Values.Add(value);

                //Key
                elementNode.MoveToParent( );
                float key = float.Parse(elementNode.GetAttribute(keyAttribute, string.Empty));
                result.Keys.Add(key);
            }

            return(result);
        }
Exemple #5
0
        public FFTCalculator(Result1D source)
        {
            this.timeDomainSource = source;

            PreCalculate( );
        }