content
stringlengths
22
815k
id
int64
0
4.91M
def named(name): """ This function is used to decorate middleware functions in order for their before and after sections to show up during a verbose run. For examples see documentation to this module and tests. """ def new_annotate(mware): def new_middleware(handler): new_h...
5,338,500
def concatFile(file_list): """ To combine files in file list. """ config = getConfig() print('[load]concating...') df_list = [] for f in file_list: print(f) tmp = pd.read_csv(config['dir_raw']+f, index_col=None, header=0) df_list.append(tmp) df = pd.concat(df_list, axis=0, ignore_index=True) return df
5,338,501
def apply_reflection(P, source_idx, target_idx, R, n_forward): """Modifies `P` in-place.""" for _source_idx, _target_idx, _R in zip(source_idx, target_idx, R): if _source_idx < n_forward: P[_target_idx, -1] += _R * P[_source_idx, -2] else: P[_target_idx, 0] += _R * P[_sou...
5,338,502
def multiply_str(char, times): """ Return multiplied character in string """ return char * times
5,338,503
def calories_per_item(hundr, weight, number_cookies, output_type): """ >>> calories_per_item(430, 0.3, 20, 0) 'One item has 64.5 kcal.' >>> calories_per_item(430, 0.3, 20, 1) 'One item has 64.5 Calories.' >>> calories_per_item(1, 1000, 10, 1) 'One item has 1000.0 Calories.' >>> c...
5,338,504
def bitcoind_call(*args): """ Run `bitcoind`, return OS return code """ _, retcode, _ = run_subprocess("/usr/local/bin/bitcoind", *args) return retcode
5,338,505
def getItemProduct(db, itemID): """ Get an item's linked product id :param db: database pointer :param itemID: int :return: int """ # Get the one we want item = db.session.query(Item).filter(Item.id == itemID).first() # if the query didn't return anything, raise noresult exception ...
5,338,506
def add_tech_types(net, tech): """ Add std_type to an existing net """ for i, t in tech.iterrows(): # i is ID of tech, t is tech data data = dict(c_nf_per_km=t.C, r_ohm_per_km=t.R, x_ohm_per_km=t.X, max_i_ka=t.Imax/1000, ...
5,338,507
def find_board(board_id: BoardID) -> Optional[Board]: """Return the board with that id, or `None` if not found.""" board = db.session.get(DbBoard, board_id) if board is None: return None return _db_entity_to_board(board)
5,338,508
def test_isin_pattern_0(): """ Test IsIn pattern which expresses the IsIn/OneOf semantics. """ inputs = Tensor(np.ones([42]), mindspore.float16) softmax_model = nn.Softmax() @register_pass(run_only_once=True) def softmax_relu_pass(): x = Any() softmax_pattern = Prim(P.Softma...
5,338,509
def ENsimtime(): """retrieves the current simulation time t as datetime.timedelta instance""" return datetime.timedelta(seconds= _current_simulation_time.value )
5,338,510
def solar_true_longitude(solar_geometric_mean_longitude, solar_equation_of_center): """Returns the Solar True Longitude with Solar Geometric Mean Longitude, solar_geometric_mean_longitude, and Solar Equation of Center, solar_equation_of_center.""" solar_true_longitude = solar_geometric_mean_longitude +...
5,338,511
def image_to_fingerprint(image, size=FINGERPRINT_SIZE): """Create b64encoded image signature for image hash comparisons""" data = image.copy().convert('L').resize((size, size)).getdata() return base64.b64encode(bytes(data)).decode()
5,338,512
def get_indices( time: str | datetime | date, smoothdays: int = None, forcedownload: bool = False ) -> pandas.DataFrame: """ alternative going back to 1931: ftp://ftp.ngdc.noaa.gov/STP/GEOMAGNETIC_DATA/INDICES/KP_AP/ 20 year Forecast data from: https://sail.msfc.nasa.gov/solar_report_archives/M...
5,338,513
def get_args(): """Get CLI arguments and options :return: AccuRev branch, git repository location, append option boolean """ parser = argparse.ArgumentParser(description='Migrate AccuRev branch history to git') parser.add_argument('accurevBranch', help='The AccuRev branch which will be migrated', t...
5,338,514
def check(device, value): """Test for valid setpoint without actually moving.""" value = json.loads(value) return zmq_single_request("check_value", {"device": device, "value": value})
5,338,515
def prove(formula, verbose): """ :param formula: String representation of a modal formula. The syntax for such a formula is per the grammar as stipulated in the README. Example input: "(a|b) & (~c => d)" :return string showing the outcome of the proof, that is valid or not valid. """ try: ...
5,338,516
def _assert_covers_from(covers, y, fol): """Assert that each element of `covers` is a subset of `y`.""" for cover in covers: assert y | ~ cover == fol.true
5,338,517
def get_projectID(base_url, start, teamID, userID): """ Get all the project from jama Args: base_url (string): jama instance base url start (int): start at a specific location teamID (string): user team ID, for OAuth userID (string): user ID, for OAuth Returns: (...
5,338,518
def to_world(points_3d, key2d, root_pos): """ Trasform coordenates from camera to world coordenates """ _, _, rcams = data_handler.get_data_params() n_cams = 4 n_joints_h36m = 32 # Add global position back points_3d = points_3d + np.tile(root_pos, [1, n_joints_h36m]) # Load the appropriat...
5,338,519
async def test_camera_generic_update( hass: HomeAssistant, ufp: MockUFPFixture, camera: ProtectCamera ): """Tests generic entity update service.""" await init_entry(hass, ufp, [camera]) assert_entity_counts(hass, Platform.CAMERA, 2, 1) entity_id = "camera.test_camera_high" assert await async_s...
5,338,520
def remove_tags(pipelineId=None, tagKeys=None): """ Removes existing tags from the specified pipeline. See also: AWS API Documentation Exceptions :example: response = client.remove_tags( pipelineId='string', tagKeys=[ 'string', ] ) :typ...
5,338,521
def test_insert_items_rebal_right_left_rotation(): """Test that the tree rebalances on a left right rotation.""" from bst import AVLBST avl = AVLBST() avl.insert(85) avl.insert(2) avl.insert(88) avl.insert(79) avl.insert(55) assert avl.root.val == 85 assert avl.root.right.val == ...
5,338,522
def orbital_energies_from_filename(filepath): """Returns the orbital energies from the given filename through functional composition :param filepath: path to the file """ return orbital_energies(spe_list( lines=list(content_lines(filepath, CMNT_STR))))
5,338,523
def _dict_merge(a, b): """ `_dict_merge` deep merges b into a and returns the new dict. """ if not isinstance(b, dict): return b result = deepcopy(a) for k, v in b.items(): if k in result and isinstance(result[k], dict): result[k] = _dict_merge(result[k], v) else:...
5,338,524
def flags(flags: int, modstring: str) -> int: """ Modifies the stat flags according to *modstring*, mirroring the syntax for POSIX `chmod`. """ mapping = { 'r': (stat.S_IRUSR, stat.S_IRGRP, stat.S_IROTH), 'w': (stat.S_IWUSR, stat.S_IWGRP, stat.S_IWOTH), 'x': (stat.S_IXUSR, stat.S_IXGRP, stat.S_IXOTH) ...
5,338,525
def _can_contain(ob1, ob2, other_objects, all_obj_locations, end_frame, min_dist): """ Return true if ob1 can contain ob2. """ assert len(other_objects) == len(all_obj_locations) # Only cones do the contains, and can contain spl or smaller sphere/cones, # cylinders/cubes are too large ...
5,338,526
def twolmodel(attr, pulse='on'): """ This is the 2-layer ocean model requires a forcing in W/m2 pulse = on - radiative pulse W/m2 pulse = off - time varyin radaitive forcing W/m2/yr pulse = time - use output from simple carbon model """ #### Parameters #### yeartosec = 30.25*24*60*6...
5,338,527
def save_df_to_s3(df_local, s3_bucket, destination): """ Saves a pandas dataframe to S3 Input: df_local: Dataframe to save s3_bucket: Bucket name destination: Prefix """ csv_buffer = StringIO() s3_resource = boto3.resource("s3") df_local.to_csv(csv_buffer, index=False) s3_...
5,338,528
def test_set_entity_ids(nlp: Language, patterns: List[Dict[str, Any]]) -> None: """It writes ids to entities.""" ruler = SpaczzRuler(nlp, spaczz_patterns=patterns) nlp.add_pipe(ruler) doc = nlp("Grint Anderson was prescribed Zithroma.") assert len(doc.ents) == 2 assert doc.ents[0].label_ == "NAM...
5,338,529
def maximumToys(prices, k): """Problem solution.""" prices.sort() c = 0 for toy in prices: if toy > k: return c else: k -= toy c += 1 return c
5,338,530
def batch_process(process, **kwargs): """Runs a process on a set of files and batches them into subdirectories. Arguments: process ((IN, OUT, Verbosity) -> str): The function to execute on each file. Keyword Arguments: file (Optional[str]): The input files and directories. ...
5,338,531
async def test_config_bad_key(hass): """Check config with bad key.""" config = {"name": "test", "asdf": 5, "platform": "universal"} config = validate_config(config) assert "asdf" not in config
5,338,532
def get_X_HBR_d_t_i(X_star_HBR_d_t): """(47) Args: X_star_HBR_d_t: 日付dの時刻tにおける負荷バランス時の居室の絶対湿度(kg/kg(DA)) Returns: 日付dの時刻tにおける暖冷房区画iの実際の居室の絶対湿度(kg/kg(DA)) """ X_star_HBR_d_t_i = np.tile(X_star_HBR_d_t, (5, 1)) return X_star_HBR_d_t_i
5,338,533
def add_route(url: str, response: Optional[str] = None, method: str = 'GET', response_type: str = 'JSON', status_code: int = 200, headers: Optional[Dict[str, str]] = None, callback: Optional[Callable[[Any], None]] = None, ...
5,338,534
def findUsername(data): """Find a username in a Element Args: data (xml.etree.ElementTree.Element): XML from PMS as a Element Returns: username or None """ elem = data.find('User') if elem is not None: return elem.attrib.get('title') return None
5,338,535
def test_non_unischema_with_many_colums_with_one_shot_iterator(carbon_many_columns_non_unischema_dataset): """Just a bunch of read and compares of all values to the expected values""" with make_batch_carbon_reader(carbon_many_columns_non_unischema_dataset.url, workers_count=1) as reader: dataset = make_pycarbon...
5,338,536
def preprocess_config_factory(args: argparse.Namespace, ref_paths: dict, dataset_type: str) -> Union[BratsConfig, CamCanConfig, IBSRConfig, CANDIConfig, IXIConfig]: """Factory method to create a pre-processing config based on the parsed command line arguments.""" if dataset_type ==...
5,338,537
def GET(request): """Get this Prefab.""" request.check_required_parameters(path={'prefabId': 'string'}) prefab = Prefab.from_id(request.params_path['prefabId']) prefab.check_exists() prefab.check_user_access(request.google_id) return Response(200, 'Successfully retrieved prefab', prefab.obj)
5,338,538
def fix_empty_strings(tweet_dic): """空文字列を None に置換する""" def fix_media_info(media_dic): for k in ['title', 'description']: if media_dic.get('additional_media_info', {}).get(k) == '': media_dic['additional_media_info'][k] = None return media_dic for m in tweet_dic...
5,338,539
def group_joinrequest(request, group_id): """ Handle post request to join a group. """ if not request.is_ajax() or request.method != 'POST': raise Http404 result = {} content_type = 'application/json; charset=utf-8' group_id = int(group_id) group = get_group(group_id) if n...
5,338,540
def fibonacci(**kwargs): """Fibonacci Sequence as a numpy array""" n = int(math.fabs(kwargs.pop('n', 2))) zero = kwargs.pop('zero', False) weighted = kwargs.pop('weighted', False) if zero: a, b = 0, 1 else: n -= 1 a, b = 1, 1 result = np.array([a]) for i in rang...
5,338,541
def temp_directory(): """This context manager gives the path to a new temporary directory that is deleted (with all it's content) at the end of the with block. """ directory = tempfile.mkdtemp() try: yield directory finally: shutil.rmtree(directory)
5,338,542
def read_data(): """Reads in the data from (currently) only the development file and returns this as a list. Pops the last element, because it is empty.""" with open('../PMB/parsing/layer_data/4.0.0/en/gold/dev.conll') as file: data = file.read() data = data.split('\n\n') data.pop(-...
5,338,543
def argrelextrema(data, comparator, axis=0, order=1, mode='clip'): """ Calculate the relative extrema of `data`. Parameters ---------- data : ndarray Array in which to find the relative extrema. comparator : callable Function to use to compare two data points. Should tak...
5,338,544
def test_as_airbyte_stream_incremental(mocker): """ Should return an incremental refresh AirbyteStream with information matching the provided Stream interface. """ test_stream = StreamStubIncremental() mocker.patch.object(StreamStubIncremental, "get_json_schema", return_value={}) airbyte_st...
5,338,545
def test_get_temperature_rise_no_spec_sheet(): """get_temperature_rise_spec_sheet() should raise a KeyError when passed an unkown page number.""" with pytest.raises(KeyError): inductor.get_temperature_rise_spec_sheet(22)
5,338,546
def dijkstra(G, s): """ find all shortest paths from s to each other vertex in graph G """ n = len(G) visited = [False]*n weights = [math.inf]*n path = [None]*n queue = [] weights[s] = 0 hq.heappush(queue, (0, s)) while len(queue) > 0: g, u = hq.heappop(queue) ...
5,338,547
def prepare_create_user_db(): """Clear a user from the database to be created.""" username = TEST_USERS[0][0] connection = connect_db() connection.cursor().execute('DELETE FROM Users WHERE username=%s', (username,)) connection.commit() close_db(connection) ret...
5,338,548
def _getlocal(ui, rpath): """Return (path, local ui object) for the given target path. Takes paths in [cwd]/.hg/hgrc into account." """ try: wd = os.getcwd() except OSError, e: raise util.Abort(_("error getting current working directory: %s") % e.strerror) ...
5,338,549
def get_size_and_sha256(infile): """ Returns the size and SHA256 checksum (as hex) of the given file. """ h = hashlib.sha256() size = 0 while True: chunk = infile.read(8192) if not chunk: break h.update(chunk) size += len(chunk) return (size, h.h...
5,338,550
def process_log_data(spark, input_data, output_data): """ Function to create users, time, and songplays table and to process log data """ # get filepath to log data file log_data = input_data + "log_data/*/*" # read log data file df = spark.read.json(log_data) # filter by actions for s...
5,338,551
def cmServiceAbort(): """CM SERVICE ABORT Section 9.2.7""" a = TpPd(pd=0x5) b = MessageType(mesType=0x23) # 00100011 packet = a / b return packet
5,338,552
def get_distribution(distribution_id): """ Lists inforamtion about specific distribution by id. :param distribution_id: Id of CDN distribution """ cloudfront = CloudFront() return cloudfront.get_distribution(distribution_id=distribution_id)
5,338,553
def get_information_per_topic(db_path: str, topic: str, field: str): """ Query all alert data monitoring rows for a given topic Parameters ---------- db_path: str Path to the monitoring database. The database will be created if it does not exist yet. topic: str Topic name of...
5,338,554
def _testOpen(): """ >>> from defcon.test.testTools import getTestFontPath >>> from defcon.objects.font import Font >>> font = Font(getTestFontPath('TestOpenContour.ufo')) >>> glyph = font['A'] >>> glyph[0].open True >>> glyph[1].open False >>> glyph[2].open True >>> glyp...
5,338,555
def add_packer_codebuild_job(t, name, environment=None): """ Add the packer AMI build to the codebuild job """ cfn_name = sanitize_cfn_resource_name(name) with open(os.path.dirname(os.path.realpath(__file__)) + "/buildspecs/packer.yml") as spec: build_spec = spec.read() codebuild_job_environmen...
5,338,556
def gripper_client(finger_positions): """Send a gripper goal to the action server.""" action_address = '/' + prefix + 'driver/fingers_action/finger_positions' client = actionlib.SimpleActionClient(action_address, kinova_msgs.msg.SetFingersPositionAction) client....
5,338,557
def plot_scalar_field(snap: Step, fieldname: str) -> None: """Plot scalar field with plate information. Args: snap: a :class:`~stagpy._step.Step` of a StagyyData instance. fieldname: name of the field that should be decorated with plate informations. """ fig, axis, _, _ = fi...
5,338,558
def validate_column(column_name,value,lookup_values): """Validates columns found in Seq&Treat tuberculosis AST donation spreadsheets. This function understands either the format of a passed column or uses values derived from lookup Pandas dataframes to check each value in a spreadsheet. Args: ...
5,338,559
def get_html_from_url(url, timeout=None): """Get HTML document from URL Parameters url (str) : URL to look for timeout (float) : Inactivity timeout in seconds Return The HTML document as a string """ resp = reqget(url, timeout=timeout) return resp.text
5,338,560
def save_hdf5(connection, filepath): """ Save network parameters in HDF5 format. Parameters ---------- {save_dict.connection} filepath : str Path to the HDF5 file that stores network parameters. Examples -------- >>> from neupy import layers, storage >>> >>> connec...
5,338,561
def clean(column, output_column=None, file_path=None, df=None, symbols='!@#$%^&*()+={}[]:;’\”/<>', replace_by_space=True, keep_original=False): """ cleans the cell values in a column, creating a new column with the clean values. Args: column: the column to be cleaned. output_colum...
5,338,562
def len_lt(name, value): """ Only succeed if the length of the given register location is less than the given value. USAGE: .. code-block:: yaml foo: check.len_lt: - value: 42 run_remote_ex: local.cmd: - tgt: '*' - func: tes...
5,338,563
def _ll_to_xy(latitude, longitude, wrfin=None, timeidx=0, stagger=None, method="cat", squeeze=True, cache=None, _key=None, as_int=True, **projparams): """Return the x,y coordinates for a specified latitude and longitude. The *latitude* and *longitude* arguments can be a single value...
5,338,564
def p_command_box(p): """command : BOX NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER | BOX NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER SYMBOL | BOX SYMBOL NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER | BOX SYMBOL NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER SYMBOL""" cmd = {'op'...
5,338,565
def partner_to_partners(apps, schema_editor): """ Adds the Partner object in Authorization.partner to the many-to-many relationship in Authorization.partners """ authorization_model = apps.get_model("users", "Authorization") for authorization in authorization_model.objects.all(): ...
5,338,566
def spawn(): """ Spawn a machine to package or to slave into the network :return None: """ args = parse_spawn_arguments() spawn_machine( assimilate=not args.no_assimilate, after_assimilate=not args.no_after_assimilate, after_mesh=not args.no_after_mesh, provision=...
5,338,567
def verify_in_person_group(subscription_key): """VerifyInPersonGroup. This will verify whether faces detected as similar in a group are of the same person. """ face_base_url = "https://{}.api.cognitive.microsoft.com".format(FACE_LOCATION) face_client = FaceClient(endpoint=face_base_url, credential...
5,338,568
def onedsinusoid(x,H,A,omega,phi): """ Returns a 1-dimensional sinusoid of form H+A*np.sin(omega*x+phi) """ phi = np.pi/180 * phi return H+A*np.sin(omega*x+phi)
5,338,569
def _make_wrapper_func(func_name): """ make_eus_instance()から呼ばれるEus_pkgクラスコンストラクタにて、eusの関数名のエントリからラッパー関数を作成する際の補助関数。 引数部の構築は_translate_args()を用いて行う。 Args: func_name (str): もとのEuslispでの関数名でpkg::を含む。なお、関数は内部シンボルと仮定している。(exportされてたら外部シンボルアクセス:(1個)を使わなければならない)。 Returns: wrapper (functio...
5,338,570
def number_in_english(number): """Returns the given number in words >>> number_in_english(0) 'zero' >>> number_in_english(5) 'five' >>> number_in_english(11) 'eleven' >>> number_in_english(745) 'seven hundred and fourty five' >>> number_in_english(1380) 'one thousand three hu...
5,338,571
def create_app(environment): """Factory Method that creates an instance of the app with the given config. Args: environment (str): Specify the configuration to initilize app with. Returns: app (Flask): it returns an instance of Flask. """ app = Flask(__name__) app.config.from_obj...
5,338,572
def heating_design_temp(tmy_id): """Returns the heating design temperature (deg F) for the TMY3 site identified by 'tmy_id'. """ return df_tmy_meta.loc[tmy_id].heating_design_temp
5,338,573
def tonal_int(x): """ >>> tonal_int((4,7)) 7 >>> tonal_int((4,7,2)) 31 >>> tonal_int((6,11,-1)) -1 >>> tonal_int((0,-1,-1)) -13 >>> tonal_int((6,0,0)) 12 >>> tonal_int((0,11,0)) -1 >>> tonal_int((0,11)) -1 >>> tonal_int((2, 0)) 0 """ i...
5,338,574
def read_vcf(vcf_file, gene_filter=None, experimentalDesig=None): """ Reads an vcf v4.0 or 4.1 file and generates :class:`~epytope.Core.Variant.Variant` objects containing all annotated :class:`~epytope.Core.Transcript.Transcript` ids an outputs a list :class:`~epytope.Core.Variant.Variant`. Only the fo...
5,338,575
def serial_read_and_publish(ser, mqtt): """thread for reading serial data and publishing to MQTT client""" ser.flushInput() while True: line = ser.readline() # this is blocking line = line.decode() if debug: print() cleaned_line = line.replace('\r', '').repl...
5,338,576
def tid() -> Tuple[int, int, int]: """ Return the current thread indices for a 3d kernel launch. Use ``i,j,k = wp.tid()`` syntax to retrieve the coordinates inside the kernel thread grid. """ ...
5,338,577
def sqrtmod(a, p): """ Returns a square root of a modulo p. Input: a -- an integer that is a perfect square modulo p (this is checked) p -- a prime Output: int -- a square root of a, as an integer between 0 and p-1. Examples: >>> sqrtmod(4, 5)...
5,338,578
def hints(missing_includes): """Output hints for how to configure missing includes on some platforms""" if platform.system() == "Darwin" and "GL/glut.h" in missing_includes: print(""" NOTE: On macOS, include GLUT/glut.h instead of GL/glut.h. Suggested code: # ifdef __APPLE__ # include <GLUT/gl...
5,338,579
def DrtVariableExpression(variable): """ This is a factory method that instantiates and returns a subtype of ``DrtAbstractVariableExpression`` appropriate for the given variable. """ if is_indvar(variable.name): return DrtIndividualVariableExpression(variable) elif is_funcvar(variable.na...
5,338,580
def init_db(): """Initiate the database.""" with app.app_context(): db = get_db() with app.open_resource('schema.sql', mode='r') as f: db.cursor().executescript(f.read()) db.commit()
5,338,581
def ShowNexuses(cmd_args=None): """ Show Nexus. usage: shownexues """ nexus_summaries = [] nexuses = kern.globals.nx_head for nx in IterateRBTreeEntry(nexuses, 'struct kern_nexus*', 'nx_link'): nexus_summaries.append(GetStructNexusSummary(nx)) nexus_summaries.sort() for nx_s...
5,338,582
def process_cv_results(cv_results): """ This function reformats the .cv_results_ attribute of a fitted randomized search (or grid search) into a dataframe with only the columns we care about. Args -------------- cv_results : the .cv_results_ attribute of a fitted randomized search (or g...
5,338,583
def cbow(currentWord, C, contextWords, tokens, inputVectors, outputVectors, dataset, word2vecCostAndGradient = softmaxCostAndGradient): """ CBOW model in word2vec """ # Implement the continuous bag-of-words model in this function. # Input/Output specifications: same as the skip-gram model # We will...
5,338,584
def generate_dlf_yaml(in_yaml): """ Generate DLF-compatible YAML configuration file using "templates/dlf_out.yaml" as template. :param in_yaml: dict representation of a YAML document defining placeholder values in "templates/dlf_out.yaml" :type in_yaml: dict :raises PlaceholderNotFoundError...
5,338,585
def dice_coefficient(x, target): """ Dice Loss: 1 - 2 * (intersection(A, B) / (A^2 + B^2)) :param x: :param target: :return: """ eps = 1e-5 n_inst = x.size(0) x = x.reshape(n_inst, -1) target = target.reshape(n_inst, -1) intersection = (x * target).sum(dim=1) union = (x *...
5,338,586
def batch_intersection_union(output, target, nclass): """mIoU""" # inputs are numpy array, output 4D, target 3D predict = np.argmax(output, axis=1) + 1 # [N,H,W] target = target.astype(float) + 1 # [N,H,W] predict = predict.astype(float) * np.array(target > 0).astype(float) intersection = pre...
5,338,587
def plot_pairs_corr(base="CFs_Result", xlim=[-10,10], figsize=(8,4), exclude_folders=["Logs","Plot"],cmap="PiYG"): """ Plot ambient noise results of each pair under the base path Parameters base: base path for the cross-correlation res...
5,338,588
def StepFailure(check, step_odict, step): """Assert that a step failed. Args: step (str) - The step to check for a failure. Usage: yield ( TEST + api.post_process(StepFailure, 'step-name') ) """ check(step_odict[step].status == 'FAILURE')
5,338,589
def convert(trainset,testset,seed=1,batch_size=128, num_workers=2,pin_memory=True): """ Converts DataSet Object to DataLoader """ SEED = 1 cuda = torch.cuda.is_available() torch.manual_seed(SEED) if cuda: torch.cuda.manual_seed(SEED) dataloader_args = dict(shuffle=True, batch_size=128, num_workers=2, pin_m...
5,338,590
def exit(): """quits the application""" System.exit(0)
5,338,591
def test_pipeline_target_encoding_correct(): """ The correct processing of the categorical target at the Pipeline is tested. Moreover, target contains nans and has incorrect shape. Source and predicted labels should not differ. """ classification_data = data_with_categorical_target(with_nan=True...
5,338,592
def build_gradcam(img_path, heatmap, color_map, original_image_colormap, alpha=0.5): """ Builds the gradcam. Args: img_path (_type_): Image path. heatmap (_type_): Heatmap. color_map (_type_): Color map. original_image_colormap (_type_): Original image colormap. alpha (float...
5,338,593
def delete_data(): """ テストで使用したデータの削除 zabbix関連テーブルは試験後に削除されているので不要 """ # テーブル初期化 RuleType.objects.all().delete() DataObject.objects.all().delete()
5,338,594
def sample_joint_comorbidities(age, country): """ Default country is China. For other countries pass value for country from {us, Republic of Korea, japan, Spain, italy, uk, France} """ return sample_joint(age, p_comorbidity(country, 'diabetes'), p_comorbidity(country, 'hypertension'))
5,338,595
def generate_tsdf_3d_ewa_image(depth_image, camera, camera_extrinsic_matrix=np.eye(4, dtype=np.float32), field_shape=np.array([128, 128, 128]), default_value=1, voxel_size=0.004, array_offset=np.a...
5,338,596
def locate(name): """ Locate the object for the given name """ obj = pydoc.locate(name) if not obj: obj = globals().get(name, None) return obj
5,338,597
def qmap(func, q, eos_marker=EOS): """ Converts queue to an iterator. For every `item` in the `q` that is not `eos_marker`, `yield proc(item)` Takes care of calling `.task_done()` on every item extracted from the queue. """ while True: item = q.get(block=True) if item is eos_marker...
5,338,598
def get_mesh_deforms(mesh, deforms, origin, **kwargs): """ input : mesh object deforms forward for mesh?! origin (from volume) output: PointSet of mesh vertices (duplicates removed) and list with deforms (PointSets) of mesh vertices """ from stentseg.utils impo...
5,338,599