Saturday, July 4, 2015

Simple Cosine Wave UI: illustrating frequency and phase

A new simple user interface has been added to github: SimpleCosineWaveUI! It's not terribly advanced, but it does illustrate two fundamental concepts in exploration geophysics: frequency and phase. The UI graphs a plot of: $$ f(t) = cos(2\pi ft+\phi ) $$ The two sliders at the bottom of the page allow the user to change the frequency and the phase of the signal and interactively view how those changes affect the plot. A "RESET" button is added that sets the phase and frequency of the signal back to zero. Finally, if you would like to see the waves with the area under of the curve filled in, click the check box "add fill". It does make the plot visually more interesting and allows the user to see more in my opinion.

A few of the details for those not interested in scanning through the code:

The minimum time and maximum time of the plot is set to zero and one second, respectively. The interval between samples is 0.001 seconds or one millisecond. Many of you will immediately jump to the fact that that means the sampling frequency (or sampling rate) is 1000 Hz (Fs = 1/dt), and thus the Nyquist frequency is 500 Hz. Although, technically you could reconstruct any frequency (NOT THE SIGNAL ITSELF NECESSARILY, a discussion tabled for another UI) up to Nyquist frequency, I have limited the frequency range from 0 to 100 Hz.

There are 2 interesting things that will notice after playing with the UI:(1) a cosine wave with zero frequency is a linear function with zero slope. In other words a constant: $ f(t) = C $. (2) an increase in phase (moving the phase slider to the right) causes the function to appear to move to the left. The function has undergone a negative translation or time delay. Both of these phenomena will be discussed in a later post and accompanying UI or IPython notebook. For now, it is important to recognize them.

Below are some screenshots. I hope you enjoy this tool and maybe even learn something.

Wednesday, June 17, 2015

Daily Dose of Exploration Geophysics: Gardners Expression as a Linear Regression

Gardner's Coefficients Revealed!


I have a added a new IPython notebook to my github account that shows how you can find the coefficients in Gardner's expression for the basin you happen to be working in. follow the link to myIPythonNotebooks - Gardner's Expression Regressed. For some reason, github is not showing the mathjax equations well, but if you download the notebook and open it locally, you should have no problem viewing them. I'll write them here just in case to give you a sample of what can be found in the notebook:


********************************************************************************************************************* One option is to linearize the equation and do a regression for the 2 parameters. This ipython notebook will show you how. Start with the general equation: $$\rho = \alpha * V_{P}^\beta$$ Take the natural log of both sides: $$ln(\rho) = ln(\alpha * V_{P}^\beta)$$ Use the properties of logarithms to make a linear equation: $$ln\rho = ln\alpha + ln(V_{P}^\beta)$$ $$ln\rho = ln\alpha + \beta*lnV_{P}$$ Rewrite: $$D = A + BV$$ where A is the intercept, B is the slope, V is the independent variable, and D is the dependent variable. *********************************************************************************************************************


Finally, below is a screen shot of the final regression:


GREAT LINK to SUBSURF WIKI: Gardner's equation

Tuesday, June 2, 2015

The best method I have found for setting up my python environment

I am running Scientific Linux 6 which comes with python version 2.6.6.  However, I really like using version 2.7.9 mainly because of all the compatible third party libraries associated with it.  Also, I prefer to use PyCharm - my favorite python IDE.

I have found that anaconda by Continuum Analytics to be the best python package manager and, after surfing the web, it seems I am not alone.  Using 'conda' to add additional packages is simple and for those new to python programming and third party modules or libraries, conda is well documented.  Also, conda installs to its own directory, so it does not interfere with your package python interpreter.


Once you have conda installed, install PyCharm.  PyCharm does not include a python interpreter (which is why you need conda or you can use the system default).  When you create a new project, tell PyCharm you want to use the anaconda interpreter (~/anaconda/bin/python).


That's it.  Post any questions to the comment portion and I will do my best to answer them if I can.

Monday, June 1, 2015

First Github Contribution: SimpleLasCurveViewer

Simple las Curve Viewer

Check out my first contribution to the open source community. It won't revolutionize the industry, but I think its a good start. It's a little program called 'Simple las Curve Viewer' and it's exactly that. The GUI is written with PyQt4 developed by Riverbank and it uses the plotting library pyqtgraph.

I've built and tested it using the L-30.las file from the Penobscot survey. You can find it at the SEG Github page under tutorials/1406_Make_a_synthetic.

The code can be found at github.

Thank you Warren Weckesser for allowing others to use your las python script and Luke Campagnola for developing pyqtgraph.

Below are some screenshots of the application.

First when the application opens:

After importing the las: (Notice that the curve list is populated with all the names of the curves in the las file)

A gamma ray log:

A resistivity log:

Saturday, April 18, 2015

I'm Back!!!

After a long time of not blogging, I'm back.  The blog title has changed from 'MathCompGeoPhys' to just 'CompGeoPhys', but the content will be the same.

Here's what you can expect to see in the future:

  • Solved problems in advanced calculus and differential equations
  • cool python (and C) code for exploring and visualizing the world of computational geophysics
  • and other cool things related to my favorite subjects: mathematics and computational geophysics!

Thanks for reading.  Stay tuned...