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

Ref/tdem testing #620

Merged
merged 51 commits into from
Jun 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d71d013
use setup class to define and store fields to speed up testing
lheagy Jun 23, 2017
35f204b
cleanup of the raw waveform tests as well
lheagy Jun 24, 2017
68dc071
remove fdem inversion example in favor of the published one
lheagy Jun 24, 2017
604b07f
check if the model has truly been updated before clearing matrices
lheagy Jun 24, 2017
fc7b423
early exit if the model is change['value']
lheagy Jun 24, 2017
3ade675
clean up logic for model observer
lheagy Jun 24, 2017
606b503
limit the number of steps taken in the sensitivity test for DC
lheagy Jun 24, 2017
1e5d502
update logic so it is more transparent when we are early exiting and …
lheagy Jun 25, 2017
ca291a1
extend timing slightly for docs build
lheagy Jun 25, 2017
1a99ecb
reverse the travis wait addition
lheagy Jun 25, 2017
bcc048f
try using travis wait only on docs
lheagy Jun 25, 2017
08e89b4
remove test_TDEM_MltiSrcDerivAdjoint and instead test multiple source…
lheagy Jun 25, 2017
8a74a56
download laguna del maule data as a .tar.gz
lheagy Jun 25, 2017
43513dd
remove printing comments around active cells
lheagy Jun 25, 2017
7683e8e
restore commented-out tdem test
lheagy Jun 25, 2017
b83926c
shrink the size of the mesh being used in the TDEM tests
lheagy Jun 25, 2017
4e4eed2
upload half the examples via travis
lheagy Jun 26, 2017
d23da2d
comment out celia figure for now
lheagy Jun 26, 2017
8537633
print pwd contents, travis
lheagy Jun 26, 2017
8332c9c
upload examples directory as well
lheagy Jun 26, 2017
8734b83
simplify download locations
lheagy Jun 26, 2017
f4cb8e3
path updates
lheagy Jun 26, 2017
bcab316
more path updates
lheagy Jun 26, 2017
9f6f2b5
restore all examples
lheagy Jun 26, 2017
55d0d92
more travis cleanup
lheagy Jun 26, 2017
8a85240
remove unintended commit of examples test
lheagy Jun 26, 2017
f43709e
remove notebook
lheagy Jun 26, 2017
c55475a
make examples directory
lheagy Jun 26, 2017
791239d
travis typo in path to where examples are
lheagy Jun 26, 2017
3ee08a7
remove the zip file as well in grad laguna example
lheagy Jun 26, 2017
d75a9b9
be verbose in unpacking of google files
lheagy Jun 26, 2017
11b4fe3
temp remove some examples so travis re-uploads docs and examples
lheagy Jun 26, 2017
aecce04
bring back em examples for upload
lheagy Jun 26, 2017
d0ec1af
add dc back
lheagy Jun 26, 2017
f9f9a31
tmp remove maps, grav
lheagy Jun 26, 2017
d86d1a8
just build docs, don't nosetest
lheagy Jun 26, 2017
b5afbf4
upload artifacts created on travis for half of the examples
lheagy Jun 26, 2017
d7d5210
simplify unpacking of docs archives
lheagy Jun 26, 2017
61d7490
cd to the right place
lheagy Jun 26, 2017
16c0395
add back examples, use make html-noplot
lheagy Jun 26, 2017
cf48e80
more pathing cleanups
lheagy Jun 26, 2017
e2c0e0b
try make html
lheagy Jun 26, 2017
e231b6d
restore all tests, restore use of nitpick on 2.7
lheagy Jun 26, 2017
6e587a0
remove aux bookpurnong files
lheagy Jun 26, 2017
a012d84
restore python 3 tests
lheagy Jun 26, 2017
e4ac2ae
use noplot for python 3 test
lheagy Jun 26, 2017
4087241
Merge pull request #621 from simpeg/tmp/upload-half-examples
lheagy Jun 26, 2017
bdb4f2a
update ylim to be consistent with publication, remove auxilary file c…
lheagy Jun 26, 2017
4890374
Change default interpolation to "nearest" to avoid logical error with…
fourndo Jun 27, 2017
dc4ac6c
add documentation to surface2ind_topo
thast Jun 27, 2017
60f0f29
add documentation surface2ind_topo
thast Jun 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 13 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ before_install:
- ./miniconda.sh -b -p $HOME/miniconda
- export PATH=/home/travis/anaconda/bin:/home/travis/miniconda/bin:$PATH
- conda update --yes conda
- echo $PWD
- ls $PWD
- echo $TRAVIS_BUILD_DIR
- ls $TRAVIS_BUILD_DIR

