Source code :: main

[Return]
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/python2
# -*- coding: utf-8 -*-

import matplotlib
matplotlib.rcParams['backend'] = 'Agg'
matplotlib.rc('font',  size='10')
matplotlib.rc('text', usetex=True)  # FIXME !! nicer but slower !!!  


from numpy import *
from pygolem_lite.modules import *
import time
import os, sys


card_setup = [ #[filename, dt]
  ['Nidatap.lvm', 5e-6], # 200 kHz 
  ['Nidatap_6143.lvm', 4e-6], # 250 kHz
  ]


def prepare_data():
  for filename, dt in card_setup:
      try:
	data = loadtxt(filename)
	tvec = arange(len(data)) * dt
	save_adv(filename.rstrip(".lvm"), tvec, data)
	print "prepared data"
      except Exception, e:
	print "Failed saving: " + str(e) 
  

def plot_data(file_type):

    for name in ['NIbasic', 'NIbasic_6143']:
	#name = "NI Basic"
	# graph all
	#try:
	out = get_data(name, 'ch', "" ,xlim=[0,40],integrated=False , debug=True)
	multiplot(out, name , 'graph_'+name, (6,len(out)*2),  100,  'vertical', file_type)

	os.system('convert -resize 150x120\! graph_'+name+'.png icon.png')

	## integrated 
	out = get_data(name, 'ch', "",xlim=[0,40] , integrated=True , debug=True)
	multiplot(out, name+ " Integrated" , 'graph_'+name + '_int', (6,len(out)*2),  100,  'vertical', file_type)
	#except Exception, e:
	    #print "plotting failed", e

def main():
    if sys.argv[1] ==  "acquisition":
	prepare_data()
    if sys.argv[1] ==  "plots":
	plot_data('png')
	#plot_data('svg')
	saveconst('status', 0)
    


if __name__ == "__main__":
    main()
    
    

Navigation