public void should_match_expected_when_respect_group_order_is_false(int leftIndex, int leftGroupIndex, int rightIndex, int rightGroupIndex, int expected) { var left = new QualityIndex(leftIndex, leftGroupIndex); var right = new QualityIndex(rightIndex, rightGroupIndex); left.CompareTo(right, false).Should().Be(expected); }
public QualityIndex AddQTestItem(QualityIndex newQTestItem) { QualityIndex reQTestItem = null; try { _qualityTestItemDal.Add(newQTestItem); reQTestItem = newQTestItem; } catch (RepositoryException ex) { throw ex; } return(reQTestItem); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { var hash = 17; hash = 23 * hash + AmplitudeThreshold.GetHashCode(); hash = 23 * hash + VarianceThreshold.GetHashCode(); hash = 23 * hash + QualityIndex.GetHashCode(); hash = 23 * hash + AmplitudeFilter.GetHashCode(); hash = 23 * hash + VarianceFilter.GetHashCode(); hash = 23 * hash + Centroids.GetHashCode(); hash = 23 * hash + Partition.GetHashCode(); hash = 23 * hash + Merged.GetHashCode(); hash = 23 * hash + Subregions.GetHashCode(); return(hash); }
public void UpdateAsHQ(IEnumerable <QualityIndex> qualityHQ, IEnumerable <QualityIndex> qualityItem) { foreach (QualityIndex qIndex in qualityHQ) { var temp = _qualityTestItemDal.Single(q => q.quality_index_id == qIndex.quality_index_id); if (temp.HasValue) { //if exist,just update //如果已经存在了,就更新(Update) QualityIndex qualityTemp = temp.Entity; //qualityTemp.parent_id = qIndex.parent_quality_index; //qualityTemp.quality_index_id = qIndex.quality_index_id; //qualityTemp.quality_testitem_and_flag = qIndex.quality_index_and_flag; //qualityTemp.quality_testitem_assess = qIndex.quality_index_assess; //qualityTemp.quality_testitem_assess_and = qIndex.quality_index_assess_and; //qualityTemp.quality_testitem_center //qualityTemp.quality_testitem_des //qualityTemp.quality_testitem_downlim //qualityTemp.quality_testitem_is_comparsion = qIndex.quality_index_is_comparsion; //qualityTemp.quality_testitem_is_necessary = qIndex.quality_index_is_necessary; //qualityTemp.quality_testitem_name = qIndex.quality_index_name; //qualityTemp.quality_testitem_property_type = qIndex.quality_index_property_type; //qualityTemp.quality_testitem_type //qualityTemp.quality_testitem_uplim //qualityTemp.quality_testitem_value = qIndex.quality_index_value; //qualityTemp.quality_testitem_value_and = qIndex.quality_index_value_and; //qualityTemp.quality_testitme_unit = qIndex.quality_index_unit; _unitOfWork.AddAction(qualityTemp, DataActions.Update); } else { //if not exist,just add a new QualityTestItem //如果不存在,就添加 QualityIndex qualityTemp = new QualityIndex(); //qualityTemp.parent_id = qIndex.parent_quality_index; //qualityTemp.quality_index_id = qIndex.quality_index_id; //qualityTemp.quality_testitem_and_flag = qIndex.quality_index_and_flag; //qualityTemp.quality_testitem_assess = qIndex.quality_index_assess; //qualityTemp.quality_testitem_assess_and = qIndex.quality_index_assess_and; //qualityTemp.quality_testitem_center //qualityTemp.quality_testitem_des ////qualityTemp.quality_testitem_downlim //qualityTemp.quality_testitem_is_comparsion = qIndex.quality_index_is_comparsion; //qualityTemp.quality_testitem_is_necessary = qIndex.quality_index_is_necessary; //qualityTemp.quality_testitem_name = qIndex.quality_index_name; //qualityTemp.quality_testitem_property_type = qIndex.quality_index_property_type; //qualityTemp.quality_testitem_type ////qualityTemp.quality_testitem_uplim //qualityTemp.quality_testitem_value = qIndex.quality_index_value; //qualityTemp.quality_testitem_value_and = qIndex.quality_index_value_and; //qualityTemp.quality_testitme_unit = qIndex.quality_index_unit; _unitOfWork.AddAction(qualityTemp, DataActions.Add); } } _unitOfWork.Save(); //处理parent_id IEnumerable <QualityIndex> qualityList = _qualityTestItemDal.Find(q => q.quality_index_id != null).Entities; foreach (QualityIndex qTestItem in qualityList) { //if (qTestItem.parent_id != null) //{ // qTestItem.parent_id = qualityList.Single(q => q.quality_index_id == qTestItem.parent_id).id; // _unitOfWork.AddAction(qTestItem, DataActions.Update); //} } _unitOfWork.Save(); }
private static void ExtractTraits(Culture culture, RateTraitExtractionMethod rateTraitExtractionMethod) { const bool getRawMetada = false; double lag; double yield; double gt; var qIdx = new QualityIndex(); var processed = culture.GrowthMeasurements.GetMeasurements(DataType.Processed); if (Modules.NoGrowth(processed)) { lag = 48; yield = double.NaN; gt = double.NaN; } else { var metaData = new GrowthVariableMetaData(); var macroLagData = Modules.GetLag(processed); lag = macroLagData.Lag; metaData.Lag = macroLagData.InterceptStretchs; var macroYieldData = Modules.GetYield(processed); yield = macroYieldData.Yield; metaData.Yield = macroYieldData.YieldAnchors; //var macroRateData = Modules.GetGtSim(processed); MacroRateData macroRateData; switch (rateTraitExtractionMethod) { case RateTraitExtractionMethod.Default: macroRateData = Modules.GetGT(processed); break; case RateTraitExtractionMethod.LinearRegression: macroRateData = Modules.GetGTLinearRegression(processed); break; default: throw new ArgumentOutOfRangeException(nameof(rateTraitExtractionMethod), rateTraitExtractionMethod, null); } gt = macroRateData.GT; metaData.Rate = macroRateData.RateSlopeAnchors; qIdx = Modules.GetQualityIndex(culture, DataType.Raw); culture.GrowthMeasurements.SetMetaData(DataType.Processed, metaData); if (getRawMetada) { var raw = culture.GrowthMeasurements.GetMeasurements(DataType.Raw); var rawMetaData = new GrowthVariableMetaData(); var rawMacroLagData = Modules.GetLag(raw); rawMetaData.Lag = rawMacroLagData.InterceptStretchs; var rawMacroYieldData = Modules.GetYield(raw); rawMetaData.Yield = rawMacroYieldData.YieldAnchors; var rawMacroRateData = Modules.GetGT(raw); rawMetaData.Rate = rawMacroRateData.RateSlopeAnchors; culture.GrowthMeasurements.SetMetaData(DataType.Raw, rawMetaData); } } culture.Lag = lag; culture.Rate = gt; culture.Yield = yield; culture.QualityIndex = qIdx; }