Exemplo n.º 1
0
 def record(self, variables, ids):
     """
     Add the cells in `ids` to the sets of recorded cells for the given variables.
     """
     logger.debug('Recorder.record(<%d cells>)' % len(ids))
     ids = set([id for id in ids if id.local])
     for variable in normalize_variables_arg(variables):
         if not self.population.can_record(variable):
             raise errors.RecordingError(variable, self.population.celltype)
         new_ids = ids.difference(self.recorded[variable])
         self.recorded[variable] = self.recorded[variable].union(ids)
         self._record(variable, new_ids)
Exemplo n.º 2
0
    def record(self, variables, ids, sampling_interval=None):
        """
        Add the cells in `ids` to the sets of recorded cells for the given variables.
        """
        logger.debug('Recorder.record(<%d cells>)' % len(ids))
        if sampling_interval is not None:
            if sampling_interval != self.sampling_interval and len(self.recorded) > 0:
                raise ValueError("All neurons in a population must be recorded with the same sampling interval.")

        ids = set([id for id in ids if id.local])
        for variable in normalize_variables_arg(variables):
            if not self.population.can_record(variable):
                raise errors.RecordingError(variable, self.population.celltype)
            new_ids = ids.difference(self.recorded[variable])
            self.recorded[variable] = self.recorded[variable].union(ids)
            self._record(variable, new_ids, sampling_interval)
Exemplo n.º 3
0
    def record(self, variables, ids, sampling_interval=None):
        """
        Add the cells in `ids` to the sets of recorded cells for the given variables.
        """
        logger.debug('Recorder.record(<%d cells>)' % len(ids))
        self._check_sampling_interval(sampling_interval)

        # for NEST we need all ids, not just local ones, otherwise simulations
        # sometimes hang with MPI if some nodes aren't recording anything
        all_ids = set(ids)
        local_ids = set([id for id in ids if id.local])
        for variable in recording.normalize_variables_arg(variables):
            if not self.population.can_record(variable):
                raise errors.RecordingError(variable, self.population.celltype)
            new_ids = all_ids.difference(self.recorded_all[variable])
            self.recorded[variable] = self.recorded[variable].union(local_ids)
            self.recorded_all[variable] = self.recorded_all[variable].union(all_ids)
            self._record(variable, new_ids, sampling_interval)