6 |
|
from optparse import OptionParser |
7 |
|
from OSUT3Analysis.Configuration.configurationOptions import * |
8 |
|
from OSUT3Analysis.Configuration.processingUtilities import * |
9 |
+ |
from OSUT3Analysis.Configuration.formattingUtilities import * |
10 |
|
|
11 |
|
parser = OptionParser() |
12 |
|
|
65 |
|
endLine = " \\\\ " |
66 |
|
newLine = " \n" |
67 |
|
|
68 |
< |
#function to make the replacements in the dataset names requested by the user |
68 |
< |
def formatString(inputString): |
69 |
< |
filler = "*" |
70 |
< |
if not arguments.replacements: |
71 |
< |
return inputString |
72 |
< |
for replacement in arguments.replacements: |
73 |
< |
inputString = inputString.replace(replacement,filler) |
74 |
< |
filler = filler + "*" |
75 |
< |
|
76 |
< |
return inputString |
77 |
< |
|
78 |
< |
#function to put spaces between every 3 digits in a number |
79 |
< |
def formatNumber(inputNumber): |
80 |
< |
inputList = list(inputNumber) |
81 |
< |
decimalIndex = inputNumber.find(".") |
82 |
< |
if decimalIndex is not -1:# found decimal point |
83 |
< |
numDigitsAboveOne = decimalIndex |
84 |
< |
numDigitsBelowOne = len(inputList) - numDigitsAboveOne - 1 |
85 |
< |
else: # didn't find a decimal point |
86 |
< |
numDigitsAboveOne = len(inputList) |
87 |
< |
numDigitsBelowOne = 0 |
88 |
< |
|
89 |
< |
outputString = "$" |
90 |
< |
|
91 |
< |
for index in range(numDigitsAboveOne): #print digits > 1 |
92 |
< |
outputString = outputString + inputList[index] |
93 |
< |
if (numDigitsAboveOne - index - 1) % 3 is 0 and (numDigitsAboveOne - index - 1) is not 0: |
94 |
< |
outputString = outputString + "\;" |
95 |
< |
if decimalIndex is not -1: #print "." if needed |
96 |
< |
outputString = outputString + "." |
97 |
< |
for index in range(numDigitsBelowOne):#print digits < 1 |
98 |
< |
outputString = outputString + inputList[index+numDigitsAboveOne+1] |
99 |
< |
if (index+1) % 3 is 0 and (numDigitsBelowOne - index -1) is not 0: |
100 |
< |
outputString = outputString + "\;" |
101 |
< |
|
102 |
< |
outputString = outputString + "$" |
103 |
< |
|
104 |
< |
return outputString |
105 |
< |
|
106 |
< |
#function to round to a certain number of significant digits |
107 |
< |
def round_sigfigs(num, sig_figs): |
108 |
< |
if num != 0: |
109 |
< |
return round(num, -int(math.floor(math.log10(abs(num))) - (sig_figs - 1))) |
110 |
< |
else: |
111 |
< |
return 0 # Can't take the log of 0 |
68 |
> |
|
69 |
|
|
70 |
|
#### check which bgMC input datasets have valid output files |
71 |
|
processed_datasets = [] |