Skip to content

Commit

Permalink
Add countlog()
Browse files Browse the repository at this point in the history
  • Loading branch information
rndsrc committed Jan 22, 2024
1 parent f489948 commit 3c78d50
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/movie/sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ plt.plot(orders-1, lengths)
plt.plot(orders-1, 0.7*(orders-1)**2)
```

In fact, if we care about the sampling in log-frequency, the gaps do not really matter.

```{code-cell} ipython3
def countlog(t):
last = round(np.log2(t[-1]))
tau = 2**np.arange(last+1)
n_tau = np.zeros(last+1)
for ti in t:
for tj in t:
if tj > ti:
tauk = tj - ti
n_tau[round(np.log2(tauk))] += 1
return tau, n_tau
tau, n_tau = countlog(t)
plt.step(tau, n_tau, where='mid')
```

0 comments on commit 3c78d50

Please sign in to comment.