Теперь фактор, шаг которого равен нулю, не учитывается, но отображается отдельным столбцом с однаковым значением.

This commit is contained in:
2026-05-27 12:40:47 +05:00
parent f479674332
commit a2bc606336
3 changed files with 42 additions and 17 deletions
+8 -1
View File
@@ -53,7 +53,7 @@ def calculate_factor_levels(
else: # "ед."
# Конвертируем абсолютный шаг в проценты
low = calc_amount(factor.percentage) - factor.step
high = calc_amount(factor.percentage) + factor.step
high = calc_amount(factor.center) + factor.step
# ВОЗВРАЩАЕМ НОВЫЙ ОБЪЕКТ FactorData
return FactorData(
@@ -72,6 +72,12 @@ def calculate_all_factors_levels(factors: List['FactorData'], **kwargs) -> List[
"""Рассчитывает уровни для всех факторов"""
return [calculate_factor_levels(f, **kwargs) for f in factors]
def get_active_factors(factors):
return [f for f in factors if f['step'] != 0]
def get_inactive_factors(factors):
return [f for f in factors if f['step'] == 0]
def generate_factorial_design(
factors: List[Dict],
center_points: int = 3,
@@ -159,6 +165,7 @@ def generate_factorial_design(
# Добавление центральных точек
for i in range(center_points):
center_experiment = {}
for j in range(k):
center_experiment[f"Фактор_{j+1}"] = {
'coded': 0,