query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
If instruments connected and the voltmeter is set to manual ranging, update the value of the voltmeter range. WORKING
def update_volt_range(self): self.volt_range_index = self.VoltmeterRangeValue.currentIndex() self.cmd = self.volt_range_switch.get(self.volt_range_index, None) if self.connected: self.I_source.write(self.cmd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_volt_rate(self):\r\n self.cmd = None\r\n if self.connected:\r\n self.cmd = (\"SYST:COMM:SER:SEND ':SENS:VOLT:NPLC \"\r\n + (str(self.DeltaRate.value()) if self.current_tab\r\n else str(self.dIdVRate.value())) + \"'\")\r\n ...
[ "0.6594569", "0.6531825", "0.6392429", "0.6377812", "0.6198045", "0.6152024", "0.6146791", "0.61040014", "0.6015494", "0.59889895", "0.5960682", "0.5886433", "0.58780557", "0.58434933", "0.5833829", "0.5824948", "0.58067364", "0.57977766", "0.5794106", "0.5776705", "0.576475"...
0.7757934
0
If instruments connected, update voltmeter rate. Only functional for dIdV and delta measurements. WORKING
def update_volt_rate(self): self.cmd = None if self.connected: self.cmd = ("SYST:COMM:SER:SEND ':SENS:VOLT:NPLC " + (str(self.DeltaRate.value()) if self.current_tab else str(self.dIdVRate.value())) + "'") self.voltmeter_rat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _measurement_update(self):\n pass", "def update_volt_range(self):\r\n self.volt_range_index = self.VoltmeterRangeValue.currentIndex()\r\n self.cmd = self.volt_range_switch.get(self.volt_range_index, None)\r\n if self.connected:\r\n self.I_source.write(self.cmd)", "def ...
[ "0.63179785", "0.622544", "0.60588276", "0.5962366", "0.589405", "0.5797333", "0.5788367", "0.57867223", "0.57157326", "0.57095784", "0.57080036", "0.5685928", "0.56754315", "0.5664005", "0.56250376", "0.5614799", "0.55972266", "0.55874556", "0.55782706", "0.55688703", "0.556...
0.7804134
0
If the instruments are connected and the user alters the compliance voltage, send a command to update the instruments. WORKING
def update_compliance(self): self.compliance_voltage = str(self.ComplianceVoltage.value()) #self.cmd = None if self.connected: self.cmd = "CURR:COMP " + self.compliance_voltage self.I_source.write(self.cmd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_volt_range(self):\r\n self.volt_range_index = self.VoltmeterRangeValue.currentIndex()\r\n self.cmd = self.volt_range_switch.get(self.volt_range_index, None)\r\n if self.connected:\r\n self.I_source.write(self.cmd)", "def update_volt_rate(self):\r\n self.cmd = None...
[ "0.6727535", "0.66885936", "0.6580229", "0.62153286", "0.6068523", "0.6049526", "0.6044076", "0.60218334", "0.60006726", "0.5878938", "0.5873626", "0.5801125", "0.5755011", "0.5741827", "0.5732976", "0.57316613", "0.57288504", "0.56651706", "0.56286997", "0.56208044", "0.5619...
0.74610525
0
If instruments connected and the user alters the specified units in the dropdown menu, send a command to update the unit type. WORKING
def update_units(self): self.units_index = self.UnitsComboBox.currentIndex() self.cmd = None if self.connected: self.cmd = self.unit_switch.get(self.units_index, None) self.I_source.write(self.cmd) self.update_header_string()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unitUpdate(self):\n newText = self.unitGroup.unitString()\n cursorPos = len(newText) - self.text().length() + self.cursorPosition()\n if cursorPos < 0: # cursor set to same distance from right end\n cursorPos = 0\n self.blockSignals(True)\n self.setText(newTex...
[ "0.6152118", "0.61117256", "0.6045749", "0.5959084", "0.58111477", "0.57802886", "0.5717387", "0.570346", "0.56736743", "0.56634337", "0.56476676", "0.56463736", "0.5617639", "0.56117994", "0.5536073", "0.5527987", "0.55072844", "0.54589546", "0.54367155", "0.53979075", "0.53...
0.7398374
0
Check GPIB address of current source and initialize if valid. If the usergiven GPIB address for the 6221 is in the list of resources, then assign it to self.I_source and send the following
def update_GPIB(self): self.check_errors(False, False) #self.I_source_list = [ # x for x in self.resources # if (str(self.GPIB.value()) and 'GPIB') in x # ] if not self.errors_exist: self.I_source = self.rm.open_resource(self.I_so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n import visa\n\n rm = visa.ResourceManager()\n target = 'Agilent Technologies,8163B,MY48208514,V5.25(72637)'\n\n for dev in rm.list_resources():\n try:\n inst = rm.open_resource(dev)\n name = inst.query('*IDN?') # Agilent Te...
[ "0.58488786", "0.5460564", "0.54244834", "0.53689754", "0.52629423", "0.5229564", "0.5226817", "0.5191806", "0.5149981", "0.5125633", "0.50626856", "0.50484693", "0.5043974", "0.50175875", "0.501238", "0.49967742", "0.49922526", "0.4991907", "0.49915245", "0.49810675", "0.497...
0.5940608
0
Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.
def job_timeout_ms(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "job_timeout_ms")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeout(self) -> str:\n return pulumi.get(self, \"timeout\")", "def timeout(self) -> int:\n\n return self._timeout", "def check_timeout(self, msg):\n if msg.clock.secs > self.timeout and not self.is_cancelled:\n rospy.loginfo(\"Test timed out, cancelling job\")\n ...
[ "0.5882542", "0.58566386", "0.58173275", "0.58124197", "0.57919353", "0.5783616", "0.57713014", "0.572862", "0.5660806", "0.56589997", "0.5643863", "0.5643863", "0.5625082", "0.55886996", "0.55886996", "0.55886996", "0.55886996", "0.5574897", "0.557383", "0.5548075", "0.55405...
0.69198066
0
The type of the job.
def job_type(self) -> pulumi.Output[str]: return pulumi.get(self, "job_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_type(self):\n return self._job_type", "def type(self) -> Optional[pulumi.Input['JobType']]:\n return pulumi.get(self, \"type\")", "def job_details_type(self) -> str:\n return pulumi.get(self, \"job_details_type\")", "def job_details_type(self) -> str:\n return pulumi.get(s...
[ "0.9002671", "0.844342", "0.76216686", "0.76216686", "0.76216686", "0.7435503", "0.726418", "0.709847", "0.7038003", "0.7030451", "0.7030451", "0.7030451", "0.7030451", "0.7030451", "0.7030451", "0.7030451", "0.7030451", "0.7030451", "0.7030451", "0.7030451", "0.7030451", "...
0.87467295
1
Email address of the user who ran the job.
def user_email(self) -> pulumi.Output[str]: return pulumi.get(self, "user_email")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_useremail(self):\n return self.user.email", "def email(self, instance):\r\n return instance.user.email", "def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')", "def email(self) -> str:\n return pulumi.get...
[ "0.8045067", "0.7482019", "0.72746706", "0.7197063", "0.7197063", "0.7197063", "0.7195695", "0.7189387", "0.7168474", "0.7168474", "0.7168474", "0.7168474", "0.71192086", "0.7095948", "0.7094554", "0.70901", "0.69890106", "0.6986238", "0.6955563", "0.691718", "0.68999255", ...
0.8011265
1
Using the options and stdin check the bloom filters for IOCs
def main(): options = get_options() data_path = str(options.data_dir) bloom = BloomCategory(malicious_path=data_path + '/malicious-ips.bloom', predicted_path=data_path + '/predicted-ips.bloom', has_intel_path=data_path + '/ip-threat-intel.bloom') with ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n arguments = collections.deque(sys.argv)\r\n arguments.popleft()\r\n file_name = arguments.popleft()\r\n if len(arguments) == 0:\r\n print(\"Please enter filter commands to run the program. (host, port, ip, tcp, udp, icmp, net)\")\r\n sys.exit()\r\n packets_info = read_a...
[ "0.59075195", "0.571198", "0.56005055", "0.55080795", "0.54815006", "0.5467969", "0.54254556", "0.54060715", "0.53923625", "0.53685206", "0.5339621", "0.5333452", "0.5298472", "0.5276344", "0.5259351", "0.5253875", "0.5249222", "0.52447957", "0.5241998", "0.5231878", "0.52266...
0.7171011
0
Create a background file for motif analysis.
def create_background_file( outfile, bg_type, fmt="fasta", size=None, genome=None, inputfile=None, number=10000 ): fmt = fmt.lower() if fmt in ["fa", "fsa"]: fmt = "fasta" if bg_type not in BG_TYPES: logger.error(f"The argument 'type' should be one of: {','.join(BG_TYPES)}") sys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_background(argv):\n args = parse_args(argv)\n\n # Create fasta files\n sys.stdout.write(f\"Generating input fasta file...\")\n generate_input_fasta(regulatory_regions_file=args.regulatory_regions_file,\n background_input_fasta=args.background_input_fasta,\n ...
[ "0.6770991", "0.6409098", "0.60642445", "0.600799", "0.58706754", "0.58117944", "0.5713409", "0.56881523", "0.5673229", "0.5517937", "0.5509815", "0.5440462", "0.5392011", "0.5383787", "0.53739244", "0.5337144", "0.5326043", "0.53088874", "0.5253408", "0.52207017", "0.519795"...
0.68112105
0
Create index of GC content for a genome.
def create_gc_bin_index(genome, fname, min_bin_size=100): logger.info("Creating index for genomic GC frequencies.") g = Genome(genome) fasta = g.filename sizes = g.filename + ".sizes" # props["sizes"]["sizes"] with NamedTemporaryFile() as tmp: # pylint: disable=unexpected-keyword-arg ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_index(self):\r\n date_time('Building indexes in citations table')\r\n self.cursor.execute('DROP INDEX IF EXISTS IDX_citations ;')\r\n self.cursor.execute('CREATE INDEX IDX_citations ON citations (citation);')\r\n self.conn.commit()\r\n gc.collect()", "def index_genome...
[ "0.63085175", "0.6208266", "0.6030924", "0.5986668", "0.5840511", "0.58364654", "0.5822908", "0.57987857", "0.5792786", "0.5771251", "0.57565176", "0.56883234", "0.5687291", "0.5676972", "0.5670533", "0.5667721", "0.56395346", "0.5570101", "0.5566708", "0.5549159", "0.5545711...
0.7131006
0
Create a BED file from different GC bins.
def gc_bin_bedfile( bedfile, genome, number, length=200, bins=None, random_state=None, min_bin_size=100 ): if bins is None: bins = [(0.0, 0.2), (0.8, 1.0)] for b in np.arange(0.2, 0.799, 0.05): bins.append((round(b, 2), round(b + 0.05, 2))) bins = sorted(bins) if number ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gc_bin_index(genome, fname, min_bin_size=100):\n logger.info(\"Creating index for genomic GC frequencies.\")\n g = Genome(genome)\n fasta = g.filename\n sizes = g.filename + \".sizes\" # props[\"sizes\"][\"sizes\"]\n\n with NamedTemporaryFile() as tmp:\n # pylint: disable=unexpect...
[ "0.60980815", "0.5793627", "0.5760087", "0.5706503", "0.56810117", "0.56430155", "0.56416684", "0.5589777", "0.55267876", "0.55234665", "0.5493021", "0.54800487", "0.5461782", "0.5357284", "0.5355436", "0.53348494", "0.53264964", "0.5325675", "0.53226894", "0.52907103", "0.52...
0.6333996
0
Create a BED file with GC% matched to input file.
def matched_gc_bedfile(bedfile, matchfile, genome, number, size=None, min_bin_size=100): g = Genome(genome) genome_fa = g.filename try: fa = Fasta(matchfile) gc = [ (seq.upper().count("C") + seq.upper().count("G")) / len(seq) for seq in fa.seqs ] sizes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_bgf(self, filename):\n body = [\"BIOGRF{0:>5s}\\n\".format(self.biogrf)]\n if self.descrp:\n body.append(\"DESCRP {0}\\n\".format(self.descrp))\n else:\n body.append(\"DESCRP {0}\\n\".format(filename))\n body.append(\"FORCEFIELD {0}\\n\".format(self.ff))\...
[ "0.6062387", "0.56986284", "0.55833983", "0.55601734", "0.5551539", "0.5389084", "0.53258824", "0.53198844", "0.52998364", "0.52686113", "0.52623475", "0.5166518", "0.51603377", "0.51446456", "0.51310086", "0.5125808", "0.50954264", "0.5057726", "0.503264", "0.5031262", "0.50...
0.6236064
0
Mutate individual in place; sigma much higher that 0.25 can will leed to long execution time
def GausianMutator(individual, sigma, indpb): for idx, gene in enumerate(individual): if rand.random() > indpb: dtype = gene.type if dtype == bool: gene.value(not gene.value()) continue min_value, max_value = gene.min, gene.max ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mutate(self, noise_generator, sigma):\n\n mutation_indexes = torch.distributions.categorical.Categorical(\n torch.tensor([self.mutation_prob, 1 - self.mutation_prob])).sample([self.population_size]) > 0.5\n\n noise = noise_generator.sample([self.population_size, len(self.population[0]...
[ "0.6688608", "0.655262", "0.6480654", "0.6246567", "0.61921453", "0.6139258", "0.6087077", "0.6059703", "0.60146874", "0.5908357", "0.5848488", "0.580409", "0.5796968", "0.57791954", "0.57513815", "0.5739943", "0.5710097", "0.56995106", "0.5689599", "0.5685349", "0.56732017",...
0.70532256
0
put local file to qiniu. If key is None, the server will generate one.
def put_file(self, key=None, local_file=None, rename=None): if local_file is None: raise NameError('upload file to qiniu error!') policy = rs.PutPolicy(bucket_name) policy.saveKey = rename up_token = policy.token() ret, err = io.put_file(up_token, key, local_file) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_file(uptoken, key, localfile, extra=None):\r\n if extra is not None and extra.check_crc == 1:\r\n extra.crc32 = _get_file_crc32(localfile)\r\n with open(localfile, 'rb') as f:\r\n return put(uptoken, key, f, extra)", "def key_upload(self, key=None):\n raise NotImplementedError"...
[ "0.7133599", "0.69790006", "0.682977", "0.66461545", "0.65120673", "0.64975405", "0.6486899", "0.6470201", "0.6447628", "0.6422348", "0.6378536", "0.63577235", "0.62944865", "0.6294383", "0.6289327", "0.62754655", "0.62322944", "0.61883247", "0.61791635", "0.6174863", "0.6158...
0.738366
0
Generates a `Datasets` object from a list.
def from_list(list_of_datasets): train, valid, test = None, None, None train = list_of_datasets[0] if len(list_of_datasets) > 3: print("There are more then 3 Datasets here...") return list_of_datasets if len(list_of_datasets) > 1: test = list_of_datase...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_dataset():\n num_list = 10\n return [generate_list() for _ in range(num_list)]", "def create(data):\n \n return Setlist(\n list_id = data['id'],\n name = data['name'],\n items = data['num_sets'])", "def CreateDataset(all_arrays):\n dataset = ...
[ "0.713642", "0.67912585", "0.6644632", "0.64633846", "0.6451107", "0.63641775", "0.60139936", "0.6010649", "0.5985657", "0.5928591", "0.59258014", "0.5889244", "0.5883013", "0.5867555", "0.58655316", "0.5801068", "0.57994795", "0.57927996", "0.57612014", "0.5750914", "0.57479...
0.76773876
0
Stack some datasets calling stack for each dataset.
def stack(*datasets_s): return Datasets.from_list( [ Dataset.stack(*[d[k] for d in datasets_s if d[k] is not None]) for k in range(3) ] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack(*datasets):\n return Dataset(\n data=vstack([d.data for d in datasets]),\n target=stack_or_concat([d.target for d in datasets]),\n sample_info=np.concatenate([d.sample_info for d in datasets]),\n info={\n k: [d.info.get(k, None) for d in d...
[ "0.74105006", "0.6224133", "0.61153567", "0.605392", "0.60062796", "0.5918449", "0.5896614", "0.5779996", "0.5749291", "0.5718587", "0.57030183", "0.56620634", "0.5621588", "0.5579488", "0.55665857", "0.55463654", "0.5545169", "0.552239", "0.552239", "0.54799163", "0.5455473"...
0.71461445
1
Assuming that the datasets have same structure, stacks data, targets and other info
def stack(*datasets): return Dataset( data=vstack([d.data for d in datasets]), target=stack_or_concat([d.target for d in datasets]), sample_info=np.concatenate([d.sample_info for d in datasets]), info={ k: [d.info.get(k, None) for d in datasets] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_stack_and_label(filesource_dataset_1,filesource_dataset_2,num_sample):\n\n x = filesource_dataset_1[0]\n x_utterances = len(filesource_dataset_1)\n for idx in tqdm(range(1, x_utterances)):\n x = np.hstack((x, filesource_dataset_1[idx]))\n #print(x.shape)\n y = filesource_datas...
[ "0.6439451", "0.63662523", "0.5770458", "0.57640004", "0.56014407", "0.5594226", "0.55866146", "0.5569384", "0.55502826", "0.5504315", "0.5489888", "0.5488856", "0.5467876", "0.5466481", "0.54472476", "0.54406786", "0.5429611", "0.5415711", "0.54056656", "0.54047024", "0.5401...
0.7734438
0
Tender Qualification Document Upload
def collection_post(self): document = upload_file(self.request) document.author = self.request.authenticated_role self.context.documents.append(document) if save_tender(self.request): self.LOGGER.info( "Created tender qualification document {}".format(document...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self):\n document = upload_file(self.request)\n self.request.validated[\"qualification\"].documents.append(document)\n if save_tender(self.request):\n self.LOGGER.info(\n \"Updated tender qualification document {}\".format(self.request.context.id),\n ...
[ "0.7011324", "0.6625791", "0.6056341", "0.604441", "0.599105", "0.58514357", "0.58014864", "0.57448494", "0.5722403", "0.5647626", "0.5646104", "0.5611597", "0.55856794", "0.55776405", "0.5573368", "0.5542979", "0.55415756", "0.5528359", "0.55037415", "0.5495104", "0.54863006...
0.6640573
1
Tender Qualification Document Update
def put(self): document = upload_file(self.request) self.request.validated["qualification"].documents.append(document) if save_tender(self.request): self.LOGGER.info( "Updated tender qualification document {}".format(self.request.context.id), extra=con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_document(self):\n pass", "def edit_document():", "def patch(self):\n if apply_patch(self.request, src=self.request.context.serialize()):\n update_file_content_type(self.request)\n self.LOGGER.info(\n \"Updated tender qualification document {}\".form...
[ "0.65441775", "0.6009176", "0.6004787", "0.5918397", "0.5706653", "0.56903756", "0.56212336", "0.5521491", "0.550605", "0.5475452", "0.54754287", "0.54498464", "0.54302835", "0.53948754", "0.5377633", "0.53746945", "0.534313", "0.534106", "0.5327438", "0.5279192", "0.527067",...
0.6770321
0
Emulate legacy field superseeded by `patient_consent_date`. Forward to current datetime to `patient_consent_date` setter, which will set both underlying columns.
def patient_consent(self, value): self.patient_consent_date = utcnow() if value else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patient_consent_date(self, value):\n self._patient_consent_date = value\n self._patient_consent = 1 if value else 0", "def patient_consent_date(self):\n return self._patient_consent_date", "def set_to_date(self):\n self.set_value_into_input_field(self.set_to_date_locator, self.g...
[ "0.668064", "0.5796747", "0.57947594", "0.571031", "0.571031", "0.5642255", "0.5556245", "0.5523759", "0.55139166", "0.5509836", "0.55023223", "0.5477226", "0.5464905", "0.5369002", "0.5365053", "0.5335959", "0.53224725", "0.5223045", "0.5208461", "0.5204645", "0.51883584", ...
0.6615058
1
Get internal value for `patient_consent_date`.
def patient_consent_date(self): return self._patient_consent_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_patient_consent_date(self, d: dict):\n consent_date = d.get('patient_consent_date')\n consent_bool = d.get('patient_consent')\n if consent_date is not None:\n return self._str_to_datetime(consent_date)\n elif consent_bool:\n t0 = datetime.datetime.fromtim...
[ "0.8094495", "0.7589582", "0.7246536", "0.71703386", "0.6186469", "0.60771775", "0.582364", "0.582364", "0.582364", "0.582364", "0.5744298", "0.57036215", "0.5643021", "0.56060433", "0.56060433", "0.56060433", "0.56038517", "0.5568324", "0.5548201", "0.55249274", "0.5518372",...
0.8428358
0
Set consent for both legacy `patient_consent` and new `patient_consent_date`. If consent is given, set the `patient_consent_date` to the current datetime in UTC. (If the real date of consent is known, one should set `patient_consent_date` directly). If consent is revoked, set the `patient_consent_date` to None.
def patient_consent_date(self, value): self._patient_consent_date = value self._patient_consent = 1 if value else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patient_consent(self, value):\n self.patient_consent_date = utcnow() if value else None", "def consent(self, consent):\n if consent is None:\n raise ValueError(\"Invalid value for `consent`, must not be `None`\") # noqa: E501\n\n self._consent = consent", "def patient_conse...
[ "0.73732257", "0.6368166", "0.6134412", "0.5915429", "0.58693725", "0.56939834", "0.5567969", "0.5020891", "0.5020535", "0.48919058", "0.4779866", "0.4765815", "0.47550648", "0.47453716", "0.47379932", "0.47163343", "0.46686274", "0.4600456", "0.45884106", "0.45701525", "0.45...
0.7228571
1
Read patient_consent information from dict serialization. For existing rows that did not record the actual consent date, if `patient_consent` is True, `ceation_date` is used if present, UNIX epoch 0 if it is missing.
def _read_patient_consent_date(self, d: dict): consent_date = d.get('patient_consent_date') consent_bool = d.get('patient_consent') if consent_date is not None: return self._str_to_datetime(consent_date) elif consent_bool: t0 = datetime.datetime.fromtimestamp(0, t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patient_consent(self):\n return 1 if self.patient_consent_date is not None else 0", "def patient_consent(self, value):\n self.patient_consent_date = utcnow() if value else None", "def patient_consent_date(self, value):\n self._patient_consent_date = value\n self._patient_consent...
[ "0.5926589", "0.5809377", "0.5732567", "0.56433344", "0.55838776", "0.5239948", "0.514208", "0.5133141", "0.4684602", "0.45138747", "0.44812942", "0.44552103", "0.44459537", "0.44308993", "0.44297066", "0.4419778", "0.43893576", "0.4386389", "0.43847585", "0.4346647", "0.4310...
0.73424447
0
Saves the weights of model to output_path.
def save_model_weights(model, output_path): output_dir = os.path.dirname(output_path) if output_dir and not os.path.exists(output_dir): os.makedirs(output_dir) model.save_weights(output_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model_weights(self, filename):\n self.model.save_weights(filename)", "def save_model(self, file_name):\n\t\tself.model.save_weights(file_name)", "def save(self, filename):\n self.model.save_weights(filename)", "def save_model(self, model_filename):\n self.model.save_weights(mode...
[ "0.80955356", "0.7926381", "0.7886226", "0.7832939", "0.7832589", "0.77854276", "0.77565", "0.7726169", "0.77205503", "0.77095634", "0.7655661", "0.7647746", "0.76366", "0.75701165", "0.75657123", "0.75270814", "0.7525037", "0.7525037", "0.74478704", "0.7430976", "0.74265957"...
0.8475825
0
Apply a butter lowpass filter.
def butter_lowpass_filter(self, data: np.ndarray, lowcut: float, fs: float, order: int = 4) -> np.ndarray: b, a = self._butter_lowpass(lowcut, fs, order=order) y = filtfilt(b, a, data) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def butter_lowpass_filter(data, cutoff, fs, order=1):\n b, a = butter_lowpass(cutoff, fs, order=order)\n y = filtfilt(b, a, data)\n return y", "def butter_bandpass_filter(data, lowcut, highcut, fs, order=1):\n b, a = butter_bandpass(lowcut, highcut, fs, order=order)\n y = filtfilt(b, a, data)\n ...
[ "0.77225924", "0.758474", "0.75541186", "0.74821657", "0.74796224", "0.74441874", "0.74429524", "0.7362974", "0.7348949", "0.7328772", "0.73254126", "0.7311591", "0.72724277", "0.71420956", "0.7005642", "0.6849895", "0.6796962", "0.6738573", "0.66404504", "0.660009", "0.65754...
0.7719998
1
Apply a calibration matrix to the data.
def calibration_matrix(self, data: np.ndarray, matrix: np.ndarray) -> np.ndarray: tic = time.time() data_cal = np.dot(matrix, data) self.process_time.append(time.time() - tic) return data_cal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, data):\n cal = self.calc()\n assert data.shape == cal.shape, \\\n \"data shape does not match calibration ({} != {})\".format(data.shape, cal.shape)\n return data * cal", "def _applyCalibration(self, ws, detPos):\n alg = self.createChildAlgorithm('ApplyCa...
[ "0.69434965", "0.62040365", "0.6035492", "0.5958941", "0.59398246", "0.5786696", "0.574981", "0.57194704", "0.55841017", "0.5576397", "0.55610746", "0.5532381", "0.5509009", "0.5477683", "0.5476905", "0.54610693", "0.5456806", "0.5437726", "0.5427076", "0.5380523", "0.5365716...
0.72663486
0
update the signal processing parameters.
def update_signal_processing_parameters(self, **kwargs): for key, value in kwargs.items(): if key in self.__dict__: self.__dict__[key] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_parameters(self):\n # We update gamma, gamma0, lambda and nu in turn (Bottolo et al, 2011)\n self.update_gamma()\n self.update_gamma0()\n self.update_lambda()\n self.update_nu()\n if self.sample_xi:\n self.update_xi()", "def updateSignals(self):\n ...
[ "0.6584715", "0.6542431", "0.62621695", "0.6258087", "0.62553895", "0.62539536", "0.61550564", "0.6127215", "0.60999376", "0.60887265", "0.60854816", "0.6067803", "0.60374635", "0.6030319", "0.5960224", "0.5955644", "0.5927045", "0.5896254", "0.57902694", "0.57900864", "0.578...
0.79885525
0
Allow to apply a custom processing function to the data.
def custom_processing(self, funct: callable, data_tmp: np.ndarray, **kwargs) -> np.ndarray: tic = time.time() data_tmp = funct(data_tmp, **kwargs) self.process_time.append(time.time() - tic) return data_tmp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_fn(self,fn):\r\n \r\n self.check_Data()\r\n for split,data_ in self.processed_data.items():\r\n x = data_['x']\r\n x = np.array([fn(xi) for xi in x])\r\n data_['x'] = x", "def _process(self, data: np.ndarray) -> np.ndarray:", "def _process(self, d...
[ "0.7209119", "0.71054864", "0.71054864", "0.70158184", "0.67586684", "0.66956675", "0.6674667", "0.6640138", "0.66138846", "0.6517365", "0.64679474", "0.64604974", "0.6420236", "0.6411107", "0.63475305", "0.6322858", "0.63099974", "0.63018227", "0.6262167", "0.6238369", "0.62...
0.711315
1
Compute MVC from several mvc_trials.
def compute_mvc( nb_muscles: int, mvc_trials: np.ndarray, window_size: int, tmp_file: str = None, output_file: str = None, save_file: bool = False, ) -> list: mvc_list_max = [] for i in range(nb_muscles): mvc_temp = -np.sort(-mvc_trials, ax...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(cfg: DictConfig):\n\n experiments = cfg.get('experiment_type', f'{cfg.model.name}_only')\n fixed_t0 = cfg.get('fixed_t0', False)\n ext = '_fixedT0' if fixed_t0 else ''\n\n base_dir = cfg.device.root\n datasource = cfg.datasource.name\n\n if experiments == 'ablations':\n models...
[ "0.5545384", "0.5365183", "0.53412914", "0.52675617", "0.5252825", "0.52142614", "0.5210786", "0.5191421", "0.5145621", "0.5120124", "0.5053513", "0.5046397", "0.5045741", "0.5001172", "0.4999463", "0.49868155", "0.49839026", "0.49817446", "0.49579707", "0.49385127", "0.49382...
0.61508936
0
Delete the minority class, assign its label to the nearest majority class
def handle_imbalance(dataset, minority_class): for i, l in enumerate(dataset): if l == minority_class: dataset[i] = 2 return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_classification_head(self) -> None:\n del self.model.classifier", "def majority_class(classes):\n num_pos = len(classes[np.where(classes == 1)])\n num_neg = len(classes) - num_pos\n return 1 if num_pos > num_neg else 0", "def majority_voting(distances, labels, k):\n nearest_index =...
[ "0.6377702", "0.5918562", "0.58172894", "0.5726421", "0.56754035", "0.5635833", "0.55105144", "0.55105144", "0.5506352", "0.5470802", "0.54528326", "0.5444725", "0.5436435", "0.5425838", "0.54167604", "0.5402758", "0.53571814", "0.5312206", "0.5306321", "0.5279353", "0.524258...
0.61863196
1
Compute the BlandAltman plot for the flow results from the neural network and the reference results from Segment.
def bland_altman_plot(result, reference, save = False, dest_path = os.getcwd() + '/', filename = 'bland_altman_plot.png'): print('\nChecking that result and reference are 1D and that they have the same length\n') if (len(result.shape) == 1) and (len(reference.shape) == 1): if len(resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualise_dataset_balancer_results(results, range=(-0.5, 0.5),\n colors=(\"#64B3DE\", \"#1f78b4\", \"#B9B914\", \"#FBAC44\", \"#bc1659\", \"#33a02c\", \"grey\", \"#b15928\", \"#6a3d9a\", \"#e31a1c\", \"#6ABF20\", \"#ff7f00\", \"#6a3d9a\"),\n ...
[ "0.63131994", "0.61638975", "0.60450023", "0.5963564", "0.5949459", "0.58739024", "0.5803001", "0.57943153", "0.57097024", "0.5674428", "0.5670437", "0.5666262", "0.56224895", "0.5605114", "0.56042796", "0.5596361", "0.55910486", "0.5591017", "0.55787", "0.5563748", "0.555826...
0.69851726
0
Stabilization of a video. Saved at the same directory as the original video. Using fixed_area it is possible to adress an area in which fixed spots are located.
def stabilization(videopath, smoothing_radius=50, fixed_area=[0, -1, 0, -1], stab_points=200): # Read original video # Extract directory and videoname for saving purposes capture = cv2.VideoCapture(videopath) directory, videoname = os.path.split(vid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def video_stabilizer(self, video=None):\r\n def in_roi(roi, p):\r\n x, y = p\r\n return roi['x1'] < x < roi['x2'] and roi['y1'] < y < roi['y2']\r\n\r\n \r\n if video is None:\r\n video = self.video_buffer\r\n stab_video = np.zeros_like(video)\r\n ...
[ "0.59573704", "0.5611474", "0.5611474", "0.55306906", "0.54804987", "0.543196", "0.54163516", "0.5396492", "0.53075343", "0.530261", "0.5296827", "0.529461", "0.5270649", "0.5267028", "0.5228373", "0.5218529", "0.5175246", "0.51592225", "0.51358426", "0.5133068", "0.5116132",...
0.6866042
0
Creates a DataLoader from given source and its open/transform params.
def get_loader( data_source: Iterable[dict], open_fn: Callable, dict_transform: Callable = None, sampler=None, collate_fn: Callable = default_collate_fn, batch_size: int = 32, num_workers: int = 4, shuffle: bool = False, drop_last: bool = False, ): from catalyst.data.dataset impo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_DataLoader(self, **kwargs):\r\n return DataLoader(self, **kwargs)", "def get_dataloader(params, format_name='hdf5', **kwargs):\n \n Provider = get_proper_provider(format_name)(params.modality)\n \n return DataLoader(Provider(params.dataset_path,\n seq_len...
[ "0.67652076", "0.6572773", "0.6279626", "0.61619353", "0.61383015", "0.61090654", "0.60896605", "0.60315233", "0.6029367", "0.60176903", "0.5900374", "0.58815914", "0.5844954", "0.584316", "0.5832388", "0.5825662", "0.58236927", "0.58061033", "0.58045447", "0.5799926", "0.577...
0.73296386
0
Returns a batch from experiment loaders by its index or name.
def get_native_batch_from_loaders( loaders: Dict[str, DataLoader], loader: Union[str, int] = 0, batch_index: int = 0, ): if isinstance(loader, str): loader_instance = loaders[loader] elif isinstance(loader, int): loader_instance = list(loaders.values())[loader] else: rais...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_native_batch_from_loader(loader: DataLoader, batch_index: int = 0):\n dataset = loader.dataset\n collate_fn = loader.collate_fn\n return collate_fn([dataset[batch_index]])", "def get_batch(self, name):\n batches = self._meta['sets'].get('batches', {})\n if batches.get(name):\n ...
[ "0.62770796", "0.6147377", "0.6142249", "0.5965098", "0.5944489", "0.58695436", "0.58550024", "0.5844343", "0.57876563", "0.57487893", "0.5744385", "0.56675255", "0.56562734", "0.56562734", "0.5644203", "0.56192917", "0.56192917", "0.561557", "0.55952257", "0.557245", "0.5514...
0.6902564
0
Transfers loader to distributed mode. Experimental feature.
def _force_make_distributed_loader(loader: DataLoader) -> DataLoader: from catalyst.data.sampler import DistributedSamplerWrapper sampler = ( DistributedSampler(dataset=loader.dataset) if getattr(loader, "sampler", None) is not None else DistributedSamplerWrapper(sampler=loader.sampler)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_cluster(self):", "def _load_disk(self):\r\n pass", "def _load_disk(self):", "def _load_disk(self):", "def train(self, train_loader):\n pass", "def load_fileclient_dist(filename, backend, map_location):\n rank, world_size = get_dist_info()\n rank = int(os.environ.get('LOCAL_RANK'...
[ "0.59361863", "0.5920277", "0.59072095", "0.59072095", "0.56024635", "0.5458916", "0.5377288", "0.5368101", "0.5337646", "0.5314456", "0.5306029", "0.53045654", "0.5274331", "0.52272767", "0.5219852", "0.5215269", "0.5144504", "0.5126292", "0.51216847", "0.51074153", "0.51073...
0.6326774
0
Returns the data structures required to build a multipoint constraint. Given a nested dictionary, where the first keys are functions for geometrically locating the slave degrees of freedom. The values of these keys are another dictionary, containing functions for geometrically locating the master degree of freedom. The...
def slave_master_structure(V: function.FunctionSpace, slave_master_dict: typing.Dict[types.FunctionType, typing.Dict[ types.FunctionType, float]], subspace_slave=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_mixture_parameters(param_dict):\n compound1 = param_dict['compound1_name']\n compound2 = param_dict['compound2_name']\n compound1_mw = param_dict[compound1]['mw']\n compound2_mw = param_dict[compound2]['mw']\n n_fractions = param_dict['n_fractions']\n compound1_frac_range = np.linspace(0...
[ "0.5444125", "0.5406418", "0.5294767", "0.52280223", "0.5195249", "0.5088805", "0.50730544", "0.50400007", "0.49896812", "0.49793857", "0.4948449", "0.49242276", "0.49029934", "0.48890132", "0.48779187", "0.48230854", "0.4778732", "0.4759802", "0.47489172", "0.473061", "0.472...
0.5465718
0
Convenience function for locating a dof close to a point use numpy and lambda functions.
def dof_close_to(x, point): if point is None: raise ValueError("Point must be supplied") if len(point) == 1: return numpy.isclose(x[0], point[0]) elif len(point) == 2: return numpy.logical_and(numpy.isclose(x[0], point[0]), numpy.isclose(x[1], point[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindClosestPointWithinRadius(self, p_float, , p_float_4):\n ...", "def closest_point(point, points):\n return points[cdist([point], points).argmin()]", "def FindClosestPoint(self, ):\n ...", "def locate_source(p,d):\n # M = sensors, n = dimensions\n M, n = p.shape\n p = np.m...
[ "0.5620192", "0.5540381", "0.5476292", "0.5463289", "0.53948784", "0.52953845", "0.52639014", "0.515784", "0.5153333", "0.5147639", "0.5111826", "0.50957406", "0.5084647", "0.5053538", "0.5044675", "0.5013717", "0.5011052", "0.49993494", "0.4937481", "0.49339086", "0.492871",...
0.6613694
0
update grad related data in full resolution
def update_grad_data(): t_file = 'hcapgrd1_full_data_*.fits*' out_dir = deposit_dir + '/Grad_save/' tdir = out_dir + 'Gradcap/' # #--- read grad group name # gfile = house_keeping + 'grad_list' grad_list = mcf.read_data_file(gfile) [tstart, tstop, year] = ecf.find_data_collecting_period...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _UpdateGradient(self):\n self.mol.GetGradient('analytic')", "def update(self):\n self.arest.update()", "def update():", "def update():", "def updateG(self, dt):\n\t\tself.tissue.G.project( (self.initial * dt + Identity(3)) * self.tissue.G )", "def force_update_graph(self):\n self.upd...
[ "0.64381087", "0.6039294", "0.60320777", "0.60320777", "0.59506106", "0.5820663", "0.5819838", "0.58146644", "0.5809392", "0.5805305", "0.5803003", "0.57782805", "0.5775283", "0.5766644", "0.5766644", "0.5766644", "0.57610506", "0.5724304", "0.572347", "0.57166773", "0.570517...
0.7163576
0
Convert coordinates in the (u,v) plane into the (y,z) plane, assuming a chop angle.
def uv2yz(self, coords, chop=0): coords = np.array(coords, float, order='c', copy=False) yz = np.empty_like(coords) distortion = self.distortion_yz.base.base.base tmf.pacs_uv2yz(coords.reshape((-1,2)).T, distortion, chop, yz.reshape((-1,2)).T) yz *= 3600 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uv_to_coord(uv):\n transposed_uv = np.transpose(uv)\n x = transposed_uv[0] \n y = transposed_uv[1] \n z = transposed_uv[2]\n \n c = SkyCoord(x, y, z, unit = 'mpc', representation_type = 'cartesian',\n frame = 'icrs')\n\n return c", "def proyZm1(u, v, t1):\n ...
[ "0.61944693", "0.6185099", "0.6060304", "0.60305244", "0.6014021", "0.59566766", "0.5864326", "0.5781212", "0.5732748", "0.57312196", "0.5688741", "0.5502812", "0.54883116", "0.5481512", "0.5480482", "0.5480482", "0.5473742", "0.54688644", "0.54560274", "0.5441397", "0.542247...
0.69537777
0
Return the PACSspecific pointing matrix for the observation. If the observation has several slices, as many pointing matrices are returned in a list.
def get_pointing_matrix(self, header, npixels_per_sample=0, method=None, downsampling=False, section=None, comm=MPI.COMM_WORLD): if section is None: return super(PacsBase, self).get_pointing_matrix(header, npixels_per_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neighbors(point):\n pt = point.copy()\n output= [point.copy() for i in range(4)]\n output[0:2] = map(Point.setY, output[0:2], [pt.getY()+ i for i in range(-1,2,2)])\n output[2:4]= map(Point.setX, output[2:4], [pt.getX()+ i for i in range(-1,2,2)])\n return output", "def get_pointer_section...
[ "0.54192126", "0.5042742", "0.50278944", "0.4957887", "0.49473453", "0.49380195", "0.49365938", "0.49317816", "0.49207887", "0.49150553", "0.49030608", "0.48919055", "0.4853464", "0.48280665", "0.47937012", "0.47761717", "0.47713685", "0.47575518", "0.4756305", "0.47314298", ...
0.54859775
0
Return the number of valid samplings for each slice, by taking into account compression factor and fine sampling. They are those whose self.pointing is not removed.
def get_nfinesamples(self): return tuple(np.asarray(self.get_nsamples()) * \ self.slice.compression_factor * \ self.instrument.fine_sampling_factor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_count(self):\n assert len(self.decay_x) == len(self.decay_y)\n return len(self.decay_x)", "def _count_block_perm(orig_vals, perm_ds, nbs, tail, rng, return_null, clip_min_value):\n orig_vals = np.atleast_2d(orig_vals)\n # uniform perm_ds for both single and paired test\n if perm...
[ "0.6506231", "0.6302611", "0.62566555", "0.6216657", "0.61590683", "0.61199486", "0.60595316", "0.6048185", "0.60077083", "0.59875214", "0.59564877", "0.5913218", "0.5910656", "0.5910656", "0.5904776", "0.5903784", "0.587871", "0.58774364", "0.58659023", "0.585209", "0.583657...
0.6644689
0
Return a sky scan for the PACS instrument. The output is a Pointing instance that can be handed to PacsSimulation to create a simulation.
def create_scan(cls, center, length, step=148, sampling_period=None, speed=20, acceleration=ACCELERATION, nlegs=3, angle=0, instrument_angle=45, compression_factor=4, cross_scan=True): if sampling_period is None: if int(compression_factor)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scan(self):\n\n return self._scan_factory.make_scan(\n image_range=(1, 1),\n # dummy value--return to this later please\n exposure_time=1,\n oscillation=(\n self.detectorbase.osc_start,\n self.detectorbase.osc_start + self.detect...
[ "0.5746266", "0.506474", "0.49583694", "0.4863261", "0.48469698", "0.48300648", "0.48104277", "0.47972572", "0.47229928", "0.47021076", "0.46826926", "0.46820483", "0.46613055", "0.46553722", "0.4640871", "0.46237504", "0.46197218", "0.45881274", "0.4583141", "0.4549301", "0....
0.5223673
1
Return FITS keyword, according to HCSS handling.
def _hcss_fits_keyword(header, keyword, *args): if len(args) > 1: raise ValueError('Invalid number of arguments.') for k in header.keys(): if not k.startswith('key.'): continue if header[k] == keyword: return header[k[4:]] if len(args) == 1: return arg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cached_dm_find_fits_keyword(key):\n return MODEL.find_fits_keyword(key.upper(), return_result=True)", "def getKeyword(self, key):\n try:\n return self.raw[0].header[key]\n except:\n return self.raw[0].header['HIERARCH ESO '+key]", "def translate_keyword(keyword):\n ...
[ "0.61742735", "0.5731916", "0.5624878", "0.5479709", "0.5469909", "0.536184", "0.5338029", "0.53282803", "0.53036934", "0.52704316", "0.52200615", "0.51690644", "0.51421887", "0.51387876", "0.5137836", "0.51041573", "0.5076539", "0.50673413", "0.5035812", "0.50308436", "0.502...
0.62036276
0
Mask everything up to the n_scanline scan line of the n_repetition repetition. If n_scanline is None, mask the whole repetition. Arguments
def step_scanline_masking(obs, n_repetition=0, n_scanline=None): if n_scanline == None: for i in xrange(n_repetition): obs.pointing.masked[obs.status.Repetition == i] = True else: for i in xrange(n_repetition - 1): obs.pointing.masked[obs.status.Repetition == i] = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maskgroup(x, n):\n # create running lists\n index = []\n length = []\n count = 0\n\n # count indices and lengths of unmasked data groups\n for i in range(x.mask.size):\n if i==0:\n if not x.mask[i]:\n index += [i]\n count = 1\n if i>0:...
[ "0.5703053", "0.5262323", "0.5123203", "0.51200473", "0.5092291", "0.49722835", "0.49684605", "0.49445692", "0.49437836", "0.491899", "0.4886753", "0.48616335", "0.48601496", "0.48428234", "0.48108998", "0.48108998", "0.4792055", "0.4777932", "0.47722837", "0.4742274", "0.473...
0.77437854
0
The mask of a 3d image should be 2d
def test_05_01_mask_of3D(self): x=cpi.Image() x.image = np.ones((10,10,3)) self.assertTrue(x.mask.ndim==2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mask(self):\n\t\treturn pygame.mask.from_surface(self.img)", "def getHitmask(self,image):\n\t\tmask = []\n\t\tfor x in range(image.get_width()):\n\t\t\tmask.append([])\n\t\t\tfor y in range(image.get_height()):\n\t\t\t\tmask[x].append(bool(image.get_at((x,y))[3]))\n\t\treturn mask", "def get_mask(self,...
[ "0.688976", "0.68292147", "0.68080103", "0.67995906", "0.6752144", "0.6688653", "0.66669863", "0.661741", "0.6568836", "0.6568836", "0.6568836", "0.6547132", "0.65295583", "0.6466821", "0.6449835", "0.64433336", "0.6434398", "0.64335746", "0.6432887", "0.6421492", "0.64210224...
0.8106994
0
test that an 'is_disconnect' condition will invalidate the connection, and additionally dispose the previous connection pool and recreate.
def test_reconnect(self): # make a connection conn = self.db.connect() # connection works conn.execute(select(1)) # create a second connection within the pool, which we'll ensure # also goes away conn2 = self.db.connect() conn2.close() # two...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_already_disconnected(connection, events, schedule, flush):\n schedule(connection.connect(),\n connection.disconnect(),\n connection.disconnect())\n flush()\n assert events.triggered(\"CLIENT_CONNECT\")\n assert events.triggered(\"CLIENT_DISCONNECT\")", "def test_disco...
[ "0.71215147", "0.7030726", "0.70195895", "0.6962915", "0.6929336", "0.68194956", "0.6759856", "0.6750204", "0.6691207", "0.6621002", "0.6536765", "0.64876175", "0.64719003", "0.6469791", "0.6457137", "0.6449306", "0.640901", "0.63973737", "0.6388318", "0.6374561", "0.6314033"...
0.7141908
0
test that having an event handler that doesn't do anything keeps the behavior in place for a disconnect error.
def test_event_handler_didnt_downgrade_disconnect( self, ping_fixture_all_errs_disconnect ): engine = ping_fixture_all_errs_disconnect @event.listens_for(engine, "handle_error") def setup_disconnect(ctx): assert ctx.is_pre_ping assert ctx.is_disconnect ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_event_handler_didnt_upgrade_disconnect(self, ping_fixture):\n engine = ping_fixture\n\n @event.listens_for(engine, \"handle_error\")\n def setup_disconnect(ctx):\n assert not ctx.is_disconnect\n\n with expect_raises_message(\n exc.DBAPIError, \"unhandled d...
[ "0.78867626", "0.76576835", "0.73965603", "0.7263293", "0.7216937", "0.7042568", "0.6785579", "0.65975875", "0.6531375", "0.6502572", "0.6493144", "0.64641625", "0.64185786", "0.64083093", "0.6385069", "0.6377654", "0.6374116", "0.63512623", "0.6334448", "0.63215125", "0.6294...
0.7935945
0
returns coefficients of Chebyshev Regression of f with m sample points on the interval [min,max], and n is the order of chebyshev polynomials
def chebcoef(self,f,n,m,Kmin,Kmax): z = -cos((linspace(1,m,m)*2-1)*pi/(2*m*1.0)) x = (z+1)*(Kmax-Kmin)/2.0 + Kmin y = f(x) # print 'x, f(x):', x, y T0 = ones(m) T1 = z a = zeros(n+1) a[0] = sum(y)/(m*1.0) a[1] = dot(y,T1)/dot(T1,T1) for i i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chebyshev_coeffs(f, n):\n extrema = np.cos((np.pi * np.arange(2*n))/n)\n samples = f(extrema)\n coeffs = np.real(np.fft.fft(samples))[:n+1]\n coeffs /= n \n coeffs[0] /= 2\n coeffs[n] /= 2\n\n return coeffs", "def random_coefficients(self, n=3, max_range = 10):\n return np.random....
[ "0.7639109", "0.6433395", "0.6052176", "0.60155755", "0.59195346", "0.57900774", "0.57421833", "0.5741759", "0.5730309", "0.56809217", "0.5661867", "0.55754876", "0.5554896", "0.5551868", "0.5530003", "0.5522098", "0.55102664", "0.5499079", "0.54902244", "0.54771787", "0.5465...
0.7481705
1
This method does NOT work!! except for some parameter values like eco = projectionmethod(N=2,tol=0.01,R=5,W=10,beta=0.98,delta=0.05,ncheb=2)
def projection(e,N=30): start_time = datetime.now() # records the starting time for i in range(N): e.IterateCheby() e.CalculateChebyPaths() e.Aggregate() if e.Converged: print 'Converged! in',i+1,'iterations with tolerance level',e.tol break end_time =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Projection(W, TYPE_PROJ = proj_l11ball, ETA = 100, AXIS = 0, ETA_STAR = 100, device = \"cpu\" ): \n \n #global TYPE_PROJ, ETA, ETA_STAR, AXIS, device \n if TYPE_PROJ == 'No_proj':\n W_new = W\n if (TYPE_PROJ == proj_l1ball or TYPE_PROJ == proj_l11ball or TYPE_PROJ == proj_l11ball_line )...
[ "0.606067", "0.60375684", "0.5986863", "0.5974436", "0.5932277", "0.5917319", "0.5792665", "0.57505715", "0.573772", "0.56984025", "0.5694427", "0.5688644", "0.5684781", "0.5637021", "0.562528", "0.5622044", "0.55693513", "0.55580497", "0.5556933", "0.55527645", "0.55185956",...
0.6673543
0
Transforms a single 3D mesh.
def transform_mesh(mesh: InputTensor, matrix: InputTensor, vertices_are_points=True) -> t.Tensor: mesh = util.to_tensor(mesh, dtype=t.float32) matrix = util.to_tensor(matrix, dtype=t.float32) assert mesh.shape[-2:] == (3, 3) assert matrix.shape[-2:] == (4, 4) assert mesh.shape[:-3] == matr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, data):\n self.cube = self.trf.transform(data)", "def GetTransform(self, *args) -> \"itkTransformD33 *\":\n return _itkTransformMeshFilterPython.itkTransformMeshFilterMF3MF3TD33_GetTransform(self, *args)", "def GetTransform(self, *args) -> \"itkTransformF33 *\":\n return...
[ "0.6724482", "0.6628377", "0.6589676", "0.6446487", "0.6304848", "0.6281156", "0.6236697", "0.62262785", "0.61985016", "0.6182246", "0.6143696", "0.6117967", "0.6096631", "0.60931605", "0.6072821", "0.603262", "0.6030979", "0.5999245", "0.5990135", "0.5965643", "0.59506994", ...
0.66893816
1
Get the address of sICX token contract.
def getSicxAddress(self) -> Address: return self._sICX_address.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_address(self):\n if self.address:\n return self.address", "def get_address(self, ):\n return self.get_parameter('address')", "def _get_address(self):\n return self.__address", "def address(self) -> str:\n return pulumi.get(self, \"address\")", "def address(self) -...
[ "0.6026088", "0.6024718", "0.6004629", "0.5933634", "0.5933634", "0.5933634", "0.5915871", "0.5914371", "0.5914371", "0.59061444", "0.5879427", "0.58482677", "0.5840453", "0.5836381", "0.5836381", "0.5836381", "0.5836381", "0.5836381", "0.5824099", "0.58240896", "0.5750373", ...
0.6808541
0
Returns the total staked amount stored in a vardb _total_stake.
def getTotalStake(self) -> int: return self._total_stake.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_spent(self):\n total_sum = Order.objects.filter(\n email=self.email).aggregate(\n Sum('total_price')\n ).get('total_price__sum')\n return round(total_sum, 4) if total_sum else 0", "def total_sold(album):\n return album.total_sold", "def total(self):\n ...
[ "0.65858716", "0.6538318", "0.62111753", "0.6138218", "0.6135569", "0.6123897", "0.6095115", "0.60794395", "0.60766083", "0.6074283", "0.6031743", "0.5965689", "0.5964389", "0.59520096", "0.5926538", "0.59139526", "0.590713", "0.5894734", "0.58571315", "0.5856632", "0.5830383...
0.8146318
0
Sets the sICX address from staking contract.
def setSicxAddress(self, _address: Address) -> None: self._sICX_address.set(_address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_contract_addr(self, addr):\n\t\tself.contract_addr = addr\n\t\tself._bank_inst = self._w3.eth.contract(\n\t\t\taddress=self.contract_addr,\n\t\t\tabi=self._iface[\"abi\"],\n\t\t)", "def set_address(self, address):\n pass", "def getSicxAddress(self) -> Address:\n return self._sICX_address....
[ "0.7022209", "0.668352", "0.6504335", "0.60547084", "0.5994743", "0.5949447", "0.59453374", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5877724", "0.58283544", "0.56609696", "0.5632742", "0.5621456", "0.5613599", ...
0.76929194
0
Weekly this function is called to set the top 100 prep address in an arraydb
def _set_top_preps(self) -> None : prep_dict = self._system.getPReps(1, 20) prep_address_list = prep_dict['preps'] for each_prep in prep_address_list: self._top_preps.put(each_prep['address'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partition_geocode(con: sqlite3.Connection, cur: sqlite3.Cursor, quarter: str, county_cht: str):\n cur.execute('''SELECT 土地區段位置或建物區門牌 FROM \"{0}/TRX\"\n WHERE 縣市 = ?\n GROUP BY 土地區段位置或建物區門牌;'''.format(quarter), (county_cht,))\n for address, in cur.fetchall():\n c...
[ "0.511866", "0.50577724", "0.504898", "0.5036274", "0.49281853", "0.48955876", "0.48717105", "0.48107842", "0.47876543", "0.47528073", "0.47337833", "0.4712964", "0.47108823", "0.46957618", "0.46719283", "0.4665297", "0.4657939", "0.46463177", "0.46462315", "0.4643902", "0.46...
0.6340167
0
Returns the amount to be minted to a address
def _get_amount_to_mint(self) -> int: supply = self._sICX_supply.get() balance = self.getTotalStake() if balance == self.msg.value: amount = self.msg.value else: amount = supply * self.msg.value // (balance - self.msg.value) return amount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mint(amount: int) -> int:\n global total_supply\n\n _assert_is_bank(context.sender)\n total_supply = base.mint(balance_of, total_supply, context.sender, amount)\n return total_supply", "def get_address_balance(litecoinaddress):\n total_balance = 0\n unspent = list_unspent(litecoinaddress)\n...
[ "0.69586235", "0.6636571", "0.64191425", "0.6284753", "0.62760067", "0.62711406", "0.6152331", "0.6129017", "0.6064553", "0.58940786", "0.58726585", "0.5836371", "0.5781485", "0.5695222", "0.5656765", "0.5585638", "0.55727005", "0.5548005", "0.5546406", "0.55363196", "0.55116...
0.6663697
1
Checks the balance of the score and transfer the unstaked amount to the address and removing the data from linked list .
def _check_unstake_result(self) -> None: balance_score = self.icx.get_balance(self.address) - self._daily_reward.get() if balance_score > 0: unstake_info_list = self.getUserUnstakeInfo() for each_info in unstake_info_list: value_to_transfer = each_info[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeStake(self, address: str, value_LP: int):\n addr = address.lower()\n balances = self.addresses[addr] if addr in self.addresses else []\n if len(balances) > 0:\n while len(balances) > 0 and value_LP > 0:\n balance = balances[-1]\n initial_LP = ...
[ "0.6432592", "0.5612482", "0.55736476", "0.5467292", "0.5448148", "0.5388455", "0.5355376", "0.5315712", "0.528098", "0.5231815", "0.52249676", "0.5186252", "0.5156468", "0.513889", "0.51251215", "0.5123362", "0.51192874", "0.5118209", "0.5103814", "0.5093112", "0.5073614", ...
0.5967963
1
Sends ICX to an address.
def _send_ICX(self, _to: Address, amount: int, msg: str='') -> None: try: self.icx.transfer(_to, amount) self.FundTransfer(_to, amount, msg + f' {amount} ICX sent to {_to}.') except BaseException as e: revert(f'{amount} ICX not sent to {_to}. ' f'Ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_ICX(self, _to: Address, amount: int, msg: str) -> None:\n try:\n self.icx.transfer(_to, amount)\n self.FundTransfer(_to, amount, msg + f' {amount} ICX sent to {_to}.')\n except BaseException as e:\n revert(f'{amount} ICX not sent to {_to}. '\n ...
[ "0.67941105", "0.6422302", "0.5968883", "0.593261", "0.5741187", "0.57041913", "0.5646999", "0.5617863", "0.5556189", "0.5440533", "0.53692085", "0.5294152", "0.528091", "0.52612793", "0.52612793", "0.5130072", "0.5127549", "0.51131177", "0.51100826", "0.51076645", "0.5046392...
0.68834853
0
Register all directives, exists to avoid race conditions. Sometimes stuff like publish_parts can be ran from command line functions tests. There's also ways we could avoid this by placing it in __init__ of django_docutils.lib, but that's a bit implicit. Investigate that later. In order to make this work across django p...
def register_based_directives(): if not BASED_LIB_RST: return if "directives" in BASED_LIB_RST: for dir_name, dir_cls_str in BASED_LIB_RST["directives"].items(): class_ = import_string(dir_cls_str) directives.register_directive(dir_name, class_)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(app):\n app.add_directive('show_tasks', ShowTasksDirective)", "def setup(app): # noqa\n # Wee want to override the directives:\n # - 'graph' from sphinx.ext.graphviz extension.\n # - 'uml' from sphinxcontrib.plantuml\n # But Sphinx warns of the override, causing failure if warnings are ...
[ "0.56825787", "0.55998087", "0.556161", "0.544905", "0.5275472", "0.52580863", "0.52263993", "0.5223901", "0.519866", "0.51767975", "0.517581", "0.5134543", "0.5127223", "0.50869644", "0.50686884", "0.5055614", "0.5038577", "0.5013569", "0.5008931", "0.50057", "0.5004458", ...
0.7255333
0
Implementation of RGCN from the `"Modeling Relational Data with Graph Convolutional Networks"
def __init__(self, num_nodes, h_dim, out_dim, num_rels, num_bases=-1, num_hidden_layers=1, dropout=0.5, bias=False): super(RGCN, self).__init__() self.num_nodes = num_nodes self.h_dim = h_dim self.out_dim = out_dim self.num_rels = num_rels self.num_bases ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n n_in_channel=1,\n nclass=10,\n attention=True,\n activation=\"glu\",\n dropout=0.5,\n train_cnn=True,\n rnn_type=\"BGRU\",\n n_RNN_cell=128,\n n_layers_RNN=2,\n dropout_recurrent=0,\n cnn_integration=False,\...
[ "0.6725458", "0.65787673", "0.64724976", "0.62752014", "0.62358326", "0.61777776", "0.61175686", "0.6113475", "0.60882884", "0.60320884", "0.600548", "0.59998", "0.5995034", "0.5975954", "0.59726614", "0.5959342", "0.5940323", "0.5939544", "0.59256434", "0.591488", "0.5912431...
0.74162155
0
Precomputes and stores the factorial terms up to ``n!``.
def _compute_factorial(n: int) -> None: fact_count = len(_factorial_sequence) # have the terms up to n! already been computed? if n < fact_count: return # compute numbers iteratively from existing sequence product = _factorial_sequence[-1] for i in range(fact_count, n + 1): pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial(n):\n return product(range(1, n + 1))", "def factorial(n):\r\n temp = 1\r\n for item in range(2, n+1):\r\n temp *= item\r\n return temp", "def factorial(n):\n\n # the code for factorial", "def factorial_factorization(n):\n primes = sympy.primerange(2, n+1)\n factoriz...
[ "0.7415409", "0.7358811", "0.7357318", "0.73475236", "0.73066384", "0.7260437", "0.7232459", "0.7230606", "0.7225571", "0.71934617", "0.71773946", "0.71698505", "0.71696246", "0.71455836", "0.70917183", "0.7090762", "0.7074305", "0.7074229", "0.7064162", "0.6995383", "0.69483...
0.8229444
0
Resets the currently cached list of factorial terms.
def _reset_factorial_cache() -> None: global _factorial_sequence _factorial_sequence = [1, 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_clear(self):\n self.fold_term.cache_clear()", "def reset(self):\n self.__sets = []\n self._computed = False", "def reset(self):\n\n self._problem.reset()\n self._termination_criterion.reset()\n\n self._tabu_list = TabuList(self._list_size)\n\n if self....
[ "0.6321717", "0.62391734", "0.6231912", "0.6231774", "0.615009", "0.60553265", "0.60204417", "0.59892094", "0.59822446", "0.5975522", "0.5887768", "0.5880887", "0.58590513", "0.5852908", "0.58527416", "0.5850188", "0.5849707", "0.58328885", "0.58244604", "0.5810227", "0.58006...
0.81499666
0
Counts the permutations of ``k`` objects from a group of ``n``.
def permute(n: int, k: int) -> int: # no possible permutations if k > n if n < k: return 0 # if faster, compute n! and (n - k)! and return their quotient fact_count = len(_factorial_sequence) if n - fact_count <= k: return factorial(n) // factorial(n - k) # compute the product...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TAoCPpermutation(n,k):\n perms = []\n for subset in itertools.combinations(range(n), k):\n A = []; B = []; C = []; min = 0; j = 0; up = 0\n for i in xrange(n):\n if(j>=k or i != subset[j]):\n B.append(i)\n up +=1\n else:\n up -=1\n j += 1\n ...
[ "0.67244786", "0.6602117", "0.65821195", "0.6575043", "0.65667427", "0.6461524", "0.6421544", "0.64200276", "0.6202763", "0.6188401", "0.6182074", "0.6161341", "0.60909414", "0.6059227", "0.6050304", "0.6045108", "0.60183555", "0.5992609", "0.59800917", "0.59441495", "0.59124...
0.6858752
0
Returns the new colour of two added
def __add__(self, other): red = min(255, self.red + other.red) green = min(255, self.green + other.green) blue = min(255, self.blue + other.blue) return Colour(red, green, blue)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_color(red, green, blue):\r\n\r\n return (red << 16) + (green << 8) + blue", "def combine_colors(c1, c2, factor=0.5):\n c3 = QtGui.QColor()\n c3.setRed(int((factor * c1.red() + (1 - factor) * c2.red())))\n c3.setGreen(int((factor * c1.green() + (1 - factor) * c2.green())))\n c3.setB...
[ "0.72824293", "0.718031", "0.7179917", "0.70171314", "0.6788322", "0.661035", "0.6600029", "0.65749484", "0.64816475", "0.6467034", "0.63840234", "0.6309512", "0.6279438", "0.6279166", "0.6245517", "0.62111986", "0.62088406", "0.618801", "0.61737853", "0.61657524", "0.6154074...
0.7358977
0
Function create the overall graph within the selected time window. Require two table named identity and activity to retrive the data.
def graphformation(time_lower, time_upper): prm = param.Para() try: db_connection = mysql.connector.connect( host=prm.hostname, user=prm.username, passwd=prm.password, database= prm.dbname ) db_cursor = db_connection.cursor() except: print("Can't Connect to database, check credentials in pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n \n # initialize SQL kit to access database\n s = SQL_Kit(self.userID, self.password, self.database)\n \n \n \"\"\" Total Activity by hour \"\"\"\n \n # get activity data\n all_date_times = self.activity().index\n\n all_days ...
[ "0.5929608", "0.574596", "0.55326647", "0.5474472", "0.5462424", "0.5437014", "0.5401054", "0.5382752", "0.5361706", "0.52705204", "0.52689993", "0.5264251", "0.5233626", "0.5202995", "0.51812655", "0.5161609", "0.51143515", "0.50975466", "0.5093021", "0.50598747", "0.5042939...
0.6528744
0
Returns a generator of the AirbyteMessages generated by reading the source with the given configuration, catalog, and state.
def read( self, logger: AirbyteLogger, config: Mapping[str, Any], catalog: ConfiguredAirbyteCatalog, state: MutableMapping[str, Any] = None ) -> Iterable[AirbyteMessage]:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amsg_source_make(*args, **kwargs):\n return _uhd_swig.amsg_source_make(*args, **kwargs)", "def loadFromCs(cs) -> Reactor:\n from armi.reactor import blueprints\n\n bp = blueprints.loadFromCs(cs)\n return factory(cs, bp)", "def create_om_sources(self): #TODO: Prob. should make file names specifiab...
[ "0.48040932", "0.47626972", "0.47410765", "0.47083217", "0.46909904", "0.45570529", "0.45484966", "0.4527919", "0.44946748", "0.4476982", "0.4471172", "0.44699246", "0.44605175", "0.44356242", "0.44228485", "0.43957162", "0.43610972", "0.43510348", "0.43501917", "0.43245143", ...
0.71435726
0
Returns an AirbyteCatalog representing the available streams and fields in this integration. For example, given valid credentials to a Postgres database, returns an Airbyte catalog where each postgres table is a stream, and each table column is a field.
def discover(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteCatalog:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_catalog(self):\n streams = []\n\n for report in self.reports_definition:\n # For each report in reports_definition generate a Catalog Entry\n schema_name = report['name']\n view_id = report.get('view_id', self.client.view_id)\n\n schema = {\n ...
[ "0.63259274", "0.56996787", "0.5594333", "0.5563564", "0.5491723", "0.5298365", "0.52703625", "0.5256098", "0.52359384", "0.5234309", "0.5234309", "0.5234309", "0.5226757", "0.5211858", "0.5205091", "0.5180719", "0.5156277", "0.51447415", "0.51197815", "0.5114194", "0.5089148...
0.58156174
1
Override to return the class object of the port to be tested, or None if a valid port object cannot be constructed on the specified platform.
def port_maker(self, platform): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_port_type(self):\n raise NotImplementedError", "def port(self, **kw):\n return self.portType(**kw)", "def test_port_get_kind(self):\n assert_equal(self.test_port.get_kind(), 'mpport')", "def get_serial(cls, port):\n if port in cls._open_ports:\n return cls._open...
[ "0.6562559", "0.63834244", "0.6243232", "0.6179789", "0.6163945", "0.60676473", "0.60174555", "0.59178525", "0.5900225", "0.5800537", "0.5724092", "0.55979264", "0.5515977", "0.549112", "0.5490424", "0.5437289", "0.5437289", "0.541859", "0.5402839", "0.53838426", "0.53678054"...
0.66482294
0
Clean user reports after a certain amount of time
def clean_reports(): logger.info('Cleaning reports older than %d days' % lgr_settings.report_expiration_delay) # set the last run in the settings data lgr_settings.report_expiration_last_run = timezone.now() lgr_settings.save() nbr, __ = LGRReport.objects.filter( created_at__lt=datetime.date...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def afterHoursAutoPurge(self, ctx: Context):", "def clean_timelog():", "def purge(self, width):\n print('Purge', width)\n step_name = 'Purge'\n t0 = time.time()\n t_lastlog = t0\n while True:\n if self.interrupt_measurement_called:\n self.shuto...
[ "0.6732919", "0.6592778", "0.6126299", "0.6061384", "0.60261893", "0.5976596", "0.58207494", "0.57760584", "0.5754052", "0.5697268", "0.5681771", "0.5681109", "0.5671812", "0.56477356", "0.5646306", "0.55700403", "0.55624986", "0.55588466", "0.5548783", "0.5538477", "0.552587...
0.7127584
0
Calculate the index variant labels of the existing TLDs against the selected RZ LGR
def calculate_index_variant_labels_tlds(user_pk=None): logger.info('Calculate the index variant labels of the existing TLDs against the default RZ LGR') tlds_raw = download_file(settings.ICANN_TLDS)[1].read().lower() tlds = LabelInfo.from_form('TLDs', tlds_raw).labels rz_lgr_object: RzLgr = RzLgr.object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labelingLVQ(self):\n numLabels = len(np.unique(self.y))\n for i, x in enumerate(self.x):\n w = self.find_closest(x)[0]\n for nl in range(numLabels):\n if self.y[i] == nl:\n self.labels[nl, w[0], w[1]] += 1\n return self.labels", "de...
[ "0.6098479", "0.5809883", "0.5792415", "0.5639455", "0.558691", "0.55725765", "0.5469845", "0.5450689", "0.5437865", "0.53840214", "0.5329258", "0.5291685", "0.52631277", "0.51997197", "0.5175804", "0.51625544", "0.5155564", "0.51203215", "0.51166624", "0.51041543", "0.508753...
0.80737275
0
Given an absolute path, return a path relative to the project root. 'subdir/foo'
def _get_relative_path(self, abs_path): relative_path = os.path.relpath(abs_path, settings.PROJECT_ROOT) return relative_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_relative_path(path):\n if os.path.isabs(path):\n return path\n root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))\n return os.path.join(root_dir, path)", "def _abs_path(rel_path):\n return os.path.join(BASE_DIR, rel_path)", "def absPath(path)...
[ "0.76968694", "0.7513431", "0.74758035", "0.7474766", "0.7435405", "0.7332667", "0.7309524", "0.7283314", "0.7236684", "0.7155462", "0.7137708", "0.7106382", "0.70955163", "0.70686436", "0.70526963", "0.7035758", "0.7011202", "0.701053", "0.70069593", "0.6901063", "0.68866503...
0.7532645
1
withdraw ammount If successful return true else return false
def withdraw(self, ammount): if self.ammount < ammount: print(f"Current balance {self.ammount} is not sufficent to withdraw {ammount}") return False self.ammount -= ammount return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def withdraw(self, account_number: int, withdrawal: float) -> bool: \n if (withdrawal <= self._accounts[account_number][1]):\n self._accounts[account_number][1] -= withdrawal\n return True\n else:\n return False", "def withdraw(self,withdrawal_money):\r\n if ...
[ "0.7129063", "0.697466", "0.685374", "0.6743872", "0.6703391", "0.6656968", "0.6639949", "0.6582516", "0.6498409", "0.6463554", "0.6439925", "0.64195585", "0.64138675", "0.6405057", "0.6379571", "0.634767", "0.63386095", "0.63367176", "0.6332831", "0.632186", "0.6317901", "...
0.79275125
0
Validate that the checkpoint storage can be written to, restored from, and deleted from. Throws an exception if any of the operations fail.
def validate(config: Dict[str, Any]) -> None: class ValidationData(Storable): """ Verification for reading and writing a UUID to a checkpoint. The UUID saved must match the UUID that is loaded. """ def __init__(self) -> None: self.uuid = str(uuid.uuid4()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_checkpoint(self, checkpoint):\n if checkpoint not in self.journal:\n raise ValidationError(\"Checkpoint not found in journal: {0}\".format(\n str(checkpoint)\n ))", "def _checkIntegrity(self):\n return (\n os.path.isfile(os.path.join(sel...
[ "0.6401403", "0.604441", "0.60247445", "0.6014493", "0.5938673", "0.58888197", "0.5848131", "0.58427566", "0.58053726", "0.5703405", "0.5692488", "0.5662562", "0.55983996", "0.55499136", "0.55243295", "0.55065054", "0.5486752", "0.54731613", "0.5468748", "0.54644", "0.5440154...
0.6228919
1
For a given n, return X(t)
def X_n(a, b, n, T): def X(t): return a * np.cos((np.pi * 2 * n * t) / T) + b * np.sin((np.pi * 2 * n * t) / T) return X
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def I (self, n):", "def H(n,x):\r\n H_values = [] #a list of sequential H values for different n's up to n=n.\r\n H_values.append(1) #appends H_0.\r\n H_values.append(2*x) #appends H_1.\r\n if n>1:\r\n for i in range(1,n):\r\n H_values.append((2*x*H_values[-1])-(2*i*H_values[-2]))...
[ "0.6313942", "0.62647074", "0.6229281", "0.6226506", "0.6218988", "0.6215609", "0.61505866", "0.6141341", "0.6121001", "0.61204237", "0.6110605", "0.60703003", "0.6052773", "0.60342765", "0.6012939", "0.59978163", "0.59976727", "0.59882796", "0.592562", "0.5920827", "0.590750...
0.6888937
0
Parses new episodes from podcast feed.
def create_episodes_from_feed(self, entries): guids = self.podcast.episode_set.values_list("guid", flat=True) entries = [entry for entry in entries if entry["id"] not in guids] episodes = [ episode for episode in [self.create_episode_from_feed(entry) for entry in entries...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_podcast_episodes(url):\n\n def parse_pubdate(date_string):\n \"\"\"\n Change pubdate string to datetime object. Tries a bunch of\n possible formats, but if none of them is a match, it will\n return a epoch = 0 datetime object\n\n :param date_string: A string representi...
[ "0.6681258", "0.64088464", "0.61949426", "0.6156933", "0.6130738", "0.6122721", "0.6103838", "0.60889024", "0.60440505", "0.5956099", "0.5897863", "0.5877394", "0.58128", "0.58113426", "0.57403153", "0.57149476", "0.5643858", "0.55934775", "0.5578704", "0.55482566", "0.554315...
0.7159126
0
This function runs hashlib.sha512() on a file using chunks to ensure that too much RAM is not used.
def sha512(fname, /, *, chunksize = 1048576): # Import standard modules ... import hashlib # Create hash object ... hobj = hashlib.sha512() # Open input file as bytes ... with open(fname, "rb") as fObj: # Start infinite loop ... while True: # Read a chunk ... ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_file_sha512(fileIn):\n\n # fileIn is read in chunks to ensure it will work with (very) large files as well\n # Adapted from: http://stackoverflow.com/a/1131255/1209004\n\n blocksize = 2**20\n m = hashlib.sha512()\n with open(fileIn, \"rb\") as f:\n while True:\n buf = ...
[ "0.7312387", "0.72841877", "0.7193235", "0.69665354", "0.68670136", "0.6723953", "0.6630066", "0.6559456", "0.6534818", "0.64672387", "0.63602763", "0.6274184", "0.626974", "0.6252934", "0.6230989", "0.6187304", "0.61721843", "0.6122351", "0.6092596", "0.5980338", "0.59542215...
0.8374994
0
r"""Updating the injection spectrum.
def update_spectrum(self, spectrum): self.spectrum = spectrum return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.probe.update()", "def update(self):\n self.probe.update()", "def update(self):\n self.probe.update()", "def retarder(self):\n self.spectrum = self.spectrum", "def analyzer(self):\n self.spectrum = self.spectrum", "def calibration_wheel(self):\n ...
[ "0.61867964", "0.61867964", "0.61867964", "0.614271", "0.5898126", "0.58536935", "0.5806128", "0.57766", "0.5747572", "0.57033694", "0.56991166", "0.5691732", "0.5648008", "0.56375796", "0.56250036", "0.56163186", "0.56163186", "0.5604377", "0.55946124", "0.55214006", "0.5519...
0.6875147
0
Defining score according votes
def define_score(self, votes_string): #2*REW + colleagues + post-doctorate associate + 2* JBW votes = [int(x) for x in votes_string] weights = [2,1,1,2] score = 0 for i in range(0, 4): if votes[i] >= 0 and votes[i] <= 2: score += votes[i]*weights[i] return score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_score(self, obj):\n content_type = ContentType.objects.get_for_model(obj)\n result = self.filter(content_type=content_type,\n object_id=obj._get_pk_val()).aggregate(\n score=Sum('vote'),\n ...
[ "0.716967", "0.6934019", "0.6640118", "0.66166174", "0.6604573", "0.654908", "0.64828604", "0.64662987", "0.6440514", "0.64305836", "0.6388617", "0.63805676", "0.63544095", "0.63482374", "0.6321137", "0.6302071", "0.6254929", "0.62451154", "0.6213553", "0.6203114", "0.6122902...
0.75115824
0
Reading xml file and getting content from QueryNumber, QueryText, Results and Records tags
def read_xml(self, xml_name): logging.info('INICIANDO: leitura do arquivo xml de consultas') doc = xml.dom.minidom.parse(xml_name) query_number = doc.getElementsByTagName("QueryNumber") query_text = doc.getElementsByTagName("QueryText") results = doc.getElementsByTagName("Results") records = doc.getElements...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_XML(filename):\n logger_global.info('Reading '+filename+' file...')\n init = time.time()\n \n queries = []\n queries_keys = []\n results = []\n dom_tree = parse(filename)\n query_xml = dom_tree.documentElement.getElementsByTagName(\"QUERY\")\n \n for qu in query_xml:\n ...
[ "0.7173334", "0.6277773", "0.6025296", "0.58326966", "0.5825554", "0.57722706", "0.55968976", "0.55710435", "0.5553241", "0.5421207", "0.5395721", "0.53890324", "0.53667855", "0.53554547", "0.5332934", "0.53212774", "0.53173196", "0.529998", "0.5299098", "0.5297139", "0.52959...
0.7311271
0
Writing xml file in the query file In the resulting file, it is possible to find all the queries
def generate_query_file(self, query_file, xml_name, apply_stemmer): if apply_stemmer: logging.info('INICIANDO: geração de arquivo de consultas com stemmer') else: logging.info('INICIANDO: geração de arquivo de consultas sem stemmer') content = self.read_xml(xml_name) if apply_stemmer: query_file = qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_expected_file(self, expected_file, xml_name):\n\t\tlogging.info('Gerando arquivo de documentos esperados')\n\t\tcontent = self.read_xml(xml_name)\n\n\t\twith open(expected_file, 'w', newline='') as csvfile:\n\t\t\tfieldnames = ['QueryNumber', 'DocNumber', 'DocVotes']\n\t\t\twriter = csv.DictWriter(csv...
[ "0.6497793", "0.62081456", "0.62006843", "0.6157533", "0.6150465", "0.615025", "0.61167115", "0.60717726", "0.6031287", "0.5999682", "0.59621423", "0.5887432", "0.5863373", "0.5846017", "0.5824117", "0.5806362", "0.58015513", "0.5782127", "0.5765131", "0.5738493", "0.5731863"...
0.68933845
0
Writing xml file in the expected file In the resulting file, it is possible to find all retrieved documents for the queries
def generate_expected_file(self, expected_file, xml_name): logging.info('Gerando arquivo de documentos esperados') content = self.read_xml(xml_name) with open(expected_file, 'w', newline='') as csvfile: fieldnames = ['QueryNumber', 'DocNumber', 'DocVotes'] writer = csv.DictWriter(csvfile, fieldnames=fieldn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_output_file(self, xml_text, xml_file):\n xml_fo = open(xml_file, 'w')\n xml_fo.write(xml_text+'</xml>')\n xml_fo.close()\n return", "def xmlwrite(self, doc, filename):\n pathname = os.path.join(self.session.session_dir, filename)\n f = open(pathname, \"w\")\n ...
[ "0.65399575", "0.63661104", "0.63374054", "0.63239974", "0.6219125", "0.62150633", "0.6206546", "0.61252916", "0.6086908", "0.60831994", "0.5984633", "0.5983388", "0.5897017", "0.58935225", "0.5852003", "0.5838994", "0.5825246", "0.5819493", "0.5794886", "0.57939947", "0.5779...
0.7599953
0
Main method Reads all files and generate a file with queries and a file with expected documents to each query
def generate_files(self): apply_stemmer, xml_file, query_file, expected_file = self.read_config_file() self.generate_query_file(query_file, xml_file, apply_stemmer) self.generate_expected_file(expected_file, xml_file) logging.info('FINALIZADO: MÓDULO PROCESSADOR DE CONSULTAS')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n with read_std_files(OUT_FILE) as (qrys_file, docs_file, out_file):\n doc_count, token_count, word_map = map_docs(docs_file)\n avg_doc_len = token_count / float(doc_count)\n for doc_id, doc_tokens in tokenize(docs_file):\n doc_len = len(doc_tokens)\n doc_d...
[ "0.68237984", "0.6357273", "0.6356943", "0.6325044", "0.63006157", "0.6190093", "0.61827916", "0.61622274", "0.6130799", "0.61200684", "0.6096639", "0.60336506", "0.60316324", "0.60244626", "0.6006422", "0.60005426", "0.5965755", "0.5961854", "0.59602106", "0.5943142", "0.594...
0.709213
0
Function that computes the cost value for a given x
def costFun(self, x): tmp = x.reshape(self.inp_shape) c = np.float64(self.calcCost(np.asarray(tmp,dtype=np.float32))) + self.alpha * np.dot(x.T, x) return c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def costFun(self, S, x):", "def cost(self,x):\n Mx = self.generate_vector()\n self.prior.M.mult(x,Mx)\n return .5*Mx.inner(x)", "def final_cost(self, x):\n return self.x_M_x(x[-1,:,:],self.R)", "def fn(x):\n if x == 0: return 0\n if x < 0: return -inf \n ...
[ "0.8048273", "0.7995505", "0.7497831", "0.74943554", "0.72771204", "0.72714454", "0.724877", "0.7232135", "0.72299874", "0.72011256", "0.7193746", "0.7113412", "0.7009601", "0.69141775", "0.68879235", "0.6861625", "0.67966616", "0.67966616", "0.67889404", "0.6746737", "0.6742...
0.820668
0
Function that computes the cost value for a given x
def costFun(self, S, x):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def costFun(self, x):\n\ttmp = x.reshape(self.inp_shape)\n\tc = np.float64(self.calcCost(np.asarray(tmp,dtype=np.float32))) + self.alpha * np.dot(x.T, x)\n\treturn c", "def cost(self,x):\n Mx = self.generate_vector()\n self.prior.M.mult(x,Mx)\n return .5*Mx.inner(x)", "def final_cost(self,...
[ "0.820668", "0.7995505", "0.7497831", "0.74943554", "0.72771204", "0.72714454", "0.724877", "0.7232135", "0.72299874", "0.72011256", "0.7193746", "0.7113412", "0.7009601", "0.69141775", "0.68879235", "0.6861625", "0.67966616", "0.67966616", "0.67889404", "0.6746737", "0.67426...
0.8048273
1
given a song and an artist, return a uri to that song in Spotify
def get_spotify_uri(song, artist) -> str: song = re.sub("['|\s]", '%20', song) artist = re.sub("['|\s]", '%20', artist) query = "https://api.spotify.com/v1/search?q=track:{}+artist:{}&type=track&offset=0&limit=20".format( song, artist) response = requests.get(query, headers={ "Content-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spotify_uri(self,song_name, artist):\n query = f\"track:{song_name} artist:{artist}\"\n result = self.sp.search(q=query,limit=1,type='track')\n\n #only use the first song\n if len(result['tracks']['items']) > 0 and result['tracks']['items'][0]['artists'][0]['name'] == artist:\n ...
[ "0.83749163", "0.73485065", "0.7067173", "0.6968523", "0.68646127", "0.66602623", "0.6432892", "0.632123", "0.62950456", "0.61599934", "0.61227757", "0.60696423", "0.606751", "0.6037092", "0.59806633", "0.5964562", "0.5937355", "0.5896755", "0.5891374", "0.5862065", "0.585202...
0.8370671
1
Parse the trace.txt for each iteration, calculate DVFS residency state/frequencies and dump the result in csv and flush the data for next iteration.
def process_iteration_result(self, result, context): self.infile = os.path.join(context.output_directory, 'trace.txt') if os.path.isfile(self.infile): self.logger.debug('Running result_processor "dvfs"') self.outfile = os.path.join(settings.output_directory, 'dvfs.csv') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectrum_parser():\n from tools import file_importer, file_outporter\n from random import random\n # from math import log10\n \n print(\"this is spectrum parser\")\n \n relPath = \"bob/processed/OST-24-05-2017_combined.csv\"\n outPath = \"bob/processed/OST-24-05-2017_combined_no0_spectrum.csv\"\n inpF...
[ "0.5701113", "0.5631786", "0.5608315", "0.55364835", "0.54893756", "0.5474661", "0.5458289", "0.54296297", "0.54242486", "0.5418956", "0.5402291", "0.5402081", "0.53681874", "0.53458184", "0.5335917", "0.53273916", "0.53256774", "0.5292377", "0.5272078", "0.52447605", "0.5243...
0.6252766
0
Store state, cpu_id for each timestamp from trace.txt and flush all the values for next iterations.
def flush_parse_initialize(self): self.current_cluster = 0 self.current_frequency_of_clusters = [] self.timestamp = [] self.currentstates_of_clusters = [] self.state_time_map = {} self.cpuid_time_map = {} self.cpu_freq_time_spent = {} self.cpuids_of_cluste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_trace(self):\n\n tfname = str(int(time.time())) + \".obd2_reader.trace\"\n self.tf_out = open(tfname, 'a')\n self.RecordTrace = 1\n print \"Recoding trace to:\", tfname", "def update_records(self):\n impl.get_runtime().sync()\n self.clear_frontend()\n s...
[ "0.5487987", "0.5408423", "0.5171812", "0.5149306", "0.5137264", "0.51059526", "0.5044956", "0.50032514", "0.50026226", "0.49774602", "0.4974482", "0.49592197", "0.49436066", "0.49434984", "0.49397263", "0.49303812", "0.4918796", "0.4905129", "0.49025974", "0.48947987", "0.48...
0.64534724
0
Update the cluster frequency and current cluster
def update_cluster_freq(self, state, cpu_id): # For IKS devices cluster changes only possible when # freq changes, for other it is determine by cpu_id. if self.device.scheduler != 'iks': self.current_cluster = self.get_cluster(cpu_id, state) if self.get_state_name(state) == "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateClusterInfo(self):\n self.nPoints = len(self.labels)\n self.n = len(np.unique(self.labels))\n self.centers = [ [0.0 for j in range(3)] for i in range(self.n)]", "def update_cluster(self, cluster, params, *args, **kwargs):\n raise NotImplementedError", "def add_update...
[ "0.70926946", "0.6771409", "0.6328401", "0.63172925", "0.6311955", "0.6175837", "0.60610443", "0.6025551", "0.6025551", "0.6025551", "0.6025551", "0.6025551", "0.6025551", "0.59272796", "0.5923734", "0.5918287", "0.58931756", "0.5863579", "0.5851121", "0.5786061", "0.57628703...
0.7776443
0
Update state of each cores in every cluster. This is done for each timestamp.
def update_state(self, state, cpu_id): # pylint: disable=R0912 POWERDOWN = 2 offline_value = -1 # if state is in unknowstate, then change state of current cpu_id # with cluster freq of current cluster. # if state is in powerstate then change state with that power state. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_cores(self):\n num_cores = 0\n for job in self.job_list:\n num_cores += int(job.get_core_info())\n self.cores_used = num_cores\n return", "def cluster_state(self):\n for ip in set([status.ip for status in self.cluster_status]):\n yield self.node...
[ "0.6780373", "0.62166446", "0.60941476", "0.6064973", "0.58558685", "0.5828296", "0.5750417", "0.5698166", "0.559145", "0.55552137", "0.5542846", "0.55281645", "0.55234426", "0.55096674", "0.5472171", "0.5465183", "0.5462773", "0.5457216", "0.5441518", "0.5434996", "0.5420856...
0.6289924
1
Determine the unique Frequency and state
def unique_freq(self): unique_freq = [] for i in self.timestamp: if self.state_time_map[i] not in unique_freq and self.state_time_map[i] != self.UNKNOWNSTATE: unique_freq.append(self.state_time_map[i]) for i in self.minimum_frequency_cluster: if i not in u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freq():", "def freq(self) -> int:", "def get_frequency(self):\r\n # print '*********in get freq'\r\n self.cntr.run('FREQ 1')\r\n f_0_ = self.cntr.get_measurements(1)\r\n self.f_0 = f_0_[0]\r\n self.cntr.run('FREQ 2')\r\n f_rep_ = self.cntr.get_measurements(1)\r\n ...
[ "0.6752879", "0.65904456", "0.6134581", "0.6110019", "0.60763687", "0.6033786", "0.59830177", "0.59820443", "0.59509546", "0.5918082", "0.5894775", "0.5856046", "0.5792838", "0.5790568", "0.5765567", "0.57557666", "0.5713634", "0.5709292", "0.5696585", "0.5632066", "0.5631045...
0.7312302
0
generate the '''dvfs.csv''' with the state, frequency and cores
def generate_csv(self, context): # pylint: disable=R0912,R0914 temp = self.percentage() total_state = self.unique_freq() offline_value = -1 ghz_conversion = 1000000 mhz_conversion = 1000 with open(self.outfile, 'a+') as f: writer = csv.writer(f, delimiter=','...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeRawFCD():\n global vehId, vehIdDict\n vehIdDict = {}\n vehId = 0\n day = 0\n\n def getVehId(orgId):\n \"\"\"creates new vehicle id's which consists only numerics\"\"\"\n global vehId, vehIdDict\n value = vehIdDict.get(orgId, vehId)\n if value is vehId:\n ...
[ "0.60827273", "0.5674156", "0.5534153", "0.55247027", "0.5505764", "0.55022764", "0.5441504", "0.53989345", "0.5363615", "0.5295529", "0.5295098", "0.5272777", "0.5267846", "0.5244405", "0.5212482", "0.5211538", "0.5181538", "0.5169765", "0.51641446", "0.5136384", "0.51107246...
0.64446026
0
updating the direction information, revived from the client
def update_player_direction(self,direction): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_direction(self, update_data: dict):\n if self.on_update_direction:\n self.on_update_direction(self, update_data)", "def _directionUpdated(self, *args, **kwargs):\n # Invert direction to manipulate the 'source' pointing to\n # the center of the viewport\n x, y, z ...
[ "0.75249773", "0.6738136", "0.641039", "0.62898123", "0.625545", "0.62209475", "0.6207071", "0.6116505", "0.610406", "0.6084203", "0.6081595", "0.6042297", "0.6000609", "0.59838057", "0.59476405", "0.5923903", "0.59084034", "0.5897013", "0.5897013", "0.5890528", "0.5885742", ...
0.7453741
1
sending all relevant scene information to all clients, for status update
def send_scene_informations(self): self.send_player_position() self.send_player_direction() self.send_grafik_objects()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update(self):\n \n logging.info('updating state...')\n info = await self.send_command(\"$dat\", \"upd01-\")\n if not info:\n msg = \"Unable to get data about windows and scenes from Gateway\"\n return msg\n\n logging.debug('hub response is :')\n lo...
[ "0.60041046", "0.59992117", "0.5972423", "0.5819911", "0.5718183", "0.5576376", "0.5558921", "0.55262274", "0.5505325", "0.5475588", "0.54616416", "0.5444071", "0.5439299", "0.5424768", "0.54154384", "0.5349631", "0.5341202", "0.5330424", "0.5319409", "0.5318403", "0.530497",...
0.77263695
0
send positions of all player to all clients
def send_player_position(self): pl_coor_dict = {} for pl in self.player_list: #coor_list = [[p.x(),p.y()] for p in pl._line_list] pl_coor_dict[pl.id] = pl.get_line_list_float() self.on_data_to_all_clients({"game":{"player_coor":pl_coor_dict}})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_msg_to_players(players, msg=\"\"):\n for player in players:\n player.player_socket.send(msg + \"\\n\")", "def send_player_direction(self):\n pl_dir_dict = {}\n for pl in self.player_list:\n pl_dir_dict[pl.id] = pl.direction\n self.on_data_to_all_clients({\"game\...
[ "0.71883184", "0.6897638", "0.67860633", "0.6763005", "0.6666125", "0.6314095", "0.6149467", "0.6116273", "0.6100776", "0.60904455", "0.60173345", "0.6011354", "0.5980113", "0.5946969", "0.5932228", "0.59281164", "0.5904502", "0.5900891", "0.58715874", "0.5848904", "0.5835822...
0.7897912
0
send direction of all player to the server
def send_player_direction(self): pl_dir_dict = {} for pl in self.player_list: pl_dir_dict[pl.id] = pl.direction self.on_data_to_all_clients({"game":{"player_dir":pl_dir_dict}})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_player_direction(self,direction):\n pass", "async def send_dms(self):\n # Player 1 info\n info = \"\"\n for k, v in self.p1_moves.items():\n info += f\"Type **{k}** for **{v}**\\n\"\n\n embed = discord.Embed(\n title=f\"RPS in #{self.channel.nam...
[ "0.6904939", "0.63594335", "0.6280396", "0.60382164", "0.6019095", "0.5836359", "0.5783612", "0.5775737", "0.5773039", "0.5698471", "0.568822", "0.56532097", "0.56252", "0.5607198", "0.5595909", "0.5570109", "0.55576384", "0.5543813", "0.55298716", "0.5492103", "0.54724264", ...
0.8593915
0
decoding the k7 files and merge all of k7 files in specific date range into a single k7 file
def __merge(self, year, month, day): print 'Merge...' logging.info('[merge]->Merge...') k7dir = self.aodSetting.k7_dir # path.join(baseDir, 'k7') mdir = self.aodSetting.merge_dir # path.join(baseDir, 'merge') t = datetime.datetime(year, month, day) stids = self.aodSet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n\r\n directory = 'D:\\\\Profession\\\\Intern\\\\Assignments\\\\Codes\\\\Assignement Codes\\\\Part 2\\\\data_dumps'\r\n path = os.path.join(directory, 'dump_3')\r\n if not (os.path.exists(path)):\r\n os.mkdir(path)\r\n\r\n for date in range(1, 31):\r\n # date-month-year\r\n ...
[ "0.5749903", "0.55136085", "0.5509204", "0.5468086", "0.538251", "0.5376807", "0.536799", "0.5353574", "0.53223854", "0.53129154", "0.52146643", "0.5213128", "0.52057177", "0.51921964", "0.5189649", "0.5172596", "0.51672804", "0.51579833", "0.5130428", "0.5128183", "0.5115077...
0.6418639
0
calculate the aod file
def __cal_aod(self, year, month, day): print 'Calculate...' logging.info('[calculate]->Calculate...') t = datetime.datetime(year, month, day) ddir = self.aodSetting.data_dir wdir = self.aodSetting.p_aot_dir ascdir = self.aodSetting.ascii_dir aotdir = self.aodSet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_opal(self, file_name):\n \n return 0", "def aovsPath(self):\n\t\treturn fl.File( self._path + '/aovs.data' )", "def arff_file(data,attributes,relation,description,output_dir=\"./\",filename=\"tmp\"):\n x = []\n for k in attributes:\n x.append(k[0])\n data_write = {}\n ...
[ "0.5947568", "0.58376205", "0.5767446", "0.5706364", "0.56674826", "0.5640036", "0.56169784", "0.5545555", "0.5503337", "0.5500597", "0.546921", "0.54391", "0.54287213", "0.5404696", "0.5369557", "0.5313572", "0.53117436", "0.5296597", "0.5285791", "0.52849066", "0.5265977", ...
0.71632695
0
Test that the longterm average are correctly updated.
def test_avg_l(self): u_spec = leabra.UnitSpec(g_bar_e=0.3, g_bar_l=0.3, g_bar_i=1.0) u = leabra.Unit(spec=u_spec) for _ in range(20): u.add_excitatory(1.0) u.calculate_net_in() u.cycle('minus') self.assertEqual(u.avg_l, 0.40) u.spec.update_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mean(self):\n pass", "def test_mean(self):\n pass", "def test_compute_metrics(self):\n with self.test_session() as sess:\n tf.set_random_seed(1234)\n dut = _setup_trainer(self.tmpdir)\n\n sess.run(tf.global_variables_initializer())\n ses...
[ "0.6695123", "0.6695123", "0.6322456", "0.62833387", "0.62269557", "0.6221759", "0.6209817", "0.6205302", "0.62012064", "0.61570823", "0.6138694", "0.6086192", "0.6057636", "0.6040159", "0.6011267", "0.60064286", "0.5958843", "0.5958843", "0.5958843", "0.59416413", "0.5934692...
0.69294035
0
Test if units with forced activity update their averages
def test_avgs_forced(self): u = leabra.Unit() for t in range(10): u.force_activity(1.0) u.calculate_net_in() u.cycle('minus') for name in ['avg_ss', 'avg_s', 'avg_m', 'avg_s_eff']: self.assertTrue(getattr(u, name) != 0.15)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_average(self):\n avg_orders = Decimal(self._uncertain_demand.average_orders)\n self.assertEqual(avg_orders, 50)", "def should_average(self):\n return self._should_average", "def trigger_measurement_with_mass_flow_t_comp_and_averaging(self):\n return self.execute(SdpI2cCm...
[ "0.6194015", "0.60837054", "0.58219624", "0.57840586", "0.57701164", "0.5766448", "0.5765421", "0.5758668", "0.56976837", "0.56943905", "0.56729764", "0.56564695", "0.56349504", "0.5634266", "0.56338817", "0.5632846", "0.5626187", "0.561752", "0.5612526", "0.56117576", "0.559...
0.722404
0
Test quantitative equivalence with emergent on the xx1 function.
def test_emergent_xx1(self): xx1_data = data.parse_xy('convolve_nxx1.txt') spec = leabra.UnitSpec(adapt_on=False, noisy_act=True, act_gain=40, act_sd=0.01) receiver = leabra.Unit(spec=spec) receiver.cycle('minus') # create the noisy_xx1 convolution ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_xx1_thr(self):\n u_spec = leabra.UnitSpec()\n u_spec.act_thr = 0.25\n u = leabra.Unit(spec=u_spec)\n self.assertEqual(u_spec.xx1(-0.1), 0.0)\n self.assertTrue(0.0 < u_spec.xx1(0.1))\n self.assertEqual(u_spec.noisy_xx1(-0.1), 0.0)\n self.assertTrue(0.1 < u_s...
[ "0.64280814", "0.6261571", "0.6162461", "0.61146444", "0.60372925", "0.5985458", "0.59624684", "0.59294164", "0.59135175", "0.58800495", "0.5852574", "0.5826231", "0.58108443", "0.5767499", "0.575935", "0.5757728", "0.5744132", "0.5743049", "0.5740862", "0.57356805", "0.57282...
0.72790396
0