query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Entry point for ansible girder client module | def main():
# Default spec for initalizing and authenticating
argument_spec = {
# __init__
'host': dict(),
'port': dict(),
'apiRoot': dict(),
'apiUrl': dict(),
'scheme': dict(),
'dryrun': dict(),
'blacklist': dict(),
# authenticate
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n module = AnsibleModule(\n argument_spec=dict(\n passphrase=dict(type='str', required=False,\n default=None, no_log=True),\n key=dict(type='str', required=False,\n default=None),\n rpms=dict(type='list', required... | [
"0.64768285",
"0.64604247",
"0.6410106",
"0.63225335",
"0.6256897",
"0.60829186",
"0.6063106",
"0.60240316",
"0.60228515",
"0.5964343",
"0.59607345",
"0.5950873",
"0.59385973",
"0.5934552",
"0.5917794",
"0.5884459",
"0.586978",
"0.58608925",
"0.5838486",
"0.5816458",
"0.57575... | 0.8046157 | 0 |
Resize image for np.array | def _np_resize_image(image, size, dtype='int'):
if dtype == 'int':
_size = (size[1], size[0]) # (H,W) to (W,H)
return cv2.resize(image.astype('uint8'),
_size,
interpolation=cv2.INTER_LINEAR)
elif dtype == 'float':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize(image, size):\n return np.array(Image.fromarray(image).resize(size))",
"def image_resize(image: Image, size: (int, int)) -> array:\n image = Image.fromarray(uint8(image))\n\n return array(image.resize(size))",
"def np_resize(img, input_shape):\n height, width = input_shape\n return cv... | [
"0.80775344",
"0.75024486",
"0.73508173",
"0.73508173",
"0.7299563",
"0.7239478",
"0.723774",
"0.6936804",
"0.69231737",
"0.6879766",
"0.68316567",
"0.67977756",
"0.6782235",
"0.6751836",
"0.6731369",
"0.67199236",
"0.67041594",
"0.66855896",
"0.66484493",
"0.66157305",
"0.66... | 0.76700854 | 1 |
Binarize probability map into mask. | def _np_get_mask(prob_map, prob_thresh=0.5):
mask = (prob_map > prob_thresh) * 255
return mask.astype(np.uint8) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_binarise(self):\n pass",
"def apply_mask(binary, mask_dict):\n result = \"\"\n for i, val in enumerate(binary):\n if mask_dict[i] in ('X', '1'):\n result += mask_dict[i]\n else:\n result += binary[i]\n return result",
"def remap_histogram_key(original... | [
"0.642523",
"0.6356742",
"0.62461436",
"0.60823035",
"0.60694367",
"0.59785223",
"0.5968543",
"0.591298",
"0.5908036",
"0.5904688",
"0.58887273",
"0.5858042",
"0.58433956",
"0.5843204",
"0.5840894",
"0.5832284",
"0.5817506",
"0.57884526",
"0.5750518",
"0.5745882",
"0.57396334... | 0.68136746 | 0 |
Transform original points list into flipped points and concatenate these two list. | def _points_transform(clicks_lists, image_width):
clicks_lists_flipped = []
for clicks_list in clicks_lists:
clicks_list_flipped = []
for click in clicks_list:
# Horizontal flip
_y = image_width - click.coords[1] - 1
_click = clicke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mirror_points_point(points, mirror):\n return [mirror_point_point(point, mirror) for point in points]",
"def flip_points(a):\n a = np.array(a)\n return np.flip(a, 1)",
"def _reversePoints(points):\n # copy the points\n points = _copyPoints(points)\n # find the first on curve type and recy... | [
"0.6846456",
"0.62525344",
"0.62357557",
"0.60575736",
"0.57666177",
"0.575885",
"0.5750715",
"0.5610349",
"0.5597628",
"0.55869466",
"0.55826664",
"0.5582364",
"0.5554964",
"0.5532528",
"0.5522956",
"0.54966503",
"0.54485905",
"0.5446705",
"0.5442356",
"0.54414785",
"0.54312... | 0.63959026 | 1 |
Preprocessing the user clicks to points array | def _preprocessing(self):
if self.resize:
self.click_list = self._remapping_coord(self.click_list,
self.input_size,
self.orig_size)
clickers = self._get_clickers(self.click_list)
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_mouse():\n\timport matplotlib.pyplot as plt\n\tfig = plt.figure()\n\tax = fig.add_subplot(111, xlim=(-1,2), ylim=(-1,2))\n\tX = np.zeros( (0,2) )\n\tY = np.zeros( (0,) )\n\tcol = ['bs','gx','ro']\n\t\n\tdef on_click(event):\n\t\tX.resize( (X.shape[0]+1,X.shape[1]) )\n\t\tX[-1,:] = [event.xdata,event.yda... | [
"0.6028115",
"0.5976332",
"0.5928237",
"0.588722",
"0.5848616",
"0.56758183",
"0.5582898",
"0.5569146",
"0.5567416",
"0.55399483",
"0.55177397",
"0.5503829",
"0.55011344",
"0.54957795",
"0.5451826",
"0.54001564",
"0.5395018",
"0.5391376",
"0.53872997",
"0.53311664",
"0.533116... | 0.65283585 | 0 |
Delete the empty related analytic account | def unlink(self):
analytic_accounts_to_delete = self.env['account.analytic.account']
for project in self:
if project.analytic_account_id and not project.analytic_account_id.line_ids:
analytic_accounts_to_delete |= project.analytic_account_id
result = super(Project, se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_account(self, account):\n \n pass",
"def delete_account(self):\n Credential.account_list.remove(self)",
"def test_duo_account_delete(self):\n pass",
"def delete(account):\n account.stripe_account.delete()\n account.delete()",
"def delete_non_activated_account():... | [
"0.7033174",
"0.67283726",
"0.6711199",
"0.6671805",
"0.65966976",
"0.6531173",
"0.6522223",
"0.6496321",
"0.64545316",
"0.64010954",
"0.62627757",
"0.61838365",
"0.6163211",
"0.6157718",
"0.6136624",
"0.6132036",
"0.60669327",
"0.6063105",
"0.6054789",
"0.6036722",
"0.603480... | 0.68331313 | 1 |
Given two particles, calculate number of ticks before they collide for the first time. None if they never collide. | def calculate_collision(p1: Particle, p2: Particle):
# First find all the tick numbers, when one coordinate matches
solutions = []
solutions.append(
_collision_one_coord(p1.ax, p1.vx, p1.px, p2.ax, p2.vx, p2.px)
)
solutions.append(
_collision_one_coord(p1.ay, p1.vy, p1.py, p2.ay, p2.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def particleCollisionTime(self, first_element, second_element):\n\n # Quantities required in following formula\n r = self.measure.distance(first_element, second_element)\n r2 = np.dot(r, r)\n #v = relativeVelocity(first_element, second_element, self.vel)\n v = self.measure.relati... | [
"0.7132978",
"0.66651785",
"0.63942224",
"0.6128394",
"0.60699826",
"0.59047437",
"0.5892432",
"0.5862217",
"0.58521605",
"0.5847946",
"0.583856",
"0.56933767",
"0.5688538",
"0.5648261",
"0.5645475",
"0.5642052",
"0.5617919",
"0.5595813",
"0.55799955",
"0.55546814",
"0.552132... | 0.7031036 | 1 |
Return participant documents with encoded names. | def get_encoded_participants(case, error_handler):
log = parse_file.get_logger()
for participant in case['participants']:
for encoder_name, encoder in encodings.ENCODERS.items():
result = {'encoding': encoder_name,
'case': case['_id'],
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def documents(pmid_23982599, civic_aid6_document):\n return [pmid_23982599, civic_aid6_document]",
"def get_documents(self, value, key='name'):\n documents = []\n for doc in value:\n if doc.endswith('.json'):\n key = 'filename'\n documents.append([x for x in ... | [
"0.5037065",
"0.5026983",
"0.4952229",
"0.4952091",
"0.49487412",
"0.49179173",
"0.49000576",
"0.48417312",
"0.48328254",
"0.482964",
"0.47789705",
"0.47716552",
"0.47558188",
"0.47499445",
"0.47499314",
"0.4745078",
"0.47300333",
"0.47276202",
"0.470836",
"0.47082222",
"0.47... | 0.50994873 | 0 |
Samples skills and users | def create_samples(self, skills_sample_fraction=1.0, users_sample_fraction=1.0):
# Sampling
self.sample_skills_to_be_covered(skills_sample_fraction)
self.sample_users(users_sample_fraction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_skills_to_be_covered_controlled(self, num_sampled_skills=50, rare_sample_fraction=0.33,\n popular_sample_fraction=0.33, rare_threshold=0.33,\n popular_threshold=0.33, user_sample_fraction=1.0):\n print('In... | [
"0.7143267",
"0.67321247",
"0.6420536",
"0.62872666",
"0.62241715",
"0.62220424",
"0.6190365",
"0.6159566",
"0.61140394",
"0.61028713",
"0.6063896",
"0.5995409",
"0.5967122",
"0.5901189",
"0.58642733",
"0.5856139",
"0.5851461",
"0.582702",
"0.5779618",
"0.57707846",
"0.576233... | 0.6959373 | 1 |
Samples a fraction of skills that need to be covered instead of all the skills based on the sampling scheme. | def sample_skills_to_be_covered(self, fraction=1.0):
self.skills_covered = np.zeros(self.num_skills)
if fraction < 1.0:
num_sampled_skills = int(fraction * self.num_skills)
sampled_skills = np.random.choice(self.num_skills, size=num_sampled_skills, replace=False)
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_skills_to_be_covered_controlled(self, num_sampled_skills=50, rare_sample_fraction=0.33,\n popular_sample_fraction=0.33, rare_threshold=0.33,\n popular_threshold=0.33, user_sample_fraction=1.0):\n print('In... | [
"0.78624916",
"0.7106903",
"0.64429855",
"0.6430922",
"0.6430922",
"0.62151647",
"0.6180233",
"0.61468625",
"0.61047155",
"0.60914946",
"0.60914946",
"0.6078987",
"0.60781646",
"0.606959",
"0.6035406",
"0.6023221",
"0.60061115",
"0.6001572",
"0.5997152",
"0.5982087",
"0.59579... | 0.7834701 | 1 |
Categorizes skills of sampled users into three categories based on frequency histogram 1. rare skills (e.g., bottom 33% frequencies) 2. common skills (rest of the skills) 3. popular skills (e.g., top 33% frequencies) | def categorize_skills(self, df_sampled_users, rare_threshold=0.33, popular_threshold=0.33):
# Get frequency of each skills
skills_array = np.array(df_sampled_users['skills_array'].values)
freq = np.sum(skills_array, axis=0)
freq_skills_available = freq[freq > 0]
num_skills_availa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_skills_to_be_covered_controlled(self, num_sampled_skills=50, rare_sample_fraction=0.33,\n popular_sample_fraction=0.33, rare_threshold=0.33,\n popular_threshold=0.33, user_sample_fraction=1.0):\n print('In... | [
"0.5880891",
"0.57333535",
"0.54879767",
"0.5449425",
"0.54090947",
"0.539615",
"0.536603",
"0.5337189",
"0.5275776",
"0.51925325",
"0.5185017",
"0.51759356",
"0.5171471",
"0.5154309",
"0.51523465",
"0.51490986",
"0.5146992",
"0.51279056",
"0.51225543",
"0.5111562",
"0.510716... | 0.7330615 | 0 |
Creates a sample of skills of size 'num_skills'. In this sample, 'rare_sample_fraction' of them are from rare skills category, 'popular_sample_fraction' of them are from popular skills category. | def sample_skills_to_be_covered_controlled(self, num_sampled_skills=50, rare_sample_fraction=0.33,
popular_sample_fraction=0.33, rare_threshold=0.33,
popular_threshold=0.33, user_sample_fraction=1.0):
print('In freelan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_samples(self, skills_sample_fraction=1.0, users_sample_fraction=1.0):\n # Sampling\n self.sample_skills_to_be_covered(skills_sample_fraction)\n self.sample_users(users_sample_fraction)",
"def sample_skills_to_be_covered(self, fraction=1.0):\n self.skills_covered = np.zeros(... | [
"0.69684005",
"0.6896007",
"0.57801753",
"0.57077175",
"0.5643414",
"0.5603849",
"0.5503905",
"0.5475773",
"0.5417366",
"0.5333956",
"0.5306661",
"0.5280854",
"0.5280854",
"0.52536625",
"0.5248631",
"0.5248631",
"0.5248631",
"0.5248631",
"0.52307445",
"0.5207248",
"0.52070117... | 0.7567981 | 0 |
Assigns the ground set elements to partitions uniformly at random | def assign_ground_set_to_random_partitions(self, num_of_partitions, cardinality_constraint):
print('In freelancer random partition.')
self.partitions = defaultdict(dict,{i:{'users':set(), 'k':cardinality_constraint} for i in range(0,num_of_partitions)})
partition_ids = np.arange(start=0, stop=nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomize(self):\n \n spins = [np.random.random() > 0.5 for x in range(self.size)]\n self.spins_initial = bitarray.bitarray(spins)",
"def randPlace(self):\r\n random.seed(self.seed)\r\n \r\n # Start placement on Partition A\r\n partA = True\r\n for node... | [
"0.6404953",
"0.6304296",
"0.62770027",
"0.6260475",
"0.62467414",
"0.6226484",
"0.6215011",
"0.62098956",
"0.6190984",
"0.61088425",
"0.608441",
"0.6081554",
"0.60681367",
"0.6066866",
"0.60614324",
"0.6058705",
"0.6013652",
"0.6003242",
"0.59814346",
"0.59783477",
"0.597287... | 0.73680335 | 0 |
Assigns the ground set elements to partitions based on their salary | def assign_ground_set_to_equi_salary_partitions(self, num_of_partitions, cardinality_constraint):
print('In freelancer salary partition.')
costs = set()
for user_id in self.E:
costs.add(self.cost_vector[user_id])
sorted_costs = sorted(list(costs))
# each cost is a par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_ground_set_to_random_partitions(self, num_of_partitions, cardinality_constraint):\n print('In freelancer random partition.')\n self.partitions = defaultdict(dict,{i:{'users':set(), 'k':cardinality_constraint} for i in range(0,num_of_partitions)})\n partition_ids = np.arange(start=0,... | [
"0.5667653",
"0.55090714",
"0.53606564",
"0.5289445",
"0.5275607",
"0.52265185",
"0.5104114",
"0.5090907",
"0.507885",
"0.5077779",
"0.50641537",
"0.50145876",
"0.5004258",
"0.49790886",
"0.4966237",
"0.49300385",
"0.492593",
"0.48953396",
"0.48378688",
"0.4824251",
"0.478498... | 0.72019356 | 0 |
Reads a n lines from f with an offset of offset lines. | def tail(f, n, offset=0):
avg_line_length = 74
to_read = n + offset
while 1:
try:
f.seek(-(avg_line_length * to_read), 2)
except IOError:
# woops. apparently file is smaller than what we want
# to step back, go to the beginning instead
f.seek(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _seek_to_n_lines_from_end(f, numlines=10):\n\tbuf = \"\"\n\tbuf_pos = 0\n\tf.seek(0, 2) # seek to the end of the file\n\tline_count = 0\n\n\twhile line_count < numlines:\n\t\tnewline_pos = buf.rfind(\"\\n\", 0, buf_pos)\n\t\tfile_pos = f.tell()\n\n\t\tif newline_pos == -1:\n\t\t\tif file_pos == 0:\n\t\t\t\t# ... | [
"0.6995713",
"0.69830865",
"0.6557249",
"0.6479133",
"0.6015872",
"0.6004799",
"0.5924873",
"0.5825385",
"0.58244157",
"0.58227545",
"0.5806487",
"0.5802106",
"0.5796131",
"0.5785858",
"0.577081",
"0.5706994",
"0.56648135",
"0.5641311",
"0.5623573",
"0.5615154",
"0.56085676",... | 0.75444746 | 0 |
Returns number of subnets, given the breakdown; or 1 if breakdown doesn't work. | def calculate_subnets(total, breakdown):
sanity_percent = 0 # if this isn't 100% by the end, we got issues.
subnets = 0
for nodep, netp in breakdown:
sanity_percent += nodep
if (sanity_percent > 100):
return -1
subtotal = int(total * .01 * nodep)
groupby = int(254... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_country_count():\n numbers=country_populations.split('\\n')\n count_numbers= len(numbers)-1\n return count_numbers",
"def getStackCountWith(b):\n options = [t for t in boxes if canStack(b,t)]\n _,height,_ = b\n if not options:\n return height\n return heigh... | [
"0.55934674",
"0.5563919",
"0.5528462",
"0.5488039",
"0.54619956",
"0.5447456",
"0.53395575",
"0.5290311",
"0.52890843",
"0.52565587",
"0.52516896",
"0.5245732",
"0.5244731",
"0.5234548",
"0.5229551",
"0.522947",
"0.5148768",
"0.51222277",
"0.51222277",
"0.5111655",
"0.510094... | 0.7305358 | 0 |
Method to pad PIL Image on all sides with constant `fill` value. | def pad(img, padding, fill=0, mode='constant'):
check_type(img)
if not isinstance(padding, (numbers.Number, tuple)):
raise TypeError('Got inappropriate padding arg')
if not isinstance(fill, (numbers.Number, str, tuple)):
raise TypeError('Got inappropriate fill arg')
if isinstance(paddi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(img, padding, fill=0, padding_mode='constant'):\n if not _is_numpy(img):\n raise TypeError('img should be Numpy Image. Got {}'.format(type(img)))\n\n if not isinstance(padding, (numbers.Number, tuple)):\n raise TypeError('Got inappropriate padding arg')\n if not isinstance(fill, (num... | [
"0.7385898",
"0.73481995",
"0.72555906",
"0.6851695",
"0.6816186",
"0.66814405",
"0.6671225",
"0.66600376",
"0.66376644",
"0.6515069",
"0.65061873",
"0.6502234",
"0.6499006",
"0.64707226",
"0.64594185",
"0.6350127",
"0.63446885",
"0.63444966",
"0.63180697",
"0.6223735",
"0.61... | 0.7467693 | 0 |
Adjust brightness of an Image. | def adjust_brightness(img, brightness_factor):
check_type(img)
enhancer = ImageEnhance.Brightness(img)
img = enhancer.enhance(brightness_factor)
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_brightness(image, delta):\r\n return _clip(image + delta * 255)",
"def adjust_brightness(img, brightness_factor):\n _assert_image_tensor(img, 'CHW')\n assert brightness_factor >= 0, \"brightness_factor should be non-negative.\"\n assert _get_image_num_channels(img, 'CHW') in [\n 1,\... | [
"0.82204413",
"0.78174996",
"0.77475053",
"0.7690998",
"0.76791644",
"0.7669285",
"0.76448554",
"0.75564486",
"0.75472367",
"0.7507929",
"0.74771297",
"0.74748397",
"0.74423105",
"0.7440186",
"0.7276459",
"0.70266074",
"0.70151705",
"0.69986284",
"0.698788",
"0.6980698",
"0.6... | 0.8465688 | 0 |
Adjust contrast of an Image. | def adjust_contrast(img, contrast_factor):
check_type(img)
enhancer = ImageEnhance.Contrast(img)
img = enhancer.enhance(contrast_factor)
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_contrast(img, contrast_factor):\n _assert_image_tensor(img, 'chw')\n assert contrast_factor >= 0, \"contrast_factor should be non-negative.\"\n\n channels = _get_image_num_channels(img, 'CHW')\n dtype = img.dtype if paddle.is_floating_point(img) else paddle.float32\n if channels == 1:\n ... | [
"0.80959105",
"0.79809284",
"0.79799145",
"0.7915904",
"0.7864022",
"0.784802",
"0.7763845",
"0.7725997",
"0.7657669",
"0.7654457",
"0.75754154",
"0.75321746",
"0.7374148",
"0.73587877",
"0.7324188",
"0.72749984",
"0.72118354",
"0.7140224",
"0.7107081",
"0.709643",
"0.7095321... | 0.8614103 | 0 |
Adjust color saturation of an image. | def adjust_saturation(img, saturation_factor):
check_type(img)
enhancer = ImageEnhance.Color(img)
img = enhancer.enhance(saturation_factor)
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_saturation(img, saturation_factor):\n if not _is_numpy_image(img):\n raise TypeError('img should be PIL Image. Got {}'.format(type(img)))\n\n im = img.astype(np.float32)\n degenerate = cv2.cvtColor(cv2.cvtColor(im, cv2.COLOR_RGB2GRAY), cv2.COLOR_GRAY2RGB)\n im = (1-saturation_factor) ... | [
"0.7918249",
"0.78994155",
"0.7829689",
"0.7721216",
"0.7650373",
"0.76433337",
"0.73215264",
"0.71374863",
"0.6895094",
"0.6852125",
"0.67068046",
"0.6642146",
"0.66122895",
"0.658319",
"0.65360445",
"0.6521743",
"0.64246887",
"0.641921",
"0.639464",
"0.6353775",
"0.62883955... | 0.855761 | 0 |
Adjust hue of an image. The image hue is adjusted by converting the image to HSV and cyclically shifting the intensities in the hue channel (H). The image is then converted back to original image mode. `hue_factor` is the amount of shift in H channel and must be in the interval `[0.5, 0.5]`. See `Hue`_ for more details... | def adjust_hue(img, hue_factor):
if not(-0.5 <= hue_factor <= 0.5):
raise ValueError('hue_factor is not in [-0.5, 0.5].'.format(hue_factor))
check_type(img)
input_mode = img.mode
assert img.mode not in {'L', '1', 'I', 'F'}, \
"Input image mode should not be {'L', '1', 'I', 'F'}"
h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_hue(img, hue_factor):\n if not _is_numpy(img):\n raise TypeError('img should be Numpy Image. Got {}'.format(type(img)))\n\n if hue_factor < -255 or hue_factor > 255:\n raise ValueError(\n f'hue_factor({hue_factor}) is outside of the expected value range (-255 <= x <= 255)'... | [
"0.85895795",
"0.8572448",
"0.85619026",
"0.7205861",
"0.69402057",
"0.69187206",
"0.62650293",
"0.61591804",
"0.60515624",
"0.60091466",
"0.59828484",
"0.5952519",
"0.5854867",
"0.5839377",
"0.58338064",
"0.58218634",
"0.58043385",
"0.57956964",
"0.5656194",
"0.56120825",
"0... | 0.8744694 | 0 |
Display the attributes of the layer. | def display_layer_parameters(self):
pprint.pprint(vars(self))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _print_attribute(self):\n print(vars(self))",
"def display(self):\n # type: ()->None\n print('============')\n for key, value in self._ifAttributes.items():\n if isinstance(value, list):\n print(key + ': ')\n for item in value:\n ... | [
"0.6759068",
"0.6757934",
"0.6757424",
"0.6648813",
"0.6640005",
"0.65391797",
"0.6433737",
"0.6322798",
"0.63007444",
"0.6251851",
"0.6192194",
"0.61783284",
"0.6137543",
"0.6119068",
"0.6101882",
"0.6101882",
"0.60906076",
"0.6051513",
"0.59783787",
"0.59731185",
"0.5908545... | 0.7359366 | 0 |
Return the ideal quarter wavelength thickness of the AR coating layer at a given optimization frequency. Arguments | def ideal_thickness(self, opt_freq=160e9):
return (1/np.sqrt(self.dielectric)*3e8/(4*opt_freq)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_wavelength(period, depth, gravity):\r\n return geometry.gmCalculateWavelength(period, depth, gravity)",
"def width(self):\n return (self.norm / max(self.transmit)) * Unit(self.wavelength_unit)",
"def wavelength(self,freq):\n return self.phase_velocity()/freq",
"def get_waveleng... | [
"0.6247497",
"0.61737293",
"0.6076563",
"0.60169905",
"0.5970396",
"0.5918256",
"0.5918256",
"0.5891127",
"0.58884025",
"0.5886617",
"0.5878247",
"0.5775444",
"0.573283",
"0.5727211",
"0.5720022",
"0.5705462",
"0.5659742",
"0.5655887",
"0.5622704",
"0.5589557",
"0.5573802",
... | 0.70882714 | 0 |
Connect all the AR coating layer objects, ensuring that the source and terminator layers come first and last, respectively. | def _interconnect(self):
self.clear_structure()
self.structure.append(self.source)
for i in range(len(self.stack)):
self.structure.append(self.stack[i])
self.structure.append(self.terminator)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_layers(self):\n if not self.check():\n msg = \"Failed to check neural network.\"\n print(msg)\n logging.error(msg)\n return\n\n # 1. set input layer\n pre_layer = self.input_layer\n for layer in self.hidden_layers:\n lay... | [
"0.66146564",
"0.58673614",
"0.5616601",
"0.56008357",
"0.5556945",
"0.55171543",
"0.54460603",
"0.53880274",
"0.53788203",
"0.53654885",
"0.5359501",
"0.5356802",
"0.5317173",
"0.53037655",
"0.52933365",
"0.5251121",
"0.5243879",
"0.521525",
"0.5213942",
"0.5212931",
"0.5211... | 0.6034239 | 1 |
Return a 2x2 array quickly. Arguments | def _make_2x2(self, A11, A12, A21, A22, dtype=float):
array = np.empty((2,2), dtype=dtype)
array[0,0] = A11
array[0,1] = A12
array[1,0] = A21
array[1,1] = A22
return array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLongArray2D(self) -> typing.List[typing.List[int]]:\n ...",
"def getIntArray2D(self) -> typing.List[typing.List[int]]:\n ...",
"def alloc2d(x,y,iv=0):\n return [[iv for j in range(int(x))] for i in range(int(y))]",
"def getArray2d(self):\n\t\treturn self.array2d",
"def make_2d(x):\n... | [
"0.6950673",
"0.6948435",
"0.67974806",
"0.67486435",
"0.6719765",
"0.6714848",
"0.66816825",
"0.6673269",
"0.6661035",
"0.6561734",
"0.6459632",
"0.6361773",
"0.6218368",
"0.6169503",
"0.61442554",
"0.61306435",
"0.60949576",
"0.60715556",
"0.60360205",
"0.6027216",
"0.60221... | 0.75258005 | 0 |
Organize the refractive indices of the layers in the simulation. Returns | def _sort_ns(self):
n = []
for layer in self.structure:
n.append(layer.get_index())
n = np.asarray(n)
return n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numbering_rafts(rafts_loc, rafts_radii, num_of_rafts):\n orbiting_center = np.mean(rafts_loc, axis=0)\n orbiting_dist = np.sqrt((rafts_loc[:, 0] - orbiting_center[0]) ** 2 + (rafts_loc[:, 1] - orbiting_center[1]) ** 2)\n sorted_index = orbiting_dist.argsort()\n dist_sorted = orbiting_dist[sorted_in... | [
"0.5970919",
"0.5969071",
"0.5868115",
"0.58487093",
"0.5830703",
"0.5737197",
"0.5721988",
"0.5652723",
"0.5637402",
"0.5637402",
"0.56195587",
"0.55844927",
"0.5548918",
"0.55183476",
"0.5512431",
"0.5509347",
"0.5491557",
"0.5490198",
"0.5486574",
"0.54467595",
"0.54252297... | 0.6599312 | 0 |
Handle the special case of unpolarized light by running the model for both 's' and 'p' polarizations and computing the mean of the two results. Arguments | def _unpolarized_simulation(self, frequency, theta_0=0):
s_data = self.simulate(frequency, 's', theta_0)
p_data = self.simulate(frequency, 'p', theta_0)
T = (s_data + p_data)/2
return T | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modelmean(self, model_params, this_data, this_suff_stat):\n pass",
"def mt(P_1,V0_1,meanF_1,rho): \n psi = np.arctan2(V0_1[2],-V0_1[0])\n \n # Find swept ares\n idx_zmax = np.argmax(P_1[:,-1,2])\n idx_ymax = np.argmax(P_1[:,-1,1])\n idx_zmin = np.argmin(P_1[:,-1,2])\n \... | [
"0.59134376",
"0.55239034",
"0.53342396",
"0.5303632",
"0.52453595",
"0.5169982",
"0.5147065",
"0.5143282",
"0.51396984",
"0.5123302",
"0.51190704",
"0.51146936",
"0.5091671",
"0.5088502",
"0.50615734",
"0.50424194",
"0.5028437",
"0.5017718",
"0.5015112",
"0.5014439",
"0.4998... | 0.5633161 | 1 |
Create a layer from the set of preprogrammed materials and add it to the AR coating stack Arguments | def add_layer(self, material, thickness=5.0, units='mil', type='layer', \
stack_position=-1):
type = type.lower()
if type == 'layer':
layer = Layer()
layer.name = material.lower()
layer.thickness = thickness
layer.units = units
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddDispersionMaterial(GeometryName,RGBData):\n\n r,g,b=RGBData\n onlyR = tuple([r,0,0,1])\n onlyG = tuple([0,g,0,1])\n onlyB = tuple([0,0,b,1])\n\n\n currentMaterial = bpy.data.materials.new(name='TypeA'+GeometryName)\n currentMaterial.use_nodes = True\n nodes = currentMaterial.node_tree.n... | [
"0.6226837",
"0.6203353",
"0.6016738",
"0.58274734",
"0.5601365",
"0.55847776",
"0.5581775",
"0.5572715",
"0.55110264",
"0.54817516",
"0.5468707",
"0.54606545",
"0.5430585",
"0.5422103",
"0.5419676",
"0.5414244",
"0.5406814",
"0.54019004",
"0.538",
"0.5315735",
"0.530001",
... | 0.6437094 | 0 |
Add a layer with custom properties to the AR stack. Arguments | def add_custom_layer(self, material, thickness, units, dielectric, loss_tangent, stack_position=-1):
layer = Layer()
layer.units = units
layer.thickness = thickness
layer.dielectric = dielectric
layer.losstangent = loss_tangent
if (stack_position == -1):
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, layer):\n self._top = layer(self._top)\n layer_name_ = layer.__class__.__name__\n layer_params_ = layer.params\n self._info.append((layer_name_, layer_params_))",
"def __call__(cls, *args, **kwargs):\n layer = super(LayerAspect, cls).__call__(*args, **kwargs)\n\n if Job.Cu... | [
"0.6919454",
"0.6874903",
"0.6793331",
"0.65545005",
"0.64739907",
"0.63449734",
"0.63442105",
"0.6126746",
"0.59435934",
"0.59133106",
"0.5860487",
"0.58573556",
"0.582993",
"0.58179677",
"0.57985747",
"0.5792031",
"0.5770099",
"0.57636625",
"0.5761266",
"0.57004243",
"0.568... | 0.7097225 | 0 |
Display all the simulation parameters in one place. | def display_sim_parameters(self):
pprint.pprint(vars(self))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_parameters(self):\n with np.printoptions(precision=3, suppress=True):\n print('number of wind phase = {}'.format(self.ncomp))\n print('galactic parameter = {}'.format(self.scaling_field))\n print('reference height = {}'.format(self.z0))\n for p in ['cool_... | [
"0.74094933",
"0.73057306",
"0.71566695",
"0.6884514",
"0.6796596",
"0.67935765",
"0.6771066",
"0.67183095",
"0.6626539",
"0.6595529",
"0.65158534",
"0.6436903",
"0.6424904",
"0.64146215",
"0.6342033",
"0.6288974",
"0.62845755",
"0.6271121",
"0.6263979",
"0.6254826",
"0.62532... | 0.7992493 | 0 |
Remove all elements from the current AR ``structure``. | def clear_structure(self):
self.structure = []
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_elements(self):\n\n pass",
"def clear(self):\n\n\t\tself.atomid = []\n\t\tself.resi = []\n\t\tself.resn = []\n\t\tself.atom = []\n\t\tself.element = []\n\t\tself.chain = []\n\t\tself.type = []\n\t\tself.inverted = False\n\t\tself.atomlist = []\n\t\tself.keeplist = []\n\t\ts... | [
"0.6407057",
"0.6135725",
"0.6079741",
"0.6073262",
"0.6065226",
"0.5991256",
"0.59750926",
"0.5952651",
"0.59332174",
"0.58856636",
"0.5879297",
"0.5873883",
"0.5859984",
"0.58570814",
"0.5840715",
"0.5840436",
"0.58200175",
"0.5818231",
"0.5818231",
"0.5808292",
"0.5805646"... | 0.75357366 | 0 |
Remove the specified layer from the AR coating stack. Arguments | def remove_layer(self, layer_pos):
self.stack.pop(layer_pos)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RemoveLayer(self, *args):\n return _XCAFDoc.XCAFDoc_LayerTool_RemoveLayer(self, *args)",
"def remove_layer(self, layer=None):\n\t\tif layer is not None:\n\t\t\ttry:\n\t\t\t\tself.sublayers.remove(layer)\n\t\t\texcept ValueError:\n\t\t\t\tpass\n\t\telif self.superlayer is not None:\n\t\t\tself.superlay... | [
"0.77137464",
"0.7416595",
"0.7410551",
"0.71367216",
"0.68727535",
"0.6798072",
"0.679285",
"0.6770055",
"0.65042233",
"0.6372433",
"0.6315002",
"0.62630314",
"0.57843345",
"0.5730568",
"0.57278323",
"0.5645684",
"0.5617629",
"0.55241436",
"0.5509654",
"0.5505746",
"0.548432... | 0.78272414 | 0 |
Take the attributes of the ``Builder()`` object and execute the simulation at each frequency in ``Builder().freq_sweep``. Save the output to a columnized, tabseparated text file. Returns | def run_sim(self):
t0 = time.time()
print('Beginning AR coating simulation')
self._d_converter()
self._interconnect()
f_list = []
t_list = []
r_list = []
for f in self.freq_sweep:
results = self.sim_single_freq(f)
f_list.append(f)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\r\n #print 'WriteFITS.run'\r\n\r\n # construct the name of the file\r\n runtime = self.previous_results['runtime']\r\n fitsname = '%s.fits' % runtime\r\n\r\n # get list of instrument observations\r\n observe = self.previous_results['observe']\r\n obs_... | [
"0.5954314",
"0.559512",
"0.55548674",
"0.5545312",
"0.5534271",
"0.55245703",
"0.5496111",
"0.5488325",
"0.54748154",
"0.5410784",
"0.5380403",
"0.53455675",
"0.53385794",
"0.52782524",
"0.5235391",
"0.5225953",
"0.5218088",
"0.52113324",
"0.5201477",
"0.516396",
"0.5160859"... | 0.5908045 | 1 |
List the materials with known properties. The listed material names are keys in the materials properties dictionary. | def show_materials(self):
print('\nThe materials with known dielectric properties are:\n')
pprint.pprint(mats.Electrical.props)
# pprint.pprint(mats.Electrical.DIELECTRIC)
print('\nThe materials with known loss tangents are:\n')
pprint.pprint(mats.Electrical.props)
# ppri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_materials_properties(dbpath): #<un-named>nook\n odb = openOdb(path=dbpath)\n data = []\n for _name,_mat in odb.materials.items():\n _elastic_mod = _mat.elastic.table[0][0]\n _poisson = _mat.elastic.table[0][1]\n if hasattr(_mat,\"plastic\"):\n _plastic = _mat.plasti... | [
"0.6943955",
"0.6848694",
"0.6815325",
"0.66644573",
"0.6500591",
"0.6459267",
"0.6354483",
"0.62616825",
"0.6259314",
"0.6180884",
"0.6179187",
"0.61718166",
"0.6148789",
"0.6141167",
"0.60783863",
"0.58889025",
"0.5850806",
"0.58497685",
"0.5842548",
"0.58035386",
"0.580026... | 0.7507949 | 0 |
Returns the root 'src' absolute path of this Chromium Git checkout. | def get_chromium_src_path() -> pathlib.Path:
_CHROMIUM_SRC_ROOT = pathlib.Path(__file__).parents[3].resolve(strict=True)
if _CHROMIUM_SRC_ROOT.name != 'src':
raise AssertionError(
f'_CHROMIUM_SRC_ROOT "{_CHROMIUM_SRC_ROOT}" should end in "src".')
try:
_assert_git_repository(_CHR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetSrc():\n return os.path.abspath(os.path.join(_THIS_DIR, os.pardir, os.pardir,\n os.pardir))",
"def source_root_dir():\n return os.path.abspath(os.path.dirname(__file__))",
"def menpowidgets_src_dir_path():\n # to avoid cluttering the menpowidgets.base namespac... | [
"0.7207564",
"0.70896846",
"0.70820946",
"0.70458966",
"0.7013986",
"0.6813633",
"0.6768941",
"0.6744797",
"0.6672002",
"0.6643499",
"0.6634959",
"0.66120505",
"0.6588977",
"0.6572024",
"0.6556969",
"0.65439117",
"0.65423363",
"0.65149325",
"0.65131664",
"0.65060693",
"0.6501... | 0.7769902 | 0 |
Gets the datetime of the commit at HEAD for a Git repository in UTC. The datetime returned contains timezone information (in timezone.utc) so that it can be easily be formatted or converted (e.g., to local time) based on the caller's needs. | def get_head_commit_datetime(
git_repo: Optional[Union[str, pathlib.Path]] = None) -> dt.datetime:
if not git_repo:
git_repo = get_chromium_src_path()
if not isinstance(git_repo, pathlib.Path):
git_repo = pathlib.Path(git_repo)
_assert_git_repository(git_repo)
timestamp = subp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_commit_date():\n return subprocess.check_output(['git', 'log', '-1', '--pretty=%ad',\n '--date=format:%d %b %H:%M', 'py/calendon']).decode().strip()",
"def __last_commit_date(self):\n return utils.run('git', ['log', '--all', '-1', '--format=%cI'],\n ... | [
"0.73576576",
"0.7228298",
"0.6683409",
"0.663864",
"0.6581028",
"0.6477623",
"0.6476076",
"0.64546764",
"0.64242756",
"0.6367367",
"0.6354047",
"0.6353915",
"0.6298306",
"0.6136942",
"0.61079997",
"0.6062234",
"0.6038261",
"0.6030498",
"0.59632814",
"0.59031916",
"0.58791256... | 0.7551182 | 0 |
Takes list or array of postcodes, and returns it in a cleaned numpy array | def clean_postcodes(postcodes):
postcode_df = pd.DataFrame({'Postcode':postcodes})
postcode_df['Postcode'] = postcode_df['Postcode'].str.upper()
# If length is not 7 get rid of spaces. This fixes e.g. "SW19 2AZ" -> "SW192AZ"
postcode_df['Postcode'] = postcode_df['Postcode'].where(
postcode_df['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(lst, typecode ):\n a = array.array( typecode )\n for n,c in lst: \n a.extend( array.array( typecode, (c,) * n ) )\n return a",
"def clean_data(array):\n ret = np.zeros(len(array))\n for i in range(len(array)):\n drop_id = len(str(i+1)) + 1\n array[i, 0] = array[i, 0... | [
"0.5970978",
"0.5884224",
"0.5817092",
"0.5791146",
"0.57216644",
"0.5662122",
"0.56127787",
"0.55187774",
"0.5317119",
"0.5283018",
"0.5241644",
"0.52055186",
"0.5141189",
"0.5121496",
"0.5102922",
"0.50876445",
"0.5085679",
"0.50591373",
"0.5050036",
"0.5042256",
"0.5041779... | 0.60236096 | 0 |
Get an array of WGS84 (latitude, longitude) pairs from a list of postcodes. | def get_lat_long(self, postcodes):
# Fix evil postcodes
postcodes = clean_postcodes(postcodes)
postcode_df = self.postcode_df
postcode_df = postcode_df.fillna('np.nan')
postcode_df = postcode_df.set_index('Postcode')
index_data = postcode_df.loc[postcodes]
lat = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geocode_postcode(self, postcode: [str],\n address: Optional[str] = None) -> Union[Tuple[float, float], List[Tuple[float, float]]]:\n address = [None for a in address] if address is None else list(address)\n logging.debug(\"Geocoding %s postcodes (%s addresses)\", len(postc... | [
"0.6265567",
"0.62188435",
"0.616504",
"0.6100916",
"0.58316505",
"0.58076537",
"0.56954175",
"0.5694291",
"0.56838447",
"0.5665563",
"0.5650249",
"0.54783994",
"0.5472408",
"0.54524064",
"0.5436842",
"0.5424833",
"0.5395187",
"0.53837734",
"0.5375772",
"0.5349759",
"0.533922... | 0.62757945 | 0 |
Get an array of flood risk probabilities from arrays of eastings and northings. Flood risk data is extracted from the Tool flood risk file. Locations not in a risk band circle return `Zero`, otherwise returns the name of the highest band it sits in. | def get_easting_northing_flood_probability(self, easting, northing):
# Read in risk files as pandas dataframe
risks = self.risk_df
prob_bands = np.full(np.size(easting), "Zero", dtype='<U8')
# For each point we get:
for point, point_east in enumerate(easting):
point_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sorted_flood_probability(self, postcodes):\n # Fix evil postcodes\n postcodes = clean_postcodes(postcodes)\n\n # Get latitude and longitude\n output = self.get_lat_long(postcodes) # Returns latitude,longitude pairs in an array\n lat_long = pd.DataFrame(\n {'Po... | [
"0.5840573",
"0.5451073",
"0.5239133",
"0.51064956",
"0.4967001",
"0.49006256",
"0.4847061",
"0.48315755",
"0.48241347",
"0.47855008",
"0.47808293",
"0.47772777",
"0.4758176",
"0.4740778",
"0.47345486",
"0.47230184",
"0.4712612",
"0.47092313",
"0.47091162",
"0.4705005",
"0.46... | 0.75808704 | 0 |
Get an array of flood risk probabilities from a sequence of postcodes. Probability is ordered High>Medium>Low>Very low>Zero. Flood risk data is extracted from the `Tool` flood risk file. | def get_sorted_flood_probability(self, postcodes):
# Fix evil postcodes
postcodes = clean_postcodes(postcodes)
# Get latitude and longitude
output = self.get_lat_long(postcodes) # Returns latitude,longitude pairs in an array
lat_long = pd.DataFrame(
{'Postcode':post... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def psipred(infile, sequence):\n aa2sec = {\n 'H': [1, 0, 0],\n 'E': [0, 1, 0],\n 'C': [0, 0, 1]\n }\n result = []\n with open(infile, 'r') as fh:\n for line in fh:\n if line.startswith('Pred:'):\n spl = line.strip().split(' ')\n if l... | [
"0.6149525",
"0.57030034",
"0.53762126",
"0.5350772",
"0.5320058",
"0.5255733",
"0.52238405",
"0.52073324",
"0.51705116",
"0.51705116",
"0.50618285",
"0.50456816",
"0.50339997",
"0.50247955",
"0.4985709",
"0.4939108",
"0.4907953",
"0.49060336",
"0.485977",
"0.48142055",
"0.48... | 0.64648455 | 0 |
Get an array of estimated cost of a flood event from a sequence of postcodes. | def get_flood_cost(self, postcodes):
# Fix evil postcodes
postcodes = clean_postcodes(postcodes)
values_df = self.values_df[['Postcode', 'Total Value']]
values_df = values_df.loc[values_df.Postcode.isin(postcodes)]
values_df = values_df.set_index('Postcode').reindex(postcodes)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost_func(plist):\n\t\tgamma, alpha = plist\n\t\tk = ac.Moffat2DKernel(gamma, alpha, x_size=nx, y_size=ny)\n\n\t\tarr_out_predict = ac.convolve(arr_in, k)\n\n\t\tarr_out_fit, arr_out_predict_fit = match_dimension(arr_out, arr_out_predict)\n\t\tdiff = (arr_out_fit - arr_out_predict_fit)*scale_factor\n\n\t\tretu... | [
"0.5173801",
"0.51564807",
"0.5112312",
"0.51068145",
"0.5104989",
"0.5104811",
"0.5067886",
"0.5053143",
"0.5042089",
"0.50331557",
"0.49932286",
"0.49598402",
"0.49526855",
"0.49343145",
"0.4929131",
"0.49237642",
"0.49029443",
"0.48845562",
"0.48811215",
"0.4875639",
"0.48... | 0.7135164 | 0 |
Get an array of estimated annual flood risk in pounds sterling per year of a flood event from a sequence of postcodes and flood probabilities. | def get_annual_flood_risk(self, postcodes, probability_bands):
#get cost_value
cost_value = self.get_flood_cost(postcodes)
#create Dataframe for replacing corresonding value
risk_df = pd.DataFrame({'Probability Band': probability_bands})
total_df = risk_df.replace(
{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sorted_annual_flood_risk(self, postcodes):\n\n # Fix evil postcodes\n postcodes = clean_postcodes(postcodes)\n\n # Get lat, long of postcodes\n arr = self.get_lat_long(postcodes)\n lat = arr[:, 0] # Latitude\n lng = arr[:, 1] # Longitude\n\n # Convert lat, l... | [
"0.59848833",
"0.56781584",
"0.5404115",
"0.5328161",
"0.52764213",
"0.5244134",
"0.522769",
"0.51827186",
"0.513963",
"0.5112866",
"0.51083076",
"0.50649613",
"0.49471208",
"0.49010098",
"0.48951918",
"0.48927584",
"0.48918253",
"0.48807698",
"0.48748794",
"0.48567662",
"0.4... | 0.6496352 | 0 |
Get a sorted pandas DataFrame of flood risks. | def get_sorted_annual_flood_risk(self, postcodes):
# Fix evil postcodes
postcodes = clean_postcodes(postcodes)
# Get lat, long of postcodes
arr = self.get_lat_long(postcodes)
lat = arr[:, 0] # Latitude
lng = arr[:, 1] # Longitude
# Convert lat, long -> easting,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_gefs_frame(frame):\n if frame is None:\n return frame\n else:\n return pd.DataFrame(np.sort(frame), index=frame.index)",
"def get_goldilocks_dataframe(self, filename):\n df = pd.DataFrame()\n for j in range(self.n_orders):\n df_i = pd.DataFrame()\n ... | [
"0.6370824",
"0.58607304",
"0.5721609",
"0.56225353",
"0.5615848",
"0.55028003",
"0.550037",
"0.54332703",
"0.54226243",
"0.5420903",
"0.53964025",
"0.53897834",
"0.53690106",
"0.52974486",
"0.5292217",
"0.52744174",
"0.5213015",
"0.5210845",
"0.5197446",
"0.51936984",
"0.516... | 0.6240735 | 1 |
Insert a new value after a key. | def insert_after(self, key, value):
self._insert_after(self.head, key, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, key, value):\n\t\tself.__insert(key, value, key[1:])",
"def _insert_after(cls, node, key, value):\n # End of list base case\n if node is None:\n return\n\n # Base case for key found\n if node.value == key:\n node.next_ = Node(value, node.next_)\n... | [
"0.824605",
"0.76902354",
"0.7456207",
"0.74112356",
"0.7222522",
"0.7161951",
"0.71594304",
"0.71453357",
"0.7112022",
"0.70699406",
"0.7042985",
"0.7003373",
"0.6992507",
"0.6984114",
"0.69314635",
"0.6923191",
"0.68841237",
"0.68686163",
"0.685315",
"0.6815772",
"0.6809205... | 0.8499372 | 0 |
Insert a new value after a key recursively. | def _insert_after(cls, node, key, value):
# End of list base case
if node is None:
return
# Base case for key found
if node.value == key:
node.next_ = Node(value, node.next_)
return
# Recursive case
cls._insert_after(node.next_, key, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_after(self, key, value):\n self._insert_after(self.head, key, value)",
"def insert(self, key, value):\n\t\tself.__insert(key, value, key[1:])",
"def insert(self, key, value=None):\n if isinstance(key, list):\n for k in key:\n self.insert(k)\n else:\n ... | [
"0.7798615",
"0.7577879",
"0.7455184",
"0.7206514",
"0.7101434",
"0.70513165",
"0.6990954",
"0.69256455",
"0.6925461",
"0.6884688",
"0.685683",
"0.6851591",
"0.68488187",
"0.6843558",
"0.68378764",
"0.68335766",
"0.6827937",
"0.6778415",
"0.6688068",
"0.6680994",
"0.6632043",... | 0.80542064 | 0 |
Delete node with the value. | def delete(self, value):
# Iterating to node that has value
node = self.head
last_node = None
while node is not None and node.value != value:
last_node = node
node = node.next_
# Check if the node has been found
if node is None:
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_node(tx, node_value, node_type):\n cql = \"MATCH(n:\" + node_type + \"{name:$node_value}) DETACH DELETE(n);\"\n try:\n tx.run(cql, node_value=node_value)\n except Exception as e:\n print(str(e))",
"def delete_node(name: str, value: str) -> None:\n global _... | [
"0.7895208",
"0.7865066",
"0.7842883",
"0.77804184",
"0.7733886",
"0.7649159",
"0.75719863",
"0.7489731",
"0.7425765",
"0.73570824",
"0.7320378",
"0.72870445",
"0.72328395",
"0.7221816",
"0.7196131",
"0.7181461",
"0.711635",
"0.70913994",
"0.70902276",
"0.7073389",
"0.70698",... | 0.80483353 | 0 |
Try importing Pyspark or display warn message in streamlit | def try_import_pyspark_in_streamlit():
try:
import pyspark
from pyspark.sql import SparkSession
except:
print("You need Pyspark installed to run NLU. Run <pip install pyspark==3.0.2>")
try:
import streamlit as st
st.error(
"You need Pyspar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_spark(self):\n\t\traise NotImplementedError()",
"def get_spark_i_know_what_i_am_doing():\n return _spark",
"def test_pyspark(container):\n c = container.run(\n tty=True,\n command=['start.sh', 'python', '-c', 'import pyspark']\n )\n rv = c.wait(timeout=30)\n assert rv == 0 o... | [
"0.5612264",
"0.53342944",
"0.5266926",
"0.50426006",
"0.50365645",
"0.50164586",
"0.5011089",
"0.4967256",
"0.49386474",
"0.4916724",
"0.49133012",
"0.49097872",
"0.4909218",
"0.48768187",
"0.48554832",
"0.4795663",
"0.4754267",
"0.4747436",
"0.4722205",
"0.47067413",
"0.469... | 0.78209 | 0 |
Authenticate enviroment for JSL Liscensed models. Installs NLPHealthcare if not in enviroment detected Either provide path to spark_nlp_for_healthcare.json file as first param or manually enter them, SPARK_NLP_LICENSE_OR_JSON_PATH,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,JSL_SECRET . Set gpu=true if you want to enable G... | def auth(SPARK_NLP_LICENSE_OR_JSON_PATH='/content/spark_nlp_for_healthcare.json', AWS_ACCESS_KEY_ID='',
AWS_SECRET_ACCESS_KEY='', JSL_SECRET='', gpu=False):
if os.path.exists(SPARK_NLP_LICENSE_OR_JSON_PATH):
with open(SPARK_NLP_LICENSE_OR_JSON_PATH) as json_file:
j = json.load(json_file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(_):\n hps = LM.get_default_hparams().parse(FLAGS.hpconfig)\n hps._set(\"num_gpus\", FLAGS.num_gpus)\n print ('*****HYPER PARAMETERS*****')\n print (hps)\n print ('**************************')\n\n vocab = Vocabulary.from_file(os.path.join(FLAGS.datadir, \"vocabulary.txt\"))\n\n if FLAG... | [
"0.57388246",
"0.54338783",
"0.5398804",
"0.5333285",
"0.53162426",
"0.5237506",
"0.523501",
"0.52327436",
"0.51980984",
"0.51619136",
"0.5145377",
"0.5143205",
"0.5136607",
"0.51189315",
"0.5115787",
"0.50833327",
"0.50563383",
"0.5043505",
"0.50324553",
"0.5023637",
"0.5003... | 0.6689239 | 0 |
Wrap function with ST cache method if streamlit is importable | def wrap_with_st_cache_if_avaiable(f):
try:
import streamlit as st
logger.info("Using streamlit cache for load")
return st.cache(f, allow_output_mutation=True, show_spinner=False)
except:
logger.exception("Could not import streamlit and apply caching")
print("You need str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_functools_wraps(self):\n\n import streamlit as st\n\n @st.cache\n def f():\n return True\n\n self.assertEqual(True, hasattr(f, \"__wrapped__\"))",
"def cached(func):\n return _lru_cache(None)(func)",
"def cache(func):\n storage = {}\n\n def wrapper(*... | [
"0.72335064",
"0.67037886",
"0.66820943",
"0.6557552",
"0.6514492",
"0.6514082",
"0.6456728",
"0.637417",
"0.63546365",
"0.63348776",
"0.6316537",
"0.6292026",
"0.62352824",
"0.62345815",
"0.6233367",
"0.62333107",
"0.62000644",
"0.6180296",
"0.6171165",
"0.6138923",
"0.61381... | 0.8505075 | 0 |
Normalize a dict of chunks. | def normalize_chunks(
chunks: Mapping[str, Union[int, Tuple[int, ...]]],
dim_sizes: Mapping[str, int],
) -> Dict[str, int]:
if not chunks.keys() <= dim_sizes.keys():
raise ValueError(
'all dimensions used in chunks must also have an indicated size: '
f'chunks={chunks} vs dim_sizes={dim_siz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_all_data_in_dict(data: Data_dict_type, normalizers: Tuple[object, ...]) -> Data_dict_type:\n for key, item in data.items():\n values, sample_rate = item\n # save old shape and reshape data to supported format for normalizer\n old_shape = values.shape\n values = values.r... | [
"0.6302474",
"0.60837907",
"0.5948247",
"0.5786794",
"0.57858247",
"0.5774023",
"0.5770888",
"0.57661134",
"0.5734257",
"0.5642278",
"0.55719125",
"0.5567272",
"0.5513552",
"0.5469426",
"0.5463131",
"0.54538107",
"0.5401542",
"0.5381413",
"0.5303782",
"0.52984816",
"0.5297081... | 0.67038727 | 0 |
Make a rechunking plan. | def rechunking_plan(
dim_sizes: Mapping[str, int],
source_chunks: Mapping[str, int],
target_chunks: Mapping[str, int],
itemsize: int,
max_mem: int,
) -> List[Dict[str, int]]:
plan_shapes = algorithm.rechunking_plan(
shape=tuple(dim_sizes.values()),
source_chunks=tuple(source_chunks[dim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rechunking(self, compressor, parallel=False, replace=False):\n target_path = tempfile.TemporaryDirectory()\n source_sf = strax.DataDirectory(self.path)\n st= self.st\n st.set_context_config(dict(allow_rechunk=False,\n n_chunks=10))\n st.stor... | [
"0.54398316",
"0.53904545",
"0.5279085",
"0.5181603",
"0.5129563",
"0.51162356",
"0.50968367",
"0.50834996",
"0.50642467",
"0.5043662",
"0.5040708",
"0.5030235",
"0.50188833",
"0.4995437",
"0.49625322",
"0.4938163",
"0.49274",
"0.4926029",
"0.49074957",
"0.48996857",
"0.48986... | 0.6029432 | 0 |
Round down a chunkkey to offsets corresponding to new chunks. | def _round_chunk_key(
chunk_key: core.ChunkKey,
target_chunks: Mapping[str, int],
) -> core.ChunkKey:
new_offsets = {}
for dim, offset in chunk_key.items():
chunk_size = target_chunks.get(dim)
if chunk_size is None:
new_offsets[dim] = offset
elif chunk_size == -1:
new_offsets[dim] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_chunk(self):\n for key, value in self.piece_coordinates.items():\n # Why is the key a numpy.int type ???\n self.chunk[value] = key",
"def _normalizeKeySlice(self, key):\n if key.start is None:\n kstart = (0, 0)\n else:\n kstart = key.sta... | [
"0.6085762",
"0.59721315",
"0.5535615",
"0.54769576",
"0.5392096",
"0.53591967",
"0.52559686",
"0.5224978",
"0.51803327",
"0.5149737",
"0.49530393",
"0.49112108",
"0.49017742",
"0.4898832",
"0.48969337",
"0.4896401",
"0.48882088",
"0.48876253",
"0.4837309",
"0.48347116",
"0.4... | 0.7670033 | 0 |
Combine chunks into a single (ChunkKey, Dataset) pair. | def consolidate_chunks(
inputs: Iterable[Tuple[core.ChunkKey, xarray.Dataset]],
combine_kwargs: Optional[Mapping[str, Any]] = None,
) -> Tuple[core.ChunkKey, xarray.Dataset]:
inputs = list(inputs)
keys = [key for key, _ in inputs]
if len(set(keys)) < len(keys):
raise ValueError(f'chunk keys are not un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_chunks_result(self, data_keys: List[str], fetch_only: bool = False) -> List:",
"def split_chunks(\n key: core.ChunkKey,\n dataset: xarray.Dataset,\n target_chunks: Mapping[str, int],\n) -> Iterator[Tuple[core.ChunkKey, xarray.Dataset]]:\n # This function splits consolidated arrays into blocks o... | [
"0.6005835",
"0.5682695",
"0.5602341",
"0.5585601",
"0.5574721",
"0.5481608",
"0.52914053",
"0.5252008",
"0.51839036",
"0.5157331",
"0.51571405",
"0.51497865",
"0.51459897",
"0.511034",
"0.50953734",
"0.5063773",
"0.50514185",
"0.5030089",
"0.5011495",
"0.50045127",
"0.500423... | 0.68850577 | 0 |
Split a single (ChunkKey, xarray.Dataset) pair into many chunks. | def split_chunks(
key: core.ChunkKey,
dataset: xarray.Dataset,
target_chunks: Mapping[str, int],
) -> Iterator[Tuple[core.ChunkKey, xarray.Dataset]]:
# This function splits consolidated arrays into blocks of new sizes, e.g.,
# ⌈x_00 x_01 ...⌉ ⌈⌈x_00⌉ ⌈x_01⌉ ...⌉
# X = |x_10 x_11 ...| = ||x_1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_dataset(x, batch_size):\r\n\tsize_modulo = len(x) % batch_size # hack to ensure data is batches successfully\r\n\tif size_modulo != 0:\r\n\t\tx = x[:-size_modulo]\r\n\tpartitioned = np.split(x, batch_size)\r\n\treturn partitioned",
"def _chunk_data(self):\n for n in range(0, len(self.data) + 1,... | [
"0.6560789",
"0.6540121",
"0.64344317",
"0.63841146",
"0.6350557",
"0.6311908",
"0.6191371",
"0.61547345",
"0.6076409",
"0.6063916",
"0.6042421",
"0.6026232",
"0.59983486",
"0.599385",
"0.5961747",
"0.59533745",
"0.58974886",
"0.5865656",
"0.5859766",
"0.5859766",
"0.5857885"... | 0.75269866 | 0 |
Rechunk inmemory pairs of (ChunkKey, xarray.Dataset). | def in_memory_rechunk(
inputs: List[Tuple[core.ChunkKey, xarray.Dataset]],
target_chunks: Mapping[str, int],
) -> Iterator[Tuple[core.ChunkKey, xarray.Dataset]]:
key, dataset = consolidate_chunks(inputs)
yield from split_chunks(key, dataset, target_chunks) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_chunks(\n key: core.ChunkKey,\n dataset: xarray.Dataset,\n target_chunks: Mapping[str, int],\n) -> Iterator[Tuple[core.ChunkKey, xarray.Dataset]]:\n # This function splits consolidated arrays into blocks of new sizes, e.g.,\n # ⌈x_00 x_01 ...⌉ ⌈⌈x_00⌉ ⌈x_01⌉ ...⌉\n # X = |x_10 x_11 ... | [
"0.6820932",
"0.6255683",
"0.6226878",
"0.61808604",
"0.61686605",
"0.6154692",
"0.59964454",
"0.5780077",
"0.5754279",
"0.565912",
"0.565868",
"0.5657204",
"0.5638074",
"0.5595732",
"0.5479498",
"0.5458643",
"0.5443265",
"0.54278415",
"0.5369429",
"0.5363588",
"0.53392226",
... | 0.7626952 | 0 |
Tells info about current time | def time(self):
time = datetime.datetime.now().strftime("%I:%M:%S")
self.speak("the current time is")
self.speak(time) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currentTime():\n return strftime(\"%H:%M:%S\", time.localtime())",
"def current_time(cls) -> float:",
"def current_time():\n now = datetime.now().strftime(\"%Y/%m/%d %H:%M:%S.%f\")\n return now",
"def getCurrentTime():\n\tnow = datetime.datetime.now()\n\thr = now.hour\n\tgreeting = \"\"\... | [
"0.7973656",
"0.772625",
"0.7605761",
"0.75881535",
"0.75294447",
"0.7498588",
"0.7495459",
"0.7466368",
"0.74531955",
"0.7447623",
"0.74185985",
"0.73490584",
"0.72843736",
"0.72731084",
"0.7260997",
"0.72487897",
"0.7235523",
"0.7235523",
"0.72326684",
"0.7181535",
"0.71282... | 0.78153354 | 1 |
Recursively update a dict. Subdict's won't be overwritten but also updated. | def deepupdate(original, update):
for key, value in original.iteritems():
if not key in update:
update[key] = value
elif isinstance(value, dict):
deepupdate(value, update[key])
return update | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive_update(to_update, update):\n if update:\n for key, value in update.items():\n if isinstance(value, dict):\n value = recursive_update(to_update.get(key, {}), value)\n to_update[key] = value\n return to_update",
"def recursive_update(\n base_di... | [
"0.7904014",
"0.78887457",
"0.76975274",
"0.761823",
"0.75225943",
"0.7286748",
"0.7235716",
"0.7204504",
"0.7094437",
"0.7051808",
"0.691271",
"0.68377817",
"0.68304867",
"0.68073094",
"0.6774031",
"0.6769757",
"0.67376924",
"0.6737295",
"0.6721304",
"0.671807",
"0.6696274",... | 0.79647446 | 0 |
Converts a dataframe containing shap values in ohe format back to original genomic positions | def ohe_inverse(df_shap_values):
# Auxiliary list to recreate original shap_values dataframe
list_shap_original = []
# Regular expression to pick attributes names.
# Since in our case attributes names are the genomic positions (i.e. an integer number), we use the regex below
import re
pattern ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def harmonize_eia_epa_orispl(df):\n # TODO: implement this.\n return df",
"def power_point_old(osm_path): \n df = retrieve(osm_path,'points',['other_tags']) \n\n for row in df.itertuples():\n if df.loc[row.Index, \"other_tags\"] == None:\n df = df.drop(row.Index)\n elif not... | [
"0.61097676",
"0.5519744",
"0.54567635",
"0.5409611",
"0.54091376",
"0.5289816",
"0.5179169",
"0.51285565",
"0.50935245",
"0.5074704",
"0.50697887",
"0.5064374",
"0.50546235",
"0.50294065",
"0.502251",
"0.5016597",
"0.49828702",
"0.4946064",
"0.49396178",
"0.49290437",
"0.492... | 0.68825835 | 0 |
creates a new shape with hyp's attributes | def draw(hyp):
print 'g.createShape(',hyp.getAttList(),')'
print type(hyp.getAttList())
g.createShape(hyp.getAttList()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(hyp):\r\n print 'g.createShape(',hyp.getAttList(),')'\r\n print type(hyp.getAttList())\r\n g.createShape(hyp.getAttList())",
"def shape(self) -> Shape:",
"def _create_main_shape(self):\n\n a, b = gc( self.size/2,\n self._ZERO_DEGREES - self.angle,\n self._... | [
"0.6620612",
"0.62583685",
"0.5957094",
"0.5908689",
"0.5908689",
"0.5786528",
"0.5775833",
"0.5735391",
"0.5731915",
"0.5704661",
"0.56915826",
"0.568746",
"0.56355876",
"0.5630756",
"0.5630004",
"0.55272645",
"0.550738",
"0.5436085",
"0.54052126",
"0.54014254",
"0.53949374"... | 0.6593295 | 1 |
hides the existing shape associated with id | def hide(id):
if type(id) is int: # shapeID
g.hide(g.database[id])
else: # id refers to hypothetical shape
shapeID=pickShape(local_vars[id])
g.hide(g.database[shapeID]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide(id):\r\n if type(id) is int: # shapeID\r\n g.hide(g.database[id])\r\n else: # id refers to hypothetical shape\r\n shapeID=pickShape(local_vars[id])\r\n g.hide(g.database[shapeID])",
"def hide_shape(self, shape_id):\n\n if shape_id:\n self.itemconfigure(shape_... | [
"0.8581231",
"0.8390346",
"0.71212643",
"0.6763957",
"0.66287816",
"0.6290862",
"0.6058897",
"0.59502864",
"0.5834213",
"0.5813145",
"0.56963134",
"0.5608406",
"0.56070375",
"0.557525",
"0.5532165",
"0.5472659",
"0.5464938",
"0.54630136",
"0.5410584",
"0.53952074",
"0.5380336... | 0.8552118 | 1 |
fills unspecified attributes of var with attributes of most recently mentioned shape that matches attributes in var | def one2(var):
varAttList = local_vars[var]
options = g.database.findMatches(local_vars[var])
shapeAttList = g.database[g.referenceOrder.pickMostRecent(options)].getAttList()
local_vars[var] = g.AttributeList(shapeAttList.items()+ varAttList.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one2(var):\r\n varAttList = local_vars[var]\r\n options = g.database.findMatches(local_vars[var])\r\n shapeAttList = g.database[g.referenceOrder.pickMostRecent(options)].getAttList()\r\n local_vars[var] = g.AttributeList(shapeAttList.items()+ varAttList.items())",
"def copy_attributes(var1, var2)... | [
"0.6883614",
"0.6200598",
"0.56799114",
"0.54352635",
"0.5365718",
"0.530961",
"0.52707833",
"0.51479536",
"0.51225156",
"0.50734746",
"0.50443786",
"0.5040507",
"0.50123763",
"0.50016546",
"0.49899435",
"0.4980406",
"0.49721068",
"0.496868",
"0.49663883",
"0.49450296",
"0.49... | 0.68042654 | 1 |
applies a predicate to object represented by id | def applyPredicate(id,cmd):
if type(id) is int: # shapeID
attList = g.database[id].getAttList()
g.updateAttList(attList, cmd)
g.updateShape(id,attList)
elif type(id) is HypotheticalShape:
attList = id.getAttList()
try:
shapeID=pickShape(attList)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applyPredicate(id,cmd):\r\n\r\n if type(id) is int: # shapeID\r\n attList = g.database[id].getAttList()\r\n g.updateAttList(attList, cmd)\r\n g.updateShape(id,attList)\r\n\r\n elif type(id) is HypotheticalShape:\r\n attList = id.getAttList()\r\n try:\r\n shap... | [
"0.73754346",
"0.5838974",
"0.577372",
"0.5400787",
"0.5399971",
"0.534218",
"0.53274",
"0.53145176",
"0.5280384",
"0.5277906",
"0.5170549",
"0.5151107",
"0.51495343",
"0.5148643",
"0.51419514",
"0.51378804",
"0.51228505",
"0.5114596",
"0.5080061",
"0.5057794",
"0.5043167",
... | 0.7315682 | 1 |
creates a new shape with hyp's attributes | def draw(hyp):
print 'g.createShape(',hyp.getAttList(),')'
print type(hyp.getAttList())
g.createShape(hyp.getAttList()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(hyp):\n print 'g.createShape(',hyp.getAttList(),')'\n print type(hyp.getAttList())\n g.createShape(hyp.getAttList())",
"def shape(self) -> Shape:",
"def _create_main_shape(self):\n\n a, b = gc( self.size/2,\n self._ZERO_DEGREES - self.angle,\n self._180_DE... | [
"0.6593559",
"0.6257868",
"0.5956994",
"0.5908373",
"0.5908373",
"0.5786683",
"0.5775889",
"0.5735456",
"0.57318187",
"0.5704653",
"0.56927305",
"0.5687583",
"0.563451",
"0.563041",
"0.5629834",
"0.55266005",
"0.5505664",
"0.5436107",
"0.54052895",
"0.5402675",
"0.5394044",
... | 0.66208655 | 0 |
hides the existing shape associated with id | def hide(id):
if type(id) is int: # shapeID
g.hide(g.database[id])
else: # id refers to hypothetical shape
shapeID=pickShape(local_vars[id])
g.hide(g.database[shapeID]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide(id):\n if type(id) is int: # shapeID\n g.hide(g.database[id])\n else: # id refers to hypothetical shape\n shapeID=pickShape(local_vars[id])\n g.hide(g.database[shapeID])",
"def hide_shape(self, shape_id):\n\n if shape_id:\n self.itemconfigure(shape_id, state=... | [
"0.8552118",
"0.8390346",
"0.71212643",
"0.6763957",
"0.66287816",
"0.6290862",
"0.6058897",
"0.59502864",
"0.5834213",
"0.5813145",
"0.56963134",
"0.5608406",
"0.56070375",
"0.557525",
"0.5532165",
"0.5472659",
"0.5464938",
"0.54630136",
"0.5410584",
"0.53952074",
"0.5380336... | 0.8581231 | 0 |
fills unspecified attributes of var with attributes of most recently mentioned shape that matches attributes in var | def one2(var):
varAttList = local_vars[var]
options = g.database.findMatches(local_vars[var])
shapeAttList = g.database[g.referenceOrder.pickMostRecent(options)].getAttList()
local_vars[var] = g.AttributeList(shapeAttList.items()+ varAttList.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one2(var):\n varAttList = local_vars[var]\n options = g.database.findMatches(local_vars[var])\n shapeAttList = g.database[g.referenceOrder.pickMostRecent(options)].getAttList()\n local_vars[var] = g.AttributeList(shapeAttList.items()+ varAttList.items())",
"def copy_attributes(var1, var2):\n f... | [
"0.68038476",
"0.61991006",
"0.5679668",
"0.5434393",
"0.5364872",
"0.53093505",
"0.5270253",
"0.5148796",
"0.51211107",
"0.5072938",
"0.504459",
"0.50410783",
"0.50117296",
"0.5000911",
"0.4990542",
"0.4980776",
"0.4973292",
"0.49685407",
"0.4966164",
"0.4943376",
"0.4938346... | 0.68832254 | 0 |
applies a predicate to object represented by id | def applyPredicate(id,cmd):
if type(id) is int: # shapeID
attList = g.database[id].getAttList()
g.updateAttList(attList, cmd)
g.updateShape(id,attList)
elif type(id) is HypotheticalShape:
attList = id.getAttList()
try:
shapeID=pickShape(attList)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applyPredicate(id,cmd):\n\n if type(id) is int: # shapeID\n attList = g.database[id].getAttList()\n g.updateAttList(attList, cmd)\n g.updateShape(id,attList)\n\n elif type(id) is HypotheticalShape:\n attList = id.getAttList()\n try:\n shapeID=pickShape(attLis... | [
"0.7314072",
"0.58414406",
"0.5774458",
"0.5401331",
"0.53996676",
"0.5343018",
"0.5326704",
"0.5313459",
"0.5280696",
"0.527821",
"0.5169472",
"0.51523036",
"0.5150036",
"0.5147061",
"0.5142404",
"0.5136667",
"0.51229036",
"0.5114203",
"0.50794065",
"0.50568193",
"0.50444686... | 0.7374118 | 0 |
Compute gravity gradient torques. | def _compute_gravity_torque(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_gravity_torque(self, curr_date):\n if self._to_add[0]:\n # return gravity gradient torque in satellite frame\n body2inertial = self.earth.getBodyFrame().getTransformTo(self.in_frame, curr_date)\n body2sat = self.inertial2Sat.applyTo(body2inertial.getRotation())\... | [
"0.7358119",
"0.64381224",
"0.62688065",
"0.5906272",
"0.5894993",
"0.5838472",
"0.575906",
"0.5756718",
"0.5749612",
"0.56591",
"0.5626756",
"0.56163937",
"0.5612647",
"0.5589206",
"0.550804",
"0.55040807",
"0.5498407",
"0.5491252",
"0.5456741",
"0.5433564",
"0.54157126",
... | 0.673073 | 1 |
Property holding magnetic torque vector. | def mTorque(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_torque(self):\n return self.node.sdo[0x6077].phys # rate torque(mN.m) /1000",
"def aTorque(self):\n pass",
"def gTorque(self):\n pass",
"def _compute_gravity_torque(self):\n pass",
"def setMotorTorque(self, torque):\r\n if torque < 0.0:\r\n torque = 0... | [
"0.69905686",
"0.6883635",
"0.6844292",
"0.67961264",
"0.6745202",
"0.66349584",
"0.66349584",
"0.6534814",
"0.6531397",
"0.6504692",
"0.648461",
"0.64651704",
"0.64503294",
"0.63484573",
"0.63299674",
"0.6295242",
"0.62508523",
"0.6243299",
"0.6232335",
"0.62192",
"0.6147876... | 0.73894155 | 0 |
Initializes dipole Model. This method uses the simplified dipole model implemented in DipoleModel.py Which needs to initialize the induced Magnetic density in the hysteresis rods. It also adds the hysteresis rods and bar magnets specified in the settings file to the satellite using the DipoleModel class. | def _initialize_dipole_model(self, model):
for key, hyst in model['Hysteresis'].items():
direction = np.array([float(x) for x in hyst['dir'].split(" ")])
self.dipoleM.addHysteresis(direction, hyst['vol'], hyst['Hc'], hyst['Bs'], hyst['Br'])
# initialize values for Hysteresis (ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n\n super().__init__(\n dynamics_model=DoorDynamicsModel(),\n virtual_sensor_model=UnimodalVirtualSensorModel(\n virtual_sensor_model=[\n DoorVirtualSensorModel(modalities={\"image\"}),\n DoorVirtualSensorModel(mo... | [
"0.60846996",
"0.59922695",
"0.59226173",
"0.57868224",
"0.5778244",
"0.5775409",
"0.5774516",
"0.5749749",
"0.5731533",
"0.570221",
"0.5688919",
"0.5684113",
"0.5678075",
"0.56579274",
"0.5642495",
"0.5609805",
"0.5589588",
"0.55426383",
"0.5534838",
"0.5527638",
"0.54799986... | 0.7724515 | 1 |
Update satellite state obtained from orbit propagation. This method should be called before each attitude integration step! It updates internal variables needed for disturbance torque computation. | def update_satellite_state(self, integration_date):
self.in_date = integration_date
self.spacecraft_state = self.state_observer.spacecraftState
self.satPos_i = self.spacecraft_state.getPVCoordinates().getPosition()
self.satVel_i = self.spacecraft_state.getPVCoordinates().getVelocity() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_satellite_state(self, current_date):\n self.in_date = current_date\n self.spacecraft_state = self.state_observer.spacecraftState\n\n self.satPos_i = self.spacecraft_state.getPVCoordinates().getPosition()\n self.satVel_i = self.spacecraft_state.getPVCoordinates().getVelocity()... | [
"0.6536202",
"0.6313927",
"0.61441183",
"0.6109408",
"0.59719265",
"0.5909231",
"0.59028345",
"0.5894888",
"0.58819085",
"0.58797926",
"0.5865231",
"0.58123153",
"0.58112884",
"0.5784101",
"0.5752916",
"0.57316554",
"0.57180375",
"0.5714949",
"0.5713429",
"0.570852",
"0.56988... | 0.66748387 | 0 |
Compute disturbance torques acting on satellite. This method computes the disturbance torques, which are set to active in satellite's setting file. | def compute_torques(self, rotation, omega, dt):
# shift time from integration start to time of attitude integration step
curr_date = self.in_date.shiftedBy(dt)
self.inertial2Sat = rotation
self.satPos_s = self.inertial2Sat.applyTo(self.satPos_i)
self.satPos_s = np.array([self.sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_torques(self, rotation, omega, dt):\n # shift time @ which attitude integration currently is\n try:\n curr_date = self.in_date.shiftedBy(dt)\n\n self.inertial2Sat = rotation\n self.satPos_s = self.inertial2Sat.applyTo(self.satPos_i)\n omega = Ve... | [
"0.58227944",
"0.5271165",
"0.5135637",
"0.4930457",
"0.48061916",
"0.46520263",
"0.46455866",
"0.4638927",
"0.46183428",
"0.46048695",
"0.45919403",
"0.45686707",
"0.45576572",
"0.4542761",
"0.4541472",
"0.45262",
"0.45204988",
"0.45135644",
"0.45062312",
"0.45003635",
"0.45... | 0.56088495 | 1 |
Compute gravity gradient torque if gravity model provided. This method computes the Newtonian attraction and the perturbing part of the gravity gradient for every cuboid defined in dictionary inCub at time curr_date (= time of current satellite position). The gravity torque is computed in the inertial frame in which th... | def _compute_gravity_torque(self, curr_date):
if self._to_add[0]:
# return gravity gradient torque in satellite frame
body2inertial = self.earth.getBodyFrame().getTransformTo(self.in_frame, curr_date)
body2sat = self.inertial2Sat.applyTo(body2inertial.getRotation())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_gravity_torque(self, curr_date):\n if self._to_add[0]:\n body2inertial = self.earth.getBodyFrame().getTransformTo(self.in_frame, curr_date)\n body2sat = self.inertial2Sat.applyTo(body2inertial.getRotation())\n sat2body = body2sat.revert()\n\n satM = s... | [
"0.75096387",
"0.6571571",
"0.6571571",
"0.61444074",
"0.53732836",
"0.5364078",
"0.53592175",
"0.53389966",
"0.5281263",
"0.52668315",
"0.52541155",
"0.52250105",
"0.52205896",
"0.5189851",
"0.5186091",
"0.512015",
"0.50682104",
"0.5003378",
"0.49752918",
"0.49623924",
"0.49... | 0.77637815 | 0 |
Compute magnetic torque if magnetic model provided. This method converts the satellite's position into Longitude, Latitude, Altitude representation to determine the geo. magnetic field at that position and then computes based on those values the magnetic torque. | def _compute_magnetic_torque(self, curr_date):
if self._to_add[1]:
gP = self.earth.transform(self.satPos_i, self.in_frame, curr_date)
topoframe = TopocentricFrame(self.earth, gP, 'ENU')
topo2inertial = topoframe.getTransformTo(self.in_frame, curr_date)
lat = gP.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def torque(system, /, use_demag=True):\n if use_demag:\n total_field = (mm.consts.mu0 *\n (oc.compute(system.energy.demag.effective_field, system)\n + system.energy.zeeman.H))\n else:\n total_field = mm.consts.mu0 * np.array(system.energy.zeeman.H)\n... | [
"0.6871455",
"0.6338733",
"0.6233411",
"0.61869115",
"0.61336684",
"0.6113086",
"0.6039602",
"0.58993423",
"0.58980733",
"0.580256",
"0.57689935",
"0.5768379",
"0.5749182",
"0.57389605",
"0.57320094",
"0.56794477",
"0.5643121",
"0.5619001",
"0.55776167",
"0.55374926",
"0.5476... | 0.7265357 | 1 |
Initializes dipole Model. This method uses the simplified dipole model implemented in DipoleModel.py Which needs to initialize the induced Magnetic density in the hysteresis rods. It also adds the hysteresis rods and bar magnets specified in the settings file to the satellite using the DipoleModel class. | def _initialize_dipole_model(self, model):
for key, hyst in model['Hysteresis'].items():
direction = np.array([float(x) for x in hyst['dir'].split(" ")])
self.dipoleM.addHysteresis(direction, hyst['vol'], hyst['Hc'], hyst['Bs'], hyst['Br'])
# initialize values for Hysteresis (ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n\n super().__init__(\n dynamics_model=DoorDynamicsModel(),\n virtual_sensor_model=UnimodalVirtualSensorModel(\n virtual_sensor_model=[\n DoorVirtualSensorModel(modalities={\"image\"}),\n DoorVirtualSensorModel(mo... | [
"0.60838014",
"0.5990392",
"0.5922041",
"0.5784273",
"0.57757676",
"0.5773712",
"0.5773648",
"0.5748722",
"0.5730481",
"0.5700419",
"0.56870985",
"0.5683414",
"0.56764555",
"0.56551784",
"0.5640305",
"0.56077576",
"0.55869156",
"0.5540809",
"0.55335855",
"0.55258167",
"0.5477... | 0.7723989 | 0 |
Update satellite state obtained from orbit propagation. This method should be called before each attitude integration step! It updates internal variables needed for disturbance torque computation. | def update_satellite_state(self, current_date):
self.in_date = current_date
self.spacecraft_state = self.state_observer.spacecraftState
self.satPos_i = self.spacecraft_state.getPVCoordinates().getPosition()
self.satVel_i = self.spacecraft_state.getPVCoordinates().getVelocity() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_satellite_state(self, integration_date):\n self.in_date = integration_date\n self.spacecraft_state = self.state_observer.spacecraftState\n\n self.satPos_i = self.spacecraft_state.getPVCoordinates().getPosition()\n self.satVel_i = self.spacecraft_state.getPVCoordinates().getVe... | [
"0.6674608",
"0.63138056",
"0.6144622",
"0.61089504",
"0.5971476",
"0.5910543",
"0.5902695",
"0.5894484",
"0.5882854",
"0.5878823",
"0.5864989",
"0.5812776",
"0.5812547",
"0.5783059",
"0.5753217",
"0.5730742",
"0.57175034",
"0.5714535",
"0.57135075",
"0.57093894",
"0.56997526... | 0.6535651 | 1 |
Compute disturbance torques acting on satellite. This method computes the disturbance torques, which are set to active in satellite's setting file. | def compute_torques(self, rotation, omega, dt):
# shift time @ which attitude integration currently is
try:
curr_date = self.in_date.shiftedBy(dt)
self.inertial2Sat = rotation
self.satPos_s = self.inertial2Sat.applyTo(self.satPos_i)
omega = Vector3D(float... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_torques(self, rotation, omega, dt):\n # shift time from integration start to time of attitude integration step\n curr_date = self.in_date.shiftedBy(dt)\n\n self.inertial2Sat = rotation\n self.satPos_s = self.inertial2Sat.applyTo(self.satPos_i)\n self.satPos_s = np.arr... | [
"0.56103945",
"0.5272524",
"0.5136728",
"0.49325484",
"0.4808587",
"0.46530074",
"0.46459928",
"0.46395054",
"0.4618196",
"0.4606716",
"0.45933738",
"0.45713773",
"0.45592108",
"0.45434135",
"0.45429534",
"0.45280662",
"0.45210528",
"0.45133996",
"0.45075887",
"0.45007682",
"... | 0.5824297 | 0 |
Compute gravity gradient torque if gravity model provided. This method computes the Newtonian attraction and the perturbing part of the gravity gradient for every cuboid defined in dictionary inCub at time curr_date (= time of current satellite position). The gravity torque is computed in the inertial frame in which th... | def _compute_gravity_torque(self, curr_date):
if self._to_add[0]:
body2inertial = self.earth.getBodyFrame().getTransformTo(self.in_frame, curr_date)
body2sat = self.inertial2Sat.applyTo(body2inertial.getRotation())
sat2body = body2sat.revert()
satM = self.state_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_gravity_torque(self, curr_date):\n if self._to_add[0]:\n # return gravity gradient torque in satellite frame\n body2inertial = self.earth.getBodyFrame().getTransformTo(self.in_frame, curr_date)\n body2sat = self.inertial2Sat.applyTo(body2inertial.getRotation())\... | [
"0.77637815",
"0.6571571",
"0.6571571",
"0.61444074",
"0.53732836",
"0.5364078",
"0.53592175",
"0.53389966",
"0.5281263",
"0.52668315",
"0.52541155",
"0.52250105",
"0.52205896",
"0.5189851",
"0.5186091",
"0.512015",
"0.50682104",
"0.5003378",
"0.49752918",
"0.49623924",
"0.49... | 0.75096387 | 1 |
Compute magnetic torque if magnetic model provided. This method converts the satellite's position into Longitude, Latitude, Altitude representation to determine the geo. magnetic field at that position and then computes based on those values the magnetic torque. | def _compute_magnetic_torque(self, curr_date):
if self._to_add[1]:
gP = self.earth.transform(self.satPos_i, self.in_frame, curr_date)
topoframe = TopocentricFrame(self.earth, gP, 'ENU')
topo2inertial = topoframe.getTransformTo(self.in_frame, curr_date)
lat = gP.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def torque(system, /, use_demag=True):\n if use_demag:\n total_field = (mm.consts.mu0 *\n (oc.compute(system.energy.demag.effective_field, system)\n + system.energy.zeeman.H))\n else:\n total_field = mm.consts.mu0 * np.array(system.energy.zeeman.H)\n... | [
"0.68699807",
"0.63400656",
"0.6232671",
"0.6188151",
"0.6134176",
"0.61125404",
"0.60403585",
"0.5898898",
"0.58988893",
"0.5801989",
"0.5767733",
"0.5767675",
"0.57487917",
"0.57399243",
"0.57315844",
"0.568015",
"0.5644834",
"0.5619654",
"0.5577926",
"0.5538078",
"0.547793... | 0.72651374 | 0 |
Compute torque acting on satellite due to solar radiation pressure. This method uses the getLightingRatio() method defined in Orekit and copies parts of the acceleration() method of the SolarRadiationPressure and radiationPressureAcceleration() of the BoxAndSolarArraySpacecraft class to to calculate the solar radiation... | def _compute_solar_torque(self, curr_date):
if self._to_add[2]:
inertial2Sat = self.spacecraft_state.getAttitude().getRotation()
ratio = self.SolarModel.getLightingRatio(self.satPos_i,
self.in_frame,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_solar_torque(self):\n pass",
"def _compute_solar_torque(self, curr_date):\n if self._to_add[2]:\n ratio = self.SolarModel.getLightingRatio(self.satPos_i,\n self.in_frame,\n ... | [
"0.69949347",
"0.6673097",
"0.60990465",
"0.59711844",
"0.58253074",
"0.5795665",
"0.57630336",
"0.5722515",
"0.5703465",
"0.5680917",
"0.5680917",
"0.5657641",
"0.5528349",
"0.5487832",
"0.5445919",
"0.5436321",
"0.5404575",
"0.53043115",
"0.52985704",
"0.52985704",
"0.52661... | 0.6856325 | 1 |
Wait for task to complete async 'accepted' task Notes Certain operations use an async task pattern, where a 202 response on the initial POST is returned along with a self link to query. The operation is complete when one of the following is true (depends on the REST API) The self link returns 200 (as opposed to 202) | def _wait_for_task(self, task_url):
response, status_code = self._client.make_request(
http_utils.parse_url(task_url)['path'],
advanced_return=True
)
# check for async task pattern success/failure
if status_code != constants.HTTP_STATUS_CODE['OK']:
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_wait(self, mocker):\n\n tid = 289466\n site = \"mysite\"\n first_response = self.generate_task_dictionary(\n tid, state=\"waiting\", completed=False\n )\n\n responses = [\n {\"json\": first_response},\n {\"json\": self.generate_task_dicti... | [
"0.61062074",
"0.60079914",
"0.60069877",
"0.58521867",
"0.581347",
"0.5812886",
"0.5768431",
"0.5765323",
"0.5762925",
"0.5761387",
"0.57408994",
"0.573335",
"0.5708843",
"0.5695533",
"0.5674839",
"0.56686956",
"0.56040645",
"0.55940294",
"0.5587207",
"0.5552761",
"0.5543241... | 0.6627306 | 0 |
Test migration of field group references in field definitions | def test_field_fieldgroup_references(self):
# Create field group
self.test_group = RecordGroup_migration.create(
self.testcoll, test_group_id, test_group_create_values
)
# Create field definition referencing field group
self.test_field = RecordField.create(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_field_rules():",
"def test_group_field(self):\n field = self.record.find('field[@name=\\'groups_id\\']')\n self.assertEqual(field.attrib['eval'],\n '[(4, ref(\\'nh_clinical.group_nhc_admin\\'))]',\n 'Incorrect eval on groups id')",
"def tes... | [
"0.61829984",
"0.6167331",
"0.6130675",
"0.6105369",
"0.6037458",
"0.5969111",
"0.59682834",
"0.5849834",
"0.5825737",
"0.58188885",
"0.5818871",
"0.57729965",
"0.5756657",
"0.57528496",
"0.57460386",
"0.5722967",
"0.5712481",
"0.5708259",
"0.5704885",
"0.56987375",
"0.565978... | 0.81420827 | 0 |
Test migration of field without tooltip | def test_field_comment_tooltip(self):
# Create field definition
self.test_field = RecordField.create(
self.testcoll, test_field_id, test_field_tooltip_create_values
)
# Apply migration to collection
migrate_coll_data(self.testcoll)
# Read field definition ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_column_name(self):\n field = self.base_field\n sch = SchemaField(field)\n self.assertEqual(sch.name, sch.column_name)\n self.assertNotEqual(sch.column_name, sch.title)",
"def test_validation_column(self):\n assert self.check.validation_column == \"foo_bar_is_unique_ide... | [
"0.6383244",
"0.6045873",
"0.5803746",
"0.57448345",
"0.57064986",
"0.5700613",
"0.5686739",
"0.5685216",
"0.5632432",
"0.5609656",
"0.55931246",
"0.5588414",
"0.5569909",
"0.55542284",
"0.5545484",
"0.55209637",
"0.55139685",
"0.55029345",
"0.5502049",
"0.5484399",
"0.546857... | 0.69139206 | 0 |
Test migration of view fields | def test_migrate_view_fields(self):
self.test_view = RecordView.create(
self.testcoll, test_view_id, test_view_create_values
)
migrate_coll_data(self.testcoll)
# Read field definition and check for inline field list
view_data = self.check_entity_values(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_prep_fields(self):\n pass",
"def test_Migration_columns(self):\n migration = self.DBSession.query(Migration).filter_by().first()\n if self.engine.dialect.name == 'sqlite': # pragma: no cover\n # pysqlite driver always convert the strings collumns to unicode\n ... | [
"0.64087135",
"0.6328817",
"0.60160935",
"0.6006993",
"0.59865445",
"0.59838164",
"0.59082943",
"0.590558",
"0.5854425",
"0.58354616",
"0.58255655",
"0.5821566",
"0.5816661",
"0.57960916",
"0.5781735",
"0.5768386",
"0.5765273",
"0.5749321",
"0.5749269",
"0.5725564",
"0.572247... | 0.8429944 | 0 |
Test migration of list fields | def test_migrate_list_fields(self):
self.test_list = RecordList.create(
self.testcoll, test_list_id, test_list_create_values
)
migrate_coll_data(self.testcoll)
# Read field definition and check for inline field list
view_data = self.check_entity_values(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_field():",
"def test_single_field_is_listified(self):\r\n ss = SelectStatement('table', 'field')\r\n self.assertEqual(ss.fields, ['field'])",
"def test__list_fields(self):\n correct_fields = [\n \"distance\",\n \"verbose\",\n \"min_core_neighb... | [
"0.7982737",
"0.7013082",
"0.6694529",
"0.6347495",
"0.6340831",
"0.6340831",
"0.6202872",
"0.62022257",
"0.61912197",
"0.6155615",
"0.61215365",
"0.61195683",
"0.61160946",
"0.6111083",
"0.6088671",
"0.607299",
"0.59409857",
"0.59221065",
"0.59152704",
"0.5907704",
"0.588925... | 0.80628663 | 0 |
Sets the reference_currency of this CreditSupportAnnex. | def reference_currency(self, reference_currency):
if self.local_vars_configuration.client_side_validation and reference_currency is None: # noqa: E501
raise ValueError("Invalid value for `reference_currency`, must not be `None`") # noqa: E501
self._reference_currency = reference_currency | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def card_currency(self, card_currency):\n\n self._card_currency = card_currency",
"def billing_currency(self, billing_currency):\n\n self._billing_currency = billing_currency",
"def reference(self, reference):\n\n self._reference = reference",
"def reference(self, reference):\n\n ... | [
"0.6202353",
"0.620083",
"0.6186801",
"0.6186801",
"0.596234",
"0.59369206",
"0.5925179",
"0.5925179",
"0.5925179",
"0.5925179",
"0.5810195",
"0.5784062",
"0.5707103",
"0.5687867",
"0.56441146",
"0.560263",
"0.5576023",
"0.5565525",
"0.5519472",
"0.548651",
"0.5457715",
"0.... | 0.8066907 | 0 |
Sets the collateral_currencies of this CreditSupportAnnex. | def collateral_currencies(self, collateral_currencies):
if self.local_vars_configuration.client_side_validation and collateral_currencies is None: # noqa: E501
raise ValueError("Invalid value for `collateral_currencies`, must not be `None`") # noqa: E501
self._collateral_currencies = coll... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currencies(self, currencies):\n\n self._currencies = currencies",
"def quote_currencies(self):\n pass",
"def ciphers(self, ciphers):\n\n self._ciphers = ciphers",
"def reset_currencies(self):\n self.currency_data = read_csv('base_currency_data.txt')\n for _ in range(2):... | [
"0.67481405",
"0.5265579",
"0.5176979",
"0.5093953",
"0.5061187",
"0.49187213",
"0.48065504",
"0.47883865",
"0.4766928",
"0.4766007",
"0.4744785",
"0.4650204",
"0.46441692",
"0.4619848",
"0.4619848",
"0.4619848",
"0.4619848",
"0.4618425",
"0.4618425",
"0.46050042",
"0.4600184... | 0.76613015 | 0 |
Sets the isda_agreement_version of this CreditSupportAnnex. | def isda_agreement_version(self, isda_agreement_version):
if self.local_vars_configuration.client_side_validation and isda_agreement_version is None: # noqa: E501
raise ValueError("Invalid value for `isda_agreement_version`, must not be `None`") # noqa: E501
if (self.local_vars_configurati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ata_version(self, ata_version: SmartSsdAtaVersion):\n\n self._ata_version = ata_version",
"def guideline_version(self, guideline_version):\n\n self._guideline_version = guideline_version",
"def sata_version(self, sata_version: SmartSsdSataVersion):\n\n self._sata_version = sata_version... | [
"0.5928529",
"0.52493036",
"0.509096",
"0.49936894",
"0.4745028",
"0.46790195",
"0.4664767",
"0.46101287",
"0.4549267",
"0.4519262",
"0.44122893",
"0.43925443",
"0.43877813",
"0.43829527",
"0.43829527",
"0.43659112",
"0.4359275",
"0.43583745",
"0.43583745",
"0.43583745",
"0.4... | 0.83479697 | 0 |
Sets the margin_call_frequency of this CreditSupportAnnex. | def margin_call_frequency(self, margin_call_frequency):
if self.local_vars_configuration.client_side_validation and margin_call_frequency is None: # noqa: E501
raise ValueError("Invalid value for `margin_call_frequency`, must not be `None`") # noqa: E501
if (self.local_vars_configuration.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_margin(self, margin):\n _pal.lib.geometry_set_margin(self._geometry, c.c_float(margin))",
"def exposureMargin(self, exposureMargin):\n\n self._exposureMargin = exposureMargin",
"def change_margin(self, margin):\n self.margin = margin * self._MM_IN_MICRONS\n\n self._create_dr... | [
"0.5699754",
"0.56821644",
"0.53351855",
"0.53324115",
"0.5319535",
"0.5294425",
"0.52547044",
"0.5080364",
"0.50522316",
"0.5033701",
"0.5031883",
"0.49959642",
"0.498956",
"0.49374285",
"0.4922234",
"0.48966405",
"0.4871515",
"0.481583",
"0.4808186",
"0.47932616",
"0.477174... | 0.7814718 | 0 |
Sets the valuation_agent of this CreditSupportAnnex. | def valuation_agent(self, valuation_agent):
if self.local_vars_configuration.client_side_validation and valuation_agent is None: # noqa: E501
raise ValueError("Invalid value for `valuation_agent`, must not be `None`") # noqa: E501
if (self.local_vars_configuration.client_side_validation an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def agent_requirement(self, agent_requirement):\n\n self._agent_requirement = agent_requirement",
"def setAgility(self, agility):\n self.ag = agility",
"def valuation_date_times(self, valuation_date_times):\n\n self._valuation_date_times = valuation_date_times",
"def set_etacalc(self, et... | [
"0.5399857",
"0.5215203",
"0.5160706",
"0.51547",
"0.48660296",
"0.47691083",
"0.4741191",
"0.47110885",
"0.46982107",
"0.46744177",
"0.4664191",
"0.46602476",
"0.4644078",
"0.4594802",
"0.44882673",
"0.44703478",
"0.44610634",
"0.44596305",
"0.44565627",
"0.4448571",
"0.4439... | 0.7366433 | 0 |
Sets the threshold_amount of this CreditSupportAnnex. | def threshold_amount(self, threshold_amount):
if self.local_vars_configuration.client_side_validation and threshold_amount is None: # noqa: E501
raise ValueError("Invalid value for `threshold_amount`, must not be `None`") # noqa: E501
self._threshold_amount = threshold_amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_threshold(self, threshold):\n self._threshold = check_value_positive('threshold', threshold)",
"def setThreshold(self, threshold): # real signature unknown; restored from __doc__\n pass",
"def setThreshold(self, value):\n return self._set(threshold=value)",
"def setThreshold(self... | [
"0.76420635",
"0.7484654",
"0.7002138",
"0.69110656",
"0.69110656",
"0.69110656",
"0.69110656",
"0.69110656",
"0.6605099",
"0.62813085",
"0.6248368",
"0.6243392",
"0.6088954",
"0.59891135",
"0.59891135",
"0.57627714",
"0.5746402",
"0.5746402",
"0.5746402",
"0.5658464",
"0.565... | 0.7795437 | 0 |
Sets the rounding_decimal_places of this CreditSupportAnnex. | def rounding_decimal_places(self, rounding_decimal_places):
if self.local_vars_configuration.client_side_validation and rounding_decimal_places is None: # noqa: E501
raise ValueError("Invalid value for `rounding_decimal_places`, must not be `None`") # noqa: E501
self._rounding_decimal_pla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rounding_decimal(self, rounding_decimal):\n\n self._rounding_decimal = rounding_decimal",
"def rounding_decimal(self, rounding_decimal):\n\n self._rounding_decimal = rounding_decimal",
"def set_decimal_precision(self, decimal_precision):\n assert (decimal_precision >= 0.0) and (decimal... | [
"0.70312047",
"0.70312047",
"0.6526627",
"0.6234227",
"0.5845742",
"0.58131725",
"0.57996356",
"0.56278586",
"0.5584064",
"0.55155945",
"0.5437357",
"0.5435349",
"0.5397775",
"0.5376162",
"0.5353457",
"0.53360766",
"0.53161436",
"0.5277059",
"0.522207",
"0.52174044",
"0.51590... | 0.7307036 | 0 |
Sets the initial_margin_amount of this CreditSupportAnnex. | def initial_margin_amount(self, initial_margin_amount):
if self.local_vars_configuration.client_side_validation and initial_margin_amount is None: # noqa: E501
raise ValueError("Invalid value for `initial_margin_amount`, must not be `None`") # noqa: E501
self._initial_margin_amount = init... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_margin(self, margin):\n _pal.lib.geometry_set_margin(self._geometry, c.c_float(margin))",
"def set_margin(self, value):\n value = u.decimal(value)\n if u.isempty(value):\n self.sale_price = self.cost_price\n else:\n cp = self.cost_price or zero\n ... | [
"0.63743806",
"0.6039284",
"0.5959661",
"0.5892813",
"0.58600277",
"0.5603433",
"0.5558049",
"0.5511332",
"0.55063444",
"0.53762347",
"0.5342674",
"0.51481956",
"0.5045504",
"0.49929357",
"0.49733338",
"0.4962956",
"0.4943264",
"0.48602268",
"0.48602268",
"0.4854743",
"0.4840... | 0.81832016 | 0 |
Sets the minimum_transfer_amount of this CreditSupportAnnex. | def minimum_transfer_amount(self, minimum_transfer_amount):
if self.local_vars_configuration.client_side_validation and minimum_transfer_amount is None: # noqa: E501
raise ValueError("Invalid value for `minimum_transfer_amount`, must not be `None`") # noqa: E501
self._minimum_transfer_amo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_minimum(self, min_value):\n\n self._progress.setMinimum(min_value)",
"def buy_min_amount(self, buy_min_amount):\n\n self._buy_min_amount = buy_min_amount",
"def min_value(self, min_value):\n\n self._min_value = min_value",
"def min_value(self, min_value):\n\n self._min_val... | [
"0.69782037",
"0.6906807",
"0.6490221",
"0.6490221",
"0.6490221",
"0.640613",
"0.6306588",
"0.6306588",
"0.6292194",
"0.60590804",
"0.60590804",
"0.6001845",
"0.59859973",
"0.5823921",
"0.5805904",
"0.576669",
"0.55387044",
"0.5535776",
"0.5526052",
"0.54994684",
"0.5489253",... | 0.8311381 | 0 |
Plot the land uses of the resting points | def plotLandUse(layer, x):
# features of the layer
features = layer.getFeatures()
# Create empty list for landuses
list_lu = []
# Iterate over features and add to a list
for feature in features:
list_lu.append(feature['Landuse'])
list_lu.sort()
# bins of the landuse numbers
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_landmarks(image, landmarks):\n plt.imshow(image)\n plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r')\n plt.pause(0.001) # pause a bit so that plots are updated",
"def show_landmarks(image, landmarks):\n plt.imshow(image)\n plt.scatter(landmarks[:, 0], landmarks[:, 1]... | [
"0.65083843",
"0.65083843",
"0.65083843",
"0.63315463",
"0.63290757",
"0.615328",
"0.615054",
"0.60093755",
"0.5987699",
"0.59867996",
"0.5930163",
"0.58884436",
"0.5883454",
"0.587664",
"0.58760786",
"0.5844076",
"0.5840335",
"0.58364946",
"0.5829448",
"0.58185834",
"0.58177... | 0.6548161 | 0 |
Switches between two operations depending on a scalar value (int or bool). Note that both `then_expression` and `else_expression` should be symbolic tensors of the same shape. Arguments | def switch(condition, then_expression, else_expression):
x_shape = copy.copy(then_expression.get_shape())
x = tf.cond(tf.cast(condition, 'bool'),
lambda: then_expression,
lambda: else_expression)
x.set_shape(x_shape)
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ifelse(\n self,\n true_expr: ir.Value,\n false_expr: ir.Value,\n ) -> ir.Value:\n # Result will be the result of promotion of true/false exprs. These\n # might be conflicting types; same type resolution as case expressions\n # must be used.\n return ops.Where... | [
"0.63129026",
"0.60874236",
"0.608386",
"0.60220104",
"0.59478444",
"0.59066546",
"0.58980834",
"0.58406264",
"0.56265366",
"0.5610067",
"0.5571444",
"0.55693847",
"0.55487734",
"0.5547",
"0.5502982",
"0.54745007",
"0.5456266",
"0.5454656",
"0.5417349",
"0.5417349",
"0.541734... | 0.7355844 | 0 |
Returns a session that will use CPU's only | def make_session(num_cpu=None, make_default=False):
if num_cpu is None:
num_cpu = int(os.getenv('RCALL_NUM_CPU', multiprocessing.cpu_count()))
tf_config = tf.ConfigProto(
inter_op_parallelism_threads=num_cpu,
intra_op_parallelism_threads=num_cpu)
tf_config.gpu_options.allocator_type ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_threaded_session():\n return make_session(num_cpu=1)",
"def make_session(num_cpu, graph=None):\n tf_config = tf.compat.v1.ConfigProto(\n allow_soft_placement=True,\n inter_op_parallelism_threads=num_cpu,\n intra_op_parallelism_threads=num_cpu)\n\n # Prevent tensorflow fro... | [
"0.7916806",
"0.6607453",
"0.63830155",
"0.6224698",
"0.6224698",
"0.6165562",
"0.61295897",
"0.61049616",
"0.60454756",
"0.600789",
"0.6007467",
"0.5951829",
"0.5934167",
"0.59015",
"0.58531624",
"0.57040143",
"0.56954604",
"0.5674512",
"0.5665763",
"0.562259",
"0.56143194",... | 0.66379386 | 1 |
Returns a session which will only use a single CPU | def single_threaded_session():
return make_session(num_cpu=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_session(num_cpu=None, make_default=False):\n if num_cpu is None:\n num_cpu = int(os.getenv('RCALL_NUM_CPU', multiprocessing.cpu_count()))\n tf_config = tf.ConfigProto(\n inter_op_parallelism_threads=num_cpu,\n intra_op_parallelism_threads=num_cpu)\n tf_config.gpu_options.allo... | [
"0.6815164",
"0.67610806",
"0.652727",
"0.6317698",
"0.6214333",
"0.61678463",
"0.6132221",
"0.6112054",
"0.6099076",
"0.59487903",
"0.59289527",
"0.59029776",
"0.5881761",
"0.5881761",
"0.58647627",
"0.5776358",
"0.57622933",
"0.5718971",
"0.57157207",
"0.5713068",
"0.563818... | 0.843942 | 0 |
Linear interpolation between initial_p and final_p over schedule_timesteps. After this many timesteps pass final_p is returned. | def __init__(self, schedule_timesteps, final_p, initial_p=1.0):
self.schedule_timesteps = schedule_timesteps
self.final_p = final_p
self.initial_p = initial_p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolate(self, previous_goalpoint, next_goalpoint, t_prev, t_next):\n des_pos = previous_goalpoint + (next_goalpoint - previous_goalpoint) * (self.curr_delta_time- t_prev)/ (t_next - t_prev)\n\n # print 'current_delta_time: ', self.curr_delta_time\n # print \"interpolated pos:\", des_po... | [
"0.5953423",
"0.59146756",
"0.5886902",
"0.58812714",
"0.58812714",
"0.5858246",
"0.58575207",
"0.5845823",
"0.5793997",
"0.56578064",
"0.5634574",
"0.55303574",
"0.5486555",
"0.5473343",
"0.5472917",
"0.5465888",
"0.5437795",
"0.540126",
"0.54007995",
"0.53590375",
"0.534620... | 0.6360331 | 1 |
Test that syntax error are caught when reading a mapping. | def test_read_mapping_errors(content):
with pytest.raises(IOError):
vermouth.map_input._read_mapping_partial(content.split('\n'), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_parse_mapping_file_handles_errors(self):\r\n # Empty file\r\n self.assertRaises(QiimeParseError,\r\n parse_mapping_file,\r\n [])\r\n # string\r\n self.assertRaises(QiimeParseError,\r\n parse_mapping_file... | [
"0.7488966",
"0.71245766",
"0.71224445",
"0.7086689",
"0.685664",
"0.68011135",
"0.67126226",
"0.6616215",
"0.6579855",
"0.6512076",
"0.64878446",
"0.64554673",
"0.64214325",
"0.64154875",
"0.64133835",
"0.6383648",
"0.6362922",
"0.6348759",
"0.63308614",
"0.6324306",
"0.6319... | 0.7941152 | 0 |
Test that regular mapping files are read as expected. | def test_read_mapping_file(case):
reference = collections.defaultdict(lambda: collections.defaultdict(dict))
for from_ff, to_ff in itertools.product(case.from_ff, case.to_ff):
reference[from_ff][to_ff][case.name] = (
case.mapping, case.weights, case.extra
)
ffs = case_to_dummy_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_mapping_directory(ref_mapping_directory):\n dirpath, ref_mappings = ref_mapping_directory\n from_names = list(ref_mappings.keys())\n to_names = []\n block_names = []\n mapping = {}\n weights = {}\n\n\n for k in ref_mappings:\n to_names.extend(ref_mappings[k].keys())\n ... | [
"0.7734215",
"0.74426365",
"0.74284154",
"0.73957855",
"0.738895",
"0.7286489",
"0.7281214",
"0.7254501",
"0.7174775",
"0.7063158",
"0.7009144",
"0.69992447",
"0.695043",
"0.6936193",
"0.68889594",
"0.6878551",
"0.685513",
"0.6841759",
"0.6801524",
"0.6760218",
"0.67302",
"... | 0.74782133 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.