An extension for IPython that help to use Fortran in your interactive session.
Compile and import everything from a Fortran code cell, using f2py.
The contents of the cell are written to a .f90 file in the directory IPYTHONDIR/fortran using a filename with the hash of the code. This file is then compiled. The resulting module is imported and all of its symbols are injected into the user’s namespace.
|author:||Martín Gaitán <firstname.lastname@example.org>|
|documentation:||see this notebook|
You can install or upgrade via pip
pip install -U fortran-magic
or directly from the repository using the %install_ext magic command:
In: %install_ext https://raw.github.com/mgaitan/fortran_magic/master/fortranmagic.py
Once it’s installed, you can load it with %load_ext fortranmagic. Then put your Fortran code in a cell started with the cell magic %%fortran`. For example:
In: %load_ext fortranmagic In: %%fortran subroutine f1(x, y, z) real, intent(in) :: x,y real, intent(out) :: z z = sin(x+y) end subroutine f1
Every symbol is automatically imported. So f1 is already available:
In: f1(1.0, 2.1415) Out: 9.26574066397734e-05
See the documentation for details.
0.4 / 2013-07-10
- Implement the --extra option.
- Include f2py args in the hashing, so the same cell are recompiled if its arguments changes
0.3 / 2013-03-10
- Added %fortran_config to set and persist default arguments for %%fortran
- Improve documentation
0.2.1 / 2013-09-24
- Packaged and registered in pypi
- Starting a version’s changelog
0.2 / 2013-09-19
- Fortran highlighting in a %%fortran cell
- Works (or it should) in any platform (linux/windows/osx) and with py3 (thanks to Bradley Froehle)
- Many f2py’s arguments exposed as magic arguments
- Verbosity handling
- Improved documentation
0.1 / 2013-09-08
- First public release
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size fortran-magic-0.4.tar.gz (6.1 kB)||File type Source||Python version None||Upload date||Hashes View|