Example #1
0
 def parse_spikes(self, to_parse):
     spikes = []
     if isinstance(to_parse, list):
         spikes = to_parse
     elif 'file' in to_parse:
         if not self.f.exists():
             inform('ERROR! Datafile %s does not exist (relative to %s)!'%
                     (self.f.filename, getcwd()), indent=2, verbosity=0, underline='-')
             spikes = None
         elif not self.f.has_changed():
             inform('ERROR! Datafile %s has not changed!'
                    % self.f.filename, indent=2, verbosity=0, underline='-')
             spikes = None
         elif self.f.has_changed():
             tv = self.f.get_timeseries()
             inform('Reading timeseries from: ', self.f,
                    indent=1, verbosity=1)
             if 'spike detection' in to_parse:
                 sd = to_parse['spike detection']
                 method = sd.get('method', 'threshold')
                 threshold = float(sd.get('threshold', 0))
                 inform('Detecting spikes with method: ',
                        method, indent=2, verbosity=1)
                 spikes = ts.spikes_from_timeseries(tv, method=method,
                                                    threshold=threshold)
             else:  # file contains spike times
                 spikes = tv
         else:
             inform('ERROR! Preexistent datafile %s has not been updated!'
                    % self.f.filename, indent=2, verbosity=0, underline='-')
             spikes = []
     return spikes
Example #2
0
 def parse_spikes(self, to_parse):
     if isinstance(to_parse, list):
         spikes = to_parse
     elif 'file' in to_parse:
         if self.f.has_changed():
             tv = self.f.get_timeseries()
             inform('Reading timeseries from: ',
                    self.f,
                    indent=1,
                    verbosity=1)
             if 'spike detection' in to_parse:
                 sd = to_parse['spike detection']
                 method = sd.get('method', 'threshold')
                 threshold = float(sd.get('threshold', 0))
                 inform('Detecting spikes with method: ',
                        method,
                        indent=2,
                        verbosity=1)
                 spikes = ts.spikes_from_timeseries(tv,
                                                    method=method,
                                                    threshold=threshold)
         else:
             inform('ERROR! Preexistent datafile %s has not been updated!' %
                    self.f.filename,
                    indent=2,
                    verbosity=0,
                    underline='-')
             spikes = []
     return spikes
Example #3
0
 def parse_spikes(self, to_parse):
     if isinstance(to_parse, list):
         spikes = to_parse
     elif 'file' in to_parse:
         f = fn.FileNodeHelper(to_parse['file'])
         tv = f.get_timeseries()
         inform('Reading timeseries from:', f, indent=1)
         if 'spike detection' in to_parse:
             sd = to_parse['spike detection']
             method = sd.get('method', 'threshold')
             threshold = float(sd.get('threshold', 0))
             inform('Detecting spikes with method:', method, indent=2)
             spikes = ts.spikes_from_timeseries(tv, method=method, threshold=threshold)
     return spikes