Beispiel #1
0
        private async Task <MainWindowViewModel> InitializeAsync()
        {
            return(await Task.Run(async() =>
            {
                Trace.AutoFlush = true;

                var sysname = System.Environment.MachineName;
                if (sysname == "JAKE-PC")
                {
                    ConfigurationManager.AppSettings.Set("BatchTestSystem", "BTS1");
                }
                else if (sysname == "DESKTOP-GQQ0M3J")
                {
                    ConfigurationManager.AppSettings.Set("BatchTestSystem", "BTS2");
                }
                Debug.WriteLine("sysname: " + sysname);
                await InstrumentService.CreateCoordinatorAsync();
                await OriginService.CreateControllerAsync();
                await DataProcessingService.CreateLEDCalculatorAsync();
                if (Debugger.IsAttached)
                {
                    Properties.Settings.Default.Reset();
                }
                var dBConnectionManager = new DBConnectionManager();
                ctx = new DeviceBatchContext();
                Task[] initTasks = new Task[2];
                initTasks[0] = LoadDirectoryTreeView();
                initTasks[1] = UpdateIPAddress();
                await Task.WhenAll(initTasks);
                Trace.TraceInformation("Initialized MainWindowViewModel");
                return this;
            }).ConfigureAwait(false));
        }
Beispiel #2
0
        public FileSelectForm(DataProcessingService processingService)
        {
            _processingService = processingService;

            InitializeComponent();
            FillData();
        }
        public HealthMonitorServer(string host, string port)
        {
            server = new WebSocketServer(string.Format("ws://{0}:{1}", host, port));

            server.Start(socket =>
            {
                socket.OnOpen = () =>
                {
                    lock (sync)
                    {
                        connections.Add(socket);
                    }
                };
                socket.OnClose = () =>
                {
                    lock (sync)
                    {
                        connections.Remove(socket);
                    }
                };
            });

            var processService = new DataProcessingService();

            processService.NewBroadcastMessage += ProcessService_NewBroadcastMessage;
        }
        /// <summary>
        /// Step through and calculate means+std devs for each voltage in .fullDATs
        /// </summary>
        public void GenerateStatsData()
        {
            StackTrace st = new StackTrace();

            Debug.WriteLine("GenerateStatsData() caller name: " + st.GetFrame(1).GetMethod().Name);
            StatsDataList = new List <LJVStatsDatum>();
            //remove scans where pixel did not light up
            for (int i = 0; i < LJVScanVMCollection.Count; i++)
            {
                if (!LJVScanVMCollection[i].TheLJVScan.PixelLitUp ?? false)
                {
                    Debug.WriteLine(LJVScanVMCollection[i].TheLJVScan.DeviceLJVScanSummary.Device.Label + LJVScanVMCollection[i].TheLJVScan.Pixel.Site + " did not light up");
                    LJVScanVMCollection.Remove(LJVScanVMCollection[i]);
                }
            }
            //first find the maximum voltage across all LJVScans
            decimal   maxVoltage = 0;
            LJVScanVM maxScan    = new LJVScanVM();

            foreach (LJVScanVM scan in LJVScanVMCollection)
            {
                try
                {
                    if (scan.FullLJVDataList.Count != scan.RawLJVDataList.Count)
                    {
                        scan.GenerateFullLJVData();
                    }
                    var scanMax = scan.FullLJVDataList.Max(x => x.Voltage);
                    if (scanMax > maxVoltage)
                    {
                        maxVoltage = scanMax;
                        maxScan    = scan;
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("LJVScanSummaryVM GenerateStatsData error: " + e.ToString());
                }
            }
            //assume that the StepSize is constant and loop through each step in maxScan
            for (int i = 0; i < maxScan.FullLJVDataList.Count; i++)
            {
                List <FullLJVDatum> dataAtVoltage = new List <FullLJVDatum>();
                foreach (LJVScanVM scan in LJVScanVMCollection)
                {
                    if (scan.FullLJVDataList.Count >= i)
                    {
                        FullLJVDatum datumAtIndex = scan.FullLJVDataList.Where(x => x.Voltage == maxScan.FullLJVDataList[i].Voltage).FirstOrDefault();
                        if (datumAtIndex != null)
                        {
                            dataAtVoltage.Add(datumAtIndex);
                        }
                    }
                }
                StatsDataList.Add(StatsDatumFromFullLJVList(dataAtVoltage));
            }
            SetStatsDataPath();
            DataProcessingService.WriteIENumberableToCSV(StatsDataList, _statsDataPath);
        }
Beispiel #5
0
        public MainMenuForm(FileSelectForm openFileForm, FileSelectForm deleteFileForm, FileNameForm saveFileForm, DataProcessingService dataProcessingService)
        {
            _openFileForm          = openFileForm;
            _deleteFileFrom        = deleteFileForm;
            _saveFileForm          = saveFileForm;
            _dataProcessingService = dataProcessingService;

            InitializeComponent();
        }
        public MigrationController(
            DataProcessingService dataProcessingService,
            BuyersService buyersService,
            SuppliersService suppliersService,
            ClassificationService classificationService,
            CuentasClarasContext db)
        {
            this.dataProcessingService = dataProcessingService;
            this.db = db;

            this.buyersService         = buyersService;
            this.suppliersService      = suppliersService;
            this.classificationService = classificationService;
        }
Beispiel #7
0
 public async Task CreateSubFoldersThenWriteCSVs(string paramDirectory)
 {
     await Task.Run(() =>
     {
         Debug.WriteLine("CreateSubFoldersThenWriteCSVs");
         string rawDataPath = string.Concat(paramDirectory, @"\Raw Data\");
         Directory.CreateDirectory(rawDataPath);
         string elSpecPath = string.Concat(paramDirectory, @"\EL Spectra\");
         Directory.CreateDirectory(elSpecPath);
         string procDataPath = string.Concat(paramDirectory, @"\Processed Data\");
         Directory.CreateDirectory(procDataPath);
         string imagePath = string.Concat(paramDirectory, @"\Images\");
         Directory.CreateDirectory(imagePath);
         string summaryPath = string.Concat(paramDirectory, @"\Scan Summaries\");
         Directory.CreateDirectory(summaryPath);
         try
         {
             string label = TheDeviceVM.TheDevice.Label;
             TheLJVScanSummaryVM.TheLJVScanSummary.SpreadsheetReportPath = string.Concat(summaryPath, label, ".xlsx");
             string devCompletionDay = label.Substring(0, label.IndexOf("-"));
             Debug.WriteLine("devCompletionDay: " + devCompletionDay);
             string qdBatchString = label.Substring(label.IndexOf("-") + 1, label.Length - label.IndexOf("-") - 1);
             qdBatchString        = qdBatchString.Substring(0, qdBatchString.IndexOf("-"));
             Debug.WriteLine("qdBatchString: " + qdBatchString);
             string batchIndexString = label.Substring(label.LastIndexOf("-") + 1);
             Debug.WriteLine("batchIndexString: " + batchIndexString);
             string pixelDataString = string.Concat(devCompletionDay, "-", qdBatchString, "_", TheScanSpec.TestCondition, "-", batchIndexString, "_", SelectedPixel.Site);//to conform to OriginLab data processing scripts
             Debug.WriteLine("pixelDataString: " + pixelDataString);
             rawDataPath = string.Concat(rawDataPath, pixelDataString, ".rawDAT");
             DataProcessingService.WriteIENumberableToCSV(InstrumentService.LJVScanCoordinator.RawLJVData, rawDataPath);
             procDataPath = string.Concat(procDataPath, pixelDataString, ".procDAT");
             procDatPaths.Add(procDataPath);
             DataProcessingService.WriteIENumberableToCSV(PreviousScanData, procDataPath);
             elSpecPath = string.Concat(elSpecPath, pixelDataString, "@", InstrumentService.LJVScanCoordinator.PresentVoltage, "V.ELSpectrum");
             elspecPaths.Add(elSpecPath);
             Debug.WriteLine("ELSpecData.Count: " + InstrumentService.LJVScanCoordinator.ELSpecData.Count);
             DataProcessingService.WriteIENumberableToCSV(InstrumentService.LJVScanCoordinator.ELSpecData, elSpecPath);
             //do this for images
             imagePath = string.Concat(imagePath, pixelDataString, ".jpg");
             imagePaths.Add(imagePath);
             InstrumentService.LJVScanCoordinator.TheImageReceiver.SaveImage(imagePath);
         }
         catch (Exception e)
         {
             MessageBox.Show("Device Label in unexpected format?: " + e.ToString());
         }
     }).ConfigureAwait(false);
 }
Beispiel #8
0
        public void MaxTravels_ShouldCalcSpecialCase()
        {
            //Arrange
            List <int> inputData = new List <int> {
                50, 24, 1
            };

            inputData.Sort();
            int expected = 1;

            //Act
            int maxTravels = DataProcessingService.maxTravels(inputData);

            //Assert
            Assert.AreEqual(expected, maxTravels);
        }
        private void ConstructFullLJVDataListAndCSV(string fp)
        {
            FullLJVDataList = new List <FullLJVDatum>();
            foreach (RawLJVDatum rawdat in RawLJVDataList)
            {
                try
                {
                    ProcessedLJVDatum procdat  = ProcLJVDataList.Where(x => x.Voltage == rawdat.Voltage).First();
                    FullLJVDatum      newDatum = new FullLJVDatum();
                    if (rawdat.PhotoCurrentA != 0)
                    {
                        newDatum = new FullLJVDatum()
                        {
                            Voltage            = rawdat.Voltage,
                            Current            = rawdat.Current,
                            CurrentDensity     = procdat.CurrentDensity,
                            Resistance         = rawdat.Resistance,
                            PhotoCurrentA      = rawdat.PhotoCurrentA,
                            PhotoCurrentB      = rawdat.PhotoCurrentB,
                            PhotoCurrentC      = rawdat.PhotoCurrentC,
                            CameraCIEx         = rawdat.CameraCIEx,
                            CameraCIEy         = rawdat.CameraCIEy,
                            CameraLuminance    = rawdat.CameraLuminance,
                            Luminance          = procdat.Luminance,
                            CurrentEff         = procdat.CurrentEff,
                            PowerEff           = procdat.PowerEff,
                            EQE                = procdat.EQE,
                            PCurrChangePercent = ((rawdat.PhotoCurrentC / rawdat.PhotoCurrentA) - 1) * 100,
                            TimeStamp          = rawdat.TimeStamp
                                                 //generate method to find ELSpecPaths from SpectrumAtEachStep function
                        };
                    }

                    FullLJVDataList.Add(newDatum);
                }
                catch (Exception e)
                {
                    Debug.WriteLine("error at LJVScanVM ConstructFullLJVDataListAndCSV: " + e.ToString());
                }
            }
            DataProcessingService.WriteIENumberableToCSV(FullLJVDataList, fp);
        }
Beispiel #10
0
        public FileNameForm(DataProcessingService dataProcessingService)
        {
            _processingService = dataProcessingService;

            InitializeComponent();
        }
 public StatsController(CuentasClarasContext db, DataProcessingService dataProcessingService)
 {
     this.db = db;
     this.dataProccessingService = dataProcessingService;
 }