Skip to content

Commit

Permalink
Improve circuit validation for virtual nodes (#86)
Browse files Browse the repository at this point in the history
- Check for 'components' only for biophysical nodes
- Change return type of circuit validation from list to set
  • Loading branch information
asanin-epfl committed Jul 31, 2020
1 parent 54514ec commit 0316fb1
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 83 deletions.
11 changes: 8 additions & 3 deletions bluepysnap/circuit_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def __eq__(self, other):
return False
return self.level == other.level and self.message == other.message

def __hash__(self):
"""Hash. Errors with the same level and message give the same hash."""
return hash(self.level) ^ hash(self.message)


class BbpError(Error):
"""Special class of errors for BBP specification of Sonata."""
Expand Down Expand Up @@ -303,6 +307,9 @@ def _check_rotations():
errors.append(fatal('Group {} of {} misses biophysical fields: {}'.
format(group_name, group.file.filename, missing_fields)))
_check_rotations()
if 'components' not in config:
errors.append(fatal('No "components" in config'))
return errors
components = config['components']
errors += _check_components_dir('morphologies_dir', components)
errors += _check_components_dir('biophysical_neuron_models_dir', components)
Expand Down Expand Up @@ -602,11 +609,9 @@ def validate(config_file, bbp_check=False):
"""
config = Config(config_file).resolve()
errors = _check_required_datasets(config)
if 'components' not in config:
errors.append(fatal('No "components" in config'))
if not errors:
errors = _check_populations(config)
if not bbp_check:
errors = [e for e in errors if not isinstance(e, BbpError)]
_print_errors(errors)
return errors
return set(errors)

0 comments on commit 0316fb1

Please sign in to comment.