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 |
|---|---|---|---|---|---|---|
Runs Interpolation with random picking of the value of Beta | def run_interpolations_with_random_betas_1d():
rmse_values = []
picked_points_values = []
number_of_times = 100 # this will be the number of points displayed on the graph
random = np.random.default_rng()
for i in range(0, number_of_times):
test_points = create_points_with_random_pollution_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _beta_choice ( time_total, CurrentTime, dist, a = 0, b = 0 ):\n \n # compute the parameters b and a\n if not b: b = ( time_total - CurrentTime ) / ( time_total )\n if not a: a = ( 1 - b )\n\n if b == 0 : b = 0.01\n \n rv = beta(a, b)\n \n # get a random number\n variate = beta.rvs... | [
"0.6315217",
"0.5948435",
"0.5948435",
"0.58648527",
"0.5816035",
"0.5799185",
"0.5602806",
"0.56006837",
"0.5565972",
"0.55429894",
"0.55197525",
"0.5506608",
"0.54965204",
"0.5478616",
"0.5464626",
"0.54386944",
"0.54170537",
"0.54120225",
"0.5407994",
"0.54060245",
"0.5383... | 0.615036 | 1 |
Returns a matrix of pollution points using the Gaussian Atmospheric Dispersion Model that creates realistic pollution values given a source point | def create_points_using_atmospheric_model(x_source_list, y_source_list, side_length, number_of_maps):
pollution_maps = {}
number_of_sources = len(x_source_list)
x = 5
for map in range(0, number_of_maps): # loops through for each map
pollution_values = gaussian_atmospheric_dispersion_model(x_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_weight_matrix(dispersion, L):\n return np.exp(-0.5*(dispersion[:,None]-dispersion[None,:])**2/L**2)",
"def gxx(xp, yp, zp, prisms):\n if xp.shape != yp.shape != zp.shape:\n raise ValueError(\"Input arrays xp, yp, and zp must have same shape!\")\n res = 0\n for prism in prisms:\n ... | [
"0.5751619",
"0.57213074",
"0.5517285",
"0.5477143",
"0.5448317",
"0.5383978",
"0.5383978",
"0.5383978",
"0.5330314",
"0.52928764",
"0.52814704",
"0.5280798",
"0.52327096",
"0.5229621",
"0.52240545",
"0.52211356",
"0.5219602",
"0.52170163",
"0.52043295",
"0.520355",
"0.520089... | 0.57707286 | 0 |
Graphs all points and interpolates unknown points, useful for visualizing Gaussian Interpolation and affects of kernals | def see_what_its_doing_1d():
all_points = create_points_with_random_pollution_1d(100, 100, 10)
picked_points = pick_uniform_random_points(all_points, 20)
interpolated_points = interpolate_unknown_points(picked_points, all_points)
picked_x = []
picked_pollution = []
for label, point in picked_po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_interpolation(self):\r\n self.plot_all_logcalls(True)\r\n print_log('info', 'Interpolation was finished.')",
"def test_interpolated():\n # Set random seed for reproducibility\n manualSeed = main.manualSeed\n print(\"Fixed Seed: \", manualSeed)\n random.seed(manualSeed)\n tor... | [
"0.6510402",
"0.6353091",
"0.63335377",
"0.605492",
"0.6011792",
"0.6011792",
"0.6011792",
"0.5990307",
"0.5940392",
"0.5913538",
"0.5863067",
"0.58239466",
"0.58210856",
"0.58043647",
"0.57680166",
"0.57446057",
"0.57185596",
"0.5710173",
"0.56967527",
"0.56915724",
"0.56820... | 0.6986818 | 0 |
Equalizes the amp levels in each input file to the average amp level. Assumes the segmaps are in the same directory. | def equalize_amps(f, multiply_flat=True):
outfile = f.replace('.fits', '_eq.fits')
if not os.path.isfile(outfile):
h = fits.open(f)
if multiply_flat:
flat_file = os.path.join(os.environ['iref'],
h[0].header['PFLTFILE'].replace('iref$', ''))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coldaverage( names):\n\n rs = radioastronomy.Spectrum() # create input and average structures\n avenames = names # create an output list to average\n\n# assume only a limited range of galactic latitudes are available\n# not range above +/-60.\n use60Range = False\n minGlat = 90. ... | [
"0.5678562",
"0.5648256",
"0.5603824",
"0.5540252",
"0.55384094",
"0.54120356",
"0.53110045",
"0.52906954",
"0.5276951",
"0.524398",
"0.5133814",
"0.5110126",
"0.50557166",
"0.504026",
"0.50270253",
"0.49903795",
"0.49727103",
"0.49685916",
"0.49442196",
"0.49347755",
"0.4916... | 0.6478025 | 0 |
Makes a segmentation map for each extension of the input files. | def make_segmap(f, overwrite=True):
# Make segmaps for each SCI extension
for i in [1,4]:
# See if segmap already exists
outfile = f.replace('.fits', '_seg_ext_{}.fits'.format(i))
if (os.path.exists(outfile)) & (overwrite is False):
pass
else:
# Get ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bulk_process_images(inputpath, outputpath, extension):\n\n for dirpath, dirnames, filenames in os.walk(inputpath):\n structure = os.path.join(outputpath, dirpath[len(inputpath) + 1:])\n for file in filenames:\n if file.endswith(extension):\n src = os.path.join(dirpath... | [
"0.6040463",
"0.5870681",
"0.58686787",
"0.57802045",
"0.5761197",
"0.57405865",
"0.5730281",
"0.56978464",
"0.56978387",
"0.56869394",
"0.56725156",
"0.5512648",
"0.5472542",
"0.5451532",
"0.5432038",
"0.5428308",
"0.54233843",
"0.5411149",
"0.5382873",
"0.5381004",
"0.53777... | 0.66200495 | 0 |
Find the median through an image stack. Useful for multiprocessing when running into memory issues. | def med_stack(stack):
return np.nanmedian(stack, axis=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median(image, selem, out=None, mask=None, shift_x=False, shift_y=False):\n\n return _apply(_crank8.median, _crank16.median, image, selem, out=out,\n mask=mask, shift_x=shift_x, shift_y=shift_y)",
"def build_median_image(self):\n # Check if the image stack has been aligned\n ... | [
"0.7241589",
"0.70984644",
"0.70366246",
"0.6865056",
"0.679089",
"0.6772967",
"0.6750015",
"0.67148644",
"0.6671408",
"0.666153",
"0.66491425",
"0.6599428",
"0.659365",
"0.6567267",
"0.6500306",
"0.64866716",
"0.6450642",
"0.644931",
"0.64462674",
"0.6440576",
"0.64078534",
... | 0.7426714 | 0 |
Subtracts the median from the input file ampbyamp to remove any bias offset. Assumes the segmaps are in the same directory. | def subtract_med(f, multiply_flat=True):
outfile = f.replace('.fits', '_medsub.fits')
if not os.path.isfile(outfile):
h = fits.open(f)
if multiply_flat:
flat_file = os.path.join(os.environ['iref'],
h[0].header['PFLTFILE'].replace('iref$', ''... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median_filter(self):\n print \"Median-Filtering...\"\n D = self.D\n x = np.median(np.median(D,axis=1),axis=1)\n for i in xrange(len(x)):\n D[i,:,:] -= x[i]\n self.D = D\n print \"done.\"",
"def median(in_file, out_path=None):\n if out_path is None:\n ... | [
"0.59360003",
"0.54216653",
"0.5401621",
"0.538461",
"0.538461",
"0.5283749",
"0.5127036",
"0.51253754",
"0.51095885",
"0.5084595",
"0.5084595",
"0.5070787",
"0.5017929",
"0.50051963",
"0.4997873",
"0.49927825",
"0.49886608",
"0.49699232",
"0.49677554",
"0.4959802",
"0.495652... | 0.61098677 | 0 |
Subtracts the skydark from the input file. | def subtract_skydark(f):
# Store these final products in a separate directory
final_outdir = './final/'
outfile = os.path.join(final_outdir, f.replace('.fits', '_skydarksub.fits'))
if not os.path.isfile(outfile):
# Get the skydark data
skydark_ext1 = fits.getdata('skydark_ext_1_filtered... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def darksubtract(dir='Flats', master_dark='Darks/Dark60sec0807.fits'):\n # master_dark = input(\"Which Master Dark in the /Darks/ folder (or otherwise) would you like to use?\")\n\n # if answer == 'Y':\n # print(\"The script is now running....\")\n # else:\n # print(\"You have chosen to quit t... | [
"0.64771134",
"0.60219544",
"0.587728",
"0.56964374",
"0.55409485",
"0.54986095",
"0.5322549",
"0.52782416",
"0.5247249",
"0.51829696",
"0.51821125",
"0.5170453",
"0.51609313",
"0.5094622",
"0.50819296",
"0.49800363",
"0.49751177",
"0.4920687",
"0.48617005",
"0.48549804",
"0.... | 0.7673071 | 0 |
A wrapper around the equalize_amps function to allow for multiprocessing. | def wrapper_equalize_amps(args):
return equalize_amps(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equalize_amps(f, multiply_flat=True):\n \n outfile = f.replace('.fits', '_eq.fits')\n if not os.path.isfile(outfile):\n h = fits.open(f)\n if multiply_flat:\n flat_file = os.path.join(os.environ['iref'], \n h[0].header['PFLTFILE'].replace('i... | [
"0.59990793",
"0.5497779",
"0.5313964",
"0.52303433",
"0.51945496",
"0.5087411",
"0.50079083",
"0.49257243",
"0.48766726",
"0.48382878",
"0.47912908",
"0.4777078",
"0.4776286",
"0.46790597",
"0.46756646",
"0.46716306",
"0.46137878",
"0.46090004",
"0.4608776",
"0.46075648",
"0... | 0.81383216 | 0 |
A wrapper around the subtract_med function to allow for multiprocessing. | def wrapper_subtract_med(args):
return subtract_med(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtract(self, m): \n f = m.negate()\n return self.add(f)",
"def subtract(self):\n return self._do_calc(self.subtracter)",
"def subtract(self):\n return self._do_calc(self.subtracter)",
"def subtract(self):\n return self._do_calc(self.subtracter)",
"def subtract(a, b)... | [
"0.64864635",
"0.63344973",
"0.63344973",
"0.63344973",
"0.6091509",
"0.6091509",
"0.592077",
"0.5872197",
"0.5861908",
"0.5763004",
"0.5758329",
"0.5717828",
"0.56867516",
"0.5671118",
"0.5636658",
"0.5633379",
"0.5619199",
"0.5604695",
"0.5604695",
"0.5604695",
"0.5586736",... | 0.8406752 | 0 |
Copies the first n items from q. | def copydeck(self, q, n):
tmp = q.copy()
return deque(reversed([tmp.pop() for _ in range(n)])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take(self, n): # noqa: N805\n return List(_islice(self, n))",
"def take(n, seq):\n return itertools.islice(seq, n)",
"def take(n, iterable):\n return list(islice(iterable, n))",
"def take(n, iterable):\n return list(islice(iterable, n))",
"def take(iterable, n):\n return list(iterto... | [
"0.64387465",
"0.6300363",
"0.6298109",
"0.6298109",
"0.6225375",
"0.619442",
"0.61891025",
"0.61891025",
"0.59269166",
"0.5898483",
"0.5890745",
"0.5890017",
"0.58869463",
"0.5769344",
"0.5731915",
"0.5716537",
"0.5715462",
"0.5715462",
"0.568876",
"0.5663788",
"0.5588568",
... | 0.72947156 | 0 |
Returns a generator of the descriptions of difference between the two trees. | def get_des_gen(tree_before: Node, tree_after: Node) -> Iterator[Description]:
distance, delta = diff(tree_before, tree_after)
tree_before_iter: Iterator[Node] = infinite_none_suffix(
post_order_tree_traversal(tree_before)
)
tree_after_iter: Iterator[Node] = infinite_none_suffix(
post_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_des(tree_before: Node, tree_after: Node) -> List[Description]:\n\n des_gen: Iterator[Description] = get_des_gen(tree_before, tree_after)\n\n return list(des_gen)",
"def diff(self):\n return [node.diff for node in self]",
"def describe_update(node_before: Node, node_after: Node) -> UpdateDe... | [
"0.73225856",
"0.65581506",
"0.64734423",
"0.6388793",
"0.6273645",
"0.6184728",
"0.61689174",
"0.61183506",
"0.610188",
"0.60345906",
"0.6001336",
"0.591645",
"0.5910881",
"0.5791382",
"0.57668334",
"0.5744307",
"0.57028943",
"0.57018024",
"0.5669134",
"0.5665456",
"0.565814... | 0.78360057 | 0 |
Runs the training loop for A3C agents Separate threads are started for the number of workers | def train_workers(self):
args = dict(actor=self.actor,
critic=self.critic,
gamma=self.gamma,
lamda=self.lamda or self.gamma / 1.005,
device=self.device,
optimizers=[self.actor_optimizer, self.critic_optimizer])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worker_duty():\n\n while True:\n batch = queue.get()\n if batch is None:\n break\n examples, labels, alphas = batch\n for example, label, alpha in batch:\n self._train_one_example(example, label, alpha)... | [
"0.6836633",
"0.65122765",
"0.6460647",
"0.6446657",
"0.6403028",
"0.6399128",
"0.63808846",
"0.6323567",
"0.62675905",
"0.6262276",
"0.6206964",
"0.62046957",
"0.615917",
"0.61558115",
"0.61420363",
"0.6113237",
"0.6074411",
"0.6072816",
"0.6071342",
"0.6067619",
"0.60607314... | 0.6769891 | 1 |
Plot a 3D pose 4x4 homogenous transform on given axis 'axes' with given 'axis_length'. | def plot_pose3_on_axes(axes, T, axis_length=0.1, center_plot=False, line_obj_list=None):
return plot_pose3RT_on_axes(axes, *decompose_T(T), axis_length, center_plot, line_obj_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_pose3_on_axes(axes, T, axis_length=0.1, center_plot=False, line_obj_list=None, zoom_to_fit=False):\n return plot_pose3RT_on_axes(axes, *decompose_T(T), axis_length, center_plot, line_obj_list, zoom_to_fit=zoom_to_fit)",
"def plot_pose3RT_on_axes(axes, gRp, origin, axis_length=0.1, center_plot=False, ... | [
"0.7363005",
"0.69970095",
"0.6886538",
"0.6229485",
"0.5885916",
"0.5774794",
"0.5706918",
"0.56915104",
"0.5599934",
"0.55716264",
"0.55564326",
"0.55549055",
"0.5533825",
"0.5525004",
"0.5512172",
"0.5479025",
"0.5466929",
"0.53740156",
"0.53642106",
"0.5224792",
"0.520648... | 0.7480402 | 0 |
Try to send the exit command to subprocess running. Kill it if it is still running | def exit(self):
if self._isSubProcessRunning() and self._exitCommand is not None:
self.__process.stdin.write(self._exitCommand)
self.__process.stdin.write(os.linesep)
self.__process.stdin.flush()
time.sleep(0.5)
if self._isSubProcessRunning() :
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _kill(self) -> None:\n if not hasattr(self, \"proc\"):\n raise FuzzFrontendError(\"Attempted to kill non-running PID.\")\n\n self.proc.terminate()\n try:\n self.proc.wait(timeout=0.5)\n L.info(\"Fuzzer subprocess exited with `%d`\", self.proc.returncode)\n except subprocess.TimeoutEx... | [
"0.69836146",
"0.6966061",
"0.6951791",
"0.6874733",
"0.68658394",
"0.68343395",
"0.68141687",
"0.6774711",
"0.6766339",
"0.67142147",
"0.66957617",
"0.66684884",
"0.6658576",
"0.6650318",
"0.6644671",
"0.6609407",
"0.6569436",
"0.6552041",
"0.65366364",
"0.6534633",
"0.65299... | 0.77208024 | 0 |
Create a SaliencyMapMethod instance. | def __init__(self, model, sess=None, dtypestr='float32', **kwargs):
super(SaliencyMapMethod, self).__init__(model, sess, dtypestr, **kwargs)
self.feedable_kwargs = ('y_target',)
self.structural_kwargs = [
'theta', 'gamma', 'clip_max', 'clip_min', 'symbolic_impl'
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_saliency_map(graph):\n \n SP = saliencymap(graph)\n SP.construct_saliency_map()\n return SP.saliency_map",
"def initialize(cls):\n if len(cls.mapping) == 0:\n cls.mapping[\"noop\"] = cls(Transform.identity, Combiner.noop)\n cls.mapping[\"sigmoid\"] = cls(Tra... | [
"0.6396506",
"0.53610367",
"0.5246618",
"0.52401555",
"0.521829",
"0.4967219",
"0.49535316",
"0.49254853",
"0.4872292",
"0.486188",
"0.48590204",
"0.48539758",
"0.48367265",
"0.477107",
"0.4770125",
"0.4745201",
"0.47328815",
"0.4717256",
"0.47093287",
"0.46956885",
"0.468247... | 0.5915626 | 1 |
displays a dialog to the user with the results of the import | def show_result(self, results):
successes, failures = results
title = u'uTorrentImport Finished'
dialog = dialogs.AsyncDialog(title, None, True, (gtk.STOCK_OK, gtk.RESPONSE_OK),
destroy_signals=gtk.RESPONSE_OK)
if successes is failures is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n # show the dialog\n self.dlg.show()\n # Run the dialog event loop\n result = self.dlg.exec_()\n # See if OK was pressed\n if result:\n # Do something useful here - delete the line containing pass and\n # substitute with your code.\n ... | [
"0.6398973",
"0.6398973",
"0.6398973",
"0.63558096",
"0.62587315",
"0.6151493",
"0.61467886",
"0.6135253",
"0.6075212",
"0.60457295",
"0.6041286",
"0.601465",
"0.5999153",
"0.59936106",
"0.59697664",
"0.59595853",
"0.59467345",
"0.5932287",
"0.5923266",
"0.5921622",
"0.591637... | 0.73466444 | 0 |
foreces the 'Force Recheck' checkbox to be checked if the user dosen't add the torrents in a resumed state | def on_resume_toggled(self, _):
if not self.resume.get_active():
self._previous_force_recheck = self.force_recheck.get_active()
self.force_recheck.set_sensitive(False)
self.force_recheck.set_active(True)
else:
self.force_recheck.set_active(self._previous_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_checkbox(self):\n self.checkbox_online_var = not self.checkbox_online_var",
"def _check_state(self):\n if (self.stock_checker.isChecked() or self.future_checker.isChecked()) and self.name.buddy.text():\n self.btn_ok.setEnabled(True)\n self.btn_ok.setDefault(True)\n ... | [
"0.6375744",
"0.61438805",
"0.6002504",
"0.57452595",
"0.56638986",
"0.563966",
"0.563966",
"0.563966",
"0.5619525",
"0.5601674",
"0.5588646",
"0.5584676",
"0.5536964",
"0.55080086",
"0.5496366",
"0.5466445",
"0.5457843",
"0.54563206",
"0.5426",
"0.5420272",
"0.5392461",
"0... | 0.71248174 | 0 |
F1 metric. Computes the micro_f1 and macro_f1, metrics for multilabel classification of how many relevant items are selected. | def micro_f1(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)), axis=0)
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)), axis=0)
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)), axis=0)
"""Micro_F1 metric.
"""
precision = K.sum(true_positives) / (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f1_score(self):\n self.overall_f1_score = f1_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_f1_score = f1_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)",
"def macro_f1(y_true, y_pr... | [
"0.7080461",
"0.6990739",
"0.68753433",
"0.6874051",
"0.6803589",
"0.68008345",
"0.6744617",
"0.6717685",
"0.66996837",
"0.66817147",
"0.6563985",
"0.65582395",
"0.65173525",
"0.6490318",
"0.6464693",
"0.6453357",
"0.644287",
"0.6411451",
"0.6372281",
"0.6353034",
"0.6341358"... | 0.71423185 | 0 |
r"""Applies weight normalization to a parameter in the given module. | def weight_norm(module, name="weight", dim=0):
WeightNorm.apply(module, name, dim)
return module | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self, module):\n if isinstance(module, (torch.nn.Linear, torch.nn.Embedding, torch.nn.LayerNorm)):\n module.weight.data.normal_(mean=0.0, std=self.initializer_range)\n if isinstance(module, (torch.nn.Linear, torch.nn.LayerNorm)) and module.bias is not None:\n mo... | [
"0.7096624",
"0.69489896",
"0.67758477",
"0.67641747",
"0.67641747",
"0.67641747",
"0.6664136",
"0.66512257",
"0.66180927",
"0.6597774",
"0.6563312",
"0.6533415",
"0.6533415",
"0.6514457",
"0.64933705",
"0.6326802",
"0.63143027",
"0.6313276",
"0.6313276",
"0.6313276",
"0.6305... | 0.758885 | 0 |
Find a group for val and add it there. A group key is calculated by group_by. If no such key exists, a new group is created. If a formatting key was not found for val, | def update(self, val):
try:
key = self._group_by(val)
except lena.core.LenaKeyError:
raise lena.core.LenaValueError(
"could not find a key for {}".format(val)
)
if key in self.groups:
self.groups[key].append(val)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_group(self, _groupby):\n # forces a `__getitem__`, which in turn calls `__missing__`\n # the first time we try to insert a value\n def do_append(key, group):\n self[key].send(group)\n appender = yield from starmap(do_append, _groupby)",
"def add_group(self, key):... | [
"0.62460804",
"0.5931766",
"0.5929217",
"0.5738482",
"0.55488914",
"0.5493878",
"0.53995466",
"0.53692806",
"0.5329505",
"0.524783",
"0.5219613",
"0.51948535",
"0.51936805",
"0.5187539",
"0.5174229",
"0.5158574",
"0.51375973",
"0.5133945",
"0.51203275",
"0.5119256",
"0.508099... | 0.72430766 | 0 |
Computes precise BN stats on training data. | def compute_precise_bn_stats(model, loader):
# Compute the number of minibatches to use
num_iter = min(cfg.BN.NUM_SAMPLES_PRECISE // loader.batch_size, len(loader))
# Retrieve the BN layers
bns = [m for m in model.modules() if isinstance(m, torch.nn.BatchNorm2d)]
# Initialize stats storage
mus =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_bn_stats(\n model: nn.Module,\n loader: DataLoader,\n num_samples: int = 8192,\n logger: Optional[Union[logging.Logger, str]] = None) -> None:\n if is_model_wrapper(model):\n model = model.module\n\n # get dist info\n rank, world_size = mmengine.dist.get_dist_... | [
"0.6554783",
"0.6422349",
"0.63577896",
"0.6318661",
"0.6236532",
"0.6216655",
"0.6173939",
"0.60070693",
"0.59611785",
"0.5951854",
"0.58218586",
"0.5805479",
"0.5786752",
"0.57796615",
"0.57740426",
"0.57325435",
"0.57291657",
"0.571751",
"0.56999123",
"0.5690688",
"0.56904... | 0.6964537 | 0 |
Accumulates complexity of Conv2D into cx = (h, w, flops, params, acts). | def complexity_conv2d(cx, w_in, w_out, k, stride, padding, groups=1, bias=False):
h, w, flops, params, acts = cx["h"], cx["w"], cx["flops"], cx["params"], cx["acts"]
h = (h + 2 * padding - k) // stride + 1
w = (w + 2 * padding - k) // stride + 1
flops += k * k * w_in * w_out * h * w // groups
params... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _conv2d(self, x, W):\n return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')",
"def conv2d(x, W):\r\n return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')",
"def conv2d(x, W):\r\n return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')",
"def conv2d(self, x, W, name=... | [
"0.6674081",
"0.65357906",
"0.65357906",
"0.6412553",
"0.63949925",
"0.63763547",
"0.63763547",
"0.63763547",
"0.63763547",
"0.6368188",
"0.63220304",
"0.6304514",
"0.6286195",
"0.62574595",
"0.6239252",
"0.6231746",
"0.6207097",
"0.62049645",
"0.6193705",
"0.61782473",
"0.61... | 0.6955393 | 0 |
Accumulates complexity of BatchNorm2D into cx = (h, w, flops, params, acts). | def complexity_batchnorm2d(cx, w_in):
h, w, flops, params, acts = cx["h"], cx["w"], cx["flops"], cx["params"], cx["acts"]
params += 2 * w_in
return {"h": h, "w": w, "flops": flops, "params": params, "acts": acts} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def norm2d_cx(cx, w_in):\n h, w, flops, params, acts = cx[\"h\"], cx[\"w\"], cx[\"flops\"], cx[\"params\"], cx[\"acts\"]\n params += 2 * w_in\n return {\"h\": h, \"w\": w, \"flops\": flops, \"params\": params, \"acts\": acts}",
"def batch_norm(self, inputs):\n x = inputs\n x = self.bn(x)\n... | [
"0.6029063",
"0.5916383",
"0.59101087",
"0.58551776",
"0.5815395",
"0.5722043",
"0.5658716",
"0.5597723",
"0.5559726",
"0.55357724",
"0.548931",
"0.54498947",
"0.54247254",
"0.5414501",
"0.53972757",
"0.53680533",
"0.5341699",
"0.53092265",
"0.5289099",
"0.52851355",
"0.52816... | 0.7216221 | 0 |
Accumulates complexity of MaxPool2d into cx = (h, w, flops, params, acts). | def complexity_maxpool2d(cx, k, stride, padding):
h, w, flops, params, acts = cx["h"], cx["w"], cx["flops"], cx["params"], cx["acts"]
h = (h + 2 * padding - k) // stride + 1
w = (w + 2 * padding - k) // stride + 1
return {"h": h, "w": w, "flops": flops, "params": params, "acts": acts} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pool(x):\n return F.max_pool2d(x, 2, 2)",
"def max_pool_2x2(x):\n#{{{\n return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],\n strides=[1, 2, 2, 1], padding='SAME')",
"def max_pool_2x2(x):\r\n return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],\r\n strides=[1, 2, 2, 1], ... | [
"0.7155148",
"0.6751596",
"0.6616057",
"0.6616057",
"0.657513",
"0.65508795",
"0.6531473",
"0.65290457",
"0.6510662",
"0.6510662",
"0.6510662",
"0.6504694",
"0.6453313",
"0.6400681",
"0.6243156",
"0.62162477",
"0.6170596",
"0.613367",
"0.6117203",
"0.6096806",
"0.6074436",
... | 0.68710643 | 1 |
Compute model complexity (model can be model instance or model class). | def complexity(model):
size = cfg.TRAIN.IM_SIZE
cx = {"h": size, "w": size, "flops": 0, "params": 0, "acts": 0}
cx = model.complexity(cx)
return {"flops": cx["flops"], "params": cx["params"], "acts": cx["acts"]} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complexity(self):\n raise NotImplementedError()",
"def model_summary():\n print(\"\\n\")\n print(\"=\" * 30 + \"Model Structure\" + \"=\" * 30)\n model_vars = tf.trainable_variables()\n slim.model_analyzer.analyze_vars(model_vars, print_info=True)\n print(\"=\" * 60 + \"\\n\")",
"def ... | [
"0.6605584",
"0.59366196",
"0.5886446",
"0.56924075",
"0.5661364",
"0.557045",
"0.5560027",
"0.55478823",
"0.5541143",
"0.54775125",
"0.5454639",
"0.54201376",
"0.5385921",
"0.53454864",
"0.5339216",
"0.5318505",
"0.5308675",
"0.5306969",
"0.5279005",
"0.5275013",
"0.5260561"... | 0.7099636 | 0 |
Computes precise model forward test time using dummy data. | def compute_time_eval(model):
# Use eval mode
model.eval()
# Generate a dummy mini-batch and copy data to GPU
im_size, batch_size = cfg.TRAIN.IM_SIZE, int(cfg.TEST.BATCH_SIZE / cfg.NUM_GPUS)
inputs = torch.zeros(batch_size, 3, im_size, im_size).cuda(non_blocking=False)
# Compute precise forward ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test(self):\n with torch.no_grad():\n self.model.eval()\n p10_forecast, p10_forecast, p90_forecast, target = None, None, None, None\n\n t = time()\n for step, sample in enumerate(self.test_loader):\n\n # Hide future predictions from input vector... | [
"0.6510253",
"0.60044163",
"0.59714794",
"0.5950414",
"0.590269",
"0.5864837",
"0.57908577",
"0.5780596",
"0.578044",
"0.57703686",
"0.5736541",
"0.5686347",
"0.56765133",
"0.56763405",
"0.5658642",
"0.5642856",
"0.5615679",
"0.5612191",
"0.5605651",
"0.5584105",
"0.55365753"... | 0.668232 | 0 |
Computes precise model forward + backward time using dummy data. | def compute_time_train(model, loss_fun):
# Use train mode
model.train()
# Generate a dummy mini-batch and copy data to GPU
im_size, batch_size = cfg.TRAIN.IM_SIZE, int(cfg.TRAIN.BATCH_SIZE / cfg.NUM_GPUS)
inputs = torch.rand(batch_size, 3, im_size, im_size).cuda(non_blocking=False)
labels = torc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_time_eval(model):\n # Use eval mode\n model.eval()\n # Generate a dummy mini-batch and copy data to GPU\n im_size, batch_size = cfg.TRAIN.IM_SIZE, int(cfg.TEST.BATCH_SIZE / cfg.NUM_GPUS)\n inputs = torch.zeros(batch_size, 3, im_size, im_size).cuda(non_blocking=False)\n # Compute preci... | [
"0.6410812",
"0.60869324",
"0.60772",
"0.606294",
"0.6041349",
"0.5941731",
"0.59404194",
"0.5881241",
"0.5859137",
"0.58523643",
"0.5727986",
"0.56924284",
"0.56924206",
"0.5689781",
"0.5681081",
"0.56706685",
"0.5642578",
"0.5636248",
"0.5630338",
"0.56215453",
"0.5612816",... | 0.6129935 | 1 |
Sets all model weights from a single flat vector. | def set_flat_weights(model, flat_weights):
k = 0
for p in model.parameters():
n = p.data.numel()
p.data.copy_(flat_weights[k : (k + n)].view_as(p.data))
k += n
assert k == flat_weights.numel() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_weights(self, weights):\r\n self.weights = weights.reshape(self.output_size, self.input_size+1)",
"def set_weights(self, weights):\n self.forcing_term.weights_[:, :] = weights.reshape(*self.forcing_term.shape)",
"def set_weights(self, weights):\n tuples = []\n for layer in self.lay... | [
"0.7298198",
"0.72855574",
"0.7152028",
"0.71171165",
"0.7112108",
"0.7080838",
"0.70481706",
"0.70481706",
"0.70098025",
"0.6777375",
"0.6718739",
"0.67022854",
"0.6671261",
"0.6660021",
"0.66521096",
"0.66359806",
"0.6623057",
"0.6608641",
"0.6599572",
"0.6599149",
"0.65855... | 0.7406195 | 0 |
List of custom hooks to run (their keys/names). | def custom_hooks(self):
return self.config.options(self.CUSTOM_HOOKS_SECTION, []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_custom_hook_names():\n return list(_CUSTOM_HOOKS)",
"def hooks(self):\n return tuple(self.__hooks.keys())",
"def callable_hooks(self):\n for hook in self.custom_hooks:\n options = rh.hooks.HookOptions(hook,\n self.custom_hook(hook),\... | [
"0.81508255",
"0.742941",
"0.74196446",
"0.73603314",
"0.73010254",
"0.7292337",
"0.7292337",
"0.7119414",
"0.7106756",
"0.70132947",
"0.69788814",
"0.69402766",
"0.69025815",
"0.6864048",
"0.681646",
"0.6780301",
"0.66794336",
"0.66784006",
"0.6675118",
"0.6655331",
"0.65509... | 0.7996913 | 1 |
List of all enabled builtin hooks (their keys/names). | def builtin_hooks(self):
return [k for k, v in self.config.items(self.BUILTIN_HOOKS_SECTION, ())
if rh.shell.boolean_shell_value(v, None)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_custom_hook_names():\n return list(_CUSTOM_HOOKS)",
"def hooks(self):\n return tuple(self.__hooks.keys())",
"def all_builtins():\n return (p for p in plugin.plugins.values() if p.builtin)",
"def get_extra_lvs_hooks(self) -> List[HammerToolHookAction]:\n return list()",
"def get_... | [
"0.74387103",
"0.7353622",
"0.73356843",
"0.7216453",
"0.71656626",
"0.7094143",
"0.6979044",
"0.6979044",
"0.69187975",
"0.6865903",
"0.685299",
"0.6780199",
"0.6749223",
"0.6656279",
"0.6598797",
"0.65129423",
"0.6498798",
"0.6476067",
"0.64752567",
"0.6466376",
"0.64492714... | 0.83364797 | 0 |
List of all tool paths. | def tool_paths(self):
return dict(self.config.items(self.TOOL_PATHS_SECTION, ())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toolpaths_list(self) -> List[dict]:\n self.__logger.debug('Eva.toolpaths_list called')\n return self.__http_client.toolpaths_list()",
"def get_tools() -> List[Dict[str, Any]]:\n tools = []\n with os.scandir(PHP_TOOL_PATH) as it:\n for item in it:\n if not item.name.start... | [
"0.82778263",
"0.7157282",
"0.707213",
"0.6871132",
"0.6798026",
"0.6771085",
"0.67286545",
"0.67038876",
"0.6575302",
"0.65571517",
"0.6528214",
"0.6506476",
"0.6506476",
"0.6461473",
"0.6440759",
"0.6396947",
"0.6390025",
"0.63817215",
"0.63775754",
"0.6366696",
"0.63199776... | 0.7676587 | 1 |
Yield a name and callback for each hook to be executed. | def callable_hooks(self):
for hook in self.custom_hooks:
options = rh.hooks.HookOptions(hook,
self.custom_hook(hook),
self.tool_paths)
yield (hook, functools.partial(rh.hooks.check_custom,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hookregistry():\n registry = HookRegistry()\n yield registry",
"def call_hook(self, hook, *args, **kwargs):\n for function in self.hooks[hook]:\n function.__call__(*args, **kwargs)",
"def __call__(self, *args, **kwargs):\n for hook in self:\n logger.debug(f\"Execut... | [
"0.7204379",
"0.67144656",
"0.6692465",
"0.64337873",
"0.634387",
"0.6337482",
"0.6297489",
"0.62168694",
"0.6183158",
"0.61628264",
"0.6082764",
"0.60385525",
"0.6016945",
"0.6010944",
"0.6002328",
"0.5955463",
"0.58322287",
"0.57768565",
"0.57552737",
"0.5739468",
"0.570310... | 0.7635109 | 0 |
Whether to skip hooks for merged commits. | def ignore_merged_commits(self):
return rh.shell.boolean_shell_value(
self.config.get(self.OPTIONS_SECTION,
self.OPTION_IGNORE_MERGED_COMMITS, None),
False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strategy_supports_no_merge_call():\n if not distribute_lib.has_strategy():\n return True\n strategy = distribute_lib.get_strategy()\n return not strategy.extended._use_merge_call() # pylint: disable=protected-access",
"def process_hooks(self, hooks):\n try:\n enabled_hooks = self.pro... | [
"0.6048273",
"0.6040354",
"0.57877344",
"0.5701615",
"0.5652187",
"0.5637277",
"0.55973953",
"0.55972683",
"0.5582864",
"0.55575055",
"0.55173683",
"0.5491309",
"0.5457858",
"0.5450925",
"0.5440673",
"0.5425741",
"0.5364287",
"0.5357948",
"0.5338182",
"0.532124",
"0.5304539",... | 0.7036875 | 0 |
for a list of words, return a list of target words >>>target_words = ['slow', 'quick', 'yellow', 'loud', 'hard'] >>>wwm = word_to_words_matcher() >>>wwm.build(target_words) >>>wwm.predict(target_words) >>>wwm.predict(['rigid','stiff']).tolist() | def predict(self,words):
vector_array = self.get_vector_array(words)
clusterind = self.clusterer.predict(vector_array)
return self.target_tokens[clusterind].tolist() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_word_to_words_matcher(self):\n import nltk\n from nltk.corpus import wordnet\n from collections import defaultdict\n target_words = ['slow', 'quick', 'yellow', 'loud', 'hard']\n wwm = word_to_words_matcher()\n wwm.build(target_words)\n\n wwm.predict(target_... | [
"0.7434455",
"0.6355531",
"0.63237256",
"0.6303343",
"0.62572414",
"0.61942506",
"0.619025",
"0.61035055",
"0.606427",
"0.6019503",
"0.60166985",
"0.60114914",
"0.5974415",
"0.59729433",
"0.594172",
"0.5935629",
"0.59291464",
"0.5916087",
"0.59096605",
"0.5903366",
"0.5896115... | 0.6516791 | 1 |
Generic chaining function for third derivative | def chain_3(d3f_dg3, dg_dx, d2f_dg2, d2g_dx2, df_dg, d3g_dx3):
if np.all(dg_dx==1.) and np.all(d2g_dx2==0) and np.all(d3g_dx3==0):
return d3f_dg3
dg_dx_3 = np.clip(dg_dx, -np.inf, _lim_val_cube)**3
return d3f_dg3*(dg_dx_3) + 3*d2f_dg2*dg_dx*d2g_dx2 + df_dg*d3g_dx3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chain_3(d3f_dg3, dg_dx, d2f_dg2, d2g_dx2, df_dg, d3g_dx3):\r\n return d3f_dg3*(dg_dx**3) + 3*d2f_dg2*dg_dx*d2g_dx2 + df_dg*d3g_dx3",
"def Derivative(self, *args):\n return _Adaptor3d.Adaptor3d_InterFunc_Derivative(self, *args)",
"def chain_1(df_dg, dg_dx):\r\n return df_dg * dg_dx",
"def cha... | [
"0.66135144",
"0.60402095",
"0.59228766",
"0.5795447",
"0.56727415",
"0.565194",
"0.55889356",
"0.55303663",
"0.54464394",
"0.5430472",
"0.53882045",
"0.53733414",
"0.5372374",
"0.53384584",
"0.53262234",
"0.5324828",
"0.529189",
"0.5279793",
"0.5256373",
"0.5229483",
"0.5204... | 0.61131805 | 1 |
Creates a Ddimensional grid of n linearly spaced points | def linear_grid(D, n = 100, min_max = (-100, 100)):
g = np.linspace(min_max[0], min_max[1], n)
G = np.ones((n, D))
return G*g[:,None] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_grid(N):\n\n x = np.linspace(-2. , 2 , N)\n y = np.linspace(-2. , 2 , N)\n # two evenly spaced grids from -2 to 2\n\n return x, y",
"def linear_grid(D, n = 100, min_max = (-100, 100)):\r\n\r\n g = np.linspace(min_max[0], min_max[1], n)\r\n G = np.ones((n, D))\r\n\r\n return G*g[:,No... | [
"0.76228786",
"0.75158966",
"0.7254434",
"0.69516516",
"0.69320124",
"0.68234044",
"0.6809387",
"0.67894524",
"0.66963047",
"0.6670365",
"0.6624484",
"0.6593824",
"0.6564381",
"0.65498596",
"0.6515209",
"0.6436385",
"0.63669217",
"0.6316191",
"0.63046896",
"0.62997156",
"0.62... | 0.7520031 | 1 |
Set the start month for certificates | def set_start_month(self, month):
return self.form.set_value("output period \"month from\"", MONTHS[month - 1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_fiscal_year_start_month(self, fiscal_year_start_month):\n self.fiscal_year_start_month = fiscal_year_start_month",
"def set_start_date(self, date):\n pass",
"def start_date(self, start_date):\n if start_date is None:\n start_date = datetime.now() - timedelta(days=365)\n\... | [
"0.7083649",
"0.6475777",
"0.62166417",
"0.62127465",
"0.6202509",
"0.61114717",
"0.604339",
"0.60405225",
"0.5998758",
"0.5998758",
"0.5998758",
"0.5998758",
"0.5998758",
"0.5998758",
"0.5998758",
"0.5998758",
"0.5998758",
"0.598781",
"0.59236807",
"0.5921077",
"0.58853763",... | 0.7003562 | 1 |
Set the finish month for certificates | def set_finish_month(self, month):
return self.form.set_value("output period \"month to\"", MONTHS[month - 1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_month(self, month: int, year: int, bill: Bill) -> None:\n self.bill = bill\n self.bill.set_rates(\"TERM\", TERM_MINS_COST)\n self.bill.add_fixed_cost(TERM_MONTHLY_FEE)\n if not ((self.end.month < month and self.end.year <= year) or\n self.end.year < year):\n ... | [
"0.61762846",
"0.61280257",
"0.60646594",
"0.5875881",
"0.5733086",
"0.5729553",
"0.5658201",
"0.5614031",
"0.5562677",
"0.5558146",
"0.5543753",
"0.54753804",
"0.545213",
"0.5451844",
"0.54499245",
"0.54149026",
"0.541394",
"0.5410662",
"0.54101086",
"0.54056174",
"0.5387887... | 0.7110114 | 0 |
Set the start year for certificates | def set_start_year(self, year):
return self.form.set_value("output period \"year from\"", str(year)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_start_year(self, model_start_year):\n\n self._model_start_year = model_start_year",
"def set_year (self, year):\n self.year = year",
"def setYear(self, *args):\n return _libsbml.Date_setYear(self, *args)",
"def set_year(self, year: int) -> None:\n if year <= 0:\n ... | [
"0.7174779",
"0.716286",
"0.70799214",
"0.68041897",
"0.6799202",
"0.67519015",
"0.6745669",
"0.67243755",
"0.66998297",
"0.6649117",
"0.6583277",
"0.642255",
"0.64148694",
"0.6351808",
"0.6208147",
"0.60659236",
"0.6064516",
"0.60400736",
"0.60352993",
"0.60085285",
"0.59844... | 0.7810913 | 0 |
Set the finish year for certificates | def set_finish_year(self, year):
return self.form.set_value("output period \"year to\"", str(year)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_year(self, year) -> bool:\n if self.set_start_year(year) is False:\n return False\n return self.set_finish_year(year)",
"def model_end_year(self, model_end_year):\n\n self._model_end_year = model_end_year",
"def set_year (self, year):\n self.year = year",
"def ... | [
"0.6419942",
"0.63630605",
"0.632141",
"0.6252914",
"0.6235252",
"0.61699986",
"0.6077197",
"0.59497935",
"0.5931477",
"0.58752584",
"0.58316076",
"0.5808241",
"0.579241",
"0.5777016",
"0.5702537",
"0.55938476",
"0.5561803",
"0.5552052",
"0.55244976",
"0.55239034",
"0.5521176... | 0.73293865 | 0 |
Filter certificates by technology group | def filter_technology(self, what):
return self.form.set_value('technology group', what) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filter_device_group(self):\n pass",
"def filterData(records):\n def isInteresting(record):\n if record[VO_ISSUER] in ('/DC=ch/DC=cern/OU=computers/CN=voms.cern.ch', '/DC=ch/DC=cern/OU=computers/CN=lcg-voms.cern.ch'):\n return True\n if record[VO_NAME] in ('atlas', 'cms... | [
"0.5686095",
"0.51378906",
"0.5014018",
"0.4964923",
"0.49624494",
"0.4930452",
"0.48846352",
"0.48791942",
"0.48785123",
"0.47814336",
"0.46958083",
"0.46906593",
"0.46865487",
"0.46798941",
"0.46736392",
"0.46721274",
"0.466348",
"0.46305785",
"0.4598265",
"0.45934573",
"0.... | 0.59199756 | 0 |
Filter certificates by generation type | def filter_generation_type(self, what):
return self.form.set_value('generation type', what) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def certificates(self):\n if self.user.is_superuser:\n return Certificate.objects.all()\n else:\n return Certificate.objects.filter(licensee__in=self.licensees.all())",
"def get_queryset(self):\n user = self.request.user\n return Certificate.objects.filter(owner=... | [
"0.52752507",
"0.5224373",
"0.51097304",
"0.5018499",
"0.49534738",
"0.4901122",
"0.48837742",
"0.48649216",
"0.48649216",
"0.48644254",
"0.48270026",
"0.4826546",
"0.4820408",
"0.4801919",
"0.47983828",
"0.47905505",
"0.4761726",
"0.47570202",
"0.47563046",
"0.4679938",
"0.4... | 0.5279305 | 0 |
Filter certificates by generator id (accreditation number). | def filter_generator_id(self, acc_no):
return self.form.set_value('accreditation no', acc_no.upper()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_generator_id(self, accno):\n return self.form.set_value(\"accreditation search\", accno)",
"def get_queryset(self):\n user = self.request.user\n return Certificate.objects.filter(owner=user)",
"def certificates(self):\n if self.user.is_superuser:\n return Certi... | [
"0.62953",
"0.5367165",
"0.52554405",
"0.51241887",
"0.49865824",
"0.49212256",
"0.48709646",
"0.46776897",
"0.46363014",
"0.46247968",
"0.45851558",
"0.45139134",
"0.4512963",
"0.45019916",
"0.45005128",
"0.44980755",
"0.44714746",
"0.44683418",
"0.44609725",
"0.44483426",
"... | 0.5981732 | 1 |
Generator that returns a Return a list of stations related to the certificates | def stations(self):
for stat in sorted(self.station_records):
yield self.station_records[stat] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stations():\n\n return station_list",
"def station_list() -> List[Dict]:\n return STATIONS",
"def stations():\r\n for row in rows():\r\n yield tuple(row)",
"def getStations(self) :\n return self._stations",
"def collect_stations(self):\n # First, iterate provinces and buil... | [
"0.6709372",
"0.64456254",
"0.6285379",
"0.58896387",
"0.5830136",
"0.58108586",
"0.5736853",
"0.54899895",
"0.5479725",
"0.5451379",
"0.54355764",
"0.54263633",
"0.5424569",
"0.5419757",
"0.5401877",
"0.5388686",
"0.537183",
"0.53597116",
"0.53305775",
"0.53091675",
"0.53089... | 0.67234486 | 0 |
Set both the start and finish year for certificates. | def _set_year(self, year) -> bool:
if self.set_start_year(year) is False:
return False
return self.set_finish_year(year) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setYear(self, *args):\n return _libsbml.Date_setYear(self, *args)",
"def set_year (self, year):\n self.year = year",
"def set_start_year(self, year):\n return self.form.set_value(\"output period \\\"year from\\\"\", str(year))",
"def set_finish_year(self, year):\n return self.... | [
"0.6859456",
"0.6689481",
"0.6548196",
"0.65382427",
"0.64009875",
"0.6388287",
"0.6356327",
"0.62098986",
"0.61887354",
"0.618363",
"0.6159197",
"0.61268514",
"0.6081075",
"0.57858837",
"0.5760051",
"0.55687064",
"0.5563812",
"0.54884493",
"0.54884493",
"0.54884493",
"0.5472... | 0.67245466 | 1 |
len(...) returns the number of stations available. | def __len__(self):
return len(self.stations) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNbStations(self) :\n return len(self._stations)",
"def getNrStations(self):\n return len(self.stationData)",
"def num_stations(self) -> int:\n return self._num_stations",
"def get_num_streets(market):\r\n return len(market)",
"def get_num_stations(add):\r\n name=get_zipcod... | [
"0.7492692",
"0.7202965",
"0.7185709",
"0.66710705",
"0.66124904",
"0.65629065",
"0.65629065",
"0.65629065",
"0.649789",
"0.6461219",
"0.6439922",
"0.64366007",
"0.64089525",
"0.6401535",
"0.6386784",
"0.63589084",
"0.63574255",
"0.6357091",
"0.63306606",
"0.63282835",
"0.632... | 0.7843997 | 0 |
Filter stations based on name. The search will return all stations containing the supplied name. | def filter_name(self, name):
return self.form.set_value("generating station search", name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_by_name(self, name):\n for station in self.stations:\n if name.lower() in station.stationname.lower():\n return station\n\n print(str.format(\"Could not find station with name '{0}'\", name))",
"def search_by_name(self, name):\r\n return self.__filter(se... | [
"0.7011877",
"0.6723853",
"0.6520272",
"0.6080978",
"0.60456336",
"0.6042563",
"0.5951579",
"0.590254",
"0.5863565",
"0.5847021",
"0.56821316",
"0.5674226",
"0.56469357",
"0.56359357",
"0.56311",
"0.55817884",
"0.5569548",
"0.5542532",
"0.55174375",
"0.5508504",
"0.5496334",
... | 0.7042624 | 0 |
Debugging page for creating a dummy play | def dummy():
play = Play(artist = "Artist", album_artist = "Album Artist", album = "Album", title = "Title", user = users.get_current_user())
play.put()
print(datetime.datetime.now())
print(play.time)
print(play.time.hour)
return "Success" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_plays_get(self):\n pass",
"def play_page():\n session.permanent = True\n if 'tracks' not in session:\n session['tracks'] = {}\n if 'id' not in session:\n session['id'] = uuid4().int\n return app.send_static_file('play.html')",
"def play(request):\r\n ttt = TicTacToe... | [
"0.652852",
"0.6104245",
"0.60467625",
"0.6006113",
"0.59926593",
"0.5935459",
"0.59020776",
"0.5896085",
"0.5852527",
"0.5824335",
"0.5823279",
"0.58127356",
"0.5766469",
"0.5755603",
"0.5708845",
"0.568005",
"0.5673123",
"0.56625295",
"0.56553173",
"0.5648031",
"0.563687",
... | 0.6552439 | 0 |
Acquire the lock. If the lock can't be acquired immediately, retry a specified number of times, with a specified wait time. | def acquire(self):
retries = [0]
self._acquire_start_seconds = self._reactor.seconds()
def log_lock_acquired(result):
self._lock_acquired_seconds = self._reactor.seconds()
seconds = self._lock_acquired_seconds - self._acquire_start_seconds
self._log.msg('Acqu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_lock_acquire(lock):\n\tlogging.debug('Starting')\n\tfor i in range(2):\n\t\ttime.sleep(0.5)\n\t\tlogging.debug('Trying to acquire')\n\n\t\t\"\"\".acqire() returns false if the timeout passed in has elapsed.\"\"\"\n\t\thave_it = lock.acquire(0)\n\t\ttry:\n\t\t\tif have_it:\n\t\t\t\t\"\"\" only one thread wi... | [
"0.72159404",
"0.7038874",
"0.6986053",
"0.63417274",
"0.6330585",
"0.6322539",
"0.6309454",
"0.62400013",
"0.6200018",
"0.61961895",
"0.61753875",
"0.6166814",
"0.6085544",
"0.6082737",
"0.6062204",
"0.6025323",
"0.5951601",
"0.5925638",
"0.5922272",
"0.5910791",
"0.58708763... | 0.7393543 | 0 |
Get the lane heading at a given longitudinal lane coordinate. | def heading_at(self, longitudinal: float) -> float:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_heading_along_route(self, route: Route, longitudinal: float, lateral: float) \\\n -> Tuple[np.ndarray, float]:\n\n while len(route) > 1 and longitudinal > self.get_lane(route[0]).length:\n longitudinal -= self.get_lane(route[0]).length\n route = route[1:]\n\n ... | [
"0.68570274",
"0.6411223",
"0.6229055",
"0.62190783",
"0.6213609",
"0.61929053",
"0.6123263",
"0.6044675",
"0.6044675",
"0.60054857",
"0.59418863",
"0.5905814",
"0.5870294",
"0.5870294",
"0.58232576",
"0.58138525",
"0.58103323",
"0.580154",
"0.56709087",
"0.5579937",
"0.55125... | 0.71446353 | 0 |
Whether a given world position is on the lane. | def on_lane(self,
position: np.ndarray,
longitudinal: float = None,
lateral: float = None,
margin: float = 0) -> bool:
if not longitudinal or not lateral:
longitudinal, lateral = self.local_coordinates(position)
return np.abs(l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_reach(self, position: tuple) -> bool:\n x = position[0]\n y = position[1]\n dist_to_shoulder = math.sqrt(x**2 + y**2)\n max_dist = self.bicep_length + self.forearm_length\n if dist_to_shoulder > max_dist:\n return False\n return True",
"def _is_valid_l... | [
"0.67187107",
"0.6603079",
"0.6420876",
"0.63983667",
"0.6354372",
"0.6285472",
"0.627441",
"0.6240657",
"0.6235772",
"0.6234093",
"0.62326586",
"0.6221681",
"0.6185796",
"0.6181252",
"0.61717224",
"0.61404264",
"0.61356753",
"0.6125642",
"0.61218387",
"0.6104374",
"0.6088298... | 0.71192163 | 0 |
Whether the lane is reachable from a given world position | def is_reachable_from(self, position: np.ndarray) -> bool:
s, r = self.local_coordinates(position)
return 0 <= s < self.length + CAR_LENGTH and np.abs(r) <= 2 * self.width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_reach(self, position: tuple) -> bool:\n x = position[0]\n y = position[1]\n dist_to_shoulder = math.sqrt(x**2 + y**2)\n max_dist = self.bicep_length + self.forearm_length\n if dist_to_shoulder > max_dist:\n return False\n return True",
"def goal_occupi... | [
"0.69188195",
"0.64880306",
"0.64444655",
"0.64380383",
"0.6386515",
"0.63721955",
"0.6336067",
"0.6315577",
"0.6303339",
"0.6303339",
"0.6303339",
"0.62764513",
"0.62495667",
"0.6246161",
"0.61925274",
"0.61626583",
"0.6147806",
"0.6112186",
"0.6112106",
"0.61057127",
"0.605... | 0.7499413 | 0 |
visualize the result of dimension reduction by ISOmap or MDS | def dimension_reduce_visualize(X,labels,flag_3d=False):
labels_dict = {}
for i in range(len(labels)):
if labels[i] in labels_dict:
labels_dict[labels[i]].append(i)
else:
labels_dict[labels[i]] = [i]
traces = []
for label in labels_dict:
if flag_3d == 'Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualize_svd():",
"def compute_visuals(self):\n pass",
"def test_visualize(local_registry, dask_array):\n q = local_registry.Quantity(dask_array, units_)\n\n comps = add_five(local_registry, q)\n res = comps.visualize()\n\n assert res is None\n # These commands only work on Unix and ... | [
"0.6315989",
"0.62353224",
"0.6230941",
"0.61221904",
"0.59742075",
"0.5963729",
"0.593722",
"0.59211844",
"0.5876837",
"0.58332545",
"0.58025664",
"0.5795848",
"0.5767392",
"0.5757078",
"0.57543606",
"0.5733783",
"0.5727038",
"0.5686295",
"0.56836176",
"0.5674932",
"0.563969... | 0.6415424 | 0 |
Downloads web data and writes it to a file | def download (url):
path, url = url
r = requests.get (url, stream = True)
content = r.text
#print (content)
with open (path + '.txt', 'w') as f:
f.write (content) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(self, url):\n try:\n webFile = urllib.urlopen(url)\n localFile = open(self.workdir + \"/\" + url.split('/')[-1], 'w')\n localFile.write(webFile.read())\n webFile.close()\n localFile.close()\n except IOError:\n print(\"coul... | [
"0.7657589",
"0.7293613",
"0.7291564",
"0.7277285",
"0.72701293",
"0.7107575",
"0.71018064",
"0.7086054",
"0.70423007",
"0.70147276",
"0.6898912",
"0.68840075",
"0.6865691",
"0.6852597",
"0.6811777",
"0.6791737",
"0.6786761",
"0.67820966",
"0.67811334",
"0.6775394",
"0.675657... | 0.73934907 | 1 |
Pulls height values from the lidar data from ice locations within the radar data, appending the heights to an ice list Returns None. | def pull_heights ():
global ice
ice = []
for i in range (len (radar_clean)):
for j in range (len (radar_clean)):
radar_clean [i][j] = lidar_clean [i][j]
#print (radar_clean [i][j])
if (radar_clean [i][j]) > 100:
#print (radar_clean [i][j])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHeights(self):\n if self.heights: return self.heights\n reader = self.getReader()\n subData = reader.findSubRecord('VHGT','LAND')\n if not subData: return None\n height0 = struct.unpack('f',subData[:4])[0]\n import array\n deltas = array.array('b',subData[4:4... | [
"0.65517515",
"0.5756234",
"0.57528067",
"0.5685759",
"0.5587718",
"0.52702695",
"0.5251656",
"0.5227739",
"0.51492643",
"0.51358956",
"0.5129739",
"0.50837463",
"0.50811785",
"0.5061865",
"0.4968986",
"0.49256042",
"0.48158374",
"0.47840145",
"0.47839153",
"0.47371757",
"0.4... | 0.71224654 | 0 |
Generates two figures simultaneously displaying lidar and radar input datasets. Figures will appear in individual popup windows. Returns None. | def show_graphs ():
plt.ylim = (0, 300)
plt.xlim = (0, 300)
#Set up lidar plot to figure 1
lidar_plot = plt.figure (1)
#Assign title
plt.title ('Lidar data')
#Assign data
plt.imshow (lidar_clean)
#Set up radar plot to figure 2
radar_plot = plt.figure (2)
#Assign title
plt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n save = False\n show = True\n\n #hd_parameter_plots = HDparameterPlots(save=save)\n #hd_parameter_plots.flow_parameter_distribution_for_non_lake_cells_for_current_HD_model()\n #hd_parameter_plots.flow_parameter_distribution_current_HD_model_for_current_HD_model_reprocessed_without_lake... | [
"0.6485638",
"0.6264387",
"0.62268615",
"0.621223",
"0.6163923",
"0.604711",
"0.5990099",
"0.5959995",
"0.5891323",
"0.58578455",
"0.58475906",
"0.58352965",
"0.5828015",
"0.58084714",
"0.58035195",
"0.5782315",
"0.5769838",
"0.5732438",
"0.57267797",
"0.5714267",
"0.57075095... | 0.6758527 | 0 |
Generates the program results, calculates towability and disables the results button postexecution Returns None. | def show_results ():
#Total volume
vol = tkinter.Label\
(text= ("Total volume: " + str (ice_volume) + " m\u00b2"))
vol.pack ()
#Total mass
mass = tkinter.Label\
(text= ("Total mass: " + str (ice_mass) + " kg"))
mass.pack ()
#Towability
print ("Calculating towability")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_grading(self, results):\n if self.submission_metadata:\n allowed, output = self._submission_allowed()\n results.set_output(output)\n if not allowed:\n results.hide_everything()",
"def post_result(self, halt_on_failure=False):\n self.api.m.perf_d... | [
"0.6363727",
"0.6291697",
"0.6267638",
"0.59205866",
"0.5887012",
"0.58282125",
"0.57326597",
"0.5716473",
"0.5694743",
"0.5655908",
"0.5615384",
"0.5597997",
"0.55823416",
"0.55775625",
"0.5566849",
"0.5559864",
"0.5540183",
"0.55014646",
"0.5490965",
"0.5470243",
"0.5467598... | 0.63014406 | 1 |
Initialize web3 and coins. | def __init__(self):
load_dotenv()
mnemonic_phrase = os.getenv(
"MNEMONIC", "soccer cousin badge snow chicken lamp soft note ugly crouch unfair biology symbol control heavy")
# initialize w3
self.w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545"))
# support PoA algo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_ocean(web3, account=None):\n ocn = Ocean()\n token_contract = deploy_contract(web3, account, 'OceanToken')\n ContractHandler.set('OceanToken', token_contract)\n ContractHandler.set('DIDRegistry', deploy_contract(web3, account, 'DIDRegistry'))\n ContractHandler.set('OceanMarket',\n ... | [
"0.6158826",
"0.5960341",
"0.5893339",
"0.5886047",
"0.56138134",
"0.5595925",
"0.55651367",
"0.5531933",
"0.54997146",
"0.5474313",
"0.5473954",
"0.5382798",
"0.5315007",
"0.5250126",
"0.5250027",
"0.52201295",
"0.52170783",
"0.51888514",
"0.5166536",
"0.51658636",
"0.515719... | 0.7503984 | 0 |
Return prepared transaction for coin and account. | def create_tx(self, coin, account, to, amount):
if coin is ETH:
gasEstimate = self.w3.eth.estimateGas(
{"from": account.address, "to": to, "value": amount}
)
return {
"from": account.address,
"to": to,
"value": s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tx(coin, account, recipient, amount):\n if coin ==ETH:\n gasEstimate = w3.eth.estimateGas(\n {\"from\": account.address, \"to\": recipient, \"value\": amount})\n return{\n \"to\": recipient,\n \"from\": account.address,\n \"value\": amount,\n ... | [
"0.74350524",
"0.67146766",
"0.6600321",
"0.65091795",
"0.6476258",
"0.64278823",
"0.63780105",
"0.6339197",
"0.62772506",
"0.61485475",
"0.6107418",
"0.60826004",
"0.59362245",
"0.58952457",
"0.5878666",
"0.58291197",
"0.5810224",
"0.58087635",
"0.57529116",
"0.5734624",
"0.... | 0.77845055 | 0 |
Free any resources associated with the given spider | def close_spider(self, spider):
assert spider in self.sites, "Spider not opened: %s" % spider
site = self.sites.get(spider)
site.closing = defer.Deferred()
site.cancel_request_calls()
self._process_queue(spider)
return site.closing | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_spider(self, spider):\n self.curr.close()\n self.connection_utils.close_connection(self.conn)",
"def cleanupResources():\n None",
"def dm_teardown(self):\n try:\n dispatcher.disconnect(\n self.dequeue_next_page_requests,\n signal=signals.... | [
"0.69849163",
"0.64308953",
"0.6341883",
"0.6316706",
"0.61720514",
"0.6065447",
"0.60483575",
"0.60290384",
"0.59920996",
"0.59612775",
"0.59233016",
"0.58336556",
"0.5832016",
"0.5832016",
"0.5832016",
"0.57897323",
"0.5746283",
"0.570645",
"0.5673132",
"0.56568044",
"0.563... | 0.66202503 | 1 |
Test generating delays with experiment options. | def test_gen_delays(self):
min_freq = 1e6
max_freq = 50e6
exp = StarkRamseyXY(
physical_qubits=[0],
stark_amp=0.1,
min_freq=min_freq,
max_freq=max_freq,
)
test_delays = exp.delays()
ref_delays = np.arange(0, 1 / min_freq, 1 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simulationTwoDrugsDelayedTreatment():\n\n # TODO",
"def test_delay(self):\n model = BDF(debug=False)\n node1, c1, t1 = 100, 3, 0.3\n node2, c2, t2 = 101, 4, 0.4\n sid = 42\n card_lines = ['DELAY', sid, node1, c1, t1, node2, c2, t2]\n model.add_card(card_lines, car... | [
"0.63151807",
"0.62265396",
"0.61583215",
"0.60993654",
"0.6087559",
"0.60214984",
"0.59776026",
"0.59776026",
"0.59776026",
"0.59776026",
"0.5976127",
"0.5970612",
"0.59562224",
"0.59161735",
"0.588575",
"0.5855777",
"0.58485854",
"0.58361363",
"0.58350307",
"0.5834983",
"0.... | 0.6567276 | 0 |
Samples a pair of logits, and computes loss and metrics. | def loss_and_metrics_one_pair(self, params, rng):
key_pq, key_samples = jax.random.split(rng)
p_logits, q_logits = self.logit_pair_distribution_fn(key_pq)
def sample_loss(key_sample):
"""Computes loss for a single sample of a relaxed pair of outcomes."""
q_kwargs = dict(transpose=True) if self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def experiment2(trials=100):\n scatter(*transpose([map(lambda xs:mean(map(log,xs)),experiment2_()) for i in trange(trials)]))",
"def _pairwise_loss(self, pairwise_logits):\n raise NotImplementedError('Calling an abstract method.')",
"def mean_squared_log_error(y_true, y_pred, *, sample_weight=..., multio... | [
"0.605809",
"0.5935073",
"0.58854437",
"0.5849769",
"0.57563514",
"0.565485",
"0.56086004",
"0.55222446",
"0.55202734",
"0.5481702",
"0.54713726",
"0.5458737",
"0.54551506",
"0.5431097",
"0.54302096",
"0.5427748",
"0.54136986",
"0.5410963",
"0.54103875",
"0.54000944",
"0.5399... | 0.65059406 | 0 |
Helper to build a joint sampler function for the model. | def build_sampler(self, params):
def sampler(logits_1, logits_2, key):
q_kwargs = dict(transpose=True) if self.use_transpose else {}
x = self.model.bind(params).sample(logits_1, key)
y = self.model.bind(params).sample(logits_2, key, **q_kwargs)
return jnp.zeros([10, 10]).at[x, y].set(1.)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _construct_train_joint(self):\n # setup some symbolic variables for theano to deal with\n xi = T.matrix()\n xo = T.matrix()\n br = T.lscalar()\n # collect the outputs to return from this function\n outputs = [self.joint_cost, self.nll_cost, self.kld_cost, \\\n ... | [
"0.6211532",
"0.55625427",
"0.55612224",
"0.5531557",
"0.5493008",
"0.5374742",
"0.5345863",
"0.5329224",
"0.52714133",
"0.5271356",
"0.5167526",
"0.5120441",
"0.5095912",
"0.50952464",
"0.5068104",
"0.5041663",
"0.50321555",
"0.50196314",
"0.50132215",
"0.4980108",
"0.497969... | 0.70090085 | 0 |
Computes couplings for a collection of experiments. All experiments should have the same logit_pair_distribution_fn. | def get_coupling_estimates(experiments,
results,
seed,
logits_1=None,
logits_2=None,
num_joint_samples=10_000_000,
logit_kwargs=None):
logits_key, vis_key =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_coupling_losses(experiments, logits_1, logits_2,\n estimated_couplings):\n test_losses = {}\n for name, coupling in estimated_couplings.items():\n loss_value = jnp.sum(\n coupling * experiments[0].coupling_loss_matrix_fn(logits_1, logits_2))\n test_losses[name]... | [
"0.61248034",
"0.6036888",
"0.59975713",
"0.5613673",
"0.53036046",
"0.5283286",
"0.52826214",
"0.52768475",
"0.5256234",
"0.522982",
"0.5218015",
"0.52112806",
"0.51216614",
"0.5091342",
"0.50708973",
"0.5048608",
"0.50277084",
"0.50267684",
"0.49827257",
"0.4974505",
"0.496... | 0.68691695 | 0 |
Estimate losses for each experiment. All experiments should have the same coupling_loss_matrix_fn. | def compute_coupling_losses(experiments, logits_1, logits_2,
estimated_couplings):
test_losses = {}
for name, coupling in estimated_couplings.items():
loss_value = jnp.sum(
coupling * experiments[0].coupling_loss_matrix_fn(logits_1, logits_2))
test_losses[name] = loss_val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_losses(self):\n cycle_consistency_loss_a = \\\n self._lambda_a * losses.cycle_consistency_loss(\n real_images=self.input_a, generated_images=self.cycle_images_a,\n )\n cycle_consistency_loss_b = \\\n self._lambda_b * losses.cycle_consistency... | [
"0.66265893",
"0.6330247",
"0.62920225",
"0.6135106",
"0.6135106",
"0.6072551",
"0.601146",
"0.60057414",
"0.5969181",
"0.5917119",
"0.5907043",
"0.59022623",
"0.58908814",
"0.5876948",
"0.5820022",
"0.5808756",
"0.58082795",
"0.57900095",
"0.57855034",
"0.5782424",
"0.578114... | 0.70157397 | 0 |
Helper function to both compute couplings and visualize them. | def compute_and_visualize_coupling_experiments(experiments, results, seed,
**kwargs):
(logits_1,
logits_2), couplings = get_coupling_estimates(experiments, results, seed,
**kwargs)
test_losses = compute_coupling_losse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualize_coupling_experiments(loss_values, logits_1, logits_2, couplings):\n ncols = 2 + len(couplings)\n _, axs = plt.subplots(nrows=1, ncols=ncols, figsize=(4 * ncols, 4))\n axs[0].imshow(jnp.exp(logits_1)[:, None], vmin=0)\n axs[1].imshow(jnp.exp(logits_2)[None, :], vmin=0)\n for j, (name, coupling) i... | [
"0.6304147",
"0.60089594",
"0.5939836",
"0.57586855",
"0.57543457",
"0.5744566",
"0.5598566",
"0.5583795",
"0.5578644",
"0.5577272",
"0.55660135",
"0.55334276",
"0.55091953",
"0.5506413",
"0.5498147",
"0.5457946",
"0.54557765",
"0.5421681",
"0.542055",
"0.5348615",
"0.5303648... | 0.62751156 | 1 |
Helper function to evaluate all experiments and baselines. | def evaluate_all(experiments,
results,
seed,
num_pairs,
samples_per_pair,
loop_size=None):
eval_results = evaluate_baselines(
experiments[0], seed, num_pairs, samples_per_pair, loop_size=None)
for ex, res in zip(experiments, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_experiments():\n elo_explain_experiments()\n alpha_beta_experiments()\n mtcs_experiments()",
"def run_experiments():\r\n result = eval_strategy_range(always_roll, 1, 10)\r\n print('Best always_roll strategy:', result)\r\n\r\n if True: # Change to True when ready to test make_comeback_st... | [
"0.6680169",
"0.65234303",
"0.63890356",
"0.6362374",
"0.6288215",
"0.6165007",
"0.6160428",
"0.6117452",
"0.6056629",
"0.6028466",
"0.597769",
"0.5974593",
"0.5973362",
"0.5958528",
"0.5934326",
"0.59249026",
"0.59145623",
"0.590865",
"0.58897716",
"0.5845117",
"0.5835772",
... | 0.6532778 | 1 |
Manually close this computation and detach from its stream. This computation object cannot be restarted, used or streamed for after this method is called. | def close(self):
self._state = Computation.STATE_COMPLETED
if self._stream:
self._stream.close()
self._stream = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.input_processing_running = False",
"def close(self):\n self.p.close(self.inStream)",
"def detach(self):\n raise io.UnsupportedOperation",
"def close(self):\n self.stream.stop_stream()\n self.stream.close()\n self.p.terminate()",
"def close(s... | [
"0.6461419",
"0.6158445",
"0.61347896",
"0.6099115",
"0.606717",
"0.6046602",
"0.6042417",
"0.6006571",
"0.6006571",
"0.6006571",
"0.5983686",
"0.5926395",
"0.5922669",
"0.58965856",
"0.58894277",
"0.5883494",
"0.58673984",
"0.58431107",
"0.5835887",
"0.58249986",
"0.57950914... | 0.6759623 | 0 |
Return the full metadata object for the given timeseries (by its ID), if available. | def get_metadata(self, tsid):
return self._metadata.get(tsid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def series_metadata(series_id, **kwargs):\n\n instance = Ceic._get_instance()\n\n kwargs[\"id\"] = series_id\n get_series_method = instance._series_facade.get_series_metadata\n result = instance._make_request(get_series_method, **kwargs)\n\n return result",
"def get_meta(_id):\... | [
"0.7596756",
"0.71405804",
"0.6620177",
"0.6345488",
"0.6211664",
"0.6198132",
"0.6175653",
"0.61720866",
"0.6139353",
"0.60621643",
"0.60227144",
"0.60011643",
"0.5937554",
"0.59227675",
"0.58920753",
"0.58731914",
"0.58703643",
"0.586539",
"0.5859682",
"0.5834022",
"0.57553... | 0.7499768 | 1 |
Iterate over the messages from the computation's output. Control and metadata messages are intercepted and interpreted to enhance this Computation's object knowledge of the computation's context. Data and event messages are yielded back to the caller as a generator. | def stream(self):
iterator = iter(self._stream)
while self._state < Computation.STATE_COMPLETED:
try:
message = next(iterator)
except StopIteration:
if self._state < Computation.STATE_COMPLETED:
self._stream = self._execute()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatchMessageLoop(self, tree):\n self.fill(\"for (const auto& \")\n self.dispatch(tree.target)\n self.write(\" : \")\n # if simple message iterator\n if isinstance(tree.iter, ast.Name):\n if not tree.iter.id == self._input_message_var:\n self.Raise... | [
"0.62907",
"0.61624604",
"0.61519766",
"0.6049434",
"0.5895483",
"0.5862697",
"0.57415575",
"0.57073766",
"0.5664131",
"0.5584904",
"0.55799276",
"0.5549966",
"0.5504933",
"0.54767543",
"0.5455556",
"0.54053915",
"0.5362748",
"0.53410953",
"0.53177094",
"0.53131336",
"0.53108... | 0.6595029 | 0 |
Process an information message received from the computation. | def _process_info_message(self, message):
# Extract the output resolution from the appropriate message, if
# it's present.
contents = message.get('contents', None)
if message['messageCode'] == 'JOB_RUNNING_RESOLUTION':
self._resolution = contents['resolutionMs']
elif ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_info(self, info):\n return info",
"def _process_info_response(self, message):\n self.stick.logger.debug(\"Response info message for node %s\", self.get_mac())\n self.set_available(True)\n if message.relay_state.serialize() == b\"01\":\n if not self._relay_state:... | [
"0.6863245",
"0.6593536",
"0.6513189",
"0.6232416",
"0.62244856",
"0.6170796",
"0.6160665",
"0.61211336",
"0.60577446",
"0.6045957",
"0.6028034",
"0.5947839",
"0.59292454",
"0.59191173",
"0.5918451",
"0.58967113",
"0.5854963",
"0.5833575",
"0.5806119",
"0.58033127",
"0.580289... | 0.7892579 | 0 |
Test compress a a fastq pair with spring | def test_compress_spring(spring_tmp_path, first_tmp_file, second_tmp_file, spring_api):
# GIVEN a spring api
# GIVEN two existing fastq reads
assert first_tmp_file.exists()
assert second_tmp_file.exists()
# GIVEN a spring path that does not exist
assert not spring_tmp_path.exists()
# WHEN c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_compress_fastq_real(\n first_read, second_read, spring_tmp_path, real_base_context\n):\n # GIVEN the path to a existing bam file and a cli runner\n runner = CliRunner()\n assert not spring_tmp_path.exists()\n # WHEN running the compress command with dry_run\n result = runner.invoke(\n ... | [
"0.67960364",
"0.66650796",
"0.6589134",
"0.6380383",
"0.635136",
"0.6088469",
"0.6068755",
"0.6026248",
"0.59677315",
"0.59421235",
"0.5831872",
"0.5776875",
"0.5654765",
"0.561792",
"0.55867845",
"0.55817515",
"0.55781907",
"0.5565639",
"0.547318",
"0.54543227",
"0.5444818"... | 0.7122614 | 0 |
Test decompress a real spring file | def test_decompress_spring(spring_tmp_file, spring_api):
# GIVEN a spring file, a spring api and two paths to fastq files that does not exist
assert spring_tmp_file.exists()
fastq_files = fastq_outpaths(spring_tmp_file)
first_read = fastq_files[0]
second_read = fastq_files[1]
assert not first_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__decompress(filename):\n with open(filename, mode=\"rb\") as file_handle:\n name, content = Submit._decompress(filename, file_handle)\n assert name.endswith(\"EcoliCore.xml\")\n assert len(content.read()) >= 494226",
"def test_decompress_file():\n gz_file = os.path.join(\n temp... | [
"0.703235",
"0.695694",
"0.6342343",
"0.63244593",
"0.63132185",
"0.61721224",
"0.60823673",
"0.6055376",
"0.6052097",
"0.6038044",
"0.5983951",
"0.5957158",
"0.59367615",
"0.59053504",
"0.58562326",
"0.582531",
"0.5788251",
"0.5767488",
"0.5707274",
"0.5705833",
"0.5699921",... | 0.7215441 | 0 |
Initializes and returns a dictionary representing the schema of the json dict using the fieldnames | def create_schema_dict_from_fieldnames(fieldnames):
schema_dict = {}
keys_list_info = []
'''Intermediate list to keep track of the level in the key list that is being processed'''
for field in fieldnames:
keys = field.split('.')
keys_list_info.append({
'keys': keys,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fields2jsonschema(self, fields, *, ordered=False, partial=None):\n jsonschema = {\"type\": \"object\", \"properties\": OrderedDict() if ordered else {}}\n\n for field_name, field_obj in fields.items():\n observed_field_name = field_obj.data_key or field_name\n prop = self.fi... | [
"0.60444427",
"0.6005666",
"0.5987223",
"0.59056395",
"0.5895684",
"0.5891646",
"0.58794457",
"0.58593464",
"0.5795326",
"0.5780785",
"0.5736191",
"0.57257277",
"0.5721278",
"0.5699274",
"0.56913126",
"0.5668999",
"0.5615016",
"0.5561104",
"0.5539173",
"0.5529676",
"0.5525052... | 0.6785187 | 0 |
gets the number of devices. | def get_count():
_check_init()
return _pypm.CountDevices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_number_of_devices(self):\n return self.drt_manager.get_number_of_devices()",
"def get_device_count():\n debug(\"MpOrLibUsb.get_device_count()\")\n num = MpOrLibUsb.__get_device_count_Mpusb()\n num = num + MpOrLibUsb.__get_device_count_Libusb()\n return num\n #end get... | [
"0.90645766",
"0.831698",
"0.8050943",
"0.801327",
"0.761507",
"0.7551366",
"0.747413",
"0.7435826",
"0.73832136",
"0.7341328",
"0.7251374",
"0.7061213",
"0.6950681",
"0.6738359",
"0.6673769",
"0.66521573",
"0.6631131",
"0.65439636",
"0.65121925",
"0.65111357",
"0.63980174",
... | 0.8458767 | 1 |
gets default input device number | def get_default_input_id():
_check_init()
return _pypm.GetDefaultInputDeviceID() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_device():\n return MXNET_DEFAULT_DEVICE",
"def device_num(self) -> str:\n return pulumi.get(self, \"device_num\")",
"def device_index(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"device_index\")",
"def _get_device_id() -> str:\n with open(\"/proc/cpuinfo\", \"r\... | [
"0.7383052",
"0.72157747",
"0.70465815",
"0.68007797",
"0.6748688",
"0.6748688",
"0.6703096",
"0.6666385",
"0.6661851",
"0.65817934",
"0.6539918",
"0.65131176",
"0.6443669",
"0.63783634",
"0.6374211",
"0.6300509",
"0.6276648",
"0.6276648",
"0.6276648",
"0.6276648",
"0.6236164... | 0.7330685 | 1 |
gets default output device number | def get_default_output_id():
_check_init()
return _pypm.GetDefaultOutputDeviceID() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_device():\n return MXNET_DEFAULT_DEVICE",
"def device_num(self) -> str:\n return pulumi.get(self, \"device_num\")",
"def _get_device_id() -> str:\n with open(\"/proc/cpuinfo\", \"r\") as f:\n for line in f.readlines():\n if line.startswith('Serial'):\n ... | [
"0.7615652",
"0.713454",
"0.6950882",
"0.69294",
"0.6905241",
"0.6814386",
"0.6747941",
"0.66223323",
"0.66208005",
"0.6608296",
"0.6604695",
"0.6604695",
"0.6604695",
"0.6604695",
"0.6532698",
"0.6532698",
"0.6532698",
"0.6532698",
"0.6532698",
"0.6511042",
"0.65032375",
"... | 0.77695215 | 0 |
reads num_events midi events from the buffer. | def read(self, num_events):
_check_init()
self._check_open()
return self._input.Read(num_events) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poll_midi_events(self):\r\n if self.midi_input.poll():\r\n\r\n midi_msgs = self.midi_input.read(32)\r\n packets = []\r\n for midi_msg in midi_msgs:\r\n\r\n status = midi_msg[0][0]\r\n msg_type = (status & 0b11110000) >> 4\r\n ... | [
"0.6534274",
"0.65341234",
"0.57681197",
"0.5692784",
"0.5534939",
"0.54197687",
"0.54154485",
"0.53513765",
"0.5266867",
"0.5253126",
"0.52386856",
"0.51894593",
"0.5175614",
"0.516431",
"0.5149533",
"0.5142087",
"0.5093501",
"0.5061167",
"0.5058137",
"0.5051007",
"0.5021992... | 0.6847562 | 0 |
Output(device_id) Output(device_id, latency = 0) Output(device_id, buffer_size = 4096) Output(device_id, latency, buffer_size) The buffer_size specifies the number of output events to be buffered waiting for output. (In some cases see below PortMidi does not buffer output at all and merely passes data to a lowerlevel A... | def __init__(self, device_id, latency=0, buffer_size=256):
_check_init()
self._aborted = 0
if device_id == -1:
raise MidiException(
"Device id is -1, not a valid output id."
" -1 usually means there were no default "
"Output devices.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _out(self, pitch=60, dur=0.25, velocity=64, layer=0, keycode=None):\n if self.midi_out is None:\n self.midi_out = midi\n #print color('WARNING',\"The midi out object is missing. Defaulting to midi controller.\")\n self.midi_out.note(pitch, dur, velocity, layer, keycode)",
... | [
"0.59255934",
"0.58488685",
"0.57052743",
"0.5690895",
"0.56780297",
"0.5553791",
"0.554004",
"0.54786086",
"0.5383475",
"0.5369967",
"0.536184",
"0.53447855",
"0.53310466",
"0.53170395",
"0.52864814",
"0.52820253",
"0.5278892",
"0.5271516",
"0.5254288",
"0.5254288",
"0.52542... | 0.6173794 | 0 |
write_short(status ) Output.write_short(status) Output.write_short(status, data1 = 0, data2 = 0) output MIDI information of 3 bytes or less. data fields are optional | def write_short(self, status, data1=0, data2=0):
_check_init()
self._check_open()
self._output.WriteShort(status, data1, data2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __send_short(self, msg_id, param1, param2):\n data_out = struct.pack(\"<HBBBB\", msg_id, param1, param2,\n self.__dst, self.__src)\n if self.__debug:\n print \">>> %s\" % binascii.hexlify(data_out)\n self.__ser.write(data_out)\n self.__ser.flush()",
"def wShort(self... | [
"0.61694926",
"0.6038646",
"0.5992387",
"0.5830418",
"0.5723575",
"0.5662122",
"0.56084025",
"0.55684793",
"0.5503604",
"0.5452714",
"0.543934",
"0.534923",
"0.53473973",
"0.53471833",
"0.53398734",
"0.5333919",
"0.5298675",
"0.52902836",
"0.52268827",
"0.5155862",
"0.5142787... | 0.81179553 | 0 |
writes a timestamped systemexclusive midi message. Output.write_sys_ex(when, msg) msg can be a list or a string when a timestamp in milliseconds | def write_sys_ex(self, when, msg):
_check_init()
self._check_open()
self._output.WriteSysEx(when, msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_system_time(cls, dispatcher, timestamp): # pragma: no cover\n\n if not cls.is_system_openwrt():\n return\n\n dispatcher.update_all_timers(timestamp - time.time())\n with open(os.devnull, \"w\") as dev_null:\n cls.logger.info(\"Setting system time to %s\",\n ... | [
"0.57817173",
"0.56807023",
"0.5651003",
"0.5520806",
"0.55050445",
"0.5425977",
"0.54207873",
"0.53803086",
"0.5367607",
"0.5229563",
"0.52123886",
"0.5196102",
"0.51570934",
"0.5146427",
"0.5120539",
"0.5091979",
"0.5083298",
"0.5074567",
"0.5063733",
"0.5056245",
"0.505320... | 0.65253943 | 0 |
turns a midi note on. Note must be off. Output.note_on(note, velocity, channel=0) note is an integer from 0 to 127 velocity is an integer from 0 to 127 channel is an integer from 0 to 15 Turn a note on in the output stream. The note must already be off for this to work correctly. | def note_on(self, note, velocity, channel=0):
if not 0 <= channel <= 15:
raise ValueError("Channel not between 0 and 15.")
self.write_short(0x90 + channel, note, velocity) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_note_on(self, note=60, velocity=127, ch=None):\n self.send_channel_message(NOTE_ON, note, velocity, ch=ch)",
"def _on_note(self) -> Iterator:\n return filter(\n lambda x: x.type == constants.NOTE_ON, self.midi_data)",
"def turn_on(self, **kwargs):\n self._is_on = True\n... | [
"0.7613324",
"0.592991",
"0.55369717",
"0.550542",
"0.5414737",
"0.5405249",
"0.5375794",
"0.53548884",
"0.5338894",
"0.5334944",
"0.5332442",
"0.5331875",
"0.530105",
"0.5289198",
"0.52711296",
"0.525631",
"0.52452683",
"0.52413917",
"0.52339345",
"0.52312446",
"0.5229462",
... | 0.7090578 | 1 |
turns a midi note off. Note must be on. Output.note_off(note, velocity=0, channel=0) note is an integer from 0 to 127 velocity is an integer from 0 to 127 (release velocity) channel is an integer from 0 to 15 Turn a note off in the output stream. The note must already be on for this to work correctly. | def note_off(self, note, velocity=0, channel=0):
if not 0 <= channel <= 15:
raise ValueError("Channel not between 0 and 15.")
self.write_short(0x80 + channel, note, velocity) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_note_off(self, note=60, velocity=0, ch=None):\n self.send_channel_message(NOTE_OFF, note, velocity, ch=ch)",
"def send_all_notes_off(self, ch=None):\n self.send_control_change(ALL_NOTES_OFF, 0, ch=ch)",
"def note_off(self, channel, key, velocity):\n log.debug(\"WinchMIDILogic rece... | [
"0.79659575",
"0.6555073",
"0.6434429",
"0.6037967",
"0.5972276",
"0.59586877",
"0.5936766",
"0.5906997",
"0.58888584",
"0.58817726",
"0.58514315",
"0.5849906",
"0.57724184",
"0.5766596",
"0.57500625",
"0.5740246",
"0.57222235",
"0.5715646",
"0.5582674",
"0.5579068",
"0.55757... | 0.7337855 | 1 |
select an instrument for a channel, with a value between 0 and 127 Output.set_instrument(instrument_id, channel=0) Also called "patch change" or "program change". | def set_instrument(self, instrument_id, channel=0):
if not 0 <= instrument_id <= 127:
raise ValueError(f"Undefined instrument id: {instrument_id}")
if not 0 <= channel <= 15:
raise ValueError("Channel not between 0 and 15.")
self.write_short(0xC0 + channel, instrument_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setInstrument(self,instrument):\n self.instrument = instrument\n self.instrument.attach(self)",
"def instrument(self, instrument):\n\n self._instrument = instrument",
"def instrument(self, instrument):\n\n self._instrument = instrument",
"def instrument(self, instrument):\n\n s... | [
"0.6165716",
"0.5908412",
"0.5908412",
"0.5908412",
"0.5908412",
"0.57718825",
"0.56522983",
"0.55587083",
"0.5467114",
"0.54046494",
"0.53875726",
"0.5380665",
"0.5360065",
"0.53364366",
"0.5315677",
"0.52725387",
"0.5267486",
"0.52653897",
"0.5259578",
"0.52514374",
"0.5249... | 0.80024487 | 0 |
modify the pitch of a channel. Output.pitch_bend(value=0, channel=0) Adjust the pitch of a channel. The value is a signed integer from 8192 to +8191. For example, 0 means "no change", +4096 is typically a semitone higher, and 8192 is 1 whole tone lower (though the musical range corresponding to the pitch bend range can... | def pitch_bend(self, value=0, channel=0):
if not 0 <= channel <= 15:
raise ValueError("Channel not between 0 and 15.")
if not -8192 <= value <= 8191:
raise ValueError(
f"Pitch bend value must be between -8192 and +8191, not {value}."
)
# "The... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_pitch_bend(self, value=8192, ch=None):\n self.send_channel_message(PITCH_BEND, value & 0x7f,\n (value >> 7) & 0x7f, ch=ch)",
"def pitch(self, pitch):\n pass",
"def setVoicePitch(self, pitch):\n\n try:\n assert (pitch >= 1.0 and pitch <= ... | [
"0.7421974",
"0.547343",
"0.5347844",
"0.51605266",
"0.5077903",
"0.48852926",
"0.4849803",
"0.4712596",
"0.46920925",
"0.4681353",
"0.46808225",
"0.46378794",
"0.46331412",
"0.45785624",
"0.45332983",
"0.44683796",
"0.436608",
"0.43487012",
"0.43238682",
"0.4311896",
"0.4307... | 0.79253113 | 0 |
converts midi events to pygame events | def midis2events(midis, device_id):
evs = []
for midi in midis:
((status, data1, data2, data3), timestamp) = midi
event = pygame.event.Event(
MIDIIN,
status=status,
data1=data1,
data2=data2,
data3=data3,
timestamp=timestamp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def midi_event(self, event_t, *data):\n ev = self.event(event_t, *data)\n msg = self.to_midi()\n return ev, msg",
"def midi_event(self, event_t, *data):\n ev = self.event(event_t, *data)\n msg = self.to_midi()\n return ev, msg",
"def _pygame_event_to_event(self, pg_eve... | [
"0.7015109",
"0.7015109",
"0.65206575",
"0.63299954",
"0.6121373",
"0.5952899",
"0.58821917",
"0.57828414",
"0.57319665",
"0.56886464",
"0.56084985",
"0.56024367",
"0.5598078",
"0.5597545",
"0.55962354",
"0.5568476",
"0.5451933",
"0.5427319",
"0.5413126",
"0.54105806",
"0.539... | 0.7087804 | 0 |
converts a frequency into a MIDI note. Rounds to the closest midi note. | def frequency_to_midi(frequency):
return int(round(69 + (12 * math.log(frequency / 440.0)) / math.log(2))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def midi_to_frequency(midi_note: Union[float, int]) -> float:\n half_tone = 2 ** (1 / 12)\n return 440. * half_tone ** (midi_note - 69.)",
"def midi_to_frequency(midi_note):\n return round(440.0 * 2 ** ((midi_note - 69) * (1.0 / 12.0)), 1)",
"def frequency_to_note(f: float) -> float:\n diff = frequ... | [
"0.7662604",
"0.75888556",
"0.70005167",
"0.68602085",
"0.68094957",
"0.6688544",
"0.65842634",
"0.6493252",
"0.64888257",
"0.64689696",
"0.63606673",
"0.6304645",
"0.61992043",
"0.6178548",
"0.6116287",
"0.61123514",
"0.6076782",
"0.6068218",
"0.6002282",
"0.59802586",
"0.59... | 0.85298073 | 0 |
Converts a midi note to a frequency. | def midi_to_frequency(midi_note):
return round(440.0 * 2 ** ((midi_note - 69) * (1.0 / 12.0)), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def midi_to_frequency(midi_note: Union[float, int]) -> float:\n half_tone = 2 ** (1 / 12)\n return 440. * half_tone ** (midi_note - 69.)",
"def note_to_freq(note: str) -> float:\n try:\n octave = int(note[-1])\n except ValueError:\n raise Exception('Octave must be an integer')\n\n if... | [
"0.88211846",
"0.7932969",
"0.7870479",
"0.78518265",
"0.7508776",
"0.7294357",
"0.71753925",
"0.6704369",
"0.664",
"0.65712625",
"0.65357894",
"0.6476176",
"0.63454854",
"0.62705004",
"0.6227535",
"0.5996586",
"0.59871805",
"0.5956149",
"0.59524626",
"0.5872471",
"0.58206695... | 0.88746357 | 0 |
returns the Ansi Note name for a midi number. | def midi_to_ansi_note(midi_note):
notes = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]
num_notes = 12
note_name = notes[int((midi_note - 21) % num_notes)]
note_number = (midi_note - 12) // num_notes
return f"{note_name}{note_number}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _midi_to_note(self, midi_note: int) -> str:\n return constants.MIDI_TO_NOTES[midi_note][0]",
"def getNoteLetter(self):\n if self.noteName != None and self.noteName != \"\":\n return self.noteName[0]\n else:\n return \"\"",
"def getNoteName(self):\n return s... | [
"0.7424283",
"0.64719594",
"0.6344131",
"0.6218995",
"0.6144893",
"0.6049338",
"0.6036549",
"0.6022637",
"0.5914489",
"0.5914489",
"0.5914489",
"0.5755851",
"0.5745317",
"0.5737554",
"0.57128763",
"0.56990564",
"0.56805706",
"0.56452733",
"0.56289667",
"0.5602271",
"0.5559806... | 0.7344328 | 1 |
Transform listening count in user profiles to ratings from 1 to 5. Based on O. Celma, Music Recommendations and Discovery in the Long Tail, pp 8081. | def listening_count_to_rating(urm):
for i in range(urm.shape[0]):
u = [(j, c) for j, c in zip(np.nonzero(urm[i, :])[0], urm[i, np.nonzero(urm[i, :])[0]])]
u = sorted(u, key=lambda e: e[1])
l = sum([c for _, c in u])
agg = 0
for j, c in u:
agg += c
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_user_to_ratings(reviews):\n\tuser_ratings = dict()\n\tfor review in reviews:\n\t\tuser = review[0]\n\t\tif user not in user_ratings:\n\t\t\tuser_ratings[user] = 0\n\t\telse:\n\t\t\tuser_ratings[user] = user_ratings[user] + 1\n\n\treturn user_ratings",
"def binarize(self):\n total = 0\n count = ... | [
"0.6235899",
"0.5980918",
"0.57725275",
"0.56985414",
"0.5618159",
"0.55728376",
"0.5528598",
"0.5506304",
"0.54792196",
"0.5442517",
"0.53938824",
"0.53938824",
"0.53509635",
"0.5324479",
"0.52795076",
"0.5255723",
"0.52215415",
"0.52103394",
"0.5208007",
"0.5196402",
"0.518... | 0.6492444 | 0 |
Utility method for converting dataset from mirex and latfm to our format. It creates items.json, a and ground truth for similar items (similar_items_ground_truth.json) The datasets are from Oramas et al. "A Semanticbased Approach for Artist Similarity", | def prepare_mirex_lastfmapi_dataset(which='mirex'):
assert which in ['lastfmapi', 'mirex']
raw_folder_path = f"{raw_dataset_path}/dataset_similarity_oramas_et_al"
preprocessed_folder_path = f"{preprocessed_dataset_path}/similarity/{which}"
os.makedirs(preprocessed_folder_path, exist_ok=True)
musicb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_dataset(dataset):\n\n with open(f\"{preprocessed_dataset_path}/similarity/{dataset}/items.json\") as f:\n items = json.load(f)\n\n graphs = []\n\n for item in tqdm(items):\n\n # using just factual nodes for similarity, leading to informative segues\n\n if dataset == 'mirex' o... | [
"0.62105983",
"0.5801646",
"0.5505663",
"0.52782065",
"0.52087826",
"0.5172635",
"0.51711726",
"0.51567847",
"0.5134203",
"0.5113845",
"0.5091391",
"0.50912607",
"0.50692916",
"0.5068016",
"0.50543123",
"0.5045711",
"0.5037639",
"0.5019551",
"0.5018539",
"0.49870875",
"0.4938... | 0.7114617 | 0 |
Initiliazer to be used as argument of construct_graph, in case artist_musicbrainz_id is provided in seed, e.g. in Mirex. The graph is initialized with two nodes, artist_name and artist_musicbrainz_id, one son of the other, with values as defined in seed. | def custom_construct_graph_initializer(seed):
g = construct_graph(seed, supplier=CustomReturnValueMockedActionsSupplier(
{'artist_musicbrainz_id': seed.pop('artist_musicbrainz_id')}))
return g | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, edges = None):\n self.__nodes = defaultdict(lambda: {\"tails\":[], \"heads\":[], \"dummied\": False})\n self.__dummy = \"dummy_\" + \"\".join(\\\n map(lambda i: random.choice(ascii_lowercase), range(4)))\n self.__nodes[self.__dummy][\"dummied\"] = True\n se... | [
"0.5836354",
"0.57587296",
"0.5678948",
"0.563076",
"0.5491074",
"0.5491074",
"0.5489605",
"0.5393623",
"0.5371762",
"0.5316773",
"0.529387",
"0.52928746",
"0.52773917",
"0.52674276",
"0.52356595",
"0.51657325",
"0.5164365",
"0.516066",
"0.5147788",
"0.5134221",
"0.51284033",... | 0.7727425 | 0 |
For use when mode is 'spores', to allow the model to be built, edited, and iteratively run within Pyomo, modifying, at each iteration, the score of | def run_spores(model_data, timings, interface, backend, build_only):
log_time(
logger,
timings,
"run_start",
comment="Backend: starting model run in SPORES mode",
)
run_config = UpdateObserverDict(
initial_yaml_string=model_data.attrs["run_config"],
name="run... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(self, model, context):\n pass",
"def call(self, model):\n raise NotImplementedError('Define your score here')",
"def recompute(self):\n \n dbpath, config = self._start()\n \n self.logger.msg1(\"Deleting existing scores\")\n scorestab = ... | [
"0.6714492",
"0.6420956",
"0.6240597",
"0.61677253",
"0.6150882",
"0.61076355",
"0.6102904",
"0.6065709",
"0.59423095",
"0.5931523",
"0.5821409",
"0.5809015",
"0.5761495",
"0.5690105",
"0.56883705",
"0.5686266",
"0.5668462",
"0.5625598",
"0.56113815",
"0.5590778",
"0.55749327... | 0.6467272 | 1 |
For use when mode is 'operate', to allow the model to be built, edited, and iteratively run within Pyomo. | def run_operate(model_data, timings, backend, build_only):
log_time(
logger,
timings,
"run_start",
comment="Backend: starting model run in operational mode",
)
defaults = UpdateObserverDict(
initial_yaml_string=model_data.attrs["defaults"],
name="defaults",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _execute(self, model_obj):",
"def build_model_fn(self):",
"def main():\n model = Calculator()",
"def __call__(self, do_jacobian=True):\n raise NotImplementedError(\"The Model call is not implemented\")",
"def _doRun(self, model: Model):\n raise Exception(\"Not implemented\")",
"def ... | [
"0.6358259",
"0.6248437",
"0.62081784",
"0.5971545",
"0.5952259",
"0.5840456",
"0.5815429",
"0.5812729",
"0.5764588",
"0.5748183",
"0.5732024",
"0.57149744",
"0.5669818",
"0.56673306",
"0.5662947",
"0.5660561",
"0.564741",
"0.5634192",
"0.5613314",
"0.56120145",
"0.56022084",... | 0.7075024 | 0 |
Deposition of the charge density rho using numba on the GPU. Iterates over the cells and over the particles per cell. Calculates the weighted amount of rho that is deposited to the 4 cells surounding the particle based on its shape (linear). The particles are sorted by their cell index (the lower cell in r and z that t... | def deposit_rho_gpu(x, y, z, w,
invdz, zmin, Nz,
invdr, rmin, Nr,
rho0, rho1,
rho2, rho3,
cell_idx, prefix_sum):
# Get the 1D CUDA grid
i = cuda.grid(1)
# Deposit the field per cell in parallel (for t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deposit_J_gpu(x, y, z, w,\r\n ux, uy, uz, inv_gamma,\r\n invdz, zmin, Nz,\r\n invdr, rmin, Nr,\r\n J0, J1,\r\n J2, J3,\r\n cell_idx, prefix_sum):\r\n # Get the 1D CUDA grid\r\n i = cuda.grid(1)\r\n # ... | [
"0.6986752",
"0.58862",
"0.58421993",
"0.5800051",
"0.5683709",
"0.5657621",
"0.56383175",
"0.5603056",
"0.5597998",
"0.5594804",
"0.5593205",
"0.55781126",
"0.5505303",
"0.5493633",
"0.54896146",
"0.5484876",
"0.5469367",
"0.5462829",
"0.5459251",
"0.5420487",
"0.54059887",
... | 0.79129606 | 0 |
Deposition of the current J using numba on the GPU. Iterates over the cells and over the particles per cell. Calculates the weighted amount of J that is deposited to the 4 cells surounding the particle based on its shape (linear). The particles are sorted by their cell index (the lower cell in r and z that they deposit... | def deposit_J_gpu(x, y, z, w,
ux, uy, uz, inv_gamma,
invdz, zmin, Nz,
invdr, rmin, Nr,
J0, J1,
J2, J3,
cell_idx, prefix_sum):
# Get the 1D CUDA grid
i = cuda.grid(1)
# Deposit the field per c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deposit_rho_gpu(x, y, z, w,\r\n invdz, zmin, Nz,\r\n invdr, rmin, Nr,\r\n rho0, rho1,\r\n rho2, rho3,\r\n cell_idx, prefix_sum):\r\n # Get the 1D CUDA grid\r\n i = cuda.grid(1)\r\n # Deposit the field per ce... | [
"0.6378881",
"0.58057255",
"0.5751499",
"0.5600807",
"0.55796045",
"0.54036754",
"0.53955084",
"0.53427756",
"0.5287707",
"0.5280162",
"0.5265903",
"0.52190214",
"0.5199122",
"0.5179599",
"0.514474",
"0.51409495",
"0.5123635",
"0.5112827",
"0.5112695",
"0.5090087",
"0.506889"... | 0.7632011 | 0 |
Sets the actual_reported_date of this ZacksEPSSurpriseSummary. | def actual_reported_date(self, actual_reported_date):
self._actual_reported_date = actual_reported_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actual_reported_time(self, actual_reported_time):\n\n self._actual_reported_time = actual_reported_time",
"def actual_reported_desc(self, actual_reported_desc):\n\n self._actual_reported_desc = actual_reported_desc",
"def actual_reported_code(self, actual_reported_code):\n\n self._actu... | [
"0.68168414",
"0.66969454",
"0.5711135",
"0.545208",
"0.54077923",
"0.54045695",
"0.5323684",
"0.5323684",
"0.53009677",
"0.5259019",
"0.5259019",
"0.524832",
"0.5241506",
"0.522606",
"0.51777023",
"0.51777023",
"0.51777023",
"0.51777023",
"0.51777023",
"0.51777023",
"0.51777... | 0.8531986 | 0 |
Sets the actual_reported_time of this ZacksEPSSurpriseSummary. | def actual_reported_time(self, actual_reported_time):
self._actual_reported_time = actual_reported_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actual_reported_date(self, actual_reported_date):\n\n self._actual_reported_date = actual_reported_date",
"def actual_reported_desc(self, actual_reported_desc):\n\n self._actual_reported_desc = actual_reported_desc",
"def set_umeastime(self, time):\n self.utime = time",
"def rejected... | [
"0.701044",
"0.6810117",
"0.5564027",
"0.55543506",
"0.5522467",
"0.54617625",
"0.539025",
"0.53619623",
"0.53619623",
"0.53264856",
"0.5311299",
"0.509753",
"0.5055156",
"0.50488114",
"0.50488114",
"0.502645",
"0.502645",
"0.502645",
"0.5001926",
"0.49952546",
"0.49857408",
... | 0.84131885 | 0 |
Sets the actual_reported_code of this ZacksEPSSurpriseSummary. | def actual_reported_code(self, actual_reported_code):
self._actual_reported_code = actual_reported_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actual_reported_desc(self, actual_reported_desc):\n\n self._actual_reported_desc = actual_reported_desc",
"def actual_reported_date(self, actual_reported_date):\n\n self._actual_reported_date = actual_reported_date",
"def actual_reported_time(self, actual_reported_time):\n\n self._actu... | [
"0.61240596",
"0.5752885",
"0.54392207",
"0.52955383",
"0.5170515",
"0.5155533",
"0.5119406",
"0.50986403",
"0.4989291",
"0.4950932",
"0.49143597",
"0.48412418",
"0.48412418",
"0.48147735",
"0.47920007",
"0.47920007",
"0.47589415",
"0.4729439",
"0.4729439",
"0.47285947",
"0.4... | 0.8275259 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.