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

Write custom error class for SALib #42

Open
willu47 opened this issue Mar 9, 2015 · 0 comments
Open

Write custom error class for SALib #42

willu47 opened this issue Mar 9, 2015 · 0 comments

Comments

@willu47
Copy link
Member

willu47 commented Mar 9, 2015

At present, RuntimeErrors are used within each of the analysis modules. However, the text that describes the errors is inconsistent between the different methods (although sometimes needs to be different).

A custom SALib error class would allow us to maintain a focussed control on types of errors and the content error messages, ultimately resulting in a more informed user experience!

For example, from the Sobol module:

   if calc_second_order and Y.size % (2 * D + 2) == 0:
        N = int(Y.size / (2 * D + 2))
    elif not calc_second_order and Y.size % (D + 2) == 0:
        N = int(Y.size / (D + 2))
    else:
        raise RuntimeError("""
        Incorrect number of samples in model output file. 
        Confirm that calc_second_order matches option used during sampling.""")

    if conf_level < 0 or conf_level > 1:
        raise RuntimeError("Confidence level must be between 0-1.")

This would be replaced by:

   if calc_second_order and Y.size % (2 * D + 2) == 0:
        N = int(Y.size / (2 * D + 2))
    elif not calc_second_order and Y.size % (D + 2) == 0:
        N = int(Y.size / (D + 2))
    else:
        raise SampleError()

    if conf_level < 0 or conf_level > 1:
        raise ConfidenceIntervalError()
@jdherman jdherman added this to Structure in SALib Development Roadmap Nov 7, 2019
@jdherman jdherman moved this from Structure to Features in SALib Development Roadmap Nov 11, 2019
@jdherman jdherman moved this from Features to Methods in SALib Development Roadmap Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant