query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Add an isosurface to this item.
def addIsosurface(self, level, color): isosurface = self._Isosurface(parent=self) isosurface.setColor(color) if callable(level): isosurface.setAutoLevelFunction(level) else: isosurface.setLevel(level) isosurface.sigItemChanged.connect(self._isosurfaceItemChanged) self._isosurfaces.append(isosurface) self._updateIsosurfaces() self.sigIsosurfaceAdded.emit(isosurface) return isosurface
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_surface(self,s):\n self.surfaces.append(s)\n s.system=self.surfaces", "def _addClicked(self):\n volume = self.volume()\n if volume is not None:\n dataRange = volume.getDataRange()\n if dataRange is None:\n dataRange = 0., 1.\n\n ...
[ "0.6740248", "0.62558913", "0.60210866", "0.5904212", "0.5893358", "0.577374", "0.53729206", "0.52408725", "0.519066", "0.5183285", "0.5161759", "0.5116448", "0.5109245", "0.5073585", "0.5032729", "0.5032729", "0.5009403", "0.4923389", "0.49232364", "0.4879343", "0.48575088",...
0.72267526
0
Remove an isosurface from this item.
def removeIsosurface(self, isosurface): if isosurface not in self.getIsosurfaces(): _logger.warning( "Try to remove isosurface that is not in the list: %s", str(isosurface)) else: isosurface.sigItemChanged.disconnect(self._isosurfaceItemChanged) self._isosurfaces.remove(isosurface) self._updateIsosurfaces() self.sigIsosurfaceRemoved.emit(isosurface)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _removeClicked(self):\n isosurface = self.isosurface()\n if isosurface is not None:\n volume = isosurface.parent()\n if volume is not None:\n volume.removeIsosurface(isosurface)", "def isosurface(self):\n return self._isosurface()", "def remove(self...
[ "0.7447585", "0.58254415", "0.5618442", "0.557807", "0.5543547", "0.54468757", "0.5415708", "0.54150975", "0.53558755", "0.533654", "0.53338057", "0.5329659", "0.53128797", "0.5312818", "0.5301393", "0.52970207", "0.52678525", "0.5265467", "0.52498937", "0.5239983", "0.523310...
0.8135996
0
Handle update of isosurfaces upon level changed
def _isosurfaceItemChanged(self, event): if event == Item3DChangedType.ISO_LEVEL: self._updateIsosurfaces()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _updated(self, event=None):\n if event == ItemChangedType.COMPLEX_MODE:\n self._syncDataWithParent()\n\n elif event in (ItemChangedType.COLORMAP,\n Item3DChangedType.INTERPOLATION):\n self._updateScenePrimitive()\n super(ComplexIsosurface, self)....
[ "0.6973583", "0.6578195", "0.6466973", "0.62059677", "0.6089591", "0.5909208", "0.5899945", "0.5825903", "0.57568187", "0.5703271", "0.5698263", "0.5687134", "0.56855094", "0.5576002", "0.55106765", "0.547519", "0.54643226", "0.54612565", "0.5458047", "0.5452608", "0.54472446...
0.81053317
0
Handle updates of isosurfaces level and add/remove
def _updateIsosurfaces(self): # Sorting using minus, this supposes data 'object' to be max values sortedIso = sorted(self.getIsosurfaces(), key=lambda isosurface: - isosurface.getLevel()) self._isogroup.children = [iso._getScenePrimitive() for iso in sortedIso]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isosurfaceItemChanged(self, event):\n if event == Item3DChangedType.ISO_LEVEL:\n self._updateIsosurfaces()", "def _updated(self, event=None):\n if event == ItemChangedType.COMPLEX_MODE:\n self._syncDataWithParent()\n\n elif event in (ItemChangedType.COLORMAP,\n ...
[ "0.7572625", "0.6483485", "0.62844723", "0.6087187", "0.60834914", "0.5838356", "0.58052474", "0.57790345", "0.57654625", "0.56409895", "0.5590038", "0.5531311", "0.552662", "0.55226326", "0.54919386", "0.5402099", "0.5401069", "0.53722477", "0.5337533", "0.5290507", "0.52768...
0.6803121
1
Returns the list of items currently present in this item.
def getItems(self): return self.getCutPlanes() + self.getIsosurfaces()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_items(self):\n return self.item_list", "def get_items(self) -> list:\r\n return self._items", "def items(self) -> List[Item]:\n return self._items", "def get_all_items(self):\n return self.api.state['items']", "def items(self):\n return [x.item for x in self]", ...
[ "0.8302771", "0.82145596", "0.80660933", "0.7957701", "0.79011357", "0.7892576", "0.7880532", "0.7875717", "0.7802759", "0.7696309", "0.7644806", "0.762694", "0.75896615", "0.7539122", "0.735725", "0.7353106", "0.7332338", "0.732954", "0.7262226", "0.7146134", "0.7119999", ...
0.0
-1
Synchronize this instance data with that of its parent
def _syncDataWithParent(self): parent = self.parent() if parent is None: data, range_ = None, None else: mode = self.getComplexMode() data = parent.getData(mode=mode, copy=False) range_ = parent.getDataRange(mode=mode) self._updateData(data, range_)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _syncDataWithParent(self):\n parent = self.parent()\n if parent is None:\n self._data = None\n else:\n self._data = parent.getData(copy=False)\n self._updateScenePrimitive()", "def _syncDataWithParent(self):\n parent = self.parent()\n if parent ...
[ "0.8105605", "0.80830806", "0.7733652", "0.71153784", "0.71153784", "0.70563495", "0.7043718", "0.674526", "0.65729344", "0.6530828", "0.64562", "0.6451494", "0.6362502", "0.6362502", "0.6325555", "0.63112843", "0.6255493", "0.6245364", "0.6242624", "0.619789", "0.61851496", ...
0.7977319
2
Handle update of the cut plane (and take care of mode change
def _updated(self, event=None): if event == ItemChangedType.COMPLEX_MODE: self._syncDataWithParent() super(ComplexCutPlane, self)._updated(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plane_update(self):\n self.plane.update()", "def _update(self):\n self.cv.update()", "def onUpdateFactors(self, evt):\n\t\tif self.blockFactorUpdate:\n\t\t\tprint \"Blocking factor update\"\n\t\t\treturn\n\t\tx, y, z = self.dataUnits[0].dataSource.getOriginalDimensions()\n\t\tfx = 1\n\t\tfy =...
[ "0.6893299", "0.60525465", "0.58858526", "0.5834753", "0.5762848", "0.5702077", "0.5648497", "0.5648258", "0.56118804", "0.56109047", "0.55797815", "0.55794543", "0.55765516", "0.5570159", "0.5562381", "0.55067044", "0.550493", "0.54722816", "0.54584134", "0.5452447", "0.5450...
0.6976842
0
Handle update of color
def _updateColor(self, color): primitive = self._getScenePrimitive() if (len(primitive.children) != 0 and isinstance(primitive.children[0], primitives.ColormapMesh3D)): primitive.children[0].alpha = self._color[3] else: super(ComplexIsosurface, self)._updateColor(color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_color(self, color):\n self.color = color", "def _update_color(self, *args):\n\n if self._variable and 'w' in self._mode and not self._dnd_started:\n self._internal_color_change = True\n self.color_var.set(self._variable)", "def update_color(self):\r\n \r\n ...
[ "0.792751", "0.7712366", "0.77086216", "0.7582702", "0.72797334", "0.7251339", "0.72495466", "0.7238376", "0.72019273", "0.7178436", "0.7135327", "0.69967073", "0.69614214", "0.69462603", "0.6907712", "0.68813443", "0.6823944", "0.6820552", "0.6733206", "0.67252445", "0.66873...
0.659273
26
Synchronize this instance data with that of its parent
def _syncDataWithParent(self): parent = self.parent() if parent is None: self._data = None else: self._data = parent.getData( mode=parent.getComplexMode(), copy=False) if parent is None or self.getComplexMode() == self.ComplexMode.NONE: self._setColormappedData(None, copy=False) else: self._setColormappedData( parent.getData(mode=self.getComplexMode(), copy=False), copy=False) self._updateScenePrimitive()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _syncDataWithParent(self):\n parent = self.parent()\n if parent is None:\n self._data = None\n else:\n self._data = parent.getData(copy=False)\n self._updateScenePrimitive()", "def _syncDataWithParent(self):\n parent = self.parent()\n if parent ...
[ "0.8105605", "0.80830806", "0.7977319", "0.71153784", "0.71153784", "0.70563495", "0.7043718", "0.674526", "0.65729344", "0.6530828", "0.64562", "0.6451494", "0.6362502", "0.6362502", "0.6325555", "0.63112843", "0.6255493", "0.6245364", "0.6242624", "0.619789", "0.61851496", ...
0.7733652
3
Handle data change in the parent this isosurface belongs to
def _parentChanged(self, event): if event == ItemChangedType.COMPLEX_MODE: self._syncDataWithParent() super(ComplexIsosurface, self)._parentChanged(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _updated(self, event=None):\n if event == ItemChangedType.COMPLEX_MODE:\n self._syncDataWithParent()\n\n elif event in (ItemChangedType.COLORMAP,\n Item3DChangedType.INTERPOLATION):\n self._updateScenePrimitive()\n super(ComplexIsosurface, self)....
[ "0.7281809", "0.6798219", "0.663362", "0.6617056", "0.6495038", "0.63887423", "0.63887423", "0.63203007", "0.6309291", "0.62671393", "0.6239306", "0.6219209", "0.6177352", "0.6040155", "0.59989554", "0.5994137", "0.59767103", "0.5967239", "0.5934066", "0.5895432", "0.58403164...
0.78250813
0
Handle update of the isosurface (and take care of mode change)
def _updated(self, event=None): if event == ItemChangedType.COMPLEX_MODE: self._syncDataWithParent() elif event in (ItemChangedType.COLORMAP, Item3DChangedType.INTERPOLATION): self._updateScenePrimitive() super(ComplexIsosurface, self)._updated(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isosurfaceItemChanged(self, event):\n if event == Item3DChangedType.ISO_LEVEL:\n self._updateIsosurfaces()", "def update_flags(self):\n # view mode, filled vs wirefrom\n if self.view['wireframe']:\n gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)\n else:\...
[ "0.72574514", "0.6297322", "0.62271756", "0.6138882", "0.6094875", "0.6022466", "0.6002216", "0.6002216", "0.5986893", "0.5943191", "0.59352255", "0.59275275", "0.59257054", "0.5873895", "0.58552265", "0.5850752", "0.5833824", "0.57953125", "0.5777924", "0.5773839", "0.577058...
0.750728
0
Set the 3D complex data represented by this item. Dataset order is zyx (i.e., first dimension is z).
def setData(self, data, copy=True): if data is None: self._data = None self._dataRangeCache = None self._boundedGroup.shape = None else: data = numpy.array(data, copy=copy, dtype=numpy.complex64, order='C') assert data.ndim == 3 assert min(data.shape) >= 2 self._data = data self._dataRangeCache = {} self._boundedGroup.shape = self._data.shape self._updated(ItemChangedType.DATA)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setitem3d(self, index, value):\n ix = index[0]\n iy = index[1]\n iz = index[2]\n\n lovects = self._getlovects()\n hivects = self._gethivects()\n fields = self._getfields()\n\n if len(index) > self.dim:\n if ncomps > 1:\n ic = index[-1]...
[ "0.6401612", "0.6063972", "0.6011041", "0.5975089", "0.5953853", "0.59492946", "0.5900088", "0.58977884", "0.58162755", "0.5780997", "0.57658124", "0.5763134", "0.5757174", "0.57559294", "0.5752819", "0.5680372", "0.56681836", "0.56602615", "0.5607443", "0.5574102", "0.555902...
0.5670554
16
Return 3D dataset. This method does not cache data converted to a specific mode, it computes it for each request.
def getData(self, copy=True, mode=None): if mode is None: return super(ComplexField3D, self).getData(copy=copy) else: return self._convertComplexData(self._data, mode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def D3(self, *args):\n return _Adaptor3d.Adaptor3d_Surface_D3(self, *args)", "def get_3d_train(self, jnts=14):\n\n to_select, to_sort = dataset_indices(self.dataset_name, jnts)\n\n return self._data_train['3d'][:, to_select, :][:, to_sort, :]", "def get_dataset(self, cid, type=\"train\"):\...
[ "0.60187584", "0.59878784", "0.58777374", "0.58265644", "0.58206046", "0.5816656", "0.5816164", "0.57970816", "0.57919204", "0.5772738", "0.57650393", "0.57250017", "0.5724938", "0.5707195", "0.5686548", "0.5647479", "0.5564669", "0.55568475", "0.5537837", "0.5516145", "0.550...
0.6331602
0
Return the range of the requested data as a 3tuple of values. Positive min is NaN if no data is positive.
def getDataRange(self, mode=None): if self._dataRangeCache is None: return None if mode is None: mode = self.getComplexMode() if mode not in self._dataRangeCache: # Compute it and store it in cache data = self.getData(copy=False, mode=mode) self._dataRangeCache[mode] = self._computeRangeFromData(data) return self._dataRangeCache[mode]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _computeRangeFromData(data):\n if data is None:\n return None\n\n dataRange = min_max(data, min_positive=True, finite=True)\n if dataRange.minimum is None: # Only non-finite data\n return None\n\n if dataRange is not None:\n min_positive = dataRange...
[ "0.8155307", "0.7806243", "0.73593587", "0.7330732", "0.7230256", "0.72106385", "0.7186712", "0.7147313", "0.7062318", "0.69120955", "0.6874664", "0.6780946", "0.67772317", "0.6763518", "0.6762277", "0.6691655", "0.6686971", "0.66690457", "0.659863", "0.65986276", "0.6585736"...
0.0
-1
Forward implementation, going through the complete flow $f_{\phi}$.
def forward(self, x: Tensor, covariates: Tensor) -> Tuple[Tensor, Tensor, Tensor]: return self.real_nvp(x, covariates)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_forward(self):", "def forward(self, x):\n pass", "def forward(self, inputs):\r\n #print (len(inputs))\r\n out = self.fc1(inputs)\r\n out = self.fc2(out)\r\n self.out = out\r\n return out\r\n #raise NotImplementedError('Implement the forward method of th...
[ "0.6307234", "0.63024616", "0.6222227", "0.6175904", "0.6175904", "0.6155502", "0.61270106", "0.61270106", "0.6118309", "0.60926515", "0.60638916", "0.60609066", "0.605443", "0.6050017", "0.6004105", "0.59371006", "0.5925121", "0.5920974", "0.5920974", "0.5920974", "0.5911123...
0.0
-1
Go through the flow in reverse direction, i.e. $f_{\phi}^{1}$.
def inverse(self, u: Tensor, covariates: Tensor) -> Tensor: return self.real_nvp.inverse(u, covariates)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def back(self, step):\r\n self.forward(-step)", "def backward(self):\n #print('backward\\r')\n self.linearVector = Vector3(x=-1.0, y=0.0, z=0.0)\n self.angularVector = Vector3(x=0.0, y=0.0, z=0.0)", "def right_backward(self):\n self.right_motor.run_forever(speed_sp=-self.MAX...
[ "0.6866659", "0.6588461", "0.65301454", "0.6521583", "0.65055853", "0.6387518", "0.6372426", "0.62705827", "0.62705827", "0.62705827", "0.62369365", "0.6212663", "0.6203503", "0.6184255", "0.6184255", "0.6184255", "0.61603993", "0.61086434", "0.61086434", "0.61086434", "0.610...
0.0
-1
Population prior, i.e. $Categorical(\pi)$.
def prior_z(self) -> distributions.Distribution: return distributions.Categorical(self.pi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_prior_name(self):\n dim = Dimension(\"yolo\", \"reciprocal\", 1e-10, 1)\n assert dim.prior_name == \"reciprocal\"\n\n dim = Dimension(\"yolo\", \"norm\", 0.9)\n assert dim.prior_name == \"norm\"\n\n dim = Real(\"yolo\", \"uniform\", 1, 2)\n assert dim.prior_name =...
[ "0.6308094", "0.6022625", "0.5991592", "0.5984886", "0.5965109", "0.5834765", "0.58280075", "0.57996655", "0.57636964", "0.57478815", "0.57455534", "0.56727767", "0.56464076", "0.559691", "0.5589314", "0.55594623", "0.5548906", "0.55311286", "0.55226177", "0.5502985", "0.5502...
0.6626557
0
Log population weights $log \; \pi$.
def log_pi(self) -> Tensor: return torch.log_softmax(self.pi_logit_ratio * self.pi_logit, dim=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_log(val):\n return val * math.log(val)", "def log_prob(self):", "def my_loglike(theta, x, data, sigma):\n\n model = my_model(theta, x)\n\n return -0.5*len(x)*np.log(2*math.pi*sigma**2) - (0.5/sigma**2) * np.sum((data-model)**2)", "def loglike(store):\n nobs = store['yvec'].shape[0]\n ...
[ "0.75484306", "0.74073654", "0.6920241", "0.69167686", "0.6878915", "0.6841056", "0.6841056", "0.68350965", "0.6828722", "0.68049484", "0.6777457", "0.6776188", "0.6734402", "0.6714555", "0.6667137", "0.66558814", "0.6647851", "0.6641693", "0.6629896", "0.6627645", "0.6611287...
0.62821656
64
Compute the log weights with temperature $log \; \pi^{(T)}$
def log_pi_temperature(self, T: float) -> Tensor: return torch.log_softmax(self.pi_logit_ratio * self.pi_logit / T, dim=0).detach()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_log(val):\n return val * math.log(val)", "def logTF(self, tf):\n return math.log(tf)", "def theil(x, weights):\n assert numpy.all(x >= 0), \"negative numbers can't be used in Theil\"\n x_mean = numpy.average(x, weights=weights) + 1e-100\n normed = x / x_mean\n normed[normed < 1...
[ "0.7621643", "0.69197744", "0.6796218", "0.6738715", "0.6605438", "0.6519413", "0.65133", "0.65053755", "0.64697593", "0.6465963", "0.64617324", "0.6432319", "0.64254224", "0.6399813", "0.6398325", "0.63717324", "0.6365299", "0.63402146", "0.6339453", "0.6321659", "0.6321659"...
0.676322
3
Compute probabilities used in the loss function.
def compute_probabilities( self, x: Tensor, covariates: Tensor, use_temp: bool = False ) -> Tuple[Tensor, Tensor, Tensor]: u, _, ldj_sum = self(x, covariates) log_pi = ( self.log_pi_temperature(-self.hparams.temperature) if use_temp else self.log_pi ) log_probs = self.prior.log_prob(u) + log_pi # size N x P return log_probs, ldj_sum, u
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probabilities(self):\n raise NotImplementedError", "def get_probability_loss(self):\n return sum(self._loss)/len(self._loss)", "def get_probs(self, a):\n with torch.no_grad():\n probabilities = (np.array(self.priorities) ** a) / sum(np.array(self.priorities) ** a)\n r...
[ "0.7476701", "0.7470944", "0.7260153", "0.72360164", "0.7207925", "0.71791935", "0.69240594", "0.69167626", "0.6853515", "0.68420863", "0.68305", "0.6796231", "0.67783356", "0.67678964", "0.6767037", "0.67276955", "0.6719253", "0.66585714", "0.66527164", "0.66472435", "0.6636...
0.0
-1
Compute the module loss for one minibatch.
def kl( self, x: Tensor, covariates: Tensor, use_temp: bool, ) -> Tuple[Tensor, Tensor]: log_probs, ldj_sum, _ = self.compute_probabilities(x, covariates, use_temp) return -(torch.logsumexp(log_probs, dim=1) + ldj_sum).mean()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_loss(self):", "def compute_loss(self):\n self.test_logits = self.compute_logits()\n loss = tf.nn.sparse_softmax_cross_entropy_with_logits(\n labels=self.data.test_labels, logits=self.test_logits)\n cross_entropy_loss = tf.reduce_mean(loss)\n regularization = tf.reduce_sum(\n ...
[ "0.7217973", "0.69893515", "0.69603366", "0.68529373", "0.6852118", "0.6713502", "0.66971284", "0.6693088", "0.6590194", "0.6569734", "0.6569734", "0.6549821", "0.6538307", "0.6513913", "0.64711624", "0.64643025", "0.6439348", "0.6421351", "0.640085", "0.6387436", "0.6382425"...
0.0
-1
Test vertex_areas. Vertex area is the area of all of the triangles who are in contact
def test_vertex_areas(self, faces, point): number_of_contact_faces = gs.array([3, 5, 5, 5, 5, 5, 3, 5]) triangle_area = 0.5 * 2 * 2 expected = 2 * (number_of_contact_faces * triangle_area) / 3 space = self.Space(faces) result = space.vertex_areas(point) assert result.shape == (8,) assert expected.shape == (8,) assert gs.allclose(result, expected), result point = gs.array([point, point]) expected = gs.array([expected, expected]) result = space.vertex_areas(point) assert point.shape == (2, 8, 3) assert result.shape == (2, 8), result.shape assert gs.allclose(result, expected), result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_triangle_area():\n v1 = (0,0); v2 = (1,0); v3 = (0,2)\n verticies = [v1,v2,v3]\n expected = 1\n computed = get_triangle_area(verticies)\n tol = 1E-14\n success = abs(expected-computed) < tol\n msg = 'computed area={} != {} (expected)'.format(computed,expected)\n assert success,...
[ "0.7278366", "0.7158183", "0.68438345", "0.67501736", "0.66490245", "0.6619761", "0.658673", "0.6489864", "0.64847827", "0.63019234", "0.6286598", "0.6198661", "0.618283", "0.61759", "0.61708784", "0.61697274", "0.61374867", "0.6110089", "0.606067", "0.59845203", "0.5979044",...
0.8256436
0
Test normals. We test this on a space whose initializing point is a cube, and we test the function on a cube with sides of length 2 centered at the origin. The cube is meshed with 12 triangles (2 triangles per face.) Recall that the magnitude of each normal vector is equal to the area of the face it is normal to.
def test_normals(self, faces, point): space = self.Space(faces=faces) cube_normals = gs.array( [ [0.0, 0.0, 2.0], [0.0, 0.0, 2.0], [0.0, 2.0, 0.0], [0.0, 2.0, 0.0], [2.0, 0.0, 0.0], [2.0, 0.0, 0.0], [0.0, -2.0, 0.0], [0.0, -2.0, 0.0], [-2.0, 0.0, 0.0], [-2.0, 0.0, 0.0], [0.0, 0.0, -2.0], [0.0, 0.0, -2.0], ] ) expected = cube_normals result = space.normals(point) are_close = [ (gs.allclose(res, exp) or gs.allclose(res, -exp)) for res, exp in zip(result, expected) ] assert gs.all(are_close) point = gs.array([point, point]) result = space.normals(point) are_close_0 = [ (gs.allclose(res, exp) or gs.allclose(res, -exp)) for res, exp in zip(result[0], expected) ] are_close_1 = [ (gs.allclose(res, exp) or gs.allclose(res, -exp)) for res, exp in zip(result[1], expected) ] assert gs.all(gs.array([are_close_0, are_close_1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_surface_normal(self):\n vertices = np.array([[0, 1, 0], [0, 0, 0], [1, 0, 0]])\n expected = np.array([0, 0, 1])\n np.testing.assert_almost_equal(surface_normal(vertices), expected)\n\n # Test against multiple triangles\n vertices = np.r_[vertices[np.newaxis, :, :], [[[0,...
[ "0.7417501", "0.7163587", "0.71501", "0.7141003", "0.6889132", "0.6833686", "0.6778833", "0.66802526", "0.6537442", "0.65106905", "0.64550817", "0.64479667", "0.6442539", "0.6430552", "0.6334144", "0.6329478", "0.6270688", "0.62549996", "0.6243213", "0.6220221", "0.61403275",...
0.7896348
0
Test surface one forms.
def test_surface_one_forms(self, faces, point): space = self.Space(faces=faces) result = space.surface_one_forms(point=point) assert result.shape == (space.n_faces, 2, 3), result.shape first_vec = result[:, 0, :] second_vec = result[:, 1, :] inner_prods = gs.einsum("ni,ni->n", first_vec, second_vec) result = [prod in [0.0, 4.0] for prod in inner_prods] assert gs.all(result) singleton_point = gs.expand_dims(point, axis=0) result = space.surface_one_forms(point=singleton_point) assert result.shape == (1, space.n_faces, 2, 3) point = gs.array([point, point]) result = space.surface_one_forms(point=point) assert result.shape == (2, space.n_faces, 2, 3) first_vec = result[:, :, 0, :] second_vec = result[:, :, 1, :] inner_prods = gs.einsum("mni,mni->mn", first_vec, second_vec) result = [] for inner_prod in inner_prods: result.append([prod in [0.0, 4.0] for prod in inner_prod]) assert gs.all(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_contains_forms(self):\n response = self.client.get(self.url)\n \n first_author_form = response.context.get('first_author_form')\n authors_fs = response.context.get('authors_fs')\n book_form = response.context.get('book_form')\n language_form = response.context.get...
[ "0.67187005", "0.66679955", "0.6620312", "0.6506094", "0.6404817", "0.63322777", "0.6299859", "0.62120825", "0.6142838", "0.6095488", "0.6078851", "0.6059996", "0.6051694", "0.6024828", "0.6017514", "0.59854054", "0.5980818", "0.59628683", "0.5926908", "0.59222543", "0.591568...
0.0
-1
Test surface metric matrices.
def test_surface_metric_matrices(self, faces, point): space = self.Space(faces=faces) result = space.surface_metric_matrices(point=point) assert result.shape == ( space.n_faces, 2, 2, ), result.shape point = gs.array([point, point]) result = space.surface_metric_matrices(point=point) assert result.shape == (2, space.n_faces, 2, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_metric_matrices(self, point):\n one_forms = self.surface_one_forms(point)\n\n return self._surface_metric_matrices_from_one_forms(one_forms)", "def test_symmetry_surface_average_2(self):\n\n def test(grid, basis, true_avg=1):\n transform = Transform(grid, basis)\n\n ...
[ "0.6212602", "0.60263664", "0.6011479", "0.59304386", "0.5858633", "0.5743929", "0.5703311", "0.5686523", "0.5677409", "0.56035334", "0.55897456", "0.5561343", "0.5554519", "0.55176467", "0.5503147", "0.5501849", "0.5489476", "0.5488244", "0.5445561", "0.5432928", "0.54146785...
0.743953
0
Check that energy of a path of surfaces is positive at each timestep.
def test_path_energy_per_time_is_positive( self, space, a0, a1, b1, c1, d1, a2, path, atol ): n_times = len(path) space.equip_with_metric(self.Metric, a0=a0, a1=a1, b1=b1, c1=c1, d1=d1, a2=a2) energy = space.metric.path_energy_per_time(path) self.assertAllEqual(energy.shape, (n_times - 1, 1)) result = gs.all(energy > -1 * atol) self.assertTrue(result) expected_shape = (2, n_times - 1, 1) path = gs.array([path, path]) energy = space.metric.path_energy_per_time(path) self.assertAllEqual(energy.shape, expected_shape) result = gs.all(energy > -1 * atol) self.assertTrue(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_path_energy_is_positive(self, space, a0, a1, b1, c1, d1, a2, path, atol):\n space.equip_with_metric(self.Metric, a0=a0, a1=a1, b1=b1, c1=c1, d1=d1, a2=a2)\n\n energy = space.metric.path_energy(path)\n self.assertAllEqual(energy.shape, ())\n result = gs.all(energy > -1 * atol)\n...
[ "0.728073", "0.589016", "0.58340615", "0.56767166", "0.5647796", "0.56435287", "0.56361413", "0.5609778", "0.5564585", "0.55382043", "0.5497689", "0.5426183", "0.5391233", "0.5343787", "0.5343612", "0.5332643", "0.5260981", "0.5248749", "0.5233796", "0.52206767", "0.5216022",...
0.719298
1
Check that energy of a path of surfaces is positive at each timestep.
def test_path_energy_is_positive(self, space, a0, a1, b1, c1, d1, a2, path, atol): space.equip_with_metric(self.Metric, a0=a0, a1=a1, b1=b1, c1=c1, d1=d1, a2=a2) energy = space.metric.path_energy(path) self.assertAllEqual(energy.shape, ()) result = gs.all(energy > -1 * atol) self.assertTrue(result) path = gs.array([path, path]) energy = space.metric.path_energy(path) self.assertAllEqual(energy.shape, (2,)) result = gs.all(energy > -1 * atol) self.assertTrue(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_path_energy_per_time_is_positive(\n self, space, a0, a1, b1, c1, d1, a2, path, atol\n ):\n n_times = len(path)\n space.equip_with_metric(self.Metric, a0=a0, a1=a1, b1=b1, c1=c1, d1=d1, a2=a2)\n\n energy = space.metric.path_energy_per_time(path)\n\n self.assertAllEqual...
[ "0.719298", "0.589016", "0.58340615", "0.56767166", "0.5647796", "0.56435287", "0.56361413", "0.5609778", "0.5564585", "0.55382043", "0.5497689", "0.5426183", "0.5391233", "0.5343787", "0.5343612", "0.5332643", "0.5260981", "0.5248749", "0.5233796", "0.52206767", "0.5216022",...
0.728073
0
goes through each neuron, each neuron has a chance of mutating equal to the learning rate of the network. There is a 20% chance of a physical mutation.
def mutate(self): #First, mutate masses for neuronNum in range(self.neuronCounter - 1): if self.learningRate > random.random(): self.neurons[neuronNum].mutate() else: continue #Now determine physical mutations if random.random() < 0.2: try: physMutation = random.choice(['a','l','c']) if physMutation == 'a': self.addNeuron(random.choice([0,1,2])) elif physMutation == 'l': begin = random.randint(1,self.neuronCounter - 1) end = random.randint(1, self.neuronCounter - 1) self.link(begin, end) else: begin = random.randint(1,self.neuronCounter - 1) end = random.choice(self.neurons[begin].outDic.keys()) self.cut(begin, end) except: return self return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate_nonstructural(self):\n # TODO consider clamping weights and biases?\n for link in self.gene_links:\n # Disable/Enable links\n if event(link_toggle_prob): # Chance of toggling link\n link.enabled = True if link.enabled is False else False\n i...
[ "0.7139885", "0.6918553", "0.6862937", "0.67987317", "0.6480224", "0.6446079", "0.64306605", "0.63981", "0.6360692", "0.6357444", "0.62559646", "0.62238425", "0.61995184", "0.61872697", "0.6183759", "0.6120707", "0.6096974", "0.6002629", "0.60015005", "0.599701", "0.59915847"...
0.78212637
0
Create an entry for the flow.
async def async_oauth_create_entry(self, data): await self.async_set_unique_id(unique_id=f"{DOMAIN}Cloud") return self.async_create_entry(title=f"{DOMAIN}Cloud", data=data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_entry(entry):\n Entry.create(**entry)\n return entry", "def create_entry(self, entry_group_name, entry_id, entry):\n try:\n entry = self.__datacatalog.create_entry(parent=entry_group_name,\n entry_id=entry_id,\n ...
[ "0.7608277", "0.6764989", "0.6709134", "0.6657233", "0.65733117", "0.64365363", "0.6302687", "0.6290588", "0.6275084", "0.6263564", "0.62014914", "0.62014914", "0.6190114", "0.615221", "0.614616", "0.6126723", "0.61106926", "0.60714495", "0.60638577", "0.6062632", "0.60251296...
0.65311766
5
Handle a flow initiated by the user.
async def async_step_user(self, user_input=None): # If there is a CLOUD entry already, abort a new LOCAL entry if self.is_cloud_device_already_added(): return self.async_abort(reason="already_configured_device") return await self.async_step_environment()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(self, flow: mitmproxy.http.HTTPFlow):\n pass", "async def flow(self, session: ClientSession, data: Dict) -> None:", "def action(self):\n current_action = self.get_script_entry()\n if current_action[\"type\"] == \"request\":\n self._handle_request(current_action)\n ...
[ "0.6017324", "0.59390163", "0.5888961", "0.5822091", "0.58176124", "0.5810652", "0.57601875", "0.57601875", "0.57484925", "0.57093275", "0.5647356", "0.5628661", "0.56186384", "0.55906844", "0.5579503", "0.55780405", "0.5541484", "0.5533322", "0.5515994", "0.5509516", "0.5508...
0.0
-1
Decide environment, cloud or local.
async def async_step_environment(self, user_input=None): if user_input is None: return self.async_show_form( step_id="environment", data_schema=vol.Schema( { vol.Required("environment", default=ENV_CLOUD): vol.In( [ENV_CLOUD, ENV_LOCAL] ) } ), errors={}, ) # Environment chosen, request additional host information for LOCAL or OAuth2 flow for CLOUD # Ask for host detail if user_input["environment"] == ENV_LOCAL: return await self.async_step_local() # Abort cloud option if a LOCAL entry has already been added if user_input["environment"] == ENV_CLOUD and self._async_current_entries(): return self.async_abort(reason="already_configured_local_device") return await self.async_step_pick_implementation()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_environment():\n # Auto-set settings object based on App Engine dev environ\n if 'SERVER_SOFTWARE' in os.environ:\n if os.environ['SERVER_SOFTWARE'].startswith('Dev'):\n return Config.ENV_LOCAL\n elif os.environ['SERVER_SOFTWARE'].startswith('Google App Engine/'):\n ...
[ "0.69293857", "0.69236493", "0.6797534", "0.67813027", "0.6735507", "0.66701186", "0.66018623", "0.6579463", "0.6422409", "0.6391686", "0.6374094", "0.6291594", "0.62128055", "0.6179286", "0.61659306", "0.61260915", "0.61217046", "0.61181223", "0.60868585", "0.6076432", "0.60...
0.61509675
15
Check if a CLOUD device has already been added.
def is_cloud_device_already_added(self): for entry in self._async_current_entries(): if entry.unique_id is not None and entry.unique_id == f"{DOMAIN}Cloud": return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_exists(device):\n return os.path.exists('/sys/class/net/%s' % device)", "def addDevice(self, device):\n if device.name in self.devices:\n log.error(\"'%s' already part of '%s'\", device.name, self.name)\n else:\n self.devices[device.name] = device\n return...
[ "0.6239254", "0.609345", "0.609345", "0.609345", "0.6073092", "0.6065576", "0.6047093", "0.5987568", "0.5987568", "0.5947811", "0.58741647", "0.58736914", "0.58404255", "0.58278227", "0.5810434", "0.5785578", "0.5772156", "0.57598025", "0.5751442", "0.5747727", "0.57093596", ...
0.8269784
0
Convert data types in a pandas dataframe. Purpose is to reduce size of dataframe.
def convert_types(df): # Iterate through each column for c in df: # Convert ids and booleans to integers if ('SK_ID' in c): df[c] = df[c].fillna(0).astype(np.int32) # Convert objects to category elif (df[c].dtype == 'object') and (df[c].nunique() < df.shape[0]): df[c] = df[c].astype('category') # Booleans mapped to integers elif list(df[c].unique()) == [1, 0]: df[c] = df[c].astype(bool) # Float64 to float32 elif df[c].dtype == float: df[c] = df[c].astype(np.float32) # Int64 to int32 elif df[c].dtype == int: df[c] = df[c].astype(np.int32) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_dtype(data_df, settings):\n data_df = data_df.astype(settings[\"dtype\"])\n return data_df", "def test_df_all_types():\n return pd.DataFrame({\n 'intcol': [1, 2],\n 'strcol': ['three', 'four'],\n 'floatcol': [5.0, 6.0],\n 'boolcol': [True, False],\n 'dateti...
[ "0.74301016", "0.7253401", "0.71946836", "0.719138", "0.70960134", "0.7077248", "0.7054006", "0.6973285", "0.6967862", "0.69372344", "0.69322556", "0.69102204", "0.6864454", "0.6861238", "0.67856", "0.6762191", "0.67100865", "0.66672635", "0.65790963", "0.65746284", "0.657040...
0.7024564
7
Load the IMDB reviews dataset. Code adapted from the code for
def load_imdb_dataset(): (x_train, y_train), (x_test, y_test) = imdb.load_data( path="./datasets", num_words=_IMDB_CONFIG["max_features"]) num_train = _IMDB_CONFIG["num_train"] x_train, x_val = x_train[:num_train], x_train[num_train:] y_train, y_val = y_train[:num_train], y_train[num_train:] def preprocess(x, y, max_length): x = sequence.pad_sequences(x, maxlen=max_length) y = onp.array(y) x = onp.array(x) return x, y max_length = _IMDB_CONFIG["max_len"] x_train, y_train = preprocess(x_train, y_train, max_length=max_length) x_val, y_val = preprocess(x_val, y_val, max_length=max_length) x_test, y_test = preprocess(x_test, y_test, max_length=max_length) data_info = {"num_classes": 2} return (x_train, y_train), (x_test, y_test), (x_val, y_val), data_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(path='./data/train'):\n print(\"Loading IMDB Data...\")\n data = []\n\n dir = os.path.dirname(__file__)\n file_list = glob.glob(os.path.join(dir, path + '/pos/*'))\n file_list.extend(glob.glob(os.path.join(dir, path + '/neg/*')))\n print(\"Parsing %s files\" % len(file_list))\n f...
[ "0.75287616", "0.66760135", "0.65806144", "0.6317917", "0.6313057", "0.6215495", "0.61960655", "0.61669785", "0.6146301", "0.6112559", "0.60396117", "0.5993801", "0.59847677", "0.59646434", "0.59450567", "0.5916073", "0.59076846", "0.5888437", "0.5850578", "0.5838023", "0.583...
0.6858757
1
Loads the dataset as a generator of batches.
def load_image_dataset(split, batch_size, name="cifar10", repeat=False, shuffle=False, shuffle_seed=None): # Do no data augmentation. ds, dataset_info = tfds.load( name, split=split, as_supervised=True, with_info=True) num_classes = dataset_info.features["label"].num_classes num_examples = dataset_info.splits[split].num_examples num_channels = dataset_info.features["image"].shape[-1] def img_to_float32(image, label): return tf.image.convert_image_dtype(image, tf.float32), label ds = ds.map(img_to_float32).cache() ds_stats = _ALL_IMG_DS_STATS[ImgDatasets(name)] def img_normalize(image, label): """Normalize the image to zero mean and unit variance.""" mean, std = ds_stats image -= tf.constant(mean, shape=[1, 1, num_channels], dtype=image.dtype) image /= tf.constant(std, shape=[1, 1, num_channels], dtype=image.dtype) return image, label ds = ds.map(img_normalize) if batch_size == -1: batch_size = num_examples if repeat: ds = ds.repeat() if shuffle: ds = ds.shuffle(buffer_size=10 * batch_size, seed=shuffle_seed) ds = ds.batch(batch_size) return tfds.as_numpy(ds), num_classes, num_examples
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch(data_path):\n train, _, _ = get_datasets(\n data_path=data_path,\n nb_nodes=7,\n task_type=\"classification\",\n nb_classes=2,\n split=None,\n k_fold=None,\n seed=1234,\n )\n for batch in torch.utils.data.DataLoader(\n train, shuffle=False,...
[ "0.74145716", "0.72911185", "0.7193387", "0.70773464", "0.70638293", "0.7023753", "0.6965977", "0.69633365", "0.6931853", "0.69255435", "0.6894077", "0.6890785", "0.6880416", "0.6874165", "0.68381536", "0.6833069", "0.6754379", "0.6751766", "0.6733288", "0.6700763", "0.667048...
0.0
-1
Normalize the image to zero mean and unit variance.
def img_normalize(image, label): mean, std = ds_stats image -= tf.constant(mean, shape=[1, 1, num_channels], dtype=image.dtype) image /= tf.constant(std, shape=[1, 1, num_channels], dtype=image.dtype) return image, label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variance_normalize(self):\n self.img = self.img / np.sqrt(np.sum(self.img ** 2))", "def _normalize(images):\n images -= images.mean(axis=0, keepdims=True)\n images /= np.maximum(images.std(axis=0, keepdims=True), 3e-1)", "def _normalize(images):\n images -= images.mean(axis=0, keepdims=True...
[ "0.85018736", "0.77996475", "0.77996475", "0.7690731", "0.76031065", "0.7495071", "0.74933225", "0.7450734", "0.742322", "0.742322", "0.7292144", "0.72221386", "0.71879476", "0.717902", "0.71174324", "0.71018165", "0.709455", "0.709455", "0.7082818", "0.7072676", "0.70667064"...
0.7024483
25
Load a UCI dataset from an npz file. Ported from
def load_uci_regression_dataset(name, split_seed, train_fraction=0.9, data_dir="uci_datasets"): path = os.path.join(data_dir, _UCI_REGRESSION_FILENAMES[UCIRegressionDatasets(name)]) data_arr = onp.load(path) x, y = data_arr["x"], data_arr["y"] indices = jax.random.permutation(jax.random.PRNGKey(split_seed), len(x)) indices = onp.asarray(indices) x, y = x[indices], y[indices] n_train = int(train_fraction * len(x)) x_train, y_train = x[:n_train], y[:n_train] x_test, y_test = x[n_train:], y[n_train:] def normalize_with_stats(arr, arr_mean=None, arr_std=None): return (arr - arr_mean) / arr_std def normalize(arr): eps = 1e-6 arr_mean = arr.mean(axis=0, keepdims=True) arr_std = arr.std(axis=0, keepdims=True) + eps return normalize_with_stats(arr, arr_mean, arr_std), arr_mean, arr_std x_train, x_mean, x_std = normalize(x_train) y_train, y_mean, y_std = normalize(y_train) x_test = normalize_with_stats(x_test, x_mean, x_std) y_test = normalize_with_stats(y_test, y_mean, y_std) data_info = {"y_scale": float(y_std)} return (x_train, y_train), (x_test, y_test), data_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data_from_npz(filename):\n with np.load(filename) as f:\n data = np.zeros(f[\"shape\"], np.bool_)\n data[[x for x in f[\"nonzero\"]]] = True\n return data", "def load_npz(fd_or_filename: Union[str, io.IOBase], **kwargs):\n return np.load(fd_or_filename, **kwargs)", "def load_dat...
[ "0.6841584", "0.62716067", "0.6261759", "0.6199561", "0.61455333", "0.613199", "0.6091358", "0.6050293", "0.60497475", "0.60486746", "0.6030378", "0.6012157", "0.5956382", "0.59548086", "0.59342986", "0.5906623", "0.58845", "0.5869178", "0.58608663", "0.5851471", "0.5849214",...
0.54285187
85
Parse name and seed for uci regression data. E.g. yacht_2 is the yacht dataset with seed 2.
def _parse_uci_regression_dataset(name_str): pattern_string = "(?P<name>[a-z]+)_(?P<seed>[0-9]+)" pattern = re.compile(pattern_string) matched = pattern.match(name_str) if matched: name = matched.group("name") seed = matched.group("seed") return name, seed return None, None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_uci_regression_dataset(name,\n split_seed,\n train_fraction=0.9,\n data_dir=\"uci_datasets\"):\n path = os.path.join(data_dir,\n _UCI_REGRESSION_FILENAMES[UCIRegressionDatasets(name)])\n dat...
[ "0.6082497", "0.5352037", "0.5263292", "0.5021193", "0.49601898", "0.48798177", "0.4859456", "0.48388806", "0.48280886", "0.48230565", "0.48205665", "0.4811698", "0.4808677", "0.4778711", "0.477406", "0.4759555", "0.47592923", "0.47398236", "0.47390524", "0.4733845", "0.47287...
0.730633
0
Reshapes batch to have first axes size equal n_split.
def batch_split_axis(batch, n_split): x, y = batch n = x.shape[0] n_new = n / n_split assert n_new == int(n_new), ( "First axis cannot be split: batch dimension was {} when " "n_split was {}.".format(x.shape[0], n_split)) n_new = int(n_new) return tuple(arr.reshape([n_split, n_new, *arr.shape[1:]]) for arr in (x, y))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reshape_output_batch(self, number, output):\n #tt = cutotime('reshape')\n #tt.start()\n output = output.reshape(self.output_shapes[number]) # batch, h, w, 3, (5 + 80)\n #tt.stop()\n return output", "def split_last_dimension(x, n):\n x_shape = shape_list(x)\n m = x_s...
[ "0.69617146", "0.68236685", "0.66688055", "0.6664411", "0.65866363", "0.65084076", "0.65084076", "0.65084076", "0.6464381", "0.6412519", "0.6412519", "0.6395728", "0.6334293", "0.630652", "0.6277924", "0.62474674", "0.61763036", "0.61714095", "0.6166665", "0.61203986", "0.608...
0.72161376
0
Shard the dataset to devices.
def pmap_dataset(ds, n_devices): n_data = len(ds[0]) if n_data % n_devices: new_len = n_devices * (n_data // n_devices) warning_str = ("Dataset of length {} can not be split onto {} devices." "Truncating to {} data points.".format( n_data, n_devices, new_len)) warnings.warn(warning_str, UserWarning) ds = (arr[:new_len] for arr in ds) return jax.pmap(lambda x: x)(batch_split_axis(ds, n_devices))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shard(self, dataset_iter):\n return dataset_iter", "def devices(self, devices):\n\n self._devices = devices", "def devices(self, devices):\n\n self._devices = devices", "def set_rng_device_and_dtype(\n self, device: torch.device = torch.device('cpu'), dtype: torch.dtype = torch.fl...
[ "0.5999675", "0.58297193", "0.58297193", "0.58137083", "0.5668784", "0.56086874", "0.5523341", "0.5516918", "0.54677045", "0.54248637", "0.5422187", "0.5421713", "0.5397734", "0.5350507", "0.53368425", "0.5336252", "0.5329454", "0.5285518", "0.52771497", "0.52771497", "0.5277...
0.5367258
13
Make train and test sets sharded over batch dim.
def make_ds_pmap_fullbatch(name, dtype, n_devices=None, truncate_to=None): name = name.lower() n_devices = n_devices or len(jax.local_devices()) if name in ImgDatasets._value2member_map_: train_set, test_set, data_info = get_image_dataset(name) loaded = True task = Task.CLASSIFICATION elif name == "imdb": train_set, test_set, _, data_info = load_imdb_dataset() dtype = jnp.int32 loaded = True task = Task.CLASSIFICATION elif name[-4:] == ".npz": train_set, test_set, data_info = load_npz_array(name) loaded = True task = Task.CLASSIFICATION else: name, seed = _parse_uci_regression_dataset(name) loaded = name is not None if name is not None: train_set, test_set, data_info = load_uci_regression_dataset( name, int(seed)) loaded = True task = Task.REGRESSION if not loaded: raise ValueError("Unknown dataset name: {}".format(name)) if truncate_to: assert truncate_to % n_devices == 0, ( "truncate_to should be devisible by n_devices, but got values " "truncate_to={}, n_devices={}".format(truncate_to, n_devices)) train_set = tuple(arr[:truncate_to] for arr in train_set) train_set, test_set = tuple( pmap_dataset(ds, n_devices) for ds in (train_set, test_set)) train_set, test_set = map(lambda ds: (ds[0].astype(dtype), ds[1]), (train_set, test_set)) return train_set, test_set, task, data_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_test_split(self):\n random.seed(self.args.seed)\n nodes = [node for node in range(self.ncount)]\n random.shuffle(nodes)\n self.train_nodes = torch.LongTensor(nodes[0:self.args.training_size])\n self.validation_nodes = torch.LongTensor(nodes[self.args.training_size:self....
[ "0.6583123", "0.639782", "0.63896275", "0.63545656", "0.63532937", "0.6268737", "0.623224", "0.6219766", "0.62126184", "0.62075806", "0.6200337", "0.6198661", "0.61894786", "0.61629933", "0.61584157", "0.6099286", "0.6081113", "0.607283", "0.60670036", "0.6061789", "0.6061682...
0.0
-1
Load traces in an interval (in seconds).
def select_traces(traces, interval, sample_rate=None): start, end = interval i, j = round(sample_rate * start), round(sample_rate * end) i, j = int(i), int(j) traces = traces[i:j] traces = traces - np.median(traces, axis=0) return traces
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self, filepath=''):\n sleep(20)\n pass", "def load_traces(self, filename):\n\n self.traces = self.load(filename)", "def delay(interval):\n time.sleep(interval / 1000.0)", "def interval(ctx, poll_interval):\n fc_info = {}\n fc_info['POLL_INTERVAL'] = poll_interval\n ...
[ "0.54937834", "0.5422799", "0.523051", "0.5210247", "0.51206535", "0.51206535", "0.510375", "0.50268334", "0.49911025", "0.49497274", "0.48942694", "0.48845673", "0.48481822", "0.48463246", "0.48297423", "0.47870618", "0.47789985", "0.47762358", "0.47673932", "0.47318327", "0...
0.47573504
19
Iterate through the spike waveforms belonging in the current trace view.
def _iter_spike_waveforms( interval=None, traces_interval=None, model=None, supervisor=None, n_samples_waveforms=None, get_best_channels=None, show_all_spikes=False): m = model p = supervisor sr = m.sample_rate a, b = m.spike_times.searchsorted(interval) s0, s1 = int(round(interval[0] * sr)), int(round(interval[1] * sr)) ns = n_samples_waveforms k = ns // 2 for show_selected in (False, True): for i in range(a, b): t = m.spike_times[i] c = m.spike_clusters[i] is_selected = c in p.selected # Show non selected spikes first, then selected spikes so that they appear on top. if is_selected is not show_selected: continue # Skip non-selected spikes if requested. if (not show_all_spikes and c not in supervisor.selected): continue # cg = p.cluster_meta.get('group', c) channel_ids, channel_amps = get_best_channels(c) s = int(round(t * sr)) - s0 # Skip partial spikes. if s - k < 0 or s + k >= (s1 - s0): # pragma: no cover continue # Extract the waveform. wave = Bunch( data=traces_interval[s - k:s + ns - k, channel_ids], channel_ids=channel_ids, start_time=(s + s0 - k) / sr, spike_id=i, spike_time=t, spike_cluster=c, channel_amps=channel_amps, # for each of the channel_ids, the relative amp select_index=p.selected.index(c) if c in p.selected else None, ) assert wave.data.shape == (ns, len(channel_ids)) yield wave
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_waveforms(self, key, _):\n if key == self.controls.Arrays.WAVEFORMS:\n self.trace_lines[0].set_ydata(self.pv_monitor.arrays[key][0])\n self.trace_lines[1].set_ydata(self.pv_monitor.arrays[key][1])\n self.draw()", "def waveforms(self):\n return list(self._...
[ "0.60995203", "0.60207593", "0.58172476", "0.56029576", "0.5505114", "0.5358715", "0.5346913", "0.53436625", "0.5329249", "0.5252956", "0.52186084", "0.5192006", "0.5182989", "0.5122417", "0.5108391", "0.50970674", "0.5088726", "0.5059595", "0.5016616", "0.5011529", "0.500940...
0.71562934
0
Display the traces and spikes in a given interval.
def set_interval(self, interval=None): if interval is None: interval = self._interval interval = self._restrict_interval(interval) if interval != self._interval: logger.log(5, "Redraw the entire trace view.") self._interval = interval emit('is_busy', self, True) self.plot(update_traces=True, update_waveforms=True) emit('is_busy', self, False) emit('time_range_selected', self, interval) self.update_status() else: self.plot(update_traces=False, update_waveforms=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self, fig=None):\n i = 0\n # for t = 0:obj.step_size:obj.duration\n # TODO: make a generator?\n iterator = np.linspace(0, self.duration(), num=math.ceil(self.duration() / self.step_precision) + 1)\n tfInterp_l = np.zeros((4, 4, len(iterator)))\n tfInterp_r = np.ze...
[ "0.57920915", "0.5683707", "0.5661111", "0.5605037", "0.55469894", "0.5529888", "0.55209893", "0.5516258", "0.5514016", "0.54653513", "0.54639024", "0.5443685", "0.5424659", "0.54157746", "0.54123294", "0.5401272", "0.5386288", "0.53694296", "0.53634524", "0.5349171", "0.5345...
0.500734
62
Attach the view to the GUI.
def attach(self, gui): super(TraceView, self).attach(gui) self.actions.add(self.toggle_show_labels, checkable=True, checked=self.do_show_labels) self.actions.add( self.toggle_highlighted_spikes, checkable=True, checked=self.show_all_spikes) self.actions.add(self.toggle_auto_scale, checkable=True, checked=self.auto_scale) self.actions.add(self.switch_origin) self.actions.separator() self.actions.add( self.go_to, prompt=True, prompt_default=lambda: str(self.time)) self.actions.separator() self.actions.add(self.go_to_start) self.actions.add(self.go_to_end) self.actions.separator() self.actions.add(self.shift, prompt=True) self.actions.add(self.go_right) self.actions.add(self.go_left) self.actions.add(self.jump_right) self.actions.add(self.jump_left) self.actions.separator() self.actions.add(self.widen) self.actions.add(self.narrow) self.actions.separator() self.actions.add(self.go_to_next_spike) self.actions.add(self.go_to_previous_spike) self.actions.separator() self.set_interval()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_show_view(self):\n self.setup()", "def on_show_view(self):\n self.setup()", "def on_show_view(self):\n self.setup()", "def _add_view(self, window, view):\r\n\r\n # If no 'relative_to' is specified then the view is positioned\r\n # relative to the editor area.\r\n ...
[ "0.66884124", "0.66884124", "0.66884124", "0.66009265", "0.6581134", "0.6503647", "0.6470148", "0.6323154", "0.62344205", "0.6183854", "0.6170608", "0.6120538", "0.60880315", "0.60534596", "0.604596", "0.6022283", "0.5969684", "0.5946267", "0.5931756", "0.58913046", "0.589079...
0.6533588
5
Whether to show the channels from top to bottom (`top` option, the default), or from bottom to top (`bottom`).
def origin(self): return getattr(self.canvas.layout, 'origin', Stacked._origin)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __redrawChannels(self):\n self.__channelWin.clear()\n all_chans = self._client.getChannels()\n all_chans.sort(key=lambda c: c.getName())\n count = min(len(all_chans), self.__channelWin.getmaxyx()[0])\n show = all_chans[:count]\n for c in show:\n cur = self._...
[ "0.55284494", "0.55176115", "0.54155743", "0.5375682", "0.53093606", "0.5295649", "0.5262697", "0.52525777", "0.5098146", "0.5055639", "0.5050628", "0.50497913", "0.50408816", "0.49749383", "0.49492052", "0.49289334", "0.48759848", "0.48495993", "0.4837377", "0.4822591", "0.4...
0.0
-1
Switch between top and bottom origin for the channels.
def switch_origin(self): self.origin = 'bottom' if self.origin == 'top' else 'top'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reshape(self, bottom, top):\r\n pass", "def reshape(self, bottom, top):\n\t\tpass", "def reshape(self, bottom, top):\n pass", "def reshape(self, bottom, top):\n pass", "def reshape(self, bottom, top):\n pass", "def reshape(self, bottom, top):\n pass", "def reshape...
[ "0.5853456", "0.58374345", "0.57300776", "0.57300776", "0.57300776", "0.57300776", "0.57300776", "0.57300776", "0.57300776", "0.57300776", "0.57300776", "0.57300776", "0.57300776", "0.56316376", "0.56309074", "0.5490777", "0.5398423", "0.5386707", "0.53046316", "0.5291994", "...
0.7755325
0
Time at the center of the window.
def time(self): return sum(self._interval) * .5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center_on_spawn(self):\n self.center_on(*self.world.metadata['playerStart'])", "def center(window):\n window.update_idletasks()\n\n # Find the screen resolution\n screen_width = window.winfo_screenwidth()\n screen_height = window.winfo_screenheight()\n\n # Find new (x, y) coordinates\n ...
[ "0.6251276", "0.61837316", "0.6181719", "0.6170674", "0.6131986", "0.6077728", "0.60649556", "0.6055015", "0.6043705", "0.60249746", "0.6022022", "0.6018045", "0.60002804", "0.59981203", "0.5997838", "0.5936975", "0.5931709", "0.59026456", "0.58981544", "0.5848138", "0.581421...
0.0
-1
Interval as `(tmin, tmax)`.
def interval(self): return self._interval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_tmin_tmax(inst, tmin, tmax):\n _check_type(tmin, (None, \"numeric\"), item_name=\"tmin\")\n _check_type(tmax, (None, \"numeric\"), item_name=\"tmax\")\n\n # check positiveness for tmin, tmax\n for name, arg in ((\"tmin\", tmin), (\"tmax\", tmax)):\n if arg is None:\n contin...
[ "0.68151754", "0.66623974", "0.6629554", "0.6584883", "0.65043294", "0.6474935", "0.6412259", "0.6410299", "0.63806736", "0.63406235", "0.62529576", "0.6237908", "0.62276185", "0.6169634", "0.6162228", "0.6150554", "0.6136628", "0.6109361", "0.61021554", "0.608784", "0.604031...
0.0
-1
Half of the duration of the current interval.
def half_duration(self): if self._interval is not None: a, b = self._interval return (b - a) * .5 else: return self.interval_duration * .5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def half_step_time(self):\n\n return self.full_step_time() * self.half_to_full_step_time_ratio", "def _get_half_time(self):\n return self.__half_time", "def widen(self):\n t, h = self.time, self.half_duration\n h *= self.scaling_coeff_x\n self.set_interval((t - h, t + h))", "de...
[ "0.72750044", "0.70751405", "0.6361613", "0.6327403", "0.63129026", "0.6184249", "0.61641526", "0.61528426", "0.6123823", "0.6084359", "0.608264", "0.6048802", "0.6041668", "0.603156", "0.60129833", "0.60048217", "0.59908354", "0.5974596", "0.59592074", "0.5935029", "0.593502...
0.8561854
0
Go to a specific time (in seconds).
def go_to(self, time): half_dur = self.half_duration self.set_interval((time - half_dur, time + half_dur))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jump(self, seconds: float) -> None:\n if seconds < 0:\n raise ValueError(\"time can't go backwards\")\n self._virtual_base += seconds", "def set_time(self, sec):\n self.set_timed(round(sec * 10.0))", "def pass_time(self, t):\n cont = time.time() + t\n while tim...
[ "0.6700288", "0.66491824", "0.6632575", "0.6577623", "0.65731984", "0.629269", "0.62756586", "0.62237495", "0.6199625", "0.6169536", "0.6169536", "0.6143821", "0.6137382", "0.6088691", "0.60664135", "0.602092", "0.6020566", "0.60139376", "0.6013062", "0.593964", "0.5881879", ...
0.6876498
0
Shift the interval by a given delay (in seconds).
def shift(self, delay): self.go_to(self.time + delay)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift(self, delay):\n self.__begin.shift(delay)\n self.__end.shift(delay)", "def delay(interval):\n time.sleep(interval / 1000.0)", "def delay(seconds):\n\n # Perform the delay\n time.sleep(seconds)", "def delay():\r\n time.sleep(2)", "async def sleep(cls, delay: float) ->...
[ "0.7768829", "0.7139381", "0.6876155", "0.6494857", "0.649145", "0.64053226", "0.6397227", "0.6366633", "0.63602847", "0.6356303", "0.6325486", "0.6317313", "0.6315866", "0.62965715", "0.62463284", "0.6218299", "0.61278665", "0.6077595", "0.60770804", "0.60277456", "0.6008311...
0.82353926
0
Go to the start of the recording.
def go_to_start(self): self.go_to(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recording_start(self):\n self._post('recording/start')", "def start_recording(self):\n\n\t\tself.eyetribe.start_recording()\n\t\tself.recording = True", "def start(self):\n self.recording = True", "def start(self):\n self.events[0].record()\n self.cur = 1", "def start_record...
[ "0.7811632", "0.748685", "0.74566555", "0.737498", "0.71553403", "0.68922603", "0.6806795", "0.67850584", "0.6769072", "0.67346567", "0.67321515", "0.6717027", "0.6545686", "0.6453229", "0.6453229", "0.6453229", "0.6453229", "0.6446663", "0.643614", "0.6370786", "0.6351596", ...
0.7430042
3
Go to end of the recording.
def go_to_end(self): self.go_to(self.duration)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(self) -> None:", "def end(self):\n pass", "def end(self):\n pass", "def end(self):\n pass", "def handle_record_end():\n LOG.info(\"End Recording...\")\n context = {'client_name': 'mycroft_listener',\n 'source': 'audio',\n 'destination': [\"skil...
[ "0.71201277", "0.709415", "0.709415", "0.709415", "0.7093299", "0.7023222", "0.6937872", "0.6920976", "0.6730083", "0.6668539", "0.6595177", "0.652316", "0.6494475", "0.6478494", "0.6469474", "0.64187795", "0.6406178", "0.6406178", "0.63864815", "0.63863313", "0.636873", "0...
0.7161482
0
Jump to next or previous spike from the selected clusters.
def _jump_to_spike(self, delta=+1): spike_times = self.get_spike_times() if spike_times is not None and len(spike_times): ind = np.searchsorted(spike_times, self.time) n = len(spike_times) self.go_to(spike_times[(ind + delta) % n])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_next_spike(self, ):\n self._jump_to_spike(+1)", "def go_to_previous_spike(self, ):\n self._jump_to_spike(-1)", "def next(self):\n self.jumpahead(1)", "def jump(self):\n global jumpSize\n print \"jumping...\"\n # create a range that includes all the availabl...
[ "0.70530874", "0.666981", "0.59389496", "0.58566797", "0.5765864", "0.5735018", "0.56252164", "0.5610634", "0.557462", "0.55167204", "0.54348326", "0.541708", "0.53921545", "0.5388768", "0.536333", "0.5288356", "0.5214645", "0.5199193", "0.5193192", "0.5163095", "0.51492554",...
0.6327784
2
Jump to the next spike from the first selected cluster.
def go_to_next_spike(self, ): self._jump_to_spike(+1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_previous_spike(self, ):\n self._jump_to_spike(-1)", "def _jump_to_spike(self, delta=+1):\n spike_times = self.get_spike_times()\n if spike_times is not None and len(spike_times):\n ind = np.searchsorted(spike_times, self.time)\n n = len(spike_times)\n ...
[ "0.68979293", "0.6640994", "0.6507172", "0.5977406", "0.5866238", "0.5749817", "0.57480246", "0.568603", "0.5647011", "0.5641555", "0.56349427", "0.55913675", "0.5588329", "0.5521469", "0.54015243", "0.5398123", "0.5389734", "0.53794944", "0.5359989", "0.53176546", "0.528841"...
0.7934081
0
Jump to the previous spike from the first selected cluster.
def go_to_previous_spike(self, ): self._jump_to_spike(-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_next_spike(self, ):\n self._jump_to_spike(+1)", "def _jump_to_spike(self, delta=+1):\n spike_times = self.get_spike_times()\n if spike_times is not None and len(spike_times):\n ind = np.searchsorted(spike_times, self.time)\n n = len(spike_times)\n s...
[ "0.714149", "0.63978726", "0.63840806", "0.61748135", "0.60427266", "0.5830913", "0.5813735", "0.5735725", "0.57223296", "0.57025665", "0.57012117", "0.55288374", "0.5477547", "0.547428", "0.5469675", "0.5461348", "0.5453362", "0.5451666", "0.5414452", "0.534706", "0.5315017"...
0.79967767
0
Toggle between showing all spikes or selected spikes.
def toggle_highlighted_spikes(self, checked): self.show_all_spikes = checked self.set_interval()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ToggleOff(self):\n for s in self.sensors:\n self.gSetpt[s.GetID()].Disable()\n\n self.top_sizer.Layout()\n print(\"Toggle off\")", "def hidden_singles(self):\n self.change = True\n while self.change:\n self.hidden_round()", "def toggle_surface_mode(s...
[ "0.6208926", "0.6050148", "0.5986689", "0.5931181", "0.5903119", "0.5903119", "0.5695317", "0.56854576", "0.56528676", "0.56528676", "0.56507105", "0.5585108", "0.5578206", "0.557582", "0.5550592", "0.55118", "0.5508104", "0.5504786", "0.5502983", "0.55022866", "0.54935396", ...
0.69948447
0
Increase the interval size.
def widen(self): t, h = self.time, self.half_duration h *= self.scaling_coeff_x self.set_interval((t - h, t + h))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateSize(self):\n self.currentsize = len(self.intervals)\n try:\n assert self.currentsize <= self.size\n except AssertionError:\n print(self.currentsize)\n print(self.size)\n sys.exit('[', sys.arg[0] + ']: Size problem')", "def resize(self, n...
[ "0.7556731", "0.70139605", "0.6836615", "0.66695124", "0.6534693", "0.6534693", "0.6534693", "0.646582", "0.6381011", "0.63793176", "0.6339734", "0.628063", "0.62720335", "0.626589", "0.61986613", "0.61749625", "0.617216", "0.6102264", "0.60876834", "0.6084448", "0.6077518", ...
0.6189907
15
Decrease the interval size.
def narrow(self): t, h = self.time, self.half_duration h /= self.scaling_coeff_x self.set_interval((t - h, t + h))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dec_size(self):\r\n self.__length -= 1", "def updateSize(self):\n self.currentsize = len(self.intervals)\n try:\n assert self.currentsize <= self.size\n except AssertionError:\n print(self.currentsize)\n print(self.size)\n sys.exit('[', ...
[ "0.7060343", "0.68583477", "0.64114755", "0.6321924", "0.6098751", "0.607889", "0.6018984", "0.599691", "0.5946714", "0.59390116", "0.5916328", "0.5848298", "0.58161247", "0.57695884", "0.5745519", "0.5734558", "0.5694274", "0.5650514", "0.563735", "0.56304765", "0.56119967",...
0.563252
19
Toggle the display of the channel ids.
def toggle_show_labels(self, checked): logger.debug("Set show labels to %s.", checked) self.do_show_labels = checked self.text_visual.toggle() self.canvas.update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _visibleChannels_changed(self):\n for i in range(0,8):\n if i in self.visibleChannels:\n self.masterContainer.plots[\"channel\"+str(i)][0].visible=True\n else:\n print i\n self.masterContainer.plots[\"channel\"+str(i)][0].visible=False",...
[ "0.67623276", "0.670535", "0.63494956", "0.63484985", "0.61224884", "0.60341847", "0.5839348", "0.5775318", "0.57307273", "0.57006425", "0.5679107", "0.564858", "0.5595665", "0.55708903", "0.55689216", "0.55689216", "0.5560915", "0.5559971", "0.55417454", "0.55388993", "0.552...
0.49804327
88
Toggle automatic scaling of the traces.
def toggle_auto_scale(self, checked): logger.debug("Set auto scale to %s.", checked) self.auto_scale = checked
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onToggleScale(self, event):\r\n if self.get_yscale() == 'log':\r\n self.set_yscale('linear')\r\n else:\r\n self.set_yscale('log')\r\n self.subplot.figure.canvas.draw_idle()", "def clickAutoscale(self, event):\n self.axes.autoscale_view()", "def scaling_ena...
[ "0.7329849", "0.7177367", "0.65722066", "0.61756915", "0.61486137", "0.6119862", "0.6056649", "0.6035681", "0.6035681", "0.6006283", "0.5996011", "0.5986425", "0.597488", "0.5941395", "0.5927027", "0.5925209", "0.5909223", "0.5884189", "0.5856268", "0.5849367", "0.5846804", ...
0.72248846
1
Update the view when the color scheme changes.
def update_color(self): self.plot(update_traces=False, update_waveforms=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_color(self):\r\n \r\n \r\n colorset = self.colorset\r\n \r\n self.grfx[0].colorset = colorset\r\n pass", "def plot_color_changed(self):\n self.plot_color = self.plot_color_button.color()", "def changeColor(self):\n self.layer.new_colormap()", "def _update_color(self...
[ "0.6837024", "0.67573655", "0.67464536", "0.6674691", "0.6582233", "0.6487157", "0.6407548", "0.6334135", "0.62867904", "0.6270955", "0.6240912", "0.62101436", "0.62077475", "0.6205991", "0.61959213", "0.6193557", "0.6117789", "0.6114603", "0.61016107", "0.608556", "0.6044547...
0.6732327
3
Scaling of the channel boxes.
def scaling(self): return self.stacked._box_scaling[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(self):", "def __scale_bboxes(self, bboxes, scale_x, scale_y):\n with tf.variable_scope('scale_bboxes'):\n return tf.multiply(bboxes, tf.tile([[scale_y, scale_x, scale_y,\n scale_x]],\n [tf.sh...
[ "0.6791516", "0.66905487", "0.6362399", "0.6291339", "0.6284861", "0.6226618", "0.62150896", "0.61979586", "0.6165425", "0.60886663", "0.6006513", "0.60016114", "0.5972433", "0.5896266", "0.5881052", "0.5877557", "0.58730024", "0.58693355", "0.58449113", "0.58054405", "0.5792...
0.6452094
2
Select a cluster by clicking on a spike.
def on_mouse_click(self, e): if 'Control' in e.modifiers: # Get mouse position in NDC. box_id, _ = self.canvas.stacked.box_map(e.pos) channel_id = np.nonzero(self.channel_y_ranks == box_id)[0] # Find the spike and cluster closest to the mouse. db = self.data_bounds # Get the information about the displayed spikes. wt = [(t, s, c, ch) for t, s, c, ch in self._waveform_times if channel_id in ch] if not wt: return # Get the time coordinate of the mouse position. mouse_pos = self.canvas.panzoom.window_to_ndc(e.pos) mouse_time = Range(NDC, db).apply(mouse_pos)[0][0] # Get the closest spike id. times, spike_ids, spike_clusters, channel_ids = zip(*wt) i = np.argmin(np.abs(np.array(times) - mouse_time)) # Raise the select_spike event. spike_id = spike_ids[i] cluster_id = spike_clusters[i] emit('select_spike', self, channel_id=channel_id, spike_id=spike_id, cluster_id=cluster_id) if 'Shift' in e.modifiers: # Get mouse position in NDC. box_id, _ = self.canvas.stacked.box_map(e.pos) channel_id = int(np.nonzero(self.channel_y_ranks == box_id)[0][0]) emit('select_channel', self, channel_id=channel_id, button=e.button)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(self, event):\n x, y = self.canvas.invert([event.x, event.y])\n i, j = int(floor(x)), int(floor(y))\n patch = self.get_cell(i, j)\n if patch and patch.state == \"green\":\n cluster = self.get_cluster(patch)\n self.show_cluster(cluster)", "def selectPoin...
[ "0.64221257", "0.58902055", "0.56319547", "0.55411613", "0.5464253", "0.5434376", "0.5432982", "0.5413814", "0.54018533", "0.5387682", "0.5354226", "0.5342046", "0.5314084", "0.5284342", "0.5284342", "0.5258224", "0.52542984", "0.5254069", "0.5253677", "0.5247113", "0.5224413...
0.6448263
0
Scroll through the data with alt+wheel.
def on_mouse_wheel(self, e): # pragma: no cover super(TraceView, self).on_mouse_wheel(e) if e.modifiers == ('Alt',): start, end = self._interval delay = e.delta * (end - start) * .1 self.shift(-delay)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll(*args):", "def on_mouse_wheel(self,event,canvas):\n canvas.yview(\"scroll\",-1*event.delta/100,\"units\")", "def on_mousewheel(self, event):\r\n self.container_widgets[\"order_canvas\"].yview_scroll(-1 * int(event.delta / 120), \"units\")\r\n # TODO FIX SCROLLING\r", "def _on_...
[ "0.67423654", "0.66140634", "0.6610619", "0.65981364", "0.6562769", "0.6438472", "0.6420957", "0.6374915", "0.6302239", "0.62492704", "0.6228947", "0.6200425", "0.6184353", "0.6166804", "0.61381143", "0.6054333", "0.6047623", "0.60413134", "0.6029681", "0.6023016", "0.5998706...
0.62142295
11
Attach the view to the GUI.
def attach(self, gui): ManualClusteringView.attach(self, gui) # ScalingMixin.attach(self, gui) # self.actions.add(self.toggle_show_labels, checkable=True, checked=self.do_show_labels) # self.actions.add(self.toggle_auto_scale, checkable=True, checked=self.auto_scale) self.actions.add(self.switch_origin) self.actions.separator() self.actions.add(self.go_to, prompt=True, prompt_default=lambda: str(self.time)) self.actions.separator() self.actions.add(self.go_to_start) self.actions.add(self.go_to_end) self.actions.separator() self.actions.add(self.shift, prompt=True) self.actions.add(self.go_right) self.actions.add(self.go_left) self.actions.add(self.jump_right) self.actions.add(self.jump_left) self.actions.separator() self.actions.add(self.widen) self.actions.add(self.narrow) self.actions.separator() self.set_interval()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_show_view(self):\n self.setup()", "def on_show_view(self):\n self.setup()", "def on_show_view(self):\n self.setup()", "def _add_view(self, window, view):\r\n\r\n # If no 'relative_to' is specified then the view is positioned\r\n # relative to the editor area.\r\n ...
[ "0.66884124", "0.66884124", "0.66884124", "0.66009265", "0.6533588", "0.6503647", "0.6470148", "0.6323154", "0.62344205", "0.6183854", "0.6170608", "0.6120538", "0.60880315", "0.60534596", "0.604596", "0.6022283", "0.5969684", "0.5946267", "0.5931756", "0.58913046", "0.589079...
0.6581134
4
Whether to show the channels from top to bottom (`top` option, the default), or from bottom to top (`bottom`).
def origin(self): return self._origin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __redrawChannels(self):\n self.__channelWin.clear()\n all_chans = self._client.getChannels()\n all_chans.sort(key=lambda c: c.getName())\n count = min(len(all_chans), self.__channelWin.getmaxyx()[0])\n show = all_chans[:count]\n for c in show:\n cur = self._...
[ "0.5528585", "0.5517574", "0.54150355", "0.53741115", "0.5310534", "0.5296304", "0.52636003", "0.52526826", "0.5098848", "0.5056651", "0.505137", "0.50510633", "0.5041843", "0.4975196", "0.4949792", "0.4928718", "0.48774537", "0.48504677", "0.48374486", "0.48222828", "0.48000...
0.0
-1
Scaling of the colormap vrange.
def scaling(self): return self._scaling
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_cmap(self):\n vmax, vmin = np.max(self.values), np.min(self.values)\n self.midpoint = 1 - vmax/(vmax + abs(vmin))\n if self.midpoint > 0.5:\n self.start, self.stop = 0, 0.5 + (1-self.midpoint)\n else:\n self.start, self.stop = 0.5 - self.midpoint, 1",...
[ "0.6941317", "0.6658408", "0.6627601", "0.6596878", "0.6527981", "0.6513227", "0.6493253", "0.6488291", "0.6472731", "0.6470762", "0.6453213", "0.6415893", "0.641051", "0.6392674", "0.6256625", "0.6209371", "0.6175291", "0.61744946", "0.6136316", "0.6118481", "0.61143214", ...
0.5751985
51
Create reviews folder if it does not exist
def dirChecking(dir): if not os.path.exists(dir): os.mkdir(dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_folder_if_not_exist(filename):\n os.makedirs(os.path.dirname(filename), exist_ok=True)", "def create_directory():\r\n\r\n # Create directory for all lyrics\r\n try:\r\n os.mkdir(markovDir)\r\n except FileExistsError:\r\n pass", "def create_folder_if_needed(path):\n if o...
[ "0.6261388", "0.6114282", "0.6103237", "0.6101051", "0.6050629", "0.6020232", "0.60049367", "0.5988745", "0.59877414", "0.5978589", "0.5952596", "0.5923892", "0.5916263", "0.58593273", "0.585862", "0.58409756", "0.5830644", "0.5822491", "0.5775935", "0.5775935", "0.5774649", ...
0.5550531
49
Convert the illegal name for freebase
def convertName(name): name = re.sub(r'\$', 's', name) return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_name(self, name):\n if not self.re_name.match(name):\n org_name = name\n name = self.re_white.sub('_', name)\n name = self.re_alpha.sub('_', name)\n if not self.re_name.match(name):\n name = 'x_' + name2\n self.warn('Converti...
[ "0.6321686", "0.594915", "0.58042735", "0.5773941", "0.56322277", "0.56275433", "0.5616114", "0.55334014", "0.55209816", "0.55155563", "0.5503195", "0.54807377", "0.5372777", "0.53538215", "0.5341635", "0.533382", "0.5289499", "0.52765995", "0.5246423", "0.5203556", "0.520119...
0.0
-1
Returns a logger with the given name
def get_logger(name: str): logger = logging.getLogger(name) for handler in HANDLERS: logger.addHandler(handler) return logger
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logger(name):\n # type: (str) -> Logger\n return logging.getLogger(name)", "def get_logger(name):\n return logging.getLogger(name)", "def get_logger(name: str) -> logging.Logger:\n \n return logging.getLogger(name)", "def get_logger(name: str) -> logging.Logger:\n try:\n...
[ "0.86943036", "0.86648834", "0.86127335", "0.83303255", "0.8310802", "0.8274421", "0.82201195", "0.82107776", "0.81484", "0.81371915", "0.81099725", "0.80877364", "0.80632704", "0.7964971", "0.79618955", "0.7960622", "0.79571754", "0.7941737", "0.79340976", "0.7931048", "0.79...
0.79965186
13
Loads requirements file and outputs an array of dependencies
def parse_requirements(filename): lineiter = (line.strip() for line in open(filename)) return [line for line in lineiter if line and not line.startswith('#')]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_requirements():\r\n reqs_path = os.path.join('.', 'requirements.txt')\r\n with open(reqs_path, 'r') as f:\r\n requirements = [line.rstrip() for line in f]\r\n return requirements", "def read_requirements():\n reqs_path = path.join('.', 'requirements.txt')\n with open(reqs_path, 'r'...
[ "0.77573985", "0.775108", "0.77329814", "0.76370883", "0.76339567", "0.76128036", "0.76061934", "0.7439385", "0.7396733", "0.7377151", "0.73661613", "0.72941184", "0.72542316", "0.7222787", "0.7135786", "0.705487", "0.70474964", "0.70436454", "0.70436454", "0.7020663", "0.696...
0.0
-1
Computes negative value of input tensor.
def neg(data, target=utils.CCE): utils.check_supported_target(target) utils.check_shape(data.shape) if target == utils.CCE: data_type = data.dtype utils.ops_dtype_check(data_type, [utils.DtypeForDavinci.ALL_FLOAT, utils.DtypeForDavinci.INT32]) pone = akg.tvm.const(-1.0, dtype=data_type) res = akg.lang.ascend.vmuls(data, pone) if data_type == "int32": res = akg.topi.cast(res, "int32") else: res = akg.topi.negative(data) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __neg__(self):\n return TensorWithIndices(-self._tensor, \n self._con + '_' + self._cov)", "def abs(tensor):\n raise NotImplementedError", "def __neg__(self):\n\t\tval = -self.val\n\t\tder = -self.der if len(self.der.shape) else None\n\t\treturn Var(val, der)",...
[ "0.75131583", "0.7114549", "0.692163", "0.69077533", "0.6887083", "0.67914915", "0.6730227", "0.66932213", "0.6687829", "0.66610897", "0.6652976", "0.664498", "0.6637376", "0.6635296", "0.6629944", "0.65936184", "0.65753895", "0.6546625", "0.6520362", "0.6507943", "0.64984477...
0.66008675
15
Overloading the addition operator for particles types
def __add__(self, other): if isinstance(other, type(self)): # always create new particles, since otherwise c = a + b changes a as well! p = particles(self) p.pos[:] = self.pos + other.pos p.vel[:] = self.vel + other.vel p.m = self.m p.q = self.q return p else: raise DataError("Type error: cannot add %s to %s" % (type(other), type(self)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other: PointOrIterableOrScalar) -> PointType:\n return self.__op(other, operator.add)", "def __iadd__(self, other: PointOrIterableOrScalar) -> PointType:\n return self.__iop(other, operator.add)", "def __add__(self, other):\r\n if isinstance(other, vec4):\r\n r...
[ "0.7108404", "0.70331186", "0.7007142", "0.69473356", "0.6846601", "0.6845393", "0.68245333", "0.6748368", "0.671954", "0.66836524", "0.6639666", "0.6628716", "0.6572368", "0.6572368", "0.65575284", "0.65301085", "0.65287226", "0.6522699", "0.64960563", "0.64930576", "0.649",...
0.7784703
0
Overloading the subtraction operator for particles types
def __sub__(self, other): if isinstance(other, type(self)): # always create new particles, since otherwise c = a - b changes a as well! p = particles(self) p.pos[:] = self.pos - other.pos p.vel[:] = self.vel - other.vel p.m = self.m p.q = self.q return p else: raise DataError("Type error: cannot subtract %s from %s" % (type(other), type(self)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sub__(self, other):\r\n if isinstance(other, vec4):\r\n return vec4(self.x-other.x, self.y-other.y, self.z-other.z, self.w-other.w)\r\n else:\r\n raise TypeError, \"unsupported operand type for -\"", "def __sub__(self, other):\n\t\tif isinstance(other, int) or isinstance...
[ "0.7190107", "0.69218826", "0.6909827", "0.6842003", "0.6795763", "0.6745326", "0.6738838", "0.666937", "0.6658452", "0.6623842", "0.66205114", "0.6617514", "0.66050494", "0.65911543", "0.65911543", "0.658858", "0.65842706", "0.6576843", "0.65648913", "0.654615", "0.654368", ...
0.7674791
0
Overloading the right multiply by factor operator for particles types
def __rmul__(self, other): if isinstance(other, float): # always create new particles p = particles(self) p.pos[:] = other * self.pos p.vel[:] = other * self.vel p.m = self.m p.q = self.q return p else: raise DataError("Type error: cannot multiply %s to %s" % (type(other), type(self)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiplier(self) -> global___Expression:", "def __mul__(self, factor):\n def mul(output, target, params):\n return self(output, target, params) * factor\n return type(self)(type(self).__reserved_init, mul, factor * (1. if self._fact is None else self._fact), self._name)", "def __mul__(self, othe...
[ "0.7431928", "0.7313898", "0.72634524", "0.71655995", "0.7143251", "0.69607747", "0.6940514", "0.68881065", "0.6880617", "0.6876777", "0.68679297", "0.68585974", "0.68542147", "0.6810146", "0.6792147", "0.6772574", "0.6749506", "0.67289525", "0.6717555", "0.67149484", "0.6702...
0.67623055
16
Overloading the abs operator for particles types
def __abs__(self): abspos = abs(self.pos) absvel = abs(self.vel) return np.amax((abspos, absvel))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __abs__(self):\r\n raise TypeError(f\"bad operand type for abs(): '{type(self).__name__}'\")", "def abs_(a):", "def abs(self):\n return self * self.sign()", "def abs(self, a):\n return abs(a)", "def abs(x):\n pass", "def abs(self):\n\n return self._get(\"abs\", rtype=self.__c...
[ "0.7323492", "0.73157257", "0.71471566", "0.69704336", "0.6960074", "0.69372237", "0.6878583", "0.6811065", "0.67880434", "0.67874306", "0.6773758", "0.671703", "0.6713032", "0.6710696", "0.6704489", "0.6671311", "0.665533", "0.66214633", "0.6609428", "0.6576943", "0.654796",...
0.67304426
11
Routine for sending data forward in time (blocking)
def send(self, dest=None, tag=None, comm=None): comm.send(self, dest=dest, tag=tag) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_data(self, data, time):\n pass", "def sendall(self, data):\n while data and self.running:\n ret = self.sendFn(data[:MAX_SEND_SIZE])\n assert ret > 0\n data = data[ret:]", "def nonblocking_send(self, data):\n try:\n if len(data) == 0:\n ...
[ "0.74057233", "0.7014785", "0.6927097", "0.6825883", "0.67526937", "0.6658176", "0.6651976", "0.65532917", "0.6422756", "0.6384636", "0.638339", "0.63811976", "0.6377756", "0.63681", "0.63496214", "0.633937", "0.63225573", "0.63097596", "0.63071275", "0.6304865", "0.6235367",...
0.0
-1
Routine for sending data forward in time (nonblocking)
def isend(self, dest=None, tag=None, comm=None): return comm.isend(self, dest=dest, tag=tag)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_data(self, data, time):\n pass", "def sendall(self, data):\n while data and self.running:\n ret = self.sendFn(data[:MAX_SEND_SIZE])\n assert ret > 0\n data = data[ret:]", "def nonblocking_send(self, data):\n try:\n if len(data) == 0:\n ...
[ "0.731677", "0.69155127", "0.683366", "0.67629844", "0.66871953", "0.6625277", "0.64126647", "0.63910866", "0.63096064", "0.6301206", "0.6290626", "0.6284213", "0.6281181", "0.62581146", "0.62326896", "0.62172097", "0.6213326", "0.62094146", "0.61989105", "0.61908275", "0.617...
0.0
-1
Routine for receiving in time
def recv(self, source=None, tag=None, comm=None): part = comm.recv(source=source, tag=tag) self.pos[:] = part.pos.copy() self.vel[:] = part.vel.copy() self.m = part.m.copy() self.q = part.q.copy() return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recv_ts(self) -> int:\n pass", "def receive(self, packet, time):\n raise NotImplementedError", "def handleReturnTime(rtt):\n pass", "def sendTime(self):\n timestamp = datetime.datetime.now().strftime(\"%A, %d. %B %Y %I:%M%p\")\n self.send(timestamp)", "def receive_eve...
[ "0.70089287", "0.6884526", "0.6857238", "0.6805326", "0.6590571", "0.65366685", "0.6528338", "0.64993405", "0.6413793", "0.6379032", "0.63445044", "0.6328772", "0.62992907", "0.62992907", "0.6283762", "0.6253673", "0.6244733", "0.6216846", "0.62057245", "0.6201179", "0.620011...
0.0
-1
Overloading the addition operator for fields types
def __add__(self, other): if isinstance(other, type(self)): # always create new fields, since otherwise c = a - b changes a as well! p = fields(self) p.elec[:] = self.elec + other.elec p.magn[:] = self.magn + other.magn return p else: raise DataError("Type error: cannot add %s to %s" % (type(other), type(self)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other: Any) -> ColumnOperators:\n return self.operate(add, other)", "def __add__(self, other):\n try:\n total = {self.var: 1, other.var: 1}\n return AutoDiffReverse(self.val + other.val, None, der=total)\n except AttributeError:\n return Aut...
[ "0.70417506", "0.69787914", "0.688292", "0.6869126", "0.6797251", "0.67966515", "0.67823577", "0.6694425", "0.66731805", "0.6661316", "0.6661316", "0.66475755", "0.6635631", "0.6635631", "0.6613988", "0.66052085", "0.65744835", "0.6570402", "0.6558253", "0.65581644", "0.65564...
0.7395196
0
Overloading the subtraction operator for fields types
def __sub__(self, other): if isinstance(other, type(self)): # always create new fields, since otherwise c = a - b changes a as well! p = fields(self) p.elec[:] = self.elec - other.elec p.magn[:] = self.magn - other.magn return p else: raise DataError("Type error: cannot subtract %s from %s" % (type(other), type(self)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sub__(self, other):\n try:\n total = {self.var: 1, other.var: -1}\n return AutoDiffReverse(self.val - other.val, None, der=total)\n except AttributeError:\n return AutoDiffReverse(self.val - other, None, {self.var: 1})", "def __rsub__(self, other):\n tr...
[ "0.68123215", "0.65827966", "0.658205", "0.65601283", "0.6536032", "0.6514197", "0.6397643", "0.6376854", "0.6373891", "0.63729715", "0.6359867", "0.6323568", "0.63116324", "0.6266902", "0.62532926", "0.624705", "0.624705", "0.6241416", "0.62308973", "0.6229982", "0.6229982",...
0.7506139
0
Overloading the multiply with factor from right operator for fields types
def __rmul__(self, other): if isinstance(other, float): # always create new fields, since otherwise c = a - b changes a as well! p = fields(self) p.elec[:] = other * self.elec p.magn[:] = other * self.magn return p else: raise DataError("Type error: cannot multiply %s with %s" % (type(other), type(self)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __mul__(self, other: Any) -> ColumnOperators:\n return self.operate(mul, other)", "def __mul__(self: _TT, other: float) -> _TT:\n return type(self)(str(self.value * other),\"\")", "def __mul__(self, other, **kwargs):\n kwargs.update({'operator': 'mul'})\n return self.__add__(oth...
[ "0.7637235", "0.75161517", "0.7407263", "0.7326037", "0.7278116", "0.72107786", "0.71714556", "0.7157849", "0.7142031", "0.7124826", "0.7087941", "0.707973", "0.7029224", "0.70278025", "0.7017292", "0.7013551", "0.6969518", "0.69458455", "0.6943746", "0.6943483", "0.6938702",...
0.69146836
23
PSNR between two images
def _psnr(img1, img2): mse = np.mean((img1 - img2) ** 2) if mse == 0: return 100 PIXEL_MAX = 1 return (20 * math.log10(PIXEL_MAX)) - (10 * math.log10(mse))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computePSNR(img1, img2, pad_y=0, pad_x=0):\n if pad_y != 0 and pad_x != 0:\n img1_u = (np.clip(img1, 0, 255.0)[pad_y:-pad_y, pad_x:-pad_x, ...]).astype(dtype=np.uint8)\n img2_u = (np.clip(img2, 0, 255.0)[pad_y:-pad_y, pad_x:-pad_x, ...]).astype(dtype=np.uint8)\n else:\n img1_u = (np....
[ "0.8011122", "0.791417", "0.7270669", "0.7199645", "0.7080047", "0.6986541", "0.69765127", "0.6821519", "0.67978144", "0.67174155", "0.6548654", "0.6511339", "0.6409773", "0.637189", "0.6161479", "0.60819566", "0.5994104", "0.58915156", "0.58915156", "0.58762085", "0.5791571"...
0.79002017
2
PSNR between two arrays
def psnr(y, y_pred, verbose=True): psnr_sum = 0 for i in range(len(y)): psnr_sum += _psnr(y[i], y_pred[i]) if verbose: print(f"Mean PSNR {psnr_sum / len(y)}") return psnr_sum / len(y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_psnr_with_two_completely_different_sets(self):\n low = np.zeros((10, 500, 500, 1), dtype=np.uint8)\n high = np.ones((10, 500, 500, 1), dtype=np.uint8) * 255\n\n avg_psnr = np.array(psnr(high, low)).mean()\n self.assertEqual(avg_psnr, 0.0)", "def _comput_PSNR(self, input, targ...
[ "0.67593676", "0.6583941", "0.6571986", "0.6554812", "0.6508913", "0.6467811", "0.6447499", "0.62350047", "0.6199426", "0.6098049", "0.60345674", "0.60345674", "0.5925496", "0.58263636", "0.58061653", "0.58047163", "0.57209736", "0.5715212", "0.56880504", "0.56373477", "0.563...
0.54374504
39
MSE between two arrays
def mse(y, y_pred, verbose=True): mse_sum = 0 for i in range(len(y)): mse_sum += mean_squared_error(y[i], y_pred[i]) if verbose: print(f"Mean MSE {mse_sum / len(y)}") return mse_sum / len(y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mse(a, b):\n a = numpy(a)\n b = numpy(b)\n return ((a - b) ** 2).sum()", "def rmse_calc(arr1, arr2):\n assert arr1.shape==arr2.shape\n \n return np.sqrt(np.mean((arr2-arr1)**2))", "def MSE(a,b,axis):\n return ((a-b)**2).mean(axis=axis)", "def mse(image1: np.ndarray, image2: np.ndarray) ...
[ "0.7542618", "0.7358524", "0.71128005", "0.7101528", "0.7070503", "0.70539194", "0.70428056", "0.7029061", "0.70196426", "0.6944558", "0.6933053", "0.68064827", "0.67791283", "0.67727405", "0.67626035", "0.67504066", "0.6732543", "0.67134595", "0.6677729", "0.65477544", "0.65...
0.0
-1
SSIM between two arrays of images
def ssim(y, y_pred, verbose=True): ssim_sum = 0 for i in range(len(y)): ssim_sum += structural_similarity(y[i], y_pred[i]) if verbose: print(f"Mean SSIM {ssim_sum / len(y)}") return ssim_sum / len(y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_images(img1,img2):", "def computeSSIM(img1, img2, pad_y=0, pad_x=0):\n if pad_y != 0 and pad_x != 0:\n img1_u = (np.clip(img1, 0, 255.0)[pad_y:-pad_y, pad_x:-pad_x, ...]).astype(dtype=np.uint8)\n img2_u = (np.clip(img2, 0, 255.0)[pad_y:-pad_y, pad_x:-pad_x, ...]).astype(dtype=np.ui...
[ "0.74889344", "0.67036545", "0.6571887", "0.65122443", "0.64808476", "0.6370916", "0.6308732", "0.62787664", "0.62620807", "0.62355393", "0.6224311", "0.6201802", "0.61937666", "0.61699677", "0.6163589", "0.6148197", "0.60919136", "0.60919136", "0.6080456", "0.6079969", "0.60...
0.0
-1
The names of the roles performed by the model. This is required by QtQuick
def roleNames(self): return self._roles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roles(self):\n return self._roles", "def roles(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"roles\")", "def roles(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"roles\")", "def object_role_names(s...
[ "0.7476474", "0.73596126", "0.73596126", "0.73139435", "0.7310977", "0.7254139", "0.7241115", "0.7161311", "0.7130106", "0.71001154", "0.7057589", "0.7041748", "0.7031347", "0.69231516", "0.69207555", "0.68998986", "0.6880031", "0.6854992", "0.6836892", "0.6824553", "0.679437...
0.7644932
0
Save the instrument script to a file
def export(self, path): path = path[7:] if path[0] == "/" and path[2] == ":": path = path[1:] # Windows fix with open(path, "w") as outfile: outfile.write(self.script)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveauto(self):\n self.inp.getedge()\n ss=ss=strftime(\"_%Y-%m-%d_%H:%M:%S\", gmtime())\n fn=os.environ['VMEWORKDIR'] +\"/WORK/phases/\"+self.name+ss+self.inp.edge+\"_\"+self.inp.inpnum+\"_\"+self.inp.ctpnum+\".ps\"\n rc=self.c1.postscript(file=fn)\n if rc is not '':\n MywError(errmsg=\"File...
[ "0.70398337", "0.66688", "0.6626497", "0.6604999", "0.6573816", "0.6538797", "0.6495883", "0.6472696", "0.64520216", "0.64416486", "0.6366099", "0.6365805", "0.63635427", "0.63568205", "0.63320476", "0.63086146", "0.62524873", "0.62345755", "0.62287915", "0.62133014", "0.6172...
0.6128726
25
Save the current state to a file
def save(self, path, alignment, positions): path = path[7:] if path[-5:] != ".json": path += ".json" if path[0] == "/" and path[2] == ":": path = path[1:] # Windows fix with open(path, "w") as outfile: value = { "angleCommand": self._angle_command, "horizontalCommand": self._horizontal_command, "verticalCommand": self._vertical_command, "origin": self._origin, "frameWidth": self._frame_width, "frameHeight": self._frame_height, "runs": [r.to_json() for r in self._runs], "alignment": alignment.to_dict(), "positions": positions.to_dict() } json.dump(value, outfile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveState(self, file):\n state = self.context.getState(getPositions=True, getVelocities=True, getParameters=True, getIntegratorParameters=True)\n xml = mm.XmlSerializer.serialize(state)\n if isinstance(file, str):\n with open(file, 'w') as f:\n f.write(xml)\n ...
[ "0.8169854", "0.802114", "0.79456836", "0.7888457", "0.78155065", "0.7731117", "0.7627129", "0.75945497", "0.7590737", "0.75843394", "0.7554501", "0.7541444", "0.74861246", "0.7482532", "0.74790096", "0.7468032", "0.7460777", "0.74439883", "0.7396383", "0.7396383", "0.7384259...
0.0
-1
Read the state from a file
def load(self, path, alignment, positions): path = path[7:] if path[-5:] != ".json": path += ".json" if path[0] == "/" and path[2] == ":": path = path[1:] # Windows fix with open(path, "r") as infile: value = json.load(infile) self._angle_command = value["angleCommand"] self._horizontal_command = value["horizontalCommand"] self._vertical_command = value["verticalCommand"] self._frame_width = value["frameWidth"] self.frameWidthChanged.emit() self._frame_height = value["frameHeight"] self._origin = value["origin"] self.beginRemoveRows(QModelIndex(),0,len(self._runs)-1) self.endRemoveRows() if value["runs"]: self.beginInsertRows(QModelIndex(), 0, len(value["runs"])-1) self._runs = [SingleRun.from_json(self, r) for r in value["runs"]] self.endInsertRows() alignment.from_dict(value["alignment"]) positions.from_dict(value["positions"]) self.frameHeightChanged.emit() self.validChanged.emit() self.scriptChanged.emit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_state_file(self):\r\n with open(StudentModuleHistoryCleaner.STATE_FILE) as state_file:\r\n return state_file.read()", "def read_state(self, file):\n try:\n with open(file, 'r') as f:\n state = json.load(f)\n except IOError as e:\n logg...
[ "0.79414666", "0.73601097", "0.73104596", "0.71004415", "0.70303845", "0.70303845", "0.701008", "0.6921969", "0.689979", "0.68704414", "0.6858411", "0.68411195", "0.68014264", "0.67528075", "0.67309463", "0.6665738", "0.66562074", "0.6639629", "0.6635025", "0.6634156", "0.657...
0.0
-1
The horizontal center of rotation.
def origin(self): return self._origin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def horiz_center(self):\n return self._horiz_center", "def horiz_center(self):\n return self._horiz_center", "def rotation_center_x(self, *args, **kwargs) -> Any:\n pass", "def center(self):\n return self.pos + self.axis / 2.0", "def rotation_center(self, *args, **kwargs) -> Any...
[ "0.7565997", "0.7565997", "0.7496786", "0.74307644", "0.7374164", "0.73705566", "0.7350087", "0.7348408", "0.73358035", "0.71673024", "0.70586854", "0.70101935", "0.7006534", "0.69662935", "0.69427985", "0.6927156", "0.69266474", "0.68949395", "0.68809116", "0.68760055", "0.6...
0.0
-1
The physical width in mm of the reference frame in the photograph
def frameWidth(self): return self._frame_width
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWidth(self):\r\n width = 1\r\n if self.orientation == \"h\":\r\n width = self.size\r\n return width", "def getWidth(self):\n area = self.getArea()\n length = self.getLength()\n return area / length", "def get_width(self) -> int:\n return self.r...
[ "0.7777585", "0.77179724", "0.768844", "0.7662584", "0.758126", "0.757602", "0.7558276", "0.749808", "0.7468271", "0.74638665", "0.7462626", "0.7425399", "0.7418057", "0.7411394", "0.7389598", "0.73888046", "0.7365202", "0.7350629", "0.73443985", "0.7315457", "0.73142976", ...
0.71373034
54
The physical height in mm of the reference in the photograph
def frameHeight(self): return self._frame_height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getHeight(self):\r\n height = 1\r\n if self.orientation == \"v\":\r\n height = self.size\r\n return height", "def height(self) -> int:", "def height(self) -> int:", "def height(self) -> int:", "def height(self):\n yy = self.yy\n return max(yy) - min(yy)", ...
[ "0.7840666", "0.7595656", "0.7595656", "0.7595656", "0.751236", "0.7481456", "0.7390257", "0.7385717", "0.7385174", "0.73824626", "0.73762196", "0.73762196", "0.7343244", "0.73425585", "0.73327744", "0.7330128", "0.7315331", "0.7312233", "0.7302953", "0.7289399", "0.7289399",...
0.0
-1
The outline of the command used to perform a angle run
def angleCommand(self): return self._angle_command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd(self):", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli...
[ "0.64293647", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986", "0.62761986"...
0.6085803
34
The outline of the command used to perform a horizontal run
def horizontalCommand(self): return self._horizontal_command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hr() -> None:\n width, _ = click.get_terminal_size()\n click.echo('-' * width)", "def _display_command(self):\n idx = self.current_idx # Local copy to avoid race condition updates\n output = self.outputs[idx]\n if output is None:\n self.screen.addstr('Waiting for comman...
[ "0.6144864", "0.60430384", "0.60299814", "0.59511566", "0.5867638", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", "0.5822455", ...
0.64010274
0
The outline of the command used to perform a vertical run
def verticalCommand(self): return self._vertical_command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():"...
[ "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714", "0.59563714"...
0.6988323
0
The current number of runs
def count(self): return len(self._runs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_run_idx(self):\n return self.num_runs", "def number_of_launches(self):\n return self._number_of_launches", "def number_of_iterations(self) -> int:\n pass", "def num_runs(self):\n return len(self._h5[RUNS])", "def run(self) -> int:\n self._times_called += 1\n ...
[ "0.76630276", "0.75599295", "0.74130595", "0.7332917", "0.73038995", "0.72296184", "0.7181953", "0.7181953", "0.71678597", "0.7135644", "0.6975584", "0.6965288", "0.6940288", "0.6895412", "0.6895412", "0.68646985", "0.68560135", "0.68351436", "0.6822677", "0.68223685", "0.682...
0.77989334
0
The current number of runs. This is required by QtQuick
def rowCount(self, index=QModelIndex()): return len(self._runs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_launches(self):\n return self._number_of_launches", "def next_run_idx(self):\n return self.num_runs", "def count(self):\n return len(self._runs)", "def num_launches(self):\n return len(self.launches)", "def num_trials(self):", "def num_runs(self):\n return...
[ "0.7597703", "0.7347741", "0.72782546", "0.71634763", "0.70761245", "0.70040226", "0.6842851", "0.6821602", "0.67603767", "0.65716016", "0.6482918", "0.6470233", "0.6462451", "0.6448073", "0.64193875", "0.64025664", "0.63683856", "0.6359015", "0.6359015", "0.6350764", "0.6343...
0.6444586
14