def __init__(self, *args, **kwargs):
        super(SimpleContourAlgorithm, self).__init__(*args, **kwargs)

        self.narmour_features_cnt= defaultdict(dict)
        for feature_name, all_vals in all_features_values().iteritems():
            for val in all_vals:
                self.narmour_features_cnt[feature_name][val]=0.5
    def save_info(self, folder, score, params): 
        from plot import plot_narmour_feature, plot_first_note, paper_plot_narmour_feature, plot_arrival_contexts
        ### XXX para el paper
        #prob_model= ProbModel(self.ec.narmour_features_prob, self.notes_distr, use_harmony=True) 
        #n1= n2= 83
        #plot_narmour_feature(prob_model, params['min_pitch'], params['max_pitch'], folder, n1, n2)
        #plot_first_note(prob_model, params['min_pitch'], params['max_pitch'], folder, n1, n2)
        #plot_arrival_contexts(prob_model, params['min_pitch'], params['max_pitch'], 78, folder)


        #import ipdb;ipdb.set_trace()


        # XXX
        feature_names= all_features_values().keys() 
        feature_names.append(None)
        # XXX
        pitches_distr= {}
        for n, p in self.notes_distr.iteritems():
            pitches_distr[n.get_canonical_note()]= pitches_distr.get(n.get_canonical_note(), 0) + p
        prob_model= ProbModel(self.ec.narmour_features_prob, pitches_distr, use_harmony=False) 
        for feature_name in feature_names:
            plot_narmour_feature(prob_model, 50, 50+12+6, feature_name, folder)
        
        reference_pitch= 11
        #reference_pitch= max(self.notes_distr.iteritems(), key=lambda x:x[1])[0].pitch
        plot_narmour_feature(prob_model, params['min_pitch'], params['max_pitch'], None, folder, reference_note=Note(reference_pitch))
        reference_pitch= 6
        plot_narmour_feature(prob_model, params['min_pitch'], params['max_pitch'], None, folder, reference_note=Note(reference_pitch))
        #plot_narmour_feature(prob_model, 50, 50+12+6, None, folder, reference_note=Note((reference_pitch+7)%12))
        from pprint import pprint
        with open(os.path.join(folder, 'narmour.txt'), 'w') as f:
            pprint(self.ec.narmour_features_prob, f)
 def save_info(self, folder, score): 
     feature_names= all_features_values().keys() 
     feature_names.append(None)
     # XXX
     prob_model= ProbModel(self.ec.narmour_features_prob, self.notes_distr, use_harmony=False) 
     from plot import plot_narmour_feature
     for feature_name in feature_names:
         plot_narmour_feature(prob_model, 50, 50+12+6, feature_name, folder)
     
     #reference_pitch= max(self.notes_distr.iteritems(), key=lambda x:x[1])[0].pitch
     for reference_pitch in xrange(12):
         plot_narmour_feature(prob_model, 50, 50+12+6, None, folder, reference_note=Note(reference_pitch))
     #plot_narmour_feature(prob_model, 50, 50+12+6, None, folder, reference_note=Note((reference_pitch+7)%12))
     from pprint import pprint
     with open(os.path.join(folder, 'narmour.txt'), 'w') as f:
         pprint(self.ec.narmour_features_prob, f)