install:
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then
Expand All @@ -68,20 +64,25 @@ install:
openssl aes-256-cbc -K $encrypted_7e0a8632ac3f_key -iv $encrypted_7e0a8632ac3f_iv -in credentials.tar.gz.enc -out credentials.tar.gz -d ;
tar -xzf credentials.tar.gz ;
gcloud auth activate-service-account --key-file credentials/client-secret-docs.json ;
gsutil cp gs://simpeg/_build.tar.gz $PWD/docs/ ;
mkdir $PWD/docs/_build ;
tar -xzf $PWD/docs/_build.tar.gz -C $PWD/docs/_build ;
ls $PWD/docs/_build/ ;
gsutil cp gs://simpeg/_build.tar.gz $PWD/docs ;
gsutil cp gs://simpeg/examples.tar.gz $PWD/docs/content ;
cd docs ;
tar -xzf _build.tar.gz _build;
cd content ;
tar -xzf examples.tar.gz examples;
cd ../../ ;
fi

# Run test
script:
# - nosetests $TEST_DIR --with-cov --cov SimPEG --cov-config .coveragerc -v -s
- if [ "$TEST_DIR" = "$DEPLOY_DIR" -a ${TRAVIS_PYTHON_VERSION:0:1} == "3" ]; then
cd docs; make html-noplot ; cd ../;
cd docs; make html-noplot ; cd ../ ;
else
nosetests $TEST_DIR --with-cov --cov SimPEG --cov-config .coveragerc -v -s;
fi


