public void DoValidate() { Debug.Log("<color=red>start of thing==========================</color>"); for (int i = 0; i < QXRDScrollview.transform.childCount; i++) { QXRDListEntry QLE = QXRDScrollview.transform.GetChild(i).GetComponent <QXRDListEntry>(); if (QLE.index == i) { QLE.index++; } }//for some reason the list changing the top value to 0 despite me explicitly setting it to 1 /* * //CHECK: * //Does dataset grid have the name number of rows as combi results grid has columns? * //Does Assay have the same number of samples as Combi? * * bool isValid = true; * for (int y = 1; y <= AssayTrainingTable.GetUpperBound(1); y++) * { * string[] b = { "", "" }; * Debug.Log("does combicolumn contain " + AssayTrainingTable[0, y]); * if (GetSlice(CombiResultTable, 0, true).Any(AssayTrainingTable[0, y].Contains)) * Debug.Log("yep"); * } */ TrainAssay(); }
public void TrainAssay() { bothController.loadingMenu.SetActive(true); trainingSubmenu2.SetActive(false); Debug.Log("getslice3"); groupColumn = GetSlice(DatasetTable, "group", true); Debug.Log("getslice4"); maxWeightsColumn = GetSlice(DatasetTable, "max", true); Debug.Log("getslice5"); minWeightsColumn = GetSlice(DatasetTable, "min", true); combiSamplesColumn = GetSlice(CombiResultTable, 0, true); assaySamplesColumn = GetSlice(AssayTrainingTable, 0, true); assayElementsRow = GetSlice(AssayTrainingTable, 0, false); group1Indexes = new List <int>(); group2Indexes = new List <int>(); group3Indexes = new List <int>(); group4Indexes = new List <int>(); group5Indexes = new List <int>(); maxWeights = new List <float>(); minWeights = new List <float>(); minList = new List <string>(); assayMinList = new List <string>(); combiMinList = new List <string>(); sampleList = new List <string>(); elementList = new List <string>(); combiColumnPositions = new List <int>(); QXRDRowPositions = new List <int>(); assayElementIndexList = new List <int>(); assaySampleIndexes = new List <int>(); combiSampleIndexes = new List <int>(); //for each of the items in the QXRD list that arent paired with a None, cross check their index with the groupcolumn //if it's 0, nothing happens //if it's greater than zero, // int i = 0; int row = 1;///but should be 1?===================================================================================== //Debug.Log("maxWeightsColumn length = " + maxWeightsColumn.Length); foreach (Transform QXRD in QXRDScrollview.transform) { QXRDListEntry QLE = QXRD.GetComponent <QXRDListEntry>(); //if the paired mineral is not 'None' if (QLE.dropdown.value != 0) { //Debug.Log("row = " + row + " " + maxWeightsColumn[row]); float f; if (float.TryParse(maxWeightsColumn[row], out f)) { bestWeights.Add(f); maxWeights.Add(f); } else { bestWeights.Add(0); maxWeights.Add(0); } if (float.TryParse(minWeightsColumn[row], out f)) { minWeights.Add(f); } else { minWeights.Add(0); } if (groupColumn[row] == "1") { group1Indexes.Add(i); } if (groupColumn[row] == "2") { group2Indexes.Add(i); } if (groupColumn[row] == "3") { group3Indexes.Add(i); } if (groupColumn[row] == "4") { group4Indexes.Add(i); } if (groupColumn[row] == "5") { group5Indexes.Add(i); } //add in the mineral compositions //these should be the ones that are the qxrd list names, not the dropdowns string minString = QLE.MineralComp; minList.Add(minString); assayMinList.Add(minString); combiMinList.Add(QLE.dropdown.options[QLE.dropdown.value].text); //Debug.Log("adding " + minString + " to list"); combiColumnPositions.Add(QLE.dropdown.value); QXRDRowPositions.Add(QLE.index); i++; } row++; } //RON'S PSEUDOLOOP //bestWeights = create first list of weights //while(number of completed loops < 3) //for(int m = 0; m < numberofMineralCompositionsinGroup1; m++) // thisMin = listOfMinsInGroup1(m) // thisMinWeights = 0, min, (0.75*min+0.25*max), (min+max)/2, (0.25*min+0.75*max), max // for(int j = 0; j <= 5; j++) // minWeights(thisMin) = thisMinWeights[j] // startCoroutine(EnumerateAssayWeightIterator) // if(absluteDifference < currentDifference) // bestWeights[thisMin] = thisMinWeights[j] //repeat for loop for other groups foreach (BothController.MineralComposition mc in bothController.elementDict.Values) { minList.Add(mc.mineral); bestWeights.Add(-100); } //probably include all elements? /* * foreach (Toggle tog in bothController.elementCompScrollView.transform.GetComponentsInChildren<Toggle>()) * { * if (tog.isOn) * { * string elemString = tog.gameObject.GetComponent<MineralCompositionListEntry>().MineralComp; * tog.isOn = true; * minList.Add(elemString); * weightList.Add(double.TryParse(tog.GetComponentInChildren<InputField>().text, out result) ? result : -100); * columnNames += "," + elemString; * * } * }*/ //Debug.Log("assayElementsRow.Length = " + assayElementsRow.Length); for (int e = 1; e < assayElementsRow.Length; e++) { //Debug.Log("assayElementsRow[" + e + "] = " + assayElementsRow[e]); if (ContainsNoCase(assayElementsRow[e], "_pc")) { string elem = assayElementsRow[e]; assayElementIndexList.Add(e); //elementList.Add(string sans _pc)================================================================================================================ elementList.Add(elem.Substring(0, elem.IndexOf('_'))); } } for (int a = 1; a < assaySamplesColumn.Length; a++) { if (combiSamplesColumn.Any(assaySamplesColumn[a].Contains)) { for (int c = 0; c < combiSamplesColumn.Length; c++) { if (ContainsNoCase(combiSamplesColumn[c], assaySamplesColumn[a])) { assaySampleIndexes.Add(a); combiSampleIndexes.Add(c); sampleList.Add(assaySamplesColumn[a]); break; } } } } //prepare for progress bar int maxSamples = 0; int numberOfValidMinerals = group1Indexes.Count + group2Indexes.Count + group3Indexes.Count + group4Indexes.Count + group5Indexes.Count; int numberOfSamples = assaySampleIndexes.Count; int totalNumber = numberOfSamples * numberOfValidMinerals * 18; bothController.progressBar.value = 0; bothController.progressBar.maxValue = totalNumber; //group we're up to (1-5), weight index we're up to (0-5), currentGroup = 0; currentGroupIndex = 0; currentWeight = 0; currentLoop = 0; //Group 1======================================================================================================================== float min = minWeights[group1Indexes[0]]; float max = maxWeights[group1Indexes[0]]; weightRange = new float[] { 0f, min, (0.75f * min) + (0.25f * max), (min + max) / 2, (0.25f * min) + (0.75f * max), max }; weightsArray = new List <double>(bestWeights); weightsArray[group1Indexes[0]] = weightRange[0]; StartCoroutine("EnumerateAssayWeightIterator"); }