def get_html_correct_by_block(self, trialarray): if not trialarray: return div(italic("No trials")) html = """ <table class="extradetail"> <tr> <th>Block</th> <th>P(detected|present)</th> <th>P(detected|absent)</th> <th>c</th> <th>d'</th> </tr> """ for b in range(self.num_blocks): (p_detected_given_present, p_detected_given_absent, c, dprime, n_trials) = self.get_p_detected(trialarray, [b], None) html += tr( b, a(p_detected_given_present), a(p_detected_given_absent), a(c), a(dprime), ) html += """ </table> """ return html
def get_html_correct_by_group(self, trialarray): if not trialarray: return div(italic("No trials")) html = """ <table class="extradetail"> <tr> <th>Group</th> <th>P(detected|present)</th> <th>P(detected|absent)</th> <th>c</th> <th>d'</th> </tr> """ for g in range(N_CUES): (p_detected_given_present, p_detected_given_absent, c, dprime, n_trials) = self.get_p_detected(trialarray, None, [g]) html += tr( g, a(p_detected_given_present), a(p_detected_given_absent), a(c), a(dprime), ) html += """ </table> """ return html
def get_html_correct_by_half_and_probability(self, trialarray, grouparray): if (not trialarray) or (not grouparray): return div(italic("No trials or no groups")) n_target_highprob = max([x.n_target for x in grouparray]) n_target_lowprob = min([x.n_target for x in grouparray]) groups_highprob = [x.group_num for x in grouparray if x.n_target == n_target_highprob] groups_lowprob = [x.group_num for x in grouparray if x.n_target == n_target_lowprob] html = """ <div><i> High probability groups (cues): {}.\n Low probability groups (cues): {}.\n </i></div> <table class="extradetail"> <tr> <th>Half (0 first, 1 second)</th> <th>Target probability given stimulus (0 low, 1 high)</th> <th>P(detected|present)</th> <th>P(detected|absent)</th> <th>c</th> <th>d'</th> </tr> """.format( ", ".join([str(x) for x in groups_highprob]), ", ".join([str(x) for x in groups_lowprob]) ) for half in [0, 1]: for prob in [0, 1]: blocks = range(half * self.num_blocks/2, self.num_blocks/(2 - half)) groups = groups_lowprob if prob == 0 else groups_highprob (p_detected_given_present, p_detected_given_absent, c, dprime, n_trials) = self.get_p_detected(trialarray, blocks, groups) html += tr( half, a(prob), a(p_detected_given_present), a(p_detected_given_absent), a(c), a(dprime), ) html += """ </table> """ return html
def get_html_correct_by_group_and_block(self, trialarray): if not trialarray: return div(italic("No trials")) html = """ <table class="extradetail"> <tr> <th>Block</th> """ for g in range(N_CUES): html += """ <th>Group {0} P(detected|present)</th> <th>Group {0} P(detected|absent)</th> <th>Group {0} c</th> <th>Group {0} d'</th> """.format(g) html += """ </th> </tr> """ for b in range(self.num_blocks): html += "<tr>" + td(b) for g in range(N_CUES): (p_detected_given_present, p_detected_given_absent, c, dprime, n_trials) = self.get_p_detected(trialarray, [b], [g]) html += td(a(p_detected_given_present)) html += td(a(p_detected_given_absent)) html += td(a(c)) html += td(a(dprime)) html += "</tr>\n" html += """ </table> """ return html