public void GenerateReports(Measurement m) { if (m.Detector.ListMode) // generate list mode report if it is list mode, hey! { RawAnalysisReport rep = new RawAnalysisReport(ctrllog); rep.GenerateReport(m); ResultsReport = rep.replines; } MethodResultsReport mrep = new MethodResultsReport(ctrllog); mrep.ApplyReportSectionSelections(m.AcquireState.review.Selections); mrep.GenerateReport(m); foreach (List <string> r in mrep.INCCResultsReports) { INCCResultsReports.Add(r); } if (NC.App.AppContext.CreateINCC5TestDataFile) { TestDataFile mdat = new TestDataFile(ctrllog); mdat.GenerateReport(m); foreach (List <string> r in mdat.INCCTestDataFiles) { TestDataFiles.Add(r); } } if (NC.App.AppContext.OpenResults) { PrepNotepad(); if (bNotepadHappensToBeThere) { foreach (ResultFile fname in m.ResultsFiles) { System.Diagnostics.Process.Start(notepadPath, fname.Path); } } // optional enablement if (ExcelPush.ExcelPresent() && !string.IsNullOrEmpty(m.ResultsFiles.CSVResultsFileName.Path)) { #if EXCEL Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook wb = excel.Workbooks.Open(m.ResultsFiles.CSVResultsFileName.Path); excel.Visible = true; #endif } } }
void AddTestDataCycle(int run, uint run_seconds, double run_count_time, Measurement meas, TestDataFile td, string pivot = "", int cfindex = -1) { Cycle cycle = new Cycle(datalog); try { cycle.UpdateDataSourceId(ConstructedSource.CycleFile, meas.Detectors[0].Id.SRType, td.DTO.AddSeconds(run_seconds), td.Filename); cycle.seq = run; cycle.TS = TimeSpan.FromSeconds(run_count_time); // dev note: check if this is always only in seconds, or fractions of a second // hn -- 9/4/14 -- not integer for count time. Convert from double seconds here. // Joe still has force to int. bleck! /* init run tests */ cycle.SetQCStatus(meas.Detectors[0].MultiplicityParams, QCTestStatus.None); // multmult creates entry if not found meas.Add(cycle, cfindex); /* singles, reals + accidentals, accidentals */ string l = td.reader.ReadLine(); string[] zorks = l.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); double[] v = new double[5]; for (int z = 0; z < 5; z++) { double d; bool b = Double.TryParse(zorks[z], out d); if (b) v[z] = d; } cycle.Totals = (ulong)v[0]; MultiplicityCountingRes mcr = new MultiplicityCountingRes(meas.Detectors[0].MultiplicityParams.FA, cycle.seq); // multmult cycle.CountingAnalysisResults.Add(meas.Detectors[0].MultiplicityParams, mcr); // multmult mcr.AB.TransferIntermediates(meas.Detectors[0].AB); // copy alpha beta onto the cycle's results mcr.Totals = cycle.Totals; mcr.TS = cycle.TS; mcr.ASum = v[4]; mcr.RASum = v[3]; mcr.Scaler1.v = v[1]; mcr.Scaler2.v = v[2]; cycle.SinglesRate = v[0] / run_count_time; // assign the hits to a single channel (0) cycle.HitsPerChannel[0] = cycle.Totals; mcr.RawSinglesRate.v = cycle.SinglesRate; /* number of multiplicity values */ string mv = td.reader.ReadLine(); UInt16 k = 0; UInt16.TryParse(mv, out k); if (k == 0) // test data files require an entry with 1 bin set 0s for the absence of multiplicity, go figure { ctrllog.TraceEvent(LogLevels.Error, 440, "This" + pivot + " cycle " + run.ToString() + " has no good multiplicity data."); return; } mcr.MinBins = mcr.MaxBins = k; mcr.RAMult = new ulong[k]; mcr.NormedAMult = new ulong[k]; mcr.UnAMult = new ulong[k]; // todo: compute this /* multiplicity values */ for (UInt16 j = 0; j < k; j++) { string ra = td.reader.ReadLine(); string[] blorks = ra.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); double[] ve = new double[2]; for (int z = 0; z < 2; z++) { double d; bool b = Double.TryParse(blorks[z], out d); if (b) ve[z] = d; } mcr.RAMult[j] = (ulong)ve[0]; mcr.NormedAMult[j] = (ulong)ve[1]; } ctrllog.TraceEvent(LogLevels.Verbose, 5439, "Cycle " + cycle.seq.ToString() + pivot + ((mcr.RAMult[0] + mcr.NormedAMult[0]) > 0 ? " max:" + mcr.MaxBins.ToString() : " *")); } catch (Exception e) { ctrllog.TraceEvent(LogLevels.Warning, 33085, pivot + "cycle processing error {0} {1} {2}", run, e.Message, pivot); } }
public void GenerateReports(Measurement m) { if (m.Detector.ListMode) // generate list mode report if it is list mode, hey! { RawAnalysisReport rep = new RawAnalysisReport(ctrllog); rep.GenerateReport(m); ResultsReport = rep.replines; } MethodResultsReport mrep = new MethodResultsReport(ctrllog); mrep.ApplyReportSectionSelections(m.AcquireState.review.Selections); mrep.GenerateReport(m); foreach (List<string> r in mrep.INCCResultsReports) { INCCResultsReports.Add(r); } if (NC.App.AppContext.CreateINCC5TestDataFile) { TestDataFile mdat = new TestDataFile(ctrllog); mdat.GenerateReport(m); foreach (List<string> r in mdat.INCCTestDataFiles) { TestDataFiles.Add(r); } } if (NC.App.AppContext.OpenResults) { PrepNotepad(); if (bNotepadHappensToBeThere) { foreach (ResultFile fname in m.ResultsFiles) System.Diagnostics.Process.Start(notepadPath, fname.Path); } // optional enablement if (ExcelPush.ExcelPresent() && !string.IsNullOrEmpty(m.ResultsFiles.CSVResultsFileName.Path)) { #if EXCEL Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook wb = excel.Workbooks.Open(m.ResultsFiles.CSVResultsFileName.Path); excel.Visible = true; #endif } } }