public void TrimDataList() //trim data points for log scale plotting to improve plotting performance { int desiredNumberOfDataPoints = 6000; //heuristic based on trial and error while (LifetimeDataList.Count > desiredNumberOfDataPoints) { var modulusValue = 12; //we want to remove fewer data points initially since LED properties change most rapidly at first var decileTracker = 1; //every 10% of the list we increase the frequency of data removal by decreasing the modulus value //i.e., 1 corresponds to the first 10% of data points, 2 to the first 20%... for (int i = 0; i < LifetimeDataList.Count; i++) { if (((double)i * 10 / (double)LifetimeDataList.Count) > decileTracker)//*10 because all values are otherwise < 1 { decileTracker++; modulusValue--; //Debug.WriteLine("Mod value is now" + modulusValue); } if (i % modulusValue == 0 && i != LifetimeDataList.Count - 1)//remove data point every modulusValue except for the final { LifetimeDataList.RemoveAt(i); } } //Debug.WriteLine("LifetimeDataList.Count is now: " + LifetimeDataList.Count); } }
public void PopulatePropertiesFromPath() { try { //TheLifetime = new Lifetime(); //TheLifetime.FilePath = fp; GetLifetimeValuesFromCryscoHeader(); LoadLifetimeDataIntoList(); TheLifetime.SetCurrent = Math.Round(Convert.ToDecimal(LifetimeDataList.First().Current), 3); //this is in milliamps TheLifetime.SetCurrentDensity = Math.Round(Convert.ToDecimal(LifetimeDataList.First().CurrentDensity), 3); TheLifetime.InitialCE = Math.Round((4E-3m * TheLifetime.InitialLuminance) / TheLifetime.SetCurrent, 1); var lowestRelativeLuminance = LifetimeDataList.Last().RelativeLuminance;//find how far the test went and then populate values TheLifetime.TotalHoursElapsed = Math.Round(Convert.ToDecimal(LifetimeDataList.Last().ElapsedHours), 3); var lifeStartDate = TheLifetime.StartDateTime ?? default(DateTime); var timespan = lifeStartDate - TheLifetime.Pixel.Device.DeviceBatch.FabDate; DaysBetweenDeviceFabAndLifetimeTest = Math.Round(Convert.ToDouble(timespan.TotalDays), 1); if (lowestRelativeLuminance <= 0.97) { TheLifetime.TimeUntil97Percent = Math.Round(Convert.ToDecimal(LifetimeDataList.Where(x => x.RelativeLuminance <= 0.97d).First().ElapsedHours), 3);//find the first datum where relativeLuminance is less than 97% and get the elapsedHours } if (lowestRelativeLuminance <= 0.90) { TheLifetime.TimeUntil90Percent = Math.Round(Convert.ToDecimal(LifetimeDataList.Where(x => x.RelativeLuminance <= 0.90d).First().ElapsedHours), 3);//find the first datum where relativeLuminance is less than 97% and get the elapsedHours } if (lowestRelativeLuminance <= 0.50) { TheLifetime.TimeUntil50Percent = Math.Round(Convert.ToDecimal(LifetimeDataList.Where(x => x.RelativeLuminance <= 0.50d).First().ElapsedHours), 3);//find the first datum where relativeLuminance is less than 97% and get the elapsedHours } foreach (CryscoLifetimeDatum cld in LifetimeDataList) { cld.CurrentEfficiency = Math.Round(((4E-3 * cld.Luminance) / cld.Current), 3); cld.PowerEfficiency = cld.CurrentEfficiency * Math.PI / cld.PixelVoltage; } TrimDataList(); } catch (Exception e) { Debug.WriteLine(e); MessageBox.Show(e.ToString()); } }