query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
The units used for variables within. This should be overridden in children.
def get_units(self,): self.UNITS = {'pressure':'Pa',} return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def units(self):\n pass", "def unit_of_measurement(self):\n return self.var_units", "def units(self):\n return self._units", "def units(self):\n return self._units", "def unit_of_measurement(self):\n return self._var_unit", "def unit_of_measurement(self):\n retur...
[ "0.8475738", "0.82523423", "0.7962671", "0.7962671", "0.78302574", "0.78302574", "0.7656947", "0.7647602", "0.763098", "0.75417906", "0.7417572", "0.7415579", "0.74116683", "0.73817796", "0.73459446", "0.73356164", "0.71914446", "0.717996", "0.7169595", "0.71674466", "0.71674...
0.74156046
11
Return the index to load a requested level (in hPa). If level doesn't exist, throw an exception.
def idx_from_lv(self,vrblkey,lv=None): rows = N.where(self.available_fields_array == vrblkey)[0] # idxs = self.available_fields_array[rows,5] if len(rows) == 1 and lv == None: # return idxs[0] return 0 lv_choice = self.available_fields_array[rows,5] # pdb....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level_to_index(level: int) -> int:\n\n level_data = {\n 15: 1,\n 25: 2,\n 30: 3,\n 35: 4,\n 40: 5,\n 45: 6,\n 50: 7,\n }\n return level_data[level]", "def level_index(self, level):\n try:\n return list(self._levels).index(str(level))...
[ "0.68838525", "0.63543373", "0.6246571", "0.61276937", "0.6102357", "0.60659957", "0.60261744", "0.5963071", "0.5932447", "0.5925082", "0.58323705", "0.5814966", "0.5791093", "0.57674646", "0.57245857", "0.5688138", "0.5678364", "0.5652685", "0.56450814", "0.5619901", "0.5617...
0.0
-1
I don't think we need utc/lv aren't all grib files one time? but it is here to enable compatibility with other get() APIs.
def get(self,vrbl,idx=0,utc=None,level=None,lons=None,lats=None): # TODO: look up level in available fields array, return index vrblkey = self.lookup_vrbl(vrbl) print("Variable {0} has key {1} in Grib data.".format(vrbl,vrblkey)) # gg = self.get_record(vrblkey,idx=idx) # idx look...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_info_t_prop_time_get(svn_info_t_self): # real signature unknown; restored from __doc__\n pass", "def get(self, filename, from_time, to_time):\n raise NotImplementedError()", "def get():", "def get():", "def _get_time_info(self, keys: list[str]):\n if self.is_info_v2:\n i...
[ "0.552266", "0.53847766", "0.5327144", "0.5327144", "0.5288795", "0.5284251", "0.51308817", "0.5111512", "0.5103746", "0.5102246", "0.50884247", "0.5059077", "0.50417954", "0.50307804", "0.4973795", "0.4973238", "0.49729574", "0.49729574", "0.4964048", "0.49491337", "0.494704...
0.55045795
1
Look for record entries based on a keyword.
def search_keyword(self,keyword): for entry in self.available_fields_list: for x in entry: if keyword in x: print(entry) break return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def searchRecords(self, filterChoice, keyword):\r\n session = wx.GetApp().session\r\n model = getattr(db, self.modelName)\r\n\r\n result = None\r\n if filterChoice == \"Person\":\r\n qry = session.query(model)\r\n logging.debug(qry)\r\n result = qry.filt...
[ "0.6326545", "0.6215973", "0.6141149", "0.60207176", "0.59056956", "0.58672076", "0.58531576", "0.58378905", "0.58213276", "0.5780427", "0.57540876", "0.57399154", "0.571995", "0.5706627", "0.5669257", "0.5653376", "0.5625087", "0.5598351", "0.559667", "0.55940646", "0.556526...
0.7411851
0
Perform the BLASTing of the proteins in an input file (inputFile) against those in another file (databaseFile). Returns a dictionary of the similarities between proteins, as determined by BLAST. The dictionary is indexed by a alphanumerically ordered tuple (index[0] < index[1]), and the entry for each index is a dictio...
def main(inputFile, databaseFile, blastOperationID, SEG=False, cores=2, minAlignLength=20, maxEValue=1.0, verboseOutput=False): # Get the location of the BLAST executables. srcLocation = os.path.abspath(__file__) srcLocation = '\\'.join(srcLocation.split('\\')[:-1]) BLASTExecutables = srcLocation +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addBlastFilesToStream(fileMap,fragIndex,inputFragment):\n # TODO: return False if output files are missing completely\n\n # get list of reads from input fragment\n records={}\n fastaRecordRE=fileTypeMap['fasta'].sepRE\n with open(inputFragment,'rt') as f:\n for line in f:\n m=f...
[ "0.57911015", "0.57641923", "0.5724841", "0.56280184", "0.55734056", "0.5516204", "0.5510528", "0.54538035", "0.5439656", "0.5411389", "0.5381811", "0.5352944", "0.534707", "0.534198", "0.52927357", "0.5241423", "0.5195701", "0.5192132", "0.5173747", "0.5169282", "0.51647925"...
0.5815675
0
Will perform the process of BLAST > PROCESS OUTPUT on inputFile.
def sequence_BLAST(processedBLAST, inputFile, database, BLASTLoc, SEG, cores): # Setup the parameters for the BLASTing. outputLoc = inputFile.split('.')[0] + '.tmp' query = ' -query ' + inputFile out = ' -out ' + outputLoc evalue = ' -evalue 1' inclusionEThresh = ' -inclusion_ethresh 0.000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self,fileobj_out,fileobj_in):\n pass", "def process_file(input_file = 'NC_012655.ffn',output_file = 'NC_012655.output'):\n #prepare\n f = open(input_file, 'r')\n o = open(output_file,'w')\n seq = ''\n header = f.readline()\n o.write('GeneID Length GC \\n')\n #work\...
[ "0.62266076", "0.60749716", "0.5962994", "0.59588873", "0.5911635", "0.58566844", "0.5830632", "0.58203375", "0.5813754", "0.57374686", "0.5724027", "0.5714571", "0.5711974", "0.5665211", "0.56526506", "0.5626592", "0.5592834", "0.559092", "0.55641717", "0.5556468", "0.554570...
0.5891977
5
Runs the chosen algoirthm until one of the two break criteria are met.
def neighbour_search( orders_dict: dict, algorithm: str, factories_dict: dict, sku_dict: dict, time_limit=600000, iteration_limit=4, ): algorithm = algorithm.lower() if algorithm not in ["naive", "max", "min"]: raise ValueError("Please only select one of naive, max or min as the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_74_break(self):\n\t\tinput = \"\"\"procedure main(); var x:integer;\n\t\tbegin while(true)do begin\n\t\twith x:integer; do with x:real; do begin\n\t\t\tif (x>0) then break;\n\t\t\twith x:integer; do if (x=0) then return;\n\t\tend{with} break; end{while} break; end\"\"\"\n\t\texpect = \"Break Not In Loop\"...
[ "0.6149245", "0.6020976", "0.59952736", "0.5882346", "0.57830894", "0.5751992", "0.5666575", "0.5641377", "0.5601723", "0.5586441", "0.5559049", "0.554734", "0.5497915", "0.5416353", "0.54055893", "0.53711516", "0.53647", "0.5342509", "0.5317392", "0.53048575", "0.5278566", ...
0.0
-1
Returns a path to a fixture via the given fname and label
def fixture(fname, label="reference"): return os.path.join(FIXTURES, label, fname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_file(*path):\n return os.path.join(os.path.dirname(__file__), 'fixtures', *path)", "def get_test_fname(fname):\n path = get_test_path()\n full_path = os.path.join(path, fname)\n return full_path", "def get_filename(label):\n return op.splitext(op.splitext(op.basename(label))[0])[0]",...
[ "0.6520794", "0.6382769", "0.63656783", "0.6110005", "0.5983235", "0.5950241", "0.5911903", "0.59048057", "0.59048057", "0.59048057", "0.5869462", "0.5829332", "0.5817864", "0.58178484", "0.58095974", "0.5808435", "0.57983226", "0.57849145", "0.5742818", "0.5695899", "0.56913...
0.8895459
0
Reads a file in FASTA format, returning a tuple, (label, sequence).
def fasta(path): label = None sequence = None with open(path, 'r') as data: for line in data: line = line.strip() if line.startswith('>'): if label and sequence: yield (label, sequence) label = line[1:] se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_fasta(sequence_file :str):\n\n #for gziped files:\n\n if sequence_file.endswith(\".gz\"):\n with gzip.open(sequence_file, \"rt\") as file:\n seqDict = SeqIO.to_dict(SeqIO.parse(file, 'fasta'))\n ident = ident.split(\"|\")[1]\n return seqDict\n\n # for no gz...
[ "0.7599585", "0.7488535", "0.7305853", "0.72761166", "0.7245398", "0.71999073", "0.711566", "0.70988804", "0.69952655", "0.6989163", "0.69828224", "0.691334", "0.6869248", "0.68569374", "0.6752505", "0.6749362", "0.67348534", "0.6690506", "0.6614239", "0.66042876", "0.6526621...
0.73308635
2
Wrapper function for timing function calls
def timeit(func): def wrapper(*args, **kwargs): start = time.time() result = func(*args, **kwargs) finit = time.time() delta = finit-start return result, delta return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timed(f):\n\n def wrapper(*args, **kwargs):\n start = time.time()\n ret = f(*args, **kwargs)\n end = time.time()\n\n return ret, (end - start)\n\n return wrapper", "def time_it(func):\n\n def wrapper(*args, **kwargs):\n start = timer()\n func(*args, **kwargs...
[ "0.7829795", "0.7792269", "0.7790988", "0.7769397", "0.7762282", "0.7744963", "0.77080756", "0.7681372", "0.7661294", "0.7654119", "0.75102586", "0.75028896", "0.74699044", "0.74616414", "0.74550444", "0.74546194", "0.7453743", "0.7424639", "0.7387927", "0.7381818", "0.73659"...
0.7135359
49
Returns the complement of the DNA sequence
def revc(sequence): complements = { 'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C', 'N': 'N', '.': '.', } def inner(sequence): for char in reversed(sequence): yield complements[char] sequence = sequence.upper() return ''.join(inner(sequen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complement(seq):\n if PY3:\n table = str.maketrans('ACTGNactg', 'TGACNtgac')\n elif PY2:\n table = string.maketrans('ACTGNactg', 'TGACNtgac')\n return str(seq).translate(table)", "def get_reverse_complement(dna):\r\n\r\n seq = Seq(dna)\r\n rev_seq = seq.reverse_complement()\r\n ...
[ "0.7816923", "0.7662132", "0.7593875", "0.7514506", "0.74755436", "0.73782635", "0.7311068", "0.73018074", "0.7296013", "0.7293187", "0.72908664", "0.7290187", "0.7283251", "0.7267131", "0.7253721", "0.7249284", "0.72297704", "0.7224757", "0.7220809", "0.7193174", "0.7168171"...
0.0
-1
Creates a meta_data instance for the model at the time point (appointment) for the given registered_subject. might return None and meta data not created based on visit reason (e.g. missed).
def create_meta_data(self): if self.visit_instance.reason not in self.skip_create_visit_reasons: try: entry = self.entry_model.objects.get( app_label=self.model._meta.app_label.lower(), model_name=self.model._meta.object_name.lower(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def informed_consent_on_post_save(sender, instance, raw, created, **kwargs):\n if not raw:\n if created:\n pass\n # instance.registration_update_or_create()\n # update_model_fields(instance=instance,\n # model_cls=['subject_identifier', inst...
[ "0.5472681", "0.52024764", "0.512791", "0.48788267", "0.48686114", "0.48406184", "0.47583947", "0.4736606", "0.47161746", "0.47055674", "0.46937343", "0.46804252", "0.46649593", "0.46285155", "0.4618309", "0.45941997", "0.4592607", "0.45912987", "0.45581073", "0.45331988", "0...
0.772739
0
Retrieve an organization Return details on an individual organization including various details such as membership access, features, and teams. {method} {path}
def get(self, request, organization): team_list = list(Team.objects.filter( organization=organization, status=TeamStatus.VISIBLE, )) feature_list = [] if features.has('organizations:sso', organization, actor=request.user): feature_list.append('sso') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_organization(organization):\n return fetch_json(organization_url, organization)", "def test_get_organization(self):\n pass", "def test_retrieve_l_organization(self):\n pass", "def GetOrganization(**argd):\n flag, ret = CGateway.core.GetOrganizationName(argd[\"session\"])\n ...
[ "0.7148548", "0.7105574", "0.6952284", "0.65545195", "0.6552218", "0.64303905", "0.64210945", "0.63243663", "0.6256752", "0.6247144", "0.6243915", "0.6230795", "0.61991656", "0.6193295", "0.6187062", "0.6177847", "0.61678433", "0.6031752", "0.6031751", "0.6006261", "0.5959868...
0.64187884
7
Update an organization Update various attributes and configurable settings for the given organization. {method} {path} {{
def put(self, request, organization): serializer = OrganizationSerializer(organization, data=request.DATA, partial=True) if serializer.is_valid(): organization = serializer.save() self.create_audit_entry( request=reques...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, request, pk=None):\n serializer = OrganizationUpdateBody(data=request.data)\n if serializer.is_valid(raise_exception=True):\n name = serializer.validated_data.get(\"name\")\n # agents = serializer.validated_data.get(\"agents\")\n # network = serialize...
[ "0.7464905", "0.7344722", "0.72334814", "0.6991192", "0.68280673", "0.6780415", "0.66433245", "0.6163794", "0.6163794", "0.6163794", "0.6006318", "0.5986513", "0.5846596", "0.57903427", "0.5783204", "0.5736965", "0.57127297", "0.57026005", "0.57019323", "0.5627186", "0.553396...
0.7070443
3
Delete an organization Schedules an organization for deletion. {method} {path}
def delete(self, request, organization): if organization.is_default: return Response({'detail': ERR_DEFAULT_ORG}, status=400) logging.getLogger('sentry.deletions').info( 'Organization %s (id=%s) removal requested by user (id=%s)', organization.slug, organization.id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_organization(self):\n pass", "def delete(self, organization_id):\n if organization_id is not None:\n # fetch org to delete\n try:\n org = Organization.query.filter_by(id=organization_id).first()\n # return 404 if org does not exist...
[ "0.70051813", "0.6944466", "0.67821133", "0.65625185", "0.6549952", "0.6258782", "0.6244123", "0.6154723", "0.6129886", "0.6023895", "0.59733737", "0.59061176", "0.58606285", "0.58501047", "0.58364564", "0.58216476", "0.56640875", "0.56540847", "0.5620168", "0.5593044", "0.55...
0.7104207
0
Start an application in a subprocess.
def __init__(self, *args, **kwargs): mp.Process.__init__(self) self._args = args self._kwargs = kwargs self._host_conn, self._proc_conn = mp.Pipe() self.daemon = True self.start() reply = self._host_conn.recv() if isinstance(reply, Exception): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Start(self):\n\n\n\n assert not self._process, 'Start() can only be called once'\n self._process = subprocess.Popen(self._args)", "def start(self):\n self._proc = self._get_subprocess()\n self._pid = self._proc.pid\n self._return_code = None", "def run_app(self):\n # Updat...
[ "0.7369324", "0.7195297", "0.70307446", "0.7023959", "0.69730425", "0.6970679", "0.683562", "0.6766922", "0.6708134", "0.6668066", "0.66187245", "0.654548", "0.6529274", "0.64943254", "0.64486915", "0.640595", "0.64022136", "0.63618714", "0.6325139", "0.631463", "0.62968546",...
0.0
-1
Redirect method calls to the subprocess.
def __getattr__(self, name): def _send(*args, **kwargs): self._host_conn.send((name, args, kwargs)) reply = self._host_conn.recv() if isinstance(reply, Exception): raise reply return reply return _send
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_subprocess(self, monkeypatch):\n monkeypatch.setattr('subprocess.check_call', self.fake_check_call)", "def wrap_command(self, prog_name, command, preserve_files):\n raise NotImplementedError(\"Pure virtual method wrap_command() called\")", "def _override_command_method(self, name):\n ...
[ "0.6421962", "0.59309554", "0.55841166", "0.5566177", "0.5490214", "0.53713787", "0.5369807", "0.53612804", "0.5358685", "0.5349538", "0.5338001", "0.53358626", "0.5319026", "0.52982914", "0.5297855", "0.52841663", "0.52483004", "0.52227914", "0.52191365", "0.521012", "0.5161...
0.0
-1
Run the application in a subprocess.
def run(self): try: # import here to prevent Panda3D from loading in the host process from .viewer_app import ViewerApp app = ViewerApp(*self._args, **self._kwargs) self._proc_conn.send(None) def _execute(task): for _ in range(100): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_app(self):\n # Update system arguments\n sys.argv[0] = sys.executable\n sys.argv[1] = '{}.py'.format(sys.argv[1])\n\n # Make sure to exit with the return value from the subprocess call\n self._app_process = subprocess.Popen(sys.argv)\n return self._app_process.wait...
[ "0.7752048", "0.7020225", "0.6981871", "0.6956881", "0.6930996", "0.69175863", "0.689937", "0.68447065", "0.68109673", "0.6805248", "0.6789014", "0.6736907", "0.66935885", "0.66848093", "0.6647466", "0.66381854", "0.6635647", "0.66031396", "0.66024846", "0.6504287", "0.641390...
0.60383326
77
Test wether or not `path` is absolute url.
def is_absolute_url(path): return path.startswith("http")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_absolute_path(path: str) -> bool:\n # This is a rather weak test, may be enhanced if desired\n return \"//\" in path \\\n or \":\" in path \\\n or path.startswith(\"/\")", "def isabs(path):\n # If detected as storage path, it is an absolute path.\n return True", "def is_a...
[ "0.85445476", "0.8208567", "0.73892355", "0.736103", "0.72351986", "0.68886465", "0.6864662", "0.6810893", "0.67265016", "0.6722769", "0.6581062", "0.6573491", "0.65669185", "0.6557852", "0.6554364", "0.65135294", "0.6481539", "0.64398235", "0.64357907", "0.64325374", "0.6398...
0.8398912
1
Return a path as an absolute url.
def get_absolute_url(path): if is_absolute_url(path): return path site = settings.SITES['front'] return build_url(path, scheme=site['scheme'], domain=site['domain'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_url(self, path):\n if path[0] == '/':\n path = path[1:]\n return urljoin(self.absolute_root, path)", "def build_absolute_url(self, path_or_url):\n return urllib.parse.urljoin(self.parsed_url.geturl(), path_or_url)", "def create_absolute_url(path: str) -> str:\n domai...
[ "0.8106669", "0.78375137", "0.7732806", "0.75587624", "0.7432354", "0.7375705", "0.7318042", "0.727619", "0.72687167", "0.7228609", "0.71804714", "0.7169504", "0.7164312", "0.7094387", "0.7032917", "0.6995915", "0.69660145", "0.68689567", "0.68408626", "0.6804187", "0.6791408...
0.78109497
2
Same behavior as django's reverse but uses django_sites to compute absolute url.
def reverse(viewname, *args, **kwargs): return get_absolute_url(django_reverse(viewname, *args, **kwargs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_url(self):\n\n url = reverse('comicsite.views.site', args=[self.short_name])\n return url", "def reverse(*args, **kw):\n return make_absolute_url(django_reverse(*args, **kw))", "def url_abs(name, *args):\n\tprotocol = settings.PROTOCOL\n\tdomain = settings.DOMAIN\n\turl = reve...
[ "0.7787592", "0.7709379", "0.76670426", "0.73699325", "0.73201346", "0.73201346", "0.69739074", "0.69669706", "0.69336665", "0.69207036", "0.69077927", "0.6861142", "0.6835743", "0.67903143", "0.6759977", "0.6747809", "0.6734185", "0.67224824", "0.67141503", "0.67096394", "0....
0.68545514
12
Hook if plugin wants to do something on initialization
def setup(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_initialize(self) -> None:\n pass", "def on_startup(self) -> None:\n ...", "def on_load(self):\n self.__init__()", "def plugin_init():\n\n global _recreate_omf_objects\n\n _logger.debug(\"{0} - URL {1}\".format(\"plugin_init\", _config['URL']))\n\n try:\n\n _recreat...
[ "0.7507647", "0.7504341", "0.7496409", "0.7494931", "0.74793804", "0.74655914", "0.7393103", "0.73722833", "0.73722833", "0.73722833", "0.73722833", "0.73652464", "0.7331865", "0.7323755", "0.72868645", "0.7274375", "0.7180136", "0.71684223", "0.7052333", "0.7052333", "0.7042...
0.0
-1
Return dtype of computed data; used only if no dtype attribute defined
def infer_dtype(self): # Don't raise NotImplementedError, IDE will complain you're not # implementing all abstract methods... raise RuntimeError("No infer dtype method defined")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dtype(a):\n return a.dtype", "def dtype(self) -> np.dtype:\n ...", "def dtype(self):\n return self.data.dtype", "def infer_dtype(self):\n raise NotImplementedError", "def dtype(self):\n return self._data.dtype", "def dtype(self):\n return self._data.dtype", "de...
[ "0.8160277", "0.8091967", "0.78537405", "0.7848468", "0.7772697", "0.7772697", "0.77548546", "0.77424324", "0.77381605", "0.7717209", "0.7709745", "0.7655319", "0.76532096", "0.762091", "0.7618867", "0.7592245", "0.7592245", "0.7592245", "0.7457054", "0.743728", "0.733613", ...
0.72716284
21
Return version number applicable to the run_id. Most plugins just have a single version (in .__version__) but some may be at different versions for different runs (e.g. timedependent corrections).
def version(self, run_id=None): return self.__version__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"version_id\")", "def get_version(self):\r\n\r\n return self.versions[0].number", "def plugin_version(self):\n return self.__plugin_version", "def get_version(self):\n return self.cur_config['version'...
[ "0.6729067", "0.6524676", "0.64457977", "0.64410496", "0.6421774", "0.638525", "0.6285096", "0.6263206", "0.6241869", "0.62201875", "0.62045753", "0.61937886", "0.6150016", "0.61450565", "0.61103964", "0.6099586", "0.6094055", "0.6089521", "0.60501593", "0.6048226", "0.604449...
0.8039038
1
Metadata to save along with produced data
def metadata(self, run_id, data_type): if not data_type in self.provides: raise RuntimeError(f"{data_type} not in {self.provides}?") return dict( run_id=run_id, data_type=data_type, data_kind=self.data_kind_for(data_type), dtype=self.dtype_for(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, metadata):\n pass", "def saveMetadata(self):\n pickle.dump(self.metadata, open(self.metadataFile, 'w+b'))", "def save_meta(self):\n # jOut = os.path.join(self.meta[\"wdir\"], meta_file)\n with open(self.meta_filepath, \"w\") as f:\n json.dump(self.meta, f)"...
[ "0.77472275", "0.77155846", "0.7143829", "0.71382594", "0.7115775", "0.7076076", "0.7007138", "0.6980497", "0.6932532", "0.69278365", "0.6896692", "0.68722975", "0.68544436", "0.68350136", "0.67774874", "0.67684793", "0.6745481", "0.67393374", "0.66593844", "0.6621759", "0.65...
0.0
-1
Return whether the chunk chunk_i is ready for reading. Returns True by default; override if you make an online input plugin.
def is_ready(self, chunk_i): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isComplete(self):\n return self.bytesToRead == 0", "def readable(self):\n self._check_not_closed()\n return False", "def readable(self):\n return self.interface.in_waiting", "def wantsReadEvent(self):\r\n if self.result != None:\r\n return self.result == 0\r\...
[ "0.69202155", "0.66135347", "0.64482975", "0.6399048", "0.6347218", "0.63396084", "0.6247333", "0.6240271", "0.6226292", "0.6206879", "0.61784005", "0.61481017", "0.6137742", "0.6130014", "0.6119764", "0.6119764", "0.6114823", "0.61147493", "0.61111355", "0.61077726", "0.6064...
0.8069259
0
Return whether all chunks the plugin wants to read have been written. Only called for online input plugins.
def source_finished(self): # Don't raise NotImplementedError, IDE complains raise RuntimeError("source_finished called on a regular plugin")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_readings(self):\n # loading data from log file\n if self.filepath is not None:\n if self.all_read is None:\n return False\n else:\n ei = self.curr_indexi + self.read_step\n if ei >= self.all_read.shape[0]:\n ...
[ "0.6492002", "0.6469171", "0.63446265", "0.6324339", "0.6238816", "0.6206547", "0.6205954", "0.6199328", "0.61821496", "0.61651605", "0.6162274", "0.6162274", "0.61592495", "0.6116448", "0.60340613", "0.6015801", "0.5949607", "0.59428126", "0.5938531", "0.59170115", "0.587718...
0.0
-1
Iterate over dependencies and yield results
def iter(self, iters, executor=None): deps_by_kind = self.dependencies_by_kind() # Merge iterators of data that has the same kind kind_iters = dict() for kind, deps in deps_by_kind.items(): kind_iters[kind] = strax.merge_iters( strax.sync_iters( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_dependencies(target, dep_context):\n for dep in target.closure(bfs=True, **dep_context.target_closure_kwargs):\n yield dep", "def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requirement]:\n raise NotImplementedError()", "def _jar_dependencies(self, dep):\r\n if isins...
[ "0.7130062", "0.6738838", "0.67295426", "0.66484344", "0.6448103", "0.6326727", "0.62433416", "0.62354714", "0.6179864", "0.60664564", "0.5945691", "0.5933414", "0.59150857", "0.59114265", "0.5876124", "0.5872147", "0.5864354", "0.58548445", "0.5850609", "0.58492243", "0.5845...
0.5817837
22
Wrapper for the userdefined compute method This is the 'job' that gets executed in different processes/threads during multiprocessing
def do_compute(self, chunk_i=None, **kwargs): if self.compute_takes_chunk_i: result = self.compute(chunk_i=chunk_i, **kwargs) else: result = self.compute(**kwargs) return self._fix_output(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(self, *args):\n\n pass", "async def compute(self, *args):\n\n if self.is_output:\n await self.output_compute(*args)\n else:\n await self.input_compute(*args)", "def compute(self, **kwargs):\n raise NotImplementedError", "def compute(*args, **kwarg...
[ "0.7612346", "0.7391647", "0.73353815", "0.7278398", "0.7083773", "0.68990755", "0.6735223", "0.66403323", "0.66300184", "0.66108423", "0.66101986", "0.64207846", "0.6332434", "0.6248518", "0.6230195", "0.6211428", "0.6190991", "0.6186588", "0.6131487", "0.6117481", "0.609191...
0.6578323
11
Return the required window size in nanoseconds
def get_window_size(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_window_size(rectified_signal):\n logging.debug('running determine_window_size function')\n first_peak = first_peak_detect(rectified_signal, 1)\n second_peak = first_peak_detect(rectified_signal, first_peak + 1)\n return (second_peak - first_peak) * WINDOW_MULTIPLIER", "def window_size(s...
[ "0.6956439", "0.692949", "0.6680659", "0.6524226", "0.6438083", "0.643161", "0.64152575", "0.6410299", "0.6361257", "0.63495505", "0.63490444", "0.6307991", "0.625709", "0.6253582", "0.6225795", "0.6221469", "0.618813", "0.6102591", "0.6072447", "0.60635877", "0.6054567", "...
0.6643748
3
returns number of 'instagram' stickers needed to make a phrase
def stickers_for(phrase): stic_dict = {} for ltr in 'instagram': if ltr not in stic_dict: stic_dict[ltr] = 1 else: stic_dict[ltr] += 1 print(ltr) phr_dict = {} for ltr in phrase: if ltr not in phr_dict: phr_dict[ltr] = 1 else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(text):\n return len(text)", "def total_phrases(target_text):\n\n nbphrase = 0\n separators = '.!?;'\n for char in target_text:\n if char in separators:\n nbphrase = nbphrase + 1\n return nbphrase", "def loop_through_text(phrase_length):\n\n # get text\n tanach =...
[ "0.6402699", "0.62502104", "0.62345266", "0.61822414", "0.6158409", "0.61361337", "0.6079605", "0.6060118", "0.6012842", "0.6003197", "0.59709525", "0.5940616", "0.58799154", "0.5834511", "0.5813628", "0.5810768", "0.5804959", "0.5762326", "0.57615393", "0.57399106", "0.57376...
0.7720326
0
Loads config from the given paths. A handful of seed values will be set to act as if specified in the loaded config file's DEFAULT section, and be available for use in substitutions. The caller may override some of these seed values.
def load(cls, configpaths, seed_values=None): if not configpaths: return _EmptyConfig() single_file_configs = [] for configpath in configpaths: parser = cls._create_parser(seed_values) with open(configpath, 'r') as ini: parser.readfp(ini) single_file_configs.append(_SingleFi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(paths):\n if not paths:\n raise ConfigException(message='No configuration file specified',\n reason=paths)\n yaml_dict = {}\n if type(paths) == str:\n paths = [paths]\n # for every filename in list...\n for path in paths:\n # read config fil...
[ "0.7207116", "0.6690684", "0.6671056", "0.6507221", "0.62847865", "0.61621714", "0.6146892", "0.6069338", "0.6026834", "0.60224783", "0.59600526", "0.5925976", "0.5920861", "0.58888274", "0.58582234", "0.58458626", "0.58401996", "0.5825556", "0.582437", "0.58228505", "0.58212...
0.7786894
0
Creates a config parser that supports %([keyname])s value substitution. A handful of seed values will be set to act as if specified in the loaded config file's DEFAULT section, and be available for use in substitutions. The caller may override some of these seed values.
def _create_parser(cls, seed_values=None): seed_values = seed_values or {} buildroot = seed_values.get('buildroot', get_buildroot()) all_seed_values = { 'buildroot': buildroot, 'homedir': os.path.expanduser('~'), 'user': getpass.getuser(), 'pants_bootstrapdir': get_pants_cachedir(),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _new():\n\treturn ConfigParser(\n\tdelimiters = ('=',),\n\tcomment_prefixes = ('#', ';'),\n\tdefault_section = 'default',\n\tallow_no_value = False,\n\tstrict = False,\n\tinterpolation = ExtendedInterpolation(),\n\tdefaults = {\n\t\t'debug': False,\n\t\t'datadir': path.join(path.expanduser('~'), '.local', 'ros...
[ "0.5458247", "0.5408141", "0.5199554", "0.50978345", "0.5079219", "0.4990985", "0.497882", "0.49530998", "0.49407214", "0.49386162", "0.49364063", "0.49315286", "0.4930387", "0.49081331", "0.4890862", "0.48780882", "0.4861418", "0.48542067", "0.48509136", "0.48480615", "0.483...
0.5753604
0
Retrieves option from the specified section (or 'DEFAULT') and attempts to parse it as type. If the specified section does not exist or is missing a definition for the option, the value is looked up in the DEFAULT section. If there is still no definition found, the default value supplied is returned.
def get(self, section, option, type_=six.string_types, default=None): return self._getinstance(section, option, type_, default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, section, option, default=None, **kwargs):\n section = section.lower()\n option = option.lower()\n if self.has_section(section) and self.has_option(section, option):\n # Super does not work for ConfigParser as not inherited from object\n out = configparser.Co...
[ "0.73788524", "0.7365858", "0.7304894", "0.7237488", "0.71810937", "0.6949195", "0.6876211", "0.686278", "0.6829772", "0.67827827", "0.67400485", "0.6720243", "0.6594856", "0.6542349", "0.65182227", "0.64763665", "0.6465788", "0.64603096", "0.64568794", "0.64402354", "0.64163...
0.7418041
0
Returns the underlying singlefile configs represented by this object.
def configs(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configs(self):\n return self._configs", "def configs(self):\n\n return self.__configs", "def get_full_config(self):\n return self._read_config()", "def config(self) -> dict:\n return self._configs", "def config(self):\n return self._cfg", "def config(self):\r\n r...
[ "0.71781963", "0.71364343", "0.70960563", "0.6913402", "0.69121945", "0.66923416", "0.6692044", "0.6692044", "0.6688849", "0.6688849", "0.6688849", "0.6674267", "0.6649714", "0.66398054", "0.65898687", "0.6565974", "0.65383905", "0.65109235", "0.65039575", "0.650033", "0.6458...
0.6552234
16
Returns the sources of this config as a list of filenames.
def sources(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_name_list(self):\n return list(self._sources.keys())", "def sources(self):\n return self._sources", "def sources(self):\n return self._sources.keys()", "def Sources():\n return _sources", "def sources(self) -> Sequence[Any]:\n return pulumi.get(self, \"sources\")",...
[ "0.7786413", "0.77240646", "0.7713705", "0.7628546", "0.75150096", "0.7434362", "0.72902656", "0.7239786", "0.72359085", "0.71616554", "0.71586025", "0.71586025", "0.7079919", "0.7046149", "0.7037049", "0.6996502", "0.69905746", "0.69320965", "0.6907242", "0.688997", "0.68408...
0.6767311
22
Returns the sections in this config (not including DEFAULT).
def sections(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_list(self):\n return self._config_parser.sections()", "def getSections(self):\n answer = self._configParser.sections()\n for item in self._defaultValues:\n if item not in answer:\n answer.append(item)\n return answer", "def sections(self):\n ...
[ "0.8512301", "0.8508229", "0.8307163", "0.7925625", "0.79061824", "0.7736119", "0.76756203", "0.766217", "0.76578575", "0.7541391", "0.7338333", "0.7338333", "0.72865856", "0.72596097", "0.7200811", "0.71924216", "0.71607226", "0.7013504", "0.69939464", "0.69557583", "0.68077...
0.6593047
22
Returns whether this config has the section.
def has_section(self, section): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_section(self,name):\n return self.__config.has_section(name)", "def has_section(self, section):\r\n return self.configparser.has_section(section)", "def has_section(self, section):\n\n return self.cfg.has_section(section)", "def has_section(self, section):\n return section in self...
[ "0.8642762", "0.84708226", "0.8450783", "0.83417547", "0.82778883", "0.82477504", "0.81383157", "0.8037954", "0.768683", "0.7682951", "0.7524755", "0.711535", "0.7076341", "0.7069764", "0.6811312", "0.67209554", "0.6706611", "0.67006975", "0.6656741", "0.66467994", "0.6576400...
0.7412496
11
Returns whether this config specified a value the option.
def has_option(self, section, option): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_option(self, name):\n return self.option_settings[name]", "def has_option(self, key):\n\n return key in self.__opt", "def has_option(self, option):\n splitvals = option.split('/')\n section, key = \"/\".join(splitvals[:-1]), splitvals[-1]\n\n return RawConfigParser.ha...
[ "0.77919054", "0.7458672", "0.7176345", "0.7071135", "0.7064684", "0.69743544", "0.69613177", "0.6923256", "0.6885776", "0.6852783", "0.684224", "0.68362474", "0.6797654", "0.6762468", "0.67084855", "0.6697023", "0.6682692", "0.6671115", "0.66410077", "0.6624669", "0.6616862"...
0.61884606
48
Returns the value of the option in this config as a string, or None if no value specified.
def get_value(self, section, option): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self):\n return self._get_value(self.optionType, self.value, self.defaultValue)", "def fmt_option_val(option):\n if option is None:\n return \"\"\n return str(option)", "def opt_value(self):\n return self._opt_value", "def OptionValue(self):\n if self.force_aut...
[ "0.7286254", "0.72754765", "0.71678287", "0.7146978", "0.71148956", "0.690592", "0.68540543", "0.6821994", "0.67486674", "0.6748038", "0.67415774", "0.67415774", "0.67415774", "0.67415774", "0.67415774", "0.67415774", "0.67415774", "0.67415774", "0.67415774", "0.67415774", "0...
0.6038727
100
Returns the path to the source file the given option was defined in.
def get_source_for_option(self, section, option): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_file_path(self) -> str:\n return self._source_file_path", "def _get_source_path(self, docmeta: DocMetadata) -> Optional[str]:\n identifier = docmeta.arxiv_identifier\n version = docmeta.version\n file_noex = identifier.filename\n if not docmeta.is_latest:\n ...
[ "0.70683277", "0.6915933", "0.68622655", "0.6847837", "0.66117984", "0.6302336", "0.6269676", "0.6259663", "0.6240513", "0.6234616", "0.6230491", "0.6221738", "0.62008744", "0.6191012", "0.6189371", "0.61713874", "0.6149972", "0.61361355", "0.6125448", "0.60671276", "0.604563...
0.74370855
0
initialize the tmean cluster
def __init__(self, n_clusters=0, centroids=None, data=None, labels=[], distance='cov', threshold=0.38, dimension=128, update_centroids=True): self.n_clusters = n_clusters ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_cluster(self):\n self._Init_Cluster()", "def __initCluster(self):\n data_size, cluster_center = self.data_size, self.cluster_center\n self.cluster_temp = np.zeros(data_size, dtype=int)\n self.cluster_upper_bound = np.full(len(cluster_center), float('inf'), dtype=float)\n ...
[ "0.6738208", "0.63276654", "0.63108695", "0.62052727", "0.60864115", "0.6062684", "0.60300195", "0.5981466", "0.59145635", "0.5901523", "0.5853843", "0.5845921", "0.58449733", "0.5808943", "0.5794397", "0.5763279", "0.5758935", "0.574938", "0.57491726", "0.57318556", "0.57304...
0.5286891
75
solve argmin_{beta} ||y X dot beta ||_1
def IRLS(self, y, X, beta, w, delta = 1e-8): W = sparse.diags(w) beta = inv(X.T @ W @ X) @ X.T @ W @ y w = 1 / np.maximum(delta, np.abs(y - X @ beta)) return beta, w
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minfunc(beta, yvec, xmat ):\n return yvec - exp(dot(xmat, beta))", "def objective(beta, lambdat, X, y):\n return 1/len(y) * (np.sum(\n (np.maximum(0, 1-((y[:, np.newaxis]*X).dot(beta)))**2)))\\\n + lambdat * np.linalg.norm(beta)**2", "def solve_beta_lasso(X, Y, t):\n p = X.shape[1]\n...
[ "0.76020336", "0.66610235", "0.6239103", "0.6199994", "0.5979489", "0.59647894", "0.5962795", "0.5930549", "0.588228", "0.5881008", "0.58784705", "0.5788748", "0.5787775", "0.57678", "0.57592976", "0.57562065", "0.5743531", "0.5743035", "0.57398003", "0.57210016", "0.57176596...
0.0
-1
Provides specific explanation data.
def data(self, key=None): # NOTE: When a non-default provider is used, it's represented as ("provider", key). if isinstance(key, tuple) and len(key) == 2: _, key = key # NOTE: Currently returns full internal object, open to change. if key == -1: return self._inte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def explain(self):", "def _describe(self) -> Dict[str, Any]:", "def explanation(self, explanation):\n\n self._explanation = explanation", "def get_explain_details2(match_explanation):\n expl = []\n matchers = match_explanation[\"details\"] # at times the explanation is not in 'details' list!!\n if...
[ "0.66131544", "0.65381855", "0.6452191", "0.6341137", "0.63367254", "0.6238496", "0.60453624", "0.60426176", "0.6004104", "0.5966842", "0.596472", "0.59641504", "0.5941501", "0.5920873", "0.5890071", "0.58864754", "0.58783513", "0.58569354", "0.58312625", "0.5824691", "0.5818...
0.0
-1
cached request to github to avoid requesting this too often
def _fetch_data(url: str, d: datetime) -> pd.DataFrame: return pd.read_json(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github_api(request):\n if not request.startswith('https://api.github.com/'):\n request = 'https://api.github.com/' + request\n d = time.time() - github_api.last_time\n if d < 1:\n time.sleep(1 - d) # wait at least one second between GitHub API calls\n key = os.getenv('GITHUB_API_KEY'...
[ "0.6290903", "0.6110685", "0.6091229", "0.6054084", "0.58456695", "0.58443004", "0.58402115", "0.58225346", "0.579956", "0.5798013", "0.5787587", "0.57315785", "0.5699487", "0.5694648", "0.562111", "0.5616564", "0.56037015", "0.55681086", "0.5555009", "0.55348444", "0.5524224...
0.0
-1
Tests the ability to submit machine flags
def test_machine_flags(mock_htb_client: HTBClient): # Create a fake machine to test with machine = Machine({ "id": 1, "name": "Lame", "os": "Linux", "points": 0, "release": "2021-02-27T17:00:00.000000Z", "user_owns_count": 0, "root_owns_count": 0, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_checkFlags(self):\n self.failUnlessEqual(self.nice.opts['aflag'], 1)\n self.failUnlessEqual(self.nice.opts['flout'], 0)", "def test_handle_flag_error(self):\n pass", "def test_fortress_flags(mock_htb_client: HTBClient):\n # Create a fake fortress to test with\n fortress = Fo...
[ "0.6605318", "0.65299326", "0.64944285", "0.64357823", "0.6367936", "0.62655514", "0.6254911", "0.62415195", "0.60922045", "0.6091679", "0.60882485", "0.60709053", "0.6067145", "0.60066473", "0.5954045", "0.59530026", "0.5952983", "0.59263897", "0.59212893", "0.5817619", "0.5...
0.79896796
0
Tests the ability to submit challenge flags
def test_challenge_flags(mock_htb_client: HTBClient): # Create a fake challenge to test with challenge = Challenge({ "id": 1, "name": "Crack This", "retired": True, "points": 0, "difficulty_chart": "0", "release_date": "2018-04-25", "solves": 0, "a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fortress_flags(mock_htb_client: HTBClient):\n # Create a fake fortress to test with\n fortress = Fortress({\n \"id\": 1,\n \"name\": \"Jet\",\n \"ip\": \"10.13.37.10\",\n \"image\": \"https://www.hackthebox.eu/storage/companies/3.png\",\n \"number_of_flags\": 11\n ...
[ "0.7046961", "0.6523449", "0.6378727", "0.615151", "0.59990907", "0.5966798", "0.59481794", "0.594684", "0.5943263", "0.5833452", "0.58245754", "0.5815917", "0.5809349", "0.5805617", "0.5789382", "0.57777566", "0.5737647", "0.5709123", "0.5697028", "0.56850445", "0.5678845", ...
0.82451797
0
Tests the ability to submit endgame flags
def test_endgame_flags(mock_htb_client: HTBClient): # Create a fake endgame to test with endgame = Endgame({ "id": 1, "name": "P.O.O.", "avatar_url": "nothing.png", "cover_image_url": "nothing.png", "retired": True, "vip": True, "creators": [{ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_challenge_flags(mock_htb_client: HTBClient):\n # Create a fake challenge to test with\n challenge = Challenge({\n \"id\": 1,\n \"name\": \"Crack This\",\n \"retired\": True,\n \"points\": 0,\n \"difficulty_chart\": \"0\",\n \"release_date\": \"2018-04-25\",\...
[ "0.6466769", "0.63374233", "0.62643325", "0.61247206", "0.61133975", "0.61104405", "0.609314", "0.60709924", "0.59978354", "0.58942944", "0.5889562", "0.5853111", "0.58342797", "0.5833326", "0.58182824", "0.5808839", "0.580797", "0.5788669", "0.5773043", "0.57706904", "0.5754...
0.77757776
0
Tests the ability to submit fortress flags
def test_fortress_flags(mock_htb_client: HTBClient): # Create a fake fortress to test with fortress = Fortress({ "id": 1, "name": "Jet", "ip": "10.13.37.10", "image": "https://www.hackthebox.eu/storage/companies/3.png", "number_of_flags": 11 }, mock_htb_client, summar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_checkFlags(self):\n self.failUnlessEqual(self.nice.opts['aflag'], 1)\n self.failUnlessEqual(self.nice.opts['flout'], 0)", "def test_flags(self):\n self.check_search(\n dict(flag_contact=u'yes'),\n [u'Tackle', u'DoubleSlap', u'Ice Punch', u'Bite', u'Fly'],\n ...
[ "0.6779397", "0.6575178", "0.64314836", "0.6311009", "0.620359", "0.61329275", "0.6104035", "0.6099779", "0.6085823", "0.6070564", "0.60327524", "0.60288745", "0.60206354", "0.59562874", "0.5912869", "0.5899586", "0.5886937", "0.5829158", "0.57350963", "0.57208604", "0.571990...
0.77798915
0
Test explicit value creation.
def test_creation(site): attr = models.Attribute.objects.create( resource_name='Device', site=site, name='test_attribute' ) dev = models.Device.objects.create( hostname='foo-bar1', site=site ) # Explicitly create a Value without providing site_id val = models.Value.objec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creation_dict():\n with pytest.raises(ValueError) as __:\n value = dict()\n __ = param.Integer(value=value)", "def test_creation_str():\n with pytest.raises(ValueError) as __:\n value = \"42\"\n __ = param.Integer(value=value)", "def test_creat...
[ "0.73240423", "0.71990496", "0.7117133", "0.70802635", "0.68730843", "0.66622335", "0.64344686", "0.6415248", "0.63561475", "0.6349691", "0.6336331", "0.6328015", "0.6309541", "0.62116146", "0.61904067", "0.61900926", "0.61748517", "0.6167833", "0.6157425", "0.61522233", "0.6...
0.61966324
14
Return the url to use to get a video thumbnail.
def _get_url(self, video, thumbnail): return f"/api/videos/{video.pk}/thumbnails/{thumbnail.id}/"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thumbnail_url(self):\n if self.thumbnail_url:\n return self.thumbnail_url\n \n if not self.get_video_id():\n return ''\n \n if not self.thumbnail_url:\n api_url = 'https://api.dailymotion.com/video/%s?fields=thumbnail_url' % self.get_video_id()\n ...
[ "0.8509363", "0.8491865", "0.8400712", "0.8359779", "0.8358022", "0.8317948", "0.813222", "0.8024413", "0.7839949", "0.77882147", "0.77798337", "0.76739687", "0.76691765", "0.7563553", "0.7558059", "0.7404783", "0.7250487", "0.72193384", "0.71992475", "0.7136481", "0.709769",...
0.8081987
7
Assert the user cannot retrieve a thumbnail.
def assert_user_cannot_retrieve_thumbnail(self, user, thumbnail): jwt_token = UserAccessTokenFactory(user=user) response = self.client.get( self._get_url(thumbnail.video, thumbnail), HTTP_AUTHORIZATION=f"Bearer {jwt_token}", ) self.assertEqual(response.status_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_thumbnail_retrieve_by_random_user(self):\n user = UserFactory()\n\n self.assert_user_cannot_retrieve_thumbnail(user, self.some_thumbnail)", "def assert_user_can_retrieve_thumbnail(self, user, thumbnail):\n jwt_token = UserAccessTokenFactory(user=user)\n\n response = self....
[ "0.7858373", "0.6750369", "0.67265964", "0.66662884", "0.6562147", "0.65335554", "0.6521999", "0.6404572", "0.63752455", "0.63744694", "0.6354989", "0.6335756", "0.6335132", "0.63183075", "0.6306187", "0.62036556", "0.6201066", "0.6169549", "0.6157951", "0.61430115", "0.60936...
0.8417783
0
Assert the user can retrieve a thumbnail.
def assert_user_can_retrieve_thumbnail(self, user, thumbnail): jwt_token = UserAccessTokenFactory(user=user) response = self.client.get( self._get_url(thumbnail.video, thumbnail), HTTP_AUTHORIZATION=f"Bearer {jwt_token}", ) self.assertEqual(response.status_code,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_thumbnail_retrieve_by_random_user(self):\n user = UserFactory()\n\n self.assert_user_cannot_retrieve_thumbnail(user, self.some_thumbnail)", "def assert_user_cannot_retrieve_thumbnail(self, user, thumbnail):\n jwt_token = UserAccessTokenFactory(user=user)\n\n response = se...
[ "0.7861407", "0.76095414", "0.75132185", "0.71113604", "0.70641714", "0.68966985", "0.68929076", "0.6885267", "0.68603885", "0.6830988", "0.6725639", "0.67165977", "0.66617674", "0.66551024", "0.661036", "0.6549719", "0.65310204", "0.6513257", "0.6444996", "0.6356796", "0.634...
0.79718024
0
Anonymous users should not be allowed to retrieve a thumbnail.
def test_api_thumbnail_read_detail_anonymous(self): video = VideoFactory() thumbnail = ThumbnailFactory(video=video) response = self.client.get(self._get_url(video, thumbnail)) self.assertEqual(response.status_code, 401) content = json.loads(response.content) self.assertE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_home_as_anonymous(self):\n response = self.client.get(\"/images/contents/\")\n self.assertEqual(response.status_code, 401)", "def test_home_as_anonymous(self):\n response = self.client.get(\"/images/contents/\")\n self.assertEqual(response.status_code, 401)", "def assert_us...
[ "0.68530566", "0.68530566", "0.67204446", "0.6701233", "0.63773066", "0.6366298", "0.6249894", "0.624031", "0.6135416", "0.6123689", "0.6103045", "0.6043306", "0.5995901", "0.59817123", "0.59473157", "0.58821845", "0.5838749", "0.58223754", "0.57953495", "0.5790194", "0.57737...
0.7287502
0
Authenticated user without access cannot retrieve a thumbnail.
def test_api_thumbnail_retrieve_by_random_user(self): user = UserFactory() self.assert_user_cannot_retrieve_thumbnail(user, self.some_thumbnail)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_user_cannot_retrieve_thumbnail(self, user, thumbnail):\n jwt_token = UserAccessTokenFactory(user=user)\n\n response = self.client.get(\n self._get_url(thumbnail.video, thumbnail),\n HTTP_AUTHORIZATION=f\"Bearer {jwt_token}\",\n )\n\n self.assertEqual(res...
[ "0.75183046", "0.70896447", "0.6801665", "0.6583585", "0.6538382", "0.6501151", "0.6361877", "0.6343528", "0.633494", "0.6316429", "0.63046277", "0.6302587", "0.61078155", "0.6107007", "0.6094753", "0.6094753", "0.6067809", "0.60633063", "0.60210025", "0.6020656", "0.60054046...
0.71911126
1
Organization students cannot retrieve a thumbnail.
def test_api_thumbnail_retrieve_by_organization_student(self): organization_access = OrganizationAccessFactory( organization=self.some_organization, role=STUDENT, ) self.assert_user_cannot_retrieve_thumbnail( organization_access.user, self.some_thumbnail ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_user_cannot_retrieve_thumbnail(self, user, thumbnail):\n jwt_token = UserAccessTokenFactory(user=user)\n\n response = self.client.get(\n self._get_url(thumbnail.video, thumbnail),\n HTTP_AUTHORIZATION=f\"Bearer {jwt_token}\",\n )\n\n self.assertEqual(res...
[ "0.6759956", "0.6608878", "0.6606777", "0.65997195", "0.63853014", "0.6371965", "0.62514627", "0.61948556", "0.61474854", "0.6042091", "0.60399956", "0.59651506", "0.58786523", "0.5877402", "0.5835692", "0.58111465", "0.5799567", "0.5793276", "0.5775071", "0.5764711", "0.5759...
0.73315066
0
Organization instructors cannot retrieve a thumbnail.
def test_api_thumbnail_retrieve_by_organization_instructor(self): organization_access = OrganizationAccessFactory( organization=self.some_organization, role=INSTRUCTOR, ) self.assert_user_cannot_retrieve_thumbnail( organization_access.user, self.some_thumbnai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_thumbnail_retrieve_by_organization_student(self):\n organization_access = OrganizationAccessFactory(\n organization=self.some_organization,\n role=STUDENT,\n )\n\n self.assert_user_cannot_retrieve_thumbnail(\n organization_access.user, self.some_th...
[ "0.6952235", "0.6369274", "0.6285176", "0.6232424", "0.6225232", "0.61745995", "0.6172444", "0.61498815", "0.6121853", "0.6116987", "0.594136", "0.58232135", "0.5762892", "0.57019526", "0.56708616", "0.5668787", "0.5641343", "0.5612725", "0.5612397", "0.5575803", "0.5553606",...
0.75101215
0
Organization administrators can retrieve a thumbnail.
def test_api_thumbnail_retrieve_by_organization_administrator(self): organization_access = OrganizationAccessFactory( organization=self.some_organization, role=ADMINISTRATOR, ) self.assert_user_can_retrieve_thumbnail( organization_access.user, self.some_thumb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thumbnail_url():", "def test_api_thumbnail_retrieve_by_playlist_admin(self):\n playlist_access = PlaylistAccessFactory(\n playlist=self.some_video.playlist,\n role=ADMINISTRATOR,\n )\n\n self.assert_user_can_retrieve_thumbnail(\n playlist_access.user,...
[ "0.69568473", "0.6949048", "0.69144523", "0.6782628", "0.67104197", "0.66854703", "0.65969235", "0.6590126", "0.6586846", "0.6573921", "0.65533423", "0.64994305", "0.6378205", "0.636926", "0.6366648", "0.6348245", "0.62879926", "0.6287473", "0.62491494", "0.62364477", "0.6232...
0.71771973
0
Consumer site roles cannot retrieve a thumbnail.
def test_api_thumbnail_retrieve_by_consumer_site_any_role(self): consumer_site_access = ConsumerSiteAccessFactory( consumer_site=self.some_video.playlist.consumer_site, ) self.assert_user_cannot_retrieve_thumbnail( consumer_site_access.user, self.some_thumbnail )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_user_cannot_retrieve_thumbnail(self, user, thumbnail):\n jwt_token = UserAccessTokenFactory(user=user)\n\n response = self.client.get(\n self._get_url(thumbnail.video, thumbnail),\n HTTP_AUTHORIZATION=f\"Bearer {jwt_token}\",\n )\n\n self.assertEqual(res...
[ "0.68565124", "0.6401451", "0.62354344", "0.6173921", "0.6166922", "0.6150965", "0.6077196", "0.60095006", "0.59961003", "0.5961394", "0.59391886", "0.5873697", "0.5857408", "0.56985843", "0.5674253", "0.56423765", "0.56163293", "0.55962807", "0.55887306", "0.5585544", "0.558...
0.75406796
0
Playlist student cannot retrieve a thumbnail.
def test_api_thumbnail_retrieve_by_playlist_student(self): playlist_access = PlaylistAccessFactory( playlist=self.some_video.playlist, role=STUDENT, ) self.assert_user_cannot_retrieve_thumbnail( playlist_access.user, self.some_thumbnail )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thumbnail(self):\r\n raise Exception('get_thumbnail is Not Implemented in base class \"Video\"')", "def test_api_thumbnail_read_detail_student(self):\n video = VideoFactory()\n thumbnail = ThumbnailFactory(video=video)\n\n jwt_token = StudentLtiTokenFactory(playlist=video.play...
[ "0.72964805", "0.7294963", "0.7204757", "0.66731846", "0.661595", "0.6610957", "0.65946805", "0.6585006", "0.6512752", "0.6450439", "0.63490075", "0.63181674", "0.6197807", "0.6148186", "0.61198866", "0.6115284", "0.609608", "0.6090407", "0.60756737", "0.60405296", "0.6007919...
0.76357526
0
Playlist instructor cannot retrieve a thumbnail.
def test_api_thumbnail_retrieve_by_playlist_instructor(self): playlist_access = PlaylistAccessFactory( playlist=self.some_video.playlist, role=INSTRUCTOR, ) self.assert_user_can_retrieve_thumbnail( playlist_access.user, self.some_thumbnail )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thumbnail(self):\r\n raise Exception('get_thumbnail is Not Implemented in base class \"Video\"')", "def test_api_thumbnail_retrieve_by_playlist_student(self):\n playlist_access = PlaylistAccessFactory(\n playlist=self.some_video.playlist,\n role=STUDENT,\n )\n\n...
[ "0.754921", "0.72657204", "0.7022425", "0.6922864", "0.6887758", "0.6872325", "0.68639344", "0.6854711", "0.6709114", "0.65598696", "0.647682", "0.6444286", "0.63603157", "0.63512784", "0.6273392", "0.6267445", "0.6266809", "0.62609625", "0.62433076", "0.62410164", "0.6197724...
0.7200989
2
Playlist administrator can retrieve a thumbnail.
def test_api_thumbnail_retrieve_by_playlist_admin(self): playlist_access = PlaylistAccessFactory( playlist=self.some_video.playlist, role=ADMINISTRATOR, ) self.assert_user_can_retrieve_thumbnail( playlist_access.user, self.some_thumbnail )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thumbnail(self):\r\n raise Exception('get_thumbnail is Not Implemented in base class \"Video\"')", "def test_api_thumbnail_retrieve_by_playlist_instructor(self):\n playlist_access = PlaylistAccessFactory(\n playlist=self.some_video.playlist,\n role=INSTRUCTOR,\n ...
[ "0.7072114", "0.7043516", "0.7031702", "0.70205593", "0.68750274", "0.6830887", "0.67835605", "0.67505544", "0.669611", "0.66419655", "0.66401845", "0.66229904", "0.6611108", "0.66012394", "0.6589992", "0.65843177", "0.6499029", "0.6455152", "0.6356071", "0.63520384", "0.6281...
0.7956929
0
Students users should not be allowed to read a thumbnail detail.
def test_api_thumbnail_read_detail_student(self): video = VideoFactory() thumbnail = ThumbnailFactory(video=video) jwt_token = StudentLtiTokenFactory(playlist=video.playlist) response = self.client.get( self._get_url(video, thumbnail), HTTP_AUTHORIZATION=f"Beare...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_thumbnail_administrator_read_detail_in_read_only(self):\n thumbnail = ThumbnailFactory()\n\n jwt_token = InstructorOrAdminLtiTokenFactory(\n playlist=thumbnail.video.playlist,\n permissions__can_update=False,\n )\n\n response = self.client.get(\n ...
[ "0.72766185", "0.70698196", "0.6967689", "0.6460065", "0.6312292", "0.6261655", "0.61761296", "0.61653566", "0.60412514", "0.5985592", "0.59407854", "0.59155726", "0.58906955", "0.5862425", "0.586175", "0.5833028", "0.5833028", "0.5773634", "0.57534486", "0.5732344", "0.56791...
0.6705593
3
Instructor should not be able to read thumbnails in a read_only mode.
def test_api_thumbnail_instructor_read_detail_in_read_only(self): thumbnail = ThumbnailFactory() jwt_token = InstructorOrAdminLtiTokenFactory( playlist=thumbnail.video.playlist, permissions__can_update=False, ) response = self.client.get( self._get_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_thumbnail_administrator_read_detail_in_read_only(self):\n thumbnail = ThumbnailFactory()\n\n jwt_token = InstructorOrAdminLtiTokenFactory(\n playlist=thumbnail.video.playlist,\n permissions__can_update=False,\n )\n\n response = self.client.get(\n ...
[ "0.7128775", "0.6064049", "0.5956134", "0.59525853", "0.5946476", "0.5924403", "0.5898635", "0.58588713", "0.5841984", "0.5751428", "0.5735692", "0.57163644", "0.5715092", "0.5666382", "0.56368256", "0.56359357", "0.5584379", "0.55173814", "0.55173814", "0.54943883", "0.54872...
0.6774711
1
Instructors should be able to read details of thumbnail associated to their video.
def test_api_thumbnail_read_detail_token_user(self): video = VideoFactory( uploaded_on=datetime(2018, 8, 8, tzinfo=timezone.utc), upload_state="ready" ) thumbnail = ThumbnailFactory(video=video, upload_state="pending") jwt_token = InstructorOrAdminLtiTokenFactory(playlist=vi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thumbnail(self):\r\n raise Exception('get_thumbnail is Not Implemented in base class \"Video\"')", "def test_api_thumbnail_read_detail_student(self):\n video = VideoFactory()\n thumbnail = ThumbnailFactory(video=video)\n\n jwt_token = StudentLtiTokenFactory(playlist=video.play...
[ "0.79106504", "0.71708935", "0.711236", "0.70729136", "0.70006025", "0.6909872", "0.6901868", "0.68766785", "0.6864849", "0.68309647", "0.6824591", "0.68066835", "0.6778094", "0.67371124", "0.6660454", "0.6659213", "0.66370344", "0.6631762", "0.66140234", "0.6612588", "0.6609...
0.7088053
3
Admin should not be able to read thumbnails in a read_only mode.
def test_api_thumbnail_administrator_read_detail_in_read_only(self): thumbnail = ThumbnailFactory() jwt_token = InstructorOrAdminLtiTokenFactory( playlist=thumbnail.video.playlist, permissions__can_update=False, ) response = self.client.get( self._ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_thumbnail_instructor_read_detail_in_read_only(self):\n thumbnail = ThumbnailFactory()\n\n jwt_token = InstructorOrAdminLtiTokenFactory(\n playlist=thumbnail.video.playlist,\n permissions__can_update=False,\n )\n\n response = self.client.get(\n ...
[ "0.661828", "0.6382733", "0.6356342", "0.6159073", "0.6037804", "0.6037804", "0.5990374", "0.59651357", "0.59140724", "0.5866006", "0.58399206", "0.5734935", "0.5719596", "0.5685072", "0.5679178", "0.56767166", "0.5566921", "0.5552464", "0.5542619", "0.55314493", "0.55218256"...
0.71898
0
Admin should be able to read details of thumbnail associated to their video.
def test_api_thumbnail_read_detail_admin_user(self): video = VideoFactory( uploaded_on=datetime(2018, 8, 8, tzinfo=timezone.utc), upload_state="ready" ) thumbnail = ThumbnailFactory(video=video, upload_state="pending") jwt_token = InstructorOrAdminLtiTokenFactory( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thumbnail(self):\r\n raise Exception('get_thumbnail is Not Implemented in base class \"Video\"')", "def get_thumbnail_url(self):\n if self.thumbnail_url:\n return self.thumbnail_url\n \n if not self.get_video_id() or not self.get_username():\n return ''\n \n ...
[ "0.7471359", "0.68928635", "0.68879104", "0.68605113", "0.683838", "0.679808", "0.6788042", "0.6787663", "0.67236894", "0.67226833", "0.66978943", "0.66908675", "0.66846454", "0.6566404", "0.6513157", "0.64605933", "0.64442825", "0.64260656", "0.6422254", "0.641737", "0.64100...
0.7063691
1
A ready thumbnail should have computed urls.
def test_api_thumbnail_read_ready_thumbnail(self): video = VideoFactory( pk="78338c1c-356e-4156-bd95-5bed71ffb655", uploaded_on=datetime(2018, 8, 8, tzinfo=timezone.utc), upload_state="ready", ) thumbnail = ThumbnailFactory( video=video, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thumbnail_url():", "def thumbnail_url(self):\n return None", "def prepare_thumbnail_url(self, object):\n if object.media is not None:\n return os.path.join(settings.MEDIA_URL, object.media.media_thumb_file.name)\n else:\n return ''", "def thumbnail_url_if_se...
[ "0.7071324", "0.6947205", "0.64887977", "0.64814335", "0.645994", "0.6422525", "0.6387085", "0.63043034", "0.6263864", "0.6248888", "0.6232873", "0.6228274", "0.6215955", "0.6176703", "0.61678946", "0.6028321", "0.6024606", "0.60037696", "0.60035664", "0.59153795", "0.5912750...
0.6284165
8
Trying to retrieve a thumbnail using an other video in the url should return a 404.
def test_api_thumbnail_retrieve_from_another_video(self): thumbnail = ThumbnailFactory() other_video = VideoFactory(playlist=thumbnail.video.playlist) jwt_token = InstructorOrAdminLtiTokenFactory(playlist=thumbnail.video.playlist) response = self.client.get( self._get_url(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_url(self, video, thumbnail):\n return f\"/api/videos/{video.pk}/thumbnails/{thumbnail.id}/\"", "def test_video_thumbnail(self):\n data = TestData().load_users().load_galleries()\n album = data.gallery_b7w.top_album\n\n video1 = Video.objects.create(album=album, uid='56433514'...
[ "0.7110042", "0.7059349", "0.70160884", "0.6730062", "0.666879", "0.6634168", "0.6619411", "0.6557481", "0.6487372", "0.6479977", "0.6477736", "0.6452395", "0.644955", "0.63289744", "0.6300859", "0.62483877", "0.6219747", "0.6173391", "0.6165181", "0.61574286", "0.6088163", ...
0.78344685
0
Check if the line has already an active route
def pre_save_route(sender, **kwargs): instance = kwargs.get('instance') if instance.is_active and RouteModel.objects.filter(line_id=instance.line_id, is_active=True)\ .exclude(id=instance.id or -1).exists(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visited(self, route=[], connection=None):\r\n\r\n visited_airports = [self.flights[flight].source for flight in route]\r\n\r\n if self.flights[connection].source in visited_airports:\r\n # find index of connection source in visited airports on route\r\n segment_start = visit...
[ "0.65387857", "0.6377769", "0.6372641", "0.6372641", "0.6365585", "0.62267476", "0.6223022", "0.6218845", "0.619473", "0.6103653", "0.6094104", "0.6076136", "0.6058769", "0.60385406", "0.599384", "0.5954393", "0.59505534", "0.58803916", "0.5868137", "0.5857777", "0.5817007", ...
0.6748292
0
This function plots an ellipse that represents a covariance matrix. The ellipse is centered at (x, y) and its shape, size and rotation are determined by the covariance matrix.
def plot_covariance_ellipse(x, y, cov, chi2=3.0, color="-r", ax=None): eig_val, eig_vec = np.linalg.eig(cov) if eig_val[0] >= eig_val[1]: big_ind = 0 small_ind = 1 else: big_ind = 1 small_ind = 0 a = math.sqrt(chi2 * eig_val[big_ind]) b = math.sqrt(chi2 * eig_val[sma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_ellipse(center, covariance, alpha, color):\n # eigenvalues and eigenvector of matrix covariance\n eigenvalues, eigenvector = np.linalg.eigh(covariance)\n order = eigenvalues.argsort()[::-1]\n eigenvector = eigenvector[:, order]\n\n # Calculate Angle of ellipse\n angle = np.degrees(np.arc...
[ "0.8121411", "0.786105", "0.7851154", "0.7836551", "0.7788456", "0.77731025", "0.7677366", "0.75016886", "0.74661875", "0.74517506", "0.7439261", "0.74343836", "0.74177426", "0.7180367", "0.6976172", "0.69502145", "0.68941927", "0.68941927", "0.68941927", "0.68461376", "0.665...
0.7838968
3
This function plots an ellipse based on the given parameters.
def plot_ellipse(x, y, a, b, angle, color="-r", ax=None, **kwargs): t = np.arange(0, 2 * math.pi + 0.1, 0.1) px = [a * math.cos(it) for it in t] py = [b * math.sin(it) for it in t] fx = rot_mat_2d(angle) @ (np.array([px, py])) px = np.array(fx[0, :] + x).flatten() py = np.array(fx[1, :] + y).fl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_ellipse(center, covariance, alpha, color):\n # eigenvalues and eigenvector of matrix covariance\n eigenvalues, eigenvector = np.linalg.eigh(covariance)\n order = eigenvalues.argsort()[::-1]\n eigenvector = eigenvector[:, order]\n\n # Calculate Angle of ellipse\n angle = np.degrees(np.arc...
[ "0.7876582", "0.75598735", "0.7379512", "0.7341711", "0.725592", "0.72097546", "0.7179025", "0.71503866", "0.7085659", "0.70802534", "0.7069205", "0.7030703", "0.70065445", "0.6996101", "0.6995528", "0.6958151", "0.69569767", "0.6942199", "0.6931811", "0.68900853", "0.6841160...
0.73253155
4
Plot an arrow or arrows based on 2D state (x, y, yaw) All optional settings of matplotlib.pyplot.arrow can be used.
def plot_arrow(x, y, yaw, arrow_length=1.0, origin_point_plot_style="xr", head_width=0.1, fc="r", ec="k", **kwargs): if not isinstance(x, float): for (i_x, i_y, i_yaw) in zip(x, y, yaw): plot_arrow(i_x, i_y, i_yaw, head_width=head_width, fc=fc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _plot(self, **kwargs):\n XY = self.positions\n plt.plot(XY[0,:], XY[1,:], 'o')\n plt.gca().set_aspect('equal')\n SS = np.abs(self.S)\n SS /= SS.max()\n\n for i in range(self.N):\n for j in range(self.N):\n if i == j or SS[i,j] < 1e-2:\n ...
[ "0.6329709", "0.6254767", "0.6178017", "0.5998989", "0.5936659", "0.59270495", "0.5884406", "0.58207273", "0.5796814", "0.57445866", "0.5731595", "0.5682117", "0.56536233", "0.5604874", "0.5574216", "0.5567082", "0.54870504", "0.5486324", "0.54488695", "0.54224336", "0.542128...
0.73107964
0
Plot curvature on 2D path. This plot is a line from the original path, the lateral distance from the original path shows curvature magnitude. Left turning shows right side plot, right turning shows left side plot. For straight path, the curvature plot will be on the path, because curvature is 0 on the straight path.
def plot_curvature(x_list, y_list, heading_list, curvature, k=0.01, c="-c", label="Curvature"): cx = [x + d * k * np.cos(yaw - np.pi / 2.0) for x, y, yaw, d in zip(x_list, y_list, heading_list, curvature)] cy = [y + d * k * np.sin(yaw - np.pi / 2.0) for x, y, yaw, d in zip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curvature(x, y):\n dalpha = np.pi/1000\n xd1 = np.gradient(x, 2)\n xd2 = np.gradient(xd1, 2)\n yd1 = np.gradient(y, 2)\n yd2 = np.gradient(yd1, 2)\n\n return np.abs(xd1*yd2 - yd1*xd2) / np.power(xd1**2 + yd1**2, 3.0/2.0)", "def curvature(self):\n if self.x[0] == self.x[-1] and self.y...
[ "0.6502923", "0.6433723", "0.6230932", "0.60672617", "0.5971525", "0.59171945", "0.58404565", "0.5807356", "0.56144226", "0.5591963", "0.5420314", "0.5400934", "0.53681475", "0.53225476", "0.5318358", "0.5312725", "0.52968705", "0.5250027", "0.5185593", "0.51690495", "0.51435...
0.6097678
3
Helper function to set equal axis
def set_equal_3d_axis(ax, x_lims, y_lims, z_lims): x_lims = np.asarray(x_lims) y_lims = np.asarray(y_lims) z_lims = np.asarray(z_lims) # compute max required range max_range = np.array([x_lims.max() - x_lims.min(), y_lims.max() - y_lims.min(), z_li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_equal(ax):\n scaling = array([getattr(ax, 'get_{}lim'.format(dim))() for dim in 'xyz'])\n ax.auto_scale_xyz(*[[min(scaling), max(scaling)]]*3)", "def equal_axis(frame):\n limits = frame.axis()\n zmin = np.min([limits[0], limits[2]])\n zmax = np.max([limits[1], limits[3]])\n frame.set_xl...
[ "0.67071664", "0.6518004", "0.63109624", "0.6267606", "0.6167906", "0.60394734", "0.5803293", "0.57901895", "0.57079023", "0.57079023", "0.5660312", "0.5647207", "0.56240493", "0.56233215", "0.56170815", "0.5615651", "0.56054443", "0.55858827", "0.55755645", "0.55601573", "0....
0.55455345
21
Detects harris corners. Make sure the returned coordinates are x major!!!
def harris_corner_detector(im): Ix = derivative(im, axis=0) Iy = derivative(im, axis=1) Ixy = sol4_utils.blur_spatial(Ix * Iy, BLUR_KERNEL_SIZE) Ixx = sol4_utils.blur_spatial(Ix * Ix, BLUR_KERNEL_SIZE) Iyy = sol4_utils.blur_spatial(Iy * Iy, BLUR_KERNEL_SIZE) det = Ixx * Iyy - Ixy*Ixy trace...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def harris_corner_detector(im):\n\n conv_vec = np.array([[1, 0, -1]])\n\n x_der = convolve(im, conv_vec)\n y_der = convolve(im, conv_vec.transpose())\n\n x_der_2 = sol4_utils.blur_spatial(x_der * x_der, 3)\n\n y_der_2 = sol4_utils.blur_spatial(y_der*y_der, 3)\n x_y_der = sol4_utils.blur_spatial(x...
[ "0.7338353", "0.7133686", "0.7005946", "0.6849036", "0.6735868", "0.66729707", "0.66553104", "0.6582876", "0.6573205", "0.6538724", "0.6484621", "0.6438694", "0.63991416", "0.636579", "0.63362527", "0.6308946", "0.62801975", "0.62695485", "0.62327456", "0.6218055", "0.6199252...
0.7379283
0
Samples descriptors at the given corners.
def sample_descriptor(im, pos, desc_rad): k = 2 * desc_rad + 1 pos = 2**DESCRIPOTR_LEVEL_DIFF * pos window = (np.ones((pos.shape[0],1)) * np.arange(k) ) - desc_rad x = window +np.expand_dims(pos[:,0], 1) y = window +np.expand_dims(pos[:,1], 1) xx = np.tile(x, (1,1,k)).flatten() yy = np.rep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_features(pyr):\n descriptor_radius = DESC_RAD\n patch_amount = PATCH_AM\n min_distance_from_edge = DIST_FROM_EDGE\n corners = spread_out_corners(pyr[ORG_IMG], patch_amount, patch_amount, min_distance_from_edge)\n level_3_pos = np.array(pyr_point_translator(corners[:, X], corners[:, Y], ORG_...
[ "0.6397295", "0.6256895", "0.59952456", "0.58769244", "0.5599015", "0.5399331", "0.5395432", "0.53945875", "0.53690636", "0.53454524", "0.52510166", "0.52326304", "0.52222836", "0.52011186", "0.5174105", "0.51144576", "0.50981003", "0.508238", "0.5077964", "0.5068688", "0.505...
0.55129343
5
Detects and extracts feature points from a pyramid.
def find_features(pyr): feature_pnts = spread_out_corners(pyr[0], SPREAD_N, SPREAD_M ,SPREAD_CORNERS_RADIUS) descriptors = sample_descriptor(pyr[2], feature_pnts, SAMPLE_RAD) return feature_pnts, descriptors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_features(pyr):\n\n feature_lst = spread_out_corners(pyr[0], 3, 3, 3)\n descriptors = sample_descriptor(pyr[2],feature_lst/4,3)\n return [feature_lst,descriptors]", "def find_features(pyr):\n descriptor_radius = DESC_RAD\n patch_amount = PATCH_AM\n min_distance_from_edge = DIST_FROM_EDG...
[ "0.7035094", "0.669588", "0.6503971", "0.63814044", "0.6307368", "0.61140066", "0.6062323", "0.6053611", "0.60419255", "0.59824055", "0.59824055", "0.59658", "0.59382474", "0.59103197", "0.5740096", "0.5705487", "0.57028913", "0.569599", "0.56659395", "0.5660129", "0.5603166"...
0.7127179
0
Return indices of matching descriptors.
def match_features(desc1, desc2, min_score): ## Reshape D1,2 to (N1, k^2), (k^2, N2) D1 = desc1.reshape((desc1.shape[0], -1)) D2 = desc2.reshape((desc2.shape[0], -1)).T ## Calc M = D1 * D2, shape (N1, N2) ## Mi,j = match score of pt i from I1 and pt 2 from I2. M = D1.dot(D2) ## Get cand...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_predicate_indices(tags: List[str]) -> List[int]:\n return [ind for ind, tag in enumerate(tags) if \"V\" in tag]", "def indices(self):\n i, j, _edge = self.indicesAndEdge()\n return i, j", "def find_indices_of_matched_samples(self, X, a):\n\n matching_weights = self.matching.matc...
[ "0.6563392", "0.6433877", "0.636279", "0.6334142", "0.63318443", "0.63143104", "0.6308538", "0.6285328", "0.62668735", "0.6181223", "0.615383", "0.61386955", "0.6127922", "0.6117723", "0.61068016", "0.60706395", "0.6065159", "0.6048736", "0.59917486", "0.59818524", "0.5966697...
0.0
-1
Apply homography to inhomogenous points.
def apply_homography(pos1, H12): ## Expand dims of pos1 to [x,y,1] pos1 = np.concatenate( (pos1 , np.ones((pos1.shape[0], 1))), axis=-1) ## dot with H12 pos2_extended = H12.dot(pos1.T).T ## Reduce dims pos2 = pos2_extended[:,[0,1]] / pos2_extended[:,[2,2]] return pos2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def computeHomography(src_pnt: np.ndarray, dst_pnt: np.ndarray) -> (np.ndarray, float):\r\n\r\n A = []\r\n for i in range(0, len(src_pnt)):\r\n x, y = src_pnt[i][0], src_pnt[i][1]\r\n u, v = dst_pnt[i][0], dst_pnt[i][1]\r\n A.append([x, y, 1, 0, 0, 0, -u * x, -u * y, -u])# like we saw in...
[ "0.7001385", "0.6763035", "0.671395", "0.66501546", "0.66149807", "0.64726466", "0.6456443", "0.64406973", "0.6315962", "0.6219856", "0.602618", "0.594029", "0.59350526", "0.5921374", "0.59114695", "0.5814162", "0.57273835", "0.5723179", "0.57077605", "0.57067144", "0.5596657...
0.6579365
5
Computes homography between two sets of points using RANSAC.
def ransac_homography(points1, points2, num_iter, inlier_tol, translation_only=False): inliners = np.array([]) pairs_num = 1 + (not translation_only) for i in range(num_iter): ## try random match pairs = np.random.randint(0, points1.shape[0],pairs_num) pos1, pos2 = points1[pairs], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_homography(pts1, pts2, feats1, feats2):\n\n #\n # Your code here\n #\n\n idxs1, idxs2 = find_matches(feats1, feats2)\n ransac_return = ransac(pts1[idxs1], pts2[idxs2])\n\n return ransac_return, idxs1, idxs2", "def ransac_homography(keypoints1, keypoints2, matches, sampling_ratio=0.5, ...
[ "0.75701237", "0.7454456", "0.71248895", "0.6936703", "0.67340356", "0.66742325", "0.66653675", "0.66420114", "0.6500048", "0.60429156", "0.6041068", "0.6006896", "0.5996779", "0.59723634", "0.5836983", "0.5752668", "0.5745174", "0.5689338", "0.5664019", "0.5643932", "0.56021...
0.6625923
8
Convert a list of succesive homographies to a list of homographies to a common reference frame.
def accumulate_homographies(H_succesive, m): h2m = [np.eye(3)] if len(H_succesive) == 0: return h2m [h2m.append( h2m[-1].dot(H_succesive[i]) ) for i in range(m-1,-1,-1)] h2m.reverse() [h2m.append( np.linalg.inv(H_succesive[i]).dot(h2m[-1]) ) for i in ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hyperedge_concat(*H_list):\n H = None\n for h in H_list:\n if h is not None:\n # for the first H appended to fused hypergraph incidence matrix\n if H is None:\n H = h\n else:\n H = np.hstack((H, h))\n return H", "def hexlist_to_ge...
[ "0.56202364", "0.52784044", "0.5173602", "0.50553465", "0.50095004", "0.50068694", "0.5002364", "0.49897015", "0.4984743", "0.49719393", "0.48041353", "0.4802245", "0.47971445", "0.47926477", "0.47808725", "0.47345135", "0.47344205", "0.47225136", "0.47150758", "0.47113198", ...
0.467676
22
computes bounding box of warped image under homography, without actually warping the image
def compute_bounding_box(homography, w, h): corners = np.array([[0,0], [0,h], [w,0], [w,h]]) t_corners = apply_homography(corners, homography) return np.array([t_corners.min(axis=0),t_corners.max(axis=0)], dtype= np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_bounding_box(homography, w, h):\n top_left_x, top_left_y = apply_homography(np.array([[0, 0]]), homography).transpose()\n top_right_x, top_right_y = apply_homography(np.array([[w, 0]]), homography).transpose()\n bottem_left_x, bottem_left_y = apply_homography(np.array([[0, h]]), homography).tr...
[ "0.68395644", "0.68263465", "0.6565394", "0.65440303", "0.65215236", "0.63024795", "0.6185591", "0.6115287", "0.60751134", "0.6052541", "0.59913546", "0.5959734", "0.59432757", "0.59432757", "0.5937751", "0.59291124", "0.5924142", "0.59106493", "0.5907376", "0.59039426", "0.5...
0.6808969
2
Warps a 2D image with a given homography.
def warp_channel(image, homography): ## calc canvas top, bottom = compute_bounding_box(homography, image.shape[1], image.shape[0]) canvas_shape = tuple(np.diff([top,bottom], axis=0).flatten()[::-1]) ## create index map x,y = np.meshgrid(np.arange(top[0], bot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warp_channel(image, homography):\n\n\n boundings = compute_bounding_box(homography,image.shape[1],image.shape[0])\n x_vals = np.arange(boundings[0][0], boundings[1][0])\n y_vals = np.arange(boundings[0][1], boundings[1][1])\n x_vals,y_vals = np.meshgrid(x_vals,y_vals)\n\n x_vals_f, y_vals_f = x_...
[ "0.7345839", "0.6907998", "0.682956", "0.6758212", "0.6758212", "0.66904014", "0.6446177", "0.6243719", "0.6226596", "0.62007666", "0.61647147", "0.61616576", "0.6121813", "0.6111707", "0.59788084", "0.59439003", "0.59374386", "0.5885356", "0.58439845", "0.58154804", "0.57919...
0.70242566
1
Warps an RGB image with a given homography.
def warp_image(image, homography): return np.dstack([warp_channel(image[..., channel], homography) for channel in range(3)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warp_channel(image, homography):\n\n\n boundings = compute_bounding_box(homography,image.shape[1],image.shape[0])\n x_vals = np.arange(boundings[0][0], boundings[1][0])\n y_vals = np.arange(boundings[0][1], boundings[1][1])\n x_vals,y_vals = np.meshgrid(x_vals,y_vals)\n\n x_vals_f, y_vals_f = x_...
[ "0.6858929", "0.64860207", "0.64229715", "0.6370132", "0.6330629", "0.6271079", "0.6197037", "0.5913447", "0.5638907", "0.5629886", "0.5541217", "0.55241203", "0.54386544", "0.5392584", "0.53646666", "0.5351558", "0.5351546", "0.5324591", "0.53157", "0.5295544", "0.5268346", ...
0.6242118
7
Filters rigid transformations encoded as homographies by the amount of translation from left to right.
def filter_homographies_with_translation(homographies, minimum_right_translation): translation_over_thresh = [0] last = homographies[0][0, -1] for i in range(1, len(homographies)): if abs(homographies[i][0, -1] - last) > minimum_right_translation: translation_over_thresh.append(i) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_homographies_with_translation(homographies, minimum_right_translation):\n translation_over_thresh = [0]\n last = homographies[0][0,-1]\n for i in range(1, len(homographies)):\n if homographies[i][0,-1] - last > minimum_right_translation:\n translation_over_thresh.append(i)\n last = homog...
[ "0.6446996", "0.6349221", "0.5705963", "0.55155295", "0.5404492", "0.5364814", "0.5335949", "0.5306663", "0.5300621", "0.5253372", "0.5253372", "0.5253372", "0.5253372", "0.5253372", "0.5208703", "0.520631", "0.51603156", "0.51567453", "0.5116342", "0.5115032", "0.5105264", ...
0.6257986
2
Computes rigid transforming points1 towards points2, using least squares method.
def estimate_rigid_transform(points1, points2, translation_only=False): centroid1 = points1.mean(axis=0) centroid2 = points2.mean(axis=0) if translation_only: rotation = np.eye(2) translation = centroid2 - centroid1 else: centered_points1 = points1 - centroid1 centered_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transformation_from_points(points1, points2):\n points1 = points1.astype(np.float64)\n points2 = points2.astype(np.float64)\n\n c1 = np.mean(points1, axis=0)\n c2 = np.mean(points2, axis=0)\n points1 -= c1\n points2 -= c2\n\n s1 = np.std(points1)\n s2 = np.std(points2)\n points1 /= s...
[ "0.7304165", "0.70865107", "0.673969", "0.6356167", "0.6285698", "0.6282726", "0.62205327", "0.6169337", "0.6140601", "0.61327386", "0.61087453", "0.60888803", "0.6048376", "0.60207796", "0.5988855", "0.5973158", "0.59728986", "0.5908945", "0.5903124", "0.58705467", "0.583474...
0.6581751
4
Finds local maximas of an image.
def non_maximum_suppression(image): # Find local maximas. neighborhood = generate_binary_structure(2, 2) local_max = maximum_filter(image, footprint=neighborhood) == image local_max[image < (image.max() * 0.1)] = False # Erode areas to single points. lbs, num = label(local_max) centers = ce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_max(img, size=(70,100,100)):\n # Apply a maximum filter.\n max_f = ndi.maximum_filter(img, size=size)\n # Find pixels that are local maxima.\n local_max = np.where(max_f == img, 1, 0)\n return(local_max)", "def findMax(img):\n\td = minMaxLoc(img)\n\treturn {\"maxVal\":d[\"maxVal\"], \"ma...
[ "0.81915313", "0.7625611", "0.68985856", "0.6832104", "0.67985094", "0.6775226", "0.6725332", "0.66870373", "0.66672045", "0.65558475", "0.6497807", "0.64525133", "0.64096", "0.63515335", "0.634579", "0.6333941", "0.6321105", "0.6305051", "0.6277516", "0.62486374", "0.6246329...
0.6336719
16
Splits the image im to m by n rectangles and uses harris_corner_detector on each.
def spread_out_corners(im, m, n, radius): corners = [np.empty((0, 2), dtype=np.int)] x_bound = np.linspace(0, im.shape[1], n + 1, dtype=np.int) y_bound = np.linspace(0, im.shape[0], m + 1, dtype=np.int) for i in range(n): for j in range(m): # Use Harris detector on every sub image. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spread_out_corners(im, m, n, radius):\n corners = [np.empty((0,2), dtype=np.int)]\n x_bound = np.linspace(0, im.shape[1], n+1, dtype=np.int)\n y_bound = np.linspace(0, im.shape[0], m+1, dtype=np.int)\n for i in range(n):\n for j in range(m):\n # Use Harris detector on every sub image.\n sub_im...
[ "0.7192716", "0.63815415", "0.6211173", "0.60078424", "0.5932329", "0.5887943", "0.5871418", "0.58623314", "0.578299", "0.57816726", "0.57581216", "0.5722521", "0.56884426", "0.56871694", "0.56726635", "0.56665385", "0.56598103", "0.5608869", "0.5607788", "0.5546984", "0.5483...
0.7179764
2
The naming convention for a sequence of images is file_prefixN.jpg, where N is a running number 001, 002, 003...
def __init__(self, data_dir, file_prefix, num_images): self.file_prefix = file_prefix self.files = [os.path.join(data_dir, '%s%03d.jpg' % (file_prefix, i + 1)) for i in range(num_images)] self.files = list(filter(os.path.exists, self.files)) self.panoramas = None self.homographie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_prefix() :\n \n import glob\n filenames = glob.glob(picture_folder+'*.jpg')\n max_prefix = 0\n for filename in filenames :\n parts = filenames.split('_')\n if len(parts) > 1 :\n possible_prefix = parse_int(parts[0])\n if possible_prefix > max_prefix :\n max_prefix = possible_pre...
[ "0.769489", "0.73024964", "0.6996918", "0.695735", "0.6912876", "0.68801117", "0.6853592", "0.67820257", "0.6771336", "0.67199373", "0.6704712", "0.66808397", "0.6628377", "0.658693", "0.6585913", "0.65571696", "0.65143126", "0.6469766", "0.64489675", "0.64109373", "0.6376563...
0.58315897
73
compute homographies between all images to a common coordinate system
def align_images(self, translation_only=False): # Extract feature point locations and descriptors. points_and_descriptors = [] for file in self.files: image = sol4_utils.read_image(file, 1) self.images.append(image) self.h, self.w = image.shape pyr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_homography(self):\n src = np.array(self._metadata[:4])\n\n h_units = self._config.h_units\n v_units = self._config.v_units\n dst = np.array(\n [(0, v_units), (h_units, v_units), (0, 0), (h_units, 0)])\n\n h_m, _ = cv2.findHomography(src, dst)\n se...
[ "0.70967317", "0.67565054", "0.6647977", "0.6640233", "0.6524193", "0.6376031", "0.6365266", "0.6343077", "0.6188618", "0.6002113", "0.5964076", "0.59238464", "0.58914006", "0.58824134", "0.5871231", "0.5748752", "0.57079154", "0.5679168", "0.5676379", "0.5661097", "0.5622856...
0.5631594
20
combine slices from input images to panoramas.
def generate_panoramic_images(self, number_of_panoramas): assert self.homographies is not None # compute bounding boxes of all warped input images in the coordinate system of the middle image (as given by the homographies) self.bounding_boxes = np.zeros((self.frames_for_panoramas.size, 2, 2)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_panoramic_images(self, number_of_panoramas):\n assert self.homographies is not None\n\n # compute bounding boxes of all warped input images in the coordinate system of the middle image (as given by the homographies)\n self.bounding_boxes = np.zeros((self.frames_for_panoramas.size, 2, 2))\n ...
[ "0.6989787", "0.69521314", "0.63546145", "0.61053276", "0.59612685", "0.5914441", "0.5825741", "0.582431", "0.5722109", "0.56852674", "0.56654567", "0.5582949", "0.5580172", "0.55788565", "0.55557424", "0.5504493", "0.54561037", "0.54267657", "0.54023594", "0.53983194", "0.53...
0.69521314
2
Calculates cost and its gradient using Mean Squared Error. (1/2m)sum(Y Y_hat)^.2
def mean_squared_error(Y, Y_hat): m = Y.shape[0] # calc cost cost = (1 / (2 * m)) * np.sum(np.square(Y - Y_hat)) cost = np.squeeze(cost) # calc gradient dY_hat = - (1 / m) * (Y - Y_hat) return cost, dY_hat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_cost(Y, Y_hat):\n m = Y.shape[1]\n\n cost = (1 / (2 * m)) * np.sum(np.square(Y - Y_hat))\n cost = np.squeeze(cost) # remove extraneous dimensions to give just a scalar\n\n dY_hat = -1 / m * (Y - Y_hat) # derivative of the squared error cost function\n\n return cost, dY_hat", "def com...
[ "0.80790156", "0.80790156", "0.7456379", "0.73937976", "0.7304459", "0.7289378", "0.72770244", "0.7272426", "0.7232527", "0.7229088", "0.7182291", "0.7179993", "0.71723986", "0.71631444", "0.71498054", "0.71384823", "0.7122224", "0.7103611", "0.7058416", "0.70522356", "0.7051...
0.79877114
2
Calculates cost and its gradient using Binary Cross Entropy. (1/m) np.sum(np.log(Y_hat) Y np.log(1Y_hat) (1Y))
def binary_cross_entropy(Y, Y_hat, epsilon=1e-8): m = Y.shape[0] # make data safe Y_hat = np.clip(Y_hat, a_min=epsilon, a_max=(1 - epsilon)) # calc cost cost = (1 / m) * np.nansum(-np.log(Y_hat) * Y - np.log(1 - Y_hat) * (1 - Y)) cost = np.squeeze(cost) # calc gradient ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_cost(Y_hat, Y):\r\n\r\n m = Y.shape[1]\r\n\r\n\r\n cost = (1. / m) * np.sum(np.multiply(-np.log(Y_hat + 0.000000001),Y) + np.multiply(-np.log(1 - Y_hat + 0.000000001), 1 - Y))\r\n\r\n cost = np.squeeze(cost) # To make sure your cost's shape is what we expect (e.g. this turns [[17]] into 17).\...
[ "0.79731613", "0.79660696", "0.77614254", "0.7753233", "0.7751599", "0.7738234", "0.7619114", "0.7614405", "0.756269", "0.74779886", "0.7462293", "0.74533564", "0.74393666", "0.74089724", "0.73822963", "0.7329635", "0.7329065", "0.7310318", "0.725654", "0.72156954", "0.719657...
0.71322453
26
Calculates cost and its gradient using Cross Entropy. (1 / m) np.sum(Y np.log(Y_hat))
def cross_entropy(Y, Y_hat, epsilon=1e-8): m = Y.shape[0] # make data safe Y_hat = np.clip(Y_hat, a_min=epsilon, a_max=(1 - epsilon)) # calc cost cost = (-1 / m) * np.nansum(Y * np.log(Y_hat)) cost = np.squeeze(cost) # calc gradient dY_hat = -Y / Y_hat return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_cost(Y_hat, Y):\r\n\r\n m = Y.shape[1]\r\n\r\n\r\n cost = (1. / m) * np.sum(np.multiply(-np.log(Y_hat + 0.000000001),Y) + np.multiply(-np.log(1 - Y_hat + 0.000000001), 1 - Y))\r\n\r\n cost = np.squeeze(cost) # To make sure your cost's shape is what we expect (e.g. this turns [[17]] into 17).\...
[ "0.8094435", "0.79508626", "0.7784622", "0.7753385", "0.77234364", "0.7718602", "0.76510054", "0.75447094", "0.74698293", "0.74428225", "0.7442382", "0.7431407", "0.742752", "0.742752", "0.73978907", "0.7375569", "0.7369099", "0.7367389", "0.73666364", "0.73191875", "0.728816...
0.74783975
8
Convert a number to unicode, with appropriate substitutions.
def unicode_number(x): output = u"%g" % x if output[0] == u"-": output = u"\u2012" + output[1:] index = output.find(u"e") if index != -1: uniout = unicode(output[:index]) + u"\u00d710" saw_nonzero = False for n in output[index+1:]: if n == u"+": pass # uniout += u"\u207a" elif n =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_u(val, encoding='utf-8'):\r\n if isinstance(val, text_type):\r\n return val\r\n elif isinstance(val, numeric_types):\r\n return text_type(val)\r\n\r\n return val.decode(encoding)", "def translate_number(number):\n return NUMBER_TRANSLATOR[number]", "def _to_cn(number):\n\n c...
[ "0.64799064", "0.6462614", "0.6408784", "0.61651", "0.6087401", "0.59796566", "0.5951445", "0.58721507", "0.58155435", "0.5808134", "0.57698685", "0.5736867", "0.57064986", "0.5688757", "0.5659142", "0.56527704", "0.56455475", "0.56412405", "0.5638056", "0.56291896", "0.56287...
0.7085641
0
Return a function that can be used to draw regular grid lines or tick marks.
def regular(step, start=0.): def output(low, high): newstart = math.ceil((low - start)/step) * step + start return numpy.arange(newstart, high, step, dtype=numpy.float) output.func_name = "regular(%g, start=%g)" % (step, start) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawGrid(self,gridLines=True):\n if not self.changed: self.edit()\n cGrid = Fmap.GRID\n cBorder = Fmap.BORDER\n if gridLines: #--Some fools don't want the grid!\n #--Grid\n for uv in range(-25,26,5):\n xy = 512/2 - 9*uv + 4\n self....
[ "0.61834234", "0.6008772", "0.59259754", "0.5909034", "0.5832352", "0.57928234", "0.5755209", "0.5727162", "0.5662317", "0.56454045", "0.56073934", "0.5587352", "0.5586233", "0.5584013", "0.555687", "0.5555793", "0.5554617", "0.5530118", "0.55236983", "0.5503275", "0.55012906...
0.0
-1
Return a function that can be used to set standard tick marks.
def tickmarks(major=-10, minor=True, logbase=0, format=unicode_number): if not callable(format): tmp = format format = lambda x: tmp % x format.func_name = tmp def linear_tickmarks(low, high): if low >= high: raise ValueError, "To compute tick-marks, 'low' must be l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_style(func):\n def wrapper(*args, **kwargs):\n fig = plt.figure(figsize=(18,18))\n sns.set_context(\"talk\", font_scale=0.9)\n plt.xlim(-3, 3)\n plt.tick_params(grid_alpha=0.2)\n func(*args, **kwargs)\n plt.clf()\n return wrapper", "def create_tick_mark(\n fmin: f...
[ "0.6055695", "0.5834575", "0.5709799", "0.5684322", "0.56447107", "0.5592472", "0.5586648", "0.55707574", "0.55437565", "0.55194885", "0.54999316", "0.5466122", "0.5416735", "0.539491", "0.53574145", "0.5304559", "0.5293611", "0.5277207", "0.52736354", "0.5267641", "0.524143"...
0.60170686
1
Return the range (min, max) of a dataset, excluding any NANs.
def calcrange(data, log=False): xmin, xmax = None, None for x in data: if not log or x > 0.: if xmin is None or x < xmin: xmin = x if xmax is None or x > xmax: xmax = x if xmin is None and xmax is None: if log: return 0.1, 1. else: ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_range(x):\n return max(x)-min(x)", "def _full_value_range(self):\n min_value, max_value = self._raw_data.data_range\n return max_value - min_value", "def _computeRangeFromData(data):\n if data is None:\n return None\n\n dataRange = min_max(data, min_positive=True, fin...
[ "0.7928218", "0.759846", "0.7561937", "0.7432182", "0.72924185", "0.716103", "0.7079898", "0.7077026", "0.7050836", "0.68989515", "0.6853273", "0.677322", "0.67359143", "0.669912", "0.66874564", "0.66771185", "0.6630462", "0.65873176", "0.65851694", "0.65726477", "0.6569491",...
0.0
-1
Return the range (min, max) of a dataset, based on quartiles (stable against large numbers).
def calcrange_quartile(data, log=False): if not isinstance(data, numpy.ndarray): data = numpy.array(data) if log: data = data[data > 0.] if len(data) == 0: if log: return 0.1, 1. else: return 0., 1. data = numpy.sort(data) q1 = data[int(math.floor(0.25*len(data)))] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Quartiles(data):\n q = np.percentile(data, [25, 50, 75])\n\n return q[0], q[1], q[2]", "def interquartile_range(x):\n return (quantile(x,0.75) - quantile(x,0.25))", "def interquartile_range(xs: List[float]) -> float:\n return quantile(xs, 0.75) - quantile(xs, 0.25)", "def data_range(x):\n ...
[ "0.7523062", "0.71719885", "0.7050786", "0.69144285", "0.6811111", "0.67421144", "0.6629707", "0.66259694", "0.65270203", "0.6509629", "0.65053487", "0.64967763", "0.64555305", "0.6433195", "0.6423888", "0.63779706", "0.6359893", "0.63541", "0.6300196", "0.62596935", "0.62174...
0.67295194
6