Skip to content

Move to a more pythonic API #235

@otizonaizit

Description

@otizonaizit

The naming of the functions in the public API are still derived by the MATLAB implementation. The MATLAB implementation does not use name spaces, I guess because it used to be the case that to make a function visible it needed to have the same of the file it is defined in. As a result we have to do something like:

import psignifit as ps
import psignifit.psigniplot as psp

res = ps.psignifit(...)
ax = psp.plot_psychometric_function(res)

for the function psignifit is indeed crazy, without the aliasing in __init__
we actually have psignifit.psignifit.psignifit.

I think that it makes more sense to name a function by what it does, so I think we want an API like this instead:

import psignifit as psf

res = psf.fit(...)
ax = psf.plot_psychometric_function(res)
ax = psf.plot_stimulus_residuals(res)
...

In other words this means we could have a flat namespace with functions that have names not as typo-inducing as psignifit is. Given that we do not have a lot of functions in the public API, I think a flat namespace is the easiest and more intuitive thing to do.

All of this could be done when we address #228 . Also, it can be done in a 100% backwards compatible way by creating aliases for the old API that can be supported forever.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions