rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if not make.pkgdata: return "<unknown>"
if not make.pkgdata: return bbfile
def completeFilePath( bbfile ): if not make.pkgdata: return "<unknown>" for key in make.pkgdata.keys(): if key.endswith( bbfile ): return key return "<unknown>"
return "<unknown>"
return bbfile
def completeFilePath( bbfile ): if not make.pkgdata: return "<unknown>" for key in make.pkgdata.keys(): if key.endswith( bbfile ): return key return "<unknown>"
self.initVar("_data") self.dict["_data"] = parent
self.dict = deepcopy(parent)
def linkDataSet(self,parent): if not parent == None: self.initVar("_data") self.dict["_data"] = parent
rungitcmd("git clone %s://%s%s %s" % (proto, host, path, repodir),d)
rungitcmd("git clone -n %s://%s%s %s" % (proto, host, path, repodir),d)
def go(self, d, urls = []): """Fetch urls""" if not urls: urls = self.urls
if taskData.abort:
if not taskData.abort:
def mark_active(listid, depth): """ Mark an item as active along with its depends (calls itself recursively) """
status, error, location = sendToPastebin( contents ) if status == 302: print "SHELL: Pasted to %s" % location else: print "ERROR: %s %s" % ( status, error )
sendToPastebin( "output of " + params[0], contents )
def pasteBin( self, params ): """Send a command + output buffer to http://oe.pastebin.com""" index = params[0] contents = self._shell.myout.buffer( int( index ) ) status, error, location = sendToPastebin( contents ) if status == 302: print "SHELL: Pasted to %s" % location else: print "ERROR: %s %s" % ( status, error )
status, error, location = sendToPastebin( open( filename ).read() ) if status == 302: print "SHELL: Pasted to %s" % location else: print "ERROR: %s %s" % ( status, error )
file = open( filename ).read() sendToPastebin( "contents of " + filename, file )
def pasteLog( self, params ): """Send the last event exception error log (if there is one) to http://oe.pastebin.com""" if last_exception is None: print "SHELL: No Errors yet (Phew)..." else: reason, event = last_exception.args print "SHELL: Reason for the last error: '%s'" % reason if ':' in reason: msg, filename = re...
def sendToPastebin( content ):
def sendToPastebin( desc, content ):
def sendToPastebin( content ): """Send content to http://oe.pastebin.com""" mydata = {} mydata["parent_pid"] = "" mydata["format"] = "bash" mydata["code2"] = content mydata["paste"] = "Send" mydata["poster"] = "%s@%s" % ( os.environ.get( "USER", "unknown" ), socket.gethostname() or "unknown" ) params = urllib.urlencode...
mydata["parent_pid"] = "" mydata["format"] = "bash" mydata["code2"] = content mydata["paste"] = "Send" mydata["poster"] = "%s@%s" % ( os.environ.get( "USER", "unknown" ), socket.gethostname() or "unknown" )
mydata["lang"] = "Plain Text" mydata["desc"] = desc mydata["cvt_tabs"] = "No" mydata["nick"] = "%s@%s" % ( os.environ.get( "USER", "unknown" ), socket.gethostname() or "unknown" ) mydata["text"] = content
def sendToPastebin( content ): """Send content to http://oe.pastebin.com""" mydata = {} mydata["parent_pid"] = "" mydata["format"] = "bash" mydata["code2"] = content mydata["paste"] = "Send" mydata["poster"] = "%s@%s" % ( os.environ.get( "USER", "unknown" ), socket.gethostname() or "unknown" ) params = urllib.urlencode...
conn = httplib.HTTPConnection( "oe.pastebin.com:80" ) conn.request("POST", "/", params, headers )
host = "rafb.net" conn = httplib.HTTPConnection( "%s:80" % host ) conn.request("POST", "/paste/paste.php", params, headers )
def sendToPastebin( content ): """Send content to http://oe.pastebin.com""" mydata = {} mydata["parent_pid"] = "" mydata["format"] = "bash" mydata["code2"] = content mydata["paste"] = "Send" mydata["poster"] = "%s@%s" % ( os.environ.get( "USER", "unknown" ), socket.gethostname() or "unknown" ) params = urllib.urlencode...
return response.status, response.reason, response.getheader( "location" ) or "unknown"
if response.status == 302: location = response.getheader( "location" ) or "unknown" print "SHELL: Pasted to http://%s%s" % ( host, location ) else: print "ERROR: %s %s" % ( response.status, response.reason )
def sendToPastebin( content ): """Send content to http://oe.pastebin.com""" mydata = {} mydata["parent_pid"] = "" mydata["format"] = "bash" mydata["code2"] = content mydata["paste"] = "Send" mydata["poster"] = "%s@%s" % ( os.environ.get( "USER", "unknown" ), socket.gethostname() or "unknown" ) params = urllib.urlencode...
self.myout.startCommand( command ) if '|' in command: command, pipecmd = command.split( '|' ) delegate = self.myout.delegate self.myout.delegate = None if ' ' in command: self.processCommand( command.split()[0], command.split()[1:] )
if command == 'python': sys.stdout = self.myout.delegate self.processCommand( command, "" ) sys.stdout = self.myout
def main( self ): """The main command loop""" while not leave_mainloop: try: sys.stdout = self.myout.delegate cmdline = raw_input( "BB>> " ) sys.stdout = self.myout if cmdline: allCommands = cmdline.split( ';' ) for command in allCommands: pipecmd = None # self.myout.startCommand( command ) if '|' in command: # disable...
self.processCommand( command, "" ) self.myout.endCommand() if pipecmd is not None: self.myout.delegate = delegate pipe = popen2.Popen4( pipecmd ) pipe.tochild.write( "\n".join( self.myout.lastBuffer() ) ) pipe.tochild.close() sys.stdout.write( pipe.fromchild.read() )
self.myout.startCommand( command ) if '|' in command: command, pipecmd = command.split( '|' ) delegate = self.myout.delegate self.myout.delegate = None if ' ' in command: self.processCommand( command.split()[0], command.split()[1:] ) else: self.processCommand( command, "" ) self.myout.endCommand() if pipecmd is not Non...
def main( self ): """The main command loop""" while not leave_mainloop: try: sys.stdout = self.myout.delegate cmdline = raw_input( "BB>> " ) sys.stdout = self.myout if cmdline: allCommands = cmdline.split( ';' ) for command in allCommands: pipecmd = None # self.myout.startCommand( command ) if '|' in command: # disable...
cooker.cook( bitbake.BBConfiguration( Opt() ), ["fix-mind"] )
try: cooker.cook( bitbake.BBConfiguration( Opt() ), ["fix-mind"] ) except SystemExit: print "exited"
def __init__(self): self.__dict__ = { 'abort' : False, 'interactive' : False, 'force' : False, 'cmd' : 'build', 'file' : [], 'verbose' : False, 'debug' : 0, 'dry_run' : False, 'parse_only' : False, 'disable_psyco' : False, 'show_versions' : False, 'show_environment' : False, 'buildfile' : None }
self.assertTrue(os.environ['BB_BASE_BBCLAS_RAN'])
self.assertEquals("true", os.environ['BB_BASE_BBCLAS_RAN'])
def __init__(self): self.__dict__ = { 'abort' : False, 'interactive' : False, 'force' : False, 'cmd' : 'build', 'file' : [], 'verbose' : False, 'debug' : 0, 'dry_run' : False, 'parse_only' : False, 'disable_psyco' : False, 'show_versions' : False, 'show_environment' : False, 'buildfile' : None }
def __init__(self, sampleGen):
def __init__(self, sampleGen, config):
def __init__(self, sampleGen): self.sampleGen = sampleGen sampleGen.onSongChanged.add(self.onSongChanged)
if not self.pcm: self.pcm = alsaaudio.PCM(type=alsaaudio.PCM_PLAYBACK)
if self.pcm: self.pcm.close() self.pcm = alsaaudio.PCM(type=alsaaudio.PCM_PLAYBACK)
def onSongChanged(self, *args, **kwargs): ansi.debug('onSongChanged')
ansi.stdout( "{cursor.col.0}{clear.line.all}Current time:" " {style.bold}{file.elapsedTime: >7.2f}{style.none} / {file.duration: <7.2f}", file=self.sampleGen, suppressNewline=True )
if self.debug: ansi.stdout( "{cursor.col.0}{clear.line.all}Current time:" " {style.bold}{file.elapsedTime: >7.2f}{style.none} / {file.duration: <7.2f}", file=self.sampleGen, suppressNewline=True )
def queueNextSound(self, event=None): ansi.stdout( "{cursor.col.0}{clear.line.all}Current time:" " {style.bold}{file.elapsedTime: >7.2f}{style.none} / {file.duration: <7.2f}", file=self.sampleGen, suppressNewline=True )
NBANNERS = 64 i = whrandom.randint(0, NBANNERS-1) s = "PyBanner%03d.gif" % i self.__d['banner'] = s self.__whichbanner = i
def __init__(self, file, rootdir, relthis): root, ext = os.path.splitext(file) html = root + '.html' p = self.__parser = HTParser(file, self.AUTHOR) f = self.__linkfixer = LinkFixer(html, rootdir, relthis) self.__body = None self.__cont = None # calculate the sidebar links, adding a few of our own self.__d = {'rootdir'...
<a href="%(rootdir)s/"> <img alt="" border="0" src="%(rootdir)s/pics/%(banner)s"></a></center>''' % \
<a href="http://www.student.virginia.edu/~improv/games/findthespam.html"> <img alt="" border="0" src="%(rootdir)s/pics/banner.png"></a></center>''' % \
def get_corner(self): # it is important not to have newlines between the img tag and the end # anchor and end center tags, otherwise layout gets messed up return '''
return [ ' ' ' ' ' ' ' ' ' ' ' ' ' ][self.__whichbanner]
return "
def get_corner_bgcolor(self): # this may not be 100% correct. it uses PIL to get the RGB values at # the corners of the image and then takes a vote as to the most likely # value. Some images may be `bizarre'. See .../pics/backgrounds.py return [ '#3399ff', '#6699cc', '#3399ff', '#0066cc', '#3399ff', '#0066cc', ...
p.sidebar.append(('%(rootdir)s', '''
p.sidebar.append(('http://sourceforge.net', '''
def __init__(self, file, rootdir, relthis): root, ext = os.path.splitext(file) html = root + '.html' p = self.__parser = HTParser(file, self.AUTHOR) f = self.__linkfixer = LinkFixer(html, rootdir, relthis) self.__body = None self.__cont = None # calculate the sidebar links, adding a few of our own self.__d = {'rootdir'...
''' % self.__d))
'''))
def __init__(self, file, rootdir, relthis): root, ext = os.path.splitext(file) html = root + '.html' p = self.__parser = HTParser(file, self.AUTHOR) f = self.__linkfixer = LinkFixer(html, rootdir, relthis) self.__body = None self.__cont = None # calculate the sidebar links, adding a few of our own self.__d = {'rootdir'...
print expr, self.Variable
def map_variable(self, expr): print expr, self.Variable if expr == self.Variable: return 1 else: return 0
if isinstance(other, Constant) and other.Value == 0:
if tests.is_zero(other):
def __add__(self, other): if not isinstance(other, Expression): other = Constant(other) if isinstance(other, Constant) and other.Value == 0: return self return Sum((self, other))
if not isinstance(other, Expression): other = Constant(other) if isinstance(other, Constant) and other.Value == 0: return self
assert not isinstance(other, Expression) if other == 0: return self else: other = Constant(other)
def __radd__(self, other): if not isinstance(other, Expression): other = Constant(other) if isinstance(other, Constant) and other.Value == 0: return self return Sum((other, self))
other = Constant(other) if isinstance(other, Constant) and other.Value == 0:
other = Constant(other) if tests.is_zero(other):
def __sub__(self, other): if not isinstance(other, Expression): other = Constant(other) if isinstance(other, Constant) and other.Value == 0: return self return Sum((self, -other))
if not isinstance(other, Expression): other = Constant(other) if isinstance(other, Constant) and other.Value == 0:
assert not isinstance(other, Expression) if other == 0:
def __rsub__(self, other): if not isinstance(other, Expression): other = Constant(other) if isinstance(other, Constant) and other.Value == 0: return Negation(self) return Sum((other, -self))
return Product((self, other)) def __rmul__(self, other): if not isinstance(other, Expression): other = Constant(other) if isinstance(other, Constant) and other.Value == 1: return self return Product((other, self)) def __div__(self, other): if not isinstance(other, Expression): other = Constant(other) if isinstance(ot...
def __mul__(self, other): if not isinstance(other, Expression): other = Constant(other) if isinstance(other, Constant) and other.Value == 1: return self return Product((self, other))
if not isinstance(other, Expression): other = Constant(other) return Quotient(other, self)
assert not isinstance(other, Expression) return Quotient(Constant(other), self)
def __rdiv__(self, other): if not isinstance(other, Expression): other = Constant(other) return Quotient(other, self)
if isinstance(other, Constant): if other.Value == 0: return Constant(1) elif other.Value == 1: return self
if tests.is_zero(other): return Constant(1) elif tests.is_one(other): return self
def __pow__(self, other): if not isinstance(other, Expression): other = Constant(other) if isinstance(other, Constant): if other.Value == 0: return Constant(1) elif other.Value == 1: return self return Power(self, other)
if not isinstance(other, Expression): other = Constant(other)
assert not isinstance(other, Expression) if tests.is_zero(other): return Constant(0) elif tests.is_one(other): return Constant(1)
def __rpow__(self, other): if not isinstance(other, Expression): other = Constant(other) return Power(other, self)
if self.Value == 0: return other return Sum((self, other))
if isinstance(other, Constant): return Constant(self.Value + other.Value) if self.Value == 0: return other return Expression.__add__(self, other)
def __add__(self, other): if not isinstance(other, Expression): return Constant(self.Value + other) if self.Value == 0: return other return Sum((self, other))
return Sum((other, self))
return Expression.__radd__(self, other)
def __radd__(self, other): if not isinstance(other, Expression): return Constant(other + self.Value) if self.Value == 0: return other return Sum((other, self))
return Sum((self, -other))
return Expression.__sub__(self, other)
def __sub__(self, other): if not isinstance(other, Expression): return Constant(self.Value - other) if self.Value == 0: return Negation(other) return Sum((self, -other))
return Sum((other, -self))
return Expression.__rsub__(self, other)
def __rsub__(self, other): if not isinstance(other, Expression): return Constant(other - self.Value) if self.Value == 0: return other return Sum((other, -self))
return Product((self, other))
if self.Value == 0: return self return Expression.__mul__(self, other)
def __mul__(self, other): if not isinstance(other, Expression): return Constant(self.Value * other) if self.Value == 1: return other return Product((self, other))
return Product((other, self))
if self.Value == 0: return self return Expression.__rmul__(self, other)
def __rmul__(self, other): if not isinstance(other, Expression): return Constant(other * self.Value) if self.Value == 1: return other return Product((other, self))
return Quotient(self, other) def __rdiv__(self, other): if not isinstance(other, Expression): return Constant(other / self.Value) return Quotient(other, self)
return Expression.__rdiv__(self, other)
def __div__(self, other): if not isinstance(other, Expression): return Constant(self.Value / other) if self.Value == 1: return other return Quotient(self, other)
if self.Value == 0: return self
if isinstance(other, Constant): return Constant(self.Value ** other.Value)
def __pow__(self, other): if not isinstance(other, Expression): return Constant(self.Value ** other) if self.Value == 0: return self if self.Value == 1: return self return Power(self, other)
return Power(self, other)
return Expression.__pow__(self, other)
def __pow__(self, other): if not isinstance(other, Expression): return Constant(self.Value ** other) if self.Value == 0: return self if self.Value == 1: return self return Power(self, other)
if self.Value == 0: return Constant(1) return Power(other, self)
return Expression.__rpow__(self, other)
def __rpow__(self, other): if not isinstance(other, Expression): return Constant(other ** self.Value) if self.Value == 1: return other if self.Value == 0: return Constant(1) return Power(other, self)
def __call__(self, pars):
def __call__(self, *pars):
def __call__(self, pars): for par in pars: if isinstance(par, Expression): return Expression.__call__(self, pars) return self.Value(*pars)
return Expression.__call__(self, pars)
return Expression.__call__(self, *pars)
def __call__(self, pars): for par in pars: if isinstance(par, Expression): return Expression.__call__(self, pars) return self.Value(*pars)
def __init__(self, base, children):
def __init__(self, base, coeff):
def __init__(self, base, children): self.Base = base self.Children = children
self.Children = children
self.Data = children def __neg__(self): return Polynomial(self.Base, [(exp, -coeff) for (exp, coeff) in self.Data]) def __add__(self, other): if not isinstance(other, Polynomial) or other.Base != self.Base: return Expression.__add__(self, other) iself = 0 iother = 0 result = [] while iself < len(self.Data) and io...
def __init__(self, base, children): self.Base = base self.Children = children
print "YAY", expr, self._isc(expr), self.Variable
def map_product(self, expr): print "YAY", expr, self._isc(expr), self.Variable return pymbolic.sum(*( pymbolic.product(*(expr.children[0:i] + (child.invoke_mapper(self),) + expr.children[i+1:])) for i, child in enumerate(expr.children) if not self._isc(child)))
print s
pass
def debug_out(s): print s
void SVGTextContentElement::setFont(svgl::Context * svglContext, svgl::GLInfo* glinfo, svgl::TextInfo*);
void setFont(svgl::Context * svglContext, svgl::GLInfo* glinfo, svgl::TextInfo*);
#undef ATTRDEF
def __init__(self, iterator, **keywords): self.iterator = iter(iterator) traits.HasTraits.__init__(**keywords)
def __init__(self, **keywords): traits.HasTraits.__init__(self, **keywords)
def __init__(self, iterator, **keywords): self.iterator = iter(iterator) traits.HasTraits.__init__(**keywords)
a1, b1 = prange(n, rank=0)
a1, b1 = _prange(n, rank=0)
def _pmin(n): """ Determine minimum number of iterations for any of the processors. """ a1, b1 = prange(n, rank=0) n1 = b1 - a1 a2, b2 = prange(n, rank=mpi.size-1) n2 = b2 - a2 return min(n1, n2)
a2, b2 = prange(n, rank=mpi.size-1)
a2, b2 = _prange(n, rank=mpi.size-1)
def _pmin(n): """ Determine minimum number of iterations for any of the processors. """ a1, b1 = prange(n, rank=0) n1 = b1 - a1 a2, b2 = prange(n, rank=mpi.size-1) n2 = b2 - a2 return min(n1, n2)
self.values = {'mean': {'mu': None 'sd': None 't': None 'resid': None
self.values = {'mean': {'mu': None, 'sd': None, 't': None, 'resid': None,
def __init__(self): raise NotImplementedError self.values = {'mean': {'mu': None 'sd': None 't': None 'resid': None 'df_resid': None, 'scale': None}, 'varatio': {'varatio': None 'varfix': None}}
'varatio': {'varatio': None
'varatio': {'varatio': None,
def __init__(self): raise NotImplementedError self.values = {'mean': {'mu': None 'sd': None 't': None 'resid': None 'df_resid': None, 'scale': None}, 'varatio': {'varatio': None 'varfix': None}}
def testOLS(self): X = W((40,10)) Y = W((40,)) model = OLSModel(design=X) results = model.fit(Y) self.assertEquals(results.df_resid, 30)
def test_init(self): t1 = formula.Term("trivial") sqr = lambda x: x*x
def testOLS(self): X = W((40,10)) Y = W((40,)) model = OLSModel(design=X) results = model.fit(Y) self.assertEquals(results.df_resid, 30)
def testAR(self): X = W((40,10)) Y = W((40,)) model = ARModel(design=X, rho=0.4) results = model.fit(Y) self.assertEquals(results.df_resid, 30)
t2 = formula.Term("not_so_trivial", sqr, "sqr")
def testAR(self): X = W((40,10)) Y = W((40,)) model = ARModel(design=X, rho=0.4) results = model.fit(Y) self.assertEquals(results.df_resid, 30)
def testOLSdegenerate(self): X = W((40,10)) X[:,0] = X[:,1] + X[:,2] Y = W((40,)) model = OLSModel(design=X) results = model.fit(Y) self.assertEquals(results.df_resid, 31)
self.assertRaises(ValueError, formula.Term, "name", termname=0)
def testOLSdegenerate(self): X = W((40,10)) X[:,0] = X[:,1] + X[:,2] Y = W((40,)) model = OLSModel(design=X) results = model.fit(Y) self.assertEquals(results.df_resid, 31)
def testARdegenerate(self): X = W((40,10)) X[:,0] = X[:,1] + X[:,2] Y = W((40,)) model = ARModel(design=X, rho=0.9) results = model.fit(Y) self.assertEquals(results.df_resid, 31)
def test_str(self): t = formula.Term("name") s = str(t)
def testARdegenerate(self): X = W((40,10)) X[:,0] = X[:,1] + X[:,2] Y = W((40,)) model = ARModel(design=X, rho=0.9) results = model.fit(Y) self.assertEquals(results.df_resid, 31)
def suite(): suite = unittest.makeSuite(RegressionTest) return suite
def test_add(self): t1 = formula.Term("t1") t2 = formula.Term("t2") f = t1 + t2 self.assert_(isinstance(f, formula.Formula)) self.assert_(f.hasterm(t1)) self.assert_(f.hasterm(t2))
def suite(): suite = unittest.makeSuite(RegressionTest) return suite
P = scipy.stats.norm.sf
P = stats.norm.sf
def __call__(self, x, search=None): """ Get expected EC for a search region (default is self.search which itself defaults to [1] giving the survival function. """
P = lambda x: scipy.stats.t.sf(x, self.dfd)
P = lambda x: stats.t.sf(x, self.dfd)
def __call__(self, x, search=None): """ Get expected EC for a search region (default is self.search which itself defaults to [1] giving the survival function. """
Kuriki, S. & Takemura, A. (2001). ' Tail probabilities of the maxima of multilinear forms and their applications.' Ann. Statist. 29(2): 328­371.
Kuri, S. & Takemura, A. (2001). 'Tail probabilities of the maxima of multilinear forms and their applications.' Ann, Statist. 29(2): 328-371.
def __call__(self, x, search=None): return ECcone.__call__(self, N.sqrt(x * self.dfn), search=search)
sf += binomial(self.dfn, i) * scipy.stats.chi.sf(x, i) / N.power(2., self.dfn)
sf += binomial(self.dfn, i) * stats.chi.sf(x, i) / N.power(2., self.dfn)
def _getmu(self): x = N.linspace(0, 2 * self.dfn, 100) sf = 0. g = Gaussian() for i in range(1, self.dfn+1): sf += binomial(self.dfn, i) * scipy.stats.chi.sf(x, i) / N.power(2., self.dfn)
>>> a(3) == 3**2+1
>>> a(3) == 3*3**2 + 4*3 + 5
def Q(dim, dfd=N.inf): """ If dfd == inf (the default), then Q(dim) is the (dim-1)-st Hermite polynomial H_j(x) = (-1)^j * e^{x^2/2} * (d^j/dx^j e^{-x^2/2}) If dfd != inf, then it is the polynomial Q defined in Worsley, K.J. (1994). 'Local maxima and the expected Euler characteristic of excursion sets of \chi^2, F ...
>>>
def Q(dim, dfd=N.inf): """ If dfd == inf (the default), then Q(dim) is the (dim-1)-st Hermite polynomial H_j(x) = (-1)^j * e^{x^2/2} * (d^j/dx^j e^{-x^2/2}) If dfd != inf, then it is the polynomial Q defined in Worsley, K.J. (1994). 'Local maxima and the expected Euler characteristic of excursion sets of \chi^2, F ...
raise ValueError, 'quasi polynomials are not compatible, m disagrees'
return False
def compatible(self, other): """ Check whether the degrees of freedom of two instances are equal so that they can be multiplied together.
>>> a(3) == 3**2+1
>>> a(3) == 3*3**2 + 4*3 + 5
def __call__(self, val): """ Evaluate the ECquasi instance.
>>> b-c
>>> print b-c
def __sub__(self, other): """ Subtract other from self.
"""
>>> """ return self + (other * -1)
def __sub__(self, other): """ Subtract other from self.
where m is a non-negative float (possibly infinity, in which the
where m is a non-negative float (possibly infinity, in which case the
def Q(dim, dfd=N.inf): """ If dfd == inf (the default), then Q(dim) is the (dim-1)-st Hermite polynomial H_j(x) = (-1)^j * e^{x^2/2} * (d^j/dx^j e^{-x^2/2}) If dfd != inf, then it is the polynomial Q defined in Worsley, K.J. (1994). 'Local maxima and the expected Euler characteristic of excursion sets of \chi^2, F ...
out = N.zeros((D+1,), N.float64)
out = N.zeros((D+2,), N.float64)
def scale_space(region, interval, kappa=1.): """ Work out intrinsic volumes of region x interval in the scale space model. See Siegmund, D.O and Worsley, K.J. (1995). 'Testing for a signal with unknown location and scale in a stationary Gaussian random field.' Annals of Statistics, 23:608-639. and Taylor, J.E. & Wo...
for i in range(1, D+1): out[i] = (1./w1 + 1./w2) * region.mu[i] * 0.5
for i in range(1, D+2): if i < D+1: out[i] = (1./w1 + 1./w2) * region.mu[i] * 0.5
def scale_space(region, interval, kappa=1.): """ Work out intrinsic volumes of region x interval in the scale space model. See Siegmund, D.O and Worsley, K.J. (1995). 'Testing for a signal with unknown location and scale in a stationary Gaussian random field.' Annals of Statistics, 23:608-639. and Taylor, J.E. & Wo...
f = N.log(w2/w1) / (w1*w2)
f = N.log(w2/w1)
def scale_space(region, interval, kappa=1.): """ Work out intrinsic volumes of region x interval in the scale space model. See Siegmund, D.O and Worsley, K.J. (1995). 'Testing for a signal with unknown location and scale in a stationary Gaussian random field.' Annals of Statistics, 23:608-639. and Taylor, J.E. & Wo...
tmp = []
def fit(self, **keywords): """ Go through an iterator, instantiating model and passing data, going through outputs. """
model = S.regression.OLSModel(design=X)
model = OLSModel(design=X)
def testOLS(self): X = W((40,10)) Y = W((40,)) model = S.regression.OLSModel(design=X) results = model.fit(Y) self.assertEquals(results.df_resid(), 30)
self.assertEquals(results.df_resid(), 30)
self.assertEquals(results.df_resid, 30)
def testOLS(self): X = W((40,10)) Y = W((40,)) model = S.regression.OLSModel(design=X) results = model.fit(Y) self.assertEquals(results.df_resid(), 30)
model = S.regression.ARModel(design=X, rho=0.4)
model = ARModel(design=X, rho=0.4)
def testAR(self): X = W((40,10)) Y = W((40,)) model = S.regression.ARModel(design=X, rho=0.4) results = model.fit(Y) self.assertEquals(results.df_resid(), 30)
self.assertEquals(results.df_resid(), 30)
self.assertEquals(results.df_resid, 30)
def testAR(self): X = W((40,10)) Y = W((40,)) model = S.regression.ARModel(design=X, rho=0.4) results = model.fit(Y) self.assertEquals(results.df_resid(), 30)
model = S.regression.OLSModel(design=X)
model = OLSModel(design=X)
def testOLSdegenerate(self): X = W((40,10)) X[:,0] = X[:,1] + X[:,2] Y = W((40,)) model = S.regression.OLSModel(design=X) results = model.fit(Y) self.assertEquals(results.df_resid(), 31)
self.assertEquals(results.df_resid(), 31)
self.assertEquals(results.df_resid, 31)
def testOLSdegenerate(self): X = W((40,10)) X[:,0] = X[:,1] + X[:,2] Y = W((40,)) model = S.regression.OLSModel(design=X) results = model.fit(Y) self.assertEquals(results.df_resid(), 31)
model = S.regression.ARModel(design=X, rho=0.9)
model = ARModel(design=X, rho=0.9)
def testARdegenerate(self): X = W((40,10)) X[:,0] = X[:,1] + X[:,2] Y = W((40,)) model = S.regression.ARModel(design=X, rho=0.9) results = model.fit(Y) self.assertEquals(results.df_resid(), 31)
self.assertEquals(results.df_resid(), 31)
self.assertEquals(results.df_resid, 31)
def testARdegenerate(self): X = W((40,10)) X[:,0] = X[:,1] + X[:,2] Y = W((40,)) model = S.regression.ARModel(design=X, rho=0.9) results = model.fit(Y) self.assertEquals(results.df_resid(), 31)
value['mean'['resid'] = (Y - N.multiply.outer(N.ones(Y.shape[0], N.float64), mu)) * N.sqrt(W)
value['mean']['resid'] = (Y - N.multiply.outer(N.ones(Y.shape[0], N.float64), mu)) * N.sqrt(W)
def estimate_mean(self, Y, W):
raise NotImplementedError
def __init__(self): raise NotImplementedError self.values = {'mean': {'mu': None, 'sd': None, 't': None, 'resid': None, 'df_resid': None, 'scale': None}, 'varatio': {'varatio': None, 'varfix': None}}
scale = N.add.reduce(N.power(value.resid, 2), 0) / value.df_resid
scale = N.add.reduce(N.power(value['mean']['resid'], 2), 0) / value['mean']['df_resid']
def estimate_mean(self, Y, W):
value['mean']['t'] = N.squeeze(value.mu * recipr(value.sd))
value['mean']['t'] = N.squeeze(value['mean']['mu'] * recipr(value['mean']['sd']))
def estimate_mean(self, Y, W):
results = OneSample.fit(self, data, W, **keywords)
os = OneSample() results = os.fit(data, W, **keywords)
def fit(self, **keywords): """ Go through an iterator, instantiating model and passing data, going through outputs. """
self.sphere = LKSet([LKsphere(k,i) for i in range(self.k)])
self.sphere = LKSet([LKsphere(k,i) for i in range(k)])
def __init__(self, n=1, m=4, k=1, **extra): FStat.__init__(m=m, n=n, **extra) self.sphere = LKSet([LKsphere(k,i) for i in range(self.k)]) self.k = k
self.sphere = LKSet([LKsphere(k,i) for i in range(self.k)])
self.sphere = LKSet([LKsphere(k,i) for i in range(k)])
def __init__(self, m=4, k=1, **extra): FStat.__init__(m=m, n=1, **extra) self.sphere = LKSet([LKsphere(k,i) for i in range(self.k)]) self.k = k
extrainfo('Downloading url ...', url)
else: info('Downloading url ...', url)
def download(self, url_obj): """ Download this url """
char_data = ''
self._data = ''
def __init__(self, config): self.cfg = config self._node = '' char_data = ''
self.char_data = '' self._node = ''
self._data = ''
def start_element(self, name, attrs): # reset character and node data, we're starting new element self.char_data = '' self._node = '' if attrs: # If the element has attributes # it does not have CDATA. So set # curr elem to null. self._node = '' for key, value in attrs.iteritems(): # Form key name in xml map xmlkey ...
self.char_data = self.char_data.strip() if self.char_data != '':
if self._data != '':
def end_element(self, name): # This is called after the closing tag of an XML element was found # When this is called we know that char_data now truly has all the data # that was between the element start and end tag. # jkleven: 10/1/06 - this function exists because we weren't # parsing strings in config file # with ...
self.cfg.set_option_xml(self._node, self.char_data)
self.cfg.set_option_xml(self._node, self._data)
def end_element(self, name): # This is called after the closing tag of an XML element was found # When this is called we know that char_data now truly has all the data # that was between the element start and end tag. # jkleven: 10/1/06 - this function exists because we weren't # parsing strings in config file # with ...
print self.char_data
print self._data
def end_element(self, name): # This is called after the closing tag of an XML element was found # When this is called we know that char_data now truly has all the data # that was between the element start and end tag. # jkleven: 10/1/06 - this function exists because we weren't # parsing strings in config file # with ...
char_data = ''
self._data = ''
def end_element(self, name): # This is called after the closing tag of an XML element was found # When this is called we know that char_data now truly has all the data # that was between the element start and end tag. # jkleven: 10/1/06 - this function exists because we weren't # parsing strings in config file # with ...
self.char_data += data
self._data += data.strip()
def char_data(self, data): # This will be called after the # start element is called. Simply # record all the data passed in and # then in the end element callback # we will actually add the whole # string to the internal config structure self.char_data += data
if timestr: try: lmt = time.mktime( strptime(timestr, "%a, %d %b %Y %H:%M:%S GMT")) except ValueError, e: debug(e) datalen = self.get_content_length()
def __save_url_file(self, urlobj): """ Download data from the url <url> and write to the file <filename> """
if timestr: try: lmt = time.mktime( strptime(timestr, "%a, %d %b %Y %H:%M:%S GMT")) except ValueError, e: debug(e) if lmt != -1: url, filename = urlobj.get_full_url(), urlobj.get_full_filename() update, fileverified = dmgr.is_url_uptodate(url, filename, lmt, self.__data) if update and fileverified: extrainfo("Project...
if lmt != -1: url, filename = urlobj.get_full_url(), urlobj.get_full_filename() update, fileverified = dmgr.is_url_uptodate(url, filename, lmt, self.__data) if update and fileverified: extrainfo("Project cache is uptodate =>", url) return 3
def __save_url_file(self, urlobj): """ Download data from the url <url> and write to the file <filename> """
update, fileverified = dmgr.is_url_cache_uptodate(url, filename, self.get_content_length(), self.__data)
update, fileverified = dmgr.is_url_cache_uptodate(url, filename, datalen, self.__data)
def __save_url_file(self, urlobj): """ Download data from the url <url> and write to the file <filename> """