# Calculate coverage
after_success:
- bash <(curl -s https://codecov.io/bash)
Expand All @@ -106,7 +107,10 @@ after_success:
gcloud auth activate-service-account --key-file credentials/client-secret.json ;
export GAE_PROJECT=simpegdocs ;
elif [ "$TRAVIS_BRANCH" = "$DEV_BRANCH" ]; then
cd docs; tar -cvzf _build.tar.gz _build ;
cd content; tar -cvzf examples.tar.gz examples ; cd ..;
gsutil cp docs/_build.tar.gz gs://simpeg ;
gsutil cp docs/content/examples.tar.gz gs://simpeg ;
gcloud auth activate-service-account --key-file credentials/client-secret-dev.json ;
export GAE_PROJECT=simpeg-dev-docs ;
fi ;
Expand Down
10 changes: 9 additions & 1 deletion SimPEG/Problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ def unpair(self):
deleteTheseOnModelUpdate = []

@properties.observer('model')
def _on_model_update(self, value):
def _on_model_update(self, change):
if change['previous'] is change['value']:
return
if (
isinstance(change['previous'], np.ndarray) and
isinstance(change['value'], np.ndarray) and
np.allclose(change['previous'], change['value'])
):
return
for prop in self.deleteTheseOnModelUpdate:
if hasattr(self, prop):
delattr(self, prop)
Expand Down
20 changes: 19 additions & 1 deletion SimPEG/Utils/modelutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,27 @@
import numpy as np
from scipy.interpolate import griddata, interp1d

def surface2ind_topo(mesh, topo, gridLoc='CC', method='cubic', fill_value=np.nan):
def surface2ind_topo(mesh, topo, gridLoc='CC', method='nearest', fill_value=np.nan):
Copy link
Member Author

Choose a reason for hiding this comment

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

thanks @fourndo!

"""
Get active indices from topography

Parameters
----------

:param TensorMesh mesh: TensorMesh object on which to discretize the topography
:param numpy.ndarray topo: [X,Y,Z] topographic data
:param str gridLoc: 'CC' or 'N'. Default is 'CC'.
Discretize the topography
on cells-center 'CC' or nodes 'N'
:param str method: 'nearest' or 'linear' or 'cubic'. Default is 'nearest'.
Interpolation method for the topographic data
:param float fill_value: default is np.nan. Filling value for extrapolation

Returns
-------

:param numpy.array actind: index vector for the active cells on the mesh
below the topography
"""

if mesh.dim == 3:
Expand Down
8 changes: 7 additions & 1 deletion examples/00_published/plot_booky_1D_time_freq_inv.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def run(plotIt=True, saveFig=False, cleanup=True):

ax0.semilogx(sigma_re, z, 'k', lw=2, label="RESOLVE")
ax0.semilogx(sigma_sky, z, 'b', lw=2, label="SkyTEM")
ax0.set_ylim(-100, 0)
ax0.set_ylim(-50, 0)
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the range we used in the paper

# ax0.set_xlim(5e-4, 1e2)
ax0.grid(True)
ax0.set_ylabel("Depth (m)")
Expand Down Expand Up @@ -459,6 +459,12 @@ def run(plotIt=True, saveFig=False, cleanup=True):
plt.show()

if cleanup:
print( os.path.split(directory)[:-1])
os.remove(
os.path.sep.join(
directory.split()[:-1] + ["._bookpurnong_inversion"]
)
)
os.remove(downloads)
shutil.rmtree(directory)

Expand Down
19 changes: 11 additions & 8 deletions examples/04-grav/plot_laguna_del_maule_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"""
import os
import shutil
import tarfile
import SimPEG.PF as PF
from SimPEG import Maps, Regularization, Optimization, DataMisfit,\
InvProblem, Directives, Inversion
Expand All @@ -24,15 +25,16 @@
def run(plotIt=True, cleanAfterRun=True):

# Start by downloading files from the remote repository
url = "https://storage.googleapis.com/simpeg/Chile_GRAV_4_Miller/"
cloudfiles = [
'LdM_grav_obs.grv', 'LdM_mesh.mesh',
'LdM_topo.topo', 'LdM_input_file.inp'
]
# directory where the downloaded files are

# Download to Downloads/SimPEGtemp
basePath = os.path.expanduser('~/Downloads/simpegtemp')
download([url+f for f in cloudfiles], folder=basePath, overwrite=True)
url = "https://storage.googleapis.com/simpeg/Chile_GRAV_4_Miller/Chile_GRAV_4_Miller.tar.gz"
Copy link
Member Author

Choose a reason for hiding this comment

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

@fourndo are you good with this?

Copy link
Contributor

Choose a reason for hiding this comment

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

i'm good with that.

downloads = download(url, overwrite=True)
basePath = downloads.split(".")[0]

# unzip the tarfile
tar = tarfile.open(downloads, "r")
tar.extractall()
tar.close()

input_file = basePath + os.path.sep + 'LdM_input_file.inp'
# %% User input
Expand Down Expand Up @@ -133,6 +135,7 @@ def run(plotIt=True, cleanAfterRun=True):
mrec = inv.run(mstart)

if cleanAfterRun:
os.remove(downloads)
shutil.rmtree(basePath)

# %%
Expand Down
116 changes: 0 additions & 116 deletions examples/07-fdem/plot_inversion_1D.py

This file was deleted.

6 changes: 4 additions & 2 deletions tests/em/static/test_DC_jvecjtvecadj.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def test_misfit(self):
self.survey.dpred(m), lambda mx: self.p.Jvec(self.m0, mx)
],
self.m0,
plotIt=False
plotIt=False,
num=3
Copy link
Member Author

Choose a reason for hiding this comment

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

@sgkang: I fixed the number of iterations this runs. If we let it go too far it fails b/c we hit machine precision.

)
self.assertTrue(passed)

Expand All @@ -149,7 +150,8 @@ def test_dataObj(self):
passed = Tests.checkDerivative(
lambda m: [self.dmis(m), self.dmis.deriv(m)],
self.m0,
plotIt=False
plotIt=False,
num=3
)
self.assertTrue(passed)

Expand Down