#!/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 !!!
#import pygolem_lite
from numpy import *
#from pygolem_lite.config import *
from pygolem_lite.modules import *
from pygolem_lite import Shot
#from matplotlib.pyplot import *
import time
from shutil import copy, move
import os, sys
def graphs(file_type):
try:
name = "NI Turbo 6356"
# graph all
out = get_data('NIturbo6356', 'ch', "" ,xlim=[0,40], integrated=True ) # ylim=[None, 11],
paralel_multiplot(out, name + ' Integrated' , 'graph2_int', (6,len(out)*2), 100, 'vertical', file_type)
out = get_data('NIturbo6356', 'ch', "" ,xlim=[0,40], integrated=False, reduction=False ) # ylim=[None, 11],
paralel_multiplot(out, name , 'graph2', (6,len(out)*2), 100, 'vertical', file_type)
os.system('convert -resize 150x120\! graph2.png icon.png')
except:
print "NIturbo6356 failed"
#raise
try:
name = "NI Turbo 6251"
# graph all
out = get_data('NIturbo6251', 'ch', "" ,xlim=[0,40], integrated=False, reduction=False ) # ylim=[None, 11],
multiplot(out, name , 'graph0', (10,3), 100, 'vertical', file_type)
os.system('convert -resize 150x120\! graph0.png icon.png')
except:
print "NIturbo6251 failed"
#raise
try:
name = "NI Turbo 6358"
## integrated
out = get_data('NIturbo', 'ch', "", xlim=[0,40], integrated=True )
paralel_multiplot(out, name + ' Integrated' , 'graph1_int', (6,len(out)*2), 100, 'vertical', file_type)
# graph all
out = get_data('NIturbo', 'ch', "" , xlim=[0,40],integrated=False, reduction=False )
multiplot(out, name , 'graph1', (6,len(out)*2), 100, 'vertical', file_type)
os.system('convert -resize 150x120\! graph1.png icon.png')
except:
print "NIturbo6358 failed"
print "done"
def acquisition():
for name in ['Nidatap_6356', 'Nidatap_6358', 'Nidatap_6251']: #, "Nidatap_6356"]:
try:
load_adv(name) # automatically cache the data to NPZ file
except Exception, e:
print "Error ", str(e)
def main():
if sys.argv[1] == "plots":
graphs('png')
saveconst('status', 0)
#graphs('svg')
if sys.argv[1] == "acquisition":
acquisition()
if __name__ == "__main__":
main()