added another backgroundMessage animation. generally cleaned code a slight bit.
This commit is contained in:
parent
28259b2c46
commit
01a5343ca2
|
@ -106,6 +106,7 @@ class backgroundMessage(threading.Thread):
|
||||||
|
|
||||||
choices = {'bounce': ['_', 'o', 'O', u'\u00B0',
|
choices = {'bounce': ['_', 'o', 'O', u'\u00B0',
|
||||||
u'\u203e',u'\u203e',u'\u00B0','O','o','_'],
|
u'\u203e',u'\u203e',u'\u00B0','O','o','_'],
|
||||||
|
'spin': [u'\u25dc',u'\u25dd',u'\u25de',u'\u25df'],
|
||||||
'circle': [u'\u25f4',u'\u25f5',u'\u25f6',u'\u25f7'],
|
'circle': [u'\u25f4',u'\u25f5',u'\u25f6',u'\u25f7'],
|
||||||
'hexagon': [u'\u2b22',u'\u2b23'],
|
'hexagon': [u'\u2b22',u'\u2b23'],
|
||||||
'square': [u'\u2596',u'\u2598',u'\u259d',u'\u2597'],
|
'square': [u'\u2596',u'\u2598',u'\u259d',u'\u2597'],
|
||||||
|
@ -229,7 +230,7 @@ def leastsqBound(func, x0, args=(), bounds=None, Dfun=None, full_output=0,
|
||||||
return shape(res), dt
|
return shape(res), dt
|
||||||
|
|
||||||
def _int2extGrad(p_int, bounds):
|
def _int2extGrad(p_int, bounds):
|
||||||
"""Calculate the gradients of transforming the internal (unconstrained) to external (constained) parameter."""
|
"""Calculate the gradients of transforming the internal (unconstrained) to external (constrained) parameter."""
|
||||||
grad = np.empty_like(p_int)
|
grad = np.empty_like(p_int)
|
||||||
for i, (x, bound) in enumerate(zip(p_int, bounds)):
|
for i, (x, bound) in enumerate(zip(p_int, bounds)):
|
||||||
lower, upper = bound
|
lower, upper = bound
|
||||||
|
@ -431,22 +432,20 @@ def curve_fit_bound(f, xdata, ydata, p0=None, sigma=None, bounds=None, **kw):
|
||||||
else:
|
else:
|
||||||
pcov = np.inf
|
pcov = np.inf
|
||||||
|
|
||||||
if return_full:
|
return popt, pcov, infodict, errmsg, ier if return_full else popt, pcov
|
||||||
return popt, pcov, infodict, errmsg, ier
|
|
||||||
else:
|
|
||||||
return popt, pcov
|
|
||||||
|
|
||||||
|
|
||||||
def execute(cmd,streamIn = None,wd = './'):
|
def execute(cmd,streamIn = None,wd = './'):
|
||||||
"""executes a command in given directory and returns stdout and stderr for optional stdin"""
|
"""executes a command in given directory and returns stdout and stderr for optional stdin"""
|
||||||
initialPath = os.getcwd()
|
initialPath = os.getcwd()
|
||||||
os.chdir(wd)
|
os.chdir(wd)
|
||||||
process = subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE,stderr = subprocess.PIPE,stdin=subprocess.PIPE)
|
process = subprocess.Popen(shlex.split(cmd),
|
||||||
if streamIn is not None:
|
stdout = subprocess.PIPE,
|
||||||
out,error = [i.replace("\x08","") for i in process.communicate(streamIn.read())]
|
stderr = subprocess.PIPE,
|
||||||
else:
|
stdin = subprocess.PIPE)
|
||||||
out,error =[i.replace("\x08","") for i in process.communicate()]
|
out,error = [i.replace("\x08","") for i in (process.communicate if streamIn is None
|
||||||
|
else process.communicate(streamIn.read()))]
|
||||||
os.chdir(initialPath)
|
os.chdir(initialPath)
|
||||||
if process.returncode !=0: raise RuntimeError(cmd+' failed with returncode '+str(process.returncode))
|
if process.returncode != 0: raise RuntimeError('{} failed with returncode {}'.format(cmd,process.returncode))
|
||||||
return out,error
|
return out,error
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue