public void Run(IContext ctx) { resultSet = new DataSet(); DataTable K_Table = ctx.GetData("RepresentationCheck").Tables["Coefficient"]; DataTable SigmaTable = new DataTable() { TableName = "Standarts" }; SigmaTable.Columns.Add("n"); SigmaTable.Columns.Add("Sigma_k_srednee"); SigmaTable.Columns.Add("Sigma_k_sigma"); SigmaTable.Columns.Add("Sigma_k_cv"); SigmaTable.Columns.Add("Sigma_k_cs"); SigmaTable.Columns.Add("Sigma_k_eta"); DataTable paramsTable = data.Tables["params"]; var attrs = typeof(Standarts).GetCustomAttributes<ParameterAttribute>(); int n = (int)attrs.First((param) => { return param.Name == "n"; }).DefaultValue; foreach (DataRow row in paramsTable.Rows) { switch (row["Name"].ToString()) { case "n": n = int.Parse(row["Value"].ToString()); break; } } RepresentationCheck represent = new RepresentationCheck(); statistics stat = new statistics(); DataRow rows = SigmaTable.NewRow(); rows["n"] = n; double[] k = represent.TableValues(K_Table, 1); double sigma = stat.standart(k); rows["Sigma_k_srednee"] = sigma; k = represent.TableValues(K_Table, 2); sigma = stat.standart(k); rows["Sigma_k_sigma"] = sigma; k = represent.TableValues(K_Table, 3); sigma = stat.standart(k); rows["Sigma_k_cv"] = sigma; k = represent.TableValues(K_Table, 4); sigma = stat.standart(k); rows["Sigma_k_cs"] = sigma; k = represent.TableValues(K_Table, 5); sigma = stat.standart(k); rows["Sigma_k_eta"] = sigma; SigmaTable.Rows.Add(rows); resultSet.Tables.Add(SigmaTable); }
public void Run(IContext ctx) { resultSet = new DataSet(); DataTable pTable = new DataTable() { TableName = "Probability" }; DataTable K_Table = ctx.Data.Tables["Coefficient"]; pTable.Columns.Add("k_srednee"); pTable.Columns.Add("k_sigma"); pTable.Columns.Add("k_cv"); pTable.Columns.Add("k_cs"); pTable.Columns.Add("k_eta"); RepresentationCheck represent = new RepresentationCheck(); DataTable paramsTable = data.Tables["params"]; var attrs = typeof(Probability).GetCustomAttributes<ParameterAttribute>(); int resN = (int)attrs.First((param) => { return param.Name == "resN"; }).DefaultValue; foreach (DataRow row in paramsTable.Rows) { switch (row["Name"].ToString()) { case "resN": resN = int.Parse(row["Value"].ToString()); break; } } for (int i = 0; i < resN; i++) { DataRow row = pTable.NewRow(); pTable.Rows.Add(row); } for (int type_k = 1; type_k < 6; type_k++) { statistics stat = new statistics(); double[] k = represent.TableValues(K_Table, type_k); k = stat.sort_shell(k, k.Length); for (int i = 0; i < resN; i++) { pTable.Rows[i][type_k-1] = k[(int)Math.Round((double)i * ((double)(k.Length - 1)) / ((double)(resN - 1)))]; } } resultSet.Tables.Add(pTable); }