source: Idarraga/sims_plots/readfileLPNHE.py

Last change on this file was 242, checked in by idarraga, 13 years ago
File size: 1.0 KB
Line 
1def readfileLPNHE(filename, tab, indx):
2   
3    print("opening (LPNHE file) --> %s"%filename)
4    fs = open(filename,'r')
5
6        # to return
7    x = [ ]
8    y = [ ]
9    histoTitle = []
10   
11    x.append( [] )
12    y.append( [] )
13    plotCntr = 0
14   
15    startReading=False
16    for line in fs:
17       
18        if startReading:  # avoid first line
19            figures = line.split('\t')
20            #print figures
21            # And take x and the desired tab
22           
23            # fix for ',' to '.'
24            for itr in range(0, len(figures)):
25                figures[itr] = figures[itr].replace(',','.')
26           
27            if len(figures) > 2:
28                x[0].append( float(figures[0]) )
29                y[0].append( float(figures[tab]) )
30        else :
31            print("   [%d] loading lpnhe"%(plotCntr + indx))
32           
33        startReading=True
34   
35    fs.close()
36   
37    plotCntr += 1
38    histoTitle.append("lpnhe")
39   
40    return [ x, y, histoTitle, plotCntr ] # for now only one plot per file
Note: See TracBrowser for help on using the repository browser.