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 |
|---|---|---|---|---|---|---|
Normalize the name attribute and assign it the normalized_name attribute. | def __normalize_name(self):
self.normalized_name = normalizeSimplified(self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_name(self):\n name = self.ua_data.get('name', '')\n if not name:\n return\n self.ua_data['name'] = self.normalized_name.get(name.lower(), name)",
"def normalize_name(cls, name):\n\t\treturn ' '.join(name.lower().strip().split())",
"def normalize_name(cls, name):\n\... | [
"0.8145657",
"0.7358192",
"0.7358192",
"0.7358192",
"0.73001164",
"0.71639097",
"0.70434594",
"0.66868776",
"0.66818297",
"0.6645059",
"0.66193527",
"0.6603514",
"0.65407497",
"0.6513661",
"0.6509814",
"0.64971495",
"0.6418087",
"0.64082617",
"0.63728404",
"0.63634264",
"0.63... | 0.8653227 | 0 |
Use the normalized_name attribute and the Location.URL to attempt to find the instance's location. A location is only attached if the server responds with a single result. | def __find_location(self):
URL_RESOURCE = 'http://maps.googleapis.com/maps/api/geocode/json'
URL_QUERY_TEMPLATE = '?address={address}&sensor=true'
URL = URL_RESOURCE + URL_QUERY_TEMPLATE
url = URL.format(address=quote(self.normalized_name))
payload = json.load(urlopen(url))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location(self):\r\n response = self.connection.make_request('GET', self.name,\r\n query_args='location')\r\n body = response.read()\r\n if response.status == 200:\r\n rs = ResultSet(self)\r\n h = handler.XmlHandler(rs... | [
"0.66033566",
"0.65697044",
"0.65260303",
"0.6403216",
"0.63808894",
"0.63307935",
"0.63143545",
"0.630919",
"0.6299324",
"0.62974364",
"0.6274206",
"0.6228702",
"0.6209134",
"0.6205717",
"0.61871684",
"0.6174094",
"0.613726",
"0.61340636",
"0.6109455",
"0.6080561",
"0.603818... | 0.690633 | 0 |
Use the BaseTicketing object to assign a name_id. | def __assign_name_id(self):
if not self.name_id:
self.name_id = str(BaseTicketing.objects.create()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, id_, name):\n self._id = id_\n\n self._name = name\n self._name = self._name.title()",
"def name(self, name) :\n\t\ttry :\n\t\t\tself._name = name\n\t\texcept Exception as e:\n\t\t\traise e",
"def name(self, name):\n self._name = name",
"def name(self, name):\n ... | [
"0.6540638",
"0.6511959",
"0.63940686",
"0.63940686",
"0.63940686",
"0.63940686",
"0.63940686",
"0.63940686",
"0.63940686",
"0.63940686",
"0.63940686",
"0.63940686",
"0.63940686",
"0.63940686",
"0.6350768",
"0.6348479",
"0.6348479",
"0.6348479",
"0.6348479",
"0.63030946",
"0.... | 0.8805637 | 0 |
Filters through a Name object's related locations and returns the one marked as current. | def _get_current_location(self):
return self.get_queryset().filter(status=self.model.CURRENT).first() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_actor_searchable_current(self, object):\n if object.current_location is not None:\n locations = []\n\n locations.append('/api/v1/location/{0}/'.format(\n object.current_location.id\n ))\n if object.current_location.parent_location is not... | [
"0.57623345",
"0.57383907",
"0.56384647",
"0.5571303",
"0.53816736",
"0.5375538",
"0.53710043",
"0.53051746",
"0.5276648",
"0.51896995",
"0.5164687",
"0.51572245",
"0.5153213",
"0.5135154",
"0.5125489",
"0.50980383",
"0.50831646",
"0.5075788",
"0.50679815",
"0.50605947",
"0.5... | 0.62803453 | 0 |
True if the Location has a status of Current. | def is_current(self):
return self.CURRENT == self.status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_current_location(self):\n return self.location_set.current_location is not None",
"def is_current(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"is_current\")",
"def is_idle(self) -> bool:\n\n return self.send(self.cmd.GET_GLOBALSTATUS_RUNNING) is False",
"def... | [
"0.8096759",
"0.7212046",
"0.6812895",
"0.6794776",
"0.6783451",
"0.66914296",
"0.6656115",
"0.6570917",
"0.65598893",
"0.6543463",
"0.65225387",
"0.65137804",
"0.6495556",
"0.64789724",
"0.64671594",
"0.64653087",
"0.64653087",
"0.64653087",
"0.64653087",
"0.64653087",
"0.64... | 0.80706763 | 1 |
Test that calculating a winner returns None when no winner. | def test_calc_winner_none(self):
board = self.board_class()
board.place_token(1, 1, 'X')
board.place_token(0, 0, 'O')
board.place_token(1, 0, 'X')
board.place_token(0, 2, 'O')
assert board.calc_winner() is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_winner(self):\n pass",
"def winner(self):\n return (\"None\")",
"def check_winner(self):\n pass",
"def test_winner_won(self):\n board = self.board_class()\n board.place_token(1, 1, 'X')\n board.place_token(0, 0, 'O')\n board.place_token(1, 0, 'X')\n ... | [
"0.77822256",
"0.7507554",
"0.7346225",
"0.71233296",
"0.71143043",
"0.7085056",
"0.7017777",
"0.6977995",
"0.69325536",
"0.69158137",
"0.68952185",
"0.6894018",
"0.6894018",
"0.6894018",
"0.6860414",
"0.6853513",
"0.68408227",
"0.6833363",
"0.681267",
"0.6782709",
"0.6775989... | 0.8289965 | 0 |
Test that calculating a winner returns the winner. | def test_winner_won(self):
board = self.board_class()
board.place_token(1, 1, 'X')
board.place_token(0, 0, 'O')
board.place_token(1, 0, 'X')
board.place_token(0, 2, 'O')
board.place_token(1, 2, 'X')
assert board.calc_winner() == 'X' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_winner(self):\n pass",
"def print_result(winner):\r\n pass",
"def check_winner(self):\n pass",
"def test_get_winner():\n\n board = Board()\n board1 = Board()\n board2 = Board()\n\n # board is empty\n board.find_winner(0)\n assert board.get_winner() == board.EMPTY\n... | [
"0.8160061",
"0.73563534",
"0.73394275",
"0.731884",
"0.7310254",
"0.7298336",
"0.72755563",
"0.7162206",
"0.7162206",
"0.7162206",
"0.701149",
"0.69624203",
"0.6956647",
"0.6952133",
"0.6948896",
"0.68900687",
"0.68098",
"0.6799909",
"0.6785131",
"0.6785131",
"0.67524636",
... | 0.75398433 | 1 |
Key The key to search for Value A value to check equality for Path The path in the spec to search True if the spec doc has the key. If value is passed in, True only if key is present and equal to value | def specifies(self, key, value=None, path=None):
try:
if path != None and isDict(multiIndex(self.current_state, path)):
target = multiIndex(self.current_state, path)
logging.debug("Specification found: ")
logging.debug("Key : " + key)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has(self, key):",
"def matchedKey(self, value):\n if self._fullname.lower() == value.lower():\n #print(f'FullName attribute matched: {self._fullname} == {value}')\n return True\n if self._shortname.lower() == value.lower():\n #print(f'Shortname attribute matched... | [
"0.6193526",
"0.6128685",
"0.6101222",
"0.60580564",
"0.604977",
"0.60189897",
"0.59933096",
"0.59117144",
"0.5892385",
"0.5888902",
"0.58783543",
"0.58724695",
"0.5856248",
"0.58517903",
"0.5838812",
"0.5831589",
"0.5775578",
"0.5770002",
"0.57589763",
"0.5736674",
"0.572278... | 0.7713752 | 0 |
Train ocr for a number of steps. | def train():
with tf.Graph().as_default():
global_step = tf.contrib.framework.get_or_create_global_step()
# Get images and labels for ocr.
print("Preparing input")
# with tf.device('/cpu:0'):
images, labels, seq_lengths = ocr.distorted_inputs()
# Build a Graph that ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train(self, training_steps=10):",
"def train():\n pass",
"def train_step(self):\n pass",
"def train_start(self):\n self.module.img_enc.train()\n self.module.txt_enc.train()",
"def TrainOneStep(self):\n pass",
"def train():\n # YOUR TRAINING CODE GOES HERE",
"de... | [
"0.7502081",
"0.66739446",
"0.6537587",
"0.6469562",
"0.6459255",
"0.6291313",
"0.6290073",
"0.62595063",
"0.6236177",
"0.62269425",
"0.62269425",
"0.62269425",
"0.62269425",
"0.62269425",
"0.62154126",
"0.614658",
"0.61336267",
"0.60702175",
"0.6030181",
"0.60114205",
"0.599... | 0.6762774 | 1 |
Explain one or more input instances. | def explain_instance(self, *argv, **kwargs):
return (self.explainer.shap_values(*argv, **kwargs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def explain(self):",
"def help_show(self):\n print(\"print an instance based on the class name and id\")",
"def explain(self, idx):\r\n np.random.seed(1)\r\n exp = self.explainer.explain_instance(self.data[idx], self.model.predict, threshold=0.95)\r\n res = {'Prediction': self.model... | [
"0.66302717",
"0.62587583",
"0.6235769",
"0.6135094",
"0.6002681",
"0.5954503",
"0.59308183",
"0.59212154",
"0.5825364",
"0.58087426",
"0.57107633",
"0.56416094",
"0.56289464",
"0.559864",
"0.5593865",
"0.5587201",
"0.55682015",
"0.556368",
"0.55423486",
"0.55340177",
"0.5531... | 0.70587087 | 1 |
Explain one or more input instances. | def explain_instance(self, *argv, **kwargs):
return (self.explainer.shap_values(*argv, **kwargs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def explain(self):",
"def help_show(self):\n print(\"print an instance based on the class name and id\")",
"def explain(self, idx):\r\n np.random.seed(1)\r\n exp = self.explainer.explain_instance(self.data[idx], self.model.predict, threshold=0.95)\r\n res = {'Prediction': self.model... | [
"0.66317886",
"0.62615937",
"0.62352264",
"0.6136088",
"0.600346",
"0.5954949",
"0.5932891",
"0.59208715",
"0.58242834",
"0.58107203",
"0.57107747",
"0.56413364",
"0.5629232",
"0.55995196",
"0.5596403",
"0.5587828",
"0.556996",
"0.5564924",
"0.5542456",
"0.55353177",
"0.55318... | 0.7059274 | 0 |
Returns words sorted by cosine distance to a given vector, most similar first | def sorted_by_similarity(words: List[Word], base_vector: Vector) -> List[Tuple[float, Word]]:
words_with_distance = [(cosine_similarity(base_vector, w.vector), w) for w in words]
# We want cosine similarity to be as large as possible (close to 1)
return sorted(words_with_distance, key=lambda t: t[0], revers... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topn_similarity(word_vecs, word, n):\n vec = word_vecs[word]\n sim = dict()\n for w in word_vecs:\n if w != '<TOP>' and w != '<BOT>':\n # sim[w] = np.dot(vec, np.transpose(word_vecs[w]))\n sim[w] = 1 - spatial.distance.cosine(vec, word_vecs[w])\n # sim[w] = np.... | [
"0.70045835",
"0.6886095",
"0.686393",
"0.68389386",
"0.67793965",
"0.6617508",
"0.6600106",
"0.65235937",
"0.64998406",
"0.6477512",
"0.64679414",
"0.6408758",
"0.6370389",
"0.63559616",
"0.6333625",
"0.63126165",
"0.63048506",
"0.6292699",
"0.6278257",
"0.6256954",
"0.62567... | 0.7695986 | 0 |
object containing photometric point information based on flux and effective wavelength. | def get_photopoint(flux=None,var=None,
datacounts=None, bkgdcounts=None, exptime=None,
lbda=None, zp=None,bandname=None,mjd=None,
source=None, instrument_name=None,**kwargs):
# -------------
# - Parser
if "wavelength" in kwargs.keys() and lbda is None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, flux, var=None,\n lbda=None, mjd=None,\n bandname=None, zp=None,**kwargs):\n super(PhotoPoint,self).__init__(flux=flux, var=var,\n lbda=lbda, mjd=mjd,\n bandname=bandname,... | [
"0.634727",
"0.61913866",
"0.61638576",
"0.608426",
"0.5962199",
"0.5938567",
"0.58590335",
"0.58335805",
"0.57805663",
"0.57041234",
"0.57041234",
"0.56867296",
"0.5605221",
"0.55883217",
"0.5583919",
"0.55767006",
"0.55739844",
"0.5571898",
"0.55622154",
"0.55486596",
"0.55... | 0.6238992 | 1 |
This fuctions enable to convert a dictionnary into a list of photopoints. This uses 'photopoint' to load the list. | def dictsource_2_photopoints(dictsource,**kwargs):
if type(dictsource) is not dict:
raise TypeError("'dictsource' must be a dictionnary")
# - Does is have the requiered basic information:
for musthave in ["fluxes","variances","lbda"]:
if musthave not in dictsource.keys():
ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _aperture_to_photopoint_(self, *args, **kwargs):\n\n if not self.has_sky():\n return super(GALEX,self)._aperture_to_photopoint_( *args, **kwargs )\n\n datacps, bkgdcps = args\n datacounts = datacps[0]*self.exposuretime\n bkgdcounts = bkgdcps[0]*self.exposuretime\n ... | [
"0.6540127",
"0.5635883",
"0.5635148",
"0.5584595",
"0.54569",
"0.54485756",
"0.53915405",
"0.53860205",
"0.53614736",
"0.53427374",
"0.53390104",
"0.527858",
"0.5233937",
"0.5212977",
"0.51437676",
"0.51348144",
"0.511379",
"0.5039093",
"0.50031817",
"0.49981216",
"0.4987921... | 0.7358234 | 0 |
Change the slicing of the data. This will update the background, variance and the wcs solution's offset. If you had an sepobjects loaded, this will update it. | def reload_data(self, dataslice0, dataslice1,
variance=None,background=None,mask=None):
rawdata = self.fits[self._build_properties["data_index"]].data[
dataslice0[0]:dataslice0[1],
dataslice1[0]:dataslice1[1]]
# -- no more sepobject attached
reload_sep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_wcs(self,wcs,force_it=False):\n super(Image, self).set_wcs(wcs, force_it=force_it)\n if self.has_wcs():\n self.wcs.set_offset(*self._dataslicing)",
"def on_data_vars_change(self, change):\n if change['type'] == 'change' and change['name'] == 'value':\n self.left... | [
"0.57423234",
"0.5504184",
"0.5474871",
"0.5428495",
"0.53296715",
"0.52879375",
"0.52706957",
"0.52475893",
"0.52428573",
"0.5237092",
"0.52147996",
"0.51758945",
"0.51646745",
"0.51397026",
"0.5133604",
"0.5090996",
"0.5081896",
"0.50785667",
"0.5062701",
"0.50607663",
"0.5... | 0.6156409 | 0 |
Change (or create) an object associated to the given image. This function will test if the object (the target) is withing the image boundaries (expect if 'test_inclusion' is set to False). Set 'newtarget' to None to remove the association between this object and a target. Return Void | def set_target(self, newtarget, test_inclusion=True):
if newtarget is None:
self._side_properties['target'] = None
return
# -- Input Test -- #
if newtarget.__nature__ != "AstroTarget":
raise TypeError("'newtarget' should be (or inherite) an AstroTarge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def builder_should_create_target_image(self, builder, target, image_id, template, parameters):",
"def test_replace_image(self):\n pass",
"def modify_image(self, example, target_label):\n raise NotImplementedError()",
"def builder_will_create_target_image(self, builder, target, image_id, template, p... | [
"0.56863374",
"0.5611876",
"0.5590109",
"0.55107003",
"0.55029154",
"0.54563946",
"0.5443029",
"0.5404575",
"0.5388274",
"0.53361917",
"0.5252749",
"0.52338034",
"0.5183609",
"0.5175078",
"0.51551765",
"0.5153159",
"0.51311135",
"0.51307184",
"0.5113589",
"0.5103109",
"0.5059... | 0.66789705 | 0 |
Attach a wcs solution to the current object | def set_wcs(self,wcs,force_it=False):
super(Image, self).set_wcs(wcs, force_it=force_it)
if self.has_wcs():
self.wcs.set_offset(*self._dataslicing) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_wcs(self, wcs, force_it=False):\n if self.has_wcs() and not force_it:\n raise AttributeError(\"A wcs solution is already loaded.\"\\\n \" Set force_it to True if you really known what you are doing\")\n from .astrometry import get_wcs\n self._side_properti... | [
"0.61309594",
"0.551333",
"0.54075474",
"0.5401703",
"0.53757185",
"0.53647757",
"0.5353762",
"0.52740794",
"0.5186292",
"0.5085032",
"0.50390124",
"0.5012216",
"0.49862352",
"0.4947205",
"0.49034286",
"0.4898908",
"0.4894244",
"0.48769772",
"0.48308295",
"0.4824484",
"0.4817... | 0.5562392 | 1 |
attach a catalogue to the current instance. you can then access it through 'self.catalogue'. The current instance's wcs solution is passed to the calague. If the current instance has an sepobjects, sepobjects gains the catalogue and a matching is run. | def set_catalogue(self, catalogue, force_it=False,
match_angsep=3, **kwargs):
super(Image, self).set_catalogue(catalogue, force_it=force_it, **kwargs)
# -- Lets save the pixel values
if self.has_catalogue() and self.has_sepobjects():
self.sepobjects.set_catalog... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_catalogue(self, catalogue, force_it=False,\n fast_setup=False):\n from .catalogue.basecatalogue import Catalogue\n\n if not fast_setup:\n if self.has_catalogue() and force_it is False:\n raise AttributeError(\"'catalogue' already defined\"+\\\n ... | [
"0.581488",
"0.5733194",
"0.5454103",
"0.5419532",
"0.51098615",
"0.4982203",
"0.49729517",
"0.49491403",
"0.4943627",
"0.49172583",
"0.48951182",
"0.48951182",
"0.48767966",
"0.48767966",
"0.48767966",
"0.4867812",
"0.4831434",
"0.48207822",
"0.48148945",
"0.47911206",
"0.47... | 0.61963177 | 0 |
value is the value of the fwhm. If no units is provided (astropy units) arcsec will be assumed. | def set_fwhm(self, value, force_it=True):
if self.has_fwhm() and not force_it:
raise AttributeError("'fwhm' is already defined."+\
" Set force_it to True if you really known what you are doing")
if value<0:
raise ValueError("the 'fwhm' must be positive")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_value(self, mpos):\n if mpos[0] > 60 and mpos[0] < 180 and mpos[1] > 180 and mpos [1] < 360:\n if mpos[1] < 225 and mpos[1] > 180:\n self.value = 3390 #3.39k ohm\n elif mpos[1] < 270 and mpos[1] >225:\n self.value = 16900 #16.9 k ohm\n ... | [
"0.6315121",
"0.59481734",
"0.5617003",
"0.5462507",
"0.5406977",
"0.53761315",
"0.53761315",
"0.53761315",
"0.5346658",
"0.534661",
"0.5339562",
"0.5324273",
"0.525256",
"0.5252013",
"0.5226371",
"0.5209949",
"0.5188332",
"0.51337194",
"0.5124048",
"0.5116123",
"0.50982785",... | 0.6490183 | 0 |
Mask array for ellipse annulus (based on sep) (True for pixels inside the elliptical annulus) Prameters | def get_ellipann_mask(self, x, y, a, b, theta, rin, rout):
from sep import mask_ellipse
ellipsemask_o = np.asarray(np.zeros((self.height,self.width)),dtype="bool")
ellipsemask_i = np.asarray(np.zeros((self.height,self.width)),dtype="bool")
mask_ellipse( ellipsemask_o, x, y, a, b, the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derive_sepmask(self, r):\n if not self.has_sepobjects():\n raise AttributeError(\"No sepobjects loaded. Run sep_extract\")\n return self.sepobjects.get_ellipse_mask(self.width,self.height,r=r)",
"def get_ellipse_mask(ellipse, img_shape, offset=0):\n # create image\n mask = np.z... | [
"0.69542736",
"0.64579767",
"0.61343414",
"0.6082683",
"0.6012492",
"0.5912738",
"0.5851889",
"0.58195686",
"0.58171093",
"0.5813707",
"0.5765561",
"0.5753373",
"0.57273597",
"0.5697622",
"0.5675059",
"0.5658515",
"0.5657383",
"0.56530666",
"0.5644299",
"0.5642122",
"0.560589... | 0.6558745 | 1 |
If a target is loaded, this will get the target coords and run 'get_aperture'. | def get_target_aperture(self,radius,runits="pixels",aptype="circle",subpix=5,
**kwargs):
if self.target is None:
raise AttributeError("No 'target' loaded")
xpix, ypix = self.coords_to_pixel(self.target.ra,self.target.dec)
return self.get_aperture(xpix,ypix... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __load_target_cloud(self):\n try:\n self.target_cloud = QFileDialog.getOpenFileName(self,\n 'Open file',\n os.getcwd(),\n ... | [
"0.6261796",
"0.56263095",
"0.55502737",
"0.547204",
"0.5440683",
"0.53731084",
"0.5304241",
"0.5254251",
"0.5189904",
"0.5182811",
"0.5182811",
"0.51212734",
"0.5102787",
"0.5101959",
"0.5092901",
"0.50891316",
"0.5084111",
"0.5083835",
"0.50134206",
"0.49871346",
"0.4985528... | 0.60138226 | 1 |
if a target is loaded, and sep_extract has successfully ran, this returns the idx of the nearest galaxy. (This is build upon the sepobject's get_host_idx() method. It first searches galaxies in a given radius and then returns the index of the one minimizing the elliptical radius (not necesseraly the nearest in angular ... | def get_host_idx(self, scaleup=2.5,
radius=30, runits="kpc",
max_galdist=2., catid=None):
if not self.has_target():
raise AttributeError("No 'target' loaded")
if not self.has_sepobjects():
raise AttributeError("No 'sep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_target_location(self, alphas, epsilons, data_collected):\n if len(alphas) == 1:\n \tfor i in range(0, self.number_sampling_points-1):\n \t\talphas.append(alphas[0])\n \t\tepsilons.append(epsilons[0])\n\n # if self.target_location == None:\n # # dBm_list =... | [
"0.5754422",
"0.5737063",
"0.560703",
"0.5561404",
"0.55223",
"0.5452619",
"0.5395697",
"0.53734416",
"0.5362938",
"0.53479797",
"0.527915",
"0.52094454",
"0.5203363",
"0.52010113",
"0.51502305",
"0.5138846",
"0.51375896",
"0.51306355",
"0.5129794",
"0.51267135",
"0.51160043"... | 0.5798096 | 0 |
if a target is loaded, this get the aperture of the nearest galaxy. This is build upon the sepobject's get_host_idx() method. It first searches galaxies in a given radius and then returns the index of the one minimizing the elliptical radius (not necesseraly the nearest in angular distance). The aperture photometry fol... | def get_host_aperture(self, scaleup=2.5,
radius=30, runits="kpc",
max_galdist=2., catid=None, **kwargs):
idx = self.get_host_idx(scaleup=scaleup, radius=radius, runits=runits,
max_galdist=max_galdist, catid=catid)
if idx... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_target_location(self, alphas, epsilons, data_collected):\n if len(alphas) == 1:\n \tfor i in range(0, self.number_sampling_points-1):\n \t\talphas.append(alphas[0])\n \t\tepsilons.append(epsilons[0])\n\n # if self.target_location == None:\n # # dBm_list =... | [
"0.55026555",
"0.5372028",
"0.5298633",
"0.52484405",
"0.51560694",
"0.5105907",
"0.5095346",
"0.49827695",
"0.49731913",
"0.49002412",
"0.48869523",
"0.4839351",
"0.4828953",
"0.48124662",
"0.47743163",
"0.4773598",
"0.47689575",
"0.47648567",
"0.47607487",
"0.47604692",
"0.... | 0.61864215 | 0 |
Measure the aperture photometry on the "noise" part of the image. The "noise" is defined as area remaining after maskingout of the SEP detected object with a scaling up of "scaleup". | def _get_noise_aperture_prop_(self, ncall=1000,
sourcemask=None, edge=10,
rangex=None, rangey=None, scaleup=4):
if sourcemask is None:
sourcemask = self.derive_sepmask( r=scaleup )
# - Range parsing
if range... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def noiseReduction(self):\n pass",
"def get_estimated_noise(self):\n raise NotImplementedError('Abstract Method.')",
"def EST_NOISE(images):\n num = images.shape[0]\n m_e_bar = sum(images)/num\n m_sigma = np.sqrt(sum((images - m_e_bar)**2)/(num - 1))\n \n return m_s... | [
"0.61432505",
"0.6014798",
"0.5991047",
"0.5880211",
"0.58782595",
"0.58729124",
"0.57440394",
"0.5740159",
"0.57376933",
"0.5699135",
"0.5681166",
"0.5678946",
"0.566299",
"0.5651872",
"0.5605458",
"0.55796254",
"0.55776215",
"0.5568432",
"0.5564477",
"0.5560885",
"0.5556807... | 0.6272753 | 0 |
give the index [list of] of an sep's object(s) and extract the aperture at this location. | def get_idx_aperture(self, idx, scaleup=2.5, **kwargs):
if not self.has_sepobjects():
raise AttributeError("sepobjects has not been set. Run sep_extract()")
x, y, a, b, theta = self.sepobjects.get(["x","y","a","b","theta"], mask=np.atleast_1d(idx)).T
return self.get_aper... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pull_anno(self, index):\n img_path = list(self.annotation.keys())[index]\n return img_path[img_path.rfind(\"/\") + 1 : img_path.rfind(\".\")], self.annotation[img_path]",
"def sep_extract(self,thresh=None,returnobjects=False,\n set_catalogue=True,match_catalogue=True,\n ... | [
"0.57181156",
"0.552784",
"0.5373039",
"0.5330206",
"0.5264377",
"0.5253909",
"0.5239055",
"0.5207299",
"0.5181885",
"0.51727766",
"0.5143336",
"0.5125023",
"0.5063754",
"0.50630903",
"0.50341576",
"0.5030332",
"0.49911964",
"0.4971609",
"0.49654073",
"0.49566966",
"0.4950117... | 0.6707035 | 0 |
units should be a parsable string or a astropy units. Uses the wcs method units_to_pixels() In addition, you have access to the 'psf [==fwhm]' unit | def units_to_pixels(self,units_):
if type(units_) == str and units_.lower() in ["fwhm","psf"]:
units_ = self.fwhm
return super(Image, self).units_to_pixels(units_, target=self.target) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def units_to_pixels(self,units_, target=None):\n if self.has_wcs() is False:\n raise AttributeError(\"no wcs solution loaded.\")\n \n return self.wcs.units_to_pixels(units_,target=target)",
"def get_units(cls, wkt):\n if HAS_GDAL:\n return SpatialReference(wk... | [
"0.7378042",
"0.63031936",
"0.62479496",
"0.6196111",
"0.6157692",
"0.6100161",
"0.60264546",
"0.6001477",
"0.59790766",
"0.5973762",
"0.59229565",
"0.5902058",
"0.589764",
"0.58689487",
"0.5818935",
"0.5764421",
"0.5751814",
"0.57432693",
"0.5730734",
"0.5701479",
"0.5697544... | 0.8156565 | 0 |
this will be used as a default threshold for sep_extract | def _get_sep_extract_threshold_(self):
#print "_get_sep_extract_threshold_ called"
if not hasattr(self,"_sepbackground"):
_ = self.get_sep_background(update_background=False)
return self._sepbackground.globalrms*1.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_sep_threshold_(self, thresh):\n if thresh is None:\n return self._get_sep_extract_threshold_() if self.var is None\\\n else np.nanmean(np.sqrt(self.var[~np.isinf(self.var)]))*1.5\n return thresh",
"def analyze(self, word_count_thresh):",
"def global_threshold(img,... | [
"0.7234938",
"0.58125687",
"0.5747358",
"0.57313794",
"0.55520356",
"0.5477272",
"0.5439941",
"0.5366512",
"0.53333324",
"0.5220387",
"0.51915985",
"0.51518834",
"0.51047575",
"0.5103636",
"0.50660557",
"0.50320125",
"0.5028472",
"0.5024921",
"0.50220484",
"0.50064534",
"0.49... | 0.726912 | 0 |
Pixel size in arcsec. Based on wcs solution | def pixel_size_arcsec(self):
from astropy import units
if type(self.pixel_size_deg) is not units.quantity.Quantity:
return [ps.to("arcsec") for ps in self.pixel_size_deg]
return self.pixel_size_deg.to("arcsec") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pixelsize(self):\n if hasattr(self, \"_pixelsize\"):\n return self._pixelsize\n\n try:\n return self.header[\"PixSize\"] # [arcsec]\n except KeyError:\n try:\n return abs(self.header[\"CDELT1\"]) * 3600 # [deg] -> [arcsec]\n exce... | [
"0.7054183",
"0.6840398",
"0.6840398",
"0.6840398",
"0.67983085",
"0.6761867",
"0.66037667",
"0.64562416",
"0.6417801",
"0.6409793",
"0.6397776",
"0.6395125",
"0.63156056",
"0.62913805",
"0.6244087",
"0.6222757",
"0.6170272",
"0.6161922",
"0.61465776",
"0.61327183",
"0.612984... | 0.7482742 | 0 |
area where SEP detected an object scaled up by `r`. See derive_sepmask | def derive_sepmask(self, r):
if not self.has_sepobjects():
raise AttributeError("No sepobjects loaded. Run sep_extract")
return self.sepobjects.get_ellipse_mask(self.width,self.height,r=r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area(r):\n return np.pi * (r ** 2)",
"def approx_shoulders(upper_body_roi):\n height = upper_body_roi.shape[0]; width = upper_body_roi.shape[1]\n return (int(width / 6), int((height / 4) * 3)), (int((width / 6) * 5), int((height / 4) * 3))",
"def circle_area(r):\n if r < 0:\n raise Value... | [
"0.6378482",
"0.58068347",
"0.57037187",
"0.57016915",
"0.5698898",
"0.5672637",
"0.5650747",
"0.5622364",
"0.5605082",
"0.5580094",
"0.55578405",
"0.5492871",
"0.5492871",
"0.54822767",
"0.5468314",
"0.54553276",
"0.54551125",
"0.54412127",
"0.54355377",
"0.54291964",
"0.541... | 0.6437265 | 0 |
full width half maximum in arcsec. If you did not set it manually, this will use sepobjects' get_fwhm_pxl() method to set it. | def fwhm(self):
if not self.has_fwhm():
if self.has_sepobjects():
fwhm_pxl = self.sepobjects.get_fwhm_pxl(isolated_only=True,
stars_only=True)
self.set_fwhm(fwhm_pxl/self.units_to_pixels("arcsec").value*\
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fwhm(self) -> float:\n return 2 * np.sqrt(2 * np.log(2)) * self.width",
"def onSetToHalfSize(self, evt):\n\t\tself.halfResampleZ.Enable(1)\n\t\tif self.dataUnits:\n\t\t\tx, y, z = self.dataUnits[0].dataSource.getOriginalDimensions()\n\t\t\tzf = 1\n\t\t\t\n\t\t\tif self.halfResampleZ.GetValue():\n\t\t\... | [
"0.6268734",
"0.5886417",
"0.5678247",
"0.5618902",
"0.5612229",
"0.5571225",
"0.5571225",
"0.5541341",
"0.5468493",
"0.54473406",
"0.5410404",
"0.53796226",
"0.5378622",
"0.53672487",
"0.5336223",
"0.53070104",
"0.53052604",
"0.5301816",
"0.52980316",
"0.5296364",
"0.5289482... | 0.68449265 | 0 |
Initialize the Samplers. Remark that all flux, fluxerr and lbda are requested to draw the samplers | def __init__(self, fluxsamples, lbda=None, empty=False, negative_fluxmag=None):
self.__build__()
if empty:
return
self.set_samplers(fluxsamples)
if lbda is not None:
self.set_lbda(lbda, negative_fluxmag=negative_fluxmag) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_samplers(self):\n for sampler in self.gltf.samplers:\n # Use a sane default sampler if the sampler data is empty\n # Samplers can simply just be json data: \"{}\"\n if sampler.minFilter is sampler.magFilter is None:\n self.samplers.append(\n ... | [
"0.72320765",
"0.6541044",
"0.65216345",
"0.6249392",
"0.6141176",
"0.60598165",
"0.6045578",
"0.59606373",
"0.5945856",
"0.5941458",
"0.5934796",
"0.590171",
"0.585322",
"0.5834441",
"0.5730423",
"0.57284707",
"0.56967485",
"0.5693186",
"0.5692392",
"0.5686067",
"0.5684817",... | 0.66458225 | 1 |
AB magnitude samples derived from the input fluxes (samplers) | def _magsamples(self):
if self._derived_properties["magsamples"] is None:
if self.lbda is None:
raise AttributeError("lbda not set.")
self.derive_magsamples()
return self._derived_properties["magsamples"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derive_magsamples(self, negative_fluxmag=None):\n mags = flux_to_mag(self.samplers, None, wavelength=self.lbda)[0]\n self._side_properties[\"negative_fluxmag\"] = negative_fluxmag\n \n if negative_fluxmag is None:\n mags = mags[mags==mags]\n else:\n mags... | [
"0.6882988",
"0.6606504",
"0.6602036",
"0.65952456",
"0.65620184",
"0.6508889",
"0.6474389",
"0.62482834",
"0.61934686",
"0.6128165",
"0.610978",
"0.6068776",
"0.6049895",
"0.6042773",
"0.6008975",
"0.59401774",
"0.59197485",
"0.5904278",
"0.58786327",
"0.5874978",
"0.5872423... | 0.68935245 | 0 |
correct the flux and variance for the given extinction. if embv is negative, this will remove flux (i.e. simulate dust absorption). use a positive ebmv to correct for dust extinction. The resulting flux will be higher. | def apply_extinction(self, ebmv, r_v=3.1, law="fitzpatrick99"):
# - Do you have extinction installed
try:
import extinction
except ImportError:
raise ImportError("install the python library 'extinction', pip install extinction. See http://extinction.readthedocs.io")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trans_elv_elvebv(self):\n if self.type != 'elv':\n warnings.warn(\"attempt to normalize a non-elv curve with ebv\",\n UserWarning)\n else:\n # determine the index for the B band\n dwaves = np.absolute(self.waves['BAND'] - 0.438)\n ... | [
"0.60749763",
"0.5912936",
"0.56383824",
"0.5523697",
"0.55061877",
"0.54998016",
"0.5457647",
"0.5412334",
"0.53357196",
"0.52572685",
"0.5228767",
"0.5227609",
"0.5219037",
"0.5195473",
"0.5181734",
"0.5125447",
"0.50917965",
"0.50647664",
"0.5063385",
"0.5035485",
"0.50341... | 0.62412286 | 0 |
reset the derived and recorded properties | def _reset_derived_prop_(self):
self._derived_properties["photosamplers"] = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\r\n instdict = self.__dict__\r\n classdict = self.__class__.__dict__\r\n # To reset them, we simply remove them from the instance dict. At that\r\n # point, it's as if they had never been computed. On the next access,\r\n # the accessor function from the parent... | [
"0.74625975",
"0.7280035",
"0.7250987",
"0.7018255",
"0.6940064",
"0.69223744",
"0.6904301",
"0.69020516",
"0.6883174",
"0.6859904",
"0.6826046",
"0.6826046",
"0.6826046",
"0.6772673",
"0.6756142",
"0.67517024",
"0.6692494",
"0.6691773",
"0.6691096",
"0.6676703",
"0.6654328",... | 0.7688974 | 0 |
Define the flux of the photopoint. This defines the rest of the object | def set_flux(self, flux, var):
self._properties["flux"] = np.float(flux)
self._properties["var"] = np.float(var) if var is not None else np.NaN
self._reset_derived_prop_() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, flux, var=None,\n lbda=None, mjd=None,\n bandname=None, zp=None,**kwargs):\n super(PhotoPoint,self).__init__(flux=flux, var=var,\n lbda=lbda, mjd=mjd,\n bandname=bandname,... | [
"0.6936246",
"0.6579925",
"0.6535005",
"0.6414696",
"0.6378689",
"0.6294907",
"0.6285802",
"0.6275854",
"0.6201942",
"0.61425984",
"0.6036315",
"0.6023839",
"0.601368",
"0.5998262",
"0.5948799",
"0.5932451",
"0.59245086",
"0.58417714",
"0.5837007",
"0.5792206",
"0.5749765",
... | 0.6811316 | 1 |
Change the name of the bandname. | def set_bandname(self,value):
if value is not None:
if type(value) != str and type(value) != np.string_:
raise TypeError("The bandname must be a string", type(value))
self._properties["bandname"] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bandname(self):\n if self._properties['bandname'] is None:\n self._properties['bandname'] = \"fuv\" if \"-fd-\" in self.filename else \"nuv\" if \"-nd-\" in self.filename \\\n else \"unknown\"\n return self._properties['bandname']",
"def new_name(self,new_name):\n ... | [
"0.7241578",
"0.69039625",
"0.6895791",
"0.6833014",
"0.6807056",
"0.6751194",
"0.6734371",
"0.6734371",
"0.6689476",
"0.6630472",
"0.66169816",
"0.6559574",
"0.65430295",
"0.65027386",
"0.6474839",
"0.6459341",
"0.6459341",
"0.64104074",
"0.64104074",
"0.64104074",
"0.641040... | 0.8280091 | 0 |
Shift of the magnitude given the target distance (requires target set.) => return `self.mag 5( np.log10(self.target.distmpc1.e6) 1)` | def magabs(self):
if not self.has_target():
raise AttributeError("No target defined, I can't get the distance")
return self.mag - 5*( np.log10(self.target.distmpc*1.e6) - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_new_magnitude(mag_current, distance_current, distance_new):\n\n # Calculate the apparent magnitude of a star given another reference star\n mag_new = mag_current + 5.0 * (np.log10(distance_new/10.0) - np.log10(distance_current/10.0))\n\n return mag_new",
"def set_mag(self, target_mag):\n ... | [
"0.6505577",
"0.63445723",
"0.6167879",
"0.6093513",
"0.60368496",
"0.5991048",
"0.58356136",
"0.5826607",
"0.57901007",
"0.57198817",
"0.5693409",
"0.5691705",
"0.56370646",
"0.5611172",
"0.5606084",
"0.5569929",
"0.5567981",
"0.556793",
"0.555797",
"0.5524733",
"0.5502636",... | 0.7290378 | 0 |
Set the photosamplers object defining the number of samples available. | def draw_photosamplers(self, nsamplers=5000, negative_fluxmag=None):
self._derived_properties["photosamplers"] = \
PhotoSamplers( np.random.normal(loc=self.flux, scale=np.sqrt(self.var), size=nsamplers),
lbda = self.lbda, negative_fluxmag=negative_fluxmag) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_samplers(self, samplers):\n self._derived_properties[\"samplers\"] = samplers\n self.nsamplers = len(self.samplers)",
"def draw_photosamplers(self, nsamplers=5000):\n raise NotImplementedError(\"You need to define the `draw_photosamplers` method (inherating BasePhotoPoint)\")",
"de... | [
"0.72745544",
"0.6977924",
"0.6955875",
"0.6796204",
"0.67159444",
"0.62039137",
"0.59907633",
"0.59367037",
"0.5820958",
"0.5808072",
"0.57357967",
"0.5701543",
"0.569319",
"0.5640133",
"0.5602408",
"0.5529184",
"0.55075705",
"0.5481457",
"0.5481094",
"0.5460175",
"0.544364"... | 0.7045827 | 1 |
this flux quantity will be removed from the current flux | def remove_flux(self, flux, var=None):
self.set_flux(self._properties["flux"] - flux,
self._properties["var"] - var if var is not None else\
self.var) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self):",
"def removeFluxObjective(self, *args):\n return _libsbml.Objective_removeFluxObjective(self, *args)",
"def delX(self):\n del self.components[0]",
"def delX(self):\n del self.components[0]",
"def remove_item(self,itm):\n inv = self.get_inventory()\n s =... | [
"0.6380897",
"0.62161815",
"0.61986107",
"0.61986107",
"0.619643",
"0.6145327",
"0.6142867",
"0.61379826",
"0.61000395",
"0.60955024",
"0.6089606",
"0.6061867",
"0.6047143",
"0.6047143",
"0.6047143",
"0.60148853",
"0.597136",
"0.5956025",
"0.5955525",
"0.59393036",
"0.5937485... | 0.66922766 | 0 |
converts counts into flux | def cps_to_flux(self, counts):
return counts * 10**(-(2.406+self.zp) / 2.5 ) / (self.lbda**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self) -> \"Stream[float]\":\n return ExpandingCount()(self).astype(\"float\")",
"def flux(source, freq=0.0, deltafreq=0.0, daysback=0.0) :\n x = queryFlux(source,freq,deltafreq,daysback)\n return x.flux",
"def to_countvectors(self):\n if hasattr(self, \"ifp\"):\n df = s... | [
"0.60633475",
"0.5949982",
"0.5584796",
"0.5568298",
"0.5555001",
"0.55394894",
"0.55394894",
"0.54651356",
"0.54651356",
"0.5373014",
"0.53395957",
"0.5332762",
"0.5326706",
"0.5323258",
"0.53164715",
"0.52887124",
"0.52685785",
"0.52584463",
"0.52495116",
"0.5210051",
"0.51... | 0.6765831 | 0 |
Sum of the data and background counts | def totalcounts(self):
return self.datacounts + self.bkgdcounts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nodes_pixel_count(self):\n sum_count = self.pixel_count\n for i in range(8):\n node = self.children[i]\n if node:\n sum_count += node.pixel_count\n return sum_count",
"def totalhashes(self):\n return np.sum(self.counts)",
"def gal_count(c... | [
"0.59804076",
"0.5948288",
"0.57557136",
"0.5743971",
"0.57192796",
"0.56736714",
"0.566086",
"0.566086",
"0.56496847",
"0.56325287",
"0.56325287",
"0.56325287",
"0.5630881",
"0.5622863",
"0.5619059",
"0.5617458",
"0.56069016",
"0.5570332",
"0.5567497",
"0.5535872",
"0.553587... | 0.6485714 | 0 |
This method gets all fields mentioned in the statements. | def _get_fields_from_statements(self, statement):
columns_fields = []
if statement is not None:
columns_fields = list(set([x for col in statement for x in re.findall(Pheno2SQL.RE_COLUMN_NAME, col)]))
return columns_fields | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_fields(self):\n tables = [self.sell_table, self.buy_table, self.pending_table]\n for table in tables:\n sql = f'SHOW COLUMNS in {table}'\n self.fields[table] = list(tb.Database().read(sql).Field)",
"def _get_fields(self):\n if not self._cursor.description:\n ... | [
"0.7156919",
"0.692624",
"0.6884458",
"0.6814844",
"0.67626506",
"0.6542504",
"0.6515264",
"0.6462682",
"0.64590603",
"0.6411002",
"0.63534313",
"0.6344302",
"0.63381857",
"0.6237788",
"0.6213629",
"0.6200524",
"0.6200524",
"0.6200179",
"0.6191353",
"0.6154356",
"0.6135048",
... | 0.6991902 | 1 |
This method returns a list of fields (either its column specification, like c64_0_0 or its rename like myfield) that are of type integer. | def _get_integer_fields(self, columns):
int_columns = []
for col in columns:
if col == 'eid':
continue
match = re.search(Pheno2SQL.RE_FULL_COLUMN_NAME_RENAME, col)
if match is None:
continue
col_field = match.group('fiel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_fields(self, table):\n fields = list()\n for column in table.columns:\n fields.append({'id': column.name, 'type': str(column.type)})\n return fields",
"def column_types(self):\n return self._hndl.column_types()",
"def identify_numeric_columns(dataset):\n retur... | [
"0.68269765",
"0.6456442",
"0.6351034",
"0.6348163",
"0.63085",
"0.61558086",
"0.61520594",
"0.6149548",
"0.6130748",
"0.6124146",
"0.6053448",
"0.60428953",
"0.603779",
"0.6013474",
"0.5993608",
"0.5993608",
"0.59647644",
"0.5925211",
"0.59218806",
"0.59146714",
"0.59055597"... | 0.751693 | 0 |
DataSize is update with the lenght of head, payload and eop expected | def setDataSize(self, head,payload,eop):
self.dataSize = len(head)+len(payload)+len(eop) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_size(self):\n return len(self.get_payload()) + 4",
"def __payload_size(self):\n return (\n self.SIZE_LINEUP_ID + self.players_per_lineup * self.SIZE_PLAYER) * self.entries.count()",
"def __len__(self):\n\n return len(self.data) * 8",
"def __len__(self):\n ... | [
"0.7256133",
"0.7087587",
"0.69353086",
"0.6655744",
"0.66549367",
"0.6584182",
"0.6466465",
"0.6465146",
"0.64590085",
"0.64590085",
"0.64442855",
"0.64431727",
"0.6432089",
"0.6423863",
"0.6418688",
"0.6414835",
"0.64025384",
"0.63947356",
"0.6380141",
"0.6380141",
"0.63801... | 0.8885069 | 0 |
Fechando a porta no sistema | def closeGate(self):
print("tentando fechar a porta")
self.com.disable()
print('+--------------------------------+')
print('| Porta fechada |')
print('+--------------------------------+') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def velocidade_porta(self): # Testar este metodo.\r\n porta, velocidade = args\r\n if \"usb\" in porta:\r\n if velocidade:\r\n ## Retorna \"0\" se executado com sucesso\r\n status = subprocess.call(\r\n \"stty -F /dev/ttyUSB0 speed {0}\".format(ve... | [
"0.5684939",
"0.5445621",
"0.5418745",
"0.51699895",
"0.50844985",
"0.50260824",
"0.50132674",
"0.49030408",
"0.48909253",
"0.48664024",
"0.48402378",
"0.48235455",
"0.4761444",
"0.47457138",
"0.4744236",
"0.46895415",
"0.4679941",
"0.46667632",
"0.46562585",
"0.46501243",
"0... | 0.5658003 | 1 |
receive message size is the width of the message type(size) = int return the message received | def receiveMessage(self,size):
self.messageReceived = self.com.getData(size)
print('+--------------------------------+')
print('| Mensagem Recebida |')
print('+--------------------------------+')
print(self.messageReceived) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recv_size(s, size):\n print 'Receive data in fixed size mode'\n reply = s.recv(size)\n print reply",
"def ReceiveBufferSize(self) -> int:",
"def ReceiveBufferSize(self) -> int:",
"def _read_len(self):\n\n read = self.socket.recv(4)\n if len(read) == 0:\n # if we read 0 b... | [
"0.7209607",
"0.7047936",
"0.7047936",
"0.703413",
"0.70163167",
"0.6983315",
"0.6948629",
"0.69426155",
"0.6882877",
"0.6868097",
"0.683018",
"0.68169767",
"0.6724496",
"0.67101705",
"0.670977",
"0.67024106",
"0.6685487",
"0.6650386",
"0.6636737",
"0.66122013",
"0.66078997",... | 0.78524727 | 0 |
Return the information in /proc/cpuinfo as a dictionary in the following | def cpuinfo():
cpu_info = OrderedDict()
procinfo = OrderedDict()
nprocs = 0
with open('/proc/cpuinfo') as cpuinfo_file:
for line in cpuinfo_file:
if not line.strip():
# end of one processor
cpu_info["proc{!s}".format(nprocs)] = procinfo
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpu_info():\n cpuinfo = OrderedDict()\n procinfo = OrderedDict()\n nprocs = 0\n with open('/proc/cpuinfo') as f:\n for line in f:\n if not line.strip():\n # end of one processor\n cpuinfo['proc%s' % nprocs] = procinfo\n nprocs = nprocs ... | [
"0.84610534",
"0.8009619",
"0.7828145",
"0.77500343",
"0.7665037",
"0.7436814",
"0.7072395",
"0.7038289",
"0.6958358",
"0.684321",
"0.68240786",
"0.67933744",
"0.6775043",
"0.676049",
"0.67295897",
"0.67123634",
"0.6696791",
"0.669299",
"0.664515",
"0.6548545",
"0.6508164",
... | 0.83720917 | 1 |
Checks existence (runnability) of plymouth in the target system. True if plymouth exists in the target, False otherwise | def detect_plymouth():
# Used to only check existence of path /usr/bin/plymouth in target
isPlymouth = target_env_call(["sh", "-c", "which plymouth"])
debug("which plymouth exit code: {!s}".format(isPlymouth))
return isPlymouth == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_win(self):\n return UNEXPOSED not in self.get_game() and self.get_game().count(FLAG) == len(self.get_pokemon_location)",
"def hasPokemon(self):\r\n return self.trainer.hasPokemon()",
"def can_exist_outside_of_game(self):\n return True",
"def can_exist_outside_of_game(self):\n ... | [
"0.6475311",
"0.6330805",
"0.6170313",
"0.6170313",
"0.60015094",
"0.59555125",
"0.58366877",
"0.581904",
"0.5770049",
"0.57698214",
"0.5757941",
"0.5751054",
"0.5690737",
"0.56897444",
"0.5672264",
"0.5644189",
"0.56418335",
"0.56355816",
"0.5633012",
"0.561374",
"0.55747163... | 0.7919609 | 0 |
Calls routine with given parameters to modify '/etc/mkinitcpio.conf'. | def run():
partitions = libcalamares.globalstorage.value("partitions")
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
if not partitions:
libcalamares.utils.warning("partitions is empty, {!s}".format(partitions))
return (_("Configuration Error"),
_("No ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bootstrap():\n validate_configurator_version()\n\n # put new mkinitcpio.conf in place\n run(\"mv /etc/mkinitcpio.conf.pacnew /etc/mkinitcpio.conf\")\n sed(\"/etc/mkinitcpio.conf\",\n 'MODULES=\"\"',\n 'MODULES=\"xen-blkfront xen-fbfront xen-kbdfront xen-netfront xen-pcifront xenbus_pr... | [
"0.61212",
"0.6063286",
"0.601032",
"0.5911971",
"0.5840091",
"0.5806259",
"0.5711432",
"0.5618954",
"0.55213636",
"0.54905295",
"0.546345",
"0.5456032",
"0.5426769",
"0.54266286",
"0.54186964",
"0.5396334",
"0.53733575",
"0.5367634",
"0.53524953",
"0.5348449",
"0.533639",
... | 0.72416776 | 0 |
Create the mesh object lists is a list of [data.DisplayList, texture] objects holding the 3d rendering of the mesh pos must be a threepart tuple representing the position of the mesh rotation must be a threepart tuple representing the rotation of the mesh verts is a list of vertices in the mesh scale must be a number o... | def __init__(self, lists, pos=(0,0,0),
rotation=(0,0,0), verts=[],
scale=1, colorize=(1,1,1,1)):
view.require_init()
self.gl_lists = lists
self.pos = pos
self.rotation = rotation
self.verts = verts
self.scale = scale
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_mesh(self):\n print(\"create_mesh\")\n faces = self.get_faces()\n print(\"num faces: {}\".format(len(faces)))\n\n # TODO: perform face filtering to remove long edges in Z direction\n # filtered_faces = self.get_filtered_faces(faces)\n # print(\"num filtered face... | [
"0.6949505",
"0.6842107",
"0.6687609",
"0.6662013",
"0.66028094",
"0.6578481",
"0.6559042",
"0.64688796",
"0.6433167",
"0.64153606",
"0.63791925",
"0.63023114",
"0.6300214",
"0.6253577",
"0.62309635",
"0.6230281",
"0.62207234",
"0.617293",
"0.6150715",
"0.611848",
"0.61159664... | 0.70226866 | 0 |
Return a copy of the mesh, sharing the same data.DisplayList | def copy(self):
return BasicMesh(self.gl_lists, list(self.pos),
list(self.rotation), list(self.verts),
self.scale, list(self.colorize)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_meshes(scene):\r\n # all the instances we want to duplicate and change the source\r\n instances = []\r\n # the mesh we want to use as the new source\r\n replacement_mesh = None\r\n # the original mesh\r\n original_mesh = None\r\n\r\n for item in scene.selected:\r\n if item.isAnI... | [
"0.6642409",
"0.66337055",
"0.6620074",
"0.65797347",
"0.65439165",
"0.65439165",
"0.65439165",
"0.65439165",
"0.6461901",
"0.6455767",
"0.63550776",
"0.63550776",
"0.6302007",
"0.61966115",
"0.6148905",
"0.6110501",
"0.60982805",
"0.60765606",
"0.60564744",
"0.6038767",
"0.6... | 0.7728657 | 0 |
Render the mesh camera must be None if the camera the scene is using | def render(self, camera=None):
glPushMatrix()
x,y,z = self.pos
glTranslatef(x,y,-z)
a, b, c = self.rotation
glRotatef(a, 1, 0, 0)
glRotatef(b, 0, 1, 0)
glRotatef(c, 0, 0, 1)
try:
glScalef(*self.scale)
except:
glSc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(scene, camera, HEIGHT=100, WIDTH=100):\n output = np.zeros((HEIGHT, WIDTH, RGB_CHANNELS), dtype=np.uint8)\n if not scene or scene.is_empty() or not camera or camera.inside(\n scene.objects\n ):\n print(\"Cannot generate an image\")\n return output\n # This is for showing... | [
"0.63282067",
"0.6247002",
"0.62461245",
"0.6240543",
"0.6158925",
"0.6148335",
"0.61456746",
"0.60481405",
"0.6036247",
"0.5995018",
"0.5948636",
"0.5941453",
"0.5925543",
"0.5920356",
"0.5909246",
"0.5890616",
"0.5887701",
"0.5858915",
"0.585822",
"0.58497745",
"0.58483076"... | 0.68499565 | 0 |
Resets the database to a healthy state by any means necessary. Tries to delete the file, or flush all tables, then runs the migrations from scratch. It now checks if the file exists. This will throw a PermissionError if the user has the DB open in another program. | def reset_db(name, fail_ok=True):
print("Deleting", db_path(name))
close_old_connections()
delete_failed = False
if os.path.exists(db_path(name)): # your database is corrupted and must be destroyed
connections[name].close()
try:
# or you could http://stackoverflow.com/a/2450... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_db_danger():\n from flask.ext.migrate import init, migrate\n # Remove the migration folder if exist\n if os.path.exists('migrations'):\n shutil.rmtree('migrations')\n\n # Remove the sqlite database files if exist\n for fl in glob.glob('*.sqlite'):\n os.remove(fl)\n\n # Res... | [
"0.6936277",
"0.66065484",
"0.65963084",
"0.6573971",
"0.65093094",
"0.6496426",
"0.64728326",
"0.6460116",
"0.64427376",
"0.6389634",
"0.6362313",
"0.6341633",
"0.63092744",
"0.62991583",
"0.62861896",
"0.6286085",
"0.6273984",
"0.6273582",
"0.62533766",
"0.6244704",
"0.6236... | 0.6962941 | 0 |
exports specified tasks to Things3 for Mac | def export2Things3(self, taskObjs):
# append all task names to link, so Things3 knows
# which tasks (more than one) to add
for i in taskObjs:
if taskObjs == None: print(col.FAIL + "Failed exporting to Things. Things3Helper didn't receive appropriate data." + col.ENDC)
lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tasks():",
"def task():\n\n\tprint('Example task executed.')",
"def discover_tasks(app):\n\n task_arguments.add_argument(\n \"preload-defaults-from-site\",\n type=str,\n required=False,\n default=\"\",\n choices=preload_defaults_from_site_choices,\n help=\"Selec... | [
"0.6327094",
"0.59076524",
"0.5836535",
"0.57699925",
"0.5737186",
"0.57361573",
"0.5734858",
"0.5734858",
"0.5692314",
"0.56744194",
"0.5647242",
"0.55659676",
"0.54340035",
"0.537767",
"0.5367153",
"0.53470516",
"0.53445685",
"0.53445524",
"0.53198165",
"0.53169787",
"0.530... | 0.65886086 | 0 |
Open and read an Excel file | def open_file(path):
book = xlrd.open_workbook(path)
# print number of sheets
#print book.nsheets
# print sheet names
#print book.sheet_names()
# get the first worksheet
first_sheet = book.sheet_by_index(0)
# read a row
#print first_sheet.row_values(0)
# read a cell
cell = fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_xlsx_file(filepath, mode=\"rb\"):\n archive = XslxFile(filepath)\n archive.open()\n return archive",
"def _read_file(self):\n # Convert str to pathlib.Path() object.\n if isinstance(self.file_path, str):\n self.file_path = Path(self.file_path)\n\n # Check if file... | [
"0.7142977",
"0.6957968",
"0.6929991",
"0.68153423",
"0.68112993",
"0.68009347",
"0.6750092",
"0.6731913",
"0.671375",
"0.6713655",
"0.6657591",
"0.6592459",
"0.65921164",
"0.6578631",
"0.655591",
"0.65300924",
"0.64815927",
"0.6444378",
"0.6410499",
"0.6408071",
"0.6375193",... | 0.72357196 | 0 |
Decorator to check for masked arrays. Check that the first argument to a function is a masked array. If not, convert it into one. | def check_mask(f):
def wrapper(*args, **kwargs):
data = args[0]
try:
mask = data.mask
except AttributeError:
data = np.ma.array(data, mask=np.zeros(data.shape, dtype=np.bool))
mask = data.mask
args = list(args)
args[0] = data
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mask_array(mask, *args):\n invalid = ~mask # True if invalid\n args_masked = []\n for arg in args:\n if arg.size > 1 and arg.shape != invalid.shape:\n raise ValueError('Shape mismatch between mask and array.')\n arg_masked = arg.astype(np.float64)\n if arg.size == 1:\... | [
"0.72376055",
"0.6092625",
"0.6069391",
"0.60632956",
"0.6015258",
"0.5943337",
"0.57985723",
"0.57833385",
"0.5702111",
"0.56136847",
"0.55706364",
"0.5559784",
"0.55149686",
"0.5501927",
"0.54972684",
"0.5459309",
"0.541955",
"0.54083496",
"0.53978586",
"0.53914213",
"0.539... | 0.75570744 | 0 |
Apply SumThreshold method This function applies a set ofmoving averages to the data along both time and frequency axes, then checks if the output are above a threshold. This is the basic technique used in AOFlagger's algorithm. | def sum_threshold(data, plot_progress=False, verbose=False):
thr_f = params.thr_f
thr_t = params.thr_t
scales = params.scales
rho = params.rho
mask = np.copy(data.mask)
thr1_f = thr_f
thr1_t = thr_t
# do first stage of flagging:
mask_f = np.greater_equal(np.abs(data-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def belowThresholdAlarm(self, data):\n\n if(self.belowThreshold and self.calculateAverage(data) < self.threshold):\n message = \"Average below acceptable amount for \" + self.subjectName + \".\"\n if(self.log):\n logging.info(message)\n\n ... | [
"0.61906254",
"0.6165873",
"0.5695181",
"0.56285673",
"0.55743444",
"0.552214",
"0.54605484",
"0.5459882",
"0.543789",
"0.54317486",
"0.54109883",
"0.5399993",
"0.5364612",
"0.53480464",
"0.5344392",
"0.53079313",
"0.52595514",
"0.5254944",
"0.5248128",
"0.52447414",
"0.52326... | 0.6732292 | 0 |
Flag anything above or below absolute thresholds. First pass for horrific data. | def flag_absolute(data):
data.mask = np.logical_or(data.mask, data > params.thr_max)
data.mask = np.logical_or(data.mask, data < params.thr_min)
return data.mask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_thresholding(x):\n return x > threshold_otsu(x)",
"def threshold(self,thresholdValue):\n # TO DO\n pass",
"def apply_hounsfield_thresholding(data_, threshold: tuple = (200, 600)):\n mask = np.ma.masked_inside(data_, threshold[0], threshold[1], ).mask\n thresholded = np.zeros_li... | [
"0.6319579",
"0.62372077",
"0.6130785",
"0.604354",
"0.6014459",
"0.5823133",
"0.5811214",
"0.5798224",
"0.57867634",
"0.577807",
"0.57724714",
"0.57661194",
"0.57521254",
"0.57452726",
"0.5742407",
"0.5733061",
"0.5727703",
"0.571427",
"0.57091475",
"0.5701577",
"0.57004046"... | 0.70633096 | 0 |
Alternate DTV flagger for spectrometer data. This function uses the constrastin power between the DTV band edges (outer 0.25 MHz) and the DTV band centers (inner 4.5 MHz) to identify DTV flares. | def do_dtv_flagging2(data, freqs):
mask = data.mask*1
dtv_times = []
for ledge in (54, 60, 66, 76, 82):
uedge = ledge + 6
band = np.where( (freqs>=ledge) & (freqs<=uedge) )[0]
trns = np.where( (freqs>=ledge+0.25) & (freqs<=uedge-0.25) )[0]
empt = np.where( ((freqs>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ptf10iuv(colorplt = False):\n z = 0.0251485\n ebv = 0.0371 # SFD\n D = cosmo.luminosity_distance([z])[0].value * 1e+6 # in pc\n dis_mod = 5*np.log10(D / 10)\n print (\"adopt g band t_max estimated by myself\")\n t_max = 55357.387 \n tb = pd.read_csv('../data/otherSN/Kasliwal2012/PTF10i... | [
"0.6109995",
"0.59951276",
"0.57790977",
"0.575149",
"0.5737363",
"0.5664619",
"0.5647433",
"0.5642654",
"0.5629072",
"0.5567218",
"0.5546353",
"0.5500568",
"0.54740155",
"0.5468313",
"0.5457287",
"0.5444354",
"0.54430723",
"0.541593",
"0.5398459",
"0.5384672",
"0.5380677",
... | 0.70495063 | 0 |
RFI Flagging routine for LEDA data | def rfi_flag(data, freqs=None):
masks = Masks()
# Record any nans
masks.add("nan_mask", np.isnan(data))
if params.do_sum_threshold:
try:
to_flag
except NameError:
bpass = estimate_bandpass(data)
to_flag = data / bpass
to_fla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def at_aflight(seq, flag):\n at(\"AFLIGHT\", seq, [flag])",
"def set_flags(data):\n flag_status_bit = {\n \"flagfield_rf1\": np.array([1, 1, 2, 1, 2, 0, 0, 0]),\n \"flagfield_rf2\": np.array([2, 2, 0, 0, 0, 0, 0, 0]),\n \"flagfield_pl\": np.array([2, 2, 2, 2, 0, 0, 0, 0]),\n \"f... | [
"0.6014695",
"0.58131117",
"0.57622546",
"0.55920565",
"0.5525371",
"0.5463985",
"0.52837116",
"0.52661276",
"0.525537",
"0.52289164",
"0.52183723",
"0.5209912",
"0.5195452",
"0.5172419",
"0.516967",
"0.51316375",
"0.5109751",
"0.510752",
"0.5091125",
"0.50868595",
"0.5086526... | 0.61054915 | 0 |
Returns an offspring obtained by applying crossover to the two given chromosomes, chrom1 and chrom2. If the crossover occurs at a random index i, then the offspring is created | def crossover(self, chrom1, chrom2):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crossover(chromosome_1, chromosome_2):\n (x1, y1) = (randrange(col_count), randrange(row_count))\n (x2, y2) = (randrange(x1+1, col_count+1), randrange(y1+1, row_count+1))\n def mate(chromosome_1, chromosome_2):\n used = set(chromosome_1[x+y*col_count] for x in range(x1, x2) for ... | [
"0.7741972",
"0.71026045",
"0.69760233",
"0.6832219",
"0.65046716",
"0.631999",
"0.6303768",
"0.623347",
"0.6162992",
"0.61589414",
"0.61228406",
"0.6118747",
"0.61057234",
"0.60661435",
"0.6047666",
"0.6026608",
"0.60084987",
"0.60013145",
"0.59919107",
"0.5970242",
"0.59259... | 0.73467314 | 1 |
Returns the fitness value of the given chrom | def fitness_fn(self, chrom):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateFitness(self,chromosome):\n\t\tif self.fitness_external_data:\n\t\t\treturn self.fitness_func(chromosome, *(self.fitness_external_data))\n\t\telse:\n\t\t\treturn self.fitness_func(chromosome)",
"def get_overall_fitness(self):\n total_fitness = 0\n for chromosome_list in self.chromo_lis... | [
"0.67713594",
"0.62464845",
"0.6241168",
"0.62035155",
"0.61529666",
"0.6149372",
"0.6123359",
"0.60255337",
"0.5863344",
"0.5848801",
"0.5810107",
"0.5807863",
"0.5777454",
"0.57656956",
"0.5700657",
"0.56974095",
"0.5686676",
"0.56401676",
"0.5631618",
"0.5614915",
"0.56145... | 0.8457975 | 0 |
Return the version tuple as a string, e.g. for (0, 10, 7), return '0.10.7'. | def get_version(version_tuple):
return ".".join(map(str, version_tuple)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version():\n vers = [\"%(major)i.%(minor)i\" % __version_info__, ]\n\n if __version_info__['micro']:\n vers.append(\".%(micro)i\" % __version_info__)\n if __version_info__['releaselevel'] != 'final':\n vers.append('%(releaselevel)s' % __version_info__)\n return ''.join(vers)",
"... | [
"0.7933622",
"0.7844669",
"0.7725943",
"0.76721835",
"0.7621875",
"0.75918096",
"0.7581856",
"0.75529605",
"0.7491002",
"0.7491002",
"0.7488045",
"0.748552",
"0.7445712",
"0.72769445",
"0.7272909",
"0.72623897",
"0.7256755",
"0.7237101",
"0.7227922",
"0.7188286",
"0.7174934",... | 0.8402218 | 0 |
Check if the currently stored steps are valid with respect to a given proximity class | def is_step_allowed(self, proximity_class, condition_on_grid=None):
return proximity_class.is_step_allowed(self.arr_new_steps, self.pos_x, self.pos_y, self.pos_z,
condition_on_grid=condition_on_grid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_step(step):\n assert isinstance(step, list), \"Step must be a list\"\n assert (len(step) == 3 or len(step) == 4), \\\n \"Step must be a list of length 3 or 4 (to include temporary values)\"\n assert isinstance(step[0], type), (\n \"The first element of the step ... | [
"0.5950858",
"0.59025",
"0.5880932",
"0.5751608",
"0.5615108",
"0.5612318",
"0.5581712",
"0.55670583",
"0.55666775",
"0.55469203",
"0.550529",
"0.55052096",
"0.54791355",
"0.54550046",
"0.54436976",
"0.54434323",
"0.5419243",
"0.540788",
"0.5401445",
"0.5376519",
"0.53605205"... | 0.72541904 | 0 |
Set the position of the selected agents using coordinates of the graph vertex the agent is currently on. | def set_position_based_on_graph(self, arr_selected_agent, use_radius=True, agent_position_attribute='position',
graph_coord_x_attribute='coord_x',
graph_coord_y_attribute='coord_y',
graph_coord_z_attribute='coord... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_node_positions(self):",
"def set_new_location(self, xPos, yPos):",
"def setPosition(*args):",
"def setPosition(*args):",
"def setPosition(*args):",
"def setPosition(*args):",
"def setPosition(*args):",
"def setPosition(*args):",
"def setPosition(*args):",
"def setPosition(*args):",
"def... | [
"0.6581404",
"0.63604665",
"0.6103417",
"0.6103417",
"0.6103417",
"0.6103417",
"0.6103417",
"0.6103417",
"0.6103417",
"0.6103417",
"0.6103417",
"0.6103417",
"0.6103417",
"0.60904014",
"0.6086654",
"0.6039753",
"0.60023797",
"0.59787905",
"0.595031",
"0.5928913",
"0.5920887",
... | 0.6673279 | 0 |
Set the directions of the selected agents in the direction of the north pole (coordinates X et Y are 0.). Agents located at the north or south pole have their initial direction set to (1., 0., 0.). | def set_direction_to_north(self, arr_selected_agents):
arr_selected_agents = np.array(arr_selected_agents, dtype=bool)
pos_x = np.array(self.df_population['coord_x'], dtype=np.float)
pos_y = np.array(self.df_population['coord_y'], dtype=np.float)
pos_z = np.array(self.df_population['coo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_direction_von_mises(self, arr_selected_agents, kappa):\n arr_selected_agents = np.array(arr_selected_agents, dtype=bool)\n\n pos_x = np.array(self.df_population['coord_x'], dtype=np.float)\n pos_y = np.array(self.df_population['coord_y'], dtype=np.float)\n pos_z = np.array(self.... | [
"0.6302545",
"0.6212734",
"0.61221373",
"0.60512704",
"0.59610564",
"0.5928018",
"0.58417803",
"0.5826621",
"0.57771915",
"0.57650757",
"0.5714318",
"0.5705142",
"0.57035714",
"0.5678118",
"0.5645479",
"0.5645479",
"0.5644388",
"0.56416196",
"0.5634493",
"0.5601044",
"0.56009... | 0.74984133 | 0 |
Set the direction of the selected agents by deviating their current direction by an angle given by von mises distribution. | def set_direction_von_mises(self, arr_selected_agents, kappa):
arr_selected_agents = np.array(arr_selected_agents, dtype=bool)
pos_x = np.array(self.df_population['coord_x'], dtype=np.float)
pos_y = np.array(self.df_population['coord_y'], dtype=np.float)
pos_z = np.array(self.df_populat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_direction_to_north(self, arr_selected_agents):\n arr_selected_agents = np.array(arr_selected_agents, dtype=bool)\n\n pos_x = np.array(self.df_population['coord_x'], dtype=np.float)\n pos_y = np.array(self.df_population['coord_y'], dtype=np.float)\n pos_z = np.array(self.df_popul... | [
"0.621206",
"0.597278",
"0.5859308",
"0.5800002",
"0.5755136",
"0.5755136",
"0.5723313",
"0.5677956",
"0.5668672",
"0.5663365",
"0.56591505",
"0.56193614",
"0.55996156",
"0.5554558",
"0.5554558",
"0.5536821",
"0.55331975",
"0.5523699",
"0.5523263",
"0.552083",
"0.54946107",
... | 0.7386967 | 0 |
Propose a new step for the selected agents, following their current direction with a step length given by a Gamma distribution. | def propose_step_gamma_law(self, arr_selected_agents, k, theta):
gamma_sample = np.random.gamma(k, theta, size=(arr_selected_agents.sum(),))
arr_selected_agents = np.array(arr_selected_agents)
pos_x = np.array(self.df_population['coord_x'], dtype=np.float)
pos_y = np.array(self.df_popu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_step(self, experiences, gamma):\n raise NotImplementedError",
"def step(self):\n\n percept = self.getPerception(self.agent.capteurs)\n choix = self.agent.getDecision(percept)\n self.__historique.append(((self.table, self.posAgent), choix))\n self.agent.setReward(self.applyChoix(choix... | [
"0.6747871",
"0.6102468",
"0.6094519",
"0.6037685",
"0.59589595",
"0.5924652",
"0.59118545",
"0.5801442",
"0.5700218",
"0.5676688",
"0.56624216",
"0.5657877",
"0.5648469",
"0.564375",
"0.5643624",
"0.5631456",
"0.5615784",
"0.5595073",
"0.554196",
"0.5538769",
"0.55386734",
... | 0.7177706 | 0 |
Finds the standard deviation of a list of column values Arguments | def column_stdev(column_values, mean):
try:
stdev = math.sqrt(
sum([(mean-x)**2 for x in column_values]) / len(column_values))
except ZeroDivisionError:
print("Column is empty, cannot perform calculation",
file=sys.stderr)
sys.exit(1)
return stdev | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stdev(headers, data):\n\tcolumn_matrix=data.get_data(headers)\n\tmean_values=column_matrix.std(0)\n\tstd_values=mean_values.tolist()\n\treturn std_values",
"def stdev(items):\n return Series.std(Series(items))",
"def standard_deviation(xs: List[float]) -> float:\n return math.sqrt(variance(xs))",
"... | [
"0.75662345",
"0.7257426",
"0.72186244",
"0.72186244",
"0.7181876",
"0.707933",
"0.7032461",
"0.69594395",
"0.6940183",
"0.68986225",
"0.68807936",
"0.68558097",
"0.68515176",
"0.681029",
"0.6798629",
"0.6773498",
"0.6764885",
"0.67641616",
"0.67426467",
"0.6733447",
"0.67265... | 0.7331031 | 1 |
Computes lagcrp for a given recall list | def lagcrp(rec, lstlen):
def check_pair(a, b):
if (a>0 and b>0) and (a!=b):
return True
else:
return False
def compute_actual(rec, lstlen):
arr=pd.Series(data=np.zeros((lstlen)*2),
index=list(range(-lstlen,0)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lagcrp_helper(egg, match='exact', distance='euclidean',\n ts=None, features=None):\n\n def lagcrp(rec, lstlen):\n \"\"\"Computes lag-crp for a given recall list\"\"\"\n\n def check_pair(a, b):\n if (a>0 and b>0) and (a!=b):\n return True\n ... | [
"0.6530831",
"0.5988757",
"0.57605416",
"0.5691241",
"0.55181473",
"0.5509565",
"0.55074036",
"0.55045956",
"0.54032797",
"0.53664505",
"0.5325315",
"0.53126174",
"0.52216846",
"0.5180279",
"0.51550597",
"0.51078355",
"0.5098598",
"0.50555897",
"0.50174916",
"0.5011792",
"0.5... | 0.66099495 | 0 |
Return a List of all args in settings.txt file | def init():
args = []
with open("settings.txt", "r") as reader:
for line in reader:
args.append(line)
return args | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _list_settings(self, settings=None):\n if settings == None:\n settings = fileIO.load_json(\"settings.json\")\n print(\"The list of settings is: \")\n for i in settings:\n print(\"{0}: {1}\".format(i, settings[i]))\n return(None)",
"def get_args(self) -> List[... | [
"0.6487716",
"0.6457457",
"0.63988405",
"0.63828725",
"0.63628465",
"0.62929213",
"0.6273107",
"0.61642474",
"0.6151727",
"0.60626006",
"0.6027101",
"0.60010695",
"0.5982636",
"0.5977372",
"0.5968307",
"0.5953618",
"0.5951499",
"0.5915452",
"0.5911236",
"0.5894399",
"0.588808... | 0.82072544 | 0 |
Called for "table" nodes. | def visit_table(self, node: docutils.nodes.reference) -> None:
self.entry = {}
self.header = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def depart_table(self, node: docutils.nodes.Node) -> None:\n pass",
"def start_table(self):\n raise NotImplementedError",
"def generate_table(self, rows):\n ...",
"def start_table(self):\n self.result = \"<table>\\n\"",
"def node_table(self, G, myfile):\r\n layout = \"{0}... | [
"0.7063385",
"0.6665527",
"0.66135293",
"0.64686155",
"0.645431",
"0.64389",
"0.6433312",
"0.628465",
"0.62776935",
"0.6256247",
"0.6253577",
"0.6253329",
"0.61014146",
"0.6084219",
"0.6014613",
"0.6014613",
"0.5997109",
"0.5980133",
"0.5957157",
"0.5890032",
"0.5874245",
"... | 0.69205457 | 1 |
Get a single item without mix_results. Iterate through all data processors to prepare model inputs. The data processors are organized first by modalities and then by models. | def _load_item(self, idx):
ret = dict()
try:
for group_id, per_processors_group in enumerate(self.processors):
per_sample_features = get_per_sample_features(
modality_features=getattr(self, f"modality_features_{group_id}"),
modality_typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_get_single_postprocessor(result=None, **kw):\n pass\n obj = result.copy()\n result.clear()\n result[model_name] = obj",
"def get_instance(self, data):\n if self.transient:\n return None\n props = get_primary_keys(self.opts.model)\n filters =... | [
"0.6036593",
"0.5466109",
"0.5334395",
"0.5267224",
"0.5214438",
"0.5210585",
"0.5189395",
"0.51464427",
"0.50807554",
"0.5067626",
"0.5065683",
"0.50520974",
"0.49994427",
"0.4990989",
"0.49765724",
"0.49671996",
"0.49545968",
"0.49318174",
"0.49246103",
"0.49173674",
"0.491... | 0.5962651 | 1 |
Calculate global coordinate of mosaic image and local coordinate of cropped subimage. | def _mosaic_combine(
self, loc: str, center_position_xy: Sequence[float], img_shape_wh: Sequence[int]
) -> Tuple[Tuple[int], Tuple[int]]:
assert loc in ("top_left", "top_right", "bottom_left", "bottom_right")
if loc == "top_left":
# index0 to top left part of image
x1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mosaic_combine(self, loc, center_position_xy, img_shape_wh):\n\n assert loc in ('top_left', 'top_right', 'bottom_left', 'bottom_right')\n if loc == 'top_left':\n # index0 to top left part of image\n x1, y1, x2, y2 = max(center_position_xy[0] - img_shape_wh[0], 0), \\\n ... | [
"0.61554253",
"0.5711784",
"0.55225426",
"0.5508147",
"0.54404837",
"0.54127914",
"0.5369446",
"0.5363894",
"0.5347078",
"0.53165084",
"0.53129375",
"0.52870363",
"0.5274904",
"0.5267543",
"0.5266987",
"0.5261621",
"0.5260711",
"0.5242646",
"0.5210589",
"0.52073973",
"0.52069... | 0.599289 | 1 |
Constructor for creating the custom column. Usage is the same as normal Column, however, a 'mapper_key' is required. | def __init__(
self,
*args,
mapper_key: typing.Optional[str] = None,
transform: typing.Optional[typing.Callable] = None,
**kwargs,
):
super(CustomColumn, self).__init__(*args, **kwargs)
self.mapper_key = mapper_key
self.transform = transform | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\r\n primary_key=False,\r\n index=False,\r\n db_field=None,\r\n default=None,\r\n required=False,\r\n save_strategy=None):\r\n self.primary_key = primary_key\r\n self.index = index\r\n ... | [
"0.60259587",
"0.5890681",
"0.5775215",
"0.5769186",
"0.576711",
"0.5631621",
"0.558502",
"0.55702376",
"0.5502349",
"0.5463798",
"0.54432845",
"0.5427061",
"0.5414419",
"0.5398779",
"0.53540087",
"0.5314218",
"0.52942926",
"0.52864254",
"0.5279286",
"0.5274883",
"0.5263861",... | 0.8424667 | 0 |
Test API on creating a bucketlist (POST Request) | def test_bucketlist_create(self):
res = self.client().post('/bucketlist', data=self.bucketlist)
self.assertEqual(res.status_code, 201)
self.assertIn('Go to vacation', str(res.data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_bucketlist_item(self):\n resp = self.client.post('/bucketlists',\n data=json.dumps(self.bucketlist),\n content_type=\"application/json\", headers={\n \"Authorization\": self.token\n ... | [
"0.8362053",
"0.8256497",
"0.8006556",
"0.7986437",
"0.78841245",
"0.7805581",
"0.777856",
"0.7757934",
"0.7616869",
"0.7607198",
"0.760406",
"0.7520301",
"0.7459011",
"0.74139905",
"0.73820364",
"0.7299936",
"0.7282302",
"0.7243523",
"0.7181079",
"0.7118802",
"0.7116098",
... | 0.8508352 | 0 |
Test API to get all data in bucketlist (GET Request) | def test_api_get_all_bucketlists(self):
res = self.client().post('/bucketlist', data=self.bucketlist)
self.assertEqual(res.status_code, 201)
res = self.client().get('/bucketlist')
self.assertEqual(res.status_code, 200)
self.assertIn('Go to vacation', str(res.data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_get_list_of_buckets(self):\n with self.client:\n response = self.client.get(\n '/bucketlists/',\n headers=dict(Authorization='Bearer ' + self.get_user_token())\n )\n data = json.loads(response.data.decode())\n self.a... | [
"0.8243035",
"0.80226827",
"0.77059263",
"0.769947",
"0.76427543",
"0.7624371",
"0.76011336",
"0.75830054",
"0.75149554",
"0.7491348",
"0.7467424",
"0.73366696",
"0.72969276",
"0.7261066",
"0.7243233",
"0.7160906",
"0.71608293",
"0.7153277",
"0.7149434",
"0.7139654",
"0.71180... | 0.81351703 | 1 |
Test API to get bucketlist by id | def test_api_get_bucketlist_by_id(self):
res_post = self.client().post('/bucketlist', data=self.bucketlist)
self.assertEqual(res_post.status_code, 201)
res_in_json = json.loads(res_post.data.decode('UTF-8').replace("'", "\""))
res = self.client().get(f"/bucketlist/{res_in_json['id']}")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bucket_by_id_is_returned_on_get_request(self):\n with self.client:\n token = self.get_user_token()\n # Create a Bucket\n response = self.client.post(\n '/bucketlists',\n data=json.dumps(dict(name='Travel')),\n headers=dic... | [
"0.8432812",
"0.79586273",
"0.7692606",
"0.75601715",
"0.7536347",
"0.7417009",
"0.73749256",
"0.7374103",
"0.73399794",
"0.73101795",
"0.72740847",
"0.7233099",
"0.7229824",
"0.72118866",
"0.72093755",
"0.7147539",
"0.71362406",
"0.70945454",
"0.70571244",
"0.70500207",
"0.7... | 0.8457787 | 0 |
Test API to get bucketlist by id when id does not exist | def test_api_get_bucketlist_by_id_not_exist(self):
res = self.client().get(f"/bucketlist/99")
self.assertEqual(res.status_code, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_bucket_returned_by_given_id(self):\n with self.client:\n token = self.get_user_token()\n\n response = self.client.get(\n '/bucketlists/1',\n headers=dict(Authorization='Bearer ' + token)\n )\n data = json.loads(response.da... | [
"0.8452869",
"0.8115867",
"0.8113846",
"0.767868",
"0.73052067",
"0.72711307",
"0.72450787",
"0.715663",
"0.69706464",
"0.6965228",
"0.69445795",
"0.6921409",
"0.6859074",
"0.6812505",
"0.6802468",
"0.67841727",
"0.6780305",
"0.6775552",
"0.67690146",
"0.67414135",
"0.6733725... | 0.8581222 | 0 |
Test API to edit bucketlist (PUT Request) | def test_api_edit_bucketlist(self):
res_post = self.client().post('/bucketlist', data={'name': 'Wake up, Eat, Code, Sleep & Repeat'})
self.assertEqual(res_post.status_code, 201)
res_post_in_json = json.loads(res_post.data.decode('UTF-8').replace("'", "\""))
id = res_post_in_json['id']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_edit_bucketlist(self):\n post_data = self.post_a_bucket()\n self.assertEqual(post_data.status_code, 201)\n result_of_put_method = self.client().put(\n '/bucketlists/1',\n headers=dict(Authorization='Bearer '\n + self.token()\n ... | [
"0.8703054",
"0.7808431",
"0.73537976",
"0.7250397",
"0.72338814",
"0.7148291",
"0.7121116",
"0.6990683",
"0.6962019",
"0.6898072",
"0.6881871",
"0.68014103",
"0.67995316",
"0.67813414",
"0.6766084",
"0.6743543",
"0.67432564",
"0.6681097",
"0.6671989",
"0.66679364",
"0.664234... | 0.86224693 | 1 |
Test API to delete bucketlist (DELETE Request) | def test_api_delete_bucketlist(self):
res_post = self.client().post('/bucketlist', data={'name': "Don't forget to exercise"})
self.assertEqual(res_post.status_code, 201)
res_post_in_json = json.loads(res_post.data.decode('UTF-8'))
id = res_post_in_json['id']
res_delete = self.cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_bucketlist(self):\n post_data = self.post_a_bucket()\n self.assertEqual(post_data.status_code, 201)\n result_of_delete_method = self.client().delete('/bucketlists/1',\n headers=dict(Authorization='Bearer '\n ... | [
"0.87816864",
"0.83896846",
"0.83171433",
"0.79910237",
"0.7873985",
"0.77634895",
"0.77510893",
"0.7698184",
"0.75955635",
"0.75789833",
"0.7439075",
"0.7429857",
"0.7363391",
"0.72874737",
"0.7112332",
"0.6841594",
"0.6791001",
"0.67869383",
"0.6745487",
"0.6741254",
"0.669... | 0.888001 | 0 |
Piecewise Polynomial Coefficients for a PCHIP (Piecewise Cubic Hermite Interpolating Polynomial) | def pchip_coeffs(X, Y):
# Suppress the divide by zero and invalid arguments warnings that appear
# for the `numba.guvectorize`d function, though not for the `numba.njit`ed
# function. The PCHIP algorithm is guaranteed to not divide by zero.
# https://github.com/numba/numba/issues/4793#issuecomment-623... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pchip_coeffs_i(X, Y, i):\n\n # Pre-assign sizes for PCHIP variables.\n h = [0.0, 0.0, 0.0]\n δ = [0.0, 0.0, 0.0]\n d = [0.0, 0.0]\n\n # Check whether x is adjacent to the start or end of this X\n at_start = (i == 0) or np.isnan(X[i - 1] + Y[i - 1])\n at_end = (i == len(X) - 2) or np.isnan... | [
"0.62187743",
"0.6198569",
"0.61006665",
"0.6073233",
"0.5982651",
"0.5964653",
"0.58934",
"0.5891084",
"0.58548",
"0.58486193",
"0.5842306",
"0.58396894",
"0.5809755",
"0.5767435",
"0.5749473",
"0.5747041",
"0.57277894",
"0.56898445",
"0.5677923",
"0.56749165",
"0.5648649",
... | 0.6472976 | 0 |
Coefficients for a single PCHIP when the data may contain NaNs Inputs and outputs are as for `pchip_coeffs`, but `X` and `Y` both 1D arrays of length `n`, and so `Yppc` is a 2D array of size `(n, 4)`. | def pchip_coeffs_1(X, Y):
# Find k = index to first valid data site, and
# K such that K - 1 = index to last valid data site in contiguous range
# of valid data after index k.
k, K = valid_range_1_two(X, Y)
return _pchip_coeffs_1(X, Y, k, K) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pchip_coeffs(X, Y):\n\n # Suppress the divide by zero and invalid arguments warnings that appear\n # for the `numba.guvectorize`d function, though not for the `numba.njit`ed\n # function. The PCHIP algorithm is guaranteed to not divide by zero.\n # https://github.com/numba/numba/issues/4793#issuec... | [
"0.7683169",
"0.6891365",
"0.68254536",
"0.53028786",
"0.52590394",
"0.51819485",
"0.48967373",
"0.48894528",
"0.48733106",
"0.48668343",
"0.48513827",
"0.47978702",
"0.47769806",
"0.4774299",
"0.47456157",
"0.47405112",
"0.47375876",
"0.47240058",
"0.4715691",
"0.46868387",
... | 0.70058113 | 1 |
rotates a word from given index onwards | def rotate(s, index):
# we'll have to split the list from index so that we can only rotate the charaters starting after index
left = s[:index]
right = s[index:]
# shift each character to the left
# "abcd" => "bcda"
rotated = right[1:]
#rotated.append(right[0])
rotated += right[0]
# merged the rotated... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encryptionShift(text, index):\n s=text\n transformedChar=\"\"\n transformedChar = ord(s[index]) + 1\n\n if(transformedChar > 90):\n transformedChar=chr(ord(s[index]) + 1 - 26)\n else:\n transformedChar = chr(transformedChar)\n\n print(\"Single Shift Encrypted text: \")\n retu... | [
"0.6865679",
"0.68353593",
"0.6683722",
"0.65733266",
"0.65431863",
"0.6418805",
"0.6388089",
"0.63125056",
"0.62354326",
"0.6086322",
"0.60832816",
"0.604717",
"0.604527",
"0.6006065",
"0.5952704",
"0.5920161",
"0.5890075",
"0.5885275",
"0.58819884",
"0.58819884",
"0.5853584... | 0.7802776 | 0 |
Remove reserved keys from records. | def clean_record(self):
_dict = {
key: value for (key, value) in self.record.items() if not key in
BAMBOO_RESERVED_KEYS
}
return remove_mongo_reserved_keys(_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_reserved_keys(df, exclude=[]):\n reserved_keys = __column_intersect(\n df, BAMBOO_RESERVED_KEYS).difference(set(exclude))\n\n return df.drop(reserved_keys, axis=1)",
"def removeAllKeys(self) -> None:\n ...",
"def remove_unused_keys(cop):\n delete_these = [\n 'officer_at... | [
"0.68836576",
"0.6244996",
"0.61620706",
"0.59967494",
"0.59965",
"0.5985874",
"0.5954014",
"0.5944359",
"0.5838665",
"0.5768952",
"0.5766907",
"0.5766339",
"0.5746722",
"0.57350534",
"0.57025963",
"0.56510305",
"0.56258124",
"0.5589366",
"0.55786705",
"0.5572855",
"0.5556310... | 0.7927458 | 0 |
Return the first row matching `query` and `select` from MongoDB. | def find_one(cls, query, select=None, as_dict=False):
record = cls.collection.find_one(query, select)
return record if as_dict else cls(record) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _query_and_fetchone(self, query):\n with self._connect() as conn:\n cur = conn.cursor()\n cur.execute(query)\n result = cur.fetchone()\n\n return result",
"def find_one(self, collection, query):\n obj = getattr(self.db, collection)\n result = obj.f... | [
"0.6962823",
"0.67654413",
"0.66527754",
"0.6602769",
"0.65141326",
"0.63615376",
"0.6325337",
"0.6313322",
"0.6266175",
"0.61997205",
"0.61848855",
"0.61843103",
"0.6181612",
"0.6157744",
"0.6155519",
"0.6155519",
"0.6155519",
"0.6155519",
"0.6155519",
"0.6149751",
"0.613541... | 0.69065726 | 1 |
Call unset with the spec `query` the unset document `unset_query`. | def unset(cls, query, unset_query):
cls.collection.update(query, {"$unset": unset_query}, multi=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unset_queries(self, *args):\n for k in args:\n self._query_dict.pop(k, None)",
"def delete(self, query):\n self.collection.remove(query)",
"def _clean_query(self, query):\n for object_query in query:\n filters = object_query.get(\"filters\", {}).get(\"expression\")\n s... | [
"0.6972681",
"0.62648195",
"0.5671868",
"0.5561115",
"0.55180794",
"0.5439912",
"0.53466463",
"0.5344292",
"0.5320448",
"0.528609",
"0.5261242",
"0.52323633",
"0.52198625",
"0.52137136",
"0.5190996",
"0.51531076",
"0.5121701",
"0.50768965",
"0.5046076",
"0.50452757",
"0.50195... | 0.8402788 | 0 |
Instantiate with data in `record`. | def __init__(self, record=None):
self.record = record | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _new_record():\n nonlocal key\n nonlocal value_list\n nonlocal record\n nonlocal origin\n nonlocal field_offset_map\n key = None\n value_list = None\n if source is not None:\n origin = Origin(source, None, None)\n field_offset_map = {}\n... | [
"0.7235988",
"0.7165694",
"0.6930202",
"0.6895159",
"0.6846218",
"0.6821071",
"0.68088585",
"0.66876",
"0.66790855",
"0.6578508",
"0.6575916",
"0.6553236",
"0.6496165",
"0.6494365",
"0.64263445",
"0.6400598",
"0.639081",
"0.6372391",
"0.63090974",
"0.6307076",
"0.6273901",
... | 0.7857227 | 0 |
Perist the state of the current instance to `STATE_PENDING` | def pending(self):
self.update({self.STATE: self.STATE_PENDING}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending(self):\n self.state = Step.State.PENDING",
"def pending(self, pending):\n\n self._pending = pending",
"def is_pending(self):\n return self._state == \"PENDING\"",
"def is_pending(self):\n return self.type_id == STATE_PENDING",
"def __init__(self, created_at=None):\n ... | [
"0.8087413",
"0.71778303",
"0.7121458",
"0.7102593",
"0.6938702",
"0.6796989",
"0.6575543",
"0.64872926",
"0.6450982",
"0.64054006",
"0.6393254",
"0.63800955",
"0.611548",
"0.6073752",
"0.5987666",
"0.5933847",
"0.5875658",
"0.5860062",
"0.58360183",
"0.58225495",
"0.5816052"... | 0.83847713 | 0 |
Perist the state of the current instance to `STATE_READY` | def ready(self):
self.update({self.STATE: self.STATE_READY}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ready(cls):\n sync_call(cls.ready)",
"def ready(cls):\n pass",
"def ready(self):\n pass",
"def init_state(self):\n if self.event == 'e_start':\n return 'RUNNING'\n else:\n return 'INIT'",
"def set_ready(self):\n if self.game.has_started()... | [
"0.7549581",
"0.7168628",
"0.7008004",
"0.698104",
"0.68835795",
"0.6735186",
"0.6704448",
"0.6637973",
"0.66207975",
"0.6592242",
"0.65886813",
"0.6583159",
"0.6531678",
"0.6526781",
"0.6459618",
"0.64209044",
"0.64183694",
"0.6412824",
"0.6411931",
"0.6391302",
"0.6382399",... | 0.81343806 | 0 |
Save `record` in this model's collection. Save the record in the model instance's collection and set the internal record of this instance to the passed in record. | def save(self, record):
self.collection.insert(record)
self.record = record
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, record):\n record = dict_for_mongo(record)\n id_dict = {'_id': self.record['_id']}\n self.collection.update(id_dict, {'$set': record})\n\n # Set record to the latest record from the database\n self.record = self.__class__.collection.find_one(id_dict)",
"def sav... | [
"0.6831833",
"0.6813052",
"0.6786624",
"0.6766821",
"0.672745",
"0.66924304",
"0.66618013",
"0.64472735",
"0.6430919",
"0.62607366",
"0.6143162",
"0.6107227",
"0.607896",
"0.60664856",
"0.6038548",
"0.59682995",
"0.5967654",
"0.5924792",
"0.5891098",
"0.5858306",
"0.5842989",... | 0.84877664 | 0 |
Update the current instance with `record`. Update the current model instance based on its `_id`, set it to the passed in `record`. | def update(self, record):
record = dict_for_mongo(record)
id_dict = {'_id': self.record['_id']}
self.collection.update(id_dict, {'$set': record})
# Set record to the latest record from the database
self.record = self.__class__.collection.find_one(id_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_record(self, record):\r\n self.record.editObject(record, id=record['id'])",
"def update_record(self, context, record):\n record = self.dns_manager.update_record(context, record)\n return record",
"def save(self, record):\n self.collection.insert(record)\n self.record... | [
"0.7203623",
"0.69081175",
"0.6783199",
"0.66866016",
"0.65707713",
"0.65177757",
"0.65079254",
"0.6474375",
"0.64504594",
"0.6401437",
"0.63269717",
"0.6310488",
"0.6303936",
"0.6261233",
"0.6183379",
"0.61272323",
"0.6050124",
"0.6013715",
"0.59891355",
"0.59642816",
"0.594... | 0.79660505 | 0 |
Enviem informacio d'error amb l'hora | def print_if_error(cadena):
print(time.strftime("%H:%M:%S ERROR => ") + cadena) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tzError(fpp, h, xiTz):\n return (h**3*fpp(xiTz))",
"def handleErrorTimeStamps(self,timeStamp,strCode,num1,num2):\r\n\r\n codeDict = {'A':' Millis() on Connect ', \\\r\n '@':' Input error on port ', \\\r\n '#':' Recovered from input error on port ', \\\r\n ... | [
"0.5816449",
"0.56747216",
"0.5656951",
"0.5615982",
"0.5574299",
"0.5558613",
"0.5524234",
"0.54830015",
"0.54642504",
"0.5453254",
"0.54436374",
"0.5436162",
"0.54008627",
"0.53850746",
"0.5329366",
"0.53266543",
"0.52901894",
"0.527243",
"0.5263929",
"0.52306575",
"0.52127... | 0.6825998 | 0 |
Al rebre un ALIVE_INF, busca l'equip i mira si esta REGISTERED o ALIVE i si esta tot correcte per enviar ALIVE_ACK | def control_manteniment_comunicacio(data, sock, address, equips, dades_serv):
for equip in equips:
if equip['nom'].__eq__(data[1:6]) and equip['mac'].__eq__(data[8:20]) and equip['estat'].__eq__('DISCONNECTED'):
enviar_alive_rej(sock, address, 'Equip no registrat al sistema.')
elif equip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Anchor_resetInactive(): \r\n global expectedMsgId\r\n DW1000.generalConfiguration(\"82:17:5B:D5:A9:9A:E2:9B\", C.MODE_LONGDATA_RANGE_ACCURACY) \r\n DW1000.registerCallback(\"handleSent\", handleSent)\r\n DW1000.registerCallback(\"handleReceived\", handleReceived)\r\n DW1000.setAntennaDelay(C.... | [
"0.581297",
"0.57275254",
"0.5559301",
"0.5532823",
"0.55250084",
"0.5452967",
"0.5430362",
"0.5415704",
"0.5409283",
"0.5393624",
"0.5343345",
"0.53172415",
"0.52974594",
"0.52707446",
"0.5260409",
"0.5255243",
"0.524142",
"0.5241078",
"0.52351815",
"0.5210721",
"0.5201382",... | 0.59280944 | 0 |
Mira si el client esta registrat, tupla format per Boolean i el nom de l'equip ('' en cas negatiu) | def es_client_registrat(data_tcp, equips):
for equip in equips:
if equip['nom'].__eq__(data_tcp[1:6]) and equip['mac'].__eq__(data_tcp[8:20]):
return True, equip['nom']
return False, '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirmacio_registre(data, sock, address, equips, dades_servidor):\n for equip in equips:\n if equip['nom'].__eq__(data[1:6]) and equip['mac'].__eq__(data[8:20]):\n if data[21:27].__eq__(equip['aleatori']) or not equip['estat'].__eq__('DISCONNECTED'):\n if equip['estat'].__e... | [
"0.65146273",
"0.5796324",
"0.5750673",
"0.55711573",
"0.5559948",
"0.5557206",
"0.5467569",
"0.54674476",
"0.5444221",
"0.54323006",
"0.5397379",
"0.5360595",
"0.5348783",
"0.53459936",
"0.5335289",
"0.532914",
"0.5312453",
"0.53036755",
"0.51902467",
"0.51808625",
"0.515670... | 0.69781876 | 0 |
Crea paquets amb pdu de TCP buits del tipus i amb les dades que vulguem | def create_empty_pack_tcp(type, data):
camps = ['', '', '', '']
llargada_camps = (7, 13, 7, 50)
index_camps = 0
for llargada in llargada_camps:
camps[index_camps] = camps[index_camps].zfill(llargada)
index_camps += 1
return struct.pack('c7s13s7s150s', chr(type), '', '', '', data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TCP(conn, addr):\n buffer = array('B', [0] * 300)\n cnt = 0\n while True:\n if cnt < 60000: cnt = cnt + 1\n else: cnt = 1\n try:\n conn.recv_into(buffer)\n TID0 = buffer[0] #Transaction ID to sync\n TID1 = buffer[1] #Transaction ID \n ... | [
"0.61352086",
"0.59879684",
"0.57681376",
"0.57606757",
"0.57170296",
"0.5563142",
"0.5558896",
"0.55546385",
"0.5544965",
"0.55166376",
"0.54358304",
"0.5376075",
"0.536106",
"0.5334791",
"0.52996576",
"0.5275537",
"0.5246903",
"0.5245928",
"0.5203505",
"0.5157321",
"0.51539... | 0.6065185 | 1 |
Envia el paquet SEND_REJ | def enviar_send_rej(sock):
pack = create_empty_pack_tcp(0x23, 'Dades de l\'equip incorrectes')
print_if_debug(DEBUG, 'Enviat ' + to_str_dades_udp(pack))
sock.send(pack) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendBuffer():\n dislin.sendbf()",
"def send(self, data):",
"def sendjob(self,bashscript):",
"def enviar_get_rej(sock):\n pack = create_empty_pack_tcp(0x33, 'Dades de l\\'equip incorrectes')\n print_if_debug(DEBUG, 'Enviat ' + to_str_dades_udp(pack))\n sock.send(pack)",
"def enviar(self, dat... | [
"0.5235911",
"0.5203341",
"0.51459414",
"0.50878793",
"0.5008606",
"0.4948326",
"0.49338228",
"0.49070644",
"0.48995352",
"0.4830632",
"0.4823637",
"0.48209107",
"0.47935465",
"0.4769925",
"0.47651932",
"0.47291052",
"0.47291052",
"0.47291052",
"0.47236082",
"0.4712547",
"0.4... | 0.5374625 | 0 |
Envia el GET_NACK amb el motiu | def enviar_get_nack(sock):
pack = create_empty_pack_tcp(0x32, 'Dades addicionals de l\'equip incorrectes')
print_if_debug(DEBUG, 'Enviat ' + to_str_dades_udp(pack))
sock.send(pack) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no():\r\n global RESPONSEOPTIONS\r\n if RESPONSEOPTIONS != []:\r\n RESPONSEOPTIONS.pop(0)\r\n else:\r\n print(\"RESPONSEOPTIONS - empty. connect a new state or reset\")",
"def enviar_get_rej(sock):\n pack = create_empty_pack_tcp(0x33, 'Dades de l\\'equip incorrectes')\n print_if_... | [
"0.54023534",
"0.53693277",
"0.532679",
"0.53202075",
"0.5179138",
"0.51729965",
"0.51420057",
"0.51280195",
"0.51213723",
"0.51191676",
"0.511034",
"0.50984395",
"0.50812984",
"0.50777936",
"0.50690585",
"0.50430274",
"0.5037807",
"0.50364345",
"0.502574",
"0.502138",
"0.501... | 0.5802217 | 0 |
Mira si existeix nom_equip.cfg, en cas afirmatiu envia l'ack, en cas negatiu envia rej | def enviar_get_ack(dades, sock, nom_equip, aleatori):
try:
open(nom_equip + '.cfg', 'r')
data = struct.pack('c7s13s7s150s', chr(0x31), dades['Nom'], dades['MAC'], aleatori, nom_equip + '.cfg')
print_if_debug(DEBUG, 'Enviat ' + to_str_dades_udp(data))
sock.send(data)
return no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_config(cfg):",
"def _check_config(self):",
"def is_config_exist(self) -> bool:\n return True",
"def is_config_exist(self) -> bool:\n pass",
"def check_equipped(self):\n equipped_str = \"\"\n for body_part, item in self.equipped.items():\n if item is None:\n ... | [
"0.5570157",
"0.5370317",
"0.5244698",
"0.5243483",
"0.52140296",
"0.51737195",
"0.5173416",
"0.51681477",
"0.50925905",
"0.5063546",
"0.5028734",
"0.50253963",
"0.50249565",
"0.50180584",
"0.49864903",
"0.49582854",
"0.49475574",
"0.49383968",
"0.49325103",
"0.49115512",
"0.... | 0.6313568 | 0 |
Realitza la connexio amb el servidor, tan per UDP com per TCP. | def connexio(dades, equips, quit_command):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print_if_debug(DEBUG, 'S\'ha creat el socket UDP')
def quit_handler(sign, frame):
""" signal_handler """
if sign == signal.SIG... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conectar(self):\r\n self.socket = socket.create_connection((self.host, self.puerto))",
"def connect(self):\n sock_version = socket.AF_INET if self.ip_version == 4 else socket.AF_INET6\n with socket.socket(sock_version, socket.SOCK_STREAM) as sock:\n sock.connect((self.server_i... | [
"0.6946073",
"0.6503651",
"0.638577",
"0.6377154",
"0.6376694",
"0.6366226",
"0.6305969",
"0.628578",
"0.61858004",
"0.61334884",
"0.61242527",
"0.6114042",
"0.6086634",
"0.60681707",
"0.6057783",
"0.6000794",
"0.59856653",
"0.5937445",
"0.5923484",
"0.59099764",
"0.59068274"... | 0.67724323 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.