Advertisement
unstoppablelinda

Untitled

Oct 13th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. def generate_roster(name_file_path, roster_file_path, year=19):
  2. """
  3. Given a path to file with list of two names separated by space,
  4. a path to file for output roster, and year (default = 19),
  5.  
  6. Generate a roster as a TAB separated file of :
  7. Last First ID
  8. on each line, where ID = first.last.year
  9.  
  10. Ignore all lines that start with #
  11.  
  12. :param name_file_path: relative path to file containing a list of names
  13. :param roster_file_path: relative path to file to hold the output roster
  14. :param year: year integer used to assign student IDs
  15. :return: number of students in roster
  16. """
  17.  
  18.  
  19.  
  20. pass
  21. return -1
  22.  
  23. def generate_expected_grades(roster_file_path, expected_grade_file_path,
  24. class_mean, class_std_dev ):
  25. """
  26. Given class roster (Last First ID), generate an
  27. file that randomly assigns an expected grade to each student
  28. according to a Gaussian (normal) distribution of defined by
  29. class_mean and class_std_deviation
  30.  
  31. If the sample is higher than 100, re-sample.
  32. If the sample is lower than 0 or 5 standard deviations below mean,
  33. re-sample
  34.  
  35. :param roster_file_path: file containing class roster
  36. :param expected_grade_file_path: output file containing ID and expected expected_grade_file_path of list of operations
  37. :param class_mean: ideal mean for the class samples
  38. :param class_std_deviation: ideal std_deviation for samples
  39. :return: calculated median, mean, std_dev for all samples
  40. """
  41. pass
  42. return None, None, None
  43.  
  44.  
  45. """
  46. Simple output if you run as a script
  47. """
  48. if __name__ == '__main__':
  49.  
  50. import os
  51. num_students = generate_roster(os.path.join("data","short_names.txt"),
  52. os.path.join("data","short_roster.csv"))
  53.  
  54. print("Generated ",num_student," IDs in roster")
  55. median, mean, std_dev = generate_expected_grades(os.path.join("data","short_roster.csv"),
  56. os.path.join("data","short_expected.csv"),
  57. 78.0, 10.0)
  58. print("Calculated median={} mean={} s.d.={}".format(median, mean, std_dev))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement