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
Converts a unified CSV row to a SVM feature matrix (numbers only!)
def row_to_features(self, row): sequence = unify_sequence(row["Sequence"]) charge = field_to_float(row["Charge"]) score = field_to_bayes_float(row[self.col_for_sorting]) calc_mz, exp_mz, calc_mass, exp_mass = get_mz_values(row) # calc_mz = field_to_float( row['Calc m/z'] ) # cal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csvRowToVector(self, csvRow, questionIds, csvTitles):\n if len(csvTitles) != len(csvRow): \n raise ValueError(\"Length of titles list is different to that of csvRow\")\n \n numFields = len(questionIds)\n egoRow = numpy.zeros(numFields) \n\n for i in range(0, numFie...
[ "0.65499526", "0.649871", "0.6260098", "0.6239809", "0.622896", "0.6216122", "0.6206421", "0.615319", "0.6141482", "0.6021808", "0.60132277", "0.6011888", "0.59874713", "0.5967463", "0.59497404", "0.5932906", "0.5924142", "0.5853456", "0.5838096", "0.58369327", "0.581172", ...
0.0
-1
parses a unified csv file and collects features from each row
def collect_data(self): categories = [] list_of_feature_lists = [] feature_sets = set() with open(self.csv_path, "r") as f: reader = csv.DictReader(f) # collecting some stats for FDR calculation: self.PSM_count = 0 self.decoy_count = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCSV(input_file):", "def parse_prefeaturized_csv_data(features_file_path):\n objects = []\n with open(features_file_path) as f:\n # First line contains column titles\n keys = f.readline().strip().split(',')\n for line in f:\n vals = line.strip().split(\",\")\n ...
[ "0.70052725", "0.67813885", "0.67507994", "0.671795", "0.66744685", "0.65594405", "0.6549073", "0.6524705", "0.65231276", "0.6494231", "0.6469768", "0.6439672", "0.6422604", "0.6382351", "0.63786244", "0.6309739", "0.6285347", "0.62765247", "0.6273016", "0.62624663", "0.62614...
0.70409966
0
Determines whether a PSM (csv row) should be used as a negative or positive training example. returns 1 highscoring target (positive training example) 0 nothighscoring target (not usable for training) 1 decoy (negative training example)
def get_psm_category(self, row): category = 0 # unknown (mix of true positives and false positives) self.PSM_count += 1 # for FDR calculation sequence = unify_sequence(row["Sequence"]) psm_FDR = calc_FDR(self.PSM_count, self.decoy_count) if row_is_decoy(row): self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify_snp_prediction(row):\n\n if row['true_snp'] == True and row['prediction'] == True:\n return 'true_positive'\n elif row['true_snp'] == False and row['prediction'] == True:\n return 'false_positive'\n elif row['true_snp'] == False and row['prediction'] == False...
[ "0.6114877", "0.6008109", "0.5968435", "0.577627", "0.5707403", "0.5707228", "0.55909485", "0.5569505", "0.55581737", "0.55474263", "0.5519808", "0.55175203", "0.5470294", "0.5445095", "0.5436541", "0.5433641", "0.5433556", "0.54277265", "0.54233503", "0.5411494", "0.5403636"...
0.58807063
3
Set up the standard conformer filter
def _apply_init(self, result: ComponentResult) -> None: if self.rms_cutoff is not None: self._cache["cutoff"] = self.rms_cutoff * unit.angstrom else: self._cache["cutoff"] = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testUsingFilterTool(self):\n pass", "def __init__(self, filter: ghidra.program.util.ProgramMergeFilter):\n ...", "def filter(self, filters):", "def __init__(self, standardize=True, hdr_alpha=0.05, tr=0.720, low_pass=None, high_pass=None, s_filter=False):\n\n self.standardize = standa...
[ "0.6870899", "0.6385693", "0.637626", "0.63454145", "0.6275047", "0.6240758", "0.61316156", "0.6117365", "0.60983324", "0.6065666", "0.6034638", "0.5999396", "0.59849596", "0.59578615", "0.5918277", "0.58771527", "0.58769166", "0.5844637", "0.5836335", "0.5813589", "0.5770331...
0.0
-1
Generate conformers for the molecules using the selected toolkit backend.
def _apply(self, molecules: List[Molecule]) -> ComponentResult: # create the toolkit toolkit = self._toolkits[self.toolkit]() result = self._create_result() rms_cutoff = self._cache["cutoff"] for molecule in molecules: try: # assume input is angstr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_conformers(self, mol):\n mol = Chem.AddHs(mol)\n mol = self._embed_conformers(mol)\n\n if self.force_field:\n energies = self._minimize_conformers(mol, self.force_field)\n mol = self._prune_conformers(mol, energies)\n\n if self.align_templates:\n ...
[ "0.5587314", "0.5390047", "0.5389015", "0.5304018", "0.5105989", "0.50054854", "0.49886605", "0.4986325", "0.490982", "0.49074492", "0.4867412", "0.48475558", "0.4822304", "0.48166752", "0.48095068", "0.47933137", "0.47610325", "0.47103268", "0.47037166", "0.46839568", "0.468...
0.50706977
5
Verify OAuth2 and Basic Auth Credentials for CrowdStrike
def selftest_function(opts): try: LOG.info("Verifying app.config values for %s", CrowdStrikeHelper.app_config_section) app_configs = opts.get(CrowdStrikeHelper.app_config_section, {}) cs_helper = CrowdStrikeHelper(app_configs) LOG.info("Verifying OAuth2 Credentials...") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_auth():", "def identify_auth():\r\n from requests.auth import HTTPBasicAuth\r\n from requests.auth import HTTPDigestAuth\r\n # HTTPBasicAuth Auth Method\r\n response = requests.get(base_url + '/basic-auth/51zxw/8888', auth=HTTPBasicAuth('51zxw', '8888'))\r\n print(response.status_code)\r...
[ "0.6982856", "0.6764704", "0.6455922", "0.64511263", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", "0.6441798", ...
0.0
-1
Thresholds the values in the GFF file infn and exports the results to the BED file outbed.
def GFFthreshold(infn,outbed): converterd = {'probe':nodate,'a':nodate,'b':nodate} logging.debug('reading GFF into record array') a = csv2rec(infn, delimiter='\t', names=('chr','prog','id','start','stop','ratio','a','b','probe'), converterd=converterd) l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(inFilepath, outFilepath):\n\n gff_df=read_gff(inFilepath, additional_lst=[\"ID\"])\n attribute_lst=[]\n for _, row in gff_df.iterrows():\n orfId = \"{}_{}\".format(row[\"seqname\"], row[\"ID\"].split(\"_\")[-1])\n att = \"{};orf_id={}\".format(row[\"attribute\"], orfId)\n att...
[ "0.57636285", "0.5452764", "0.5443643", "0.54257494", "0.5339823", "0.5275607", "0.5164848", "0.51557857", "0.5153393", "0.51523715", "0.509349", "0.50704485", "0.5037733", "0.5014071", "0.50115407", "0.49746937", "0.4944627", "0.4939648", "0.49357095", "0.49293602", "0.49289...
0.70352584
0
Clean and shape node or way XML element to Python dict
def shape_element(element, node_attr_fields=NODE_FIELDS, way_attr_fields=WAY_FIELDS, problem_chars=PROBLEMCHARS, default_tag_type='regular'): node_attribs = {} way_attribs = {} way_nodes = [] tags = [] def get_tags(element): """get tags...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elem2dict(node):\n result = {}\n\n for element in node.iterchildren():\n # Remove namespace prefix\n key = element.tag.split('}')[1] if '}' in element.tag else element.tag\n key = key[:1].lower() + key[1:]\n\n # Process element as tree element if the inner XML contains non-whi...
[ "0.7497333", "0.7103926", "0.69807535", "0.6878571", "0.68709517", "0.6814094", "0.677641", "0.67453074", "0.67044884", "0.6668514", "0.665151", "0.6613812", "0.6592377", "0.6582121", "0.6580767", "0.6556343", "0.636651", "0.63367105", "0.6273763", "0.6259617", "0.62185", "...
0.56999934
48
get tags under nodes and ways into proper format
def get_tags(element): tags = [] id_num = element.attrib['id'] for child in element.iter('tag'): attr = child.attrib # check for problematic characters first and skip if matches if PROBLEMCHARS.search(attr['k']): continue child_di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags():", "def nodes_to_nags(self, nags):\n out = []\n for n in nags:\n out.append(n.text.strip(' '))\n return out", "def get_tags(self, root):\n tags = root.xpath(self.path)\n return tags if self.many else tags[:1]", "def tags(self):\n # See also. Sen...
[ "0.66982424", "0.61945075", "0.6123378", "0.61216927", "0.60466504", "0.6027082", "0.58852315", "0.5872097", "0.58477205", "0.58027965", "0.5772606", "0.5757173", "0.57448596", "0.5741053", "0.57295", "0.5729347", "0.5726202", "0.5711139", "0.57031196", "0.5689136", "0.566932...
0.5371315
43
Yield element if it is the right type of tag
def get_element(osm_file, tags=('node', 'way', 'relation')): context = ET.iterparse(osm_file, events=('start', 'end')) _, root = next(context) for event, elem in context: if event == 'end' and elem.tag in tags: yield elem root.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterchildren(self, tag: Optional[str] = None) -> Iterator[E]:\n if tag == '*':\n tag = None\n for child in self:\n if tag is None or child.is_matching(tag):\n yield child", "def iter(self, tag: Optional[str] = None) -> Iterator[E]:\n def safe_iter(ele...
[ "0.63753164", "0.60972255", "0.60102105", "0.59415174", "0.58363974", "0.55872273", "0.5578602", "0.5544091", "0.5525566", "0.5525566", "0.550221", "0.550221", "0.550221", "0.549343", "0.54807174", "0.5473522", "0.5439183", "0.53977484", "0.53914195", "0.53841794", "0.5373682...
0.5498705
17
Raise ValidationError if element does not match schema
def validate_element(element, validator, schema=SCHEMA): if validator.validate(element, schema) is not True: field, errors = next(validator.errors.iteritems()) message_string = \ "\nElement of type '{0}' has the following errors:\n{1}" error_string = pprint.pformat(errors) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate(self):\n fields, schema = self.__dict__, self._def.default\n extra_fields = fields.viewkeys() - schema.viewkeys()\n if len(extra_fields) > 0:\n raise AttributeError('Fields found that are not in the schema: %r' % (list(extra_fields)))\n for key in fields.iterkey...
[ "0.6917677", "0.6829546", "0.6765086", "0.6688886", "0.6621969", "0.6621969", "0.6621969", "0.6621969", "0.6598295", "0.6589527", "0.6505747", "0.64963084", "0.6438894", "0.64136946", "0.63809", "0.6356894", "0.6352081", "0.6347782", "0.63391244", "0.63356936", "0.6332507", ...
0.65517884
10
Iteratively process each XML element and write to csv(s)
def process_map(file_in, validate): with codecs.open(NODES_PATH, 'w') as nodes_file, \ codecs.open(NODE_TAGS_PATH, 'w') as nodes_tags_file, \ codecs.open(WAYS_PATH, 'w') as ways_file, \ codecs.open(WAY_NODES_PATH, 'w') as way_nodes_file, \ codecs.open(WAY_TAGS_PATH, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_document(as_xml, as_csv):\n tree = ET.parse(as_xml)\n lists = xml_to_list(tree.getroot())\n list_to_csv(lists, as_csv)\n # raise NotImplementedError()\n pass", "def write_data_to_csv(xml_files, csv_file):\n output = {}\n for xml_file in xml_files:\n with open(xml_file, 'r'...
[ "0.7012709", "0.6700947", "0.6297407", "0.59716314", "0.58779824", "0.5822816", "0.57374775", "0.5690835", "0.56382555", "0.5521618", "0.5448036", "0.5382776", "0.53448856", "0.53337634", "0.53160036", "0.530577", "0.5304252", "0.5286421", "0.5284995", "0.5283285", "0.5185278...
0.0
-1
Initializes the TRPO agent.
def __init__(self, sess, state_dim, encode_dim, action_dim, actions_output_dim, filepath): # # Initialize Network # self.dir_path = filepath self.seed = seed_initialize(filepath, self.config.seed) print(self.seed) # TODO: tf to pyTorch self.sess = sess ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agent_init(self):\n pass", "def initialize(self):\n self._setup_simulation_from_parameters()\n if \"orrb\" in self.constants.observation_providers:\n self._reset()\n self._goal = self._next_goal()\n self.update_goal_info()\n\n self.observer = self._build_o...
[ "0.7680569", "0.7075661", "0.70310503", "0.69604135", "0.6932689", "0.6915156", "0.67658997", "0.66978145", "0.66117245", "0.66038847", "0.6591837", "0.65475047", "0.65472716", "0.65404785", "0.6506784", "0.64253426", "0.64153105", "0.6413088", "0.6406444", "0.63784635", "0.6...
0.0
-1
Returns a policy from expert based on the task var for a given (s,a)
def get_policy_encode(self, state, action, encodes): policy = np.zeros(self.action_dim, dtype=np.float32) G_policy = \ self.sess.run( self.action_dist_mu, {self.state: state, self.encodes: encodes} # {state, encodes} ) mu ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_policy(env, v, GAMMA=1.0):\r\n policy = np.zeros(env.nS)\r\n for s in range(env.nS):\r\n q_sa = np.zeros(env.nA)\r\n for a in range(env.nA):\r\n q_sa[a] = sum([p*(r+GAMMA*v[s_]) for p, s_, r, _ in env.P[s][a]])\r\n policy[s] = np.argmax(q_sa)\r\n return policy",...
[ "0.5840355", "0.5825589", "0.57298046", "0.5645543", "0.56205803", "0.5619291", "0.5573069", "0.5508011", "0.5464358", "0.542903", "0.5403647", "0.5371436", "0.5299", "0.5299", "0.5250383", "0.5200065", "0.518749", "0.5182148", "0.51795244", "0.51595765", "0.5146109", "0.51...
0.0
-1
Impl. of SGAIL learning procedure. In each iter. generates trajs from G and updates G (via TRPO; based on value fun extimate) and D (Adam optimizer; Based on classification error).
def learn(self, state_expert, action_expert, action_expert_ori, s_max, s_min, a_max, a_min, new_dir_path): # # Information Writing # file_path = new_dir_path + "/Readme.txt" f_read = open(file_path, "a") f_read.write("paths_per_collect:\n" + str(self.config.paths_per_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(model, gt_adjacency, gt_interv, train_data, test_data, opt, metrics_callback, plotting_callback):\n first_stop = 0\n second_stop = 0\n thresholded = False\n\n patience = opt.train_patience\n patience_thresh = opt.train_patience_post\n best_nll_val = np.inf\n best_lagrangian_val = np....
[ "0.6723436", "0.66920716", "0.6676073", "0.6527702", "0.6476373", "0.6435898", "0.641563", "0.6395276", "0.6364404", "0.63341355", "0.63299733", "0.632058", "0.6317122", "0.6303805", "0.6303732", "0.6287278", "0.6263957", "0.6256631", "0.6253903", "0.62500715", "0.6217582", ...
0.0
-1
If the filename is of the format YYYYMMDD_hhmmss
def get_date_from_filename(filepath): print "debug: %s" % filepath fname = os.path.basename(filepath) print "debug: %s" % fname date = fname.split("_")[0] if len(date) != 8: print "debug: %s" % date print "debug: date len != 8" return None try: int(date) # will ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _safe_filename(filename):\n date = datetime.datetime.utcnow().strftime(\"%Y-%m-%d-%H%M%S\")\n basename, extension = filename.rsplit('.', 1)\n return \"{0}-{1}.{2}\".format(basename, date, extension)", "def time_key(file_name):\n splits = file_name.split('/')\n [date] = re.findall(r'(\\d{4}_\\d...
[ "0.6922858", "0.67721564", "0.66523653", "0.66341877", "0.6627839", "0.66261584", "0.6525038", "0.65032446", "0.6415359", "0.63129514", "0.6286169", "0.6285519", "0.62379235", "0.62240267", "0.61937743", "0.6186371", "0.614045", "0.60972834", "0.6082455", "0.6059182", "0.6048...
0.6285025
12
Convert raw ADC counts into SI units as per datasheets
def processData(self, data): # Skip bad reads if len(data) != 2: return global lastTemp, lastRH, lastTimestamp tempCts = int(data[0]) rhCts = int(data[1]) rhVolts = rhCts * 0.0048828125 # 10mV/degree, 1024 count/5V temp = tempCts * 0.4882812...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_frequency_2_internal_u(self,val):\n return val*conversion_facs_frequency[self.current_units[\"frequency\"]]", "def convert_frequency_2_current_u(self,val):\n return val/conversion_facs_frequency[self.current_units[\"frequency\"]]", "def convert_units(self):\n for prod in (\"ier...
[ "0.61268955", "0.6116247", "0.5842502", "0.58094406", "0.57919526", "0.5777237", "0.575389", "0.57444954", "0.56433296", "0.5555081", "0.55548817", "0.55385494", "0.5536834", "0.5532951", "0.5483744", "0.54682785", "0.544294", "0.54411733", "0.543857", "0.5397938", "0.5390165...
0.0
-1
print_in_block prints a message fancy
def print_in_block(message): print("|", message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_in_block(message):\n print(\"=\"*4, message)", "def do_block():\n print_column()\n print_rows()", "def do_block():\n print_column()\n print_rows()", "def print_block():\n do_twice(do_block)\n do_twice(do_block)\n print_column()", "def print_block():\n do_twice(do_block)...
[ "0.82680213", "0.72581327", "0.72581327", "0.72422236", "0.72410613", "0.65806854", "0.6528688", "0.64682865", "0.644541", "0.64331144", "0.63909894", "0.61803967", "0.61426616", "0.600337", "0.6001629", "0.59299904", "0.5875311", "0.58397245", "0.58374274", "0.58373517", "0....
0.8424028
0
Create account in db for testing
def create_test_account(self): if not hasattr(self, "headers"): self.headers = {"Content-Type": "application/json"} self.account = { "account_number": "11223344", "pin": "1234", "first_name": "John", "last_name": "Doe", "opening_bal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n account_models.User.objects.create_user(email='mrtest@mypapaya.io', password='WhoAmI', username='aov1')", "def test_create_user(self):\n pass", "def test_create_user(self):\n pass", "def test_create_user(self):\n pass", "def account():\n\n bank_test = Bank....
[ "0.7464342", "0.73190993", "0.73190993", "0.73190993", "0.7251022", "0.72328395", "0.7218017", "0.71607393", "0.7132524", "0.71249807", "0.71243155", "0.71232057", "0.70938474", "0.7090275", "0.7054926", "0.7043996", "0.6997264", "0.69949186", "0.69774175", "0.69712317", "0.6...
0.7687588
0
Login and add Authorization headers
def add_auth_to_headers(self): if not hasattr(self, "headers"): self.headers = {"Content-Type": "application/json"} login = {"account_number": self.account["account_number"], "pin": self.account["pin"]} token = json.loads(self.client.post( "/accounts/log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _login(self, username, password):\n\n auth_token_header_name = \"X-AuthToken\"\n if auth_token_header_name not in self.headers:\n login_response = self._send(\"/auth/login\", \"POST\", {\n \"username\": username,\n \"password\": password\n })\n ...
[ "0.7459252", "0.71714276", "0.7051584", "0.697408", "0.6925245", "0.67969096", "0.678197", "0.6740072", "0.6695989", "0.66357434", "0.6629826", "0.6582317", "0.65689564", "0.6558543", "0.6489001", "0.6484532", "0.6425403", "0.64215344", "0.6419265", "0.6415041", "0.6412059", ...
0.7460721
0
The kmlWriter function writes JPEG and TIFF EXIF GPS data to a Google Earth KML file. This file can be opened in Google Earth and will use the GPS coordinates to create 'pins' on the map of the taken photo's location.
def kmlWriter(output_data, output_dir, output_name): msg = 'Writing ' + output_name + ' KML output.' print '[+]', msg logging.info(msg) # Instantiate a Kml object and pass along the output filename kml = simplekml.Kml(name=output_name) for exif in output_data: if 'Latitude' in exif.keys(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveKML(kmlFile):\n\n tilePath = os.path.basename('map-NYC_heatmap.png')\n north = topLeftLat\n south = bottomRightLat\n east = topLeftLon\n west = bottomRightLon\n \n bytes = KML % (tilePath, north, south, east, west)\n file(kmlFile, \"w\").write(bytes)"...
[ "0.7272041", "0.70665", "0.6839336", "0.6782229", "0.67590886", "0.6627731", "0.6027612", "0.5821973", "0.5808136", "0.5792859", "0.5754415", "0.5609513", "0.55759126", "0.5573969", "0.5561544", "0.555536", "0.54809815", "0.5467511", "0.5448434", "0.5412696", "0.533536", "0...
0.75549674
0
Build a dict of functions to transform from a timestamp into a relative offset. E.g.
def build_run_time_transformers(ranges, buckets=250): funcs = {} def f(t, min_, max_): #return "%0.2f" % ((t-min_) * (1/(max_-min_))) key = (t-min_) * (1/(max_-min_)) return "%0.3f" % (int(buckets*key) / (buckets / 100.0)) for run, range_ in ranges.items(): funcs[run] = fun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_calculated(funs):\n def with_calculated_funs(a_dict):\n return updated_with(a_dict, to_dict(funs)(a_dict))\n return with_calculated_funs", "def get_time_attr_map(t):\n now = datetime.datetime.now()\n if t + datetime.timedelta(hours=3) > now:\n return get_map(\"main_list_white\"...
[ "0.52797824", "0.5149295", "0.5143466", "0.5121843", "0.51101065", "0.5044267", "0.50194275", "0.5009638", "0.4988149", "0.49848637", "0.49679974", "0.4934628", "0.4894539", "0.4892821", "0.48880813", "0.48834634", "0.4878724", "0.4828654", "0.47740626", "0.47482517", "0.4743...
0.501486
7
Take a move ('color', (row,col)). where row, col are 0indexed (from sgfmill) Figure out which corner it's in Transform it to be in the upper right corner; Returns [corners, move]
def move_to_corner(move): color, m = move if not m: return (None, move) y, x = m corners = [] if (x >= 9 and y >= 9): corners.append(0) elif (x >= 9 and y <= 9): corners.append(1) elif (x <= 9 and y <= 9): corners.append(2) elif (x <= 9 and y >= 9): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, board):\n\n if board.get_number_of_moves() == 0:\n random_row = randint(0, 2)\n random_column = randint(0, 2)\n\n if random_row == 1 or random_column == 1:\n random_row = 1\n random_column = 1\n elif random_row == 2:\n ...
[ "0.64972967", "0.63445497", "0.6259929", "0.6193406", "0.6146919", "0.6122342", "0.61185247", "0.60586184", "0.604872", "0.60303676", "0.60222936", "0.5930572", "0.58977294", "0.58832806", "0.5881443", "0.5868172", "0.585934", "0.58571357", "0.585504", "0.5842502", "0.5817029...
0.77939284
0
In addition to the corner information returned, we also add the winner, returning a tuple of ((sequence_counts, nextmove_counts), winner) where `winner` == 1 for B win, 0 otherwise.
def extract_from_game(game_path): with open(game_path) as sgf_file: game_data = sgf_file.read().encode('utf-8') try: g = sgf.Sgf_game.from_bytes(game_data) _, moves = sgf_moves.get_setup_and_moves(g) except BaseException: print("bad file: ", game_path) return Counter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner(board):\n black_count = board.count(-1)\n white_count = board.count(1)\n if black_count > white_count:\n #if black_count + white_count != 64:\n # black_count += (64 - black_count - white_count)\n return (-1, black_count, white_count)\n elif white_count > black_count:\...
[ "0.6933734", "0.67717934", "0.6493579", "0.6132359", "0.60990435", "0.6084213", "0.60838664", "0.6075124", "0.5997574", "0.59872484", "0.5982879", "0.5978751", "0.59727734", "0.5944895", "0.5942834", "0.59083647", "0.5867989", "0.5861778", "0.58603925", "0.58582777", "0.58547...
0.0
-1
Parses all .sgfs in `directory` and updates database accordingly. `directory` is assumed to be a path ending in 'YYYYmmddHH'. e.g. /path/to/games/2019070100/
def analyze_dir(directory): counts = Counter() next_moves = defaultdict(Counter) example_sgfs = {} b_wins = Counter() sgf_files = [os.path.join(directory, p) for p in os.listdir(directory) if p.endswith('.sgf')] amt = int(len(sgf_files) * FLAGS.sample_frac) if FLAGS.sample_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usagestats_parse(dirpath):\r\n # Create database\r\n # TODO: change to an easier format, probably json.\r\n db, cursor = create_table()\r\n\r\n # Some vars for logging\r\n processed = 0\r\n err = 0\r\n\r\n # Iterate through the /usagestats/ directory and fetch all files\r\n for root, di...
[ "0.53457755", "0.5272943", "0.522", "0.5175559", "0.5155737", "0.51370525", "0.5131457", "0.5120154", "0.5110887", "0.51071286", "0.5103022", "0.51002693", "0.5084197", "0.506192", "0.5057502", "0.50454944", "0.5033248", "0.50327975", "0.5024265", "0.5013997", "0.5005775", ...
0.62088275
0
That's a very nice function detecting all local minima and maxima and computing their coordinates. The method is based on derivatives.
def detect_min_max(arr): max_value = max(np.absolute(np.reshape(arr, -1))) peaks_max = [] peaks_min = [] x_max = [] y_max = [] z_max = [] x_min = [] y_min = [] z_min = [] for j1 in range(10, arr.shape[0]-10): for j2 in range(1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMaxima(x, y):\n# mx_x = (np.abs(np.min(x)) + np.max(x)) / 2\n# mx_y = (np.abs(np.min(y)) + np.max(y)) / 2\n# \n mx_x = np.max(x)\n mx_y = np.max(y)\n return mx_x, mx_y", "def find_local_minima(self, arr):\n\n # walks through array, finding local minima ranges\n\n # hacky wa...
[ "0.64929116", "0.6011464", "0.59649295", "0.5955771", "0.5748925", "0.57336473", "0.5702977", "0.5701539", "0.56934154", "0.56354034", "0.562641", "0.55739635", "0.55384916", "0.5537082", "0.5524504", "0.55112046", "0.5501972", "0.55000186", "0.54938585", "0.54908246", "0.547...
0.54925483
19
Read the wave function of Nth state from the file numbered by jjjj
def read_from_file(jjjj, N, path='/data/users/mklymenko/science/H2_100/programing/dis/v0/'): p1 = np.loadtxt(path+'ff_'+str(jjjj)+'.dat') a = [] a = np.where( ((p1[:, 1] == 111) & (p1[:, 2] == 111) & (p1[:, 3] == 111)))[0] n1 = N X = np.array(p1[a[n1]+1:a[n1+1], 0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readNextGenSpectrum(fname=''):\n\n print('Reading : ', fname)\n\n with open(fname, 'r') as rfile:\n dum = rfile.readline()\n sdum = dum.split()\n teff = float(sdum[0])\n logg = float(sdum[1])\n mph = float(sdum[2])\n dum = rfile.readline()\n nwav = float(d...
[ "0.6181482", "0.5862029", "0.56960034", "0.5677018", "0.56482685", "0.56220466", "0.5604546", "0.5573163", "0.5567389", "0.55650276", "0.5486313", "0.547349", "0.54472053", "0.5439266", "0.54381114", "0.5421353", "0.5416626", "0.54019856", "0.53966343", "0.53939825", "0.53676...
0.63657975
0
Save Gaussian functions coefficients to the file
def save(self): if (self._save != '0'): p = self._save+self._path[-3:-1]+'_'+str(self._qn)+'.dat' np.savetxt(p, self._gf) else: sys.exit("Wrong path to save")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, exp_file, gat_file):\n\t\tto_save = np.stack((self.b, self.sigma)) #(2, K)\n\t\tto_save = np.concatenate((self.W,to_save) , axis = 0) #(D+2,K)\n\t\tnp.savetxt(exp_file, to_save)\n\t\tself.gating.save(gat_file)\n\t\treturn", "def saveCoefficients(self):\n path = self.directory + \"/\" + self...
[ "0.6887294", "0.6386368", "0.5855118", "0.5557168", "0.55372137", "0.5516496", "0.54990965", "0.54429656", "0.5438885", "0.54104203", "0.54090834", "0.536263", "0.5352562", "0.5349766", "0.5345404", "0.53397816", "0.5333403", "0.53292924", "0.53191966", "0.53074473", "0.52777...
0.5314649
19
The model function represented by a sum of the Gaussian functions with variable positions, widths and amplitudes
def modelfun1(self, x, *par): g = np.zeros(len(x[0])) for j in range(len(par)/5): x1 = par[j*5] x2 = par[j*5+1] x3 = par[j*5+2] w = par[j*5+3] a = par[j*5+4] r1 = pow((x[0]-x1), 2)+pow((x[1]-x2), 2)+pow((x[2]-x3), 2) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Gaussian(x, mu=0, sigma=26.4, A=1, y0=0):\r\n #width = sigma*(2*np.sqrt(2*np.log(2)))\r\n b = 1/(sigma*np.sqrt(2*np.pi))\r\n f = b*np.power(np.e, -(((x-mu)**2)/(2*sigma**2)))\r\n return A*f + y0", "def gaussian(x, *parameters):\n position, sigma, amplitude, background = parameters\n return ...
[ "0.66367567", "0.6560433", "0.65372294", "0.653147", "0.646325", "0.6463125", "0.6366298", "0.63595486", "0.6355874", "0.6349452", "0.6348714", "0.63399464", "0.6332683", "0.62884027", "0.62640566", "0.62518823", "0.6249206", "0.6184604", "0.6174887", "0.6136336", "0.6109296"...
0.5969462
42
Computes the value of the wave function in points stored in the vector x using fitting parameters and the model functions.
def show_func(self, x): if (self._flag == 1): g = self.modelfun(x, *self._gf) elif (self._flag == 2): g = self.modelfun1(x, *self._gf) elif ((self._flag == 0) & (self._load != '0')): pass else: # pass sys.exit("Wrong flag in do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wavefunction(self, x):\n return ( float(1) / math.pi**(float(1)/4)) * math.exp( x**2 / float(-2))", "def f(self, x: np.array) -> float:\n return np.dot(x, self._w) + self._b", "def get_value(self, x):\n return np.dot(self.w, x)", "def __call__(self, x):\n if self.W.data is Non...
[ "0.7227406", "0.68093836", "0.6625069", "0.6607957", "0.6584455", "0.64573056", "0.6423362", "0.6364259", "0.63284844", "0.6268312", "0.6254425", "0.61995685", "0.61708206", "0.61386824", "0.61219203", "0.61038744", "0.6098201", "0.6074191", "0.605777", "0.6016525", "0.601011...
0.0
-1
Same as show_func(self,x) but returns decomposed primitive Gaussian functions
def show_gf(self, x): g = np.zeros((len(x[0]), self._num_fu), dtype=np.float64) for j in range(self._num_fu): x1 = self._gf[j*5] x2 = self._gf[j*5+1] x3 = self._gf[j*5+2] w = self._gf[j*5+3] a = self._gf[j*5+4] r1 = pow((x[0]-x1), 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_func(self, x):\n\n if (self._flag == 1):\n g = self.modelfun(x, *self._gf)\n elif (self._flag == 2):\n g = self.modelfun1(x, *self._gf)\n elif ((self._flag == 0) & (self._load != '0')):\n pass\n else:\n # pass\n sys.exit(\"...
[ "0.6923806", "0.61165667", "0.58499724", "0.578721", "0.5772432", "0.572566", "0.5708594", "0.56611586", "0.5646653", "0.56375355", "0.5631954", "0.562097", "0.5598726", "0.55861354", "0.5576355", "0.55678403", "0.55473655", "0.55415136", "0.55403167", "0.5530078", "0.5522108...
0.6513373
1
Returns (height, x, y, width_x, width_y) the gaussian parameters of a 2D distribution by calculating its moments
def moments(data): data = np.absolute(data) total = data.sum() X = np.indices(data.shape) x = (X*data).sum()/total width = np.sqrt((((X-x)**2)*data).sum()/data.sum()) m_max = data.max() m_min = data.min() if np.absolute(m_max) >= np.absolute(m_min): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian(height, center_x, center_y, width_x, width_y):\n width_x = float(width_x)\n width_y = float(width_y)\n return lambda x,y: height*np.exp(\n -(((center_x-x)/width_x)**2+((center_y-y)/width_y)**2)/2)", "def gaussian(height, center_x, center_y, width_x, width_y):\n width_x = f...
[ "0.6980863", "0.6980863", "0.6980863", "0.695399", "0.69327515", "0.6924225", "0.67132115", "0.6643802", "0.66222733", "0.6582163", "0.6523381", "0.64445627", "0.6374211", "0.63356495", "0.6284357", "0.6257092", "0.624982", "0.6249254", "0.6249254", "0.6245236", "0.6215857", ...
0.6313388
14
The function does the fitting procedure
def do_fit(self): if (self._flag == 1): self._gf = [0.2] self._gf = self.par*(self._num_fu*len(self._sites)*2) x, F = self.read_from_file( self._sn, self._qn, self._path) # read data from the file # ,ftol=1.0e-7,xtol=1.0e-8) popt, pco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit():\n pass", "def fit(self, X):", "def fit(self, x):\n pass", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(se...
[ "0.83682567", "0.81361425", "0.79078686", "0.7716284", "0.7716284", "0.7716284", "0.7716284", "0.7716284", "0.7716284", "0.7716284", "0.7716284", "0.7716284", "0.7716284", "0.7701683", "0.7701683", "0.7701683", "0.76664245", "0.75478643", "0.7520859", "0.74977016", "0.7411296...
0.693916
34
This function is responsible for hitting the solr endpoint and returning the results back.
def search_simple_index(query, offset, count, draw): results = SOLR_SIMPLEINDEX.search(q=query, **{ 'start': int(offset), 'rows': int(count) }) print("Saw {0} result(s) for query {1}.".format(len(results), query)) formatted_hits = [] for hit in results.doc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solr_query(config, solr_host, fq, solr_collection_name):\n # solr_collection_name = config['solr_collection_name']\n\n getVars = {'q': '*:*',\n 'fq': fq,\n 'rows': 300000}\n\n url = f'{solr_host}{solr_collection_name}/select?'\n response = requests.get(url, params=getVar...
[ "0.7272182", "0.7217205", "0.68685675", "0.6716241", "0.6716241", "0.6543741", "0.64756453", "0.63854057", "0.63058704", "0.62296706", "0.6182412", "0.6172993", "0.60816866", "0.6062186", "0.6048523", "0.60386133", "0.6022621", "0.59974325", "0.5983618", "0.5973377", "0.59657...
0.5627814
53
This function is responsible for hitting the solr endpoint and returning the results back.
def search_entity_aware_index(query, offset, count, draw, qf): results = SOLR_ENTITYAWAREINDEX.search(q=query, **{ 'start': int(offset), 'rows': int(count), 'qf': qf }) print("Saw {0} result(s) for query {1}.".format(len(results), query)) formatted_hit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solr_query(config, solr_host, fq, solr_collection_name):\n # solr_collection_name = config['solr_collection_name']\n\n getVars = {'q': '*:*',\n 'fq': fq,\n 'rows': 300000}\n\n url = f'{solr_host}{solr_collection_name}/select?'\n response = requests.get(url, params=getVar...
[ "0.7272182", "0.7217205", "0.68685675", "0.6716241", "0.6716241", "0.6543741", "0.64756453", "0.63854057", "0.63058704", "0.62296706", "0.6182412", "0.6172993", "0.60816866", "0.6062186", "0.6048523", "0.60386133", "0.6022621", "0.59974325", "0.5983618", "0.5973377", "0.59657...
0.5488242
75
A helper to load any app's submodule by its name
def load_module(self, name, quiet=True): full_name = '%s.%s' % (self.name, name) try: return import_module(full_name) except ImportError: if quiet: return None raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_app_modules(apps, submodules):\n for app in apps:\n mod = import_module(app)\n for submodule in submodules:\n import_submodule(mod, app, submodule)", "def init_app(app):\n app.load_extension(__name__)", "def findModule(name):", "def loadapp(self, app, params=None):\n ...
[ "0.6744178", "0.6379068", "0.6354267", "0.6203909", "0.611294", "0.6102048", "0.60686713", "0.60368586", "0.5984119", "0.5932818", "0.5903442", "0.5897478", "0.58476454", "0.58268327", "0.58212805", "0.58017206", "0.5801174", "0.578524", "0.57665443", "0.5766239", "0.5740579"...
0.0
-1
Returns the list of URL patterns which have to be added to main urls.py By default returns a sigle URL pattern which mounts app's urls.py as under the app's label path. Most likely you don't need to edit this function.
def urlpatterns(self): regex = r'^%s/' % self.label urls_module = '%s.urls' % self.name ns = self.label return [url(regex, include(urls_module, namespace=ns, app_name=ns))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discover_urls():\n urlpatterns = []\n\n for app in settings.INSTALLED_APPS:\n try:\n _temp = __import__(f'{app}.urls', globals(), locals(), ['urlpatterns'], 0)\n urlpatterns += _temp.urlpatterns\n\n except ModuleNotFoundError:\n pass\n\n return urlpattern...
[ "0.78666055", "0.76514953", "0.75988424", "0.74951446", "0.7466889", "0.7462883", "0.7424311", "0.72087145", "0.7128712", "0.71177673", "0.7090256", "0.70579743", "0.6972757", "0.69723296", "0.6950012", "0.6892247", "0.6667635", "0.6659763", "0.66339105", "0.6629913", "0.6492...
0.84036785
0
A signal called by the constructor once the app instance is ready (once it's registered)
def ready(self): # export app settings self.export_settings() # import the submodule with signal handlers self.load_module('signals')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ready(self):\n import main.signals # noqa", "def on_startup(self) -> None:\n ...", "def ready(self):\n\n from . import signals # noqa", "def on_start(self):\n App.on_start(self)\n self.root.register()", "def on_start(self):\n self.init()", "def ready(self):...
[ "0.74507123", "0.73261684", "0.73054254", "0.72979665", "0.7194798", "0.71527547", "0.71152693", "0.70625466", "0.702905", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.68536276", "0.683485", "0.68191284", "0.68191147", "...
0.7368948
1
A decorator to add a periodic task. Decorated function has to accept
def periodic_task(cls, delta, name=None): if isinstance(delta, int): delta = datetime.timedelta(seconds=delta) def decorator(func): registry_name = name or '%s.%s' % (func.__module__, func.__name__) cls.periodic_tasks[registry_name] = PeriodicTaskFun(func, delta, reg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_periodic_tasks(sender, **kwargs):\n sender.add_periodic_task(60, scheduled_task.s(), name='A scheduled task')", "def Schedule(interval=3600):\n # TODO:: if func need to return something\n def schedule(func):\n @wraps(func)\n def wrapper(*args, **kwargs):\n while True:\...
[ "0.67738533", "0.6409797", "0.63915294", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.63910186", "0.6348526", "0.6347841", "0.6334383", "0.6309153", "0.625314", "0.62467635", "0.61627775", "0....
0.7903502
0
Uses Gibbs sampling to segment an image into foreground and background. Inputs
def gibbs_segmentation(image, burn_in, collect_frequency, n_samples): (Nx, Ny, _) = image.shape distribution = np.zeros( (Nx, Ny) ) # Initialize binary estimates at every pixel randomly. estimates = (np.random.random( (Nx, Ny) ) > .5).astype(int) total_iterations = burn_in + (collect_frequency *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def img_process(fgMask):\n backSub = cv.createBackgroundSubtractorKNN()\n kernel1 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE, ksize=(2,2))\n kernel2 = cv.getStructuringElement(shape=cv.MORPH_ELLIPSE, ksize=(2,2))\n #kernel1 = np.ones((3,3),np.uint8)\n #kernel2 = np.ones((3,3), np.uint8)\n\n ...
[ "0.60925585", "0.59579676", "0.5944388", "0.5910497", "0.5808057", "0.5794726", "0.57745075", "0.57592636", "0.5752392", "0.5752392", "0.5737282", "0.572165", "0.5718988", "0.56727695", "0.56688863", "0.5667283", "0.5656513", "0.56523293", "0.5646415", "0.564283", "0.5639516"...
0.6486014
0
Returns values of the grid at points neighboring (x,y) Inputs
def get_neighbors(grid, x, y): out = [] if x > 0: out.append(grid[x-1, y]) if y > 0: out.append(grid[x, y-1]) if y < grid.shape[1] - 1: out.append(grid[x, y+1]) if x < grid.shape[0] - 1: out.append(grid[x+1, y]) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xy(self, x, y):\r\n\t\treturn self.grid[y, x]", "def get_xy_grid(nx, ny):\n\tfor n in [nx, ny]:\n\t\tif not isodd(n):\n\t\t\traise Exception(\"[get_xy_grid] only accept odd number\")\n\n\tx, y = np.mgrid[-(nx-1)/2:(nx+1)/2, -(ny-1)/2:(ny+1)/2]\n\n\treturn x, y", "def neighbours(x, y):\n n = []\n ...
[ "0.7048819", "0.6988485", "0.6886183", "0.6840988", "0.6834184", "0.6812989", "0.6711071", "0.66918945", "0.66904217", "0.6687271", "0.6672603", "0.66403353", "0.6630548", "0.6619971", "0.6610192", "0.6555865", "0.6553371", "0.6549096", "0.6524648", "0.6524648", "0.649784", ...
0.7839016
0
Computes the probability of observing a set of RGB intensities for a given label. Inputs
def observation_model(intensities, label): idxs = enumerate(intensities) return np.prod([dist[label, i, intensity] for (i, intensity) in idxs])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_color_for_labels(label):\n color = [int((p * (label ** 2 - label + 1)) % 255) for p in palette]\n return tuple(color)", "def compute_color_for_labels(label):\n color = [int((p * (label ** 2 - label + 1)) % 255) for p in palette]\n return tuple(color)", "def compute_color_for_labels(labe...
[ "0.60875475", "0.60875475", "0.60875475", "0.60875475", "0.60744995", "0.6039619", "0.5823827", "0.5799188", "0.5729159", "0.57266355", "0.56977594", "0.5687674", "0.5687674", "0.5659029", "0.5646229", "0.56302005", "0.5624872", "0.56243336", "0.56099576", "0.5598231", "0.559...
0.5677279
13
Given the values at two pixels, returns the edge potential between those two pixels.
def edge_model(label1, label2): if label1 == label2: return ALPHA else: return 1-ALPHA
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_between_neighbors(cell_a, cell_b):\n edge = np.logical_and(dilate_simple(cell_a), dilate_simple(cell_b))\n return edge", "def find_complete_edge(v1, v2):\n if v2 < v1:\n v1, v2 = v2, v1\n return v1 + v2 * (v2 - 1) // 2", "def getEdge(self, v1, v2):\n for e in self.edges:\n ...
[ "0.7079424", "0.6260533", "0.614386", "0.60064805", "0.5930904", "0.58217674", "0.57802707", "0.5778961", "0.57789373", "0.5767245", "0.5729393", "0.57185256", "0.5709799", "0.56502026", "0.56246686", "0.5592777", "0.5570452", "0.5570447", "0.55511206", "0.55267125", "0.55116...
0.5323
43
Derivative of objective function
def func_deriv(x,remain): #df_x0 = -1*remain[0]/x[0]**2 #df_x1 = -1*remain[2]/x[1]**2 #df_x2 = -1*remain[1]/x[2]**2 return np.array(-1*remain/x**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deriv(self, x, d=None):\n if self.weights is None:\n self.compute_weights()\n\n val = 0.0\n for i in range(self.M):\n val += self.weights[i]*self.model_list[i].deriv(x, d)\n return val", "def objective_function_derivative(\n terms,\n overlap_penalty,\n ...
[ "0.695038", "0.6901204", "0.68689436", "0.67938876", "0.67433965", "0.6723132", "0.6718581", "0.67118424", "0.6699861", "0.6609691", "0.6604677", "0.66040355", "0.6575055", "0.65495205", "0.65025395", "0.64683104", "0.6449893", "0.6427921", "0.6427921", "0.64193326", "0.64159...
0.60648674
59
This function loads two files as input and return merged files
def load_data(messages_filepath, categories_filepath): #load messages file messages = pd.read_csv(messages_filepath) #load categories file categories = pd.read_csv(categories_filepath) #merge these two datasets df = messages.merge(categories, how='inner', on= 'id') return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(file_a, file_b):\n res = []\n a = read_bin_file_in_full(file_a)\n b = read_bin_file_in_full(file_b)\n pa = 0\n pb = 0\n while pa < len(a) and pb < len(b):\n if a[pa] < b[pb]:\n res.append(a[pa])\n pa += 1\n else:\n res.append(b[pb])\n ...
[ "0.7331378", "0.7132421", "0.6835498", "0.6799099", "0.66699827", "0.6610325", "0.6533628", "0.65293807", "0.6524281", "0.6505234", "0.6429747", "0.64011747", "0.63752604", "0.6368189", "0.63059515", "0.6287107", "0.6269712", "0.6246524", "0.6194321", "0.6161838", "0.61496097...
0.0
-1
Options callback for DSAIR.
def async_get_options_flow( config_entry: ConfigEntry, ) -> DsAirOptionsFlowHandler: return DsAirOptionsFlowHandler(config_entry)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_options(self):", "def set_options(self, options):\n self.options = options", "def _options(self):\n return", "def initialize_options(self):\n pass", "def options(self, parser):\n pass", "def scanOptions(self, options):", "def register_options(cls, register):", "def ...
[ "0.66560775", "0.6543463", "0.6489074", "0.6467768", "0.6431175", "0.6387198", "0.63495994", "0.63028973", "0.6291787", "0.62798554", "0.62798554", "0.62676454", "0.62281305", "0.62281305", "0.62199026", "0.62199026", "0.61435634", "0.60815954", "0.6069882", "0.6067049", "0.6...
0.0
-1
Creates a desired number of sets of masks for MADE.
def gen_masks(num_masks, features, hidden_layers, hidden_units): # This array should contain numbers 1-784 features_indices = [] for i in range(features): features_indices.append(i + 1) masks = [] indices = [] for i in range(num_masks): set_masks = [] # Will contain all masks f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createMaks(self):\n mask = np.zeros((self.height, self.width)) # (H, W)\n center = self.width // 2\n\n for lat in range(self.height):\n count = int(self.counts[lat])\n # print(lat, count)\n # print(center - count, center, center + count)\n mask[lat][center: center + count] = 1\n ...
[ "0.69497967", "0.63979864", "0.63291293", "0.62540984", "0.6075182", "0.60407674", "0.6014026", "0.59925056", "0.59683883", "0.59295285", "0.57517284", "0.57473755", "0.57148474", "0.5689238", "0.56375664", "0.5568423", "0.5564914", "0.555798", "0.5554419", "0.55477774", "0.5...
0.5952679
9
Generate autoencoded images and samples using the highestperforming variants of the model.
def compare_masks(model, num_examples, data, indices, masks, masks_history, fname=None): # Ensure that data is a numpy array if tf.is_tensor(data): data.numpy() # Compute the number of different masks to be used num_masks = math.floor(math.sqrt(num_examples)) plot_side = m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_examples():\n build_models([\n \"VGG_16\",\n \"VGG_19\",\n \"RESNET_50\",\n \"MOBILENET\",\n #\"INCEPTION_V3\",\n #\"INCEPTION_RESNET\",\n #\"DENSENET_121\",\n #\"DENSENET_169\",\n #\"DENSENET_201\"])\n ])", "def sample_final_tier...
[ "0.6182725", "0.6160187", "0.61424756", "0.61398923", "0.60936207", "0.60548085", "0.60506153", "0.6010686", "0.59838", "0.59792376", "0.5966361", "0.5953654", "0.59395534", "0.592701", "0.5913982", "0.5891453", "0.5865974", "0.58577037", "0.5855368", "0.58507276", "0.5829841...
0.0
-1
This function prints the values of the pixel with index 1 generated from num_samples different instances of noise. In a properly autoregressive network, these values will be equal, because the output node indicating the predicted probability of the first pixel's activation doesn't have any connections.
def ar_test(model, num_samples, indices): samples = np.random.rand(num_samples, 28, 28) i = 1 index = indices.index(i) x_out = model.predict(samples, batch_size=num_samples) row = index // 28 col = index % 28 print(x_out[:, row, col])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_samples(num=10):\n X_init = torch.zeros(num, 1, dtype=torch.long).to(args.device)\n top_k = args.top_k if args.top_k != -1 else None\n steps = train_dataset.get_output_length() - 1 # -1 because we already start with <START> token (index 0)\n X_samp = generate(model, X_init, steps, top_k=top_k...
[ "0.5568828", "0.5551278", "0.5541915", "0.5498311", "0.5442604", "0.5351635", "0.5320976", "0.531449", "0.5227196", "0.5210755", "0.52081746", "0.52046764", "0.5169416", "0.5149908", "0.51466405", "0.5116766", "0.51054716", "0.508762", "0.5068448", "0.5055635", "0.5052395", ...
0.47255567
98
Main function of Quick Sort
def quick_sort(l): return _quick_sort(l, 0, len(l) - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_sort(array, pivot_type):\n\n def partition(array, left, right):\n global counter\n counter += right - left \n\n \n if pivot_type == 'median':\n \tmedian = get_median(array, left, right)\n \tarray[left], array[median] = array[median], array[left]\n\n eli...
[ "0.7489234", "0.73037255", "0.7263377", "0.7248187", "0.7244165", "0.72246665", "0.72138345", "0.7182466", "0.7112789", "0.70957726", "0.70957106", "0.7094222", "0.7061047", "0.7031038", "0.70136863", "0.70048517", "0.6961541", "0.69505847", "0.69396096", "0.69392663", "0.693...
0.65747607
65
Helper function of Quick Sort
def _quick_sort(l, start, end): if start < end: split_point = partition(l, start, end) _quick_sort(l, start, split_point - 1) _quick_sort(l, split_point + 1, end) return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_sort(items):\n if len(items) &gt; 1:\n pivot_index = len(items) / 2\n smaller_items = []\n larger_items = []\n \n for i, val in enumerate(items):\n if i != pivot_index:\n if val &lt; i...
[ "0.7760281", "0.7721993", "0.76885456", "0.7677915", "0.7651931", "0.7591512", "0.7565072", "0.75632894", "0.7554661", "0.75349593", "0.7512256", "0.7479444", "0.7468108", "0.7460778", "0.7458644", "0.74480146", "0.7427353", "0.7420264", "0.73737925", "0.7369719", "0.73560107...
0.74366266
16
Check FPU mode was not changed during the test.
def check_fpu_mode(request): old_mode = get_fpu_mode() yield new_mode = get_fpu_mode() if old_mode != new_mode: warnings.warn("FPU mode changed from {0:#x} to {1:#x} during " "the test".format(old_mode, new_mode), category=FPUModeChangeWarning, stackl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_test_mode(self):\n\n # Ensure that we default to test mode off\n self.assertFalse(self.driver._test_mode)\n\n exception = False\n try:\n self.driver.set_test_mode(False)\n self.driver.test_force_state(state=1)\n\n except TestModeException:\n ...
[ "0.6161543", "0.6077402", "0.602634", "0.5968215", "0.59399635", "0.5799107", "0.5782805", "0.5766817", "0.56953335", "0.5690476", "0.567844", "0.55987924", "0.5596079", "0.55791", "0.5551743", "0.55079734", "0.5506978", "0.5492651", "0.5483458", "0.5458876", "0.5451956", "...
0.83218914
0
Calculate distance between two vectors using pearson method
def pearson_distance(vector1, vector2) : sum1 = sum(vector1) sum2 = sum(vector2) sum1Sq = sum([pow(v,2) for v in vector1]) sum2Sq = sum([pow(v,2) for v in vector2]) pSum = sum([vector1[i] * vector2[i] for i in range(len(vector1))]) num = pSum - (sum1*sum2/len(vector1)) den = math.sqrt((su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vector_dist(self, vec1, vec2):\r\n return sqrt(sum([(float(v1) - float(v2)) ** 2 for v1, v2 in\r\n zip(vec1, vec2)]))", "def distance(p1, p2):\n return np.linalg.norm(p2-p1)", "def distance(p1, p2):\n return np.linalg.norm(np.array(p1) - np.array(p2))", "def distance...
[ "0.7294797", "0.7278467", "0.7270707", "0.70065033", "0.6940717", "0.6914079", "0.687906", "0.6853775", "0.68429995", "0.6828889", "0.6796051", "0.6794433", "0.67713475", "0.67655015", "0.6764504", "0.67617387", "0.6739371", "0.67008483", "0.6689883", "0.66892594", "0.6667814...
0.82104915
0
generate k clusters randomly
def kmeans(matrix, k) : clusters = [0 for i in range(k)] lastcluster=[0 for i in range(k)] min_=0 max_=matrix.__len__() print "len",max_ cluster = [0 for i in range(k)] for i in range(k) : cluster[i]=int(random.random() * (max_ - min_) + min_) clusters[i]=matrix[cluster[i]] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_clusters(points, k):\r\n return points[np.random.randint(points.shape[0], size=k)]", "def generateClustersRandomly(k=2, scale=1, num_clusters=1, points_per_cluster=20):\n rands = [[np.random.uniform(-scale, scale) * np.random.rand() for _ in range(k)] for i in range(num_clusters)]\n point...
[ "0.8382873", "0.81803024", "0.78525186", "0.7692448", "0.7688887", "0.76144856", "0.74655944", "0.7380468", "0.7282572", "0.72800666", "0.71585906", "0.71396697", "0.713959", "0.71369356", "0.7134352", "0.71260124", "0.7118058", "0.71011895", "0.70912254", "0.7076738", "0.703...
0.6394023
67
Return number of iterations taken to get to 1.
def collatz(n): iterCount = 0 while(n != 1): if(n & 1): n = 3 * n + 1 else: n //= 2 iterCount += 1 return iterCount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_iterations(self) -> int:\n pass", "def number_of_iterations(self) -> int:\n return self._solution.info.iter", "def number_of_iterations(self) -> int:\n return self._stats[\"iter_count\"]", "def number_of_iterations(self):\n return self._solution.nit", "def getNIter...
[ "0.78124964", "0.74823964", "0.72896755", "0.7144956", "0.70778865", "0.70778865", "0.6886788", "0.6828246", "0.6690062", "0.6689765", "0.66271555", "0.6603668", "0.65433306", "0.65433306", "0.65174437", "0.6474691", "0.6438922", "0.6409205", "0.6398579", "0.6361549", "0.6349...
0.0
-1
data loader for mnist data
def load_mnist(dataset_name='mnist', **kwargs): dataset_name = dataset_name.strip().lower().replace('minist', 'mnist') if dataset_name.lower() not in ['mnist', 'fashion-mnist']: raise ValueError('Only mnist or fashion-mnist are valid dataset_name.') base = 'http://yann.lecun.com/exdb/mnist/' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dataset():\n temp = gzip.open('mnist.pkl.gz')\n train, val , test = pickle.load(temp,encoding='latin1')\n temp.close()\n train_inp = [np.reshape(x, (784,1)) for x in train[0]]\n train_outp = [one_hot(y) for y in train[1]]\n training_data = zip(train_inp, train_outp)\n validation_inp =...
[ "0.79639393", "0.79220957", "0.7809936", "0.77620274", "0.7741267", "0.77089685", "0.77075154", "0.76809376", "0.7589876", "0.7587508", "0.7579602", "0.7560688", "0.75594527", "0.7546023", "0.753031", "0.75233907", "0.7508495", "0.7488156", "0.74859476", "0.74364215", "0.7397...
0.74054974
20
data loader for mnist data
def load_cifar(dataset_name='cifar10'): dataset_name = dataset_name.strip().lower().replace(' ', '') if dataset_name.lower() not in ['cifar10', 'cifar100']: raise ValueError('Only cifar10 or cifar100 are valid dataset_name.') baseURL = 'https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dataset():\n temp = gzip.open('mnist.pkl.gz')\n train, val , test = pickle.load(temp,encoding='latin1')\n temp.close()\n train_inp = [np.reshape(x, (784,1)) for x in train[0]]\n train_outp = [one_hot(y) for y in train[1]]\n training_data = zip(train_inp, train_outp)\n validation_inp =...
[ "0.79644245", "0.7922395", "0.7810252", "0.7762534", "0.7741613", "0.77093273", "0.7708081", "0.7681307", "0.7590164", "0.75880253", "0.7579777", "0.75611156", "0.75599843", "0.7546466", "0.753079", "0.752396", "0.7508959", "0.7488553", "0.7486288", "0.7436546", "0.74058455",...
0.0
-1
data loader for AllanYiin deep learning course exsample data
def load_examples_data(dataset_name): dataset_name = dataset_name.strip().lower() if dataset_name.lower() not in ['pokemon', 'hanzi', 'animals', 'nsfw', 'simpsons', 'horse2zebra', 'people', 'autodrive', 'superresolution', 'anpr', 'beauty','antisproofing','facelandmarks','dogs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self):\n params = self.params\n catg = params.data_category\n langs = ['en', params.target_lang]\n data = {lang: {splt: {} for splt in (['train', 'valid'] if lang == 'en' else ['test'])} for lang in langs}\n clf_dataset_path = {\n lang: {\n ...
[ "0.6882167", "0.6877698", "0.6874206", "0.68331033", "0.6818233", "0.6786491", "0.6765132", "0.6740958", "0.6734389", "0.66937464", "0.66903794", "0.6689039", "0.6681287", "0.66398233", "0.66133606", "0.66025066", "0.65917754", "0.658308", "0.6580977", "0.65651095", "0.655459...
0.0
-1
Main hook entry point
def execute(self, tasks, work_template, comment, thumbnail_path, sg_task, primary_task, primary_publish_path, progress_cb, **kwargs): results = [] default_thumb = not os.path.exists(thumbnail_path) alembic_jobs = [] alembic_publish_tasks = [] # publish all tasks: for t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entry_point():", "def entry_point():", "def entry_point():", "def _hook(self):", "def on_hook(self) -> None:", "def setup_hooks(self):\n pass", "def main():\n pass", "def main(self):\r\n pass", "def _post_hooks(self):", "def main():\n PLUGIN_ENTRY().run(\"\")", "def ...
[ "0.7423908", "0.7423908", "0.7423908", "0.73854935", "0.7256732", "0.7225447", "0.7175162", "0.71340764", "0.7110802", "0.7008554", "0.7006415", "0.6989436", "0.6963864", "0.6871478", "0.6857729", "0.67905015", "0.67806673", "0.6760804", "0.6760804", "0.6760804", "0.6760804",...
0.0
-1
Publish an Alembic cache file for the scene and publish it to Shotgun.
def __publish_alembic_cache(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # get the current scene path ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __publish_geocache(self, item, output, work_template, primary_publish_path,\n sg_task, comment, thumbnail_path, progress_cb):\n # determine the publish info to use\n #\n progress_cb(10, \"Determining publish details\")\n\n # get the current sce...
[ "0.6180006", "0.58817565", "0.5879691", "0.5615526", "0.55755055", "0.5549456", "0.5518195", "0.5488557", "0.53738135", "0.5355673", "0.53469515", "0.53295285", "0.5316194", "0.5295457", "0.52651227", "0.5242149", "0.5208094", "0.519602", "0.51877934", "0.51724315", "0.516887...
0.65435106
0
Export an OBJ geo file for the scene and publish it to Shotgun.
def __publish_obj(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # get the current scene path and extrac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __make_geo(self):\n # gmsh freecad_part.iges -o out_iges.geo -0\n fname_list = self.__fname.split('.')\n geo_file = fname_list[0]+'.geo'\n runstr = \"%s %s -o %s -0\" % (environment.GMSH, self.__fname, geo_file)\n print(runstr)\n subprocess.call(runstr, shell=True)\n ...
[ "0.6160985", "0.60075134", "0.5905908", "0.5900655", "0.5871399", "0.5855076", "0.58512455", "0.58496916", "0.5741153", "0.5695086", "0.56631285", "0.5657295", "0.5654158", "0.565178", "0.5648279", "0.56455564", "0.5628589", "0.5552822", "0.54969823", "0.5480505", "0.54628605...
0.5423219
24
Publish an Alembic cache file for the scene and publish it to Shotgun.
def __publish_geocache(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # get the current scene path and e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __publish_alembic_cache(self, item, output, work_template, primary_publish_path,\n sg_task, comment, thumbnail_path, progress_cb):\n # determine the publish info to use\n #\n progress_cb(10, \"Determining publish details\")\n\n # get the curren...
[ "0.65446615", "0.58813435", "0.587966", "0.5616056", "0.5576552", "0.55503", "0.5517325", "0.54890555", "0.53740954", "0.53564984", "0.5346136", "0.53308266", "0.5318086", "0.5296485", "0.5264278", "0.524097", "0.5208991", "0.5195995", "0.5189076", "0.5173123", "0.5169205", ...
0.61809075
1
Publish an Alembic cache file for the scene and publish it to Shotgun.
def __publish_yeticache(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # the file and folder name is derived from th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __publish_alembic_cache(self, item, output, work_template, primary_publish_path,\n sg_task, comment, thumbnail_path, progress_cb):\n # determine the publish info to use\n #\n progress_cb(10, \"Determining publish details\")\n\n # get the curren...
[ "0.65444964", "0.6181592", "0.58802617", "0.5877373", "0.56138086", "0.55472326", "0.5520058", "0.5490468", "0.53768396", "0.5357921", "0.5348515", "0.5328552", "0.53159", "0.5297584", "0.5266048", "0.52403307", "0.5207243", "0.5193524", "0.51886195", "0.5176134", "0.5167291"...
0.5576275
5
Export a Maya file for the camera and publish it to Shotgun.
def __publish_mayacamera(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # get the current scene path and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_camera(progress_controller=None):\n if progress_controller is None:\n progress_controller = ProgressControllerBase()\n progress_controller.maximum = 7\n\n from stalker import Task, Version\n from anima.dcc import mayaEnv\n\n m = mayaEnv.Maya()\n v = m.get_current_version()\n ...
[ "0.6774113", "0.6170067", "0.6094196", "0.5807592", "0.5593866", "0.5566821", "0.55538255", "0.5492313", "0.5441863", "0.5441394", "0.54356366", "0.5406046", "0.540113", "0.53069115", "0.5299804", "0.52989906", "0.52933705", "0.52650744", "0.52415776", "0.5216365", "0.5212121...
0.6862812
0
Export an Alembic file for the camera and publish it to Shotgun.
def __publish_alembiccamera(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb): # determine the publish info to use # progress_cb(10, "Determining publish details") # get the current scene path ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_camera(progress_controller=None):\n if progress_controller is None:\n progress_controller = ProgressControllerBase()\n progress_controller.maximum = 7\n\n from stalker import Task, Version\n from anima.dcc import mayaEnv\n\n m = mayaEnv.Maya()\n v = m.get_current_version()\n ...
[ "0.6083645", "0.5946963", "0.57567835", "0.5715746", "0.5713011", "0.5650772", "0.55849946", "0.555498", "0.54727066", "0.5459543", "0.54370785", "0.5400925", "0.5385602", "0.53685206", "0.5327392", "0.5321729", "0.5304796", "0.5301103", "0.5287265", "0.5260967", "0.52580863"...
0.6043398
1
Find the animation range from the current scene.
def _find_scene_animation_range(self): # look for any animation in the scene: animation_curves = cmds.ls(typ="animCurve") # if there aren't any animation curves then just return # a single frame: if not animation_curves: return (1, 1) # something in the scen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrentAnimRange():\n return int(oma.MAnimControl.minTime().value), int(oma.MAnimControl.maxTime().value)", "def get_frame_range(self):\n #self._root = self.get_root_node()\n #startFrame = int(self._root.knob('first_frame').value())\n #endFrame = int(self._root.knob('last_frame').v...
[ "0.71858317", "0.6609152", "0.6361358", "0.6292253", "0.6262991", "0.6139651", "0.6130778", "0.6130778", "0.61261404", "0.61125124", "0.6087573", "0.6052101", "0.59913844", "0.5926955", "0.58776486", "0.58599156", "0.58571494", "0.58331656", "0.5719528", "0.56707656", "0.5669...
0.8159036
0
Returns the game result and wage Earned. Plays One Round of BlackJack
def play_blackjack(wager, max_wager): game = BlackJack(wager=wager, max_wager=max_wager, allow_split=True, allow_dd=True) player = game.players[0] print('\nYour Hand %s has %s points. Your wager is: %d' % (player['hand'], game.player_hand_value(), player['wager'])) print("Dealer's upcard is: ", game.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_game(self):\n self.dealer.hit_until_hold()\n message = self.bold_message(self.dealer.final_str_with_hand()+ \"\\n\")\n if self.dealer.has_blackjack():\n message += \"The Dealer has Blackjack. All players without blackjack will lose the round.\\n\\n\"\n for pl...
[ "0.74676996", "0.7168184", "0.6733583", "0.6671142", "0.6599137", "0.6537235", "0.6495052", "0.648471", "0.6455073", "0.63855594", "0.6383431", "0.63688266", "0.6352971", "0.6303885", "0.6285994", "0.62824136", "0.62114704", "0.62050974", "0.6204267", "0.6198414", "0.6196291"...
0.7301225
1
Returns the action choice made by the Player. Player can choose to Hit(1), Stand(2) or Double Down (3)
def get_player_input(allow_double_down=True): choices_avail = ['h', '1', '2'] msg = 'Select: help (h), hit (1), stand (2)' if allow_double_down: choices_avail.append('3') msg += ' ,double down (3)' msg += ' :' choice = 0 while choice not in choices_avail: choice = input(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action(player):\n print_action(player)\n chosen_action_index = int(input('Please indicate your selection from the following list by inputting the number: '))\n return player.available_actions[chosen_action_index]", "def get_player_action(self) -> None:\n print(f\"\\nYou have: {self.user.h...
[ "0.7664304", "0.76305485", "0.7418116", "0.7145675", "0.71054864", "0.7077956", "0.70766556", "0.70766556", "0.70401573", "0.6945828", "0.69291", "0.68862695", "0.682164", "0.68153846", "0.6801916", "0.6727821", "0.67192125", "0.6679106", "0.66654944", "0.66654944", "0.666165...
0.6747504
15
Retuns the wager the player chooses for this round. It cannot exceed the maximum available.
def get_wager_input(max_chips, min_chips=1): chips = 0 while chips < min_chips or chips > max_chips: chips = input('How many chips do you wager? (min %d, max %d): ' % (min_chips, max_chips)) try: chips = int(chips) except: chips = 0 return chips
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_based_alien_limitation(self):\n if self.num_round < 5:\n return 1\n elif self.num_round < 10:\n return 2\n else:\n return 3", "def take(self, desired_amount):\n if self.amount >= desired_amount:\n grab = desired_amount\n els...
[ "0.607354", "0.60145956", "0.5848289", "0.58172387", "0.57498705", "0.5735455", "0.5721542", "0.56717646", "0.5671178", "0.5665499", "0.5651265", "0.5645929", "0.5634616", "0.55988336", "0.55921286", "0.559142", "0.55852073", "0.55724007", "0.55680674", "0.5562452", "0.555093...
0.52707225
51
Returns the initialized player attributes. This function is called just once, but the player dict is updated on each round
def _initialize_game(wager_credits): player = {} player['chips'] = wager_credits player['round'] = 0 player['blackjack'] = 0 player['won'] = 0 player['lost'] = 0 player['push'] = 0 player['bust'] = 0 return player
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player_attributes(self):\n return Player_Attributes.read_by_player_fifa_api_id(self.player_fifa_api_id)", "def __init__(self):\r\n self.players = {}", "def player_properties(self):\n return self.properties.GetAll(self.player_interface)", "def get_players():\n return {\"X\": pl...
[ "0.7445393", "0.6738495", "0.6638327", "0.6635758", "0.6523638", "0.64918613", "0.6424853", "0.6402643", "0.63063866", "0.6300941", "0.61768234", "0.6132734", "0.6125309", "0.61147493", "0.6112685", "0.6096234", "0.609568", "0.60428095", "0.5956577", "0.59536284", "0.5951785"...
0.6587913
4
Set up some molecules, residues, and spins for testing.
def setUp(self): # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # Name the first molecule. cdp.mol[0].name = 'Ap4Aase' # Add a second molecule to the system. cdp.mol.add_item(mol_name='RNA') # Add two more residues to the first m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n insts = []\n for i in range(5):\n insts.append(pysat.Instrument('pysat', 'testing',\n clean_level='clean'))\n self.testC = pysat.Constellation(instruments=insts)\n self.testI = pysat.Instrument('pysat', 'testing', cl...
[ "0.68977237", "0.68746495", "0.65944415", "0.6475946", "0.64491606", "0.6416783", "0.63493866", "0.6320015", "0.62843525", "0.62730145", "0.62586296", "0.621708", "0.62119216", "0.6208113", "0.618722", "0.61871713", "0.61690503", "0.60853016", "0.6070992", "0.60702187", "0.60...
0.6524442
3
Test that the number of spins can be properly counted. The function tested is pipe_control.mol_res_spin.count_spins().
def test_count_spins(self): # Test the number of spins counted. self.assertEqual(mol_res_spin.count_spins(), 4) self.assertEqual(mol_res_spin.count_spins(skip_desel=False), 8) self.assertEqual(mol_res_spin.count_spins(selection='@N5'), 1) self.assertEqual(mol_res_spin.count_spin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_count_no_spins(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Test the number of spins counted.\n self.assertEqual(mol_res_spin.count_spins(), 0)", "def test_count_spins_no_pipe(self)...
[ "0.8216668", "0.79208726", "0.6061253", "0.59907717", "0.5961885", "0.59412616", "0.59404606", "0.59132665", "0.5879472", "0.5839816", "0.5767341", "0.57627225", "0.5760211", "0.5658254", "0.5647766", "0.56327945", "0.5631395", "0.5559625", "0.55477506", "0.5539356", "0.54946...
0.87852323
0
Test that the number of spins (zero) can be properly counted. The function tested is pipe_control.mol_res_spin.count_spins().
def test_count_no_spins(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # Test the number of spins counted. self.assertEqual(mol_res_spin.count_spins(), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_count_spins(self):\n\n # Test the number of spins counted.\n self.assertEqual(mol_res_spin.count_spins(), 4)\n self.assertEqual(mol_res_spin.count_spins(skip_desel=False), 8)\n self.assertEqual(mol_res_spin.count_spins(selection='@N5'), 1)\n self.assertEqual(mol_res_spin...
[ "0.8364899", "0.80283797", "0.63442856", "0.609039", "0.6043598", "0.6036848", "0.6035397", "0.5966873", "0.58482337", "0.58064646", "0.57407767", "0.56835514", "0.56486934", "0.563143", "0.5597956", "0.55912817", "0.55141515", "0.546807", "0.54593736", "0.5443237", "0.544082...
0.846338
0
Test that the counting of the number of spins raises an error when no pipe exists. The function tested is pipe_control.mol_res_spin.count_spins().
def test_count_spins_no_pipe(self): # Reset relax. reset() # Test for the error. self.assertRaises(RelaxNoPipeError, mol_res_spin.count_spins)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_count_no_spins(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Test the number of spins counted.\n self.assertEqual(mol_res_spin.count_spins(), 0)", "def test_count_spins(self):\n\n ...
[ "0.8297968", "0.7812048", "0.67697406", "0.61876446", "0.6167623", "0.6036055", "0.58979064", "0.58179224", "0.5769859", "0.57561326", "0.5715153", "0.5708538", "0.5594331", "0.5509007", "0.54806995", "0.5468505", "0.54357624", "0.54193336", "0.5419145", "0.5415963", "0.53699...
0.88973
0
Test the function for determining if moleculeresiduespin data exists. The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data(self): # This should be True. self.failUnless(mol_res_spin.exists_mol_res_spin_data())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # This should be False.\n self.failIf(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res...
[ "0.86498624", "0.8171099", "0.8008126", "0.7832109", "0.7612232", "0.74061805", "0.7374406", "0.64998114", "0.6273386", "0.6179472", "0.5896734", "0.58264905", "0.5745269", "0.57218933", "0.57177144", "0.5715544", "0.5627069", "0.56219554", "0.56199694", "0.55988914", "0.5454...
0.91275215
0
Determine if moleculeresiduespin data exists (with data for a single molecule). The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_single_mol(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') dp = pipes.get_pipe('orig') # Name the first molecule. dp.mol[0].name = 'TOM40' # This should be Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data(self):\n\n # This should be True.\n self.failUnless(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res_spin_data_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='or...
[ "0.84925765", "0.8205755", "0.81849754", "0.7938019", "0.78887266", "0.75465906", "0.6573173", "0.63930625", "0.56609166", "0.5556357", "0.5478604", "0.53835493", "0.5380998", "0.53788584", "0.53724927", "0.5332502", "0.5311545", "0.52456486", "0.52142644", "0.52067447", "0.5...
0.8367752
1
Determine if moleculeresiduespin data exists (when a single residue is named). The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_single_res_name(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') dp = pipes.get_pipe('orig') # Name the first residue. dp.mol[0].res[0].name = 'Lys' # This sho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data_single_mol(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n dp = pipes.get_pipe('orig')\n\n # Name the first molecule.\n dp.mol[0].name = 'TOM40'\n\n # ...
[ "0.8420557", "0.83105195", "0.8121444", "0.81118304", "0.807993", "0.7950876", "0.6401373", "0.6279278", "0.6215082", "0.591349", "0.5806613", "0.5639699", "0.5575356", "0.54308885", "0.5376391", "0.53730816", "0.53661835", "0.5356303", "0.5276748", "0.5268216", "0.52539533",...
0.8232994
2
Determine if moleculeresiduespin data exists (when a single residue is numbered). The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_single_res_num(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') dp = pipes.get_pipe('orig') # Number the first residue. dp.mol[0].res[0].num = 1 # This should ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data_single_spin_num(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n dp = pipes.get_pipe('orig')\n\n # Number the first spin.\n dp.mol[0].res[0].spin[0].num = 234\...
[ "0.84456354", "0.82298267", "0.8103048", "0.79645956", "0.79151535", "0.77068615", "0.6438838", "0.6125528", "0.6099552", "0.5864683", "0.57085097", "0.5695363", "0.5664928", "0.55890244", "0.55634105", "0.5563084", "0.5443872", "0.5368424", "0.53031784", "0.52392286", "0.519...
0.8403741
1
Determine if moleculeresiduespin data exists (when a single spin is named). The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_single_spin_name(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') dp = pipes.get_pipe('orig') # Name the first spin. dp.mol[0].res[0].spin[0].name = 'NH' # Thi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data(self):\n\n # This should be True.\n self.failUnless(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res_spin_data_single_mol(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name=...
[ "0.83926356", "0.83922964", "0.8218184", "0.81590086", "0.8031726", "0.7876572", "0.6523379", "0.6487321", "0.5793478", "0.566882", "0.5593635", "0.5562465", "0.55435604", "0.5511731", "0.54539114", "0.54490983", "0.5361425", "0.535502", "0.53494656", "0.53312635", "0.5321676...
0.8426691
0
Determine if moleculeresiduespin data exists (when a single spin is numbered). The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_single_spin_num(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') dp = pipes.get_pipe('orig') # Number the first spin. dp.mol[0].res[0].spin[0].num = 234 # This...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data(self):\n\n # This should be True.\n self.failUnless(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res_spin_data_single_mol(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name=...
[ "0.8392751", "0.823386", "0.8206758", "0.817102", "0.8049526", "0.75779665", "0.6515433", "0.63660663", "0.5854637", "0.57079095", "0.5615342", "0.55319315", "0.552877", "0.5456042", "0.54262865", "0.5386728", "0.53743654", "0.5337322", "0.53064", "0.5303351", "0.5252378", ...
0.8513595
0
Determine if moleculeresiduespin data exists when no data exists. The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_no_data(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # This should be False. self.failIf(mol_res_spin.exists_mol_res_spin_data())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data(self):\n\n # This should be True.\n self.failUnless(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res_spin_data_single_mol(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name=...
[ "0.86641157", "0.8070875", "0.80186194", "0.7868918", "0.77041644", "0.74484134", "0.70216393", "0.65485287", "0.62315524", "0.58949995", "0.57270414", "0.56871605", "0.5657348", "0.55692613", "0.5513263", "0.54984736", "0.5497161", "0.5481748", "0.54525614", "0.5450925", "0....
0.8743408
0
Determine if moleculeresiduespin data exists when no data pipe exists. The function tested is pipe_control.mol_res_spin.exists_mol_res_spin_data().
def test_exists_mol_res_spin_data_no_pipe(self): # Reset relax. reset() # This should fail. self.assertRaises(RelaxNoPipeError, mol_res_spin.exists_mol_res_spin_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exists_mol_res_spin_data_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # This should be False.\n self.failIf(mol_res_spin.exists_mol_res_spin_data())", "def test_exists_mol_res...
[ "0.8865291", "0.8417973", "0.80885214", "0.80438846", "0.7852497", "0.7701418", "0.7463378", "0.65262586", "0.6252962", "0.59931844", "0.58717984", "0.5862831", "0.5473991", "0.54632425", "0.54621637", "0.5440022", "0.5434693", "0.5432748", "0.5344402", "0.5344402", "0.533307...
0.7589267
6
Test the format_info_full() function for all combinations of input.
def test_format_info_full1(self): # The spin info and expected string - covering all possible combinations. info = [ # 5 bits of info. {'mol_name': 'Ubi', 'res_name': 'Ala', 'res_num': 10, 'spin_name': 'N', 'spin_num': 200, 'string': "Molecule Ubi, residue Ala 10, spin N 200...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_format_correlation_info(self):\r\n # With 999 permutations.\r\n exp = 'Correlation coefficient\\tParametric p-value\\tNonparametric ' + \\\r\n 'p-value\\tCI (lower)\\tCI (upper)\\n0.7778\\t0.0000\\t' + \\\r\n '0.000\\t0.0000\\t1.0000\\n'\r\n obs = format_corr...
[ "0.61617583", "0.5618504", "0.55047697", "0.5475531", "0.5467334", "0.544068", "0.5422697", "0.54041266", "0.5374505", "0.53257984", "0.5319085", "0.53129464", "0.5284171", "0.5279987", "0.52776444", "0.52651304", "0.52415544", "0.51991093", "0.51775396", "0.5157071", "0.5129...
0.72220844
0
First test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array1(self): # The data. data = ['1', 'GLY'] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2) # Test the string. self.assertEqual(id, ':1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array6(self):\n\n # The data.\n data = ['1', 'GLY', None, None]\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2)\n\n # Test the string.\n self.assertEqual(id, ':1')", "def test_generate_spin...
[ "0.78925526", "0.7822347", "0.76349664", "0.7610406", "0.75354004", "0.6579472", "0.60722893", "0.5760644", "0.5730065", "0.5698617", "0.5577793", "0.55716354", "0.554988", "0.55279154", "0.5508247", "0.5425098", "0.5357982", "0.53330165", "0.52789444", "0.527686", "0.527214"...
0.8076779
0
Second test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array2(self): # The data. data = ['1', 'GLY', '234', 'NH'] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2, spin_num_col=3, spin_name_col=4) # Test the string. self.assertEqual(id, ':1@234')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array1(self):\n\n # The data.\n data = ['1', 'GLY']\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2)\n\n # Test the string.\n self.assertEqual(id, ':1')", "def test_generate_spin_id_data_arr...
[ "0.8086905", "0.7927075", "0.7615566", "0.7598885", "0.75597614", "0.6486901", "0.6055875", "0.58638847", "0.57211256", "0.5610557", "0.55860114", "0.558456", "0.5549974", "0.54673797", "0.53942615", "0.53439724", "0.5339024", "0.5296352", "0.52316296", "0.5216718", "0.520122...
0.8013001
1
Third test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array3(self): # The data. data = ['Ap4Aase', '234', 'NH'] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, mol_name_col=1, res_num_col=None, res_name_col=None, spin_num_col=2, spin_name_col=3) # Test the string. self.assertEq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array6(self):\n\n # The data.\n data = ['1', 'GLY', None, None]\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2)\n\n # Test the string.\n self.assertEqual(id, ':1')", "def test_generate_spin...
[ "0.7930686", "0.79260224", "0.77357745", "0.7663863", "0.7659892", "0.64280635", "0.5991729", "0.591287", "0.5785646", "0.5763235", "0.5534429", "0.5532555", "0.5476528", "0.5412773", "0.5298371", "0.528956", "0.52654487", "0.523596", "0.52343017", "0.5201792", "0.5143447", ...
0.79937476
0
Fourth test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array4(self): # The data. data = ['Ap4Aase', '1', 'GLY'] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, mol_name_col=1, res_num_col=2, res_name_col=3) # Test the string. self.assertEqual(id, '#Ap4Aase:1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array6(self):\n\n # The data.\n data = ['1', 'GLY', None, None]\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2)\n\n # Test the string.\n self.assertEqual(id, ':1')", "def test_generate_spin...
[ "0.8070005", "0.8019214", "0.79400337", "0.7837104", "0.7815383", "0.64224803", "0.59210145", "0.5868475", "0.57858336", "0.57399845", "0.56103945", "0.53635967", "0.53469247", "0.53459364", "0.53184336", "0.5314746", "0.5255449", "0.5224802", "0.5213441", "0.515649", "0.5151...
0.80017376
2
Fifth test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array5(self): # The data. data = ['Ap4Aase', '1', 'GLY', '234', 'NH'] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5) # Test the string. self.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array6(self):\n\n # The data.\n data = ['1', 'GLY', None, None]\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2)\n\n # Test the string.\n self.assertEqual(id, ':1')", "def test_generate_spin...
[ "0.815962", "0.80106467", "0.781097", "0.7796662", "0.77246344", "0.6556488", "0.5972483", "0.596083", "0.5889257", "0.58199716", "0.58112353", "0.5503903", "0.5457309", "0.54131293", "0.5382142", "0.53779155", "0.53478414", "0.5337792", "0.5311869", "0.53046256", "0.5285401"...
0.80710626
1
Sixth test of the spin ID generation function. The function tested is pipe_control.mol_res_spin.generate_spin_id_data_array().
def test_generate_spin_id_data_array6(self): # The data. data = ['1', 'GLY', None, None] # The ID. id = mol_res_spin.generate_spin_id_data_array(data, res_num_col=1, res_name_col=2) # Test the string. self.assertEqual(id, ':1')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_spin_id_data_array5(self):\n\n # The data.\n data = ['Ap4Aase', '1', 'GLY', '234', 'NH']\n\n # The ID.\n id = mol_res_spin.generate_spin_id_data_array(data, mol_name_col=1, res_num_col=2, res_name_col=3, spin_num_col=4, spin_name_col=5)\n\n # Test the string.\n ...
[ "0.784438", "0.7714932", "0.7577586", "0.757559", "0.7561462", "0.6163308", "0.5690773", "0.56745136", "0.56711537", "0.5610869", "0.56024593", "0.5324083", "0.527502", "0.5271551", "0.5269606", "0.52232736", "0.52200073", "0.5196732", "0.5193356", "0.5152407", "0.5141934", ...
0.8226237
0
Test the proper operation of the molecule loop with molecule selection. The function tested is pipe_control.mol_res_spin.molecule_loop().
def test_molecule_loop(self): # Loop over the molecules. for mol in mol_res_spin.molecule_loop('#RNA'): # Test the molecule name. self.assertEqual(mol.name, 'RNA') # Test loop length. self.assertEqual(len(list(mol_res_spin.molecule_loop('#RNA'))), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_molecule_loop_no_selection(self):\n\n # Molecule data.\n name = ['Ap4Aase', 'RNA']\n\n # Loop over the molecules.\n i = 0\n for mol in mol_res_spin.molecule_loop():\n # Test the molecule names.\n self.assertEqual(mol.name, name[i])\n\n # ...
[ "0.78410846", "0.72731423", "0.71487254", "0.7066662", "0.6906277", "0.6623356", "0.6518581", "0.64826006", "0.64725286", "0.6450824", "0.6367674", "0.62304765", "0.61855984", "0.61084175", "0.60988086", "0.609054", "0.6079127", "0.5973447", "0.59563404", "0.55609775", "0.548...
0.75784975
1
Test the proper operation of the molecule loop when no data is present. The function tested is pipe_control.mol_res_spin.molecule_loop().
def test_molecule_loop_no_data(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # Loop over the molecules. i = 0 for molecule in mol_res_spin.molecule_loop(): i = i + 1 # Test loop ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_molecule_loop_no_selection(self):\n\n # Molecule data.\n name = ['Ap4Aase', 'RNA']\n\n # Loop over the molecules.\n i = 0\n for mol in mol_res_spin.molecule_loop():\n # Test the molecule names.\n self.assertEqual(mol.name, name[i])\n\n # ...
[ "0.79922223", "0.79701054", "0.79289037", "0.74845135", "0.731188", "0.68929285", "0.6694039", "0.65099937", "0.6446146", "0.6183709", "0.6016163", "0.5998978", "0.5988837", "0.59473413", "0.5947067", "0.58972764", "0.57490903", "0.57089925", "0.5673426", "0.5634207", "0.5628...
0.88965213
0
Test the proper operation of the molecule loop when no data pipe is present. The function tested is pipe_control.mol_res_spin.molecule_loop().
def test_molecule_loop_no_pipe(self): # Reset relax. reset() # Function for the problem of catching an error in a generator function. def fail_test(): for molecule in mol_res_spin.molecule_loop(): pass # Test for the no pipe error. self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_molecule_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the molecules.\n i = 0\n for molecule in mol_res_spin.molecule_loop():\n i = i + 1\n\n ...
[ "0.85301226", "0.79059464", "0.7656533", "0.73368526", "0.7248419", "0.70627767", "0.69679505", "0.6318001", "0.63044786", "0.6154404", "0.61035573", "0.5977854", "0.5860056", "0.5848514", "0.5847035", "0.5795445", "0.56938887", "0.55405074", "0.5520122", "0.5514679", "0.5450...
0.84358346
1
Test the proper operation of the molecule loop when no selection is present. The function tested is pipe_control.mol_res_spin.molecule_loop().
def test_molecule_loop_no_selection(self): # Molecule data. name = ['Ap4Aase', 'RNA'] # Loop over the molecules. i = 0 for mol in mol_res_spin.molecule_loop(): # Test the molecule names. self.assertEqual(mol.name, name[i]) # Increment i. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_molecule_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the molecules.\n i = 0\n for molecule in mol_res_spin.molecule_loop():\n i = i + 1\n\n ...
[ "0.7604223", "0.73143464", "0.73025155", "0.7007973", "0.6872689", "0.6866279", "0.6847027", "0.6842967", "0.64472896", "0.64401734", "0.640884", "0.6354868", "0.6325706", "0.6155382", "0.58229405", "0.5801081", "0.5721982", "0.5642657", "0.5607593", "0.55608016", "0.5551149"...
0.8007402
0
Test the proper operation of the residue loop with residue selection. The function tested is pipe_control.mol_res_spin.residue_loop().
def test_residue_loop(self): # Loop over the residues. for res in mol_res_spin.residue_loop('#Ap4Aase:Glu'): # Test the selection. self.assertEqual(res.num, 2) # Test loop length. self.assertEqual(len(list(mol_res_spin.residue_loop('#Ap4Aase:Glu'))), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_residue_loop_no_selection(self):\n\n # Spin data.\n num = [1, 2, 4, -5, -4]\n name = [None, 'Glu', 'Pro', None, None]\n\n # Loop over the residues.\n i = 0\n for res in mol_res_spin.residue_loop():\n # Test the residue numbers.\n self.assertE...
[ "0.81529486", "0.7770318", "0.7552308", "0.6837369", "0.674307", "0.64884526", "0.6445583", "0.63936305", "0.6344969", "0.6327929", "0.6228372", "0.62093467", "0.600957", "0.600777", "0.59746706", "0.59265643", "0.59220964", "0.5913016", "0.5843478", "0.5786151", "0.57159615"...
0.8213552
0
Test the proper operation of the residue loop when no data is present. The function tested is pipe_control.mol_res_spin.residue_loop().
def test_residue_loop_no_data(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # Loop over the residues. i = 0 for residue in mol_res_spin.residue_loop(): i = i + 1 # Test loop leng...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_residue_loop_no_selection(self):\n\n # Spin data.\n num = [1, 2, 4, -5, -4]\n name = [None, 'Glu', 'Pro', None, None]\n\n # Loop over the residues.\n i = 0\n for res in mol_res_spin.residue_loop():\n # Test the residue numbers.\n self.assertE...
[ "0.8301634", "0.82040375", "0.7788324", "0.7710455", "0.7556808", "0.72358716", "0.70310825", "0.6912135", "0.66328", "0.66025203", "0.6565843", "0.6549843", "0.6462473", "0.6374776", "0.6350188", "0.6347619", "0.6336793", "0.61492753", "0.6104927", "0.58747214", "0.5848667",...
0.8984354
0
Test the proper operation of the residue loop when no data pipe is present. The function tested is pipe_control.mol_res_spin.residue_loop().
def test_residue_loop_no_pipe(self): # Reset relax. reset() # Function for the problem of catching an error in a generator function. def fail_test(): for residue in mol_res_spin.residue_loop(): pass # Test for the no pipe error. self.assertR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_residue_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the residues.\n i = 0\n for residue in mol_res_spin.residue_loop():\n i = i + 1\n\n ...
[ "0.85945946", "0.77838326", "0.7751666", "0.76332873", "0.7629808", "0.7481475", "0.6956494", "0.69382966", "0.68887913", "0.65152484", "0.6382403", "0.63752276", "0.6283524", "0.6206884", "0.62047124", "0.61061484", "0.6081791", "0.6047085", "0.59946924", "0.5982436", "0.588...
0.86027044
0
Test the proper operation of the residue loop when no selection is present. The function tested is pipe_control.mol_res_spin.residue_loop().
def test_residue_loop_no_selection(self): # Spin data. num = [1, 2, 4, -5, -4] name = [None, 'Glu', 'Pro', None, None] # Loop over the residues. i = 0 for res in mol_res_spin.residue_loop(): # Test the residue numbers. self.assertEqual(res.num, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_residue_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the residues.\n i = 0\n for residue in mol_res_spin.residue_loop():\n i = i + 1\n\n ...
[ "0.8018613", "0.7852093", "0.77218246", "0.70574504", "0.68793595", "0.67554224", "0.66418993", "0.65647024", "0.64698106", "0.6459469", "0.6435851", "0.63787186", "0.62164485", "0.6151769", "0.61505395", "0.61433077", "0.60872215", "0.60452425", "0.5893791", "0.5879402", "0....
0.83963245
0
Test the function for returning the desired molecule data container. The function tested is pipe_control.mol_res_spin.return_molecule().
def test_return_molecule(self): # Ask for a few molecules. mol1 = mol_res_spin.return_molecule('#Ap4Aase') mol2 = mol_res_spin.return_molecule(selection='#RNA', pipe='orig') # Test the data of molecule 1. self.assertEqual(mol1.name, 'Ap4Aase') # Test the data of molecu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_molecule_pipe_fail(self):\n\n # Try to get a molecule from a missing data pipe.\n self.assertRaises(RelaxNoPipeError, mol_res_spin.return_molecule, selection='#Ap4Aase', pipe='new')\n self.assertRaises(RelaxNoPipeError, mol_res_spin.return_molecule, selection='#RNA', pipe='new'...
[ "0.63652605", "0.636043", "0.6196237", "0.61398995", "0.6118704", "0.59954035", "0.5866117", "0.5800223", "0.57261777", "0.56701607", "0.56608844", "0.55993", "0.5499727", "0.5499299", "0.5475103", "0.5424967", "0.53821063", "0.53715503", "0.5311273", "0.5283148", "0.5275008"...
0.82855994
0
Test the failure of the function for returning the desired molecule data container. The function tested is pipe_control.mol_res_spin.return_molecule().
def test_return_molecule_pipe_fail(self): # Try to get a molecule from a missing data pipe. self.assertRaises(RelaxNoPipeError, mol_res_spin.return_molecule, selection='#Ap4Aase', pipe='new') self.assertRaises(RelaxNoPipeError, mol_res_spin.return_molecule, selection='#RNA', pipe='new')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_molecule(self):\n\n # Ask for a few molecules.\n mol1 = mol_res_spin.return_molecule('#Ap4Aase')\n mol2 = mol_res_spin.return_molecule(selection='#RNA', pipe='orig')\n\n # Test the data of molecule 1.\n self.assertEqual(mol1.name, 'Ap4Aase')\n\n # Test the ...
[ "0.7752265", "0.6388569", "0.6297495", "0.6286569", "0.62686867", "0.6196573", "0.6173113", "0.617114", "0.6123175", "0.60926574", "0.59676576", "0.5883313", "0.587805", "0.5837631", "0.58120954", "0.577729", "0.5614546", "0.56138414", "0.56082726", "0.55601", "0.55297875", ...
0.75012517
1
Test the function for returning the desired residue data container. The function tested is pipe_control.mol_res_spin.return_residue().
def test_return_residue(self): # Ask for a few residues. res1 = mol_res_spin.return_residue(':1') res2 = mol_res_spin.return_residue(selection=':2') res4 = mol_res_spin.return_residue(selection=':4', pipe='orig') res5 = mol_res_spin.return_residue(selection='#RNA:-5', pipe='orig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_single_residue_info(self):\n\n # Ask for a few residues.\n res1 = mol_res_spin.return_single_residue_info('1')\n res2 = mol_res_spin.return_single_residue_info('2,Glu')\n res4 = mol_res_spin.return_single_residue_info('Pro,4')\n res5 = mol_res_spin.return_single_r...
[ "0.75668174", "0.6807258", "0.6658924", "0.6526883", "0.641903", "0.6259072", "0.62291884", "0.6145257", "0.61449796", "0.60818225", "0.6001908", "0.594091", "0.5885459", "0.58385515", "0.57113373", "0.5641675", "0.5627909", "0.5625898", "0.5486544", "0.54508084", "0.5426877"...
0.84991
0