Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant