sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
622419c4d53f249fb6a46ef75dd656023291ac2d526b2e26bc736d67db9da077
Python
4,694
174
#%% import pymaid import matplotlib.pyplot as plt import numpy as np import seaborn as sns from scipy.ndimage import gaussian_filter1d from src.data import load_maggot_graph, load_palette from src.io import savefig from src.visualization import adjplot, set_theme set_theme(font_scale=1.25) def stashfig(name, **kws):...
74f213376d1d38b8003688700e04dd54077e0ddbfa7c5bb6b5657d4b050850a5
Python
4,696
125
import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import CONV_LAYERS, ConvAWS2d, constant_init from mmcv.ops.deform_conv import deform_conv2d @CONV_LAYERS.register_module(name='SAC') class SAConv2d(ConvAWS2d): """SAC (Switchable Atrous Convolution) This is an implementation of...
1bf3b3700b62ad5a224cd2b2e81189ff0db6522b94739f66b44f019ac71ddeea
Python
4,697
155
""" interfaces Created by: Martin Sicho On: 26.04.22, 13:12 """ from abc import ABC, abstractmethod from drugex.logs import logger from drugex.molecules.interfaces import MolSupplier class Vocabulary(ABC): """ Definition of the vocabulary interface. All vocabularies contain "words" that are used for encodin...
4692f6d3f04fa5031f0fb6e977a88097c2f0feeaf0a26fbb9f11b18a692348eb
Python
4,697
127
# -*- 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 torch.nn as nn import torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import numpy as np class RNN_LSTM(nn...
edd5e53429f160939015ef2ab19d1883d1cef09eb5cfa74b0b123371b166abd6
Python
4,698
136
# 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...
011b80c8eeb4a82adb3c833394f8ba1172b369e90d1bf61112a163f8dc387ff9
Python
4,700
166
import statistics import numpy as np import os import json def load_config(): config_file = os.path.abspath(os.path.join(os.curdir, 'config2.json')) with open(config_file, 'r', ) as config_file: config_string = config_file.read() return json.loads(config_string) def solve(graph, labels): "...
992030763b02d1f406830188c16f6466265c60aa820825cc9bc81cd7e9990900
Python
4,700
105
import os import argparse import torch import torch.nn.functional as F import torch.optim as optim from network.resEGNN import resEGNN_with_ne if __name__ == '__main__': parser = argparse.ArgumentParser(description='Predict model quality and output numpy array format.') parser.add_argument('--train', type=st...
3f5150aab51fd883470fbd67063491abb4b20077ff950c61ea727bdac7e0930a
Python
4,701
141
from typing import Dict, Iterable, List, Tuple from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.interfaces.obograph_interface import OboGraphInterface from oaklib.types import CURIE, PRED_CURIE, SUBSET_CURIE from oaklib.utilities.semsim.similarity_utils import ( ListPair, compute_all_pairs, ...
515ef1adacb953b26e65c4f68933204becae4e5f14af1cee722c3d107b1b797e
Python
4,701
160
''' Make a big figure of all selected fits ''' from brian2 import * import os from pylab import * import matplotlib.pyplot as plt import yaml from scipy.signal import butter, sosfilt from file_management import * from plotting import * import pandas as pd from os.path import join, splitext, split from fitting import * ...
52abd8c0ccdfce63d5be3996c5d14c2916487ccda5879560b4d3ede6d5f0b4dd
Python
4,701
127
# -*- 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 torch.nn as nn import torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import numpy as np class RNN_LSTM(nn...
400bf47e62f7efc8b9ccc177dd7ce0c72258958938f61b4ffe19af241d121b1b
Python
4,702
133
""" Copyright (c) 2019, National Institute of Informatics All rights reserved. Author: Huy H. Nguyen ----------------------------------------------------- Script for testing classification of ClassNSeg (the proposed method) """ import os import torch import numpy as np import torch.utils.data import torchvision.datase...
6cd237fa94d40348c74c5ebb31cb787425fe2ac6bf3700b04cbafc19a7976978
Python
4,702
123
# -*- coding: utf-8 -*- """Utility functions to download files.""" import os import hashlib import zipfile import tarfile import requests from tqdm.auto import tqdm CHUNKSIZE = 1048576 # 1 MB RETRIES = 3 def download_file(url, out_path, extract_out_path=None, byte_size=None, sha256sum=None, progress=True, callb...
dae2c048a875decc90b18dbf60331eb6ea62b1214e654acf371fc022a918367d
Python
4,702
132
# 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...
3908226c43385067c43790a5d6a688b849efbc60d3aa742df290323dafa9613d
Python
4,703
124
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Configure Eelbrain""" from multiprocessing import cpu_count import os from matplotlib.colors import to_rgb SUPPRESS_WARNINGS = True CONFIG = { 'n_workers': cpu_count(), 'eelbrain': True, 'autorun': None, 'show': True, 'format': 'svg', ...
68fcec0e0692a770720ac8c7ab56b15d54c8d56940a7ffdbe5ef409071cdfbf5
Python
4,703
130
# 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...
781d17a8fa244a29b5682cf2d1ff1dd3e70de9391ec9c64341cd4effae6fa1b8
Python
4,704
125
# This script is part of navis (http://www.github.com/schlegelp/navis). # but has been adapted from vispy (http://www.vispy.org) # # 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, ...
95b4ef8fb4323bd6afafefb0c83532523336e0f43b9a4625ba5bdc61b6019450
Python
4,707
122
"""IGCV3""" import torch.nn as nn from models.baselines.base_model.basic import _ConvBNReLU, InvertedIGCV3 __all__ = ['IGCV3', 'get_igcv3', 'igcv3_1_0', 'igcv3_0_5', 'igcv3_0_75', 'igcv3_0_25'] class IGCV3(nn.Module): def __init__(self, num_classes=1000, width_mult=1.0, dilated=False, norm_layer=nn.BatchNorm2d,...
fb5acc8975c53e9d3445a5ff91e46fffa46115d44af6dfad946068969ae8f467
Python
4,709
164
#!/usr/bin/env python # Read a .sam file, output several fasta files containing reads which # do not overlap in the SAM alignment. # The SAM file is assumed to be sorted by chr and position. # AUTHOR: Tom Skelly (thomas.skelly@fnlcr.nih.gov) import os import sys import optparse import re # regular expression...
391afa90de7a493ed3ad9b5c597275362f6edf22c024da88059ae988e4effc47
Python
4,710
143
from __future__ import absolute_import from __future__ import division from __future__ import print_function import multiprocessing import tensorflow as tf from tflib.data.dataset import batch_dataset, Dataset _N_CPU = multiprocessing.cpu_count() def disk_image_batch_dataset(img_paths, ...
7f7561b840c6c73d3808bb409623f5a37461574c3bb6366310c6b6f6a3ebed3c
Python
4,710
122
# # Copyright (c) 2018 Institute for Basic Science # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge...
bea07bb77a0e2197493c312b14857502294e0bbfd2f78d2b0d4f79dd2cbb9106
Python
4,710
134
# 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...
ce6c36b8cb878074634cc86b2d6db1c07477fb03cc0676d6022f1899cef2dc79
Python
4,711
128
# -*- 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 torch.nn as nn import torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import numpy as np import random cla...
eef425c7201e19a3c5d68871a411038d13a222c7a121c1b9e8f9ce786f46a706
Python
4,711
136
""" File: cmd_line_arguments.py Created: 2020/06/08 Last Changed: 2020/06/11 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...
cd7264032db0b0a7f6eff6eedffacdcfdd37ee7beaab0533298ce308348de208
Python
4,712
130
# -*- 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 torch.nn as nn import torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import numpy as np class RNN_LSTM(nn...
53f4b8c871e5206fede486b4c4210a0778912b075b5220b5374b607e41ca6585
Python
4,715
136
#%% import os try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass #%% import csv import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from pymaid_creds import url, name, password, token import pymaid rm = pyma...
c0c645d63636f0ed1d33993ff29addbfbb04964877169183b6b9c6c3c64327ed
Python
4,715
128
# -*- 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 torch.nn as nn import torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import numpy as np import random cla...
e181a381c49f1ced58c069fa2517c4a325e8ad64c1970680fbfa946924f5400f
Python
4,715
104
# Copyright (c) 2016, Konstantinos Kamnitsas # All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the BSD license. See the accompanying LICENSE file # or read the terms at https://opensource.org/licenses/BSD-3-Clause. from __future__ import absolute_im...
8f5165fe5ad7f7e2059dfefecb92d188d0e0c8ff09c8ae7fe026f45258bdcad3
Python
4,716
146
from anytree import Node import numpy as np from anytree import LevelOrderGroupIter, Node from .traverse import BaseTraverse def to_transmission_matrix(adj, p, method="uniform", in_weights=None): if method == "uniform": not_probs = ( 1 - p ) ** adj # probability of none of the synapse...
914c47ec1f5e4564685449fcf6044971d217cb54248127b1c0e619efdb9e95c0
Python
4,717
170
# SCSCSCSCSCSCSCSCSCSC # CSB Lab | Indian Institute of Science, Bengaluru # Chinmay K Haritas # Toggle Triad ODE # %% print("\nSpatial GRNs - Toggle Triad in 2D \n") print("ODE Solver") # Import Block import helpers from tt_vars import * from helpers import hill, p_i np, pd, plt, tqdm, time, njit, prange, animator,...
e8ed5192215ae1a545dbe421e648b925aecb22010b44b93a4360487b5532b825
Python
4,717
173
import itertools import logging import random from pathlib import Path from typing import List, Tuple import numpy as np import tifffile as tf from attrs import define, field, validators logger = logging.getLogger(__name__) def path_exists(instance, attribute, value): if not value.exists(): raise FileNo...
40bd0ab8087d4f59ea78d3d8ded04e905583953e5206aa4e55d73c12f84a67b6
Python
4,720
175
from typing import Tuple import logging import cv2 import numpy as np from attrs import define from cenfind.core.data import Field logger = logging.getLogger(__name__) @define class Centriole: """ Represents a centriole as a 2d point associated with a Field and a channel index. The parent attributes i...
70333954c566d5209a5739d4ad31817fa7e4d9e66246ca70782ec699965d6a63
Python
4,721
133
#!/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>. """Compare two recorder files (gotten from 'show_recorder_file_info') line by...
4b50d4ea5d5a5436349fcfcc61a2b0a3802e425dfc18f2db2b57edd3a72e8dae
Python
4,722
123
#!/usr/bin/python import numpy as np import os import Bio import shutil from Bio.PDB import * import sys import importlib from IPython.core.debugger import set_trace # Local includes from default_config.masif_opts import masif_opts from triangulation.computeMSMS import computeMSMS from triangulation.fixmesh import fi...
9c725cf7c46942793f64412e9be23c04cc0b7a235f5b7cde7b324c5da1fa8999
Python
4,722
229
# Code adopted from https://github.com/tomasjakab/keypointgan hip = 'hip' thorax = 'thorax' r_hip = 'r_hip' r_knee = 'r_knee' r_ankle = 'r_ankle' r_ball = 'r_ball' r_toes = 'r_toes' l_hip = 'l_hip' l_knee = 'l_knee' l_ankle = 'l_ankle' l_ball = 'l_ball' l_toes = 'l_toes' neck_base = 'neck' head_center = 'head-center' ...
2379e21849d9a27a367b107f3538180754f34798008611fce584fdf47b9049d2
Python
4,723
110
#!/usr/bin/env python #title :train.py #description :Network for MR-tod #author :Zifei Liang #date :2022/05/22 #usage :Network for Deep learing from MRI to TOD #python_version :3.6 from Network import Generator import Utils_model, Utils from Utils_model import VGG_LOSS from...
0ae8f248a6fcb01050d3e27eb0fa37b721e02384877ed27c3c5f0a86cfe46b71
Python
4,725
158
""" Code to explore the PDF and CDF of weight distributions. We use truncated lognormals to define the distribution of excitatory connections. We scale that by -8 for inhibitory connections. We represent the inhibitory connections with a negative number as a convention to be consistent with the network simulator (NEST...
4819179b1d9caf6e1227f12fd19aed7b3387d91320c98be8b105694edc6bee21
Python
4,726
196
from pygenn.genn_model import create_custom_weight_update_class, create_custom_postsynaptic_class, create_custom_sparse_connect_init_snippet_class, create_cmlf_class, create_custom_init_var_snippet_class, init_var import numpy as np """ weightupdate model to pass OR activation into ORNs """ pass_or = create_custom_we...
6bb89234bf0579ac47eafa8836e3ef954ebee54ab147a04d01a806cc28d9a99a
Python
4,726
129
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, ...
094d7b47ed0caab44b0296509c53e7091d2d3e2c7be6c139d8a14c16e1b2bde0
Python
4,727
128
""" File: create_cov_matrices.py Created: 2020/10/08 Last Changed: 2021/10/21 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...
7f310378bdd70e6c36b3fcee4817e24c10535e07f1d5a328388130563bec0366
Python
4,727
132
# 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 ...
cf0a4f5143bf9915503a44262cbd60684871a0f9d98bb8b7de71cd763e99f6f9
Python
4,729
159
import csv import os import sys import math def reduce_precision(value, prec=2): return "{:.{}f}".format(round(float(value), prec), prec) def generate_linear_grid(n=100, a=0, b=1): h = float(b - a) / n prec = int(math.log10(n / float(b - a)) + 2) last_h = b - h grid = [] for i in range(0, n): ...
408d3a35c6ba30a0af7256b56973cd07127aa9de0adad841fd74f587d4057e6e
Python
4,731
132
import math from mmcv.cnn import build_conv_layer, build_norm_layer from ..builder import BACKBONES from ..utils import ResLayer from .resnet import Bottleneck as _Bottleneck from .resnet import ResNet class Bottleneck(_Bottleneck): expansion = 4 def __init__(self, inplanes, ...
9872ffca7289fd6d1fab7577627a5bc394f92d33fe6b15b3d8e800d8079ea8af
Python
4,731
140
import argparse import sys from pathlib import Path import numpy as np import torch from hyperopt import hp, fmin, tpe, Trials, STATUS_OK from torch.utils.data import DataLoader from tqdm import tqdm from functools import partial import trajectory as tr from camera_frame import CameraFrameTransformer from dataloading...
b06c08cb8ada50ecad300910bdf1fa7c93b38b0a240f68d52528cf37d6ecf22c
Python
4,731
155
"""Serialization with :mod:`pyarrow` (requires pyarrow to be installed) Usage ----- A context implements serialization of relevant Eelbrain objects, and can be re-used indefinitely:: >>> context = pyarrow_context() >>> s = context.serialize(ds).to_buffer() >>> ds = context.deserialize(s) """ from inspect...
0729125445bbd047ff5f52b3c1ca270275473988705c06e367e67e6d956f832a
Python
4,732
133
import torch import torch.nn as nn class MoCo(nn.Module): """ Build a MoCo model with a base encoder, a momentum encoder, and two MLPs https://arxiv.org/abs/1911.05722 """ def __init__(self, base_encoder, dim=256, mlp_dim=4096, T=1.0): """ dim: feature dimension (default: 256) ...
e9a07eaaf61e9a9c5e4f0019b5eff09182dd300b46723fcaffec997a8ef313b9
Python
4,732
128
"""Parser for Boomer output""" import hashlib import logging import re from dataclasses import dataclass, field from typing import Dict, Iterator, Optional, TextIO from curies import Converter from oaklib.datamodels.mapping_cluster_datamodel import MappingCluster, SimpleMapping from oaklib.datamodels.vocabulary impo...
68fa644125184e2c953d815463ca3ad0598d851d46ff822d35240e95e56fe74d
Python
4,738
105
from . import SyncSmokeTest import carla import math # A wheel that jumps is off by far more than this; one that rolls, or holds for # a frame, is not. JUMP_TOLERANCE_DEG = 30.0 class VehicleWheelSmokeTest(SyncSmokeTest): """Shared setup for the smoke tests that read a vehicle's wheels. Runs on whatever map...
a46ea8d2b70e725c5021d9eda4e4a360f1ad1f9bbc1d82b6fa797f60912de75b
Python
4,741
156
import seaborn as sns from matplotlib import pyplot as plt from skfuzzy.cluster import cmeans_predict import numpy as np class FuzzySet: def __call__(self, x): raise NotImplementedError def plot(self, canvas, label): raise NotImplementedError class TrapezoidFuzzySet(FuzzySet): def __ini...
e842d0ec3c361e164f05d6998660b58ade0f67c7f27710e15d2a6f4fc123ff43
Python
4,741
109
#!/usr/bin/env python3 """Draw debug primitives in the CARLA world: points, lines, arrows, boxes, text. Commands (all take a --life in seconds and an optional --color r,g,b): point --at X,Y,Z [--size 0.1] line --from X,Y,Z --to X,Y,Z [--thickness 0.1] arrow --from X,Y,Z --to X,Y,Z [--thickness 0.1 --a...
fa26a82fb24ce5be942f0bc8ae1f16a67cf68bafaef03e13d348fcf01a25e015
Python
4,741
198
import logging import os import shutil import subprocess from collections.abc import Generator from pathlib import Path from subprocess import TimeoutExpired _logger = logging.getLogger(__name__) def _switch_workdir(path: Path | None) -> bool: """Check if it makes sense to change directory""" if path is Non...
1e8983966efb3dbb25d69f2a839407f934d7bcb7aaf2f4340caa2bdd9a623d40
Python
4,742
129
"""Fixtures: an API app with a real mock-worker subprocess behind Starlette's TestClient.""" from __future__ import annotations import sys import time from dataclasses import dataclass from pathlib import Path import pytest from starlette.testclient import TestClient from carla_cosmos.synthetic import make_clip fro...
8b4222038a676c6cd3f0db124e293c03c734296955359d78a7f5bf62bfe432a2
Python
4,742
127
import pandas as pd import numpy as np import networkx as nx from networkx.algorithms import bipartite import itertools def bipartite_random_nsp(ntarg, p, numspines, numinputs): # p : probability of connecting an edge G = nx.MultiDiGraph() # multiple edges between two neurons will be counted list_targ = n...
d63c3b936f9053f5c603a8c7e2035471ddc5bd142c5bc781fa7d6f4d6896c138
Python
4,744
120
# 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...
ec7ea4ce87e70d353fc937d7368cf1e5fbd97401d8615ea5a000dff4c6f06723
Python
4,746
113
# basic imports import os import pickle import numpy as np import pyqtgraph as qg # framework imports from cobel.agents.sfma import SFMAAgent from cobel.interfaces.gridworld import InterfaceGridworld from cobel.analysis.rl_monitoring.replay_monitors import OptimalityMonitor # store experiment directory cwd = os.getcwd(...
b111b08f5484f528debfb0a2d65676c8fe2fc393430a9631b8a506c1d051b3e5
Python
4,747
139
# 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...
5560654b5d753c2aa10304cf7d8b7ed096445e72c007f84093dcd3b1bd19fb87
Python
4,748
175
import cv2 import torch from model import U2NET from torch.autograd import Variable import numpy as np from glob import glob import os def detect_single_face(face_cascade,img): # Convert into grayscale gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # Detect faces faces = face_cascade.detectMultiScale(gr...
f8122590611f40e9e03a54b9f4db38369881742af7ecc06706b07e4e8f4b469d
Python
4,748
139
# Copyright 2020-2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
21a22a010b10d3e3e2b016d5643afaa1bee48103c1b0681786d02523bfa4cbe0
Python
4,750
150
from typing import Tuple, List import cv2 import numpy as np import pandas as pd from attrs import define from ortools.linear_solver import pywraplp import logging from cenfind.core.structures import Centriole, Nucleus logger = logging.getLogger(__name__) def flag(is_full: bool) -> Tuple[int, int, int]: """ ...
4f5de0424def5c669beef58733ab47eac62146ee27af3a3130007c26877ae53a
Python
4,751
126
""" Author: Benny Date: Nov 2019 """ from data_utils.ModelNetDataLoader import ModelNetDataLoader, load_data, PointSampler, Normalize, RandomNoise, RandomRotate, toTensor from torchvision import transforms import argparse import numpy as np import os import torch import logging from tqdm import tqdm import sys import i...
631bc3bedf993b5ceee57167535bd954c649aba41ada28b3ce3f86c605cfe7cd
Python
4,752
173
import random import re import torch import numpy as np import pandas as pd from collections import UserList, defaultdict from rdkit import Chem REGEX_SML = r'Cl|Br|[#%\)\(\+\-1032547698:=@CBFIHONPS\[\]cionps]' def normalize_smiles(smi, canonical, isomeric): normalized = Chem.MolToSmiles( Chem.MolFromSm...
e22927d156c75bdafd1350c46c8c8066822208c7f79ae8dce90d072a3c06578d
Python
4,752
132
#!/usr/bin/env python3 """ File: export_cf_interaction_to_excel.py Created: 2022/05/16 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 ...
1db56b021bc63a4b48fd6692e86bb76730a49fa1564275905f9b82c2dff52d5c
Python
4,753
126
#!/usr/bin/env python import os import cv2 import numpy as np import os.path as osp import SimpleITK as sitk from PIL import Image def compute_specificity(SEG, GT): TN = np.sum(np.logical_not(np.logical_or(SEG, GT))) FP = np.sum(SEG) - np.sum(np.logical_and(SEG, GT)) spec = TN / (TN + FP) return spec...
662a5e675a839bee5e5316826dbcc0ff0eaae550792b971a96e93ebf6fce07cf
Python
4,753
149
import plotly.graph_objs as go from mne.channels.layout import _find_topomap_coords from mne.utils.check import _check_sphere from mne.viz.topomap import _make_head_outlines import mne import numpy as np import RV.constants as c def get_channel_topography_plot(raw: mne.io.Raw): """Generates channel-topography ...
cd401dfa4212ab9d23fd2ff794e5b012ec46586141c78d389e62e96afbb1e6fd
Python
4,754
102
import torch import numpy as np import torch.nn.functional as F def spectral_projection_divergence_free(u, domain_size, constraint_modes): """Apply spectral projection layer to make a velocity field divergence-free. Parameters ---------- u : torch.Tensor Input velocity field [batch, 2, he...
247d68fcc7b2ef33e3861e461ce6e429a01526052055527dae67d483488170f1
Python
4,759
118
import cv2 import numpy as np from PIL import Image import math import numpy as np # import torch # from torchvision import transforms def rotate_image(image, angle, center = None, scale = 1.0): (h, w) = image.shape[:2] if center is None: center = (w / 2, h / 2) # Perform the rotation M = cv...
8041a504b8eca19b3e53ec98663243b57e779521e1f5313d66733cd1286d8dac
Python
4,759
118
# basic imports import numpy as np import pickle def recover_states(replay: list) -> np.ndarray: ''' This function extracts the states of replayed experiences. Parameters ---------- replay : A sequence of replayed experiences. Returns ---------- sta...
fad6fad1379734d920f67bbb15d0509087bbcac790d88eca8de8379b0e14ae62
Python
4,759
105
"""Public API and bounded CLI regressions for disabled llocal (#809).""" from types import SimpleNamespace import pytest from MACS3.Signal.FixWidthTrack import FWTrack from MACS3.Signal.PairedEndTrack import PETrackI from MACS3.Signal.PeakDetect import PeakDetect from test_callpeak_local_windows import inputs @pyt...
86ab3e12b62396a0425ac1dd93414c260dc83a6b1ede9b2ed59d03d30b1aed96
Python
4,762
125
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, ...
c571c088c34a280694978f8f0021dcbb3d8d2d2fe0e658ef73c08afc13f00a0f
Python
4,763
131
""" File: create_auc_per_expl_var_plot.py Created: 2020-12-17 Last Changed: 2020-12-17 Author(s): H.H.Wiersma Code to create distribution plot and a mask image used in the research plan Copyright (C) 2019 H.H.Wiersma This program is free software: you can redistribute it and/or modify it under the ter...
7d3fd3967f4ba6d3e17954cfeb8487ccc74a8898e60197279816b3ced6a3aecc
Python
4,764
156
from itertools import chain import pytest from eelbrain import datasets, plot from eelbrain.plot import _base from eelbrain.plot._base import Layout, ImLayout from eelbrain.testing import skip_on_windows from eelbrain._wxgui.testing import hide_plots def assert_layout_ok(*args, **kwargs): layout = Layout(*args, ...
8bd846bb0890ccea3ee416ab9ee15b7ff58fcbf465a20b20047e7d3ebb0d39a6
Python
4,765
153
import os import copy import numpy as np import pandas as pd import math import random import matplotlib.colors as colors from sklearn.model_selection import train_test_split from sklearn.decomposition import PCA from siVAE.data import data_handler as dh from siVAE.util import reduce_dimensions fro...
bc2ee90f9dfecd981fbfa78ef152db4483b36bc5479f04cebd31209e10324f81
Python
4,767
127
import os import os.path as op import sys from abc import ABC, abstractmethod import numpy as np import json from drugex.logs import logger from drugex.environment.neural_network import STFullyConnected from sklearn.cross_decomposition import PLSRegression from sklearn.naive_bayes import GaussianNB from sklearn.svm i...
0e61192e94a7e7c6574f01ab062ac4f0bbd2128a7e4a0279a5f910d199eebca5
Python
4,769
129
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, ...
4124aca6fe807d557c9d818927a4df678debf1c77c85f4e4f994f44dd694d160
Python
4,771
122
#!/usr/bin/env python3 """ File: combine_julienbryois2021_files.py Created: 2022/01/12 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...
3954c182cc8ed3a1e185c40a8a3d63a9b1b3086baef45b359b97b3a579212182
Python
4,772
109
"""End-to-end capture against a live CARLA server. Run with ``CARLA_COSMOS_TEST_PORT=<port> pytest -m integration``. Keeps the load small (one hero, 8 frames, single camera) because the GPU is shared. """ import numpy as np import pyarrow.parquet as pq import pytest pytestmark = pytest.mark.integration @pytest.fi...
ab8042535c37a0a22a3af4602eddcf0bdbef0f720ac24ab34d4fc5ec72dbafcf
Python
4,774
109
# 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>. from . import SyncSmokeTest import carla import math import time class TestVehicleTelemetry(SyncS...
b7c0cb2c015f6ef32a28d7b4ea55c8e3e66137624bf915b15f1579fccbd3f3fd
Python
4,775
165
import difflib import math import os from pathlib import Path from typing import List from linkml_runtime.utils.yamlutils import YAMLRoot ROOT = Path(__file__).resolve().parent INPUT_DIR = ROOT / "input" OUTPUT_DIR = ROOT / "output" # When the test suite is parallelised with pytest-xdist, every worker imports # this...
000a2251e3e496bc38672d840acc715f8d8c60bcf1b0701baabffd02c6dd4d1b
Python
4,778
166
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib.dates as mdates import pandas as pd def plot_test_anomalies( X_test, ANOMS, fig_cols=1, color="r", s=10, alpha=0.4, fontsize="large", loc="left", figsize=(20, 20), ): n_nodes = X_test.shape[1] fig_row...
3906fd8933bfd97615f013fdf16433021a7cbaaca3da63cd248d3df5b3074f1e
Python
4,778
119
''' Adapted from kuangliu/pytorch-cifar . ''' import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_planes, planes, stride=1): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d( in_planes, plan...
80f246fec05aafcf6c7e4301335ea45bb0e73694fb98b9b102d0979ab78f15a2
Python
4,778
112
"""Shared helpers: sync mode, traffic population, freezing, cleanup.""" import random, time, carla def connect(): c = carla.Client("localhost", 2000); c.set_timeout(60) return c, c.get_world() def set_sync(world, tm=None, on=True, dt=0.05): s = world.get_settings(); s.synchronous_mode = on; s.fixed_delta_...
d4ee1c6de893a25bffb657c82fc2b35cf98c67349e27656ed6ac5b47aef92e9f
Python
4,778
112
#!/usr/bin/env python3 """Preview camera rain on a dedicated CARLA server; replaces its current map. python rain_lens_demo.py --port 4654 Requires pygame and numpy. 1-4 select rain; N switches day/night; Space toggles automatic cycling; Esc closes and restores world settings. """ import argparse import queue import ti...
5bf0c15a65bb92888839011336562651cad48b78d82b68a52ee58b52f82f02c1
Python
4,779
135
# 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...
aed8867534b97e59f2476bb37569bdfbeef8a7cccd6e45832ca21e601d1da044
Python
4,779
101
# SPDX-FileCopyrightText: © 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: MIT """``dict_to_camera_spec`` builds every lens model the render engine accepts. ``CameraSpec`` is a oneof over three lens models and NRE serves all three, but this function used to build ``FthetaCamer...
fc8801ff52274fa857f058c92cf1755c9546ff8e53aa81cf11555d93febf33bc
Python
4,783
126
import argparse from dateutil.relativedelta import relativedelta import geopandas as gpd import descarteslabs as dl from tqdm import tqdm from scripts import contour_gen, dl_utils DL_SYSTEM_PARAMS = { 'image': ('us.gcr.io/dl-ci-cd/images/tasks/public/' + 'py3.8:v2020.09.22-5-ga6b4e5fa'), 'cpus...
0622feb357167a9877da0a619b728a50bad05a66141c623e9c2eedd38b994d01
Python
4,784
115
import math import numpy as np def get_min_max_size(network_size, scale_list): conv4_3_scale = scale_list[0] min_scale = scale_list[1] max_scale = scale_list[2] source_num = {'300': 6, '512': 7, '1024': 8}[str(network_size)] scales = [conv4_3_scale * 0.01] for i in range(1, source_num + 1): ...
a81a20e984e40461d72546290bd5eb7d805640ee4ecf58c3b14e797e1b6674ac
Python
4,784
127
# -*- coding: utf-8 -*- import queue from collections import OrderedDict import pandas as pd import torch.nn as nn from utils.model_hook import CModelHook from utils.summary_tree import CSummaryTree, CSummaryNode pd.set_option('display.width', 1000) pd.set_option('display.max_rows', 10000) def get_parent_node(root...
271329a7a20ffdbe9e3d1e6c0ea22b70c2d9adf1622753e329f990901fa6d5dc
Python
4,786
159
################################################################### #### #### Version: 1.1.7 #### Date: 6/24/2023 #### Description: This file contains the code for the configuration menu of Neuron EZ. The current config menu contains sections for about, reference, and an option to set debug mode. #### Author: Evan Cobb...
ec3b64040d33146c66725c623cf73cdf5fc9eacb2d418783c6bc12111682e1f7
Python
4,786
116
#################################################################################################### # 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 ...
d2681452dc75e3eb5a45e3d300487396d1976725bfdf5cdb2dc0a4554141d9f6
Python
4,787
129
# -*- 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 torch.nn as nn import torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import numpy as np import random cla...
50eafa3c01824200478886fd080d5b68a53ba1def8620b9b27c3ff2ae74e7901
Python
4,788
114
"""Phase 3d experiment: latent inhibition as the dual-DAN discriminator. Compare three agents on the LI paradigm: 1. Pure RPE (Bennett 2021 single-valence on connectome) 2. Pure AIF (Bayesian observer with posterior entropy DAN) 3. Dual-DAN (RPE with eta gated by AIF surprisal) For each: run two groups (p...
aa42dd5b04157d5d97c658d935f2179273f31723c916a795b4ea56821541ed87
Python
4,788
126
# 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...
35a2833e9db821f27ce535f1efde395743e3a8c62ca43e255d9445270942ec1a
Python
4,789
137
import time import math # import vis_funcs as vis_funcs # import utils.vis_funcs as vis_funcs import numpy as np import pandas as pd def timeSince(since): now = time.time() s = now - since m = math.floor(s / 60) s -= m * 60 return '%dm %ds' % (m, s) def simple_optimizer(rnn, lr): for param in ...
0bdc413af0e1f6b192ec467147d421d49424bb059cc53c3c16f8fff26b143d50
Python
4,790
132
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unetsl.model import sys import click import collections def patchEndsofUnet(first, second, out="transferred.h5"): """ Transfers the weights of the first model to corresponding layers in the second model. (If inverted the first model is the ta...
01bbb096812289b0941448b193efc5748d935bd2e35d5464246e780343e6f90e
Python
4,791
151
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import warnings import numpy as np from numpy.testing import assert_allclose, assert_equal import pytest import scipy.stats from eelbrain import datasets from eelbrain._stats import stats from eelbrain._stats.permutation import permute_order, rand_rotation_matr...
5c9ea2172e4b9767e9d1f40588bcc0e7d47b8a720d4d50966ef03288bbf16fb9
Python
4,791
120
#!/usr/bin/env python # rowrateplot - a command line utility to generate spike frequency vs. # time for groups of neurons. It takes a single filename # as argument, with a line for each time step containing the simulation # time, followed by the average spike frequency during that time step for # each group of ...
002bd9074962207ff075e4b346f32be3a5125c729d1c0f848e7455136509d050
Python
4,793
98
# 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...
6429ac417af701bd7987578365adc77dc777d51fc3bdcdd40711f79991547eb0
Python
4,794
132
# 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...
647d9191edb7e7a838477c571e2231811c60521f44b285966366227a12d8e110
Python
4,794
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...
a001a3c05220d2b753f1acbdc48171c4f0e92b10096b2d060d7c64824021fa24
Python
4,796
146
import logging import sys import warnings from dataclasses import asdict import chika import pandas as pd from imblearn.metrics import geometric_mean_score from sklearn.ensemble import ExtraTreesClassifier, RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.metrics import cohen_kap...
228ae887c9f081190f440917a6158648f1a9938f353f644df2d4ae68ce2df8fd
Python
4,797
135
import torch from torch.utils.data import Dataset from mol_tree import MolTree import numpy as np from rdkit import Chem from rdkit.Chem import Descriptors from rdkit.Chem import AllChem from torch_geometric.data import Batch from torch_geometric.data import Data class MoleculeDataset(Dataset): def __init__(self...