Skip to content

Instantly share code, notes, and snippets.

@ljmartin
Created January 20, 2025 04:59
Show Gist options
  • Save ljmartin/765a59c4b1a9e9421672f34d8aa9b2a1 to your computer and use it in GitHub Desktop.
Save ljmartin/765a59c4b1a9e9421672f34d8aa9b2a1 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ljmartin
Copy link
Author

If you know the t_q, you can use this simple Km calculator, which seems to work OK even for quite noisy readouts:

ests = []
signal = golicnik+np.random.normal(0, 0.0001, size=(len(golicnik),))
dp_ = np.gradient(signal)

for d in np.arange(1, 100):
    i = d2p.argmax()-d
    j = d2p.argmax()+d
    dyi = dp_[i]
    dyj = dp_[j]
    si = signal[i]
    sj = signal[j]
    

    km_est = ((dyj-dyi)* si*sj) / ((dyi*sj) - (dyj*si))
    if km_est<0:
        continue
    print(km_est)
    ests.append(km_est)


plt.hist(ests,bins=55)
plt.axvline(np.sqrt(np.power(ests, 2).mean()))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment