source: sans/utils/bt5/bt5plot/usans.py @ 922

Last change on this file since 922 was 725, checked in by ajj, 13 years ago

Work to add auto grouping to bt5plot

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    bt5list.sort(key=lambda s: os.path.getmtime(s))
41   
42    return bt5list
43
44if __name__ == '__main__':
45    import sys
46    data,metadata = getBT5DataFromFile(sys.argv[1])
47    printBT5DetData(data)
48
49    maxinfo = maxDetCount(data, 2)
50    print maxinfo
51    avals = getAlignVals(data, maxinfo['Position'])
52    print avals
Note: See TracBrowser for help on using the repository browser.