Changeset 748 in ETALON


Ignore:
Timestamp:
Nov 29, 2017, 8:27:37 AM (6 years ago)
Author:
delerue
Message:

CLIO graphical interface and analysis updated

Location:
CLIO/control
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • CLIO/control/CLIO_graphical_interface.py

    r744 r748  
    2222global FILE_STOP
    2323global FILE_PAUSE
     24global FILE_REF
     25global FILE_COMPARE
    2426global data_directory
    2527global code_directory
     
    98100        self.latestFileWithSignal.pack(side=TOP)
    99101
     102        self.frameDataRefs = Frame(self.frameStatus)
     103        self.frameDataRefs.pack(side=BOTTOM)
     104        self.buttonSetRef = Button(self.frameDataRefs, text="Ref", command=self.onButtonRef)
     105        self.buttonSetRef.pack(side=LEFT)
     106        self.buttonSetCompare = Button(self.frameDataRefs, text="Compare", command=self.onButtonCompare)
     107        self.buttonSetCompare.pack(side=LEFT)
     108        self.buttonSetClearCompare = Button(self.frameDataRefs, text="Clr comp.", command=self.onButtonClearCompare)
     109        self.buttonSetClearCompare.pack(side=LEFT)
     110       
    100111        #data acquisition
    101112        self.frameAcquisition = Frame(self.frameAllControls, borderwidth=10, relief=SUNKEN)
     
    202213                bgcolortxt='red'
    203214                fgcolortxt='black'
    204             self.latestFileAcquired.config(text=os.path.basename(latest_file_acquired),bg=bgcolortxt,fg=fgcolortxt)
     215            self.latestFileAcquired.config(text=os.path.basename(latest_file_acquired.replace("data_CLIO_","").replace(".sig","")),bg=bgcolortxt,fg=fgcolortxt)
    205216
    206217        list_of_files_processed = glob.glob(data_directory+"data_CLIO*.png")
     
    219230                bgcolortxt='red'
    220231                fgcolortxt='black'
    221             self.latestFileProcessed.config(text=os.path.basename(latest_file_processed),bg=bgcolortxt,fg=fgcolortxt)
     232            self.latestFileProcessed.config(text=os.path.basename(latest_file_processed.replace("data_CLIO_","").replace(".sig","")),bg=bgcolortxt,fg=fgcolortxt)
    222233            imageNames[0]=latest_file_processed;
    223234
     
    227238        if (len(list_of_files_with_signal)>0):
    228239            #latest_file_with_signal = max(list_of_files_with_signal, key=os.path.getctime)
    229             latest_file_with_signal = max(sorted(list_of_files_with_signal))
    230             filetime=os.path.getctime(latest_file_with_signal)
     240            self.latest_file_with_signal = max(sorted(list_of_files_with_signal))
     241            filetime=os.path.getctime(self.latest_file_with_signal)
    231242            if (time.time()-filetime)<threshold_recent:
    232243                bgcolortxt='green'
     
    238249                bgcolortxt='red'
    239250                fgcolortxt='black'
    240             self.latestFileWithSignal.config(text=os.path.basename(latest_file_with_signal),bg=bgcolortxt,fg=fgcolortxt)
    241 
    242             imageNames[0]=latest_file_with_signal.replace(".sig",".png")
    243             imageNames[1]=latest_file_with_signal.replace(".sig","_zoom.png")
    244             imageNames[2]=latest_file_with_signal.replace(".sig","_signal.png")
     251            self.latestFileWithSignal.config(text=os.path.basename(self.latest_file_with_signal.replace("data_CLIO_","").replace(".sig","")),bg=bgcolortxt,fg=fgcolortxt)
     252
     253            imageNames[0]=self.latest_file_with_signal.replace(".sig",".png")
     254            imageNames[1]=self.latest_file_with_signal.replace(".sig","_zoom.png")
     255            imageNames[2]=self.latest_file_with_signal.replace(".sig","_signal.png")
     256            imageNames[3]=self.latest_file_with_signal.replace(".sig","_amplitude.png")
     257            imageNames[4]="/var/www/html/CLIO/data_comparison.png"
     258            imageNames[5]="/var/www/html/CLIO/data_comparison_with_reference.png"
    245259            time.sleep(0.1)
    246260
     
    413427        self.labelPositionCurrent.config(bg='cyan');
    414428        self.labelPositionStep.config(bg='cyan');
    415    
     429       
    416430    #----------------
    417431    def onButtonBkd20k(self):
     
    467481        fid.write("stop")
    468482        fid.close()
     483
     484    def onButtonRef(self):
     485        print "Set Ref "+ self.latest_file_with_signal
     486        filename=FILE_REF
     487        fid=open(filename,'w')
     488        fid.write(self.latest_file_with_signal)
     489        fid.close()
     490       
     491    def onButtonCompare(self):
     492        print "Compare "+ self.latest_file_with_signal
     493        filename=FILE_COMPARE
     494        fid=open(filename,'a')
     495        fid.write(self.latest_file_with_signal)
     496        fid.write("\n")
     497        fid.close()
     498
     499    def onButtonClearCompare(self):
     500        print "Clear Compare "
     501        filename=FILE_COMPARE
     502        fid=open(filename,'w')
     503        fid.write("\n")
     504        fid.close()
     505
     506       
    469507       
    470508    #----------------
  • CLIO/control/backup_data.sh

    r745 r748  
    22
    33cd /var/www/html/CLIO/
    4 gzip -9 201*/*.txt
    5 rm 201*/*.done
     4gzip -9 201*/*.txt &
     5rm 201*/*.done &
    66
    7 rsync -rv --append --exclude datajuly/ --exclude processed/ --exclude 20170???/ --exclude new/  /var/www/html/CLIO/ delerue@lx3.lal.in2p3.fr:/sps/sera/delerue/smith-purcell/CLIO/
     7rsync -rv --append --exclude datajuly/ --exclude processed/ --exclude '20170???/'  --exclude '*/*.txt' --exclude new/  /var/www/html/CLIO/ delerue@lx3.lal.in2p3.fr:/sps/sera/delerue/smith-purcell/CLIO/
  • CLIO/control/clio_constants.py

    r744 r748  
    1313global FILE_STOP
    1414global FILE_PAUSE
     15global FILE_REF
     16global FILE_COMPARE
    1517global data_directory
    1618global data_dir
     
    4951    data_directory_base="/var/www/html/CLIO/"
    5052    FILE_ACQ_INFO=basedir+'acquisition_data/acquisition_info.txt'
     53    FILE_REF=basedir+'acquisition_data/reference.txt';
     54    FILE_COMPARE=basedir+'acquisition_data/compare.txt';
    5155#    data_dir="/home/etalon-admin/acquisition_data"   
    5256
     
    96100
    97101data_dir=data_directory
     102
     103def grating_pitch_mm(date):
     104    return 6
     105
  • CLIO/control/compare_spectrums_from_list.py

    r691 r748  
    99
    1010import glob
     11import math
    1112import os
    1213import numpy as np
     
    1718from clio_constants import *
    1819
     20#Definitions
     21nchannels=32
     22
     23   
    1924filemask="data_CLIO*.sig"
    2025list_of_files = []
     26list_of_names = []
    2127
    22 ilist=3
     28ilist=1
     29
    2330
    2431if (ilist==1):
    25     #list at position 3M
    26     comment='Comparison at 3M steps'
    27     list_of_files.append('data_CLIO_2017-04-13_15-40-58.sig')
    28     list_of_files.append('data_CLIO_2017-04-13_15-41-00.sig')
    29     list_of_files.append('data_CLIO_2017-04-13_15-41-02.sig')
    30     list_of_files.append('data_CLIO_2017-04-13_15-51-58.sig')
    31     list_of_files.append('data_CLIO_2017-04-13_15-51-59.sig')
    32     list_of_files.append('data_CLIO_2017-04-13_17-05-43.sig')
    33     list_of_files.append('data_CLIO_2017-04-13_17-05-47.sig')
    34     list_of_files.append('data_CLIO_2017-04-13_17-24-04.sig')
    35     list_of_files.append('data_CLIO_2017-04-13_17-24-06.sig')
    36     list_of_files.append('data_CLIO_2017-04-13_17-49-43.sig')
    37     list_of_files.append('data_CLIO_2017-04-13_17-49-46.sig')
    38     list_of_files.append('data_CLIO_2017-04-13_17-49-48.sig')
    39     list_of_files.append('data_CLIO_2017-04-13_18-18-32.sig')
    40     list_of_files.append('data_CLIO_2017-04-13_18-18-33.sig')
    41     list_of_files.append('data_CLIO_2017-04-13_18-18-35.sig')
    42     list_of_files.append('data_CLIO_2017-04-13_18-41-19.sig')
    43     list_of_files.append('data_CLIO_2017-04-13_18-41-20.sig')
    44     list_of_files.append('data_CLIO_2017-04-13_18-41-24.sig')
    45     list_of_files.append('data_CLIO_2017-04-13_19-03-49.sig')
    46     list_of_files.append('data_CLIO_2017-04-13_19-03-57.sig')
    47     list_of_files.append('data_CLIO_2017-04-13_19-04-03.sig')
    48     list_of_files.append('data_CLIO_2017-04-13_19-27-25.sig')
    49     list_of_files.append('data_CLIO_2017-04-13_19-27-31.sig')
    50     list_of_files.append('data_CLIO_2017-04-13_19-27-39.sig')
    51     list_of_files.append('data_CLIO_2017-04-13_19-48-55.sig')
    52     list_of_files.append('data_CLIO_2017-04-13_19-57-48.sig')
     32    data_directory=data_directory+'../20171031/'
     33    comment='Change of current'
     34    list_of_files.append('data_CLIO_2017-10-31_15-18-49.sig')
     35    list_of_names.append('940mV')
     36    list_of_files.append('data_CLIO_2017-10-31_15-19-37.sig')
     37    list_of_names.append('940mV')
     38    list_of_files.append('data_CLIO_2017-10-31_15-22-58.sig')
     39    list_of_names.append('910mV')
     40    list_of_files.append('data_CLIO_2017-10-31_15-23-28.sig')
     41    list_of_names.append('910mV')
     42    list_of_files.append('data_CLIO_2017-10-31_15-26-10.sig')
     43    list_of_names.append('750mV')
     44    list_of_files.append('data_CLIO_2017-10-31_15-27-17.sig')
     45    list_of_names.append('750mV')
     46    list_of_files.append('data_CLIO_2017-10-31_15-29-38.sig')
     47    list_of_names.append('992mV (fin)')
     48    list_of_files.append('data_CLIO_2017-10-31_15-30-06.sig')
     49    list_of_names.append('992mV (fin)')
    5350elif (ilist==2):
    5451    comment='Comparison at 5M steps'
    5552    list_of_files.append('data_CLIO_2017-04-13_17-20-05.sig')
    5653    list_of_files.append('data_CLIO_2017-04-13_17-20-07.sig')
    57     list_of_files.append('data_CLIO_2017-04-13_17-20-08.sig')
    58     list_of_files.append('data_CLIO_2017-04-13_17-20-10.sig')
    59     list_of_files.append('data_CLIO_2017-04-13_17-20-12.sig')
    60     list_of_files.append('data_CLIO_2017-04-13_17-20-13.sig')
    61     list_of_files.append('data_CLIO_2017-04-13_17-20-15.sig')
    62     list_of_files.append('data_CLIO_2017-04-13_17-20-17.sig')
    63     list_of_files.append('data_CLIO_2017-04-13_17-20-20.sig')
    64     list_of_files.append('data_CLIO_2017-04-13_17-20-21.sig')
    65     list_of_files.append('data_CLIO_2017-04-13_17-45-37.sig')
    66     list_of_files.append('data_CLIO_2017-04-13_17-45-40.sig')
    67     list_of_files.append('data_CLIO_2017-04-13_17-45-43.sig')
    68     list_of_files.append('data_CLIO_2017-04-13_17-45-45.sig')
    69     list_of_files.append('data_CLIO_2017-04-13_17-45-47.sig')
    70     list_of_files.append('data_CLIO_2017-04-13_17-45-48.sig')
    71     list_of_files.append('data_CLIO_2017-04-13_17-45-50.sig')
    72     list_of_files.append('data_CLIO_2017-04-13_17-45-52.sig')
    73     list_of_files.append('data_CLIO_2017-04-13_17-45-53.sig')
    74     list_of_files.append('data_CLIO_2017-04-13_17-45-55.sig')
    75     list_of_files.append('data_CLIO_2017-04-13_18-14-12.sig')
    76     list_of_files.append('data_CLIO_2017-04-13_18-14-13.sig')
    77     list_of_files.append('data_CLIO_2017-04-13_18-14-15.sig')
    78     list_of_files.append('data_CLIO_2017-04-13_18-14-17.sig')
    79     list_of_files.append('data_CLIO_2017-04-13_18-14-20.sig')
    80     list_of_files.append('data_CLIO_2017-04-13_18-14-23.sig')
    81     list_of_files.append('data_CLIO_2017-04-13_18-14-25.sig')
    82     list_of_files.append('data_CLIO_2017-04-13_18-14-27.sig')
    83     list_of_files.append('data_CLIO_2017-04-13_18-14-30.sig')
    84     list_of_files.append('data_CLIO_2017-04-13_18-36-59.sig')
    85     list_of_files.append('data_CLIO_2017-04-13_18-37-01.sig')
    86     list_of_files.append('data_CLIO_2017-04-13_18-37-03.sig')
    87     list_of_files.append('data_CLIO_2017-04-13_18-37-08.sig')
    88     list_of_files.append('data_CLIO_2017-04-13_18-37-14.sig')
    89     list_of_files.append('data_CLIO_2017-04-13_18-59-02.sig')
    90     list_of_files.append('data_CLIO_2017-04-13_18-59-05.sig')
    91     list_of_files.append('data_CLIO_2017-04-13_18-59-06.sig')
    92     list_of_files.append('data_CLIO_2017-04-13_18-59-08.sig')
    93     list_of_files.append('data_CLIO_2017-04-13_18-59-10.sig')
    94     list_of_files.append('data_CLIO_2017-04-13_18-59-13.sig')
    95     list_of_files.append('data_CLIO_2017-04-13_18-59-15.sig')
    96     list_of_files.append('data_CLIO_2017-04-13_19-23-07.sig')
    97     list_of_files.append('data_CLIO_2017-04-13_19-23-08.sig')
    98     list_of_files.append('data_CLIO_2017-04-13_19-23-10.sig')
    99     list_of_files.append('data_CLIO_2017-04-13_19-23-11.sig')
    100     list_of_files.append('data_CLIO_2017-04-13_19-23-16.sig')
    101     list_of_files.append('data_CLIO_2017-04-13_19-23-18.sig')
    102     list_of_files.append('data_CLIO_2017-04-13_19-23-20.sig')
    103     list_of_files.append('data_CLIO_2017-04-13_19-44-33.sig')
    104     list_of_files.append('data_CLIO_2017-04-13_19-44-36.sig')
    105     list_of_files.append('data_CLIO_2017-04-13_19-44-44.sig')
    106     list_of_files.append('data_CLIO_2017-04-13_19-44-47.sig')
    107     list_of_files.append('data_CLIO_2017-04-13_20-12-36.sig')
    108     list_of_files.append('data_CLIO_2017-04-13_20-12-38.sig')
    109     list_of_files.append('data_CLIO_2017-04-13_20-12-41.sig')
    110     list_of_files.append('data_CLIO_2017-04-13_20-12-44.sig')
    111     list_of_files.append('data_CLIO_2017-04-13_20-12-47.sig')
    112 elif (ilist==3):
    113     comment='Comparison at 5.4M steps'
    114     list_of_files.append('data_CLIO_2017-04-13_17-22-31.sig')
    115     list_of_files.append('data_CLIO_2017-04-13_17-22-33.sig')
    116     list_of_files.append('data_CLIO_2017-04-13_17-22-35.sig')
    117     list_of_files.append('data_CLIO_2017-04-13_17-22-36.sig')
    118     list_of_files.append('data_CLIO_2017-04-13_17-22-39.sig')
    119     list_of_files.append('data_CLIO_2017-04-13_17-22-41.sig')
    120     list_of_files.append('data_CLIO_2017-04-13_17-22-43.sig')
    121     list_of_files.append('data_CLIO_2017-04-13_17-22-44.sig')
    122     list_of_files.append('data_CLIO_2017-04-13_17-22-46.sig')
    123     list_of_files.append('data_CLIO_2017-04-13_17-48-05.sig')
    124     list_of_files.append('data_CLIO_2017-04-13_17-48-07.sig')
    125     list_of_files.append('data_CLIO_2017-04-13_17-48-09.sig')
    126     list_of_files.append('data_CLIO_2017-04-13_17-48-10.sig')
    127     list_of_files.append('data_CLIO_2017-04-13_17-48-12.sig')
    128     list_of_files.append('data_CLIO_2017-04-13_17-48-15.sig')
    129     list_of_files.append('data_CLIO_2017-04-13_17-48-19.sig')
    130     list_of_files.append('data_CLIO_2017-04-13_18-16-37.sig')
    131     list_of_files.append('data_CLIO_2017-04-13_18-16-39.sig')
    132     list_of_files.append('data_CLIO_2017-04-13_18-16-41.sig')
    133     list_of_files.append('data_CLIO_2017-04-13_18-16-44.sig')
    134     list_of_files.append('data_CLIO_2017-04-13_18-16-45.sig')
    135     list_of_files.append('data_CLIO_2017-04-13_18-16-47.sig')
    136     list_of_files.append('data_CLIO_2017-04-13_18-16-49.sig')
    137     list_of_files.append('data_CLIO_2017-04-13_18-16-50.sig')
    138     list_of_files.append('data_CLIO_2017-04-13_18-16-52.sig')
    139     list_of_files.append('data_CLIO_2017-04-13_18-16-54.sig')
    140     list_of_files.append('data_CLIO_2017-04-13_18-16-55.sig')
    141     list_of_files.append('data_CLIO_2017-04-13_18-39-21.sig')
    142     list_of_files.append('data_CLIO_2017-04-13_18-39-29.sig')
    143     list_of_files.append('data_CLIO_2017-04-13_18-39-33.sig')
    144     list_of_files.append('data_CLIO_2017-04-13_18-39-37.sig')
    145     list_of_files.append('data_CLIO_2017-04-13_19-01-30.sig')
    146     list_of_files.append('data_CLIO_2017-04-13_19-01-32.sig')
    147     list_of_files.append('data_CLIO_2017-04-13_19-01-40.sig')
    148     list_of_files.append('data_CLIO_2017-04-13_19-25-40.sig')
    149     list_of_files.append('data_CLIO_2017-04-13_19-25-43.sig')
    150     list_of_files.append('data_CLIO_2017-04-13_19-25-47.sig')
    151     list_of_files.append('data_CLIO_2017-04-13_19-25-48.sig')
    152     list_of_files.append('data_CLIO_2017-04-13_19-47-12.sig')
    153     list_of_files.append('data_CLIO_2017-04-13_20-15-05.sig')
    154     list_of_files.append('data_CLIO_2017-04-13_20-15-08.sig')
    155     list_of_files.append('data_CLIO_2017-04-13_20-15-11.sig')
    15654
    15755
     
    16260for filename in list_of_files:
    16361    print os.path.basename(filename)
    164     filedata=np.loadtxt(data_directory+filename)
    165     filedata[:,1]=filedata[:,1]*-1
    166    
     62    #read parameters   
    16763    key_values={}
    168     with open(data_directory+filename.replace(".sig",".val"),'r') as fid:
     64    with open(data_directory+filename,'r') as fid:
    16965        fileline=fid.readline()
    170         while (len(fileline)>0):               
    171             entries=fileline.replace(' ','').replace('\n','').split('=')
     66        while (len(fileline)>0)and(fileline[0]=='#'):               
     67            entries=fileline.replace('#','').replace(' ','').replace('\n','').split('=')
    17268            key_values[entries[0]]=entries[1]
    17369            fileline=fid.readline()
    174         fid.close()
    175 
    176         if (nfiles==0):
    177             alldata=np.array([filedata[:,1]])
    178             current_values_list=[key_values['current_value']]
    179             motor_values_list=[key_values['motor_value']]
    180             angles=filedata[:,0]
    181             filenames=[filename]
     70    fid.close()
     71   
     72    filedata=np.loadtxt(data_directory+filename, dtype='float', comments='#', delimiter='\t')
     73    print filedata
     74    print repr(filedata)
     75             
     76    if (nfiles==0):
     77        alldata=np.array([filedata[:,1]])
     78        current_values_list=[key_values['current_value']]
     79        motor_values_list=[key_values['motor_value']]
     80        angles=filedata[:,0]
     81        filenames=[filename]
     82    else:
     83        if len(filedata)!=alldata.shape[1]:
     84            print "Incorrect data size in "+filename
     85            nfiles-=1
     86        elif not((angles==filedata[:,0]).all()):
     87            print "Incorrect angles in "+filename
     88            nfiles-=1               
    18289        else:
    183             if len(filedata)!=alldata.shape[1]:
    184                 print "Incorrect data size in "+filename
    185                 nfiles-=1
    186             elif not((angles==filedata[:,0]).all()):
    187                 print "Incorrect angles in "+filename
    188                 nfiles-=1               
    189             else:
    190                 alldata=np.append(alldata,[filedata[:,1]],axis=0)
    191                 current_values_list.append(key_values['current_value'])
    192                 motor_values_list.append(key_values['motor_value'])
    193                 filenames.append(filename)
    194         nfiles+=1
    195 
     90            alldata=np.append(alldata,[filedata[:,1]],axis=0)
     91            current_values_list.append(key_values['current_value'])
     92            motor_values_list.append(key_values['motor_value'])
     93            filenames.append(filename)
     94    nfiles+=1
     95       
    19696       
    19797#prepare the figures
    19898#we do not need the loops but we keep them for now
    199 fig=plt.figure(1,figsize=(12, 8))
     99fig=plt.figure(1,figsize=(8,6),dpi=100)
    200100plt.figure(1)
    201101ax=plt.subplot(111)
     102
     103fig.subplots_adjust(bottom=0.2)
     104
    202105plt.ylabel('Signal amplitude [V]')
    203106plt.xlabel('Angles [degrees]')
     
    207110#print len(alldata[range(0,nfiles),1])
    208111for idata in range(0,len(list_of_files)):
    209     plt.plot(angles,alldata[idata,:],'*-',label=(filenames[idata]).replace("data_CLIO_","").replace(".sig",""))
     112    if len(list_of_names)>0:
     113        labeltxt=list_of_names[idata]
     114    else:
     115        labeltxt=(filenames[idata]).replace("data_CLIO_","").replace("2017-10-31_15-","").replace(".sig","")
     116    plt.plot(angles,alldata[idata,:],'*-',label=labeltxt)
     117plt.title('Compare files --- '+comment)
     118
     119(angle_min,angle_max)=ax.get_xlim()
    210120
    211121box=ax.get_position()
    212122ax.set_position([box.x0,box.y0,box.width*0.8,box.height])       
     123ax2=ax.twiny()
     124ax2.set_position([box.x0,box.y0*0.5,box.width*0.8,box.height])       
    213125ax.legend(loc='center left',fancybox=True,shadow=True,bbox_to_anchor=(1,0.5))
    214 plt.title('Compare files --- '+comment)
     126
     127#creating second bottom axis
     128def tick_function(X,angle_min,angle_max):
     129    #X is an array
     130    V=[ float(grating_pitch_mm('20171031'))*(1-math.cos((angle_min+z*(angle_max-angle_min))*math.pi/180.)) for z in X]
     131    return ["%.1f" % z for z in V]
     132
     133new_tick_locations= np.array([0.,.25,.5,.75,1.])
     134
     135ax2.xaxis.set_ticks_position("bottom")
     136ax2.xaxis.set_label_position("bottom")
     137#ax2.spines["bottom"].set_position(("axes",-0.15)) 
     138
     139ax2.set_frame_on(True)
     140ax2.patch.set_visible(False)
     141
     142for sp in ax2.spines.itervalues():
     143    sp.set_visible(False)
     144ax2.spines["bottom"].set_visible(True)
     145
     146ax2.set_xticks(new_tick_locations)
     147ax2.set_xticklabels(tick_function(new_tick_locations,angle_min,angle_max))
     148ax2.set_xlabel(r"Wavelength [mm]")
     149
    215150imagename=data_directory+"compare_"+str(ilist)+".png"
    216151fig.savefig(imagename)
  • CLIO/control/popup_example.py

    r746 r748  
    4040class Application(ttk.Frame):
    4141
     42    def retrieve_input(self):
     43        print "hello"
     44        inputValue=self.button_value.get("1.0","end-1c")
     45        print inputValue
     46   
    4247    def __init__(self, master):
    4348        ttk.Frame.__init__(self, master)
     
    5964        self.button_lsshell.pack()
    6065
     66        self.button_rti = ttk.Button(self, text ="Ret.", command = self.retrieve_input)
     67        self.button_rti.pack()
     68
     69        self.button_value = tk.Text(self, height=1, width=5)
     70        self.button_value.pack()
     71
     72        self.button_ok = ttk.Button(self, text ="OK", command = lambda: self.retrieve_input())
     73        self.button_ok.pack()
     74
     75
    6176
    6277root = tk.Tk()
  • CLIO/control/read_plot_data.py

    r744 r748  
    1414from scipy.fftpack import fft, ifft
    1515from scipy import signal
     16from clio_constants import *
    1617
    1718def read_plot_data(filename):
     
    6869                idx_angles_sorted.append(data_mapping.index(angle))
    6970            idx_data_mapping[data_mapping.index(angle)]=int(len(angles_sorted))
     71           
    7072    #Check if the filename contains the path or not
    7173    if (len(os.path.dirname(filename))==0):
     
    159161        move(filename,target_filename)
    160162           
    161     #print Sig_mean, Sig_std
     163    print Sig_mean, Sig_std
    162164
    163165 
     
    205207    imagename_no_path=os.path.basename(imagename)
    206208
    207 
    208     fid=open(target_directory+'list.html','a');
    209     fid.write("<A HREF=")
    210     fid.write(imagename_no_path)
    211     fid.write("><IMG SRC=")
    212     fid.write(imagename_no_path)
    213     fid.write(" width=600>")
    214     fid.write("</A><BR/>")
    215     fid.write(imagename_no_path)
    216     fid.write("<BR/><BR/>\n")
    217     fid.close()
    218     copyfile(imagename,os.path.dirname(imagename)+'/last.png')
     209## We no longer create an HTML list
     210#    fid=open(target_directory+'list.html','a');
     211#    fid.write("<A HREF=")
     212#    fid.write(imagename_no_path)
     213#    fid.write("><IMG SRC=")
     214#    fid.write(imagename_no_path)
     215#    fid.write(" width=600>")
     216#    fid.write("</A><BR/>")
     217#    fid.write(imagename_no_path)
     218#    fid.write("<BR/><BR/>\n")
     219#    fid.close()
     220#    copyfile(imagename,os.path.dirname(imagename)+'/last.png')
    219221
    220222    if (electrons_found):
     
    227229        figzoom.savefig(imagenamezoom)
    228230        plt.close(figzoom)
    229         copyfile(imagenamezoom,os.path.dirname(imagename)+'/last_zoom.png')
     231#        copyfile(imagenamezoom,os.path.dirname(imagename)+'/last_zoom.png')
    230232   
    231233        imagenamezoom_no_path=os.path.basename(imagenamezoom)
    232         fid=open('zoom_list.html','a');
    233         fid.write("<A HREF=")
    234         fid.write(imagenamezoom_no_path)
    235         fid.write("><IMG SRC=")
    236         fid.write(imagenamezoom_no_path)
    237         fid.write(" width=600>")
    238         fid.write("</A><BR/>")
    239         fid.write(imagenamezoom_no_path)
    240         fid.write("<BR/><BR/>\n")
    241         fid.close()
    242        
     234
     235## We no longer create an HTML list
     236#        fid=open('zoom_list.html','a');
     237#        fid.write("<A HREF=")
     238#        fid.write(imagenamezoom_no_path)
     239#        fid.write("><IMG SRC=")
     240#        fid.write(imagenamezoom_no_path)
     241#        fid.write(" width=600>")
     242#        fid.write("</A><BR/>")
     243#        fid.write(imagenamezoom_no_path)
     244#        fid.write("<BR/><BR/>\n")
     245#        fid.close()
     246
     247
    243248        plt.figure(3)
    244         plt.plot(range(48,132,7), Sig_mean,'r^-')
     249        plt.plot(angles_sorted, Sig_mean,'r^-',label='Data')
     250        refdata=load_reference_signal()
     251        if (len(refdata)>0):
     252#            print refdata[:,0]
     253#            print refdata[:,1]
     254            plt.plot(refdata[:,0],refdata[:,1],'go:',label='Reference')           
    245255        plt.title(key_values['date']+ ' ---  Motor value:  '+key_values['motor_value']+ ' ---  Current:  '+key_values['current_value'])
    246256        plt.ylabel('Signal amplitude [a.u.]')
    247257        plt.xlabel('Detector angle [deg.]')
    248         plt.grid(True)       
     258        plt.grid(True)
     259        plt.legend()
    249260        imagenamesignal=target_filename.replace('.txt','_signal.png')
    250261        figsignal.savefig(imagenamesignal)
    251262        plt.close(figsignal)
    252         copyfile(imagenamesignal,os.path.dirname(imagename)+'/last_signal.png')
     263
     264        if (len(refdata)>0):
     265            figref=plt.figure(4,figsize=figure_size,dpi=figure_dpi)
     266            plt.figure(4)
     267            diffdata=np.zeros((len(angles_sorted),2))
     268            for angle in angles_sorted:
     269                idx=angles_sorted.index(angle)
     270                idxref=np.where(refdata == angle)
     271                diffdata[idx,0]=angle
     272                diffdata[idx,1]=Sig_mean[idx]-refdata[idxref[0],1]
     273            #print diffdata
     274            plt.plot(diffdata[:,0], diffdata[:,1],'r^-')
     275            plt.title('Diff --- ' +key_values['date']+ ' ---  Motor value:  '+key_values['motor_value']+ ' ---  Current:  '+key_values['current_value'])
     276            plt.ylabel('Signal amplitude above reference [a.u.]')
     277            plt.xlabel('Detector angle [deg.]')
     278            plt.grid(True)       
     279            imagenamesignal=target_filename.replace('.txt','_amplitude.png')
     280            figref.savefig(imagenamesignal)
     281            plt.close(figref)
     282
     283
     284       
     285#        copyfile(imagenamesignal,os.path.dirname(imagename)+'/last_signal.png')
    253286
    254287        imagenamesignal_no_path=os.path.basename(imagenamesignal)
    255         fid=open('signal_list.html','a');
    256         fid.write("<A HREF=")
    257         fid.write(imagenamesignal_no_path)
    258         fid.write("><IMG SRC=")
    259         fid.write(imagenamesignal_no_path)
    260         fid.write(" width=600>")
    261         fid.write("</A><BR/>")
    262         fid.write(imagenamesignal_no_path)
    263         fid.write("<BR/><BR/>\n")
    264         fid.close()
     288       
     289## We no longer create an HTML list
     290#        fid=open('signal_list.html','a');
     291#        fid.write("<A HREF=")
     292#        fid.write(imagenamesignal_no_path)
     293#        fid.write("><IMG SRC=")
     294#        fid.write(imagenamesignal_no_path)
     295#        fid.write(" width=600>")
     296#        fid.write("</A><BR/>")
     297#        fid.write(imagenamesignal_no_path)
     298#        fid.write("<BR/><BR/>\n")
     299#        fid.close()
    265300       
    266301    filenamesig=target_filename.replace('.txt','.sig')
     
    282317    return;
    283318
     319
     320def load_reference_signal():
     321    global FILE_REF
     322
     323    try:
     324        fid=open(FILE_REF)       
     325        refname=fid.readline().rstrip()
     326        fid.close()
     327    except:
     328        print "Unable to read reference file"
     329        refname=""
     330
     331    if (len(refname)>0):
     332        #read refrence parameters   
     333        ref_key_values={}
     334        with open(refname,'r') as fid:
     335            fileline=fid.readline()
     336            while (len(fileline)>0)and(fileline[0]=='#'):               
     337                entries=fileline.replace('#','').replace(' ','').replace('\n','').split('=')
     338                ref_key_values[entries[0]]=entries[1]
     339                fileline=fid.readline()
     340            fid.close()
     341       
     342            #for p in ref_key_values: print p,'=', ref_key_values[p]
     343           
     344        allrefdata=np.loadtxt(refname, comments='#', delimiter='\t', usecols=range(0,3))
     345#        print allrefdata
     346        return allrefdata
  • CLIO/control/run_all.sh

    r744 r748  
    2323
    2424if [ -eq `ps -edf | grep run_makefile_recent | grep -cv grep ` 0 ];
    25    echo "To start the files process type /home/etalon-admin/control/run_makefile_recent.sh "
     25   echo "To start the files processing type /home/etalon-admin/control/run_makefile_recent.sh "
    2626   exit -1
    2727fi
     
    3535
    3636   
     37echo "To backup the data type control/backup_data.sh "
  • CLIO/control/run_read_data.py

    r638 r748  
    11from read_plot_data import read_plot_data
    22import sys
    3 
     3import subprocess
     4import os
    45#print 'Number of arguments:', len(sys.argv), 'arguments.'
    56#print 'Argument List:', str(sys.argv)
    6 read_plot_data(sys.argv[1])
     7filename=sys.argv[1]
     8fname,fext=os.path.splitext(filename)
     9if (fext==".gz"):
     10    print "Gzipped file"
     11    gzipok=0
     12    try:
     13        response=subprocess.check_output("gzip -d "+filename,shell=True)
     14        gzipok=1
     15    except:
     16        print "gzip -d failed"
     17        gzipok=0
     18    if (gzipok==1):
     19        read_plot_data(fname)
     20        try:
     21            response=subprocess.check_output("gzip -9 "+fname,shell=True)
     22        except:
     23            print "gzip -9 failed"
     24if (fext==".txt"):
     25    read_plot_data(filename)
Note: See TracChangeset for help on using the changeset viewer.