Git Product home page Git Product logo

geobipy's Introduction

Welcome to GeoBIPy: Geophysical Bayesian Inference in Python

This package uses a Bayesian formulation and Markov chain Monte Carlo sampling methods to derive posterior distributions of subsurface and measured data properties. The current implementation is applied to time and frequency domain electromagnetic data. Application outside of these data types is in development.

Citation

Foks, N. L., and Minsley, B. J. 2020. GeoBIPy - Geophysical Bayesian Inference in Python. 10.5066/P9K3YH9O

Background scientific references

Minsley, B. J., Foks, N. L., and Bedrosian, P. A. 2020. Quantifying model structural uncertainty using airborne electromagnetic data. Geophys. J. Int. 224, 1, 590โ€“607. https://doi.org/10.1093/gji/ggaa393

Minsley, B. J. 2011. A trans-dimensional Bayesian Markov chain Monte Carlo algorithm for model assessment using frequency-domain electromagnetic data. Geophys. J. Int. 187, 252โ€“272. 10.1111/j.1365-246X.2011.05165.x

Documentation is here!

This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. The software is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the software.

geobipy's People

Contributors

banesullivan avatar bminsley avatar leonfoks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geobipy's Issues

'numpy' has no attribute 'float128'

For users running this code on windows, there are multiple calls to np.float128. This datatype is not available for windows machines. This results in continuous exceptions and constant rejection of models.

Suggest changing to "np.longdouble". This will default to float128 on linux and float64 on windows, which is the best you can do.

Changes should be made to "utilities" line 670 and "inference1D" line 382, though there may be other instances.

Another issue plotting without X

I want to use the 'Agg' backend to make plots (such that I can create and save figures remotely, without access to an X-server), as I use a remote server to run GeoBiPy.

But, if I do

import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt

from geobipy import LineResults

I get an error impoerting LineResults from geobipy:

(geobipy) tmeha@Arizona:~/$ python pl_results.py
Traceback (most recent call last):
  File "pl_results.py", line 15, in <module>
    from geobipy import LineResults
  File "/mnt/PROGRAMMING/geobipy/geobipy/__init__.py", line 20, in <module>
    from .src.base import customPlots
  File "/mnt/PROGRAMMING/geobipy/geobipy/src/base/customPlots.py", line 2, in <module>
    mpl.use('TkAgg')
  File "/home/tmeha/anaconda3/envs/geobipy/lib/python3.7/site-packages/matplotlib/__init__.py", line 1391, in use
    switch_backend(name)
  File "/home/tmeha/anaconda3/envs/geobipy/lib/python3.7/site-packages/matplotlib/pyplot.py", line 222, in switch_backend
    newbackend, required_framework, current_framework))
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running

A simple trick to allow a user to select the backend is to comment out line 2 in /geobipy/src/base/customPlots.py:

# mpl.use('TkAgg')

  • Thomas

plotDatapoints script issue

there appears to be a problem with the plotDatapoints.py script when one or more soundings have failed to converge (burn in). In this case, you cannot plot any of the points and the following error shows up:

[pbedrosian@yeti-login20 plotting] python plotDatapoints.py ../Data/ ../results/1650.0.h5 --points 5
Traceback (most recent call last):
File "plotDatapoints.py", line 51, in
fids = LR.iDs[args.points]
IndexError: too many indices for array
[pbedrosian@yeti-login20 plotting] python plotDatapoints.py ../Data/ ../results/1650.0.h5
Traceback (most recent call last):
File "plotDatapoints.py", line 64, in
for fid in fids:
TypeError: iteration over a 0-d array

DOI transparency on line plots

How do you include the DOI as a transparency on top of a line plot? I tried using:

LR.plotDoi(linewidth=0.1, alpha=0.6, percent=40)

but got the following error-

File "plotLine.py", line 63, in
LR.plotDoi(linewidth=0.1, alpha=0.6, percent=40)
File "/cxfs/projects/software/geobipy/geobipy/src/inversion/LineResults.py", line 462, in plotDoi
self.getDOI(percent)
File "/cxfs/projects/software/geobipy/geobipy/src/inversion/LineResults.py", line 209, in getDOI
self.doi[i] = self.depthGrid.cellCentres[zSize - iC]
AttributeError: 'NoneType' object has no attribute 'cellCentres'

Direct link to the publication?

Hi there! In the docs, it says:

The code and its processes have been documented in multiple ways. First we have the publication associated with this software release, the citation is below, and presents the application of this package to frequency and time domain electro-magnetic inversion.

But there's no citation... would you all provide a link to the published work? Thanks!

Note: I found this abstract

Problem for Installing a serial version of GeoBIPy

I followed your instruction in the Documentation, the error messages are:

(base) C:\geobipy-master>setup.py install
Traceback (most recent call last):
File "C:\geobipy-master\setup.py", line 25, in
long_description=readme(),
File "C:\geobipy-master\setup.py", line 18, in readme
return f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 870: illegal multibyte sequence

self.savePNG = True does not work without X

Hi

I run geobipySerial on a remote machine, and I do not use the X-server.
If I use

self.plot = False
self.savePNG = True

