Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/gimli-org/gimli into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
carsten-forty2 committed Sep 27, 2018
2 parents fa82cab + a62bc56 commit 8a2fa34
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" ST
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -pipe -ansi -Wall -Wno-long-long -Wno-unused-result -Wno-unused-variable")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-unused-value -Wno-strict-aliasing -Wno-unused-local-typedefs")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-int-in-bool-context")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-class-memaccess")

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -p -O2 -ansi -pedantic -fno-omit-frame-pointer -Wall")

Expand Down
3 changes: 0 additions & 3 deletions python/pygimli.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef PYTHON_PYGIMLI__H
#define PYTHON_PYGIMLI__H



//See best practices section in Py++ documentation

//# gcc 4.8 with linux complains about a couple of atomic problems
Expand Down Expand Up @@ -37,7 +35,6 @@
//#define PYTEST
#ifdef PYTEST


#include <iostream>
#include <fstream>
#include "stopwatch.h"
Expand Down
4 changes: 2 additions & 2 deletions python/pygimli/physics/ert/ves.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class VESModelling(Block1DModelling):
B is second power, M is first potential electrode.
an :
Part of data basis. Distances between A and N electrodes.
A is first power, M is second potential electrode.
A is first power, N is second potential electrode.
bn :
Part of data basis. Distances between B and N electrodes.
B is second power, M is second potential electrode.
B is second power, N is second potential electrode.
ab2 :
Half distance between A and B.
Only used for output and auto generated.
Expand Down
20 changes: 13 additions & 7 deletions python/pygimli/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
Please check: https://pytest.org/latest/example/index.html
"""

import pygimli as pg
import numpy as np
import platform
import sys
from os.path import join, realpath

import matplotlib.pyplot as plt
import numpy as np

import pygimli as pg


def test(target=None, show=False, onlydoctests=False, coverage=False,
Expand Down Expand Up @@ -50,9 +52,14 @@ def test(target=None, show=False, onlydoctests=False, coverage=False,
Return correct exit code, e.g. abort documentation build when a test
fails.
"""
# Remove figure warnings
plt.rcParams["figure.max_open_warning"] = 1000

printopt = np.get_printoptions()

if verbose:
pg.boxprint("Testing pygimli %s" % pg.__version__, sym="+")

# Numpy compatibility (array string representation has changed)
if np.__version__[:4] in ("1.14", "1.15"):
np.set_printoptions(legacy="1.13")
Expand Down Expand Up @@ -93,8 +100,10 @@ def test(target=None, show=False, onlydoctests=False, coverage=False,
if onlydoctests:
excluded.append("testing")

cmd = (["-v", "-rsxX", "--color", "yes", "--doctest-modules",
"--durations", 5, cwd])
cmd = ([
"-v", "-rsxX", "--color", "yes", "--doctest-modules", "--durations", 5,
cwd
])
for directory in excluded:
cmd.extend(["--ignore", join(cwd, directory)])

Expand All @@ -115,8 +124,5 @@ def test(target=None, show=False, onlydoctests=False, coverage=False,
print("Exiting with exitcode", exitcode)
sys.exit(exitcode)

plt.close('all')
plt.switch_backend(old_backend)
np.set_printoptions(**printopt)


8 changes: 4 additions & 4 deletions python/pygimli/testing/test_RValueConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,10 @@ def test_NumpyToScalar(self):
pg.HarmonicModelling(np.int64(1), x);
pg.HarmonicModelling(np.uint64(1), x);

pg.PolynomialModelling(1, np.int32(1), x3, x);
pg.PolynomialModelling(1, np.int64(1), x3, x);
pg.PolynomialModelling(1, np.uint32(1), x3, x);
pg.PolynomialModelling(1, np.uint64(1), x3, x);
# pg.PolynomialModelling(1, np.int32(1), x3, x);
# pg.PolynomialModelling(1, np.int64(1), x3, x);
# pg.PolynomialModelling(1, np.uint32(1), x3, x);
# pg.PolynomialModelling(1, np.uint64(1), x3, x);

x = pg.Pos(0.0, 0.0, 0.0)
x += np.float32(1)
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ if (PYTHON_FOUND)
target_link_libraries(${libgimli_TARGET_NAME} ${PYTHON_LIBRARY})
endif (PYTHON_FOUND)

if (CONDA_BUILD)
include_directories(${CONDA_PREFIX})
endif()


if (USE_BOOST_THREAD)
Expand Down
4 changes: 3 additions & 1 deletion src/datacontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ long DataContainer::createSensor(const RVector3 & pos, double tolerance){

void DataContainer::registerSensorIndex(const std::string & token) {
dataSensorIdx_.insert(token);
this->set(token, RVector(this->size(), -1.0));
if (!this->exists(token)){
this->set(token, RVector(this->size(), -1.0));
}
}

bool DataContainer::isSensorIndex(const std::string & token) const {
Expand Down

0 comments on commit 8a2fa34

Please sign in to comment.