sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
74bcda1fdf27444c2c3cd500e1134a06fcc45a3b58515ce374162e085a891d00
Python
1,063
52
from abc import ABC from typing import Iterable from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface from oaklib.types import CURIE class SkosInterface(BasicOntologyInterface, ABC): """ presents ontology as simple SKOS vocabularies `SKOS <https://www.w3.org/2004/02/skos/>`_ ...
fd156ad5d1e55f482054f664458b03b7d96309c3ba8eb4c217d784b5b0d6acdd
Python
1,063
55
from builtins import object import abc from future.utils import with_metaclass class Transform(with_metaclass(abc.ABCMeta, object)): """Abstract class for geometric transforms.""" @abc.abstractmethod def apply(self, source, grid=None): """Apply the transform to raw source data. Paramete...
164d8a6f581068a3dc856abc6d914ad34cc5cfec2c29678112883e7856a9e065
Python
1,064
26
""" Copyright 2020 - by Jerome Tubiana (jertubiana@gmail.com) All rights reserved Permission is granted for anyone to copy, use, or modify this software for any uncommercial purposes, provided this copyright notice is retained, and note is made of any changes that have been made. This softwar...
6f5616f7b2e6b20d331f322492253d508e0f7a9239aa2006a24cf82fc0a17aa8
Python
1,064
29
# %% import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from pymaid_creds import url, name, password, token import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) from contools import Promat from data_settings import data_date, pairs_path # %% neurons = pymaid...
95b944fe4ccbd0db76467d87e87f20baa3bbded14ab313499fe27a95bbb26503
Python
1,064
22
import random # Very simple fake genotype file to showcase how to run Decon method # Also write the snp-gene file for which combination needs to be tested with open('count.table.simulated.txt') as input_file, open('gene_snp_file.txt','w') as out, open('fake_genotype_dosages.txt','w') as out2: x = 0 out.write('...
715996bfc8abba95ac0fc33d94116d2b4a3b78a4a76cab7b97436edd556d9249
Python
1,065
36
# -*- coding: utf-8 -*- from collections import OrderedDict import torch.nn as nn import torchvision.models as tv_models from utils.model_summary import model_summary class CCustomNet(nn.Module): def __init__(self): super(CCustomNet, self).__init__() a = list() a.append(('conv_0', nn.Co...
bccc44c33f77df89433cff29062252d0b0709e7ef118e4086fcaad4a9fa65f27
Python
1,065
36
# 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 a...
357cd4571878d93ae0199d3e4f6bfab4ca0765b150c559173d78118c94e7e1ce
Python
1,066
27
# 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...
f600a68e4e3a2477fefcf9f803b3c318331b2adb9545c1187895c979496edc84
Python
1,066
21
#################################################################################################### # Copyright (c) 2019, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free softwar...
f8c59f4ed985cc19d340d268efe9769f9f09cb8c22b7c84cbb7efba8dea71ef6
Python
1,066
27
# 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...
d26ede75343aebea73cb2dd02a31a90bffec663ef801d23856aa825812638050
Python
1,067
37
# 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 a...
155f82efa7b17418866710dabacb1b30f59275d9fdef2c7f47fb9bf14ae8f74d
Python
1,068
27
from glob import glob import shutil import os from sphinx_gallery.scrapers import figure_rst class PNGScraper(object): def __init__(self): self.seen = set() def __repr__(self): return 'PNGScraper' def __call__(self, block, block_vars, gallery_conf): # Find all PNG files in the dire...
37accdb6d2c47794eb31fdc2c9d35a8a34a8811e4b46fbd2226b4db07d09dbc0
Python
1,070
37
_base_ = '/home/Thanaporn/mmdetection_v2_2/mmdetection/configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py' model = dict( pretrained='torchvision://resnet101', backbone=dict( type='ResNet_MD', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm...
8eaecea4ed3cefd7e32ae57c407054a379aa2debb350a1350ce8802f18c35c91
Python
1,070
41
__author__ = "Johannes Köster" __copyright__ = "Copyright 2016, Johannes Köster" __email__ = "koester@jimmy.harvard.edu" __license__ = "MIT" from snakemake.shell import shell from os import popen outfile = snakemake.output[0] compress_flags = "" if outfile.endswith("vcf.gz"): compress_flags = "-Oz" elif outfil...
b2edb96b498fd4f8fb95a38c119e89996b9530b57f49c02d4c892c5de78a2760
Python
1,070
26
rule preprocess: output: bookmark_file='{name}/.poreplex_preprocessing_done', adapter_inventory='{name}/adapter-dumps/inventory.h5' threads: 40 run: input_dir = config['data'][wildcards.name] output_dir = os.path.dirname(output.bookmark_file) shell('poreplex --input "...
2bf8963f336e45a295d2f25a90a8e850936725f807cf67cf2eceeb4b3ca8c5e3
Python
1,071
25
# 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...
8e1be9b7adda72fd49af1cf1816687b4a9ec6bffaab64e9c91c902624e5d72df
Python
1,071
48
import unittest import grr.ThresholdModel_testutil as tmt from grr.GIF import GIF # SIMULATION TESTS class TestGIFSimulateDoesNotCrash_VectorInput( tmt.TestSimulateDoesNotCrash_VectorInput, unittest.TestCase ): def setUp(self): super(TestGIFSimulateDoesNotCrash_VectorInput, self).setUp() se...
c2c5224590316618901e7ff5af6377a7bf07364dda45a592aef941c663e8a7b2
Python
1,071
21
#################################################################################################### # Copyright (c) 2019, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free softwar...
b621207c93892311446a8d0819274ed8f77fb6d77b600c70a821d37569f8e62a
Python
1,072
50
''' Fig. 11. Collective behavior. ''' from brian2 import * from pylab import * import matplotlib.font_manager as fm from plotting import * from matplotlib import gridspec from behavior import * import imageio import numpy as np fontprops = fm.FontProperties(size=18) width, height = 8, 3 dt = 33*ms duration = 200*secon...
e384183cf57f0b39c66423fc18b8912e6f3f259d00f5ce86a0632b5ff9df5ec0
Python
1,072
16
"""montage.py OUT.webp W H MS IMG[:LABEL[:croptop]] ... -> animated webp, one still per frame.""" import sys from PIL import Image, ImageDraw, ImageFont F = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 30) out, W, H, ms = sys.argv[1], int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]); f...
a6b937feb709c060f852ad5672b572e624db99f38e3faf2b03ecbd30333f11e6
Python
1,074
47
""" core Created by: Martin Sicho On: 21.04.22, 22:03 """ from rdkit import Chem from drugex.molecules.interfaces import Molecule class InitializationException(Exception): pass class DrExMol(Molecule): def __init__(self, rd_mol, identifier=None): if not rd_mol: raise InitializationExc...
4d07b5c02ee17bc4ce24beb3b403440a0b8a4758a843c95859192ba033d8ffc5
Python
1,076
52
"""Get inferred parameters. """ from sys import argv if len(argv) != 3: print("Please pass the number of modes and run id, e.g. python 3_get_inf_params.py 6 1") exit() n_modes = int(argv[1]) run = int(argv[2]) #%% Import packages import os import pickle import numpy as np from osl_dynamics.data import Data...
5ac48c8ca3b3af7b735b57bb677648c622e33da2222174d202b56d918dfba586
Python
1,077
27
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from itertools import chain from numpy.testing import assert_array_equal from eelbrain import datasets, epoch_impulse_predictor from eelbrain._trf.shared import RevCorrData def test_segmentation(): ds = datasets.get_uts() n_times = len(ds['uts'].time)...
c2df004dc04f140f21f2bc9ad32a185593f05fd54a0694b8fbf29fe81feb7511
Python
1,078
24
#################################################################################################### # Copyright (c) 2019, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free softwar...
119232aaa3fe02c051605a307629afeeb46b9a51efedac331096e653d94f1bf3
Python
1,079
35
import torch.nn as nn from .registry import PADDING_LAYERS PADDING_LAYERS.register_module('zero', module=nn.ZeroPad2d) PADDING_LAYERS.register_module('reflect', module=nn.ReflectionPad2d) PADDING_LAYERS.register_module('replicate', module=nn.ReplicationPad2d) def build_padding_layer(cfg, *args, **kwargs): """Bu...
5f41ecce7442d6832658879c565e34b10480d80a1989e9215d0cbe6d7b087fd0
Python
1,081
20
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
ca985711a983b896baf8e8eb09974087692f0b33013ed18666c43bc0b2bebea1
Python
1,081
38
from PrognosAIs import Pipeline import evaluate_model from PrognosAIs.IO import ConfigLoader import argparse from slurmpie import slurmpie import os import sys from glob import glob model = sys.argv[1] input_folder = sys.argv[2] output_folder = sys.argv[3] config_file = sys.argv[4] # make label file, stupid requireme...
64ed2cf7d24c543339db612b1dc9d3dc307a6830a10aa4c1a0ea4cc890c2a3da
Python
1,082
41
from snakemake.shell import shell import pysam log = snakemake.log_fmt_shell(stdout=True, stderr=True) sort_cmd = "" fq1=snakemake.output.fastq1.split(".gz")[0] fq2=snakemake.output.fastq2.split(".gz")[0] bamtofastq_cmd = ( " bedtools bamtofastq -i {snakemake.input.bam_file} " "-fq {fq1} " "-fq2 {fq2}; ...
8f178377073bf7f839ed11cb5a6ac9ca381a71d6781aeeb3bbe4a99bfca38a02
Python
1,082
34
from abc import ABC, abstractmethod from torch.utils.data import DataLoader from moses.utils import set_torch_seed_to_all_gens class MosesTrainer(ABC): @property def n_workers(self): n_workers = 1 return n_workers if n_workers != 1 else 0 def get_collate_device(self, model): n_wor...
e5667e438b8b75fc4a9ad22b3a0e66759817f121239b4946002877a013ea16dd
Python
1,082
36
# -*- coding: utf-8 -*- """ @author: Satoshi Hara """ import sys sys.path.append('../') import numpy as np from AlternateLinearModel import AlternateLogisticLasso from sklearn.datasets import fetch_20newsgroups from sklearn.feature_extraction.text import TfidfVectorizer # get news20 data (science) categories = ['sc...
e758a3773cfb19689f4b9b2b32d498731bc3d01da7655a6dec6da442c13feed1
Python
1,084
35
""" © 2022, ETH Zurich """ import json import os ROOT_PATH = os.path.dirname(os.path.dirname(__file__)) DATA_PATH = os.path.join(ROOT_PATH, "data") PROC_DATA_PATH = os.path.join(ROOT_PATH, "proc_data") FOLDER_NAMES = {"az": "az_set", "inhouse": "inhouse_data"} MODEL_FILENAMES = {"rf": "rf.joblib", "lasso": "lasso.j...
80967dc06cf69d74480d301cf0a601af307cae3a3e701cc4d22463e018f8198e
Python
1,085
21
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
81748984adb6df0cb41d1504fd852ef239387c95d9a05133618ea2b930468152
Python
1,085
36
import torch import torch.nn as nn from torch.autograd import Variable def create_var(tensor, requires_grad=None): device = torch.device("cuda:" + "1") if torch.cuda.is_available() else torch.device("cpu") if requires_grad is None: return Variable(tensor).to(device) else: return Variable(te...
d3f4b4b29e9f20ec53e04c5124b72c9dfda3fa0035ee6584bc9823eacffd8792
Python
1,086
20
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
fdc7cb4d957c5059578002694dc9e30533df8dee4f86648acfcda3c3f775a783
Python
1,086
37
import argparse from scripts.experiment_1 import Exp1 from scripts.experiment_2 import Exp2 from scripts.experiment_3 import Exp3 from scripts.experiment_4 import Exp4 if __name__ == '__main__': parser = argparse.ArgumentParser(description='Optional app description') parser.add_argument('--exp', type=str) parse...
4cd170d498066f5803b31cb317932e9b3bee9f06f485a259ef5eac523125d287
Python
1,087
36
from typing import Any, List, Optional from zencfg import ConfigBase from .distributed import DistributedConfig from .models import ModelConfig, FNOGNO_Small3d from .opt import OptimizationConfig, PatchingConfig from .wandb import WandbConfig class CarCFDDatasetConfig(ConfigBase): root: str = "~/data/car-pressur...
3a3ff4ead30adbcf56008a56b45af5de92d3d408e825c8b080fc64ad697809b8
Python
1,088
29
# 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...
b870d512b648f4e788b3b3f147ac36dce5fd58a615237a6bb116a5e74c7697e0
Python
1,088
21
#################################################################################################### # Copyright (c) 2019, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free softwar...
ded12a3414a1092a64f3de9b9a4d8d490b4d9fdc80c44cd96aa04e17b6c802de
Python
1,088
21
#################################################################################################### # Copyright (c) 2019 - 2022, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
e77ebc67c84e530bb3f3428fce7901d2cf2a2e794c63b9d680777f80308235c0
Python
1,088
37
#%% import pandas as pd import numpy as np from pymaid_creds import url, name, password, token import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) # %% # dennotate / remove single annotation annot = 'something' pymaid.remove_annotations(pymaid.get_skids_by_annotation(annot), annot) # %% # deanno...
474ac354dae28235d9c6f49c1aaad29a9024e348115619b775308047715bf32c
Python
1,089
40
# global_vars.py: Global variables used by MaSIF -- mainly pointing to environment variables of programs used by MaSIF. # Pablo Gainza - LPDI STI EPFL 2018-2019 # Released under an Apache License 2.0 import os from IPython.core.debugger import set_trace epsilon = 1.0e-6 msms_bin= "" if 'MSMS_BIN' in os.environ: m...
a1b3853c62d85b6896a2758f992e8b6926f6fd0eb6937c9c8571b216e43e1c18
Python
1,089
42
import seaborn as sns import matplotlib.pyplot as plt colors = { 'ser': sns.color_palette()[0], 'som': sns.color_palette()[1], 'pyr': 'gray', 'fit': 'black', 'm': sns.color_palette()[2], 'h': sns.color_palette()[3], 'n': sns.color_palette()[4], '4AP': (207./255., 2./255., 52./255.), # ...
d0547e796bb9b7713b49a4916adc9af6595842ab9c8a2a46e3c00259f093c2ea
Python
1,089
34
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ from config import cfg import torch.nn as nn from math import sqrt import torch from torch.autograd.function import InplaceFunction from itertoo...
3c19020d69ea493b076bf67b95b5bf1dc33216164cc31d2706f1adface2d7487
Python
1,090
31
import random import torch from torch.autograd import Variable class ImagePool(): def __init__(self, pool_size): self.pool_size = pool_size if self.pool_size > 0: self.num_imgs = 0 self.images = [] def query(self, images): if self.pool_size == 0: retu...
420af966fef2f9e630b0fc6e809fb0918e8bf69e647a569b2410fd180cc78cf3
Python
1,090
30
import unittest from deeprank_gnn.GraphGenMP import GraphHDF5 class TestCreateGraph(unittest.TestCase): def setUp(self): self.pdb_path = './tests/data/pdb/1ATN/' self.pssm_path = './tests/data/pssm/1ATN/' self.ref = './tests/data/ref/1ATN/' def test_create_serial_with_bio(self): ...
61687f5f7980dddee03f0ab6c0e7f845fa7c6c3d08ddc254a5ee4314bebf1a13
Python
1,090
49
''' Figure 11. Shows snapshots of chemotactic trajectories. ''' from brian2 import * from pylab import * import matplotlib.font_manager as fm from plotting import * from matplotlib import gridspec from behavior import * import imageio import numpy as np fontprops = fm.FontProperties(size=18) width, height = 8, 3 dt = ...
67a7c67b7a9fe97d5078555b5d5b23e2254f7950b0d272406791298bd43eddc2
Python
1,090
37
import os import sys import numpy as np root_path = os.path.realpath("./") sys.path.append(root_path) import pytest # noqa E402 from hebbcl.parameters import parser # noqa E402 from utils import eval, choicemodel # noqa E402 def parse_args(args): return parser.parse_args(args) class TestSampling: def t...
652b44607dba9293b1ca7cbb173171c7bf91c54ef22f3385a0a0ac1e77c50fda
Python
1,091
26
# 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...
6dd534a67ec40c171099571045da9af5a00f6001c0b1845314364564dd78e617
Python
1,091
44
"""MedMNIST-NAS-Bench: tabular NAS benchmark on MedMNIST v2. Quick start ----------- >>> from medmnist_nas_bench import load_metrics >>> df = load_metrics("breastmnist", search_space="tiny") >>> df[df["epoch"] == 100].nlargest(5, "test_accuracy") Get raw predictions (for custom metrics) ------------------------------...
81601dac4f79daa4873d46d139b706769feae703f23c8abf5e2e82733e2706d1
Python
1,091
40
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the gradunwarp package for the # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## import logging VERSION = 'HCP-1.0.3' usage = '''...
845b2d16b51084cc7ec66ce735ab8f7f8d29bc9782e30578de39d235a2b3c4c9
Python
1,091
29
#!/usr/bin/env python # Copyright (C) 2011 Genome Research Limited -- See full notice at end # of module. # Create a Python logger with the right parameters. import sys import logging logLevel = logging.DEBUG logFormat = '[%(levelname)s] %(asctime)-15s [%(module)s %(lineno)d] %(message)s' logging.basicConfig( strea...
b76c72325a4423c04e7bc4c9d1998f2b4c66d2b45e591d69d40b571b24028890
Python
1,091
31
import pytest import numpy as np from numpy.testing import assert_almost_equal, assert_array_almost_equal from pycpd import gaussian_kernel, deformable_registration def test_2D(): X = np.loadtxt('data/fish_target.txt') Y = np.loadtxt('data/fish_source.txt') reg = deformable_registration(**{ 'X': X, 'Y': Y...
4c65b4d965c8811d310196c4a4b5bba8f626dd6ae5d2d2e851342e40e7a6dde1
Python
1,092
17
#!/usr/bin/env python3 """Insert captions under images: add_captions.py CAPTIONS.json [--root CARLA_ROOT] CAPTIONS.json maps page -> {image path as written in the page: caption html}. An image that already has a caption line under it is left alone. Use <code>/<b> inside the caption (it is already italic, so a nested <...
962c7c5cfc541234f417548049feb4cfe0275d1750f0f8c27294e83e11370fa9
Python
1,092
52
"""Get inferred parameters. """ from sys import argv if len(argv) != 3: print("Please pass the number of states and run id, e.g. python 3_get_inf_params.py 8 1") exit() n_states = int(argv[1]) run = int(argv[2]) #%% Import packages import os import pickle import numpy as np from osl_dynamics.data import Da...
09984a2009b4e2b8aee991d5c9d688557be09e93aedbd19d19d2ee343354c28a
Python
1,093
27
# 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 a...
e9986a14de24133b246081f7d078f7e0bb6b7e7f785c1d3a05c1aaac9b75cd4f
Python
1,093
50
# -*- coding: utf-8 -*- """ Created on Fri Mar 13 11:54:09 2020 @author: Sandi """ import pandas as pd import numpy as np from datetime import datetime from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPRegressor from sklearn import metrics import pickle import uuid df = pd....
eba16e8f911671d088cab3b07f1a5fda61635622c72bb7cc36fa25241030c61e
Python
1,093
37
from typing import Any, List, Optional from zencfg import ConfigBase from .distributed import DistributedConfig from .models import ModelConfig, GINO_Small3d from .opt import PatchingConfig from .wandb import WandbConfig class CarCFDDatasetConfig(ConfigBase): root: str = "~/data/car-pressure-data/processed-car-p...
0d98209319b6dba69425a8e4647f9be23a6ffb644bca83d2ae778d12987eef89
Python
1,094
37
import jax jax.config.update('jax_platform_name', 'cpu') import matplotlib as mpl;mpl.use('Agg') from matplotlib import rcParams rcParams['font.family'] = 'sans-serif' rcParams['font.sans-serif'] = ['Liberation Sans'] from matplotlib import pyplot as plt import corticostriatal as cs import numpy as np from functools im...
9958f0c4ecf2f53fb3ff2fa4efa0745fdaa903c5de41a92c69a517048a973d2b
Python
1,094
31
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch import nn class FrozenBatchNorm2d(nn.Module): """ BatchNorm2d where the batch statistics and the affine parameters are fixed """ def __init__(self, n): super(FrozenBatchNorm2d, self).__init__()...
1e28339ce611ab1b440f49b16c2f148e17d969ee94ed3b2f32baa5c3f68ab6ca
Python
1,096
50
# -*- coding: utf-8 -*- """ Created on Fri Mar 13 11:54:09 2020 @author: Sandi """ import pandas as pd import numpy as np from datetime import datetime from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPRegressor from sklearn import metrics import pickle import uuid df = pd....
2f36ea36d4a0d23b15ce468a7def86578ef17c8cc54b731e996f1f41aeb0a7f1
Python
1,096
50
# -*- coding: utf-8 -*- """ Created on Fri Mar 13 11:54:09 2020 @author: Sandi """ import pandas as pd import numpy as np from datetime import datetime from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPRegressor from sklearn import metrics import pickle import uuid df = pd....
3664abe70818bbbf31e21fb8b49b8adb6a400a3c6f3eef0ebd0e28e6be42612e
Python
1,097
40
import matplotlib.pyplot as plt import numpy as np from polychrom import forcekits, simulation, starting_conformations sim = simulation.Simulation( platform="cuda", # Switch to platform="OpenCL" if you don't have cuda integrator="variableLangevin", error_tol=0.003, collision_rate=0.04, N=8000, ...
56c4f69c14cac7d4ebe6f963825972a0a522dd04bba203f18ed8e079dc09b73a
Python
1,098
28
import os import numpy as np import pandas as pd def calculate_degree_centrality(embeddings=None,recon_loss=None,logdir_FA=None): ## 3 options () # 1. Distance from origin in gene embedding if embeddings is not None: siVAE_gene_score = -np.sqrt(np.square(embeddings).sum(1)) # 2. Reco...
7325b3cfc36b2d0a40554845ab2bf8f5813ecd20ad696396d4df9d275c5cfcef
Python
1,099
53
"""Get inferred parameters. """ from sys import argv if len(argv) != 3: print("Please pass the number of states and run id, e.g. python 3_get_inf_params.py 8 1") exit() n_states = int(argv[1]) run = int(argv[2]) #%% Import packages import os import pickle import numpy as np from osl_dynamics.data import Da...
fc62d2222c139cc5460f71566479e2caba962ab7c9fb709fc59b086f8153dba4
Python
1,099
32
import torch from mmdet.models.registry import BACKBONES from .fna_base_backbone import BaseBackbone @BACKBONES.register_module class RetinaNetBackbone(BaseBackbone): def __init__(self, search_params, output_indices=[2, 3, 5, 7]): super(RetinaNetBackbone, self).__init__(search_params, output_i...
3d604eefc1d84bf5352fbb52dc3b2e2252fa3b39e804ca02c405b498ce7627af
Python
1,100
32
from .atss import ATSS from .base import BaseDetector from .cascade_rcnn import CascadeRCNN from .cornernet import CornerNet from .fast_rcnn import FastRCNN from .faster_rcnn import FasterRCNN from .fcos import FCOS from .fovea import FOVEA from .fsaf import FSAF from .gfl import GFL from .grid_rcnn import GridRCNN fro...
ecf4e4008b8c6eae71a45657d787430ed3c516c0b72869563e2b532bf2ea5324
Python
1,101
20
#################################################################################################### # Copyright (c) 2019, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free softwar...
f66e539164b13a17ce0f936c3d5ead5ba140562fcd4a6582b64ceae325b9c26a
Python
1,102
34
import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_absolute_error, mean_squared_error, mean_absolute_error from pandas.api.types import is_string_dtype, is_numeric_dtype, is_object_dtype, is_cat...
041637fafa6a2e0e766bc4ba5c7d39e92195ddafcd7eec2b8d30d1d5f28c0571
Python
1,105
40
################################ ### Some tools ################################## import numpy as np def stokeeinstein(radius,kb=1.3806488e-23 , Tcelsius= 35, viscosity=0.693e-3 ): """ Compute the diffusion coefficient from the radius of the particle using the stokes-einstein relationship. """ ...
1e68d3144b619f14c2e5bb7de6f2e96f45b7b8d12d7a008c44e485d00e4bc465
Python
1,105
28
import tqdm import ipdb import argparse, sys; sys.path.append('../..') import random as rand import torch from graphxai.gnn_models.node_classification.testing import GIN_3layer_basic, GCN_3layer_basic, GSAGE_3layer def get_model(name): if name.lower() == 'gcn': model = GCN_3layer_basic(16, input_feat = 11...
43485cdbf3c0da4658646e2e7614423474c837601f85a6ade634db44a8db6abc
Python
1,105
28
import os, sys; sys.path.append('..') import torch from torch_geometric.datasets import TUDataset from graphxai.explainers import IntegratedGradExplainer #from graphxai.explainers.utils.visualizations import visualize_mol_explanation from graphxai.gnn_models.graph_classification import train, test from graphxai.gnn_mo...
a8f95a09dd8ce7610e560a38e9c14de614cfc2f862b946126144c0d61f9d16b7
Python
1,105
32
from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.loggers import WandbLogger from datasources import paths_manager class TrainerCallbacksFactory: @staticmethod def create_earlystopping() -> EarlyStopping: return EarlyStopping(monitor='val_loss', ...
c57e6a88faff8128b06a8313aa864052f17320ec38164a0c7f86700266d7dfaa
Python
1,106
27
from scripting.spectrum.dataset import extract from scripting.spectrum import metadata from scripting.spectrum.metrics import band_powers from scripting.spectrum.io import persist DPATH = '/home/guest/Desktop/dataset_pickles/new/8wp3/dataset.pkl' GROUP = 'b' #or 'b','c','d' CHS = [0, 1, 2] BANDS = [(1,4),(4,8),(8,13),...
4b5984ec23c5ffc87221f6a9db4353f3d1f4c19ae376a9b2dc80e168b87786fc
Python
1,107
27
import torch import wandb from pytorch_lightning import Callback class ImagePredictionLogger(Callback): def __init__(self, val_samples, num_samples=32): super().__init__() self.num_samples = num_samples self.val_imgs, self.val_labels = val_samples def on_validation_epoch_end(self, tra...
58ac9d7044e64e69a4db9921d70566832261964e4ca51063781f05478ee9fc55
Python
1,107
45
import csv import os import sys def read_cases(path): cases = [] outcomes = [] headers = [] with open(path, 'rb') as csvfile: reader = csvfile.readlines() n = len(reader[0].split()) for i, row in enumerate(reader): cases.append(row.split()[1:]) outcomes.a...
f1fce7fd6dc7100179c898208f7e95635afb2cd1e298f310f3c4a2ca918ebe8a
Python
1,108
31
__author__ = 'duarte' """ =========================================================================== Modules Package =========================================================================== Collection of modules comprising all the tools and objects necessary to set up complex network simulations, input properties,...
1564a02f8f2b6e7378157222a294a556a74530685d237d51b791984219fc4ba4
Python
1,110
20
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This library is free ...
63a323b70447798ad0a3ef42ac6cf62ce3c83a23bcb8a4e6756600ad52ac29e1
Python
1,110
28
import os, sys; sys.path.append('..') import torch from torch_geometric.datasets import TUDataset from graphxai.explainers import IntegratedGradExplainer #from graphxai.explainers.utils.visualizations import visualize_mol_explanation from graphxai.gnn_models.graph_classification import train, test from graphxai.gnn_mo...
8d8d2c26be73878df66e3cbce95bd3451acdf378379e5ae5dff71d71988eca56
Python
1,110
21
# # Copyright (c) 2018 Institute for Basic Science # # 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, modify, merge...
c4741e554884ee901d9dcf6df229ef26f82d49fef831004aed71ce69879b9220
Python
1,110
43
import os import json import pandas as pd import pickle def handle_dir(path): if not os.path.isdir(path): os.mkdir(path) def export_json(dict, path, print_json=False): with open(path, "w") as outfile: json.dump(dict, outfile, indent=4) if print_json: print("config") print...
a05af4202594450955e5a9d1990a50d00082acc9b970e1f381c488d6db89118d
Python
1,113
28
import os, sys; sys.path.append('..') import torch from torch_geometric.datasets import TUDataset from graphxai.explainers import IntegratedGradExplainer #from graphxai.explainers.utils.visualizations import visualize_mol_explanation from graphxai.gnn_models.graph_classification import train, test from graphxai.gnn_mo...
059380f46693f256be1485251ed551bb0ce0429b3474b91b6fec569d6f5a6728
Python
1,114
29
import numpy as np import matplotlib.pyplot as plt x, y = np.loadtxt('TSSA_tri_trace_1D.dat', unpack=True, usecols=[0,1]) plt.plot(x, y, label="1D diffusion", color='blue', linestyle='solid', linewidth = 4, marker='o', markerfacecolor='blue', markeredgecolor="navy", markersize=12) x, y = np.loadtxt('TSSA_tri_trace_2...
714d3b91daa551ad75f83ee116312924c28e08eaf968bc79de0bf18988115b5e
Python
1,114
46
import numpy as np import carpet import carpet.lattice.triangular as lattice ## Parameters # Geometry nx = 16 ny = 16 # even number N = nx * ny a = 18 # [um] lattice spacing ## Initialize # Geometry distances = [1] # pre save coordinates try: coords = np.load('coords.npy') lattice_ids = np.load('lattice_i...
8793ae6efa40b3ac3f07d5bb5dcb644591e7a11c5fed27feadd2a634a8337e2a
Python
1,114
39
# This updates usage/config.rst to the latest cli # Developers can run this after modifying any arguments the user can see from AFQ.utils.bin import func_dict_to_arg_dict, dict_to_toml prologue = """ The pyAFQ configuration file ---------------------------- This file should be a `toml <https://github.com/toml-lang/t...
a6cf8939f60c4cd3ac8c68ef0b4048b163265f1cf86d1840c13f09ccade64531
Python
1,114
37
# Resume all interrupted trainings in yolov5/ dir including DDP trainings # Usage: $ python utils/aws/resume.py import os import sys from pathlib import Path import torch import yaml sys.path.append('./') # to run '$ python *.py' files in subdirectories port = 0 # --master_port path = Path('').resolve() for last ...
3d602fb49fb07d965ab322f97cc9469bb954f3592191b11443fa8162575fd3a0
Python
1,115
28
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from numpy.testing import assert_array_equal, assert_array_almost_equal from eelbrain import datasets from eelbrain.mne_fixes import _interpolate_bads_meg from eelbrain.testing import requires_mne_sample_data @requires_mne_sample_data def test_interpolation():...
770e656c073faa7405b805ea5b5febc341855a67f3ca471cb016cd4cd404f63e
Python
1,116
22
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
a8e7544e0a46d59a91bce6b74fd06ee85eebc99adb332d1a37848cdc03fec540
Python
1,116
21
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
63453cfc22f7da2064c7fb12d6a97c94e6d82e4f040df3ef13cea5a6a2b40444
Python
1,117
33
from dataclasses import dataclass from typing import Iterable from linkml_runtime.dumpers import json_dumper from oaklib.datamodels.obograph import GraphDocument from oaklib.interfaces.obograph_interface import OboGraphInterface from oaklib.io.streaming_writer import StreamingWriter from oaklib.types import CURIE @...
1a7a6059fda882be771eaf7922416b9a2224bc32c9b92a9e8c755f7928804da4
Python
1,118
30
# 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...
47e54360dca8d620dec7b484ebb20fedf7c5c94ee4cf638dc0f237a972a29e83
Python
1,119
21
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
9089d46bf56050acf1a8bd94580e4e3201230c9dc1fcdd9246d004a17beaf0a1
Python
1,119
39
import argparse import os import gzip parser = argparse.ArgumentParser(description='Check if genes in first column have a version number and if so, remove') parser.add_argument('matrix', help='Matrix to remove versions of genes (inplace)') args = parser.parse_args() if not os.path.exists(args.m...
e9e062c2d35fe7a15574fff9c045ce484920674159dc0135772431f521d251b3
Python
1,120
27
# 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...
1ae63a2327e53cd469934bd118dba137dda2c00fbff9083e4e03bce27429ba30
Python
1,121
33
import numpy as np import nibabel as nib import sys import os from utils import largestAfterOpen from scipy import ndimage img_name = sys.argv[1] template_name = sys.argv[2] roi_th = int(sys.argv[3]) print(f'roi_th: {roi_th}') f_name = img_name.split('/')[-1] out_path = img_name.replace(f_name,'') img = nib.load(img_n...
8aad232bb1926affdec7e4a895020787171d3fde45359f9784495e1b3596dd2d
Python
1,121
55
from abc import ABC from typing import Dict, List, Tuple, Iterable from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface from oaklib.types import CURIE, LABEL, URI from rdflib import Graph class SkosInterface(BasicOntologyInterface, ABC): """ presents ontology as simple SKOS vocabular...
79e30ebbb7a57b5c819b7336d34c9335be5295fba9591f9bdfe38e50af83074b
Python
1,123
34
""" scorers Created by: Martin Sicho On: 03.06.22, 13:28 """ import numpy as np import pandas as pd from rdkit import Chem class SmilesChecker: @staticmethod def checkSmiles(smiles, frags=None): shape = (len(smiles), 1) if frags is None else (len(smiles), 2) valids = np.zeros(shape) f...
7b65bb7cab755a62df43d25c78c890a3a3d0d441b8c99145f9693a7ad82ac6fb
Python
1,125
41
from sklearn.cluster import KMeans import numpy as np import csv import os import sys if __name__ == '__main__': path = 'Justice.csv' justices = [] ideology = [] qualification = [] with open(path, 'rb') as csvfile: reader = csv.reader(csvfile, delimiter=',', quotechar='"') for i, ro...
9969afed5e91b63d9b85f5edcce42027309b71306fff637be0b26ac87982f1dc
Python
1,125
36
import unittest from typing import Any, List, Type, Union from oaklib import BasicOntologyInterface from oaklib.io.streaming_csv_writer import StreamingCsvWriter from oaklib.io.streaming_json_writer import StreamingJsonWriter from oaklib.io.streaming_writer import StreamingWriter class AbstractDatamodelTestCase(unit...
3220b3184e1197ace7799d09e7d325886e52e2d2c6e55300b9d3cccebc93ccd3
Python
1,126
35
""" EQUATIONS: Documentation """ from brian2 import Equations, units ########################################### # CELLS Equations ########################################### eqs_LIF = Equations('''dvm/dt = ((El - vm) + I_synEX + I_synIN + I_noise)/tau : volt (unless refractory) I_noise : volt ...
618632ecf8f5f6d6d404adb8a64e4d7c4f08f1ca206e94c830ba5da2d27b1376
Python
1,126
38
import numpy as np import os, sys, brian2 nrun = int(sys.argv[1]) rate = int(sys.argv[2]) brian2.seed(nrun) print ('RUN: ' + str(nrun)) foldername = 'rate'+str(rate)+'/run_'+str(nrun) os.system('mkdir -p -v '+foldername) N = 10000 # number of neurons time_input = 4000 * brian2.ms # simulation time P = brian2.Pois...