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

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

Move to more oo design.

Add display of logbook values.

File size: 1.1 KB
RevLine 
[438]1#!/usr/bin/python
2
[471]3import os
4import sys
[438]5
[466]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()
[471]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:
[466]28        return 0
[471]29    else: # x>y
30        return 1     
[466]31
[471]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())
[441]37   
[471]38    bt5list = [ x for x in dirlist if (x.find('.bt5') > 0 and isBT5Data(x))]
[441]39   
[471]40    return bt5list
[438]41
42if __name__ == '__main__':
[441]43    import sys
44    data,metadata = getBT5DataFromFile(sys.argv[1])
45    printBT5DetData(data)
[438]46
[441]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.