Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
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

@robban80

Description

@robban80

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']))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions