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
Returns the mgm and lfn that the user most likely intended to
def _safe_split_mgm(self, path, mgm=None): if path.startswith('root://'): _mgm, lfn = split_mgm(path) if not(mgm is None) and not _mgm == mgm: raise ValueError( 'Conflicting mgms determined from path and passed argument: ' 'From pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_name_and_gender():\n fn=''\n mn=''\n g = 'M' if random.randint(0,1) == 0 else 'F'\n if g=='M':\n fn = fake.first_name_male()\n mn = fake.first_name_male()\n else:\n fn = fake.first_name_female()\n mn = fake.first_name_female()\n\n return fn,mn", "def extrac...
[ "0.5902391", "0.58704615", "0.5793951", "0.552161", "0.55187815", "0.5314315", "0.5185743", "0.5127224", "0.5122406", "0.51154524", "0.5075057", "0.50512254", "0.5047442", "0.50456214", "0.5017562", "0.5007443", "0.4966871", "0.49581426", "0.49524567", "0.49454257", "0.493799...
0.5127529
7
Joins mgm and lfn, ensures correct formatting
def _join_mgm_lfn(self, mgm, lfn): if not mgm.endswith('/'): mgm += '/' return mgm + lfn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_to_pretty_string(f, g, rs, ss, ts):\n\n return '\\n'.join(map(lambda (r, s, t): '{r} = ({s}) * ({f}) + ({t}) * ({g})'.format(r=r, s=s, t=t, f=f, g=g),\n zip(rs, ss, ts)))", "def get_M_as_string(self):\n return '\\n'.join(['M({})={}'.format(p.name, p.M) for p in self.P...
[ "0.51409286", "0.50731665", "0.50231826", "0.49108234", "0.48673972", "0.4861895", "0.48246044", "0.48213902", "0.4819359", "0.4811084", "0.47524574", "0.47146547", "0.4714585", "0.4713504", "0.47094056", "0.46955222", "0.4657899", "0.46380806", "0.46370494", "0.46309257", "0...
0.7829792
0
Creates a directory on the SE Does not check if directory already exists
def create_directory(self, directory): mgm, directory = self._safe_split_mgm(directory) logger.warning('Creating directory on SE: {0}'.format(self._join_mgm_lfn(mgm, directory))) cmd = [ 'xrdfs', mgm, 'mkdir', '-p', directory ] svj.core.utils.run_command(cmd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dir(self):\n if not os.path.exists(self.d):\n try:\n os.mkdir(self.d)\n except OSError, e:\n if e.errno != 17:\n raise\n pass", "def create_dir(dir_path):\n if not os.path.exists(dir_path):\n ...
[ "0.83424073", "0.8160656", "0.8106043", "0.80585885", "0.80585885", "0.80445415", "0.8038276", "0.8032155", "0.80254644", "0.8020224", "0.80045015", "0.8000421", "0.79927254", "0.793986", "0.79367894", "0.79226726", "0.79205954", "0.78914696", "0.7890425", "0.78721476", "0.78...
0.7743014
40
Returns a boolean indicating whether the directory exists
def is_directory(self, directory): mgm, directory = self._safe_split_mgm(directory) cmd = [ 'xrdfs', mgm, 'stat', '-q', 'IsDir', directory ] status = (subprocess.check_output(cmd) == 0) if not status: logger.info('Directory {0} does not exist'.format(self._join_mgm_lfn(mgm, d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_exists(dir: str) -> bool:\n return os.path.isdir(dir)", "def check_dir_exist():\n if os.path.isdir(path_structure):\n return True\n else:\n return False", "def directory_exists(self, directory: str = None) -> bool:\n return os.access(directory if directory else self.get_di...
[ "0.85646", "0.84998095", "0.84274375", "0.8296807", "0.82139444", "0.82082856", "0.809449", "0.80681866", "0.8031138", "0.79924685", "0.7937865", "0.7918179", "0.7815453", "0.7649746", "0.76208276", "0.7597657", "0.7462627", "0.7451004", "0.7436449", "0.74356145", "0.7376903"...
0.76564944
13
Copies a file `src` to the storage element
def copy_to_se(self, src, dst, create_parent_directory=True): mgm, dst = self._safe_split_mgm(dst) dst = self._join_mgm_lfn(mgm, dst) if create_parent_directory: parent_directory = osp.dirname(dst) self.create_directory(parent_directory) logger.warning('Copying {0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def src(self, src):\n\n self._src = src", "def copy_source(self, filename, new_filename, **kw):\n\n file_path = os.path.join(self.storage_path, filename)\n new_file_path = os.path.join(self.storage_path, new_filename)\n shutil.copyfile(file_path, new_file_path)", "def _copy_to_media...
[ "0.6695303", "0.6277998", "0.61272883", "0.6095858", "0.6080218", "0.5903634", "0.5829626", "0.5754406", "0.57520276", "0.5700519", "0.55948555", "0.557057", "0.5544569", "0.5529829", "0.55181485", "0.550103", "0.54890895", "0.54736984", "0.5438495", "0.5427721", "0.5403259",...
0.0
-1
Returns the proper sizing
def _getsizing(self, comminfo, cash, data, isbuy): if isbuy: # Buying target = self.broker.getvalue() * self.params.prop # Ideal total value of the position price = data.close[0] shares_ideal = target / price # How many shares are needed to get target b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_size(self):\r\n pass", "def get_image_size(self):", "def size(self):\n return (self.width)", "def calc_size(self):\r\n self.height = HEIGHT_STATUS", "def size(self):\n return self.width", "def size(self):\n return self.width", "def size(self):\n return...
[ "0.79809976", "0.7545345", "0.74031615", "0.73629415", "0.73331845", "0.73331845", "0.73331845", "0.73331845", "0.73331845", "0.73331845", "0.73331845", "0.7309496", "0.728393", "0.7250864", "0.72462463", "0.7211166", "0.7156204", "0.71235317", "0.71235317", "0.7122899", "0.7...
0.0
-1
Check str of Submission model.
async def test_str( submission_fixture: Submission, ) -> None: AssertThat(str(submission_fixture)).IsInstanceOf(str) AssertThat(str(submission_fixture)).IsEqualTo(submission_fixture.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_submission_model_str(self):\n cattle = mommy.make(\n 'main.Task',\n name='Cattle Price')\n submission = mommy.make(\n 'main.Submission',\n task=cattle,\n _fill_optional=['user', 'comment', 'submission_time'])\n expected = \"Cattle...
[ "0.7059866", "0.62975836", "0.6151616", "0.61028385", "0.6042036", "0.6003411", "0.5991225", "0.59581923", "0.5912117", "0.5893448", "0.5867347", "0.5861611", "0.58457726", "0.58284163", "0.5810691", "0.5804451", "0.5799303", "0.5771318", "0.57530624", "0.5749821", "0.574816"...
0.67675114
1
Generate name for test project.
def project_name() -> str: fake = Faker() raw_name: str = ( fake.name_female().lower().replace(" ", "_").replace("-", "_").replace(".", "_") ) return re.sub("_+", "_", raw_name).strip("_")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getProjectName():", "def generate_name(self):\n name = self._generate_test_name()\n while self.exists(name):\n name = self._generate_test_name()\n return name", "def testName(self):\n project = self.session.create_project()\n\n self.util.stringTypeTest(self, pr...
[ "0.7983957", "0.77939415", "0.7772358", "0.77490586", "0.7741682", "0.75450486", "0.7491648", "0.7360723", "0.7253296", "0.72480696", "0.71617275", "0.7105816", "0.7038073", "0.6992555", "0.69569904", "0.6916934", "0.6876165", "0.6875566", "0.6869538", "0.6838565", "0.6822547...
0.77850544
2
Generate directory to work into
def generator_start_dir() -> str: old_cwd = os.getcwd() newpath = tempfile.mkdtemp() os.chdir(newpath) try: yield newpath finally: os.chdir(old_cwd) shutil.rmtree(newpath, ignore_errors=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_output_directory(self):\n fs = self._filesystem\n output_filename = fs.join(self._root_output_dir, self._test_name)\n fs.maybe_make_directory(fs.dirname(output_filename))", "def make_source_dir():\n\n os.makedirs(files['source_dir'].rel)", "def _make_output_dir(self):\n ...
[ "0.7443446", "0.7413898", "0.7176719", "0.7132227", "0.7052426", "0.7027971", "0.69864786", "0.6921163", "0.6908912", "0.68657094", "0.68656844", "0.6845449", "0.6840432", "0.6839763", "0.6807036", "0.6770787", "0.6740235", "0.67180556", "0.6714957", "0.66977865", "0.6696159"...
0.6814439
14
Default builder context without features.
def default_context(project_name: str) -> None: return BuilderContext( project_name=project_name, kube_name=project_name.replace("_", "-"), project_description="Generated by pytest.", ci_type=CIType.none, db=DatabaseType.none, db_info=DB_INFO[DatabaseType.none], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBuilder():", "def build(self) -> cern.lsa.domain.settings.ContextSettings:\n ...", "def get_dummy_context():\n context = util.DotDict()\n context.elasticSearchHostname = \"\"\n context.elasticSearchPort = 9200\n context.platforms = (\n {\n \"id\": \"windows\",\n ...
[ "0.66999394", "0.6211641", "0.62057453", "0.6149984", "0.59577477", "0.591246", "0.591246", "0.5912228", "0.58951634", "0.58951634", "0.58951634", "0.58951634", "0.58951634", "0.58951634", "0.5883314", "0.5875144", "0.58420306", "0.582237", "0.5786626", "0.575766", "0.5714654...
0.71017975
0
Change directory to generator_start_dir.
def default_dir(generator_start_dir: str) -> None: yield cwd = os.getcwd() if cwd != generator_start_dir: os.chdir(generator_start_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generator_start_dir() -> str:\n old_cwd = os.getcwd()\n newpath = tempfile.mkdtemp()\n os.chdir(newpath)\n try:\n yield newpath\n finally:\n os.chdir(old_cwd)\n shutil.rmtree(newpath, ignore_errors=True)", "def setup(self, newdir=None):\n if not os.path.exists(self....
[ "0.7866557", "0.62242794", "0.61990684", "0.617797", "0.6177548", "0.6098702", "0.60680014", "0.60668284", "0.5981352", "0.5979372", "0.5947241", "0.5925714", "0.5915247", "0.5878447", "0.5877666", "0.58542806", "0.583494", "0.58293223", "0.5808327", "0.5800286", "0.5794496",...
0.7948314
0
Cleans up docker context.
def docker_module_shutdown(generator_start_dir: str, project_name: str) -> None: yield cwd = os.getcwd() project_dir = Path(generator_start_dir) / project_name if not project_dir.exists(): return os.chdir(project_dir) Path("poetry.lock").unlink(missing_ok=True) run_docker_compose_com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(self):\n with hide(\"output\", \"warnings\", \"running\"):\n self.stop_all()\n self._execute_standard(\"rm -rf {model_repo}\".format(model_repo=MODEL_REPO))\n self._execute_root(\"docker rmi --force $(docker images -q)\", warn_only=True)\n self._execut...
[ "0.7146161", "0.7115365", "0.701015", "0.6967293", "0.6847206", "0.6737693", "0.67033553", "0.6644785", "0.6614517", "0.65589184", "0.65430343", "0.6533365", "0.6469086", "0.6405354", "0.6397906", "0.63866544", "0.6380686", "0.6300325", "0.6300325", "0.6300325", "0.6300325", ...
0.0
-1
Load energy_plant_radiation_class class from file energy_plant_radiation_class.
def classFactory(iface): # pylint: disable=invalid-name # from .nuclear_energy_plant_radiation_module import energy_plant_radiation_class return energy_plant_radiation_class(iface)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_resource():\n resource_file = 'curves/' + self.combo_box[\"class\"].get() + '.json'\n self.classes[\"fractal\"].curve.load_from_resource(\n resource_file)\n self.classes[\"fractal\"].curve.set_parent_parameters()\n self.classes[\"parameters\"].rul...
[ "0.5642803", "0.5179759", "0.5126858", "0.51085144", "0.5100658", "0.5096265", "0.5077245", "0.50566846", "0.49435663", "0.48717636", "0.48648682", "0.485874", "0.48466516", "0.48069355", "0.48024842", "0.47911623", "0.47862443", "0.4783866", "0.4778332", "0.47674206", "0.476...
0.51236886
3
Generate sample vessel system. J. Kunes
def generate_sample_data(m=1, noise_level=0.005, gauss_sigma=0.1): from imtools import thresholding_functions data3d = np.zeros((100 * m, 100 * m, 100 * m), dtype=np.int) # size 8 data3d_new = np.ones((100 * m, 100 * m, 100 * m), dtype=np.bool) data3d_new[0:30 * m, 20 * m, 20 * m] = 0 data3d_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_vessel_components(self) -> list:\n\n # Blanket computed from plasma\n blanket = paramak.BlanketFP(\n plasma=self.plasma,\n thickness=4.06e2 - 3.52e2,\n start_angle=-70,\n stop_angle=230,\n rotation_angle=self.rotation_angle,\n ...
[ "0.6104725", "0.58946806", "0.58238125", "0.57697004", "0.5739443", "0.57187384", "0.5605193", "0.56051666", "0.5605048", "0.55891824", "0.5569418", "0.55644405", "0.55613863", "0.55606264", "0.55549943", "0.55420285", "0.5541645", "0.5530176", "0.55171233", "0.55052173", "0....
0.0
-1
Processing data without gui. There is a sister of this function in histology_analyser_gui module
def processData(args): inputfile=args.inputfile threshold=args.threshold mask_file=args.maskfile crop=args.crop voxelsize=args.voxelsize binaryClosing=args.binaryclosing binaryOpening=args.binaryopening vtfile=args.vtfile vt2esofspy=args.vt2esofspy output_report_csv_file=args.out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analyze(data):\n ## Do welch periodogram here\n pass", "def _process(self, data: np.ndarray) -> np.ndarray:", "def _process(self, data: np.ndarray) -> np.ndarray:", "def analyse(self, data=None):\n pass", "def main():\n df_data = import_clean_process()\n plot_data_matplotlib(...
[ "0.67493516", "0.62960464", "0.62960464", "0.6286892", "0.6212195", "0.61093634", "0.60937744", "0.60866874", "0.6036327", "0.5978911", "0.5975806", "0.59499186", "0.59346336", "0.59103394", "0.5823865", "0.5798523", "0.57932895", "0.5774382", "0.5751546", "0.5751546", "0.575...
0.5766699
18
returns the first word in a given text.
def first_word(text: str) -> str: import string # it's deleting first not letter strings start = 0 for element in text: if element in (" ", ",", ".", "'"): start += 1 elif element in (string.ascii_uppercase + string.ascii_lowercase): break text = text[start:l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_word(text: str) -> str:\n # answer = []\n # answer=text.split(\" \", maxsplit=1)\n # import re\n # re.sub(r'a', 'b', 'banana')\n\n answer_wrk = re.search(r\"[a-zA-z\\']+\", text)\n answer = answer_wrk.group(0)\n\n return answer", "def first_word(text):\n # your code here\n sp...
[ "0.8146144", "0.8141208", "0.7967539", "0.7401317", "0.7396188", "0.7192831", "0.714187", "0.66818404", "0.66556394", "0.65835834", "0.65610653", "0.6507425", "0.6431512", "0.6374773", "0.6374773", "0.63654155", "0.6336063", "0.6329843", "0.6294769", "0.6290436", "0.625327", ...
0.83027816
0
Uses underlying C api to create a module
def __init__(self, idargs): if type(idargs) != idargparse.TxpArgumentParser: raise ValueError("idargs must be a TxpArgumentParser") self._mod = pyIdlak_txp.PyIdlakModule_new(self._modidx, idargs.idlakopts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_module(cls, *args, **kwargs): # real signature unknown\n pass", "def create_module(cls, *args, **kwargs): # real signature unknown\n pass", "def _create_module(name):\n module = new.module(name)\n sys.modules[name] = module\n return module", "def _createModuleObj(self):\n ...
[ "0.75084627", "0.75084627", "0.7268729", "0.71196806", "0.69312716", "0.6830948", "0.6711122", "0.6680741", "0.656734", "0.6560675", "0.6482013", "0.64257735", "0.6414944", "0.6380871", "0.63747823", "0.6368041", "0.6287453", "0.6278774", "0.6261905", "0.6261905", "0.6243278"...
0.0
-1
process the document in place
def process(self, doc): if not type(doc) is xmldoc.XMLDoc: raise ValueError("doc must be a XMLDoc") pyIdlak_txp.PyIdlakModule_process(self._mod, doc.idlak_doc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _transform(self, document):\n pass", "def process(self, doc):\n self.doc = doc\n if self.replace_words is True:\n self.replace_words_fun()\n if self.remove_html_tags is True:\n self.remove_html_tags_fun()\n if self.remove_stopwords is True:\n ...
[ "0.7462148", "0.7406086", "0.6852314", "0.67837477", "0.66898626", "0.63546854", "0.633135", "0.632514", "0.63043433", "0.62745553", "0.62177104", "0.61018103", "0.60946083", "0.60878795", "0.6036372", "0.6034082", "0.6027082", "0.60214764", "0.5997861", "0.5982215", "0.59393...
0.5574814
52
Gets the name of the module
def name(self): return self._modname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def module_name(self):\n return self.lib.get_module_name()", "def module_name(self):\n return self.name()", "def module_name(self):\n return self.name", "def get_module_name(self):\n return self.module_name", "def name(cls):\n return MODULE_NAME", "def module_name(self)...
[ "0.9114128", "0.9060202", "0.89279187", "0.89060533", "0.8833184", "0.8701048", "0.85008574", "0.8235956", "0.81398195", "0.8051865", "0.7917739", "0.7917739", "0.79172605", "0.78984195", "0.7841873", "0.77399725", "0.773858", "0.76504517", "0.7642898", "0.76253045", "0.75270...
0.8397406
7
Create a new AtramhasisProvider
def __init__(self, metadata, **kwargs): if 'subject' not in metadata: metadata['subject'] = [] if 'uri' not in metadata: log.warning( "AtramhasisProvider: 'uri' is not present in the metadata. " "This will result in a http call to fetch the concept...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_attestation(attestation: Attestation):\n pass", "def alpaca_create(self, keyname = \"ALPACA_API_KEY\", secret = \"ALPACA_SECRET_KEY\"):\n aak = os.getenv(keyname)\n ask = os.getenv(secret)\n if type(aak) is not str | type(aak) is not str:\n raise Exception(\"Could no...
[ "0.52555776", "0.5254564", "0.52526224", "0.5233139", "0.50061494", "0.49999845", "0.4925371", "0.48999807", "0.4887252", "0.4868984", "0.48582995", "0.48151788", "0.48077402", "0.47774965", "0.47251567", "0.47028697", "0.46956468", "0.46650037", "0.46495956", "0.46471313", "...
0.60222864
0
Usado para emitir notificacoes no inicio e fim de uma acao
def logging( action, prefix_action="* ", sufix_action="...", success="OK ", error="ERROR" ): print("{}{}{}".format(prefix_action, action, sufix_action), end=" ") def finish(text): """ Usado para emitir uma mensagem de fim customizada, se nao for invocada e exibida a mensagem padrao ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enchere(self):\n\n i = 0\n while i < 5 and self.annonce < 4:\n paroleJ = self.joueurs[i].parler(self.annonce)\n if paroleJ != 0:\n self.annonce = paroleJ\n self.indiceJoueurQuiPrend = i\n i += 1\n\n print(\"joueur qui prend : \...
[ "0.5825989", "0.5716464", "0.57003754", "0.5677707", "0.5641369", "0.5552748", "0.54724026", "0.5452283", "0.54361415", "0.54250216", "0.5415447", "0.54134053", "0.53304255", "0.52359575", "0.52322567", "0.5201554", "0.51994395", "0.51853836", "0.51836836", "0.5165727", "0.51...
0.0
-1
Usado para emitir uma mensagem de fim customizada, se nao for invocada e exibida a mensagem padrao de sucesso
def finish(text): finish.has_been_called = True print("{}{}".format(success, text))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendErrorMessage(msg): #@NoSelf", "def flash_msg(self, params):\n if params.has_key('receiver'): name = params['receiver']\n else: \n if self.participant: \n group = self.service.groupOfParticipant(self.participant)\n if group: \n mem...
[ "0.6033863", "0.58943576", "0.58772117", "0.5869448", "0.5865626", "0.5859008", "0.5838634", "0.58163446", "0.58033967", "0.579107", "0.576767", "0.5746271", "0.5722057", "0.56849825", "0.56139547", "0.5588774", "0.5582261", "0.55735016", "0.55451274", "0.553899", "0.5537516"...
0.0
-1
Recupera todas as contas em aberto das igrejas
def pegar_contas_igrejas(): erros = [] contas = [] cpfl = CPFL() for igreja, instalacao in INSTALACOES.items(): try: with logging(igreja) as finish: novas_contas = cpfl.recuperar_contas_abertas(CNPJ, instalacao) for conta in novas_contas: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countering():\r\n return []", "def encontrar_mejor_sitio(ubicaciones):\n\ttorretas_adicionales = ubicaciones.count(\"t\") # obtengo cuantas t (torretas adicionales) hay en ubicaciones\n\tif torretas_adicionales == 0:\n\t\tprint \"Posicion: 5\"\n\tif torretas_adicionales == 4:\n\t\tprint \"Posicion: \",\n\...
[ "0.6024232", "0.5778898", "0.5772468", "0.56903213", "0.56899667", "0.5653988", "0.5653988", "0.55774236", "0.5563019", "0.55446196", "0.55063593", "0.54217356", "0.5399272", "0.5393137", "0.53357404", "0.5330091", "0.53291875", "0.53227985", "0.52933735", "0.5261711", "0.524...
0.63868624
0
Converts grib files to netcdf using HRRR forecast data and the variables required by the SMRF. Uses the wgrib2 command to identify variable names and uses that to filter the output from the commandline.
def grib2nc(f_hrrr, output=None, external_logger=None): start = time.time() if external_logger == None: fmt = "%(levelname)s: %(msg)s" log = logging.getLogger(__name__) coloredlogs.install(logger=log, fmt=fmt) msg = "GRIB2NC Converter Utility" log.info(msg) log.info("=" * len(msg)) # criteria dictionary ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hourly_grib2_to_netcdf(grib_file, grib_source, nc_file, nc_var_name,\n grib_var_name, grib_level, cache_size=100,\n initial_year=1979, overwrite_nc_units=None,\n include_analysis=True,\n nc_format='NETCDF4')...
[ "0.6853723", "0.6487569", "0.6329581", "0.6090967", "0.56164694", "0.5534598", "0.5456288", "0.53535604", "0.52977234", "0.5225581", "0.5223431", "0.519277", "0.5141454", "0.51206857", "0.5117262", "0.50898886", "0.508972", "0.5078878", "0.5070577", "0.50090307", "0.49965036"...
0.7377985
0
Firstly, the image is rotated, and then the image is preprocessed
def __getitem__(self, index): img, _ = self.dataset.__getitem__(index) # Convert to numpy.ndarray if isinstance(img, Image.Image): img = np.array(img) elif isinstance(img, torch.Tensor): img = img.numpy() else: pass # Convert grayscal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, image):\n if self.rotate == 0:\n return image\n\n angle = self.rotate * -90\n return image.rotate(angle, expand=True).crop((0, 0, self._w, self._h))", "def transform(self, previousimage):", "def apply_rotation(image):\n\n\t# Load the image into a new BytesIO...
[ "0.7815346", "0.692002", "0.6816925", "0.6709122", "0.66407454", "0.6565173", "0.64606667", "0.64606667", "0.64087397", "0.6385571", "0.63738203", "0.63497627", "0.6326754", "0.6312972", "0.6279072", "0.6265637", "0.62516814", "0.62358415", "0.6215376", "0.620934", "0.6188507...
0.0
-1
Replace contractions in string of text
def replace_contractions(text): return contractions.fix(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_contractions(text):\r\n return contractions.fix(text)", "def _replace_contractions(text):\n return contractions.fix(text)", "def replaceContractions(self, text):\n\t\treturn contractions.fix(text)", "def replace_contractions(self):\n self.text = contractions.fix(self.text)\n r...
[ "0.8687263", "0.8606106", "0.8100211", "0.75796664", "0.7554637", "0.73812336", "0.72393143", "0.71252644", "0.6733126", "0.6524883", "0.6449502", "0.6409592", "0.64059746", "0.6365393", "0.6314563", "0.6309385", "0.6151162", "0.61502606", "0.61313903", "0.61110896", "0.61059...
0.8611583
1
Remove nonASCII characters from list of tokenized words
def remove_non_ascii(words): new_words = [] for word in words: new_word = unicodedata.normalize('NFKD', word).encode('ascii', 'ignore').decode('utf-8', 'ignore') new_words.append(new_word) return new_words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_non_word_chars(tokens):\n toks = []\n for token in tokens:\n t = re.sub(r'\\W', \"\", token)\n if len(t) > 1:\n toks.append(t)\n\n return toks", "def _remove_non_ascii(words):\n new_words = []\n for word in words:\n new_word = unicodedata.normalize('NFKD', word).encode('ascii...
[ "0.811785", "0.7990454", "0.7987333", "0.79803234", "0.79065156", "0.7874596", "0.7569082", "0.75249046", "0.7517662", "0.73463523", "0.73408365", "0.7230869", "0.71905714", "0.7190189", "0.71839136", "0.71484107", "0.7140565", "0.7088968", "0.70817244", "0.7076244", "0.70608...
0.79627377
8
Convert all characters to lowercase from list of tokenized words
def to_lowercase(words): new_words = [] for word in words: new_word = word.lower() new_words.append(new_word) return new_words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowercase(tokens):\n if not lowercase_activated:\n return tokens\n output = [token.lower() for token in tokens]\n return output", "def preprocess(tokens):\n result = []\n for token in tokens:\n result.append(token.lower())\n return result", "def lowercase(tokens):\n return [token.lower(...
[ "0.825361", "0.81953853", "0.79781765", "0.781734", "0.7800716", "0.7751302", "0.7673937", "0.76445544", "0.75346315", "0.7522023", "0.74568486", "0.7307557", "0.71714586", "0.7123188", "0.69849426", "0.6983551", "0.68570787", "0.6821391", "0.6815797", "0.6752138", "0.6731911...
0.76206166
13
Remove punctuation from list of tokenized words
def remove_punctuation(words): new_words = [] for word in words: new_word = re.sub(r'[^\w\s]', '', word) if new_word != '': new_words.append(new_word) return new_words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_punctuations(tokenized_word_list):\n puncuations = set(string.punctuation)\n\n double_quote = '\\'\\''\n double_sign = '``'\n\n puncuations.add(double_quote)\n puncuations.add(double_sign)\n\n filtered_tokens = [word for word in tokenized_word_list if word not in puncuations]\n retu...
[ "0.8442782", "0.8359967", "0.8351824", "0.8328873", "0.8253663", "0.825076", "0.8141438", "0.811486", "0.8062248", "0.79808956", "0.79785806", "0.79171425", "0.78637815", "0.7798064", "0.7791937", "0.7775272", "0.77740026", "0.77291363", "0.7681821", "0.7561502", "0.749725", ...
0.8288225
8
Replace all interger occurrences in list of tokenized words with textual representation
def replace_numbers(words): p = inflect.engine() new_words = [] for word in words: if word.isdigit(): new_word = p.number_to_words(word) new_words.append(new_word) else: new_words.append(word) return new_words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_nums2words(tokens):\n e = inflect.engine()\n words = []\n for word in tokens:\n if word.isdigit():\n words.append(e.number_to_words(word).replace(',', ''))\n else:\n words.append(word)\n return words", "def replace_numbers(words):\n p = inflect.engin...
[ "0.7128246", "0.6678444", "0.6678444", "0.6665406", "0.6647252", "0.65828025", "0.6537516", "0.65074503", "0.6504618", "0.645171", "0.64318156", "0.630259", "0.6287732", "0.62486833", "0.6144012", "0.6124199", "0.60891247", "0.60028815", "0.59723675", "0.5952372", "0.59475845...
0.6507276
13
Remove stop words from list of tokenized words
def remove_stopwords(words): new_words = [] for word in words: if word not in stopwords.words('english'): new_words.append(word) return new_words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stop_words(stop_list, tokens):\n return [t for t in tokens if len(t) > 2 and not t in stop_list]", "def remove_stopwords(tokens):\n stop_words = set(stopwords.words('english'))\n\n tokens = [w for w in tokens if w not in stop_words]\n\n return tokens", "def remove_stop_words(tokenized_wo...
[ "0.86630034", "0.86183923", "0.85973936", "0.8596811", "0.8580546", "0.8363658", "0.8350171", "0.8328014", "0.8318595", "0.8263289", "0.82468146", "0.820217", "0.81783086", "0.81630206", "0.8158307", "0.8138284", "0.81271654", "0.8113883", "0.8099041", "0.8048383", "0.8027641...
0.8002353
25
Stem words in list of tokenized words
def stem_words(words): stemmer = LancasterStemmer() stems = [] for word in words: stem = stemmer.stem(word) stems.append(stem) return stems
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stemWords(self, words):\n\t\tif stemmer == \"lancaster\":\n\t\t\tstemmer = LancasterStemmer()\n\t\telif stemmer == \"snowbal\":\n\t\t\tstemmer = SnowballStemmer()\n\t\telif stemmer == \"porter\":\n\t\t\tstemmer = PorterStemmer()\n\t\tstems = [stemmer.stem(word) for word in words]\n\t\treturn stems", "def ste...
[ "0.75900483", "0.75858396", "0.7580691", "0.7545852", "0.75312364", "0.75184566", "0.74880385", "0.7459504", "0.7455224", "0.7444837", "0.7443147", "0.742159", "0.73581856", "0.7346131", "0.73340863", "0.7282425", "0.7278071", "0.7240274", "0.7219631", "0.7127321", "0.709653"...
0.74077874
16
Lemmatize verbs in list of tokenized words
def lemmatize_verbs(words): lemmatizer = WordNetLemmatizer() lemmas = [] for word in words: lemma = lemmatizer.lemmatize(word, pos='v') lemmas.append(lemma) return lemmas
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lemmatization(tokenized_word_list):\n porter=nltk.stem.PorterStemmer()\n filtered_tokens = [porter.stem(word) for word in tokenized_word_list]\n return filtered_tokens", "def lemmatize_verbs(self):\n lemmas = []\n # lemmas = \"\"\n for word in self.words:\n lemma = wn.lemmatize(word, p...
[ "0.80288726", "0.7971245", "0.79286313", "0.7890332", "0.7825369", "0.77554196", "0.77338827", "0.7710709", "0.7703906", "0.7699137", "0.7638337", "0.7630645", "0.75690055", "0.7545449", "0.75376844", "0.75229007", "0.74909216", "0.7470532", "0.7464851", "0.7436286", "0.73693...
0.77416253
11
Rename uploaded files with the object's slug.
def logo_upload_to(instance, filename): _, extension = splitext(filename) filename = f"programs/{instance.slug}_logo{extension}" return filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_rename(file_path, new_name):\n \n # Return if no file given\n if not file_path:\n return ''\n else:\n file_path = file_path\n \n # Get the new name\n new_path = change_basename(file_path, new_name)\n \n \n # Changed?\n if new_path != file_path:\n # Try...
[ "0.6704687", "0.6586624", "0.6303177", "0.6205136", "0.618939", "0.610291", "0.6092216", "0.60845494", "0.60668653", "0.60320705", "0.6015525", "0.59766597", "0.5961521", "0.59444106", "0.592686", "0.5900543", "0.58116543", "0.5760065", "0.5760043", "0.5758437", "0.57485795",...
0.54537857
55
Only return programs with aids.
def has_aids(self): return self.exclude(aids=None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def program(cls, program):\n search_str = ArtePlus7.PROGRAMS[program]\n all_programs = cls.search(search_str)\n programs = [p for p in all_programs if p.name == program]\n return programs", "def extract_programs():\n if settings.XPRO_CATALOG_API_URL:\n return requests.get(se...
[ "0.62694216", "0.5741981", "0.56935924", "0.5627908", "0.56089944", "0.5581919", "0.5562044", "0.5484791", "0.54173875", "0.53707904", "0.53661776", "0.53409916", "0.53327256", "0.5318837", "0.5258225", "0.5221538", "0.5221057", "0.52003723", "0.5185413", "0.51680654", "0.514...
0.59520566
1
Only return programs with a logo.
def has_logo(self): return self.exclude(models.Q(logo="") | models.Q(logo=None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logo(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"logo\")", "def logo(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"logo\")", "def _orgWithLogoQuery(model, program):\n q = model.all()\n q.filter('scope', program)\n q.filter('status', 'active')\n ...
[ "0.57749265", "0.57749265", "0.56826365", "0.56404835", "0.56404835", "0.56404835", "0.56404835", "0.5542502", "0.5531564", "0.5531564", "0.5531564", "0.5393385", "0.5332547", "0.5254092", "0.5242228", "0.5217577", "0.5214733", "0.51957464", "0.5155629", "0.5128401", "0.50329...
0.59098417
0
Only return spotlighted programs with a logo.
def can_be_displayed_on_homepage(self): return self.filter(is_spotlighted=True).has_logo()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _orgWithLogoQuery(model, program):\n q = model.all()\n q.filter('scope', program)\n q.filter('status', 'active')\n q.filter('logo_url >=', '')\n\n return q", "def logo(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"logo\")", "def logo(self) -> pulumi.Output[Optional[str]]:\n...
[ "0.58757883", "0.559757", "0.559757", "0.5495591", "0.54465705", "0.54465705", "0.54465705", "0.54465705", "0.5373558", "0.5335026", "0.52914727", "0.52914727", "0.52914727", "0.5289588", "0.5156099", "0.51511264", "0.5124702", "0.5042212", "0.49926183", "0.49869227", "0.4982...
0.5512798
3
Set the object's slug if it is missing.
def set_slug(self): if not self.slug: self.slug = slugify(self.name)[:50]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_slug(self, slug):\n if self.slug is None:\n self.slug = slug", "def save(self, *args, **kwargs):\n if not self.slug:\n self.slug = self.generate_slug()\n super().save(*args, **kwargs)", "def save(self, *args, **kwargs):\n if not self.slug:\n ...
[ "0.82838136", "0.7608521", "0.7608521", "0.75689924", "0.7556534", "0.74918675", "0.73224854", "0.7266315", "0.7145025", "0.7014389", "0.6966631", "0.68139696", "0.6707514", "0.6704849", "0.6695652", "0.6694695", "0.66387", "0.6633332", "0.6626626", "0.6613412", "0.6583327", ...
0.79101604
1
Error Mail Checker and Handler return True if mail was processed, owtherwise False
def process_error_mail(recipient, sender, journal_id): if recipient in ['', None]: #: Simpley Error Mail! #: TODO: error marking... return True try: param = return_path_from_address(recipient) assert param['message_id'] != "" assert param['domain'] != "" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_mail_when_failed(self, body):\r\n pass", "def postprocess():\n if ERRORS:\n address = 'tamakoshihiroki@gmail.com'\n body = '\\n\\n'.join( ERRORS )\n msg = create_message( body, address )\n send_mail( msg, address )", "def verify_mail(self):\n raise N...
[ "0.71684676", "0.69915545", "0.6529014", "0.62857515", "0.6200424", "0.6169863", "0.61431986", "0.6050912", "0.6026715", "0.6016107", "0.59999835", "0.59469104", "0.58907336", "0.57553744", "0.57525676", "0.5709628", "0.57048935", "0.5676118", "0.5647386", "0.5646338", "0.559...
0.7448859
0
call task by name
def call_task_by_name(mod_name, task_name, *args, **kwargs): m = __import__(mod_name, globals(), locals(), ["*"]) return getattr(m, task_name).delay(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calltask(self, name, **vars):\n if name in self._tasks:\n for entry in self._tasks[name]:\n entry.execute(vars)\n else:\n raise Error(\"No such task: {0}\".format(name))", "def task(self, name):\n pass", "def process_task(params):\n params['task'...
[ "0.8585335", "0.7789529", "0.72249997", "0.71038425", "0.69543546", "0.69214267", "0.69214267", "0.69186956", "0.68981737", "0.6868687", "0.6745845", "0.6649044", "0.6632027", "0.659691", "0.65874046", "0.65842366", "0.6553517", "0.64654744", "0.6460285", "0.6419106", "0.6415...
0.77990216
1
Loads 300x1 word vecs from Google (Mikolov) word2vec
def load_bin_vec(word2vec, vocab): word_vecs = {} with open(word2vec, "rb") as f: header = f.readline() vocab_size, layer1_size = map(int, header.split()) binary_len = np.dtype('float32').itemsize * layer1_size for line in xrange(vocab_size): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_word2vec_model():\n logging.basicConfig(\n format='%(asctime)s : %(levelname)s : %(message)s', \n level=logging.INFO)\n model_path = '/playpen/home/tongn/GoogleNews-vectors-negative300.bin'\n model = KeyedVectors.load_word2vec_format(fname=model_path, binary=True)\n return model"...
[ "0.76019704", "0.742075", "0.7389909", "0.734901", "0.7344073", "0.71604186", "0.7155626", "0.70614433", "0.7006758", "0.6975921", "0.6915394", "0.6902017", "0.69003725", "0.6872555", "0.6856889", "0.6849271", "0.6808106", "0.6806605", "0.6799634", "0.6782137", "0.6776794", ...
0.65175366
39
You can set label property.
def __repr__(self) -> str: class_name = self.__class__.__name__ pk = self.id # type: ignore label = getattr(self, "label", "") return f'<{class_name}({pk}:{label!r})>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setLabel(self, label):\r\n\t\tself.label = label", "def setLabel(self, label):\r\n\t\tself.label = label", "def setLabel(self, label):\r\n\t\tself.label = label", "def SetLabel(self, label):\r\n\r\n self.label = label", "def label(self, label):\n\n self._label = label", "def label(self,...
[ "0.9090345", "0.9090345", "0.9090345", "0.87645483", "0.86649144", "0.86649144", "0.86649144", "0.86649144", "0.86649144", "0.86649144", "0.86649144", "0.86649144", "0.86649144", "0.86649144", "0.86649144", "0.8575247", "0.8406376", "0.84045035", "0.8354132", "0.83295137", "0...
0.0
-1
Column that adds primary key foreign key reference.
def reference_col(tablename: str, nullable: bool = False, pk_name: str = 'id', onupdate: str = None, ondelete: str = None, **kwargs: Any) \ -> Column: return Column( ForeignKey('{0}.{1}'.format(tablename, pk_name), onupdate=onupdate, ondelete=ondelete), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReferenceCol(tablename, nullable=False, pk_name='id', **kwargs):\n return db.Column(\n db.ForeignKey(\"{0}.{1}\".format(tablename, pk_name)),\n nullable=nullable, **kwargs)", "def reference_col(tablename, nullable=True, pk_name='id', **kwargs):\n return db.Column(\n db.ForeignKey('...
[ "0.7489892", "0.73920554", "0.70771027", "0.64817816", "0.6393585", "0.62086946", "0.61619574", "0.60691184", "0.58412683", "0.5764522", "0.5702417", "0.56470424", "0.5642272", "0.5633937", "0.5618169", "0.5618169", "0.5618169", "0.5618169", "0.56098497", "0.55792147", "0.553...
0.7201066
2
The number of rows or columns in a patch extraction grid.
def _num_extracted_rows_and_columns( image_size: int, patch_size: int, stride: int, num_scales: int, scale_factor: int, ) -> int: largest_patch_size = int(patch_size * (scale_factor**(num_scales - 1))) residual = image_size - largest_patch_size return (residual // stride) + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plaquette_rows_cols(self):\n return len(self.minor_yvals()), len(self.minor_xvals())", "def num_tiles(self):\n return self.num_row_tiles * self.num_col_tiles", "def ncells(self):\n return self.izone.size", "def getNumTiles(self):\n return self.w * self.h", "def size(self):\n ...
[ "0.78464913", "0.78142715", "0.7716126", "0.7626603", "0.76048946", "0.7598101", "0.75613004", "0.7550961", "0.7520141", "0.7501207", "0.74937814", "0.74850416", "0.7461705", "0.7411939", "0.7409282", "0.7402846", "0.73934966", "0.73903716", "0.73784256", "0.7349377", "0.7322...
0.6874424
51
Extract single scale patches from the given image. This op is implemented purely in Tensorflow and so may be more memory efficient when only singlescale patches are required.
def extract_patches_single_scale( patch_size: int, stride: int, image_lt: lt.LabeledTensor, name: str = None, ) -> Tuple[np.ndarray, lt.LabeledTensor]: with tf.compat.v1.name_scope(name, "extract_patches_single_scale", [image_lt]) as scope: image_lt = lt.transpose(image_lt, ["batch", "row", "colum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_patches_and_positions_from_image(\n image, patch_size, patch_stride, hse_grid_size,\n n_crops, h, w,\n c, scale_id, max_seq_len):\n p = tf.image.extract_patches(\n image, [1, patch_size, patch_size, 1], [1, patch_stride, patch_stride, 1],\n [1, 1, 1, 1],\n padding='SAME')\n\n ...
[ "0.6790287", "0.65466", "0.6151751", "0.6099914", "0.59317386", "0.5905685", "0.57604104", "0.5746815", "0.573609", "0.5610079", "0.56077653", "0.56040645", "0.5576093", "0.5573452", "0.5562469", "0.5551167", "0.5530099", "0.55173755", "0.54859334", "0.5467564", "0.54598343",...
0.7401282
0
Compute statistics of the given distributions. The statistics are computed assuming the first class has value 0.0 and the last class has value 1.0, with a linear progression in between.
def distribution_statistics(distribution_lt: lt.LabeledTensor, name: str = None) -> lt.LabeledTensor: # This is the number of statistics computed by distribution_statistics. num_statistics = 6 with tf.compat.v1.name_scope(name, "distribution_statistics", [distribut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _class_distribution(y):\n unique, counts = np.unique(y, return_counts = True)\n\n percentages = counts / np.sum(counts)\n\n return unique, counts, percentages", "def distribution_statistics(feat):\n \n return [np.median(feat),np.min(feat),np.max(feat),np.std(feat),\n np.std(feat)/ab...
[ "0.68734366", "0.6468991", "0.62134933", "0.60060537", "0.59643877", "0.5949125", "0.5901382", "0.5898189", "0.5834337", "0.58121556", "0.5723928", "0.5710522", "0.570123", "0.56938374", "0.568001", "0.56670696", "0.56273925", "0.5580179", "0.5553914", "0.55065745", "0.55061"...
0.551426
19
Composite images into a larger image.
def patches_to_image(patch_centers: np.ndarray, patch_lt: lt.LabeledTensor, name: Optional[str] = None) -> lt.LabeledTensor: with tf.compat.v1.name_scope(name, "patches_to_image", [patch_lt]) as scope: patch_lt = lt.transpose(patch_lt, ["batch", "row", "column", "channel"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getComposite(images):\n composite = mapnik.Image(images[0].width(), images[0].height())\n for image in images:\n composite.blend(0, 0, image, 1.0)\n return composite", "def composite(args):\n\n # load the input image\n logging.info('Loading input image %s' % (args.input))\n inputImag...
[ "0.74335957", "0.72053564", "0.70485693", "0.70225734", "0.6925989", "0.6917122", "0.68173444", "0.6806442", "0.6724852", "0.6722042", "0.67096394", "0.6651694", "0.6634226", "0.66334665", "0.65973663", "0.65869004", "0.6549259", "0.64408803", "0.6438038", "0.64255583", "0.64...
0.0
-1
You are given a binary tree in which each node contains a value Design an algorithm to print all paths which sum up to that value Note that it can be any path in the tree it does not have to start at the root
def find_sum(root, desired_sum, level=0, buffer_list=None, result=[]): if not buffer_list: buffer_list = [] if not root: return result buffer_list.append(root.key) temp = desired_sum for i in range(level, -1, -1): temp -= buffer_list[i] if temp == 0: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_tree(t):\n \"*** YOUR CODE HERE ***\"\n if is_leaf(t):\n return entry(t)\n total = entry(t)\n for subtree in subtrees(t):\n total += sum_tree(subtree)\n return total", "def minimum_path_sum(self, root) -> int:\n\n def minimum_path_sum_aux(root, path=None):\n ...
[ "0.6511818", "0.64953613", "0.6275917", "0.61998004", "0.60497695", "0.6035713", "0.6006674", "0.5971123", "0.59583557", "0.5931027", "0.5919312", "0.59181577", "0.5897086", "0.5884444", "0.5843002", "0.5836156", "0.5834166", "0.5827653", "0.58110356", "0.57977957", "0.578840...
0.54353625
53
PackageNote a model defined in Swagger
def __init__(self, package_id=None, feed_id=None, version=None, notes=None): # noqa: E501 # noqa: E501 self._package_id = None self._feed_id = None self._version = None self._notes = None self.discriminator = None if package_id is not None: self.package_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model(self, ApiId: str, Name: str, Schema: str, ContentType: str = None, Description: str = None) -> Dict:\n pass", "def __init__(self, **kwargs):\n self.swagger_types = {\n 'id': 'str',\n 'name': 'str',\n 'version': 'str',\n 'tagline': 'str',\...
[ "0.6364354", "0.617273", "0.6111821", "0.6108606", "0.6108181", "0.6101461", "0.6074732", "0.60045713", "0.59886175", "0.5938213", "0.59370977", "0.59185207", "0.5850837", "0.5837559", "0.5812189", "0.5780374", "0.57577115", "0.57191867", "0.5706632", "0.56934375", "0.5693437...
0.0
-1
Sets the package_id of this PackageNote.
def package_id(self, package_id): self._package_id = package_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_id(self, package_id):\n if package_id is None:\n raise ValueError(\"Invalid value for `package_id`, must not be `None`\") # noqa: E501\n\n self._package_id = package_id", "def package(self, package):\n\n self._package = package", "def set_package(self, pkg): ...
[ "0.75330186", "0.66790247", "0.6289974", "0.5844584", "0.5844584", "0.5831869", "0.5829048", "0.58280915", "0.5799856", "0.5799856", "0.5799856", "0.5799856", "0.5799856", "0.5799856", "0.5775636", "0.5762894", "0.57389355", "0.5732315", "0.571768", "0.57117283", "0.5708129",...
0.8552788
0
Sets the feed_id of this PackageNote.
def feed_id(self, feed_id): self._feed_id = feed_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_feed(self, feed: None | Feed = None) -> None:\n self.current_feed = feed\n self.refresh()", "def setID(self, idf):\n self.id = idf", "def package_id(self, package_id):\n\n self._package_id = package_id", "def set_id(self, id_):\n\n self.id_ = id_", "def set_id(...
[ "0.625687", "0.5923461", "0.5919375", "0.5891008", "0.5732699", "0.57217383", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0.55821204", "0...
0.8309776
0
Sets the version of this PackageNote.
def version(self, version): self._version = version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version(self, version):\n \n self._version = version", "def version(self, version):\n self._version = version", "def version(self, version):\n self._version = version", "def version(self, version: str):\n\n self._version = version", "def version(self, version: str):\n...
[ "0.760427", "0.7593128", "0.7593128", "0.754977", "0.754977", "0.7438496", "0.7233368", "0.7225656", "0.70923275", "0.7087204", "0.7039731", "0.69800216", "0.6957732", "0.6888694", "0.6833704", "0.68327606", "0.6807293", "0.6776633", "0.67301774", "0.6727152", "0.6727152", ...
0.7468903
24
Sets the notes of this PackageNote.
def notes(self, notes): self._notes = notes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setNotes(self, *args):\n return _libsbml.SBase_setNotes(self, *args)", "def notes(self, notes: str):\n self._notes = notes", "def notes(self, notes):\n if notes is None:\n raise ValueError(\"Invalid value for `notes`, must not be `None`\") # noqa: E501\n\n self._note...
[ "0.8039335", "0.80103546", "0.79160607", "0.6865212", "0.6451192", "0.6409795", "0.62720746", "0.6076015", "0.60153705", "0.60153705", "0.5956476", "0.5955603", "0.59426844", "0.594014", "0.5938115", "0.59310466", "0.58872205", "0.58405113", "0.58312994", "0.5830103", "0.5770...
0.8249744
2
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751324", "0.7751324", "0.7337662", "0.73335254", "0.72966903", "0.72765553", "0.7157653", "0.71558887", "0.7147938", "0.7147938", "0.7126862", "0.71260864", "0.7121746", "0.71060866", "0.7059236", "0.704307", "0.70337325", "0.70245665", "0.69634634", "0.6960516", "0.68999...
0.0
-1
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.85856134", "0.7814518", "0.77898884", "0.7751367", "0.7751367", "0.7712228", "0.76981676", "0.76700574", "0.7651133", "0.7597206", "0.75800353", "0.7568254", "0.7538184", "0.75228703", "0.7515832", "0.7498764", "0.74850684", "0.74850684", "0.7467648", "0.74488163", "0.7442...
0.0
-1
For `print` and `pprint`
def __repr__(self): return self.to_str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)", "def print_out():\n pass", "def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)", "def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)", "def _printable(self):\n ...
[ "0.75577617", "0.73375154", "0.6986672", "0.698475", "0.6944995", "0.692333", "0.6899106", "0.6898902", "0.68146646", "0.6806209", "0.6753795", "0.67497987", "0.6744008", "0.6700308", "0.6691256", "0.6674591", "0.6658083", "0.66091245", "0.6606931", "0.6601862", "0.6563738", ...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, PackageNote): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.80885184", "0.80885184", "0.805514", "0.7983044", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", "0.7966715", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8457179", "0.8393067", "0.81457263", "0.8140635", "0.8133462", "0.8094992", "0.8093376", "0.8093376", "0.8093376", "0.80863357", "0.80863357", "0.8077303", "0.8077303", "0.8066831" ]
0.0
-1
logfunction. will be removed for final version.
def LOG(s): logfilejosi = open('/var/log/vamdc_josi.log','a') s = str(s) logfilejosi.write(s + '\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setLogFunction(function):\n None", "def setLogFunction(function):\n _setLogFunction(function)", "def log(a):", "def log_method(f):\n return log(f, ignore_first=True)", "def _info(self, func):\n self.logger.info(\"llamando a %s\" % func)", "def _log(fn):\n @wraps(fn)\n def wr...
[ "0.79407287", "0.7664612", "0.7422398", "0.7330617", "0.72990507", "0.7251669", "0.7251345", "0.7233205", "0.7179204", "0.70030415", "0.6930351", "0.6890592", "0.6865771", "0.68590295", "0.6761506", "0.67430514", "0.6710775", "0.6693021", "0.66312206", "0.6603988", "0.6561712...
0.0
-1
This function is always called by the software.
def setupResults(sql, limit=1000): # log the incoming query LOG(sql) #x_internal is the list for the iteration over one search result, x the overall list (which is deduplicated in the end) molecules = [] molecules_internal = [] atoms = [] atoms_internal = [] sources = [] source...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self): \r\n return", "def __call__(self):\n\t\treturn", "def use(self):", "def run(self):", "def run(self):", "def run(self):", "def run(self):", "def run(self):", "def run(self):", "def run(self):", "def run(self):", "def run(self):", "def run(self):", "def support(...
[ "0.6861618", "0.6840663", "0.68093973", "0.6744555", "0.6744555", "0.6744555", "0.6744555", "0.6744555", "0.6744555", "0.6744555", "0.6744555", "0.6744555", "0.6744555", "0.66817826", "0.6671694", "0.6635426", "0.66284263", "0.6610892", "0.65700054", "0.65674466", "0.6540517"...
0.0
-1
Return a logger instance.
def _logger(self) -> logging.Logger: return logging.getLogger( type(self).__name__ )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instance():\n if Logger._logger_instance is None:\n Logger()\n return Logger._logger_instance", "def get_logger():\r\n global logger\r\n \r\n if logger:\r\n return logger\r\n else:\r\n return create_logger()", "def logger(self) -> logging.Logger:\n ...
[ "0.83598185", "0.8020046", "0.7995714", "0.79763085", "0.79743767", "0.78651994", "0.7845615", "0.78387433", "0.7820369", "0.7789571", "0.775313", "0.77197665", "0.7691047", "0.76821923", "0.76750916", "0.76057553", "0.75533676", "0.7547843", "0.75393784", "0.7525153", "0.752...
0.81544775
1
Return value of the entrez_gene_id attribute
def entrez_gene_id(gene: GeneInfo): if (gene.identifiers is not None and gene.identifiers.entrez is not None): if (gene.identifiers.entrez.startswith('NCBIGene:')): return gene.identifiers.entrez[9:] else: return gene.identifiers.entrez return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entrez_gene_id(self) -> int:\n return self._entrez_gene_id", "def id(self):\n return self.gene_id", "def get_entrezid(gene):\n entrezurl = \"http://mygene.info/v3/query?q=\"\n entrezurl = entrezurl+gene\n\n res = requests.get(entrezurl)\n results = pandas.read_json(StringIO(res.te...
[ "0.8480993", "0.81633437", "0.76325184", "0.7556689", "0.73744255", "0.73152524", "0.7198804", "0.7082559", "0.70238787", "0.69691044", "0.6916383", "0.66375375", "0.65141195", "0.6487426", "0.6360097", "0.633752", "0.6311204", "0.6283059", "0.6261556", "0.6259344", "0.625212...
0.81055087
2
consistent with R print correct_pvalues_for_multiple_testing([0.0, 0.01, 0.029, 0.03, 0.031, 0.05, 0.069, 0.07, 0.071, 0.09, 0.1])
def correct_pvalues_for_multiple_testing(pvalues, correction_type = "Benjamini-Hochberg"): pvalues = array(pvalues) n = int(pvalues.shape[0]) new_pvalues = empty(n) if correction_type == "Bonferroni": new_pvalues = n * pvalues elif correction_type == "Bonferroni-Holm": values = [ (pv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correct_p_values(self):\r\n exp = [0.003, 0.006, 0.003]\r\n obs = self.mc._correct_p_values([0.001, 0.002, 0.001])\r\n assert_almost_equal(obs, exp)", "def test_correct_p_values_no_change(self):\r\n exp = [None, 0.008]\r\n obs = self.mc._correct_p_values([None, 0.008])...
[ "0.783897", "0.74392277", "0.7198531", "0.7181438", "0.71745723", "0.70671207", "0.6688648", "0.6676265", "0.66302013", "0.65230614", "0.6508956", "0.6374666", "0.6314954", "0.62354577", "0.61699605", "0.6153693", "0.6120595", "0.6110194", "0.6095493", "0.6084531", "0.6079362...
0.72098184
2
Test case with only valid requests.
def test_case1(self): email = "test1@email.com" password = "testtesttest" first_name = "name1" family_name = "name2" gender = "Male" city = "Testcity" country = "Testcountry" # test sign up response = test_sign_up(email, password, first_name, fam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request_invalid(self, nosleep, method):\n # Dummies for K8s API URL and `requests` session.\n url = 'http://localhost:12345/'\n client = k8s.requests.Session()\n\n urls = [\n \"localhost\", # missing schema like \"http://\"\n \"httpinvalid://localho...
[ "0.71860117", "0.71185094", "0.69164205", "0.687908", "0.6855383", "0.68520737", "0.6842052", "0.6829176", "0.67974967", "0.6791964", "0.67868394", "0.67697984", "0.674673", "0.6720797", "0.6718986", "0.66736305", "0.66663545", "0.6637583", "0.66289175", "0.6617394", "0.66114...
0.0
-1
Test cases for invalid sign up and sign in.
def test_case2(self): valid_email = "test2@email.com" valid_password = "asdasdasd" valid_firstname = "name1" valid_familyname = "name2" valid_gender = "Female" valid_city = "Testcity" valid_country = "Testcountry" # Valid sign up response = test_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_5_sign_in_functionality_invalid_email_password(self):\n self.log.debug(\"Validate email and password fields are present\")\n self.page.validate_sign_in_window_elements()\n email = \"abc@gmail.com\" #Invalid email id\n password = \"123456\" #Invalid password\n self.log.de...
[ "0.7088148", "0.6885961", "0.6880667", "0.67373586", "0.6704038", "0.6618481", "0.6604394", "0.65910316", "0.6590093", "0.6574882", "0.65321714", "0.6514206", "0.65073717", "0.6412174", "0.63692397", "0.6344882", "0.6337391", "0.63259315", "0.63258", "0.6323248", "0.6315085",...
0.69835126
1
Test cases for invalid options for remaining singleuser functions.
def test_case3(self): email = "test3@email.com" password = "huehuehuehue" first_name = "name1" family_name = "name2" gender = "Male" city = "Testcity" country = "Testcountry" bad_token = "bad token" # Sign up with valid data response = t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_options(self):\n\n wf._items = []\n\n sys.argv = ['drive.py', '> not here']\n main(None)\n self.assertEqual(len(wf._items), 1)\n self.assertEqual(wf._items[0].title, ERRORS['InvalidOption']['title'])\n self.assertFalse(wf._items[0].valid)\n self.ass...
[ "0.6921977", "0.6483761", "0.6326724", "0.62633187", "0.62252504", "0.61532855", "0.61503947", "0.61236167", "0.60741204", "0.60654956", "0.6053451", "0.6017857", "0.60027343", "0.5996068", "0.5989205", "0.59843975", "0.5980413", "0.5966038", "0.596315", "0.59494287", "0.5923...
0.0
-1
Test cases for functionality that requires multiple users.
def test_case4(self): email1 = "test4@email.com" password1 = "asdasdasd" first_name1 = "name1" family_name1 = "name2" gender1 = "Male" city1 = "Testcity" country1 = "Testcountry" email2 = "test5@email.com" password2 = "asdasdasd" first_na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_users(self):\n pass", "def test_user(self):\n return True", "def test_multiple_success():\n test_usernames = [\"foo\", \"bar\", \"baz\"]\n\n for username in test_usernames:\n user = UserFactory.create(username=username, is_active=True)\n UserSocialAuthFactory.crea...
[ "0.7163188", "0.7157695", "0.69663084", "0.69517297", "0.69517297", "0.69436216", "0.6935643", "0.69141805", "0.6906897", "0.68688667", "0.68404806", "0.6802677", "0.6797317", "0.67824656", "0.6778907", "0.6778907", "0.67548573", "0.67390066", "0.6729447", "0.6699855", "0.667...
0.0
-1
This function is run once each time the robot enters autonomous mode.
def autonomousInit(self): fieldState = self.driverStation.getGameSpecificMessage() self.fieldState = fieldState self.smartDashboard.putString("field state", fieldState) fieldPosition = self.smartDashboard.getString("field position", "") self.startingFieldPosition = self.parserobo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autonomousInit(self):\n self.globalInit()\n self.autonomous.start()", "def _on_autonomous_enable(self) -> None:\n\n # XXX: FRC Dashboard compatibility\n # -> if you set it here, you're stuck using it. The FRC Dashboard\n # doesn't seem to have a default (nor will it show...
[ "0.7591189", "0.7282657", "0.6770413", "0.6743494", "0.65831965", "0.65689296", "0.6427243", "0.6401029", "0.63937986", "0.6374063", "0.6336391", "0.6330447", "0.6317473", "0.6311653", "0.6310341", "0.63009936", "0.62906706", "0.6163547", "0.6159578", "0.6144214", "0.6138753"...
0.6548382
6
Partial update an object
def patch(self, request, pk=None): return Response({'message': 'patch'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_update(self, request, pk=None): #partial update a specific object\n return Response({'http_method': 'PATCH'})", "def partial_update(self, request, *args, **kwargs):\n instance = self.get_object()\n serializer = self.get_serializer(instance, data=request.data, partial=True)\n ...
[ "0.7891486", "0.7636699", "0.7306302", "0.7305018", "0.72183466", "0.72084665", "0.72012454", "0.7157133", "0.68633926", "0.6843239", "0.6759846", "0.66094255", "0.65638405", "0.65014493", "0.64954484", "0.64345", "0.6399024", "0.6390871", "0.6384979", "0.6374396", "0.6374061...
0.0
-1
Helper function to normalize version Returns a comparable object
def normalize_version(v): rv = [] for x in v.split("."): try: rv.append(int(x)) except ValueError: for y in re.split("([0-9]+)", x): try: if y != '': rv.append(int(y)) except ValueError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __cmp__(self, other):\n\n from distutils.version import LooseVersion\n return cmp(self.version, LooseVersion(other))", "def __lt__(self, compareto: Union[str, float, int, \"AwesomeVersion\"]) -> bool:\n if isinstance(compareto, (str, int)):\n compareto = AwesomeVersion(compareto)\n ...
[ "0.6619351", "0.6102797", "0.58966285", "0.587306", "0.58682376", "0.5844353", "0.58272856", "0.5782349", "0.5742186", "0.570351", "0.56979656", "0.5681768", "0.56780016", "0.5670993", "0.56692773", "0.56069744", "0.5596596", "0.55778956", "0.5548947", "0.553731", "0.553731",...
0.0
-1
Upgrade the package if there is a later version available.
def upgrade_if_needed(self, restart = True, dependencies = False): if self.check(): print "Upgrading %s" % self.pkg self.upgrade(dependencies) if restart: self.restart()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade(self, old_version, new_version):\n pass", "def upgrade(self):", "def upgrade(self):", "def downgrade():\n pass", "def downgrade():\n pass", "def downgrade():\n raise NotImplementedError(\"Downgrade is not supported\")", "def downgrade():\n raise NotImplementedError(\"Downgrade is...
[ "0.723688", "0.7112298", "0.7112298", "0.7022366", "0.7022366", "0.7015959", "0.7015959", "0.7015959", "0.69837075", "0.66312116", "0.657686", "0.65517104", "0.6545114", "0.6488389", "0.64031035", "0.63755894", "0.63752556", "0.6303454", "0.6300192", "0.62987626", "0.62968373...
0.7406573
0
Upgrade the package unconditionaly
def upgrade(self, dependencies = False): pip_args = [] proxy = environ.get('http_proxy') if proxy: pip_args.append('--proxy') pip_args.append(proxy) pip_args.append('install') pip_args.append(self.pkg) if self.index is not None: pip_arg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade(self):", "def upgrade(self):", "def upgrade_if_needed(self, restart = True, dependencies = False):\n if self.check():\n print \"Upgrading %s\" % self.pkg\n self.upgrade(dependencies)\n if restart:\n self.restart()", "def downgrade():\n pass"...
[ "0.77651864", "0.77651864", "0.7289119", "0.71871936", "0.71871936", "0.7091273", "0.7091273", "0.7091273", "0.6949011", "0.69193083", "0.6769115", "0.67193484", "0.6690322", "0.6638302", "0.66124755", "0.65871555", "0.65205747", "0.65131366", "0.6512471", "0.64781505", "0.64...
0.6239241
25
Restart application with same args as it was started. Does not return
def restart(self): print "Restarting " + executable + " " + str(argv) execl(executable, *([executable]+argv))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart(reason, *args, **kwargs):\n logging.info(\"Restarting: %s\" % reason)\n os.execv(sys.argv[0], sys.argv)", "def RestartApp(argv_extra):\n\n p = psutil.Process(os.getpid())\n for handler in p.open_files() + p.connections():\n if handler.fd != -1:\n os.close(handler.fd)\n\n...
[ "0.7492682", "0.7328665", "0.7202149", "0.7188887", "0.7183816", "0.71728677", "0.7089019", "0.70228314", "0.70211715", "0.7020362", "0.69969636", "0.69169647", "0.68793124", "0.68679875", "0.6858443", "0.6785412", "0.67613715", "0.67178905", "0.67106485", "0.66852856", "0.66...
0.7907249
0
Check if pkg has a later version Returns true if later version exists.
def check(self): current = self._get_current() # There is no version, so don't attempt to upgrade if current[-1]: return False highest = self._get_highest_version() return highest > current
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _checkUpdateNeeded(self):\n try:\n currentVersionLine = str(subprocess.run(['pacman', '-Q', '-i', self._name],\n stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True).stdout)\n currentVersion = re.sub(r'.*Version\\s*: ([\\d|\\.]*)-.*'...
[ "0.7021907", "0.6526294", "0.6518159", "0.6440555", "0.6406439", "0.6377378", "0.6335543", "0.6268659", "0.62651664", "0.62472224", "0.61878824", "0.61660576", "0.6135595", "0.61285186", "0.61124414", "0.61058915", "0.60857654", "0.6072164", "0.60495275", "0.6023318", "0.5998...
0.650313
3
Make sure arguments passed are defined as optional args.
def validate_optional_arg(non_required_arg, optional_type): LOG.debug('non_required_arg: %s, optional_type: %s', non_required_arg, optional_type) if isinstance(non_required_arg, dict): for key, val in non_required_arg.items(): if type(key) in optional_type: # Make sure given ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_optional_arguments(self, *args):\n self._add_sample_specific_arguments(False, *args)", "def _check_args(self, args_):\n\n pass", "def valid_args(args):\n return args is not None and len(args) > 0", "def validate_args(self):\n\n parser = argparse.ArgumentParser()\n\n par...
[ "0.7520359", "0.7495491", "0.7475243", "0.74102503", "0.7395206", "0.7393366", "0.7276745", "0.7087539", "0.7069196", "0.70623475", "0.7059742", "0.705419", "0.7047886", "0.7002783", "0.69643813", "0.69628036", "0.6914736", "0.6901701", "0.68822724", "0.6843955", "0.6840575",...
0.0
-1
Make sure required arguments are present.
def validate_required_arg(new_arg, required_type): LOG.debug('new_arg: %s, required_type: %s', new_arg, required_type) if (isinstance(required_type, dict) and len(required_type.keys()) == 1 and len(required_type.values()) == 1 and type(list(required_type.keys())[0]) == type):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_required(self):\n for argument in self.arguments:\n if argument.required:\n raise ArgumentRequiredError(argument, self.tagname)\n else:\n self.kwargs[argument.name] = argument.get_default()", "def check_required(self, required):\n for k ...
[ "0.8181676", "0.78702474", "0.7787294", "0.774969", "0.7489102", "0.7430658", "0.7272238", "0.72162896", "0.71618503", "0.7148597", "0.7102853", "0.70787334", "0.70622075", "0.70550203", "0.7045379", "0.70346355", "0.6999009", "0.69819504", "0.6967147", "0.69366306", "0.69362...
0.0
-1
initializes config paths based on json file
def load_configs(self, json_fname): attr_dict = {key: value for key, value in self.__dict__.items() if not key.startswith("__") and isinstance(value, str)} with open(json_fname) as data_file: jn = json.load(data_file) for key, value in attr_dict.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_configs(self):\n\n # get current location\n self.script_dir = os.path.dirname(__file__)\n\n # load configuration file\n with open(os.path.join(self.script_dir, \"config.json\")) as f:\n self.configs = json.load(f)\n \n # load some configs as attributes\...
[ "0.7472599", "0.7347027", "0.7163628", "0.7163628", "0.71142066", "0.6932154", "0.6710952", "0.6697616", "0.6696893", "0.66957915", "0.66771334", "0.66642076", "0.6625074", "0.65872264", "0.65341294", "0.6515458", "0.6499426", "0.6485855", "0.6477584", "0.64485854", "0.638551...
0.62096363
39
transforms data by cropping, contrast, brightness, color, sharpness, and more
def data_tf(img): img = crop.process(img) img = random_contrast.process(img) img = random_brightness.process(img) img = random_color.process(img) img = random_sharpness.process(img) if img.size[1] >= 32: img = compress.process(img) img = adjust_resolution.process(img) img...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalise(image):", "def pre_processing_image(img):\n\n #print(img.shape)\n # apply gamma correction and show the images\n #adjusted = adjust_gamma(img, gamma=0.65)\n\n adjusted = exposure.adjust_gamma(img, gamma=1.65)\n #print(adjusted.shape)\n\n # log transform of image\n\n logarithmic...
[ "0.6670794", "0.63854635", "0.63689613", "0.630164", "0.630164", "0.62767696", "0.61236227", "0.6019168", "0.59998864", "0.5999592", "0.5993214", "0.59788734", "0.59414375", "0.59368694", "0.58620316", "0.58577394", "0.5838846", "0.5823632", "0.582191", "0.58008796", "0.57998...
0.56179476
50
read from fifo and parse into dictionary
def parse_trace(self): current = '' # current basic block being parsed previous = '0' # previous basic block beding parsed edge_count = 0 uniq_count = 0 with open(self._fifo_name, 'r') as fifo: for line in fifo: if line[6] == '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self):\n buffer = ''\n while True:\n buffer = buffer + self.io.read(self.io.inWaiting())\n if ' \\n' in buffer:\n lines = buffer.split(' \\n')\n if len(lines) > 2:\n last_full_line = lines[-2]\n header, values = last_full_line.split(\" \",1)\n float...
[ "0.6154674", "0.58273804", "0.57860047", "0.5758259", "0.5704924", "0.552367", "0.5465178", "0.5464379", "0.5400063", "0.53869545", "0.5373874", "0.5286278", "0.527438", "0.5263859", "0.52516687", "0.5243127", "0.52396643", "0.52133816", "0.52069277", "0.5204815", "0.51968765...
0.48739865
85
analyze the dynamic translation block coverage with qemu
def analyze_dynamic(self, test_input): # Execute binary with qemu user mode while taking care of libraries # collect dynamic translation block execution information # 1. create a named pipe for qemu to write to self.mkfifo() # 2. build command and launch QEMU # cmd = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_addr_coverage(self):\n logger.info('Generating translation block coverage information')\n\n tb_files = get_tb_files(self.project_path('s2e-last'))\n tb_coverage_files = aggregate_tb_files(tb_files)\n ret = {}\n\n # Get the number of times each address was executed by S2E...
[ "0.5733099", "0.5684116", "0.5423686", "0.53903526", "0.5295646", "0.52860355", "0.5246108", "0.5194682", "0.5191534", "0.51719093", "0.5146529", "0.51181334", "0.51031566", "0.508765", "0.50834346", "0.505631", "0.50281286", "0.50224406", "0.49979833", "0.4987376", "0.497487...
0.6033092
0
If a hyperspy signal is given, it is transformed into a ModifiedSignal. In that case, additional args and kwargs are discarded.
def __init__(self, *args, **kwargs): if len(args) > 0 and isinstance(args[0], BaseSignal): # Pretend it is a hs signal, copy axes and metadata sdict = args[0]._to_dictionary() self.__class__.__init__(self, **sdict) else: BaseSignal.__init__(self, *args, **...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal(self, args):\n pass", "def test_forwards_args(self):\n seen_kwargs = {}\n\n def callback(**kwargs):\n seen_kwargs.update(kwargs)\n\n SignalHook(self.test_extension, self.signal, callback)\n self.signal.send(sender=self, foo=1, bar=2)\n\n self.assert...
[ "0.58201706", "0.5802816", "0.5742859", "0.5680142", "0.5531176", "0.5348851", "0.5281184", "0.52533114", "0.5215119", "0.5179791", "0.51360905", "0.5093725", "0.50849617", "0.50493014", "0.50189066", "0.5009883", "0.50008637", "0.49492764", "0.493958", "0.49378914", "0.49291...
0.59273946
0
If a hyperspy Signal2D is given, it is transformed into a ModifiedImage. In that case, additional args and kwargs are discarded.
def __init__(self, *args, **kwargs): if len(args) > 0 and isinstance(args[0], Image): # Pretend it is a hs signal, copy axes and metadata sdict = args[0]._to_dictionary() Image.__init__(self, **sdict) else: Image.__init__(self, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n if len(args) > 0 and isinstance(args[0], (Image, CImage)):\n # Pretend it is a hs signal, copy axes and metadata\n sdict = args[0]._to_dictionary()\n CImage.__init__(self, **sdict)\n else:\n CImage.__init__(self, *args...
[ "0.6233259", "0.5859255", "0.58262306", "0.5785775", "0.5682472", "0.56448776", "0.561343", "0.5559629", "0.5498418", "0.54961455", "0.54533714", "0.54435664", "0.54435664", "0.54297704", "0.5408063", "0.5403812", "0.5402164", "0.5400834", "0.5393468", "0.5388425", "0.538773"...
0.62607485
0
Deprecated! use set_pad instead. Pad a hyperspy Image of navigation dimension <= 1. This is a wrapper for numpy.pad function. Additionally, as the padding information is stored in metadata, it is possible to reverse the effect of this function with a call to the unset_padding method.
def set_padding(self, pad_width=None, *erps, **kw): if pad_width is None: # If padding == None: # Same signal is returned, nothing else done return self # Store padded data and exit s = self.deepcopy() if self.axes_manager.navigation_dimension == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_padding(im, pad):\n\n return np.pad(im, pad_width=((pad, pad), (pad, pad), (0, 0)), mode='symmetric')", "def pad(self, *args, **kwargs):\n return _image.image_pad(self, *args, **kwargs)", "def _pad_image(self, img: ndarray, pad_width: int = 10) -> ndarray:\n self.padded_img = np.zeros(...
[ "0.66617864", "0.63132435", "0.6255937", "0.61713904", "0.6079077", "0.6016708", "0.59918535", "0.59772426", "0.5958085", "0.58424485", "0.5815568", "0.58081615", "0.58037835", "0.58019966", "0.5799036", "0.579806", "0.57655376", "0.57642895", "0.5691326", "0.56810474", "0.56...
0.6223679
3
This method returns an unpadded copy of a padded Image by reading the value from metadata. See the set_padding function for more information. Note the set_pad method and unset_padding are Deprecated in favor of set_pad.
def unset_padding(self): if self.metadata.Signal.has_item('pad_tuple'): Npy, Npx = self.metadata.Signal.pad_tuple else: # If no padding was done, return the same signal return self Nx, Ny = self.axes_manager.signal_shape s=self.deepcopy() del s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_padding(im, pad):\n\n return im[pad:-pad, pad:-pad]", "def padding(image, padded_size):\n image_row, image_col = image.shape #asigna alto y ancho de la imagen \n\n padded_image = np.zeros((image_row + padded_size*2, image_col + padded_size*2)) #matriz de imagen con padding en zeros\n print...
[ "0.6686708", "0.60340595", "0.6015768", "0.5856643", "0.58009404", "0.57768005", "0.57617044", "0.5709223", "0.5699135", "0.5642607", "0.5624117", "0.5597678", "0.5559465", "0.54506725", "0.5443101", "0.5443005", "0.54270214", "0.5399542", "0.5328586", "0.5314647", "0.5288809...
0.5474216
13
Returns the real space coordinate vectors for this image.
def get_real_space(self, shifted=True, shifts=None): scales, offsets, coords = [], [], [] for axi in self.axes_manager.signal_axes: scales += [axi.scale,] offsets += [axi.offset,] coords += [axi.axis.copy(),] if shifted: for io in range(2): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec(self):\r\n\r\n xv = np.arange(self.dx / 2, self.lx, self.dx)\r\n yv = np.arange(-self.ly / 2 + self.dy / 2, self.ly / 2, self.dy)\r\n zv = np.arange(self.oz, self.lz + self.oz, self.dz)\r\n\r\n if self.ox != 0:\r\n xv = np.arange(self.ox, self.lx + self.ox, self.dx)\r...
[ "0.73288465", "0.6918892", "0.6731269", "0.67148864", "0.6648549", "0.664336", "0.6614607", "0.6583926", "0.65650994", "0.6505811", "0.65025306", "0.64973223", "0.6463893", "0.64560205", "0.6419003", "0.6400466", "0.63788056", "0.6352214", "0.6321161", "0.6269683", "0.6269301...
0.56318724
86
Returns meshgrids for Fourier transforms of the image. Can be selected by choosing the parameter "retstr". Choosing from k2 = kx^2+ky^2, these vectors, or both. See below for more info.
def get_fourier_space(self, retstr='square'): # Get scales Nx, Ny = self.axes_manager.signal_shape dx, dy = [axi.scale for axi in self.axes_manager.signal_axes] # Calculate K-space dky = 2.*np.pi / (Ny*dy) dkx = 2.*np.pi / (Nx*dx) ky1D = dky*(-np.floor(Ny/2.)+np....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getkGrid(self, scaled=True):\n if scaled:\n return np.meshgrid(fft.fftshift(self.k_axis_scaled),\n fft.fftshift(self.k_axis_scaled))\n else:\n return np.meshgrid(fft.fftshift(self.k_axis_unscaled),\n fft.fftshift(se...
[ "0.5996112", "0.5166293", "0.509505", "0.50575054", "0.50280195", "0.49867755", "0.49505532", "0.49462128", "0.49283844", "0.48290855", "0.4794119", "0.47900182", "0.47630283", "0.47192663", "0.46941283", "0.46898642", "0.46341336", "0.46177945", "0.4602217", "0.45985743", "0...
0.61359316
0
Obtain the contrast transfer function (CTF) to model an imaging system. The CTF is given in Fourier representation. Imaging systems with high numerical aperture, NA > 1, are supported. It is possible to also obtain smooth apertures setting the fsmooth parameter. Such smoothing is performed up to fsmooth times the size ...
def get_contrast_transfer(self, defoci=None, angles=None, wlen=None, nref=None, NA=None, fsmooth=None): # Read defocus and angle values from input or set them from the axes # Notice the method stops if defoci is not present ax_count = 0 if defoci is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ctf(ima):\n\tfrom EMAN2 import EMAN2Ctf\n\tctf_params = ima.get_attr(\"ctf\")\t\n\treturn ctf_params.defocus, ctf_params.cs, ctf_params.voltage, ctf_params.apix, ctf_params.bfactor, ctf_params.ampcont, ctf_params.dfdiff, ctf_params.dfang", "def _excitonic_coft(self,SS,AG,n):\n \n # SystemBa...
[ "0.7002581", "0.6209968", "0.6088645", "0.60796756", "0.58631736", "0.58065104", "0.5677437", "0.56587964", "0.5646235", "0.56107277", "0.5602662", "0.55997133", "0.5555804", "0.5444011", "0.5426433", "0.5417966", "0.5346494", "0.5341499", "0.53395545", "0.53183836", "0.53132...
0.5034486
36
If a hyperspy.signal is given, it is transformed into a ModifiedImage. In that case, additional args and kwargs are discarded.
def __init__(self, *args, **kwargs): if len(args) > 0 and isinstance(args[0], (Image, CImage)): # Pretend it is a hs signal, copy axes and metadata sdict = args[0]._to_dictionary() CImage.__init__(self, **sdict) else: CImage.__init__(self, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n if len(args) > 0 and isinstance(args[0], Image):\n # Pretend it is a hs signal, copy axes and metadata\n sdict = args[0]._to_dictionary()\n Image.__init__(self, **sdict)\n else:\n Image.__init__(self, *args, **kwargs)"...
[ "0.66465324", "0.5652755", "0.5575546", "0.54421556", "0.54421556", "0.54044956", "0.5362523", "0.5332503", "0.53049153", "0.525668", "0.52531075", "0.5228889", "0.5194865", "0.51814127", "0.51791483", "0.51512146", "0.51426876", "0.51414084", "0.51294863", "0.5111185", "0.51...
0.6489429
1
Helper method to instantiate a ModifiedImage class object from a numpy array The last 2 dimensions of the numpy array are identified as Image (Signal2D) dimensions. Any other dimensions are identified with navigation dimensions, following the hyperspy conventions.
def numpy2ModI(npdata, dsig=(1., 1.), osig=(0., 0.), dnav=(1., ), onav=(0., )): img = ModifiedImage(npdata) for io, axi in enumerate(img.axes_manager.signal_axes): axi.offset = osig[io] axi.scale = dsig[io] if npdata.ndim > 2: for io, axi in enumerate(img.axes_manager.navigation_axe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newimagefromarray(self, *args, **kwargs):\n return _image.image_newimagefromarray(self, *args, **kwargs)", "def fromarray(self, *args, **kwargs):\n return _image.image_fromarray(self, *args, **kwargs)", "def create_from_array(cls, array: np.ndarray) -> \"TensorImage\":\n if array.dtype != ...
[ "0.7142961", "0.66900367", "0.63602257", "0.625875", "0.62094176", "0.62019867", "0.6056725", "0.6047084", "0.60209256", "0.5842246", "0.5758324", "0.574834", "0.57145417", "0.5702823", "0.56152433", "0.55545264", "0.55530345", "0.5538081", "0.5535631", "0.55340606", "0.55339...
0.58416265
10
Simulation of focal series using nonlinear Optics. The named parameters are used to set the calculations using module CTFSim. Anonymous params (erps and kwerps) are used to calculate a contrast transfer function, through a call to the get_contrast_transfer method.
def simulate_CTF(wave, defoci, alpha=None, using_gpu=False, *erps, **kwerps): ctsim = CTFSim(wave, zdef, alpha, using_gpu, *erps, **kwerps) fs = ctsim() return fs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_model_parameters(phi, T, nz, coord, SWVD, form=\"Calonne\"):\r\n D_eff = np.ones(nz)\r\n\r\n if form == \"Hansen\": # Hansen and Foslien (2015)\r\n D_eff = phi * (1 - phi) * D0 + D0\r\n elif form == \"Calonne\": # Calonne et al. (2014)\r\n x = 2 / 3 - phi\r\n b = np.heavi...
[ "0.5856837", "0.5780712", "0.57433075", "0.5730712", "0.57226616", "0.55379325", "0.5402803", "0.5266863", "0.52123934", "0.51807517", "0.5131692", "0.5131424", "0.51174015", "0.5110087", "0.5106631", "0.5105571", "0.51048374", "0.50832444", "0.507298", "0.5072809", "0.505827...
0.0
-1
Will retrieve the phase from a focal series in a deterministic fashion using the multifocus transport of intensity (MFTIE) method. The named parameters are passed to the __init__ method of module MFTIE. Anonymous parameters (erps and kwerps) are used to calculate the inverse Laplacian filters (more info in module MFTIE...
def multi_focus_TIE(fs, using_gpu=False, printing=False, *erps, **kwerps): mftie = MFTIE(fs, using_gpu, *erps, **kwerps) phase = mftie() if printing: mftie.print_k2_thres() return phase
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_process_TIE(fs, *erps, **kwerps):\n gptie = GPTIE(fs, *erps, **kwerps)\n phase = gptie()\n return phase", "def getPhase(phase):", "def T(params, phi):\n\t# handle the base frame, eqn 3.9, p36\n\tt = np.array([\n\t\t[cos(phi), -sin(phi), 0.0, 0.0],\n\t\t[sin(phi), cos(phi), 0.0, 0.0],\n\t\...
[ "0.5387762", "0.5230304", "0.5211815", "0.5198059", "0.51977754", "0.5130902", "0.5115025", "0.50400496", "0.5024854", "0.50156635", "0.50012213", "0.49933702", "0.4982817", "0.4942338", "0.49365675", "0.49344906", "0.4928456", "0.4909189", "0.4909062", "0.48921904", "0.48724...
0.5543668
0
Will retrieve the phase from a focal series in a deterministic fashion using the gaussianprocess transport of intensity (GPTIE) method. The anonymous parameters (erps and kwerps) are passed to the GPTIE module
def gaussian_process_TIE(fs, *erps, **kwerps): gptie = GPTIE(fs, *erps, **kwerps) phase = gptie() return phase
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ETPA(omegap, E, edip, Te, g_idx=[0], e_idx=[], f_idx=[]):\n N = len(E)\n tdm = edip\n # gamma = np.zeros(nstates)\n # for j in range(1, N):\n # gamma[j] = sum(tdm[:j, j]**2) * 0.0005\n # gamma[1:] = 0.0001\n\n # print('lifetimes of polariton states = {} eV'.format(gamma * au2ev))\n\n ...
[ "0.5845086", "0.5804024", "0.5762294", "0.57219493", "0.5717423", "0.5686649", "0.56757325", "0.5538305", "0.5519094", "0.55185133", "0.5491932", "0.5471413", "0.54459774", "0.5436331", "0.542151", "0.5375313", "0.53742886", "0.5355532", "0.534618", "0.52903897", "0.5266585",...
0.729517
0
Will refine a wave guess from a focal series in an iterative fashion using a version of the GerchbergSaxton (GS) loop. The named parameters are passed to the __init__ method of module GS. Anonymous parameters are optionally used to calculate a contrast transfer function, in the case this is not given, through fs.get_co...
def multi_focus_GS(fs, Niters=5, init_wave=None, ctf=None, alpha=None, using_gpu=False, init_phase=None, *erps, **kwerps): gsref = GS(fs, init_wave, ctf, alpha, using_gpu, *erps, **kwerps) if init_phase is None: wave = gsref(Niters) return wave if init_phase is not None:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_refine_step(self, sample, integral, integral_var, **kwargs):", "def compute_scf(geoint, guess, nstep=20, threshold=1e-6):\n # Some essential integrals...\n coreham = geoint['ki'] - geoint['nai']\n olp = geoint['oi']\n \n # The initial guess\n dm_alpha = guess['dm_alpha']\n dm_bet...
[ "0.56499416", "0.5638964", "0.559936", "0.55021787", "0.54349416", "0.53798175", "0.5369566", "0.53046954", "0.52480394", "0.52229273", "0.5188865", "0.51813334", "0.51805145", "0.5169596", "0.513884", "0.51108414", "0.5085409", "0.5055628", "0.504844", "0.5031253", "0.503005...
0.54431874
4
Perform a chi square test. Returns
def run_chi2(self, silent_run=False): self.chi2 = (self.obs - self.exp)**2. self.chi2.data /= self.exp.data**2. if not silent_run: return self.chi2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_chi_2(self):\n NN = 4\n w = 0.01\n kz = 1.0e-7\n kp = 3.0e-7\n wp = 2.0e3\n tz = 2.0e-18\n tp = 1.0e-18\n vthz = 1e5\n vthp = 1e5\n omega = 0.1\n vz = 100.\n\n chi = f_chi(NN, w, kz, kp, wp, tz, tp, vthz, vthp,\n ...
[ "0.69860387", "0.6974439", "0.692027", "0.6900534", "0.68230224", "0.68178236", "0.68107116", "0.6658554", "0.6568164", "0.6543013", "0.64838725", "0.6453995", "0.63928324", "0.63667536", "0.6342304", "0.6342304", "0.6321123", "0.6321073", "0.6294361", "0.624833", "0.6242034"...
0.5677939
56
Perform a rvalue test. Only positive data (intensities). Returns
def run_rvalue(self, silent_run=False): odata = np.sqrt(self.obs.data) edata = np.sqrt(self.exp.data) self.rvalue = np.sqrt((odata - edata)**2.).sum() self.rvalue /= edata.sum() if not silent_run: return self.rvalue
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_of_with_args(self) -> None:\n assert Result.of(lambda x: bool(x > 0), 1).unwrap() is True", "def test_pos():\n # Test for positive special method with scalar Rnode object\n x = Rnode(5)\n z = +x\n try:\n assert z.value == 1 * x.value\n except AssertionError as e:\n pr...
[ "0.56166077", "0.52924556", "0.49803373", "0.49245155", "0.49001187", "0.48983425", "0.48789844", "0.48493248", "0.48468444", "0.48117045", "0.4811189", "0.48032174", "0.480225", "0.47236064", "0.4706626", "0.47004962", "0.46803305", "0.46701148", "0.4667749", "0.46482965", "...
0.4604436
23
Measure RMSE^2 in real and reciprocal space. Returns
def run_rmse_check(self): # Shift the intensities to compare obs = self.obs.data - self.obs.data.mean() exp = self.exp.data - self.exp.data.mean() # Experimental RMSE2 in real space rmse_real = (obs - exp) rmse_real = rmse_real**2 # Experimental RMSE2 in recipr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_RMSE(e):\n \"\"\"Corresponds to sqrt(2*MSE)\"\"\"\n \n return np.sqrt(2*compute_MSE(e))", "def rrse(self) -> float:\n return float(np.sqrt(self.rse()))", "def measure_rmse(self):\n try:\n assert self.residuals_forecast is not None\n except AssertionError:\n ...
[ "0.7872834", "0.75949156", "0.75894135", "0.75683", "0.7567819", "0.75499594", "0.75355643", "0.7495896", "0.7354617", "0.72762173", "0.72546834", "0.72449005", "0.72449005", "0.72137094", "0.7211572", "0.72056526", "0.71871936", "0.71746224", "0.7170366", "0.7159166", "0.715...
0.7639022
1
Perform Fourier ring correlation (FRC) test. At the time, only the FRC for 2D images has been implemented. Because this algorithm uses FFT to compare images, it is important to enforce periodic boundary conditions, e.g. by the use of padding.
def run_fourier_ring_correlation(self, bin_size=None): # This is done in the fourier plane exp_ft = self.exp.fft(True) obs_ft = self.obs.fft(True) # Get correlations axdict = obs_ft.axes_manager.as_dictionary() axdict = [axdict[keys] for keys in axdict.keys()] ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corrf(u, v, nf):\n V = np.conj(np.fft.fft(v, n=nf))\n U = np.fft.fft(u, n=nf)\n X = U*V\n x = np.real(np.fft.ifft(X, n=nf))\n return x", "def frc(im1, im2, annulus_width=1, edgetaper=5, edgeloc=8 / 20.0, loc=(0, 0), smooth=None, working_mask=None, x=None,\n y=None, rmax=None, taper=None...
[ "0.638313", "0.630608", "0.6283942", "0.62651575", "0.62496763", "0.6248945", "0.6202985", "0.6131658", "0.6022188", "0.5948053", "0.58898234", "0.5878836", "0.585236", "0.584517", "0.5792167", "0.57854164", "0.5775085", "0.57525617", "0.57479095", "0.57201385", "0.5718814", ...
0.6200045
7
port with all pins inverted
def inverted( self ): return self._modifier( self, lambda x: invert_bits( x, self.nr_of_pins ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, pin_obj: Pin, invert: bool = False):", "def invert_port(self, port, polarity):\n\n if port == 1:\n self.__bus.write_byte_data(self.__ioaddress, self.IPOLB, polarity)\n self.__port_b_polarity = polarity\n else:\n self.__bus.write_byte_data(self.__i...
[ "0.63888365", "0.6374163", "0.6296547", "0.5969197", "0.59159297", "0.58010113", "0.57998306", "0.57990515", "0.56984675", "0.5620566", "0.56079745", "0.5602531", "0.5586794", "0.5572789", "0.55686104", "0.55678266", "0.55626017", "0.5534482", "0.5527071", "0.5523599", "0.552...
0.6363903
2
port with the pins mirrored (pin order reversed)
def mirrored( self ): return self._modifier( self, lambda x: mirror_bits( x, self.nr_of_pins ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def op_mirror():\n mir = np.array([[1, 0, 0, 0],\n [0, 1, 0, 0],\n [0, 0, -1, 0],\n [0, 0, 0, -1]])\n return mir", "def as_pin_out( self ):\n return _pin_out_from_port_out( self.as_port_out() )", "def rotate(self):\n\n self.pins = sel...
[ "0.63303953", "0.62193274", "0.6186834", "0.6178602", "0.6171273", "0.6046138", "0.6041167", "0.59468573", "0.59202063", "0.591281", "0.5760961", "0.57570535", "0.57289064", "0.57234144", "0.5697887", "0.5635463", "0.5608617", "0.55651623", "0.55323", "0.55020136", "0.5475424...
0.6741525
0
read and combine the pins that make up the port
def read( self ) -> int: if self._slave is not None: return self._filter( self._slave.read() ) else: result = 0 for pin in self._pins[ :: -1 ]: result = result << 1 if pin.read(): result |= 0b1 return r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_pins(self):\n\n for bit in range(self.addr_size):\n self.add_pin(\"addr_{0}\".format(bit),\"INPUT\")\n \n self.add_pin(\"wl_en\", \"INPUT\")\n\n for bit in range(self.num_rows):\n self.add_pin(\"wl_{0}\".format(bit),\"OUTPUT\")\n \n self.add_p...
[ "0.6417422", "0.5873375", "0.58421856", "0.57833403", "0.5708977", "0.557878", "0.55762327", "0.5553285", "0.55478317", "0.5508428", "0.5486689", "0.54373777", "0.543672", "0.5429543", "0.5376903", "0.5359111", "0.5347628", "0.5344464", "0.5342017", "0.53398526", "0.53340036"...
0.0
-1