#!/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.utilities import read_config
#from matplotlib.pyplot import *
import time
from shutil import copy
import os, sys
from scipy.interpolate import interp1d
config = read_config('das.cfg')
file_name = config['io_config']['file']
name = config['io_config']['name']
def getdata():
""" Time resolution of each channels can be different """
for i in range(32):
try:
tvec, data = load_adv(file_name+"_%02i" % i )
if 'tvec_0' in locals():
data = interp1d(tvec, squeeze( data), copy=False, bounds_error=False, fill_value=0)(tvec_0) # interplate to the same time resolution !!!
data_0 = vstack([data_0.T, data]).T
else:
data_0 = data
tvec_0 = tvec
except IOError:
pass
if 'tvec_0' in locals():
save_adv('Papouch_All', tvec_0, data_0)
else:
print "Missing data "+name
def graphs(file_type):
if os.path.exists('Papouch_All.npz'):
# integrated
out = get_data(file_name, "", "",xlim=[0,40] ,integrated=True )
multiplot(out, name + ' Integrated' , 'graph_int', (6,len(out)*2), 100, 'vertical', file_type)
os.system("convert -resize 150x120\! graph_int.png icon.png")
# graph all
out = get_data(file_name, "" , "",xlim=[0,40] ,integrated=False, reduction = False)
multiplot(out, name , 'graph', (6,len(out)*2), 100, 'vertical', file_type)
os.system("convert -resize 150x120\! graph.png icon.png")
else:
print "Missing data "+name
def main():
if sys.argv[1] == "acquisition":
getdata()
if sys.argv[1] == "plots":
graphs('png')
saveconst('status', 0)
if __name__ == "__main__":
main()