source: sans/utils/bt5/bt5plot2/usans.py @ 655

Last change on this file since 655 was 471, checked in by ajj, 14 years ago

Move to more oo design.

Add display of logbook values.

File size: 1.1 KB
Line 
1#!/usr/bin/python
2
3import os
4import sys
5
6def isBT5Data(fileName):
7
8    inputfile = open(fileName, "r")
9    inputdata = inputfile.readlines()
10   
11    if len(inputdata) < 2:
12        inputfile.close()
13        return 0
14    elif inputdata[1].find('Filename') > 0:
15        inputfile.close()
16        return 1
17    else:
18        inputfile.close()
19        return 0   
20 
21def numeric_compare(x, y):
22    x = float(x)
23    y = float(y)   
24
25    if x < y:
26        return - 1
27    elif x == y:
28        return 0
29    else: # x>y
30        return 1     
31
32def GetBT5DirList():
33    """Function to parse the directory listing of the current working directory
34         and create a list of filenames that are BT5 data files"""
35         
36    dirlist = os.listdir(os.getcwd())
37   
38    bt5list = [ x for x in dirlist if (x.find('.bt5') > 0 and isBT5Data(x))]
39   
40    return bt5list
41
42if __name__ == '__main__':
43    import sys
44    data,metadata = getBT5DataFromFile(sys.argv[1])
45    printBT5DetData(data)
46
47    maxinfo = maxDetCount(data, 2)
48    print maxinfo
49    avals = getAlignVals(data, maxinfo['Position'])
50    print avals
Note: See TracBrowser for help on using the repository browser.