query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
Ingest an edgelist from a Pandas DataFrame.
def ingest_from_edgelist_dataframe( self, edgelist: pd.DataFrame, source_column: str, target_column: str ) -> None: raise NotImplementedError()
[ "def pandasToNetworkX(edgeList):\r\n\r\n network = nx.DiGraph()\r\n\r\n for col1,col2 in edgeList.to_records(index=False):\r\n network.add_edge(col1,col2)\r\n\r\n return network", "def pathsToEdgelist(self):\n max_rows = 100000\n self.edgelist = pd.DataFrame(index = np.arange(max_row...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests the initialization and running of a workflow with a configuration yaml file
def test_workflow_config(mock_env_home, set_workflow_config, input_path, output_path): # Write workflow.yaml file workflow_name = "test-workflow-config" workflow_config = set_workflow_config[0] workflow_config["destination"]["output_path"] = output_path workflow_config["destination"]["index"] = Fals...
[ "def test_parse_workflow_yaml(self):\n cwl_wf_file = find(\"examples/clamr-ffmpeg-build/clamr_wf.cwl\")\n cwl_job_yaml = find(\"examples/clamr-ffmpeg-build/clamr_job.yml\")\n workflow_id = generate_workflow_id()\n\n workflow, tasks = self.parser.parse_workflow(workflow_id, cwl_wf_file, c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test confirms that if workflow produces no enriched data that no output file is created
def test_workflow_no_enriched_data(mock_env_home, set_workflow_config, input_path, output_path): # Create source and destination configurations source = set_workflow_config[1] destination = set_workflow_config[2] source["input_path"] = input_path destination["output_path"] = output_path # Create...
[ "def test_outputs_not_created(self):\n one_process_workflow = \"\"\"file://B <- file://A\n echo A does not produce B\n \"\"\"\n process = run_first_process(one_process_workflow)\n assert process.success is False, process.error_message\n assert process.error_message.find...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to write workflow.yaml configuration file
def write_config_file(workflow_config, workflow_name): workflow_dir = "{0}/.config/clx/{1}".format(dirname, workflow_name) if not os.path.exists(workflow_dir): os.makedirs(workflow_dir) with open(workflow_dir + "/workflow.yaml", "w") as f: yaml.dump(workflow_config, f)
[ "def write(self):\n cfgpath = os.path.join(self.config_dir, CONFIG_FILENAME)\n ofile = open(cfgpath, 'w')\n if ofile:\n log.debug( \"Write config: %s\" % cfgpath )\n cfg = yaml.dump(self.yaml, default_flow_style=False)\n log.debug( \"Config:\\n%s\" % cfg)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The dplace shift of a term t above cutoff c
def typeShiftAbove(d, c, tyT): tymap = TypeMap( onvar=lambda c, x, n: TyVar(x+d, n+d) if x >= c else TyVar(x, n+d), cutoff=c) return tymap.visit(tyT)
[ "def testShiftTerm(self):\n grid = grids.uniform_grid(\n minimums=[-10, -20],\n maximums=[10, 20],\n sizes=[201, 301],\n dtype=tf.float32)\n ys = self.evaluate(grid[0])\n xs = self.evaluate(grid[1])\n\n time_step = 0.1\n final_t = 1\n variance = 1\n a = 2\n\n def ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function provides all coordinate atoms in a PDB file, and outputs to a file.
def coord_atoms(): import os choice = input('Enter the name of the file: ') filepath = os.path.join('/home/njesh/python-mini-project-JaneNjeri/Data', choice) a_list = [] with open(filepath, 'r') as pdb: for line in pdb: if line[:4] == 'ATOM': line_split = lin...
[ "def writepdb3(list_of_coords, name):\n list_of_coords2 = []\n for elem in range(len(list_of_coords)):\n if (list_of_coords[elem] not in list_of_coords2):\n list_of_coords2.append(list_of_coords[elem])\n os.chdir(os.getcwd())\n if ((\".pdb\" not in name) and (\".PDB\" not in name)):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function write out coordinates for all alphacarbon atoms (CA), in a PDB file.
def write_CA_atoms(): import os choice = input('Enter the name of the file: ') filepath = os.path.join('/home/njesh/python-mini-project-JaneNjeri/Data', choice) ca_list = [] with open(filepath, 'r') as pdb: for line in pdb: if line[:4] == 'ATOM' and line[12:16] == " CA ": ...
[ "def writepdb(self,fname):\n pdbfile = open(fname + \".pdb\", \"w\")\n for a in self.atoms:\n pdbfile.write(str(a.type) + \"\\t\" + str(a.x) + \"\\t\" + str(a.y) + \"\\t\" + str(a.z) + \"\\n\")\n pdbfile.close()", "def writepdb3(list_of_coords, name):\n list_of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function write out the sequence of the PDB file in a fasta format, based on the coordinates section.
def write_coord_seq(): import os choice = input('Enter the name of the file: ') filepath = os.path.join('/home/njesh/python-mini-project-JaneNjeri/Data', choice) lis = [] with open(filepath, 'r') as file: for line in file: if line[:4] == 'ATOM': line_split = ...
[ "def exportfasta(db,filename):\n\n\tfl=open(filename,'w')\n\tfor cent in db.dat:\n\t\tfl.write('>%s\\n' % cent['sequence'])\n\t\tfl.write('%s\\n' % cent['sequence'])\n\tfl.close()", "def _writeOneFASTA(sequence, filehandle):\n filehandle.write(\">\" + sequence.getName()+\"\\n\")\n data = sequence.getSequenc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function calls out the submenu for writing out sequences in a PDB file, in fasta format.
def submenu2(): j = '' while j == '': print('\nS U B M E N U 2') print('1. SEQRES sequence') print('2. Coordinate sequence') print('3. Alignment sequence') print('b. Back') print('q. Quit') option = input('Select an option: ') if option.lower...
[ "def exportfasta(db,filename):\n\n\tfl=open(filename,'w')\n\tfor cent in db.dat:\n\t\tfl.write('>%s\\n' % cent['sequence'])\n\t\tfl.write('%s\\n' % cent['sequence'])\n\tfl.close()", "def _write_fasta(chain_sequences, outfile):\n with open(outfile, 'w') as f:\n for chain, seq in chain_sequences:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Main function which runs the population initialisation, then chooses which model to run, either the Python/R model or the OpenCL model
def main(parameters_file, no_parameters_file, initialise, iterations, scenario, data_dir, output, output_every_iteration, debug, repetitions, lockdown_file, use_cache, opencl, opencl_gui, opencl_gpu): # If we are running with opencl_gui then set opencl to True, so you only need to pass one flag ...
[ "def main():\n home = expanduser(\"~\")\n project_dir = \"handwritten_digit_classifer/\"\n path_to_project = os.path.join(home, project_dir)\n train_model(path_to_project)", "def main():\n # type: () -> None\n from .modelinfo import make_model_info\n\n if len(sys.argv) <= 1:\n prin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If user's input is a greeting, return a greeting response
def greeting(sentence): for word in sentence.split(): if word.lower() in GREETING_INPUTS: return random.choice(GREETING_RESPONSES)
[ "def greeting(sentence):\r\n for word in sentence.split():\r\n if word.lower() in GREETING_INPUTS:\r\n return random.choice(GREETING_RESPONSES)", "def informal_greeting():\n\n greeting_messages = [\n \"Hey, Hey man!\",\n \"How’s it going?\",\n \"What’s up?\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests the secret key sent in the post request with the one stored for this user. Also checks that the user has been set up and is not deleted Return true if they are the same, false otherwise.
def authenticateUser(self, postedSecretKey): return (not self.deleted) and self.setup_confirmed and self.secret_key == postedSecretKey
[ "def has_user(self):\n\t\treturn len( self.a_token ) > 0 and len( self.a_secret ) > 0", "def know_secret(self):\r\n return(self.secret != \"\") and (self.key != \"\")", "def check_key(request):\n try:\n access_key = request.session.get('access_key_tw', None)\n if not ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a random string of length 20 with letters and numbers to be stored as a user's secret key.
def _generateSecretKey(): return ''.join(SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(20))
[ "def get_random_secret_key():\n chars = 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'\n return get_random_string(50, chars)", "def new_secret():\n return \"\".join(\n SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(64)\n )", "def generate_key():\r\n\t\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new user to Cloudant if a user with the specified ID does not already exist.
def add_user(self, user_id): user_doc = { 'type': 'user', 'name': user_id } return self.add_doc_if_not_exists(user_doc, 'name')
[ "def addUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n # Ensure no user exists with the specified ID in the database\n if self.userIDExists(id):\n raise KeyError(\"Attempted to add a user that is already in this bbUserDB\")\n # Create and return a new user...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the ingredient based on the specified ingredientsStr in Cloudant.
def find_ingredient(self, ingredient_str): return self.find_doc('ingredient', 'name', self.get_unique_ingredients_name(ingredient_str))
[ "def search_recipe(ingredients):\n\n params = '+'.join(ingredients.split())\n url_search = SEARCH_URL.format(params)\n response = req.get(url_search)\n\n return response.content", "def add_ingredient(self, ingredient_str, matching_recipes, user_doc):\n ingredient_doc = {\n 'type': 'i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new ingredient to Cloudant if an ingredient based on the specified ingredientsStr does not already exist.
def add_ingredient(self, ingredient_str, matching_recipes, user_doc): ingredient_doc = { 'type': 'ingredient', 'name': self.get_unique_ingredients_name(ingredient_str), 'recipes': matching_recipes } ingredient_doc = self.add_doc_if_not_exists(ingredient_doc, '...
[ "def add_ingredient(self, ingredient):\r\n if isinstance(ingredient, (str)):\r\n self.ingredients.append(ingredient)\r\n elif isinstance(ingredient, (list)):\r\n for x in ingredient:\r\n self.ingredients.append(x)\r\n else:\r\n print(\"Invalid ing...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Records the request by the user for the specified ingredient. Stores the ingredient and the number of times it has been accessed in the user doc.
def record_ingredient_request_for_user(self, ingredient_doc, user_doc): try: self.client.connect() # get latest user latest_user_doc = self.client[self.db_name][user_doc['_id']] # see if user has an array of ingredients, if not create it if 'ingredient...
[ "def record_recipe_request_for_user(self, recipe_doc, ingredient_cuisine_doc, user_doc):\n try:\n self.client.connect()\n # get latest user\n latest_user_doc = self.client[self.db_name][user_doc['_id']]\n # see if user has an array of recipes, if not create it\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the unique name for the cuisine to be stored in Cloudant.
def get_unique_cuisine_name(cuisine): return cuisine.strip().lower()
[ "def cloud_name(self):\n return self._cloud_name", "def cloud_name(self) -> Optional[str]:\n return pulumi.get(self, \"cloud_name\")", "def get_customer_name(self):\n\t\treturn\tself.name", "def get_local_name(self) -> str:\n if self.username:\n return self.username\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the cuisine with the specified name in Cloudant.
def find_cuisine(self, cuisine): return self.find_doc('cuisine', 'name', self.get_unique_cuisine_name(cuisine))
[ "def find_cinema_by_name(name):\n return Cinema.objects.filter(name=name).first()", "def find_co(self, name):\n try:\n company = next(c for c in self.city.companies if c.name == name)\n return company\n except StopIteration:\n raise Exception('There is no company ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new cuisine to Cloudant if a cuisine with the specified name does not already exist.
def add_cuisine(self, cuisine_str, matching_recipes, user_doc): cuisine_doc = { 'type': 'cuisine', 'name': self.get_unique_cuisine_name(cuisine_str), 'recipes': matching_recipes } cuisine_doc = self.add_doc_if_not_exists(cuisine_doc, 'name') self.recor...
[ "def new_cuisine():\n my_cuisine = {'cuisine_name': request.form.get('cuisine_name')}\n mongo.db.cuisines.insert_one(my_cuisine)\n return redirect(url_for('find_cuisines'))", "def add_ecu(self, ecu): # type(Ecu) -> None # todo return Ecu?\n for bu in self.ecus:\n if bu.nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Records the request by the user for the specified cuisine. Stores the cuisine and the number of times it has been accessed in the user doc.
def record_cuisine_request_for_user(self, cuisine_doc, user_doc): try: self.client.connect() # get latest user latest_user_doc = self.client[self.db_name][user_doc['_id']] # see if user has an array of cuisines, if not create it if 'cuisines' not in la...
[ "def record_recipe_request_for_user(self, recipe_doc, ingredient_cuisine_doc, user_doc):\n try:\n self.client.connect()\n # get latest user\n latest_user_doc = self.client[self.db_name][user_doc['_id']]\n # see if user has an array of recipes, if not create it\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the unique name for the recipe to be stored in Cloudant.
def get_unique_recipe_name(recipe_id): return str(recipe_id).strip().lower()
[ "def name(self):\n return self.recipe_name", "def get_recipe_identifier(self, recipe):\n identifier = recipe[\"Input\"].get(\"IDENTIFIER\")\n if not identifier:\n print \"ID NOT FOUND\"\n # build a pseudo-identifier based on the recipe pathname\n recipe_path =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the recipe with the specified ID in Cloudant.
def find_recipe(self, recipe_id): return self.find_doc('recipe', 'name', self.get_unique_recipe_name(recipe_id))
[ "def get_recipe(self, _id):\n raise NotImplementedError()", "def get_recipe(cls, recipeid):\n\n recipe = Recipe.query.filter_by(recipe_id=recipeid).one()\n\n return recipe", "def fetch_recipe(*, recipe_id: int) -> Any:\n\n result = [recipe for recipe in RECIPES if recipe[\"id\"] == recip...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the user's favorite recipes in Cloudant.
def find_favorite_recipes_for_user(self, user_doc, count): try: self.client.connect() db = self.client[self.db_name] latest_user_doc = db[user_doc['_id']] if 'recipes' in latest_user_doc.keys(): user_recipes = latest_user_doc['recipes'] ...
[ "def show_fav_recipes():\n if not g.user:\n flash(\"Please login to view.\",\"warning\")\n return redirect('/login')\n \n data = search_recipes(request) \n favorite_list = [l.id for l in g.user.recipes]\n favorites = [f['id'] for f in data['results'] if f['id'] in favorite_list]\n \n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Records the request by the user for the specified recipe. Stores the recipe and the number of times it has been accessed in the user doc.
def record_recipe_request_for_user(self, recipe_doc, ingredient_cuisine_doc, user_doc): try: self.client.connect() # get latest user latest_user_doc = self.client[self.db_name][user_doc['_id']] # see if user has an array of recipes, if not create it if...
[ "def record_ingredient_request_for_user(self, ingredient_doc, user_doc):\n try:\n self.client.connect()\n # get latest user\n latest_user_doc = self.client[self.db_name][user_doc['_id']]\n # see if user has an array of ingredients, if not create it\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds a doc based on the specified doc_type, property_name, and property_value.
def find_doc(self, doc_type, property_name, property_value): try: self.client.connect() db = self.client[self.db_name] selector = { '_id': {'$gt': 0}, 'type': doc_type, property_name: property_value } que...
[ "def get_document(self, metadata_field, field_val):\n\n if metadata_field not in self.metadata_fields:\n raise MissingMetadataError([metadata_field])\n\n if metadata_field == \"date\":\n field_val = int(field_val)\n\n for document in self.documents:\n if getattr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new doc to Cloudant if a doc with the same value for unique_property_name does not exist.
def add_doc_if_not_exists(self, doc, unique_property_name): doc_type = doc['type'] property_value = doc[unique_property_name] existing_doc = self.find_doc(doc_type, unique_property_name, property_value) if existing_doc is not None: print('Returning {} doc where {}={}'.format(...
[ "def test_create_document_that_already_exists(self):\n data = {'_id': 'julia'}\n doc = self.db.create_document(data)\n self.assertEqual(self.db['julia'], doc)\n self.assertEqual(self.db.get('julia'), doc)\n self.assertEqual(self.db.get('julia', remote=True), doc)\n self.ass...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a tcl file that describes a qsys system based off a base qsys file.
def create_tcl_system_file(target, custom_components, sys_clock_rate_hz, template, working_dir): tcl_file = target.system_name + ".tcl" logger.info("Making tcl file for qsys") copyfile(RES_DIR + target.base_qsys_file, working_dir + target.base_qsys_file) quartus_version = re.search(r'.int...
[ "def gen_qsys_file(target, custom_components, sys_clock_rate_hz, template, working_dir):\n create_tcl_system_file(target, custom_components,\n sys_clock_rate_hz, template, working_dir)\n gen_qsys_file_from_tcl(target.system_name + \".tcl\", working_dir)", "def gen_qsys_file_from_tc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Run a command as a subprocess and log the cmd. Logs a message and the command to standard out and logs the output of the command to a logfile
def run_cmd_and_log(cmd, log_msg, log_file_path, err_on_fail=True): logger.info(log_msg) logger.info(f"log file can be found at {log_file_path}") logger.info(cmd.replace("\\", "\\\\")) with open(log_file_path, "w") as log_file: process = subprocess.Popen(cmd, s...
[ "def run(project, logger, cmd_name, command):\n dir_logs = project.expand('$dir_logs')\n pybuilder.utils.mkdir(dir_logs)\n out_file = os.path.join(dir_logs, '{0}.log'.format(cmd_name))\n err_file = os.path.join(dir_logs, '{0}.err'.format(cmd_name))\n with open(out_file, 'w') as out:\n with ope...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate qsys file that represents a system in Platform Designer.
def gen_qsys_file(target, custom_components, sys_clock_rate_hz, template, working_dir): create_tcl_system_file(target, custom_components, sys_clock_rate_hz, template, working_dir) gen_qsys_file_from_tcl(target.system_name + ".tcl", working_dir)
[ "def create_system(self):\n pass", "def create_tcl_system_file(target, custom_components, sys_clock_rate_hz, template, working_dir):\n tcl_file = target.system_name + \".tcl\"\n\n logger.info(\"Making tcl file for qsys\")\n copyfile(RES_DIR + target.base_qsys_file,\n working_dir + targ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the qsys file from the tcl file using qsysscript.
def gen_qsys_file_from_tcl(tcl_file, working_dir): # TODO: Updates search path from being a hardcoded (relative) path ipx_file = "components.ipx" copyfile(RES_DIR + ipx_file, working_dir + ipx_file) cmd = f'cd {working_dir} && ' + QSYS_BIN_DIR + 'qsys-script ' + \ f'--script={tcl_file} ' + \ ...
[ "def gen_qsys_file(target, custom_components, sys_clock_rate_hz, template, working_dir):\n create_tcl_system_file(target, custom_components,\n sys_clock_rate_hz, template, working_dir)\n gen_qsys_file_from_tcl(target.system_name + \".tcl\", working_dir)", "def create_tcl_system_fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the make_project.tcl file and copy over needed files.
def gen_project_tcl(project_name, project_revision, target, template, working_dir): base_project_file = target.base_proj_tcl_file top_level_vhdl_file = target.top_level_vhdl_file original_system = target.original_system logger.info("Generating make_project.tcl") with open(working_dir + "make_proje...
[ "def newproject(self):\n \n self.path = os.path.join(self.base, self.name)\n subpath = os.path.join(self.path, self.lowname)\n check_build_path(subpath)\n \n for filename, content in self.files.items():\n self.buildfile(filename, content, self.path)\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a Quartus project with the given name and revision exists.
def project_with_revision_exists(project_name, project_revision, working_dir): try: with open(working_dir + project_name + ".qpf", "r") as project_file: for line in project_file: if f"PROJECT_REVISION = \"{project_revision}\"" in line: return True ...
[ "def check_project_exists(project):\n sql = 'SELECT * FROM \"projects\" WHERE lower(name) = \"%s\" ' % (project.lower())\n c.execute(sql)\n all_rows = c.fetchone()\n return len(all_rows) > 0", "def check_project_exists(cls, owner, project_name):\n project_exists = Project.objects.filter(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate and compiles the project defined in make_project.tcl.
def gen_project(project_name, project_revision, target, template, working_dir): gen_project_tcl(project_name, project_revision, target, template, working_dir) qsys_files = filter(lambda file: file.endswith(".qsys"), target.files_list) for file in qsys_files: gen_qsys_system_from_...
[ "def gen_project_tcl(project_name, project_revision, target, template, working_dir):\n base_project_file = target.base_proj_tcl_file\n top_level_vhdl_file = target.top_level_vhdl_file\n original_system = target.original_system\n\n logger.info(\"Generating make_project.tcl\")\n\n with open(working_dir...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compile an existing Quartus project. Creates a tcl file to execute the compilitation with.
def compile_project(project_name, project_revision, template, working_dir): tcl_file = "compile_project.tcl" with open(working_dir + tcl_file, "w") as compile_file: compile_file.write(template.add_quartus_compile_project( project_name, project_revision)) log_msg = "Compiling project" ...
[ "def gen_project_tcl(project_name, project_revision, target, template, working_dir):\n base_project_file = target.base_proj_tcl_file\n top_level_vhdl_file = target.top_level_vhdl_file\n original_system = target.original_system\n\n logger.info(\"Generating make_project.tcl\")\n\n with open(working_dir...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert the sof file to an rbf file.
def gen_rbf(working_dir, target_system): log_msg = "Generating rbf file" # Command uses -m FPP for the fast passive parallel which ends up being equivalent to passive parallel x16 cmd = f"cd {working_dir}/output_files && {QUARTUS_BIN_DIR}quartus_cpf -c -m FPP {target_system}.sof {target_system}.rbf" log...
[ "def write_arcgis_fltfile(grb_name):\r\n \r\n rows = 3712 # fixed for MPE grid\r\n cols = 3712 # fixed for MPE grid\r\n\r\n bin_name = grb_name[0:-4] + '.bin'\r\n flt_name = grb_name[0:-4] + '.flt'\r\n hdr_name = grb_name[0:-4] + '.hdr'\r\n\r\n exec_str = 'wgrib2 -no_f77 ' + '-bin ' + bin_name ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute quartus workflow to create a system, project, compiles it, and convert the output file to an RBF.
def execute_quartus_workflow(target_system, custom_components, sys_clock_rate_hz, working_dir=""): init_logging() target = None if(target_system == "audiomini"): target = Audiomini elif(target_system == "reflex"): target = Reflex elif(target_system == "audioblade"): target =...
[ "def runWorkflow():\n\n brainsuite_workflow = pe.Workflow(name=WORKFLOW_NAME)\n brainsuite_workflow.base_dir=WORKFLOW_BASE_DIRECTORY\n\n\n bseObj = pe.Node(interface=bs.Bse(), name='BSE')\n bfcObj = pe.Node(interface=bs.Bfc(),name='BFC')\n pvcObj = pe.Node(interface=bs.Pvc(), name = 'PVC')\n cereb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is passed a set of NII images, their PNG equilvalents, and an html base path, and then it generates the metadata needed
def generate_scanset_metadata( image_set_dictionary, html_base_path, session_id ): cur_subj_info = {} """need to think through the data structure a bit more.... but can always adjust later """ cur_subj_info['session_id'] = session_id #cur_subj_info['img_id'] = counter cur_subj_info['subject_id'] = session_i...
[ "def test_buildhtml_samediagram():\n files = glob.glob(os.path.join(_outdir, '_images', 'plantuml-*.png'))\n assert len(files) == 1\n imgtags = [l for l in readfile('index.html').splitlines()\n if b'<img src=\"_images/plantuml' in l]\n assert len(imgtags) == 2", "def _update_metadata_ima...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`members` is an indicator map of integers in {0,...,n 1}, indicating whether or not they have been selected. This returns the length of the longest sequence of consecutive selected integers, allowing for wrapping around the end of the list.
def longest_consecutive_run(members, n): try: # first false element, so that when the loop ends we know we're at the # end of a run start = next(ind for ind, m in enumerate(members) if not m) except StopIteration: return n longest_run = current_run = 0 for i in range(n): ...
[ "def get_num_members(self, *args):\n def getsize(a):\n return CPX_PROC.getsos_info(self._env._e, self._cplex._lp, a, a)[1]\n return apply_freeform_one_arg(\n getsize, self._conv, self.get_num(), args)", "def member_count(self):\n return len(self.members)", "def count_m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Efficiently calculate proportions, but also print out every combination for testing purposes.
def main(): for combination in indicated_combinations(7, 3): print("{}: {}".format("".join(map(str, combination)), (longest_consecutive_run(combination, 7)))) run_lengths = Counter(longest_consecutive_run(combination, 7) for combination in indicated_combinations...
[ "def get_proportions(self):\n data = []\n for member in self.members:\n proportion = 1\n for m, b in zip(member, self.bases):\n proportion *= b.composition[m]\n data.append(proportion)\n return data", "def leitner_proportions(df):\n denom = d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This API call is used by clients to generate a transient unique identifier (device_id stored on client) which ties the device to a persistent voter_id (mapped together and stored on the server).
def device_id_generate_view(request): # deviceIdGenerate voter_device_id = generate_voter_device_id() # Stored in cookie elsewhere if 'test' not in sys.argv: logger.debug("apis_v1/views.py, device_id_generate-voter_device_id: {voter_device_id}".format( voter_device_id=voter_device_id)) ...
[ "def generate_device_id():\n\n # TODO this is awful, makes me sad, but for now also makes demoing\n # easier We might want to look into an auto-configuration feature for\n # devices, such that ids are not input manually on devices\n\n _attempts = 0\n generated_id = ''\n whi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This API call is used by clients to add a Firebase Cloud Messaging token ~ FCB Token to the device_id record. FCM Tokens are generated by Google's Firebase Cloud Messaging service, and are unique for every device. FCM Tokens allow the cloud messaging service to send messages (Notifications) to individual devices.
def device_store_firebase_fcm_token_view(request): # deviceStoreFirebaseCloudMessagingToken voter_device_id = get_voter_device_id(request) # We standardize how we take in the voter_device_id # cloud_messaging.test_msg_to_my_phone() if positive_value_exists(voter_device_id): voter_device_id = get...
[ "def post_token():\n token = request.json.get('token')\n deviceId = request.json.get('deviceId')\n\n user = User.query.filter_by(token=token).first()\n device = DevicesNotificationHandlers.query.filter_by(user_id=user.id).first()\n\n if device is None:\n # Device doesn't exist for that user cr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function tokenizes the input string into words. Words are delimited by any character other than az, AZ, or 09. Input parameter is a string value named myBlob Return value for the function is a list named words having various individual words
def tokenize_into_words(myblob): set_constraint = re.compile(r'[^a-zA-Z0-9]') tokenize_to_text = set_constraint.split(myblob) # The blob is spilt into words and the given constraints are applied words = [word for word in tokenize_to_text if word] return words
[ "def make_tokens(self, blob):\n # Kill the punctuation.\n blob = self.PUNCTUATION.sub(' ', blob)\n tokens = []\n\n # Split on spaces.\n for token in blob.split():\n # Make sure everything is in lowercase & whitespace removed.\n token = token.lower().strip()\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function counts the total number of unique words in a list of words. Input parameter is a list of strings named words. Return value for the function is a dictionary named total_count__of_words
def count_unique_words(words): total_count__of_words = {} # Defining a Dictionary for word in words: if word.lower() in total_count__of_words: # As mentioned in the requirements checking for case insensitive matching total_count__of_words[word.lower()] += 1 else: tota...
[ "def count_words(list_words):\n dict_occurences = {}\n for word in list_words:\n try:\n dict_occurences[word] += 1\n except KeyError:\n dict_occurences[word] = 1\n return dict_occurences", "def _get_word_counts(self, words_list):\n word_counts = defaultdict(lamb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function returns the most frequent words from the dictionary and sorts them by decreasing value of their counts Input parameters are a dictionary named total_count__of_words and n (Integer value) Return value is a list comprising of (word of string type, total count of integer type)
def display_top_n_words(total_count__of_words, n): # Considering n=10 here as specified in the requirements return sorted(total_count__of_words.items(), key=lambda i: i[1], reverse=True)[:n]
[ "def get_top_n_words(word_list, n):\n\n\t# Creates a histogram of how often the same word appears in the book\n\tword_histogram = dict()\n\tfor word in word_list:\n\t\tword_histogram[word] = 1 + word_histogram.get(word, 0)\n\n\t# Converts the dictionary into a tuple and sorts the tuple by the frequency of each word...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send a protocol message.
def send_protocol_message(self, msg): self.conn.send(msg + "\0")
[ "def sendmsg(self, msg):\n self.client.send(msg.encode())", "def send(self, msg: tgpdu.TGMessage) -> int:", "def send(self, msg):\n self.__sock.send(msg)", "def send_message(self, msg):\n msg_len_bytes = struct.pack(\"<I\", len(msg))\n if isinstance(msg, str):\n msg = ms...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves an item from the table row using a column name as an index. If the column is missing and required, an exception is raised. If the missing column is optional, not exception is raised and no warning is issued. If the missing column is neither required nor optional, a warning is issued.
def __getitem__(self, colname): colname = colname.lower() if colname in self.data: return self.data[colname] else: if colname in self.required: raise ColumnNameError( 'A required column, "' + colname + '", was missing.', ...
[ "def get(self, column_name, row_index):\n self.check_for_column(column_name)\n return self.data[column_name][row_index]", "def __getitem__(self, item):\n\n assert self.column_data, \"Get item only works if column data is set!\"\n\n if isinstance(item, int):\n return self.col...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the column names that are required in the input CSV file. If one or more of these columns are missing, an exception will be thrown.
def setRequiredColumns(self, colnames): # Make sure all column names are lower case so comparisons in _TableRow # are not case sensitive. From a modularity standpoint, this should be # done in _TableRow, but it is more efficient to do it here, since the # conversion need be done only on...
[ "def validate_column_names(self, cols):\n self.stdout.write('Verifying CSV header')\n csv_cols = set(cols)\n if self.required_csv_columns <= csv_cols:\n return True\n else:\n missing_cols = set(self.required_csv_columns).difference(csv_cols)\n raise Valid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the column names that are optional in the input CSV file. If one or more of these columns are missing, no exception will be thrown and no warning will be issued. Access to missing columns that are neither required nor optional will result in a warning being issued. To specify that all nonrequired columns are optio...
def setOptionalColumns(self, colnames): # Make sure all column names are lower case so comparisons in _TableRow # are not case sensitive. From a modularity standpoint, this should be # done in _TableRow, but it is more efficient to do it here, since the # conversion need be done only on...
[ "def setRequiredColumns(self, colnames):\n # Make sure all column names are lower case so comparisons in _TableRow\n # are not case sensitive. From a modularity standpoint, this should be\n # done in _TableRow, but it is more efficient to do it here, since the\n # conversion need be don...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets default values for one or more columns. If a nonrequired column is missing, the default value will be returned. An empty string ('') is the default default value.
def setDefaultValues(self, defaultvals): # Add lower-case versions of all column names to the dictionary to # ensure that comparisions in _TableRow are not case sensitive. From a # modularity standpoint, this should be done in _TableRow, but it is # more efficient to do it here rather t...
[ "def setOptionalColumns(self, colnames):\n # Make sure all column names are lower case so comparisons in _TableRow\n # are not case sensitive. From a modularity standpoint, this should be\n # done in _TableRow, but it is more efficient to do it here, since the\n # conversion need be don...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves a table from the source document according to an integer index. Must be implemented by child classes.
def getTableByIndex(self, index): pass
[ "def get_table_by_index(self, idx):\n for i, table in enumerate(self.iter_tables()):\n if i == idx:\n return table\n raise IndexError(f\"No table at index {idx:d} found in VOTABLE file.\")", "def tablebyindex(filehandle, index):\n with filehandle:\n tableindex = 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Credit deliverer account for its delivery (simulated)
def credit_deliverer(): return True
[ "def charge_credit_card(amount,save_to_cim=False):\n\n # Create a merchantAuthenticationType object with authentication details\n # retrieved from the constants file\n merchantAuth = apicontractsv1.merchantAuthenticationType()\n merchantAuth.name = CONSTANTS.apiLoginId\n merchantAuth.transactionKey =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Kafka Ordering Topic Producer as thread worker Get messages from a shared mq queue.Queue
def kafka_ordering_producer_worker(mq: queue.Queue): global app_config # Client producer = KafkaProducer(bootstrap_servers=bootstrap_servers, value_serializer=lambda item: json.dumps(item).encode('utf-8')) while not t_stop_event.is_set(): try: if mq.qsi...
[ "def kafka_ordering_consumer_worker(mq: queue.Queue):\n global app_config\n\n # Client\n consumer = KafkaConsumer('ordering',\n bootstrap_servers=bootstrap_servers,\n value_deserializer=lambda item: json.loads(item.decode('utf-8')))\n\n while not t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Kafka Ordering Topic Consumer as thread worker
def kafka_ordering_consumer_worker(mq: queue.Queue): global app_config # Client consumer = KafkaConsumer('ordering', bootstrap_servers=bootstrap_servers, value_deserializer=lambda item: json.loads(item.decode('utf-8'))) while not t_stop_event.i...
[ "def kafka_ordering_producer_worker(mq: queue.Queue):\n global app_config\n\n # Client\n producer = KafkaProducer(bootstrap_servers=bootstrap_servers,\n value_serializer=lambda item: json.dumps(item).encode('utf-8'))\n\n while not t_stop_event.is_set():\n try:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Kafka Payment Topic Consumer as thread worker
def kafka_payment_consumer_worker(mq: queue.Queue): global app_config # Client consumer = KafkaConsumer('payment', bootstrap_servers=bootstrap_servers, value_deserializer=lambda item: json.loads(item.decode('utf-8'))) while not t_stop_event.i...
[ "def main():\n config = configuration['local']\n KAFKA_BOOTSTRAP_SERVER = config.bootstrap_server\n print(KAFKA_BOOTSTRAP_SERVER)\n consumer_config = dict(bootstrap_servers=KAFKA_BOOTSTRAP_SERVER,\n auto_offset_reset='earliest',\n enable_auto_commit=Fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a dictionary mapping each name in `fields` to the sequence of values seen for that field in the given file.
def get_fields(csv_file, fields): result = OrderedDict() for field in fields: result[field] = [] with open(csv_file) as f: reader = csv.DictReader(f) for row in reader: for field in fields: result[field].append(row[field]) return result
[ "def _make_field_map(fields):\n field_map = {}\n for field in fields:\n if field.name in field_map:\n raise SchemaParseException(\n 'Duplicate record field name %r.' % field.name)\n field_map[field.name] = field\n return field_map", "def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Plot the given data. Expect to receive a dict mapping experiment names to results. Each result is itself a dict mapping a type of data to a sequence of values. Each experiment has a different colour, and each type of data has a different line style.
def plot(data, colours, line_styles): plt.style.use("seaborn-poster") # See also seaborn-talk and seaborn-paper. plt.grid(axis="y", linestyle="-", color="#d8dcd6") for name, experiment in data.items(): for label, series in experiment.items(): epochs = range(1, len(series) ...
[ "def plot_visualization(plot_name, experiment_results, metric_results, true_params, config):\n X_test = []\n for dgp_name in config['dgps'].keys(): # just one right now\n for method_name in config['methods'].keys():\n X_test = experiment_results[dgp_name][method_name][0][0][0]\n p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract the convolution type from the name of the log file. Assumes the log file has been created using this tool.
def get_conv_type(filename): for conv_type in structured.conv2d_types.keys(): if conv_type in filename: return conv_type else: log.error("Couldn't detect convolution type of", filename) exit(1)
[ "def _process_config(self, confobject: {}) -> str:\n file, ext = self._get_extensions([confobject.get('filenm')])\n return self._get_file_type(ext)", "def _get_modelname_from_log(self):\n with open(os.path.join(self.workdir, 'FEMAG-FSL.log')) as f:\n for l in f:\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the fraction of truth localizations that have a measured localization within X pixels (in the XY plane). truth_i3 A readinsight3.I3Reader object with the ground truth localizations. measured_i3 A readinsight3.I3Reader object with the found localizations. tolerance The search radius in pixels.
def recallFraction(truth_i3, measured_i3, tolerance): if (measured_i3.getNumberMolecules() == 0): return [0, truth_i3.getNumberMolecules()] recalled_locs = 0 total_locs = 0 for i in range(truth_i3.getNumberFrames()): t_locs = truth_i3.getMoleculesInFrame(i+1) m_locs = measur...
[ "def GetIsolatedValueTolerance(self) -> \"unsigned short const &\":\n return _itkIsolatedConnectedImageFilterPython.itkIsolatedConnectedImageFilterIUS3IUS3_GetIsolatedValueTolerance(self)", "def GetIsolatedValueTolerance(self) -> \"float const &\":\n return _itkIsolatedConnectedImageFilterPython.itk...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds the given checker to the inputed collumn at the first available row
def add_checker(self, checker, col): assert(checker == 'X' or checker == 'O') assert(0 <= col < self.width) row = self.height -1 while True: if self.slots[row][col] == ' ': self.slots[row][col] = checker break else: ...
[ "def add_checker(self, checker, col):\n\n assert(checker == 'X' or checker == 'O')\n\n assert(col >= 0 and col < self.width)\n\n\n\n if self.slots[0][col] == ' ':\n\n for i in range(self.height):\n\n \n\n if self.slots[i][col] =='X' or self.slots[i][col]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes in a string of column numbers and places alternating checkers in those columns of the called Board object, starting with 'X'.
def add_checkers(self, colunms): checker = 'X' # start by playing 'X' for col_str in colunms: col = int(col_str) if 0 <= col < self.width: self.add_checker(checker, col) # switch to the other checker if checker == 'X': c...
[ "def add_checkers(self, colnums):\n\n checker = 'X' # start by playing 'X'\n\n\n\n for col_str in colnums:\n\n col = int(col_str)\n\n if 0 <= col < self.width:\n\n self.add_checker(checker, col)\n\n\n\n # switch to the other checker\n\n if check...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes the top checker from a collumn
def remove_checker(self, col): for r in range(self.height): if self.slots[r][col] != ' ': self.slots[r][col] = ' ' break
[ "def remove_checker(self, col):\n for x in range(self.height):\n if self.slots[x][col] != ' ':\n self.slots[x][col] = ' '\n break", "def remove_checker(self, col):\r\n row = 0\r\n if row < self.height:\r\n while row < self.height -1 and self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks for a horizontal win for the specified checker.
def is_horizontal_win(self, checker): for row in range(self.height): for col in range(self.width - 3): # Check if the next four columns in this row # contain the specified checker. if self.slots[row][col] == checker and \ self.slots[row...
[ "def is_horizontal_win(self, checker):\n for row in range(self.height):\n for col in range(self.width - 3):\n # Check if the next four columns in this row\n # contain the specified checker.\n if self.slots[row][col] == checker and \\\n self.sl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks for a vertical win for the specified checker
def is_vertical_win(self, checker): for row in range(self.height-3): for col in range(self.width): if self.slots[row][col] == checker and \ self.slots[row+1][col] == checker and \ self.slots[row+2][col] == checker and \ self.slots[row+3...
[ "def is_vertical_win(self, checker):\r\n for col in range(self.width):\r\n for row in range(self.height - self.win_condition + 1):\r\n # Analyze every vertical group of win_condition checkers \r\n # (eg. every vertical group of 3 checkers if the winning \r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks for a down diagonal win for the specified checker
def is_down_diagonal_win(self, checker): for row in range(self.height-3): for col in range(self.width-3): if self.slots[row][col] == checker and \ self.slots[row+1][col+1] == checker and \ self.slots[row+2][col+2] == checker and \ self....
[ "def is_down_diagonal_win(self, checker):\r\n for row in range(self.height - self.win_condition + 1):\r\n for col in range(self.width - self.win_condition + 1):\r\n num_checkers = 0\r\n for i in range(self.win_condition):\r\n if self.grid[row + i][c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks for a up diagonal win for the specified checker
def is_up_diagonal_win(self, checker): for row in range(3, self.height): for col in range(self.width-3): if self.slots[row][col] == checker and \ self.slots[row-1][col+1] == checker and \ self.slots[row-2][col+2] == checker and \ self.s...
[ "def is_up_diagonal_win(self, checker):\r\n for row in range(self.height - self.win_condition + 1):\r\n for col in range(self.width - self.win_condition + 1):\r\n num_checkers = 0\r\n for i in range(self.win_condition):\r\n if self.grid[self.height ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Joint pairs which defines the pairs of joint to be swapped when the image is flipped horizontally.
def joint_pairs(self): return [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16], #17 body keypoints [20-3, 23-3], [21-3, 24-3], [22-3, 25-3], [26-3, 42-3], [27-3, 41-3], [28-3, 40-3], [29-3, 39-3], [30-3, 38-3], [31-3, 37-3], [32-3, 36-3], [33-3, 35-3], [43-3, 52-3], [44-3,...
[ "def joint_pairs(self):\n return ((1, 4), (2, 5), (3, 6), (14, 11), (15, 12), (16, 13))", "def joint_pairs(self):\n return [[1, 2], [3, 4], [5, 6], [7, 8],\n [9, 10], [11, 12], [13, 14], [15, 16]]", "def bone_pairs(self):\n return ((0, 3), (1, 4), (2, 5), (10, 13), (11, 14), ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test standin functions when optional dependencies not installed.
def test_optional_deps_functions(): with pytest.raises(ModuleNotFoundError, match="No module named 'scipy.integrate'"): quad() with pytest.raises(ModuleNotFoundError, match="No module named 'scipy.special'"): ellipkinc() with pytest.raises(ModuleNotFoundError, match="No module named 'scipy...
[ "def test_require():", "def test_unanchored_circular_dependencies(self):\n\n self.unanchored_circular_dependencies_helper(\"install\")\n self.unanchored_circular_dependencies_helper(\"exact-install\")", "def test_origin_dependencies(self):\n\n self.origin_dependencie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test method ``.clone()`` changing a(many) Parameter(s).
def test_clone_change_param(self, cosmo): super().test_clone_change_param(cosmo) # don't change any values kwargs = cosmo._init_arguments.copy() kwargs.pop("name", None) # make sure not setting name c = cosmo.clone(**kwargs) assert c.__class__ == cosmo.__class__ ...
[ "def test_clone_change_param(self, cosmo):\n pass", "def test_clone_scenario(self):\n pass", "def test_clone_fail_unexpected_arg(self, cosmo):\n with pytest.raises(TypeError, match=\"unexpected keyword argument\"):\n newclone = cosmo.clone(not_an_arg=4)", "def test_clone_name(s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that efunc and inv_efunc give inverse values. Here they just fail b/c no ``w(z)`` or no scipy.
def test_efunc_vs_invefunc(self, cosmo): exception = NotImplementedError if HAS_SCIPY else ModuleNotFoundError with pytest.raises(exception): cosmo.efunc(0.5) with pytest.raises(exception): cosmo.inv_efunc(0.5)
[ "def test_efunc_vs_invefunc(self, cosmo):\n # super().test_efunc_vs_invefunc(cosmo) # NOT b/c abstract `w(z)`\n z0 = 0.5\n z = np.array([0.5, 1.0, 2.0, 5.0])\n\n assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0))\n assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_ef...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test that ``efunc`` and ``inv_efunc`` give inverse values. Note that the test doesn't need scipy because it doesn't need to call ``de_density_scale``.
def test_efunc_vs_invefunc(self, cosmo): # super().test_efunc_vs_invefunc(cosmo) # NOT b/c abstract `w(z)` z0 = 0.5 z = np.array([0.5, 1.0, 2.0, 5.0]) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z))
[ "def TestInverse(self):\n\n a = self.GetRandomElement(nonZero=1)\n aInv = self.Inverse(a)\n prod = self.Multiply(a,aInv)\n assert 1 == prod, ('TestInverse failed:' + 'a=' + repr(a) + ', aInv='\n + repr(aInv) + ', prod=' + repr(prod),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the list widget with frames, ordered as selected (by rank or chronological). Set the colors of each item according to its current inclusion / exclusion state.
def fill_list_widget(self): # Initialize the inclusion / exclusion state of frames in the frame list. self.listWidget.clear() for i in range(self.frames.number_original): if self.frame_ordering == "quality": frame_number = self.quality_sorted_indices[i] e...
[ "def select_items(self):\n\n self.listWidget.currentItem().setSelected(True)\n self.items_selected = self.listWidget.selectedItems()\n\n if self.frame_ordering == \"quality\":\n self.indices_selected = [self.quality_sorted_indices[self.listWidget.row(item)] for item\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a list item or a range of items is selected, store the items and corresponding indices. Synchronize the frame slider and frame viewer with the the current list position.
def select_items(self): self.listWidget.currentItem().setSelected(True) self.items_selected = self.listWidget.selectedItems() if self.frame_ordering == "quality": self.indices_selected = [self.quality_sorted_indices[self.listWidget.row(item)] for item ...
[ "def update_list_view(self):\n # Clear the list/tree view.\n self.list_view.clear()\n\n # Find all the selected things in Maya.\n selected = cmds.ls(selection=True)\n\n # For each of the selected things, create a widget item.\n for thing in selected:\n item = QtG...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the frame slider to the value currently selected in the listWidget. Update the photo displayed in the viewer.
def synchronize_slider(self): # Block slider signals to avoid a shortcut. self.slider_frames.blockSignals(True) if self.frame_ordering == "quality": self.quality_index = self.listWidget.currentRow() self.frame_index = self.quality_sorted_indices[self.quality_index] ...
[ "def slider_frames_changed(self):\n\n # Again, please note the difference between indexing and GUI displays.\n index = self.slider_frames.value() - 1\n\n # Differentiate between frame ordering (by quality or chronologically).\n if self.frame_ordering == \"quality\":\n self.fra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This eventFilter is listening for events on the listWidget. List items can be marked as included / excluded by either using a context menu, by pressing the "+" or "" buttons, or by pressing the keyboard keys "+" or "".
def eventFilter(self, source, event): if source is self.listWidget: # Open a context menu with two choices. Depending on the user's choice, either # trigger the "use_triggered" or "not_use_triggered" method below. if event.type() == QtCore.QEvent.ContextMenu: ...
[ "def eventFilter(self, qobject, event):\n return False", "def enableFilter(self, items=None):", "def bs_filterListWidget(listWidget, lineEdit, defaultList):\n # get keyword for filter.\n searchKey = lineEdit.text()\n if not searchKey:\n listWidget.clear()\n listWidget.addItems(defa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The user has selected a list item or a range of items to be included in the stacking workflow. Change the appearance of the list entry, update the "index_included" values for the corresponding frames, and reload the image of the current index. The latter step is important to update the overlay mark in the upper left im...
def use_triggered(self): self.select_items() if self.items_selected: for index, item in enumerate(self.items_selected): index_selected = self.indices_selected[index] frame_selected = index_selected + 1 item.setText("Frame %i included" % frame_...
[ "def slider_frames_changed(self):\n\n # Again, please note the difference between indexing and GUI displays.\n index = self.slider_frames.value() - 1\n\n # Differentiate between frame ordering (by quality or chronologically).\n if self.frame_ordering == \"quality\":\n self.fra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The frames slider is changed by the user. Update the frame in the viewer and scroll the frame list to show the current frame index.
def slider_frames_changed(self): # Again, please note the difference between indexing and GUI displays. index = self.slider_frames.value() - 1 # Differentiate between frame ordering (by quality or chronologically). if self.frame_ordering == "quality": self.frame_index = sel...
[ "def frame_slider_callback(self):\n frame_index = self.frame_slider.value()\n self.update_image(frame_index=frame_index)\n self.update_tracks()\n self.overlay_search_radii()", "def handle_time_slider_change(self, frame):\r\n self.viewer.state.current_frame = frame", "def updat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the frame player is running, it periodically checks this variable. If it is set to False, the player stops.
def pushbutton_stop_clicked(self): if self.frame_player.run_player: self.frame_player.run_player = False
[ "def shooting(self):\r\n return not self.stopped", "def stop(self):\r\n self.looping = 0", "def pause(self):\n self.isRunning = False", "def pauseCheck(self):\n while (self.playStatus == False and self.pauseNow == True):\n self.isPause = True\n time.sleep(.25)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On exit from the frame viewer, update the selection status of all frames and send a completion signal.
def done(self): # Check if the status of frames has changed. indices_included = [] indices_excluded = [] for index in range(self.frames.number_original): if self.index_included[index] and not self.frames.index_included[index]: indices_included.append(index) ...
[ "def finishedSelection(self):\n self.close()\n self.finished.emit()", "def hook_frame_unselected(self):", "def ExitAllFrames():\r\n pass", "def endExperiment(self):\n if __debug__:\n log.debug('Attempting to update execution buttons: end.')\n for frame in self.fra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function sets the 5 frequencies of nuclei at the instance's magnetic field,
def set_freq_relaxation(self): self.num_omega=5 self.omega=np.zeros(self.num_omega) iOmH = 3 ; # indexing for the frequencies. iOmX = 1 ; # # First determine the frequencies omega and J from given inputs. self.omega[iOmH] = -1.0*self.gH.gamma*self.B_0*self.time_fact ...
[ "def setupFreqs(self, B):\n self.omegaGyro = self.Z * self.e * B / (self.mass_eV / self.kg2eV)\n if np.isscalar(self.omegaGyro):\n self.omegaGyro = np.array([self.omegaGyro])\n\n self.fGyro = np.abs(self.omegaGyro)/(2*np.pi)\n self.TGyro = 1.0/self.fGyro\n return", "d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Taking Eq. 4 of Ghose, Fushman and Cowburn (2001), calculate rho from R1, R2, and NOE directly, rather than from the spectral density J(omega). This is used to convert experimental measurements to rho. rvec is the triple of (R1, R2, NOE) Error is known to be bad.
def calculate_rho_from_relaxation(self, rvec, drvec=[] ): if drvec==[]: R1=rvec[0] ; R2=rvec[1] ; NOE=rvec[2] HF = -0.2*(self.gX.gamma/self.gH.gamma)*(1-NOE)*R1 R1p = R1 - 7.0*(0.921/0.87)**2.0*HF R2p = R2 - 6.5*(0.955/0.87)**2.0*HF return 4.0/3.0*R1...
[ "def calculate_rho_from_relaxation(gamma_H, gamma_N, R1, R2, NOE):\n HF = -0.2*(gamma_N/gamma_H)*(1-NOE)*R1\n R1p = R1 - 7.0*(0.921/0.87)**2.0*HF\n R2p = R2 - 6.5*(0.955/0.87)**2.0*HF\n\n return 4.0/3.0*R1p/(2.0*R2p-R1p)", "def rho(s,m1,m2):\n\treturn (s**2 + m1**4 + m2**4 - 2*s*m1**2 - 2*s*m2**2 - 2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the 5 fullanisotropic Dcoefficients associated with the D_rot ellipsoid. Also returns 'delta' required for the corresponding A_coefficient computation, if required.
def D_coefficients_ellipsoid(D, bDoDelta=False): Diso= ( D[0] + D[1] + D[2] )/3.0 D2 = ( D[0]*D[1] + D[0]*D[2] + D[1]*D[2] )/3.0 fact1= sqrt(Diso**2 - D2**2) D_J=np.zeros(5) D_J[0]= 4*D[0] + D[1] + D[2] D_J[1]= D[0] + 4*D[1] + D[2] D_J[2]= D[0] + D[1] + 4*D[2] D_J[3]= 6*Diso...
[ "def Drep(self):\n sinE = np.sin(self.E())\n cosE = np.cos(self.E())\n return -self.alpha()*sinE+(self.beta()+self.GAMMA)*cosE", "def A_coefficients_ellipsoid(v, DD, bDDisDelta=False):\n #v can be given as an array with X/Y/Z cartesian dimensions being the last.\n #\"\"\"\n if bDDisD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the 5 sullanisotropic Acoefficients associated with orientation of the vector w.r.t. to the D_rot ellipsoid. DD is given either as the DRot elements or its 'delta' transformation for direct use.
def A_coefficients_ellipsoid(v, DD, bDDisDelta=False): #v can be given as an array with X/Y/Z cartesian dimensions being the last. #""" if bDDisDelta: delta=DD else: delta=Ddelta_ellipsoid(dd) #v=_sanitise_v(v) #v2=np.square(v) #v4=np.square(v2) #fact2=np.multiply(0.75,np...
[ "def D_coefficients_ellipsoid(D, bDoDelta=False):\n Diso= ( D[0] + D[1] + D[2] )/3.0\n D2 = ( D[0]*D[1] + D[0]*D[2] + D[1]*D[2] )/3.0\n fact1= sqrt(Diso**2 - D2**2)\n D_J=np.zeros(5)\n D_J[0]= 4*D[0] + D[1] + D[2]\n D_J[1]= D[0] + 4*D[1] + D[2]\n D_J[2]= D[0] + D[1] + 4*D[2]\n D...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lowest level operation. J = Sum_i components for each om. Return dimensions (N_om) for one vector A_j, and (N_Aj,N_om) otherwise.
def _do_Jsum(om, A_J, D_J): Dmat=npufunc.Jomega.outer(D_J,om) return np.einsum('...j,jk',A_J,Dmat)
[ "def dimension_reduction(X, k=10):\n cov = cov_generation(X)\n eig, eigv, _, _ = jacobi_loop(cov)\n sort_args = np.argsort(np.abs(eig))[::-1]\n projection_matrix = eigv[sort_args][:, :k]\n reduce_x = np.dot(X, projection_matrix)\n \n return projection_matrix, reduce_x", "def _A_shape(self):\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This calculats the J value for combining an isotropic global tumbling with a fitted internal autocorrelation C(t), where C(t) = S2 + Sum{ consts[i] exp ( t/tau[i] } thus this allows fits to multiple time constants in C(t).
def J_combine_isotropic_exp_decayN(om, tau_iso, S2, consts, taus): k = (1.0/tau_iso)+(1.0/np.array(taus)) ndecay=len(consts) ; noms =len(om) Jmat = np.zeros( (ndecay+1, noms ) ) Jmat[0]= S2*tau_iso/(1.+(om*tau_iso)**2.) for i in range(ndecay): Jmat[i+1] = consts[i]*k[i] /(k[i]**2.+om**2.) ...
[ "def J(cst, x):\n [u0, v0, u1, v1, u2, v2, coeffs] = cst\n [u, v, g1, g2, g3] = x\n df1du = 2*u*g3**2 - 2*g3*u0 + 2*g3*coeffs[3]*(g1*u1-u0) + 2*g3*coeffs[4]*(g2*u2-u0)\n df1dv = -2*v*g3**2 + 2*g3*v0 - 2*g3*coeffs[3]*(g1*v1-v0) - 2*g3*coeffs[4]*(g2*v2-v0)\n df1dg1 = 2*g1*coeffs[0]*(u1**2-v1**2) + 2*(v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Taking Eq. 4 of Ghose, Fushman and Cowburn (2001), calculate rho from R1, R2, and NOE directly, rather than from the spectral density J(omega). THis is used to convert experimental measurements to rho.
def calculate_rho_from_relaxation(gamma_H, gamma_N, R1, R2, NOE): HF = -0.2*(gamma_N/gamma_H)*(1-NOE)*R1 R1p = R1 - 7.0*(0.921/0.87)**2.0*HF R2p = R2 - 6.5*(0.955/0.87)**2.0*HF return 4.0/3.0*R1p/(2.0*R2p-R1p)
[ "def rho(s,m1,m2):\n\treturn (s**2 + m1**4 + m2**4 - 2*s*m1**2 - 2*s*m2**2 - 2*m1**2*m2**2)**.5/s", "def rho(values1, values2):\n\tv1, v2 = np.array(values1), np.array(values2)\n\tn = len(v1)\n\treturn 1 - 6 * np.sum((v1 - v2)**2) / float(n * (n*n -1))", "def solve_for_rho2(rho):\n # Calculate pressure a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find y(xi) by splitting x in half repeatedly until the x is found.
def interpolate_point(xi, x, y): num_pts = len(x) if num_pts%2==0: #Even i_h2 = num_pts/2 i_h1 = num_pts/2 - 1 if x[i_h2] < xi: return interpolate_point(xi, x[i_h2:], y[0:i_h2:]) elif x[i_h1] > xi: return interpolate_point(xi, x[0:i_h1], y[0:i_h1])...
[ "def findy2(yxCells,yi1,numCells):\r\n y = yxCells[yi1,0]\r\n yit = yi1 + 1\r\n found = True\r\n while (found) and (yit<numCells):\r\n if int(yxCells[yit,0]) != y:\r\n found = False\r\n else:\r\n yit = yit + 1\r\n if not found:\r\n y2 = yit - 1\r\n else:\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a position within the source text, move the position past the skippable stuff (whitespace and comments).
def process_skippable(self, pos): newlines = [] done = False while not done: # Strip any leading whitespace ws = self.whitespace_match.match(self.src, pos=pos) if ws: # The span of a match from regex is (startidx, after_idx), so our new positio...
[ "def skipSpaces(self, pos: int) -> int:\n while True:\n try:\n current = self.src[pos]\n except IndexError:\n break\n if not isStrSpace(current):\n break\n pos += 1\n return pos", "def skipSpacesBack(self, pos: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a position within the source text, and the lexical goal, this returns the next token.
def token(self, pos: int, goal: "LexerCore.Goal" = InputElementRegExp) -> Optional[Token]: newlines = [] while 1: pos, nls = self.process_skippable(pos) newlines.extend(nls) # Check for common tokens (IdentifierName, Punctuator, NumericLiteral, StringLiteral, Templat...
[ "def get_next_token(self) -> Token:\n token = self.peek()\n self.position += 1\n return token", "def next_token(self):\n while True:\n if self.line == '':\n self.line = self.file.readline()\n if self.line == '':\n return eof_object\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset the Character object.
def _reset(self): self.characterID = None self.myName = u''
[ "def reset(self):\n self.char = 0\n self.line = 0\n self.col = 0\n self.clear_remainder()", "def reset(self):\n self._keyCode = \"\"\n self._keyCodeCount = 0\n self._keyCodeTime = 0.0", "def Reset(self):\n self._buffer = ''\n self._current_offset = 0\n s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The Character is "false" if the self.data does not contain a name.
def __nonzero__(self): # XXX: check the name and the characterID? if self.data.get('name'): return 1 return 0
[ "def has_ascii_name(self):\n return self.unpack_word(0x10) & 1 == 1", "def __contains__(self, character):\n # type: (object) -> bool\n assert isinstance(character, Text)\n return character in self._mode", "def valid_char(self, char):\n if char.lower() in self.data.keys():\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if two character have the same name and/or characterID.
def isSameName(self, other): if not isinstance(other, self.__class__): return 0 if self.data.has_key('name') and \ other.data.has_key('name') and \ build_name(self.data, canonical=0) == \ build_name(other.data, canonical=0): return ...
[ "def same_player(self, other):\n return self.name == other.name \\\n and self.color == other.color", "def __nonzero__(self):\n # XXX: check the name and the characterID?\n if self.data.get('name'): return 1\n return 0", "def is_equivalent_cid(data, cid1, cid2):\n\n # De...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a deep copy of a Character instance.
def __deepcopy__(self, memo): c = Character(name=u'', characterID=self.characterID, myName=self.myName, myID=self.myID, data=deepcopy(self.data, memo), notes=self.notes, accessSystem=self.accessSystem, titlesRefs=deepcopy(self.title...
[ "def copy(self) -> 'Cell':\n new = Cell(self.letter)\n new.player = self.player\n return new", "def copy(self):\n return self.mutate().simple_copy()", "def deep_copy(self) -> 'Player':\n return Player(deepcopy(self.player_id),\n deepcopy(self.species_list)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
String representation of a Character object.
def __repr__(self): r = '<Character id:%s[%s] name:_%s_>' % (self.characterID, self.accessSystem, self.get('name')) if isinstance(r, unicode): r = r.encode('utf_8', 'replace') return r
[ "def srepr(self):\n return \"Ch(ks_ch={}, enc_ch={})\".format(\n self.ks_characteristic.srepr(),\n self.enc_characteristic.srepr(),\n )", "def __str__(self):\n character = self.name + ', ' + ' ' + str(self.gender) + ', ' + 'with mentions: ' + \\\n str...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a string with a prettyprinted summary for the character.
def summary(self): if not self: return u'' s = u'Character\n=====\nName: %s\n' % \ self.get('name', u'') bio = self.get('biography') if bio: s += u'Biography: %s\n' % bio[0] filmo = self.get('filmography') if filmo: ...
[ "def summary_string(self) -> str:", "def pretty_print(self, value, add_unit=False):\n s = \"%.1f\" % self.internal_to_friendly(value)\n if add_unit: s += \" \" + self.friendly_units\n return s", "def _print_summary(data, metric):\n\n print(u'Cortical thickness {}: {:.2f} \\u00B1 {:.2f} [...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute log(\sum_i exp(Z_i)) for some array Z.
def log_sum_exp(Z): return np.max(Z) + np.log(np.sum(np.exp(Z - np.max(Z))))
[ "def exp(self, log_L: np.ndarray) -> np.ndarray:", "def log_sum_exp(x):\r\n # TF ordering\r\n axis = len(x.size()) - 1\r\n m, _ = torch.max(x, dim=axis)\r\n m2, _ = torch.max(x, dim=axis, keepdim=True)\r\n return m + torch.log(torch.sum(torch.exp(x - m2), dim=axis))", "def log_sum_exp(XTHETA):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get local output level. This method returns either the local logger level set when calling initialize, or if that was not set then the logger level set in the Initializer configuration.
def get_output_level(self): outlvl = self._local_logger_level if outlvl is None: outlvl = self.config.output_level return outlvl
[ "def get_log_level(self):\n return self.logger.level", "def get_logging_level(self):\n return self.logging_level", "def getLogLevel(self):\n return self.__logLevel", "def log_level(self) -> str:\n return self._log_level", "def loglevel(self, level=None):\r\n if level is No...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get logger for model by name
def get_logger(self, model): return idaeslog.getInitLogger(model.name, self.get_output_level())
[ "def get_logger(self, name):\r\n return logbook.Logger(name)", "def get_logger(self, name):\r\n\r\n if name not in self.servers_and_loggers:\r\n self._new_server_and_logger(name)\r\n return self.servers_and_loggers[name][1]", "def get_logger(name=None, level=0):\n\tif name is Non...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load initial guesses for variables into model.
def load_initial_guesses( self, model: Block, initial_guesses: dict = None, json_file: str = None, exception_on_fixed: bool = True, ): if initial_guesses is not None and json_file is not None: self._update_summary(model, "status", InitializationStatus.Erro...
[ "def _load_values_from_dict(self, model, initial_guesses, exception_on_fixed=True):\n for c, v in initial_guesses.items():\n component = model.find_component(c)\n\n if component is None:\n raise ValueError(f\"Could not find a component with name {c}.\")\n elif ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call to model.fix_initialization_states method. Method will pass if fix_initialization_states not found.
def fix_initialization_states(self, model: Block): try: model.fix_initialization_states() except AttributeError: _log.info_high( f"Model {model.name} does not have a fix_initialization_states method - attempting to continue." )
[ "def initialization(self, world_states):\n raise Exception(\"Model does not have initialization() routine implemented.\")", "def update_fixed_startup_state(m, startup_state):\r\n for g in m.G_E_THERM.union(m.G_C_THERM):\r\n for i in m.I:\r\n for o in m.O:\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }