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

cell_model.py is not trowing error if wrong dist_type is used #479

Open
robban80 opened this issue Oct 27, 2023 · 0 comments
Open

cell_model.py is not trowing error if wrong dist_type is used #479

robban80 opened this issue Oct 27, 2023 · 0 comments

Comments

@robban80
Copy link

I suppose this is not a clear error, but it makes the code sensitive to user derived errors.

If I would use the l5pc example and change some parameters so that dist_type is neither 'uniform' nor 'exp', then
def create_parameters(), lines 107-111
would happily use the scaler of the previous parameter without trowing an error (unless it happens to be the first parameter, then the scaler would not be defined which would case an error).

This could easily be avoided by raising an exception if the dist_type is something not allowed. E.g:

            if param_config['dist_type'] == 'uniform':
                scaler = ephys.parameterscalers.NrnSegmentLinearScaler()
            elif param_config['dist_type'] == 'exp':
                scaler = ephys.parameterscalers.NrnSegmentSomaDistanceScaler(
                    distribution=param_config['dist'])
            else:
                raise Exception( '"dist_type" ERROR!\n dist_type can not be "{}",\n\t use: uniform or exp'.format(param_config['dist_type']))
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

No branches or pull requests

1 participant