Skip to content

Commit

Permalink
[BBPBGLIB-1175] Handle deleted sections correctly (#182)
Browse files Browse the repository at this point in the history
## Context
User reported an error when creating synapse points on deleted sections.
This kind of synapses should have been skipped by
`Connection::add_synapses()`. This PR handles deleted sections correctly
so that they are skipped.

## Scope
In `target_manager.py` and `connection.py`, deleted sections are added
to TPointList as `None` type, and skipped by
`Connection::add_synapses()`.

## Testing
n/a

## Review
* [x] PR description is complete
* [x] Coding style (imports, function length, New functions, classes or
files) are good
* [ ] Unit/Scientific test added
* [ ] Updated Readme, in-code, developer documentation
  • Loading branch information
WeinaJi authored Jul 17, 2024
1 parent 9644aea commit 3cd579c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion neurodamus/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def add_synapses(self, target_manager, synapses_params, base_id=0):
syn_params['location'] = syn_point.x[0]
section = syn_point.sclst[0]

if not section.exists():
if section is None or not section.exists():
target_point_str = "({0.isec:.0f} {0.ipt:.0f} {0.offset:.4f})".format(syn_params)
logging.warning("SKIPPED Synapse %s on gid %d. Src gid: %d. Deleted TPoint %s",
base_id + i, self.tgid, self.sgid, target_point_str)
Expand Down
2 changes: 1 addition & 1 deletion neurodamus/target_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def append(self, *args):
# Called with a section and a point
section, point = args
self.x.append(point)
self.sclst.append(Nd.SectionRef(section.sec)) # Create and append a SectionRef
self.sclst.append(section) # Create and append a SectionRef
else:
raise ValueError("append() takes 1 or 2 arguments ({} given)".format(len(args)))

Expand Down

0 comments on commit 3cd579c

Please sign in to comment.