Comments (10)
Looking at it, this might require that the python code becomes a proper module (ie. with an __init__.py
file) as opposed to having everything at the top level of Python hierarchy, which probably means changing the import structure internally and externally (may be for the better tbh). Am I analysing this correctly?
from auto-07p.
I was thinking the same thing: it would be great to be able to do pip install auto
, but it does inded involve a fair amount of work. At the moment the closest there is to it are the *.xauto
files, which all have from auto import *
(historical.. I know this is not recommended, but easy to adjust); the autox
script does very little, just adjust PYTHONPATH
and run python with the script.
from auto-07p.
Hi, I’ve made some quick changes to the import structure and added a setup.py
/setup.cfg
definition for installation. master...Debilski:python-module
I have not at all thoroughly tested it though (we’ll test it in the lab and probably add some more changes) but it could be used as a starting point.
from auto-07p.
Thanks @Debilski : I merged your changes but changed all relative imports from . import xxx
to absolute imports from auto import xxx
. This helps with some of the existing scripts and doing imports inside the AUTO clui.
of course this setup.py is only a start, since it doesn't take care of the Fortran files yet.
from auto-07p.
Thanks for merging, @bartoldeman. For us, this solves already many problems, since we can now install the Python package in its own virtual environment. Having the Fortran part separate in its AUTO_DIR is not so much of a problem in comparison to having to change sys.path
.
from auto-07p.
How does one install this package with pip or conda currently? I've tried appendind sys path but I still cannot import the module
from auto-07p.
@nwaxiomatic I don’t know if this is the officially approved way of doing things, but at my institute we are currently doing it as follows:
# Install the Python module with pip,
# which means no messing around with sys.path is needed (thankfully!)
# (if this is no conda/Python environment,
# then adding the --user flag might be sensible)
pip install git+https://github.com/auto-07p/auto-07p
# now, Python will find the module, but won’t properly import it,
# because it cannot find the cmd scripts (and none of the Fortran files etc.)
# Those need to be compiled separately and the AUTO_DIR environment variable
# needs to be set so that the Python module can find it.
git clone https://github.com/auto-07p/auto-07p
cd auto-07p
./configure && make
# Not sure if a `make install` is strictly needed; it might work without,
# if you only want to use it from Python.
# Finally, set the environment variable to the directory we cloned the auto repo to.
export AUTO_DIR=$(pwd)
# Now it should be importable from inside Python
from auto-07p.
@Debilski thanks for the description. I hope to find some time to do the configure make directly via pip install.
@nwaxiomatic
the following works for me without the pip installed package (ie only configure and make):
$ python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/home/oldeman/auto/07p/python')
>>> from auto import *
you can of course also use import auto
in which case you need to use auto.run
instead of plain run
and so on (or if you want a clean namespace otherwise, from auto import run
and so on). AUTO_DIR
is automatically set correctly to /home/oldeman/auto/07p
by the Python code during the import
in this case.
from auto-07p.
After following the process mentioned above, some errors come out,
plot('abc')
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/auto/AUTOCommands.py", line 1845, in plot
n1b = bifDiag.bifDiag(n1b,n1s)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/auto/bifDiag.py", line 33, in init
constants)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/auto/bifDiag.py", line 53, in __realinit
raise AUTOExceptions.AUTORuntimeError('\n'.join(ioerrors))
auto.AUTOExceptions.AUTORuntimeError: [Errno 2] No such file or directory: 'b.abc'
[Errno 2] No such file or directory: 's.abc'
Please help me to overcome this problem. Thanks
from auto-07p.
I would like to see a PyPI version of Auto-07p as well! (see this issue)
For anyone willing to work with a little wrapper to auto: I wrote a software that adds a little work-around with respect to the environment/path variable issues: https://github.com/pyrates-neuroscience/PyCoBi
It is pip installable, and would merely require a PyPI build for Auto-07p that calls configure
, make
and python setup.py install
. After that, PyCoBi
handles the environment variables for you.
It is light-weight, in that it still uses most of the standard syntax that you know from Auto-07p
, and provides a few convenient features, such as automated merging of solution branches, automated extraction of eigenvalues, local lyapunov exponents, ...
Furthermore, you can interface Auto-07p to a certain degree completely from within Python, since it comes with a fortran code-generator (based on PyRates) that allows you to define your models either within Python or via YAML definition files. You can still use your own Fortran files if you want though.
from auto-07p.
Related Issues (20)
- Specifying the Jacobian of the boundary conditions. HOT 1
- Errors compiling on a Mac HOT 5
- auto.env.sh has path for pervious version HOT 2
- Compilation on Ubuntu 20.10 HOT 1
- add topics HOT 1
- MacOS installation problems HOT 1
- Error finding libraries on Mac HOT 1
- Black screen in PyPLAUT HOT 1
- Problem with the `__repr__` method in the Pointset python class
- Runtime error/segmentation fault Ubuntu 22.04 HOT 3
- How to fix ode equations error....'Label HB1 is not found'
- Print all user parameters to fort.7 file
- PLAUT04 ignored HOT 2
- PyPI integration
- Request: Add AUTO output file format (fort.8) documentation to the official manual HOT 1
- BUG: Detection of user-supplied functions depending on eigenvalues HOT 7
- Build with debug options fails with `solution.c++:2029:5: error: ‘cout’ was not declared in this scope`. HOT 1
- `make check` python-errors in r3b with `ValueError: operands could not be broadcast together with shapes (31,) (0,)`. HOT 3
- ld: library not found for -lSystem HOT 1
- Consult: Compile use problem, can not compile PLAUT04 graphics
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auto-07p.