rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
for t, fname in enum(self.xp, postfix=postfix, ext=ext): | for t, fname in self.xp.enum(postfix=postfix, ext=ext): | def time_correlation(self, postfix='',ext='dat', col=0, av=10): """read the particle-wise scalar from a time serie of files and compute the time correlation""" data = np.zeros((self.trajs.shape[1], self.trajs.shape[0])) for t, fname in enum(self.xp, postfix=postfix, ext=ext): data[t] = np.loadtxt(fname, usecols=[col])[... |
def enum(xp,postfix='',ext='dat',absPath=True): """Generator of couples (time, filename)""" format_string = xp.get_format_string(postfix,ext,absPath) for t in xp.get_range(): yield t, (format_string % t) | def enum(xp,postfix='',ext='dat',absPath=True): """Generator of couples (time, filename)""" format_string = xp.get_format_string(postfix,ext,absPath) for t in xp.get_range(): yield t, (format_string % t) | |
pos2traj = -np.ones((bonds.max()+1), dtype=int) | pos2traj = -np.ones((oldbonds.max()+1), dtype=int) | def load_bonds(self, t): oldbonds = np.loadtxt(self.xp.get_format_string(ext='bonds')%t, dtype=int) pos2traj = -np.ones((bonds.max()+1), dtype=int) pos2traj[self.trajs[:,t]] = range(self.trajs.shape[0]) newbonds = pos2traj[bonds] newbonds = newbonds[np.where(newbonds.min(axis=1)>-1)] newbonds.sort(axis=1) indices = np.... |
newbonds = pos2traj[bonds] | newbonds = pos2traj[oldbonds] | def load_bonds(self, t): oldbonds = np.loadtxt(self.xp.get_format_string(ext='bonds')%t, dtype=int) pos2traj = -np.ones((bonds.max()+1), dtype=int) pos2traj[self.trajs[:,t]] = range(self.trajs.shape[0]) newbonds = pos2traj[bonds] newbonds = newbonds[np.where(newbonds.min(axis=1)>-1)] newbonds.sort(axis=1) indices = np.... |
isf = np.zeros((stop-start+1)) if av==0: for t0, a in enumerate(A): for dt, b in enumerate(A[t0+1:]): isf[dt+1] += np.real(a.conj()*b).sum() isf /= A.shape[1] * A.shape[2] isf[0]=1 for dt, n in enumerate(range(stop-start,0,-1)): isf[dt+1] /= n return isf else: for t0, a in enumerate(A[:av]): for dt, b in enumerate(A[t... | return statistics.time_correlation(A, av) | def self_isf(self,start,stop,av): """ Self intermediate scattering function If av is 0 (Default), the calculation will act greedily, averaging over all the avilabe intervals of a given length. Example : start=1 stop=4 av=0 ISF[0] = 1 ISF[1] = ( isf([1,2]) + isf([2,3]) + isf([3,4]))/3 ISF[2] = ( isf([1,3]) + isf([2,4]) ... |
msd[dt+1] += ((b-a)**2).sum() mqd[dt+1] += ((b-a)**4).sum() msd /= A.shape[1] * A.shape[2] * (self.xp.radius*2)**2 mqd /= A.shape[1] * A.shape[2] * (self.xp.radius*2)**4 for dt, n in enumerate(range(stop-start,0,-1)): msd[dt+1] /= n mqd[dt+1] /=n | diff = (b-a)**2 msd[dt+1] += diff.sum() mqd[dt+1] += (diff.sum(axis=-1)**2).sum() for dt in range(len(mqd)): mqd[dt] *= (len(mqd)-dt) * A.shape[1] * A.shape[2] | def nonGaussian(self,start,stop,av): """ Non gaussian parameter If av is 0 (Default), the calculation will act greedily, averaging over all the avilabe intervals of a given length. Example : start=1 stop=4 av=0 alpha[dt=0] = 1 alpha[dt=1] = ( alpha([1,2]) + alpha([2,3]) + alpha([3,4]))/3 alpha[dt=2] = ( alpha([1,3]) + ... |
msd[dt+1] += ((b-a)**2).sum() mqd[dt+1] += ((b-a)**4).sum() msd /= av * A.shape[1] * A.shape[2] * (self.xp.radius*2)**2 mqd /= av * A.shape[1] * A.shape[2] * (self.xp.radius*2)**4 mqd[1:] /= (3 * msd[1:]**2) | diff = (b-a)**2 msd[dt+1] += diff.sum() mqd[dt+1] += (diff.sum(axis=-1)**2).sum() mqd *= av * A.shape[1] * A.shape[2] mqd[1:] /= 3*(5 * msd[1:]**2) | def nonGaussian(self,start,stop,av): """ Non gaussian parameter If av is 0 (Default), the calculation will act greedily, averaging over all the avilabe intervals of a given length. Example : start=1 stop=4 av=0 alpha[dt=0] = 1 alpha[dt=1] = ( alpha([1,2]) + alpha([2,3]) + alpha([3,4]))/3 alpha[dt=2] = ( alpha([1,3]) + ... |
nbs = np.empty((size)) Vs = np.empty((size)) | nbs = np.empty((self.size)) Vs = np.empty((self.size)) | def get_Nb_density(self, averaged=True): nbs = np.empty((size)) Vs = np.empty((size)) for t,fname in enum(self): coords = np.loadtxt(fname,delimiter='\t', skiprows=2) nbs[t-self.offset] = len(coords) Vs[t-self.offset] = np.ptp(coords, axis=0).prod() if averaged: return (nbs/Vs).mean() else: return (nbs, Vs) |
nbs = np.empty((size)) Vs = np.empty((size)) | nbs = np.empty((self.size)) Vs = np.empty((self.size)) | def get_zPortion_Nbd(self, lowerMargin=0, upperMargin=0, averaged=True): """Get the number density of a z-slab""" nbs = np.empty((size)) Vs = np.empty((size)) for t,fname in enum(self): coords = np.loadtxt(fname,delimiter='\t', skiprows=2) m = np.amin(coords[:,-1])+lowerMargin M = np.amax(coords[:,-1])-upperMargin coor... |
self.points = np.array((0,3)) self.bonds = np.array((0,2)) | self.points = np.empty((0,3)) self.bonds = np.empty((0,2), dtype=int) | def __init__(self, fileName=None): """Constructor from vtk legacy format""" self.name = '' self.points = np.array((0,3)) self.bonds = np.array((0,2)) self.scalars = [] self.vectors = [] self.bondsScalars = [] if not fileName ==None: self.load(fileName) |
def __init__(self, src, atomicArray): | def __init__(self, src): | def __init__(self, src, atomicArray): ''' @param src: Either a string, a file object, a socket - all providing valid binary r data @param atomicArray: if False parsing arrays with only one element will just return this element ''' try: # this only works for objects implementing the buffer protocol, e.g. strings, arrays... |
@param atomicArray: if False parsing arrays with only one element will just return this element | def __init__(self, src, atomicArray): ''' @param src: Either a string, a file object, a socket - all providing valid binary r data @param atomicArray: if False parsing arrays with only one element will just return this element ''' try: # this only works for objects implementing the buffer protocol, e.g. strings, arrays... | |
self.atomicArray = atomicArray | def __init__(self, src, atomicArray): ''' @param src: Either a string, a file object, a socket - all providing valid binary r data @param atomicArray: if False parsing arrays with only one element will just return this element ''' try: # this only works for objects implementing the buffer protocol, e.g. strings, arrays... | |
return data[0] if (len(data)==1 and not self.atomicArray) else data | return data | def xt_array_numeric(self, lexeme): raw = self.read(lexeme.dataLength) # TODO: swapping... data = numpy.fromstring(raw, dtype=numpyMap[lexeme.rTypeCode]) # The next needs to be discussed: In R everything is an array, how do we handle # singular array items in Python? Always as an array, or as an atomic item? return dat... |
return data[0] if (len(data)==1 and not self.atomicArray) else numpy.array(data) | return numpy.array(data) | def xt_array_str(self, lexeme): ''' An array of one or more null-terminated strings. The XT_ARRAY_STR can contain trailing chars \x01 which need to be chopped off. ''' if lexeme.dataLength == 0: return '' raw = self.read(lexeme.dataLength) data = raw.split('\0')[:-1] return data[0] if (len(data)==1 and not self.atomicA... |
self.lexer = Lexer(src, atomicArray) | self.lexer = Lexer(src) self.atomicArray = atomicArray | def __init__(self, src, atomicArray): self.lexer = Lexer(src, atomicArray) |
return self._parseExpr().data | return self._stripArray(self._parseExpr().data) | def _parse(self): dataLexeme = self.lexer.nextExprHdr() self._debugLog(dataLexeme, isRexpr=False) if dataLexeme.rTypeCode == DT_SEXP: return self._parseExpr().data else: raise NotImplementedError() |
'apply this for atomic data and arrays.' | 'apply this for atomic data' return self._nextExprData(lexeme) @fmap(XT_ARRAY_BOOL, XT_ARRAY_INT, XT_ARRAY_DOUBLE, XT_ARRAY_STR) def xt_array(self, lexeme): | def xt_(self, lexeme): 'apply this for atomic data and arrays.' data = self._nextExprData(lexeme) if lexeme.hasAttr and lexeme.attrTypeCode == XT_LIST_TAG: for tag, value in lexeme.attr: if tag == 'dim': # the array has a defined shape data.shape = value elif tag == 'names': data = asTaggedArray(data, value) elif tag i... |
data = asTaggedArray(data, value) | data = asTaggedArray(data, list(value)) | def xt_(self, lexeme): 'apply this for atomic data and arrays.' data = self._nextExprData(lexeme) if lexeme.hasAttr and lexeme.attrTypeCode == XT_LIST_TAG: for tag, value in lexeme.attr: if tag == 'dim': # the array has a defined shape data.shape = value elif tag == 'names': data = asTaggedArray(data, value) elif tag i... |
data.append(self._parseExpr().data) | data.append(self._stripArray(self._parseExpr().data)) | def xt_vector(self, lexeme): ''' The binary representation of an XT_VECTOR is weird: a vector contains unknown number of items, with possibly variable length. The end of this REXP can only be detected by keeping track of how many bytes have been consumed (lexeme.length!) until the end of the REXP has been reached. ''' ... |
self.updateTokenAccess() def updateTokenAccess(self): | self.fetchAccessToken() def fetchAccessToken(self, refreshing=False): | def __init__(self, oauth_server, oauth_consumer_key, oauth_consumer_secret, oauth_token="", oauth_token_secret="", realm=None): self.oauth_server = oauth_server self.oauth_consumer_key = oauth_consumer_key self.oauth_consumer_secret = oauth_consumer_secret if realm is None: realm = "yahooapis.com" self.realm = realm se... |
headers = self.getHeaderNoCheck() | headers = self.getHeader() if refreshing: self.oauth_token_secret = "" headers["Authorization"] += ',oauth_session_handle="%s"' % self.access_token['oauth_session_handle'] print headers | def updateTokenAccess(self): """Sign all keys to get a new token and token secret, must redo after oauth_expires_in second """ headers = self.getHeaderNoCheck() req = urllib2.Request(self.oauth_server, None, headers) try: o = urllib2.urlopen(req) resp = o.read() self.access_token = dict([el.split("=") for el in resp.sp... |
self.updateToken(self.access_token['oauth_token'], self.access_token['oauth_token_secret']) return True except urllib2.HTTPError, e: self._handleHttpError(e) return False | self.oauth_token = self.access_token['oauth_token'] self.oauth_token_secret = self.access_token['oauth_token_secret'] return True except urllib2.HTTPError, e: raise return False def isTokenNeedRefresh(self): return time.time() > (self.last_token_update + int(self.access_token['oauth_expires_in'])) def refreshAccessTo... | def updateTokenAccess(self): """Sign all keys to get a new token and token secret, must redo after oauth_expires_in second """ headers = self.getHeaderNoCheck() req = urllib2.Request(self.oauth_server, None, headers) try: o = urllib2.urlopen(req) resp = o.read() self.access_token = dict([el.split("=") for el in resp.sp... |
if time.time() > (self.last_token_update + int(self.access_token['oauth_expires_in'])): self.updateTokenAccess() return self.getHeaderNoCheck() def getHeaderNoCheck(self): | def getHeader(self): if time.time() > (self.last_token_update + int(self.access_token['oauth_expires_in'])): self.updateTokenAccess() return self.getHeaderNoCheck() | |
headers["Authorization"] ="""OAuth realm="%s",oauth_consumer_key="%s",oauth_signature_method="PLAINTEXT",oauth_nonce="%s",oauth_timestamp="%s",oauth_signature="%s",oauth_token="%s",oauth_version="1.0\"""" % ( | headers["Authorization"] ='OAuth realm="%s",oauth_consumer_key="%s",oauth_signature_method="PLAINTEXT",oauth_nonce="%s",oauth_timestamp="%s",oauth_signature="%s",oauth_token="%s",oauth_version="1.0"' % ( | def getHeaderNoCheck(self): headers = {} headers["Authorization"] ="""OAuth realm="%s",oauth_consumer_key="%s",oauth_signature_method="PLAINTEXT",oauth_nonce="%s",oauth_timestamp="%s",oauth_signature="%s",oauth_token="%s",oauth_version="1.0\"""" % ( self.realm, self.escape(self.oauth_consumer_key), self.escape(self.gen... |
def updateToken(self, new_oauth_token, new_oauth_token_secret = None): self.oauth_token = new_oauth_token if new_oauth_token_secret is not None: self.oauth_token_secret = new_oauth_token_secret | def getHeaderNoCheck(self): headers = {} headers["Authorization"] ="""OAuth realm="%s",oauth_consumer_key="%s",oauth_signature_method="PLAINTEXT",oauth_nonce="%s",oauth_timestamp="%s",oauth_signature="%s",oauth_token="%s",oauth_version="1.0\"""" % ( self.realm, self.escape(self.oauth_consumer_key), self.escape(self.gen... | |
uri = "http://%s/v1/keepalive?sid=%s¬ifyServerToken=%s" % (self.login_data['server'], self.login_data['sessionId'], 1) | uri = "http://%s/v1/session/keepalive?sid=%s¬ifyServerToken=%s" % (self.login_data['server'], self.login_data['sessionId'], 1) | def keepAlive(self): print ">keepalive" uri = "http://%s/v1/keepalive?sid=%s¬ifyServerToken=%s" % (self.login_data['server'], self.login_data['sessionId'], 1) headers = self.oauth.getHeader() headers['Content-type'] = CONTENT_TYPE req = urllib2.Request(uri, None, headers) req.get_method = lambda: 'PUT' try: o = urll... |
print "Keep alive required" | print ">Keep alive required" | def sendKeepAliveIfRequired(self): if time.time() > self.session_expired_time: print "Keep alive required" return self.keepAlive() |
print "Waiting notification | def cometNotification(self, primary_userid=None, sequence=None, count=10, idle=120): if primary_userid is None: primary_userid = self.login_data['primaryLoginId'] if sequence is None: sequence = self.last_sequence + 1 | |
self.shutdown = False while not self.shutdown: print "Long running", self.last_sequence self.sendKeepAliveIfRequired() self.cometNotification() self.logout() | self.shutdown = False while not self.shutdown: self.sendKeepAliveIfRequired() self.cometNotification() self.logout() | def mainLoop(self): self.shutdown = False while not self.shutdown: print "Long running", self.last_sequence self.sendKeepAliveIfRequired() self.cometNotification() self.logout() |
def __init__(self, oauth_consumer_key, oauth_consumer_secret, oauth_token="", oauth_token_secret="", realm=None): | def __init__(self, oauth_server, oauth_consumer_key, oauth_consumer_secret, oauth_token="", oauth_token_secret="", realm=None): self.oauth_server = oauth_server | def __init__(self, oauth_consumer_key, oauth_consumer_secret, oauth_token="", oauth_token_secret="", realm=None): self.oauth_consumer_key = oauth_consumer_key self.oauth_consumer_secret = oauth_consumer_secret if realm is None: realm = "yahooapis.com" self.realm = realm self.oauth_token = oauth_token self.oauth_token_s... |
OAUTH_SERVER = "https://api.login.yahoo.com/oauth/v2/get_token" | def escape(s): """Escape a URL including any /.""" return urllib.quote(s, safe='~') | |
self.oauth = SimpleOAuth(self.consumer_key, self.consumer_secret) | def __init__(self, userid, password, consumer_key=CONSUMER_KEY, consumer_secret=CONSUMER_SECRET): self.consumer_key = consumer_key self.consumer_secret = consumer_secret self.last_sequence = 0 self.part_token = None self.oauth = SimpleOAuth(self.consumer_key, self.consumer_secret) if not self.initPart(userid, password)... | |
if not self.initOAuth(): raise Exception, "Unable to init OAuth token" | self.initOAuth() | def __init__(self, userid, password, consumer_key=CONSUMER_KEY, consumer_secret=CONSUMER_SECRET): self.consumer_key = consumer_key self.consumer_secret = consumer_secret self.last_sequence = 0 self.part_token = None self.oauth = SimpleOAuth(self.consumer_key, self.consumer_secret) if not self.initPart(userid, password)... |
uri = "https://api.login.yahoo.com/oauth/v2/get_token" self.oauth.updateToken(self.part_token) headers = self.oauth.getHeader() req = urllib2.Request(uri, None, headers) try: o = urllib2.urlopen(req) resp = o.read() self.access_token = dict([el.split("=") for el in resp.split("&")]) self.oauth.updateToken(self.access_t... | self.oauth = SimpleOAuth(OAUTH_SERVER, self.consumer_key, self.consumer_secret, self.part_token) | def initOAuth(self, part_token=None): print ">initOauth" if part_token is not None: self.part_token = part_token uri = "https://api.login.yahoo.com/oauth/v2/get_token" self.oauth.updateToken(self.part_token) headers = self.oauth.getHeader() req = urllib2.Request(uri, None, headers) try: o = urllib2.urlopen(req) resp = ... |
Call every 60 minutes to keep session alive | Call before 60 minutes to keep session alive | def logout(self): print ">logout" uri = "http://%s/v1/session?sid=%s" % (self.login_data['server'], self.login_data['sessionId']) headers = self.oauth.getHeader() headers['Content-type'] = CONTENT_TYPE req = urllib2.Request(uri, None, headers) req.get_method = lambda: 'DELETE' try: o = urllib2.urlopen(req) return True ... |
self.session_expired_time = time.time() + 3600 | self.session_expired_time = time.time() + 3600 - 120 - 60 | def keepAlive(self): print ">keepalive" uri = "http://%s/v1/keepalive?sid=%s¬ifyServerToken=%s" % (self.login_data['server'], self.login_data['sessionId'], 1) headers = self.oauth.getHeader() headers['Content-type'] = CONTENT_TYPE req = urllib2.Request(uri, None, headers) req.get_method = lambda: 'PUT' try: o = urll... |
self.sendMessage(obj['sender'], self.google(obj['msg'])) | self.sendMessage(obj['sender'], "'%s'\n%s" % (self.autotranslate(obj['msg']), self.google(obj['msg']))) | def on_message_event(self, obj): #avoid infinite loop if obj['sender'] == self.login_data['primaryLoginId']: return if obj['msg'] == "dodysw:quit": self.shutdown = True return if obj['msg'] == "dodysw:friends": self.fetchContactList() print self.contacts return print "=======%s: %s" % (obj['sender'], obj['msg']) self.s... |
def on_disconnect_event(self, obj): """ Reason code 1 = Regen: This user session has been expired because of login elsewhere. 2 = Idle: This user session has been expired because of idleness. 3 = Queue Full: This user session has been expired because messages in the session notification queue are not fetched. 4 = Self-... | def on_buddyStatus_event(self, obj): print "=======%s status. Presence: %s msg: %s" % (obj['sender'], obj['presenceState'], obj.get('presenceMessage', '')) | |
self.canvas.bind("<Button-2>", self.mouse_wheel_handler) self.canvas.bind("<Button-3>", self.mouse_wheel_handler) | def __init__(self, master=None): Frame.__init__(self, master) | |
if dir == 0: return | def mouse_wheel_handler(self, event): dir = cross_platform_mouse_wheel(event) #if dir == 0: # return | |
if dir == 0: return | def mouse_wheel_handler(self, event): dir = cross_platform_mouse_wheel(event) if dir == 0: return | |
if self.zoom < -8: self.zoom = -8 | if self.zoom < -4: self.zoom = -4 | def resize_image_to_zoom(self, delta=None, zoom=None, center=None, forcereload=False): """Parameters: delta : How much to increase/decrease the current zoom? zoom : Set zoom to this absolute value. center : Uses these coordinates (x,y) as the zoom center, scrolling the canvas as needed. These are "window... |
print ( "w=({wx},{wy})\n" "old canvas=({ocx},{ocy})\n" "old scroll=({osx},{osy})\n" "old scroll=({tx},{ty})\n" "new canvas=({ncx},{ncy})\n" "new scroll=({nsx},{nsy})\n" "deltazoom={deltazoom}; deltamult={deltamult}" .format(**locals()) ) | def resize_image_to_zoom(self, delta=None, zoom=None, center=None, forcereload=False): """Parameters: delta : How much to increase/decrease the current zoom? zoom : Set zoom to this absolute value. center : Uses these coordinates (x,y) as the zoom center, scrolling the canvas as needed. These are "window... | |
self.canvas["scrollregion"] = (0, 0, tk_img.width(), tk_img.height()) | new_width = tk_img.width() new_height = tk_img.height() self.canvas["scrollregion"] = (0, 0, new_width, new_height) | def resize_image_to_zoom(self, delta=None, zoom=None, center=None, forcereload=False): """Parameters: delta : How much to increase/decrease the current zoom? zoom : Set zoom to this absolute value. center : Uses these coordinates (x,y) as the zoom center, scrolling the canvas as needed. These are "window... |
oldincx = self.canvas["xscrollincrement"] oldincy = self.canvas["yscrollincrement"] self.canvas["xscrollincrement"] = 1 self.canvas["yscrollincrement"] = 1 self.canvas.xview_moveto(0.0) self.canvas.yview_moveto(0.0) self.canvas.xview_scroll(int(nsx)+1, UNITS) self.canvas.yview_scroll(int(nsy)+1, UNITS) self.canvas["xsc... | offset_x = +1 if nsx >= 0 else 0 offset_y = +1 if nsy >= 0 else 0 self.canvas.xview_moveto(float(nsx + offset_x)/new_width) self.canvas.yview_moveto(float(nsy + offset_y)/new_height) | def resize_image_to_zoom(self, delta=None, zoom=None, center=None, forcereload=False): """Parameters: delta : How much to increase/decrease the current zoom? zoom : Set zoom to this absolute value. center : Uses these coordinates (x,y) as the zoom center, scrolling the canvas as needed. These are "window... |
print 'FUCK', bbox.getX0(), bbox.getX1(), bbox.getY0(), bbox.getY1() | print 'DEBUG', bbox.getX0(), bbox.getX1(), bbox.getY0(), bbox.getY1() | def makePsfMatchingKernel(maskedImageToConvolve, maskedImageToNotConvolve, policy, footprints=None): # Object to store the KernelCandidates for spatial modeling kernelCellSet = afwMath.SpatialCellSet(afwImage.BBox(afwImage.PointI(maskedImageToConvolve.getX0(), maskedImageToConvolve.getY0()), maskedImageToConvolve.get... |
self.assertEqual(wcs1.xyToRaDec(0, 0)[0], wcs2.xyToRaDec(0, 0)[0]) self.assertEqual(wcs1.xyToRaDec(0, 0)[1], wcs2.xyToRaDec(0, 0)[1]) | self.assertEqual(wcs1.pixelToSky(0, 0)[0], wcs2.pixelToSky(0, 0)[0]) self.assertEqual(wcs1.pixelToSky(0, 0)[1], wcs2.pixelToSky(0, 0)[1]) | def testWarp(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata not set up; not running WarpTemplateExposure.py" return |
self.assertEqual(wcs1.xyToRaDec(remappedImage.getWidth(), remappedImage.getHeight())[0], wcs2.xyToRaDec(remappedImage.getWidth(), remappedImage.getHeight())[0]) self.assertEqual(wcs1.xyToRaDec(remappedImage.getWidth(), remappedImage.getHeight())[1], wcs2.xyToRaDec(remappedImage.getWidth(), remappedImage.getHeight())[1]... | self.assertEqual(wcs1.pixelToSky(remappedImage.getWidth(), remappedImage.getHeight())[0], wcs2.pixelToSky(remappedImage.getWidth(), remappedImage.getHeight())[0]) self.assertEqual(wcs1.pixelToSky(remappedImage.getWidth(), remappedImage.getHeight())[1], wcs2.pixelToSky(remappedImage.getWidth(), remappedImage.getHeight()... | def testWarp(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata not set up; not running WarpTemplateExposure.py" return |
bbox = afwImage.BBox(afwImage.PointI(2, 900), | bbox = afwImage.BBox(afwImage.PointI(7, 900), | def testXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata not set up; not running WarpTemplateExposure.py" return |
self.assertEqual(wcs1.xyToRaDec(0, 0)[0], wcs2.xyToRaDec(0, 0)[0]) self.assertEqual(wcs1.xyToRaDec(0, 0)[1], wcs2.xyToRaDec(0, 0)[1]) | self.assertEqual(wcs1.pixelToSky(0, 0)[0], wcs2.pixelToSky(0, 0)[0]) self.assertEqual(wcs1.pixelToSky(0, 0)[1], wcs2.pixelToSky(0, 0)[1]) | def testXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata not set up; not running WarpTemplateExposure.py" return |
self.assertEqual(wcs1.xyToRaDec(remappedImage.getWidth(), remappedImage.getHeight())[0], wcs2.xyToRaDec(remappedImage.getWidth(), remappedImage.getHeight())[0]) self.assertEqual(wcs1.xyToRaDec(remappedImage.getWidth(), remappedImage.getHeight())[1], wcs2.xyToRaDec(remappedImage.getWidth(), remappedImage.getHeight())[1]... | self.assertEqual(wcs1.pixelToSky(remappedImage.getWidth(), remappedImage.getHeight())[0], wcs2.pixelToSky(remappedImage.getWidth(), remappedImage.getHeight())[0]) self.assertEqual(wcs1.pixelToSky(remappedImage.getWidth(), remappedImage.getHeight())[1], wcs2.pixelToSky(remappedImage.getWidth(), remappedImage.getHeight()... | def testXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata not set up; not running WarpTemplateExposure.py" return |
self.bbox = afwImage.BBox(afwImage.PointI(0, 1500), | self.offset = 1500 self.bbox = afwImage.BBox(afwImage.PointI(0, self.offset), | def setUp(self): self.diffimDir = eups.productDir('ip_diffim') self.diffimPolicy = os.path.join(self.diffimDir, 'pipeline', 'ImageSubtractStageDictionary.paf') self.policy = ipDiffim.generateDefaultPolicy(self.diffimPolicy) self.defDataDir = eups.productDir('afwdata') if self.defDataDir: |
display=True, frame=0) | display=display, frame=0) | def runXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata is not set up" return |
templateSubImage.getMaskedImage().setXY0(0, 0) scienceSubImage.getMaskedImage().setXY0(0, 0) | templateSubImage.setXY0(0, 0) scienceSubImage.setXY0(0, 0) | def runXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata is not set up" return |
display=True, frame=3) | display=display, frame=3) | def runXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata is not set up" return |
skp1 = spatialKernel1.getSpatialParameters() skp2 = spatialKernel2.getSpatialParameters() self.assertAlmostEqual(skp1[0][0], skp2[0][0]) sys.exit(1) kImage1 = afwImage.ImageD(spatialKernel1.getDimensions()) kImage2 = afwImage.ImageD(spatialKernel2.getDimensions()) imstats = ipDiffim.ImageStatisticsF() | def runXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata is not set up" return | |
for cand1 in cell.begin(True): | for cand1 in cell.begin(False): | def runXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata is not set up" return |
if cand1.getStatus() == afwMath.SpatialCellCandidate.GOOD: cand2 = kernelCellSet2.getCandidateById(cand1.getId() + count) cand2 = ipDiffim.cast_KernelCandidateF(cand2) xCand1 = int(cand1.getXCenter()) yCand1 = int(cand1.getYCenter()) kSum1 = spatialKernel1.computeImage(kImage1, False, afwImage.indexToPosition(xCand1... | cand2 = ipDiffim.cast_KernelCandidateF(kernelCellSet2.getCandidateById(cand1.getId() + count)) | def runXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata is not set up" return |
xCand2 = int(cand2.getXCenter()) yCand2 = int(cand2.getYCenter()) kSum2 = spatialKernel2.computeImage(kImage2, False, afwImage.indexToPosition(xCand2), afwImage.indexToPosition(yCand2)) kernel2 = afwMath.FixedKernel(kImage2) background2 = backgroundModel2(afwImage.indexToPosition(xCand2), afwImage.indexToPosition(yCan... | self.assertEqual(cand1.getXCenter(), cand2.getXCenter()) self.assertEqual(cand1.getYCenter(), cand2.getYCenter() + self.offset) | def runXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata is not set up" return |
self.assertAlmostEqual(candMean1, candMean2) self.assertAlmostEqual(candRms1, candRms2) self.assertAlmostEqual(kSum1, kSum2) self.assertAlmostEqual(background1, background2) | im1 = cand1.getKernelImage(ipDiffim.KernelCandidateF.RECENT) im2 = cand2.getKernelImage(ipDiffim.KernelCandidateF.RECENT) for y in range(im1.getHeight()): for x in range(im1.getWidth()): self.assertAlmostEqual(im1.get(x, y), im2.get(x, y)) skp1 = spatialKernel1.getSpatialParameters() skp2 = spatialKernel2.getSpat... | def runXY0(self): if not self.defDataDir: print >> sys.stderr, "Warning: afwdata is not set up" return |
hypervisor.add_filesystem(elements[1], default_filesystem, mntpnt='/') | hypervisor.add_filesystem(elements[1], default_filesystem, filename=tmpfile, mntpnt='/') | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
hypervisor.add_filesystem(elements[1], type='swap', mntpnt=None) | hypervisor.add_filesystem(elements[1], type='swap', filename=tmpfile, mntpnt=None) | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
hypervisor.add_filesystem(elements[1], type=default_filesystem, mntpnt=elements[0], devletter='', device=elements[2], dummy=(int(elements[1]) == 0)) | hypervisor.add_filesystem(elements[1], type=default_filesystem, filename=tmpfile, mntpnt=elements[0], devletter='', device=elements[2], dummy=(int(elements[1]) == 0)) | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
hypervisor.add_filesystem(elements[1], type=default_filesystem, mntpnt=elements[0]) | hypervisor.add_filesystem(elements[1], type=default_filesystem, filename=tmpfile, mntpnt=elements[0]) | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
group = self.context.setting_group('Scripts') group.add_option('--firstboot', metavar='PATH', default='', help='Specify a script that will be copied into the guest and executed the first time the machine boots. This script must not be interactive.') group.add_option('--firstlogin', metavar='PATH', default='', help='Sp... | group = self.setting_group('Scripts') group.add_setting('firstboot', metavar='PATH', help='Specify a script that will be copied into the guest and executed the first time the machine boots. This script must not be interactive.') group.add_setting('firstlogin', metavar='PATH', help='Specify a script that will be copied... | def register_options(self): group = self.context.setting_group('Scripts') group.add_option('--firstboot', metavar='PATH', default='', help='Specify a script that will be copied into the guest and executed the first time the machine boots. This script must not be interactive.') group.add_option('--firstlogin', metavar=... |
if self.context.firstboot: logging.debug("Checking if firstboot script %s exists" % (self.context.firstboot,)) if not(os.path.isfile(self.context.firstboot)): raise VMBuilderUserError('The path to the first-boot script is invalid: %s. Make sure you are providing a full path.' % self.context.firstboot) if self.context.... | firstboot = self.context.get_setting('firstboot') if firstboot: logging.debug("Checking if firstboot script %s exists" % (firstboot,)) if not(os.path.isfile(firstboot) and firstboot.startswith('/')): raise VMBuilderUserError('The path to the first-boot script is invalid: %s. Make sure you are providing a full path.' % ... | def preflight_check(self): if self.context.firstboot: logging.debug("Checking if firstboot script %s exists" % (self.context.firstboot,)) if not(os.path.isfile(self.context.firstboot)): raise VMBuilderUserError('The path to the first-boot script is invalid: %s. Make sure you are providing a full path.' % self.context.... |
logging.debug("Installing firstboot script %s" % (self.context.firstboot,)) if self.context.firstboot: self.context.install_file('/root/firstboot.sh', source=self.vm.firstboot, mode=0700) os.rename('%s/etc/rc.local' % self.context.installdir, '%s/etc/rc.local.orig' % self.vm.installdir) | firstboot = self.context.get_setting('firstboot') if firstboot: logging.debug("Installing firstboot script %s" % (firstboot,)) self.context.install_file('/root/firstboot.sh', source=firstboot, mode=0700) os.rename('%s/etc/rc.local' % self.context.chroot_dir, '%s/etc/rc.local.orig' % self.context.chroot_dir) | def post_install(self): logging.debug("Installing firstboot script %s" % (self.context.firstboot,)) if self.context.firstboot: self.context.install_file('/root/firstboot.sh', source=self.vm.firstboot, mode=0700) os.rename('%s/etc/rc.local' % self.context.installdir, '%s/etc/rc.local.orig' % self.vm.installdir) self.ins... |
logging.debug("Installing first login script %s" % (self.context.firstlogin,)) if self.context.firstlogin: self.context.install_file('/root/firstlogin.sh', source=self.vm.firstlogin, mode=0755) os.rename('%s/etc/bash.bashrc' % self.context.installdir, '%s/etc/bash.bashrc.orig' % self.vm.installdir) | firstlogin = self.context.get_setting('firstlogin') if firstlogin: logging.debug("Installing first login script %s" % (firstlogin,)) self.context.install_file('/root/firstlogin.sh', source=firstlogin, mode=0755) os.rename('%s/etc/bash.bashrc' % self.context.chroot_dir, '%s/etc/bash.bashrc.orig' % self.context.chroot_di... | def post_install(self): logging.debug("Installing firstboot script %s" % (self.context.firstboot,)) if self.context.firstboot: self.context.install_file('/root/firstboot.sh', source=self.vm.firstboot, mode=0700) os.rename('%s/etc/rc.local' % self.context.installdir, '%s/etc/rc.local.orig' % self.vm.installdir) self.ins... |
register_distro_plugin(Firstscripts) | def post_install(self): logging.debug("Installing firstboot script %s" % (self.context.firstboot,)) if self.context.firstboot: self.context.install_file('/root/firstboot.sh', source=self.vm.firstboot, mode=0700) os.rename('%s/etc/rc.local' % self.context.installdir, '%s/etc/rc.local.orig' % self.vm.installdir) self.ins... | |
self.run_in_target('chown', '-R', '%s:%s' % (self.vm.user,)*2, '/home/%s/.ssh/' % (self.vm.user)) | self.run_in_target('chown', '-R', '%s:%s' % ((self.vm.user,)*2), '/home/%s/.ssh/' % (self.vm.user)) | def install_authorized_keys(self): if self.vm.ssh_key: os.mkdir('%s/root/.ssh' % self.destdir, 0700) shutil.copy(self.vm.ssh_key, '%s/root/.ssh/authorized_keys' % self.destdir) os.chmod('%s/root/.ssh/authorized_keys' % self.destdir, 0644) if self.vm.ssh_user_key: os.mkdir('%s/home/%s/.ssh' % (self.destdir, self.vm.user... |
chroot_root = self.options_tmp_root | chroot_root = self.options.tmp_root | def main(self): tmpfs_mount_point = None try: optparser = optparse.OptionParser() |
logging.info('Un-mounting tmpfs from %s' % mount_point) | logging.info('Unmounting tmpfs from %s' % mount_point) | def clean_up_tmpfs(mount_point): """Unmounts a tmpfs storage under `mount_point`.""" umount_cmd = ["umount", "-t", "tmpfs", mount_point ] try: logging.info('Un-mounting tmpfs from %s' % mount_point) logging.debug('Executing: %s' % umount_cmd) run_cmd(*umount_cmd) except VMBuilderUserError: raise VMBuilderException( "Ca... |
self.uuid = run_cmd('blkid', '-p', '-sUUID', '-ovalue', self.filename).rstrip() | self.uuid = run_cmd('blkid', '-c', '/dev/null', '-sUUID', '-ovalue', self.filename).rstrip() | def mkfs(self): if not self.filename: raise VMBuilderException('We can\'t mkfs if filename is not set. Did you forget to call .create()?') if not self.dummy: cmd = self.mkfs_fstype() + [self.filename] run_cmd(*cmd) # Let udev have a chance to extract the UUID for us run_cmd('udevadm', 'settle') if os.path.exists("/sbin... |
if vm.hypervisor.preferred_storage == VMBuilder.hypervisor.STORAGE_FS_IMAGE: | if hypervisor.preferred_storage == VMBuilder.hypervisor.STORAGE_FS_IMAGE: | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
vm.add_filesystem(elements[1], default_filesystem, mntpnt='/') | hypervisor.add_filesystem(elements[1], default_filesystem, mntpnt='/') | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
vm.add_filesystem(elements[1], type='swap', mntpnt=None) | hypervisor.add_filesystem(elements[1], type='swap', mntpnt=None) | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
vm.add_filesystem(elements[1], type=default_filesystem, mntpnt=elements[0], devletter='', device=elements[2], dummy=(int(elements[1]) == 0)) | hypervisor.add_filesystem(elements[1], type=default_filesystem, mntpnt=elements[0], devletter='', device=elements[2], dummy=(int(elements[1]) == 0)) | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
vm.add_filesystem(elements[1], type=default_filesystem, mntpnt=elements[0]) | hypervisor.add_filesystem(elements[1], type=default_filesystem, mntpnt=elements[0]) | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
for line in file(part): | for line in file(self.options.part): | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
self.do_disk(vm, curdisk, size) | self.do_disk(hypervisor, curdisk, size) | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
disk = hypervisor.add_disk(size+1) | disk = hypervisor.add_disk(util.tmpfile(keep=False), size+1) | def do_disk(self, hypervisor, curdisk, size): default_filesystem = hypervisor.distro.preferred_filesystem() disk = hypervisor.add_disk(size+1) logging.debug("do_disk - size: %d" % size) offset = 0 for pair in curdisk: logging.debug("do_disk - part: %s, size: %s, offset: %d" % (pair[0], pair[1], offset)) if pair[0] == '... |
logging.debug("Setting timezone") self.set_timezone() | def install(self, destdir): raise VMBuilderException('Do not call this method!') | |
os.unlink('%s/etc/localtime' % self.context.chroot_dir) shutil.copy('%s/usr/share/zoneinfo/%s' % (self.context.chroot_dir, timezone), '%s/etc/localtime' % (self.context.chroot_dir,)) | self.install_from_template('/etc/timezone', 'timezone', { 'timezone' : timezone }) self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'tzdata') | def set_timezone(self): timezone = self.context.get_setting('timezone') if timezone: os.unlink('%s/etc/localtime' % self.context.chroot_dir) shutil.copy('%s/usr/share/zoneinfo/%s' % (self.context.chroot_dir, timezone), '%s/etc/localtime' % (self.context.chroot_dir,)) |
self.run_in_target('grub', '--device-map=%s' % devmapfile, '--batch', stdin='''root %s | self.suite.run_in_target('apt-get', 'install', 'strace') self.run_in_target('strace', '-f', 'grub', '--device-map=%s' % devmapfile, '--batch', stdin='''root %s | def install_bootloader(self, chroot_dir, disks): root_dev = VMBuilder.disk.bootpart(disks).get_grub_id() |
logging.debug("Copying ssh-key %s" % ssh_key) | def install_authorized_keys(self): ssh_key = self.context.get_setting('ssh-key') if ssh_key: logging.debug("Copying ssh-key %s" % ssh_key) os.mkdir('%s/root/.ssh' % self.context.chroot_dir, 0700) shutil.copy(ssh_key, '%s/root/.ssh/authorized_keys' % self.context.chroot_dir) os.chmod('%s/root/.ssh/authorized_keys' % sel... | |
group.add_setting('addpkg', type='list', metavar='PKG', help='Install PKG into the guest (can be specfied multiple times).') group.add_setting('removepkg', type='list', metavar='PKG', help='Remove PKG from the guest (can be specfied multiple times)') | group.add_setting('addpkg', type='list', metavar='PKG', help='Install PKG into the guest (can be specified multiple times).') group.add_setting('removepkg', type='list', metavar='PKG', help='Remove PKG from the guest (can be specified multiple times)') | def register_options(self): group = self.setting_group('Package options') group.add_setting('addpkg', type='list', metavar='PKG', help='Install PKG into the guest (can be specfied multiple times).') group.add_setting('removepkg', type='list', metavar='PKG', help='Remove PKG from the guest (can be specfied multiple time... |
os.chmod(script, stat.S_IRWXU | stat.S_IRWXU | stat.S_IROTH | stat.S_IXOTH) | os.chmod(script, stat.S_IRWXU | stat.S_IRWXG | stat.S_IROTH | stat.S_IXOTH) | def deploy(self, destdir): # No need create run script if vm is registered with libvirt if self.context.get_setting('libvirt'): return script = '%s/run.sh' % destdir fp = open(script, 'w') fp.write("#!/bin/sh\n\nexec %s\n" % ' '.join(self.cmdline)) fp.close() os.chmod(script, stat.S_IRWXU | stat.S_IRWXU | stat.S_IROTH... |
disk.add_part(offset, swapsize, 'swap', 'swap') offset += swapsize | if swapsize > 0: disk.add_part(offset, swapsize, 'swap', 'swap') offset += swapsize | def set_disk_layout(self, hypervisor): default_filesystem = hypervisor.distro.preferred_filesystem() if not self.options.part: rootsize = parse_size(self.options.rootsize) swapsize = parse_size(self.options.swapsize) optsize = parse_size(self.options.optsize) if hypervisor.preferred_storage == VMBuilder.hypervisor.STOR... |
self.suite.run_in_target('apt-get', 'install', 'strace') self.run_in_target('strace', '-f', 'grub', '--device-map=%s' % devmapfile, '--batch', stdin='''root %s | self.run_in_target('grub', '--device-map=%s' % devmapfile, '--batch', stdin='''root %s | def install_bootloader(self, chroot_dir, disks): root_dev = VMBuilder.disk.bootpart(disks).get_grub_id() |
if hasattr(self.vm, 'ec2') and self.context.ec2: | if hasattr(self.context, 'ec2') and self.context.ec2: | def xen_kernel_version(self): if self.suite.xen_kernel_flavour: # if this is ec2, do not call rmadison. # this could be replaced with a method to get most recent # stable kernel, but really, this is not used at all for ec2 if hasattr(self.vm, 'ec2') and self.context.ec2: logging.debug("selecting ec2 kernel") self.xen_k... |
if sline[2].strip().startswith(self.context.suite): | if sline[2].strip().startswith(self.context.get_setting('suite')): | def xen_kernel_version(self): if self.suite.xen_kernel_flavour: # if this is ec2, do not call rmadison. # this could be replaced with a method to get most recent # stable kernel, but really, this is not used at all for ec2 if hasattr(self.vm, 'ec2') and self.context.ec2: logging.debug("selecting ec2 kernel") self.xen_k... |
group.add_option('--raw', metavar='PATH', type='str', help="Specify a file (or block device) to as first disk image.") group.add_option('--part', metavar='PATH', type='str', help="Allows to specify a partition table in PATH each line of partfile should specify (root first): \n mountpoint size \none per line, separat... | group.add_option('--raw', metavar='PATH', type='str', help="Specify a file (or block device) to use as first disk image.") group.add_option('--part', metavar='PATH', type='str', help="Specify a partition table in PATH. Each line of partfile should specify (root first): \n mountpoint size \none per line, separated by... | def main(self): try: optparser = optparse.OptionParser() |
print "0x%x 0x%x 0x%x 0x%x" % head | def is_class(buff): """ checks that the data buffer has the magic numbers indicating it is a Java class file. Returns False if the magic numbers do not match, or for any errors. """ head = _unpack(">BBBB", buff) print "0x%x 0x%x 0x%x 0x%x" % head return head == (0xCA, 0xFE, 0xBA, 0xBE) | |
print repr(val) | print "repr CONST_Double", repr(val) | def _pretty_const_type_val(typecode, val): if typecode == CONST_Utf8: typestr = "Asciz" val = repr(val)[1:-1] elif typecode == CONST_Integer: typestr = "int" elif typecode == CONST_Float: typestr = "float" val = "%ff" % val elif typecode == CONST_Long: typestr = "long" val = "%il" % val elif typecode == CONST_Double: ... |
return _unpack(">BBBB", buff) == (0xCA, 0xFE, 0xBA, 0xBE) | head = _unpack(">BBBB", buff) print "0x%x 0x%x 0x%x 0x%x" % head return head == (0xCA, 0xFE, 0xBA, 0xBE) | def is_class(buff): """ checks that the data buffer has the magic numbers indicating it is a Java class file. Returns False if the magic numbers do not match, or for any errors. """ try: return _unpack(">BBBB", buff) == (0xCA, 0xFE, 0xBA, 0xBE) except: return False |
print "skipping non-jar:", entry | def cli_compare_dirs(options, leftd, rightd): from dirdelta import compare, LEFT, RIGHT, SAME, DIFF from os.path import join for event,entry in compare(leftd, rightd): if not fnmatches(("*.jar","*.sar","*.ear","*.war"), entry): # skip non-JARs. This is a terrible way to test for this, # but I am in a hurry. print "ski... | |
pass | continue | def cli_compare_dirs(options, leftd, rightd): from dirdelta import compare, LEFT, RIGHT, SAME, DIFF from os.path import join for event,entry in compare(leftd, rightd): if not fnmatches(("*.jar","*.sar","*.ear","*.war"), entry): # skip non-JARs. This is a terrible way to test for this, # but I am in a hurry. print "ski... |
k = s.read(71) | k = s.read(70) | def store_item(k, v, stream): """ The MANIFEST specification limits the width of individual lines to 72 bytes (including the terminating newlines). Any key and value pair that would be longer must be split up over multiple continuing lines""" from StringIO import StringIO v = v or "" if len(k) + len(v) > 69: s = Str... |
mat = data.correlationMatrix( angles ) | mat = data.correlationMatrix( others ) | def doit(name, angles, tree, irange, lrange, mrange ) : # TODO: veto signal mass window... or use sweight to veto signal # TODO: use sweights to split J/psi from mumu combinatoric # TODO: veto insignifcant moments iff i,l,abs(m)>2 (i.e. those not in signal PDF!) data = RooDataSet('data','data',tree,angles) ab = abasis(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.