def __init__(self,datastore,**params): PerDSVPlot.__init__(self,datastore,**params) if self.title_style == "Clever": ss = datastore.get_stimuli() stimulus = StimulusID(ss[0]) for s in ss: s = StimulusID(s) if s.name != stimulus.name: print 'Datastore does not contain same type of stimuli: changing title_style from Clever to Standard' logger.warning('Datastore does not contain same type of stimuli: changing title_style from Clever to Standard') self.title_style = "Standard" break # lets find parameter indexes that vary if we need 'Clever' title style if self.title_style == "Clever": stimulus = StimulusID(self.datastore.get_stimuli()[0]) self.varied = [] for pn,pv in stimulus.get_param_values(): if pn != 'trial': for s in self.datastore.get_stimuli(): s = StimulusID(s) if s.params[pn] != pv: self.varied.append(pn) break if self.title_style == "Standard": self.extra_space_top=0.05 if self.title_style == "Clever": self.extra_space_top=0.05
def title(self,idx): if self.title_style == "None": return None if self.title_style == "Standard": stimulus = StimulusID(self.dsvs[idx].get_stimuli()[0]) title = '' title = title + stimulus.name + '\n' for pn,pv in stimulus.get_param_values(): title = title + pn + ' : ' + str(pv) + '\n' return title if self.title_style == "Clever": stimulus = StimulusID(self.dsvs[idx].get_stimuli()[0]) title = '' for pn in self.varied: title = title + str(pn) + ' : ' + str(stimulus.params[pn]) + '\n' return title