sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
99ffb34ce94a493b5c52e8846951787aecb1857c63d9da95771819438197e2d9
Python
4,458
120
"""Functions for processing and visualization. This module contains mandatory functions to run different preprocessing / postprocessing steps on input fMRI images.""" import numpy as np import operator import torch.nn as nn from typing import Tuple, Union from nilearn.masking import unmask, apply_mask from nibabel.n...
a4c29bda552b23027dc1fb3bd6a6d6592bc00f8f9320528c6152b4913c3b74f8
Python
4,458
130
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ inspect_simulation.py --------------------- Script to plot simulated network activity of 2D rate model of motor cortex, see paper Kang, Ranft & Hakim. eLife (2023). To load specific simulation output change parameters/ filename accordingly. Created March 2023 Auth...
d2c3d10e173ca79fd0180664b7d98a079656317bf864188cb42b5d42f5b6f37b
Python
4,458
130
import matplotlib as mpl; mpl.use('Agg') from matplotlib import pyplot as plt from matplotlib import lines as mlines import numpy as np import pandas as pd from scipy import stats def evidence(h,q,ylast): n = ( (1-h) * np.exp(ylast) + h ) d = ( h * np.exp(ylast) + (1-h) ) y = np.log( q ) + np.log( n / d )...
d82922cd230d1f7fe789df4da385d80c945cbafb191b71e37c548c48fe7a02c3
Python
4,458
123
import torch from norse.torch.functional.lif import LIFState from norse.torch.functional.lif_adex import LIFAdExState # from norse.torch.functional.lif_adex_refrac import LIFAdExRefracState from norse.torch.functional.lif_refrac import LIFRefracState from norse.torch.functional.lsnn import LSNNState class InitialSta...
97377624d56f6bba2a1370e6920976ae32bf62b6e01515345192bc404e15d63a
Python
4,460
129
import os, sys import argparse, random import numpy as np import torch from tqdm import tqdm from utils import get_model, get_exp_method, get_dataset from graphxai.datasets import Benzene from graphxai.explainers import PGExplainer from graphxai.utils.performance.load_exp import exp_exists_graph from graphxai.metrics...
23618a0c83c2916db2115c0cbf7c1084bc149dd04c48fadae6f4fddff5fc4b96
Python
4,461
114
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 29 15:32:08 2021 @author: tonifuc3m """ import argparse import warnings import pandas as pd import os import compute_metrics from utils import load_entities_dict, prepro_relations, \ format_relations, get_chemical_gene_combinations, filter_pre...
146f8a35f81dad7e4a03ad24a2d20a2f337b616c801a4e99fdc143ca609a284d
Python
4,462
94
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 PYCHARM_EXEC = os.getenv('PYCHARM_EXEC') == 'True' import numpy as np import tensorflow as tf from tensorflow.keras.callbacks i...
0757f94734deb0e51ad47cfd72c9ac545ffbf2786897fc04e966b45460c31026
Python
4,465
101
# 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...
188f5972fe3d322c03258b1dd5baecc933e93704d065e217f1746f9c1b6fe110
Python
4,466
140
# Copyright 2019 The TensorFlow Authors, Pavel Yakubovskiy. 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 ...
504d52a03f23b891aadf76e26f9c7e4c771fe5aacc68e9d4874a5451ab15e300
Python
4,466
113
from collections import defaultdict import logging from typing import Dict, List from .predict import predict from chemprop.data import MoleculeDataLoader, StandardScaler from chemprop.models import MoleculeModel from chemprop.utils import get_metric_func def evaluate_predictions(preds: List[List[float]], ...
e413a8b534e4c3426a2e9c23ba0157d494760c80f3b980fad6ca930707ede7ab
Python
4,466
135
import os from scipy.ndimage.measurements import label from tqdm import tqdm import torch.nn as nn import torch import matplotlib.pyplot as plt from sklearn.metrics import accuracy_score from sklearn.metrics import precision_score from sklearn.metrics import recall_score from sklearn.metrics import f1_score ...
7a376f6c35e06c1f6a5a39421b70bed1f16a932035747829f8af8a92c4f9e91f
Python
4,467
127
# 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...
00022c4621b27c3420513b02dccce064c8571d1ee1807ad9c9bd086b3cd9cd0f
Python
4,468
125
import torch from torch import nn class KeypointPostProcessor(nn.Module): def __init__(self, keypointer=None): super(KeypointPostProcessor, self).__init__() self.keypointer = keypointer def forward(self, x, boxes): mask_prob = x scores = None if self.keypointer: ...
a270b173002147a49316a1a55302b3323ab95a6541211d0946876d854b721b3d
Python
4,469
100
from typing import Tuple import numpy as np from scipy.linalg import solve_banded from .sim import SimGrid from .typing import Shape, Size, Spacing, Optional, Union, Size3 class BPM(SimGrid): def __init__(self, size: Size, spacing: Spacing, eps: Union[float, np.ndarray] = 1, wavelength: float =...
d277f66858b73519961832c64da67ecaa44352ad060607e2ee6a88791ff30c64
Python
4,469
155
import os import numpy as np import warnings import sys from numpy.testing import assert_array_equal, assert_equal, assert_raises from bruker2nifti._getters import get_stack_direction_from_VisuCorePosition def test_get_stack_direction_from_VisuCorePosition_OK_dummy_multiple_cases(): visu_core_position_ = np.arr...
f65d5ac88062ae9d17408b849a3ceb7cc12c0b05a2387db0404e6be355042135
Python
4,470
127
#!/usr/bin/env python3 """ File: search_dataframe.py Created: 2020/07/16 Last Changed: 2020/07/17 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free So...
145c363a5ea5bfac8e2a36a844a6b20e24ca6ff6a9db8c7c197c39e0bae99179
Python
4,471
93
import torch from mmcv.runner import OptimizerHook from mmdet.core.utils.dist_utils import allreduce_grads from collections import OrderedDict import torch.distributed as dist from torch._utils import (_flatten_dense_tensors, _unflatten_dense_tensors, _take_tensors) class ArchOptimizerHook(...
52fb9fc9b35ec795494bb8b03ea2360efa4aa959901f34d3573a0c822677e44f
Python
4,471
133
""" corpus Created by: Martin Sicho On: 26.04.22, 16:47 """ from rdkit import Chem from drugex.logs import logger from drugex.data.corpus.interfaces import Corpus from drugex.data.corpus.vocabulary import VocSmiles, VocGraph class SequenceCorpus(Corpus): """ A `Corpus` to encode molecules for the sequence-b...
f74cc205b67d36ed00e62c2829cce0cf045f6892cc02776740a5b01cb3b1d97a
Python
4,471
135
""" Copyright (c) 2019, National Institute of Informatics All rights reserved. Author: Huy H. Nguyen ----------------------------------------------------- Script for testing segmentation of ClassNSeg (the proposed method) """ import os import torch import numpy as np import torch.utils.data import torchvision.datasets...
b4932708e14af527f32be23978610bb20d09f252214d73930e863de733ed9911
Python
4,472
130
# making rmats jobs directly from bam files, don't need to convert cram to bam like original import argparse import glob import os parser = argparse.ArgumentParser(description='Generate rMATs files.') parser.add_argument('output_directory', help='Outputdir to write results to') parser.add_argument('jobs_directory', he...
2c0bbb50f45d5e2432caea2505f93299f39d2667e4859975d9808a4bdd7430b1
Python
4,473
128
# 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 ...
4bd2c9f47ae6d48bea5c5db2433d77b6f6c0442d16ea21eb37241a657cd40064
Python
4,473
144
#!/usr/bin/env python3 # encoding: utf-8 # @Time : 2017/12/16 下午8:41 # @Author : yuchangqian # @Contact : changqian_yu@163.com # @File : BaseDataset.py import os import time import cv2 import torch import numpy as np import torch.utils.data as data class BaseDataset(data.Dataset): def __init__(self, sett...
7a278bdd85a564f4cbfa89b7bb83ef1d79eb42d572357f50ed551f9ff7df6cb0
Python
4,473
86
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # WMH Segmentation workflow # ========================== # # Exmple Usage: # ============= # from wmhpypes.workflows import ibbmTum_wf # from nipype.pipeline.engine import Workflow,...
e4a1d71c78534db242e96388bdf5afcd3913c6e794e27cd3f678213c146ee25b
Python
4,474
108
# 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...
7f4d87a3d99eceeae46ca24adf0bb7f7a480083991abe9cb614b496b16e7c435
Python
4,478
121
"""Phase 2: AIF agent on the same CS+/CS- conditioning task as the RPE baseline. Same substrate (Winding connectome PN->KC wiring), same task, same seed. Plots a head-to-head comparison: MBON readout (m_hat) and DAN signal, RPE vs AIF, for CS+ and CS- across trials. Expected results: - Both models acquire CS+ cor...
9e10bf0a592e19e5814502f54eb29f77e0b8d3a8f2ea0c342ed2317a85839d1a
Python
4,480
128
# 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...
dd332d370bd86b9a9ef3d34c5e03097b1a05e7b18d6e551b34060cd7db954f3a
Python
4,480
83
"""Render lidar / semantic lidar / radar captures of gallery.py into doc images.""" import json, math, os, sys import numpy as np from PIL import Image, ImageDraw import matplotlib; matplotlib.use("Agg") import matplotlib.pyplot as plt D = sys.argv[1]; OUT = sys.argv[2] meta = json.load(open(os.path.join(D, "meta.json"...
a9f30864d34f4f2c9dc2825771d2f34bf9472c5c21a40c3ec4ff441504ad580d
Python
4,484
154
import os import ssl import pytest import requests def pytest_addoption(parser): parser.addoption( "--skipintegration", action="store_true", default=False, help="Skip integration tests." ) @pytest.fixture def skip_integration(request): return request.config.getoption("--skipintegration") def ...
dfdbfa09ff72cc6e8f60bb1f8e26724c775c2df70e4a8a0d919198880bb0887c
Python
4,485
119
import os from os.path import join import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import ShuffleSplit, GridSearchCV from sklearn.metrics import (mean_absolute_error, mean_squared_error, ...
93a9519756a38ce7cb7e460a7f82349d1da9466b2f5f485969f0ed5e9f416837
Python
4,487
162
__author__ = 'jieqing jiao' __email__ = "jieqing.jiao@gmail.com" import numpy as np from scipy.interpolate import interp1d import matplotlib.pyplot as plt def dt2mft(dt): mft = np.mean(dt, axis=0) return mft def dt2tdur(dt): tdur = dt[1, ] - dt[0, ] return tdur def mft2tdur(mft): # print('min...
7c4b6310df2fcc98fa042b5afd07e7f160e11dfdc3690fad54107cbaefe80f7b
Python
4,489
96
import tensorflow as tf import numpy as np from Utilities import cdist_tf_batch, A KC = 1389.35457644382 permutation_mask = np.array([-1., 1., 1., 1., -1., -1., -1., -1., -1., -1., -1., -1., -1.]) mask = [] for x in range(3): for y in range(3): for z in range(3): base = np.zeros((3)) ...
9105e84e016aa71ce8e588b81d1e6b907191441e33da119e392481bdc034315d
Python
4,489
108
#!/usr/bin/env python3 """ File: translate_sample_ids.py Created: 2021/11/25 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software F...
e6f3cfe870b1ebb6b2a0d94def47c426c78fcaed8dce3478ba64c8e7e8ec2f8c
Python
4,490
130
#!/usr/bin/env python3 """ File: eqtl_iterations_plot.py Created: 2020/04/27 Last Changed: 2020/04/28 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Fre...
d278310d1f0bd7d4a54b60e3bd073c7ed7849975c9b7562dda72d71dec60934e
Python
4,492
122
from utils.ArticlesProvider import ArticlesProvider from utils.decomposition import Decomposition from utils import Config import torch import spacy import ftfy import re import json from transformer.model_pytorch import TransformerModel, load_openai_pretrained_model, DEFAULT_CONFIG class TransformerDecomposition(Deco...
043cf90ee92310d2d7f28f15134b17971f35c5860cd9b8d8e661daa706977f0b
Python
4,498
101
import argparse import torch import torch.nn as nn import numpy as np import os import pickle from data_loader import get_loader from build_vocab import Vocabulary from model import EncoderCNN, DecoderRNN from torch.nn.utils.rnn import pack_padded_sequence from torchvision import transforms # Device configuration de...
c278afa310bb6a0fc3ad34dd288b26f7d21af8449dacd7c69d2dd2190c3b7e6e
Python
4,501
146
"""Labeling mitochondria and neurons by compartment (axonal, dendritic, somatic)""" from collections import Counter import numpy as np import pandas as pd from scipy.spatial import KDTree from scipy.sparse import csgraph import h5py from . import skel from . import u ENGLISHLABELS = { 0: "Somatic", 1: "Axonal",...
89aefe34ce212aa9a8e5d837482a61987efef20ce901cfc57f3f16ed0bded1f6
Python
4,503
189
# %% [markdown] # ## from src.hierarchy import signal_flow from src.data import load_metagraph from src.visualization import matrixplot from src.visualization import CLASS_COLOR_DICT from src.io import savefig import os from src.graph import preprocess import numpy as np import pandas as pd import matplotlib.pyplot as...
d1fc6be06ef00952c39510b1eddcf0f4533189ffa5378c68bcf605887baaf753
Python
4,507
116
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import numpy as np from numpy.testing import assert_equal, assert_array_equal import pytest from eelbrain import datasets, Celltable, testnd from eelbrain._stats import t_contrast from eelbrain._stats.stats import t_1samp from eelbrain._stats.t_contrast import T...
6ad9148c975d9d94f6bc87e4072dc150af3ddf7a12fc27b2af010d559a4c7252
Python
4,510
132
# correlateCLIP.py # 11/23/14 # correlates RT stops from two CLIP files (*noBlacklist_noRepeat.bed) # uses RT stop maker from FAST-iCLIP import csv, sys, collections, glob, os csv.register_dialect("textdialect", delimiter='\t') def separateStrands(mappedReads): # Usage: separate positive and negative strand...
8a7dc6f6c09c78f586caca7aa3a032ffdd4c9726cf0ce3c3ea56264da1b13b7d
Python
4,510
154
import os import torch import pandas as pd import torchtext import clip import pickle import torchvision.transforms.functional as tvf from functools import partial from torchvision.datasets.folder import default_loader from torch.utils.data import Dataset class CelebAHQ(Dataset): base_folder = "celebahq" im...
12836a074266b9ce6f0cff16c6262e8552a162442842d01ae1a3a6b23c749a78
Python
4,512
116
# Copyright 2021-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...
8ab25c290259f1cd4412591059cde414d0f29213a747b6d9004338cf47220325
Python
4,513
125
import os import glob import torch import random from PIL import Image from torch.utils import data from torchvision import transforms as T class data_prefetcher(): def __init__(self, loader): self.loader = loader self.dataiter = iter(loader) self.stream = torch.cuda.Stream() self.m...
9b4c11e48c24cb1f901b872ef11d647d593630a6a5391147a3d0a849016c3d03
Python
4,514
120
# Copyright (c) Open-MMLab. All rights reserved. import copy from torch.nn.utils import clip_grad from ..fp16_utils import allreduce_grads, wrap_fp16_model from .hook import HOOKS, Hook @HOOKS.register_module() class OptimizerHook(Hook): def __init__(self, grad_clip=None): self.grad_clip = grad_clip ...
b8044ad93dfc3b50ab748554c52fb60172c4b68c214d6dd075969fa160ba5d92
Python
4,514
123
import re import argparse import gzip from multiprocessing import Process,Pool parser = argparse.ArgumentParser(description='Compare eQTLgen to MetaBrain') parser.add_argument('meataBrain_eQTL_file', help='File with eQTL data') parser.add_argument('eQTLgen_eQTL_file', help='File...
946ac543116806e9c113baa646be2903bdeae9257f3704443443e328695833a9
Python
4,522
145
"""Transform a roidb into a trainable roidb by adding a bunch of metadata.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import pickle import datasets import numpy as np from model.utils.config import cfg from datasets.factory import get_imdb...
a42f6b89ed540b3b87250cfa9d6e065e716761fc8f77e7e01bd8048f834669be
Python
4,526
107
"""Load the Winding 2023 larval Drosophila connectome. Returns a sparse signed weight matrix plus per-neuron annotations. Signs are NOT in Supplementary-Data-S1 — see nt_signs.py for default conventions. """ from __future__ import annotations from dataclasses import dataclass from pathlib import Path import numpy ...
e52663096852c6d0e813f04d78a190e21b1757ae599974424e3e6eefd55297d6
Python
4,527
119
import numpy as np import RC class DualRC : def __init__( self, Name, Parameter ) : self.seed = Parameter['seed'] self.prosess_id = Parameter['id'] self.name = Name self.modelType = 'normal' self.path = Parameter['path'] + self.name + "_" Parameter['I'] = Parameter['RC1'] self.RC1 = RC.RC( 'RC1' , P...
739efc65bf241f222609f94d8f9af349f05f9769276c79e3db83c8283c50d185
Python
4,528
102
import numpy as np import scipy import scipy.stats import itertools class PSTH(): """ Computes PSTH for a given spiketrain and a list of events Arguments: - spiketrain: list of spikes [ms] (array-like) - events: list of events [ms] (array-like) - binsize: width o...
9cc5626bc54bc306fe0befc6f76dc8136f7bb1f73495a8930e86941f055f5fdb
Python
4,529
123
""" Tests physio_obj.py """ import numpy as np from phys2bids import physio_obj as po from pytest import raises # Tests is_valid def test_is_valid(): test_list = [0, 1, 1, 2, 3, 5, 8, 13] valid_output = po.is_valid(test_list, list, int) assert valid_output == test_list test_array = np.array([0, 1, 1...
5ecf3e04efb5ca58df07d93cc20bdbb7e9f42f881b32c2599def20527f25cd07
Python
4,530
134
# 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...
696a1392626ce0fd6755bc7c2c1c5353e3e8cf12121d8f23012a7637571f7103
Python
4,530
127
# Copyright 2021-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...
f87337858552afe5d2e54b1af88213600be46abacbc0b825e0d1131cd1ad5f2c
Python
4,532
167
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- import ...
706d28139a50130e59d873193eeb78e754c287bcd06c740a87b906cb422892a4
Python
4,533
117
import argparse import os.path as op from glob import glob import numpy as np import pandas as pd def _get_parser(): parser = argparse.ArgumentParser(description="Get subjects to download") parser.add_argument( "--dset", dest="dset", required=True, help="Path to BIDS directory...
c37dbd6db5a732a9f8d4e72be244ef6699d6fb4c25094ecdbf38c0ed84f2955e
Python
4,533
113
""" File: cmd_line_arguments.py Created: 2020/10/08 Last Changed: 2020/10/27 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, eit...
11525363d888179bc66232493dfe886155532824b473c2f85bbdb6773aa6f985
Python
4,535
129
import torch from transformers import AutoTokenizer, AutoModel, AutoConfig import pandas as pd import pickle import sys device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") print(device) clinical_bert = sys.argv[1] #change model name here if clinical_bert=='huang': tokenizer = AutoTokenizer.f...
99915bebc22bc05ad026e63ac7d657b44eb52313fc562112933393fa5f751347
Python
4,535
120
"""MobileNet""" import torch.nn as nn from models.baselines.base_model.basic import _ConvBNReLU, _DWConvBNReLU __all__ = ['MobileNet', 'get_mobilenet', 'mobilenet1_0', 'mobilenet0_75', 'mobilenet0_5', 'mobilenet0_25'] class MobileNet(nn.Module): def __init__(self, num_classes=1000, width_mult=1.0, dilated=False...
9f2abdc675d0859fac0e29aa4fee8b1be18e60264114b125c5aadc3fce070e23
Python
4,535
60
import bpy,bmesh,json from pathlib import Path import os from mathutils import Vector P=Path(os.environ.get('CARLA_MODEL3_WORKDIR',Path(__file__).resolve().parents[4]/'artifacts/tesla-model3'));D=P/'export';D.mkdir(exist_ok=True);(D/'textures').mkdir(exist_ok=True) bpy.ops.wm.open_mainfile(filepath=os.environ.get('CARL...
767cb38b5b529bb57872a030cd12a9aeb674c1f12b1fe3e211073e1a7fe6e899
Python
4,536
114
# 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...
2eeb263c044fb419269f450b51f65393a4cc5fcf0b6d4d6f61ce3177a2a5f828
Python
4,537
117
#!/usr/bin/env python3 # LAMMPS Documentation Utilities # # Scan for duplicate and unused anchor labels in documentation files # # Copyright (C) 2017 Richard Berger # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free ...
559193bdbb59d8cafb609aaaf188041226331df9aa9bc7dc34f5a23549068f90
Python
4,538
131
"""Dual Attention Network""" import torch import torch.nn as nn import torch.nn.functional as F from models.baselines.segbase import SegBaseModel __all__ = ['DANet'] class DANet(SegBaseModel): def __init__(self, classes=2, aux=True, backbone='resnet50', pretrained_base=True): super(DANet, self).__init__...
9521bd05966e8d7b49c1c089dfb419831ac4abe3bf0e79ed2e2845d663246c1f
Python
4,540
113
from Lif_Parameters import * def plot_raster(spike_monitor, preptime, simtime, filename, s=False, save=False): raster = figure(figsize=[5 * cm_fig_conv, 6 * cm_fig_conv], dpi=600.0) plot(spike_monitor.t / ms / 1000, spike_monitor.i, ",b") xlabel('Time (s)') xlim(preptime / second, (preptime + simtime)...
6d1932c56199455495ec277780dc4b731b2f417d2e48152d526a072f2125e6d1
Python
4,541
117
# Copyright 2021-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...
a9352cdec7e2f94ae455debef5b63e7a1d559342b2e804eefbf1c06294e11062
Python
4,542
118
# 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...
f10ec773ad3de97fa776a02ec8c84ad11422de6a49ade749b5d171665d1c9b12
Python
4,542
121
# basic imports import os import pickle import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection def generate_polygons(DR): P = [] for e, exp in enumerate(DR): a = int(e/121) s = e % 121 x = int(s/11) ...
fb3ce63b98ec6a0d16b156705303e14f398f46e45cfe806ca54c61f9962416c4
Python
4,542
134
import time import math import numpy as np def rectangular_crop3d(f, crop_ratio): half_x = f.shape[0] // 2 half_y = f.shape[1] // 2 half_z = f.shape[2] // 2 # print('half', half_x, half_y, half_z) x_crop = int(half_x * crop_ratio) y_crop = int(half_y * crop_ratio) z_crop = int(half_z...
391e0129be079da7cedda732ac9dd7bb22acb68cbc239bdc78dc9ebb366ba4c5
Python
4,547
126
from __future__ import division from torchvision import models from torchvision import transforms from PIL import Image import argparse import torch import torchvision import torch.nn as nn import numpy as np # Device configuration device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') def load_image(...
78ab7b575e683f8fddc8d127e2aaa6c4c73a607ca9ea0c560949f60ffb3db453
Python
4,547
128
# 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...
02b20ae96687189ec1e306e9278c01fd5c8fa7ff2ab86cc1b94842cbd8a96b46
Python
4,548
115
import warnings warnings.filterwarnings("ignore") import numpy as np import sys import os from Bio.PDB import * from sklearn.neighbors import KDTree from IPython.core.debugger import set_trace # Pablo Gainza 2019 - eval zdock results for comparison with MaSIF. def test_alignment(target_pdb_fn, source_pdb_fn, aligned...
1a5b754eb1db08f00ab5909d4da7ec3f5f219bd7133aa18fb23d7d05247c54b6
Python
4,549
167
__author__ = 'jieqing jiao' __email__ = "jieqing.jiao@gmail.com" import matplotlib.pyplot as plt import numpy as np from scipy.interpolate import interp1d def dt2mft(dt): mft = np.mean(dt, axis=0) return mft def dt2tdur(dt): tdur = dt[ 1,] - dt[ 0,] return tdur def mft2tdur(mf...
576526c7f12f0c2e29e3dc42e7262b2baf09d71e75d5ce84cb5d41d46bda45b0
Python
4,549
115
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import os from warnings import catch_warnings, filterwarnings import mne from mne import pick_types import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from eelbrain import load from eelbrain.testing import assert_dataobj...
aa0b544976eacf523234bdb8214fbb472463ad41d07f4664d282a2ef2726802e
Python
4,549
119
import torch from torch import nn # only import open3d if built open3d_built = False try: from open3d.ml.torch.layers import FixedRadiusSearch open3d_built = True except: pass # Uses open3d by default which, as of October 2024, requires torch 2.0 and cuda11.* class NeighborSearch(nn.Module): """Neig...
b4fe8c771198617357bc486c6e5215108dfe7a82383f71c63dcd3cd49a9193d8
Python
4,551
142
import numpy as np import pandas as pd from os import listdir, mkdir from os.path import isfile, join, exists from PIL import Image def directory(path): """Creates a directory if doesn't exist Args: path (string): location to create """ if not exists(path): mkdir(path) def check_ext(f...
c45716f8d6479d98b977e98075377c983f7928cbca33eee6780286c04313e674
Python
4,551
115
import warnings warnings.filterwarnings("ignore") import numpy as np import sys import os from Bio.PDB import * from sklearn.neighbors import KDTree from IPython.core.debugger import set_trace # Pablo Gainza 2019 - eval zdock results for comparison with MaSIF. def test_alignment(target_pdb_fn, source_pdb_fn, aligned...
629493cbd1a9a9c610413977fefe3c3273df0d0a5a92d2c2e22d031bd97f963a
Python
4,555
114
#!/usr/bin/env python3 """Visualise and validate the pedestrian navigation mesh (navmesh). CARLA does not expose the navmesh geometry directly, but every point it returns from get_random_location_from_navigation() lies ON the walkable mesh. Sampling many such points and drawing them paints the walkable area, and confi...
e2627e47fb38f82fdcbef98deefa3d746fa80178d83f9cf05f6891d553dc80b1
Python
4,555
153
""" StyleMapGAN Copyright (c) 2021-present NAVER Corp. This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, U...
8eb35b4553ab7a9ee0eeda231a22cd8270d545ba320ab113728e6641ca2744e0
Python
4,557
178
from pathlib import Path from typing import Any import numpy as np import pytest import rmsd # type: ignore[import-untyped] from conftest import RESOURCES from ppqm import chembridge, mopac, tasks from ppqm.utils.shell import which if not which(mopac.MOPAC_CMD): pytest.skip("Could not find MOPAC executable", al...
fc49838846780c4abcd3e44a494ac950664c6a4a82e04052d8630c5db579f575
Python
4,557
108
# 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 carla import unittest class TestVehicleControl(unittest.TestCase): def test_default_va...
14993c722cf6d25309d808ba0511f3575406840e500cc5bdf98e168109f74932
Python
4,560
110
from pathlib import Path from os import chdir import unittest from math import sqrt from nipype.interfaces.base import CommandLine from qipype.commands import NewImage, Diff, ZShim from qipype.fitting import ASL, ASE, ASESim, ASEDBV, ASEDBVSim vb = True CommandLine.terminal_output = 'allatonce' class Perfusion(unitt...
db57ef18f301ea23d373d9254e00b213797785866657aa5bb3bf7386c290acf0
Python
4,560
160
from ..utils import get_wandb_api_key, wandb_login from ..utils import count_model_params, count_tensor_params from pathlib import Path import pytest # Set warning filter to show each warning only once import warnings warnings.filterwarnings("once", category=UserWarning) # Only import wandb and use if installed wand...
7012e4d040ec767e665c8c3137f1849a547b50f061b59fc9a57976c461e33d52
Python
4,561
133
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch import torch.nn.functional as F from torch import nn from maskrcnn_benchmark.layers import ROIAlign from .utils import cat class LevelMapper(object): """Determine which FPN level each RoI in a set of RoIs should map to based ...
5fc885b3c8329353a4b5e743b0a61c07945b627440a2efc49604ee43c4bdcc2f
Python
4,562
105
# 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...
4793e22cc41cb6800a13657fea037f2e477a8db1b5d70c4091c09462cbf0e62e
Python
4,564
116
__author__ = 'jieqing jiao' __contact__ = 'jieqing.jiao@gmail.com' from pathlib import Path import nibabel as nib import numpy as np from tqdm import trange from ..kt import dt2tdur from ..tac import TAC from .regions import extract_regional_values def image_to_parametric(pet_image, dt, model_name, model_inputs, km...
b83281aa0421f47d61e50fc465c24e174cfa7d43bcc77d03211731e2207727e0
Python
4,565
133
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch import torch.nn.functional as F from torch import nn from maskrcnn_benchmark.layers import ROIAlign from .utils import cat class LevelMapper(object): """Determine which FPN level each RoI in a set of RoIs should map to based ...
badeeaea67a881443a397260f2e101e05ab158fa92375752e6ba49d9c13a53f3
Python
4,566
132
# 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...
ee16c7599560625af60e8bf53463de02c3c63d666f06515b9932ada0a93daa91
Python
4,567
116
""" Flywheel zip download support functions MIT License Copyright (c) 2017-2021 Mike Tyszka 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 ...
ef15a9d3f0b99bcf2a00965e51de48721493b27082f2f9b1a00d4cee75aa9d18
Python
4,568
104
import numpy as np from scipy.signal import butter, filtfilt from scipy.interpolate import interp1d import torch from sklearn.preprocessing import StandardScaler # Clip, filter, and time normalize all sigs in the dataset from one force platform. # Sigs object must be of shape (N, C, L): def clip_filt_norm(sigs, fz_th...
a2c56f42daa161999b2bdc6821b085c907f7b4ca83ce8121499c6c7bbb37d8b7
Python
4,569
120
"""Optimizes hyperparameters using Bayesian optimization.""" from copy import deepcopy import json from typing import Dict, Union import os from hyperopt import fmin, hp, tpe import numpy as np from chemprop.args import HyperoptArgs from chemprop.constants import HYPEROPT_LOGGER_NAME from chemprop.models import Mole...
e137657bd7b3f3310c19cabfcea94b80971e3627321a85bb40a26e1cc7782262
Python
4,569
88
"""Soften the legacy falling-rain sprites for the cinematic rain preset. Run with UnrealEditor-Cmd <project> -run=pythonscript -script=<this file> -nullrhi -unattended -nosound. Rewires M_Rain without deleting rooted nodes. The original particle system, world positions, and depth testing are retained. """ import unrea...
eaa6c4669be1ba25c6e78445c14a443f01a2e6e803bcebb8116e5c7f1395a509
Python
4,569
136
import gzip import argparse import os parser = argparse.ArgumentParser(description='Remove genes from expression file that have exact same expression levels (likely duplicates), are only found on scaffolds, or have duplicate names.') parser.add_argument('-g','--gtf', help='GTF file') parser.add_argument('-e','--expres...
9decbfe04da7017dbf43afe4998004e6f23e6e5ee37ff0f60e8b1cb7429c23ca
Python
4,570
129
# 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...
98b9acbd2ff20e20e72fea63326ff7e3f99aded80a45f7b7933a1cbf9d2c9b3b
Python
4,572
146
import logging import numpy as np import torch from sklearn.neighbors import KNeighborsClassifier from scvi import _CONSTANTS from scvi.core import unsupervised_clustering_accuracy from .scvi_data_loader import ScviDataLoader from scvi.core._log_likelihood import compute_elbo logger = logging.getLogger(__name__) ...
928f704add80feba41914182039212299ddd820bd07f1dbc5eedc3723b4c760e
Python
4,573
138
import math import numpy as np from einops import repeat import torch from torch import nn from .layers import * class StyleGenerator2D(nn.Module): def __init__(self, out_res, out_ch, z_dim, ch_mul=1, ch_max=512, skip_conn=True): super().__init__() self.skip_conn = skip_conn # dict key i...
21e10ef162927533be5f8e08ac670f47b5314227b86d2ac769d0bec23ac07fed
Python
4,574
115
import logging from typing import Callable from tensorboardX import SummaryWriter import torch import torch.nn as nn from torch.optim import Optimizer from torch.optim.lr_scheduler import _LRScheduler from tqdm import tqdm from chemprop.args import TrainArgs from chemprop.data import MoleculeDataLoader, MoleculeDatas...
f9d94aa0e0f89ea60287e112d8e03c692dd2c6aa81bd810c87f4a51b97b6bb5c
Python
4,574
118
import tensorflow as tf import numpy as np import time import os from Network.SR4DFlowNet import SR4DFlowNet from Network.PatchGenerator import PatchGenerator from utils import prediction_utils from utils.ImageDataset import ImageDataset def prepare_network(patch_size, res_increase, low_resblock, hi_resblock): # ...
2d7c497d5b1855768c3515cc42aab28b585f79876e5c7c91241fc134819f3f4b
Python
4,576
126
# 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...
178b69c907f5558f8d092a37e5d0e695537cfac2677ac431eb20b34b2e210ea3
Python
4,578
167
""" Implements second-order matrix vector product using R-op (forward-mode automatic differentiation) in TensorFlow. 1) Hessian 2) Fisher 3) Gauss-Newton """ import tensorflow as tf from tensorflow_forward_ad import logger from tensorflow_forward_ad.fwgrad import forward_gradients log = logger.get() def hessian_ve...
6c24389f613fb8846f857a437bd83ef11940fe02972d0b0757e4bce00bc937f1
Python
4,579
153
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ Miscellaneous utility functions """ import torch from torch import nn from torch.nn import functional as F from maskrcnn_benchmark.config import cfg from maskrcnn_benchmark.layers import Conv2d from maskrcnn_benchmark.layers.dcn_v2 import DCN ...
b54d635d2574befe0a7a523b6070f06f0132cedabe713bd65600dffd148d923a
Python
4,579
132
import numpy as np from sklearn.metrics import confusion_matrix from sklearn.utils.validation import check_consistent_length, column_or_1d from sklearn.utils.multiclass import type_of_target from sklearn.preprocessing import LabelEncoder from scipy.sparse import csr_matrix weights = np.array([ [1,1,2,3], [1,1,...
dd7c04d6e072453d2f9f3bc09b88d54bf71b1e77386314d198627ff355042069
Python
4,579
126
import os import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import numpy as np from subprocess import Popen, PIPE from IPython.core.debugger import * import sys from Bio.PDB import * from sklearn.neighbors import KDTree def test_alignment(target_pdb_fn, source_pdb_fn, aligned_pdb_fn, inter...
11317bbde6151cd94010182bb13a9843ae1e3b259d479f79e4465fbbd5479f22
Python
4,581
140
import argparse import os.path as osp import xml.etree.ElementTree as ET import mmcv import numpy as np from mmdet.core import voc_classes label_ids = {name: i + 1 for i, name in enumerate(voc_classes())} def parse_xml(args): xml_path, img_path = args tree = ET.parse(xml_path) root = tree.getroot() ...