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
|
Rev | Line | |
---|
[438] | 1 | #!/usr/bin/python |
---|
| 2 | |
---|
[471] | 3 | import os |
---|
| 4 | import sys |
---|
[438] | 5 | |
---|
[466] | 6 | def 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 | |
---|
| 21 | def 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] | 32 | def 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 | |
---|
| 42 | if __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.