fpr) np.save('data/tpr_aar_%d.npy' % num_mix, tpr) detection_clusters = rf.get_detect_clusters_threshold_array(max_detect_vals, detection_array, np.array(detection_lengths), C0,C1) out = open('data/detection_clusters_aar_%d.npy' % num_mix, 'wb') cPickle.dump(detection_clusters,out) out.close() for i in xrange(1,11): if not np.any(fpr*60 <= i): continue thresh_idx = (np.arange(fpr.shape[0])[fpr*60 <= i]).min() FOMS[num_mix].append(tpr[thresh_idx]) pos_cluster_responses,neg_cluster_responses = rf.get_pos_neg_detections(detection_clusters[thresh_idx],detection_array,C1,window_start,window_end,example_start_end_times) pos_cluster_responses += np.random.randn(*pos_cluster_responses.shape)/1000 neg_cluster_responses += np.random.randn(*neg_cluster_responses.shape)/1000 if pos_cluster_responses.shape[0] > 1: np.save("data/aar_pos_cluster_responses_%d_%d.npy"% (num_mix,i),pos_cluster_responses) pos_response_grid, pos_response_points = rf.map_cluster_responses_to_grid(pos_cluster_responses) rf.display_response_grid("aar_pos_response_grid_%d_%d.png" % (num_mix,i),pos_response_grid,pos_response_points) if neg_cluster_responses.shape[0] > 1: np.save("data/aar_neg_cluster_responses_%d_%d.npy"%(num_mix,i),neg_cluster_responses) neg_response_grid, neg_response_points = rf.map_cluster_responses_to_grid(neg_cluster_responses) rf.display_response_grid("aar_neg_response_grid_%d_%d.png" % (num_mix,i),neg_response_grid,neg_response_points) num_clusters = sum( len(cset) for cset in detection_clusters_at_threshold) num_pos_clusters = 0 num_neg_clusters = 0
'rb') detection_clusters = cPickle.load(out) out.close() out = open('data/example_start_end_times_aar.pkl','rb') example_start_end_times = cPickle.load(out) out.close() tpr = np.load('data/tpr_aar_%d.npy' % num_mix ) detection_array = np.load('data/detection_array_aar_%d.npy' % num_mix) C1 = int(33 * 1.5+.5) window_start = -10 window_end = 10 rf.get_pos_neg_detections(detection_clusters_at_threshold,detection_array, C1, window_start, window_end, example_start_end_times) num_clusters = sum( len(cset) for cset in detection_clusters_at_threshold) num_pos_clusters = 0 num_neg_clusters = 0 pos_clusters = np.zeros((num_clusters,C1)) neg_clusters = np.zeros((num_clusters,C1)) for detect_clusters, detection_row, start_end_times in itertools.izip(detection_clusters_at_threshold,detection_array,example_start_end_times): for c in detect_clusters: is_neg = True for s,e in start_end_times: