本文整理汇总了C#中BasicLib.Param.Parameters类的典型用法代码示例。如果您正苦于以下问题:C# Parameters类的具体用法?C# Parameters怎么用?C# Parameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Parameters类属于BasicLib.Param命名空间,在下文中一共展示了Parameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init(Parameters parameters1, float paramNameWidth, int totalWidth)
{
Parameters = parameters1;
int nrows = Parameters.GroupCount;
parameterGroupPanels = new ParameterGroupPanel[nrows];
tableLayoutPanel = new TableLayoutPanel();
SuspendLayout();
tableLayoutPanel.ColumnCount = 1;
tableLayoutPanel.ColumnStyles.Clear();
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableLayoutPanel.Dock = DockStyle.None;
tableLayoutPanel.Location = new Point(0, 0);
tableLayoutPanel.Name = "tableLayoutPanel";
tableLayoutPanel.RowCount = nrows + 1;
tableLayoutPanel.RowStyles.Clear();
float totalHeight = 0;
for (int i = 0; i < nrows; i++){
float h = parameters1.GetGroup(i).Height + 26;
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize, h));
totalHeight += h + 6;
}
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
tableLayoutPanel.Size = new Size(totalWidth, (int) totalHeight);
tableLayoutPanel.TabIndex = 0;
for (int i = 0; i < nrows; i++){
AddParameterGroup(parameters1.GetGroup(i), i, paramNameWidth, totalWidth);
}
AutoScaleDimensions = new SizeF(6F, 13F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Clear();
Controls.Add(tableLayoutPanel);
Name = "ParameterPanel";
Size = new Size(totalWidth, (int) totalHeight);
ResumeLayout(true);
}
示例2: BoolWithSubParams
public BoolWithSubParams(string name, bool value)
: base(name)
{
Value = value;
Default = value;
SubParamsFalse = new Parameters();
SubParamsTrue = new Parameters();
}
示例3: AddIntSubParams
private static void AddIntSubParams(ICollection<IntParam> result, Parameters sp)
{
foreach (Parameter p in sp.GetAllParameters()){
if (p is IntParam){
result.Add((IntParam) p);
} else if (p is ParameterWithSubParams){
AddIntSubParams(result, ((ParameterWithSubParams) p).GetSubParameters());
}
}
}
示例4: FilterRows
public static void FilterRows(IMatrixData mdata, Parameters parameters, int[] rows)
{
bool reduceMatrix = GetReduceMatrix(parameters);
if (reduceMatrix){
mdata.ExtractExpressionRows(rows);
} else{
Array.Sort(rows);
string[][] col = new string[mdata.RowCount][];
for (int i = 0; i < col.Length; i++){
bool contains = Array.BinarySearch(rows, i) >= 0;
col[i] = contains ? new[]{"Keep"} : new[]{"Discard"};
}
mdata.AddCategoryColumn("Filter", "", col);
}
}
示例5: FilterColumns
public static void FilterColumns(IMatrixData mdata, Parameters parameters, int[] cols)
{
bool reduceMatrix = GetReduceMatrix(parameters);
if (reduceMatrix){
mdata.ExtractExpressionColumns(cols);
} else{
Array.Sort(cols);
string[][] row = new string[mdata.ExpressionColumnCount][];
for (int i = 0; i < row.Length; i++){
bool contains = Array.BinarySearch(cols, i) >= 0;
row[i] = contains ? new[]{"Keep"} : new[]{"Discard"};
}
mdata.AddCategoryRow("Filter", "", row);
}
}
示例6: ParameterForm
public ParameterForm(Parameters parameters, string title, string helpDescription, string helpOutput,
IList<string> helpSuppls)
{
InitializeComponent();
parameterPanel1.Init(parameters);
string text = "";
if (!string.IsNullOrEmpty(helpDescription)){
text += "\n\nDescription:\n " + helpDescription;
}
if (!string.IsNullOrEmpty(helpOutput)){
text += "\n\nOutput:\n " + helpOutput;
}
if (helpSuppls != null){
for (int i = 0; i < helpSuppls.Count; i++){
if (!string.IsNullOrEmpty(helpSuppls[i])){
text += "\n\nSuppl. table " + (i + 1) + ":\n " + helpSuppls[i];
}
}
}
helpTextBox.Text = text;
Text = title;
}
示例7: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
{
float value = (float) param.GetDoubleParam("Value").Value;
ReplaceMissingsByVal(value, mdata);
}
示例8: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
SingleChoiceWithSubParams access = param.GetSingleChoiceWithSubParams("Matrix access");
bool rows = access.Value == 0;
int groupInd;
if (rows){
groupInd = access.GetSubParameters().GetSingleChoiceParam("Grouping").Value - 1;
} else{
groupInd = -1;
}
int what = param.GetSingleChoiceParam("Subtract what").Value;
if (groupInd < 0){
SubtractValues(rows, GetFunc(what), mdata, processInfo.NumThreads);
} else{
string[][] catRow = mdata.GetCategoryRowAt(groupInd);
foreach (string[] t in catRow){
if (t.Length > 1){
processInfo.ErrString = "The groups are overlapping.";
return;
}
}
SubtractGroups(mdata, catRow, GetFunc(what));
}
}
示例9: ProcessData
public void ProcessData(IMatrixData data, Parameters param, ref IMatrixData[] supplTables,
ref IDocumentData[] documents, ProcessInfo processInfo)
{
bool falseAreIndicated = param.GetSingleChoiceParam("Indicated are").Value == 0;
int catCol = param.GetSingleChoiceParam("In column").Value;
string word = param.GetStringParam("Indicator").Value;
int[] scoreColumns = param.GetMultiChoiceParam("Scores").Value;
if (scoreColumns.Length == 0){
processInfo.ErrString = "Please specify at least one column with scores.";
return;
}
bool largeIsGood = param.GetBoolParam("Large values are good").Value;
int[] showColumns = param.GetMultiChoiceParam("Display quantity").Value;
if (showColumns.Length == 0){
processInfo.ErrString = "Please select at least one quantity to display";
return;
}
bool[] indCol = GetIndicatorColumn(falseAreIndicated, catCol, word, data);
List<string> expColNames = new List<string>();
List<float[]> expCols = new List<float[]>();
foreach (int scoreColumn in scoreColumns){
double[] vals = scoreColumn < data.NumericColumnCount
? data.NumericColumns[scoreColumn]
: ArrayUtils.ToDoubles(data.GetExpressionColumn(scoreColumn - data.NumericColumnCount));
string name = scoreColumn < data.NumericColumnCount
? data.NumericColumnNames[scoreColumn] : data.ExpressionColumnNames[scoreColumn - data.NumericColumnCount];
int[] order = GetOrder(vals, largeIsGood);
CalcCurve(ArrayUtils.SubArray(indCol, order), showColumns, name, expCols, expColNames);
}
float[,] expData = ToMatrix(expCols);
data.SetData(data.Name, expColNames, expData, new List<string>(), new List<string[]>(), new List<string>(),
new List<string[][]>(), new List<string>(), new List<double[]>(), new List<string>(), new List<double[][]>());
}
示例10: AnalyzeData
public IAnalysisResult AnalyzeData(IMatrixData mdata, Parameters param, ProcessInfo processInfo)
{
return new SelectRowsManuallyResult(mdata);
}
示例11: GetMaxThreads
public int GetMaxThreads(Parameters parameters)
{
return int.MaxValue;
}
示例12: GetReduceMatrix
private static bool GetReduceMatrix(Parameters parameters)
{
return parameters.GetSingleChoiceParam("Filter mode").Value == 0;
}
示例13: ProcessData
public void ProcessData(IMatrixData mdata, Parameters param, ref IMatrixData[] supplTables, ProcessInfo processInfo)
{
double width = param.GetDoubleParam("Width").Value;
double shift = param.GetDoubleParam("Down shift").Value;
bool separateColumns = param.GetSingleChoiceParam("Mode").Value == 0;
if (separateColumns){
ReplaceMissingsByGaussianByColumn(width, shift, mdata);
} else{
ReplaceMissingsByGaussianWholeMatrix(width, shift, mdata);
}
}
示例14: ProcessDataCreate
private static void ProcessDataCreate(IMatrixData mdata, Parameters param)
{
string name = param.GetStringParam("Row name").Value;
double[] groupCol = new double[mdata.ExpressionColumnCount];
for (int i = 0; i < mdata.ExpressionColumnCount; i++){
string ename = mdata.ExpressionColumnNames[i];
double value = param.GetDoubleParam(ename).Value;
groupCol[i] = value;
}
mdata.AddNumericRow(name, name, groupCol);
}
示例15: 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);
}
}