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

Fix location if section list is empty #451

Merged
merged 4 commits into from
Mar 16, 2023

Conversation

arnaudon
Copy link
Contributor

No description provided.

self.sec_index = int(np.argmax(np.linalg.norm(points, axis=1)))
else:
self.sec_index = int(np.argmax(points.dot(self.direction)))
if len(points) > 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

But what will happen if this fails? Isn't that an exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, here: https://github.com/BlueBrain/BluePyOpt/blob/master/bluepyopt/ephys/locations.py#L432
as sec_index =None (default) value I didn't bother raising the same again

Copy link
Contributor

Choose a reason for hiding this comment

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

I was almost gonna say it was ok like this. But then I realized that this function is called set_sec_index. The user of this method would expect something to happen to sec_index when it is being called. (Let's say e.g. sec_index was set to a certain value before the call, it would not even set to None again if no points were found). I think an exception here is the safest, because in the end ... it is an exception ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, better like that?

@wvangeit wvangeit merged commit 2f3a548 into BlueBrain:master Mar 16, 2023
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