sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1598a67c399874cfe52da7098a188fbabbf70bcd259c13014a0a4274e9ec852a
Python
1,461
44
#!/usr/bin/env python3 # Copyright 2020 Audio, Speech and Language Processing Group (ASLP@NPU), Northwestern Polytechnical University (Authors: Zhuoyuan Yao, Xiong Wang, Jingyong Hou, Lei Xie) # 2020 AIShell-Foundation (Author: Bengu WU) # 2020 Beijing Shell Shell Tech. Co. Ltd. (Author: Hui BU) #...
2fbdc6a8aa8225c76e6ba6c4c47ad37f4c6617f7febc3753b3b89ec6aef277a6
Python
1,461
54
from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Callable, Optional import curies from oaklib.datamodels.ontology_metadata import Any from oaklib.types import CURIE @dataclass(eq=False) class DataModelConverter(ABC): """ Base class for all inter-data model converters....
4daedacb949ba5d0eda9d643fc19893002aace70a6bc1f59c740e8bcf7ccd23c
Python
1,462
47
import torch import torch.nn as nn from mol_tree import Vocab, MolTree from nnutils import create_var from dfs import Motif_Generation_dfs from bfs import Motif_Generation_bfs from chemutils import enum_assemble, set_atommap, copy_edit_mol, attach_mols, atom_equal, decode_stereo import rdkit import rdkit.Chem as Chem f...
ebac9acd767a339d3bb298649c9642fc2d14919b20f220bd41e5bbc033b9a26e
Python
1,462
54
#!/usr/bin/python # This script appends utterances dumped out from XML to a Kaldi datadir import sys, re from xml.sax.saxutils import unescape basename=sys.argv[1] outdir = sys.argv[2] if len(sys.argv) > 3: mer_thresh=float(sys.argv[3]) else: mer_thresh = None # open the output files in append mode #segmen...
e2ae003c66fed07c9792138f91b74d02119b55a61f370f32ff53f680c2058555
Python
1,463
57
import numpy as np import numpy.testing as npt import pytest import nibabel as nib from dipy.io.stateful_tractogram import Space from dipy.io.streamline import StatefulTractogram import AFQ.utils.volume as afv import AFQ.data.fetch as afd def test_patch_up_roi(): roi_bad = np.zeros((10, 10, 10)) roi_good =...
e2e9c82f69e1b9cd2cf1540ce868eeeaaf6f62df2aa939b0809ed1ad48819afa
Python
1,463
37
import unittest import curies from linkml_runtime.loaders import json_loader from oaklib import OntologyResource from oaklib.converters.obo_graph_to_rdf_owl_converter import OboGraphToRdfOwlConverter from oaklib.datamodels.obograph import GraphDocument from oaklib.implementations import SparqlImplementation from oakl...
402a455f1cae185bcee81f0d220b96cdd0c9349734412744072bd358457c76c2
Python
1,467
47
"""Example code for plotting power maps from the state/mode covariances inferred on time-delay embedded training data. """ import os import numpy as np from osl_dynamics.analysis import power, post_hoc def get_data(name, output_dir): if os.path.exists(output_dir): print(f"{output_dir} already downloaded...
aaae531cd76fd918a5fe4934cf80c5d309bc3a41a85b8116dd59684f9c2c9366
Python
1,467
44
#! /usr/bin/env python3 # -*- coding:utf-8 -*- # @Author: Vincent (Qing Wang) # @Date: 2021-7-12 12:00:00 """ ====================================================== Using correcting the inconsistent studyUIDs of dicom files, if there are any, change them to match the first one. Adapted by Qing Wang (Vincent) from htt...
036de878eda77f0c409b649a9867869da48749b6c0555649b700d36836740726
Python
1,468
40
import os, subprocess BaseCase = __import__('base_case').BaseCase class TestDownloadRootDetection(BaseCase): def test_download_root_detection(self): if not self.is_chromium() and not self.headed: self.skipTest('xdotool does not work with headless firefox for some reason') self.open_ma...
5ef01953df7b7565dd860023a4508f159dde35ff574b00434a5868f6a4574236
Python
1,469
46
import subprocess import backend.startup as startup def test_nvidia_detection_prefers_nvidia_smi(monkeypatch): calls = [] def check_output(command, **_kwargs): calls.append(command) return b'NVIDIA GeForce RTX 3080\r\n' monkeypatch.setattr(startup.subprocess, 'check_output', check_outpu...
37d95c77094227e73957f16980e0b65fb66e1f2b22ce142315fdbca13ed81690
Python
1,470
37
import os from drugex import VERSION from drugex.logs import logger def getVocPaths(data_path, voc_files, mol_type): voc_paths = [] for v in voc_files: path = data_path + f"{v}_{mol_type}_voc.txt" if not os.path.exists(path): logger.warning(f'Reading {mol_type}_voc.txt instead of ...
751ece206fd7c82d24d7e836793f387b97d0fba261726b0bfdfd64a88a64c873
Python
1,470
36
import torch import torch.nn as nn from torchvision.transforms import transforms as tt class Net(nn.Module): def __init__(self, line, dropout): # l1_in, l1_out = 900, 128 # l2_in, l2_out = 128, 1 # dropout = 0.5 l1_in, l1_out, l2_in, l2_out = line super(Net, self)....
75c729dfdf0f4e685df7583178f01de959cbc25de144629c5b5e4042bbe3b4db
Python
1,470
45
from __future__ import absolute_import from __future__ import division from __future__ import print_function import random import argparse import glob import os parser = argparse.ArgumentParser() parser.add_argument("--dir", type=str, required=True, help="path to folder containing images") parser.add_argument("--tra...
d6d671c9b89d23b987524f828c30ebcf7c2fcbbed466009974775693076a6583
Python
1,470
43
import os import sys import numpy as np class DatasetGenerator: def __init__(self, data_dir, drop=True): self.data = [] self.label = [] filelist = os.path.join(data_dir, "fea.lst") labellist = os.path.join(data_dir, "label.lst") with open(filelist, 'r') as fp: fo...
158d1f232ddec423cdf4e0384412fb6c2a00d1020b7decb28ec191d913a1b2a8
Python
1,472
29
from functions import * import numpy as np import matplotlib.pyplot as plt import pickle starttime = datetime.now() #Note that measurement is stochastic, results will differ slightly on each run #Load dictionaries from pkl files to reproduce the plot as shown in the article #Running this script required 0.6sec for nr...
551f5d775d132d99a6d0f23dea9a8856191e81ed4f38675e5cb9e7134812b213
Python
1,473
42
from experiment import setup_seed, stft_general_data, stft_general_test from train import train from utils.dataTrans import get_dataloader from sklearn.model_selection import train_test_split from model import Unquantified_2layer_CNN, Unquantified_2layer_CNN_sp, Unquantified_2layer_CNN_sp_test, VGG16_base, VGG16_no...
b03b622da2bd23e2ec319e7b177e7f22bd492732cfb644d467e0a1e6f968349c
Python
1,474
43
import numpy as np def load_mabe_data_task1(data_path): """ Load data for task 1: Task 1 has multiple sequences The vocaubulary denotes the behavior name to class number. The vocabulary is all the same for all sequences in this task. """ data_dict = np.load(data_path, allow_pi...
5fc89cfdcfa9dac037b4cd8b854961f20952b77c87eeb188af1f9056933d5532
Python
1,477
47
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf def tensors_filter(tensors, filters, combine_type='or'): assert isinstance(tensors, (list, tuple)), '`tensors` shoule be a list or tuple!' assert isinstance(filters, (str, list...
682c895b29913b6d96a9b9b307f01246c608a9503a14c49d1c63bd3b474b2a2d
Python
1,477
52
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
74a1b4b4a403b983489baaaa577aeee7374c7ac0f76c76d13db8ce04829f2610
Python
1,478
52
__author__ = "Johannes Köster" __copyright__ = "Copyright 2018, Johannes Köster" __email__ = "johannes.koester@protonmail.com" __license__ = "MIT" import os from snakemake.shell import shell extra = snakemake.params.get("extra", "") java_opts = snakemake.params.get("java_opts", "") def fmt_res(resname, resparams...
42f64d3c95a8b4722fec42921c2274f84ba3e4d58f6b0aff9323667c7aa973d9
Python
1,479
36
import torch import pytest import numpy as np from ..spectral_projection import spectral_projection_divergence_free @pytest.mark.parametrize("resolution", [(64, 64), (80, 60), (60, 80)]) @pytest.mark.parametrize("constraint_modes", [(64, 64), (50, 64), (72, 60)]) @pytest.mark.parametrize("dtype", [torch.float32, torch...
724fd9a2fe417734f68e00c9d2ca990f0042cace106e7e5ab4e286d4c6e2ecba
Python
1,479
33
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
8e56cf9dc213444b1b4a442b36f46b4dd9b4ba729f4020402bc5f4081ba42f45
Python
1,480
41
import numpy as np import ddmr.utils.constants as C class SummaryDictionary: def __init__(self, model, batch_size, accumulative_gradients_step=None): self.train_names = model.metrics_names self.val_names = ['val_'+n for n in self.train_names] self.batch_size = batch_size self.acc_gr...
c6749f94d8eb6546c30a81f46d220147777ad0f8e41234e2a441f2495a67ae78
Python
1,480
46
import mediapipe as mp import cv2 import time import numpy as np import pandas as pd import os mpPose = mp.solutions.pose pose = mpPose.Pose() mpDraw = mp.solutions.drawing_utils # For drawing keypoints points = mpPose.PoseLandmark # Landmarks path = "Code/Sample Image" # enter dataset path data = [] ...
d950a7b40aec10cd990dfc35df9ee7057a2bf3e63948c599a102fd67fcc30a6c
Python
1,480
46
import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier from sklearn.metrics import mean_absolute_error, mean_squared_error, mean_absolute_error from pandas.api.types import is_string_dtype, is_numeric_dtype,...
37bce54233a69da3635ed86cf14be6501133aad0de1563f18a40a1f1f27039e5
Python
1,482
35
from .anchor_free_head import AnchorFreeHead from .anchor_head import AnchorHead from .atss_head import ATSSHead from .centripetal_head import CentripetalHead from .corner_head import CornerHead from .fcos_head import FCOSHead from .fovea_head import FoveaHead from .free_anchor_retina_head import FreeAnchorRetinaHead f...
34c814378788cb654bc2e5127a0a89ae2c7a8167f94bf60a6fb3bd01691977e1
Python
1,483
60
#!/usr/bin/env python3 import json import os import shutil import sys import numpy as np indir = sys.argv[1] cwd = os.getcwd() os.chdir(indir) os.makedirs('fsleyes', exist_ok=True) shutil.copy2('ica_components.nii.gz', os.path.join('fsleyes', 'melodic_IC.nii.gz')) d = np.genfromtxt('ica_mixing.tsv', skip_header...
6b1f7a0063eff28030f53e8e823553fa758d2f185a3807d2fc8b02b3a08b5809
Python
1,483
44
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
036047aecd0709d0106b88d5334775313baa2bf72bd8aa4a373b22555285bed5
Python
1,484
43
import setuptools import codecs from setuptools.command.install import install from io import open import os def read(rel_path): here = os.path.abspath(os.path.dirname(__file__)) with codecs.open(os.path.join(here, rel_path), "r") as fp: return fp.read() def get_version(rel_path): for line in rea...
15ee8d9e9ccf59d7734c70119f20533402ca3331858e38ad8fac2628f9c8fa05
Python
1,484
38
import multiprocessing import mne def preprocess_EEG(raw: mne.io.Raw, high_pass=None, low_pass=None, notch_freq=None, reference=None): """Filter and re-reference given mne.io.Raw object based on input values using mne. Args: raw (mne.io.Raw): Raw object holding EEG data. high_pass (float, op...
1fdaed99673923789c8582a6dc196a5326a76ee6aacc17f1ff1356fbc80bcb91
Python
1,484
64
import torch import numpy as np import networkx as nx import matplotlib.pyplot as plt from tqdm import trange from graphxai.datasets import Mutagenicity from graphxai.utils import aggregate_explanations dataset = Mutagenicity(root = '../../../explainers/mutagenicity/data', test_debug=True) # Iterate through dataset, ...
1c9c06ee5fdbc5964fae056c6abddef859b9a60e569a949f6e1b5d5cbd54b1a1
Python
1,486
32
import os, sys currentdir = os.path.dirname(os.path.realpath(__file__)) parentdir = os.path.dirname(currentdir) sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing from Brain_study.Train_Baseline import launch_train import argparse TRAIN_DATASET = '/mnt/EncryptedData1/Users/javier/ext_datas...
5bc5590fdbfa601a75b539ba7b6e79d46d34bb60ee0779355d1471fb5033c0ac
Python
1,486
47
import os import sys import numpy as np import torch import esm from Bio.PDB import PDBParser # refdir = "/bml/ccm3x/reference/" # outdir = "/bml/ccm3x/dataset/attn/" refdir = sys.argv[1] outdir = sys.argv[2] d3to1 = {'CYS': 'C', 'ASP': 'D', 'SER': 'S', 'GLN': 'Q', 'LYS': 'K', 'ILE': 'I', 'PRO': 'P', 'THR...
a122f81d37d3c8aeef3a2b7d1422e41a74bbf6763cf807409081bbbc47b232f5
Python
1,486
47
import copy import numpy as np import torch from tqdm import tqdm # maximum size of targets stored in-memory for validation metrics computation, # value derived experimentally using data loader of size 2000, batch size 64, # 194 cell types, and 201 target features MAX_TOTAL_VAL_TARGET_SIZE = 2000 * 64 * 194 * 201 d...
6af2fcc3edd34847e2c18fbac59c344b09b7225ee960c8485b2bc9407a861176
Python
1,487
45
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. import unittest import carla class TestWalkersSpawn(unittest.TestCase): def test_walker_spawn(s...
3f6171ea2c7e115c95a10fe96a23b7c87587af11408d29a6ef8366822363144a
Python
1,488
96
import json def init(): f = open('law.txt', 'r', encoding = 'utf8') law = {} lawname = {} line = f.readline() while line: lawname[len(law)] = line.strip() law[line.strip()] = len(law) line = f.readline() f.close() f = open('accu.txt', 'r', encoding = 'utf8') accu = {} accuname = {} line = f.readlin...
6c061b02e510291e7d501e6e1ff85447e72a3a55ddcb99d810e3075380711130
Python
1,488
42
""" running the ntf over a range of frequencies.""" from ..forward import network_transfer_onlymacro as nt import numpy as np def run_local_coupling_forward(brain, params, freqs): """run_forward. Function for running the forward model over the passed in range of frequencies, for the handed set of parameters (w...
ac3b1054493c35353170f7f172eb1ec9ee1d2f90b76a68a4a6c38d528ea7ba00
Python
1,488
44
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
43870e1d14aa4eb56f8fe67d3be0b91c71710b54467ec64bb24747edb021ac52
Python
1,489
42
## Template for saving import tensorflow as tf def array_to_tfrecords(X, y, output_file): feature = { 'X': tf.train.Feature(float_list=tf.train.FloatList(value=X.flatten())), 'y': tf.train.Feature(float_list=tf.train.FloatList(value=y.flatten())) } example = tf.train.Example(features=tf.t...
c084969140dca089d1d2b4c8a4e5c220ce75323caf0eedaf9105ac52a937a6c6
Python
1,489
63
import os if os.getcwd().endswith("UnitTests"): os.chdir("..") import json from Classes.SearchModule import SearchModule __author__ = 'Justas Birgiolas' import unittest class SearchModuleTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.search = SearchModule() def test_purkc...
a1145b6e50e606569da8b2b7574eea83ef85222ac78b5c363075b5449cb6d9a7
Python
1,490
39
from __future__ import print_function import os import sys """Hacky tool to convert file system layout of MCG boxes downloaded from http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/mcg/ so that it's consistent with those computed by Jan Hosang (see: http://www.mpi-inf.mpg.de/departments/computer-visio...
a47416b37160e0ccc00ccc9c656ec6a3a019338a9b7859ffd8e2595ff4d71681
Python
1,491
40
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
ef3aea5f3a525305fb92023aebeb561dfbe8881fbd59973002f67fbf8363f936
Python
1,491
40
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
28c5f0e2391608b575e6786ad7ec070bbbb5a02e83daf3a64f9adb4f1cfa704f
Python
1,492
26
"""Third-person chase camera on an autopilot vehicle (what tuto_G_pygame renders in its window).""" import os, sys, queue import carla sys.path.insert(0, os.path.dirname(__file__)); import scene OUT = sys.argv[1]; os.makedirs(OUT, exist_ok=True) c, w = scene.connect(); tm = c.get_trafficmanager(8000); lib = w.get_bluep...
2837ef447081daad99543566eb4bb0b9b98186632dc49b2334b406067e3c388b
Python
1,494
49
""" ==================================== How to segment out only some bundles ==================================== The pyAFQ software can be configured to find all of its default set of white matter pathways, or bundles. Alternatively, it can be configured to find only some bundles. This example shows how to track and...
0c65ddbef8dcf5301d7a95d7c21c45c57f7ff39d13af45e4e7698cfb24022ced
Python
1,495
45
import torch import torch.nn as nn import torch.nn.functional as F import math def rot_img(x, rot_mat): grid = F.affine_grid(rot_mat, x.size()) x = F.grid_sample(x, grid) return x class rotation_loss(nn.Module): def __init__(self): super(rotation_loss, self).__init__() self.loss = nn...
3f5132bb8b78a60d2e210cf1a8de2e8632e65eebe8f72ada2140bc624c6e3f59
Python
1,496
69
"""Dual estimation. In this script we estimate subject-specific means and covariances given the group-level model. """ #%% Run ID and output directories import os from sys import argv # We get the run ID from the command line arguments if len(argv) != 2: print("Please pass a run id, e.g. python 4_dual_estimatio...
19b0c24a2f3109fecbdf69b90eb9c514e4944d518c53c521a18302442d8167c9
Python
1,497
41
import torch from graphxai.datasets import load_ShapeGGen from graphxai.datasets.shape_graph import ShapeGGen from graphxai.gnn_models.node_classification.testing import train, test from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, GIN_3layer_basic, GCN_4layer_basic, GAT_3layer_basic from g...
75d786875bb75eeac62d3435be34885d9b5c465b5c69aa9c4bc2f51d57cceff6
Python
1,497
69
"""Dual estimation. In this script we estimate subject-specific means and covariances given the group-level model. """ #%% Run ID and output directories import os from sys import argv # We get the run ID from the command line arguments if len(argv) != 2: print("Please pass a run id, e.g. python 4_dual_estimatio...
825a714420c825201c4da5a36d50a57af97ed59f13212f2d3879ebc49ad1c376
Python
1,497
35
# Copyright 2020-2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
1f83ac26b7ad68b49fd4c3b160538092c335a7e40507dcb56d3297010fff453a
Python
1,499
48
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import glob import os.path import torch try: from torch.utils.cpp_extension import load as load_ext from torch.utils.cpp_extension import CUDA_HOME except ImportError: raise ImportError("The cpp layer extensions requires PyTorch 0.4 o...
8588587bbb0a939eec3966f10ad065f3ecf99557852343162a12119040ba02dc
Python
1,499
39
#!/usr/bin/env python3 # Apache 2.0 # This script truncates the rttm file # using UEM file and writes it to a new rttm file # from __future__ import print_function from __future__ import unicode_literals import argparse from scorelib.turn import trim_turns import scorelib.rttm as rttm_func from scorelib.uem import loa...
3a42ccab090da408f8eb935b6252b170b07bec2902e3f520a013bb5bf60d1041
Python
1,500
41
import torch from graphxai.datasets import load_ShapeGGen from graphxai.datasets.shape_graph import ShapeGGen from graphxai.gnn_models.node_classification.testing import train, test from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, GIN_3layer_basic, GCN_4layer_basic, GAT_3layer_basic from g...
40bc9cf98ec2c581ee4e6f79a5ef7e1cd93e261fbcc789cfb8a121e5998c4176
Python
1,502
54
from pathlib import Path import pandas as pd import pytest import navis @pytest.fixture def data_dir(): return Path(__file__).resolve().parent.parent / "navis" / "data" @pytest.fixture( params=["Path", "pathstr", "swcstr", "textbuffer", "rawbuffer", "DataFrame"] ) def swc_source(request, data_dir: Path): ...
49e84ed2d63492c2fdb21ac65703aa4828dd9ef1acff6838c3ebc1f0b04ae001
Python
1,502
63
import numpy as np import matplotlib.pyplot as plt import sys ID_ROW=0 REAL_ROW=1 GUESS_ROW=2 SCORE_1=5 SCORE_0=6 path = sys.argv[1] file_name = path.split('/')[-1].split('.')[0] with open(path) as f: data = f.readlines() p = 1000 n = len(data) Y = np.ndarray(shape=(n,1), dtype=int, order='F') T = np.ndarray(s...
16f0ae3ecfab79f5b895dbce47f272feed7336a839815cda9a4766030f9ce28d
Python
1,503
47
class str_gen: def basic_str(self): b_s = "" params_list = [p for p in dir(self) if not p.startswith("__") and not callable(getattr(self, p))] for p in params_list: k = getattr(self, p) if isinstance(k, str): b_s += p + ":" + k elif...
8809a951c407bdbd1766a40372a137e88c8880fc1391a51b99269e2d85fceca5
Python
1,503
46
# -*- coding: utf-8 -*- """Preview Code for 'Inf-Net: Automatic COVID-19 Lung Infection Segmentation from CT Scans' submit to Transactions on Medical Imaging, 2020. First Version: Created on 2020-05-05 (@author: Ge-Peng Ji) Second Version: Fix some bugs and edit some parameters on 2020-05-15. (@author: Ge-Peng Ji) ""...
f74a676ccc77662c9edbfd7914c771cb6ebd1e7fda043007837b480440ace2d5
Python
1,505
43
import pandas as pd from drugex.data.corpus.corpus import SequenceCorpus from drugex.data.corpus.vocabulary import VocSmiles from drugex.data.datasets import SmilesDataSet from drugex.data.processing import Standardization, CorpusEncoder, RandomTrainTestSplitter from ..settings import * def main(): if not os.path...
093d72b084bdf0cdd3372aa4c42bff5551907534d60d7edf0ea0a4c2ad0ec50f
Python
1,506
84
# Libraries import pandas as pd import numpy as np # Columns to map BOOLMAP = { 'N': False, 'Y': True, 'n': False, 'y': True, 'No': False, 'Yes': True, 'no': False, 'yes': True, } MAPPINGS = { 'Gender': { 'M': 0, 'F': 1 }, 'Admitted': BOOLMAP, 'Cough': B...
28d558aa7647110c2527ed324c8a7c1666d16e9f7a62314ff58af295d2c1cd95
Python
1,507
34
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
1d851f7014093bb55c1097ed3f3a9deb30e032f1c182d7b98f5a6cad481eb19d
Python
1,508
41
import logging import unittest from oaklib import get_adapter from oaklib.conf import CONF_DIR_PATH from oaklib.parsers import HPOA_G2D from oaklib.parsers.association_parser_factory import get_association_parser from tests import INPUT_DIR G2D_INPUT = INPUT_DIR / "example-hpoa-g2d.tsv" class HpoaG2DAssociationPars...
333cde30983e7f2dda5dcfb24c462b890d293c1036638b5f5740b47b6428299c
Python
1,508
36
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
aaf3baefdc676c4c87e072053cf9426145eea0d787894a6745002b563ffb83de
Python
1,508
36
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
2a9a2f332cb44fe1b348e853b30de4a429a839ea7ea4e369dbe4e420ba0546d3
Python
1,509
42
import os.path import os import glob import re import argparse parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for Brainseq.') parser.add_argument('fastq_dir', help='directory containing fastq files') parser.add_argument('phenotype_file', help='file with sample info') parser.add_argumen...
5bf90f9d45e325e4d0a159846510e6d8a5031013d1e2fd943d813aa89cbd8896
Python
1,509
61
import argparse import pickle import pandas as pd from grr.ThresholdModel import modelsToRecords parser = argparse.ArgumentParser() parser.add_argument( 'models', nargs='+', help='Paths to pickled lists of models.' ) parser.add_argument( '-o', '--output', type=str, required=True, help='Where...
6324872660a2eb09a844f1809143b154a1438d9a492a2f04d5333d468f5b825c
Python
1,510
41
import pandas as pd import os from drugex.data.corpus.vocabulary import VocGraph from drugex.data.datasets import GraphFragDataSet from drugex.data.fragments import FragmentPairsSplitter, FragmentCorpusEncoder, GraphFragmentEncoder from drugex.data.processing import Standardization from drugex.molecules.converters.fra...
10c55cce82df50f9ed85e1033770f4d121aa0ce8c639b5ca51384f4263d6fdcf
Python
1,511
46
#!/usr/bin/env python3 import argparse #################################### ### Parse command-line arguments ### parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("EH_filename", type=str) parser.add_argument("disease_locus_filename", type=str) args = parser.p...
73ebeb7816810d560461ce059896eaa4c5b0d05766b973cd6d3b64881f7c0464
Python
1,511
54
from math import exp, lgamma from typing import Tuple def log_binomial_coefficient(n: int, k: int) -> float: """ Binomial coefficient (n choose k). n: number of successes in sample :param n: :param k: :return: """ return lgamma(n + 1) - (lgamma(k + 1) + lgamma(n - k + 1)) def hyperg...
74015d59f670f4110bc0744e24ac8aba4e3fa09b1189ac80e8b95f80a6d4911b
Python
1,511
46
import torch import torch.nn.functional as F from torch_geometric.nn import global_mean_pool from torch_geometric.nn import GCNConv class GCN_2layer(torch.nn.Module): def __init__(self, in_channels, hidden_channels, out_channels): super(GCN_2layer, self).__init__() self.conv1 = GCNConv(in_channels,...
3e0c6d4e3a0c67b93160df43e22ff246054958899f0e07ab9d45a93fa4fe213b
Python
1,512
45
import logging import dipy.tracking.utils as dtu import numpy as np logger = logging.getLogger('AFQ') def get_percentile_threshold(mask, threshold): zero_mask = mask == 0 mask[zero_mask] = np.nan new_threshold = np.nanpercentile( mask, 100 - threshold) mask[zero_mask] = 0 return ...
9d811914e0d8c2014c0461698a16799d5bb2813aac393c5dedf695bf728402ae
Python
1,512
46
import os from subprocess import Popen, PIPE from input_output.read_msms import read_msms from triangulation.xyzrn import output_pdb_as_xyzrn from default_config.global_vars import msms_bin from default_config.masif_opts import masif_opts import random # Pablo Gainza LPDI EPFL 2017-2019 # Calls MSMS and returns the ...
b71b3b3aeb67eae7c18209cc58ac8c22842d31561d0e9ada51d1f9fe7bdf685a
Python
1,512
49
# coding=utf-8 # Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # less required by applicable law...
d4ae95a9752095219053e66157825e5611b1be326b6f76117330f2afdf2f6daa
Python
1,512
44
"""Base Model for Semantic Segmentation""" import torch.nn as nn from models.baselines.resnetv1b import resnet50_v1b, resnet101_v1b, resnet152_v1b __all__ = ['SegBaseModel'] class SegBaseModel(nn.Module): def __init__(self, classes=2, aux=False, backbone='resnet50', pretrained_base=True): super(SegBaseMo...
fb089a176ab6d2fe358fa4b9a58f0ff4e3a31dad8f7fe542bcb0ff1153b11ce3
Python
1,513
34
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
562fa8da171c72ff3ae14afa5b3f5ad3e34a9f237951851cb975209056f03eef
Python
1,516
51
import os import numpy as np import scanpy as sc from sklearn.model_selection import KFold import argparse parser = argparse.ArgumentParser() parser.add_argument('--datadir',type=str, default='default') parser.add_argument('--size_threshold', type=int, default=1000) args = parser.parse_args() datadir = args.datad...
52c9efce9bcf4e7c720f32282825f114dc6a36d7aa93d7c42f5844df4e8ce6a8
Python
1,517
59
import torch from pathlib import Path from utils.data import make_trees_dataset from utils.nnet import get_device from hebbcl.logger import LoggerFactory from hebbcl.model import ModelFactory from hebbcl.trainer import Optimiser, train_on_trees from hebbcl.parameters import parser from joblib import Parallel, delaye...
a85507bf415215ecdc4c6e87bc86567971eeb93091b2790779a6443d667b9538
Python
1,518
44
# Unit tests for sima/motion/dftreg.py # Tests follow conventions for NumPy/SciPy avialble at # https://github.com/numpy/numpy/blob/master/doc/TESTS.rst.txt # use assert_() and related functions over the built in assert to ensure tests # run properly, regardless of how python is started. from future import standard_li...
de8769d0258647b3e2b10fb4d5392f42123a34b7ab58f279fca7d90203719425
Python
1,518
61
import matplotlib.pyplot as plt import platform import seaborn as sns from rl_analysis.util import merge_dict all_fig_dct = { "pdf.fonttype": 42, "font.sans-serif": "Arial", "font.family": "sans-serif", "mathtext.fontset": "custom", "mathtext.rm": "Liberation Sans", "mathtext.it": "Liberation Sans:italic", "m...
d9a75e7ddcba18cb26d55d25fa4827eced889227830a9ac81567784bc826b5b2
Python
1,520
40
# Copyright 2020 Google Research. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
902d0aa834a69aa40191698637d0d4efe7688cba09b77889d41de403fa0e274e
Python
1,521
35
#!/usr/bin/env python3 # Copyright 2019 Ashish Arora # Apache 2.0. import sys, io import string infile = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') output = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') spkorder_writer = open(sys.argv[1],'w', encoding='utf8') array_id_error_dict={} for line in in...
1a53b562b42390479fb291f24376a8bf7c0827a20f91bd0acbbe561287c1c8d1
Python
1,522
55
import os import numpy as np import pandas as pd from sklearn.metrics import pairwise_distances from src.data import load_metagraph from src.io import savecsv FNAME = os.path.basename(__file__)[:-3] print(FNAME) def stashcsv(df, name, **kws): savecsv(df, name, foldername=FNAME, **kws) mg = load_metagraph("G"...
2f4d06a072cd218377fb1c4a01e9494797d39a4f457b47c4041c15634b9bc4b0
Python
1,523
50
import torch.nn as nn from collections import OrderedDict class LeNet5(nn.Module): """ Input - 1x32x32 C1 - 6@28x28 (5x5 kernel) tanh S2 - 6@14x14 (2x2 kernel, stride 2) Subsampling C3 - 16@10x10 (5x5 kernel, complicated shit) tanh S4 - 16@5x5 (2x2 kernel, stride 2) Subsampling C5 ...
d3d175520a9803df09c9e9e5430287a289c5f9e1cd8aa2fae397af33e38b9c1e
Python
1,523
62
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 22 20:54:01 2022 @author: th """ import numpy as np def flatten_list_1d(act_ratio): ph = np.empty((1,0)) ph = np.squeeze(ph) for entry in act_ratio: ph = np.concatenate((ph, entry)) return ph def standardscal...
1b719574362863a7c86a36074c3045ba536b22c141884f48753f15dde6813b16
Python
1,524
53
import pymesh import numpy """ read_ply.py: Read a ply file from disk using pymesh and load the attributes used by MaSIF. Pablo Gainza - LPDI STI EPFL 2019 Released under an Apache License 2.0 """ def read_ply(filename): # Read a ply file from disk using pymesh and load the attributes used by MaSIF. # filena...
34d60d89cf64aa90d53e2b9d3e30dcbbf5620224388404fb8a8b91c4c7736c78
Python
1,524
41
import torch from torch_geometric.datasets import TUDataset from graphxai.explainers import PGMExplainer from graphxai.explainers.utils.visualizations import visualize_mol_explanation from graphxai.gnn_models.graph_classification import GCN, load_data, train, test dataset = TUDataset(root='data/TUDataset', name='MUT...
3e45ee6273437db3da6338db1d9cf8cce76a4ccba1b4cf9b818d3aa7a289291f
Python
1,524
41
import pandas as pd import os from drugex.data.corpus.vocabulary import VocSmiles from drugex.data.datasets import SmilesFragDataSet from drugex.data.fragments import FragmentPairsSplitter, FragmentCorpusEncoder, SequenceFragmentEncoder from drugex.data.processing import Standardization from drugex.molecules.converter...
41a57e9466071acdb18b4d25e2b779ac7fa6c7e6d061a3b79f4c16e365d6868e
Python
1,525
43
"""Parser for GAF/HPOA and related association formats""" from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Iterable, Iterator, Optional, TextIO, Union from oaklib.datamodels.association import ( Association, NegatedAssociation, ParserConfiguration, ) from oaklib.par...
dcf467e5efe26dee4c0bf1b074fcafba352848fe14941d2dc57f3fb1ef8b570a
Python
1,529
36
from utils.dataloaders import DataLoader import csv class CSVLoader(DataLoader): def load(self): with open(self.config.dataset.dataset_path, "rt", encoding='utf-8') as csv_file: reader = csv.reader(csv_file) data = next(reader) print("Import csv...") k = 0 ...
6a71a38a9a7aa7a79d26f9efc3fff23cd5f31815e28011100fa53bd7f6a69b48
Python
1,531
63
__author__ = 'jieqing jiao' __email__ = "jieqing.jiao@gmail.com" # weighting scheme implementation based on https://www.ncbi.nlm.nih.gov/pubmed/16912378 from niftypad import kt import numpy as np def get_weight(dt, isotope='18F', a=1, t=None, r=None, tac=None): if isotope == '12C': half_life = 20.39 * ...
78286d15c5a78566ab85eedfdec3f7eb794189b4cb0c313881caf1862a3a035f
Python
1,531
40
import argparse import argparse, sys; sys.path.append('../..') import random as rand import torch from metrics import * import numpy as np from graphxai.gnn_models.node_classification.testing import GIN_3layer_basic, GCN_3layer_basic, GSAGE_3layer # ---------------------------- my_base_graphxai = '/home/owq978/GraphXA...
e9455bce5d3665eb13ad935fbe2de8045cf6a2d507bb16befc202a988d3ab2e0
Python
1,531
23
"""Town stills with traffic: townshots.py OUTDIR W H name=x,y,z,yaw,pitch[,fov] ... (Cinematic, sunny afternoon).""" import sys, os, queue, carla sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))); import scene out, W, H = sys.argv[1], sys.argv[2], sys.argv[3]; os.makedirs(out, exist_ok=True) shots = [(a.sp...
eac65c86c3926e16f4e0850ae2d0ea613163e705b7f63a18e467e6208ef0a87a
Python
1,531
41
from __future__ import division from __future__ import print_function from __future__ import absolute_import import tflib as tl import tensorflow as tf import tensorflow.contrib.slim as slim from functools import partial conv = partial(slim.conv2d, activation_fn=None, weights_regularizer=slim.l2_regularizer(1e-4)) f...
2b1c1f489c6a4cbbcc475fe3240d97a5fddd8c4e5a8d1bf7e8da96a0b35a1111
Python
1,532
45
#!/usr/bin/env python # Copyright 2015 Minhua Wu # Apache 2.0 # convert acronyms in swbd decode result to fisher convention # e.g. convert things like en_4156 B 414.26 0.65 u._c._l._a. to # en_4156 B 414.26 0.16 u # en_4156 B 414.42 0.16 c # en_4156 B 414.58 0.16 l # en_4156 B 414.74 0.17 a from __future__ import d...
6e0814f192e95a7e7be9ae758ebf366a61b77f7c91644b84862125f9cb9d040c
Python
1,533
44
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
ff2863f7bd115626a146930f7fac61d5573f05b6e0c7b5cf89eab0d87e4ad4c6
Python
1,533
41
# Copyright 2020-2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
56376dd5f92d395a82e63fd490463596cfa1e94cff3871a6d46b3aa76b742e93
Python
1,535
50
# Copyright 2021 Xiaomi Corporation (Author: Junbo Zhang, Yongqing Wang) # Apache 2.0 # This script does phone-level pronunciation scoring by GOP-based features. import sys import argparse import pickle import kaldi_io import numpy as np from utils import round_score def get_args(): parser = argparse.ArgumentP...
9b8d4772b5dcd964c800901471bab4b4ae0c6d4547beb32f3da76da457112376
Python
1,536
48
"""Parser for GAF association formats""" import csv from dataclasses import dataclass from typing import Iterator, Optional, TextIO from oaklib.datamodels.association import Association, ParserConfiguration from oaklib.parsers.xaf_association_parser import XafAssociationParser @dataclass class HpoaG2DAssociationPar...
b181d7993f7258ffa9b817ee546698f1d41d394f7f3ebb24909d192e7d4df728
Python
1,537
36
#!/usr/bin/env python3 # # Copyright (c) 2018 Hyeshik Chang # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modi...
6a1208214645c736828730d5b3e4174c2d3cdbffd4c1ded3d31a0c30da4c2bbe
Python
1,538
42
import torch import torch.nn.functional as F import numpy as np import os, argparse from scipy import misc from lib.HarDMSEG import HarDMSEG from utils.dataloader import test_dataset parser = argparse.ArgumentParser() parser.add_argument('--testsize', type=int, default=352, help='testing size') parser.add_argument('--...
b85e063ac28c8eaf85ffb80413dd1e2f82763995afb70d60612a1bec6eb94714
Python
1,539
27
#!/usr/bin/env python # Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """Shared pytest CLI options for lens_validation/. pytest only picks up pytes...