uwoseis / zephyr

Open-source seismic waveform modelling and inversion code written in Python
https://zephyr.space
MIT License
18 stars 8 forks source link

Change definition of time parameters #27

Open bsmithyman opened 8 years ago

bsmithyman commented 8 years ago

Transcribing the time issue into GH for tracking purposes.

Hi @bsmithyman

Your code has a test for the number of samples in the source wavelet: ns == 2 * nom

This is 1. incorrect and also 2. too restrictive.

  1. The error is you assume time = ns * dt, when it should be (ns-1)*dt.
  2. The restriction is as follows:

We want df to equal the inverse of the total time window, ie df = 1 / (ns - 1)*dt.

Given that, then

(ns - 1) = 1 / dt*df

To get this in terms of nom, note that nom = fmax / df

(ns -1) = nom / dt*fmax

(If we happen to choose fmax = fny = 1/ 2*dt then (ns -1) = nom*2*dt/dt = nom * 2 as in your test).

This is too restrictive - we often use forward modelling where fmax != fny.

Bottom line Can you change the test to: ns == 1 + nom / dt*fmax ?

For example, @ShaunHadden and I are building a model with dt = .15625 ms, nt = 161, total time (ns -1)*dt = 25 ms, df = 1 / 0.025 = 40 Hz.

With fmax=1600, nom=1600/40=40

So nom != 2 * ns and your test fails, but my test gives 1 + nom / dt*fmax = 1 + 40 / .0015625*1600 = 161 which is correct.

Thanks, @gerhardpratt