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