Birger Moell commited on
Commit
b12bd6f
1 Parent(s): 115525b

Updated iws

Browse files
Files changed (1) hide show
  1. app.py +35 -1
app.py CHANGED
@@ -213,6 +213,37 @@ def test_calculator(age, education, values, test, invert=False):
213
  else:
214
  print("missing value/ wrong format")
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
217
  def bnt_calculator(age, education, bnt):
218
  if age <= 60 and education <= 12:
@@ -278,7 +309,7 @@ def generate_graph(test_dict):
278
  ax.set_xticklabels(['1', '2', '3', '4', '5', '6', '7', '8', '9'])
279
 
280
  # Set the y-axis to display the tests
281
- ax.set_yticks([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
282
 
283
  # Set the test labels to the keys in test_dict (in reverse order)
284
  ax.set_yticklabels(reversed(list(test_dict.keys())))
@@ -429,6 +460,8 @@ std_dev = np.random.randint(10, 30)
429
  if st.button("Calculate Z-Score"):
430
  profile = test_profile(age, education_level, isw, bnt, fas)
431
 
 
 
432
 
433
  # for each value in the profile, calculate the z-score
434
  bnt_mean, bnt_std, z_bnt, stanine_bnt = bnt_calculator(age, education_level, bnt)
@@ -453,6 +486,7 @@ if st.button("Calculate Z-Score"):
453
  test_dict = {
454
  "bnt": [bnt, bnt_mean, bnt_std, z_bnt, stanine_bnt],
455
  "fas": [fas, fas_mean, fas_std, z_fas, stanine_fas],
 
456
  "animal": [animal, animal_mean, animal_std, animal_z, animal_stanine],
457
  "verb": [verb, verb_mean, verb_std, verb_z, verb_stanine],
458
  "repetition": [repetition, repetition_mean, repetition_std, repetition_z, repetition_stanine],
 
213
  else:
214
  print("missing value/ wrong format")
215
 
216
+ def isw_calculator(age, education, isw):
217
+ print("the isw is", isw)
218
+ isw_score = 74.38 + isw*0.66 - age*0.20 + education*1.77
219
+ # round to nearest integer
220
+ isw_score = round(isw_score)
221
+ print("the score is: ", isw_score)
222
+ isw_score_stanine = isw_stanine_calculator(isw_score)
223
+ return 0, 0, isw_score, isw_score_stanine
224
+
225
+
226
+ def isw_stanine_calculator(isw_score):
227
+ print("the score is: ", isw_score)
228
+ if isw_score <= 73:
229
+ return 1
230
+ elif isw_score <= 81:
231
+ return 2
232
+ elif isw_score <= 88:
233
+ return 3
234
+ elif isw_score <= 96:
235
+ return 4
236
+ elif isw_score <= 103:
237
+ return 5
238
+ elif isw_score <= 111:
239
+ return 6
240
+ elif isw_score <= 118:
241
+ return 7
242
+ elif isw_score <= 126:
243
+ return 8
244
+ elif isw_score >= 127:
245
+ return 9
246
+
247
 
248
  def bnt_calculator(age, education, bnt):
249
  if age <= 60 and education <= 12:
 
309
  ax.set_xticklabels(['1', '2', '3', '4', '5', '6', '7', '8', '9'])
310
 
311
  # Set the y-axis to display the tests
312
+ ax.set_yticks([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])
313
 
314
  # Set the test labels to the keys in test_dict (in reverse order)
315
  ax.set_yticklabels(reversed(list(test_dict.keys())))
 
460
  if st.button("Calculate Z-Score"):
461
  profile = test_profile(age, education_level, isw, bnt, fas)
462
 
463
+ # calculate the isw iq score
464
+ isw_mean, isw_std, isw_iq, isw_stanine = isw_calculator(age, education_level, isw)
465
 
466
  # for each value in the profile, calculate the z-score
467
  bnt_mean, bnt_std, z_bnt, stanine_bnt = bnt_calculator(age, education_level, bnt)
 
486
  test_dict = {
487
  "bnt": [bnt, bnt_mean, bnt_std, z_bnt, stanine_bnt],
488
  "fas": [fas, fas_mean, fas_std, z_fas, stanine_fas],
489
+ "isw": [isw, isw_mean, isw_std, isw_iq, isw_stanine],
490
  "animal": [animal, animal_mean, animal_std, animal_z, animal_stanine],
491
  "verb": [verb, verb_mean, verb_std, verb_z, verb_stanine],
492
  "repetition": [repetition, repetition_mean, repetition_std, repetition_z, repetition_stanine],