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
Test getting a user with username and email which are archived.
def test_get_users_including_archived(user_store: MockStore, user_email: str, username: str): # GIVEN a database with a user and an archived user StoreHelpers.add_user( name=username, email="old.user@magnolia.com", store=user_store, is_archived=True ) # WHEN getting users users: List[User] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_including_archived(user_store: MockStore, archived_user_email: str):\n # GIVEN a database with an archived user\n\n # WHEN querying for a user\n user: User = user_store.get_user(email=archived_user_email, exclude_archived=False)\n\n # THEN it should be returned\n assert user.email ...
[ "0.81211317", "0.7514452", "0.64037925", "0.63772064", "0.6226215", "0.6220526", "0.6183159", "0.6143586", "0.610818", "0.6024082", "0.60225403", "0.60225403", "0.60071534", "0.59874976", "0.59364957", "0.5935404", "0.58854514", "0.5874671", "0.5873215", "0.5843584", "0.58432...
0.7878071
1
Test getting a user by email.
def test_get_users_no_username(user_store: MockStore, user_email: str): # GIVEN a database with a user # WHEN getting users users: List[User] = user_store.get_users(email=user_email) # THEN the user should be returned assert users[0].email == user_email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_by_emailuser_email_get(self):\n pass", "def test_resource_user_resource_get_user_by_email_address_get(self):\n pass", "def user(email):\r\n return User.objects.get(email=email)", "def test_get_user(user_store: MockStore, user_email: str):\n # GIVEN a database with a user...
[ "0.88454765", "0.83276856", "0.7962884", "0.7819175", "0.76467335", "0.760338", "0.75088274", "0.7479018", "0.74315584", "0.74199104", "0.7391693", "0.7375329", "0.7330281", "0.7316307", "0.73029596", "0.7296837", "0.7296837", "0.7296077", "0.7266929", "0.72588885", "0.724362...
0.7113207
28
add to the running total grade given a certain kind of assignment and weight
def assignment(kind, grade, weight=1): global running_total global total_weight global total_grade if kind not in running_total: running_total[kind] = grade total_grade[kind] = 0 total_weight[kind] = 0 if weight > 1: grade *= weight total_grade[kind] += grade ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_weighted_total(self):\r\n self.weighted_setup()\r\n self.submit_question_answer('H1P1', {'2_1': 'Correct', '2_2': 'Correct'})\r\n self.submit_question_answer('FinalQuestion', {'2_1': 'Correct', '2_2': 'Correct'})\r\n self.check_grade_percent(1.0)", "def update_weight(self,ctr...
[ "0.67640436", "0.6405597", "0.6375525", "0.6192439", "0.61887383", "0.6149335", "0.61008453", "0.60683244", "0.6066493", "0.60514957", "0.6017797", "0.59676933", "0.5939823", "0.58858883", "0.5883962", "0.58807987", "0.5871791", "0.5829333", "0.5798484", "0.57823825", "0.5780...
0.81458527
0
return the cumulative grade so far based on a set of proportions of assignment kind to overall weight.
def total(proportions): final = {} for i in proportions: if i in running_total: final[i] = proportions[i] * running_total[i] print(final) else: final[i] = 0 print(final) total_sum = sum(final.values()) return total_sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assignment(kind, grade, weight=1):\n global running_total\n global total_weight\n global total_grade\n\n if kind not in running_total:\n running_total[kind] = grade\n total_grade[kind] = 0\n total_weight[kind] = 0\n if weight > 1:\n grade *= weight\n total_grade[ki...
[ "0.65765446", "0.62831384", "0.595206", "0.5708253", "0.56488866", "0.5574766", "0.5573747", "0.553861", "0.5452227", "0.5413668", "0.5413428", "0.54061526", "0.53985643", "0.536465", "0.53360325", "0.52808714", "0.52574164", "0.5256666", "0.52544224", "0.52473426", "0.524029...
0.50300044
40
Create a new (directed) graph instance
def createInstance(): graphTypeEnvVariable = os.getenv('GRAPH_TYPE') graphTypeKey = graphTypeEnvVariable if graphTypeEnvVariable is not None else 'networkx' # Default to networkx graphType = GraphFactory.typeMap[str(graphTypeKey)] return graphType()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_single_node_graph(directed=False):\n if directed:\n graph = DirectedGraph()\n else:\n graph = UndirectedGraph()\n graph.new_node()\n\n return graph", "def _construct_graph(self):\n raise NotImplementedError", "def build_2_node_graph(directed=False):\n if directed:\n ...
[ "0.7362396", "0.7305025", "0.728026", "0.7153638", "0.70312077", "0.7007304", "0.696268", "0.6951953", "0.6908977", "0.680827", "0.6807212", "0.6760757", "0.6723978", "0.67188424", "0.6717348", "0.6668516", "0.66585326", "0.6607544", "0.6600618", "0.6596716", "0.6584806", "...
0.0
-1
writes a string to a text file (UTF8) and returns the number of characters written
def write_file(filename="", text=""): with open(filename, mode="w", encoding="utf-8") as m: return m.write(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_file(filename=\"\", text=\"\"):\n with open(filename, mode='w', encoding='utf-8') as f:\n f.write(text)\n with open(filename, encoding='utf-8') as f:\n chars_wrote = 0\n for line in f:\n for chrs in line:\n chars_wrote += 1\n return chars_wrote", ...
[ "0.8017254", "0.7992519", "0.7653896", "0.76335394", "0.7604036", "0.75782526", "0.75011104", "0.7486993", "0.7422796", "0.7185898", "0.7028778", "0.6912235", "0.6856175", "0.65315163", "0.647109", "0.6467817", "0.63615954", "0.6310156", "0.6264829", "0.62629646", "0.6224557"...
0.6605665
13
Parse and validate command line arguments using argparse.
def parse_arguments(): parser = argparse.ArgumentParser( description="Convert NES CHR (graphics) data into a PNG file.", formatter_class=argparse.ArgumentDefaultsHelpFormatter ) parser.add_argument( "-p", "--palette", nargs=4, default=("000000", "555555", "aaaaaa", "ffffff"), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_args(self, parser: argparse):\n pass", "def parse_command_line():\r\n\r\n parser = argparse.ArgumentParser(description='User args')\r\n parser.add_argument(\"--action\", choices=['train', 'predict', 'demo', 'test'], required=True, help=\"Choose action.\")\r\n parser.add_argument(\"--...
[ "0.8049023", "0.7517425", "0.73794687", "0.73718673", "0.73425865", "0.7335131", "0.7291243", "0.72795725", "0.7270892", "0.7264726", "0.7262399", "0.7254151", "0.72504383", "0.7240381", "0.72390467", "0.7226859", "0.7219809", "0.7207931", "0.7204468", "0.7202564", "0.7197727...
0.0
-1
Decode a 6digit hexadecimal color code. Return (R, G, B).
def decode_color_code(color): try: if len(color) != 6: raise ValueError color = int(color, 16) except ValueError: sys.exit("Invalid command line color argument.") return (color >> 16, (color >> 8) & 0xff, color & 0xff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseColor(c):\n if c in baseColors:\n return baseColors[c]\n if len(c) == 6:\n return tuple(map(lambda x: int(x, 16), (c[:2], c[2:4], c[4:])))\n if len(c) == 3:\n return tuple(map(lambda x: 16*int(x, 16), c))\n raise ValueError(\"Can't find color '{}'\".format(c))", "def col...
[ "0.70379555", "0.69850445", "0.68155867", "0.6667215", "0.6667215", "0.6579798", "0.65655094", "0.65628827", "0.6547301", "0.6505032", "0.65026057", "0.6496214", "0.64522505", "0.63568914", "0.6349273", "0.6349273", "0.6349273", "0.6349273", "0.6297138", "0.6291906", "0.62521...
0.79295737
0
Get the start address and size of CHR data in the file. Return (address, size).
def get_CHR_data_position(handle): # raw CHR data? fileSize = handle.seek(0, 2) if fileSize > 0 and fileSize % 256 == 0: return (0, fileSize) # iNES ROM file? try: iNESInfo = ineslib.parse_iNES_header(handle) except ineslib.iNESError as error: sys.exit( "The...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_file_chunk(self, buf=1000):\n data = self.file.read(buf)\n return data, len(data)", "def chars(count):\n\n global offset\n\n bytes=midifile[offset:offset+count]\n offset+=count\n return bytes", "def get_file_size(file_path):\n with open(file_path, 'rb') as infile:\n infi...
[ "0.59651583", "0.5834163", "0.57600224", "0.5742578", "0.5647145", "0.56113386", "0.5561132", "0.55449986", "0.5497243", "0.5456488", "0.54542714", "0.5425964", "0.5419218", "0.5419066", "0.5395858", "0.5369064", "0.5361087", "0.5349149", "0.5306322", "0.5299539", "0.52817094...
0.7074004
0
Convert NES CHR data into a Pillow image.
def decode_file(source, palette): (CHRStart, CHRSize) = get_CHR_data_position(source) charRowCount = CHRSize // 256 # 16 characters/row img = Image.new("P", (128, charRowCount * 8), 0) img.putpalette(itertools.chain.from_iterable(palette)) source.seek(CHRStart) for (y, pixelRow) in enumerate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tile_image(self, data):\n image = Image.open(BytesIO(data))\n return image.convert('RGBA')", "def _tile_image(self, data):\n image = Image.open(StringIO(data))\n return image.convert('RGBA')", "def dwd_RGB_12_12_9i_N(self, backup_orig_data=False):\n self.check_channels(\"HRV\", 0.85, 10...
[ "0.5845652", "0.57493347", "0.5670378", "0.5572581", "0.5565135", "0.5561687", "0.5504968", "0.5468423", "0.5449214", "0.54454327", "0.5406887", "0.5396389", "0.5394998", "0.53774685", "0.53612804", "0.53557503", "0.53308254", "0.5289437", "0.52846557", "0.5275512", "0.527226...
0.52317035
24
Create frequent candidate 1itemset C1 by scaning data set.
def create_C1(data_set): C1 = set() for t in data_set: for item in t: item_set = frozenset([item]) C1.add(item_set) return C1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_C1(data_set):\n C1 = set()\n for t in data_set:\n for item in t:\n item_set = frozenset([item])\n C1.add(item_set)\n return C1", "def fit(self, filePath):\n # Initialize some variables to hold the tmp result\n transListSet = self.getTransListSet(fil...
[ "0.6886297", "0.624703", "0.6201147", "0.5755", "0.56995976", "0.5535812", "0.5463", "0.5460324", "0.54472184", "0.5409043", "0.53956145", "0.5346798", "0.5327546", "0.53055555", "0.53005487", "0.52838606", "0.5277245", "0.5261409", "0.5238653", "0.52295136", "0.5222313", "...
0.6865995
1
Judge whether a frequent candidate kitemset satisfy Apriori property.
def is_apriori(Ck_item, Lksub1): for item in Ck_item: sub_Ck = Ck_item - frozenset([item]) if sub_Ck not in Lksub1: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_apriori(Ck_item, Lksub1):\n for item in Ck_item:\n sub_Ck = Ck_item - frozenset([item])\n if sub_Ck not in Lksub1:\n return False\n return True", "def runApriori(data_iter, minSupport, minConfidence):\n itemSet, transactionList = getItemSetTransactionList(data_iter)\n...
[ "0.66959405", "0.60583735", "0.59899515", "0.5980171", "0.59638375", "0.5880278", "0.57959944", "0.57608527", "0.57316625", "0.5725965", "0.5725422", "0.5713746", "0.5713466", "0.57089907", "0.5668989", "0.563154", "0.5604906", "0.55982333", "0.5576207", "0.5572789", "0.55670...
0.666684
1
Create Ck, a set which contains all all frequent candidate kitemsets by Lk1's own connection operation.
def create_Ck(Lksub1, k): Ck = set() len_Lksub1 = len(Lksub1) list_Lksub1 = list(Lksub1) for i in range(len_Lksub1): for j in range(1, len_Lksub1): l1 = list(list_Lksub1[i]) l2 = list(list_Lksub1[j]) l1.sort() l2.sort() if l1[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_Ck(Lksub1, k):\n Ck = set()\n len_Lksub1 = len(Lksub1)\n Lksub = list(Lksub1)\n for i in range(len_Lksub1):\n for j in range(1, len_Lksub1):\n l1 = list(Lksub[i])\n l2 = list(Lksub[j])\n l1.sort()\n l2.sort()\n if l1[0:k-2] == l2[...
[ "0.7030224", "0.6693347", "0.6450786", "0.6290387", "0.6284536", "0.6245179", "0.6236539", "0.6200779", "0.6141162", "0.6107893", "0.60948", "0.59961575", "0.5984875", "0.5919703", "0.5880751", "0.5827621", "0.576909", "0.57687354", "0.5766544", "0.5685266", "0.5683019", "0...
0.70728934
0
Generate Lk by executing a delete policy from Ck.
def generate_Lk_by_Ck(data_set, Ck, min_support, support_data): Lk = set() item_count = {} for t in data_set: for item in Ck: if item.issubset(t): if item not in item_count: item_count[item] = 1 else: item_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_cluster_policy(self):\n pass", "def _generate_delete_sql(self, delete_keys):\n for key in delete_keys:\n app_label, sql_name = key\n old_node = self.from_sql_graph.nodes[key]\n operation = DeleteSQL(sql_name, old_node.reverse_sql, reverse_sql=old_nod...
[ "0.62585837", "0.610776", "0.60768133", "0.5996151", "0.5908339", "0.58960474", "0.58868164", "0.5757094", "0.57533836", "0.5749329", "0.5724434", "0.57156825", "0.57156825", "0.56706184", "0.56705767", "0.5624003", "0.56201947", "0.56194127", "0.5612312", "0.55946124", "0.55...
0.0
-1
Generate all frequent itemsets.
def generate_L(data_set, k, min_support): support_data = {} C1 = create_C1(data_set) L1 = generate_Lk_by_Ck(data_set, C1, min_support, support_data) Lksub1 = L1.copy() L = [] L.append(Lksub1) for i in range(2, k+1): Ci = create_Ck(Lksub1, i) Li = generate_Lk_by_Ck(da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ar_gen(frequentItemSets):\n# print frequentItemSets\n for fItemSet in frequentItemSets:\n if fItemSet:\n itemSets = fItemSet.keys()\n for itemSet in itemSets:\n subsets = subset_gen(itemSet)\n# print itemSet\n# print subsets\n ...
[ "0.71493286", "0.7105992", "0.6580777", "0.62979317", "0.6171453", "0.61018306", "0.6101328", "0.61012286", "0.60402083", "0.6023916", "0.6010784", "0.5947156", "0.5888078", "0.5863928", "0.58581185", "0.58263636", "0.58231854", "0.57876766", "0.5702378", "0.5639596", "0.5610...
0.0
-1
Generates DataLoader instances for training and validation data
def _get_data( self, train_dataset: TensorDataset, validation_dataset: TensorDataset ): return ( DataLoader(train_dataset, batch_size=self.batch_size, shuffle=True), DataLoader(validation_dataset, batch_size=self.batch_size * 2), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_creator(config):\n train_dataset, val_dataset = LinearDataset(2, 5), LinearDataset(2, 5)\n train_loader = DataLoader(train_dataset, batch_size=config[\"batch_size\"])\n val_loader = DataLoader(val_dataset, batch_size=config[\"batch_size\"])\n return train_loader, val_loader", "def creates_da...
[ "0.8210852", "0.8109314", "0.8044301", "0.7968612", "0.7917862", "0.7887867", "0.78700924", "0.77869165", "0.7760952", "0.77082145", "0.76851207", "0.7662429", "0.7631286", "0.76265687", "0.7601167", "0.75591475", "0.75547343", "0.750435", "0.7474078", "0.74594635", "0.742464...
0.75457203
17
Updates model parameters with a forward and backward pass on a batch, returns loss value and batch size
def _loss_batch(self, x: torch.Tensor, y: torch.Tensor, optimizer=None): loss = self.loss_function(self.model(x), y) if optimizer is not None: loss.backward() optimizer.step() optimizer.zero_grad() return loss.item(), len(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_model(engine, batch):\n\t\tengine.model.train()\n\t\tengine.model.rpn.nms_thresh = 0.7\n\t\timg, target = prepare_batch(batch, device=get_device(engine.model))\n\t\tengine.optimizer.zero_grad()\n\t\tloss = engine.model(img, target)\n\t\tlosses = sum(l for l in loss.values())\n\t\tlosses.backward()\n\t\t...
[ "0.7193141", "0.7010625", "0.69024", "0.6887777", "0.6670186", "0.6612049", "0.6582479", "0.6552454", "0.6500733", "0.6500733", "0.6500733", "0.64862645", "0.6413767", "0.64118475", "0.64105713", "0.64071685", "0.640301", "0.63606393", "0.63578224", "0.6344614", "0.63444537",...
0.0
-1
Stores model artifact in 'path'
def save(self, path: str): torch.save(self.model.state_dict(), path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model(self, path):\n pass", "def save_model(self, model_path: str):", "def model_artifact(self):\n pass", "def _save_model(self, path):\n self.ov_model._model_exists_or_err()\n path = Path(path)\n path.mkdir(exist_ok=True)\n xml_path = path / self.status['xm...
[ "0.7026439", "0.6876322", "0.67974365", "0.6757171", "0.6753395", "0.67059636", "0.66834545", "0.6614887", "0.6585589", "0.6508608", "0.6451823", "0.63897693", "0.6384008", "0.6381931", "0.63744783", "0.63744783", "0.63744783", "0.63744783", "0.63744783", "0.63426495", "0.628...
0.6117312
37
judge that element's visible
def is_visible(self, locator, timeout=15): try: ui.WebDriverWait(self.driver, timeout).until(EC.visibility_of_element_located((By.CSS_SELECTOR, locator))) return True except TimeoutException: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_element_visible(self):\n if self.web_element.is_displayed():\n return True\n else:\n return False", "def is_visible(self):", "def is_visible(self, name):\n return self.q(css=\"div.{}\".format(name)).first.visible", "def isVisible(self):\n\t\treturn True", "...
[ "0.7998117", "0.79434115", "0.73818713", "0.730582", "0.7298647", "0.7232003", "0.7218634", "0.71988034", "0.7181496", "0.7181496", "0.7123885", "0.7094754", "0.7080614", "0.7061787", "0.69975", "0.69776446", "0.69749", "0.6949657", "0.692268", "0.68815774", "0.6865418", "0...
0.69461906
18
short func find element, way to CSSseletor search
def find_element(self, selector): return self.driver.find_element_by_css_selector(selector)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(elem, xpath):\n if elem is None:\n return None\n return next(iter(elem.xpath(xpath)), None)", "def css_find(css, wait_time=30):\r\n wait_for_present(css_selector=css, timeout=wait_time)\r\n return world.browser.find_by_css(css)", "def find_element(self, element: WebElement) -> WebEl...
[ "0.6815187", "0.6786542", "0.6672687", "0.6607929", "0.6364039", "0.6354677", "0.6287534", "0.6286016", "0.6274199", "0.6255014", "0.6223549", "0.6140126", "0.61250657", "0.610699", "0.60959023", "0.6075173", "0.6055", "0.59981996", "0.5985145", "0.59524626", "0.594184", "0...
0.637397
4
cookie transplant to session
def set_session_cookie(self): self.driver.get('{domain}/home/learn/index#/{cid}/go'.format(domain=domain,cid=cid)) for subCookie in self.driver.get_cookies(): self.session.cookies.set(subCookie[u'name'], self.driver.get_cookie(subCookie[u'name'])['value']) if config.DEBUG: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def save(self, request, response) -> None:\n value = self.cipher.encrypt(request.session.dumps().encode())\n cookie = f'{self.cookie_name}={value.decode()}; SameSite=Lax'\n response.headers['Set-Cookie'] = cookie", "def _update_cookies():\n global SESSION\n SESSION.cookies = brow...
[ "0.6975678", "0.65395766", "0.651551", "0.64788395", "0.6411001", "0.6401638", "0.6388814", "0.63399684", "0.6266068", "0.6216162", "0.6212182", "0.6202752", "0.6136299", "0.61301976", "0.6107034", "0.61065716", "0.61032164", "0.6093326", "0.6091979", "0.60879934", "0.6080099...
0.62935907
8
calculator how many class and how many should handler
def add_obItems(self): self.set_session_cookie() api_data = self.session.get( '{domain}/home/learn/getCatalogList?cid={cid}&hidemsg_=true&show='.format(domain=domain,cid=cid)) if config.DEBUG: print "api_data.url :: \n{url}, content ::\n{content}". \ for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_classes(self):", "def n_classes(self):\n raise NotImplementedError", "def n_classes(self):\n raise NotImplementedError", "def n_classes(self):\n raise NotImplementedError()", "def num_classes(self):\n\t\treturn 10", "def do_count(self, *args):\n count = 0\n ...
[ "0.69187886", "0.6613594", "0.6613594", "0.6554572", "0.65268314", "0.62493396", "0.61780745", "0.6160084", "0.6104748", "0.6081582", "0.60603327", "0.60551685", "0.60187566", "0.59950566", "0.5972611", "0.5936401", "0.5935454", "0.5877726", "0.5868197", "0.5832535", "0.58261...
0.0
-1
Using Pure fresh Naivasha Ellitrack device. I am going to simulate weekly billing
def automatic_meter_reading_demo(): #Get sensor data from ellitrack serial = 17112915 #get period dates first_day_of_the_month = datetime.datetime.today().replace(day=1) yesterday = datetime.datetime.now().date() - datetime.timedelta(days=1) #seven_days_earlier = yesterday - datetime.timedelta(days=7) period_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n dict_logs = {\n 'logs/e_log.log': logging.ERROR,\n 'logs/c_log.log': logging.INFO\n }\n\n logger = create_logger(**dict_logs)\n\n # For using Chrome\n browser = webdriver.Chrome('chromedriver.exe')\n\n url = 'https://www.bestbuy.com/site/nvidia-geforce-rtx-3090-24gb-...
[ "0.54909945", "0.54586065", "0.5381838", "0.5380678", "0.5356642", "0.53565866", "0.53053683", "0.5258174", "0.52458274", "0.5244081", "0.5229652", "0.5226608", "0.5205739", "0.5198463", "0.5194624", "0.5194555", "0.5188861", "0.51873434", "0.5172629", "0.51712", "0.5168242",...
0.4980588
42
The main function that interacts with the API. We'll do some try/except to make sure that we actually receive data from the API before sending back the callback.
def get_url(url): logger.debug(f'Trying CoinMarketCap API connection.') # Try making connection, and then raise exception if a non-200 status response was received. try: response = requests.get(url) response.raise_for_status() logger.debug(f'CoinMarketCap API request successful.') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_api(self):\n #generate the final call string\n self.generate_call_string();\n #debug\n #print (self.call_url);\n \n #finally make api call\n try: \n #pass; \n self.return_articles= json.loads(urlopen(self.call_url).read());\n ...
[ "0.67859524", "0.6489905", "0.63259", "0.61163515", "0.6017064", "0.5998514", "0.59876233", "0.5981442", "0.59209305", "0.5907225", "0.5906987", "0.5884664", "0.5880034", "0.5877678", "0.5845966", "0.57924813", "0.5786819", "0.578508", "0.5777931", "0.5777396", "0.5765343", ...
0.0
-1
Builds the URL based on the coin parameter received and calls the get_url() function
def get_coin_data(coin): url = URL + f"ticker/{coin}" data = get_url(url) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_url(self, **kwargs):\n path = self.url_path.format(**kwargs)\n return self.poolbot.generate_url(path)", "def build_url(self):\n url = requests.utils.requote_uri(\n self.torrent_page + self.string_search)\n if self.page == '1337x':\n return(url + '/1...
[ "0.65411425", "0.63300383", "0.6040743", "0.6007516", "0.5941518", "0.5924182", "0.59067404", "0.5865369", "0.5839566", "0.5832496", "0.57956237", "0.57749695", "0.5747344", "0.5724375", "0.5723643", "0.56971496", "0.5675385", "0.56733966", "0.5667794", "0.5649485", "0.564533...
0.54164875
45
adds windtunnel box to an ax
def draw_windtunnel_border(ax): x_min = 0 x_max = 1 z_min = 0 z_max = 0.254 y_min = -0.127 y_max = 0.127 draw_rectangular_prism(ax, x_min, x_max, y_min, y_max, z_min, z_max) plt.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_box(self):\n self.scenes[self.current_scene].add_object(Box())\n self.redraw()", "def add_box(self, box):\n mz_from = box.from_mz\n mz_to = box.to_mz\n rt_from = box.from_rt\n rt_to = box.to_rt\n self.boxes_mz.addi(mz_from, mz_to, box)\n self.boxes_...
[ "0.58353895", "0.5790107", "0.57524234", "0.5593443", "0.5475752", "0.53979737", "0.53805476", "0.53432196", "0.5318134", "0.53155285", "0.52366716", "0.5194952", "0.51729375", "0.5148649", "0.51383233", "0.51253414", "0.5115568", "0.5114796", "0.5070012", "0.5055591", "0.504...
0.6089721
0
adds heaters to an ax
def draw_heaters(ax, windtunnel): draw_heater(ax, windtunnel.heater_l) draw_heater(ax, windtunnel.heater_r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_heat_map(self, ax=None, block=True):\n plt.figure()\n ax = sns.heatmap(data=self.data, fmt=\"\", cmap='RdYlGn', linewidths=0.3, ax=ax)\n ax.invert_yaxis()\n ax.set(xlabel='Books index', ylabel='Books values over iterations', title='Heat map for the prediction result'\n ...
[ "0.6191286", "0.5851744", "0.5804792", "0.5803193", "0.5751369", "0.575062", "0.57083535", "0.56923664", "0.56552476", "0.5585687", "0.5582017", "0.5570664", "0.553861", "0.55253464", "0.5523711", "0.55133945", "0.54960084", "0.54917896", "0.5479611", "0.5449382", "0.5418402"...
0.65778947
0
draw a generic rectangular prism
def draw_rectangular_prism(ax, x_min, x_max, y_min, y_max, z_min, z_max): alpha = 1 back = Rectangle((y_min, z_min), y_max - y_min, z_max, alpha=alpha, fill=None, linestyle='dotted') ax.add_patch(back) art3d.pathpatch_2d_to_3d(back, z=x_min, zdir="x") front = Rectangle((y_min, z_min), y_max - y_min...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n pt = self.getPoint() # Centre of prism\n\n # Form top,left,right corners\n top = Vector2d(pt.z, pt.y + self.height/2)\n d = self.height*math.tan(self.angle/2)\n left = Vector2d(pt.z - d , pt.y - self.height/2)\n right = Vector2d(pt.z + d, pt.y...
[ "0.72910595", "0.6515819", "0.6209327", "0.6186026", "0.6058665", "0.60284466", "0.5912263", "0.589943", "0.5896657", "0.5882874", "0.585008", "0.58448476", "0.5837638", "0.5797427", "0.5788786", "0.5786838", "0.5756717", "0.5756544", "0.57435954", "0.5728075", "0.57125056", ...
0.68564206
1
Plot a quiverplot of the gradient
def plot_plume_gradient(plume, ax, thresh, skipevery = 6): # TODO: plot inside windtunnel as in draw_bool_plume filtered = plume.data[plume.data.gradient_norm > thresh] if skipevery != 0: filtered = filtered[::skipevery] ax.quiver(filtered.x, filtered.y, filtered.z, filtered.gradient_x, filtered....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_quiver():\n plt.quiver(x,y,u,v,sig2noise_ratio, scale=50,color='b')\n plt.gca().invert_yaxis()\n plt.gca().set_aspect(1)\n plt.plot(x.flat[xymask],y.flat[xymask],'rx')\n plt.colorbar(orientation='horizontal')", "def plot_vf(velocities):\n n = np.shape(velocities)[0]\n u = velocitie...
[ "0.65154076", "0.63556695", "0.61553794", "0.61197305", "0.6090479", "0.586303", "0.58170414", "0.56765515", "0.56476736", "0.5598726", "0.5560891", "0.5547584", "0.553222", "0.54735816", "0.54416955", "0.53720146", "0.5366105", "0.5361912", "0.53352004", "0.5322029", "0.5320...
0.6441448
1
r"""This may be improved its just a hacky way to write SGDWR
def reschedule_learning_rate(model, epoch, scheduler): if epoch == 7: optimizer = torch.optim.SGD(model.parameters(), lr=0.005) current_lr = next(iter(optimizer.param_groups))["lr"] scheduler = torch.optim.lr_scheduler.CosineAnnealingLR( optimizer, 6, eta_min=current_lr / 100, la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_data():", "def write(self):", "def write(self):", "def w(s):\r\n gv[\"epsf\"].write(s + \"\\n\")", "def generate_sdfs(timing_data, sdf_path):\n\n def make_speed_model(data):\n \"\"\"\n Makes a speed model structure for the SDF writer\n \"\"\"\n model = dict()\n\n...
[ "0.55522937", "0.55387354", "0.55387354", "0.5400637", "0.53835016", "0.5318729", "0.5311355", "0.5307885", "0.528809", "0.52554166", "0.52429384", "0.5242792", "0.52392423", "0.5233273", "0.5229388", "0.5209131", "0.5165275", "0.5147419", "0.5136346", "0.51323134", "0.512195...
0.0
-1
Periodic correlation, implemented using np.correlate. x and y must be real sequences with the same length.
def periodic_corr_np(x, y): # # src: https://stackoverflow.com/questions/28284257/circular-cross-correlation-python # circular cross correlation python # # return np.correlate(x, np.hstack((y[1:], y)), mode='valid')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def periodic_corr(x, y):\r\n return np.fft.ifft(np.fft.fft(x) * np.fft.fft(y).conj()).real", "def xcorr(x, y, maxlag=None):\n xl = x.size\n yl = y.size\n if xl != yl:\n raise ValueError('x and y must be equal length')\n\n if maxlag is None:\n maxlag = xl - 1\n else:\n maxla...
[ "0.79519504", "0.75662684", "0.74097294", "0.73958045", "0.73598063", "0.7300638", "0.7269215", "0.7267762", "0.72383136", "0.72049016", "0.71835554", "0.7174526", "0.7106051", "0.70750237", "0.69332325", "0.69196165", "0.69098467", "0.68443376", "0.67585266", "0.67496026", "...
0.8327699
0
Handles the mouse being moved in the 'normal' state. Prints the data space position of the current mouse position.
def normal_mouse_move(self, event): plot = self.component if plot is not None: if isinstance(plot, BaseXYPlot): ndx = plot.map_index((event.x, event.y), index_only = True) x = plot.index.get_data()[ndx] y = plot.value.get_data()[ndx] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_move_callback(self, event):\n # TODO drag and drop figuriek\n print(\"moving at \", event.x + self.offset_x, event.y + self.offset_y)", "def report_mouse_position(x_pos=0, y_pos=0):\n print('x-axis:', x_pos, ' Y-axis: ', y_pos, flush=True)", "def mousePositionRaw(self):", "def mous...
[ "0.6891763", "0.6877345", "0.68201053", "0.68201053", "0.6619768", "0.6596764", "0.6543408", "0.6506254", "0.63932467", "0.63913417", "0.6375399", "0.6339471", "0.6308581", "0.62776256", "0.6249573", "0.61815065", "0.61815065", "0.61744684", "0.61577696", "0.6157739", "0.6156...
0.74333996
0
Parse a date string and convert to a naive ``datetime`` object in UTC
def parse(date_string: str): # parse the date string date = dateutil.parser.parse(date_string) # convert to UTC if containing time-zone information # then drop the timezone information to prevent unsupported errors if date.tzinfo: date = date.astimezone(dateutil.tz.UTC).replace(tzinfo=None) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_date(s):\n return parse(s).astimezone(pytz.utc)", "def parse_datetime(datestr):\r\n try:\r\n return dateutil.parser.parse(datestr).replace(tzinfo=utc)\r\n except ValueError:\r\n raise DashboardError(_(\"Unable to parse date: \") + datestr)", "def parse_datetime(date_string):\n...
[ "0.7907816", "0.78428483", "0.76955104", "0.7673007", "0.7471216", "0.74361444", "0.7354086", "0.73491085", "0.7290312", "0.7242", "0.7239528", "0.7228141", "0.7222079", "0.717494", "0.7138004", "0.7137841", "0.7119581", "0.7117855", "0.71016157", "0.70935977", "0.7070508", ...
0.8083489
0
Parse a date string of the form
def parse_date_string(date_string: str): # try parsing the original date string as a date try: epoch = parse(date_string) except ValueError: pass else: # return the epoch (as list) return (datetime_to_list(epoch), 0.0) # split the date string into units and epoch ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_parse(date_string) -> datetime:\n return datetime.strptime(date_string, DATE_FMT)", "def parse_date(str_date):\n return ciso8601.parse_datetime(str_date)", "def parse(self, str):\n values = self._exp.findall(str)\n if values is None or len(values) == 0:\n return None\n\n...
[ "0.7754825", "0.7681746", "0.7619202", "0.7595637", "0.7554202", "0.7522775", "0.7512194", "0.7293273", "0.7285541", "0.7257252", "0.7254006", "0.7244446", "0.7221628", "0.7219147", "0.72051275", "0.720416", "0.7189553", "0.71871907", "0.71790546", "0.71494836", "0.7117056", ...
0.64465564
85
Split a date string into units and epoch
def split_date_string(date_string: str): try: units,_,epoch = date_string.split(None, 2) except ValueError: raise ValueError(f'Invalid format: {date_string}') else: return (units.lower(), parse(epoch))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_date_string(date_string: str):\n # try parsing the original date string as a date\n try:\n epoch = parse(date_string)\n except ValueError:\n pass\n else:\n # return the epoch (as list)\n return (datetime_to_list(epoch), 0.0)\n # split the date string into units ...
[ "0.7257494", "0.7253272", "0.67156667", "0.64704216", "0.63837385", "0.6196135", "0.6182121", "0.60728586", "0.6071914", "0.60442466", "0.6017566", "0.60019803", "0.5955302", "0.588226", "0.58331114", "0.58295196", "0.5822171", "0.5812971", "0.58089995", "0.57947624", "0.5778...
0.78031945
0
Convert a ``datetime`` object into a list
def datetime_to_list(date): return [date.year, date.month, date.day, date.hour, date.minute, date.second]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_datetime_objs(list_of_dates):\n datetime_list = []\n for date in list_of_dates:\n date_obj = datetime.datetime.strptime(date, '%d.%m.%Y')\n datetime_list.append(date_obj)\n return datetime_list", "def deconstruct_datetime(self, date: datetime) -> List[int]:\n year, month...
[ "0.72302264", "0.708684", "0.70127237", "0.6490613", "0.6426555", "0.6377876", "0.6265655", "0.62604266", "0.62300515", "0.616861", "0.6105871", "0.6052892", "0.6040023", "0.6040023", "0.6040023", "0.6040023", "0.60229015", "0.60185957", "0.6013034", "0.5994853", "0.5991498",...
0.85056525
0
Calculates the number of days per month for a given year
def calendar_days(year: int | float | np.ndarray) -> np.ndarray: # Rules in the Gregorian calendar for a year to be a leap year: # divisible by 4, but not by 100 unless divisible by 400 # True length of the year is about 365.2422 days # Adding a leap day every four years ==> average 365.25 # Subtrac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numDays(month, year):\n\tif month in [9, 4, 6, 11]:\n\t\treturn 30\n\telif month == 2 and year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):\n\t\treturn 29\n\telif month == 2:\n\t\treturn 28\n\telse:\n\t\treturn 31", "def dayInYear(month, day, year):\n current = 1\n numberOfDays = day\n while (...
[ "0.7753709", "0.7750762", "0.73286164", "0.73098063", "0.7175724", "0.7171483", "0.7167888", "0.70833415", "0.69083405", "0.6902013", "0.6811778", "0.6779676", "0.67423326", "0.6646203", "0.6620933", "0.6610777", "0.6599068", "0.6589264", "0.6504895", "0.647074", "0.64705473"...
0.7057161
8
Convert a ``numpy`` ``datetime`` array to seconds since ``epoch``
def convert_datetime( date: float | np.ndarray, epoch: str | tuple | list | np.datetime64 = _unix_epoch ): # convert epoch to datetime variables if isinstance(epoch, (tuple, list)): epoch = np.datetime64(datetime.datetime(*epoch)) elif isinstance(epoch, str): epoch = np.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ts_to_epoch_seconds(t) -> float:\n return t.astype(int) / 1e9", "def epoch2datetime(t):\n return datetime.fromtimestamp(t/1000.0)", "def seconds_since_epoch(date_time, epoch=None):\n return microseconds_since_epoch(date_time) / 10.0**6", "def epoch_seconds(date):\n td = date - epoch\n retu...
[ "0.7118472", "0.7046606", "0.6772909", "0.66768813", "0.66768813", "0.6676594", "0.6578405", "0.65100276", "0.6425068", "0.6245704", "0.6234241", "0.6234241", "0.6190503", "0.61882025", "0.6174044", "0.5989631", "0.5972627", "0.59568745", "0.59374034", "0.5933194", "0.5920487...
0.720014
0
Convert delta time from seconds since ``epoch1`` to time since ``epoch2``
def convert_delta_time( delta_time: np.ndarray, epoch1: str | tuple | list | np.datetime64 | None = None, epoch2: str | tuple | list | np.datetime64 | None = None, scale: float = 1.0 ): # convert epochs to datetime variables if isinstance(epoch1, (tuple, list)): epoch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch2time(time):\n\tvalue = datetime.datetime.fromtimestamp(time)\n\tNormal = value.strftime('%Y-%m-%d %H:%M:%S')\n\tprint(normal)\n\treturn normal", "def pcr_delta_time_ms(pcr_t1, pcr_t2, offset = 0):\n return float(pcr_t2-pcr_t1)/90000.0 + offset", "def to_deltatime(self,\n epoch: str | tu...
[ "0.6507025", "0.6423904", "0.6152986", "0.60294515", "0.5935391", "0.5886159", "0.58696276", "0.585755", "0.58195716", "0.58072734", "0.5757571", "0.5749442", "0.56640947", "0.5653533", "0.56484276", "0.56360996", "0.56360996", "0.5627376", "0.5626698", "0.55913216", "0.55352...
0.73310125
0
Calculate the time in units since ``epoch`` from calendar dates
def convert_calendar_dates( year: np.ndarray, month: np.ndarray, day: np.ndarray, hour: np.ndarray | float = 0.0, minute: np.ndarray | float = 0.0, second: np.ndarray | float = 0.0, epoch: tuple | list | np.datetime64 = _tide_epoch, scale: float = 1.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch_time(when):\n if not when: return 0\n epoch = datetime.utcfromtimestamp(0)\n delta = when - epoch\n return int(delta.total_seconds())", "def epoch_seconds(date):\r\n td = date - epoch\r\n return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)", "def epoch_seconds(d...
[ "0.65011543", "0.6338023", "0.6319791", "0.6319791", "0.63163614", "0.6262128", "0.62227833", "0.61993825", "0.61317724", "0.6127495", "0.61181426", "0.6072212", "0.60007864", "0.59639204", "0.59409183", "0.59142095", "0.58571243", "0.58349025", "0.5826222", "0.5819649", "0.5...
0.5271708
56
Converts from calendar date into decimal years taking into account leap years
def convert_calendar_decimal( year: np.ndarray, month: np.ndarray, day: np.ndarray, hour: np.ndarray | float | None = None, minute: np.ndarray | float | None = None, second: np.ndarray | float | None = None, DofY: np.ndarray | float | None = None, ) -> np.ndar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_to_years(datum):\n return datum/DAYS_PER_YEAR", "def _days_before_year(year):\n y = year - 1\n return y * 365 + y // 4 - y // 100 + y // 400", "def year(self) -> int:\n if self.is_old_style:\n yy = int(self.split('/', 1)[1][0:2])\n else:\n yy = int(self[:2])...
[ "0.8203957", "0.71250075", "0.7108617", "0.7105648", "0.69998467", "0.69553566", "0.6881788", "0.6873216", "0.68200904", "0.6782167", "0.67277336", "0.6661865", "0.6608123", "0.65985143", "0.65974677", "0.65909606", "0.65848035", "0.6561672", "0.6542898", "0.6496585", "0.6490...
0.0
-1
Converts from Julian day to calendar date and time
def convert_julian(JD: np.ndarray, **kwargs): # set default keyword arguments kwargs.setdefault('astype', None) kwargs.setdefault('format', 'dict') # raise warnings for deprecated keyword arguments deprecated_keywords = dict(ASTYPE='astype', FORMAT='format') for old,new in deprecated_keywords.it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def JulianDay(self):\n a = (14 - self._month) // 12\n y = self._year + 4800 - a\n m = self._month + (12 * a) - 3\n return (self._day + (153 * m + 2) // 5 + 365 * y +\n y // 4 - y // 100 + y // 400 - 32045)", "def _gregorian_to_julian_day(year, month, day):\n if month...
[ "0.6966466", "0.6876087", "0.6870243", "0.68287796", "0.67212313", "0.6684041", "0.6644245", "0.664008", "0.66230804", "0.65871185", "0.6576862", "0.6546014", "0.6470467", "0.645271", "0.645271", "0.64524555", "0.64404553", "0.6387761", "0.63858074", "0.62827337", "0.6244979"...
0.6714327
5
Converts a delta time array and into a ``timescale`` object
def from_deltatime(self, delta_time: np.ndarray, epoch: str | tuple | list | np.ndarray, standard: str = 'UTC' ): # assert delta time is an array delta_time = np.atleast_1d(delta_time) # calculate leap seconds if specified if (standard.upper() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_delta_time(\n delta_time: np.ndarray,\n epoch1: str | tuple | list | np.datetime64 | None = None,\n epoch2: str | tuple | list | np.datetime64 | None = None,\n scale: float = 1.0\n ):\n # convert epochs to datetime variables\n if isinstance(epoch1, (tuple, list)):\n...
[ "0.70219845", "0.70219845", "0.617282", "0.5939533", "0.5779774", "0.5593302", "0.55432564", "0.5536148", "0.5521312", "0.53766155", "0.53602535", "0.527159", "0.5263677", "0.5244214", "0.5233275", "0.52244824", "0.5211894", "0.51791227", "0.5178882", "0.51320446", "0.5113183...
0.5494914
9
Reads a ``datetime`` array and converts into a ``timescale`` object
def from_datetime(self, dtime: np.ndarray): # convert delta time array from datetime object # to days relative to 1992-01-01T00:00:00 self.MJD = convert_datetime(dtime, epoch=_mjd_epoch)/self.day return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _datenums_to_datetime(timearr):\n def convert(dn):\n # ref: https://stackoverflow.com/questions/13965740/converting-matlabs-datenum-format-to-python\n _dtg = datetime.fromordinal(int(dn)) + timedelta(days=dn % 1) - timedelta(days=366)\n return _dtg\n\n # return quickly if float (not ...
[ "0.6680321", "0.6339166", "0.622429", "0.6137414", "0.6017892", "0.58920026", "0.5789863", "0.57523423", "0.5700324", "0.567803", "0.5672263", "0.56458503", "0.56321234", "0.55204177", "0.55177724", "0.5458993", "0.5448575", "0.5430145", "0.5427152", "0.5418572", "0.54000634"...
0.5191718
31
Convert a ``timescale`` object to a delta time array
def to_deltatime(self, epoch: str | tuple | list | np.ndarray, scale: float = 1.0 ): # convert epochs to numpy datetime variables epoch1 = np.datetime64(datetime.datetime(*_mjd_epoch)) if isinstance(epoch, (tuple, list)): epoch = np.datetime64(datetime...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_delta_time(\n delta_time: np.ndarray,\n epoch1: str | tuple | list | np.datetime64 | None = None,\n epoch2: str | tuple | list | np.datetime64 | None = None,\n scale: float = 1.0\n ):\n # convert epochs to datetime variables\n if isinstance(epoch1, (tuple, list)):\n...
[ "0.64878637", "0.64878637", "0.61043775", "0.5972427", "0.5885216", "0.58361775", "0.5752255", "0.5551825", "0.55293506", "0.55140555", "0.5505703", "0.5482155", "0.5378903", "0.5345492", "0.5293476", "0.52068985", "0.516708", "0.51591724", "0.5147998", "0.51271814", "0.51263...
0.5759867
6
Convert a ``timescale`` object to a ``datetime`` array Returns
def to_datetime(self): # convert Modified Julian Day epoch to datetime variable epoch = np.datetime64(datetime.datetime(*_mjd_epoch)) # use nanoseconds to keep as much precision as possible delta_time = np.atleast_1d(self.MJD*self.day*1e9).astype(np.int64) # return the datetime a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _datenums_to_datetime(timearr):\n def convert(dn):\n # ref: https://stackoverflow.com/questions/13965740/converting-matlabs-datenum-format-to-python\n _dtg = datetime.fromordinal(int(dn)) + timedelta(days=dn % 1) - timedelta(days=366)\n return _dtg\n\n # return quickly if float (not ...
[ "0.6838105", "0.6681591", "0.66007125", "0.65673816", "0.64083326", "0.6393032", "0.6225149", "0.60525537", "0.60447085", "0.5981337", "0.59587187", "0.59361076", "0.5913841", "0.58931285", "0.58422744", "0.5785199", "0.57421887", "0.57266754", "0.57106245", "0.5692391", "0.5...
0.57221293
18
Calculates the sum of a polynomial function of time
def polynomial_sum(self, coefficients: list | np.ndarray, t: np.ndarray): # convert time to array if importing a single value t = np.atleast_1d(t) return np.sum([c * (t ** i) for i, c in enumerate(coefficients)], axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polynomial(a, x):\n\n sum = 0\n\n for i in range(len(a)):\n sum += a[i] * x**i\n return sum", "def evaluate_poly(poly: Sequence[float], x: float) -> float:\n return sum(c * (x**i) for i, c in enumerate(poly))", "def evaluate_poly(poly, x):\n exp = 0\n total = 0\n for coef in pol...
[ "0.69386065", "0.6748726", "0.65859747", "0.657982", "0.6418515", "0.63866585", "0.6333331", "0.6205636", "0.61954945", "0.61891437", "0.61560464", "0.61277664", "0.6109031", "0.60706145", "0.60396737", "0.6031695", "0.60197645", "0.6016289", "0.59671974", "0.5960084", "0.593...
0.7166109
0
Earth Rotation Angle (ERA) in degrees
def era(self): # earth rotation angle using Universal Time J = self.MJD - 51544.5 fraction = np.mod(J, self.turn) theta = np.mod(0.7790572732640 + 0.00273781191135448*J, self.turn) return self.turndeg*np.mod(theta + fraction, self.turn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_attitude_angle(self):\n return np.arctan(np.pi * (1 - self.eccentricity_ratio ** 2) / (4 * self.eccentricity_ratio))", "def _altaz_rotation(self, jd):\n R_lon = rot_z(- self.longitude.radians - jd.gast * TAU / 24.0)\n return einsum('ij...,jk...,kl...->il...', self.R_lat, R_lon,...
[ "0.674512", "0.6602822", "0.65989155", "0.6557351", "0.64846647", "0.6468571", "0.64416575", "0.6428505", "0.64205354", "0.6386489", "0.63785654", "0.63539183", "0.63338894", "0.6282171", "0.6258052", "0.6255307", "0.62220407", "0.6206311", "0.6206153", "0.6204205", "0.618560...
0.83793527
0
Greenwich Hour Angle (GHA) in degrees
def gha(self): return np.mod(self.gmst*self.turndeg + self.turndeg*self.T*self.century + self.turndeg/2.0, self.turndeg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hpa(self):\n return HPAngle(gon2hp(self.gon_angle))", "def get_local_hour_angle(self):\n LHA = self.Calculations.local_hour_angle(self.Longitude, self.right_ascension)\n self.LHA = LHA\n return LHA", "def getH(self):\n\t\thAngle = (math.atan2(self.y,self.x))/(2*math.pi)\n\t\tif ...
[ "0.6866496", "0.68414015", "0.67737657", "0.66491437", "0.6601375", "0.65256166", "0.640311", "0.63629305", "0.6301536", "0.6282773", "0.62634754", "0.62258744", "0.61544293", "0.6149261", "0.61482656", "0.60767734", "0.60743266", "0.6058337", "0.60410094", "0.60410094", "0.6...
0.75936776
0
Greenwich Mean Sidereal Time (GMST) in fractions of day
def gmst(self): GMST = np.array([24110.54841, 8640184.812866, 9.3104e-2, -6.2e-6]) # convert from seconds to fractions of day return np.mod(self.polynomial_sum(GMST, self.T)/self.day, self.turn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_GMST(self, date):\n jd = self.julian_date(date)\n T = (jd - 2451545.0)/36525.0\n gmstdeg = 280.46061837+(360.98564736629*(jd-2451545.0))+(0.000387933*T*T)-(T*T*T/38710000.0)\n gmst = ephem.degrees(gmstdeg*np.pi/180.0)\n return gmst", "def MJD2GMST(MJD):\n # GMST = 2...
[ "0.75275975", "0.7122444", "0.70665514", "0.6129707", "0.602409", "0.57152545", "0.566555", "0.55894446", "0.5582507", "0.55749035", "0.5572051", "0.5566701", "0.5546085", "0.55289936", "0.5466619", "0.5463478", "0.53989863", "0.53863674", "0.53379256", "0.5330827", "0.530122...
0.7240699
1
Greenwich Mean Sidereal Time (GMST) in fractions of a day from the Equinox Method
def st(self): # sidereal time polynomial coefficients in arcseconds sidereal_time = np.array([0.014506, 4612.156534, 1.3915817, -4.4e-7, -2.9956e-05, -3.68e-08]) ST = self.polynomial_sum(sidereal_time, self.T) # get earth rotation angle and convert to arcseconds retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_GMST(self, date):\n jd = self.julian_date(date)\n T = (jd - 2451545.0)/36525.0\n gmstdeg = 280.46061837+(360.98564736629*(jd-2451545.0))+(0.000387933*T*T)-(T*T*T/38710000.0)\n gmst = ephem.degrees(gmstdeg*np.pi/180.0)\n return gmst", "def gmst(self):\n GMST = np...
[ "0.7580178", "0.7263052", "0.6985743", "0.6871786", "0.5782016", "0.56890565", "0.5673886", "0.5630641", "0.5608682", "0.5593219", "0.555187", "0.5504932", "0.5493797", "0.5489374", "0.5472424", "0.5406448", "0.5394932", "0.5379389", "0.53495014", "0.5342813", "0.534229", "...
0.61608785
4
Dynamic Time (TT) as Julian Days
def tt(self): return self.MJD + self.tt_ut1 + 2400000.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_julian_date(cls, year, month, day, tp='miladi'):\n cal = Calverter()\n if tp == 'miladi':\n return cal.gregorian_to_jd(year, month, day)\n return cal.jalali_to_jd(year, month, day)", "def JulianDay(self):\n a = (14 - self._month) // 12\n y = self._year + 4800...
[ "0.65697944", "0.644693", "0.6362859", "0.635199", "0.63276625", "0.6300114", "0.6296536", "0.62951887", "0.6267511", "0.62593186", "0.62149376", "0.60694706", "0.6047973", "0.6033596", "0.6023847", "0.6016421", "0.60082954", "0.5991778", "0.59857446", "0.59478116", "0.594044...
0.64475
1
Difference between universal time (UT) and dynamical time (TT)
def tt_ut1(self): # return the delta time for the input date converted to days return interpolate_delta_time(_delta_file, self.tide)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tt(self):\n return self.MJD + self.tt_ut1 + 2400000.5", "def FromTerrestrialTime(tt):\n return Time(_UniversalTime(tt), tt)", "def Tt(s_c, point, system):\n Tx = tra(s_c, point, system)\n Tx.get_time()\n return Tx.time", "def time(self, u):\n return self._ll_tree.get_time(u)...
[ "0.67252356", "0.6356437", "0.6324151", "0.6247634", "0.6235292", "0.6177706", "0.6114084", "0.60345054", "0.6016289", "0.5991008", "0.5976588", "0.5966939", "0.5965875", "0.5953034", "0.59318453", "0.59278727", "0.5925871", "0.59051293", "0.5900001", "0.58759505", "0.5874289...
0.6015316
9
Universal Time (UT) as Julian Days
def ut1(self): return self.MJD + 2400000.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_juldate():\n import time\n mjd = time.time()/86400.0 + 40587.0\n return mjd + 2400000.5", "def JulianDay(self):\n a = (14 - self._month) // 12\n y = self._year + 4800 - a\n m = self._month + (12 * a) - 3\n return (self._day + (153 * m + 2) // 5 + 365 * y +\n ...
[ "0.715137", "0.71111745", "0.69940096", "0.6913078", "0.68461066", "0.6762256", "0.66047966", "0.6559268", "0.64414185", "0.634221", "0.630194", "0.6293434", "0.6263928", "0.6248005", "0.6168659", "0.61454284", "0.6137253", "0.6083866", "0.6073943", "0.6063152", "0.60316104",...
0.64695466
8
Arcseconds in a full turn
def turnasec(self): return self.turndeg*self.deg2asec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(self, angle: int, time: int = 0, /) -> None:", "def check_angle_of_arcs(self):\n\n if self.thin_arc_start_angle >= 3600:\n self.thin_arc_start_angle %= 360\n self.thin_arc_start_angle += 360\n\n elif self.thin_arc_start_angle <= -3600:\n self.thin_arc_star...
[ "0.64920294", "0.63348496", "0.58788353", "0.5837889", "0.5771139", "0.5746486", "0.57345754", "0.5653401", "0.560239", "0.55476874", "0.5514553", "0.54789144", "0.5433282", "0.5392291", "0.53804815", "0.53746235", "0.53291017", "0.53141046", "0.5307146", "0.52814186", "0.526...
0.56465614
8
Main data type of ``timescale`` object
def dtype(self): return self.MJD.dtype
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timescale(self, text=False):\n if text:\n return text_timescale[self.timescale]\n return self.timescale", "def get_timescale_stringlist(self):\n return text_timescale", "def __init__(self, data, t0=None, sampling_interval=None,\r\n sampling_rate=None, dur...
[ "0.6369052", "0.6242251", "0.6028106", "0.5987445", "0.5969164", "0.58626974", "0.58576125", "0.5832977", "0.58100027", "0.5673811", "0.56607765", "0.5654231", "0.5586185", "0.5580415", "0.5573964", "0.5555997", "0.5511585", "0.5502394", "0.5484541", "0.54606164", "0.5453321"...
0.0
-1
Dimensions of ``timescale`` object
def shape(self): return np.shape(self.MJD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDimensions():", "def n(self):\n return self._time_axis.size", "def getDimensions(self):\n\t\tprint \"Returning\",self.x,self.y,self.slicesPerTimepoint\n\t\treturn (self.x, self.y, self.slicesPerTimepoint)", "def dimensions():", "def getDimensions(self):\n return self._majax, se...
[ "0.73101234", "0.6850362", "0.684556", "0.68177414", "0.67772055", "0.6557291", "0.6495714", "0.64714515", "0.63878226", "0.63554513", "0.62954503", "0.6271409", "0.6236604", "0.61936814", "0.6155894", "0.61523", "0.6115309", "0.6110591", "0.6087786", "0.6087386", "0.6053563"...
0.61676913
14
Number of dimensions in ``timescale`` object
def ndim(self): return np.ndim(self.MJD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n(self):\n return self._time_axis.size", "def dimensions():", "def get_dimension_length(self):\n pass", "def getDimensions():", "def getNumDimensions(self):\n return len(self.di.keys())", "def dimension(self):", "def dimension_count(self):\n return self._dimensionCount",...
[ "0.78763264", "0.7570268", "0.7397859", "0.73891526", "0.7375963", "0.7257082", "0.7176224", "0.7130662", "0.7108869", "0.7108869", "0.70566756", "0.7014534", "0.697521", "0.6970627", "0.69629836", "0.6949205", "0.69482416", "0.694623", "0.6916043", "0.6906494", "0.6903032", ...
0.6858557
27
Number of time values
def __len__(self): return len(np.atleast_1d(self.MJD))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def N(self):\n return len(self.time)", "def n_timesteps(self) -> int:\n return len(self.time)", "def count(time):\n \n return len(events(time))", "def n(self):\n return self._time_axis.size", "def getTimes():", "def getTimes():", "def getTimes():", "def num_timesteps(self):...
[ "0.79427326", "0.75147057", "0.71630573", "0.7151795", "0.70408595", "0.70408595", "0.70408595", "0.6885139", "0.6813407", "0.6734885", "0.6663376", "0.6615941", "0.65652144", "0.652506", "0.6489599", "0.6446774", "0.64028627", "0.63700676", "0.6368978", "0.63495255", "0.6324...
0.573078
77
Iterate over time values
def __iter__(self): self.__index__ = 0 return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTimes():", "def getTimes():", "def getTimes():", "def with_time(self):\n if self.time_slices is None:\n raise FeatureError(\"Feature has no time reference.\")\n\n for i, datum in enumerate(self.data[self.name]):\n yield (self.time_slices[i], datum)", "def time_ite...
[ "0.65052223", "0.65052223", "0.65052223", "0.6386225", "0.6376932", "0.63017094", "0.62274367", "0.6165275", "0.6150198", "0.61159486", "0.6094333", "0.6039249", "0.5973911", "0.59392756", "0.59242696", "0.59179634", "0.58911586", "0.58628047", "0.58271235", "0.5775612", "0.5...
0.0
-1
Get the next time step
def __next__(self): temp = timescale() try: temp.MJD = np.atleast_1d(self.MJD)[self.__index__].copy() except IndexError as exc: raise StopIteration from exc # add to index self.__index__ += 1 return temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_step(self):\n if self.time_point + 1 >= len(self.data):\n print(\"Error: at last time point\")\n else:\n self.time_point = self.time_point + 1\n self.load_frame()", "def current_time_step(self) -> ts.TimeStep:\n return self._current_time_step", "def ge...
[ "0.72337455", "0.71042407", "0.7086954", "0.68511105", "0.6833489", "0.67276645", "0.6641585", "0.6626885", "0.6626885", "0.6606148", "0.6534634", "0.65241814", "0.6494662", "0.6401727", "0.6401727", "0.6401727", "0.6401727", "0.63689667", "0.63552856", "0.63552856", "0.63526...
0.0
-1
Calculates the difference between universal time (UT) and dynamical time (TT)
def interpolate_delta_time( delta_file: str | pathlib.Path | None, idays: np.ndarray, ): # read delta time file delta_file = pathlib.Path(delta_file).expanduser().absolute() dinput = np.loadtxt(delta_file) # calculate Julian days and then convert to days since 1992-01-01T00:00:00 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tt_utc_diff(jd_ut):\n prev_offset = None\n for start, offset in TAI_UTC_DIFF:\n if jd_ut < start:\n if prev_offset is None:\n t = jd_ut - JD_AT_1_JAN_2000 / DAYS_PER_CENTURY\n return 64.184 + 59 * t - 51.2 * t ** 2 - 67.1 * t ** 3 - 16.4 * t ** 4\n ...
[ "0.6853588", "0.6493911", "0.6304295", "0.6261032", "0.623478", "0.62195843", "0.61908835", "0.6168742", "0.6116449", "0.61082405", "0.60489404", "0.6018364", "0.5994444", "0.5990104", "0.5952031", "0.5927282", "0.5924082", "0.5922242", "0.5910568", "0.59104574", "0.5907921",...
0.0
-1
Counts the number of leap seconds between a given GPS time and UTC
def count_leap_seconds( GPS_Time: np.ndarray | float, truncate: bool = True ): # get the valid leap seconds leaps = get_leap_seconds(truncate=truncate) # number of leap seconds prior to GPS_Time n_leaps = np.zeros_like(GPS_Time,dtype=np.float64) for i,leap in enumerate(leaps): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utctoweekseconds(utc, leapseconds=18):\n datetimeformat = \"%Y-%m-%d %H:%M:%S\"\n epoch = datetime.datetime.strptime(\"1980-01-06 00:00:00\", datetimeformat)\n tdiff = utc - epoch + datetime.timedelta(seconds=leapseconds)\n gpsweek = tdiff.days // 7\n gpsdays = tdiff.days - 7 * gpsweek\n gpss...
[ "0.65216655", "0.5833346", "0.57278067", "0.56890005", "0.56728673", "0.5596442", "0.5512546", "0.54993033", "0.53895235", "0.53806776", "0.5326265", "0.5325846", "0.52866095", "0.52589804", "0.51825666", "0.51720935", "0.5155383", "0.5153672", "0.511898", "0.51158345", "0.50...
0.714384
0
Gets a list of GPS times for when leap seconds occurred
def get_leap_seconds(truncate: bool = True): leap_secs = pyTMD.utilities.get_data_path(['data','leap-seconds.list']) # find line with file expiration as delta time with leap_secs.open(mode='r', encoding='utf8') as fid: secs, = [re.findall(r'\d+',i).pop() for i in fid.read().splitlines() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_leap_seconds(truncate: bool = True):\n leap_secs = icesat2_toolkit.utilities.get_data_path(['data','leap-seconds.list'])\n # find line with file expiration as delta time\n with leap_secs.open(mode='r', encoding='utf8') as fid:\n secs, = [re.findall(r'\\d+',i).pop() for i in fid.read().split...
[ "0.6766767", "0.63627315", "0.62256587", "0.6170549", "0.6149021", "0.6144678", "0.6141739", "0.6091225", "0.5989345", "0.59563494", "0.59563494", "0.59563494", "0.5944765", "0.5895257", "0.5883905", "0.5882115", "0.5879913", "0.5851446", "0.5811208", "0.57886726", "0.5767137...
0.66635275
1
Connects to servers to download leapseconds.list files from NIST servers
def update_leap_seconds( timeout: int | None = 20, verbose: bool = False, mode: oct = 0o775 ): # local version of file FILE = 'leap-seconds.list' LOCAL = pyTMD.utilities.get_data_path(['data',FILE]) HASH = pyTMD.utilities.get_hash(LOCAL) # try downloading from NIST ftp s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createFileListHTTP(self, server, directory):\r\n conn = httplib.HTTPConnection(server)\r\n conn.request(\"GET\",directory)\r\n r1 = conn.getresponse()\r\n '''if r1.status==200:\r\n print \"status200 received ok\"\r\n else:\r\n print \"oh no = status=%d %...
[ "0.6307467", "0.587883", "0.57380795", "0.5727244", "0.57012963", "0.5671404", "0.5524113", "0.5523881", "0.54859656", "0.5447411", "0.53791904", "0.5360122", "0.53399926", "0.5324205", "0.5295918", "0.52778655", "0.5270903", "0.5259758", "0.52502596", "0.52469534", "0.520906...
0.54354
10
Connects to servers to download historic_deltat.data and deltat.data files Reads IERS BulletinA produced iers_deltat.data files Creates a merged file combining the historic, monthly and daily files Longterm Delta T
def merge_delta_time( username: str | None = None, password: str | None = None, verbose: bool = False, mode: oct = 0o775 ): # retrieve history delta time files pull_deltat_file('historic_deltat.data', username=username, password=password, verbose=verbose, mode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_bulletin_a_files(\n username: str | None = None,\n password: str | None = None,\n verbose: bool = False,\n mode: oct = 0o775\n ):\n # if complete: replace previous version of file\n LOCAL = pyTMD.utilities.get_data_path(['data','iers_deltat.data'])\n COPY = pyTMD.u...
[ "0.62587607", "0.6221167", "0.61745095", "0.61631536", "0.6151757", "0.60941243", "0.60340184", "0.59688264", "0.59580076", "0.5948104", "0.5947647", "0.5916482", "0.5913912", "0.5892256", "0.58449537", "0.5821589", "0.5820833", "0.5816526", "0.5759664", "0.57588494", "0.5733...
0.6115502
5
Appends merged delta time file with values from latest BulletinA file
def append_delta_time(verbose: bool = False, mode: oct = 0o775): # append to merged file merged_file = pyTMD.utilities.get_data_path(['data','merged_deltat.data']) fid = merged_file.open(mode='a', encoding='utf8') logging.info(str(merged_file)) file_format = ' {0:4.0f} {1:2.0f} {2:2.0f} {3:7.4f}' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_delta_time(\n username: str | None = None,\n password: str | None = None,\n verbose: bool = False,\n mode: oct = 0o775\n ):\n # retrieve history delta time files\n pull_deltat_file('historic_deltat.data',\n username=username, password=password,\n verbose...
[ "0.7121708", "0.6431268", "0.61592096", "0.60849315", "0.5973292", "0.5875328", "0.5809496", "0.5783088", "0.5770004", "0.5732891", "0.5731816", "0.57240766", "0.5704416", "0.5630994", "0.55934423", "0.55868226", "0.55500346", "0.5529764", "0.54655296", "0.5397741", "0.538316...
0.7002459
1
Attempt to connects to the IERS server and the CDDIS Earthdata server to download and merge BulletinA files Reads the IERS BulletinA files and calculates the daily delta times Servers and Mirrors
def merge_bulletin_a_files( username: str | None = None, password: str | None = None, verbose: bool = False, mode: oct = 0o775 ): # if complete: replace previous version of file LOCAL = pyTMD.utilities.get_data_path(['data','iers_deltat.data']) COPY = pyTMD.utilities.get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # the url for african daily and global daily\n african_dialy_url = \"https://data.chc.ucsb.edu/products/CHIRPS-2.0/africa_daily/tifs/p25/\"\n global_daily_url = \"https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/tifs/p25/\"\n\n\n each_year_list = GetRasterYears(url=african_dial...
[ "0.6011542", "0.5969287", "0.58123285", "0.5759039", "0.57266366", "0.57164097", "0.570907", "0.55923307", "0.5591778", "0.54952574", "0.5478434", "0.5473248", "0.5473054", "0.5455511", "0.5453085", "0.54324836", "0.5404204", "0.5393854", "0.5364291", "0.5353479", "0.5330724"...
0.6489078
0
Connects to the IERS ftp server to download BulletinA files
def iers_ftp_delta_time( daily_file: str | pathlib.Path, timeout: int | None = 120, verbose: bool = False, mode: oct = 0o775 ): # connect to ftp host for IERS bulletins HOST = ['ftp.iers.org','products','eop','rapid','bulletina'] pyTMD.utilities.check_ftp_connection(HOST[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\r\n self.ftp = ftplib.FTP(self.host)\r\n self.ftp.set_debuglevel(1)\r\n self.ftp.set_pasv(True)\r\n self.ftp.login(self.login, self.passwd)\r\n if self.directory:\r\n self.ftp.cwd(self.directory)\r\n # optimize socket params for download task\...
[ "0.67025596", "0.6390615", "0.6259813", "0.62463236", "0.6128868", "0.6115838", "0.6099415", "0.6080519", "0.594889", "0.588877", "0.5813595", "0.5800462", "0.57651263", "0.5740128", "0.57006925", "0.5670138", "0.56504744", "0.5615159", "0.55837226", "0.558215", "0.55641663",...
0.0
-1
Connects to the IERS server to download BulletinA files
def iers_delta_time( daily_file: str | pathlib.Path, timeout: int | None = 120, verbose: bool = False, mode: oct = 0o775 ): # open output daily delta time file daily_file = pathlib.Path(daily_file).expanduser().absolute() fid = daily_file.open(mode='w', encoding='utf8') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_files(self):", "def run(self):\n download(self.attempt)", "def do_GET(self):\n server_ip = Setup.parse_options()['ip_address']\n uri = \"http://\" + server_ip + self.path\n response = urllib.urlopen(uri)\n self.copyfile(response, self.wfile)\n headers = se...
[ "0.62916917", "0.61809975", "0.6116133", "0.6015992", "0.59609467", "0.59609467", "0.59313524", "0.58174115", "0.57494986", "0.5647868", "0.56020874", "0.55884147", "0.55876315", "0.55622876", "0.5517662", "0.5517662", "0.5517662", "0.5517662", "0.5517662", "0.5517662", "0.55...
0.0
-1
Connects to the CDDIS Earthdata server to download BulletinA files Reads the IERS BulletinA files and calculates the daily delta times Servers and Mirrors
def cddis_delta_time( daily_file: str | pathlib.Path, username: str | None = None, password: str | None = None, verbose: bool = False, mode: oct = 0o775 ): # connect to CDDIS Earthdata host for IERS bulletins HOST = ['https://cddis.nasa.gov','archive','products','iers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_data(origin_time, net, sta, loc, chan):\n \n dataDir_get = '/import/netapp-m-02-bay200/mseed_online/archive/'\n \n fileName = \".\".join((net, sta, \".\" + chan + \".D\",\n origin_time.strftime(\"%Y.%j\")))\n filePath = os.path.join(dataDir_get, origin_time.s...
[ "0.624917", "0.62240523", "0.61129135", "0.6103739", "0.6064117", "0.5956849", "0.5899511", "0.5891214", "0.58396065", "0.5826257", "0.58234257", "0.5810777", "0.5795678", "0.57836735", "0.57829314", "0.5700951", "0.5677488", "0.56742716", "0.56424415", "0.5566769", "0.556380...
0.6056532
5
Read a weekly IERS BulletinA file and calculate the delta times (TT UT1)
def read_iers_bulletin_a(fileID): # read contents from input file object file_contents = fileID.read().decode('utf8').splitlines() # parse header text to find time offsets # TT-TAI TT_TAI = 0 # TAI-UTC TAI_UTC = 0 # counts the number of lines in the header count = 0 HEADER = Fal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iers_delta_time(\n daily_file: str | pathlib.Path,\n timeout: int | None = 120,\n verbose: bool = False,\n mode: oct = 0o775\n ):\n # open output daily delta time file\n daily_file = pathlib.Path(daily_file).expanduser().absolute()\n fid = daily_file.open(mode='w', encod...
[ "0.5857724", "0.576605", "0.5764671", "0.56473726", "0.55392706", "0.5518946", "0.55164355", "0.5499296", "0.5458036", "0.54435945", "0.5402892", "0.53991205", "0.53944993", "0.53934467", "0.5388948", "0.53689307", "0.53484637", "0.53417957", "0.53347313", "0.5307582", "0.530...
0.7188088
0
Connects to IERS Rapid Service/Prediction Center (RS/PC) and downloads latest BulletinA file
def update_bulletin_a( timeout: int | None = 20, verbose: bool = False, mode: oct = 0o775 ): # local version of file LOCAL = pyTMD.utilities.get_data_path(['data','ser7.dat']) HASH = pyTMD.utilities.get_hash(LOCAL) # try downloading from IERS Rapid Service/Prediction Center ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # the url for african daily and global daily\n african_dialy_url = \"https://data.chc.ucsb.edu/products/CHIRPS-2.0/africa_daily/tifs/p25/\"\n global_daily_url = \"https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/tifs/p25/\"\n\n\n each_year_list = GetRasterYears(url=african_dial...
[ "0.60492426", "0.60171604", "0.5783168", "0.57165664", "0.5605315", "0.55862594", "0.55782974", "0.55782306", "0.5566327", "0.5501453", "0.5471493", "0.54270077", "0.5419344", "0.54091036", "0.54085934", "0.54044515", "0.53976905", "0.538624", "0.53831536", "0.5377734", "0.53...
0.5849966
2
Connects to servers and downloads delta time files Servers and Mirrors
def pull_deltat_file( FILE: str, username: str | None = None, password: str | None = None, timeout: int | None = 20, verbose: bool = False, mode: oct = 0o775 ): # local version of file LOCAL = pyTMD.utilities.get_data_path(['data',FILE]) HASH = pyTMD.utili...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_with_server(self):\n response = self.conn_mng.dispatch_request('get_server_snapshot', '')\n if response is None:\n self.stop(1, '\\nReceived bad snapshot. Server down?\\n')\n\n server_timestamp = response['server_timestamp']\n files = response['files']\n\n syn...
[ "0.65158635", "0.6249137", "0.6246897", "0.62433285", "0.6172768", "0.5878187", "0.5850852", "0.5845232", "0.5677957", "0.5639966", "0.5639966", "0.56367874", "0.56188345", "0.5617929", "0.56096303", "0.56053394", "0.5603972", "0.5597561", "0.55865276", "0.55839694", "0.55655...
0.56571853
9
Sets attributes to use later for processing files into a batch. Arguments
def set_processing_attrs(self, image_data_generator, target_size, color_mode, data_format, interpolation, tfrecord, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_attributes(self):", "def set_attr(self):\n\n # Create a new array\n self.fileh.create_array('/', 'array', self.a1)\n for i in range(self.nobjects):\n # Set an attribute\n setattr(self.fileh.root.array.attrs, \"attr\" + str(i), str(self.a1))\n # Put a...
[ "0.663226", "0.65376776", "0.6433505", "0.63417685", "0.63057846", "0.62907225", "0.62907225", "0.62907225", "0.62564075", "0.6250395", "0.61584836", "0.6117828", "0.61080635", "0.6101694", "0.6066144", "0.60353273", "0.60230213", "0.59905666", "0.5890181", "0.585173", "0.578...
0.52937835
87
writes data to tfrecord file
def write_tfrecord(self): # build batch of image data # self.filepaths is dynamic, is better to call it once outside the loop filepaths = self.filepaths labels = self.labels tfrecord = self.tfrecord with tf.io.TFRecordWriter(tfrecord) as writer: for fpath, lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_tfrecords_file(data, output_file):\n with tf.io.TFRecordWriter(str(output_file)) as writer:\n for image, sign in data:\n with tf.io.gfile.GFile(image, \"rb\") as f:\n image_string = f.read()\n feature = {\n \"image\": tf.train.Feature(\n bytes_list=tf.train.By...
[ "0.7325877", "0.73068726", "0.7304733", "0.7111031", "0.70561475", "0.70471674", "0.70471674", "0.70045257", "0.68853045", "0.6885133", "0.6868757", "0.6831078", "0.68181723", "0.67123234", "0.6695657", "0.66853046", "0.6652954", "0.66398877", "0.66188484", "0.65502214", "0.6...
0.6723572
13
Calculates the MD5 sum of a file.
def md5_sum_file(path): with open(path, 'rb') as f: m = hashlib.md5() while True: data = f.read(8192) if not data: break m.update(data) return m.hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def md5sum(file_name):\n f = open(file_name, mode='rb')\n h = hashlib.md5()\n h.update(f.read())\n return h.hexdigest()", "def calculate_md5sum_of_a_file(context, file_name, file_path):\n command = \"md5sum \" + file_path + \"/\" + file_name + \" | awk {'print $1'}\"\n return context.cme_sessio...
[ "0.8501577", "0.8366398", "0.8354866", "0.83091176", "0.82591504", "0.8246826", "0.81144214", "0.7983357", "0.79745054", "0.7973922", "0.79374063", "0.7884534", "0.78658235", "0.78574777", "0.78492963", "0.7834824", "0.77871597", "0.77637947", "0.7742572", "0.7533376", "0.752...
0.8164291
6
Reads a MD5 checksum file and returns hashes as a dictionary.
def readmd5_sum_file(path): with open(path, "r") as f: hashes = {} while True: line = f.readline() if not line: break h, name = line.rstrip().split(' ', 1) hashes[name] = h return hashes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_md5_lookup(filename):\n lookup = {}\n\n with open(filename) as f:\n for row in f:\n (md5, sha256) = row.strip().split(\",\")\n lookup[md5] = sha256\n\n return lookup", "def data_checksum(self, node):\n cmd = f\"find {RedpandaService.DATA_DIR} -type f -exec md5...
[ "0.6960468", "0.6812591", "0.6801497", "0.6614257", "0.6598387", "0.6572755", "0.65507716", "0.6542189", "0.6502235", "0.64885104", "0.6479202", "0.646785", "0.6450681", "0.6447718", "0.64337075", "0.640807", "0.6402168", "0.63971865", "0.6393921", "0.6386618", "0.63784134", ...
0.8217127
0
Return index array matching criteria
def _filter_column(array, col, criteria): # Raise an error if the column does not exist. This is the only way to # test it across all possible types (pandas, recarray...) try: array[col] except: raise KeyError('Filtering criterion %s does not exist' % col) if (not isinstance(criteri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_indexes(from_list, find_list):\n\n df_find = pd.DataFrame(find_list, columns=['value'])\n df_from = pd.DataFrame(list(zip(from_list, np.arange(len(from_list)))), columns=['value', 'index'])\n indexes = pd.merge(df_from, df_find, on='value', how='inner')['index'].values\n return indexes", "def...
[ "0.648662", "0.63990045", "0.6351997", "0.6327967", "0.6317841", "0.6282272", "0.62778795", "0.62594384", "0.62156016", "0.61883366", "0.6183509", "0.61677086", "0.61461943", "0.6115965", "0.6113757", "0.6105369", "0.60910106", "0.6073242", "0.60502017", "0.6050009", "0.60446...
0.0
-1
Return indices of recarray entries that match criteria.
def filter_columns(array, filters, combination='and'): if combination == 'and': fcomb = np.logical_and mask = np.ones(array.shape[0], dtype=np.bool) elif combination == 'or': fcomb = np.logical_or mask = np.zeros(array.shape[0], dtype=np.bool) else: raise ValueError('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIndexes(self, val):\n # Find where this value is listed. \n valNdx = (self.values == val).nonzero()[0]\n \n # If this value is not actually in those listed, then we \n # must return empty indexes\n if len(valNdx) == 0:\n start = 0\n end = 0\n ...
[ "0.66991407", "0.6451458", "0.6383022", "0.63413405", "0.62079084", "0.61890465", "0.6104715", "0.60981125", "0.60734594", "0.6064704", "0.60335106", "0.6032053", "0.6005462", "0.6005365", "0.59307843", "0.5874397", "0.58559686", "0.5853381", "0.583678", "0.58103853", "0.5805...
0.0
-1
Takes an iterable, and puts into the expected format of a tuple if triplet tuples.
def reformat_files(cls, files): common_path = None # src base out_files = [] for fil in files: if isinstance(fil, string_types): if len(files) == 1: common_prefix = op.dirname(fil) + '/' elif common_path is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten_as_tuple(iterable):\n return tuple(chain(*iterable))", "def strtuple(iterable): \n string = ''\n function = type(strtuple)\n for i in iterable:\n if isinstance(i , function):\n string += i.__name__ + ', '\n else:\n string += str(i) + ', '\n string = ...
[ "0.6921011", "0.68820137", "0.67969006", "0.66930157", "0.65410215", "0.65340674", "0.6524488", "0.6501052", "0.64999217", "0.6474179", "0.64328927", "0.638195", "0.634732", "0.63379496", "0.62362045", "0.6152484", "0.6152422", "0.6125659", "0.6123165", "0.6112711", "0.611111...
0.0
-1
generate the input data dict for ONNXinferenceSession run
def get_next(self) -> dict: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_inputs_for_inference(builder, conf):\r\n\r\n inputs = dict()\r\n\r\n inputs[\"mel_spec_input\"] = builder.addInputTensor(popart.TensorInfo(_get_popart_type(conf.precision),\r\n [conf.samples_per_device,\r\n ...
[ "0.6266671", "0.6177044", "0.61287516", "0.60989565", "0.60571", "0.60435206", "0.6002842", "0.5988043", "0.59797364", "0.59707093", "0.5946096", "0.5901443", "0.58849496", "0.58652824", "0.58643454", "0.58619016", "0.58595145", "0.5857554", "0.5846563", "0.58404577", "0.5838...
0.0
-1
reset the execution providers to execute the collect_data. It triggers to recreating inference session.
def set_execution_providers(self, execution_providers=["CPUExecutionProvider"]): # noqa: B006 self.execution_providers = execution_providers self.create_inference_session()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n for provider in self.providers.values():\n provider.reset()\n\n for observation in self.observations.values():\n observation.reset()", "def on_reset_after_execution(self):\n pass", "def interactive_reset(self):\n # Set the initial state\n\n ...
[ "0.6323081", "0.58850425", "0.58387077", "0.5724095", "0.57188416", "0.56691223", "0.5652778", "0.5533942", "0.5513653", "0.55113894", "0.55113894", "0.55113894", "0.5511064", "0.55093247", "0.54930425", "0.54805976", "0.54596144", "0.5457072", "0.54517335", "0.5450865", "0.5...
0.6150363
1
create an OnnxRuntime InferenceSession.
def create_inference_session(self): sess_options = onnxruntime.SessionOptions() sess_options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_DISABLE_ALL self.infer_session = onnxruntime.InferenceSession( self.augmented_model_path, sess_options=sess_optio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_ort_session(self, onnx_path):\n # Setup options for optimization\n sess_options = ort.SessionOptions()\n sess_options.execution_mode = ort.ExecutionMode.ORT_SEQUENTIAL\n sess_options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL\n\n self.ort_sessio...
[ "0.64287347", "0.63863736", "0.6347452", "0.5931692", "0.5925455", "0.58672893", "0.5637707", "0.5620587", "0.5582713", "0.55574703", "0.550082", "0.5489399", "0.547671", "0.54669124", "0.5439374", "0.54066926", "0.5406201", "0.53796494", "0.5331371", "0.5314776", "0.5209954"...
0.82782066
0
select input/output tensors of candidate nodes to calibrate.
def select_tensors_to_calibrate(self, model: ModelProto): value_infos = {vi.name: vi for vi in model.graph.value_info} value_infos.update({ot.name: ot for ot in model.graph.output}) value_infos.update({it.name: it for it in model.graph.input}) initializer = {init.name for init in model.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_Utility(self):\n # Shape the input that we give to the neural network with the value of sensors, the previous actions the life of the agent \n # Get the results from the sensors according the different movement executed by the agent \n sensors_result_N = self.agent.sensors(self, d...
[ "0.5132529", "0.5103128", "0.50717694", "0.50447917", "0.5014779", "0.50001043", "0.49974504", "0.49860495", "0.49711442", "0.49643132", "0.49161378", "0.49030358", "0.49007672", "0.48981002", "0.48850143", "0.485468", "0.48339158", "0.48284072", "0.48257983", "0.47925872", "...
0.5722057
0
Adds ReduceMin and ReduceMax nodes to all quantization_candidates op type nodes in model and ensures their outputs are stored as part of the graph output
def augment_graph(self): tensors, _ = self.select_tensors_to_calibrate(self.model) reshape_shape_name = str(uuid.uuid4()) reshape_shape = numpy_helper.from_array(np.array([1], dtype=np.int64), reshape_shape_name) self.model.graph.initializer.append(reshape_shape) def add_reduce_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_reduce(g, op, block):\n\n op_map = {\n \"reduce_all\": \"all\",\n \"reduce_any\": \"any\",\n \"reduce_max\": \"max\",\n \"reduce_min\": \"min\",\n \"reduce_prod\": \"prod\",\n \"reduce_sum\": \"sum\",\n \"reduce_mean\": \"mean\",\n }\n op_name =...
[ "0.5645855", "0.53501433", "0.5246339", "0.52274525", "0.5080488", "0.50688004", "0.5044712", "0.49589333", "0.4905664", "0.4891885", "0.48683834", "0.48381573", "0.48108053", "0.4800535", "0.47633642", "0.47312012", "0.47288904", "0.471117", "0.47105142", "0.4692214", "0.468...
0.56021696
1
Compute the minmax range of tensor
def compute_data(self) -> TensorsData: if len(self.intermediate_outputs) == 0: return self.calibrate_tensors_range output_names = [self.infer_session.get_outputs()[i].name for i in range(len(self.intermediate_outputs[0]))] output_dicts_list = [ dict(zip(output_names, in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_min_max(tensor: Tensor, alpha: float = 0.09) -> Tensor:\n device = tensor.device\n tensor = tensor.detach().cpu()\n mn = (tensor == 0).sum(dim=(1, 2, 3)).float()\n mn /= numpy.prod(tensor.shape[1:])\n q = alpha * (1 - mn) * 50\n n_samples = tensor.shape[0]\n add_view = [1] * (tensor....
[ "0.7547379", "0.7123834", "0.7107737", "0.7107506", "0.7039821", "0.6998676", "0.6972081", "0.6958474", "0.69525874", "0.69308096", "0.68104637", "0.6738522", "0.6683714", "0.6664642", "0.6625571", "0.66234326", "0.6614864", "0.6614411", "0.65762603", "0.6518506", "0.6502009"...
0.0
-1
make all quantization_candidates op type nodes as part of the graph output.
def augment_graph(self): self.tensors_to_calibrate, value_infos = self.select_tensors_to_calibrate(self.model) for tensor in self.tensors_to_calibrate: if tensor not in self.model_original_outputs: self.model.graph.output.append(value_infos[tensor]) onnx.save( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _collect_ipt_and_opt_nodes(self):\n for name, node in self._nodes_collection.items():\n if node.in_degree == 0:\n # NOTICE: what's usage of `scope`?\n self._input_nodes.append(name)\n\n if node.out_degree == 0:\n self._output_nodes.appen...
[ "0.58436275", "0.54256326", "0.53823584", "0.5308641", "0.5279758", "0.5254585", "0.5193188", "0.51130235", "0.5092685", "0.50865275", "0.5085475", "0.50561804", "0.504065", "0.500407", "0.4975025", "0.49684238", "0.49679667", "0.49663618", "0.49435312", "0.49369988", "0.4936...
0.0
-1
Entropy Calibrator collects operators' tensors as well as generates tensor histogram for each operator.
def collect_data(self, data_reader: CalibrationDataReader): while True: inputs = data_reader.get_next() if not inputs: break self.intermediate_outputs.append(self.infer_session.run(None, inputs)) if len(self.intermediate_outputs) == 0: rai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self, **kwargs) -> TensorType:", "def entropy(self, **kwargs) -> TensorType:", "def _make_histogram_ops(self, model):\n # only make histogram summary op if it hasn't already been made\n if self.histogram_freq and self.merged is None:\n for weight in self.model.trainable_var...
[ "0.6375051", "0.6375051", "0.5747862", "0.5734022", "0.57108384", "0.5705662", "0.56487167", "0.55760294", "0.5560576", "0.55325216", "0.5517932", "0.54343194", "0.541528", "0.5407086", "0.53932786", "0.53651863", "0.53597933", "0.5357408", "0.5326563", "0.5320264", "0.531402...
0.0
-1
Compute the minmax range of tensor
def compute_data(self) -> TensorsData: if not self.collector: raise ValueError("No collector created and can't generate calibration data.") if isinstance(self, EntropyCalibrater): cal = CalibrationMethod.Entropy elif isinstance(self, PercentileCalibrater): ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_min_max(tensor: Tensor, alpha: float = 0.09) -> Tensor:\n device = tensor.device\n tensor = tensor.detach().cpu()\n mn = (tensor == 0).sum(dim=(1, 2, 3)).float()\n mn /= numpy.prod(tensor.shape[1:])\n q = alpha * (1 - mn) * 50\n n_samples = tensor.shape[0]\n add_view = [1] * (tensor....
[ "0.75467235", "0.7126264", "0.7105955", "0.7104534", "0.70395917", "0.6998385", "0.69723856", "0.69567525", "0.6950661", "0.6929797", "0.6809948", "0.6738251", "0.66825795", "0.66631263", "0.6628244", "0.6626751", "0.6614928", "0.66133803", "0.6575226", "0.65187347", "0.65003...
0.0
-1
Generate informative data based on given data.
def collect(self, name_to_arr): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_data(sim_attr_generator):\n#TODO description\n if Args.data_to_show == 'dprime':\n show_dprime(sim_attr_generator)", "def generate_ta(data):\n raise NotImplementedError", "def format_data(self, data):", "def _construct(self, data):\n logging.info(\"overall constructing (enter)\")\n...
[ "0.6068046", "0.5998432", "0.5993212", "0.5823532", "0.58189803", "0.5803318", "0.568087", "0.5674967", "0.56731486", "0.5647276", "0.5622952", "0.56198436", "0.5607101", "0.55947775", "0.55919886", "0.5589899", "0.5589657", "0.5586132", "0.55597925", "0.5534209", "0.5532182"...
0.0
-1
Get the optimal result among collection data.
def compute_collection_result(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPts(self):\n return self.best", "def getResults():", "def _compute_best_value(self):\n reduced_cs = []\n concerned_vars = set()\n\n for c in self.utilities:\n asgt = filter_assignment_dict(self._neighbors_values, c.dimensions)\n reduced_cs.append(c.slice(asg...
[ "0.6284819", "0.62337065", "0.61745787", "0.61052895", "0.60609734", "0.60476875", "0.6004349", "0.59691477", "0.5940262", "0.59164304", "0.5862893", "0.5773496", "0.57638365", "0.5753932", "0.574135", "0.57389337", "0.5737159", "0.57235175", "0.5709042", "0.56935674", "0.567...
0.6996528
0
Collect histogram on absolute value
def collect_absolute_value(self, name_to_arr): for tensor, data_arr in name_to_arr.items(): data_arr = np.asarray(data_arr) # noqa: PLW2901 data_arr = data_arr.flatten() # noqa: PLW2901 if data_arr.size > 0: min_value = np.min(data_arr) max_v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_histogram(self):\n\n for bin in range(self.bins.size):\n bin_inf = self.bins[bin]\n try: bin_sup = self.bins[bin + 1]\n except IndexError: bin_sup = self.vmax\n self.hist[bin] = np.sum(\n (self.values >= bin_inf)*(self.values < bin_sup))\n\n...
[ "0.6780593", "0.6637294", "0.6636672", "0.6386098", "0.6373501", "0.6371298", "0.6316349", "0.6257009", "0.62314403", "0.6217895", "0.6184364", "0.6180108", "0.614731", "0.6107375", "0.60950774", "0.6084479", "0.60823816", "0.6082355", "0.60809517", "0.607641", "0.60702395", ...
0.7000032
0
Collect histogram on real value
def collect_value(self, name_to_arr): for tensor, data_arr in name_to_arr.items(): data_arr = np.asarray(data_arr) # noqa: PLW2901 data_arr = data_arr.flatten() # noqa: PLW2901 if data_arr.size > 0: min_value = np.min(data_arr) max_value = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def just_histogram(*args, **kwargs):\n return np.histogram(*args, **kwargs)[0].astype(float)", "def add_histogram(self, tag, values, global_step=None, bins='tensorflow'):\n values = make_np(values)\n self.vis.histogram(make_np(values), opts={'title': tag})", "def get_histogram(self):\n...
[ "0.73119396", "0.7298664", "0.72432923", "0.7087078", "0.70734334", "0.7008626", "0.69554347", "0.6877622", "0.6859786", "0.6762288", "0.6739682", "0.6714061", "0.6659528", "0.6620292", "0.6579403", "0.657029", "0.65458226", "0.6535959", "0.6534714", "0.6524735", "0.6502923",...
0.0
-1
Given a dataset, find the optimal threshold for quantizing it. The reference distribution is `q`, and the candidate distribution is `p`. `q` is a truncated version of the original distribution.
def get_entropy_threshold(self, histogram, num_quantized_bins): import copy from scipy.stats import entropy hist = histogram[0] hist_edges = histogram[1] num_bins = hist.size zero_bin_index = num_bins // 2 num_half_quantized_bin = num_quantized_bins // 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Quantile(data, q, precision=1.0):\n N, bins = np.histogram(data, bins=precision*np.sqrt(len(data)))\n norm_cumul = 1.0*N.cumsum() / len(data)\n\n for i in range(0, len(norm_cumul)):\n if norm_cumul[i] > q:\n return bins[i]", "def data_quality(dset):\n dq_threshold = config.tech[...
[ "0.6154804", "0.60241234", "0.5915163", "0.5851482", "0.5744234", "0.56960785", "0.5515238", "0.54940593", "0.5455812", "0.5423219", "0.5397638", "0.53936654", "0.5350975", "0.53223306", "0.52922076", "0.52854943", "0.52854943", "0.52854943", "0.5275716", "0.5255272", "0.5224...
0.0
-1
Computes entropyregularized optimal transport between x and y
def compute(self, x, y, u=None, grad=False): assert_histograms(x, y) if u is not None: self.__u = u else: self.__u = rescale(self.__u) self.__assert_correct_size(x, y) self.__compute(x, y) obj = self.__ground_metric.gamma * (x.T.dot(log_with_zeros...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfer_entropy(X, Y):\n coords = Counter(zip(Y[1:], X[:-1], Y[:-1]))\n\n p_dist = np.zeros((config.NUM_STATES, config.NUM_STATES, config.NUM_STATES))\n for y_f, x_p, y_p in coords.keys():\n p_dist[y_p, y_f, x_p] = coords[(y_f, x_p, y_p)] / (len(X) - 1)\n\n p_yp = p_dist.sum(axis=2).sum(axi...
[ "0.6386833", "0.6281865", "0.6155928", "0.6110233", "0.59215057", "0.59209555", "0.58993256", "0.5835102", "0.5834109", "0.58311456", "0.58072424", "0.5790104", "0.5757953", "0.57465935", "0.57386595", "0.56911635", "0.5677439", "0.5672302", "0.5649353", "0.5635235", "0.56268...
0.0
-1
Find the line that contains or matches substr since line ``start``.
def find_line(lines: List[str], substr: Predicate, start: int = 0) -> int: if isinstance(substr, str): pred = _string_contains elif isinstance(substr, tuple): pred = _pattern_value_match else: pred = _apply_func for i in range(start, len(lines)): if pred(lines[i], substr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match_start_get_remaining(self, start, text):\n if not text.startswith(start):\n return\n return text[len(start):]", "def _get_prev_line_having_substr(substr):\n last_occ_idx = vim.eval(SEARCH_LAST_CMD.format(substr=substr))\n if last_occ_idx == 0:\n return\n line_co...
[ "0.6829045", "0.6382696", "0.6371454", "0.6307071", "0.62964875", "0.60427123", "0.60387963", "0.6038122", "0.60191697", "0.59272146", "0.59037364", "0.5864446", "0.5817685", "0.58130187", "0.58130187", "0.58130187", "0.5806736", "0.5797243", "0.5758163", "0.5758163", "0.5746...
0.73265594
0
Extract the lines between the line containing ``begin`` and the line containing ``end`` (excluding both lines) in ``parent``.
def extract_lines(parent: str, begin: Predicate, end: Predicate) -> str: lines = parent.splitlines() begin_line = find_line(lines, begin) end_line = find_line(lines, end, begin_line+1) new_lines = lines[begin_line+1:end_line] return "\n".join(new_lines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section(fle, begin, end):\n with open(fle) as f:\n for line in f:\n # found start of section so start iterating from next line\n if line.startswith(begin):\n for line in f: \n # found end so end function\n if line.startswith(e...
[ "0.58529377", "0.5581693", "0.54582626", "0.5362531", "0.5349962", "0.5346175", "0.53401434", "0.51990694", "0.5192469", "0.5124478", "0.49769285", "0.49085382", "0.48960736", "0.48947686", "0.48660842", "0.48560873", "0.48549527", "0.485269", "0.4845138", "0.48439127", "0.48...
0.81444484
0
Replace the lines between the line containing ``begin`` and the line containing ``end`` (excluding both lines) in ``parent`` with ``generated``.
def inject_lines(parent: str, begin: Predicate, end: Predicate, generated: str) -> str: lines = parent.splitlines() begin_line = find_line(lines, begin) end_line = find_line(lines, end, begin_line+1) new_lines = lines[:begin_line+1] + generated.splitlines() + lines[end_line:] return "\n".join(new...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_new_file(file, new_content):\n with open(file, 'r') as f:\n old_content = f.read()\n\n try:\n before, begin_marker, _, end_marker, after = re.split(r'(// GENERATED-MARKER\\n)', old_content, flags=re.MULTILINE | re.DOTALL)\n except ValueError:\n raise RuntimeError(\"Failed...
[ "0.5403601", "0.51225114", "0.49107388", "0.48132256", "0.48054352", "0.47870225", "0.47572523", "0.47332415", "0.4713576", "0.4713462", "0.4688489", "0.46581972", "0.46474382", "0.46446952", "0.46335268", "0.4598963", "0.4561457", "0.45551708", "0.4552287", "0.454125", "0.45...
0.71948594
0
Setters for _grilleCSV We read the csv file and copy it into _grilleCSV
def _set_grille_csv(self): with open(self.csvPath, "r") as csvFile: fileRead = csv.reader(csvFile, delimiter=",") #We read each row of the csv file for row in fileRead: rowSplitted = row[0].split(";") self._grilleCSV.append(rowSplitted)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv_file(self):\n pass", "def read_csv():", "def _read_csv(self):\n self.function_name = '_read_csv'\n with open(os.path.join(self.task.downloads, self.csv_name)) as csv_file:\n reader = csv.reader(csv_file, dialect='excel')\n for row in reader:\n ...
[ "0.6927725", "0.69130695", "0.6871285", "0.6801644", "0.6744654", "0.6588532", "0.6566736", "0.64618015", "0.6455032", "0.6349118", "0.63289684", "0.63281035", "0.6291599", "0.628651", "0.6254619", "0.6231155", "0.62277955", "0.62180835", "0.62180835", "0.62067026", "0.620670...
0.84458977
0