Skip to content

Instantly share code, notes, and snippets.

@pozitron57
Created March 27, 2024 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pozitron57/80acc06ccda19c330821b1523099acb3 to your computer and use it in GitHub Desktop.
Save pozitron57/80acc06ccda19c330821b1523099acb3 to your computer and use it in GitHub Desktop.
Шкала перевода первичных баллов в тестовые для ЕГЭ по физике 2024 года
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
from matplotlib.ticker import AutoMinorLocator, MultipleLocator
plt.rcParams.update({
"text.usetex": True,
"font.family": "serif",
"font.size": 23,
"text.latex.preamble": "\n".join([
r"\usepackage[T2A]{fontenc}",
r"\usepackage[utf8]{inputenc}",
r"\usepackage[russian]{babel}"
])
})
fig, ax = plt.subplots(figsize=(11,6) )
dic_2023 = {
0: 0,
1: 4,
2: 8,
3:11,
4:15,
5:18,
6:22,
7:26,
8:29,
9:33,
10:36,
11:38,
12:39,
13:40,
14:41,
15:42,
16:43,
17:44,
18:45,
19:46,
20:47,
21:48,
22:49,
23:51,
24:52,
25:53,
26:54,
27:55,
28:56,
29:57,
30:58,
31:59,
32:60,
33:61,
34:62,
35:64,
36:66,
37:68,
38:70,
39:72,
40:74,
41:76,
42:78,
43:80,
44:81,
45:83,
46:85,
47:87,
48:89,
49:91,
50:93,
51:95,
52:97,
53:99,
54:100
}
#dic_2024 = {
#1: 5,
#2: 9,
#3: 13,
#4: 17,
#5: 22,
#6: 27,
#7: 31,
#8: 35,
#9: 38,
#10: 39,
#11: 40,
#12: 41,
#13: 43,
#14: 44,
#15: 45,
#16: 46,
#17: 47,
#18: 49,
#19: 51,
#20: 52,
#21: 53,
#22: 54,
#23: 56,
#24: 57,
#25: 58,
#26: 59,
#27: 60,
#28: 62,
#29: 64,
#30: 66,
#31: 68,
#32: 71,
#33: 73,
#34: 76,
#35: 78,
#36: 80,
#37: 82,
#38: 84,
#39: 87,
#40: 89,
#41: 91,
#42: 94,
#43: 96,
#44: 99,
#45: 100
#}
# Перевод из известного словаря в неизвестный:
new_max_primary_score = 45
new_max_test_score = 100
scale_factor = new_max_primary_score / max(dic_2023.keys())
dic_2024 = {}
for primary_score in range(0, new_max_primary_score + 1):
# Вычисляем соответствующий "старый" первичный балл
old_primary_score = primary_score / scale_factor
# Находим ближайшие значения в старой шкале и интерполируем между ними
lower_old_score = int(old_primary_score)
upper_old_score = lower_old_score + 1
# Интерполяция для получения нового тестового балла
if upper_old_score in dic_2023 and lower_old_score in dic_2023:
# Рассчитываем веса для интерполяции
lower_weight = upper_old_score - old_primary_score
upper_weight = old_primary_score - lower_old_score
# Выполняем интерполяцию
interpolated_test_score = (dic_2023[lower_old_score] * lower_weight + dic_2023[upper_old_score] * upper_weight)
dic_2024[primary_score] = round(interpolated_test_score)
else:
# Если нет верхней границы (находимся в конце словаря), используем последнее значение
dic_2024[primary_score] = dic_2023[lower_old_score]
dic_2024_reshuege = {
0: 0,
1: 4,
2: 8,
3: 11,
4: 15,
5: 18,
6: 22,
7: 26,
8: 29,
9: 33,
10: 36,
11: 38,
12: 39,
13: 40,
14: 42,
15: 43,
16: 44,
17: 46,
18: 47,
19: 48,
20: 49,
21: 51,
22: 52,
23: 53,
24: 55,
25: 56,
26: 57,
27: 59,
28: 60,
29: 61,
30: 62,
31: 65,
32: 68,
33: 70,
34: 73,
35: 75,
36: 78,
37: 80,
38: 83,
39: 85,
40: 88,
41: 90,
42: 93,
43: 95,
44: 98,
45: 100
}
perv = np.array(list(dic_2023.keys()))
vtor = np.array(list(dic_2023.values()))
ax.plot(perv*45/54, vtor, linestyle=(0, (2, 2.3)), lw=2.8, color='C3', label='2023', zorder=10)
perv = np.array(list(dic_2024.keys()))
vtor = np.array(list(dic_2024.values()))
ax.plot(perv, vtor, lw=1.5, label=r'{\tt phys.pro} 2024')
perv = np.array(list(dic_2024_reshuege.keys()))
vtor = np.array(list(dic_2024_reshuege.values()))
ax.plot(perv, vtor, lw=2,label=r'{\tt reshu-ege} 2024')
ax.legend(handlelength=1.80)
ax.set_xlim([0, 45])
ax.set_ylim([0, np.amax(vtor)])
ax.set_yticks([0,10,20,30,40,50,60,70,80,90,100])
ax.set_xticks([0,5,10,15,20,25,30,35,40,45])
ax.set_xlabel('Первичный балл')
ax.set_ylabel('Тестовый балл')
ax.set_title(r'\bf{ЕГЭ-2024 по физике (ожидаемая шкала)}', pad=10)
ax.grid(which='both')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment