query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Parse NRRD vector from string into Numpy array. Function parses NRRD vector from string into an 1D Numpy array.
def parse_vector(x, dtype=None): if x[0] != '(' or x[-1] != ')': raise NrrdError('Vector should be enclosed by parentheses.') # Always convert to float and then truncate to integer if desired # The reason why is parsing a floating point string to int will fail (i.e. int('25.1') will fail) vect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_array(arg):\n\n res = arg.replace('[', '').replace(']', '').replace(',', '')\n return np.array(res.split(' '), dtype=np.int8)", "def str2np(s: str) -> np.ndarray:\n return np.array(json.loads(s))", "def deserialize_numpy(self, str, numpy):\n try:\n end = 0\n start = end\n ...
[ "0.6304405", "0.6169", "0.5857878", "0.58423615", "0.58386296", "0.5777275", "0.5748227", "0.5737619", "0.57040703", "0.57039124", "0.5700754", "0.5677522", "0.5667068", "0.56551737", "0.5635012", "0.5596183", "0.55839247", "0.55587405", "0.55100596", "0.5500904", "0.5494042"...
0.62473136
1
Parse optional NRRD vector from string into Numpy array. Function parses optional NRRD vector from string into an 1D Numpy array. This function works the same as
def parse_optional_vector(x, dtype=None): if x == 'none': return None else: return parse_vector(x, dtype)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_to_numpy(string_array):\n if pd.isnull(string_array):\n return(np.NaN)\n else:\n return np.array(ast.literal_eval(string_array))", "def str2np(s: str) -> np.ndarray:\n return np.array(json.loads(s))", "def parse_optional_matrix(x):\n\n # Split input by spaces to get each row a...
[ "0.5847317", "0.58026725", "0.5715926", "0.570887", "0.5668669", "0.5661971", "0.56577307", "0.5571466", "0.5461365", "0.5440681", "0.5404984", "0.5365434", "0.536448", "0.5355483", "0.53133684", "0.5281373", "0.5263809", "0.5219626", "0.5170426", "0.51624835", "0.51341987", ...
0.6086798
0
Parse NRRD matrix from string into Numpy array. Function parses NRRD matrix from string into an 2D Numpy array.
def parse_matrix(x, dtype=None): # Split input by spaces, convert each row into a vector and stack them vertically to get a matrix matrix = [parse_vector(x, dtype=float) for x in x.split()] # Get the size of each row vector and then remove duplicate sizes # There should be exactly one value in the mat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_matrix(inputfile, nrows, ncols, ncolsblock):\n nparray = numpy.empty(shape=(nrows, ncols))\n line = next(inputfile)\n assert len(line.split()) == min(ncolsblock, ncols)\n colcounter = 0\n while colcounter < ncols:\n # If the line is just the column header (in...
[ "0.6300853", "0.6286205", "0.6221273", "0.61275244", "0.60501814", "0.60225636", "0.5973799", "0.5956892", "0.59442747", "0.59313303", "0.5919352", "0.5868928", "0.5822526", "0.5746525", "0.57122576", "0.5706115", "0.57045245", "0.56609154", "0.56443465", "0.56294835", "0.560...
0.6614179
0
Parse optional NRRD matrix from string into Numpy array. Function parses optional NRRD matrix from string into an 2D Numpy array. This function works the same as
def parse_optional_matrix(x): # Split input by spaces to get each row and convert into a vector. The row can be 'none', in which case it will # return None matrix = [parse_optional_vector(x, dtype=float) for x in x.split()] # Get the size of each row vector, 0 if None sizes = np.array([0 if x is N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_matrix(x, dtype=None):\n\n # Split input by spaces, convert each row into a vector and stack them vertically to get a matrix\n matrix = [parse_vector(x, dtype=float) for x in x.split()]\n\n # Get the size of each row vector and then remove duplicate sizes\n # There should be exactly one value...
[ "0.58270955", "0.5824414", "0.5761667", "0.56668764", "0.56351495", "0.55596626", "0.55534637", "0.55051434", "0.54614216", "0.54158604", "0.5383043", "0.5376903", "0.5327545", "0.5294685", "0.52854365", "0.52804714", "0.5276196", "0.51956904", "0.51789623", "0.5151595", "0.5...
0.663199
0
Parse NRRD number list from string into Numpy array. Function parses NRRD number list from string into an 1D Numpy array.
def parse_number_list(x, dtype=None): # Always convert to float and then perform truncation to integer if necessary number_list = np.array([float(x) for x in x.split()]) if dtype is None: number_list_trunc = number_list.astype(int) if np.all((number_list - number_list_trunc) == 0): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_data(fn):\n data = []\n with open(fn, \"rb\") as f:\n for line in f:\n if py_ver == 3:\n # Python 3 code in this block\n dline = \"\".join(filter(lambda char: char != '\"', line.decode())).split(\",\")\n else:\n # Python 2 co...
[ "0.61555356", "0.60433227", "0.6022849", "0.59403074", "0.5938853", "0.58559996", "0.58298135", "0.5813674", "0.5772841", "0.5748721", "0.5742109", "0.5710649", "0.5671005", "0.56105345", "0.5590913", "0.55334914", "0.548106", "0.54765934", "0.54631907", "0.5392359", "0.53786...
0.6047471
1
Format a 1D Numpy array into NRRD vector string Function converts a 1D Numpy array into a string using NRRD vector format.
def format_vector(x): return '(' + ','.join([format_number(y) for y in x]) + ')'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __to_xml_vector__(array, format_=\"%f\"):\n output = ''\n for i in array:\n output = (\"%s<value>\" + format_ + \"</value>\") % (output, i)\n return output", "def vector_to_str(vector):\n output_str = \"[\"\n for i in vector:\n output_str += str(i) + \...
[ "0.65962124", "0.6406507", "0.63462204", "0.61922514", "0.61029047", "0.6052695", "0.59530616", "0.5933476", "0.5933185", "0.5923297", "0.5884527", "0.5785703", "0.5735033", "0.5705236", "0.568707", "0.56810564", "0.5595331", "0.5542254", "0.55008036", "0.5495679", "0.5464964...
0.6743971
0
Format a 2D Numpy array into a NRRD optional matrix string Function converts a 2D Numpy array into a string using the NRRD matrix format. For any rows of the matrix that contain all NaNs for each element, the row will be replaced with a 'none' indicating the row has no vector.
def format_optional_matrix(x): return ' '.join([format_optional_vector(y) for y in x])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_optional_matrix(x):\n\n # Split input by spaces to get each row and convert into a vector. The row can be 'none', in which case it will\n # return None\n matrix = [parse_optional_vector(x, dtype=float) for x in x.split()]\n\n # Get the size of each row vector, 0 if None\n sizes = np.array(...
[ "0.622035", "0.5954527", "0.5928205", "0.5912855", "0.5727499", "0.57008296", "0.56179947", "0.5614566", "0.55843174", "0.54149926", "0.53773344", "0.53477156", "0.532382", "0.53015757", "0.5123682", "0.511336", "0.5099299", "0.5092014", "0.5065899", "0.5063694", "0.5053405",...
0.72085553
0
For NRRD files, the first four characters are always "NRRD", and remaining characters give information about the file format version >>> _validate_magic_line('NRRD0005') 8 >>> _validate_magic_line('NRRD0006')
def _validate_magic_line(line): if not line.startswith('NRRD'): raise NrrdError('Missing magic "NRRD" word. Is this an NRRD file?') try: if int(line[4:]) > 5: raise NrrdError('NRRD file version too new for this library.') except ValueError: raise NrrdError('Invalid NRRD m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_header(self, cleartext_header, decrypted_header):\n import struct\n\n magic_number1 = struct.unpack(\"!I\", decrypted_header[:4])[0]\n # file_version = struct.unpack(\"!I\", decrypted_header[4:8])[0]\n # key_stretches = struct.unpack(\"!I\", decrypted_header[8:12])[0]\n ...
[ "0.569201", "0.56090045", "0.5599128", "0.5566738", "0.55418366", "0.5524839", "0.55238646", "0.5521166", "0.54416674", "0.5324497", "0.5295214", "0.5292996", "0.5256851", "0.5239331", "0.52130955", "0.52078396", "0.52056634", "0.5189201", "0.5186579", "0.5170318", "0.5164074...
0.8453927
0
Read a nrrd file and return a tuple (data, header).
def read(filename): with open(filename, 'rb') as filehandle: header = read_header(filehandle) data = read_data(header, filehandle, filename) return (data, header)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_nrrd(filename: str, header: bool = False) -> np.ndarray:\n\n readdata, headera = nrrd.read(filename)\n if header:\n return readdata, headera\n return readdata", "def _read_netCDF(filename):\n if any(fn in os.path.basename(filename) for fn in L1B_MATCHES):\n with h5py.File(filen...
[ "0.72777086", "0.61576784", "0.61218196", "0.60504836", "0.603015", "0.6007572", "0.5969267", "0.59621364", "0.59205115", "0.5912119", "0.587677", "0.5868448", "0.58651245", "0.5862413", "0.58299124", "0.5826855", "0.5811129", "0.5797746", "0.5797746", "0.5797044", "0.5772246...
0.69515914
1
Write the numpy data to a nrrd file. The nrrd header values to use are inferred from from the data. Additional options can be passed in the options dictionary. See the read() function for the structure of this dictionary. To set data samplings, use e.g. `options['spacings'] = [s1, s2, s3]` for 3d data with sampling del...
def write(filename, data, options={}, detached_header=False): # Infer a number of fields from the ndarray and ignore values # in the options dictionary. options['type'] = _TYPEMAP_NUMPY2NRRD[data.dtype.str[1:]] # Do not add endianness if encoding is ASCII if data.dtype.itemsize > 1 and options.get('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Writefile(self, outfile, verbose=True):\n \n self.outfile = outfile\n \n # Write SUNTANS grid to file\n nc = Dataset(outfile, 'w', format='NETCDF3_CLASSIC')\n nc.Description = 'SUNTANS subsetted history file'\n nc.Author = ''\n nc.Created = datetime.now()...
[ "0.5739559", "0.56466764", "0.5640623", "0.5638154", "0.56262475", "0.5625368", "0.5617781", "0.5581827", "0.5548383", "0.5436935", "0.5368643", "0.5358188", "0.53547275", "0.53422153", "0.5312903", "0.53039026", "0.52988434", "0.52966446", "0.527856", "0.52752066", "0.52733"...
0.7623156
0
Signal port readiness. Send SIGUSR1 signal to container, which the startup script is waiting on, to indicate that the veth ports have been created and recorded in the file it needs to read so that the behavioral model can be started. Also maybe because the virtual ethernet ports have been moved into the containers name...
def signal_ready(self): self._container.kill(signal.SIGUSR1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen_for_io_signal(self, flask_port):\n from socketIO_client import SocketIO\n print('server:', self.server, flask_port)\n self.io_client = SocketIO(self.server, flask_port)\n self.io_client.emit('listening', {'serial': self.serial})\n self.io_client.on('unlock', self.handl...
[ "0.5374", "0.5148628", "0.50763386", "0.5075406", "0.5052226", "0.50419664", "0.5035024", "0.49928218", "0.49739683", "0.49607196", "0.49360502", "0.48334888", "0.4798951", "0.47831273", "0.47776225", "0.47646642", "0.4749002", "0.47433737", "0.4731901", "0.4721227", "0.47059...
0.54740417
0
Convert pymunk to pygame coordinates
def to_pygame(self, p): return int(p.x), int(-p.y+600)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_pygame(p):\n return int(p.x), int(-p.y+600)", "def to_pygame(point):\n return int(point.x), int(-point.y+500)", "def to_pygame(coords):\r\n return (coords[0], HEIGHT - coords[1])", "def convert_to_pygame(pos):\n return int(pos.x), int(-pos.y+600)", "def to_map_pos(self, screen_pos):\n ...
[ "0.72971404", "0.70129144", "0.6964944", "0.6605102", "0.65387213", "0.64405024", "0.6396792", "0.62161815", "0.61861384", "0.60727125", "0.60605836", "0.6026168", "0.60190177", "0.5959261", "0.59222806", "0.5910622", "0.5907007", "0.59053713", "0.58672", "0.5865513", "0.5850...
0.7274076
1
Get bin ID from absolute coordinates.
def abs_coord_2_bin(c, abs_pos, chroms, chrom_cum_lengths, chrom_sizes): try: chr_id = np.flatnonzero(chrom_cum_lengths > abs_pos)[0] - 1 except IndexError: return c.info['nbins'] chrom = chroms[chr_id] rel_pos = abs_pos - chrom_cum_lengths[chr_id] return c.offset((chrom, rel_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBinIndex(self, x):\n\t\tb = -1\n\t\tif x == self._max_val: # final bin is [low, high], where others are [low,high)\n\t\t\tb = len(self._bins)-1\n\t\telse:\n\t\t\tb = math.floor((x-self._min_val)/self._bin_width)\n\t\treturn int(b)", "def bin_index(self, xnorm):\n return _bin_index(xnorm, self.nbins...
[ "0.6532749", "0.60642797", "0.6019951", "0.59964436", "0.5990964", "0.5922509", "0.58200943", "0.57147586", "0.5676508", "0.5670047", "0.56318897", "0.5595353", "0.5589254", "0.557879", "0.549587", "0.54341185", "0.54341185", "0.5429755", "0.54286414", "0.54257023", "0.541288...
0.6150936
1
Explode a GeoJSON geometry's coordinates object and yield coordinate tuples. As long as the input is conforming, the type of the geometry doesn't matter.
def explode(coords): for e in coords: if isinstance(e, (float, int, long)): yield coords break else: for f in explode(e): yield f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geomFromInteriorPoints(coords):\n if isinstance(coords, numpy.ndarray):\n coords = coords.tolist()\n geomDict = {'type':'MultiPoint', 'coordinates':coords}\n geomPoints = ogr.CreateGeometryFromJson(repr(geomDict))\n return geomPoints", "def getCoords(geom):\n geomDict = eval(geom.Export...
[ "0.6310954", "0.6286501", "0.6224508", "0.61245656", "0.61227405", "0.61075085", "0.58908945", "0.5888281", "0.5884113", "0.58764863", "0.58513206", "0.5839912", "0.5814071", "0.57629925", "0.5734253", "0.5729233", "0.56301165", "0.560742", "0.55914867", "0.55578196", "0.5543...
0.6802374
0
LOD friendly. Gets Inactive Days. From Configurator.
def get_inactive_days(self): #print() #print('Configurator - Get Inactive Days') days_inactive = [] if self.name not in [False]: for day in self.day_line: # Respects the LOD if day.holiday: days_inactive.append(day.date) return days_inactive
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_days(self):\r\n return 1", "def get_dutyCycleAtPowerOn(self):\n # res\n if self._cacheExpiration <= YAPI.GetTickCount():\n if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS:\n return YPwmOutput.DUTYCYCLEATPOWERON_INVALID\n res ...
[ "0.64449954", "0.5934396", "0.5876667", "0.5833705", "0.5830814", "0.5817965", "0.58149815", "0.58149815", "0.578797", "0.5740111", "0.5715397", "0.56804144", "0.56518024", "0.5642795", "0.5573022", "0.5567635", "0.5549867", "0.5542396", "0.5487861", "0.5433802", "0.54313314"...
0.69282997
0
Compute absorption coefficients as product cross section times molecular density, summed over all molecules. xsMatrix is a "matrix" of cross sections with npT=nLevels rows and nGas columns,
def sum_xsTimesDensity (xsMatrix, densities, commonFreq=True, interpolate='3', verbose=False): # print information about input data: both matrices should have the same shape nMol, npT = np.array(xsMatrix).shape nLevels, nGas = densities.shape print '\n nLevels, nMol:', nMol, npT, ' xsMatrix ', nLevels, nGas, ' de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def designMatrix(self,x,m):\n\n phi = []\n\n for i in x:\n matric = []\n for j in range(0, m + 1):\n matric.append(np.power(i,j))\n phi.append(matric)\n return np.asarray(phi)", "def assembleMatrices(self):\n # All nodes informations\n ...
[ "0.5630799", "0.55543566", "0.5525025", "0.54904616", "0.54707825", "0.5384488", "0.5381137", "0.53127646", "0.5304241", "0.52873653", "0.5276127", "0.52592444", "0.52551264", "0.52384377", "0.52354974", "0.52268493", "0.51838636", "0.5176079", "0.5139989", "0.51368153", "0.5...
0.58867294
0
Show all buckets for account
def list_buckets(): for bucket in s3.buckets.all(): print(bucket)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_buckets():\n for bucket in BUCKET_MANAGER.all_buckets():\n print(bucket)", "def listAllBuckets(self):\n print self.getAllBuckets()", "def list_all_buckets(riak_host,riak_port):\n url='http://%s:%s/buckets?buckets=true' % (riak_host,riak_port)\n r=requests.get(url)\n print jso...
[ "0.80497444", "0.7771238", "0.73688275", "0.72828764", "0.72732866", "0.7210507", "0.7165088", "0.71304774", "0.7020062", "0.6904943", "0.68432635", "0.6829519", "0.6762328", "0.6722523", "0.6612179", "0.66116047", "0.65461797", "0.6538473", "0.6527566", "0.6489969", "0.64674...
0.7840097
1
Add a bucket if it already exist it will exit gracefully
def add_bucket(bucket_name): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_bucket(empty_bucket): # pylint: disable=redefined-outer-name\n empty_bucket.insert(\"key 1\", \"value 1\")\n return empty_bucket", "def ensure_bucket(bucket: BucketLocation) -> None:\n if not bucket_exists(bucket):\n create_bucket(bucket)", "def create_bucket() -> None:\n try:\n ...
[ "0.741708", "0.7365315", "0.727142", "0.72379696", "0.7126946", "0.69747794", "0.6930565", "0.6929577", "0.6923931", "0.6832506", "0.6813384", "0.6790791", "0.67157924", "0.67026395", "0.6687666", "0.66745895", "0.6661042", "0.6627", "0.6619047", "0.6579396", "0.6533454", "...
0.80576354
0
y is a list of length t indicating which of the magic gates we put an S gate on if y[i] == 1 then the ith magic qubit gets an S if y[i] == 0 then the ith magic qubit does not get an S
def magic_sample(self, ys): #for each non-zero element in y #we want to multiply the initial state by HGate(i) SGate(i) HGate(i) #this turns out to be equivalent to multiplying the whole final state by #U H_k S_k H_k U^\dagger #but H_k S_k H_k = e^{i\pi/4} \frac{1}{\sqrt{2}} (I ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_output_hydro_rule(_m, g, y, s, t):\r\n\r\n if y != m.Y.last() and t != m.T.last():\r\n return (- m.sigma_1[g, y, s, t] + m.sigma_8[g, y, s, t]\r\n + m.sigma_20[g, y, s, t] - m.sigma_20[g, y, s, t + 1]\r\n - m.sigma_23[g, y, s, t] + m...
[ "0.6018289", "0.5715542", "0.5660033", "0.5622897", "0.55464303", "0.54023945", "0.53928316", "0.53850645", "0.5369403", "0.5325158", "0.5305767", "0.5300212", "0.5289091", "0.52594733", "0.52549297", "0.52446645", "0.52300483", "0.5200511", "0.51941687", "0.5185682", "0.5146...
0.6503296
0
Same as `BaseConnection.__enter__()` but returns `Connection` object rather than a `BaseConnection` object.
def __enter__(self) -> "Connection": if (not self.connected): self.connect() return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __enter__(self):\n return self.connection.__enter__", "def __enter__(self):\n self.connect()\n return self", "def __enter__(self):\n try:\n self.conn = sqlite3.connect(self.database_configuration)\n self.cursor = self.conn.cursor()\n\n return sel...
[ "0.8185432", "0.7195224", "0.70032036", "0.68952566", "0.68555135", "0.68120736", "0.6736196", "0.6728208", "0.6636852", "0.6616954", "0.6601591", "0.6601591", "0.65961564", "0.65285754", "0.6523009", "0.65168345", "0.6500597", "0.6497132", "0.6469238", "0.64375794", "0.64323...
0.80172914
1
Returns the entire receive queue The queue will be a `queue_size`sized list that contains tuples (timestamp received, received bytes).
def get_all_rcv(self) -> "list[tuple[float, bytes]]": return self._rcv_queue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_queue(self):\n query = \"\"\"SELECT server,\n otp,\n modified,\n info,\n server_nonce\n FROM queue\"\"\"\n self._execute(query)\n return self._dictfetchall()", "de...
[ "0.6662133", "0.65937424", "0.65805864", "0.65619344", "0.65354866", "0.65004027", "0.64574426", "0.6380644", "0.6367891", "0.63407713", "0.63293487", "0.63116616", "0.6268842", "0.625483", "0.6203705", "0.6202019", "0.6188723", "0.6175941", "0.61608964", "0.61511266", "0.615...
0.7119077
0
Returns entire receive queue as string. Each bytes object will be passed into `conv_bytes_to_str()`. This means that `read_until` and `strip` will apply to EVERY element in the receive queue before returning.
def get_all_rcv_str(self, read_until: t.Union[str, None] = None, strip: bool = True) -> "list[tuple[float, str]]": return [(ts, self.conv_bytes_to_str(rcv, read_until=read_until, strip=strip)) for ts, rcv in self._rcv_queue]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_nonblock(self):\n out_str = []\n\n try:\n while not self.queue.empty():\n out_str.append(self.queue.get_nowait())\n except Empty:\n pass\n\n return \"\\n\".join(out_str)", "def conv_bytes_to_str(self, rcv: bytes, read_until: t.Union[str, N...
[ "0.7413211", "0.70442504", "0.6801859", "0.66418153", "0.64977556", "0.6075878", "0.604919", "0.60158694", "0.5947345", "0.58534354", "0.5850467", "0.58409643", "0.5831996", "0.57825035", "0.57813114", "0.57764065", "0.5758007", "0.5742845", "0.570861", "0.57031953", "0.56993...
0.7312986
1
Gets the first response from the serial port after sending something. This method works almost the same as `send()` (see `self.send()`). It also returns a string representing the first response from the serial port after sending. All `args` and `check_type`, `ending`, and `concatenate`, will be sent to `send()`. If the...
def get_first_response(self, *args: "tuple[t.Any]", is_bytes: bool = True, check_type: bool = True, ending: str = "\r\n", concatenate: str = ' ', read_until: t.Union[str, None] = None, strip: bool = True) -> t.Union[bytes, str, None]: if (not self._check_connect()): return None send_time =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, data):\n starttime = time.time()\n while 1:\n if self._waiting_response==1:\n if time.time() - starttime > self._maxrespdelay:\n break\n _LOGGER.debug(\"Send going to sleep\\n\")\n time.sleep(self._sleeptime)\n ...
[ "0.6260393", "0.6166738", "0.6094374", "0.6057463", "0.604171", "0.6012169", "0.59196717", "0.577192", "0.57543254", "0.57430035", "0.5740491", "0.5733202", "0.56750035", "0.56618196", "0.5648238", "0.5609512", "0.560767", "0.5582185", "0.5551728", "0.55361843", "0.5533276", ...
0.68016547
0
Waits until the connection receives a given response. This method will call `receive()` repeatedly until it returns a string that matches `response` whose timestamp is greater than given timestamp (`after_timestamp`).
def wait_for_response(self, response: t.Union[str, bytes], after_timestamp: float = -1.0, read_until: t.Union[str, None] = None, strip: bool = True) -> bool: after_timestamp = float(after_timestamp) if (after_timestamp < 0): # negative number to indicate program to use current time, time in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wait_for_response_str(self, response: str, timestamp: float, read_until: t.Union[str, None], strip: bool) -> bool:\n\n call_time = time.time() # call timestamp, for timeout\n\n r = self.receive_str(read_until=read_until, strip=strip)\n\n while (r is None or r[0] < timestamp or r[1] != re...
[ "0.7169336", "0.67271274", "0.5518525", "0.53769433", "0.5317078", "0.5295316", "0.5280779", "0.5275081", "0.52597547", "0.5258325", "0.52018654", "0.5183649", "0.5139243", "0.5126724", "0.5104376", "0.507323", "0.5072797", "0.5059793", "0.5055717", "0.50551325", "0.50168455"...
0.7338029
0
Continues sending something until the connection receives a given response. This method will call `send()` and `receive()` repeatedly (calls again if does not match given `response` parameter). See `send()` for more details on `args` and `check_type`, `ending`, and `concatenate`, as these will be passed to the method. ...
def send_for_response(self, response: t.Union[str, bytes], *args: "tuple[t.any]", read_until: t.Union[str, None] = None, strip: bool = True, check_type: bool = True, ending: str = "\r\n", concatenate: str = ' ') -> bool: if (not self._check_connect()): return False try: self.la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wait_for_response_str(self, response: str, timestamp: float, read_until: t.Union[str, None], strip: bool) -> bool:\n\n call_time = time.time() # call timestamp, for timeout\n\n r = self.receive_str(read_until=read_until, strip=strip)\n\n while (r is None or r[0] < timestamp or r[1] != re...
[ "0.65040326", "0.6439424", "0.6212336", "0.6082962", "0.60457486", "0.5894044", "0.5781465", "0.5772337", "0.57515186", "0.5705934", "0.56602514", "0.56462646", "0.5639085", "0.5555202", "0.55437016", "0.55190814", "0.5478063", "0.5456423", "0.5441122", "0.5390357", "0.537947...
0.7883518
0
Attempts to reconnect the serial port. This will change the `port` attribute then call `self.connect()`. Will raise `ConnectException` if already connected, regardless of if `exception` if True or not. Note that `reconnect()` can be used instead of `connect()`, but it will connect to the `port` parameter, not the `port...
def reconnect(self, port: t.Union[str, None] = None, timeout: t.Union[float, None] = None) -> bool: if (self.connected): raise base_connection.ConnectException("Connection already established") if (port is not None): # set port to new port self.port = port ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self, host, port):\n\n self.connect_count = self.RETRY_COUNT\n timeout = None if self.debug_mode else FvpConnector.MAX_IDLE_TIME\n\n while not self.has_connect_timed_out():\n try:\n self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n ...
[ "0.6820905", "0.64085317", "0.63368905", "0.62559336", "0.62236327", "0.6190543", "0.61321855", "0.6121832", "0.59725064", "0.59033877", "0.58570766", "0.5835012", "0.58199453", "0.58150685", "0.5794943", "0.5788215", "0.56955916", "0.5685062", "0.56702334", "0.56702334", "0....
0.7964101
0
Checks if a connection has been established. Raises exception or returns false if not.
def _check_connect(self) -> bool: if (self._conn is None): if (self._exception): raise base_connection.ConnectException( "No connection established") else: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_check(self):\n try:\n client = self.connect()\n client.sys.is_initialized() # make an actual network connection\n return True\n except:\n return False", "def check_connection(self):\n return False", "def __CheckConnectStatus(self):\r\n...
[ "0.8055957", "0.79213095", "0.786534", "0.7846001", "0.7761849", "0.7760872", "0.7709449", "0.76505417", "0.7590722", "0.75716573", "0.75405365", "0.7537867", "0.75225717", "0.749127", "0.74789304", "0.7423573", "0.74233437", "0.7411698", "0.7388755", "0.73343205", "0.7315984...
0.84049904
0
`self._wait_for_response` but for strings
def _wait_for_response_str(self, response: str, timestamp: float, read_until: t.Union[str, None], strip: bool) -> bool: call_time = time.time() # call timestamp, for timeout r = self.receive_str(read_until=read_until, strip=strip) while (r is None or r[0] < timestamp or r[1] != response): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_response(self, response: t.Union[str, bytes], after_timestamp: float = -1.0, read_until: t.Union[str, None] = None, strip: bool = True) -> bool:\n\n after_timestamp = float(after_timestamp)\n if (after_timestamp < 0):\n # negative number to indicate program to use current time...
[ "0.63574046", "0.6144639", "0.6034351", "0.60156447", "0.59770465", "0.5960184", "0.59174013", "0.57894593", "0.5700789", "0.56624895", "0.56605506", "0.56472594", "0.56348354", "0.5609105", "0.55304676", "0.5529065", "0.55219597", "0.5514645", "0.5468074", "0.54580635", "0.5...
0.67398286
0
`self._wait_for_response` but for bytes
def _wait_for_response_bytes(self, response: bytes, timestamp: float) -> bool: call_time = time.time() # call timestamp, for timeout r = self.receive() while (r is None or r[0] < timestamp or r[1] != response): # timestamp needs to be greater than start of method and response nee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_response_byte(self):\n raise NotImplementedError", "def handle_execution_response(self, data, *, wait):\n ...", "def wait_for_response(self, response: t.Union[str, bytes], after_timestamp: float = -1.0, read_until: t.Union[str, None] = None, strip: bool = True) -> bool:\n\n after_t...
[ "0.6374043", "0.61274344", "0.6116333", "0.5920712", "0.59035444", "0.58897835", "0.5722002", "0.56968266", "0.567099", "0.56391656", "0.56188357", "0.5603984", "0.56014645", "0.55909187", "0.5585492", "0.5570471", "0.5554195", "0.5543721", "0.5510871", "0.5505051", "0.549860...
0.6603786
0
Loads data from FTEST if test is True, otherwise from FTRAIN. Pass a list of cols if you're only interested in a subset of the target columns.
def load(test=False, cols=None): fname = FTEST if test else FTRAIN df = pd.read_csv(os.path.expanduser(fname)) # load pandas dataframe # The Image column has pixel values separated by space; convert # the values to numpy arrays: df['Image'] = df['Image'].apply(lambda im: np.fromstring(im, sep=' ')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(test=False, cols=None):\n fname = FTEST if test else FTRAIN\n df = read_csv(os.path.expanduser(fname)) # load pandas dataframe\n\n # The Image column has pixel values separated by space; convert\n # the values to numpy arrays:\n df['Image'] = df['Image'].apply(lambda im: np.fromstring(im, ...
[ "0.71706337", "0.6157404", "0.59481573", "0.59239465", "0.5915448", "0.5850174", "0.58404183", "0.57753795", "0.57295096", "0.5712818", "0.56506884", "0.5646312", "0.5620637", "0.55998445", "0.554094", "0.5534742", "0.5509562", "0.5478337", "0.54298604", "0.5421022", "0.53862...
0.71232355
1
Detect file format and return 'BAM', 'CRAM', 'VCF' or None. None indicates an unrecognized file format. 'VCF' is returned for both uncompressed and compressed VCFs (.vcf and .vcf.gz).
def detect_file_format(path): with open(path, "rb") as f: first_bytes = f.read(16) if first_bytes.startswith(b"CRAM"): return "CRAM" if first_bytes.startswith(b"##fileformat=VCF"): return "VCF" gzip_header = b"\037\213" if first_bytes.startswith(gzip_header):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkFormat(vcfname):\n if vcfname == '-':\n return 'vcf' #may want to note its a stream\n typ = checkIfGzip(vcfname)\n if typ != 'nozip':\n return typ\n f = open(vcfname)\n l = f.readline()\n f.close()\n VCF_TAG='##fileformat=VCF'\n if l[:len(VCF_TAG)] == VCF_TAG:\n ...
[ "0.7930835", "0.70305145", "0.7003644", "0.69908905", "0.69294703", "0.6857264", "0.6844258", "0.6698243", "0.66714513", "0.6591837", "0.6505455", "0.64656615", "0.64358544", "0.6404238", "0.6402454", "0.6400432", "0.63958377", "0.6395611", "0.63777494", "0.6351832", "0.63503...
0.81228167
0
Detect if standard output is a regular file (or say a pipe).
def stdout_is_regular_file() -> bool: mode = os.fstat(sys.stdout.buffer.fileno()).st_mode return stat.S_ISREG(mode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_output(args, **kwargs):\n kwargs.setdefault('stdin', DEVNULL)\n if 'stdout' in kwargs:\n raise ValueError('stdout argument not allowed, it would be overridden.')\n return check_call_out(args, stdout=PIPE, **kwargs)[0]", "def is_output(port):\n try:\n return port.mode == 'w'\n except ...
[ "0.6127685", "0.61203176", "0.58304125", "0.57284296", "0.5619576", "0.56138164", "0.55646163", "0.5530024", "0.5490277", "0.54629254", "0.54453087", "0.5400348", "0.5336701", "0.52599245", "0.52439517", "0.52269506", "0.51865125", "0.516894", "0.5166597", "0.5132132", "0.513...
0.7379879
0
>>> Region.parse("chr1") Region("chr1", 0, None)
def parse(spec: str): parts = spec.split(":", maxsplit=1) chromosome = parts[0] if len(parts) == 1 or not parts[1]: start, end = 0, None else: try: sep = ":" if ":" in parts[1] else "-" start_end = parts[1].split(sep, maxsplit=1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_parse_region(raw_args, prog=None):\n\n if prog:\n parser = argparse.ArgumentParser(prog=prog, add_help=False)\n else:\n parser = argparse.ArgumentParser(add_help=False)\n\n def print_message(message):\n if message:\n sys.stderr.write(message)\n else:\n ...
[ "0.5842712", "0.5763863", "0.55768454", "0.55151266", "0.5471569", "0.5469674", "0.5250584", "0.5215681", "0.5211089", "0.52108705", "0.5147491", "0.51344883", "0.5092932", "0.5079902", "0.5067706", "0.5063557", "0.50489676", "0.5019866", "0.4995422", "0.49724588", "0.4947875...
0.6751657
0
Load test data from a tabseparated values file.
def load_test_data(filename): def _load_test_data(file_in): header = next(file_in).strip().split("\t") records = array([ [float(v) for v in line.strip().split("\t")] for line in file_in ]) return { variable: records[..., idx] for idx, variable in enumerate(hea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_tsv(tsv_file):\n # Load data from files\n all_examples = list(open(tsv_file, \"r\", encoding='utf-8').readlines())\n split_lines = [l.split('\\t') for l in all_examples]\n x_text = [clean_str(s[0].strip()) for s in split_lines]\n label_integers = [int(s[1].strip()) for s in split_lines...
[ "0.65515935", "0.6372641", "0.63408947", "0.62264335", "0.6210723", "0.6203184", "0.6183074", "0.613044", "0.61262894", "0.6121663", "0.61141956", "0.61086655", "0.61035705", "0.6064732", "0.6031012", "0.6021655", "0.60164285", "0.5988676", "0.59886503", "0.59744465", "0.5973...
0.7162908
0
Delete folder from disk. Path already contains base dir
def delete_folder(self, path): if not path_exists(path, self._store_folder): raise NotFoundException("") rmdir(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_folder(path):\n command = ['rm', '-rf', TEST_DIR]\n file_operation(path, command)", "def delete_folder(path: str) -> None:\n\tuux.show_info(\"Deleting \" + path)\n\n\tif not os.path.exists(path):\n\t\t# Path does not exist\n\t\treturn\n\n\ttry:\n\t\tshutil.rmtree(path, True)\n\texcept OSError as...
[ "0.7846436", "0.75231874", "0.7519311", "0.7341767", "0.73185945", "0.7287226", "0.7268936", "0.72487295", "0.7242061", "0.7236461", "0.7109808", "0.70716035", "0.70535564", "0.70082355", "0.6989712", "0.69824016", "0.6971872", "0.69538915", "0.69352335", "0.6892665", "0.6882...
0.77938616
1
Get Arango Client instance
def get_arango_client() -> ArangoClient: return ArangoClient(hosts=ARANGO_HOST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client():\n\n client = Client()\n return client", "def get_client():\n return Client(__address, authkey='strumamor')", "def client(metadata_response) -> airbase.AirbaseClient:\n return airbase.AirbaseClient()", "def client(self):\n\n if self._client is None:\n self._client =...
[ "0.73834586", "0.73340523", "0.724321", "0.717757", "0.7130575", "0.7116821", "0.7041003", "0.68899024", "0.68590456", "0.6839266", "0.6817004", "0.67721105", "0.6758782", "0.6758782", "0.67222875", "0.67133635", "0.66557705", "0.6629727", "0.6603719", "0.65801764", "0.657580...
0.8630718
0
Return system database instance
def get_system_database() -> StandardDatabase: client = get_arango_client() return client.db("_system", username=ARANGO_USER, password=ARANGO_PASSWORD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_database(self):\n return self.database", "def get_database(self, instance, name):\n return instance.get_database(name)", "def get_database(self, database, instance=None):\n return self._get(_database.Database, database)", "def db(self) -> Database:\n return self.impl.db", ...
[ "0.7939189", "0.7920433", "0.78951895", "0.78404564", "0.7790942", "0.7776532", "0.7736766", "0.77303636", "0.76975584", "0.76906294", "0.76341784", "0.7610511", "0.7609939", "0.7582774", "0.7582774", "0.756159", "0.75452924", "0.74812025", "0.74715596", "0.7459757", "0.74288...
0.8008464
0
Download remote file and return its bytes object
def get_remote_bytes(file_url) -> io.BytesIO: result = urlfetch.fetch(file_url) return io.BytesIO(result.content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadRemoteFile(url) -> bytes:\n local_url = download_util.DownloadResource(url)\n return file_util.OpenFile(local_url).read()", "def _download_from_url(self) -> bytes:\n response = requests.get(self.url, allow_redirects=True)\n return response.content", "def fetch(self, url) -> bytes:\n ...
[ "0.8271004", "0.8159522", "0.7608345", "0.754216", "0.7458709", "0.74313575", "0.7346964", "0.73246896", "0.72632086", "0.70131445", "0.7013098", "0.7005534", "0.69818085", "0.697366", "0.6967615", "0.6908354", "0.6905646", "0.689228", "0.68599916", "0.6849557", "0.68491834",...
0.8472312
0
Return the choices that are available for a given grid.
def getChoices(self, grid): return [(x, y) for x in range(3) for y in range(3) if grid[x][y] == 0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_options(self, current_row, current_column, subgrid_number)->list:\n row = self.number_for_row\n column = self.number_for_column\n subgrid = self.subgrid[subgrid_number].avaliable_numbers\n options = list(set(row[current_row]) & set(column[current_column]) & set(subgrid))\n ...
[ "0.6666721", "0.6042537", "0.6042537", "0.5838452", "0.5834571", "0.5803266", "0.580065", "0.5672176", "0.5627012", "0.5616235", "0.55283767", "0.55242723", "0.54647547", "0.54270005", "0.5405931", "0.54022855", "0.5385828", "0.53767765", "0.5376549", "0.53288865", "0.5328886...
0.7702581
0
Return the outcome of the game of the given grid.
def outcome(self, g): if g[0][0] == g[1][0] == g[2][0] and g[0][0] != 0: return g[0][0] if g[0][1] == g[1][1] == g[2][1] and g[0][1] != 0: return g[0][1] if g[0][2] == g[1][2] == g[2][2] and g[0][2] != 0: return g[0][2] if g[0][0] == g[0][1] == g[0][2]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outcome(self):\n if self.grid[0][0] == self.grid[1][0] == self.grid[2][0] and self.grid[0][0] != 0:\n return self.grid[0][0]\n if self.grid[0][1] == self.grid[1][1] == self.grid[2][1] and self.grid[0][1] != 0:\n return self.grid[0][1]\n if self.grid[0][2] == self.grid...
[ "0.7858904", "0.6622879", "0.6614127", "0.652554", "0.6383133", "0.6361459", "0.6352419", "0.63517135", "0.6351573", "0.6296269", "0.62836885", "0.62820965", "0.62380004", "0.6198023", "0.61972207", "0.613464", "0.6129366", "0.6118819", "0.610771", "0.6094723", "0.60888326", ...
0.67405844
1
Put a given token at a given choice.
def put(self, choice, token): x, y = choice self.grid[x][y] = token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_token(self, x, y, player):\n pass", "def token(self, token):\n\n self._token = token", "def token(self, token):\n\n self._token = token", "def token(self, value):\r\n self._token = value", "def add_token(self,token):\n\t\tif not token:\n\t\t\tlogging.error(\"Token cann...
[ "0.6111852", "0.56836164", "0.56836164", "0.5606343", "0.5438029", "0.5414346", "0.5222856", "0.52132773", "0.5186454", "0.5124651", "0.5092735", "0.50767994", "0.5015555", "0.50153136", "0.49336565", "0.49193585", "0.49173614", "0.49039143", "0.4889981", "0.48608044", "0.486...
0.78605884
0
Determine if a position is available.
def available(self, position): if position is not None: x, y = position return self.grid[x][y] == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_position_availible(self, position):\n return self.positions[position] == ' '", "def check_position_free(self, pos=None):\n if pos is None:\n pos = self.draw.position\n return self.board.board[pos] == 0", "def has_position(self):\n if 'position' not in self.attrs:\...
[ "0.69894826", "0.6896239", "0.6890652", "0.6801492", "0.6738765", "0.67301005", "0.66084415", "0.659311", "0.6585857", "0.6558854", "0.65433675", "0.6542001", "0.6519152", "0.6519152", "0.6519152", "0.6519152", "0.6519152", "0.65154177", "0.65154177", "0.6497597", "0.6474194"...
0.8269788
0
Create a game of TicTacToe using the TicTacToe object.
def __init__(self, tictactoe, players, window=Window(name="TicTacToe", size=(500, 500)), restart_at_end=False, telling=True): self.tictactoe = tictactoe self.players = players self.window = window self.default_size = window.size ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlayTicTacToe(numPlayers):\n\tteams = {} # maps the teams onto players or computer\n\tif numPlayers == 0:\n\t\tteams['X'] = 'C'\n\t\tteams['O'] = 'C'\n\telif numPlayers == 1:\n\t\tteams['X'] = 'H'\n\t\tteams['O'] = 'C'\n\telse:\n\t\tteams['X'] = 'H'\n\t\tteams['O'] = 'H'\n\n\tnumberBoard = (\n\t\t\t('0', '1', ...
[ "0.69434994", "0.69325745", "0.68203855", "0.6670493", "0.6613101", "0.6576579", "0.65676916", "0.6507054", "0.6462061", "0.6397867", "0.6395052", "0.63768226", "0.6376774", "0.6292221", "0.62615514", "0.6259397", "0.62147975", "0.6198071", "0.61683863", "0.6147136", "0.61443...
0.70514244
0
Tell messages to the player at the begining of a game.
def tellIfStarted(self): if self.game_number == 1: self.welcome() else: self.tellGameNumber()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_start(self):\n m = \"**{}** has started a game of {}! To participate, say `I`! **{} players needed.**\".format(\n self.message.author.display_name, self.name, self.num)\n await client.say(self.message, m)", "def start(self):\n self.save_checkpoint(\"setup\")\n\n loggin...
[ "0.7980036", "0.73593986", "0.7260422", "0.72361565", "0.712398", "0.68411154", "0.6840882", "0.679757", "0.67570394", "0.67382216", "0.67318326", "0.6713838", "0.6674273", "0.6587488", "0.65828264", "0.65710545", "0.6564919", "0.65642303", "0.65326834", "0.65190625", "0.6506...
0.7546746
1
Tell the game number to screen.
def tellGameNumber(self): t = time.time() - self.start_time d = self.start_duration if t < d: c = int(255 * (1 - (t / d))) self.window.alert("Starting game number " + str(self.game_number))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_game_number(self): \n self.game_title.draw(self.game_title_rect.topleft)\n pygl2d.draw.line((self.SCREEN_WIDTH / 4 , self.SCREEN_HEIGHT / 16 * 8.5), (self.SCREEN_WIDTH / 4 * 3, self.SCREEN_HEIGHT / 16 * 8.5), (255, 255, 255))\n pygl2d.draw.line((self.SCREEN_WIDTH / 4 , self.SCR...
[ "0.71988493", "0.6575404", "0.63399297", "0.6228327", "0.62030417", "0.6200928", "0.6191496", "0.61830056", "0.61322254", "0.61100376", "0.6094598", "0.6083642", "0.6046601", "0.60419357", "0.6038718", "0.6032156", "0.60157204", "0.59972954", "0.5970019", "0.59558254", "0.594...
0.7277345
0
Tell messages if the games has ended.
def tellIfEnded(self): self.congratulate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(self):\n winners = mafia.str_player_list(self.game.winners())\n logging.info(\"Game over! Winners: %s\" % winners)\n\n subject = \"%s: The End\" % self.name\n body = \"Game over!\\n\\nCongratulations to %s for a well \" \\\n \"(or poorly; I can't tell) played game!\" % winners\n se...
[ "0.759905", "0.7318168", "0.72988594", "0.7158918", "0.7092613", "0.70879173", "0.70463926", "0.70301557", "0.7010953", "0.69946444", "0.6971616", "0.6955989", "0.69323343", "0.6900854", "0.6900854", "0.6899504", "0.68831617", "0.6882569", "0.6867912", "0.67816174", "0.678015...
0.76129335
0
Test that a project may not be created when a study is not valid
def test_create_project_study_does_not_exist(db, clients): client = clients.get("Administrators") kf_id = to_global_id("StudyNode", "SD_00000000") variables = { "input": {"workflowType": "rsem", "study": kf_id, "projectType": "HAR"} } resp = client.post( "/graphql", content_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_for_unacceptable_matches_projects(\n student_names, project_names, supervisor_names, capacities, seed, clean\n):\n\n *_, game = make_game(\n student_names, project_names, supervisor_names, capacities, seed, clean\n )\n game.solve()\n\n project = game.projects[0]\n student = ...
[ "0.7223565", "0.7064717", "0.67333084", "0.67269564", "0.6701937", "0.6649512", "0.66244644", "0.6599214", "0.6580609", "0.65181065", "0.6503927", "0.64625907", "0.6434544", "0.6420894", "0.641123", "0.6390254", "0.6340355", "0.6340355", "0.6340355", "0.63324744", "0.6330275"...
0.7355077
0
Test that multiple projects with the same workflow may not be created for the same study.
def test_create_project_no_duplicate_workflows(db, clients, mock_cavatica_api): client = clients.get("Administrators") study = StudyFactory(kf_id="SD_00000000") study.save() kf_id = to_global_id("StudyNode", "SD_00000000") variables = { "input": {"workflowType": "rsem", "study": kf_id, "pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_project_invalid_workflows(db, clients, mock_cavatica_api):\n client = clients.get(\"Administrators\")\n\n study = StudyFactory(kf_id=\"SD_00000000\")\n study.save()\n\n kf_id = to_global_id(\"StudyNode\", \"SD_00000000\")\n variables = {\n \"input\": {\n \"workflowT...
[ "0.7134573", "0.66505384", "0.6468209", "0.6388659", "0.62340355", "0.6145839", "0.612046", "0.61085075", "0.61085075", "0.60835934", "0.6079471", "0.60697186", "0.6042777", "0.6040249", "0.6036487", "0.60094327", "0.5988171", "0.59810096", "0.5971545", "0.596354", "0.5962919...
0.74672663
0
Test that research projects with invalid workflow input may not be created.
def test_create_project_invalid_workflows(db, clients, mock_cavatica_api): client = clients.get("Administrators") study = StudyFactory(kf_id="SD_00000000") study.save() kf_id = to_global_id("StudyNode", "SD_00000000") variables = { "input": { "workflowType": "invalid@workflow*i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_for_unacceptable_matches_projects(\n student_names, project_names, supervisor_names, capacities, seed, clean\n):\n\n *_, game = make_game(\n student_names, project_names, supervisor_names, capacities, seed, clean\n )\n game.solve()\n\n project = game.projects[0]\n student = ...
[ "0.7055492", "0.69701475", "0.6939135", "0.69033504", "0.6789375", "0.67686033", "0.6768363", "0.6751658", "0.6729493", "0.67239165", "0.67095023", "0.66931164", "0.66392416", "0.66254085", "0.6609532", "0.6505268", "0.64722306", "0.64369893", "0.64119256", "0.64098793", "0.6...
0.7960564
0
Ensures scanning an empty directory is a noop.
def test_scan_empty_dir(self): self.run_scan(self.emptydir, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_directory(self):\n\n # create indexer object\n indexer = indexing_module.IndexModule()\n\n # index the location (storage/data/test/empty_directory)\n indexer.index(_path_prefix + 'empty_directory')\n\n # search for few words and check that the result is empty\n ...
[ "0.67700046", "0.66982436", "0.65239155", "0.64284533", "0.63311285", "0.6262342", "0.61743206", "0.6123855", "0.6119191", "0.6056379", "0.6028418", "0.6010321", "0.59998834", "0.59818417", "0.59769183", "0.58747846", "0.5823981", "0.5754685", "0.5724545", "0.56872135", "0.56...
0.851959
0
Ensures scanning a file directly works.
def test_scan_file(self): self.run_scan(self.filename, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_valid_file(self, file):\n\n try:\n _ = open(f\"{file}\")\n except FileNotFoundError:\n raise ValueError", "def test_read_raw_suggested(fname):\n with pytest.raises(ValueError, match='Try reading'):\n read_raw(fname)", "def __scan_file(self, args, next_fi...
[ "0.6336153", "0.6248168", "0.5982336", "0.58809805", "0.58405286", "0.5818889", "0.5784336", "0.5766788", "0.5743122", "0.570709", "0.570709", "0.5698987", "0.56981504", "0.56939304", "0.56895506", "0.5679912", "0.5640437", "0.56298", "0.5623725", "0.5614642", "0.5589746", ...
0.7663084
0
Ensures we can scan a shallow directory of files.
def test_scan_dir_files(self): self.run_scan(self.subdir, self.nest_fcount + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_scan_empty_dir(self):\n self.run_scan(self.emptydir, 0)", "def test_scan_recursive(self):\n self.run_scan(self.tempdir, self.root_fcount + self.nest_fcount + 1)", "def __walk_tree(self):\n for root, dirnames, files in os.walk(self.path, topdown=True):\n self.dirCount += 1\n ...
[ "0.6798262", "0.6258534", "0.5976422", "0.59348464", "0.59233046", "0.59121376", "0.58636653", "0.58518875", "0.58460295", "0.5805218", "0.579997", "0.57334304", "0.57289255", "0.5702161", "0.5691247", "0.56910944", "0.5682201", "0.5676784", "0.565788", "0.5657782", "0.564282...
0.74319404
0
Resets the entire report back to its starting form, including deleting any attached submissions, tool data, and feedbacks. It will also reset any overridden fields of feedback classes. However, it will not affect class hooks.
def clear(self): self.feedback.clear() self.ignored_feedback.clear() self.suppressions.clear() self.suppressed_labels.clear() self.hiddens.clear() self._tool_data.clear() self.group = None self.groups.clear() self.group_names.clear() self.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n # FIXME: this state does not make sense\n self.reset_creation_info()\n self.reset_document()\n self.reset_package()\n self.reset_file_stat()\n self.reset_reviews()\n self.reset_annotations()\n self.reset_extr_lics()", "def reset(self):\n ...
[ "0.6993362", "0.6936103", "0.6817604", "0.6717239", "0.6715757", "0.6640656", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "0.6548507", "...
0.7355985
0
Attach the given submission to this report.
def contextualize(self, submission): self.submission = submission
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addSubmission(self, submission):\r\n self.submissions.append(submission)\r\n return len(self.submissions)-1", "def attach(self, **kwargs):\n return self.client.api.attach(self.id, **kwargs)", "def submission_timestamp(self, submission_timestamp):\n\n self._submission_timestamp =...
[ "0.62619025", "0.61753154", "0.612603", "0.58245283", "0.5773562", "0.5585094", "0.5538136", "0.54583544", "0.541124", "0.5358096", "0.5283531", "0.52794594", "0.5269978", "0.5196944", "0.51448965", "0.50548995", "0.5053606", "0.5033399", "0.5022469", "0.49845043", "0.4981531...
0.61898386
1
Attaches the given feedback object to this report.
def add_feedback(self, feedback): self.feedback.append(feedback) if not isinstance(feedback.parent, (int, str)) and feedback.parent is not None: feedback.parent._get_child_feedback(feedback, True) self.execute_hooks('pedal.report', 'add_feedback', (feedback,)) return feedback
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection_feedback(self, collection_feedback):\n\n self._collection_feedback = collection_feedback", "def add_feedback(\n self, feedback_result: FeedbackResult = None, **kwargs\n ) -> None:\n\n if feedback_result is None:\n feedback_result = FeedbackResult(**kwargs)\n ...
[ "0.63195586", "0.6314475", "0.5916886", "0.5733787", "0.57326776", "0.5628029", "0.5544258", "0.5537455", "0.551398", "0.5416575", "0.54047453", "0.534764", "0.5304755", "0.52936566", "0.52672714", "0.5253341", "0.52415544", "0.5188839", "0.51846915", "0.514266", "0.5142087",...
0.6939852
0
Attaches the given feedback object to this report, but only in the ignored list. That means it should not be considered by the Resolver, since its condition did not apply to the code. Some Resolvers like to know about feedback that was not reached.
def add_ignored_feedback(self, feedback): self.ignored_feedback.append(feedback) if feedback.parent is not None: feedback.parent._get_child_feedback(feedback, False) return feedback
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_feedback(self, feedback):\n self.feedback.append(feedback)\n if not isinstance(feedback.parent, (int, str)) and feedback.parent is not None:\n feedback.parent._get_child_feedback(feedback, True)\n self.execute_hooks('pedal.report', 'add_feedback', (feedback,))\n retur...
[ "0.6586448", "0.6235703", "0.59533", "0.5890326", "0.5684849", "0.5587063", "0.5468591", "0.54678684", "0.53465766", "0.5308259", "0.53059846", "0.52731955", "0.52693284", "0.525248", "0.51605004", "0.5067591", "0.50553364", "0.5042414", "0.50258255", "0.5002025", "0.49935287...
0.71028537
0
Register the `function` to be executed when the given `event` is triggered.
def add_hook(self, event, function): if event not in self.hooks: self.hooks[event] = [] self.hooks[event].append(function)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def register_event(self, event: str, func: callable, args: dict = None):\n if not callable(func):\n raise TypeError\n await self.subscribe(event, args or {})\n self._events[event.lower()] = func", "def register_handler(self, event, fn, unique=False):\n if event not in self._registry ...
[ "0.74478304", "0.6822293", "0.6617914", "0.6617914", "0.66160136", "0.6388138", "0.62942713", "0.62520796", "0.6243661", "0.61818147", "0.61818147", "0.60682625", "0.6051137", "0.60490775", "0.6021707", "0.5953693", "0.5944442", "0.58148235", "0.5786473", "0.5781896", "0.5765...
0.6867308
1
Similar to ``add_hook``, except attaches them to the class, so they will be executed for ALL report subclasses.
def add_class_hook(cls, event, function): if event not in cls.class_hooks: cls.class_hooks[event] = [] cls.class_hooks[event].append(function)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __subclasshook__(self, ???):", "def create_hooks(self, hclass):\n for extension in self.db.values():\n self.events.register_callbacks_from_inst(hclass, extension)", "def __subclasshook__(*args):", "def __subclasshook__(*args):", "def __subclasshook__(*args):", "def __subclasshook__(...
[ "0.5927254", "0.58305424", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895", "0.58261895",...
0.63355386
0
Support retrieving a tool's data from the report using square bracket syntax. So, for example, you can do `MAIN_REPORT['tifa']` and get its data dictionary. If the tool has been registered, but not initialized for this report, then the tool will be
def __getitem__(self, tool_name): if tool_name not in self._tool_data: if tool_name not in self.TOOLS: raise PedalToolNotRegistered(tool_name, list(self.TOOLS.keys())) self.TOOLS[tool_name].reset(report=self) return self._tool_data[tool_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetToolInfo(tool):\n matches = [t for t in _TOOLS if t[0] == tool]\n if not matches:\n return None\n else:\n return matches[0][1]", "def tool(self):\n return self._tool", "def get_tool(cls, tool_name):\n if cls.tool_dict is None:\n # Init the module_dict once.\n ...
[ "0.59486336", "0.57739735", "0.5764449", "0.57395303", "0.5624646", "0.5489184", "0.54722697", "0.53248817", "0.52512896", "0.524113", "0.5138731", "0.5111609", "0.5086742", "0.50813526", "0.5075781", "0.5071217", "0.5060421", "0.50181115", "0.49676597", "0.49655676", "0.4932...
0.58624035
1
Update the formatter with the new option.
def set_formatter(self, formatter): self.format = formatter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opt_format(self, fmt):\n key = get_enum_key(fmt, FORMATTERS)\n if key is not None:\n self.conf[\"format\"] = key\n print(\"Set format %r\" % key)\n else:\n print(\"Unknown format %r\" % fmt)", "def remember_formatter_option(option, opt_str, value, parser)...
[ "0.6608302", "0.62392294", "0.60983205", "0.60392416", "0.60380363", "0.6012532", "0.5787264", "0.5780188", "0.5748713", "0.5748713", "0.5723483", "0.5712165", "0.5669065", "0.5659519", "0.5605946", "0.55807114", "0.55354506", "0.55117995", "0.5502171", "0.5493129", "0.549095...
0.69781816
0
Execute JavaScript command in an element
def js_command(self, command: str, element: WebElement): self.driver.execute_script('arguments[0]' + command, element)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_js(self, script):\n self.driver.execute_script(script)", "def runJavascriptElement(self, js, elementId):\n return self.executeScript(js, {\"ELEMENT\": elementId} )", "def js(self, script):\n self.page().mainFrame().evaluateJavaScript(script)", "def run_javascript(self, code_s...
[ "0.7032897", "0.6960337", "0.67818874", "0.66101384", "0.64145756", "0.6397854", "0.62160546", "0.6203428", "0.6198844", "0.6163721", "0.60616213", "0.60042393", "0.5862011", "0.58446425", "0.5731941", "0.5716794", "0.5705056", "0.5676087", "0.55561596", "0.5542387", "0.55281...
0.81427574
0
>>> add_one(33) 34 >>> add_one(0.2) 0.8
def add_one(x): return x + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(arg1, arg2):\r\n arg1 = float(arg1)\r\n arg2 = float(arg2)\r\n print(f\"Your answer is {arg1 + arg2}.\")", "def plus_one(x):\n return x + 1", "def add_2(number: float):\n return number + 2", "def add(first, second):\n return first + second", "def add(value1, value2):\n return 1...
[ "0.7459", "0.71925986", "0.7151158", "0.7109355", "0.7063203", "0.7061265", "0.70247793", "0.70247793", "0.70247793", "0.70247793", "0.70247793", "0.70034206", "0.69558716", "0.69527006", "0.69438016", "0.69438016", "0.69438016", "0.69438016", "0.69438016", "0.69438016", "0.6...
0.7934376
0
Creates a object based on the encryption of m
def create_level1_cipher(self, m, pub): r = random.randrange(256, pub.n) c = CipherLevel1(1,1) c.prepare_message_given_random(pub, m, r) self.alpha = c self.beta = r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(self,m):\n if m._N <= self._P.get_N():\n\n r = self._P.gen_rPoly()\n e = (r.scale(self._P.get_p())*self._h+m) % self._P.get_q()\n\n return e # Polynomial representing the encryption message\n else:\n raise Exception(\"m is too large, must be equ...
[ "0.5900655", "0.589221", "0.58234066", "0.58083946", "0.5756542", "0.56431335", "0.5482311", "0.54617923", "0.5410021", "0.53471524", "0.53373575", "0.5331117", "0.5312149", "0.53007436", "0.52802396", "0.5268709", "0.52560216", "0.5248123", "0.52213866", "0.52187675", "0.520...
0.5943643
0
Computation on server 2 for two level 1 two server ciphertext multiplication
def server2_mult(b1, b2, pub): return (b1 * b2) % pub.n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ts_mult(c1, c2, pub):\n a = server1_mult(c1.alpha, c2.alpha, pub)\n b = server2_mult(c1.beta, c2.beta, pub)\n return CipherTwoServer(a, b)", "def ts_add2 (c1,c2, pub):\n \n a = server1_add2(c1.alpha, c2.alpha, pub)\n b = server2_add2(c1.beta, c2.beta, pub)\n return CipherTwoServer(a,b)",...
[ "0.7790571", "0.7216256", "0.7012358", "0.69092906", "0.6843755", "0.6686207", "0.66027504", "0.6429439", "0.62591463", "0.597987", "0.59565777", "0.5945657", "0.59402215", "0.58833784", "0.5849028", "0.5795808", "0.5784443", "0.5773375", "0.5748294", "0.5712118", "0.56835276...
0.7685256
1
Receives two level 1 two server ciphertext and computes their multiplication Sends different parts to each server
def ts_mult(c1, c2, pub): a = server1_mult(c1.alpha, c2.alpha, pub) b = server2_mult(c1.beta, c2.beta, pub) return CipherTwoServer(a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server2_mult(b1, b2, pub):\n return (b1 * b2) % pub.n", "def server1_mult(c1, c2, pub):\n c = mult1 (c1, c2, pub)\n return c.a", "def ts_add2 (c1,c2, pub):\n \n a = server1_add2(c1.alpha, c2.alpha, pub)\n b = server2_add2(c1.beta, c2.beta, pub)\n return CipherTwoServer(a,b)", "def ts...
[ "0.71428925", "0.671304", "0.6665284", "0.6407333", "0.6380148", "0.6369225", "0.6318591", "0.6250911", "0.62196106", "0.6144547", "0.61321634", "0.59592366", "0.59067553", "0.5803788", "0.57277656", "0.568272", "0.56567997", "0.55867016", "0.55790955", "0.55686563", "0.55550...
0.75748813
0
Computation on server 1 for two level 2 two server ciphertext addition
def server1_add2 (c1, c2, pub): #return (c1 + c2) % pub.n return e_add(pub, c1, c2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ts_add2 (c1,c2, pub):\n \n a = server1_add2(c1.alpha, c2.alpha, pub)\n b = server2_add2(c1.beta, c2.beta, pub)\n return CipherTwoServer(a,b)", "def ts_add1(c1, c2, pub):\n a = server1_add1(c1.alpha, c2.alpha, pub)\n b = server2_add1(c1.beta, c2.beta, pub)\n return CipherTwoServer(a, b)",...
[ "0.7581052", "0.7281212", "0.72231877", "0.7098065", "0.6907422", "0.6574377", "0.65112376", "0.61610305", "0.6091919", "0.5947126", "0.5905374", "0.5902131", "0.5887852", "0.5858926", "0.577469", "0.57632464", "0.5694249", "0.5690778", "0.5679979", "0.55266404", "0.5519396",...
0.76380044
0
Starts a new background thread. Creates a new background thread which will call target(args, kwargs).
def start_new_background_thread(target, args, kwargs=None): if kwargs is None: kwargs = {} request = system_service_pb.StartBackgroundRequestRequest() response = system_service_pb.StartBackgroundRequestResponse() try: apiproxy_stub_map.MakeSyncCall('system', 'StartBackgroundRequest', request, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_thread(target):\n thread = threading.Thread(target=target)\n thread.daemon = True\n thread.start()", "def _create_thread(self, target=None, **kwargs):\n return PyonThread(target=target, **kwargs)", "def start_background_task(target, *args, **kwargs):\n context.application.socket_i...
[ "0.724803", "0.70270014", "0.6840939", "0.67058", "0.6672467", "0.6627068", "0.6525351", "0.6525351", "0.6525351", "0.6525351", "0.6468489", "0.64417624", "0.6410551", "0.63828117", "0.63224936", "0.6218834", "0.61594373", "0.6157621", "0.6124488", "0.6115076", "0.60590965", ...
0.8186406
0
A generator function that sleeps between retries, handles exponential backoff and jitter. The action you are retrying is meant to run after retrier yields. At each iteration, we sleep for sleeptime + random.uniform(jitter, jitter). Afterwards sleeptime is multiplied by sleepscale for the next iteration.
def retrier(attempts=5, sleeptime=10, max_sleeptime=300, sleepscale=1.5, jitter=1): jitter = jitter or 0 # py35 barfs on the next line if jitter is None if jitter > sleeptime: # To prevent negative sleep times raise Exception('jitter ({}) must be less than sleep time ({})'.format(jitter, sleept...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleeper(self):\n for waittime in (.01, .02, .05, .1, .2, .5):\n yield waittime\n while True:\n waittime = min(waittime + .2, 5)\n yield waittime", "def exponential_backoff(max_tries, max_sleep=20):\n return [random.random() * min(max_sleep, (2**i - 1)) for i ...
[ "0.67454714", "0.6720508", "0.6687347", "0.6652387", "0.6432652", "0.63767296", "0.62862915", "0.62675667", "0.6244293", "0.6240169", "0.6186151", "0.6124695", "0.6089585", "0.60674703", "0.5994877", "0.5982182", "0.596613", "0.59609294", "0.5955659", "0.59556365", "0.5932896...
0.8346202
0
A context manager for wrapping functions with retry functionality.
def retrying(func, *retry_args, **retry_kwargs): yield retriable(*retry_args, **retry_kwargs)(func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry(func):\n # ... retry MAX_RETRIES times\n # ...\n # make sure you include this for testing:\n # except Exception as exc:\n # print(exc)\n # ...\n # and use wraps to preserve docstring\n #\n @wraps(func)\n def wrapper(*args, **kwargs):\n\n tries = MAX_RETRIES\n ...
[ "0.72140026", "0.718952", "0.7181703", "0.71726537", "0.7144989", "0.7139731", "0.70460033", "0.69891655", "0.69435304", "0.6942571", "0.69366217", "0.6907932", "0.68825626", "0.6880432", "0.6871826", "0.6851486", "0.68477273", "0.68430126", "0.6812389", "0.68036973", "0.6783...
0.76236594
0
Returns a pandas dataframe with a selection of the logistic regression experiments to be included on deployment.
def logreg_experiments_to_deploy(): # A dataframe with all the results (parameters, performance, stored models...) df = logreg_results_to_pandas() # Choose a few good results (maybe apply diversity filters or ensemble selection or...) # These decisions where informed by some plotting (see tutorial) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_selection_Logistic(df, cat_columns, cf_columns):\n \n X, X_train_rs, X_test, y_train_rs, y_test = preprocess_data(df, cat_columns, cf_columns)\n X_train_scaled, X_test_scaled = scale_X(X_train_rs, X_test)\n \n #run SelectFromModel for feature selection\n selector = SelectFromModel(Log...
[ "0.5647742", "0.5482295", "0.53071505", "0.5293923", "0.527665", "0.52308536", "0.52080387", "0.51925886", "0.51923716", "0.5185387", "0.5170716", "0.5120544", "0.5105599", "0.5084058", "0.5078009", "0.50744927", "0.50687855", "0.50614315", "0.5058779", "0.5057521", "0.502796...
0.7068589
0
Return a report by taking arguments table and measure.
def table_to_report(table, measure): report = '' for i in table: report += '{} - {}{}\n'.format(i[0], i[1], measure) return report
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenerateReport(self, *args, **kwargs):\n # type: (*Any, **Any) -> None\n payload = {}\n for i in range(len(args)):\n payload[\"Arg%s\" % (i + 1)] = args[i]\n for item in kwargs.items():\n payload[item[0]] = item[1]\n return self._execute(\"generateReport...
[ "0.6571518", "0.61915857", "0.61915857", "0.61257195", "0.5882885", "0.58134395", "0.5696287", "0.5691247", "0.5688324", "0.56640226", "0.56541973", "0.5609555", "0.5560206", "0.5548237", "0.5535756", "0.5521049", "0.5518789", "0.55165243", "0.5513695", "0.55078167", "0.54916...
0.6689916
0
Return a report of top three of most viewed articles, most viewed first.
def top_three_articles(): query = """select articles.title, article_path_views.views from articles, article_path_views where '/article/' || articles.slug = article_path_views.path order by views desc limit 3""" result_table = ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mostViewedArticles():\n\n query = \"\"\"\n SELECT articles.title,COUNT(*) as views\n FROM articles JOIN log\n ON log.path LIKE ('/article/' || articles.slug)\n GROUP BY articles.title\n ORDER BY views DESC\n LIMIT 3\n \"\"\"\n\n ...
[ "0.8070346", "0.7923111", "0.7817145", "0.777235", "0.7646108", "0.7645052", "0.7627167", "0.75598174", "0.74823743", "0.73263675", "0.7318002", "0.73088086", "0.7236176", "0.7196032", "0.7104838", "0.70657367", "0.70545065", "0.7033759", "0.69059384", "0.6880131", "0.6853842...
0.84072423
0
Return a report of authors and their artilces' total views, author with most views first.
def popular_authors(): query = """select authors.name, sum(views) from authors, articles, article_path_views where authors.id = articles.author and '/article/' || articles.slug = article_path_views.path group by authors.name order by sum d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_popular_authors():\n print(\"\\nAuthors listed by article views:\\n\")\n views_data = get_query_results(AUTHORS_VIEWS_QUERY)\n author_row_format = '{} - {} views'\n for author, views in views_data:\n print(author_row_format.format(author, views))", "def popular_authors() :\n query...
[ "0.72645646", "0.7202688", "0.7052494", "0.7035721", "0.7008104", "0.69425005", "0.6857731", "0.66936016", "0.6691734", "0.6672909", "0.6661351", "0.6653085", "0.66399515", "0.66068673", "0.65785724", "0.6360788", "0.63390374", "0.63334996", "0.6261571", "0.6076283", "0.60474...
0.7805402
0
Purpose Concatenate two or more images along width, height or depth. Synopsis Y = concat(DIM, X1, X2, X3=None, X4=None) Input
def concat(DIM, X1, X2, X3=None, X4=None): from numpy import newaxis, sum, zeros aux = 'newaxis,' d = len(X1.shape) if d < 3: X1 = eval('X1[' + (3-d)*aux + ':]') d1,h1,w1 = X1.shape d = len(X2.shape) if d < 3: X2 = eval('X2[' + (3-d)*aux + ':]') d2,h2,w2 = X2.shape h3 = w3 = d3 = h4...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imageconcat(self, *args, **kwargs):\n return _image.image_imageconcat(self, *args, **kwargs)", "def concat_images(X):\n nc,h,w,_ = X.shape\n X = X.reshape(nc,h,w)\n n = np.ceil(np.sqrt(nc)).astype(\"int8\")\n img = np.zeros((n*w,n*h))\n x = 0\n y = 0\n for example in range(nc):\n ...
[ "0.7084594", "0.7015229", "0.68159354", "0.6561943", "0.64929277", "0.6398874", "0.63433594", "0.6288938", "0.6250176", "0.6233436", "0.62263393", "0.6208161", "0.6149136", "0.6142444", "0.60877794", "0.60582197", "0.6013701", "0.59851754", "0.59760755", "0.5967177", "0.59594...
0.74156016
0
Purpose Center filter. Synopsis y = center(f, b=None) Input
def center(f, b=None): if b is None: b = secross() y = f diff = 0 while not diff: aux = y beta1 = asf(y,'COC',b,1) beta2 = asf(y,'OCO',b,1) y = union(intersec(y,beta1),beta2) diff = isequal(aux,y) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fd_center(f, h, x0):\n return (f(x0 + h) - 2*f(x0) + f(x0 - h))/(h**2)", "def Center(self, *args):\n return _Bnd.Bnd_Sphere_Center(self, *args)", "def center(x):\n return x - x.mean()", "def center(self):\n return np.array([0,0,1/self.C+self.pos()])", "def center_of_flux(self, LF, n...
[ "0.6362392", "0.60890687", "0.6059413", "0.60569865", "0.6014868", "0.59663165", "0.5898244", "0.58954257", "0.5855407", "0.58440626", "0.58334535", "0.57709855", "0.5746369", "0.5724208", "0.57143396", "0.5699061", "0.56946635", "0.569103", "0.56903344", "0.56831795", "0.567...
0.7412997
0
Purpose Close holes of binary and grayscale images. Synopsis y = close_holes(f, Bc=None) Input
def close_holes(f, Bc=None): if Bc is None: Bc = secross() delta_f = frame(f) y = neg( infrec( delta_f, neg(f), Bc)) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areaopen(f, a, Bc=None):\n\n if Bc is None: Bc = secross()\n if isbinary(f):\n fr = label(f,Bc) # binary area open, use area measurement\n g = blob(fr,'area')\n y = threshad(g,a)\n else:\n y = intersec(f,0)\n zero = binary(y)\n k1 = f.min()\n k2 = f.max()\n ...
[ "0.60040784", "0.5778609", "0.576006", "0.5694225", "0.54657024", "0.5419378", "0.53273344", "0.53146905", "0.5305076", "0.527855", "0.52290446", "0.521827", "0.51965004", "0.51730394", "0.5163722", "0.513845", "0.51102966", "0.5086968", "0.50696826", "0.5042667", "0.5020051"...
0.8193464
0
Purpose Distance transform. Synopsis y = dist(f, Bc=None, METRIC=None) Input
def dist(f, Bc=None, METRIC=None): from string import upper import numpy from numpy import zeros, sqrt if Bc is None: Bc = secross() if METRIC is not None: METRIC = upper(METRIC) f = gray(f,'uint16') y = intersec(f,0) if (METRIC == 'EUCLIDEAN') or (METRIC == 'EUC2'): b = z...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gdist(f, g, Bc=None, METRIC=None):\n\n if Bc is None: Bc = secross()\n assert METRIC is None,'Does not support EUCLIDEAN'\n fneg,gneg = neg(f),neg(g)\n y = gray(gneg,'uint16',1)\n ero = intersec(y,0)\n aux = y\n i = 1\n while not isequal(ero,aux):\n aux = ero\n ero = cerod...
[ "0.5852405", "0.58288974", "0.5769724", "0.5584475", "0.5576278", "0.5462016", "0.53241926", "0.5289117", "0.5244232", "0.5215511", "0.5167028", "0.5117209", "0.5108687", "0.5066167", "0.50611544", "0.5058695", "0.50529337", "0.50526243", "0.50482833", "0.50450087", "0.504436...
0.7230714
0
Purpose Eliminate the objects that hit the image frame. Synopsis y = edgeoff(f, Bc=None) Input
def edgeoff(f, Bc=None): if Bc is None: Bc = secross() edge = frame(f) y = subm( f, infrec(edge, f, Bc)) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_holes(f, Bc=None):\n\n if Bc is None: Bc = secross()\n delta_f = frame(f)\n y = neg( infrec( delta_f, neg(f), Bc))\n return y", "def close(f, b=None):\n\n if b is None: b = secross()\n y = erode(dilate(f,b),b)\n return y", "def areaclose(f, a, Bc=None):\n\n if Bc is None: Bc =...
[ "0.62881875", "0.5563221", "0.5450353", "0.5018447", "0.49821967", "0.49653018", "0.49474898", "0.4939461", "0.49067703", "0.48391458", "0.4810584", "0.48035452", "0.4802409", "0.48016536", "0.4793928", "0.47878882", "0.47416025", "0.47373748", "0.4734478", "0.47305045", "0.4...
0.84004384
0
Purpose Create a frame image. Synopsis y = frame(f, WT=1, HT=1, DT=0, k1=None, k2=None) Input
def frame(f, WT=1, HT=1, DT=0, k1=None, k2=None): if k1 is None: k1 = limits(f)[1] if k2 is None: k2 = limits(f)[0] assert len(f.shape)<3,'Supports 2D only' y = union(intersec(f,limits(f)[0]),k2) y[:,0:WT] = k1 y[:,-WT:] = k1 y[0:HT,:] = k1 y[-HT:,:] = k1 return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_frame(fn, t, img_i=-1):\n in_ext = os.path.splitext(fn)[1]\n\n if in_ext == '.h5':\n if h5_is_itk(fn):\n return None # todo\n else:\n # assume file was converted from .lif\n sel = (slice(t, t + 1),)\n img = dd.io.load(fn, '/stack', sel=sel)\n ...
[ "0.62831277", "0.62439793", "0.60918254", "0.5999872", "0.5939383", "0.59194005", "0.58832324", "0.5790363", "0.5761716", "0.56659514", "0.5606258", "0.55836374", "0.5556065", "0.5544021", "0.55173033", "0.54533947", "0.5434527", "0.54315716", "0.5388578", "0.53613645", "0.53...
0.69651395
0
Purpose Apply a random color table to a grayscale image. Synopsis Y = glblshow(X, border=0.0) Input
def glblshow(X, border=0.0): from numpy import take, resize, shape from numpy.random import rand mmin = X.min() mmax = X.max() ncolors = mmax - mmin + 1 R = to_int32(rand(ncolors)*255) G = to_int32(rand(ncolors)*255) B = to_int32(rand(ncolors)*255) if mmin == 0: R[0],G[0],B[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMyColorTable(lr,lg,lb):\n dislin.myvlt(lr,lg,lb,len(lr))", "def display_image ( X ):\r\n\t# on teste que le tableau contient bien 256 valeurs\r\n\tif X.size != 256:\r\n\t\traise ValueError ( \"Les images doivent etre de 16x16 pixels\" )\r\n\r\n\t# on cree une image pour imshow: chaque pixel est un tabl...
[ "0.58160007", "0.54141855", "0.53887016", "0.51576924", "0.512083", "0.5086155", "0.5036573", "0.50169724", "0.49781755", "0.49765837", "0.49674243", "0.4950231", "0.49221474", "0.48944604", "0.4875144", "0.48487538", "0.481425", "0.4812318", "0.48054826", "0.47801602", "0.47...
0.7962777
0
Purpose Apply an isoline color table to a grayscale image. Synopsis Y = gdtshow(X, N=10) Input
def gdtshow(X, N=10): from numpy import newaxis, ravel, ceil, zeros, ones, transpose, repeat, concatenate, arange, reshape, floor def apply_lut(img, lut): def lut_map(intens, lut=lut): return lut[intens] g = reshape(transpose(map(lut_map, ravel(img))), (3,img.shape[0],img.shape[1])) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dtshow(f, n=10):\n import adpil\n\n if (isbinary(f)) or (len(f.shape) != 2):\n print 'Error, dtshow: works only for grayscale labeled image'\n return\n y=gdtshow(f, n)\n adpil.adshow(y)\n return\n return y", "def display_image(X):\n\n\tim = X.reshape(28, 28)\n\ttemp = plt.imshow(i...
[ "0.68214494", "0.56072205", "0.558206", "0.55567443", "0.54524714", "0.5347837", "0.5291444", "0.5162581", "0.51320803", "0.51069486", "0.5084151", "0.5003675", "0.4997832", "0.49751002", "0.4966802", "0.4966766", "0.49410617", "0.49311462", "0.4916067", "0.4904751", "0.49046...
0.78104514
0
Purpose Apply binary overlays as color layers on a binary or grayscale image Synopsis Y = gshow(X, X1=None, X2=None, X3=None, X4=None, X5=None, X6=None) Input
def gshow(X, X1=None, X2=None, X3=None, X4=None, X5=None, X6=None): if isbinary(X): X = gray(X,'uint8') r = X g = X b = X if X1 is not None: # red 1 0 0 assert isbinary(X1),'X1 must be binary overlay' x1 = gray(X1,'uint8') r = union(r,x1) g = intersec(g,neg(x1)) b = in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(f, f1=None, f2=None, f3=None, f4=None, f5=None, f6=None):\n import adpil\n\n if len(f.shape) != 2:\n print \"Error, show: can only process gray-scale and binary images.\"\n return\n if f1 == None: y = gshow(f)\n elif f2 == None: y = gshow(f,f1)\n elif f3 == None: y = gshow(f,f...
[ "0.7015698", "0.5683392", "0.56469566", "0.55916816", "0.55080146", "0.54391086", "0.5384968", "0.5329156", "0.53069097", "0.528184", "0.5249182", "0.5227852", "0.51894397", "0.5148321", "0.5134065", "0.5112562", "0.5107216", "0.5084877", "0.5081954", "0.5061456", "0.50613904...
0.82680255
0
Purpose Find the histogram of the image f. Synopsis h = histogram(f, option="uint16") Input
def histogram(f, option="uint16"): from numpy import searchsorted, sort, ravel, concatenate, product n = searchsorted(sort(ravel(f)), range(f.max()+1)) n = concatenate([n, [product(f.shape)]]) h = n[1:]-n[:-1] return h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def histograma(p):\n img = read_img(p)\n show_histograma(img.reshape((-1)))", "def compute_histogram(self, image):\n hist = [0] * 256\n [h, w] = image.shape\n print(h,w)\n i = 0\n while i < 256:\n for row in range(h):\n for col in range(w):\n ...
[ "0.67816675", "0.664652", "0.65556955", "0.65127224", "0.6480041", "0.64546347", "0.64511025", "0.6443282", "0.6399075", "0.6387095", "0.63629323", "0.6325372", "0.6271335", "0.62111413", "0.6098378", "0.6031422", "0.5995911", "0.5993291", "0.5990504", "0.59483904", "0.592299...
0.8745121
0
Purpose Label a binary image. Synopsis y = label(f, Bc=None) Input
def label(f, Bc=None): from numpy import allclose, ravel, nonzero, array if Bc is None: Bc = secross() assert isbinary(f),'Can only label binary image' zero = subm(f,f) # zero image faux=f r = array(zero) label = 1 y = gray( f,'uint16',0) # zero image (output) wh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labelflat(f, Bc=None, _lambda=0):\n from numpy import allclose, ravel, nonzero, array\n if Bc is None: Bc = secross()\n zero = binary(subm(f,f)) # zero image\n faux = neg(zero)\n r = array(zero)\n label = 1\n y = gray( zero,'uint16',0) # zero image (output)\n while not al...
[ "0.7030034", "0.6553006", "0.6418224", "0.6179108", "0.61674345", "0.6157679", "0.60991204", "0.6061294", "0.6031614", "0.6031614", "0.6031614", "0.60294235", "0.60270816", "0.60074925", "0.596568", "0.5950578", "0.5916883", "0.59099746", "0.5888183", "0.58663034", "0.5863502...
0.88049996
0
Purpose Negate an image. Synopsis y = neg(f) Input
def neg(f): y = limits(f)[0] + limits(f)[1] - f y = y.astype(f.dtype) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def negate_image(p):\n img = read_img(p)\n img_negative = negativo(img.reshape((-1)))\n show_imgs([img, img_negative.reshape(img.shape)])", "def negate(f):\r\n return lambda *args, **kwargs: -f(*args, **kwargs)", "def negate(f):\n return lambda *args, **kwargs: -f(*args, **kwargs)", "def negat...
[ "0.78867733", "0.6656876", "0.6634575", "0.6617678", "0.65859663", "0.6561802", "0.6556013", "0.65398866", "0.6464433", "0.63713396", "0.62923557", "0.62882566", "0.6269459", "0.62583417", "0.62398255", "0.6197755", "0.61889195", "0.61783475", "0.61681277", "0.6134171", "0.61...
0.6865121
1
Purpose Threshold (adaptive) Synopsis y = threshad(f, f1, f2=None) Input
def threshad(f, f1, f2=None): if f2 is None: y = binary(f1 <= f) else: y = binary((f1 <= f) & (f <= f2)) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_threshold(img, threshold_method):\n pass", "def anoise(this, *args, **kargs):\n\t\t\n\t\t# Arguments\n\t\tif not args: args = [50]\n\t\t\n\t\t# Kernel's retrieval\n\t\tanoisek = this._ANOISEK\n\t\tif anoisek is None: return None\n\t\t\n\t\t# More magic\n\t\tbin = this._BINARY\n\t\tfor thresh in arg...
[ "0.6229656", "0.6160869", "0.6063982", "0.60243773", "0.5971279", "0.59138185", "0.57899857", "0.5766369", "0.57433385", "0.5742014", "0.57352954", "0.56106734", "0.5569187", "0.55280715", "0.54871696", "0.54703045", "0.54480124", "0.5442404", "0.54402554", "0.54397815", "0.5...
0.79079473
0
Purpose Image contrast enhancement or classification by the toggle operator. Synopsis y = toggle(f, f1, f2, OPTION="GRAY") Input
def toggle(f, f1, f2, OPTION="GRAY"): from string import upper y=binary(subm(f,f1),subm(f2,f)) if upper(OPTION) == 'GRAY': t=gray(y) y=union(intersec(neg(t),f1),intersec(t,f2)) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle(self, *options: str) -> int:\n self.flags ^= self.mask(*options)\n return self.flags", "def toggled(self, *args, **kwargs): # real signature unknown\n pass", "def toggle_exposure(self):\n\n checked1 = self.exp1_radio.isChecked()\n if checked1:\n self.exp...
[ "0.558803", "0.5400143", "0.53943104", "0.5322771", "0.52874386", "0.52755517", "0.52755517", "0.5176789", "0.517456", "0.51464355", "0.5113748", "0.51136106", "0.5072428", "0.5058913", "0.50524807", "0.5034143", "0.49889058", "0.4969035", "0.49397722", "0.49196398", "0.49194...
0.84176886
0
Purpose Area closing Synopsis y = areaclose(f, a, Bc=None) Input
def areaclose(f, a, Bc=None): if Bc is None: Bc = secross() y = neg(areaopen(neg(f),a,Bc)) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areaopen(f, a, Bc=None):\n\n if Bc is None: Bc = secross()\n if isbinary(f):\n fr = label(f,Bc) # binary area open, use area measurement\n g = blob(fr,'area')\n y = threshad(g,a)\n else:\n y = intersec(f,0)\n zero = binary(y)\n k1 = f.min()\n k2 = f.max()\n ...
[ "0.62880504", "0.5855403", "0.5796685", "0.5641496", "0.5630134", "0.559903", "0.55501044", "0.5520565", "0.5520565", "0.5520565", "0.5520565", "0.5520565", "0.5235822", "0.51636785", "0.51517403", "0.51344275", "0.5131004", "0.50967634", "0.508284", "0.50506383", "0.5011054"...
0.7950012
0
Purpose Area opening Synopsis y = areaopen(f, a, Bc=None) Input
def areaopen(f, a, Bc=None): if Bc is None: Bc = secross() if isbinary(f): fr = label(f,Bc) # binary area open, use area measurement g = blob(fr,'area') y = threshad(g,a) else: y = intersec(f,0) zero = binary(y) k1 = f.min() k2 = f.max() for k in xrange(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areaclose(f, a, Bc=None):\n\n if Bc is None: Bc = secross()\n y = neg(areaopen(neg(f),a,Bc))\n return y", "def testAreaFunction(self):\n pl = Pipeline(loadInitFile=False)\n repl = REPL(pl)\n\n repl.runCommandLine('from math import pi')\n self.assertEqual(REPL.DEFAULT_PS1,...
[ "0.6950423", "0.6059293", "0.6002334", "0.5884578", "0.58367836", "0.58367836", "0.58365864", "0.58365864", "0.5807413", "0.5807413", "0.5732391", "0.5731424", "0.56942225", "0.565846", "0.5613214", "0.55761725", "0.55398726", "0.5475766", "0.54691565", "0.54460627", "0.54133...
0.8273746
0
Purpose Flooding filter h,v,abasin and dynamics (depth, area, volume) Synopsis y = flood(fin, T, option, Bc=None) Input
def flood(fin, T, option, Bc=None): if Bc is None: Bc = secross() print 'Not implemented yet' return None return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FloodFill(*args, **kwargs):\n return _gdi_.DC_FloodFill(*args, **kwargs)", "def FloodFill(*args, **kwargs):\n return _gdi_.PseudoDC_FloodFill(*args, **kwargs)", "def FloodFillPoint(*args, **kwargs):\n return _gdi_.DC_FloodFillPoint(*args, **kwargs)", "def FloodFillPoint(*args, **kwar...
[ "0.60542375", "0.5924105", "0.5439892", "0.5318217", "0.51894724", "0.5099438", "0.50953805", "0.49034697", "0.48614904", "0.48580238", "0.48464018", "0.48142278", "0.48096618", "0.4788183", "0.47364676", "0.47103125", "0.46670437", "0.4665536", "0.46525362", "0.4597145", "0....
0.7646673
0
Purpose Alternating Sequential Filtering Synopsis y = asf(f, SEQ="OC", b=None, n=1) Input
def asf(f, SEQ="OC", b=None, n=1): from string import upper if b is None: b = secross() SEQ=upper(SEQ) y = f if SEQ == 'OC': for i in xrange(1,n+1): nb = sesum(b,i) y = open(close(y,nb),nb) elif SEQ == 'CO': for i in xrange(1,n+1): nb = sesum(b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asfrec(f, SEQ=\"OC\", b=None, bc=None, n=1):\n from string import upper\n if b is None: b = secross()\n if bc is None: bc = secross()\n SEQ = upper(SEQ)\n y = f\n if SEQ == 'OC':\n for i in xrange(1,n+1):\n nb = sesum(b,i)\n y = closerec(y,nb,bc)\n y = ...
[ "0.6301624", "0.53521264", "0.53376013", "0.53115296", "0.5303476", "0.5258769", "0.52543217", "0.49733323", "0.49507746", "0.49413922", "0.48998833", "0.48743987", "0.48278847", "0.48189154", "0.47979927", "0.4753691", "0.4749123", "0.4744525", "0.47334304", "0.47334144", "0...
0.6225852
1
Purpose Reconstructive Alternating Sequential Filtering Synopsis y = asfrec(f, SEQ="OC", b=None, bc=None, n=1) Input
def asfrec(f, SEQ="OC", b=None, bc=None, n=1): from string import upper if b is None: b = secross() if bc is None: bc = secross() SEQ = upper(SEQ) y = f if SEQ == 'OC': for i in xrange(1,n+1): nb = sesum(b,i) y = closerec(y,nb,bc) y = openrec(y,nb,bc) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skelmrec(f, B=None):\n from numpy import ravel\n if B is None: B = secross()\n y = binary(intersec(f, 0))\n for r in xrange(f.max(),1,-1):\n y = dilate(union(y,binary(f,r)), B)\n y = union(y, binary(f,1))\n return y", "def openrec(f, bero=None, bc=None):\n\n if bero is None: bero ...
[ "0.5730395", "0.5557603", "0.5475232", "0.5263288", "0.49125016", "0.49052253", "0.48861334", "0.48711792", "0.47225386", "0.47123808", "0.46584457", "0.46493703", "0.46421638", "0.46004742", "0.45919815", "0.4579293", "0.45733768", "0.4551184", "0.45360827", "0.4519124", "0....
0.75222516
0
Purpose Blob measurements from a labeled image. Synopsis y = blob(fr, measurement, option="image") Input
def blob(fr, measurement, option="image"): import numpy from numpy import newaxis, ravel, zeros, sum, nonzero, array from string import upper measurement = upper(measurement) option = upper(option) if len(fr.shape) == 1: fr = fr[newaxis,:] n = fr.max() if option == 'DATA': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blob_detection(image, th=None, black_blobs=True, min_area=None,\r\n max_area=None):\r\n # Setup\r\n shape = np.shape(image)\r\n labeled = region_labeling(image, th=th, black_blobs=black_blobs)\r\n no_blobs = labeled.max()\r\n\r\n min_area = -np.float('inf') if min_area is None...
[ "0.5654765", "0.56526935", "0.5623079", "0.53789496", "0.53735524", "0.53035295", "0.5287655", "0.52449125", "0.5214615", "0.5209926", "0.5185", "0.51492226", "0.51451564", "0.51160026", "0.5113352", "0.50888085", "0.50841945", "0.5070132", "0.5069628", "0.5051327", "0.504001...
0.7125749
0
Purpose NConditional bisector. Synopsis y = cbisector(f, B, n) Input
def cbisector(f, B, n): y = intersec(f,0) for i in xrange(n): nb = sesum(B,i) nbp = sesum(B,i+1) f1 = erode(f,nbp) f2 = cdilate(f1,f,B,n) f3 = subm(erode(f,nb),f2) y = union(y,f3) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BIC(y_true, y_pred, n_features):\n ll = log_likelihood(y_true, y_pred)\n n_samples = y_true.size\n BIC = np.log(n_samples) * n_features - 2 * ll\n return BIC", "def binomC(k,n):\n return np.double( comb(n, k, exact=1) )", "def cdfFunction(f, x, N):\r\n return ssstats.binom.cdf(x, N, f)", ...
[ "0.5783486", "0.55769235", "0.5562295", "0.5453764", "0.5400742", "0.5284034", "0.52110976", "0.5208021", "0.51938444", "0.51688063", "0.5134528", "0.512883", "0.5098744", "0.5097172", "0.5048469", "0.5046473", "0.50458187", "0.5028002", "0.50091153", "0.49961647", "0.4983178...
0.75721484
0
Purpose Dilate an image conditionally. Synopsis y = cdilate(f, g, b=None, n=1) Input
def cdilate(f, g, b=None, n=1): if b is None: b = secross() y = intersec(f,g) for i in xrange(n): aux = y y = intersec(dilate(y,b),g) if isequal(y,aux): break return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infrec(f, g, bc=None):\n from numpy import product\n if bc is None: bc = secross()\n n = product(f.shape)\n y = cdilate(f,g,bc,n);\n return y", "def dilate(img, kernel = (5,5), iterations = 1):\n\ttmp = grayscale(img)\n\tk = np.ones(kernel, np.uint8)\n\tdilation = cv2.dilate(tmp, k, iterations...
[ "0.6875944", "0.68578786", "0.6476555", "0.63942444", "0.6391396", "0.6347581", "0.62869555", "0.61878175", "0.61785334", "0.613884", "0.60386795", "0.6027216", "0.5942428", "0.5924723", "0.5824156", "0.5744544", "0.5726358", "0.5669799", "0.564099", "0.5625091", "0.55512935"...
0.77406424
0
Purpose Erode an image conditionally. Synopsis y = cerode(f, g, b=None, n=1) Input
def cerode(f, g, b=None, n=1): if b is None: b = secross() y = union(f,g) for i in xrange(n): aux = y y = union(erode(y,b),g) if isequal(y,aux): break return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suprec(f, g, Bc=None):\n from numpy import product\n if Bc is None: Bc = secross()\n n = product(f.shape)\n y = cerode(f,g,Bc,n);\n return y", "def cdilate(f, g, b=None, n=1):\n\n if b is None: b = secross()\n y = intersec(f,g)\n for i in xrange(n):\n aux = y\n y = inter...
[ "0.66517705", "0.5943857", "0.5933971", "0.57270277", "0.57227707", "0.5439064", "0.54309154", "0.5401354", "0.5297804", "0.52749187", "0.52749187", "0.519512", "0.5138248", "0.51023686", "0.50917184", "0.5066798", "0.5056246", "0.50336784", "0.50285774", "0.50285774", "0.498...
0.6833467
0
Purpose Morphological closing. Synopsis y = close(f, b=None) Input
def close(f, b=None): if b is None: b = secross() y = erode(dilate(f,b),b) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeth(f, b=None):\n\n if b is None: b = secross()\n return subm( close(f,b), f)", "def bfm_close ( cid=0\n , rigor=False\n , verbose=False ):\n global _cosim\n _bfm_close = WrapFunction( _cosim\n , 'bfm_close'\n ...
[ "0.73896444", "0.62903255", "0.6011154", "0.5983948", "0.58043665", "0.57365", "0.5491675", "0.5479082", "0.54604906", "0.5456993", "0.5425095", "0.53838634", "0.5316668", "0.530495", "0.5295775", "0.5288599", "0.526393", "0.52470684", "0.52195394", "0.52195394", "0.52195394"...
0.7438756
0
Purpose Closing by reconstruction. Synopsis y = closerec(f, bdil=None, bc=None) Input
def closerec(f, bdil=None, bc=None): if bdil is None: bdil = secross() if bc is None: bc = secross() y = suprec(dilate(f,bdil),f,bc) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closerecth(f, bdil=None, bc=None):\n\n if bdil is None: bdil = secross()\n if bc is None: bc = secross()\n y = subm(closerec(f,bdil,bc), f)\n return y", "def close(f, b=None):\n\n if b is None: b = secross()\n y = erode(dilate(f,b),b)\n return y", "def close_holes(f, Bc=None):\n\n i...
[ "0.7839715", "0.6486543", "0.6265377", "0.5847143", "0.54827523", "0.5472693", "0.5441611", "0.54185206", "0.5277604", "0.5208116", "0.52053356", "0.5147737", "0.512133", "0.5097901", "0.50711316", "0.5071032", "0.50547343", "0.5032319", "0.4974385", "0.49314085", "0.4891587"...
0.8336332
0
Purpose ClosebyReconstruction TopHat. Synopsis y = closerecth(f, bdil=None, bc=None) Input
def closerecth(f, bdil=None, bc=None): if bdil is None: bdil = secross() if bc is None: bc = secross() y = subm(closerec(f,bdil,bc), f) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closerec(f, bdil=None, bc=None):\n\n if bdil is None: bdil = secross()\n if bc is None: bc = secross()\n y = suprec(dilate(f,bdil),f,bc)\n return y", "def closeth(f, b=None):\n\n if b is None: b = secross()\n return subm( close(f,b), f)", "def test_tophat():\n savedImg = galsim.fits.re...
[ "0.6333734", "0.57042897", "0.5461909", "0.54080003", "0.5392715", "0.5336746", "0.5067325", "0.5034286", "0.4987503", "0.49664605", "0.49050784", "0.4875588", "0.48711127", "0.48081443", "0.47970322", "0.47484407", "0.47397316", "0.4729069", "0.47115195", "0.4700084", "0.468...
0.7515942
0
Purpose Closing Top Hat. Synopsis y = closeth(f, b=None) Input
def closeth(f, b=None): if b is None: b = secross() return subm( close(f,b), f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(f, b=None):\n\n if b is None: b = secross()\n y = erode(dilate(f,b),b)\n return y", "def closerecth(f, bdil=None, bc=None):\n\n if bdil is None: bdil = secross()\n if bc is None: bc = secross()\n y = subm(closerec(f,bdil,bc), f)\n return y", "def areaclose(f, a, Bc=None):\n\n ...
[ "0.63748837", "0.57693976", "0.5262075", "0.5258536", "0.52093333", "0.5205753", "0.51961195", "0.519111", "0.517406", "0.5172068", "0.51672524", "0.5165613", "0.51635104", "0.5146999", "0.5071961", "0.4981805", "0.49794212", "0.49304366", "0.49273568", "0.48027503", "0.47993...
0.8136597
0