-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Continuing better Viewing (#447) #453
Conversation
Added a bunch of tests, fixed a few bugs that popped up and generally cleaned up the code. Also integrated a few changes we discussed, like removing inds from the edges dataframe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I did not review in a lot of detail, but my overall feedback would be to (1) write slightly more comprehensive docstrings (outlining also why particular functions are needed) and (2) adding more detail to comments, as many are not immediately clear to me. Let's also add tests for removing recordings, stimuli, and trainables from views. Thanks!
jaxley/modules/base.py
Outdated
@@ -179,7 +183,7 @@ def _childviews(self) -> List[str]: | |||
def __getitem__(self, index): | |||
supported_lvls = ["network", "cell", "branch"] # cannot index into comp | |||
|
|||
# TODO: SHOULD WE ALLOW GROUPVIEW TO BE INDEXED? | |||
# TODO FROM #447: SHOULD WE ALLOW GROUPVIEW TO BE INDEXED? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i still do not understand what you mean by that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that for Modules, i.e. net[0,0,0]
it is straightforward to lazy index into by just calling net.cell(0).branch(0).comp(0)
internally, likewise for net.cell(0)[0,0]
. However, for net.cell0
this is not the case, since we cannot tell easily what the user is indexing into. I.e. they might do net.cell0
or net.comp0
, which are totally different, but equivalent on the group level. Now should we allow them to still be able to do net.comp0[0,0,0]
? Additionally, should we allow net.cell(0).comp0
?
Decided to disable it for now and only allow indexing into Modules and Views thereof. I think that is sensible. The user can of course still index into groups however they like, they just have to do it via comp
, cell
, branch
instead of via __getitem__
. Lemme know if you disagree with this decision.
d922f3d
to
559be17
Compare
…ed to init SolveIndexer
559be17
to
2f2ccd1
Compare
I have addressed all comments and added a few more things, see comments above. Thanks for your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! Good to go (one minor comment below)!
@@ -41,6 +42,23 @@ | |||
from jaxley.utils.swc import build_radiuses_from_xyzr | |||
|
|||
|
|||
def only_allow_module(func): | |||
"""Decorator to only allow the function to be called on Module instances. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm maybe this should live in the utils
folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought this, but wanted to avoid circular import issues, since isinstance(self, View)
is used, which means we would have to import View
in utils. Could work around this by using self.__class__.__name__ == "View"
but I dislike this a bit. Lemme know your thoughts @michaeldeistler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, ok...let us keep it where it is then (but maybe move to the bottom of the file?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also does not work, since it's used in Module and needs to be defined above :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option would be to fold it into Module
. Will merge it like it is, feel free to change this if you dislike it.
* add: add first version of new tests * add: add more tests for new view * fix: add cumsum_nseg to View and remove cell_list in Network after used to init SolveIndexer * fix: ammend prev commit * fix: fold todos into funcs * wip: save wip, rm pre/post,make delete methods local, fixes * fix: fix trainables and local inds in edges * fix: fix jit simulate with data_stimulate issues and streamline edges * fix: make remaining tests pass * fix: ammend last * doc: prepare for review * wip: save wip * fix: all tests passing, address review comments * fix/rm: rm test for laxy indexing into groups, and rebase onto main. * fix: small refactor * fix: fix move_to issues. caused by not allowing cell.cells * doc: add comments
The following is a copy of the remaining todos from #447
Immediate Todos:
- [x] update existing tutorials with new API (edge)Will be removed -> Move functionality of SynapseView to synapse_utils #463Smaller Todos
net
andcell
. #338