Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Fortran backend for 1D EM forward modelling and Numpy broadcasting #22

Merged
merged 36 commits into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
cd5c127
Removed np.empty statements when the next line would recast the varia…
Aug 30, 2018
68f2a39
Added 3 new functions. Piecewise ramp fast uses Numpy broadcasting f…
Aug 30, 2018
3f7d08f
Added single layer flags to half-switch so no need to specify.
Aug 30, 2018
98d7e39
Updated forward modelling to use Piecewise_Pulse_Fast
Aug 30, 2018
f21906f
minor
Aug 30, 2018
f98e0f8
Added Fortran module for forward and sensitivity calculations
Aug 30, 2018
a20954b
Inputs to forward modelling must be in Fortran order to get efficient…
Aug 30, 2018
8d83d1f
Added Fortran extension to setup.py. On my Mac, I could not get pip …
Aug 30, 2018
e7b6529
Removed unused variables
Aug 30, 2018
255f5d0
version update
Sep 26, 2018
2fe95e6
Merge branch 'speed_up_leon' into master
sgkang Sep 26, 2018
3f76463
Merge pull request #19 from leonfoks/master
sgkang Sep 26, 2018
6ad4342
add import setuptools
Oct 2, 2018
508cef4
add fortran
Oct 2, 2018
d08c212
minor change
Oct 2, 2018
39d4cf5
blah..
Oct 3, 2018
045d8de
add pip install
Oct 3, 2018
52f4fdf
add fortran
Oct 3, 2018
37f9f8c
minor fix
Oct 9, 2018
47e2b61
blah
Oct 9, 2018
20d92e5
update travis.ml
Oct 9, 2018
25d4e39
minor fix
Oct 9, 2018
d0917d4
...
Oct 10, 2018
5a53afc
update notebooks
Oct 10, 2018
63653bc
tests parallel version
Oct 10, 2018
a3d1943
add make build
Oct 15, 2018
2cfaa11
minor fix
Oct 15, 2018
20bb56e
minor fix
Oct 16, 2018
b66a0a6
add make build
Oct 16, 2018
ceeace8
add try and except statement for fortran
Oct 17, 2018
c546fea
add gcc
Oct 17, 2018
afa21c6
fix time range bug in Survey.py
Oct 17, 2018
d8aca20
pep8 clean up
Oct 17, 2018
7fc58f0
back to piecewise_pulse_fast
Oct 17, 2018
73735de
minor update
Oct 22, 2018
79a6ea5
back master
Oct 23, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,28 @@ sudo: false
env:
- TEST_DIR=tests

addons:
apt_packages:
- gfortran

before_install:
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh
-O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
-O miniconda.sh; fi
- chmod +x miniconda.sh
- "./miniconda.sh -b -p $HOME/miniconda"
- export PATH=$HOME/anaconda/bin:$HOME/miniconda/bin:$PATH
- export PYTHONPATH=$HOME/simpegEM1D:$PYTHONPATH
- conda update --yes conda

install:
- conda env create -f environment.yml
- source activate simpegEM1D-environment
- export MPLBACKEND="agg"
- pip install -r requirements_dev.txt
- pip install coveralls
- python setup.py install
- make build
- export MPLBACKEND="agg"

script:
- travis_wait 20 nosetests $TEST_DIR -v -s
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
.PHONY: tests clean
.PHONY: build tests clean deploy

build:
python setup.py build_ext -i -b .

tests:
nosetests --logging-level=INFO

clean:
find . -name "*.pyc" | xargs -I {} rm -v "{}"
find . -name "*.pyc" | xargs -I {} rm -v "{}"

deploy:
python setup.py sdist bdist_wheel upload
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ dependencies:
- numpy
- scipy
- matplotlib
- ipywidgets
- mkl
- gcc
- pip:
- pymatsolver
- git+https://github.com/simpeg/simpegEM1D.git@master

56 changes: 31 additions & 25 deletions notebooks/develop/Low_pass_filter.ipynb

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions notebooks/develop/Test_global_em1d_inversion_booky.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,18 @@
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
Expand Down
538 changes: 134 additions & 404 deletions notebooks/develop/Test_global_em1d_inversion_booky_example.ipynb

Large diffs are not rendered by default.

463 changes: 104 additions & 359 deletions notebooks/examples/EM1D_inversion_FD_height_correction.ipynb

Large diffs are not rendered by default.

116 changes: 69 additions & 47 deletions notebooks/examples/EM1D_inversion_FD_height_correction_halfspace.ipynb

Large diffs are not rendered by default.

237 changes: 83 additions & 154 deletions notebooks/examples/EM1D_inversion_TD_layers.ipynb

Large diffs are not rendered by default.

520 changes: 256 additions & 264 deletions notebooks/examples/EM1D_inversion_TD_layers_dual_moment.ipynb

Large diffs are not rendered by default.

348 changes: 168 additions & 180 deletions notebooks/examples/Test_global_em1d_inversion.ipynb

Large diffs are not rendered by default.

156 changes: 77 additions & 79 deletions notebooks/examples/Test_global_em1d_inversion_td.ipynb

Large diffs are not rendered by default.

44 changes: 30 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
simpegEM1D is the package for simulation and inversion of
electromagnetic data using 1D layered-earth solution.
"""

from distutils.core import setup
import setuptools
from numpy.distutils.core import setup, Extension
from setuptools import find_packages


CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Intended Audience :: Education',
Expand All @@ -29,24 +28,41 @@
with open('README.md') as f:
LONG_DESCRIPTION = ''.join(f.readlines())

fExt = [Extension(name='simpegEM1D.m_rTE_Fortran', # Name of the package to import
sources=['simpegEM1D/Fortran/m_rTE_Fortran.f90'],
# extra_f90_compile_args=['-ffree-line-length-none',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leonfoks what are these commented lines?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally you put the fortran compile flags in the extra_f90_compile_args attribute, but it was not being recognized for some reason so I put them in the extra_link_args instead. You can delete these, but i left them commented to remind that this was the case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I'll remove them.

# '-O3',
# '-finline-functions',
# '-funroll-all-loops',
# '-DNDEBUG',
# '-g0'],
extra_link_args=['-ffree-line-length-none',
'-O3',
'-finline-functions',
'-funroll-all-loops',
'-g0'],
)
]


setup(
name = 'simpegEM1D',
version = '0.0.13',
packages = find_packages(),
install_requires = [
name='simpegEM1D',
version='0.0.15',
packages=find_packages(),
install_requires=[
'SimPEG>=0.4.1',
'empymod>=1.6.2',
'multiprocess'
],
author = 'Seogi Kang',
author_email = '[email protected]',
description = 'simpegEM1D',
long_description = LONG_DESCRIPTION,
keywords = 'geophysics, electromagnetics',
author='Seogi Kang',
author_email='[email protected]',
description='simpegEM1D',
long_description=LONG_DESCRIPTION,
keywords='geophysics, electromagnetics',
url='https://github.com/simpeg/simpegEM1D',
download_url='https://github.com/simpeg/simpegEM1D',
classifiers=CLASSIFIERS,
platforms = ['Windows', 'Linux', 'Solaris', 'Mac OS-X', 'Unix'],
platforms=['Windows', 'Linux', 'Solaris', 'Mac OS-X', 'Unix'],
license='MIT License',
use_2to3 = False,
ext_modules=fExt
)
Loading