当前位置: 首页>>代码示例>>C#>>正文


C# Parameters.GetIntParam方法代码示例

本文整理汇总了C#中BasicLib.Param.Parameters.GetIntParam方法的典型用法代码示例。如果您正苦于以下问题:C# Parameters.GetIntParam方法的具体用法?C# Parameters.GetIntParam怎么用?C# Parameters.GetIntParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BasicLib.Param.Parameters的用法示例。


在下文中一共展示了Parameters.GetIntParam方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int[] colIndx = param.GetMultiChoiceParam("x").Value;
            int[] colIndy = param.GetMultiChoiceParam("y").Value;
            if (colIndx.Length == 0){
                processInfo.ErrString = "Please select some columns";
                return;
            }
            if (colIndx.Length != colIndy.Length){
                processInfo.ErrString = "Please select the same number of columns in the boxes for the first and second columns.";
                return;
            }
            int typeInd = param.GetSingleChoiceParam("Distribution type").Value;
            int points = param.GetIntParam("Number of points").Value;
            for (int k = 0; k < colIndx.Length; k++){
                float[] xvals = GetColumn(mdata, colIndx[k]);
                float[] yvals = GetColumn(mdata, colIndy[k]);
                float[] xvals1;
                float[] yvals1;
                NumUtils.GetValidPairs(xvals, yvals, out xvals1, out yvals1);
                double xmin;
                double xmax;
                double ymin;
                double ymax;
                DensityEstimation.CalcRanges(xvals1, yvals1, out xmin, out xmax, out ymin, out ymax);
                float[,] values = DensityEstimation.GetValuesOnGrid(xvals1, xmin, (xmax - xmin)/points, points, yvals1, ymin,
                    (ymax - ymin)/points, points);
                if (typeInd == 1 || typeInd == 3){
                    MakeConditional1(values);
                }
                if (typeInd == 2 || typeInd == 3){
                    MakeConditional2(values);
                }
                DensityEstimation.DivideByMaximum(values);
                double[] xmat = new double[points];
                for (int i = 0; i < points; i++){
                    xmat[i] = xmin + i*(xmax - xmin)/points;
                }
                double[] ymat = new double[points];
                for (int i = 0; i < points; i++){
                    ymat[i] = ymin + i*(ymax - ymin)/points;
                }
                float[,] percvalues = CalcExcludedPercentage(values);
                double[] dvals = new double[xvals.Length];
                double[] pvals = new double[xvals.Length];
                for (int i = 0; i < dvals.Length; i++){
                    double xx = xvals[i];
                    double yy = yvals[i];
                    if (!double.IsNaN(xx) && !double.IsNaN(yy)){
                        int xind = ArrayUtils.ClosestIndex(xmat, xx);
                        int yind = ArrayUtils.ClosestIndex(ymat, yy);
                        dvals[i] = values[xind, yind];
                        pvals[i] = percvalues[xind, yind];
                    } else{
                        dvals[i] = double.NaN;
                        pvals[i] = double.NaN;
                    }
                }
                string xname = GetColumnName(mdata, colIndx[k]);
                string yname = GetColumnName(mdata, colIndy[k]);
                mdata.AddNumericColumn("Density_" + xname + "_" + yname,
                    "Density of data points in the plane spanned by the columns " + xname + " and " + yname + ".", dvals);
                mdata.AddNumericColumn("Excluded fraction_" + xname + "_" + yname,
                    "Percentage of points with a point density smaller than at this point in the plane spanned by the columns " + xname +
                        " and " + yname + ".", pvals);
            }
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:68,代码来源:DensityEstimationProcessing.cs

示例2: ProcessData

 public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
 {
     int numQuantiles = param.GetIntParam("Number of quantiles").Value;
     int[] colInds = param.GetMultiChoiceParam("Columns").Value;
     foreach (int colInd in colInds){
         float[] vals = mdata.GetExpressionColumn(colInd);
         List<int> v = new List<int>();
         for (int i = 0; i < vals.Length; i++){
             if (!float.IsNaN(vals[i])){
                 v.Add(i);
             }
         }
         int[] o = v.ToArray();
         vals = ArrayUtils.SubArray(vals, o);
         int[] q = ArrayUtils.Order(vals);
         o = ArrayUtils.SubArray(o, q);
         string[][] catCol = new string[mdata.RowCount][];
         for (int i = 0; i < catCol.Length; i++){
             catCol[i] = new[]{"missing"};
         }
         for (int i = 0; i < o.Length; i++){
             int catVal = (i*numQuantiles)/o.Length + 1;
             catCol[o[i]] = new[]{"Q" + catVal};
         }
         string name = mdata.ExpressionColumnNames[colInd] + "_q";
         string desc = "The column " + mdata.ExpressionColumnNames[colInd] + " has been divided into " + numQuantiles +
             " quantiles.";
         mdata.AddCategoryColumn(name, desc, catCol);
     }
 }
开发者ID:BAngermann,项目名称:perseus-plugins,代码行数:30,代码来源:Quantiles.cs

