Wednesday, February 21, 2018

Oil Crash of 2015 - ? ... Update

Now into the fourth year. Is it still a crash or the 'new normal'? One thing for sure, the geoscience job market has recovered even less than rigs or commodity prices. A generational downdraft.

Tuesday, February 6, 2018

Fourier Transform Talk and Python Code

————— 6 Feb 2018 —————

Lecture notes from the Fourier Transform brown bag talk:

————— 5 Feb 2018 —————

Well, it was probably a blur, but we got through a few good ideas. Got this from Max, who organizes the brown-bag lecture series. The video he links is, indeed, excellent. Thanks, Max!

Dr. Liner,
     Thanks again for doing Brown Bag! Sorry it cut short, I had forgotten there was a a lab in their at 1:30 and didn't inform you.
     Also, if you have time you should check out this introduction to Fourier Transforms: . It has a great intuitive visualization, and may be useful for sending to students who are learning FTs!

————— 1 Feb 2018 —————

I'll be giving an improv brown-bag lecture next Monday on campus, here is the flyer.  Should be fun!

Cartoon credit

Fig 1. FFT of 50 Hz sine wave sampled at 1 millisecond (0.001 sec). Lower plot is the Fourier Transform amplitude spectrum.
Fig 2. FFT of 50 Hz square wave showing harmonics. The harmonics arise because the Fourier Transform decomposes the signal into sine and cosine waves that are not a natural fit for square waves. To represent the square wave no singe frequency will suffice, it takes a doubly periodic family of sin-cos waves: each sin-cos is periodic in itself and the harmonics are periodic multiples. In the case shown, the nth harmonic (fn) is related to the fundamental (f0) by the rule: fn = f0*(2n+1) where n=0,1,2,...  Consequently, it is better practice to describe such signals as, say, 50 cycles per second (cps) and reserve the term Hertz (Hz) for smooth signals. In passing, I note that harmonics can also arise from smooth signals if there is amplitude asymetry present, indicating nonlinear processes are at work. For discussion of this case, see Chapter 2 of my DISC book available from SEG or Amazon.

Python FFT code, most of it is for pretty plotting.

import numpy as np
import matplotlib.pyplot as plt
import scipy.fftpack
from scipy import signal

# Number of sample points
nt = 1000
# sample spacing (seconds)
dt = 0.001
# make the time vector
t = np.linspace(0.0, nt*dt, nt)
# calculate sine function at each time point
y1 = np.sin(50.0 * 2.0*np.pi*t)
# do the FFT
yf = scipy.fftpack.fft(y1)
# make the frequency vector from zero to Nyquist
xf = np.linspace(0.0, 1.0/(2.0*dt), nt/2)

# plot the sine wave and its Fourier amplitude spectrum
plt.plot(xf, 2.0/nt * np.abs(yf[0:nt/2]))
plt.title('Fourier Transform of 50 Hz Sine Wave')
plt.xlabel('Frequency (Hz)')
plt.ylabel('Fourier Amplitude')

# calculate the square wave function at each time point
y2 = signal.square(2 * np.pi * 50 * t)
yf = scipy.fftpack.fft(y2)

# plot the square wave and its Fourier amplitude spectrum
plt.plot(xf, 2.0/nt * np.abs(yf[0:nt/2]))
plt.title('Fourier Transform of 50 Hz Square Wave')
plt.xlabel('Frequency (Hz)')
plt.ylabel('Fourier Amplitude')

Fig 3. The code above can be used to visualize the concept of aliasing. The Nyqvist frequency, Fn=1/(2*dt), is the highest frequency that can be reliably measured for a given time sample rate.  In this example the time sample rate is 0.001 sec, yielding a Nyqvist of Fn=1/(2*dt)=500 Hz. However, the input signal (upper) is a 700 Hz sine wave, a full 200 Hz above Nyqvist. The Fourier amplitude spectrum (lower) shows that the 700 Hz signal frequency is wrapped, or reflected across, the Nyqvist frequency to appear as aliased energy at 300 Hz. 

Sunday, January 7, 2018

DISC Rose and Thorn

Encore repost from TUESDAY, JANUARY 8, 2013

After posting this encore, I got a request from John Stockwell to tell the 'counterfeit $ scam' story listed under Worst Incident, so here goes. It was my last day in Buenos Aires and I learned there was a street market near the hotel. I walked the market, being mindful of security and pickpocket threat which is always a possibility. Typically, I will go slowly to one side of the market then the other, pausing to glance for anyone watching, then occasionally do a full stop against a wall to scan the whole scene. These are things you pick up living and working in hazard areas around the world.

At the end of the market there were several taxis and I chose one (did not go with anyone who chose me) and we headed back to the hotel. The cab pulls up 2 blocks from my hotel and points to the meter demanding the payment in local currency, of which I had none. My plan to was to pay via the concierge at the hotel and add it to my bill. It turned into quite a fuss with me saying 'go to the hotel' and him saying 'pay here' and neither understanding much of the other's english. Finally, I pull out my wallet and show him I only have a US $100 bill, which he quickly grabs. Before I could react (10-15 seconds max) he hands it back and kicks me out of the cab, I walk to the hotel and fly back stateside that night.

Back home, our yard guy shows up needing to be paid for several visits, about $100, so I pay him cash. He is back at the house in an hour saying, 'The $100 was counterfeit, the bank took it, and the FBI may be looking for you. Oh, and you still owe me $100.' Processing this shocking news, and paying him, I thought back to the cab incident in Argentina. The cabbie must have done a quick switch of my $100 bill, pro quality stuff. When I told this whole story to my daughter Sam, she said: 'It was worth $100 just for the story.'  I tend to agree.

----- original post -----

When my son David was in the Boy Scouts, the troop would often go camping or on a high adventure hiking trip.  We had the tradition of taking a few minutes after each long day to reflect on events.  Each boy was asked to name the day's rose (best thing) and thorn (bad thing).  With so many boys in tight quarters tempers were sure to flare.  These events were often the thorns and the reflection time gave the adult leaders a chance to talk it out with the group and then follow up with all the good things that happened.

In that vein, I humbly offer this list of roses and thorns from my year as DISC instructor for 2012.

Most amazing place:       Sugar loaf mountain (Rio)
Favorite place:           Narita, Japan
Most amazing building:    Galleria (Milan)
Most amazing event:       Earthquake (Milan)
Most traffic:             Moscow 
Least traffic:            Midland
Worst passport line:      5 hours (Saudi Arabia)
Best view:                Atop Sugarloaf (Rio)
Best food in general:     New Orleans
Best meal:                Dora(Buenos Aires)
Best vege food:           Le Grenier(Paris
Cleanest city:            Narita, Brisbane
Most crowded:             London
Best castle:              Dunnotar(Aberdeen)
Least crowded:            Stavanger 
Most graffiti:            Paris 
Most expensive hotel:     Moscow 
Most expensive taxi ride: Milan
Most expensive beer:      Stavanger 
Biggest airport:          Beijing
Smallest airport:         Midland
Best airport:             Brisbane
Largest class:            110 (Calgary)
Smallest class:           5 (Copenhagen)
Hottest:                  97F/36C (Midland)
Coldest:                  38F/3C (Stavanger in June)
                          31F/-1C (Istanbul in Dec)

Best pub:         Little Creatures Brew Pub (Perth)
                  Warwick Arms (London)
Best coincidence:         
                  Antiquarian book fair (London)
Worst incident: 
                  Slide problems at DISC 1 (Brisbane)
                  Counterfeit $ scam (Buenos Aires)
                  Missed flight (Villahermosa)