sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
39af261ffb3c8b7c7f5a0c67f36d136f7196b6e38742d0afcef7019f48f61fbb
Python
3,358
94
import os import torch import argparse import numpy as np import esm from Bio.PDB import PDBParser from scipy.spatial.distance import cdist from biopandas.pdb import PandasPdb from data.loader import expand_sh from feature import create_basic_features from network.resEGNN import resEGNN_with_ne if __name__ == '__mai...
6a1673a5865d82137f43577454d502379194876be39ef6f749fd112482310654
Python
3,358
102
import os # import dask import numpy as np from scipy.spatial import cKDTree import glob from default_config.masif_opts import masif_opts """ precompute_evaluation_features.py: Precompute the features for the actual training from the 'decoy' transformations. Freyr Sverrisson - LPDI STI EPFL 2019 Released under an Apac...
9b7bc5ece5c4b6df0613b7196ec7c26b10ed1e83fbdcdc33a6300d1c5e13b682
Python
3,358
31
from .base_options import BaseOptions import sys class TrainOptions(BaseOptions): def initialize(self, parser): parser = BaseOptions.initialize(self, parser) parser.add_argument('--shuffle', action='store_true', required=False, help='Shall the data be shuffled?') parser.add_argument('--no_...
893650f76c9115c3bf0a73bb467cc94a488dec6879bd87678ca6ab751728cd4a
Python
3,360
82
"""Rank loop for Transfer 2.5 auto/multiview: ``MultiviewInference`` on every rank (see ``common.ranks``). NVIDIA ships 7 views on 8 GPUs; the worker starts ``torchrun --nproc_per_node N -m cosmos_workers.transfer25_av.ranks --context-parallel-size N`` with N = the GPUs given to the worker (independent of the number o...
f0f28a97237beb3ccfcc8330af416e70123939f28060f4955c8b81859914474d
Python
3,360
50
import sys sys.path.insert(0, '.') from svgkit import Svg, C, render_png W, H = 1260, 640 s = Svg(W, H) s.text(W / 2, 44, "CARLA client-server architecture", size=26, weight="bold", anchor="middle") s.text(W / 2, 72, "Default ports shown; the streaming and secondary ports follow the RPC port (N, N+1, N+2)", size...
34c1033eb7218eefaa8a27a4b782df27c882d40f20ca364886222294fe2aa935
Python
3,361
90
# 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>. """Smoke test for the large-vehicle junction handling. Spawns a known-large vehicle (firetruck or b...
44abad5504a92131b37f7d13eb6b55005168e278cb2afe5ef30f9e9da7f1a344
Python
3,361
89
# 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...
2d5b1aeec7e17307dc89bf1f71b6bb4cf2d752516552642053fa68aa2fb77615
Python
3,362
100
import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms # Device configuration device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') # Hyper parameters num_epochs = 5 num_classes = 10 batch_size = 100 learning_rate = 0.001 # MNIST dataset train_dataset = ...
3b74e42d9e69ad4b0e7440ae8e5d4c450e799cbbfd0bd67c860255add526e725
Python
3,362
118
''' Logistic Regression Model trained on the t5 embeddings ''' # libraries import pandas as pd import numpy as np from sklearn import preprocessing import biovec import math import pickle from sklearn.model_selection import train_test_split, KFold, cross_val_score, StratifiedKFold from sklearn.preprocessing import S...
5f66a413d832e1ff4dce7705362ab12fbefbdbd8f52398e05a0693413d3ccd97
Python
3,362
108
import cv2 import numpy as np import random # Check if a point is inside a rectangle def rect_contains(rect, point): if point[0] < rect[0]: return False elif point[1] < rect[1]: return False elif point[0] > rect[2]: return False elif point[1] > rect[3]: return False ...
af49078de69523d088e4fc3d4dfbd8e7ad846a2fd42ac671ae3c16d61de9c489
Python
3,362
138
"""Example script for running DyNeStE on simulated HMM-MVN data. This script should take less than a couple minutes to run and achieve a dice coefficient of ~0.99. """ import os import pickle import numpy as np from osl_dynamics.simulation import HMM_MVN from osl_dynamics.data import Data from osl_dynamics.models.dy...
cc1e57a42050d4e3e9d7113abf22f68111d308adc53ec201c889425816bdf277
Python
3,366
95
# 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...
21775d9f522cdaf91d42a6f1ec4cd66e4feda1e8e6e0f01b2bf22485f429e4f6
Python
3,367
95
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import math import torch class BoxCoder(object): """ This class encodes and decodes a set of bounding boxes into the representation used for training the regressors. """ def __init__(self, weights, bbox_xform_clip=math.log(1...
efdf74917df7fc764d10b9a845b4701be88d97f8ac20a57b447a6bf16e4de1fc
Python
3,367
83
# -*- coding: utf-8 -*- # @Author : WenHan import numpy as np import models.layers as layers # implement the quantized 1D-CNN in software. def rescale_data_2d(data, shift_bits, upper_bound): data_rescale = np.zeros_like(data) for i in range(data.shape[0]): for j in range(data.shape[1]): ...
73d47967d0ae74d7b94d4a0cad70111c53e155e3df92a44fb5211e302a10e5d4
Python
3,368
136
# %% [markdown] # ## import os import warnings import colorcet as cc import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.transforms as transforms import numpy as np import pandas as pd import seaborn as sns from joblib import Parallel, delayed from scipy.stats import poisson from sklearn.exceptio...
41d32a1f1f66fe6b49c9d9fba439946557da5e8792760922794b5029a155d2ec
Python
3,370
91
import os.path as op import numpy as np import numpy.testing as npt import nibabel as nib import nibabel.tmpdirs as nbtmp import dipy.data as dpd from AFQ.registration import (write_mapping, read_mapping, syn_register_dwi, slr_registration) import AFQ.dat...
db5909c5543ce53e44b76aff123b3b491526ef3ab4e3276ebff4a0a4604c96c7
Python
3,371
90
import sys import numpy as np import circularFiltering as flt from time import time kappa_z_array = np.array([0.01,0.03,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,30,100]) # choose a kappa_z according to system variable kappa_z = kappa_z_array[int(sys.argv[1])] # choose kappa according to input variabl...
976758c0e3627801a46b47e506a1580314308d6a02502be074ff7c8010c37165
Python
3,372
117
""" This file contains primitives for multi-gpu communication. This is useful when doing distributed training. """ import pickle import time import torch import torch.distributed as dist def get_world_size(): if not dist.is_available(): return 1 if not dist.is_initialized(): return 1 ret...
b30cc1f65c2ca01a93807f2d55abcc92c8864584193de74c94ffc331bb28a555
Python
3,373
77
"""Worker protocol against a real mock-worker subprocess (no API involved).""" import asyncio import subprocess import sys import time import pytest from carla_cosmos_server.config import default_run_dir from cosmos_workers.common import protocol @pytest.fixture def worker(tmp_path): run = default_run_dir(tmp_...
11a004125fd01c04553afccc610e73416a60b38d99d5b4f3e9ef2b0aa0bb780c
Python
3,374
95
import sys import time import os import numpy as np from IPython.core.debugger import set_trace import warnings with warnings.catch_warnings(): warnings.filterwarnings("ignore",category=FutureWarning) # Configuration imports. Config should be in run_args.py from default_config.masif_opts import masif_opts np.ra...
2141ee2f894e3c81abefd7e916e7420b0567cd80217f0b2a1ace98bf2a322d98
Python
3,374
104
import random from networkx.classes.function import to_undirected import networkx as nx import torch import matplotlib.pyplot as plt from torch_geometric.utils import to_networkx from graphxai.explainers import CAM, GradCAM #from graphxai.explainers.utils.visualizations import visualize_subgraph_explanation from grap...
769af0e4231d89d24335c50fe7b614f8a2a4592eb731b3695af00e31fee046c8
Python
3,374
99
import json import os import numpy as np import PIL.Image import pytest from backend import root_tracking def test_tracking_pair_shapes_are_validated_before_matching(): assert root_tracking.validate_tracking_pair_shapes( np.zeros((48, 52)), np.zeros((48, 52)), ) == (48, 52) with pytest....
a55d96f55cd66091ac7ff90fdb0fcd143e6110ff365b55861ec6804e1f7e3acf
Python
3,374
103
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import datetime import logging import time import os import torch from tqdm import tqdm from maskrcnn_benchmark.data.datasets.evaluation import evaluate from ..utils.comm import is_main_process, get_world_size from ..utils.comm import all_gather ...
c3ca66883cb9f8e943b8f9d0f837e0ece4fa0f073a12853ef197562392d22f74
Python
3,374
82
#################################################################################################### # 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 ...
fff6914d51da81970c6a2f555e89772d42db8bf9c6773f24b57e4a6e35e1905e
Python
3,374
88
import copy import datetime import logging import torch from mmcv.runner.hooks import Hook, TextLoggerHook from mmdet.models.builder import build_neck from tools.multadds_count import comp_multadds, comp_multadds_fw from tools.utils import count_parameters_in_MB, get_network_madds class DropProcessHook(Hook): ...
58a5a488e2896bd5ec42470804cd19a0a080c49d62913f863beb215dd25dd8bc
Python
3,376
81
# 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...
9874324bbc6f64fc76a2e8a605776e4f3beb85bddb1c3171a4629704b85f3cdb
Python
3,377
125
UNDEFINED = 'undefined' BASE_NETWORK = "BASE_NETWORK" EPOCHS = 'epochs' FIXED_WINDOW = 'fixed_window' SUBSEQ_WINDOW = 'subseq_window' OUTPUT_DIM = 'output_dim' WINDOW_SIZE = 'window_size' INPUT_DIM = 'input_dim' ITERATIONS = 'iterations' INFERENCE_CPU = 'inference_cpu' SAMPLE_PERIOD = 'sample_period' BATCH_SIZE = 'batc...
b2c2187b056733644dd0371b7cbfa0519fc96d8ff8bf3cf276ba98c50613dd57
Python
3,377
137
"""Config file for automatic code running Assign some hyper-parameters, e.g. batch size for attack """ BEST_WEIGHTS = { # trained on standard mn40 dataset 'mn40': { 1024: { 'pointnet': 'pretrain/mn40/pointnet.pth', 'pointnet2': 'pretrain/mn40/pointnet2.pth', 'pointcon...
1ff62fbb895e1540144137b59ced7f8efbe0ef5fc0f98b7d63fc1918ee9ee7b2
Python
3,378
91
import csv import pickle import numpy as np import pandas as pd def write_csv(doc_attrs:pd.DataFrame): header = [] for a,b in doc_attrs.columns: if a == b: header.append(a) else: header.append(f"{b}({a})") doc_attrs.to_csv("data/model_input_data.csv", header=header, ...
41658ccbbbe553ec5a5d0e2f35c61ee261ec080433accae7d10e8b8c6de0994c
Python
3,378
94
import numpy as np from scipy.spatial.distance import cdist from scipy.ndimage import binary_dilation def check_sls_with_inclusion(sls, include_rois, include_roi_tols): for sl in sls: yield check_sl_with_inclusion( sl, include_rois, include_roi_tols) def check_sl_with...
eef1282ab72c82ae9f1c6b06b7165f1b41d8409df4af43b99fe3a93f0bcb57a3
Python
3,378
134
import numpy as np import math from .math_lattice import mod2pi def get_phase_random(N): ''' Uniformly distributed random phase vector - on the interval from 0 to 2pi. ''' phi = 2 * np.pi * np.random.rand(N) return phi def rms(vec): ''' Root mean square; Quadratic averarge ''' re...
4aee2f6d1c58558708075d726774187d302f87cc1a12c266507575acb926d899
Python
3,379
92
#!/usr/bin/env python3 """ Copyright 2020 Johns Hopkins University (Author: Desh Raj) Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) Prepare AMI mix-headset data. We use the RTTMs and SAD labels from the "only_words" category of BUT's AMI setup: https://github.com/BUTSpeechFIT/AMI-diarization-setup ...
01b96abe0514c80a13e4e3bdd86375343bf2eada92f01ae3b05c617f02e3d1fb
Python
3,380
90
import paddle import argparse import cv2 import numpy as np import os from models.model import FaceSwap, l2_norm from models.arcface import IRBlock, ResNet from utils.align_face import back_matrix, dealign, align_img from utils.util import paddle2cv, cv2paddle from utils.prepare_data import LandmarkModel from tqdm imp...
4498f8258aba0467526b6a519751d115ab26d26bb5039ad7f1a93dc5b6ee1b78
Python
3,381
90
#!/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>. import argparse import math import carla def get_traffic_light_bbs(traffic...
620cad9e7be823fae61c561e0db4311222790bb32998ac627cbacd565d8de8fa
Python
3,382
95
_base_ = '../cascade_rcnn/cascade_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_cfg=dict(type='BN', requires_grad=True), mdcon...
0ae516ce605d1e09b7efe3ad628746379ccbdf36664618d47d52e7d1809ef3dc
Python
3,384
114
#%% import datetime import time from pathlib import Path import numpy as np import pandas as pd from sklearn.preprocessing import QuantileTransformer import pymaid from graspologic.utils import symmetrize from navis import NeuronList, TreeNeuron, nblast_allbyall from src.data import load_maggot_graph from src.pymaid ...
a6f230ca0b8af3909f9999992dc0258c214bb7a05519f0c6feb9aee263d9442b
Python
3,384
105
import numpy as np import matplotlib.pyplot as plt from pathlib import Path from scipy import ndimage class NoiseModel(object): '''Class providing parameters for noise simulation. Right now it only works for a monochromatic simulation with all parameters provided in the config for a certain tube voltage. ...
d719f356ecc7f8485fca4dc07b000502a8818616375f92a4068b34ddf705bcec
Python
3,384
91
import os import PIL.Image import pytest from backend import security @pytest.mark.parametrize('value', [ '../image.png', '..\\image.png', '/tmp/image.png', 'C:\\temp\\image.png', 'folder/image.png', 'folder\\image.png', 'bad\x00name.png', 'bad\nname.png', ]) def test_validate_filena...
d14d51908f875fcf80e239b491cd195fed9f443eed3d4fe5dbe5495f087db84f
Python
3,386
125
import torch from torch import nn from torch.autograd import Function from ..utils import ext_loader ext_module = ext_loader.load_ext('_ext', [ 'top_pool_forward', 'top_pool_backward', 'bottom_pool_forward', 'bottom_pool_backward', 'left_pool_forward', 'left_pool_backward', 'right_pool_forward', 'right_po...
e08a03549151131abe00b20ae9e0e8e9c627fe2588a9b23ebbe8a066b4ab6f80
Python
3,387
111
from os import listdir, path import brian2 as b # needed for exec import matplotlib.pyplot as plt from brian2.units import * # needed for exec from scipy.optimize import curve_fit # needed for exec # Analysis code def func(t, a, tau): """Exponential decay function""" return a * b.exp(-t / tau) def get_t...
cd5e3cb42f59a3f404a7f61e2c6e5fa885365f1517f18b8728e8726079267d5f
Python
3,388
70
# Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. """ Implements the knowledge distillation loss """ import torch from torch.nn import functional as F class DistillationLoss(torch.nn.Module): """ This module wraps a standard criterion and adds an extra knowledge distillation loss by taki...
1ed3a5238f2408deb5e8f06e8cfd17aba9d2414320e14a260210d394d781127f
Python
3,389
93
# import threading import queue import torch import torch.multiprocessing as mp # from pathos.multiprocessing import ProcessPool as Pool from torch.cuda._utils import _get_device_index def get_a_var(obj): if isinstance(obj, torch.Tensor): return obj if isinstance(obj, list) or isinstance(obj, tuple):...
5569287e5a4e5756093d2191eaec1167a105b9df6795e7f7da6033973295d157
Python
3,390
101
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from train_3d_time_series import TimeSeriesDataGenerator, get3DTimeSeriesDefaults import unetsl.data import unetsl.model import unetsl.cli_interface import sys import pathlib import re import numpy from matplotlib import pyplot def displayGeneratedData(config): gr...
4b20e127407fb0d06a2f22549357406097f2d4719276e9dd70f6ca3c5106cf1c
Python
3,393
109
# 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...
9412ee0505b36fd30d25b2fc0fee304eacf81702beec808a5d12c460629db774
Python
3,393
85
#! /usr/bin/python # -*- coding: utf8 -*- import tensorflow as tf import numpy as np from six.moves import xrange def discount_episode_rewards(rewards=[], gamma=0.99, mode=0): """ Take 1D float array of rewards and compute discounted rewards for an episode. When encount a non-zero value, consider as the end...
13b7325981644a14157158334b0aade2eaf18388352cfb650ebc9ba680061add
Python
3,397
96
import os import time import logging import numpy as np from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_model import LogisticRegression from sklearn.neural_network import MLPClassifier from .data.data_handler import kfold_split def run_classifier(X_train, X_test, y_train, y_test...
3b0fee5cf07601a657ad58c7dbf375e452e55230366b83bb24858e62253c2582
Python
3,397
119
''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' '''@file early_sepsis_detector.py run this file to go through the complete neural net training, testing and evaluating procedures, look at the 'early_sepsis_detector_con...
6bf38d2d30e0663710a7f70d4b84724c219763db1941bc3ad6c829487f8c9659
Python
3,397
95
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import Optional, Union import pandas as pd from tmkit.base.Position import Position class Separation(Position): """ C...
c5465c276bd84339bc6c0301c0cf37d588f2d59fc25f194c2342c35c058f70df
Python
3,398
109
import unittest import numpy as np import numpy.testing as npt from grr.Filter import constructMedianFilter import grr.Filter_Rect as frect from grr.Filter_Exps import Filter_Exps class TestConstructMedianFilter(object): def setUp(self): self._setFilterType() self._instantiateRandomFilters() ...
3e4075dc485b063be061c308d88134a644d0b3bc1507f42f40abd3fc69977ee4
Python
3,399
112
# -*- coding: utf8 -*- import torch.cuda as cuda import torch.nn as nn import torch import collections from torch.nn.parallel._functions import Gather __all__ = ['UserScatteredDataParallel', 'user_scattered_collate', 'async_copy_to'] def async_copy_to(obj, dev, main_stream=None): if torch.is_tensor(obj): ...
4978c9cc44b3ca76087a0d405265551f5279d3a68ce06e8582beb042668845f9
Python
3,399
117
import os from skimage import io, transform import torch import torchvision from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader from torchvision import transforms#, utils # import torch.optim as optim import numpy as np from PIL imp...
838ffa416898c553678c30de2827d959764dbc50c7b472ee27cf0b1d2e14ea58
Python
3,399
101
import argparse import os import tempfile import subprocess as sp import json import struct import time import numpy as np SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) def log_quantize(data, mu, bins): # mu-law encoding scale = np.max(np.abs(data)) norm_data = data / scale log_data = np.s...
13d01074cacbcc16bbb36f012b10342c9835a7fc94323b80643846b3ccbc5e5b
Python
3,400
97
import unittest import yaml from oaklib.datamodels.vocabulary import ( NEGATIVELY_REGULATES, PART_OF, POSITIVELY_REGULATES, ) from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation from oaklib.resource import OntologyResource from oaklib.utilities.lexical.patternizer import (...
8722c06e12ec0f4b0df6f65591d024e4a013c09d1837db87c18433c88e2b9591
Python
3,401
89
from collections import defaultdict from itertools import product import os import numpy as np from scipy.stats import ttest_ind, skew, normaltest import pandas as pd from sklearn.datasets import make_classification # creates the output directory simulation_data_dir = 'datasets' if not os.path.exists(simulation_data_d...
73b5193b8cd32aeaebcaca542ae3a4f125a9d2ef561c99edc85fc4de967de0f1
Python
3,403
83
#%% # script didn't give reasonable LNs in my opinion; will use the other version import pymaid from pymaid_creds import url, name, password, token rm = pymaid.CatmaidInstance(url, token, name, password) import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import matplotlib as ...
a23de430dba93ab67b24b6dc2bc08f746f976f09bc0e8f67da57add9a637661b
Python
3,403
95
""" Visualize mesh with matplotlib """ import numpy as np from numpy.linalg import norm import matplotlib.pyplot as plt from mpl_toolkits import mplot3d # 3d visualization import FBEM def triangular_mesh_from_array(points_array, trias_array, ax=None, **kwargs): ''' representation: 'surface', 'wireframe', 'p...
66a4eba092757d52c71ef4bafd2a79e7f393613c34f424e1f81007d1d4f18bae
Python
3,404
86
import os import pandas as pd import glob import argparse import numpy as np import torch from model import ViscosityNet from utils import prepare_test_input from utils import calculate_attribution_grid from utils import seed_everything device = 'cpu' if torch.cuda.is_available(): device = torch.cuda.current_...
35518d326151092c67dcc37966b2a5b4ac91de1db15836cb7891c37f2c7b7c6b
Python
3,406
152
#!/usr/bin/python import time import string import sys import os import re sys.path.append("/home/jpylkkon/decoder_current"); import Decoder def runto(frame): while (frame <= 0 or t.frame() < frame): if (not t.run()): break def rec(start, end): st = os.times() t.reset(start) t....
60d903db61510e205fa1313811b5e794dfaf794c2cb5730ac7860001e92a1e95
Python
3,407
109
""" Title ----- Active vs passive dendrites Description ----------- In pyramidal neurons, distal synapses have often a minute effect on the somatic membrane potential due to strong dendritic attenuation. However, the activation of dendritic spikes can amplify synaptic inputs that are temporally correlated, increasing ...
cdee32fa3b9fa903b638b6454946977769e6638180d26cc07fe6c8a61ce69f29
Python
3,408
88
import os os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE" import xml.etree.ElementTree as ET from PIL import Image from tqdm import tqdm from yolo import YOLO from utils.utils import get_classes from utils.utils_map import get_coco_map, get_map if __name__ == "__main__": map_mode = 0 classes_path = ...
e25fe8278a0cc3d543bf6ff1417257dcb221b8e170ccd474549afbfae274b0c4
Python
3,408
109
import os import numpy as np from .target import Target class qSeqMemMapFeatures(Target): """ Stores the dataset specifying sequence regions and features. Accepts a path to directory containing mammap files with feature values Parameters ---------- target_folder_path : str path to a...
0bc12a7f0d095927b53769fd474aca77d31cfcb436d55b8dacb4fc1ab7ce5fdc
Python
3,410
104
"""Moxing adapter for ModelArts""" import os import functools from mindspore import context from src.model_utils.config import config _global_sync_count = 0 def get_device_id(): device_id = os.getenv('DEVICE_ID', '0') return int(device_id) def get_device_num(): device_num = os.getenv('RA...
4b5a4197d9841d2451b69ea185f9f95ccaee9cbebac411964d26086204706701
Python
3,411
138
""" Visual response related functions. """ import numpy as np from lib.tuning import tuning_curve def get_section(conditions, angle): if np.isnan(angle): valid = np.isnan(conditions).astype("int") else: valid = (conditions==angle).astype("int") valid_diff = np.diff(valid) valid_diff = valid_...
84b288c015752e9c7599fadbacc5704906213a7ae2687061a4520025b00ff86a
Python
3,412
49
import carla,time,queue,json,math,os,argparse from pathlib import Path from PIL import Image parser=argparse.ArgumentParser(description='Model 3 camera and shared door-regression checks; use an isolated server.');parser.add_argument('--port',type=int,default=4674);parser.add_argument('--profile',default='Default');args...
410feead31aab45a7841d91d39607a13b9967cb2c01faaeda7ef4bd82e30821f
Python
3,414
69
import random import slideflow as sf from slideflow.util import log class NeptuneLog: '''Creates neptune runs and assists with run logging.''' def __init__(self, api_token, workspace): '''Initializes with a given Neptune API token and workspace name.''' self.api_token = api_token self...
81964a11262408747562f819c9132f8d7b20bacf6a863701ef27ce6da20775d5
Python
3,414
140
#!/usr/bin/env python # coding: utf-8 # In[1]: import os import sys import time import random import numpy as np import imgaug import tensorflow as tf import matplotlib.pyplot as plt import matplotlib import matplotlib.patches as patches from pycocotools.coco import COCO from pycocotools.cocoeval import COCOeval fr...
ee1c6195c11e30d3a564c4107e4f927a5fb2a98a651504d9622d94e79ead9d3e
Python
3,414
94
"""Phase 1: train the Bennett 2021 RPE baseline on a CS+/CS- conditioning task. Substrate: real larval Drosophila MB connectome (Winding 2023). The KC sparse code comes from real PN->KC wiring; KC->MBON weights are plastic but restricted to the KC->MBON edge mask from the connectome. Expected behaviour: - MBON re...
4b7a9ceff520386f529a61e2045b10f85d17f11d5228a6ecff34585799ee316e
Python
3,416
102
import numpy as np class Evaluation : dThreshold = 0.1 Threshold = np.arange( 0,1, dThreshold ) Threshold_num = len( Threshold ) def __init__( self, Path, Parameter ) : self.path = Path self.stimtime = Parameter['stimtime'] self.chunks = Parameter['chunks'] self.delay = Parameter['delay'] self.confusi...
7f720fd3a7e2c4f40e7ed8d5e067c3a051ff3504baebe2abac0181b4e3824231
Python
3,416
88
#!/usr/bin/env python # weight_hist.py ver 1.0 - a command line utility to plot a wildcarded argument # list of files containing a line of connection weight values as a histogram. import sys, os import matplotlib.pyplot as plt import numpy as np def print_help(): msg = """ weight_hist.py ver 1.0 -...
8189b528f84bb5976f6fec2badd2ab50af3bcef3ca0cbfa4f6e13efeef93633c
Python
3,416
106
import numpy as np __all__ = ['frdist'] # Copied from https://github.com/spiros/discrete_frechet/blob/master/frechetdist.py def _c(ca, i, j, p, q): if ca[i, j] > -1: return ca[i, j] elif i == 0 and j == 0: ca[i, j] = np.linalg.norm(p[i]-q[j]) elif i > 0 and j == 0: ca[i, j] = max...
126d1c228e65b8cceb63aa2d1d572620ae513b814253b5705b3f05fd6dfd2683
Python
3,417
100
# 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...
af3fbce64036adf00796daa0260507d5df9db8faa1268b6c74786131b44e3515
Python
3,417
95
#!/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>. import argparse import sys import math import carla def get_traffic_light_...
1252f1c2dafe5f240e76a9c7d4906e6a9eb1e42573ac082f6ed6069ba1a8aa6a
Python
3,418
104
""" From https://github.com/jensengroup/statsig/blob/master/statsig.py (Accessed 25.04.22) The license from the original repo is reproduced here as requested: MIT License Copyright (c) 2016 Jensen Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated doc...
86f261b9d69fbd84ebcb57ad49f9c7851857d0058bceaec246ae9c2c24fa62ce
Python
3,419
98
# Copyright 2021 Xiaomi Corporation (Author: Junbo Zhang) # Apache 2.0 # This script trains a random forest regression model to convert GOP-based # feature into human expert scores. # MSE: 0.15 # Corr: 0.42 # # precision recall f1-score support # 0 0.46 0.17 0.25 1...
dcd03ef6c653293daf3b7f4763d4041f0da5b191fd6a360a146872c1c6d59ab3
Python
3,420
80
#################################################################################################### # Copyright (c) 2019 - 2021, 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 ...
1a53bc129b815306ab4009afcfb97ac4c523f5d384f5f843ce1fc586bacd0c79
Python
3,421
106
import numpy as np import torch class SamplesBatch: """ This class represents NN inputs and targets. Values are stored as numpy.ndarrays and there is a method to convert them to torch.Tensors. Inputs are stored in a dict, which can be used if you are providing more than just a `sequence_batch` to...
5a21a44bdcecab717b749c472c60993a722f70d0d4a081fbc88b512d158f4626
Python
3,424
82
#!/usr/bin/env python3 """Interrogate a recorded CARLA .log without replaying it. Commands: info --file run.log [--all] header, actors, per-frame if --all collisions --file run.log --type1 v --type2 a collisions between categories blocked --file run.log --min-time 30 --min-distance 100 ...
76d162ac4aa208f77227dbcbf30e90218f19478336d3773263641b4a0a29efa9
Python
3,424
93
import torch import neuralop.mpu.comm as comm def setup(config): """A convenience function to intialize the device, setup torch settings and check multi-grid and other values. It sets up distributed communitation, if used. Parameters ---------- config : dict this function checks: ...
64c0cff456cca651983b2dd93c745a14949f74e7b801127817f905dd43e541b3
Python
3,425
176
""" Checkpointing and loading training states ========================================= Demonstrating the ``Trainer``'s saving and loading functionality, which makes it easy to checkpoint and resume training states. """ # %% # .. raw:: html # # <div style="margin-top: 3em;"></div> # # Import dependencies # -----...
3c22ae65a9801f6551a3a7c578db87d06b5e5cdde48f55c78ca712b12996b175
Python
3,426
105
# This script is part of navis (http://www.github.com/schlegelp/navis). # Copyright (C) 2018 Philipp Schlegel # # 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, either version 3 of...
361cf3faaa3e236fc99eab95acb18ebda250b07dea66fe3df8c64956875bf96d
Python
3,427
82
import glob import gzip def main(): # TODO: change this to command line input for f in glob.glob('/groups/umcg-biogen/tmp03/umcg-ndeklein/gwas_overlap/biogen-cisandtrans-4neurodiseases/eqtlgen_disease_overlap/*trans*.txt.gz'): # filename has to be in format *-<trait>.txt trait = f.split('-')[-1...
59be249cb323ec1a2a7b6c1c998ff3fa77f7ea4f2a0e84fd2b957fb4cd71b12c
Python
3,427
106
from __future__ import division from __future__ import print_function import time import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from pygcn.utils import load_data, accuracy from pygcn.models import GCN # Training settings parser = argparse.ArgumentParser(...
cc5c8ec23c62622d50864389ee7321137b4597f0d63c82834d6580f38a807b7c
Python
3,429
83
import torch.nn as nn import torch.nn.functional as F import torch class NestedUNet(nn.Module): def __init__(self, classes=2, aux=True): super(NestedUNet, self).__init__() n1 = 64 filters = [n1, n1 * 2, n1 * 4, n1 * 8, n1 * 16] self.pool = nn.MaxPool2d(kernel_size=2, stride=2) ...
d6fd85714c7e84f756627c44ae6185ae08685bb68a804940a3e9668e26072dfd
Python
3,430
107
#!/usr/bin/env python3 import numpy from tifffile import TiffWriter import sys import unetsl.cli_interface import unetsl.model import unetsl.data import unetsl.predict import unetsl.management import unetsl import pathlib import json import click def getFileName(str_path): return pathlib.PurePath(str_path).nam...
5c11e7eaadd90a0e65e09a135444752a45ecda3eb0cc25f026223b2e6850a456
Python
3,432
91
import torch import torch.nn as nn import torch.nn.functional as F class ContrastiveLoss(nn.Module): """ Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise """ def __init__(self, margin): super(ContrastiveLo...
13457ee2d1d6a23bfe79cc9c0f4eb4ad6ddd216890de5a5af1eec2927052825f
Python
3,433
79
""" Effects of cooling on spatial release from masking - Analysis By Ferret Flattens data across vowel identity (defined by first formant: F1) and vowel location (left or right speaker) Input ----- Data comes from the analysis directory; i.e. some preprocessing has already been done to remove correction trials and an...
449ef0fac03befae7bd896e132e8eb8275fbc4ecf2e606f4d270aa706edd97c7
Python
3,433
99
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 19 18:07:49 2018 @author: asanofuyuki .tiff Normalized_by_each_mouse_max/ 1 min bin 出来上がったデータを.xlsで再保存して、doubleplotを描く。 データは9:00(ZT0)スタート、9:00(ZT0)終了でエクスポートすること。 (最終日の8:59までのデータがある。) """ import glob import numpy as np import pandas as pd import ...
92c6a20834e0cae9354a2b1d12343f7f2af90e3d8993c6f508ac5bde404ce948
Python
3,433
100
import os import pickle import pyqtgraph as pg import pyqtgraph.opengl as gl import numpy as np import scipy.ndimage as ndi def get_object_vis_color(color): vis_color = (color[0] / 255, color[1] / 255, color[2] / 255, 1) return vis_color def create_plot_points_in_3d(data_dict): data_list = data_dict['da...
a92fb8a5387d3c3c5e237d584e6fa7fe055e274aafcd1b229bcb1aa3c5355484
Python
3,434
116
# -*- coding: utf-8 -*- from .core import * from .. import _logging as logging import tensorflow as tf __all__ = [ 'StackLayer', 'UnStackLayer', ] class StackLayer(Layer): """ The :class:`StackLayer` class is layer for stacking a list of rank-R tensors into one rank-(R+1) tensor, see `tf.stack() <ht...
3c202c1af5bedc230d4757386b0a5535b0f46f4f043cd719f910884e2c2b06eb
Python
3,435
91
import numpy as np import tensorflow as tf def extract_patches(img, xy_patch, stride_length, patch_size, downsample): height, width, depth = img.shape patches = [] indices = [] if xy_patch is False: for k in range(0, depth - patch_size[2] + stride_length, stride_length): if (k + p...
31965659f9120bd74d93108332819b90c922df6759435c8a39a4ea06490a73fc
Python
3,438
78
# 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...
73c9b6f5d585fb4c89c1dff517ebc594e7ce769524c259b3bcf84f0b12cc82ba
Python
3,438
94
## Sum all losses here import torch import torch.nn as nn import torch.nn.functional as F from loss.separation_loss import separation_loss from loss.rotation_loss import rotation_loss from loss.ssim_loss import compute_ssim from model.vggforLoss import mse_loss_mask, VGG_feat def define_loss(args): loss_model = ...
99654e4352ce26260f0e40a71c56e40d5f55118713ff651b2e510b05d5b59122
Python
3,438
41
"""Controlled vehicle impacts; use a dedicated Town10HD_Opt server.""" import argparse,json,math,os,time from pathlib import Path import carla p=argparse.ArgumentParser();p.add_argument('--port',type=int,default=4674);p.add_argument('--label',default='fixed');args=p.parse_args() P=Path(os.environ.get('CARLA_MODEL3_WORK...
2265fbe39082db3a5ded70735e71bdc098eef388d6afd6a769ea935cdbd11368
Python
3,439
91
# This file is part of me-features-to-mol-ID-mapping. # # # Copyright © 2021-2022 Blue Brain Project/EPFL # # # This program is free software: you can redistribute it and/or modify # it under the terms of the APACHE-2 License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANT...
567a80a843d62e1c366fc518bbcc8d3ba03ed4dee6c7a08f447ea29a7e592574
Python
3,439
106
# prepare semantic maps for FFHQ import os import glob import json from PIL import Image import numpy as np import torch from torchvision import transforms, utils from generators.BiSeNet import BiSeNet remap_list_celebahq = torch.tensor([0, 1, 6, 7, 4, 5, 2, 2, 10, 11, 12, 8, 9, 15, 3, 17, 16, 18, 13, 14]).float() ...
96b17aa014ad66b533514139a5529b4e2e85b728940c9ee46f44c3f5f5dbf518
Python
3,441
83
import random as rng from pathlib import Path import cv2 import numpy as np from .saveFilesC import saveFilesC class negativeRandomC: def __init__(self): super().__init__() def negativeRandom(self): self.log_crop_event("Random cropping started", self.number_of_voxel) indices = np.wh...
5ef912b3b4b3f05f60e7303dd72edd20fa97eca3f03294b9b686619ba402ded2
Python
3,442
86
# 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...
d331a4e6bd9de96eb3995448acf05354741e197bcc8273a2dc936624fc4f6eee
Python
3,444
103
from typing import Dict, List, TextIO from airium import Airium from linkml_runtime.dumpers import json_dumper, yaml_dumper def format_object(curie, label): if label: return f"{label} [{curie}]" else: return curie def add_association_group(doc: Airium, associations: List[Dict], subject: str...
c03ffd693ea8a9b3cbaf128db5ad4acdc2538b504ee15c45f79d493296211453
Python
3,445
99
import pandas as pd import numpy as np import nibabel as nib import argparse import os import sys def roi_coverage(arr): return np.sum(arr > 0) / arr.shape[0] * 100 STAT_METRICS = {'mean': np.mean, 'std': np.std, 'median': np.median, 'roi_coverage': roi_coverage} #MAPS = ['rBF', 'rBV'] MAPS = [] def get_stats...
5dc420df20f801ab6a4db605ce20c8ea9e704737d83154ba2499beca0b30a3ff
Python
3,446
152
# 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...