Browse Source

Adding parse coefficients

Andrej 2 years ago
parent
commit
f9b24b19d8

File diff suppressed because it is too large
+ 0 - 0
lnnCoeficients20/cBase.txt


+ 26 - 0
pythonScripts/parseCoefficients.py

@@ -0,0 +1,26 @@
+import numpy
+import os
+import re 
+
+def parseCoefficients(fdir,outName):
+   outlines=[]
+   for s in numpy.arange(0.05,3,0.01):
+      out='{:.2f}'.format(s)
+      for c in ['alpha','beta']:
+         fname='{}_coefficients_n=20_sigma={:.2f}.txt'.format(c,s)
+         fpath=os.path.join(fdir,fname)
+         #print('{}: {}'.format(fname,os.path.isfile(fpath)))
+         with open(fpath,'r') as f:
+            lines=f.read().splitlines()
+         lines=[re.sub(r' *','',q) for q in lines]
+         lines=[re.sub(r'E','e',q) for q in lines]
+         qv=[float(q) for q in lines]
+         #use Decimal, if you want to preserve all decimals
+         #print('nread: {} {:.20f} {}'.format(len(qv),qv[0],lines[0]))
+         out+=' '
+         out+=' '.join(lines)
+         #print(' '.join(lines))
+      outlines.append(out)
+   print('nlines {}'.format(len(outlines)))
+   with open(os.path.join(fdir,outName),'w') as f:
+      f.write('\n'.join(outlines))

File diff suppressed because it is too large
+ 16 - 0
pythonScripts/parseCoeficients.ipynb


+ 1 - 1
pythonScripts/propagateErrorLN.py

@@ -50,7 +50,7 @@ def generateDistribution(fx,muTarget,mu,cv,dydp, dbg=0):
    mean=[numpy.mean(s) for s in samples]
    std=[numpy.std(s) for s in samples]
    convSample=numpy.zeros(len(samples[0]))
-   msg='[{}] mean={:.2f} std={:.2f} cv={:.2f}'.
+   msg='[{}] mean={:.2f} std={:.2f} cv={:.2f}'
    for i in range(len(cv)):
       convSample+=samples[i]
       if dbg:

Some files were not shown because too many files changed in this diff