public static void ExportDataDEPRECATED(string FullFileName, GrowthCurveCollection GCC) { bool LagData = false; //FullFileName = "C:\\FullName.csv"; StreamWriter SW = new StreamWriter(FullFileName); SW.WriteLine("Fitted Data Results"); SW.WriteLine("Name, Doubling Time(Hrs),Growth Rate, How Determined?,NumPoints,R2,RMSE, Maximum GrowthRate,MaxOD,Notes,Linear-Fit Slope,Reduction in absolute error from ExpFit,LagTime,Reduction in Sum of Squares from Exp Fit,TimeTill_OD_0.02,EndOD,TreatmentGroup"); string TitleLine = "Time,";//this will hold the titles for everything below foreach (GrowthCurve GR in GCC) { LagData = false; TitleLine += GR.ToString() + " OD," + "Flag,"; string newline = GR.ToString() + ","; double ActualGrowth = Math.Log(2) / GR.GrowthRate.GrowthRate; if (GR.ValidDataSet) { newline += ActualGrowth.ToString("n5") + "," + GR.GrowthRate.GrowthRate.ToString() + "," + GR.GrowthRate.FittingUsed + "," + GR.GrowthRate.NumPoints + "," + GR.GrowthRate.R2.ToString("n4") + "," + GR.GrowthRate.RMSE.ToString("n5") + "," + GR.MaxGrowthRate.MaxGrowthRate.ToString("n5") + "," + GR.ODValues.Max().ToString("n4") + "," + GR.GrowthRate.Notes; if (GR.LinearModelFitted && GR.ExpModelFitted) { double dif = GR.LinFit.AbsError - GR.ExpFit.AbsError; double dif2 = GR.LinFit.calculateResidualSumofSquares() - GR.ExpFit.calculateResidualSumofSquares(); newline += "," + GR.LinFit.Parameters[1].ToString("n5") + "," + dif.ToString("n5") + ",DEPRECATED," + dif2.ToString("n5") + ","; }//+","+RMSEdiff.ToString("n5")+","+GR.LinFit.RMSE.ToString()+","+GR.ExpFit.RMSE.ToString(); }//report the linear fitted slope if possible else { newline += ",No Exp Fit to Compare Against,"; } newline += GR.HoursTillODReached(.02).ToString() + ","; newline += GR.ODValues.Last().ToString() + ","; } else { newline += ",,Weird Data:Blank??,,,,,,,,,,,,,"; } SW.WriteLine(newline); } //Below assumes the time is the same for all of them string Intermissionline = "Complete Data Listing Below"; if (LagData) { Intermissionline += "-Initial OD Present"; } ; SW.WriteLine(Intermissionline); SW.WriteLine(TitleLine); HashSet <DateTime> dtimes = new HashSet <DateTime>(); foreach (GrowthCurve gc in GCC) { foreach (DateTime dt in gc.Select((x) => x.time)) { dtimes.Add(dt); } } List <DateTime> DateTimesinFile = dtimes.Select((x) => x).ToList(); DateTimesinFile.Sort(); foreach (DateTime DT in DateTimesinFile) { string line = DT.ToString() + ","; foreach (GrowthCurve GR in GCC) { int indexPos = -1; DateTime[] timeValues = GR.Times; if (SimpleFunctions.ValueInArray(timeValues, DT, ref indexPos)) { //decide if this timepoint was included line += GR.ODValues[indexPos].ToString() + ","; double DateX = GR[indexPos].time_as_double; if (GR.FittedXValues != null && SimpleFunctions.ValueInArray(GR.FittedXValues, DateX)) //now decide if it made it into the fit { line += "0,"; } else { line += "1,"; } } else { line += "-999,-999,"; } } SW.WriteLine(line); } SW.Close(); }
private void oeObjChart() { objMatrix = new GameObject[sizeX, sizeX]; int ii = 0; for (int y = 0; y < sizeX; y++) { for (int x = 0; x < sizeX; x++) { switch (primitiveType.ToString()) { case "Cube": objMatrix[x, y] = GameObject.CreatePrimitive(PrimitiveType.Cube); break; case "Sphere": objMatrix[x, y] = GameObject.CreatePrimitive(PrimitiveType.Sphere); break; case "Cylinder": objMatrix[x, y] = GameObject.CreatePrimitive(PrimitiveType.Cylinder); break; default: objMatrix[x, y] = GameObject.CreatePrimitive(PrimitiveType.Cube); break; } //objMatrix[x, y] = go; //Rigidbody gameObjectsRigidBody = go.AddComponent<Rigidbody>(); // Add the rigidbody. //gameObjectsRigidBody.mass = oeMass; // Set the GO's mass to 5 via the Rigidbod //go.GetComponent<Rigidbody>().useGravity = true; objMatrix[x, y].name = nameObj + matrixIndex + "." + ii; //cubeMatrix2[i, j] float xi = (x + 1) / distanceDivide; float yi = (y + 1) / distanceDivide; float zi = 0; switch (chartType.ToString()) { case "G1": zi = (10) / distanceDivide; break; case "G2": zi = (x + y) / distanceDivide; break; case "G3": //zi = (Mathf.Sin(x/10) * Mathf.Cos(y/10)) / distanceDivide*5; zi = (Mathf.Sin((float)x / 10) * Mathf.Cos((float)y / 10)) / distanceDivide * 5; break; case "G4": //zi = (Mathf.Sin(x/10) * Mathf.Cos(y/10)) / distanceDivide*5; zi = (Mathf.Sin((float)x / 10) * Mathf.Cos((float)y / 10)) / distanceDivide * 5; break; case "G5": //zi = (Mathf.Sin(x/10) * Mathf.Cos(y/10)) / distanceDivide*5; zi = (Mathf.Sin((float)x / 10) * Mathf.Cos((float)y / 10)) / distanceDivide * 5; break; default: zi = (x + y) / distanceDivide; break; } if (transformXZ) { float tempi = zi; zi = xi; xi = tempi; } if (transformYZ) { tempi = zi; zi = yi; yi = tempi; } if (debugList) { Debug.Log(objMatrix[x, y].name + ": " + xi + ", " + yi + ", " + zi); } objMatrix[x, y].transform.position = new Vector3(startVector.x + xi, startVector.y + yi, startVector.z + zi); objMatrix[x, y].transform.localScale = new Vector3(scaleSize, scaleSize, scaleSize); //} //catch { Debug.Log("Err: try Parse..."); } rend = objMatrix[x, y].GetComponent <Renderer>(); rend.material.color = mainColor; } ii++; } }