sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2dba12194684271def5f0531a55aa6803d0670a6d6c5fd27ef19883dec195c36
Python
5,225
131
# 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 math import random import time import carla from . import SmokeTest # The packaged build o...
e8d04d3f1fb6bdbe443073b33822ba5436620a1edd8c8680cbec04a2bed7d36b
Python
5,227
151
#%% import sys sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/") import pymaid import pyoctree from pymaid_creds import url, name, password, token import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd rm = pymaid.CatmaidInstance(url, token, name, pas...
1cea44cf2888f948ed6b8d9f380e87e06c42d604668813daa549967a6172aa7c
Python
5,228
159
# Copyright (c) Open-MMLab. All rights reserved. import os import os.path as osp import subprocess import tempfile from mmcv.utils import requires_executable @requires_executable('ffmpeg') def convert_video(in_file, out_file, print_cmd=False, pre_options='', ...
9aab3ae2ac3e3416245f25f42c4a17136c64be6dd24e276bea6641b65964d53a
Python
5,228
154
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Variational Animal Motion Embedding 1.0-alpha Toolbox © K. Luxem & P. Bauer, Department of Cellular Neuroscience Leibniz Institute for Neurobiology, Magdeburg, Germany https://github.com/LINCellularNeuroscience/VAME Licensed under GNU General Public License v3.0 """ ...
e89225091862e31fdef18d1c5f46539936ca2b9e6786b542e8ca7b35d837ee7f
Python
5,228
137
"""Test building of the MP table.""" from logging import Logger from typing import List from unittest import mock from unittest.mock import MagicMock import pandas as pd import pytest from pytest_mock.plugin import MockerFixture # type: ignore from fi_parliament_tools import mptable @pytest.fixture def mp_data() -...
5fa9cce59028b5a5370a02bc81fb44b955e6006697cfcce438173ecbf62175de
Python
5,231
185
#!/usr/bin/env python # coding: utf-8 ''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' import copy import numpy as np import torch from optrepo import OptRepo def compute_federated_algorithm(weights_list, model, args,...
9bcc635ca4befd5d22f2a56a379e41bb966c234f45c4aff81b5323d84a5ba0ab
Python
5,236
226
# Using Skorch import torch import skorch import numpy as np import pandas as pd import matplotlib.pyplot as plt from torch import optim from torch.utils.data import DataLoader # Basic Functions we use in Skorch from skorch import NeuralNet from skorch.callbacks import EpochTimer from skorch.callbacks import PrintLog...
95ce99ecde34dc2b9d77a373cff70dd3a12fd4f68803aa79fe23efd25f77f87d
Python
5,239
111
# basic imports import numpy as np # framework imports from cobel.memory_modules.sfma_memory import SFMAMemory class SFMAMemoryNonLocal(SFMAMemory): def __init__(self, interface_OAI, number_of_actions: int, gamma: float = 0.99, decay_inhibition: float = 0.9, decay_strength: float = 1., learning_rate: f...
eb2aabf23331188c441afda5b88f00112f97902e9181c4a82f665cb422bb2902
Python
5,239
163
import math import torch import torch.nn.functional as F from torch import nn from torch.nn import Parameter from .config import device, num_classes class SEBlock(nn.Module): def __init__(self, channel, reduction=16): super(SEBlock, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) ...
8811ec2a391982fe30edfa7993be8ca6ceaf28292b9dbe4b47a6ff8ba1a2ac67
Python
5,246
137
#!/usr/bin/env python3 """List and toggle a map's environment objects (buildings, vegetation, poles...). Commands: labels list valid CityObjectLabel names list [--label Buildings] [--name PATTERN] count/sample matching objects disable --label Buildings [--name P] [...
544f6f78cf3f5d83ff779445821d18c9772051ab0c191fcfcd9a0efb7d0b331c
Python
5,249
126
import numpy as np import os import json import argparse ''' Script for converting unlabeled videos from CalMS21 .json files into .npz files for input into TREBA. The .npz files are stacked trajectories of length N (default = 21). In our work, we use the unlabeled videos set (first 229 videos for train and the remai...
58942de05202f0fbe491c312e6da9520b449f7f7e2aed4910a775116e6430293
Python
5,250
167
"""Hyperbolic layers.""" import math import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init from torch.nn.modules.module import Module from layers.att_layers import DenseAtt def get_dim_act_curv(args): """ Helper function to get dimension and activation at every laye...
787c8340bd4b35020e9934dbc52e6f02b8b1c2c3fcd87aef0cf5c22cf2f357a9
Python
5,251
118
########################################################## ## ccAF: classifyPrimaryCells_homoSapiens.py ## ## ______ ______ __ __ ## ## /\ __ \ /\ ___\ /\ \/\ \ ## ## \ \ __ \ \ \___ \ \ \ \_\ \ ## ## \ \_\ \_\ \/\_____\ ...
f8db34c1f018d13304f67153ffac7ea88106e5f67854602b7e54fbb95bf0fd99
Python
5,251
72
"""Live check of sensor.camera.rt_lens with camera_model=ftheta (NuRec / NVIDIA rig pixel-distance -> angle polynomial): spawns a small prop at known positions, finds its image centroid, and compares with the analytic projection theta = sum c_i r^i solved for r. Also checks exposure_mode=manual gives a non-black, dete...
1e638d0af41df88a5e952efac9586abac83de3d2d089dea30cb484089ecf48d0
Python
5,254
130
#%% from pymaid_creds import url, name, password, token from data_settings import pairs_path, data_date import pymaid import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd import networkx as nx from contools import Promat, Prograph # allows text to be editable in Illustrator pl...
fe9b485061d2ed3251d8645ce9b78700bf66640031b2b87e871b57a71f37ebfb
Python
5,254
122
import math import numpy as np import pandas as pd from scipy import interpolate def interpolate_predictions(segment_probabilities: np.array, segment_times: list, sfreq: float, influence=0.5): """Returns CNN predictions interpolated for each sample of the EEG signal. Args: segment_probabilities (nu...
29032dc1e8be0e474461eea690bc8d300f19ea46fb82ff9851b0647779ed6210
Python
5,255
154
""" This script adds manually recorded temperature values to single trial data from original data for F1311 There are two ways to achieve this: - Start from scratch (i.e. go through all data) - Label only those trials that were previously manually selected (i.e. where only cooled trials were included in the data, whic...
92800f571159cdb6ecc05850b210b751454c57102cc7ae378d7d3365926f93b7
Python
5,255
196
import fnmatch import numpy as np import pandas as pd from tqdm.auto import tqdm #from rl_analysis.util import star from toolz.itertoolz import concat from itertools import repeat, count #from rl_analysis.util import syll_onset, syll_duration # mice with bad fiber placement EXCLUDE_MICE = ( '186', '189', '...
b9957de347c8b84d64962bf672cbd72dacbad0f48a40c4b1ee2feff07e3f3446
Python
5,255
131
#!/usr/bin/env python3 # Copyright 2020 Johns Hopkins University (Author: Desh Raj) # Apache 2.0 # This script is based on the Bayesian HMM-based xvector clustering # code released by BUTSpeech at: https://github.com/BUTSpeechFIT/VBx. # Note that this assumes that the provided labels are for a single # recording. So t...
57f59c9279c5007ffad25e8a5bf99fbe773c19f583a2949bb53be3438c79345d
Python
5,257
130
# 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...
77cb095d01754dc1a971f06196692cb08b95a3ebbf94a781b64dad0a868314f7
Python
5,258
147
# 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...
d95df9751e240a2162f30235e75ea1bc7ed7433ab827cd4961326855aa9a3fb9
Python
5,259
163
#!/usr/bin/env bash # ============================================================================= # Copyright 2019 Pavel Yakubovskiy, Sasha Illarionov. 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 ob...
7eef51ed66888d3c4255854e82de75b266df967de8e7d51504168bacc0ca5d46
Python
5,260
143
# 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...
c1a5f6d904580624a4379496a3783b1a7fa59e54541b207b09e4de267943eb9b
Python
5,265
167
# Validate NML, createLEMS, simulate, create chart js, and validate js of a model # Usage: # To generate voltage clamp plots: # # createModelVCplots.py path/to/channel.nml Na/Kv/Cav/Kca/Ih [dtInMs] # # NOTE: this script assumes and has only been tested on linux OS (Ubuntu 16) # WHY??? Because the devs of the tools u...
cb79631d9436b11d81427b61f1dc8812a7846cf783ffab15d8beab1c09043b0a
Python
5,267
97
from functions import * import pickle import matplotlib.pyplot as plt GiacoPath = "./28nets_rules/Giacomantonio2010.txt" starttime = datetime.now() #Running this script required 0.6sec on a MacBook Pro with a 2.3GHz Quad-Core processor and 16 GB of RAM #Plot Figure 4 comparing the results of a single state transitio...
31a361b8d0dc32b3e63712e501bc647ed57b73a0e015c441c7008276c313c6e9
Python
5,268
112
import numpy as np from scipy.interpolate import CubicSpline import warnings warnings.filterwarnings("ignore", category=np.VisibleDeprecationWarning) def scaling(dataset, sigma=0.1): factor = np.random.normal(loc=1., scale=sigma, size=( dataset.shape[0], dataset.shape[2])) data_scaled = np.multiply(dat...
42013cd4bce564ef795df42fdd57206bdd346746f85804e63eaf7ad5c2ad473c
Python
5,273
150
''' Author: Naiyuan liu Github: https://github.com/NNNNAI Date: 2021-11-23 17:03:58 LastEditors: Naiyuan liu LastEditTime: 2021-11-24 19:19:47 Description: ''' import cv2 import torch import fractions import numpy as np from PIL import Image import torch.nn.functional as F from torchvision import transforms from mode...
22f6a8515ad038568f7b1dd1006d207d253bd52f06dff06c4352fe674154421e
Python
5,274
138
''' Use `trianle library` to create mesh. ''' import numpy as np def triangulate_with_triangle(points, max_area, add_code=''): ''' Create triangulation using *triangle* library (don't forget to cite it) Parameters: q - quality meshing (restrict triangles angles to be smaller than 20 degrees), ...
7681392b749c6a6a417174e4d519ce7cbb48df813cfe53eff6d9303badcbefaa
Python
5,274
179
import torch from PIL import Image extensions = ['.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif'] def pil_loader(path): # open path as file to avoid ResourceWarning (https://github.com/python-pillow/Pillow/issues/835) with open(path, 'rb') as f: img = Image.open(f) return img.conver...
073d340823b982ecb5ab2ea86d27298f7bf7e9c9307338cd47cdfc799caa0e97
Python
5,275
199
import argparse def get_parser(parser=None): if parser is None: parser = argparse.ArgumentParser() # Model model_arg = parser.add_argument_group("Model") model_arg.add_argument( "--q_cell", type=str, default="gru", choices=["gru"], help="Encoder rnn cel...
461c9d3dcb1693b4d91f368ad1048005f868e252f9e5ab45f6ee00fa7e5bcb2e
Python
5,275
129
#!/usr/bin/env python3 """What blueprints may a generated scenario name? Two different answers, and a scenario is only safe where they agree: build inventory what the CARLA build can actually spawn. Read from $CARLA_ROOT/.../Content/Carla/Config/*Parameters.json - the defin...
716b6124859055c6ca67f1528ffffd64092cb2e950f539232e6d8266103a612b
Python
5,277
167
from copy import deepcopy import numpy as np import matplotlib.pyplot as plt from scipy.stats import spearmanr from .Tools import raiseExpectedGot class FrequencyInputCurve(object): """A frequency vs. input curve fitted to data.""" summary_metrics = [ 'f', 'I', 'CV', 'rheoba...
ccc2b1af83d343f04980915f7e18e3844cb2a868203223047074edbff3a7276f
Python
5,278
106
#!/usr/bin/env python3 # -*- coding: utf-8 -* """Gait study analysis file. """ import os import glob import pandas as pd import numpy as np from scipy.signal import savgol_filter from sklearn.linear_model import LinearRegression from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error def main...
2fc7466e4106a67448f7a50d3e3dd795812da98e79f312934a8d2a3f65a05fd7
Python
5,279
149
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch import nn from torch.nn import functional as F from maskrcnn_benchmark.modeling import registry from maskrcnn_benchmark.modeling.backbone import resnet from maskrcnn_benchmark.modeling.poolers import Pooler from maskrcnn_be...
a16f8af2802ba383ef0eb9ff7f61658d5b90079c99bcb2d19ba7db15a3f8226f
Python
5,280
134
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import normal_init from mmcv.ops import nms from ..builder import HEADS from .guided_anchor_head import GuidedAnchorHead from .rpn_test_mixin import RPNTestMixin @HEADS.register_module() class GARPNHead(RPNTestMixin, GuidedAnchorHead): ...
d7cdecaa47be271679ff2238b7788957cf016e06b9604f60950d355d8eb108e1
Python
5,280
103
# basic imports import numpy as np import pickle import matplotlib.pyplot as plt def countInvalidTransitions(invalid_transitions: list, mode='default') -> dict: ''' This function computes the fraction of invalid transitions that were replayed in the second and third environment. Param...
05017043ccfb5b622330d5f6c219d0361eda48fcebd0983063466b8f9ef3f361
Python
5,281
138
""" Copyright (c) 2019, National Institute of Informatics All rights reserved. Author: Huy H. Nguyen ----------------------------------------------------- Script for making FaceForensics++ FaceSwap dataset """ import argparse import cv2 import numpy as np import os import sys parser = argparse.ArgumentP...
1a6cde8d0852eba06cfe9fa8a3bdb06bc54dd847e38f13a9f913ae28d173bee7
Python
5,283
146
from pylab import * def plotCurrentscape(voltage, currents): # make a copy of currents # CURRENTSCAPE CALCULATION STARTS HERE. curr = array(currents) cpos = curr.copy() cpos[curr < 0] = 0 cneg = curr.copy() cneg[curr > 0] = 0 normapos = sum(abs(array(cpos)), axis=0) n...
7f10763edd5742d336e548ae8575ffd81e49903a5838451454f711eee86bb69b
Python
5,283
142
import logging import tarfile import tempfile from dataclasses import dataclass, field from typing import ClassVar, Dict, List, Optional from urllib.parse import urlparse from urllib.request import urlretrieve import pystow import requests import requests_cache from defusedxml.ElementTree import fromstring from oakli...
b1406713903ff106a159702f7ebd096096b0197e3697d8abc34989d337c3620e
Python
5,286
138
""" Copyright (c) 2019, National Institute of Informatics All rights reserved. Author: Huy H. Nguyen ----------------------------------------------------- Script for making FaceForensics++ DeepFakes dataset """ import argparse import cv2 import numpy as np import os import sys parser = argparse.Argument...
145b04fb6bb9005994850acc24b6f733ebf4b30970df105c36e498aae7d1a71a
Python
5,287
153
# 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...
f13bc7642a3fef770c5c35553d51d942d0a4fd12b111657d1214f5016f31f6b5
Python
5,289
125
import numpy as np def get_test_patches(img, crop_size, stride_size, rl=False): test_img = [] test_img.append(img) test_img = np.asarray(test_img) # test_img_adjust=img_process(test_img,rl=rl) test_img_adjust = test_img test_imgs = paint_border(test_img_adjust, crop_size, stride_size) ...
7787d07acca18557e9a1850ebd6b4e55e19538665cb9976118a407509437097d
Python
5,290
126
#%% from data_settings import data_date, pairs_path from pymaid_creds import url, name, password, token import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) import numpy as np import pandas as pd import pickle from contools import Promat, Adjacency_matrix, Celltype_Analyzer, Celltype, Cascade_Analyz...
bc6f93444039d581fcd445a5c704a7102650fec9ee5bbde4cc40af4e0334a882
Python
5,290
128
# %% 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 from data_settings import data_date, pairs_path import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) from contools import Celltype, Celltype_Analyzer, P...
0ec01d1534b10fe7e2caab84e67e07211026130355bf848d8fedd797e7e36eeb
Python
5,291
210
import matplotlib as mpl import matplotlib.pylab as plt from matplotlib.lines import Line2D import numpy as np import pandas as pd import seaborn as sns def make_up_axis(ax): ax.xaxis.set_ticks_position('bottom') ax.yaxis.set_ticks_position('left') ax.spines['left'].set_color('#333333') ax.spines['bo...
93b33df25b75211f184cae7ab08df840501ec8565cbe6c9936af88dbf372b112
Python
5,291
64
"""Make M_CarPaintMaster render sanely under path tracing (editor Python commandlet). The car-paint master is a clear-coat material whose instances carry Roughness values up to 1.6 (invalid; the raster path clamps them and fakes rough-metal reflections from reflection captures, so the cars look glossy anyway). The pat...
a7194f70773c698734f45f906b314c4cbff96574f1f2f8f5e635358010fb90f9
Python
5,293
162
import ipdb import torch import numpy as np import scipy.stats as st import sklearn.metrics as metrics from tqdm import trange from sklearn.model_selection import KFold from sklearn.metrics import f1_score, accuracy_score, precision_score, recall_score from graphxai.datasets.shape_graph import ShapeGGen from graphxai....
a3df9bff8aa0b50df06dcec04ce823960175967422c08b22abfdc7950c7199e3
Python
5,294
135
# 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...
91beb877b5b95aa194fe07e4812e6f3c80e688969c5cabeed9c0348e1128a9d9
Python
5,296
183
import numpy as np import matplotlib.pyplot as plt import time from helper import * from ALsim import ALsim import sim import sys import os from ALsimParameters import std_paras import random import scipy.optimize as opt from genome import set_x connect_I= "hom" dirname="opt-dir" paras= std_paras() paras["dirname"]= d...
d5103b354b71acb3377760887549db7426a00d2f60cf7ae2c9a6e6ab1f03a051
Python
5,297
141
"""Worker <-> server protocol: newline-delimited JSON over a unix socket. The worker **binds** the socket; the server connects (one connection per operation, so a ``cancel`` can arrive while a ``run`` is streaming). Every request carries ``op`` and ``id``; every reply carries the same ``id`` and an ``event``: ======...
f1503a844a52518d869382727aed75f0cb0a543b2ec0d6abf9bea605f3ba1de0
Python
5,297
204
#! /usr/bin/python # -*- coding: utf-8 -*- import tensorflow as tf from tensorflow.python.util.deprecation import deprecated __all__ = [ 'identity', 'ramp', 'leaky_relu', 'swish', 'sign', 'pixel_wise_softmax', 'linear', 'lrelu', ] @deprecated("2018-06-30", "This API will be deprecate...
2185ba036cfff5234f80241675fcc5516924a552e20688c345d9bd84b4d55bfa
Python
5,299
166
# coding=utf-8 # Copyright (c) 2021, NVIDIA CORPORATION. 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 re...
66a1056431bffb83732453ac7c67f9bb894ec411caad1ef895ef1ed741036274
Python
5,306
146
import torch from mmcv.ops.nms import batched_nms from mmdet.core.bbox.iou_calculators import bbox_overlaps def multiclass_nms(multi_bboxes, multi_scores, score_thr, nms_cfg, max_num=-1, score_factors=None): """NMS for...
1b4d7a503d9ce7ad568d78c8ea887acac67dc54929ab945d8ca5e130c1be96f4
Python
5,311
141
from utils.inference_dataset import InferenceDataset import sys sys.path.append(".") sys.path.append("..") from models.psp import pSp from utils.test_options import TestOptions from utils.common import tensor2im, log_input_image from configs import data_configs import os from argparse import Namespace from tqdm import...
8c9048372307a217b7db9f5ccfadd47a78853aa1653018f6e6839eb2d4b5635a
Python
5,312
129
import mmcv import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES from .utils import weight_reduce_loss @mmcv.jit(derivate=True, coderize=True) def varifocal_loss(pred, target, weight=None, alpha=0.75, gamma=2.0,...
05a3992c42f7c56d847360334d8fc902c16b484a68fda4a5b50f6275845b4cc8
Python
5,316
143
import random import numpy as np import torch from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (HOOKS, DistSamplerSeedHook, EpochBasedRunner, Fp16OptimizerHook, OptimizerHook, build_optimizer) from mmcv.utils import build_from_cfg from mmdet.core imp...
72b26cf0aa4c87b8be27c8f221e0091c9d94dd23e2063dd727d774d7bcabad0f
Python
5,316
143
import random import numpy as np import torch from mmcv.parallel import MMDataParallel, MMDistributedDataParallel from mmcv.runner import (HOOKS, DistSamplerSeedHook, EpochBasedRunner, OptimizerHook, build_optimizer) from mmcv.utils import build_from_cfg from mmdet.core import DistEvalHook, E...
fbf787953015a91936e2c82d5ba81445d5b7c2d86022d22d20f904989ac4e125
Python
5,318
143
import jax import jax.numpy as jnp import numpyro import numpyro.distributions as dist import numpy as np from jax import random # regression model with continuous-valued outputs/responses # http://num.pyro.ai/en/stable/examples/horseshoe_regression.html def horseshoe_regression(X, Y, indicator=None): D_X = X.sha...
2ef0df73e5dfc5f6defbbd482158da6788de2f4af7a350577ecb72dc58ec689d
Python
5,324
200
#%% import os import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import seaborn as sns import pymaid from graspologic.embed import AdjacencySpectralEmbed from graspologic.utils import binarize, pass_to_ranks, remove_loops from src.data import load_metagraph from src.graph imp...
430a208cbb495ef32972e45b4b958578ca96a6edc61196382ad86b5d6455bad5
Python
5,324
179
""" custom gym environment developed for invoking FDTD simulations used in DQN. Author: Renjie Li. October 2021 @ NOEL. """ from src import FdtdRl import random import gym from gym import spaces, logger from gym import utils from gym.utils import seeding from collections import namedtuple, deque from itert...
8be43eb9b05148981dd688df5b3cf2e48450f8aca77bc1dabd7d3d126301cce0
Python
5,324
159
''' Author: Naiyuan liu Github: https://github.com/NNNNAI Date: 2021-11-15 19:42:42 LastEditors: Naiyuan liu LastEditTime: 2021-11-15 20:01:47 Description: ''' import cv2 import numpy as np from skimage import transform as trans src1 = np.array([[51.642, 50.115], [57.617, 49.990], [35.740, 69.007], ...
6e3cb362b93dcceba8a1db24679ec24155716629cbf69ac73c9091f0ea5cb42d
Python
5,325
125
"""Paper Figure 2: RPE acquisition + extinction on the larval MB connectome. Layout (1 x 3): A — Acquisition curve with N=20 seed variance bands B — DAN prediction error decay across acquisition + extinction C — Extinction kinetics showing signed-weight requirement The claim this figure supports: signed-weight ...
aecf23c238d38044d1550c3c9249560f3153340c1b20c9904bc11efed88b0218
Python
5,325
206
#%% import datetime import time import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from matplotlib.ticker import ScalarFormatter from pkg.io import FIG_PATH, OUT_PATH, get_environment_variables from pkg.io import glue as default_glue from pkg.io import savefig from pkg.plot im...
0eb6956852d83a353445b6419a592435faff4fa1b7943da598dc83095e7383b4
Python
5,330
169
import serial import threading import time import matplotlib.pyplot as plt from matplotlib import gridspec # please specify the port name PORT_NAME = "COM4" # Parameters for serial communication # If you change these parameters, you must also change the vhdl code on the FPGA BAUD_RATE = 1000000 # baud rate NUM_DATA =...
36eef287b377b295e1eb13956262e7da37caa3da50e98263031b011f29e7b266
Python
5,336
132
############Test import os import argparse import tensorflow as tf from keras.backend import tensorflow_backend os.environ["CUDA_VISIBLE_DEVICES"] = "0" config = tf.ConfigProto(gpu_options=tf.GPUOptions(allow_growth=True)) session = tf.Session(config=config) tensorflow_backend.set_session(session) from utils import...
72efd4b78ac121a3422180b8d21a7e31a18937686b4d67f42378796e71a784e8
Python
5,340
126
import time import cv2 import torch import numpy as np import torch.backends.cudnn as cudnn import torch.nn as nn import torchvision.transforms.functional as TF from loguru import logger from tqdm import tqdm from trainer import Trainer from utils.helpers import dir_exists, remove_files, double_threshold_iteration from...
6151e2cb9d6b73462fc538f73cb34a7c7d26f2018b0d37eb1c239224ab544cd7
Python
5,341
161
from datetime import datetime from pathlib import Path from tqdm.auto import tqdm import wandb import torch from torch import nn from torch.nn import L1Loss from transformers import ViTPreTrainedModel, ViTModel, AdamW, get_scheduler from transformers.modeling_outputs import SequenceClassifierOutput class ViTForRegr...
f7935721524638981ef94fa105d5977816528349555017eb31842378989c0f71
Python
5,344
140
import contextlib from importlib import import_module from AFQ.viz.utils import viz_import_msg_error import pimms from funcargparse import FuncArgParser import logging import warnings from dipy.io.stateful_tractogram import set_sft_logger_level with contextlib.suppress(Exception): # only works on python 3.9 fro...
be340fd8ab121f31bc18127288ec37436d30180470058e6d223e81cdd80dd69c
Python
5,345
153
import argparse import copy import os import os.path as osp import time import mmcv import torch from mmcv import Config, DictAction from mmcv.runner import init_dist from mmdet import __version__ from mmdet.apis import set_random_seed, train_detector from mmdet.datasets import build_dataset from mmdet.models import ...
7a8a353176fc7bbad6a914597933adf47da13ef8fd5709f618ad9916b67c8bb3
Python
5,347
166
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" import os import pandas as pd from Bio.PDB import PDBList from tmkit.util.Kit import batchRename, delete, ungz, urlliby, rename from tmkit....
c13bc37559cfae75610092bf3bf6e6779ebd66bfc371c4955dac29d4605b2f4a
Python
5,350
152
''' Fig. 8. Calculation of motion vectors with asynchronous ciliary reversal. ''' from hydrodynamics import * import numpy as np from pylab import * import matplotlib.font_manager as fm from matplotlib import gridspec from mpl_toolkits.axes_grid1 import make_axes_locatable import matplotlib.patches as mpatches fontpro...
aec579dec6444ab68ca8c82166103571baf5c6f2208dd4d4fe2bb919c5568c30
Python
5,351
165
#### Analysis on experiments # Built-in import os,gc,glob,time,functools # Libs import numpy as np import pandas as pd from scipy import stats # Plot import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.colors as colors import seaborn as sns from matplotlib.backends.backend_pdf ...
cbe7900a535d05027c996c13911cb48b856178a0281909c08bbf1586cea58705
Python
5,356
148
from abc import abstractmethod import torch import torch.nn as nn import torch.nn.functional as F from ..cnn import ConvModule class BaseMergeCell(nn.Module): """The basic class for cells used in NAS-FPN and NAS-FCOS. BaseMergeCell takes 2 inputs. After applying concolution on them, they are resized to...
f008afd2173ed5654d058cffc8f5aa8eb4916b5e9c237f3fdbeba5e86d890a52
Python
5,357
152
import pandas as pd import logging import numpy as np import torch import math, os, shutil import functools import matplotlib.pyplot as plt from typing import Tuple from torch import nn, Tensor from torch._C import TensorType import torch.nn.functional as F import torch.optim as optim from torch.optim import optimizer ...
3e5a67966e706870b938e1b00eb56770fb6d3e0439018aa06d236f8ca863e114
Python
5,358
146
""" ======================================== Using Subject Space ROIs from Freesurfer ======================================== An example using the AFQ API to find bundles as defined by endpoint ROIs from freesurfer. This example can be modified to work with ROIs in subject space from pipelines other than freesurfer. ...
d1293c8aed38c17f0acbdbf4782bc5a82d8e6038fad7db994b739dedb026aef7
Python
5,362
130
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import numpy as np import cv2 import os import torch import torchvision from maskrcnn_benchmark.utils.comm import get_rank from maskrcnn_benchmark.structures.bounding_box import BoxList from maskrcnn_benchmark.structures.segmentation_mask import ...
e4e7c26c1cb1a8a54fa02fbf1167a3aa937154f2a82c0d5b540a993c3108f517
Python
5,363
164
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import Dict, List, Union import warnings import pandas as pd from Bio import BiopythonWarning from tmkit.chain.PDB import PDB ...
d85274c5e443034a5c193cb25ee4af63a428220c2f8c1f500175db5d76dcd369
Python
5,365
125
"""tan_projection.py - Estimating covariance matrix and projecting onto the tangent space Author: Ruiqi Chen Version: 02/08/2022 Usage: tan_projection.py <residual_dir> <rsfMRI_dir> <good_ic_file> <n_sub> <output_file> - residual_dir: output of convert_res.sh, with one folder for each subject - rsfMRI_dir: all resti...
55904996df1738f58328db0c75a6619018adcd5c4460c7dc81e0b791b1cd0657
Python
5,367
142
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch.nn import functional as F from maskrcnn_benchmark.layers import smooth_l1_loss from maskrcnn_benchmark.modeling.matcher import Matcher from maskrcnn_benchmark.structures.boxlist_ops import boxlist_iou from maskrcnn_benchmar...
ba067bd80caf7049a351aef9c2221b1fae08f6dc384c07cd49bec7599ec4129c
Python
5,368
133
import numpy as np """ Parse the command line argument to create the right initial conditions/connectivity for the LN -> PN inhibitory connections. Options are:either homogeneous (equal strength) signalled by correl == None or according to correlations (corr0 without self-inhibition, corr1 with self-inhibition) or acc...
1201e380e84aa838f23d69c73b66abfb2da4bf695881a2a1e5b793f213deb0c0
Python
5,369
107
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'melodicompTemplate.ui' # # Created by: PyQt5 UI code generator 5.12.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): ...
14998a2b75e75b05e19ba7f7fe2306c8fd29045f7465433a3e8a122fb650a59c
Python
5,369
134
''' Written by Nathan Neeteson. A set of basic utilities for importing AIM images into numpy and PyTorch formats. ''' import vtkbone import numpy as np from vtk.util.numpy_support import vtk_to_numpy import torch from bonelab.util.aim_calibration_header import get_aim_density_equation def get_data_and_pos_from_AIM(fn...
55b335a5235832b101e39ff3d060a3c70b20a4af5d39b3723c71bcbf750c12d1
Python
5,369
147
import torch import torch.nn as nn import torch.nn.functional as F from .registry import CONV_LAYERS def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, eps=1e-5): c_in = weigh...
c67663be09c504aab2cc0fc97b6236d98ca4a91f85f1b339fe138797e6549775
Python
5,370
140
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import os import numpy as np import torch from torch.autograd import Variable from logging import getLogger logger = getLogge...
fe0c68f2cf3e381829139925d35e1818781773d2bf1c92e236858a64f49611e6
Python
5,370
136
########################################################## ## ccAF: sensitivityAnalysis.py ## ## ______ ______ __ __ ## ## /\ __ \ /\ ___\ /\ \/\ \ ## ## \ \ __ \ \ \___ \ \ \ \_\ \ ## ## \ \_\ \_\ \/\_____\ ...
61098ba9d764cd402ca83ac25ee148e970269708c7a3f70738a95291d646f0ea
Python
5,371
125
import numpy as np import sys import time import shutil import subprocess import os import pyflann from IPython.core.debugger import set_trace from Bio.PDB import * struct_dir = "/home/gainza/lpdi_fs/masif_paper/masif/data/masif_ppi_search/data_preparation/01-benchmark_pdbs/" benchmark_list_fn = "../benchmark_list.txt...
b71db42efcbeed1f19a442b468300df636da4b4f44eb1528c2a64710b9c3b0b2
Python
5,371
136
########################################################## ## ccAF: sensitivityAnalysis_run.py ## ## ______ ______ __ __ ## ## /\ __ \ /\ ___\ /\ \/\ \ ## ## \ \ __ \ \ \___ \ \ \ \_\ \ ## ## \ \_\ \_\ \/\_____\ ...
2db9a6a226e8949d5e58e7fd5a946f643a58798de1b9d97e33c2c52aaab98252
Python
5,372
150
from mip.get_nn import get_nn from helper.misc import inference, infer_and_accuracy, clear_print, get_network_size,strip_network from helper.data import load_data, get_architecture from helper.fairness import equalized_odds, demographic_parity from gd.gd_nn import GD_NN import argparse import numpy as np from pdb impor...
64a54e38192b12307778d8066b7b53c620a855549e46b7cbed8424756e658ea1
Python
5,373
158
from dataclasses import dataclass from typing import Dict, List, Optional import click import numpy as np from oaklib import BasicOntologyInterface, get_adapter from oaklib.datamodels.association import Association from oaklib.interfaces.association_provider_interface import AssociationProviderInterface from oaklib.i...
05c7728da016d762a5e04fe4f29f9fc0f5709dd8fea97cc6368744b979f9e43b
Python
5,376
139
""" rewards Created by: Martin Sicho On: 26.06.22, 18:07 """ import numpy as np from rdkit import Chem, DataStructs from drugex.training.interfaces import RewardScheme, RankingStrategy from drugex.utils.fingerprints import get_fingerprint class NSGAIIRanking(RankingStrategy): def __call__(self, smiles, scores):...
1b7646f1b93f3a1e96064b3e80738741b74a12f9b4db913b5d258f7cf54fd922
Python
5,376
141
#!/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>. """ Deterministic collisions example for CARLA Runs the same crash several t...
c4065dcf10dbce22a3a3385d80ca42338189ec7ca3f6a7355e44f2d49eb42aaa
Python
5,377
160
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', help='Directory to write jobs to') parser.add_argument('cram_base_directory', help='Directory w...
2a080333dcc01df972782af3e796a96b3067a0382d2b35c4f6952515a77c2762
Python
5,379
133
################################################################### #### #### Version: 1.1.7 #### Date: 6/24/2023 #### Description: This file contains the class definition for the Time object #### Author: Evan Cobb #### ################################################################### import sys import globvar as g...
795d17ee852ca2e80438149e681fa0cb34669e1a6ed29d678947c6b99294f5c1
Python
5,383
153
""" File: perform_deconvolution.py Created: 2020/06/29 Last Changed: 2021/09/30 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, ...
a28eadf2d65aa113fe053fe36c91674866159976a36e734521021c9e3fa2bbab
Python
5,385
123
import warnings import pandas as pd import plotly.express as px import plotly.graph_objects as go from constants.constants import * from constants.enumerates import StatMeasures from utils.helpers import list_intersection, experiment_name_format pd.set_option('mode.chained_assignment', None) def plot_radar_chart(dat...
4945a8b09671256cb8129b4cec63ea2008ff02e2f8c65c6f8b462b090c5cf994
Python
5,387
186
# model settings input_size = 300 model = dict( type='SingleStageDetectorSearch', pretrained=dict( use_load=True, load_path='./seed_mbv2.pt', seed_num_layers=[1, 1, 2, 3, 4, 3, 3, 1, 1] # mbv2 ), backbone=dict( type='SSDLiteBackbone', input_size=input_size, ...
6649e5f44f3c57d0e4fa000ce048441a65271f2d27a5e8c21322c78ab7ce81e4
Python
5,390
113
# Code from ResNet Architecture in DeepAccNet # Source: https://github.com/hiranumn/DeepAccNet/blob/main/deepAccNet_noPyRosetta/resnet.py import torch from torch.nn import functional as F class ResNet(torch.nn.Module): # Parameter initialization def __init__(self, num_channel, ...
f81cc0a755b84f61fbf3ac9f3c194a0f76b091421ccbf12e391d232a070b574f
Python
5,390
134
import torch from .vae_basic_model import VaeBasicModel from . import networks from . import losses class VaeSurvivalModel(VaeBasicModel): """ This class implements the VAE survival model, using the VAE framework with the survival prediction downstream task. """ @staticmethod def modify_commandli...
4e0f46afd1121e07e98ab53f5231b9d10e6899b0ee0f6df17145a406d25a0c64
Python
5,392
152
"""Generic case-level metadata loader for CROPro. A metadata file maps case identifiers to clinical / label information. Configure through the ``[metadata]`` section of a dataset schema TOML:: [metadata] # Path to the CSV or TSV containing case-level information. csv_path = "dataset/MyDataset/label...
592d4c9cbb7c9f3fb73a65dde738cbc297cdba94f36ebeb316f8595d64dbc60d
Python
5,392
168
from math import sqrt import numpy as np import pandas as pd from skimage import io, filters, morphology, measure, color, util, segmentation from skimage.feature import blob_log from skimage.draw import circle # from skimage.external import tifffile from scipy.ndimage import convolve import matplotlib.pyplot as plt i...