• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

fatiando / fatiando / 2088 / 3
70%
master: 70%

Build:
DEFAULT BRANCH: master
Ran 08 May 2017 04:05PM UTC
Files 54
Run time 5s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

08 May 2017 03:57PM UTC coverage: 69.83% (+6.6%) from 63.186%
PYTHON=2.7 COVERAGE=true BUILD_DOCS=false

push

travis-ci

web-flow
Replace polyprism Cython code with pure numpy (#368)

Replacing the Cython `gravmag.polyprism` forward modeling code 
with simpler pure Python + numpy versions (following #364). 
Using some optimizations and simplifications, the resulting code is just as fast or 
even faster than the Cython version.
The main optimization is combining logarithms, e.g. 
`log(a/b) - log(c/d)`  with `log((a*d)/(b*c))`.

Using the following IPython script to benchmark against `master`:

    from __future__ import division, print_function
    import sys
    import numpy as np
    from fatiando import gridder, utils
    from fatiando.mesher import PolygonalPrism
    # Get processor information
    tmp = !cat /proc/cpuinfo | grep "model name"
    processor = tmp[0].split(':')[1].strip()
    print(processor)
    # Make a model for testing
    vertices = np.transpose(gridder.circular_scatter([-300, 300, -300, 300], 50))
    props = {'density': 1000, 'magnetization': utils.ang2vec(2, 25, -10)}
    model = [PolygonalPrism(vertices, 0, 200, props),
             PolygonalPrism(vertices, 200, 300, props)]
    inc, dec = -30, 50
    x, y, z = gridder.regular((-500, 500, -500, 500), (70, 70), z=-1)
    print('Model size: {}'.format(len(vertices)))
    print('Grid size: {}'.format(x.size))
    # Time the forward modeling of gravity, gradients and mag
    from fatiando.gravmag import polyprism
    print('Times:')
    if len(sys.argv) == 1:
        fields = 'gz gxx gxy gxz gyy gyz gzz tf bz bx by'.split()
    else:
        fields = sys.argv[1:]
    for field in fields:
        print('  {}: '.format(field), end='')
        if field == 'tf':
            args = (x, y, z, model, inc, dec)
        else:
            args = (x, y, z, model)
        %timeit getattr(polyprism, field)(*args)

These are the times for the `master` branch on my laptop:

    Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
    Model size: 50
    Grid size: 4900
    Times:
      ... (continued)

4180 of 5986 relevant lines covered (69.83%)

0.7 hits per line

Source Files on job 2088.3 (PYTHON=2.7 COVERAGE=true BUILD_DOCS=false)
  • Tree
  • List 0
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 2088
  • Travis Job 2088.3
  • b1abf5e2 on github
  • Prev Job for PYTHON=2.7 COVERAGE=true BUILD_DOCS=false on master (#2069.3)
  • Next Job for PYTHON=2.7 COVERAGE=true BUILD_DOCS=false on master (#2093.3)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc