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

remove global imports of numpy etc. #9

Open
demisjohn opened this issue Apr 11, 2018 · 3 comments
Open

remove global imports of numpy etc. #9

demisjohn opened this issue Apr 11, 2018 · 3 comments
Assignees
Labels

Comments

@demisjohn
Copy link
Owner

From @demisjohn on February 28, 2018 9:38

the module repeatedly calls from numpy import *, which, aside from being bad practice, actually has stomped on one of it's own functions.

The camfr function full(), as in set_mode_correct(full), has been replaced by numpy.full() (which presumably didn't exist in ~2005). This now pops an error.

    set_mode_correction(full)
Boost.Python.ArgumentError: Python argument types in
    camfr._camfr.set_mode_correction(function)
did not match C++ signature:
    set_mode_correction(Mode_correction)

Must go thru the python files and replace the import statement with import numpy as np and go through to prepend all numpy functions with np.!

Copied from original issue: #5

@demisjohn demisjohn self-assigned this Apr 11, 2018
@demisjohn
Copy link
Owner Author

A workaround may be to use the number 3 instead of "full", as I believe this is just an enumerated enum in C or something.

See camfr_wrap.cpp, and search for full

@demisjohn
Copy link
Owner Author

3041533 fixes the numpy * stomping on full ModeSolver option.

Still have a few more include files to remove the global numpy import from, and also must runs testsuite to confirm it didn't break anything.

@demisjohn
Copy link
Owner Author

The last global import is in __init__.py, where it calls from pylab import *. Not sure which modules use this.

This does actually generate a full() function from numpy, but _camfr.so is loaded afterwards, so CAMFR stomps on numpy's full function, so CAMFR works as expected when run with import camfr as *.

Should remove this line, but find out where it is used first to see if it'll break anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant