Changeset 754 in ETALON for CLIO/control/plot_compare.py


Ignore:
Timestamp:
Jan 19, 2018, 6:51:35 PM (6 years ago)
Author:
delerue
Message:

Graphical interface updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLIO/control/plot_compare.py

    r748 r754  
    1919global FILE_COMPARE
    2020global data_directory_base
     21
     22
     23print "Use plot several files instead"
     24exit -1
    2125
    2226
     
    6165plt.figure(1)
    6266
     67filenames=[]
     68
     69with open(FILE_COMPARE) as cfid:
     70    fname=cfid.readline().rstrip()
     71    if (len(fname)==0):
     72        fname=cfid.readline().rstrip()
     73    fnameprev=''
     74    while(len(fname)>0):
     75        if (fname!=fnameprev):
     76            print fname
     77            filenames.append(fname)
     78            fnameprev=fname
     79        fname=cfid.readline().rstrip()
     80cfid.close()
     81
     82print "Plotting"
     83
    6384dataref=load_reference_signal()
    6485alldata=dataref
    6586
    66 with open(FILE_COMPARE) as cfid:
    67     fname=cfid.readline().rstrip()
    68     while(len(fname)>0):
    69         print fname
    70         filedata=np.loadtxt(fname, comments='#', delimiter='\t', usecols=range(0,3))
    71         alldata=np.hstack((alldata,np.zeros((np.shape(alldata)[0],1),dtype=alldata.dtype)))
    72         colref=np.shape(alldata)[1]-1
    73         for angle in alldata[:,0]:
    74             idx=list(alldata[:,0]).index(angle)
    75             idxref=np.where(filedata == angle)
     87for fname in filenames:
     88    print fname
     89    filedata=np.loadtxt(fname, comments='#', delimiter='\t', usecols=range(0,3))
     90    alldata=np.hstack((alldata,np.zeros((np.shape(alldata)[0],1),dtype=alldata.dtype)))
     91    colref=np.shape(alldata)[1]-1
     92    for angle in alldata[:,0]:
     93        idx=list(alldata[:,0]).index(angle)
     94        idxref=np.where(filedata == angle)
     95        if (len(idxref[0])==1):
    7696            alldata[idx,colref]=filedata[idxref[0],1]
    7797           
    78         plt.figure(1)
    79         plt.plot(alldata[:,0], alldata[:,colref],label=os.path.basename(fname).replace("data_CLIO_","").replace(".sig",""))
    80         plt.figure(2)
    81         plt.plot(alldata[:,0], alldata[:,colref]-alldata[:,1],label=os.path.basename(fname).replace("data_CLIO_","").replace(".sig",""))
    82         fname=cfid.readline().rstrip()
     98    plt.figure(1)
     99    plt.plot(alldata[:,0], alldata[:,colref],label=(os.path.basename(fname).replace("data_CLIO_","").replace(".sig",""))[-8:])
     100#        plt.plot(alldata[:,0], alldata[:,colref],label=(os.path.basename(fname).replace("data_CLIO_","").replace(".sig","")))
     101    plt.figure(2)
     102    plt.plot(alldata[:,0], alldata[:,colref]-alldata[:,1],label=os.path.basename(fname).replace("data_CLIO_","").replace(".sig","")[-8:])
    83103
    84104#    ckey_values={}
     
    91111#        fid.close()                       
    92112
    93 cfid.close()
    94113
    95114
    96115plt.figure(1)
    97 plt.title('Comparison')
     116plt.title('Comparison of the selected data')
    98117plt.ylabel('Signal amplitude [a.u.]')
    99118plt.xlabel('Detector angle [deg.]')
     
    105124
    106125plt.figure(2)
    107 plt.title('Comparison (ref substracted)')
     126plt.title('Comparison (reference substracted)')
    108127plt.ylabel('Signal amplitude above reference [a.u.]')
    109128plt.xlabel('Detector angle [deg.]')
Note: See TracChangeset for help on using the changeset viewer.