query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Sample from model predictions, and evaluate outputs
def evaluate(self, model_idx, max_eval_batches=None, write_results=False, write_to_summary=True): # write_summary needs global_step self._step_collections["GlobalStep"] = ( self._sess.run(self._global_step_tensor)) # evalua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(model, test_files):\n print(\"Running predictions.\")\n models = load_model(model)\n predictions = predict(models, test_files)\n\n # # write predictions to file\n # write_predictions(\"evaluate_out.json\",predictions)\n evaluate_individual(predictions, test_files, models)\n evalua...
[ "0.7101722", "0.69548494", "0.6852271", "0.68520606", "0.674203", "0.6641309", "0.6640077", "0.6571293", "0.6543363", "0.6491229", "0.64878094", "0.64876974", "0.6486447", "0.6455267", "0.6448493", "0.6428464", "0.6425249", "0.64173007", "0.6415146", "0.64122653", "0.64120877...
0.0
-1
BiLSTM with max pooling, but ignore sequence_2
def _build_single_stream_model(self, data, embedding_fn, encoder_fn_1, encoder_fn_2, logits_fn): # Build the Model # ---...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Bilstm(self):\n # Model.\n model = Sequential()\n # model.add(Bidirectional(LSTM(2048, return_sequences=True),input_shape=self.input_shape))\n # model.add(Bidirectional(LSTM(2048))) id identification is 2048\n model.add(Bidirectional(LSTM(2048, return_sequences=True), input_...
[ "0.65396965", "0.61001", "0.5983156", "0.59826714", "0.59388393", "0.5922987", "0.5872958", "0.581099", "0.5691466", "0.565373", "0.5635273", "0.56306946", "0.557437", "0.5521328", "0.5492911", "0.5480712", "0.54760426", "0.54644793", "0.5460992", "0.54517883", "0.5438166", ...
0.0
-1
BiLSTM with max pooling from
def _build_dual_stream_model(self, data, embedding_fn, encoder_fn_1, encoder_fn_2, logits_fn): # Build the Model # ------------------------...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Bilstm(self):\n # Model.\n model = Sequential()\n # model.add(Bidirectional(LSTM(2048, return_sequences=True),input_shape=self.input_shape))\n # model.add(Bidirectional(LSTM(2048))) id identification is 2048\n model.add(Bidirectional(LSTM(2048, return_sequences=True), input_...
[ "0.6490568", "0.6294879", "0.6215612", "0.61869", "0.6159668", "0.6138382", "0.61137885", "0.60936844", "0.60936844", "0.6069494", "0.6038459", "0.60350174", "0.6011682", "0.60092825", "0.6007879", "0.6004979", "0.6004979", "0.6004979", "0.5997644", "0.59830004", "0.594934", ...
0.0
-1
Run python version inside of a docker image and get its semantic version number.
def get_python_version(self, dock_image: str) -> str: # version string typically looks like: "Python 3.9.2" # But other variations exist such as: "Python 3.6.9 :: Anaconda, Inc." # and for whatever reason, the conda version prints to stderr instead... python_version_string: str = check_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _get_python_version(user_image, python_binary) -> packaging.version.Version:\n\n proc = await asyncio.create_subprocess_exec(\n \"docker\",\n \"run\",\n \"--rm\",\n user_image,\n python_binary,\n \"--version\",\n stdout=subprocess.PIPE,\n stderr=...
[ "0.7416897", "0.6631516", "0.6582976", "0.65689105", "0.65503365", "0.6505324", "0.6406864", "0.6402115", "0.6245161", "0.62432474", "0.62357765", "0.6217067", "0.6191909", "0.613984", "0.6055866", "0.6053228", "0.5995903", "0.5990503", "0.5981206", "0.59631395", "0.59099054"...
0.67462885
1
Attempt to find the resource directory for the python package of the ChRIS plugin. It usually looks like /usr/local/lib/python3.9/sitepackages/something If unsuccessful, return empty string.
def find_resource_dir(self, dock_image: str, meta: dict) -> str: try: return self.interrogate_python_package_location(dock_image, meta) except CalledProcessError: return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource(self, rsc_path):\n\n\t\ttry:\n\t\t\tfrom pkg_resources import resource_filename\n\t\t\treturn resource_filename(__name__, rsc_path)\n\t\texcept ImportError:\n\t\t\treturn os.path.join(os.path.dirname(__file__), rsc_path)", "def get_package_dir():\n return Path(__file__).parent", "def _get_d...
[ "0.6721056", "0.6668326", "0.6601748", "0.6568538", "0.6526997", "0.64291966", "0.63636035", "0.63410276", "0.62239856", "0.6217715", "0.6213123", "0.6172258", "0.6157969", "0.61543185", "0.613424", "0.61182326", "0.60999566", "0.6063436", "0.6055837", "0.60502505", "0.604980...
0.70710635
0
Generate a shell script for running a dockerized ChRIS plugin.
def compile_plugin(self, dock_image: str, linking='dynamic') -> str: if linking not in ['static', 'dynamic']: raise ValueError('linking must be either "static" or "dynamic"') api = ShellBuilderApi(self.config) engine = api.engine() info = PythonImageInfo(engine) # TO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docker_sh():\n docker_exec('/bin/bash')", "def dockerfile() -> co.Exec:\n image = co.Image(dockerfile=\"./docker/Dockerfile.simple\")\n return co.Exec(\n f\"python -c '{pretty_table_script}'\", image=image, doc=co.util.magic_doc()\n )", "def docker_build(c):\n cli_tasks.docker_build.r...
[ "0.5865527", "0.5817266", "0.5726802", "0.56655383", "0.56499326", "0.56055737", "0.5604115", "0.55538315", "0.554898", "0.5518906", "0.54707164", "0.546558", "0.5464381", "0.5380448", "0.5358491", "0.5346705", "0.5340719", "0.5312728", "0.53005457", "0.52647114", "0.5260788"...
0.52670395
19
Same as get_plugin_cmd but if unsuccessful, print some advice and exit.
def test_the_waters(self, dock_image: str): engine = ShellBuilderApi(self.config).engine() try: return PythonImageInfo(engine).get_plugin_cmd(dock_image) except PluginMetaLookupError as e: print('Failed to get plugin meta', end=': ') print(e) prin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_specific_plugin_not_installed(self):\n self._add_plugin(self.jigconfig, 'plugin01')\n set_jigconfig(self.gitrepodir, config=self.jigconfig)\n\n # Create staged\n self.commit(self.gitrepodir, 'a.txt', 'a')\n self.stage(self.gitrepodir, 'b.txt', 'b')\n\n with nested...
[ "0.65437466", "0.62526155", "0.619401", "0.6043565", "0.5989061", "0.59795517", "0.5834357", "0.57178366", "0.5651055", "0.5617419", "0.5535857", "0.5530768", "0.55039674", "0.5490266", "0.5488291", "0.54774445", "0.54476714", "0.5432186", "0.5428482", "0.5412004", "0.5407408...
0.0
-1
Script to clean a given case.
def main(): args = read_inputs() Case(args.path) print 'case path: %s' % Case.path print '[info]: cleaning mesh and force coefficients' os.system('rm -f '+Case.path+'/*.dat') print '[info]: cleaning solution folders' for i in xrange(10): os.system('rm -rf '+Case.path+'/'+str(i)+'*') print '[info]: cleanin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(c):", "def RemoveCase(dirc):\n if os.path.exists(dirc):\n shutil.rmtree(dirc)\n #subprocess.call(['rm', '-r', dirc])", "def clean(_context):", "def hxlclean():\n run_script(hxlclean_main)", "async def clearcases(self, ctx, problem_name):\n if not await problem_exists(ctx, p...
[ "0.6394602", "0.6388809", "0.5800998", "0.56710964", "0.56026864", "0.5589458", "0.5588989", "0.55696267", "0.55633765", "0.55631894", "0.55501896", "0.5522124", "0.5501598", "0.54972", "0.543099", "0.53682435", "0.530929", "0.53045577", "0.52781314", "0.52335", "0.5228231", ...
0.669353
0
Remove a file or a directory.
def remove(src): if os.path.isfile(src): os.remove(src) elif os.path.isdir(src): shutil.rmtree(src)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(file_or_dirname: str):\n if osp.exists(file_or_dirname):\n if osp.isdir(file_or_dirname):\n shutil.rmtree(file_or_dirname, ignore_errors=True)\n if osp.isfile(file_or_dirname):\n os.remove(file_or_dirname)", "def remove(path):\n if os.path.isdir(path):\n ...
[ "0.7849267", "0.78304523", "0.7714936", "0.7685656", "0.7685656", "0.7676818", "0.7676818", "0.7666824", "0.76544356", "0.7637967", "0.76119035", "0.7565476", "0.7549089", "0.7525484", "0.75132424", "0.75080544", "0.7471931", "0.74607474", "0.731739", "0.7316478", "0.730325",...
0.74683315
17
Copy a file or directory to a future destination.
def copy(src, dst, ignore=False, force=False): if not os.path.exists(src) and not ignore: raise FileNotFoundError("'%s' is not found." % src) if os.path.isfile(src): if os.path.exists(dst): if not ignore and not force: raise FileExistsError("'%s' is exist." % dst) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_file ( self, source, dest ):\n return", "def copyfile(self, destination, **kwargs):\n assert _os.path.isfile(self.__str__()) == True\n _shutil.copyfile(self.__str__(), destination, **kwargs)", "def cp(self, src, dest):\r\n return self._call(\"-cp\", src, dest, suppress_output=Tr...
[ "0.73302346", "0.70401216", "0.6996331", "0.6920589", "0.6886142", "0.67921764", "0.6729284", "0.66975254", "0.66690886", "0.66571426", "0.66570395", "0.6654941", "0.66509396", "0.6587886", "0.658738", "0.6567847", "0.65257835", "0.65162915", "0.6507118", "0.649342", "0.64763...
0.0
-1
Move a file or directory to a future destination.
def move(src, dst, ignore=False, force=False): copy(src, dst, ignore, force) remove(src)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_file(source, destination):\n shutil.move(source, destination)", "def move_file(self, path: PathLike, dest: PathLike, force: bool = False):", "def move(self, destination, **kwargs):\n assert _os.path.exists(self.__str__()) == True\n _shutil.move(self.__str__(), destination, **kwargs)",...
[ "0.74208075", "0.7298211", "0.70145404", "0.69194704", "0.68873274", "0.6720547", "0.66964126", "0.6631833", "0.66137534", "0.6604414", "0.65643126", "0.6534053", "0.65298843", "0.6515625", "0.6511343", "0.64865124", "0.6470165", "0.64249253", "0.6424211", "0.64221215", "0.64...
0.6062482
41
Create a new API class for your application. 'root' shoudl be your base route, and routes is a mapping of routeshortname > path suffix for your API.
def API(root, **routes): # this creats a dict of properties that create Senders for # all the friendly name --> suffix combidantions passed in props = {'root': Route(root)} for (short, path) in routes.iteritems(): props[short] = lambda self, content: self.sender.send_path(path, content) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app():\r\n app = Flask(__name__, instance_relative_config=False)\r\n app.config.from_object('config.Config') \r\n \r\n api = Api(app) \r\n \r\n with app.app_context():\r\n from .flights import TicketRoute, FlightRoute\r\n api.add_resource(TicketRoute,\"/api/ticket...
[ "0.73801404", "0.7200694", "0.71829164", "0.6970352", "0.671085", "0.67097706", "0.67093503", "0.6705557", "0.6694073", "0.66517067", "0.6583034", "0.6547196", "0.64564484", "0.64072907", "0.6406355", "0.6401527", "0.63456136", "0.63084906", "0.62602186", "0.6221953", "0.6214...
0.75148106
0
function to patch over exit_json; package return data into an exception
def exit_json(*args, **kwargs): if 'changed' not in kwargs: kwargs['changed'] = False raise AnsibleExitJson(kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cli_format_error_handler_broken_json():\n resp = MagicMock()\n resp.json.side_effect = ValueError(\"\")\n resp.text = \"Not JSON\"\n output = format_utils.cli_format_error_handler(resp)\n assert 'Error: Unable to decode response. Value: Not JSON' in output", "def test_cli_format_error_han...
[ "0.6422005", "0.6011262", "0.58930314", "0.5873814", "0.5736965", "0.5635676", "0.55465096", "0.5507798", "0.55060387", "0.5482061", "0.54793316", "0.547902", "0.54240453", "0.5421341", "0.5397868", "0.539718", "0.53748244", "0.53737676", "0.5362257", "0.53568584", "0.5345366...
0.70887923
0
function to patch over fail_json; package return data into an exception
def fail_json(*args, **kwargs): kwargs['failed'] = True raise AnsibleFailJson(kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cli_format_error_handler_broken_json():\n resp = MagicMock()\n resp.json.side_effect = ValueError(\"\")\n resp.text = \"Not JSON\"\n output = format_utils.cli_format_error_handler(resp)\n assert 'Error: Unable to decode response. Value: Not JSON' in output", "def process_json(self, data):...
[ "0.7065039", "0.6566227", "0.655377", "0.6433542", "0.6402148", "0.6363974", "0.63553065", "0.63401806", "0.62943906", "0.6246136", "0.6231559", "0.62160605", "0.6212979", "0.61676127", "0.6163638", "0.6131823", "0.60966325", "0.6095224", "0.60862505", "0.60569715", "0.604183...
0.71612245
0
prepare arguments so that they will be picked up during module creation
def set_module_args(args): args = json.dumps({'ANSIBLE_MODULE_ARGS': args}) basic._ANSIBLE_ARGS = to_bytes(args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_arguments(self, parser):\n pass", "def _prepare(self):\n # Customize commandline arguments\n parser = argparse.ArgumentParser()\n self.initArgumentParser(parser, defaults=self.default_binding_overrides)\n self.__options = parser.parse_args()\n self.__bindings.update(args_util.pa...
[ "0.76967007", "0.71010435", "0.6964001", "0.6887841", "0.669962", "0.6676757", "0.657058", "0.6560541", "0.6521241", "0.6517541", "0.65066904", "0.64621484", "0.6457191", "0.6456913", "0.6422021", "0.631883", "0.6316088", "0.63051707", "0.63043374", "0.6299369", "0.6293147", ...
0.6311913
17
Create a new yard.
def __init__(self, name: str) -> None: logger.debug(f'Executing Yard __init__ with name:{name}') self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(request: YardRequestCreate) -> Yard:\n logger.debug(f'Executing Yard create with request:{request}')\n return Yard(request.name)", "def __init__(self, name: str, yard_id: Optional[int] = None) -> None:\n self._name = name\n if yard_id:\n self._yard_id = yard_id",...
[ "0.7494531", "0.568594", "0.5662496", "0.56039697", "0.56039697", "0.54037803", "0.53043294", "0.52780956", "0.5270102", "0.5120752", "0.5120752", "0.5120752", "0.5114537", "0.510326", "0.50686073", "0.50561523", "0.502217", "0.5009028", "0.49991226", "0.4990616", "0.49758244...
0.52229035
9
Return a new yard.
def create(request: YardRequestCreate) -> Yard: logger.debug(f'Executing Yard create with request:{request}') return Yard(request.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rythm(self, dev):\n new_rythm = rythm.Rythm()\n new_rythm.rythm_from_distr(duration, self.density)\n\n return new_rythm", "def __init__(self, name: str, yard_id: Optional[int] = None) -> None:\n self._name = name\n if yard_id:\n self._yard_id = yard_id", ...
[ "0.5590437", "0.54014885", "0.5362551", "0.53325903", "0.5188523", "0.5162973", "0.50443614", "0.50316876", "0.50179154", "0.50179154", "0.49858508", "0.49775422", "0.49506262", "0.4945812", "0.48390582", "0.48362887", "0.48228404", "0.482089", "0.48181245", "0.47931927", "0....
0.7020021
0
Create a new garden.
def __init__(self, name: str, yard_id: Optional[int] = None) -> None: self._name = name if yard_id: self._yard_id = yard_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(request: GardenRequestCreate) -> Garden:\n if request.yard_id:\n garden = Garden(request.name, request.yard_id)\n else:\n garden = Garden(request.name)\n return garden", "def create(request: BedRequestCreate) -> Bed:\n if request.garden_id:\n ...
[ "0.8164369", "0.6483629", "0.5973436", "0.5973436", "0.58737355", "0.5726", "0.5716766", "0.5716766", "0.5716766", "0.56845754", "0.567218", "0.5657812", "0.5549825", "0.54623795", "0.5422505", "0.5414858", "0.5364724", "0.535799", "0.5349133", "0.5321988", "0.5304222", "0....
0.0
-1
Return a new garden.
def create(request: GardenRequestCreate) -> Garden: if request.yard_id: garden = Garden(request.name, request.yard_id) else: garden = Garden(request.name) return garden
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(request: BedRequestCreate) -> Bed:\n if request.garden_id:\n bed = Bed(request.name, request.yard_id, request.garden_id)\n else:\n bed = Bed(request.name, request.yard_id)\n return bed", "def new(cls):\n return cls()", "def new_room(self):\r\n ...
[ "0.5969182", "0.55627793", "0.53683287", "0.53473854", "0.53283143", "0.5322329", "0.52581275", "0.5212227", "0.5196043", "0.51944935", "0.51816285", "0.5158744", "0.5142977", "0.5117961", "0.5069754", "0.50693375", "0.50672984", "0.5046749", "0.5021479", "0.5010107", "0.4999...
0.7625244
0
Create a new bed.
def __init__( self, name: str, yard_id: int, garden_id: Optional[int] = None, ) -> None: logger.debug( f'Executing Bed __init__ with name: {name},' f'yard_id: {yard_id} and garden_id: {garden_id}', ) self._name = name self._yard...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(request: BedRequestCreate) -> Bed:\n if request.garden_id:\n bed = Bed(request.name, request.yard_id, request.garden_id)\n else:\n bed = Bed(request.name, request.yard_id)\n return bed", "def make_bed(lines, num):\n f = get_prereqs(num)\n with open(f, '...
[ "0.6885664", "0.5910571", "0.5840972", "0.5840972", "0.57267797", "0.56706005", "0.56522185", "0.55992997", "0.5547432", "0.55409247", "0.5525808", "0.55080783", "0.5500319", "0.54551196", "0.54484475", "0.5447523", "0.54355776", "0.54355776", "0.54355776", "0.5376025", "0.53...
0.4990907
68
Return a new bed.
def create(request: BedRequestCreate) -> Bed: if request.garden_id: bed = Bed(request.name, request.yard_id, request.garden_id) else: bed = Bed(request.name, request.yard_id) return bed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplify_bed(fbed, has_header):\n line_gen = reader(fbed, header=False)\n header = line_gen.next() if has_header else None\n fh = open(BedTool._tmp(), \"w\")\n for toks in line_gen:\n new_toks = toks[:3] + [\"Z_Z\".join(toks), \".\",\n toks[5] if len(toks) > 5 ...
[ "0.58296984", "0.5644907", "0.5551764", "0.5321915", "0.53026086", "0.52609533", "0.5244851", "0.52361184", "0.51136595", "0.5104737", "0.5095381", "0.50601125", "0.50565517", "0.50565517", "0.50280887", "0.502569", "0.49909022", "0.49824548", "0.4973729", "0.49398288", "0.49...
0.65561134
0
Create a new plant.
def __init__(self, name, bed_id) -> None: logger.debug( f'Executing Plant __init with name:{name}, bed_id:{bed_id} ', ) self._name = name self._bed_id = bed_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(request: PlantRequestCreate) -> Plant:\n logger.debug(f'Executing Plant create with request:{request}')\n return Plant(request.name, request.bed_id)", "def create_unit(name, plant_id):\n Sections.create(name=name, plant=plant_id)", "def add_plant(plant_type): # noqa: E501\n glob...
[ "0.7776638", "0.68671316", "0.6758583", "0.6535089", "0.6380151", "0.63326854", "0.6307291", "0.6208937", "0.6197248", "0.60928243", "0.59974295", "0.59974295", "0.59476334", "0.5884455", "0.58510983", "0.5839649", "0.5767345", "0.57539916", "0.57097006", "0.5665074", "0.5663...
0.5987805
12
Return a new Plant.
def create(request: PlantRequestCreate) -> Plant: logger.debug(f'Executing Plant create with request:{request}') return Plant(request.name, request.bed_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_plant(plant_type): # noqa: E501\n global seededPlants\n global tasks\n\n if not seededPlants.get(plant_type):\n seededPlants[plant_type] = 0\n \n pid = db.addPlant(plant_type)\n plant = Plant(plant_id=pid, plant_type=plant_type)\n seededPlants[plant_type] += 1\n\n #clean up ...
[ "0.62443143", "0.60929143", "0.6055948", "0.5976038", "0.5604454", "0.558746", "0.55310094", "0.54382646", "0.54322815", "0.53988934", "0.53903615", "0.5373456", "0.537302", "0.5348257", "0.5344622", "0.5341449", "0.53242874", "0.5299267", "0.52762425", "0.52678794", "0.52597...
0.7463095
0
Compute the lowrank operator, the eigenquantities and slow modes.
def compute_operator(self, Xc, Yc): U, s, V = self._compute_svd(Xc) self._Atilde = (np.linalg.multi_dot([U.T.conj(), (Yc), (V)]) * np.reciprocal(s)) self._compute_eigenquantities() self._compute_modes(Yc, U, s, V) self._slow_modes = (np.abs(old_div(np.log(self.eig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def low_rank_approximation(LinearOperator: Union[ToeplitzMatrixFree, LinearOperatorFromMatrix], rank: int,\n hermitian: bool = False, tol: float = 0., backend='scipy') -> np.ndarray:\n if rank >= np.min(LinearOperator.shape):\n return LinearOperator.mat\n elif backend == 'num...
[ "0.59569466", "0.53253007", "0.526049", "0.5103837", "0.5011966", "0.4989868", "0.49648058", "0.49209514", "0.49070564", "0.4901999", "0.48523378", "0.48302522", "0.47786745", "0.47545192", "0.47301328", "0.47296545", "0.47243336", "0.47148207", "0.4714738", "0.47038925", "0....
0.48401913
11
Compute the ampltitudes for slow modes of this sub DMD operator.
def compute_sub_amplitudes(self, Xc, opt): if opt: # compute the vandermonde matrix omega = old_div(np.log(self.eigs), self.original_time['dt']) vander = np.exp( np.multiply(*np.meshgrid(omega, self.dmd_timesteps))).T # perform svd on all the sna...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idealOpAmp():", "def amplitudes(self,dataset):\n if ((dataset ==\"GPCP\") or (dataset == \"CMAP\")):\n start = '1979-1-1'\n stop = '2014-12-31'\n else:\n start = '1984-1-1'\n if dataset == \"ISCCP_raw\":\n stop = '2007-12-31'\n ...
[ "0.64523596", "0.6316284", "0.6023735", "0.59572893", "0.57390773", "0.5645965", "0.55997556", "0.5442499", "0.5416894", "0.5408983", "0.53514624", "0.53022027", "0.5294435", "0.5264709", "0.5228918", "0.5207272", "0.5185819", "0.5171698", "0.50277674", "0.5026909", "0.502029...
0.47320998
57
Compute the MrDMD operator, modes, amplitudes and eigenvalues.
def compute_operator(self, snapshots): # To avoid recursion function, use FIFO list to simulate the tree # structure data_queue = [snapshots.copy()] current_bin = 0 while data_queue: Xraw = data_queue.pop(0) n_samples = Xraw.shape[1] step =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rdm(self): \n\n # Check if CCSD calculation is performed\n if not self.cc_fragment:\n raise RuntimeError(\"Cannot retrieve RDM because no simulation has been run.\")\n\n # Solve the lambda equation and obtain the reduced density matrix from CC calculation\n sel...
[ "0.5778966", "0.56038797", "0.5406194", "0.53687596", "0.5319528", "0.5314805", "0.52992195", "0.52947414", "0.5274281", "0.52448976", "0.51809436", "0.516814", "0.51606435", "0.51417494", "0.5101703", "0.5083811", "0.5064862", "0.5062005", "0.4986676", "0.4984563", "0.498320...
0.45844302
90
Private method that return the right index element from a given level and node.
def _index_list(self, level, node): if level >= self._max_level: raise ValueError("Invalid level: greater than `max_level`") if node >= 2**level: raise ValueError("Invalid node") return 2**level + node - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level_to_index(level: int) -> int:\n\n level_data = {\n 15: 1,\n 25: 2,\n 30: 3,\n 35: 4,\n 40: 5,\n 45: 6,\n 50: 7,\n }\n return level_data[level]", "def right_child_idx(idx):\n return (idx + 1) << 1", "def tree_idx(tree,j1,J1,J2):\n j = j1\n...
[ "0.6774914", "0.65624154", "0.6238155", "0.62297726", "0.61812085", "0.61276853", "0.61116254", "0.6070355", "0.6063867", "0.60625076", "0.6038421", "0.59762305", "0.5957084", "0.5940464", "0.592238", "0.59021884", "0.58770186", "0.5868177", "0.58489066", "0.5830463", "0.5815...
0.77435327
0
Method that return the level and node given the index of the bin.
def _index_list_reversed(self, index): if index > 2**self._max_level - 2: raise ValueError("Invalid index: maximum index is ({})".format(2**self._max_level - 2)) for lvl in range(self._max_level + 1): if index < 2**lvl - 1: break level = lvl - 1 no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def what_level(index):\n if index == [1,1] or [1,2]:\n level = 1\n else:\n level = 0\n return level", "def get_node_indices_and_levels(nd: np.ndarray):\n indices = []\n lvs = []\n for j in range(1, nd.shape[0]):\n if j == 1:\n indices = nd[j]\n lvs = n...
[ "0.6595346", "0.63736695", "0.610129", "0.6084127", "0.60095966", "0.59009176", "0.57808703", "0.57083344", "0.568954", "0.56878525", "0.5673797", "0.5669853", "0.5658403", "0.56557393", "0.56169474", "0.55956525", "0.55331624", "0.55331624", "0.547583", "0.5472164", "0.54666...
0.59511775
5
Evaluate the start and end time and the period of a given bin.
def partial_time_interval(self, level, node): if level >= self._max_level: raise ValueError( 'The level input parameter ({}) has to be less than the ' 'max_level ({}). Remember that the starting index is 0'.format( level, self._max_level)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bintime(s,tunit,timebin,nanval): \r\n #same functionality can make use of pandas.cut\r\n #but have to convert column to seconds and bin accordingly i.e:\r\n #pd.cut(test.dt.seconds,[i*3600 for i in [1,2,3,4,5]],labels=[1,2,3,4])\r\n #and use pd.fillna(lastbin) for stuff outside bin\r\n #.cat....
[ "0.6374719", "0.6116384", "0.61071175", "0.58316433", "0.5764144", "0.552417", "0.5509737", "0.5422938", "0.54196686", "0.53205734", "0.53093106", "0.52903247", "0.5272032", "0.5247645", "0.5236844", "0.5235189", "0.5226849", "0.51880866", "0.51742667", "0.5172404", "0.516558...
0.0
-1
Find which bins are embedded (partially or totally) in a given time window.
def time_window_bins(self, t0, tend): indexes = [] for level in range(self._max_level): for i in range(2**level): local_times = self.partial_time_interval(level, i) if t0 >= local_times['t0'] and t0 < local_times['tend']: indexes.append(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findBins(): \n\n df = pd.read_csv('significantData.csv')\n df = df.sort_values('RecordingTimestamp')\n df.to_csv('significantData.csv', index=False)\n read_in = pd.read_csv('significantData.csv')\n count = 0\n this = []\n return_bins = {}\n word = (read_in['AOI[Neutral_Left]Hit_0']).tol...
[ "0.6001422", "0.5979062", "0.594558", "0.594434", "0.5746636", "0.5718944", "0.57073534", "0.5705244", "0.56227374", "0.56131464", "0.5604326", "0.5554541", "0.54681987", "0.5468194", "0.54643685", "0.5439552", "0.5434822", "0.54274553", "0.54239434", "0.54058325", "0.5384072...
0.66132635
0
Get the eigenvalues relative to the modes of the bins embedded (partially or totally) in a given time window.
def time_window_eigs(self, t0, tend): indexes = self.time_window_bins(t0, tend) return np.concatenate([self.operator.eigenvalues[idx] for idx in indexes])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eigenvalues(self) -> ndarray:\n return self._vals", "def energies_kev(self):\n\n if not self.is_calibrated:\n raise UncalibratedError('Spectrum is not calibrated')\n else:\n return bin_centers_from_edges(self.bin_edges_kev)", "def get_energy_per_eigenmode(self, A,...
[ "0.58370894", "0.55990386", "0.5529404", "0.55293566", "0.54781204", "0.5472124", "0.54494846", "0.5428456", "0.5418676", "0.5387911", "0.536809", "0.5356477", "0.5334652", "0.5331583", "0.53295034", "0.53018385", "0.5245877", "0.52443105", "0.5238841", "0.5225844", "0.521438...
0.65667236
0
Get the frequencies relative to the modes of the bins embedded (partially or totally) in a given time window.
def time_window_frequency(self, t0, tend): eigs = self.time_window_eigs(t0, tend) return np.log(eigs).imag/(2*np.pi*self.original_time['dt'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_freq_grid():\n (bins_per_octave, n_octaves, _, _, f_min, _) = get_hcqt_params()\n freq_grid = librosa.cqt_frequencies(\n bins_per_octave*n_octaves, f_min, bins_per_octave=bins_per_octave\n )\n return freq_grid", "def get_frequencies(self):\n num_seconds = float(self.timestamps[-...
[ "0.64852643", "0.6022063", "0.600808", "0.5990645", "0.5934242", "0.58441705", "0.5806996", "0.5801756", "0.5784977", "0.5745337", "0.5737657", "0.5725346", "0.5717773", "0.5688955", "0.5539359", "0.5526732", "0.5491822", "0.5462235", "0.5460768", "0.5458569", "0.5438181", ...
0.56093067
14
Get the growth rate values relative to the modes of the bins embedded (partially or totally) in a given time window.
def time_window_growth_rate(self, t0, tend): return self.time_window_eigs(t0, tend).real/self.original_time['dt']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agg_angular_difference_timebins(\n data: np.ndarray, fps: int, time_windows: np.ndarray\n ):\n\n data = np.deg2rad(data)\n results = np.full((data.shape[0], time_windows.shape[0]), 0.0)\n for time_window_cnt in prange(time_windows.shape[0]):\n window_size = int(time_wi...
[ "0.5529094", "0.5523554", "0.5503484", "0.54993916", "0.5434323", "0.53816473", "0.5339452", "0.53023434", "0.52874565", "0.52680075", "0.52517766", "0.52330875", "0.5208008", "0.51964575", "0.5183654", "0.5037942", "0.5031358", "0.5001336", "0.49898788", "0.49898517", "0.498...
0.597104
0
Get the amplitudes relative to the modes of the bins embedded (partially or totally) in a given time window.
def time_window_amplitudes(self, t0, tend): indexes = self.time_window_bins(t0, tend) return np.concatenate([self._b[idx] for idx in indexes])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_delta_amplitude_map(self, timeWindow=(0, 0.5)):\n\n windowIndex = np.logical_and(self.time >= timeWindow[0], self.time <= timeWindow[1])\n\n baseline_index = self.time < 0\n\n indON, indOFF, allAltPos, allAziPos = self._sort_index()\n\n ampON = np.zeros(indON.shape);\n am...
[ "0.61568254", "0.614928", "0.60325503", "0.5697051", "0.5682277", "0.5591686", "0.5508283", "0.5396303", "0.5369054", "0.5282058", "0.5267988", "0.51722425", "0.51637036", "0.51363", "0.51329863", "0.51173633", "0.5084328", "0.5062478", "0.50547963", "0.5042427", "0.50259316"...
0.5973946
3
Get the reconstructed data.
def reconstructed_data(self): try: data = np.sum( np.array([ self.partial_reconstructed_data(i) for i in range(self._max_level) ]), axis=0) except MemoryError: data = np.array(self.partial_rec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(self):\r\n return self.data.copy()", "def get_data(self):\n return self.parsed_data", "def get_data(self): # TODO: add smooth possibility\n return self.data", "def get_data(self):\n return self.data", "def get_data(self):\n return self.data", "def get_data...
[ "0.7384807", "0.71945983", "0.71018094", "0.70430684", "0.70430684", "0.70430684", "0.69570875", "0.69570875", "0.6895617", "0.68922836", "0.68922836", "0.68922836", "0.68922836", "0.68888223", "0.6882917", "0.6882917", "0.6856862", "0.6804822", "0.67907304", "0.67694813", "0...
0.72060883
1
Get the matrix containing the DMD modes, stored by column.
def modes(self): return np.hstack(tuple(self.operator.modes))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Dmat(self):\n return self._Dmat_cache", "def matrix(self):\n return np.matrix(list(self._columns.values()))", "def all_modes(self):\n\n # Find \"post-proj all modes\"\n # Jump to first value, ignoring text.\n # Move through data, adding it to a list\n # continue o...
[ "0.5767924", "0.5739843", "0.56482184", "0.5603151", "0.5537699", "0.55024064", "0.5490287", "0.5476487", "0.546271", "0.5382778", "0.5382778", "0.5339894", "0.53048295", "0.5280998", "0.526192", "0.5253967", "0.5238287", "0.5233126", "0.52254516", "0.521381", "0.52133495", ...
0.5954592
0
Get the time evolution of each mode.
def dynamics(self): return np.vstack( tuple([self.partial_dynamics(i) for i in range(self._max_level)]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getTimeEvolution(self, target):\n omega = np.log(self._eigs[target]) / self.timeScales['training']['dt']\n van = np.exp(np.multiply(*np.meshgrid(omega, self._getTimeScale())))\n timeEvol = (van * self._amplitudes[target]).T\n return timeEvol", "def evolution_time(self) -> float:\n return...
[ "0.6839359", "0.6549283", "0.6227073", "0.6013248", "0.5949761", "0.5684334", "0.56656706", "0.5637081", "0.5608758", "0.55948883", "0.55948883", "0.55948883", "0.55287373", "0.54801244", "0.5432319", "0.5413853", "0.5387543", "0.53859884", "0.53819513", "0.53752744", "0.5368...
0.0
-1
Get the eigenvalues of A tilde.
def eigs(self): return np.concatenate(self.operator.eigenvalues)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analytical_eig(A):\n n = len(A)\n h = 1/float(n)\n d = 2/float(h)**2\n a = -1/float(h)**2\n eigenval = np.empty(n)\n for j in range(1,n+1):\n eigenval[j-1] = d + 2*a*np.cos((j*np.pi)/(float(n)+1)) # Analytic solution\n \n return eigenval", "def eigenvalues(self) -> ndarray:...
[ "0.72104555", "0.7190363", "0.70601994", "0.7048385", "0.7045235", "0.67723763", "0.6767977", "0.6764434", "0.6653182", "0.6632767", "0.66069925", "0.6577262", "0.65724695", "0.65546983", "0.65340793", "0.6508823", "0.6507871", "0.65059394", "0.6457978", "0.64440125", "0.6336...
0.62570524
24
Return the modes at the specific `level` and at the specific `node`; if `node` is not specified, the method returns all the modes of the given `level` (all the nodes).
def partial_modes(self, level, node=None): if node: return self.operator.modes[self._index_list(level, node)] indeces = [self._index_list(level, i) for i in range(2**level)] return np.hstack(tuple([self.operator.modes[idx] for idx in indeces]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getnodelevels(self, node_p=None):\n node_p = self.getnodenamed(node_p) # Verify pointer.\n\n node_type = self.getnodetype(node_p)\n nstates = self.getnodenumberstates(node_p)\n if node_type == 1:\n # CONTINUOUS_TYPE\n nlevels = nstates + 1\n else:\n ...
[ "0.5354951", "0.5319307", "0.5265018", "0.5101411", "0.49746078", "0.49388418", "0.48589152", "0.4831829", "0.4802974", "0.47775087", "0.47509822", "0.46844825", "0.4642154", "0.4642027", "0.4636629", "0.46062893", "0.4591814", "0.45781466", "0.45590946", "0.4550383", "0.4544...
0.70844233
0
Return the time evolution of the specific `level` and of the specific `node`; if `node` is not specified, the method returns the time evolution of the given `level` (all the nodes).
def partial_dynamics(self, level, node=None): def dynamic(eigs, amplitudes, step, nsamples): omega = old_div( np.log(np.power(eigs, old_div(1., step))), self.original_time['dt']) partial_timestep = np.arange(nsamples) * self.dmd_time['dt'] van...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_time_interval(self, level, node):\n if level >= self._max_level:\n raise ValueError(\n 'The level input parameter ({}) has to be less than the '\n 'max_level ({}). Remember that the starting index is 0'.format(\n level, self._max_level)...
[ "0.59325534", "0.52588916", "0.5043633", "0.495186", "0.47398475", "0.47092786", "0.4535963", "0.45331597", "0.45329937", "0.4521009", "0.45167947", "0.45030764", "0.4470893", "0.44635814", "0.44450474", "0.44365618", "0.4435239", "0.43837228", "0.4378065", "0.43257716", "0.4...
0.45204026
10
Return the eigenvalues of the specific `level` and of the specific `node`; if `node` is not specified, the method returns the eigenvalues of the given `level` (all the nodes).
def partial_eigs(self, level, node=None): if level >= self._max_level: raise ValueError( 'The level input parameter ({}) has to be less than the' 'max_level ({}). Remember that the starting index is 0'.format( level, self._max_level)) if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eigenvalues(self, expand=False, factor=False, simplify=False):\n raise NotImplementedError", "def eigen_decomp(matrix):\n w = None\n v = None\n ### YOUR CODE HERE\n w,v=np.linalg.eig(matrix)\n ### END YOUR CODE\n return w, v", "def eigensystem(mat):\n e, v = numpy.linalg.eig(mat...
[ "0.5242461", "0.5114825", "0.50866956", "0.5004184", "0.49853173", "0.49390775", "0.4933429", "0.4927228", "0.48673382", "0.48499873", "0.48347157", "0.47743538", "0.4752944", "0.47522292", "0.4748588", "0.46996492", "0.46762186", "0.46594122", "0.46453482", "0.4602194", "0.4...
0.7101437
0
Return the reconstructed data computed using the modes and the time evolution at the specific `level` and at the specific `node`; if `node` is not specified, the method returns the reconstructed data of the given `level` (all the nodes).
def partial_reconstructed_data(self, level, node=None): if level >= self._max_level: raise ValueError( 'The level input parameter ({}) has to be less than the ' 'max_level ({}). Remember that the starting index is 0'.format( level, self._max_level)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(node):\n shapes = list()\n\n # -- If we have a transform, add any nurbs curves\n # -- from it\n for shape in node.getShapes():\n if isinstance(shape, pm.nt.NurbsCurve):\n shapes.append(shape)\n\n if not shapes:\n return None\n\n # -- Define out output data. Right...
[ "0.48708206", "0.48325694", "0.4717103", "0.46905452", "0.46058008", "0.45872766", "0.45579225", "0.4549462", "0.45096028", "0.45037228", "0.4485179", "0.4482341", "0.44601327", "0.44452712", "0.4380473", "0.43233997", "0.42929927", "0.42859843", "0.42788714", "0.42265484", "...
0.6255533
0
Compute the Dynamic Modes Decomposition to the input data.
def fit(self, X): self._snapshots, self._snapshots_shape = self._col_major_2darray(X) # Redefine max level if it is too big. lvl_threshold = int(np.log(self._snapshots.shape[1]/4.)/np.log(2.)) + 1 if self._max_level > lvl_threshold: self._max_level = lvl_threshold ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reconstructData(self, target):\n data = self._modes[target].dot(self.__getTimeEvolution(target))\n return data", "def decomposition(self, *args, **kwds):\n if not self.is_endomorphism():\n raise ArithmeticError(\"Matrix morphism must be an endomorphism.\")\n D = self.domain()\...
[ "0.5453213", "0.52758074", "0.5223547", "0.51681143", "0.51529014", "0.5142907", "0.50792956", "0.5053362", "0.5050135", "0.50399166", "0.5007684", "0.49988356", "0.49975812", "0.49966964", "0.49902576", "0.4976227", "0.49488717", "0.49458563", "0.49439144", "0.4908942", "0.4...
0.0
-1
Returns a normalize matrix
def normalize(X, m, s): return (X - m)/s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self,matrix):\n for i in range(self.N):\n matrix[self.N-1][i] = 0\n for i in range(self.n):\n matrix[self.N - 1][self.index(i,i)] = 1\n return matrix", "def normalize(self):\r\n max = np.amax(self.matrix)\r\n min = np.amin(self.matrix)\r\n\r\...
[ "0.7715446", "0.7613959", "0.75945044", "0.74469215", "0.72762185", "0.7221286", "0.7218722", "0.7197787", "0.71780825", "0.71014005", "0.69856745", "0.6975971", "0.6939313", "0.6927247", "0.6898473", "0.68966824", "0.68903077", "0.6872301", "0.68695444", "0.6867305", "0.6862...
0.6534378
47
Test to check that constants specified as inputs aren't interpreted as an encoded constant.
def test_constant_as_input(): def get_graph(): dtype = "uint8" ifm = relay.var("ifm", shape=(1, 16, 16, 32), dtype=dtype) conv1 = make_ethosu_conv2d( ifm, 32, 16, (1, 1), (0, 0), (1, 1), (1, 1), ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_negative_values_not_allowed(self, test_input, expected, sc):\n expected_err_msg = f'negatives not allowed {expected}'\n with pytest.raises(ValueError):\n sc.add(test_input)\n\n try:\n sc.add(test_input)\n except ValueError as e:\n assert str(e) ...
[ "0.5949847", "0.5904232", "0.58766985", "0.5792848", "0.5781268", "0.573758", "0.57277274", "0.57156056", "0.57077456", "0.56987315", "0.5657231", "0.56558204", "0.5646676", "0.56368077", "0.5625566", "0.56166357", "0.561552", "0.5598536", "0.55874467", "0.55759317", "0.55703...
0.56215614
15
Embeds an mp4 file in the notebook.
def embed_mp4(filename): video = open(filename,'rb').read() b64 = base64.b64encode(video) tag = ''' <video width="640" height="480" controls> <source src="data:video/mp4;base64,{0}" type="video/mp4"> Your browser does not support the video tag. </video>'''.format(b64.decode()) return IPython.display....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_show_video(name, vext='.mp4', ext='.png', loop=True, autoplay=True, controls=True, embed=False, figpath=figpath, **kwargs):\n import os\n from IPython.core.display import display, Image, HTML\n from base64 import b64encode\n\n opts = 'playsinline '\n if loop: opts += 'loop '\n if autoplay:...
[ "0.6405056", "0.6389918", "0.624613", "0.58332616", "0.5745402", "0.5608184", "0.5495171", "0.547484", "0.54442585", "0.53840584", "0.5354212", "0.53239614", "0.5266749", "0.5199485", "0.5187718", "0.51537603", "0.5122003", "0.5109699", "0.5109699", "0.5109699", "0.5081165", ...
0.7854064
1
Returns a single string summary of the address, separating fields using commas.
def summary(self): return u", ".join(self.active_address_fields())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_address_string(self):\n output = ''\n if self.address_line_1:\n output += '{}'.format(self.address_line_1)\n if self.address_line_2:\n output += ', {}'.format(self.address_line_2)\n if self.city:\n output += ', {}'.format(self.city)\n if s...
[ "0.78189707", "0.75865847", "0.72340244", "0.7221318", "0.70897835", "0.7086217", "0.7069089", "0.6952058", "0.69167846", "0.6916324", "0.66950196", "0.6601282", "0.6566898", "0.655473", "0.65395886", "0.65120167", "0.640262", "0.6396874", "0.6348964", "0.6314561", "0.6234863...
0.8051104
0
Join a sequence of fields using the specified separator
def join_fields(self, fields, separator=u", "): field_values = [] for field in fields: # Title is special case if field == 'title': value = self.get_title_display() else: value = getattr(self, field) field_values.append(valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join(sep, xs):\n return str(sep).join(xs)", "def join(sep, seq):\n return _to_bytes_or_str_array(\n _vec_string(sep, object_, 'join', (seq,)), seq)", "def join(items, sep=' ', prefix=None, suffix=None, target=None):\n if target is None:\n target = SQLQuery()\n\n target...
[ "0.69708467", "0.674667", "0.65593576", "0.64647615", "0.6429916", "0.6410351", "0.6325085", "0.62385356", "0.6212414", "0.6085514", "0.59461766", "0.59388465", "0.59145224", "0.58975995", "0.5858211", "0.5847662", "0.5796375", "0.5794207", "0.57875186", "0.5756469", "0.57317...
0.7043287
0
Return the nonempty components of the address, but merging the title, first_name and last_name into a single line.
def active_address_fields(self, include_salutation=True): fields = [self.line1, self.line2, self.line3, self.line4, self.state, self.postcode] if include_salutation: fields = [self.salutation] + fields fields = [f.strip() for f in fields if f] try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_address(self):\n\n return \"{}\\n{}\\n{},\\n{},\\n{}\".format(\n self.address_line_1, self.city, self.state, self.postal_code, self.country\n )", "def format_address(line1, line2, city, state, zipcode):\n\t\n\tstreetlines = line1\n\tcityline = city\n\t\n\tif len(streetlines) > ...
[ "0.6954609", "0.69253814", "0.6911354", "0.6881644", "0.6759665", "0.6734344", "0.6643338", "0.66044575", "0.6474396", "0.6452316", "0.6411441", "0.6401364", "0.63200545", "0.6319923", "0.62194943", "0.62148166", "0.6207265", "0.61958236", "0.6132151", "0.6110019", "0.6110019...
0.5777581
32
Return the order linked to this shipping address
def order(self): try: return self.order_set.all()[0] except IndexError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shipping_address(self):\n return Address(self._dict.get('shipping_address'))", "def shipping_address(self) -> 'outputs.ShippingAddressResponse':\n return pulumi.get(self, \"shipping_address\")", "def shipping_address(self) -> 'outputs.ShippingAddressResponse':\n return pulumi.get(self,...
[ "0.6902648", "0.6399106", "0.6399106", "0.6399106", "0.62057763", "0.62034076", "0.59340125", "0.5929395", "0.5901829", "0.58613276", "0.5810267", "0.57903624", "0.5780459", "0.5767802", "0.5753719", "0.57446367", "0.57325596", "0.5718112", "0.5695351", "0.5687422", "0.565242...
0.57930714
11
Save a hash of the address fields
def save(self, *args, **kwargs): # Save a hash of the address fields so we can check whether two # addresses are the same to avoid saving duplicates # self.hash = self.generate_hash() # Ensure that each user only has one default shipping address # and billing address sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_object(self, data):\n return Address(**data)", "def store_address(intent, session):\n sess_data = session.setdefault('attributes', {})\n if not sess_data.get('add_address') and \\\n not sess_data['next_step'] == 'store_address':\n raise RuntimeError('Something went wrong.')\...
[ "0.6370817", "0.6088569", "0.60453266", "0.60335714", "0.598078", "0.5959527", "0.5934991", "0.5910224", "0.5907966", "0.5855384", "0.58534986", "0.5826116", "0.5799289", "0.5788313", "0.5712779", "0.5688992", "0.5621706", "0.56182045", "0.5589447", "0.5579695", "0.5579695", ...
0.69221675
0
Init function. This first defines the network compression model that implements layer removal/shrinkage and training to get reward. It also obtains the number of layers, and the network state shape, number_of_layers x number_of_parameters_for_each_layer. This method also defines action_space and observation_space for G...
def __init__(self, config={}): _, fileprefix = mkstemp() idx = fileprefix.rfind('/') fileprefix = fileprefix[idx + 1:] self.network = NetworkCompression(prefix = fileprefix) self.num_actions = self.network.get_action_space() self.input_shape = self.network.get_observatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, device, state_space, action_space, num_actions):\n # initialize all parameters\n super(DQN_MLP_model, self).__init__(device, state_space, action_space,\n num_actions)\n # architecture\n self.layer_sizes = [(768, 768), (768, 7...
[ "0.6963171", "0.67967623", "0.6782904", "0.67258465", "0.66817856", "0.66595465", "0.66574657", "0.6555321", "0.655193", "0.6515325", "0.64991766", "0.648771", "0.6485449", "0.6467087", "0.6460257", "0.64164853", "0.64157426", "0.6414727", "0.6405644", "0.6402848", "0.6392700...
0.6200549
50
This is an helper function that obtains the state of the network in number_of_layers x number_of_parameters_for_each_layer. However, coach does not like 2D array as input and hence recast it to 1D array
def _get_current_pos_in_1d(self): pos = self.network.get_current_pos() pos = np.squeeze(np.reshape(pos, (self.input_shape[0]*self.input_shape[1],1))) return pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cnn(self, state):\n\n x = self.relu(self.bn1(self.conv1(state)))\n x = self.relu(self.bn2(self.conv2(x)))\n x = self.relu(self.bn3(self.conv3(x)))\n x = x.reshape(x.size(0), -1)\n\n return x", "def getstate(self):\r\n return Parameterized.getstate(self) + [self.part...
[ "0.62808293", "0.6241918", "0.6179134", "0.6049776", "0.6034651", "0.5932981", "0.5924396", "0.59014106", "0.58887464", "0.5868812", "0.5858823", "0.5846273", "0.5844779", "0.58178574", "0.5808643", "0.57904416", "0.5740947", "0.57272613", "0.5708938", "0.5705436", "0.570316"...
0.0
-1
Gym reset interface. Sets the current position of the simulation which is always the parent network state
def reset(self): self.cur_pos = self._get_current_pos_in_1d() return self.cur_pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def specific_reset(self) -> None:\n self.agent.specific_reset() # reset joints\n new_pos = self.agent.init_xyz\n new_pos[:2] = np.random.uniform(-0.01, 0.01, 2)\n self.agent.set_position(new_pos)\n self.old_potential = self.calculate_task_potential()", "def reset(self):\n ...
[ "0.7264109", "0.72616", "0.70819384", "0.70433414", "0.69963706", "0.6988895", "0.696318", "0.693653", "0.69319737", "0.6903858", "0.68340075", "0.68227863", "0.68126225", "0.68004537", "0.67911285", "0.6752854", "0.6727614", "0.6702409", "0.66944015", "0.66908115", "0.668374...
0.0
-1
Gym step interface. Receives a set of binary actions (1d array) that determines whether to keep/remove each layer in the child network. This method also determines the reward obtained based on the action. Since we run only one step, the calculated reward is the final reward and we are done with an episode
def step(self, actions): assert (len(actions) == self.num_actions) actions = np.around(actions) actions = np.clip(actions, 0, 1) self.done = self.network.perform_actions(actions) self.cur_pos = self._get_current_pos_in_1d() self.reward = self.network.get_reward() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, action:list) -> (np.ndarray, float, bool, dict):\n\n\n action[0] = (action[0] + 1)/2 # Done to be compatible with RL algorithms that require symmetric action spaces\n if np.isnan(action).any(): action = np.zeros(action.shape)\n self.main_vessel.step(action)\n\n for vessel...
[ "0.6944296", "0.6848718", "0.6799359", "0.67124534", "0.6680303", "0.6627744", "0.6627547", "0.66090447", "0.65186137", "0.6489625", "0.64750123", "0.6471681", "0.64692414", "0.6450281", "0.6441195", "0.6427716", "0.640443", "0.6381965", "0.63770854", "0.6363568", "0.6342039"...
0.6566457
8
This method is used to retreive all environments.
def getEnvironments(request): environments = Environment.objects.all() serializer = environmentSerializer(environments, many=True) result = {'data':serializer.data, 'code':HTTP_200_OK, 'message':OK} return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_environments():\n return ENVIRONMENTS", "def envs():\n\n # update and grab the envs from the metadata keys\n metadata = _init()\n return list(metadata.keys())", "def environments(self):\n envs = self.config[\"tox\"][\"envlist\"]\n #result = re.split(\"[^a-zA-Z0-9]\", envs)...
[ "0.8714086", "0.75199974", "0.74426425", "0.72617525", "0.7142985", "0.71147597", "0.7099694", "0.7068136", "0.6949923", "0.69379425", "0.69020444", "0.67948884", "0.6783139", "0.67773885", "0.6774582", "0.6730243", "0.67123854", "0.6709814", "0.6692068", "0.6645223", "0.6605...
0.7421862
3
'''Print the first paragraph of the docstring of the decorated function. The paragraph will be printed as a oneliner. May be invoked as a simple, argumentless decorator (i.e. ````) or with named arguments ``color``, ``bold``, ``prefix`` of ``tail`` (eg. ``(color=utils.red, bold=True, prefix=' ')``).
def print_doc1(*args, **kwargs): # output settings from kwargs or take defaults color = kwargs.get('color', blue) bold = kwargs.get('bold', False) prefix = kwargs.get('prefix', '') tail = kwargs.get('tail', '\n') def real_decorator(func): '''real decorator function''' @wraps(fun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printHelpFunc(self, func, leadingstrings=None):\n if leadingstrings is None:\n leadingstrings = ['- ', ' ']\n a, idx = 0, None\n for line in func.__doc__.split('\\n'):\n if len(line) == 0:\n continue\n if idx is None:\n idx = ...
[ "0.6182041", "0.56835043", "0.5528549", "0.54951614", "0.5478067", "0.54739696", "0.54724956", "0.5464363", "0.5463609", "0.54350126", "0.5416408", "0.5416105", "0.54136", "0.53923166", "0.53778976", "0.5367521", "0.5367521", "0.5367521", "0.5337481", "0.5322726", "0.53079075...
0.7592692
1
Uses the supplied training inputs and labels to make predictions for validation data using the Knearest neighbours algorithm.
def knn(k, train_data, train_labels, valid_data): dist = l2_distance(valid_data.T, train_data.T) nearest = np.argsort(dist, axis=1)[:, :k] train_labels = train_labels.reshape(-1) valid_labels = train_labels[nearest] # Note this only works for binary labels: valid_labels = (np.mean(valid_labels...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_knn(k, train_data, train_labels, valid_data):\n\n dist = l2_distance(valid_data.T, train_data.T)\n nearest = np.argsort(dist, axis=1)[:,:k]\n\n train_labels = train_labels.reshape(-1)\n valid_labels = train_labels[nearest]\n\n # note this only works for binary labels\n valid_labels = (np....
[ "0.7216491", "0.70995784", "0.70012844", "0.6901809", "0.6870604", "0.68224275", "0.68148446", "0.6792868", "0.6734792", "0.67107177", "0.6665414", "0.6601499", "0.6598747", "0.6598747", "0.6598747", "0.6597325", "0.6596465", "0.65924454", "0.6582011", "0.6581457", "0.6571299...
0.70062023
2
try to determine if a test suite should run or not given a set files in a diff
def check_should_run_suite(suite, diff_files): if suite in always_run_jobs: # you gotta do what you gotta do return True all_ignore = True any_docs = False all_docs = True any_console = False all_console = True any_java = False any_testable_script = False all_testab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_test(args):\n return (args.test_set or args.test_source or args.test_dataset or\n args.test_stdin or args.test_datasets)", "def test_check():\n for f in cfg.required_files:\n assert os.path.isfile(f)", "def run_test(standart_app, testing_app, *scenario_files):\n passed = True...
[ "0.60675377", "0.6027447", "0.59727937", "0.58538693", "0.58520204", "0.58372957", "0.58365786", "0.5804472", "0.58039814", "0.5785943", "0.5781354", "0.57812536", "0.57245654", "0.5717809", "0.57147026", "0.56915843", "0.56442523", "0.5639239", "0.5628038", "0.5621098", "0.5...
0.7907135
0
Call in a loop to create terminal progress bar
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', printEnd = "\r"): percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total))) filledLength = int(length * iteration // total) bar = fill * filledLength + '-' * (length - filledLen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_progress_bar():\n\n if simple_tregex_mode:\n total_files = len(list(to_iterate_over.keys()))\n else:\n total_files = sum(len(x) for x in list(to_iterate_over.values()))\n\n par_args = {'printstatus': kwargs.get('printstatus', True),\n 'root': r...
[ "0.73996055", "0.73339546", "0.7302448", "0.7211271", "0.7152014", "0.7069114", "0.7064241", "0.70030713", "0.6975914", "0.6972206", "0.6962635", "0.69542474", "0.69375116", "0.6929309", "0.6929309", "0.6929309", "0.6927648", "0.6922987", "0.6918861", "0.6918861", "0.69157404...
0.67729735
50
Reconstructs the momentum of the neutrino and antineutrino, given the momentum of the muons and bottom quarks.
def reconstruct(edata, mwm=80.4, cme=1000): assert len(edata) == 12, 'edata should have length 12.' degree = 4 # The degree of the interpolating polynomial. rbar_threshold = 0.95 mwm2 = mwm**2 domain_func, func1s, func2s = _getFuncs(edata, mwm2, cme) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def muontrg_efficiencies():\r\n# to be updated with new numbers:\r\n ejpsi_trg = Jpsi_trg\r\n ejpsi_trg.add_relative_error(0.03) # TISTOS Justine 140711\r\n ebsmm_trg.add_relative_error(0.02) # Extra lines Justine 140711\r\n ebsmm_trg = BmmE_trg\r\n ebsmm_trg.add_relative_error(0.03) # TISTOS Justin...
[ "0.5613315", "0.53698575", "0.5369027", "0.5289094", "0.52887803", "0.52873486", "0.5220959", "0.5208002", "0.5190982", "0.51466244", "0.50938475", "0.5089522", "0.5043566", "0.50237817", "0.49700487", "0.49457595", "0.48842022", "0.48757416", "0.48726192", "0.48666868", "0.4...
0.0
-1
Takes in a motion, and sends the bound key signal
def pressBoundKey(motion): if bindings[motion]: autopy.key.tap(bindings[motion], [])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_key_press(self, event):", "def _on_key_release(self, event):", "def press_bound_key(self, event):\n if event.key in self.key_bindings:\n self.press()\n elif (event.key, pg.key.get_mods()) in self.key_bindings:\n self.press()", "def ev_KEYUP(self, event):", "def k...
[ "0.68667006", "0.67747253", "0.6757369", "0.6677286", "0.6660343", "0.6565812", "0.65357596", "0.6482535", "0.6442972", "0.638499", "0.6371723", "0.6342939", "0.63109654", "0.62828064", "0.6278564", "0.6200766", "0.6191682", "0.61816347", "0.6171723", "0.6170504", "0.6152393"...
0.7920645
0
Binds a character key to a motion in the bindings table
def bind(motion, character): bindings[motion] = character
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind_key(self, key, command):\n self.key_bindings[key] = command", "def pressBoundKey(motion):\n if bindings[motion]:\n autopy.key.tap(bindings[motion], [])", "def bind_key(self, key):\n self.key_bindings.append(key)", "def bindKeyboardKeysToFunctions(self):\n self.keyboard...
[ "0.73948914", "0.717898", "0.6787276", "0.6590862", "0.65523916", "0.6453969", "0.63455117", "0.6275753", "0.6270246", "0.6268342", "0.6202153", "0.62004995", "0.6192932", "0.6180448", "0.6134238", "0.61339384", "0.60985154", "0.60825276", "0.6080745", "0.60624856", "0.606173...
0.80695057
0
Genera una ventana con la funcionalidad de generar un FileDialog.
def __init__(self): tk.Tk.__init__(self) self.title('Graficar datos') # Configuración basica de componentes de interfaz self.quitButton = tk.Button(self, width=12, text='Abrir archivo', bg='grey',command=self.buscar_archivo) self.quitButton.grid(row=0, column=0, padx=8, pady=8) self.lbl_archivo = tk.Label...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def openFileDialog(self): \n self.dialog = ocempgui.widgets.Box(373, 372)\n self.dialog.topleft = 528, 205\n\n background = guiobjects.OcempImageMapTransparent(GG.genteguada.GenteGuada.getInstance().getDataPath(WINDOW_UPLOAD))\n self.dialog.add_child(background)\n \n self.listDir = guiobjects.Oc...
[ "0.6843026", "0.66493344", "0.65278006", "0.6506434", "0.6504894", "0.64873946", "0.641618", "0.640353", "0.62047625", "0.6195347", "0.6175586", "0.61684096", "0.6079808", "0.6068441", "0.6013226", "0.59823745", "0.59658766", "0.5941334", "0.5917424", "0.5914274", "0.59101975...
0.0
-1
creates an exgaussian CDF lookup table that will be used to interpolate values
def create_exgauss_lookup_table(self): return self.exgauss_cdf_nparray(range(self.xmin,self.xmax, self.dx)).tolist(), range(self.xmin,self.xmax, self.dx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_smarter_lookup_table(self, y=0.95):\n # First determine an approximate starting point for the lookup taqble by halving the max value till the point \n # where the cdf value is less than the cdf value we are looking for\n xold = self.xmax\n xnew = self.xmax\n y_calc = self.exgauss_cdf(xnew)\n ...
[ "0.68857044", "0.5776785", "0.5618758", "0.55740803", "0.55609", "0.5537735", "0.5410309", "0.5400205", "0.53806585", "0.53747016", "0.53696406", "0.5324577", "0.5312523", "0.52905965", "0.52819836", "0.5277198", "0.5264599", "0.52586555", "0.5256953", "0.5254281", "0.5247637...
0.75694865
0
creates an exgaussian CDF lookup table but in a smarter way in that it creates a leaner lookup table with more values stacked closer to where the cdf value we are searching for is
def create_smarter_lookup_table(self, y=0.95): # First determine an approximate starting point for the lookup taqble by halving the max value till the point # where the cdf value is less than the cdf value we are looking for xold = self.xmax xnew = self.xmax y_calc = self.exgauss_cdf(xnew) while y_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_exgauss_lookup_table(self):\n return self.exgauss_cdf_nparray(range(self.xmin,self.xmax, self.dx)).tolist(), range(self.xmin,self.xmax, self.dx)", "def _calc_ecdf(self):\n for numerator, vals in self.lift.items():\n for denominator, lift in vals.items():\n raw_data ...
[ "0.66475147", "0.5811636", "0.5665929", "0.5633998", "0.55846995", "0.5386738", "0.5367499", "0.53664035", "0.5290156", "0.52471405", "0.5237261", "0.5190163", "0.51828945", "0.5166558", "0.51589215", "0.51433057", "0.5126065", "0.5123258", "0.5092755", "0.50826335", "0.50671...
0.72736365
0
1. Hide the root window 2. Draw the login window 3. Close the entire application when login window is closed 4. Lock the rest of the program until the correct password is given 5. Add widgets to the login window
def __init__(self, root): root.withdraw() self.widgets['Login Window'] = subwindow.draw_subwindow(root, self.w, self.h, self.title) self.widgets['Login Window'].protocol('WM_DELETE_WINDOW', lambda: subwindow.on_exit(root)) self.widgets['Login Window'].grab_set() self.create_w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LoadLogInWindow(self):\n \n def CreateAccount():\n \"\"\"Erase 'Log In' widgets to load 'Account Creation' widgets.\n \n This function is called by the 'Create New Account' button.\n \"\"\"\n login_frame.forget()\n self.LoadCreateA...
[ "0.7726316", "0.76516026", "0.7324264", "0.71482766", "0.71319604", "0.7108741", "0.70845526", "0.70725036", "0.7013036", "0.6962864", "0.69238645", "0.6832125", "0.6776213", "0.6681016", "0.66242844", "0.661402", "0.6568176", "0.6503089", "0.6480701", "0.6401318", "0.6358778...
0.69373995
10
1. Create and display a Frame for the widgets 2. Create and display a password prompt Label 3. Create and display an input Frame 4. Create and display a password Entry 5. Create and display an enter Button 6. Bind key to enter Button 7. Create a message Label
def create_widgets(self, root): self.widgets['Main Frame'] = Frame(self.widgets['Login Window'], borderwidth=20) self.widgets['Main Frame'].pack(expand=YES, fill=BOTH) Label(self.widgets['Main Frame'], text='Enter password:').pack(side=TOP, expand=YES) self.widgets['Input Frame'] = Fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_widgets(self):\n self.instruction = Label(self, text=\"Enter the password \")\n self.instruction.grid(row=0, column=0, columnspan=2, sticky=W)\n\n self.password_entry = Entry(self)\n self.password_entry.grid(row=0, column=1, sticky=W)\n\n self.submit_button = Button(se...
[ "0.8136624", "0.7529008", "0.74277", "0.7223204", "0.7031169", "0.6925377", "0.6852082", "0.6676885", "0.6617138", "0.6586638", "0.65417933", "0.6515163", "0.64958483", "0.64647", "0.6382624", "0.6367032", "0.634605", "0.63396925", "0.6337783", "0.63201666", "0.6295827", "0...
0.7642204
1
1. Get the user input from the Password Entry
def verify_password_input(self, root): ui = self.widgets['Password Entry'].get() if ui == self.password[0]: self.widgets['Login Window'].destroy() root.deiconify() menu.define_workspace(root) else: widgets.edit_message(self.widgets['Message'], se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enter_password(self):", "def prompt_pass():\n msg = \"Enter Password: \"\n password = getpass.getpass(msg)\n return password", "def password(self) -> str:", "def getpass(self, prompt):\r\n return getpass.getpass(prompt)", "def get_password_from_user():\n pwd = ''\n keyboard = xbmc...
[ "0.81052965", "0.77915996", "0.7512173", "0.7433339", "0.7430234", "0.73654836", "0.7329979", "0.7324449", "0.72566116", "0.7251749", "0.7206463", "0.720326", "0.720326", "0.720326", "0.720326", "0.720326", "0.720326", "0.720326", "0.720326", "0.720326", "0.720326", "0.7203...
0.68862444
52
Simulate the main task. Do something (compute a result), and send a message to the saver
def main_task_handler(): context = zmq.Context() # socket to sending messages to save save_sender = context.socket(zmq.PUSH) save_sender.connect(SAVE_PUSH_QUEUE_ADDR) c = 0 while (True): # simulate some very complex computation (x, y) = (random.gauss(0, 1), random.gauss(0, 1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\n\n # Set up environment and agent\n e = Environment() # create environment (also adds some dummy traffic)\n a = e.create_agent(LearningAgent) # create agent\n e.set_primary_agent(a, enforce_deadline=False) # set agent to track\n\n # Now simulate it\n sim = Simulator(e, update_delay...
[ "0.6379486", "0.6375426", "0.6371881", "0.63712204", "0.629279", "0.6278951", "0.6243851", "0.6223295", "0.6182957", "0.6136574", "0.60471547", "0.60366166", "0.60341793", "0.60041267", "0.6000432", "0.5988411", "0.5983482", "0.59803426", "0.59710443", "0.5966627", "0.5954777...
0.6512541
0
Simulate listening to a cmd sent by the master, and replying to it
def cmd_handler(): context = zmq.Context() # socket to receive commands (a subscription to ELECTION_CODE channel) cmd_socket = context.socket(zmq.SUB) cmd_socket.connect ("tcp://%s:5556" % SERVER_HOST) topicfilter = "politiche2013" cmd_socket.setsockopt(zmq.SUBSCRIBE, topicfilter) # socket...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sendingCommand(self): \n\n while True:\n self.tello.send_command('command') \n time.sleep(5)", "def do_command(command):\n send_command(command)\n # time.sleep(0.1) # may be required on slow machines\n response = get_response()\n print(\"Rcvd: <<< \" + resp...
[ "0.69502234", "0.6697658", "0.64755666", "0.6336326", "0.62877846", "0.6227407", "0.6196379", "0.6194214", "0.618218", "0.6180899", "0.6173779", "0.61692375", "0.61592835", "0.61553776", "0.6124696", "0.6112446", "0.6090134", "0.60835063", "0.60796964", "0.60646766", "0.60618...
0.64755476
3
generate successive prime numbers (trial by division)
def Primes(): candidate = 1 _primes_so_far = [2] # first prime, only even prime yield _primes_so_far[-1] while True: candidate += 2 # check odds only from now on for prev in _primes_so_far: if prev**2 > candidate: yield candidate _pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes():\n yield 1\n primes = []\n for n in itertools.count(2):\n if not any(n % p == 0 for p in primes):\n # No divisor found among previous primes\n yield n\n primes.append(n)", "def primes():\n yield 2\n candidate = 3\n while True:\n for i ...
[ "0.7673731", "0.767177", "0.767177", "0.7644096", "0.7614384", "0.758533", "0.75068355", "0.7456537", "0.72594345", "0.71743274", "0.7161902", "0.71163714", "0.7084194", "0.6997164", "0.69905466", "0.6985653", "0.6959174", "0.69511086", "0.6947724", "0.69435084", "0.69297296"...
0.7058044
13
prints company names for the given year
def get_titles(year, basepath=None): # create a day file reader dr = None try: if basepath is not None: dr = dayToDF.DayReader(year, basepath=basepath) else: dr = dayToDF.DayReader(year) except FileNotFoundError as err: logging.fatal("Could not create DayR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yearname(self):\n return self.strftime(\"%Y\")", "def full_name(self, year=None):\n return \"%d%s\" % (self.index(year), self.name)", "def formatyear(self, theyear):\n\t\tv = []\n\t\ta = v.append\n\t\ta('<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"year\">')\n\t\ta('\\n')\n...
[ "0.6591413", "0.6297006", "0.61307436", "0.5971754", "0.5817641", "0.5769102", "0.5757908", "0.5753845", "0.5740012", "0.5704324", "0.56821907", "0.56579894", "0.56541425", "0.5653108", "0.5635096", "0.56150603", "0.56144917", "0.56038475", "0.5547933", "0.5513544", "0.548851...
0.51956016
56
Tests if not having any parameters in the init call raises a TypeError
def test_001_init(self): self.assertRaises(TypeError,rawdata.rawdata)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_constructor_invalid():\n with pytest.raises(TypeError, match='missing 1 required positional argument'):\n PseudoPotentialData() # pylint: disable=no-value-for-parameter", "def check_params(self):\n raise NotImplementedError", "def _check_params(self):\n pass", "def test_init_rai...
[ "0.70104694", "0.6926359", "0.6900749", "0.6805929", "0.6801639", "0.67635816", "0.67625475", "0.6702001", "0.66861004", "0.66850466", "0.66674775", "0.66362405", "0.65991765", "0.65822953", "0.65713227", "0.6533889", "0.6526928", "0.6504825", "0.6481195", "0.64775735", "0.64...
0.62806404
37
Tests if having only id parameter in the init call raises a TypeError
def test_002_init(self): self.assertRaises(TypeError,rawdata.rawdata,"id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_id_type(self):\n self.assertIsInstance(Rectangle(1, 1).id, int)\n self.assertIsInstance(Rectangle(1, 1, id=None).id, int)", "def test_non_int_arg(self):\n obj = Base('id')\n self.assertTrue(obj.id is 'id')", "def check_id(self, id):", "def test_id_type_none(self):\n ...
[ "0.76953214", "0.7402727", "0.7265812", "0.7121857", "0.70339227", "0.69546986", "0.6857017", "0.67979646", "0.67748326", "0.6755924", "0.6710613", "0.66996866", "0.66996866", "0.66996866", "0.66996866", "0.6673032", "0.6602561", "0.6554279", "0.6554279", "0.6554279", "0.6554...
0.71551645
3
Tests if having id and ionchrom parameter in the init call raises a TypeError
def test_003_init(self): self.assertRaises(TypeError,rawdata.rawdata,"id",testRawdata.ioc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_002_init(self):\n self.assertIsInstance(ionchrom.ionchrom(\"id\"),ionchrom.ionchrom)", "def test_001_init(self):\n self.assertRaises(TypeError,ionchrom.ionchrom)", "def test_002_init(self):\n self.assertRaises(TypeError,rawdata.rawdata,\"id\")", "def test_init_id_type(self):\n ...
[ "0.75527525", "0.74423254", "0.6566925", "0.61732787", "0.6122854", "0.60900694", "0.59359056", "0.5932252", "0.5904741", "0.5903323", "0.5900798", "0.5861291", "0.57611066", "0.5745521", "0.5739906", "0.5716416", "0.5645096", "0.5621805", "0.5605678", "0.56036425", "0.559107...
0.65853083
2
Tests if passing the id, ionchrom and sample parameters generates a new object of type sample
def test_004_init(self): self.assertIsInstance(rawdata.rawdata("id",testRawdata.ioc,testRawdata.sam),rawdata.rawdata)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self, sample_id: str):\n\n class LimsSample:\n \"\"\" A mock class for a sample coming from LIMS. It only needs a comment \"\"\"\n\n def __init__(self, sample_id):\n self.sample_id = sample_id\n self.sample_data = {\"comment\": \"a comment in Li...
[ "0.6396938", "0.63250375", "0.61931926", "0.6181083", "0.60503036", "0.6019446", "0.597", "0.5902527", "0.58856195", "0.5864737", "0.58281857", "0.57671076", "0.57660705", "0.5757237", "0.573097", "0.57248074", "0.57248074", "0.57069016", "0.56881464", "0.5687392", "0.5686203...
0.5674374
23
Try to find nfo file in movie directory and search in nfo IMDB idetifier
def IMDB_idenifier_search(self): dir_list = os.listdir(self.MovieDir) dir_count = 0 for x in dir_list: if x.split(".")[-1].lower()=="nfo": print "find NFO in %i list" % dir_count break dir_count=dir_count+1 try: nfo_file = open(self.MovieDir+"/"+dir_list[dir_count],"r") buffor = nfo_file.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MovieScan():\r\n for root, dirnames, filenames in os.walk(dlPath):\r\n for extend in movtypes:\r\n for filename in fnmatch.filter(filenames, extend):\r\n matches.append(os.path.join(root, filename))\r\n print(os.path.join(root, filename))\r\n sh...
[ "0.5898576", "0.58694935", "0.5622307", "0.5614593", "0.55535376", "0.5487656", "0.5487184", "0.5405422", "0.5401638", "0.51820374", "0.511373", "0.5113248", "0.510091", "0.5017189", "0.5016573", "0.5016369", "0.5010073", "0.5002005", "0.50001943", "0.49860036", "0.49847925",...
0.77056664
0
Function connect with server and downloades avaliable subtitle list or avaliable subtitle zip file
def __connect_with_server(self,get_operatoin,server_reuest_type): what_is_downloaded = server_reuest_type self.XML_String = None self.zip_string = None try: conn = httplib.HTTPConnection(self.NAPISY24_url) conn.request("GET", get_operatoin) r1 = conn.getresponse() print r1.status, r1.reason ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(self):\n if not os.path.isdir(self.save_path):\n try:\n os.mkdir(self.save_path)\n except IOError:\n print(\"Can't create subfolder. \"\n \"Check that you have write access for \"\n \"{}\".format(self....
[ "0.6728568", "0.6727653", "0.63100266", "0.60740006", "0.5940395", "0.5809924", "0.5798153", "0.56826454", "0.5632426", "0.560139", "0.55641836", "0.5529447", "0.53975224", "0.5332132", "0.5298177", "0.5249126", "0.520643", "0.5179963", "0.51734734", "0.51577014", "0.5155442"...
0.62584805
3
Downloaded XML string isn't compatybil with XML standard in which minidom is written.
def Correct_MultiRoot_XML(self): if self.XML_String[0] == "\n": self.XML_String=self.XML_String[1:] SECONDLINE_CHAR = 0 for x in self.XML_String: SECONDLINE_CHAR = SECONDLINE_CHAR+1 if x =="\n": break self.XML_String = self.XML_String[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_with_no_encoding(self):\n xml = (\n u'<?xml version=\"1.0\"?>'\n u'<DocRoot>'\n u'<Elem1>默认جذ</Elem1>'\n u'<Elem2/>'\n u'</DocRoot>'\n )\n io_string = six.StringIO()\n self.builder.dom_element.write_doc(io_string, encod...
[ "0.6344099", "0.6286215", "0.6196129", "0.6091438", "0.60381323", "0.6027413", "0.60088193", "0.59996015", "0.589542", "0.58318496", "0.5826632", "0.58164376", "0.57975066", "0.57491887", "0.5740025", "0.57227606", "0.5715181", "0.5678621", "0.5669144", "0.56683767", "0.56330...
0.0
-1
Function returns subtitle dictionary which is computed from correct xml string.
def return_xml_dict(self): try: self.Correct_MultiRoot_XML() self.subtitle_dict = sorted(self.xmltodict(self.XML_String)['subtitle'],key=itemgetter('imdb','cd')) #self.subtitle_dict = self.xmltodict(self.XML_String)['subtitle'] print "XML subtitle list downloaded and converted to dict" return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from_origin_to_dict(self):\n try:\n for elem in self._xml_tree.getchildren():\n if elem.tag == \"info\":\n for subelem in elem.xpath(\"//Metadata/General/Metas/Titulo\"):\n self._translated_dict[\"root\"][\"title\"] = subelem.text\n ...
[ "0.5741043", "0.56276953", "0.55804926", "0.54216254", "0.5318582", "0.5317567", "0.53144175", "0.53124976", "0.53016436", "0.5292441", "0.52581465", "0.5189917", "0.51402706", "0.5140158", "0.51315385", "0.5113792", "0.51061213", "0.5029709", "0.50141513", "0.5013694", "0.50...
0.67018545
0
From subtitle dictionary function returns value.
def return_xml_dict_entry_value(self,dict_entry, dict_entry_position): value = self.subtitle_dict[dict_entry][dict_entry_position] return value[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edx_get_subtitle(url, headers):\n \"\"\" or None if no subtitles are available \"\"\"\n try:\n jsonString = get_page_contents(url, headers)\n jsonObject = json.loads(jsonString)\n return edx_json2srt(jsonObject)\n except URLError as e:\n print('[warning] edX subtitles (erro...
[ "0.6290816", "0.61481214", "0.60934126", "0.59526104", "0.5819839", "0.5644419", "0.5638596", "0.5580923", "0.5557902", "0.53163785", "0.5266296", "0.5250043", "0.51997524", "0.51850265", "0.51807094", "0.5156665", "0.51562893", "0.5116406", "0.50712675", "0.503532", "0.49858...
0.6423573
0
Function saves downloaded zip string on given path anf destroy self.zip_string if saveing is succesfull.
def save_downloaded_zip(self, dict_entry_to_download): if self.download_subtitle_zip(dict_entry_to_download) == True: try: zip_file = open(self.ZipFilePath,"wb") zip_file.write(self.zip_string) zip_file.close print "Zipfile: %s saved on hdd." % self.ZipFilePath del self.zip_string return True e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zipsave(self):\n\n filename = filedialog.asksaveasfilename(initialdir=self.root.cache_dir,\n title='Save As',\n filetypes=[('Zip', '.zip')],\n defaultextension='')...
[ "0.69184697", "0.6477389", "0.6425179", "0.63842976", "0.6137987", "0.6123069", "0.5896687", "0.5882788", "0.5697541", "0.5678088", "0.5674914", "0.5637382", "0.56089973", "0.5559134", "0.5541039", "0.5518614", "0.55055565", "0.54959124", "0.5464814", "0.54589176", "0.5444477...
0.7418616
0
Napisy 24 GET request for subtitle zip downloading. Data is stored in self.zip_string.
def download_subtitle_zip(self, dict_entry_to_download): request_subtitle_list = "http://napisy24.pl/download/%s/" % str(self.return_xml_dict_entry_value(dict_entry_to_download,'id')) repeat = 3 while repeat > 0: repeat = repeat - 1 #request_subtitle_list = "/libs/webapi.php?title=%s" % self.Movie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(self):\n if not os.path.isdir(self.save_path):\n try:\n os.mkdir(self.save_path)\n except IOError:\n print(\"Can't create subfolder. \"\n \"Check that you have write access for \"\n \"{}\".format(self....
[ "0.62294996", "0.573122", "0.5613491", "0.56069106", "0.54558396", "0.53945196", "0.5256225", "0.5209892", "0.5174074", "0.5155498", "0.51524377", "0.5145467", "0.5109938", "0.51030266", "0.51014733", "0.50734365", "0.50671315", "0.50465274", "0.50144225", "0.5005846", "0.498...
0.6889805
0
Funstion takes movie file path and based on EXTENSIONS from myListy.pl returns list of movies in movie file directory
def __return_movie_file_list(self, movie_path): movie_dir = movie_path.rsplit("/",1)[0] movie_file_list =[] movie_extentionds = self.__movie_file_extensions(self.__file_extentions) for x in os.listdir(movie_dir): if x.rsplit(".",1)[-1]in movie_extentionds: mov...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movies(path):\n movies_list = []\n \n \n for f in os.listdir(path):\n \n full_file_path = join(path,f)\n if isdir(full_file_path):\n \n movies_list.extend( get_movies(full_file_path) )\n \n elif isfile(full_file_path) and full_file_pa...
[ "0.77624446", "0.69705206", "0.6920418", "0.65718144", "0.65128", "0.64938384", "0.6462537", "0.6437294", "0.6373601", "0.63549864", "0.6350856", "0.6319466", "0.629446", "0.6210759", "0.6183799", "0.61389726", "0.6127222", "0.61024976", "0.6081276", "0.60760933", "0.607265",...
0.7945257
0
Function returns structure (file_path, {guesseFileData})
def subtitlePath_and_subtitleFileData(self,file_path_list): subtile_file_data = [] for x in file_path_list: subtile_file_data.append((x, self.guessFileData(x))) return subtile_file_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_data(filename):", "def raw_file_structure(self):\n return None", "def get_data(found_file, created_file):\n\n try:\n fh_f = fits.open(found_file)\n print('Found file has: ', fh_f.info())\n except Exception:\n print(' FATAL ERROR: Unable to open found file ', found...
[ "0.5878077", "0.5440457", "0.53874904", "0.53820133", "0.53557533", "0.53333783", "0.53244895", "0.5290351", "0.52806115", "0.52697927", "0.5260802", "0.52478737", "0.524652", "0.523822", "0.52320105", "0.52174884", "0.5207511", "0.51975965", "0.5183999", "0.51685417", "0.514...
0.0
-1
Returns best matching movie subtitle table.
def give_movie_subtitle_consistent_data(self, movie_file_data, subtitle_file_data): m_s_temp_data = [] preliminary_movie_subtitle_list = self.compare_movie_and_subtitle_FileData(movie_file_data, subtitle_file_data) for x in preliminary_movie_subtitle_list: """ Delete 0 'propability' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _best_matching_movie(movie):\n return (Levenshtein.distance(movie_name, movie.get('title').lower()),\n (0 - movie.get('votes', 0)),\n )", "def download_subtitle(search, results, filename, min_match=0,\n force=0, debug=0):\n s = Subseek()\n subti...
[ "0.618252", "0.5965921", "0.57754785", "0.5734618", "0.57143825", "0.5659548", "0.5541539", "0.5518001", "0.5478379", "0.5466522", "0.543087", "0.53836876", "0.5375327", "0.52907383", "0.52813095", "0.5275028", "0.52749276", "0.52622724", "0.5237285", "0.5202462", "0.5175123"...
0.65964955
0
Generate a .tgz archive from the contents of the web_static.
def do_pack(): now = datetime.now() # format the name of the file with the timestamps now_year = now.year now_month = now.month now_day = now.day now_hour = now.hour now_minute = now.minute now_second = now.second # apply the format file_name = 'versions/web_static_{}{}{}{}{}{}....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_pack():\n now = datetime.datetime.now()\n path = 'versions/web_static_' +\\\n '{}{}{}{}{}{}'.format(now.year, now.month,\n now.day, now.hour,\n now.minute, now.second) + '.tgz'\n\n local('mkdir -p versions')\n success = lo...
[ "0.7631921", "0.75582755", "0.75560766", "0.75341463", "0.7505679", "0.7504223", "0.7474274", "0.74703455", "0.74594927", "0.7432596", "0.74290574", "0.7389648", "0.7334055", "0.7259239", "0.72502697", "0.72062916", "0.72048455", "0.71769315", "0.71692425", "0.7156065", "0.71...
0.73877853
12
check the previous day for viable departures
def test_check_yesterday(self): # the service calendar has two weekdays, back to back sc = ServiceCalendar() sc.add_period( 0, 3600*24, ["WKDY"] ) sc.add_period( 3600*24, 2*3600*24, ["WKDY"] ) # the timezone lasts for two days and has no offset # this is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_up_to_date():\n last_daily = get_latest_dl_date()\n last_trading_day = get_last_open_trading_day()", "def check_absent_pre_date(self, cr, uid, att, context=None):\n if att:\n # check employee absent pre date\n pre_att_ids = self.search(cr, uid, [('employee_id', '='...
[ "0.65856576", "0.60677063", "0.5963223", "0.59185475", "0.5852571", "0.5852219", "0.5837756", "0.5755815", "0.57509553", "0.56721824", "0.56598383", "0.56210434", "0.56133294", "0.55789524", "0.5559235", "0.55514705", "0.5542802", "0.5537821", "0.5515126", "0.5511169", "0.547...
0.57666147
7
Converts a list of strings to a string by concatenating all elements of the list
def collapse(L): output = "" for s in L: output = output + s return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringer(list):\n\tstring = \"\"\n\tfor x in list:\n\t\tstring = string + str(x)\n\treturn string", "def list2string(a_list):\n\n the_string = ''\n for elem in a_list:\n the_string += str(elem)\n return the_string", "def list_to_str(list_to_convert):\n return ' '.join(to_str(item) for it...
[ "0.845377", "0.7836319", "0.7773371", "0.7705512", "0.7661951", "0.7658474", "0.7595569", "0.7587454", "0.7479857", "0.7459654", "0.74586385", "0.7406689", "0.7406689", "0.7394045", "0.7386286", "0.7349678", "0.7333463", "0.733121", "0.7291625", "0.7260772", "0.71728444", "...
0.652098
56
Computes the Protein encoded by a sequence of DNA. This function does not check for start and stop codons (it assumes that the input DNA sequence represents an protein coding region).
def coding_strand_to_AA(dna): l = len(dna) res = [] for i in range(0, l, 3): s = dna[i: i + 3] for j in range(len(codons)): # for codon in codons[j]: # if codon == s: # res.append(aa[j]) # break; if s in codons[j]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dna_to_protein(seq):\n\n # Verify a convertible sequence\n if len(seq) % 3 != 0:\n raise RuntimeError('Total number of bases must be a multiple of 3')\n\n # Iterate through adding the proteins\n protein = ''\n for i in range(0, len(seq), 3):\n protein += bioinfo_dicts.codons[seq[i:...
[ "0.79057974", "0.76611775", "0.7121469", "0.6961111", "0.68622816", "0.68331707", "0.6547189", "0.64678174", "0.6421204", "0.62824553", "0.6257737", "0.62457687", "0.62001413", "0.6168047", "0.6160185", "0.6150737", "0.60523367", "0.60273343", "0.5976103", "0.5961816", "0.593...
0.53833807
43
Unit tests for the coding_strand_to_AA function
def coding_strand_to_AA_unit_tests(): # list of [input, expected output] data_list = [ # pass cases ["ATGCGA", "MR"], ["ATGCCCGCTTT", "MPA"], ["AAA", "K"], ["TTT", "F"], ["CCC", "P"], ["GGG", "G"], ["AAAA", "K"], ["AAAAA", "K"], ["A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coding_strand_to_AA_unit_tests():\n print \"input: GTTGACAGTACGTACAGGGAA, \"+\"output: \"+coding_strand_to_AA(\"GTTGACAGTACGTACAGGGAA\")+\", actual output: VDSTYRE\"\n print \"input: TTATTGCTTATTATCATG, \"+\"output: \"+coding_strand_to_AA(\"TTATTGCTTATTATCATG\")+\", actual output: LLLIIM\"\n print \"i...
[ "0.87473875", "0.87198865", "0.8259528", "0.80338943", "0.7117547", "0.7100833", "0.7016442", "0.6978917", "0.6892497", "0.68684465", "0.68575025", "0.6806628", "0.68016726", "0.6616816", "0.6553702", "0.6507176", "0.64127254", "0.6405748", "0.6327928", "0.6140289", "0.612837...
0.83976924
2
Computes the reverse complementary sequence of DNA for the specfied DNA sequence
def get_reverse_complement(dna): res = ""; for c in dna: if c == 'A': res = 'T' + res elif c == 'T': res = 'A' + res elif c == 'G': res = 'C' + res elif c == 'C': res = 'G' + res return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reverse_complement(dna):\n rev_comp = ''\n for i in range(0, len(dna)):\n nucleo = dna[i]\n comp = get_complement(nucleo)\n rev_comp = comp + rev_comp\n return rev_comp", "def reverse_complement_strand(dna):\n reverse_complement = \"\"\n\n for character in dna[::-1]:\n...
[ "0.7621168", "0.75488645", "0.74943614", "0.7489699", "0.74795413", "0.7419932", "0.73843974", "0.73704416", "0.73488766", "0.7339861", "0.7338994", "0.7278367", "0.7258061", "0.7248897", "0.72437245", "0.7231113", "0.72207266", "0.7216731", "0.72124445", "0.7201928", "0.7174...
0.75032
2
Unit tests for the get_complement function
def get_reverse_complement_unit_tests(): # list of [input, expected output] data_list = [ ["ATGCCCGCTTT", "AAAGCGGGCAT"], ["AAAGCGGGCAT", "ATGCCCGCTTT"], ["CCGCGTTCA", "TGAACGCGG"], ["AAAA", "TTTT"], ["TTTT", "AAAA"], ["CCCC", "GGGG"], ["GGGG", "CCCC"], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reverse_complement_unit_tests():\n \n print get_reverse_complement(\"ATGCCCGCTTT\")\n print get_reverse_complement(\"CCGCGTTCA\")\n print get_reverse_complement(\"ACCTTGGAAAATTT\")", "def get_reverse_complement_unit_tests():\n input_a='ATTATTATT'\n expected_output='AATAATAAT'\n a...
[ "0.78032184", "0.7330259", "0.7222587", "0.7113062", "0.69564736", "0.69260347", "0.6924214", "0.68408453", "0.6719885", "0.6579124", "0.65708894", "0.65301526", "0.6491171", "0.64767414", "0.6465325", "0.6416435", "0.6400825", "0.63780624", "0.6311535", "0.6303076", "0.62991...
0.68050754
8
Takes a DNA sequence that is assumed to begin with a start codon and returns the sequence up to but not including the first in frame stop codon. If there is no in frame stop codon, returns the whole string.
def rest_of_ORF(dna): # [???] 'assumed to begin with a start codon': doesn't need to check input? # if len(dna) < 3: # return "" # if dna[0:3] != start_codon: # return "" l = len(dna) for i in range(3, l, 3): if dna[i: i + 3] in stop_codons: return dna[0: i] retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stop_from_end(codonseq, codon_table):\n if str(codonseq[-3:]) in codon_table.stop_codons:\n #print(\"chopped\", len(CodonSeq().from_seq(codonseq[:-3])))\n return CodonSeq().from_seq(codonseq[:-3])\n elif str(codonseq[-3:]) == '---':\n #print(\"chopped\", len(CodonSeq().from_se...
[ "0.71757495", "0.65072894", "0.64979345", "0.6329644", "0.6183206", "0.61209697", "0.61035204", "0.6082251", "0.6023832", "0.6007573", "0.59589094", "0.59459716", "0.591217", "0.5907929", "0.57332164", "0.57254994", "0.5674605", "0.563355", "0.5596707", "0.55794567", "0.55748...
0.67012167
1
Unit tests for the rest_of_ORF function
def rest_of_ORF_unit_tests(): data_list = [ ["ATGTGAA", "ATG"], ["ATGAGATAGG", "ATGAGA"], ["ATG", "ATG"], ["ATGTAG", "ATG"], ["ATGTAA", "ATG"], ["ATGTGA", "ATG"], ["ATGAAATTTGGGAAATTTGGGTAG", "ATGAAATTTGGGAAATTTGGG"], ["ATGAAATTTGGG", "ATGAAATTTGGG"], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_of_ORF_unit_tests():\n input_a='ATTCATTAG'\n expected_output='ATTCAT'\n actual_output=rest_of_ORF(input_a)\n print 'Expected Output is ' + expected_output\n print 'Actual Output is ' +actual_output\n \n input_a='ATTCATCATCATCATTAG'\n expected_output='ATTCATCATCATCAT'\n actual_ou...
[ "0.7736593", "0.77165705", "0.68423116", "0.6646262", "0.6569403", "0.6511477", "0.6402534", "0.6199879", "0.61139333", "0.60930383", "0.6042923", "0.6042923", "0.59909266", "0.59864223", "0.597569", "0.595889", "0.595889", "0.595889", "0.595889", "0.595889", "0.5914845", "...
0.7421392
2
Finds all nonnested open reading frames in the given DNA sequence and returns them as a list. This function should only find ORFs that are in the default frame of the sequence (i.e. they start on indices that are multiples of 3). By nonnested we mean that if an ORF occurs entirely within another ORF, it should not be i...
def find_all_ORFs_oneframe(dna): res = [] l = len(dna) next_pos = 0 while True: arg = dna[next_pos:] # orf = rest_of_ORF(arg) # res.append(orf) # if arg == orf: # if: no stop codon # break # next_pos = dna.index(orf, next_pos) + len(orf) + 3 # point next ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_ORFs(dna):\n index = 0\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# initialize index\n all_ORFs = []\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# intitalize empty list\n while index < 3:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# switches throught the 3 frames\n \tall_ORFs = all_ORFs + find_all_ORFs_onefr...
[ "0.69020236", "0.67974", "0.670461", "0.6622766", "0.65280724", "0.65106666", "0.6510072", "0.64129376", "0.6357248", "0.6330139", "0.63298523", "0.6307531", "0.63005555", "0.6295105", "0.62282884", "0.61387193", "0.61064196", "0.60724497", "0.6032787", "0.5994004", "0.577432...
0.611578
16
Unit tests for the find_all_ORFs_oneframe function
def find_all_ORFs_oneframe_unit_tests(): data_list = [ ["ATGCATGAATGTAGATAGATGTGCCC", ["ATGCATGAATGTAGA", "ATGTGCCC"]], ["ATGTAGATGTAG", ["ATG", "ATG"]], ["ATGATGATG", ["ATGATGATG"]], ["ATGGGGGATTAGATGATG", ["ATGGGGGAT", "ATGATG"]], ["ATGTGAATGTAA", ["ATG", "ATG"]], [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_ORFs_oneframe_unit_tests():\n\n # YOUR IMPLEMENTATION HERE", "def find_all_ORFs_oneframe_unit_tests():\n input_a='ATGATTATTTGATGAATGGATTGA'\n expected_output='[ATGATTATT,ATGGAT]'\n actual_output=find_all_ORFs_oneframe(input_a)\n print 'Expected Output is ' + expected_output\n print...
[ "0.8545172", "0.7348566", "0.73415834", "0.7203369", "0.7158465", "0.6796761", "0.6632994", "0.6604659", "0.6478488", "0.6478216", "0.62701315", "0.62148196", "0.6200575", "0.61729914", "0.61653095", "0.61079854", "0.607584", "0.60689676", "0.6063073", "0.59820056", "0.594094...
0.76647025
1
Finds all nonnested open reading frames in the given DNA sequence in all 3 possible frames and returns them as a list. By nonnested we mean that if an ORF occurs entirely within another ORF and they are both in the same frame, it should not be included in the returned list of ORFs.
def find_all_ORFs(dna): res = [] for i in range(0, 3): s = dna[i:] # print i, s, # l = len(s) # for j in range(0, l, 3): # if s[j: j + 3] == start_codon: # r = find_all_ORFs_oneframe(s[j:]) # print r # if len(r) > 0: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_ORFs(dna):\n index = 0\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# initialize index\n all_ORFs = []\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# intitalize empty list\n while index < 3:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# switches throught the 3 frames\n \tall_ORFs = all_ORFs + find_all_ORFs_onefr...
[ "0.6846477", "0.67647403", "0.67115307", "0.66981316", "0.6597111", "0.65776366", "0.64758587", "0.6420567", "0.6389022", "0.6327249", "0.62816936", "0.6255243", "0.62321466", "0.6223571", "0.6206", "0.6151061", "0.61308336", "0.6083877", "0.6025945", "0.5896849", "0.5860287"...
0.63819563
9
Unit tests for the find_all_ORFs function
def find_all_ORFs_unit_tests(): data_list = [ ["ATGCATGAATGTAG", ["ATGCATGAATGTAG", "ATGAATGTAG", "ATG"]], ["ATG", ["ATG"]], ["AATG", ["ATG"]], ["AAATG", ["ATG"]], ["ATGATG", ["ATGATG"]], ["ATATGGATTGA", ["ATGGAT"]], ["ATGAGATTAG", ["ATGAGATTAG"]], ["A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_ORFs_both_strands_unit_tests():\n\n # YOUR IMPLEMENTATION HERE", "def find_all_ORFs_unit_tests():\n print 'Begin Unit test Find_all_ORFs'\n input_a='ATGCATGAATGTAGATGTAG'\n expected_output='[ATGCATGAATGTAGATGTAG, ATGAATGTAGATGTAG, ATG, ATG]'\n actual_output=find_all_ORFs(input_a)\n ...
[ "0.7691884", "0.7465497", "0.71547097", "0.7034157", "0.70336044", "0.70111084", "0.6656426", "0.659269", "0.65738535", "0.6469719", "0.6363958", "0.6361521", "0.6306454", "0.6261688", "0.62254024", "0.6223877", "0.6080115", "0.6066479", "0.6003871", "0.597892", "0.5960407", ...
0.6763755
6