query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Process IMU data in realtime.
def process_imu( self, im_data: np.ndarray, accel: bool = False, squared: bool = False, norm_min_bound: int = None, norm_max_bound: int = None, **kwargs, ) -> np.ndarray: self.update_signal_processing_parameters(**kwargs) tic = time.time() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imu_callback(self, msg):\n self.mutex.acquire()\n\n self.ni[3] = msg.angular_rate.x\n self.ni[4] = msg.angular_rate.y\n self.ni[5] = msg.angular_rate.z\n\n self.eta2[0] = msg.orientation.roll\n self.eta2[1] = msg.orientation.pitch\n self.eta2[2] = msg.orientatio...
[ "0.63551223", "0.6044613", "0.58962166", "0.5722179", "0.5667444", "0.5629212", "0.5587109", "0.55798817", "0.5566661", "0.55389005", "0.55101794", "0.55088514", "0.5492298", "0.5483712", "0.5476294", "0.5472477", "0.54616934", "0.5400902", "0.5393032", "0.5378483", "0.537767...
0.5108354
48
Allow to get the number of peaks for an analog signal (to get cadence from treadmill for instance).
def get_peaks( self, new_sample: np.ndarray, threshold: float, min_peaks_interval=None, ) -> tuple: tic = time.time() nb_peaks = [] if len(new_sample.shape) == 1: new_sample = np.expand_dims(new_sample, 0) sample_proc = np.copy(new_sample) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_interval_peak(arr1d, lower, upper):\n from scipy.signal import find_peaks\n peaks = find_peaks(arr1d, height=(lower, upper))\n return len(peaks[0])", "def count_abs_peak(arr1d, threshold):\n from scipy.signal import find_peaks\n peaks = find_peaks(arr1d, height=threshold)\n return len...
[ "0.6425269", "0.63765293", "0.6173016", "0.61437225", "0.6119126", "0.6118085", "0.61028016", "0.6076271", "0.59957093", "0.59269536", "0.59211403", "0.59087247", "0.5859496", "0.58115536", "0.580975", "0.5803837", "0.58019924", "0.5797852", "0.57864153", "0.57161665", "0.570...
0.0
-1
Allow to apply a custom processing function to the data.
def custom_processing(self, funct: callable, data_tmp: np.ndarray, **kwargs) -> np.ndarray: tic = time.time() data_tmp = funct(data_tmp, **kwargs) self.process_time.append(time.time() - tic) return data_tmp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_fn(self,fn):\r\n \r\n self.check_Data()\r\n for split,data_ in self.processed_data.items():\r\n x = data_['x']\r\n x = np.array([fn(xi) for xi in x])\r\n data_['x'] = x", "def _process(self, data: np.ndarray) -> np.ndarray:", "def _process(self, d...
[ "0.7209119", "0.71054864", "0.71054864", "0.70158184", "0.67586684", "0.66956675", "0.6674667", "0.6640138", "0.66138846", "0.6517365", "0.64679474", "0.64604974", "0.6420236", "0.6411107", "0.63475305", "0.6322858", "0.63099974", "0.63018227", "0.6262167", "0.6238369", "0.62...
0.711315
1
Compute MVC from several mvc_trials.
def compute_mvc( nb_muscles: int, mvc_trials: np.ndarray, window_size: int, tmp_file: str = None, output_file: str = None, save_file: bool = False, ) -> list: mvc_list_max = [] for i in range(nb_muscles): mvc_temp = -np.sort(-mvc_trials, ax...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(cfg: DictConfig):\n\n experiments = cfg.get('experiment_type', f'{cfg.model.name}_only')\n fixed_t0 = cfg.get('fixed_t0', False)\n ext = '_fixedT0' if fixed_t0 else ''\n\n base_dir = cfg.device.root\n datasource = cfg.datasource.name\n\n if experiments == 'ablations':\n models...
[ "0.5545384", "0.5365183", "0.53412914", "0.52675617", "0.5252825", "0.52142614", "0.5210786", "0.5191421", "0.5145621", "0.5120124", "0.5053513", "0.5046397", "0.5045741", "0.5001172", "0.4999463", "0.49868155", "0.49839026", "0.49817446", "0.49579707", "0.49385127", "0.49382...
0.61508936
0
Batch the graphs and their labels
def collate(samples): graphs, labels = map(list, zip(*samples)) batched_graphs = dgl.batch(graphs) labels = torch.tensor(labels) - 1 # correct indexing for loss function return batched_graphs, torch.tensor(labels)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_num_classes_graphs():\n values = [10, 50, 100, 250, 1000, 4000]\n for num_classes in values:\n print(\"Training model on {} most common classes.\".format(num_classes))\n model = create_pretrained_model(num_classes=num_classes)\n histories = train(model, num_classes, epochs=50)\n...
[ "0.6137908", "0.6090466", "0.60618484", "0.6051165", "0.60128903", "0.5991099", "0.59111774", "0.59085894", "0.58944935", "0.58806723", "0.5811794", "0.5777245", "0.5748763", "0.57090044", "0.5706164", "0.5692337", "0.56865823", "0.5674395", "0.5671464", "0.56317866", "0.5592...
0.0
-1
Calculate weights for imbalanced classes
def calculate_class_weights(labels): class_counts = sorted(Counter(labels).items()) num_items = [x[1] for x in class_counts] weights = [min(num_items)/x for x in num_items] return torch.tensor(weights)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_weights_for_balanced_classes(self):\n\n count = [0] * self.get_num_classes()\n\n # label = self.class_map_dict[self.meta_data.loc[image_id]['dx']]\n # labels = [self.class_map_dict[l] for l in self.get_labels()]\n\n labels = self.get_labels()\n\n # Count how many instanc...
[ "0.81178117", "0.7981136", "0.7888464", "0.7566412", "0.755265", "0.74757576", "0.74142075", "0.7323989", "0.72968197", "0.72783875", "0.7191527", "0.7188369", "0.7066407", "0.70108426", "0.68984616", "0.6767867", "0.6734354", "0.6726656", "0.66751343", "0.66751343", "0.66481...
0.7284698
9
Delete the minority class, assign its label to the nearest majority class
def handle_imbalance(dataset, minority_class): for i, l in enumerate(dataset): if l == minority_class: dataset[i] = 2 return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_classification_head(self) -> None:\n del self.model.classifier", "def majority_class(classes):\n num_pos = len(classes[np.where(classes == 1)])\n num_neg = len(classes) - num_pos\n return 1 if num_pos > num_neg else 0", "def majority_voting(distances, labels, k):\n nearest_index =...
[ "0.6377702", "0.5918562", "0.58172894", "0.5726421", "0.56754035", "0.5635833", "0.55105144", "0.55105144", "0.5506352", "0.5470802", "0.54528326", "0.5444725", "0.5436435", "0.5425838", "0.54167604", "0.5402758", "0.53571814", "0.5312206", "0.5306321", "0.5279353", "0.524258...
0.61863196
1
Train and evaluate the model
def main(train, val, test): wandb.init(project="arg-qual", tags=[args.node_feat, args.quality_dim, str(args.epochs), str(args.lr)]) device = torch.device("cuda" if torch.cuda.is_available() else "cpu") dataloader_train = DataLoader( trainset, batch_size=10, collate_fn=collate, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def train_and_eval(self):\n self.__create_indexes()\n model = None\n model = None\n if self.model == 'OMult':\n model = OMult(self.kwargs)\n elif self.model == 'ConvO':\n mod...
[ "0.79048234", "0.7742273", "0.76403296", "0.7620212", "0.75824326", "0.75720584", "0.7564726", "0.75543934", "0.7538268", "0.75311756", "0.7518056", "0.7497667", "0.7475786", "0.745185", "0.7444781", "0.74335915", "0.74037987", "0.7389051", "0.73683375", "0.7365661", "0.73541...
0.0
-1
Compute the t statistic and pvalue given the flow results from the neural network and the reference results from Segment.
def t_test(result, reference): # Check that result and reference are 1D and that they have the same length print('\nChecking that result and reference are 1D and that they have the same length\n') if (len(result.shape) == 1) and (len(reference.shape) == 1): if len(result) == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_statistics(self):", "def compute(self) -> Tuple[float, float, float]:\n # @TODO: ddp hotfix, could be done better\n if self._is_ddp:\n for key in self.statistics:\n value: List[float] = all_gather(self.statistics[key])\n value: float = sum(value)...
[ "0.62979054", "0.6090692", "0.5972948", "0.57982653", "0.5781421", "0.57796174", "0.57675654", "0.57660323", "0.57544434", "0.57116395", "0.56900597", "0.56817675", "0.5671833", "0.56601024", "0.5622097", "0.5606627", "0.5601511", "0.55909044", "0.55909044", "0.5583507", "0.5...
0.5622872
14
Compute the sum of rank differences and pvalue given the flow results from the neural network and the reference results from Segment.
def wilcoxon_test(result, reference): print('\nChecking that result and reference are 1D and that they have the same length\n') if (len(result.shape) == 1) and (len(reference.shape) == 1): if len(result) == len(reference): print('Performing Wilcoxon test\n') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score( self ):\r\n result = 0.0\r\n for rr in self.ee.getRsrcs( ):\r\n value = self.scoreRsrc( rr )\r\n result += value\r\n print( \"INFO: Value for the schedule is %s \" % ( rr, result ) )\r\n return( result )", "def _estimate_stats_with_rel_info(self):\r\n ...
[ "0.5938969", "0.5851452", "0.576755", "0.575818", "0.5751947", "0.57292646", "0.5664509", "0.5663217", "0.56571037", "0.5621387", "0.5558706", "0.5553662", "0.5533289", "0.5519998", "0.5507834", "0.5492306", "0.5474098", "0.5470863", "0.54586834", "0.5452838", "0.54334104", ...
0.0
-1
Saves figure in specified folder with a given file name
def figure_saving(dest_path, filename, figure): print('Checking that a destination path has been given\n') if dest_path is not None: if filename[-3:] == 'png' or filename[-3:] == 'PNG': print('Saving figure as PNG in: {}'.format(dest_path)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(file_name):\n setup()\n plt.savefig(file_name)", "def save_plot(directory, name = None):\n global global_figure_count \n if directory[-1]!=\"/\":\n directory = directory + \"/\"\n directory_paths = directory.split(\"/\")\n prefix = directory_paths[0]\n for i in directory_p...
[ "0.7718799", "0.76871973", "0.76591367", "0.76588595", "0.74072856", "0.73765945", "0.7316014", "0.7292513", "0.7270031", "0.7248531", "0.7195906", "0.71886367", "0.71471447", "0.70390975", "0.7030412", "0.7016384", "0.7014492", "0.69352424", "0.69344157", "0.6902748", "0.690...
0.7174618
12
Compute a scatter plot with points and with linear regression equation given the flow results from the neural network and the reference results from Segment or QFLOW software.
def linear_regression_test(result, reference, plotting = True, save = False, dest_path = os.getcwd() + '/', filename = 'regression_plot.png'): print('\nChecking that result and reference are 1D and that they have the same length\n') if (len(result.shape) == 1) and (len(reference.shape) == 1): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_scatter(self):\n if Trainer.y_pred is None or Trainer.y_true is None:\n messagebox.showerror(\"Information\", \"Please train the model first before plotting\")\n return\n\n fig = plt.figure(figsize=(8, 4))\n plt.xlabel(\"Prediction\")\n plt.ylabel(\"Target...
[ "0.6615068", "0.6611525", "0.6609644", "0.66071516", "0.64990884", "0.63859683", "0.6262151", "0.6236126", "0.621933", "0.6182744", "0.6111916", "0.6104931", "0.6097538", "0.60893935", "0.6044467", "0.6041235", "0.60270923", "0.6026488", "0.59985936", "0.5996753", "0.5991206"...
0.65941626
4
Compute the BlandAltman plot for the flow results from the neural network and the reference results from Segment.
def bland_altman_plot(result, reference, save = False, dest_path = os.getcwd() + '/', filename = 'bland_altman_plot.png'): print('\nChecking that result and reference are 1D and that they have the same length\n') if (len(result.shape) == 1) and (len(reference.shape) == 1): if len(resu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualise_dataset_balancer_results(results, range=(-0.5, 0.5),\n colors=(\"#64B3DE\", \"#1f78b4\", \"#B9B914\", \"#FBAC44\", \"#bc1659\", \"#33a02c\", \"grey\", \"#b15928\", \"#6a3d9a\", \"#e31a1c\", \"#6ABF20\", \"#ff7f00\", \"#6a3d9a\"),\n ...
[ "0.63131994", "0.61638975", "0.60450023", "0.5963564", "0.5949459", "0.58739024", "0.5803001", "0.57943153", "0.57097024", "0.5674428", "0.5670437", "0.5666262", "0.56224895", "0.5605114", "0.56042796", "0.5596361", "0.55910486", "0.5591017", "0.55787", "0.5563748", "0.555826...
0.69851726
0
Compute Pearson correlation coefficient (r) between network result and groundtruth
def correlation(result, reference): r = np.corrcoef(result, reference)[0,1] return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_correlation(self):\n self.network.index_nodes()\n self._calculate_dist()\n pearson_correlation, pearson_pvalue = scipy.stats.pearsonr(self.dist[:,0], self.dist[:,1])\n spearman_correlation, spearman_pvalue = scipy.stats.spearmanr(self.dist[:,0], self.dist[:,1])\n re...
[ "0.7345685", "0.6861322", "0.6818759", "0.6698538", "0.66438806", "0.6590125", "0.6581691", "0.65602005", "0.65509814", "0.6521111", "0.65055865", "0.64997494", "0.6487084", "0.64761126", "0.64340806", "0.64340806", "0.64340806", "0.6431436", "0.6431436", "0.6431436", "0.6431...
0.655468
8
Moving average filter that takes in any curve as an input and returns the smoothed version of the curve.
def movingAverage(curve, radius): window_size = 2 * radius + 1 # Define the filter f = np.ones(window_size)/window_size # Add padding to the boundaries curve_pad = np.lib.pad(curve, (radius, radius), 'edge') # Apply convolution curve_smoothed = np.convolve(curve_pad, f, mode='same') # Re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moving_average_filter(val, filtered_val_prev, zeta):\n filtered_val = (1-zeta)*filtered_val_prev + zeta*val\n return filtered_val", "def moving_avg_filter(data, filter_size=filter_size):\n filter_size = int(filter_size)\n smoothed = np.zeros(len(data))\n for n in range(filter_size, len(data) -...
[ "0.7339928", "0.72752964", "0.65571386", "0.6282777", "0.6279526", "0.6273056", "0.6229946", "0.6214437", "0.6205291", "0.616007", "0.61384493", "0.612138", "0.61037254", "0.60738504", "0.60179627", "0.59666866", "0.59634", "0.59460336", "0.59332263", "0.59112227", "0.5901501...
0.72439873
2
Smooth x, y and angles individually
def smooth(trajectory, smoothing_radius): smoothed_trajectory = np.copy(trajectory) # Filter the x, y and angle curves for i in range(3): smoothed_trajectory[:, i] = movingAverage(trajectory[:, i], radius=smoothing_radius) return smoothed_trajec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smooth(o_l, o_r, c_l, c_r, AMT):\n l = o_l * AMT + (1-AMT) * c_l\n r = o_r * AMT + (1-AMT) * c_r\n return (l, r)", "def smooth(*args, numiter=1) -> core.Smooth:\n X, Y, kws = util.parseargs(*args)\n return core.Smooth(X, Y, numiter=numiter)", "def _smooth(self):\n self.te = self...
[ "0.6069272", "0.6052654", "0.58253056", "0.5748677", "0.5660876", "0.542666", "0.54207605", "0.5390675", "0.5384229", "0.53786594", "0.5338627", "0.5325628", "0.53239113", "0.5315032", "0.5307407", "0.52987885", "0.52389336", "0.5235801", "0.5194192", "0.51899594", "0.5166681...
0.57049793
4
Adjust border to remove as much of black borders as possible
def fixBorder(frame): s = frame.shape # Scale the image 2% without moving the center T = cv2.getRotationMatrix2D((s[1]/2, s[0]/2), 0, 1.02) frame = cv2.warpAffine(frame, T, (s[1], s[0])) return frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def border(self):\n ...", "def reduce_whitespace(self, border: int = 5) -> None:\n if self.img is None:\n raise FileExistsError(\"Load an image first with from_url.\")\n\n pix = np.asarray(self.img)\n\n pix = pix[:, :, 0:3] # Drop the alpha channel\n idx = np.where(...
[ "0.7338723", "0.7335545", "0.6950881", "0.68227065", "0.677218", "0.66420734", "0.6601155", "0.6601155", "0.65928864", "0.6508886", "0.6455222", "0.6428991", "0.6381604", "0.6376463", "0.6366828", "0.63566816", "0.63566476", "0.62430286", "0.62430286", "0.6230813", "0.6217119...
0.57792115
52
Stabilization of a video. Saved at the same directory as the original video. Using fixed_area it is possible to adress an area in which fixed spots are located.
def stabilization(videopath, smoothing_radius=50, fixed_area=[0, -1, 0, -1], stab_points=200): # Read original video # Extract directory and videoname for saving purposes capture = cv2.VideoCapture(videopath) directory, videoname = os.path.split(vid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def video_stabilizer(self, video=None):\r\n def in_roi(roi, p):\r\n x, y = p\r\n return roi['x1'] < x < roi['x2'] and roi['y1'] < y < roi['y2']\r\n\r\n \r\n if video is None:\r\n video = self.video_buffer\r\n stab_video = np.zeros_like(video)\r\n ...
[ "0.59573704", "0.5611474", "0.5611474", "0.55306906", "0.54804987", "0.543196", "0.54163516", "0.5396492", "0.53075343", "0.530261", "0.5296827", "0.529461", "0.5270649", "0.5267028", "0.5228373", "0.5218529", "0.5175246", "0.51592225", "0.51358426", "0.5133068", "0.5116132",...
0.6866042
0
Creates a DataLoader from given source and its open/transform params.
def get_loader( data_source: Iterable[dict], open_fn: Callable, dict_transform: Callable = None, sampler=None, collate_fn: Callable = default_collate_fn, batch_size: int = 32, num_workers: int = 4, shuffle: bool = False, drop_last: bool = False, ): from catalyst.data.dataset impo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_DataLoader(self, **kwargs):\r\n return DataLoader(self, **kwargs)", "def get_dataloader(params, format_name='hdf5', **kwargs):\n \n Provider = get_proper_provider(format_name)(params.modality)\n \n return DataLoader(Provider(params.dataset_path,\n seq_len...
[ "0.67652076", "0.6572773", "0.6279626", "0.61619353", "0.61383015", "0.61090654", "0.60896605", "0.60315233", "0.6029367", "0.60176903", "0.5900374", "0.58815914", "0.5844954", "0.584316", "0.5832388", "0.5825662", "0.58236927", "0.58061033", "0.58045447", "0.5799926", "0.577...
0.73296386
0
Returns a batch from experiment loader
def get_native_batch_from_loader(loader: DataLoader, batch_index: int = 0): dataset = loader.dataset collate_fn = loader.collate_fn return collate_fn([dataset[batch_index]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_batch(batch, ctx):\n if isinstance(batch, mx.io.DataBatch):\n data = batch.data[0]\n label = batch.label[0]\n else:\n data, label = batch\n return (gluon.utils.split_and_load(data, ctx),\n gluon.utils.split_and_load(label, ctx),\n data.shape[0])", "def...
[ "0.70499706", "0.66965586", "0.65072715", "0.63480055", "0.63115305", "0.62328964", "0.6215692", "0.6208522", "0.6193537", "0.61932385", "0.61918086", "0.61496", "0.61396766", "0.6139635", "0.6120947", "0.60812145", "0.6053506", "0.60499865", "0.60434055", "0.598307", "0.5957...
0.6029509
19
Returns a batch from experiment loaders by its index or name.
def get_native_batch_from_loaders( loaders: Dict[str, DataLoader], loader: Union[str, int] = 0, batch_index: int = 0, ): if isinstance(loader, str): loader_instance = loaders[loader] elif isinstance(loader, int): loader_instance = list(loaders.values())[loader] else: rais...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_native_batch_from_loader(loader: DataLoader, batch_index: int = 0):\n dataset = loader.dataset\n collate_fn = loader.collate_fn\n return collate_fn([dataset[batch_index]])", "def get_batch(self, name):\n batches = self._meta['sets'].get('batches', {})\n if batches.get(name):\n ...
[ "0.62770796", "0.6147377", "0.6142249", "0.5965098", "0.5944489", "0.58695436", "0.58550024", "0.5844343", "0.57876563", "0.57487893", "0.5744385", "0.56675255", "0.56562734", "0.56562734", "0.5644203", "0.56192917", "0.56192917", "0.561557", "0.55952257", "0.557245", "0.5514...
0.6902564
0
Transfers loader to distributed mode. Experimental feature.
def _force_make_distributed_loader(loader: DataLoader) -> DataLoader: from catalyst.data.sampler import DistributedSamplerWrapper sampler = ( DistributedSampler(dataset=loader.dataset) if getattr(loader, "sampler", None) is not None else DistributedSamplerWrapper(sampler=loader.sampler)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_cluster(self):", "def _load_disk(self):\r\n pass", "def _load_disk(self):", "def _load_disk(self):", "def train(self, train_loader):\n pass", "def load_fileclient_dist(filename, backend, map_location):\n rank, world_size = get_dist_info()\n rank = int(os.environ.get('LOCAL_RANK'...
[ "0.59361863", "0.5920277", "0.59072095", "0.59072095", "0.56024635", "0.5458916", "0.5377288", "0.5368101", "0.5337646", "0.5314456", "0.5306029", "0.53045654", "0.5274331", "0.52272767", "0.5219852", "0.5215269", "0.5144504", "0.5126292", "0.51216847", "0.51074153", "0.51073...
0.6326774
0
Check pytorch dataloaders for distributed setup. Transfers them to distirbuted mode if necessary. (Experimental feature)
def validate_loaders(loaders: Dict[str, DataLoader]) -> Dict[str, DataLoader]: from catalyst.data.sampler import DistributedSamplerWrapper rank = get_rank() if rank >= 0: for key, value in loaders.items(): if not isinstance( value.sampler, (DistributedSampler, Distribute...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataloaders(args):\n if args.dataset == 'heat':\n dataset_class = heat.HeatDiffusionDataset\n else:\n raise ValueError(f'Unknown dataset {args.dataset}')\n train_dataset = dataset_class(\n dataset_class.get_train_path(args.data_path), args, train=True)\n if args.dist:\n ...
[ "0.6899112", "0.6226834", "0.6168277", "0.6168277", "0.61057776", "0.6086646", "0.60528105", "0.5985111", "0.5980284", "0.5944964", "0.593367", "0.5921929", "0.5912628", "0.5857826", "0.5853588", "0.5849491", "0.5820345", "0.57989067", "0.57894933", "0.57853943", "0.57713866"...
0.5795563
18
Creates pytorch dataloaders from datasets and additional parameters.
def get_loaders_from_params( batch_size: int = 1, num_workers: int = 0, drop_last: bool = False, per_gpu_scaling: bool = False, loaders_params: Dict[str, Any] = None, samplers_params: Dict[str, Any] = None, initial_seed: int = 42, get_datasets_fn: Callable = None, **data_params, ) ->...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dataloaders(params):\r\n transform_train = transforms.Compose([transforms.RandomCrop(32, padding=4),\r\n transforms.RandomHorizontalFlip(),\r\n transforms.ToTensor(),\r\n transform...
[ "0.79882824", "0.7873911", "0.77523524", "0.7489144", "0.7423688", "0.74065715", "0.7383054", "0.73766834", "0.73579735", "0.735641", "0.7308889", "0.72247446", "0.7185362", "0.71817666", "0.7140771", "0.71166503", "0.711527", "0.7087059", "0.7068981", "0.7030009", "0.7026917...
0.0
-1
Insert mpc values into vector bc
def backsubstitution_numba(b, dofmap, num_dofs_per_element, mpc, global_indices): (slaves, slave_cells, cell_to_slave, cell_to_slave_offset, masters_local, coefficients, offsets) = mpc slaves_visited = numpy.empty(0, dtype=numpy.float64) # Loop through slave cells for (i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assemble_vector(form: _forms, constraint: MultiPointConstraint, b: Optional[_PETSc.Vec] = None) -> _PETSc.Vec:\n\n _log.log(_log.LogLevel.INFO, \"Assemble MPC vector\")\n timer_vector = Timer(\"~MPC: Assemble vector (numba)\")\n\n # Unpack Function space data\n V = form.function_spaces[0]\n x_do...
[ "0.6082489", "0.5575862", "0.5575201", "0.54895455", "0.5469619", "0.54367906", "0.5396512", "0.5330801", "0.53306586", "0.53206575", "0.5290812", "0.5254805", "0.5217282", "0.52065116", "0.5203687", "0.51997477", "0.5193619", "0.51802784", "0.5180166", "0.51514554", "0.51511...
0.47996634
90
Returns the data structures required to build a multipoint constraint. Given a nested dictionary, where the first keys are functions for geometrically locating the slave degrees of freedom. The values of these keys are another dictionary, containing functions for geometrically locating the master degree of freedom. The...
def slave_master_structure(V: function.FunctionSpace, slave_master_dict: typing.Dict[types.FunctionType, typing.Dict[ types.FunctionType, float]], subspace_slave=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_mixture_parameters(param_dict):\n compound1 = param_dict['compound1_name']\n compound2 = param_dict['compound2_name']\n compound1_mw = param_dict[compound1]['mw']\n compound2_mw = param_dict[compound2]['mw']\n n_fractions = param_dict['n_fractions']\n compound1_frac_range = np.linspace(0...
[ "0.5444125", "0.5406418", "0.5294767", "0.52280223", "0.5195249", "0.5088805", "0.50730544", "0.50400007", "0.49896812", "0.49793857", "0.4948449", "0.49242276", "0.49029934", "0.48890132", "0.48779187", "0.48230854", "0.4778732", "0.4759802", "0.47489172", "0.473061", "0.472...
0.5465718
0
Convenience function for locating a dof close to a point use numpy and lambda functions.
def dof_close_to(x, point): if point is None: raise ValueError("Point must be supplied") if len(point) == 1: return numpy.isclose(x[0], point[0]) elif len(point) == 2: return numpy.logical_and(numpy.isclose(x[0], point[0]), numpy.isclose(x[1], point[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindClosestPointWithinRadius(self, p_float, , p_float_4):\n ...", "def closest_point(point, points):\n return points[cdist([point], points).argmin()]", "def FindClosestPoint(self, ):\n ...", "def locate_source(p,d):\n # M = sensors, n = dimensions\n M, n = p.shape\n p = np.m...
[ "0.5620192", "0.5540381", "0.5476292", "0.5463289", "0.53948784", "0.52953845", "0.52639014", "0.515784", "0.5153333", "0.5147639", "0.5111826", "0.50957406", "0.5084647", "0.5053538", "0.5044675", "0.5013717", "0.5011052", "0.49993494", "0.4937481", "0.49339086", "0.492871",...
0.6613694
0
Find all rows in a matrix that is zero, and add a 1 on the diagonal
def ident_zeros(A): assert A.size[0] == A.size[1] A.assemble() o_range = A.getOwnershipRange() rows = [] for i in range(o_range[1]-o_range[0]): indices, values = A.getRow(o_range[0]+i) absrow = sum(abs(values)) if absrow < 1e-6: rows.append(o_range[0] + i) add...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero_matrix(matrix):\n rows = set()\n columns = set()\n m = len(matrix)\n n = len(matrix[0])\n for i in range(m):\n for j in range(n):\n if matrix[i][j] == 0:\n rows.add(i)\n columns.add(j)\n\n for i in range(m):\n for j in range(n):\n ...
[ "0.73189586", "0.7197821", "0.7129083", "0.70978343", "0.7078936", "0.68751305", "0.68057173", "0.6782833", "0.67469335", "0.66681945", "0.6666137", "0.66429776", "0.6623435", "0.6621061", "0.6620543", "0.6616192", "0.66147125", "0.66110265", "0.66069096", "0.65960264", "0.65...
0.64289784
36
Loads the network from the model_file
def load(model_file): return pickle.load(open(model_file))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __load_Model(self):\r\n PrintsForUser.printProcess(\"[INFO] Loading network...\")\r\n \r\n self.__model = load_model(self.__model_path)\r\n self.__lb = pickle.loads(open(self.__labels_path, \"rb\").read())", "def load_model(self, filename):\r\n pass", "def load_model(self):\n...
[ "0.80785453", "0.78836066", "0.78565896", "0.7795077", "0.7740179", "0.77031296", "0.7660467", "0.7653963", "0.75833833", "0.7533862", "0.7531292", "0.7489834", "0.7480979", "0.74483097", "0.7429411", "0.7424033", "0.74155533", "0.7393638", "0.7388102", "0.7344858", "0.731060...
0.7147446
35
Initialize the network with input, output sizes, weights, biases, learning_rate and regularization parameters
def __init__(self, input_dim, hidden_size, output_dim, learning_rate=0.01, reg_lambda=0.01): self.input_dim = input_dim self.output_dim = output_dim self.hidden_size = hidden_size self.Wxh = np.random.randn(384, 4) * 0.01 # Weight matrix for input to hidden self.Why = np.random.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, layerNeurons, numberOfLayers, initialWeights = None, lowerBound = None, upperBound = None):\r\n \r\n # Ensure that there is at-least one input and one output layer in the network\r\n assert len(layerNeurons) > 1, \"At least one input layer and one output layer is...
[ "0.74209976", "0.7396114", "0.7373526", "0.73277473", "0.73184055", "0.7301008", "0.7296244", "0.725816", "0.7257238", "0.72496414", "0.72361547", "0.72089535", "0.7180864", "0.71519685", "0.71486765", "0.71280986", "0.71126556", "0.7108435", "0.7079199", "0.7075433", "0.7041...
0.0
-1
Performs forward pass of the ANN
def _feed_forward(self, X): # Add code to calculate a1 and probs z1 = X.dot(self.Wxh) + self.bh a1 = np.tanh(z1) z2 = a1.dot(self.Why) + self.by exp_scores = np.exp(z2) probs = exp_scores/np.sum(exp_scores, axis=1, keepdims=True) return a1, probs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_train(self, *args, **kwargs):\n pass", "def forward(self, X, training=False):\n pass", "def feedForward(self):\n # Calculate the current values of the first layer\n self.layer1 = sigmoid(np.dot(self.input, self.weights1))\n\n # Calculate the sigmoid of the second ...
[ "0.73296845", "0.7058033", "0.7054047", "0.6995982", "0.69711787", "0.6962721", "0.6869112", "0.68467736", "0.68006057", "0.67674667", "0.6741799", "0.6737499", "0.67266357", "0.6712976", "0.67003626", "0.67003626", "0.6699479", "0.6699304", "0.668508", "0.6673779", "0.665580...
0.0
-1
Add regularization terms to the weights
def _regularize_weights(self, dWhy, dWxh, Why, Wxh): # Add code to calculate the regularized weight derivatives return dWhy, dWxh
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_regularization(self, w, loss, gradient, regularization, lambda_, m):\n if regularization == 'l2':\n loss += lambda_ / (2 * m) * np.squeeze(w.T.dot(w))\n gradient += lambda_ / m * w\n elif regularization == 'l1':\n loss += lambda_ / (2 * m) * np.sum(np.abs(w)...
[ "0.7179892", "0.7145785", "0.6990459", "0.6630686", "0.65943927", "0.6463276", "0.6454973", "0.64209753", "0.6366239", "0.6327552", "0.6272369", "0.6243218", "0.6200595", "0.61773133", "0.6166511", "0.61557037", "0.6152536", "0.6141911", "0.61305684", "0.6111044", "0.61042017...
0.7018406
2
Update the weights and biases during gradient descent
def _update_parameter(self, dWxh, dbh, dWhy, dby): # Add code to update all the weights and biases here
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __update_weights_grad_desc(self, x_train, y_train):\n\n predictions = self.__compute_prediction(x_train)\n weights_delta = np.dot(x_train.T, y_train - predictions)\n\n m = y_train.shape[0]\n self.__weights += self.__learning_rate / float(m) * weights_delta", "def update_weights(se...
[ "0.80361515", "0.7598971", "0.75904953", "0.7497646", "0.7484387", "0.73378307", "0.7328388", "0.72507805", "0.72425085", "0.71753126", "0.71582067", "0.70501596", "0.7045166", "0.70064026", "0.6990169", "0.69767416", "0.69753116", "0.69537646", "0.6943432", "0.691215", "0.68...
0.6541168
66
Implementation of the backpropagation algorithm
def _back_propagation(self, X, t, a1, probs,length): # Add code to compute the derivatives and return delta3 = probs delta3[range(length),t] -= 1 dWhy = (a1.T).dot(delta3) dby = np.sum(delta3, axis=0, keepdims=True) delta2 = delta3.dot(dWhy.T) * (1 - np.power(a1, 2)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backprop(self, x, y):\n \n #Building an empty networks filled with empty 0 \n updated_bias = []\n for b in self.biases:\n updated_bias.append(np.zeros(b.shape)) \n \n updated_weight = []\n for w in self.weights:\n updated_weight.appe...
[ "0.7893654", "0.7775679", "0.77610594", "0.7709016", "0.7621128", "0.7585972", "0.7565034", "0.74838185", "0.74370015", "0.7416354", "0.7389637", "0.7382596", "0.7374434", "0.736721", "0.7365797", "0.7363849", "0.73629916", "0.7333083", "0.7329341", "0.7325105", "0.731928", ...
0.75821644
6
Calculate the smoothened loss over the set of examples
def _calc_smooth_loss(self, loss, len_examples, regularizer_type=None): if regularizer_type == 'L2': # Add regulatization term to loss return 1./len_examples * loss else: return 1./len_examples * loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pseudo_loss(self, params, batches):\n loss = 0\n for batch in batches:\n states = batch[\"states\"]\n actions = batch[\"actions\"]\n returns = batch[\"returns\"]\n\n preds = self.predict_jax(params, states)\n\n baseline = jnp.mean(returns, ax...
[ "0.7046122", "0.6933266", "0.67758876", "0.6710177", "0.67039424", "0.65970236", "0.6579602", "0.65749127", "0.65639144", "0.65343916", "0.6528188", "0.6524744", "0.65166056", "0.65154487", "0.6511314", "0.6507151", "0.64965415", "0.6463061", "0.6462403", "0.6458007", "0.6445...
0.0
-1
Trains the network by performing forward pass followed by backpropagation
def train(self, inputs, targets, validation_data, num_epochs, regularizer_type=None): for k in xrange(num_epochs): loss = 0 # Forward pass a1, probs = self._feed_forward(inputs) # Backpropagation dWxh, dWhy, dbh, dby = self._back_propagati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_train(self, *args, **kwargs):\n pass", "def feedForward(self):\n # Calculate the current values of the first layer\n self.layer1 = sigmoid(np.dot(self.input, self.weights1))\n\n # Calculate the sigmoid of the second layer which is the output\n self.output = sigmoid(...
[ "0.6965216", "0.6921678", "0.6789786", "0.6776324", "0.6767226", "0.67588675", "0.6663136", "0.6638087", "0.6580595", "0.6559318", "0.65537626", "0.65397984", "0.6535671", "0.65028805", "0.65024525", "0.64893365", "0.6480598", "0.6480408", "0.647741", "0.64655685", "0.6463688...
0.0
-1
Given an input X, emi
def predict(self, X, y): # Implement the forward pass and return the output class (argmax of the softmax outputs) a1, probs = self._feed_forward(X) hits = 0 for i in xrange(len(y)): if np.where(probs[i]==max(probs[i]))[0][0] == y[i]: hits+=1 print hits,len(X...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __em(self, x):\n _, log_resp = self._e_step(x)\n\n pi, mu, var = self._m_step(x, log_resp)\n\n self.__update_pi(pi)\n self.__update_mu(mu)\n self.__update_var(var)", "def test_support_INVEX(self):\n self.assertEqual(self._parseFeature(\"INVEX\", \"Z\"), \"Z\")\n ...
[ "0.5687068", "0.5627485", "0.5571878", "0.5418379", "0.54145116", "0.5318582", "0.52997404", "0.5267728", "0.52024394", "0.51604664", "0.5143021", "0.51003444", "0.50619334", "0.50566435", "0.50231236", "0.49777362", "0.49734622", "0.49568754", "0.495462", "0.49533582", "0.49...
0.0
-1
Saves the network to a file
def save(self, model_file): pickle.dump(self, open(model_file, 'wb'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_network(network, fpath):\n\twith open(fpath, \"wb\") as f:\n\t\tpickle.dump(network, f)", "def save_net(net, filepath):\n\twith open(filepath, 'wb+') as fh:\n\t\tdump(obj = net, file = fh, protocol = -1)", "def export_network(file_name, net) -> None:\r\n file = open(file_name, 'wb')\r\n file.wri...
[ "0.8235571", "0.80835664", "0.75442106", "0.75003153", "0.7487173", "0.7381429", "0.727793", "0.7240167", "0.72368324", "0.7173263", "0.71639335", "0.69699883", "0.6954969", "0.6909733", "0.69001526", "0.68852276", "0.68837154", "0.68791676", "0.68103606", "0.6777189", "0.676...
0.0
-1
predictGame is a function and is invoked in dispatch when the operation to be performed is predict high score, low score & average score for lookahead moves.
def predictGame(messageDictionary): #output dictionary is returned to dispatch after the calculations are done outputDictionary = {} outputDictionary["gameStatus"] = "underway" #call to validatePredict to validate the input dictionary outputDictionary = validatePredict(messageDictionary, outputDic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, game:'Game'): # noqa: E0602, F821\n response = self.__send_game(game)\n return response", "def predict_outcome(self, game:'Game') -> float: # noqa: E0602, F821\n response = self.__send_game(game)\n return response[1]", "def predict_Keras():\n #read future game...
[ "0.7299662", "0.6904139", "0.6807237", "0.6549272", "0.64293885", "0.63504833", "0.6344803", "0.63210434", "0.6296399", "0.6229284", "0.6220852", "0.6206481", "0.6205331", "0.61918354", "0.6151533", "0.6146176", "0.614611", "0.6118504", "0.6116085", "0.6094616", "0.60856265",...
0.6895396
2
update grad related data in full resolution
def update_grad_data(): t_file = 'hcapgrd1_full_data_*.fits*' out_dir = deposit_dir + '/Grad_save/' tdir = out_dir + 'Gradcap/' # #--- read grad group name # gfile = house_keeping + 'grad_list' grad_list = mcf.read_data_file(gfile) [tstart, tstop, year] = ecf.find_data_collecting_period...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _UpdateGradient(self):\n self.mol.GetGradient('analytic')", "def update(self):\n self.arest.update()", "def update():", "def update():", "def updateG(self, dt):\n\t\tself.tissue.G.project( (self.initial * dt + Identity(3)) * self.tissue.G )", "def force_update_graph(self):\n self.upd...
[ "0.64381087", "0.6039294", "0.60320777", "0.60320777", "0.59506106", "0.5820663", "0.5819838", "0.58146644", "0.5809392", "0.5805305", "0.5803003", "0.57782805", "0.5775283", "0.5766644", "0.5766644", "0.5766644", "0.57610506", "0.5724304", "0.572347", "0.57166773", "0.570517...
0.7163576
0
update msid data in msid_list for the given data period
def get_data(tstart, tstop, year, grad_list, out_dir): print("Period: " + str(tstart) + '<-->' + str(tstop) + ' in Year: ' + str(year)) # #--- extract ecach group data # for group in grad_list: print(group) line = 'operation=retrieve\n' line = line + 'dataset = mta\n' line = lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generator_place_update_pids(ms, new_pid_dict):\n # print \">>> \", new_pid_dict\n new_ms = multiset()\n for pid, n in ms:\n new_pid = Pid.from_list(new_pid_dict[tuple(pid.data)])\n new_n = Pid.from_list(new_pid_dict[ tuple(pid.next(n).data) ]).ends_with() - 1\n new_ms.add((new_pid...
[ "0.5456846", "0.52601284", "0.5259704", "0.5156615", "0.5082855", "0.50776327", "0.50758034", "0.5069569", "0.50444466", "0.5033247", "0.5029289", "0.50191236", "0.4987042", "0.4984111", "0.49803722", "0.49793786", "0.49717724", "0.49439514", "0.4932616", "0.4929739", "0.4926...
0.0
-1
Set up the PACS instrument.
def __init__(self, band, active_fraction=0, fine_sampling_factor=1, policy_bad_detector='mask', reject_bad_line=True, comm=MPI.COMM_WORLD): band = band.lower().strip() expected = 'blue', 'green', 'red' if band not in expected: raise ValueError("Inval...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_setup_pocs(self, *arg):\n args, kwargs = string_to_params(*arg)\n simulator = kwargs.get('simulator', [])\n print_info(\"Simulator: {}\".format(simulator))\n\n try:\n self.pocs = POCS(simulator=simulator)\n self.pocs.initialize()\n except error.PanErr...
[ "0.67579174", "0.66947913", "0.65121156", "0.64911264", "0.6412101", "0.6392717", "0.63770014", "0.6237447", "0.6133334", "0.6107687", "0.6104067", "0.6046922", "0.6025208", "0.6009841", "0.5974992", "0.58549696", "0.58441997", "0.5822551", "0.57593024", "0.56885356", "0.5681...
0.0
-1
Convert coordinates in the (u,v) plane into the (y,z) plane, assuming a chop angle.
def uv2yz(self, coords, chop=0): coords = np.array(coords, float, order='c', copy=False) yz = np.empty_like(coords) distortion = self.distortion_yz.base.base.base tmf.pacs_uv2yz(coords.reshape((-1,2)).T, distortion, chop, yz.reshape((-1,2)).T) yz *= 3600 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uv_to_coord(uv):\n transposed_uv = np.transpose(uv)\n x = transposed_uv[0] \n y = transposed_uv[1] \n z = transposed_uv[2]\n \n c = SkyCoord(x, y, z, unit = 'mpc', representation_type = 'cartesian',\n frame = 'icrs')\n\n return c", "def proyZm1(u, v, t1):\n ...
[ "0.61944693", "0.6185099", "0.6060304", "0.60305244", "0.6014021", "0.59566766", "0.5864326", "0.5781212", "0.5732748", "0.57312196", "0.5688741", "0.5502812", "0.54883116", "0.5481512", "0.5480482", "0.5480482", "0.5473742", "0.54688644", "0.54560274", "0.5441397", "0.542247...
0.69537777
0
Convert coordinates in the (u,v) plane into celestial coordinates, assuming a pointing direction and a position angle.
def uv2ad(self, coords, pointing): coords = np.array(coords, float, order='c', copy=False) ad = np.empty(pointing.shape + coords.shape, float) coords = coords.reshape((-1,2)) distortion = self.distortion_yz.base.base.base tmf.pacs_uv2ad(coords.T, pointing['ra'].ravel(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_coord(norm, d, pts):\n # Compute the origin as the mean point of the points, and this point has to be on the plane\n \n n = len(pts) \n x_total = 0\n y_total = 0\n z_total = 0\n \n for i in range(n):\n x_total += pts[i][0]\n y_total += pts[i][1]\n z_total += p...
[ "0.56984663", "0.56822234", "0.55598813", "0.55472475", "0.54942214", "0.5481065", "0.5419634", "0.5416382", "0.5416128", "0.5368024", "0.53565735", "0.53381264", "0.53367597", "0.53355867", "0.53273153", "0.5312171", "0.52980036", "0.52692777", "0.5258552", "0.5238669", "0.5...
0.0
-1
Convert coordinates in the (y,z) plane into celestial coordinates, assuming a pointing direction and a position angle.
def yz2ad(self, coords, pointing): return super(PacsInstrument, self).instrument2ad(coords, pointing)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromECEFtoLatLongDegrees(x, y, z):\n ret = fromECEFtoLatLong(x, y, z)\n return math.degrees(ret[0]), math.degrees(ret[1]), ret[2]", "def xyz2plane(x,y,z, new_x=[], plane=[], origin=None):\n # preliminary stuff\n if origin != None: x = x - origin\n a,b,c,d = plane\n bottom = np.sqrt(a*a + b*b +...
[ "0.59502137", "0.5758122", "0.57307214", "0.5723314", "0.5712086", "0.57021403", "0.570138", "0.5659975", "0.56141365", "0.5574885", "0.555042", "0.5529116", "0.55197024", "0.5510846", "0.54765266", "0.5473403", "0.54644954", "0.544101", "0.54239607", "0.5413395", "0.5404595"...
0.0
-1
Return the minimum and maximum sky pixel coordinate values for a set of coordinates specified in the (u,v) frame.
def instrument2xy_minmax(self, coords, pointing, header): coords = np.array(coords, float, order='c', copy=False) xmin, ymin, xmax, ymax, status = tmf.pacs.uv2xy_minmax( coords.reshape((-1,2)).T, pointing['ra'].ravel(), pointing['dec'].ravel(), pointing['pa'].ravel(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_and_min(self):\n max_x = float('-inf')\n min_x = float('inf')\n max_y = float('-inf')\n min_y = float('inf')\n max_z = float('-inf')\n min_z = float('inf')\n ans = max_x, max_y, max_z, min_x, min_y, min_z\n counter = 0\n for src, node in se...
[ "0.6924671", "0.6424969", "0.61948615", "0.6065038", "0.6032333", "0.6032219", "0.60068566", "0.59866816", "0.59852475", "0.59732544", "0.5918796", "0.59173995", "0.5916899", "0.5839536", "0.583425", "0.5826967", "0.5785621", "0.5769795", "0.57387286", "0.5735453", "0.5700758...
0.63084406
2
Return the dense pointing matrix whose values are intersection between detectors and map pixels.
def instrument2pmatrix_sharp_edges(self, coords, pointing, header, pmatrix, npixels_per_sample): coords = coords.reshape((-1,2)) ra = pointing['ra'].ravel() dec = pointing['dec'].ravel() pa = pointing['pa'].ravel() chop = pointing['chop'].ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_map_offsets(self):\n map = self.map.copy()\n map_up = np.zeros((self.h + 1, self.w), np.uint8) # create 4-neighbor connectivity comparision\n map_down = np.zeros((self.h + 1, self.w), np.uint8)\n map_right = np.zeros((self.h, self.w + 1), np.uint8)\n map_left = np.zero...
[ "0.6341654", "0.5626789", "0.54947454", "0.5472413", "0.5406649", "0.5348741", "0.5346484", "0.5309716", "0.5248718", "0.52088153", "0.51692873", "0.5168997", "0.51670337", "0.5137343", "0.5128474", "0.51215345", "0.5109295", "0.508304", "0.5081762", "0.50795776", "0.50782424...
0.0
-1
Return the PACSspecific pointing matrix for a given set of pointings.
def get_pointing_matrix(self, pointing, header, npixels_per_sample=0, method='sharp', downsampling=False, compression_factor=None, delay=0., units=None, derived_units=None, comm=MPI.COMM_WORLD): if method is None: me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_matrix(self, source_points, destination_points):\n return [\n [self.measure_between_two_points(point_a, point_b) for point_b in destination_points]\n for point_a in source_points\n ]", "def afficher_points_2D(set_points):\n X, Y = [p[0][0] for p in set_points], [p[...
[ "0.604874", "0.58545774", "0.57588595", "0.5698002", "0.56862795", "0.5661911", "0.5608424", "0.5517443", "0.54482424", "0.543538", "0.54151875", "0.535561", "0.5343261", "0.53388506", "0.53377056", "0.533229", "0.5297682", "0.5295389", "0.5288998", "0.52772486", "0.5275723",...
0.5378749
11
Return data from the calibration file set. Parameter
def get_calibration(self, name): name = name.lower() expected = ('absorption', 'badpixel', 'filter transmission', 'total transmission', 'gain', 'invntt', 'responsivity', 'timeconstant', 'stddev') if name not in expected: raise ValueError("Inva...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_calibration_data(self):\n #Declare global variables.\n global calT1\n global calT2\n global calT3\n global calP1\n global calP2\n global calP3\n global calP4\n global calP5\n global calP6\n global calP7\n global calP8\n ...
[ "0.6856678", "0.6759978", "0.6588898", "0.657393", "0.6475413", "0.63763416", "0.63673043", "0.6318859", "0.6295693", "0.62789935", "0.61824745", "0.6178913", "0.6153914", "0.61184597", "0.6115963", "0.6085561", "0.6019218", "0.6009292", "0.59900814", "0.5972511", "0.59663045...
0.67558
2
Return FITS file as an HDU list and check format version.
def _get_calfile(self, filename, versions): if isscalar(versions): versions = (versions,) if not os.path.isfile(filename): raise IOError("The calibration file '{0}' does not exist or is " "not a valid file.".format(filename)) hdus = pyfits.open(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extractFIESHeader(file):\n\n try:\n\n hdulist = pyfits.open(file)\n hdulist.close()\n\n if len(hdulist) > 0:\n prihdr = hdulist[0].header\n a = ['fies','FI',prihdr]\n for i in range(1, len(hdulist)):\n a.append(hdulist[i].header)\n return a\n else:\n return ['ERROR'...
[ "0.6485853", "0.64821184", "0.6438226", "0.6303294", "0.6199642", "0.5962726", "0.5960119", "0.59521914", "0.59498054", "0.5893513", "0.579941", "0.5769727", "0.57492995", "0.5719023", "0.5696674", "0.56947064", "0.56870055", "0.56564265", "0.5642543", "0.5641584", "0.5638401...
0.5912471
9
Return the inverse noise timetime correlation coefficients.
def get_filter_uncorrelated(self): return self.instrument.get_calibration('invntt')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inv(siso):\n num = siso.num[0][0]\n den = siso.den[0][0]\n return ctrl.tf(den,num,siso.dt)", "def _normed_concentration_cached(self, time: float) -> _VectorisedFloat:\n return self._normed_concentration(time)", "def get_thermal_covariance(self):\n cov = []\n for var in self.no...
[ "0.52399397", "0.5231864", "0.5214214", "0.52137434", "0.5204542", "0.51780665", "0.51361746", "0.5107085", "0.51048934", "0.5077943", "0.5031787", "0.50150627", "0.49865398", "0.4968587", "0.49233326", "0.49120158", "0.49117133", "0.4911661", "0.49081445", "0.4901266", "0.48...
0.5075607
10
Return the PACSspecific pointing matrix for the observation. If the observation has several slices, as many pointing matrices are returned in a list.
def get_pointing_matrix(self, header, npixels_per_sample=0, method=None, downsampling=False, section=None, comm=MPI.COMM_WORLD): if section is None: return super(PacsBase, self).get_pointing_matrix(header, npixels_per_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neighbors(point):\n pt = point.copy()\n output= [point.copy() for i in range(4)]\n output[0:2] = map(Point.setY, output[0:2], [pt.getY()+ i for i in range(-1,2,2)])\n output[2:4]= map(Point.setX, output[2:4], [pt.getX()+ i for i in range(-1,2,2)])\n return output", "def get_pointer_section...
[ "0.54192126", "0.5042742", "0.50278944", "0.4957887", "0.49473453", "0.49380195", "0.49365938", "0.49317816", "0.49207887", "0.49150553", "0.49030608", "0.48919055", "0.4853464", "0.48280665", "0.47937012", "0.47761717", "0.47713685", "0.47575518", "0.4756305", "0.47314298", ...
0.54859775
0
Return noise data from a random slice of a real pointed observation. Currently, the required duration must be less than that of the real observation (around 3 hours).
def get_random(self, flatfielding=True, subtraction_mean=True): if any([slice.compression_factor not in [4,8] for slice in self.slice]): raise NotImplementedError('The compression factor must be 4 or 8.') path = os.path.join(var.path, 'pacs') files = { 'blue' : ('1342182...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noise(self):\r\n if self.buffer_offset + self.frames_per_buffer - 1 > self.x_max:\r\n #relleno con ceros al final si es necesario\r\n xs = np.arange(self.buffer_offset, self.x_max)\r\n tmp = np.random.random_sample(len(xs)) #ruido\r\n out = np.append(tmp, np.z...
[ "0.65129423", "0.62532187", "0.62303597", "0.6103324", "0.6097016", "0.6078385", "0.6068334", "0.60188043", "0.59746003", "0.594265", "0.59147614", "0.5889064", "0.5827273", "0.5821273", "0.57901174", "0.57543117", "0.5745692", "0.5664459", "0.5642329", "0.5640243", "0.561457...
0.0
-1
Returns detector's standard deviation from calibration file
def get_detector_stddev(self, length=0): lengths, stddevs = self.instrument.get_calibration('stddev') if length == 0: return self.pack(stddevs[...,-1]) if length < lengths[0]: raise ValueError('The value of the median filtering length should b' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standard_deviation(self):\r\n\t\treturn self.variance()**(1/2)", "def standard_deviation(self):\n clean, total = self._prepare_for_stats()\n if not total:\n return None\n\n return math.sqrt(clean.variance())", "def standard_dev(self):\n return self.variance()**0.5", ...
[ "0.671013", "0.6672784", "0.6658662", "0.6571934", "0.6443426", "0.6416653", "0.64020526", "0.6386533", "0.6386533", "0.6369035", "0.6362797", "0.63555735", "0.6283316", "0.62243253", "0.6156727", "0.61470175", "0.61222863", "0.6119557", "0.609404", "0.60737365", "0.6066622",...
0.57772005
54
Return the number of valid samplings for each slice, by taking into account compression factor and fine sampling. They are those whose self.pointing is not removed.
def get_nfinesamples(self): return tuple(np.asarray(self.get_nsamples()) * \ self.slice.compression_factor * \ self.instrument.fine_sampling_factor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_count(self):\n assert len(self.decay_x) == len(self.decay_y)\n return len(self.decay_x)", "def _count_block_perm(orig_vals, perm_ds, nbs, tail, rng, return_null, clip_min_value):\n orig_vals = np.atleast_2d(orig_vals)\n # uniform perm_ds for both single and paired test\n if perm...
[ "0.6506231", "0.6302611", "0.62566555", "0.6216657", "0.61590683", "0.61199486", "0.60595316", "0.6048185", "0.60077083", "0.59875214", "0.59564877", "0.5913218", "0.5910656", "0.5910656", "0.5904776", "0.5903784", "0.587871", "0.58774364", "0.58659023", "0.585209", "0.583657...
0.6644689
0
Return a sky scan for the PACS instrument. The output is a Pointing instance that can be handed to PacsSimulation to create a simulation.
def create_scan(cls, center, length, step=148, sampling_period=None, speed=20, acceleration=ACCELERATION, nlegs=3, angle=0, instrument_angle=45, compression_factor=4, cross_scan=True): if sampling_period is None: if int(compression_factor)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scan(self):\n\n return self._scan_factory.make_scan(\n image_range=(1, 1),\n # dummy value--return to this later please\n exposure_time=1,\n oscillation=(\n self.detectorbase.osc_start,\n self.detectorbase.osc_start + self.detect...
[ "0.5746266", "0.506474", "0.49583694", "0.4863261", "0.48469698", "0.48300648", "0.48104277", "0.47972572", "0.47229928", "0.47021076", "0.46826926", "0.46820483", "0.46613055", "0.46553722", "0.4640871", "0.46237504", "0.46197218", "0.45881274", "0.4583141", "0.4549301", "0....
0.5223673
1
Returns the signal and mask timelines. By default, all activated masks will be combined.
def get_tod(self, unit='Jy/detector', flatfielding=False, subtraction_mean=False, no_unit_conversion=False, masks='activated'): act_masks = set([m for slice in self.slice \ for i, m in enumerate(slice.mask_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_dtv_flagging2(data, freqs):\n \n mask = data.mask*1\n dtv_times = []\n \n for ledge in (54, 60, 66, 76, 82):\n uedge = ledge + 6\n band = np.where( (freqs>=ledge) & (freqs<=uedge) )[0]\n trns = np.where( (freqs>=ledge+0.25) & (freqs<=uedge-0.25) )[0]\n empt = np.w...
[ "0.55140257", "0.5493659", "0.5428292", "0.5308234", "0.52128303", "0.5205367", "0.5183682", "0.5136684", "0.51366", "0.5112739", "0.50524056", "0.49903628", "0.4921", "0.49115276", "0.48796055", "0.48743868", "0.4853973", "0.4848935", "0.48420635", "0.48420346", "0.48336473"...
0.0
-1
Returns the operator which converts PACS timelines from Volts to ADU.
def PacsConversionAdu(obs, gain='nominal', offset='direct'): if gain not in obs.instrument.adu_converter_gain: raise ValueError("Invalid gain. Expected values are 'low', 'high' or 'n" "ominal'.") if offset not in obs.instrument.adu_converter_offset: raise ValueError("Inv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eta2abc(parameter):\r\n # PV2AC conversion pathway TODO\r\n if parameter['Top'] == 'DC' or parameter['Top'] == 'PVINV' or parameter['Top'] == 'PV' and parameter['P_PV2AC_out'] is not None or parameter['Top'] == 'AC' and parameter['P_PV2AC_out'] is not None:\r\n \r\n # Create variables for t...
[ "0.5218613", "0.51823133", "0.50914484", "0.48762998", "0.4860368", "0.48171657", "0.47890833", "0.47625923", "0.4752423", "0.47399518", "0.4712024", "0.46896645", "0.46873918", "0.46873918", "0.4650318", "0.4644534", "0.46405387", "0.46370304", "0.46191022", "0.4616998", "0....
0.5116109
2
deglitch, filter and potentially compress if the observation is in transparent mode
def pacs_preprocess(obs, tod, projection_method='sharp', header=None, downsampling=False, npixels_per_sample=0, deglitching_hf_length=20, deglitching_nsigma=5., hf_length=30000, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_denoise(self, x):\n b, a = self.c_notch\n return filtfilt(b, a, x)", "def filter_out_flickers(total_buffer,index_disappeared):\n \n wait_for_disparition = False\n candidate_for_disparition = -1\n to_destroy = [] #List of 3D tuples (value,first_index,last_index) of segmented...
[ "0.5940264", "0.57888854", "0.56609976", "0.5598279", "0.5571579", "0.5547801", "0.5547801", "0.55289155", "0.5483978", "0.54816383", "0.5425529", "0.54046345", "0.5402441", "0.5388734", "0.53727907", "0.53614545", "0.5357019", "0.5333438", "0.5318575", "0.5286538", "0.527774...
0.5555929
5
Return gaussian, airy or calibration PSFs Calibration PSFs are rescaled to the required pixel resolution by a bilinear interpolation.
def pacs_get_psf(band, resolution, kind='calibration'): band = band.lower() choices = ('blue', 'green', 'red') if band not in choices: raise ValueError("Invalid band '" + band + "'. Expected values are " + \ strenum(choices) + '.') kind = kind.lower() choices = ('a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scale_psf(self, input_irf_file, config):\n\n # Find all \"sigma\" values - tells how many PSF components we have in the IRF file\n column_names = [col.name.lower() for col in input_irf_file['POINT SPREAD FUNCTION'].columns]\n sigma_columns = list(filter(lambda s: \"sigma\" in s.lower(), c...
[ "0.5934714", "0.59323114", "0.56692666", "0.56136227", "0.5515017", "0.55022854", "0.5450474", "0.5448875", "0.541764", "0.53971016", "0.53850543", "0.5371395", "0.5353867", "0.53373635", "0.53324974", "0.5330355", "0.52796024", "0.5279098", "0.52602744", "0.52514803", "0.524...
0.0
-1
Compute temporal offset between the PACS counter and the spacecraft clock.
def pacs_compute_delay(obs, tod, model, invntt=None, tol_delay=1.e-3, tol_mapper=1.e-3, hyper=1., brack=(-60.,-30.,0.), full_output=False): global map_rls def func_model(obs, tod, model): def substitute_projection(model): for i, c in enumerate(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clock_time(self):\n return self._shifted_time % (24*3600)", "def _prev_shifted_time(self):\n return self._prev_sim_time + self.options.time.start_clocktime", "def _shifted_time(self):\n return self.sim_time + self.options.time.start_clocktime", "def GetDeviceHostClockOffset(self):\n...
[ "0.62899196", "0.60005045", "0.59686583", "0.5939301", "0.5939301", "0.58321625", "0.5753285", "0.574835", "0.5717388", "0.5690558", "0.5614201", "0.5609203", "0.56034964", "0.5539353", "0.55265343", "0.5476326", "0.54753363", "0.5435063", "0.54001856", "0.5394224", "0.539154...
0.0
-1
Return FITS keyword, according to HCSS handling.
def _hcss_fits_keyword(header, keyword, *args): if len(args) > 1: raise ValueError('Invalid number of arguments.') for k in header.keys(): if not k.startswith('key.'): continue if header[k] == keyword: return header[k[4:]] if len(args) == 1: return arg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cached_dm_find_fits_keyword(key):\n return MODEL.find_fits_keyword(key.upper(), return_result=True)", "def getKeyword(self, key):\n try:\n return self.raw[0].header[key]\n except:\n return self.raw[0].header['HIERARCH ESO '+key]", "def translate_keyword(keyword):\n ...
[ "0.61742735", "0.5731916", "0.5624878", "0.5479709", "0.5469909", "0.536184", "0.5338029", "0.53282803", "0.53036934", "0.52704316", "0.52200615", "0.51690644", "0.51421887", "0.51387876", "0.5137836", "0.51041573", "0.5076539", "0.50673413", "0.5035812", "0.50308436", "0.502...
0.62036276
0
Mask everything up to the n_scanline scan line of the n_repetition repetition. If n_scanline is None, mask the whole repetition. Arguments
def step_scanline_masking(obs, n_repetition=0, n_scanline=None): if n_scanline == None: for i in xrange(n_repetition): obs.pointing.masked[obs.status.Repetition == i] = True else: for i in xrange(n_repetition - 1): obs.pointing.masked[obs.status.Repetition == i] = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maskgroup(x, n):\n # create running lists\n index = []\n length = []\n count = 0\n\n # count indices and lengths of unmasked data groups\n for i in range(x.mask.size):\n if i==0:\n if not x.mask[i]:\n index += [i]\n count = 1\n if i>0:...
[ "0.5703053", "0.5262323", "0.5123203", "0.51200473", "0.5092291", "0.49722835", "0.49684605", "0.49445692", "0.49437836", "0.491899", "0.4886753", "0.48616335", "0.48601496", "0.48428234", "0.48108998", "0.48108998", "0.4792055", "0.4777932", "0.47722837", "0.4742274", "0.473...
0.77437854
0
The mask of a 3d image should be 2d
def test_05_01_mask_of3D(self): x=cpi.Image() x.image = np.ones((10,10,3)) self.assertTrue(x.mask.ndim==2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mask(self):\n\t\treturn pygame.mask.from_surface(self.img)", "def getHitmask(self,image):\n\t\tmask = []\n\t\tfor x in range(image.get_width()):\n\t\t\tmask.append([])\n\t\t\tfor y in range(image.get_height()):\n\t\t\t\tmask[x].append(bool(image.get_at((x,y))[3]))\n\t\treturn mask", "def get_mask(self,...
[ "0.688976", "0.68292147", "0.68080103", "0.67995906", "0.6752144", "0.6688653", "0.66669863", "0.661741", "0.6568836", "0.6568836", "0.6568836", "0.6547132", "0.65295583", "0.6466821", "0.6449835", "0.64433336", "0.6434398", "0.64335746", "0.6432887", "0.6421492", "0.64210224...
0.8106994
0
test that an 'is_disconnect' condition will invalidate the connection, and additionally dispose the previous connection pool and recreate.
def test_reconnect(self): # make a connection conn = self.db.connect() # connection works conn.execute(select(1)) # create a second connection within the pool, which we'll ensure # also goes away conn2 = self.db.connect() conn2.close() # two...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_already_disconnected(connection, events, schedule, flush):\n schedule(connection.connect(),\n connection.disconnect(),\n connection.disconnect())\n flush()\n assert events.triggered(\"CLIENT_CONNECT\")\n assert events.triggered(\"CLIENT_DISCONNECT\")", "def test_disco...
[ "0.71215147", "0.7030726", "0.70195895", "0.6962915", "0.6929336", "0.68194956", "0.6759856", "0.6750204", "0.6691207", "0.6621002", "0.6536765", "0.64876175", "0.64719003", "0.6469791", "0.6457137", "0.6449306", "0.640901", "0.63973737", "0.6388318", "0.6374561", "0.6314033"...
0.7141908
0
test the fixture raises on connect
def test_control(self, ping_fixture): engine = ping_fixture with expect_raises_message( exc.DBAPIError, "unhandled disconnect situation" ): engine.connect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection_fail(context_fixture):\n with pytest.raises(SystemExit):\n context_fixture('RequestException')", "def test_passing_bad_connection(self):\n self.assertRaises(\n ConnectionError, Pet.init_db, Redis(host=\"127.0.0.1\", port=6300)\n )\n self.assertIsNone(...
[ "0.7074696", "0.6893949", "0.68652934", "0.6857744", "0.683198", "0.6786823", "0.6782504", "0.6678462", "0.6664294", "0.66146845", "0.64933455", "0.648083", "0.64726126", "0.64562", "0.6455107", "0.64305156", "0.6425814", "0.6402725", "0.6401104", "0.6391827", "0.63894486", ...
0.68847454
2
test the disconnect fixture doesn't raise, since it considers all errors to be disconnect errors.
def test_downgrade_control(self, ping_fixture_all_errs_disconnect): engine = ping_fixture_all_errs_disconnect conn = engine.connect() conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_event_handler_didnt_downgrade_disconnect(\n self, ping_fixture_all_errs_disconnect\n ):\n engine = ping_fixture_all_errs_disconnect\n\n @event.listens_for(engine, \"handle_error\")\n def setup_disconnect(ctx):\n assert ctx.is_pre_ping\n assert ctx.is_di...
[ "0.8239868", "0.8152695", "0.77598417", "0.7655665", "0.75864327", "0.7565692", "0.75071055", "0.7395507", "0.73369473", "0.72375166", "0.7187973", "0.7111573", "0.7008865", "0.70034695", "0.6906625", "0.686975", "0.6785399", "0.67540044", "0.66884893", "0.66840935", "0.66407...
0.7288089
9
test that having an event handler that doesn't do anything keeps the behavior in place for a fatal error.
def test_event_handler_didnt_upgrade_disconnect(self, ping_fixture): engine = ping_fixture @event.listens_for(engine, "handle_error") def setup_disconnect(ctx): assert not ctx.is_disconnect with expect_raises_message( exc.DBAPIError, "unhandled disconnect situat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_implemented(self):\n\n test_handler = EventHandler(self.mock_interruption_event)\n\n with self.assertRaises(NotImplementedError):\n test_handler.handle()", "def test_sandbox_errors_false(self):\n SignalHook(self.test_extension, self.signal, self._on_signal_exception,\...
[ "0.7467973", "0.6660555", "0.65037405", "0.64326495", "0.64048284", "0.63686633", "0.63043034", "0.62444484", "0.62275404", "0.62135327", "0.62035763", "0.6167127", "0.61608183", "0.6148361", "0.6082591", "0.60748696", "0.6074616", "0.6068908", "0.6063432", "0.6061368", "0.60...
0.6120394
14
test that having an event handler that doesn't do anything keeps the behavior in place for a disconnect error.
def test_event_handler_didnt_downgrade_disconnect( self, ping_fixture_all_errs_disconnect ): engine = ping_fixture_all_errs_disconnect @event.listens_for(engine, "handle_error") def setup_disconnect(ctx): assert ctx.is_pre_ping assert ctx.is_disconnect ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_event_handler_didnt_upgrade_disconnect(self, ping_fixture):\n engine = ping_fixture\n\n @event.listens_for(engine, \"handle_error\")\n def setup_disconnect(ctx):\n assert not ctx.is_disconnect\n\n with expect_raises_message(\n exc.DBAPIError, \"unhandled d...
[ "0.78867626", "0.76576835", "0.73965603", "0.7263293", "0.7216937", "0.7042568", "0.6785579", "0.65975875", "0.6531375", "0.6502572", "0.6493144", "0.64641625", "0.64185786", "0.64083093", "0.6385069", "0.6377654", "0.6374116", "0.63512623", "0.6334448", "0.63215125", "0.6294...
0.7935945
0
test that an event hook can receive a fatal error and convert it to be a disconnect error during preping
def test_event_handler_can_upgrade_disconnect(self, ping_fixture): engine = ping_fixture @event.listens_for(engine, "handle_error") def setup_disconnect(ctx): assert ctx.is_pre_ping ctx.is_disconnect = True conn = engine.connect() # no error con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_event_handler_didnt_downgrade_disconnect(\n self, ping_fixture_all_errs_disconnect\n ):\n engine = ping_fixture_all_errs_disconnect\n\n @event.listens_for(engine, \"handle_error\")\n def setup_disconnect(ctx):\n assert ctx.is_pre_ping\n assert ctx.is_di...
[ "0.70234233", "0.6971551", "0.66948354", "0.6495688", "0.61916995", "0.61216474", "0.6121415", "0.59488285", "0.5900851", "0.5878428", "0.5877062", "0.58651876", "0.58647805", "0.586168", "0.58307934", "0.58160025", "0.5814683", "0.579428", "0.5790778", "0.5782339", "0.578072...
0.6286811
4
test that an event hook can receive a disconnect error and convert it to be a fatal error during preping
def test_event_handler_can_downgrade_disconnect( self, ping_fixture_all_errs_disconnect ): engine = ping_fixture_all_errs_disconnect @event.listens_for(engine, "handle_error") def setup_disconnect(ctx): assert ctx.is_disconnect if ctx.is_pre_ping: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_event_handler_didnt_downgrade_disconnect(\n self, ping_fixture_all_errs_disconnect\n ):\n engine = ping_fixture_all_errs_disconnect\n\n @event.listens_for(engine, \"handle_error\")\n def setup_disconnect(ctx):\n assert ctx.is_pre_ping\n assert ctx.is_di...
[ "0.75634176", "0.7460929", "0.690459", "0.6380832", "0.6284205", "0.61783296", "0.61361533", "0.61084944", "0.6066335", "0.60619", "0.59785515", "0.5976626", "0.59717333", "0.594296", "0.5942044", "0.59340584", "0.59147024", "0.5885476", "0.58497363", "0.5848464", "0.58413315...
0.73141897
2
Given a model instance save it to the database.
def save_model(self, request, obj, form, change): obj.save() casestudy_id = request.session.get('casestudy', None) if casestudy_id is not None: casestudy = CaseStudy.objects.get(pk=casestudy_id) pic = PublicationInCasestudy.objects.get_or_create( casestudy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_to_db(self, instance: DBModelInstance) -> None:\n self.db.session.add(instance)\n self.db.session.commit()", "def save_model(self):\n pass", "def save_model( self, request, obj, form, change ):\n obj.save()", "def save(self):\n self.presavemodel()\n self.d...
[ "0.77996397", "0.7456527", "0.7434235", "0.7422407", "0.73011315", "0.7194706", "0.7194706", "0.7194706", "0.7194706", "0.71695006", "0.71580917", "0.71512944", "0.7132259", "0.7122476", "0.7114611", "0.7114611", "0.7114611", "0.7114611", "0.7114611", "0.7114611", "0.7114611"...
0.0
-1
NotifyReviewEvent returns comments for a ReviewEvent.
def NotifyReviewEvent(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_review_comments_body(\n self, pull_request_number: int) -> List[Tuple[str, str]]:\n review_comments = get_pull_request_review_comments(\n self._repo_name, pull_request_number, self._auth)\n if not review_comments:\n return []\n review_comments_msg = []...
[ "0.5948147", "0.5384553", "0.5373081", "0.5350771", "0.53389245", "0.5330528", "0.53114086", "0.53063893", "0.53036827", "0.52942955", "0.5259007", "0.5222319", "0.52145696", "0.5210138", "0.51832515", "0.5155651", "0.5119935", "0.50863373", "0.5073527", "0.5065843", "0.50623...
0.523376
11
NotifyPushEvent is not expected to return any comments. Its purpose for now is to notify the analyzer of a new push to a repository, that could be used to trigger training tasks over new contents.
def NotifyPushEvent(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_push(self, payload):\n pass", "def notify(self, event):\n\n self.send_json(event[\"payload\"])", "def push(event):\n _pushedEvents.append(event)", "def send_notification (event):\n Publisher.sendMessage (event)", "def notify(self, event):\n raise NotImplementedError", "def...
[ "0.6505522", "0.6299715", "0.62783396", "0.6245916", "0.6223001", "0.5992067", "0.59633183", "0.59553176", "0.59267044", "0.58976245", "0.58153737", "0.5808903", "0.574537", "0.5725313", "0.5693843", "0.5667237", "0.5548502", "0.55202025", "0.5500606", "0.54958946", "0.547965...
0.62791127
2
Given K and N, r, w and b are calculated Then, given r, w and b, all generations' value and decision functions are calculated BACKWARD
def IterateValues(self): agrid = self.agrid self.w = self.setwage(self.K, self.N) self.r = self.setrate(self.K, self.N) self.b = self.benefit(self.N) for l in range(self.Na): self.c[-1][l] = agrid[l]*(1+self.r) + self.b self.v[-1][l] = self.ut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def B(n, k):\n assert 0 < k <= n\n global lookup\n for index_y in range(len(lookup), n + 1):\n lookup.append([1])\n min_value = min(index_y, k)\n for index_x in range(min_value):\n if index_x < len(lookup[index_y - 1]) - 1:\n lookup[index_y].append(lookup[ind...
[ "0.6306666", "0.6230689", "0.60974103", "0.60286343", "0.6020426", "0.5946944", "0.5886355", "0.5848057", "0.5817468", "0.5804055", "0.57914394", "0.5780807", "0.5776807", "0.5772554", "0.57718253", "0.5769636", "0.5736517", "0.57279", "0.572249", "0.57167286", "0.5711532", ...
0.5691289
22
Find a bracket (a,b,c) such that policy function for next period asset level, a[x;asset[l],y] lies in the interval (a,b)
def GetBracket(self, y, l, m, agrid): a, b, c = agrid[0], agrid[0]-agrid[1], agrid[0]-agrid[2] m0 = m v0 = self.neg while a > b or b > c: v1 = self.value(y, agrid[l], agrid[m]) if v1 > v0: if m == 0: a, b = agrid[m], agrid[m] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_coeff(depth, period = 2*pi):\n\tfund_feq = 2 * pi / period\n\tAK = []\n\talphaK = []\n\n\tfor n in range(1, depth+1):\n\t\tdef a_function(x, i):\n\t\t\treturn input_function(x) * cos(i * fund_feq * x)\n\t\tdef b_function(x, i):\n\t\t\treturn input_function(x) * sin(i * fund_feq * x)\n\t\t(a, err) = quad(a...
[ "0.5546394", "0.5514575", "0.54493105", "0.54006404", "0.5219616", "0.51849455", "0.5173916", "0.51624197", "0.5160456", "0.5154094", "0.5153953", "0.5153", "0.5130451", "0.5096638", "0.5061676", "0.5000963", "0.49834117", "0.49589533", "0.49504474", "0.4946693", "0.49326152"...
0.5270328
4
Compute the aggregate capital stock and employment, K and N FORWARD
def CalculatePaths(self): agrid = self.agrid self.apath = array([0 for y in range(self.T)], dtype=float) self.cpath = array([0 for y in range(self.T)], dtype=float) self.npath = array([0 for y in range(self.T)], dtype=float) # generate each generation's asset, consumption...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_industry_neutral_nway_return(df, name, sorts, cuts, long_bucket, short_bucket, ind_col='sic1', ret_col='ret'):\n df = df.copy()\n\n # n-way sort\n keys = ['time_idx', ind_col]\n for sort, cut in zip(sorts, cuts):\n df[sort] = df.groupby(keys, as_index=False)[sort].transform(lambda ...
[ "0.5929503", "0.581313", "0.5744221", "0.5742783", "0.55948293", "0.5589375", "0.5517828", "0.54931015", "0.5415928", "0.5380793", "0.53703797", "0.53422695", "0.53379637", "0.53265834", "0.5309885", "0.5304519", "0.53018254", "0.5298242", "0.52609056", "0.5260335", "0.526007...
0.0
-1
Directly solve each generation's optimal a', c and n In this case, apath, cpath and npath store agents' policy functions In the other case of value interation, the above three paths are calculated from each generation's value functions.
def IteratePaths(self): self.w = self.setwage(self.K, self.N) self.r = self.setrate(self.K, self.N) self.b = self.benefit(self.N) a1, aT = [-1,], [] for q in range(self.Nq): if q == 0: self.apath[-1] = 0.2 elif q == 1: sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(num_wizards, num_constraints, wizards, constraints):\n\n # print(num_wizards)\n # print(num_constraints)\n # print(wizards)\n # print(constraints)\n # node_set = set(wizards)\n \n\n\n def cost(sol,num_constraints,constraints):\n constraints_satisfied = 0\n constraints_f...
[ "0.645377", "0.6445745", "0.63432974", "0.62200356", "0.61490154", "0.6128947", "0.61050683", "0.60996634", "0.5940299", "0.5918258", "0.59127754", "0.59035313", "0.5874269", "0.5844865", "0.5841971", "0.5836568", "0.58337045", "0.5832805", "0.58261335", "0.58163935", "0.5784...
0.63130635
3
Directly solve capital and labor supply given next two periods capitals y is given as 2, 3, ..., 60, i.e., through the nexttolast to the first
def DirectSolve(self, y): if y >= -self.R: a1 = self.apath[y+1] if y == -2: a2 = 0 else: a2 = self.apath[y+2] def constraints(a): c0 = (1+self.r)*a + self.b - a1 c1 = (1+self.r)*a1 + s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_working(\n assets_this_period,\n assets_next_period,\n hc_this_period,\n hc_next_period,\n interest_rate,\n wage_rate,\n income_tax_rate,\n beta,\n gamma,\n sigma,\n neg,\n continuation_value,\n delta_hc,\n zeta,\n psi,\n n_gridpoints_capital,\n n_gridpo...
[ "0.55686235", "0.5486277", "0.524329", "0.52351224", "0.5226248", "0.5210025", "0.5138276", "0.5105185", "0.50864774", "0.5027095", "0.5025979", "0.5024181", "0.49958742", "0.49447542", "0.49234024", "0.49014944", "0.48865473", "0.48819074", "0.4879534", "0.48610735", "0.4859...
0.0
-1
Return the value at the given generation and asset a0 and corresponding consumption and labor supply when the agent chooses his next period asset a1, current period consumption c and labor n a1 is always within Kmin and Kmax
def value(self, y, a0, a1): if y >= -self.R: # y = -2, -3, ..., -60 c, n = (1+self.r)*a0 + self.b - a1, 0 else: c, n = self.solve(a0,a1) v = self.util(c,n) + self.beta*self.vtilde[y+1](a1) return v if c > 0 else self.neg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cooling_output_for_supply_air_estimation(\n a_a: float, q: float, mu_c: float, v_vent: np.ndarray,\n theta_ex: np.ndarray, x_ex: np.ndarray, j: np.ndarray,\n hc_period: np.ndarray, n_p: np.ndarray, q_gen: np.ndarray, w_gen: np.ndarray, v_local: np.ndarray,\n theta_set_c: float, ...
[ "0.59520787", "0.57533324", "0.5703326", "0.56623435", "0.560426", "0.5583759", "0.55615014", "0.5517298", "0.5457148", "0.54422075", "0.53810215", "0.53772193", "0.5371446", "0.53696233", "0.5366299", "0.5357143", "0.5323624", "0.53230184", "0.5311603", "0.5301882", "0.52647...
0.494033
74
Compute the aggregate capital stock and employment, K and N FORWARD from Chebyshev polynomials
def CalculateChebyPaths(self): Kmin, Kmax = self.Kmin, self.Kmax self.apath = array([0 for y in range(self.T)], dtype=float) self.cpath = array([0 for y in range(self.T)], dtype=float) self.npath = array([0 for y in range(self.T)], dtype=float) # generate each generation's asset,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chebyshev_polynomial(X, k):\n print(\"Calculating Chebyshev polynomials up to order {}...\".format(k))\n\n T_k = list()\n T_k.append(sp.eye(X.shape[0]).tocsr())\n T_k.append(X)\n\n def chebyshev_recurrence(T_k_minus_one, T_k_minus_two, X):\n X_ = sp.csr_matrix(X, copy=True)\n retur...
[ "0.5805574", "0.568245", "0.5679868", "0.5634262", "0.55871993", "0.54936045", "0.5484346", "0.54805106", "0.5462374", "0.5451627", "0.54347575", "0.54347575", "0.54025716", "0.53955644", "0.5385762", "0.5380132", "0.53783524", "0.53712624", "0.5367456", "0.5344546", "0.53184...
0.0
-1
returns coefficients of Chebyshev Regression of f with m sample points on the interval [min,max], and n is the order of chebyshev polynomials
def chebcoef(self,f,n,m,Kmin,Kmax): z = -cos((linspace(1,m,m)*2-1)*pi/(2*m*1.0)) x = (z+1)*(Kmax-Kmin)/2.0 + Kmin y = f(x) # print 'x, f(x):', x, y T0 = ones(m) T1 = z a = zeros(n+1) a[0] = sum(y)/(m*1.0) a[1] = dot(y,T1)/dot(T1,T1) for i i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chebyshev_coeffs(f, n):\n extrema = np.cos((np.pi * np.arange(2*n))/n)\n samples = f(extrema)\n coeffs = np.real(np.fft.fft(samples))[:n+1]\n coeffs /= n \n coeffs[0] /= 2\n coeffs[n] /= 2\n\n return coeffs", "def random_coefficients(self, n=3, max_range = 10):\n return np.random....
[ "0.7639109", "0.6433395", "0.6052176", "0.60155755", "0.59195346", "0.57900774", "0.57421833", "0.5741759", "0.5730309", "0.56809217", "0.5661867", "0.55754876", "0.5554896", "0.5551868", "0.5530003", "0.5522098", "0.55102664", "0.5499079", "0.54902244", "0.54771787", "0.5465...
0.7481705
1
This method does NOT work!! except for some parameter values like eco = projectionmethod(N=2,tol=0.01,R=5,W=10,beta=0.98,delta=0.05,ncheb=2)
def projection(e,N=30): start_time = datetime.now() # records the starting time for i in range(N): e.IterateCheby() e.CalculateChebyPaths() e.Aggregate() if e.Converged: print 'Converged! in',i+1,'iterations with tolerance level',e.tol break end_time =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Projection(W, TYPE_PROJ = proj_l11ball, ETA = 100, AXIS = 0, ETA_STAR = 100, device = \"cpu\" ): \n \n #global TYPE_PROJ, ETA, ETA_STAR, AXIS, device \n if TYPE_PROJ == 'No_proj':\n W_new = W\n if (TYPE_PROJ == proj_l1ball or TYPE_PROJ == proj_l11ball or TYPE_PROJ == proj_l11ball_line )...
[ "0.606067", "0.60375684", "0.5986863", "0.5974436", "0.5932277", "0.5917319", "0.5792665", "0.57505715", "0.573772", "0.56984025", "0.5694427", "0.5688644", "0.5684781", "0.5637021", "0.562528", "0.5622044", "0.55693513", "0.55580497", "0.5556933", "0.55527645", "0.55185956",...
0.6673543
0
Computes a scale matrix.
def scale(v: InputTensor) -> t.Tensor: v = util.to_tensor(v, dtype=t.float32) assert len(v.shape) == 1 return t.diag(t.cat([v, v.new_ones([1])], dim=0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scaleMatrix(self, sx=0, sy=0, sz=0):\n\n return np.array([[sx, 0, 0, 0],\n [0, sy, 0, 0],\n [0, 0, sz, 0],\n [0, 0, 0, 1]])", "def Scale(*args, **kwargs):\n return _gdi_.GraphicsMatrix_Scale(*args, **kwargs)", "d...
[ "0.7577946", "0.7523797", "0.74303293", "0.7282001", "0.7124156", "0.7081991", "0.70752174", "0.7051836", "0.69150233", "0.6839642", "0.6801334", "0.6769318", "0.6742835", "0.66912425", "0.6654237", "0.6651771", "0.65922874", "0.64853823", "0.64189833", "0.6410784", "0.639885...
0.0
-1
Computes a translation matrix.
def translate(v: InputTensor) -> t.Tensor: result = util.to_tensor(v, dtype=t.float32) assert len(result.shape) >= 1 dimensions = result.shape[-1] result = result[..., None, :].transpose(-1, -2) result = t.constant_pad_nd(result, [dimensions, 0, 0, 1]) id_matrix = t.diag(result.new_ones([dimensions + 1])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TranslationMatrix(x, y, z):\n\treturn np.matrix([ [1., 0., 0., x],\n\t\t\t\t\t\t[0., 1., 0., y],\n\t\t\t\t\t\t[0., 0., 1., z],\n\t\t\t\t\t\t[0., 0., 0., 1.]])", "def translation_matrix(tx, ty, tz):\n T = np.array([[1, 0, 0, tx],\n [0, 1, 0, ty],\n [0, 0, 1, tz],\n ...
[ "0.7476626", "0.73376346", "0.71156037", "0.70561665", "0.70042557", "0.69543445", "0.68936795", "0.6859392", "0.6858805", "0.6777836", "0.6776042", "0.67170495", "0.6642511", "0.6580854", "0.6550882", "0.6474842", "0.64231503", "0.63632214", "0.6332118", "0.63255674", "0.629...
0.5711762
62
Transforms a batch of 3D points with a batch of matrices.
def transform_points_homogeneous(points: InputTensor, matrix: InputTensor, w: float) -> t.Tensor: points = util.to_tensor(points, dtype=t.float32) matrix = util.to_tensor(matrix, dtype=t.float32) assert points.shape[-1] == 3 assert matrix.shape[-2:] == (4, 4) assert points.sha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_transformation(self, points):\n assert (points.shape[0] == 3)\n n = points.shape[1]\n points_ = np.vstack((points, np.ones((1, n))))\n points_trans_ = np.matmul(self.pose_mat, points_)\n points_transformed = np.true_divide(points_trans_[:3, :], points_trans_[[-1], :])\n...
[ "0.68185866", "0.6803297", "0.67199254", "0.66627663", "0.63769263", "0.63079566", "0.62875766", "0.62417156", "0.6226377", "0.61661714", "0.6095978", "0.60583246", "0.6042413", "0.6042413", "0.6038547", "0.60366297", "0.5996688", "0.59671736", "0.59586704", "0.59217936", "0....
0.58872557
20
Transforms a single 3D mesh.
def transform_mesh(mesh: InputTensor, matrix: InputTensor, vertices_are_points=True) -> t.Tensor: mesh = util.to_tensor(mesh, dtype=t.float32) matrix = util.to_tensor(matrix, dtype=t.float32) assert mesh.shape[-2:] == (3, 3) assert matrix.shape[-2:] == (4, 4) assert mesh.shape[:-3] == matr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, data):\n self.cube = self.trf.transform(data)", "def GetTransform(self, *args) -> \"itkTransformD33 *\":\n return _itkTransformMeshFilterPython.itkTransformMeshFilterMF3MF3TD33_GetTransform(self, *args)", "def GetTransform(self, *args) -> \"itkTransformF33 *\":\n return...
[ "0.6724482", "0.6628377", "0.6589676", "0.6446487", "0.6304848", "0.6281156", "0.6236697", "0.62262785", "0.61985016", "0.6182246", "0.6143696", "0.6117967", "0.6096631", "0.60931605", "0.6072821", "0.603262", "0.6030979", "0.5999245", "0.5990135", "0.5965643", "0.59506994", ...
0.66893816
1
Computes a lefthanded 4x4 lookat camera matrix.
def look_at_lh(eye: InputTensor, center: InputTensor, up: InputTensor) -> t.Tensor: eye = util.to_tensor(eye, dtype=t.float32) center = util.to_tensor(center, dtype=t.float32) up = util.to_tensor(up, dtype=t.float32) assert eye.shape == (3,) assert center.shape == (3,) assert up.shape == (3,)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCameraMatrix(self): # real signature unknown; restored from __doc__\n pass", "def camera_matrix(self) -> TransformationMatrixType:\n return numpy.matmul(\n self.rotation_matrix(*self.rotation),\n displacement_matrix(*-numpy.array(self.location)),\n )", "def per...
[ "0.5941741", "0.5775757", "0.5662558", "0.5599011", "0.5386134", "0.5304439", "0.52797616", "0.5268123", "0.5224661", "0.5198523", "0.5161968", "0.5151681", "0.51350677", "0.51214856", "0.50689846", "0.5061132", "0.5058804", "0.504136", "0.50070995", "0.5004285", "0.4988299",...
0.0
-1
Computes a righthanded 4x4 lookat camera matrix.
def look_at_rh(eye: InputTensor, center: InputTensor, up: InputTensor) -> t.Tensor: eye = util.to_tensor(eye, dtype=t.float32) center = util.to_tensor(center, dtype=t.float32) up = util.to_tensor(up, dtype=t.float32) assert eye.shape == (3,) assert center.shape == (3,) assert up.shape == (3,)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCameraMatrix(self): # real signature unknown; restored from __doc__\n pass", "def camera_matrix(self) -> TransformationMatrixType:\n return numpy.matmul(\n self.rotation_matrix(*self.rotation),\n displacement_matrix(*-numpy.array(self.location)),\n )", "def cam...
[ "0.604629", "0.5690877", "0.566058", "0.546934", "0.5419739", "0.53992414", "0.53747255", "0.53564847", "0.53442174", "0.533645", "0.53151274", "0.52816457", "0.52754575", "0.5259618", "0.5208826", "0.5179219", "0.5169666", "0.51681334", "0.51548636", "0.5148781", "0.5135079"...
0.0
-1
Get the ratio of ICX to sICX.
def getRate(self) -> int: if (self._total_stake.get() + self._daily_reward.get()) == 0: rate = DENOMINATOR else: rate = (self._total_stake.get() + self._daily_reward.get()) * DENOMINATOR // self.sICX_score.totalSupply() return rate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csi(self):\n return self.table[0, 0] / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0])", "def cci(self) -> float:\n return self._cci", "def coi(self, s):\n return 2 ** 0.5 * s", "def as_integer_ratio(self): # real signature unknown; restored from __doc__\n pass", "d...
[ "0.60738033", "0.5845884", "0.583743", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.57556456", "0.56797916", ...
0.0
-1
Only necessary for the dummy contract.
def setSicxSupply(self) -> None: self._sICX_supply.set(self.sICX_score.totalSupply())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RequiredContract(self) -> _n_0_t_1:", "def dummy(self):\n pass", "def contract_pepo_pbc():\n pass", "def test_stub(self):\n pass", "def _dummy(ticket):\r\n return True", "def test_block_bad_signature(self):\n pass", "def dummy_fn(self):\n\t\tpass", "def __call__(self) -...
[ "0.6988934", "0.6948609", "0.66215193", "0.6288151", "0.606796", "0.604304", "0.597733", "0.5960648", "0.5929356", "0.5910414", "0.5864295", "0.5847082", "0.5847082", "0.5843603", "0.5816594", "0.5808959", "0.58019507", "0.57961833", "0.5791844", "0.57686216", "0.57359856", ...
0.0
-1
Get the address of sICX token contract.
def getSicxAddress(self) -> Address: return self._sICX_address.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_address(self):\n if self.address:\n return self.address", "def get_address(self, ):\n return self.get_parameter('address')", "def _get_address(self):\n return self.__address", "def address(self) -> str:\n return pulumi.get(self, \"address\")", "def address(self) -...
[ "0.6026088", "0.6024718", "0.6004629", "0.5933634", "0.5933634", "0.5933634", "0.5915871", "0.5914371", "0.5914371", "0.59061444", "0.5879427", "0.58482677", "0.5840453", "0.5836381", "0.5836381", "0.5836381", "0.5836381", "0.5836381", "0.5824099", "0.58240896", "0.5750373", ...
0.6808541
0
Returns the total staked amount stored in a vardb _total_stake.
def getTotalStake(self) -> int: return self._total_stake.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_spent(self):\n total_sum = Order.objects.filter(\n email=self.email).aggregate(\n Sum('total_price')\n ).get('total_price__sum')\n return round(total_sum, 4) if total_sum else 0", "def total_sold(album):\n return album.total_sold", "def total(self):\n ...
[ "0.65858716", "0.6538318", "0.62111753", "0.6138218", "0.6135569", "0.6123897", "0.6095115", "0.60794395", "0.60766083", "0.6074283", "0.6031743", "0.5965689", "0.5964389", "0.59520096", "0.5926538", "0.59139526", "0.590713", "0.5894734", "0.58571315", "0.5856632", "0.5830383...
0.8146318
0
Returns the total rewards earned up to now by the staking contract.
def getLifetimeReward(self) -> int: return self._total_lifetime_reward.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_rewards(self) -> float:\n return self.__total_rewards", "def getTotalReward(self):\n return self.cumreward", "def getTotalReward(self):\n return self.cumreward", "def getTotalReward(self):\n return self.lastFitness", "def total_reward(self):\n return np.sum(self.rew...
[ "0.74350184", "0.7319174", "0.7319174", "0.6883852", "0.67559856", "0.67167974", "0.6656435", "0.6656435", "0.6656435", "0.66351753", "0.65298206", "0.6467578", "0.6409539", "0.63020545", "0.6262705", "0.6262705", "0.62345237", "0.6190423", "0.6136656", "0.61360705", "0.61356...
0.5873769
39
Returns the top prep addresses that is set every week.
def getTopPreps(self) -> list: top_prep_list= [] for x in self._top_preps: top_prep_list.append(x) return top_prep_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_top_seven_routes(self):\n df = self.filter_according_to_travel_day('Sunday')\n # Group the dataset according to the frequency of the travel route\n df =df.groupby([\"travel_from\", \"travel_to\"]).size().reset_index(name=\"Frequency\")\n #Sort the dataset according to the frequ...
[ "0.5992419", "0.5827104", "0.5596639", "0.5556763", "0.5274141", "0.52575624", "0.51689905", "0.5167692", "0.5102182", "0.5079598", "0.50520396", "0.5037802", "0.49485672", "0.4947178", "0.49291557", "0.49205166", "0.49199647", "0.4886885", "0.48541108", "0.48188907", "0.4788...
0.5099575
9
Returns a dictionary that shows wallet address as a key and the request of unstaked amount by that address as a value.
def getUserUnstakeInfo(self) -> list: unstake_info_list =[] for items in self._linked_list_var: unstake_info_list.append([items[1],items[2]]) return unstake_info_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address_transactions_unspent(self, address):\n res = r.get(self.url + self.address_unspent + str(address))\n return self.execute(res)", "def address_transactions_unconfirmed(self, address):\n res = r.get(self.url + self.address_unconfirmed + str(address))\n return self.execute(res...
[ "0.6371236", "0.5843207", "0.5801892", "0.5744291", "0.5730674", "0.5722021", "0.57213354", "0.5651544", "0.5647592", "0.5630476", "0.5613511", "0.5587668", "0.553333", "0.55286324", "0.5524606", "0.54863155", "0.54595", "0.5434609", "0.54137826", "0.5393165", "0.5364194", ...
0.0
-1
Sets the sICX address from staking contract.
def setSicxAddress(self, _address: Address) -> None: self._sICX_address.set(_address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_contract_addr(self, addr):\n\t\tself.contract_addr = addr\n\t\tself._bank_inst = self._w3.eth.contract(\n\t\t\taddress=self.contract_addr,\n\t\t\tabi=self._iface[\"abi\"],\n\t\t)", "def set_address(self, address):\n pass", "def getSicxAddress(self) -> Address:\n return self._sICX_address....
[ "0.7022209", "0.668352", "0.6504335", "0.60547084", "0.5994743", "0.5949447", "0.59453374", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5931548", "0.5877724", "0.58283544", "0.56609696", "0.5632742", "0.5621456", "0.5613599", ...
0.76929194
0
Weekly this function is called to set the top 100 prep address in an arraydb
def _set_top_preps(self) -> None : prep_dict = self._system.getPReps(1, 20) prep_address_list = prep_dict['preps'] for each_prep in prep_address_list: self._top_preps.put(each_prep['address'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partition_geocode(con: sqlite3.Connection, cur: sqlite3.Cursor, quarter: str, county_cht: str):\n cur.execute('''SELECT 土地區段位置或建物區門牌 FROM \"{0}/TRX\"\n WHERE 縣市 = ?\n GROUP BY 土地區段位置或建物區門牌;'''.format(quarter), (county_cht,))\n for address, in cur.fetchall():\n c...
[ "0.511866", "0.50577724", "0.504898", "0.5036274", "0.49281853", "0.48955876", "0.48717105", "0.48107842", "0.47876543", "0.47528073", "0.47337833", "0.4712964", "0.47108823", "0.46957618", "0.46719283", "0.4665297", "0.4657939", "0.46463177", "0.46462315", "0.4643902", "0.46...
0.6340167
0
Returns the amount to be minted to a address
def _get_amount_to_mint(self) -> int: supply = self._sICX_supply.get() balance = self.getTotalStake() if balance == self.msg.value: amount = self.msg.value else: amount = supply * self.msg.value // (balance - self.msg.value) return amount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mint(amount: int) -> int:\n global total_supply\n\n _assert_is_bank(context.sender)\n total_supply = base.mint(balance_of, total_supply, context.sender, amount)\n return total_supply", "def get_address_balance(litecoinaddress):\n total_balance = 0\n unspent = list_unspent(litecoinaddress)\n...
[ "0.69586235", "0.6636571", "0.64191425", "0.6284753", "0.62760067", "0.62711406", "0.6152331", "0.6129017", "0.6064553", "0.58940786", "0.58726585", "0.5836371", "0.5781485", "0.5695222", "0.5656765", "0.5585638", "0.55727005", "0.5548005", "0.5546406", "0.55363196", "0.55116...
0.6663697
1
Sets the new top 100 prep address in an array db weekly after checking the specific conditions.
def _reset_top_preps(self) -> None: if self._system.getIISSInfo()["nextPRepTerm"] > self._block_height_week.get() + (7 * 43200): self._block_height_week.set(self._system.getIISSInfo()["nextPRepTerm"]) for i in range(len(self._top_preps)): self._top_preps.pop() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_top_preps(self) -> None :\n prep_dict = self._system.getPReps(1, 20)\n prep_address_list = prep_dict['preps']\n for each_prep in prep_address_list:\n self._top_preps.put(each_prep['address'])", "def update_weekly_total(areacode=AREACODE,areaname=AREA):\n start,stop=mo...
[ "0.63330156", "0.53173107", "0.49326813", "0.49134898", "0.48076132", "0.47747403", "0.47253653", "0.46731806", "0.46633682", "0.46196696", "0.4618803", "0.46049136", "0.45915735", "0.4584027", "0.45573524", "0.45506656", "0.45506567", "0.45332375", "0.45256045", "0.4525433", ...
0.5096449
2