public async Task <List <AnalyzeResult> > Analyze(List <LotteryRecord> records, int period, int variableTwo) { return(await Task.Run(() => { records = records.OrderByDescending(r => r.ID).Take(period).OrderBy(o => o.ID).ToList(); var result = new List <AnalyzeResult>(); var dataMatrix = new Matrix(new double[, ] { { 1, 0 }, { 0, 0 }, { 1, 0 }, { 0, 0 }, { 1, 0 }, { 0, 0 }, { 1, 0 }, { 0, 0 } }); var transform = new WaveletTransform(new HaarLift(), 1); dataMatrix = transform.DoForward(dataMatrix); return result; })); }
//------------------------------------------------Вейвлет----------------------------------------------------------------------- private void button7_Click(object sender, EventArgs e) { //---------------Вейвлет---------------------------------- double[,] frame_mass = new double[frames, 512]; //массив всех фреймов по 512 set_frames(frame_mass); Hamming_window(frame_mass, frames); var dataMatrix = new Matrix(frame_mass); var transform = new WaveletTransform(new HaarLift(), 2); dataMatrix = transform.DoForward(dataMatrix); string wavelet_str = dataMatrix.ToString(); double[] wavelet_mass = wavelet_str.Split(new char[] { ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(n => double.Parse(n)).ToArray(); pictureBox4.Width = wavelet_mass.Length; //подгоняем ширину графика под кол-во данных Bitmap bmp = new Bitmap(pictureBox4.Width, pictureBox4.Height); //создаём в оперативной памяти новый рисунок Graphics gr = Graphics.FromImage(bmp); Pen VioletPen = new Pen(Color.BlueViolet, 1); Pen RedPen = new Pen(Color.Red, 1); for (int i = 0; i < wavelet_mass.Length; i++) { gr.DrawLine(VioletPen, i, bmp.Height, i, bmp.Height - bmp.Height * Convert.ToInt32(wavelet_mass[i]) / 10000); } for (int i = 0; i < wavelet_mass.Length; i = i + 256) { gr.DrawLine(RedPen, new Point(i, 0), new Point(i, 200)); } pictureBox4.Image = bmp; }