diff --git a/lms/djangoapps/instructor/views.py b/lms/djangoapps/instructor/views.py
index f78a1160de..d812791c3d 100644
--- a/lms/djangoapps/instructor/views.py
+++ b/lms/djangoapps/instructor/views.py
@@ -209,6 +209,7 @@ def instructor_dashboard(request, course_id):
problem = request.POST['Problem']
nmsg, plots = psychoanalyze.generate_plots_for_problem(problem)
msg += nmsg
+ track.views.server_track(request, 'psychometrics %s' % problem, {}, page='idashboard')
if idash_mode=='Psychometrics':
problems = psychoanalyze.problems_with_psychometric_data(course_id)
diff --git a/lms/djangoapps/psychometrics/psychoanalyze.py b/lms/djangoapps/psychometrics/psychoanalyze.py
index c798c73609..bb2a6ba6a8 100644
--- a/lms/djangoapps/psychometrics/psychoanalyze.py
+++ b/lms/djangoapps/psychometrics/psychoanalyze.py
@@ -146,6 +146,13 @@ def generate_plots_for_problem(problem):
xdat = range(1,max_attempts+1)
dataset = {'xdat': xdat}
+ # compute grade statistics
+ grades = [pmd.studentmodule.grade for pmd in pmdset]
+ gsv = StatVar()
+ for g in grades:
+ gsv += g
+ msg += "
Grade distribution: %s
" % gsv + # generate grade histogram ghist = [] @@ -159,8 +166,12 @@ def generate_plots_for_problem(problem): }] }""" + if gsv.max > max_grade: + msg += "Something is wrong: max_grade=%s, but max(grades)=%s
" % (max_grade, gsv.max) + max_grade = gsv.max + if max_grade > 1: - ghist = make_histogram([pmd.studentmodule.grade for pmd in pmdset],np.linspace(0,max_grade,max_grade+1)) + ghist = make_histogram(grades, np.linspace(0,max_grade,max_grade+1)) ghist_json = json.dumps(ghist.items()) plot = {'title': "Grade histogram for %s" % problem, @@ -192,7 +203,7 @@ def generate_plots_for_problem(problem): dtsv += dt ct0 = ct if dtsv.cnt > 2: - msg += "Time differences between checks: %s
" % dtsv bins = np.linspace(0,1.5*dtsv.sdv(),30) dbar = bins[1]-bins[0] thist = make_histogram(dtset,bins) @@ -223,7 +234,7 @@ def generate_plots_for_problem(problem): ylast = y + ylast yset['ydat'] = ydat - if len(ydat)>5: # try to fit to logistic function if enough data points + if len(ydat)>3: # try to fit to logistic function if enough data points cfp = curve_fit(func_2pl, xdat, ydat, [1.0, max_attempts/2.0]) yset['fitparam'] = cfp yset['fitpts'] = func_2pl(np.array(xdat),*cfp[0])