示例3: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            const bool rows = false;
            int minValids = param.GetIntParam("Min. number of values").Value;
            SingleChoiceWithSubParams modeParam = param.GetSingleChoiceWithSubParams("Mode");
            int modeInd = modeParam.Value;
            if (modeInd != 0 && mdata.CategoryRowNames.Count == 0){
                processInfo.ErrString = "No grouping is defined.";
                return;
            }
            if (modeInd != 0){
                processInfo.ErrString = "Group-wise filtering can only be appled to rows.";
                return;
            }
            SingleChoiceWithSubParams x = param.GetSingleChoiceWithSubParams("Values should be");
            Parameters subParams = x.GetSubParameters();
            int shouldBeIndex = x.Value;
            FilteringMode filterMode;
            double threshold = double.NaN;
            double threshold2 = double.NaN;
            switch (shouldBeIndex){
                case 0:
                    filterMode = FilteringMode.Valid;
                    break;
                case 1:
                    filterMode = FilteringMode.GreaterThan;
                    threshold = subParams.GetDoubleParam("Minimum").Value;
                    break;
                case 2:
                    filterMode = FilteringMode.GreaterEqualThan;
                    threshold = subParams.GetDoubleParam("Minimum").Value;
                    break;
                case 3:
                    filterMode = FilteringMode.LessThan;
                    threshold = subParams.GetDoubleParam("Maximum").Value;
                    break;
                case 4:
                    filterMode = FilteringMode.LessEqualThan;
                    threshold = subParams.GetDoubleParam("Maximum").Value;
                    break;
                case 5:
                    filterMode = FilteringMode.Between;
                    threshold = subParams.GetDoubleParam("Minimum").Value;
                    threshold2 = subParams.GetDoubleParam("Maximum").Value;
                    break;
                case 6:
                    filterMode = FilteringMode.Outside;
                    threshold = subParams.GetDoubleParam("Minimum").Value;
                    threshold2 = subParams.GetDoubleParam("Maximum").Value;
                    break;
                default:
                    throw new Exception("Should not happen.");
            }
            if (modeInd != 0){
                int gind = modeParam.GetSubParameters().GetSingleChoiceParam("Grouping").Value;
                string[][] groupCol = mdata.GetCategoryRowAt(gind);
                NonzeroFilterGroup(minValids, mdata, param, modeInd == 2, threshold, threshold2, filterMode, groupCol);
            } else{
                NonzeroFilter1(rows, minValids, mdata, param, threshold, threshold2, filterMode);
            }
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:62,代码来源:FilterValidValuesColumns.cs

示例4: ProcessData

 public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
 {
     bool rows = param.GetSingleChoiceParam("Matrix access").Value == 0;
     bool atLeast = param.GetSingleChoiceParam("Side").Value == 0;
     int numValids = param.GetIntParam("Number of valid values").Value;
     SingleChoiceWithSubParams modeParam = param.GetSingleChoiceWithSubParams("Mode");
     int modeInd = modeParam.Value;
     if (modeInd != 0 && mdata.CategoryRowNames.Count == 0){
         processInfo.ErrString = "No grouping is defined.";
         return;
     }
     if (modeInd != 0 && !rows){
         processInfo.ErrString = "Group-wise filtering can only be appled to rows.";
         return;
     }
     if (modeInd != 0){
         int gind = modeParam.GetSubParameters().GetSingleChoiceParam("Grouping").Value;
         string[][] groupCol = mdata.CategoryRows[gind];
         ValidValueFilterGroup(numValids, mdata, param, modeInd == 2, groupCol, atLeast);
     } else{
         ValidValueFilter1(rows, numValids, mdata, param, atLeast);
     }
 }
开发者ID:BAngermann,项目名称:perseus-plugins,代码行数:23,代码来源:FilterValidValues.cs

示例5: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int minCount = param.GetIntParam("Min. count").Value;
            int selCol = param.GetSingleChoiceParam("Selection").Value;
            string value = param.GetStringParam("Value").Value;
            int[] catIndices = param.GetMultiChoiceParam("Categories").Value;
            bool[] selection = null;
            if (selCol < mdata.CategoryColumnCount){
                selection = new bool[mdata.RowCount];
                string[][] x = mdata.GetCategoryColumnAt(selCol);
                for (int i = 0; i < selection.Length; i++){
                    if (x[i] != null){
                        for (int j = 0; j < x[i].Length; j++){
                            if (x[i][j].Equals(value)){
                                selection[i] = true;
                                break;
                            }
                        }
                    }
                }
            }
            CountingResult result = CountCategories(mdata, selection, selCol, catIndices);
            CreateMatrixData(result, mdata, minCount, selection);
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:25,代码来源:CategoryCounting.cs

示例6: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int avType = param.GetSingleChoiceParam("Average type").Value;
            if (mdata.CategoryRowCount == 0){
                processInfo.ErrString = "No category rows were loaded.";
                return;
            }
            int groupColInd = param.GetSingleChoiceParam("Grouping").Value;
            int validVals = param.GetIntParam("Min. valid values per group").Value;
            bool keep = param.GetBoolParam("Keep original data").Value;
            bool sdev = param.GetBoolParam("Add standard deviation").Value;
            Func<IList<double>, double> func;
            switch (avType){
                case 0:
                    func = ArrayUtils.Median;
                    break;
                case 1:
                    func = ArrayUtils.Mean;
                    break;
                case 2:
                    func = ArrayUtils.Sum;
                    break;
                case 3:
                    func = ArrayUtils.GeometricMean;
                    break;
                default:
                    throw new Exception("Never get here.");
            }
            if (sdev) {
                AddStandardDeviation(groupColInd, validVals, mdata);
            }
            if (keep) {
                FillMatrixKeep(groupColInd, validVals, mdata, func);
            } else{
                FillMatrixDontKeep(groupColInd, validVals, mdata, func);
            }
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:38,代码来源:AverageGroups.cs

示例7: ProcessData

        public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
			ref IDocumentData[] documents, ProcessInfo processInfo)
        {
            int nrows = param.GetIntParam("Number of rows").Value;
            nrows = Math.Min(nrows, mdata.RowCount);
            Random2 rand = new Random2();
            int[] rows = ArrayUtils.SubArray(rand.NextPermutation(mdata.RowCount), nrows);
            PerseusPluginUtils.FilterRows(mdata, param, rows);
        }
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:9,代码来源:FilterRandomRows.cs


注:本文中的BasicLib.Param.Parameters.GetIntParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。