Skip to content
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

[WIP] fix __iter__ #329

Closed
wants to merge 1 commit into from
Closed

[WIP] fix __iter__ #329

wants to merge 1 commit into from

Conversation

michaeldeistler
Copy link
Contributor

@michaeldeistler michaeldeistler commented Apr 10, 2024

comp = jx.Compartment()
branch = jx.Branch(comp, 2)
cell = jx.Cell(branch, [-1, 0, 0])
net = jx.Network([cell for _ in range(4)])

counter = 0
for cell in net:
    for branch in cell:
        for comp in branch:
            counter += 1

print(counter)  # ==> 3

Copy link
Contributor

@jnsbck jnsbck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the rationale behind this change?

@@ -1055,14 +1055,9 @@ def shape(self):

```
network.shape = (num_cells, num_branches, num_compartments)
cell.shape = (num_branches, num_compartments)
branch.shape = (num_compartments,)
cell.shape = (1, num_branches, num_compartments)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not so sure if we should assign dim=1 to cell if you technically have no way to index into it (it is the object being indexed into).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, net would also have to have shape=(1,...), which would be odd imo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be added to #43 when settled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I had not meant to request a review yet...

Anyways, __iter__ is broken right now, see the PR description. But let's just talk in person this is not an urgent PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went over the recent PRs and thought I'd just do a pass of this one as well, even though you did not request it.

Alright sounds good.

@michaeldeistler michaeldeistler changed the title fix __iter__ [WIP] fix __iter__ Apr 11, 2024
@michaeldeistler michaeldeistler force-pushed the main branch 8 times, most recently from a1b70d8 to fddb19a Compare August 22, 2024 14:36
@jnsbck jnsbck mentioned this pull request Oct 10, 2024
@jnsbck jnsbck mentioned this pull request Oct 23, 2024
8 tasks
@jnsbck
Copy link
Contributor

jnsbck commented Oct 23, 2024

adressed by #447

@jnsbck jnsbck closed this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants