예제 #1
0
 /// <summary>
 /// 将光谱数据延着X轴方向扩展
 /// </summary>
 /// <param name="b"></param>
 public void Expand(SpecBase b)
 {
     if (b == null)
     {
         Log.Error("错误的输入");
         return;
     }
     this.Axis.X = Data.Tools.InsertColumn(this.Axis.X, b.Axis.X, this.Axis.X.Length + 1);
     //扩展x矩阵
     this._x = Data.Tools.InsertRow(this._x, b.X, this._x.Dimensions[0] + 1);
 }
예제 #2
0
        /// <summary>
        /// 获取子光谱库
        /// </summary>
        /// <param name="idxs"></param>
        /// <returns></returns>
        public SpecBase SubLib(int[] idxs)
        {
            var lib = new SpecBase()
            {
                Components = this.Components,
                Axis       = this.Axis
            };

            lib.Specs = new List <Spectrum>();
            foreach (var i in idxs)
            {
                lib.Specs.Add(this._specs[i]);
            }
            idxs  = idxs.Select(d => d + 1).ToArray();
            lib.X = Data.Tools.SelectColumn(this._x, idxs);
            lib.Y = Data.Tools.SelectRow(this._y, idxs);
            return(lib);
        }
예제 #3
0
        /// <summary>
        /// 合并光谱
        /// </summary>
        /// <param name="b"></param>
        public void Merger(SpecBase b)
        {
            if (b == null)
            {
                Log.Error("错误的输入");
                return;
            }
            var cnames = this._components.Select(d => d.Name).ToList();
            //合并性质
            var notInca = b.Components.Where(c => !cnames.Contains(c.Name));

            foreach (var c in notInca)
            {
                this.Comp_Add(c);
            }

            //合并光谱
            foreach (var s in b)
            {
                this.Add(s);
            }
        }