Skip to content

Instantly share code, notes, and snippets.

@gadamc
Created February 17, 2012 12:13
Show Gist options
  • Save gadamc/1853014 to your computer and use it in GitHub Desktop.
Save gadamc/1853014 to your computer and use it in GitHub Desktop.
extract template with function
#!/usr/bin/env python
import couchdbkit
s = couchdbkit.Server('https://edwdbik.fzk.de:6984')
db = s['pulsetemplates']
vr = db.view('analytical/bychandate', startkey=['chalA FID807', '2012-02-17 13:09:14'], limit=1, reduce=False, descending=True, include_docs=True)
doc = vr.first()['doc']
exec(doc['formula']['python']) #defines template function
templatePulse = []
for i in range(512):
templatePulse.append( template(2.016*i, doc['formula']['par']))
print templatePulse
print ''
print 'the template is printed out above... now I am trying to graphically plot it with matplotlib. be patient with slow networks...'
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
plt.plot(np.array(templatePulse))
raw_input('hit enter to quit')
@gadamc
Copy link
Author

gadamc commented Feb 17, 2012

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