source: ETALON/CLIO/control/plot_file_average.py @ 691

Last change on this file since 691 was 691, checked in by delerue, 7 years ago

CLIO control updated

File size: 1.2 KB
Line 
1# -*- coding: utf-8 -*-
2"""
3Created on Sun Mar  5 18:51:17 2017
4
5Calculates the mean of several data set
6
7@author: delerue
8"""
9
10import glob
11import os
12import numpy as np
13
14global data_directory
15
16from clio_constants import *
17
18filemask="data_CLIO*.zoom_txt"
19list_of_files = glob.glob(data_directory+filemask)
20
21print repr(list_of_files)
22
23#prepare the figures   
24fig=plt.figure(9,figsize=(12, 8))
25
26nfiles=0
27for filename in list_of_files:
28    print filename
29    filedata=np.loadtxt(filename)
30    if (nfiles==0):
31        nchannels=np.size(filedata,0)
32        ndatapoints=np.size(filedata,1)
33        alldata=np.zeros((nchannels,ndatapoints))
34    else:
35        if (nchannels!=np.size(filedata,0)):
36            print "Incorrect number of channels in file!"
37        if (ndatapoints!=np.size(filedata,1)):
38            print "Incorrect number of data points in file!"
39    plt.figure(9)
40    plt.plot(range(1,ndatapoints),filedata[1,range(1,ndatapoints)])
41    print repr(alldata)
42    alldata=alldata+filedata
43    nfiles+=1
44   
45    print "nfiles "+str(nfiles)
46   
47 #prepare the figures   
48fig=plt.figure(1,figsize=(12, 8))
49plt.figure(1)
50plt.plot(range(1,ndatapoints),alldata[1,range(1,ndatapoints)])
51   
Note: See TracBrowser for help on using the repository browser.