public AnalysisInfo GetAnalysisInfo(int assetId, int timeframeId) { _repository = new EFQuotationRepository(); AnalysisInfoDto dto = _repository.GetAnalysisInfo(assetId, timeframeId); return(AnalysisInfo.FromDto(dto)); }
internal TonalityAnalysisState() { for (int c = 0; c < OpusConstants.DETECT_SIZE; c++) { info[c] = new AnalysisInfo(); } }
public override Grid?Solve(Grid grid, out AnalysisInfo analysisInfo) { int[,] gridValues = grid.ToArray(); int[, ]? result = null; int solutionsCount = 0; var stopwatch = new Stopwatch(); stopwatch.Start(); try { BacktrackinglySolve(ref solutionsCount, ref result, gridValues, 0); stopwatch.Stop(); analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, true); return(new Grid(result ?? throw new NoSolutionException())); } catch (MultipleSolutionsException) { // Multiple solutions. stopwatch.Stop(); analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, false); return(null); } catch (NoSolutionException) { // No solution. stopwatch.Stop(); analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, false); return(null); } }
public void ToDto_ReturnsProperPriceDtoObject() { //Arrange AnalysisInfo info = new AnalysisInfo() { StartDate = DEFAULT_START_DATETIME, EndDate = DEFAULT_END_DATETIME, StartIndex = DEFAULT_START_INDEX, EndIndex = DEFAULT_END_INDEX, MinLevel = DEFAULT_MIN_LEVEL, MaxLevel = DEFAULT_MAX_LEVEL, Counter = DEFAULT_COUNTER }; //Act AnalysisInfoDto actualDto = info.ToDto(); //Assert AnalysisInfoDto expectedDto = new AnalysisInfoDto() { StartDate = DEFAULT_START_DATETIME, EndDate = DEFAULT_END_DATETIME, StartIndex = DEFAULT_START_INDEX, EndIndex = DEFAULT_END_INDEX, MinLevel = DEFAULT_MIN_LEVEL, MaxLevel = DEFAULT_MAX_LEVEL, Counter = DEFAULT_COUNTER }; Assert.AreEqual(expectedDto, actualDto); }
public Grid?Solve(int[,] gridArray, out AnalysisInfo analysisInfo) { var dlx = new DancingLink(new ColumnNode(-1)); _root = dlx.CreateLinkedList(gridArray); var stopwatch = new Stopwatch(); stopwatch.Start(); try { Search(); stopwatch.Stop(); analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, true); return(_resultGrid); } catch { stopwatch.Stop(); analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, false); return(null); } }
public AnalysisInfo AnalyseDataset(string filename) { // Serialise JSON file to objects var projects = _loader.LoadFromFile(filename); // Call calculator classes to get metrics var noofsuccessdeployments = _noofsuccessdeploymentscalc.Calculate(projects.projects); var successbreakdown = _successDeploymentBreakdownCalc.Calculate(projects.projects); var mostpopularliveday = _mostpopulardayforlivecalc.Calculate(projects.projects); var inttoliveaverage = _integrationtolivecalc.Calculate(projects.projects); var pipelinebreakdown = _pipelinebreakdowncalc.Calculate(projects.projects); // Compose results into Analysis DTO to be returned var results = new AnalysisInfo() { TotalNoOfSuccessfulDeployments = noofsuccessdeployments, SuccessfulDeploymentBreakdown = successbreakdown, MostPopularLiveDeploymentWeekday = mostpopularliveday, IntegrationToLiveBreakdowns = inttoliveaverage, PipelineBreakdowns = pipelinebreakdown }; return(results); }
private void processAnalisysStage(AnalysisInfo analysis) { Logger.Debug($"Анализ [{analysis.BarCode}] - запуск выполнения {analysis.CurrentStage}-й стадии."); Analyzer.Needle.HomeLifterAndRotator(); AnalyzerOperations.NeedleWash(); // Подводим нужную ячейку картриджа под иглу Analyzer.Rotor.Home(); Analyzer.Rotor.PlaceCellUnderNeedle( analysis.Stages[analysis.CurrentStage].CartridgePosition, analysis.Stages[analysis.CurrentStage].Cell, RotorUnit.CellPosition.CellLeft); // Устанавливаем иглу над нужной ячейкой картриджа Analyzer.Needle.TurnToCartridge(analysis.Stages[analysis.CurrentStage].Cell); // Прокалываем ячейку картриджа Analyzer.Needle.GoDownAndPerforateCartridge(analysis.Stages[analysis.CurrentStage].Cell); // Поднимаемся на безопасную высоту над картриджем Analyzer.Needle.GoToSafeLevel(); // Подводим центр ячейки картриджа под иглу Analyzer.Rotor.PlaceCellUnderNeedle( analysis.Stages[analysis.CurrentStage].CartridgePosition, analysis.Stages[analysis.CurrentStage].Cell, RotorUnit.CellPosition.CellCenter); // Прокалываем ячейку картриджа Analyzer.Needle.GoDownAndPerforateCartridge(analysis.Stages[analysis.CurrentStage].Cell); // Забираем реагент из ячейки картриджа Analyzer.Pomp.Pull(0); // Поднимаемся на безопасную высоту над картриджем Analyzer.Needle.GoToSafeLevel(); // Устанавливаем иглу над белой ячейкой картриджа Analyzer.Needle.TurnToCartridge(CartridgeCell.MixCell); // Подводим белую кювету картриджа под иглу Analyzer.Rotor.Home(); Analyzer.Rotor.PlaceCellUnderNeedle( analysis.Stages[analysis.CurrentStage].CartridgePosition, CartridgeCell.MixCell); // Опускаем иглу в белую кювету Analyzer.Needle.GoDownAndPerforateCartridge(CartridgeCell.MixCell, false); // Сливаем реагент в белую кювету Analyzer.Pomp.Push(0); // Поднимаем иглу до дома Analyzer.Needle.HomeLifter(); Logger.Debug($"Анализ [{analysis.BarCode}] - завершено выполнение {analysis.CurrentStage}-й стадии."); }
public ActionResult GetDataSetsInfo(int assetId, int timeframeId) { IDataSetService dataSetService = new DataSetService(); AnalysisInfo info = dataSetService.GetAnalysisInfo(assetId, timeframeId); var json = new { info = info }; return(Json(json, JsonRequestBehavior.AllowGet)); }
internal void Assign(AnalysisInfo other) { this.valid = other.valid; this.tonality = other.tonality; this.tonality_slope = other.tonality_slope; this.noisiness = other.noisiness; this.activity = other.activity; this.music_prob = other.music_prob; this.bandwidth = other.bandwidth; }
private void buttonRemoveTube_Click(object sender, EventArgs e) { Controller.Options.Analyzes.Remove(selectedTube); if (Controller.Options.Analyzes.Count == 0) { buttonRemoveTube.Visible = false; selectedTube = null; } }
private void tubesList_SelectionChanged(object sender, EventArgs e) { if (Controller.Options.Analyzes.Count == 0) { return; } selectedTube = Controller.Options.Analyzes[tubesList.CurrentRow.Index]; buttonRemoveTube.Visible = true; }
public static RC AnalysisLoad(Context ctx, int db) { Debug.Assert(db >= 0 && db < ctx.DBs.length); Debug.Assert(ctx.DBs[db].Bt != null); // Clear any prior statistics Debug.Assert(Btree.SchemaMutexHeld(ctx, db, null)); for (HashElem i = ctx.DBs[db].Schema.IndexHash.First; i != null; i = i.Next) { Index idx = (Index)i.Data; sqlite3DefaultRowEst(idx); sqlite3DeleteIndexSamples(ctx, idx); idx.Samples.data = null; } // Check to make sure the sqlite_stat1 table exists AnalysisInfo sInfo = new AnalysisInfo(); sInfo.Ctx = ctx; sInfo.Database = ctx.DBs[db].Name; if (sqlite3FindTable(ctx, "sqlite_stat1", sInfo.Database) == null) { return(RC.ERROR); } // Load new statistics out of the sqlite_stat1 table string sql = C._mtagprintf(ctx, "SELECT tbl, idx, stat FROM %Q.sqlite_stat1", sInfo.Database); if (sql == null) { rc = RC.NOMEM; } else { rc = Vdbe.Exec(ctx, sql, AnalysisLoader, sInfo, 0); C._tagfree(ctx, ref sql); } // Load the statistics from the sqlite_stat3 table. #if ENABLE_STAT3 if (rc == RC_OK) { bool lookasideEnabled = ctx.Lookaside.Enabled; ctx.Lookaside.Enabled = false; rc = LoadStat3(ctx, sInfo.Database); ctx.Lookaside.Enabled = lookasideEnabled; } #endif if (rc == RC.NOMEM) { db.MallocFailed = true; } return(rc); }
static bool AnalysisLoader(object data, long argc, object Oargv, object notUsed) { string[] argv = (string[])Oargv; AnalysisInfo info = (AnalysisInfo)data; Debug.Assert(argc == 3); if (argv == null || argv[0] == null || argv[2] == null) { return(false); } Table table = sqlite3FindTable(info.Ctx, argv[0], info.Database); if (table == null) { return(false); } Index index = (!string.IsNullOrEmpty(argv[1]) ? sqlite3FindIndex(info.Ctx, argv[1], info.Database) : null); int n = (index != null ? index.Columns.length : 0); string z = argv[2]; int zIdx = 0; for (int i = 0; z != null && i <= n; i++) { tRowcnt v = 0; int c; while (zIdx < z.Length && (c = z[zIdx]) >= '0' && c <= '9') { v = v * 10 + c - '0'; zIdx++; } if (i == 0) { table.RowEst = v; } if (index == null) { break; } index.RowEsts[i] = v; if (zIdx < z.Length && z[zIdx] == ' ') { zIdx++; } if (string.Equals(z.Substring(zIdx), "unordered", StringComparison.OrdinalIgnoreCase)) { index.Unordered = true; break; } } return(false); }
// TODO: Эта задача не реализована до конца!!! private void processAnalisysFinishStage(AnalysisInfo analysis) { Logger.Debug($"Анализ [{analysis.BarCode}] - запуск выполнения завершающей стадии."); AnalyzerOperations.NeedleWash(); Analyzer.Rotor.Home(); Analyzer.Rotor.PlaceCellUnderNeedle( analysis.Stages[analysis.Stages.Count - 1].CartridgePosition, CartridgeCell.MixCell); Analyzer.Needle.HomeLifter(); Analyzer.Needle.TurnToCartridge(CartridgeCell.MixCell); Analyzer.Needle.GoDownAndPerforateCartridge(CartridgeCell.MixCell); Analyzer.Pomp.Pull(0); Analyzer.Needle.GoToSafeLevel(); Analyzer.Rotor.PlaceCellUnderNeedle(analysis.Stages[analysis.Stages.Count - 1].CartridgePosition, CartridgeCell.ResultCell); // Устанавливаем иглу над белой ячейкой картриджа Analyzer.Needle.TurnToCartridge(CartridgeCell.ResultCell); Analyzer.Needle.GoDownAndPerforateCartridge(CartridgeCell.ResultCell); // TODO: Добавить реализацию в NeedleUnit Analyzer.Pomp.Push(0); Analyzer.Needle.HomeLifter(); Analyzer.Rotor.PlaceCellUnderWashBuffer(analysis.Stages[analysis.Stages.Count - 1].CartridgePosition); //AnalyzerGateway.Rotor.PlaceCellAtDischarge(analysis.Stages[analysis.Stages.Count - 1].CartridgePosition); AnalyzerOperations.DischargeCartridge(analysis.Stages[analysis.Stages.Count - 1].CartridgePosition); // Далее нужно перелить в прозрачную кювету и отправить на анализ. // TODO: Эта задача не реализована до конца!!! Logger.Debug($"Анализ [{analysis.BarCode}] - выполнения завершающей стадии завершено."); }
public override Grid?Solve(Grid grid, out AnalysisInfo analysisInfo) { var stopwatch = new Stopwatch(); stopwatch.Start(); var results = SolveStrings(grid.ToString("g0", null)); stopwatch.Stop(); if (results.Count == 1) { analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, true); return(Grid.Parse(results[0])); } else { analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, false); return(null); } }
private void processAnalyzesCycle() { conveyor.CellInScanPosition = 0; while (existUnhandledAnalyzes()) { if (interruptRequest) { break; } conveyor.CheckFullCycle(); searchTubeInConveyorCell(attemptsNumber: 2); int cellInSampling = conveyor.CellInSamplingPosition; AnalysisInfo analysisInSampling = searchBarcodeInDatabase(conveyor.Cells[cellInSampling].AnalysisBarcode); if (analysisInSampling != null) { Logger.Debug($"Пробирка со штрихкодом [{analysisInSampling.BarCode}] дошла до точки забора материала."); if (analysisInSampling.NoSampleWasTaken()) { Logger.Debug($"Забор материала ранее не производился."); analysisInSampling.SetSamplingStage(); processAnalisysInitialStage(analysisInSampling); analysisInSampling.SetNewIncubationTime(); } } processScheduledAnalyzes(); conveyor.CellInScanPosition++; } }
public override Grid?Solve(Grid grid, out AnalysisInfo analysisInfo) { var str = grid.ToString("g0", null); var sb = new StringBuilder(81); var stopwatch = new Stopwatch(); try { stopwatch.Start(); analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, true); return(Solve32(str, sb, 2) != 1 ? null : Grid.Parse(sb.ToString())); } catch (BadImageFormatException ex) when(ex.HResult == -2147024885) { stopwatch.Stop(); // The magic number is 0x8007000B, which means // we use 32-bit dll file on 64-bit-based platform. // This is incompatible, so we catch this exception // and try using 64-bit dll to execute that unmanaged function. // 0x8007000B is not a `int` value, but a `uint` value, // so we should express the value by its complement value. analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, false); return(Solve64(str, sb, 2) != 1 ? null : Grid.Parse(sb.ToString())); } catch { stopwatch.Stop(); // Neither x86 nor x64 or wrong execution. // What the hell will return? analysisInfo = new AnalysisInfo(Name, null, stopwatch.Elapsed, false); return(null); } }
public void SetTube(AnalysisInfo tube) { this.tube = tube; }
internal static void tonality_get_info(TonalityAnalysisState tonal, AnalysisInfo info_out, int len) { int pos; int curr_lookahead; float psum; int i; pos = tonal.read_pos; curr_lookahead = tonal.write_pos - tonal.read_pos; if (curr_lookahead < 0) { curr_lookahead += OpusConstants.DETECT_SIZE; } if (len > 480 && pos != tonal.write_pos) { pos++; if (pos == OpusConstants.DETECT_SIZE) { pos = 0; } } if (pos == tonal.write_pos) { pos--; } if (pos < 0) { pos = OpusConstants.DETECT_SIZE - 1; } info_out.Assign(tonal.info[pos]); tonal.read_subframe += len / 120; while (tonal.read_subframe >= 4) { tonal.read_subframe -= 4; tonal.read_pos++; } if (tonal.read_pos >= OpusConstants.DETECT_SIZE) { tonal.read_pos -= OpusConstants.DETECT_SIZE; } /* Compensate for the delay in the features themselves. * FIXME: Need a better estimate the 10 I just made up */ curr_lookahead = Inlines.IMAX(curr_lookahead - 10, 0); psum = 0; /* Summing the probability of transition patterns that involve music at * time (DETECT_SIZE-curr_lookahead-1) */ for (i = 0; i < OpusConstants.DETECT_SIZE - curr_lookahead; i++) { psum += tonal.pmusic[i]; } for (; i < OpusConstants.DETECT_SIZE; i++) { psum += tonal.pspeech[i]; } psum = psum * tonal.music_confidence + (1 - psum) * tonal.speech_confidence; /*printf("%f %f %f\n", psum, info_out.music_prob, info_out.tonality);*/ info_out.music_prob = psum; }
internal static void run_analysis <T>(TonalityAnalysisState analysis, CeltMode celt_mode, T[] analysis_pcm, int analysis_pcm_ptr, int analysis_frame_size, int frame_size, int c1, int c2, int C, int Fs, int lsb_depth, Downmix.downmix_func <T> downmix, AnalysisInfo analysis_info) { int offset; int pcm_len; if (analysis_pcm != null) { /* Avoid overflow/wrap-around of the analysis buffer */ analysis_frame_size = Inlines.IMIN((OpusConstants.DETECT_SIZE - 5) * Fs / 100, analysis_frame_size); pcm_len = analysis_frame_size - analysis.analysis_offset; offset = analysis.analysis_offset; do { tonality_analysis(analysis, celt_mode, analysis_pcm, analysis_pcm_ptr, Inlines.IMIN(480, pcm_len), offset, c1, c2, C, lsb_depth, downmix); offset += 480; pcm_len -= 480; } while (pcm_len > 0); analysis.analysis_offset = analysis_frame_size; analysis.analysis_offset -= frame_size; } analysis_info.valid = 0; tonality_get_info(analysis, analysis_info, frame_size); }
public static RC AnalysisLoad(Context ctx, int db) { Debug.Assert(db >= 0 && db < ctx.DBs.length); Debug.Assert(ctx.DBs[db].Bt != null); // Clear any prior statistics Debug.Assert(Btree.SchemaMutexHeld(ctx, db, null)); for (HashElem i = ctx.DBs[db].Schema.IndexHash.First; i != null; i = i.Next) { Index idx = (Index)i.Data; sqlite3DefaultRowEst(idx); sqlite3DeleteIndexSamples(ctx, idx); idx.Samples.data = null; } // Check to make sure the sqlite_stat1 table exists AnalysisInfo sInfo = new AnalysisInfo(); sInfo.Ctx = ctx; sInfo.Database = ctx.DBs[db].Name; if (sqlite3FindTable(ctx, "sqlite_stat1", sInfo.Database) == null) return RC.ERROR; // Load new statistics out of the sqlite_stat1 table string sql = C._mtagprintf(ctx, "SELECT tbl, idx, stat FROM %Q.sqlite_stat1", sInfo.Database); if (sql == null) rc = RC.NOMEM; else { rc = Vdbe.Exec(ctx, sql, AnalysisLoader, sInfo, 0); C._tagfree(ctx, ref sql); } // Load the statistics from the sqlite_stat3 table. #if ENABLE_STAT3 if (rc == RC_OK) { bool lookasideEnabled = ctx.Lookaside.Enabled; ctx.Lookaside.Enabled = false; rc = LoadStat3(ctx, sInfo.Database); ctx.Lookaside.Enabled = lookasideEnabled; } #endif if (rc == RC.NOMEM) db.MallocFailed = true; return rc; }
private void processAnalisysInitialStage(AnalysisInfo analysis) { Logger.Debug($"Анализ [{analysis.BarCode}] - запущено выполнение подготовительной стадии."); Logger.Debug($"Подготовка к забору материала из пробирки."); // Смещаем пробирку, чтобы она оказалась под иглой Analyzer.Conveyor.Shift(false, ConveyorUnit.ShiftType.HalfTube); // Поднимаем иглу вверх до дома Analyzer.Needle.HomeLifter(); Logger.Debug($"Ожидание загрузки картриджа..."); AnalyzerOperations.ChargeCartridge(cartirdgePosition: 0, chargePosition: 5); Logger.Debug($"Загрузка картриджа завершена."); Logger.Debug($"Ожидание касания жидкости в пробирке..."); // Устанавливаем иглу над пробиркой и опускаем ее до контакта с материалом в пробирке Analyzer.Needle.TurnToTubeAndWaitTouch(); Logger.Debug($"Забор материала из пробирки."); // Набираем материал из пробирки Analyzer.Pomp.Pull(0); // Подводим белую кювету картриджа под иглу Analyzer.Rotor.Home(); Analyzer.Rotor.PlaceCellUnderNeedle( analysis.Stages[0].CartridgePosition, CartridgeCell.MixCell); // Поднимаем иглу вверх до дома Analyzer.Needle.HomeLifter(); // Устанавливаем иглу над белой ячейкой картриджа Analyzer.Needle.TurnToCartridge(CartridgeCell.MixCell); // Опускаем иглу в кювету Analyzer.Needle.GoDownAndPerforateCartridge(CartridgeCell.MixCell); Logger.Debug($"Слив забранного материала в белую кювету."); // Сливаем материал в белую кювету Analyzer.Pomp.Push(0); // Промываем иглу AnalyzerOperations.NeedleWash(); Logger.Debug($"Перенос реагента в белую кювету."); // Выполняем перенос реагента из нужной ячейки картриджа в белую кювету processAnalisysStage(analysis); // Устанавливаем иглу в домашнюю позицию Analyzer.Needle.HomeLifterAndRotator(); // Смещаем пробирку обратно Analyzer.Conveyor.Shift(reverse: true, ConveyorUnit.ShiftType.HalfTube); Logger.Debug($"Анализ [{analysis.BarCode}] - завершено выполнение подготовительной стадии."); }