then geobipySerial stops with an error when the png file is being created:
"_tkinter.TclError: couldn't connect to display "localhost:12.0"
Is it possible to use another backend with matplotlib in this case (when self.plot=False) that does not need an Xserver?

The code runs fine if I use

self.plot = False
self.savePNG = False

Also, it would be nice if the progress of geobipySerial could be written to the console. Perhaps this is already an option?

Have a great day

  • Thomas

add functionality for thinning of chain

add a parameter such as self.thin in the userParameters file that is used to thin the Markov Chain results so that only every nth model is included in output calculations & statistics. For example, with if the chain is run for 400,000 iterations with thin=4, the output statistics would be based on every 4th model (100,000 total). Accept/reject rules apply to all models in the chain as the algorithm runs.

This might help to deal with some 'noisy' outputs where the chain gets stuck occasionally, and will be a step towards future multi-chain runs

No module named 'cached_property'

Hi

When I import geobipy (fter a fresh install) I get the following:

(geobipy) tmeha@pop-os:~/space/PROGRAMMING/geobipy/documentation_source/source/examples/Models$ python
Python 3.8.1 (default, Jan  8 2020, 22:29:32) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import geobipy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/space/PROGRAMMING/geobipy/geobipy/__init__.py", line 21, in <module>
    from .src.base import customFunctions
  File "/mnt/space/PROGRAMMING/geobipy/geobipy/src/base/customFunctions.py", line 5, in <module>
    from ..classes.core import StatArray
  File "/mnt/space/PROGRAMMING/geobipy/geobipy/src/classes/core/StatArray.py", line 12, in <module>
    from ...base.HDF import hdfRead
  File "/mnt/space/PROGRAMMING/geobipy/geobipy/src/base/HDF/hdfRead.py", line 6, in <module>
    from ...classes.data.datapoint.FdemDataPoint import FdemDataPoint
  File "/mnt/space/PROGRAMMING/geobipy/geobipy/src/classes/data/datapoint/FdemDataPoint.py", line 7, in <module>
    from .EmDataPoint import EmDataPoint
  File "/mnt/space/PROGRAMMING/geobipy/geobipy/src/classes/data/datapoint/EmDataPoint.py", line 1, in <module>
    from .DataPoint import DataPoint
  File "/mnt/space/PROGRAMMING/geobipy/geobipy/src/classes/data/datapoint/DataPoint.py", line 1, in <module>
    from cached_property import cached_property
ModuleNotFoundError: No module named 'cached_property'

Am I missing something ?

  • Thomas

Error when installing serial version

I ran into issues when running pip install -e . for installing the serial version. The error seems to be related to mtforward1d_fortranmodule.c, which was not generated during build through f2py. I am not sure how to fix this. Any help will be much appreciated!

I am using python 3.7.1, below is the error message. Python 3.5/3.6 also produced the same error.

$ pip install -e .
Obtaining file:///Users/.../code/geobipy
    Complete output from command python setup.py egg_info:
    running egg_info
    running build_src
    build_src
    building extension "geobipy.src.classes.forwardmodelling.fdemforward1d_fortran" sources
    f2py options: []
      adding 'build/src.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/geobipy/src/classes/forwardmodelling/fortranobject.c' to sources.
      adding 'build/src.macosx-10.7-x86_64-3.7/build/src.macosx-10.7-x86_64-3.7/geobipy/src/classes/forwardmodelling' to include_dirs.
      adding 'build/src.macosx-10.7-x86_64-3.7/geobipy/src/classes/forwardmodelling/fdemforward1d_fortran-f2pywrappers2.f90' to sources.
    building extension "geobipy.src.classes.forwardmodelling.mtforward1d_fortran" sources
    f2py options: []
    f2py:> build/src.macosx-10.7-x86_64-3.7/geobipy/src/classes/forwardmodelling/mtforward1d_fortranmodule.c
    IOError: [Errno 2] No such file or directory: 'geobipy/src/classes/forwardmodelling/mtforward1D_fortran/m_mtforward1D.f90'. Skipping file "geobipy/src/classes/forwardmodelling/mtforward1D_fortran/m_mtforward1D.f90".
    error: f2py target file 'build/src.macosx-10.7-x86_64-3.7/geobipy/src/classes/forwardmodelling/mtforward1d_fortranmodule.c' not generated
    Reading fortran codes...
    Post-processing...
    Post-processing (stage 2)...
    Building modules...
   
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /Users/.../code/geobipy/

Thanks!

Fdem Forward produces NaNs on scientific linux

The hyperbolic tangent in Fortran is not defined in the same way on different systems. On my Mac, high positive values produce 1+0j, while on sci linux I got Nan+0j. Same version of gfortran.

Easier way to plot subplots of inversion results

I'm trying to plot some single-site results from geobipy. I can create the 'full' site plot using:

R = LR.getResults(LR.iDs[point])
R.plot(forcePlot=True)

Is there an easy way to plot just the component pieces of this figure (say just the histogram plot and the layer-depth historgram?

Running geobipy from Python

Hi
Is there an example of howto run geobipy from within python, without the need to run it from the command line?

  • Thomas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.