sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e9c55bda4afc1e31839e572148f09b2a525c328ce085d043539f88ccc647e95d
Python
4,350
160
# 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...
e98828b4ab2bb044afc2ae6929df8e77f44a16a1ef458bf02e21caf0cc34f784
Python
4,351
138
from __future__ import division from __future__ import print_function from builtins import str from builtins import range from scipy import signal from scipy.stats import uniform, norm import numpy as np import seaborn as sns import matplotlib.mlab as ml import matplotlib.pyplot as plt from sima import spikes ######...
010950641a1faf2882214c461e8db2714c118a2f9d0a631ec60ba7bfb58dba74
Python
4,352
130
# taken from https://github.com/tonylins/pytorch-mobilenet-v2/ # Published by Ji Lin, tonylins # licensed under the Apache License, Version 2.0, January 2004 from torch import nn from torch.nn import BatchNorm2d #from maskrcnn_benchmark.layers import FrozenBatchNorm2d as BatchNorm2d from maskrcnn_benchmark.layers imp...
a06c072a55779795c881f80b0becf468fa77f53d19582e914f5a8f3b971c93c0
Python
4,354
137
import gc import os import tempfile import numpy as np from src.transforms import * gc.enable() import random import numpy as np random.seed(666) from selene_sdk.utils import load_path from selene_sdk.utils.config_utils import get_full_dataset, interval_from_line CHROM_SIZES = { "chr1": 249250621, "chr2...
2b33e8b4889fb917e080f1447e8bd5141b7668ec282200bb95339c0319984f4c
Python
4,355
130
import torch from torch import nn class GeneratorLoss(nn.Module): def __init__(self, model_path, device): super(GeneratorLoss, self).__init__() ctf_model = regression_model.ResidualLowpass() ctf_model.to(device) checkpoint = torch.load(model_path) ctf_model.load_state_dict(checkpoint['model_state_dict']) ...
274b0ba62946507c21b3518f0d5a72b5dcf377e0d99bc077304e40816aff4494
Python
4,356
111
""" Plotting tools in nilearn ========================== Nilearn comes with a set of plotting functions for easy visualization of Nifti-like images such as statistical maps mapped onto anatomical images or onto glass brain representation, anatomical images, functional/EPI images, region specific mask images. See :ref...
5c11d551052d50ecd83c6d8387fdc141afc0aca8fde71c9a3f5d74d8d40984b0
Python
4,356
197
# Generic import torch import skorch import numpy as np import pandas as pd import matplotlib.pyplot as plt # Basic Functions in Torch from torch import nn from torch import optim from torch.utils.data import DataLoader # Basic Functions in Skorch from skorch import NeuralNet from skorch.callbacks import EpochTimer f...
85563fadc9a24ec8689630a5c932eeff35ac1083dcabb30b46de68a82efbc287
Python
4,356
136
# 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...
40b7f231319ac091e62a8c8cd8d92efd89bc4490369964a5e30d1916dd4a774a
Python
4,357
147
from datetime import datetime import itk import numpy as np import torch TIMESTAMP = datetime.now().strftime("%Y%m%d_%H%M%S") PANDAS_FCSV_KWARGS = { "comment": "#", "names": [ "id", "x", "y", "z", "ow", "ox", "oy", "oz", "vis", "s...
33846375caa24ecbb90a87f3f6959f8bd467399273f29569c02a1a333972574e
Python
4,358
101
import numpy as np def linear_(x, params): a, b = params return a*x+b def spike2calcium(spike_times, ca_times, param): tau_r = param[0] # rise tau_d1 = param[1] # decay1 tau_d2 = param[2] # decay2 k = param[3] ca_trace = np.zeros(len(ca_times)) for n, spk in enumerate(spike_times): ...
617fc24f37566918e24c50b351cee135a9665f5ea3966017a541e1cfb85e9d34
Python
4,358
120
import torch.nn as nn from mmdet.core import bbox2result from ..builder import DETECTORS, build_backbone, build_head, build_neck from .base import BaseDetector @DETECTORS.register_module() class SingleStageDetector(BaseDetector): """Base class for single-stage detectors. Single-stage detectors directly and ...
2d4189588667ac41952dcd2f1b5353fabc13cd654f0bc2e551572179bb23c9ef
Python
4,360
98
#%% import pymaid import navis #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 import connectome_tools.process_skeletons as skel # allows text to be editable in Illustrator plt.rcParams['pdf.fonttype'] =...
c5a8445cef54f9796a3994cb0458faec570d8d6c3e58b62a0d2c1791d8a93d32
Python
4,360
127
import argparse import os from bruker2nifti.converter import Bruker2Nifti import bruker2nifti._utils as utils def main_scan(): """ Parser from terminal with $ python2 bruker2nifti_scan -h $ python2 bruker2nifti_scan -i input_file_path -o output_file_path """ parser = argparse.ArgumentParser(...
0aaab76224b1a7ca7e16b24ab4be5d63e0212794fbc21d12a0bf56c6de60d763
Python
4,361
102
# 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...
a648d2a44277569e8dc26d29b2ac3545563198a82341610cb7790825aa18830d
Python
4,361
106
import numpy as np import torch import random import os import argparse from pathlib import Path from tqdm import tqdm from torch.utils.data import DataLoader import aug_accuracy as util from aug_accuracy import InputError def train(config, dataset_name, data_type, nn_type, run_num): data_root = config['General']...
79fe493bd2db224db9591d88f3bff8190ca989cd2926fc1220284c5e80dd817e
Python
4,363
104
import re import torch import logging from collections import OrderedDict def remap_for_paramadapt(load_path, model_dict, seed_num_layers=[]): seed_dict = load_checkpoint(load_path, map_location='cpu') logging.info('Remapping for parameter adaptation starts!') # remapping on the depth level depth_map...
b4022c0d9800ccad99369615d6694ed841affb182ed5418a85c55d4e439478f2
Python
4,363
126
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
05d9807f67b535f52b5592f525154a0a2d5c827398084e5993f9e2ae1e825f51
Python
4,364
119
import logging import numpy as np logger = logging.getLogger(__name__) def expand_to_dim(values, dim): expanded = [] for v in values: if not isinstance(v, (tuple, list, np.ndarray)): v = [v] if isinstance(v, np.ndarray): v = list(v) if len(v) != dim: ...
5180a33a4d77e897d6f75ec5fd3c94d77eb6771f674ef14fa25816e80ce8319c
Python
4,367
130
import torch from torch import nn def skip_connection( in_features, out_features, n_dim=2, bias=False, skip_type="soft-gating" ): """A wrapper for several types of skip connections. Returns an nn.Module skip connections, one of {'identity', 'linear', soft-gating'} Parameters ---------- in_fe...
843fc4ad0cc428d8b7174ffe700d9bb0f2f064f60831b02392e80dcc9c16900e
Python
4,367
120
# -*- coding: utf-8 -*- """ Created on Sun May 22 21:44:18 2022 @author: earg8 """ from PIL import Image from numpy import asarray import numpy as np from skimage import filters from skimage.color import rgb2gray from attention import Attention class InputReader: def __init__(self, numPixels = 108, state = ...
32f87d45d6450865f12479d91ee06490388bfed1568902280b4736fc7f8c7c7a
Python
4,368
111
""" A randomly sampling batch sequence object Samples randomly across uniformly randomly selected SleepStudy objects Does not sample uniformly across classes (see BalancedRandomBatchSequence). """ import logging import numpy as np from utime.sequences import BatchSequence logger = logging.getLogger(__name__) class ...
9b7ac4f1e603f1589a26d921889e5c30f3302fe03b40b64b9b9a002b429e0d2a
Python
4,368
143
import torch.nn as nn import torch.nn.functional as F import torch class AttU_Net(nn.Module): def __init__(self, classes=2, aux=True): super(AttU_Net, self).__init__() n1 = 64 filters = [n1, n1 * 2, n1 * 4, n1 * 8, n1 * 16] self.Maxpool1 = nn.MaxPool2d(kernel_size=2, stride=2) ...
c08f6b3cefb33dcf48d318b9ab3a65e01bb80755d78957752d8d99b7c456be34
Python
4,368
136
from cgtasknet.tasks.reduce import ( CtxDMTask, CtxDM1, CtxDM2, CtxDMTaskParameters, ) def test_dm_task_size(): assert CtxDMTask().feature_and_act_size == (3, 3) assert CtxDM1().feature_and_act_size == (3, 3) assert CtxDM2().feature_and_act_size == (3, 3) def test_ctx_task_run_one_data_s...
739e9e6e367aa46ac553dbf30a09d1caf55b1b8179a9a1704c56910f35317776
Python
4,370
119
import numpy as np from . import kt, models __author__ = "jieqing jiao <jieqing.jiao@gmail.com>" class TAC: def __init__(self, tac, dt): self.tac = tac self.dt = dt self.mft = kt.dt2mft(dt) self.km_results = [] def run_model(self, model_name, model_inputs): km_resul...
1419bc353dd5cb83646b0743ae09383a8d276237d7b0bfb80a1aad662b9c5f11
Python
4,371
106
# -*- coding: utf-8 -*- # Versión 3.0 clase posición reducida # Autor: José Miguel Ramírez Sanz #imports import numpy as np import math #Posiciones versión 3.0 reducida class Posicion(): # param x: lista con los valores del eje x de los puntos obtenidos con detectron #param y: lista con los valores del ...
012de6d9a00cd34951669ce651ee1bdd4ecf10686c289389ef93a5baa70384a3
Python
4,372
103
# basic imports import os import gc 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.misc.gridworld_tools import make_empty_field # store experiment directory cwd = os.getcwd() # shal...
9f209fac57109a5a62d5abaf8f5d2e6d952d137727314a3f6aa5e35bf05a2ee0
Python
4,373
135
from Classes.RelationshipMap import RelationshipMap from Classes.RelationshipCollection import RelationshipCollection from Classes.SearchComponent import SearchComponent class RelationshipIdentifier(SearchComponent): def GetDirectRelationships(self, keywords): # Search between keyword matches and subreg...
bf777c5fdb1eb38a633aa72486eecc494c81b2d7c945c755bd4c9870650011a6
Python
4,374
147
""" interfaces Created by: Martin Sicho On: 06.04.22, 16:54 """ from abc import ABC, abstractmethod from drugex.logs import logger from drugex.molecules.converters.interfaces import ConversionException class Molecule(ABC): @abstractmethod def annotate(self, key, value): pass @abstractmethod ...
01142d159fc79f95c146286646609bb756f14dec535f2b66a951e8ab1330b56f
Python
4,375
143
from abc import ABC, abstractmethod from drugex.logs import logger from drugex.molecules.converters.interfaces import ConversionException class Molecule(ABC): @abstractmethod def annotate(self, key, value): pass @abstractmethod def getAnnotation(self, key): pass @abstractmethod ...
cdde1046140d3bff29c7908516765c2d0e1bfdc9c9a9749d8e21b6798b06427a
Python
4,375
97
# 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...
e440f23f9e88f14391ff7a086283522d9d3e787ea14d9a48bb797231722d26ef
Python
4,377
125
# A simple torch style logger # (C) Wei YANG 2017 from __future__ import absolute_import import matplotlib.pyplot as plt import numpy as np __all__ = ['Logger', 'LoggerMonitor', 'savefig'] def savefig(fname, dpi=None): dpi = 150 if dpi == None else dpi plt.savefig(fname, dpi=dpi) def plot_overlap(logger,...
2ed6102fcd53ac35d62205d3a391e6c0798317af66dceda0a77341bd0f507186
Python
4,378
136
"""Configuration file for pytest. Initialize different fixtures for automatically loading test transcripts and creating objects for testing. Keeping the test data for full transcript (subsections) in csv files helps keep the test files clean and readable. Other long strings, that do not need the hook for automatic gen...
35e2501969cd56bf2f87e663f75e71006717d776371b693cbba30a1b9e6582b9
Python
4,378
130
import torch from torch import nn import regression_model class GeneratorLoss(nn.Module): def __init__(self, model_path, device): super(GeneratorLoss, self).__init__() ctf_model = regression_model.ResidualLowpass() ctf_model.to(device) checkpoint = torch.load(model_path) ctf_model.load_state_dict(checkpoin...
f350c6f0c3ac609779f92790aa53ef18dfa60f7f673adaf36b52867250c49f68
Python
4,378
96
from .vehicle_wheel_smoke_test import VehicleWheelSmokeTest import carla import math # A steered front wheel passes well beyond this while the vehicle is turning, # and settles well inside it once the steering command returns to centre. The # exact angle depends on the asset's steering curve, so nothing here asserts ...
feb5253299c1abac509980e8243a119ffc33ddf16a09b2f086996a79739c980e
Python
4,378
167
#%% from pathlib import Path import colorcet as cc import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import seaborn as sns from umap import UMAP from graspologic.embed import LaplacianSpectralEmbed from graspologic.plot import heatmap, pairplot from graspologic.utils import ...
e041c1be57d933f00dd27dfbb0b6f8a5bac2db1d4578b81c6fc7d7a1576ab710
Python
4,379
109
import logging from typing import Callable from tensorboardX import SummaryWriter import torch import torch.nn as nn from torch.optim import Optimizer from torch.optim.lr_scheduler import _LRScheduler from tqdm import tqdm from chemprop.args import TrainArgs from chemprop.data import MoleculeDataLoader, MoleculeDatas...
ec78488a729e42060aa5165005396d98dc22e599622f8fd1de723702eee7a94e
Python
4,379
149
import gzip import logging import sys from typing import List, Optional import click from semsql.sqla.semsql import ObjectPropertyNode, Statements from oaklib import get_adapter from oaklib.datamodels.vocabulary import ( DESCRIPTION, EQUIVALENT_CLASS, HAS_DEFINITION_CURIE, OWL_SOME_VALUES_FROM, RD...
fbe96d7d060dfaf47a0788fcd6fc53b2a657b499a9194a92affe599e65bea6a3
Python
4,380
150
#%% IMPORT MODULES from __future__ import division import os from textwrap import dedent import pandas as pd import h5py from ezephys.rectools import ABFLoader from grr.CurveFit import extract_gating_data, fit_gating_curve #%% LOAD DATA OUTPUT_PATH = os.path.join(os.getenv('DATA_PATH'), 'processed', '5HT') if no...
735979d80c49f686573db40f36190c5ba9fbea8317c3f3f1375129aa453534cd
Python
4,382
125
import pandas as pd import random import pickle from src.preprocess import standardization_pipeline, remove_smiles_duplicates if __name__ == "__main__": # set random seed, used for error generation & initiation transformer SEED = 42 random.seed(SEED) name = 'selective_ki' errors_per_molecule...
65195700fb30ad1ad4bf7565347fa6fa8c65146f8b6a03ea41a53b45cef36d56
Python
4,386
136
# model settings model = dict( type='MaskRCNN', pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, ...
ab94c570768bfb8c8c41b58fd647356b002378cba2030207d63ee76718b936a1
Python
4,386
138
# Code adopted from https://github.com/tomasjakab/keypointgan import os import torch import re import numpy as np from collections import defaultdict def swap_points(points, correspondences): """ points: B x N x D """ permutation = list(range((points.shape[1]))) for a, b in correspondences: ...
11325c926ad6cb0b3ce6606705e2e4344d148165ebcf34ad76ef083b98c7dcf9
Python
4,387
185
""" Create pipeline =============== Sample file to create a pipeline. """ # %% # First of all, lets import the main libraries and load the iris data. # Generic import os import yaml import time import torch import pickle import pprint import numpy as np import pandas as pd import matplotlib.pyplot as plt # Librari...
365df63d8d4bc3d078b89a9c219982798c2964305721d07ae7482babcfa6a117
Python
4,387
86
#! /usr/bin/env python3 """Python API, single-view Cosmos 3 with the world-scenario (``wsm``) control. python api_cosmos3_wsm.py --clip ./clips/carla_town10_1700000000 \\ --prompt "heavy rain, headlights on" [--backend cosmos3-super] [--results ./cosmos-results] The clip's ClipGT scene package (``<clip>/s...
693c69f1edd2465a8d8035ceed36438268ddfa00f94f7e47cfadf7c2aac7cd1e
Python
4,388
131
################################################################### #### #### Version: 1.1.7 #### Date: 6/24/2023 #### Description: This contains all the functions used to create GUI elements. #### Author: Evan Cobb #### ################################################################### import sys from PyQt5.QtWidge...
75755a8720b24a7820792ed37de89443c7a0de5a3bdb170fbdef43f09a164a50
Python
4,389
125
__author__ = 'jieqing jiao' __email__ = "jieqing.jiao@gmail.com" from . import models from . import kt import numpy as np class TAC: def __init__(self, tac, dt): self.tac = tac self.dt = dt self.mft = kt.dt2mft(dt) self.km_results = [] def run_model(self, model_name, model_...
b0616c1a61b04549cd14f46b8919798fd6e62edc4f6a521c0e1919b87a01c63d
Python
4,390
112
# Copyright 2020-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 agre...
18fffa06d9dd17f9c0ab52a08f9b79315e29545d6182a372c35508e2495d81a7
Python
4,392
118
import pytest from kgcl_schema.grammar.render_operations import render from oaklib import get_adapter from oaklib.datamodels.synonymizer_datamodel import RuleSet, Synonymizer from oaklib.utilities.lexical.synonymizer import apply_synonymizer, apply_synonymizer_to_terms from tests import CYTOPLASM, INPUT_DIR, NUCLEAR_M...
3e65b6f3b333b750b399e89d45498541c72ecdbc735ee929b50f01534b28ac74
Python
4,392
101
import sys sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/") import networkx as nx from networkx.utils import pairwise import pandas as pd import numpy as np import connectome_tools.process_skeletons as proskel import math from tqdm import tqdm import csv # import and split skeletons int...
0a458b7d655bc9c53501bf18e326e15a163ba7b333f1907c114418b23579db92
Python
4,393
125
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
1b9ff458b99e1f7927f26c7ee3e53b3e52b7f43fd0d84b5e5c9570d6ada9e641
Python
4,393
135
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 27 17:45:40 2022 @author: spiros """ import os import pickle import pandas as pd def zero_entries(df): return df[(df.values == 0).any(axis=1)].index.values.tolist() dirname = "data_synapses_new2/" with open(dirname + 'circuitry_analyzed.pkl...
44cfd68c4151933186ba6298d7663f148c0aefc80a4df4e601ceb027082aa3d4
Python
4,393
114
''' Inspired by https://stackoverflow.com/a/24092195 Use `run_parallel` function to parallelize a job. Important: - Threads have access to the same memory. - Must be careful that they don't overwrite some shared object. - Can cause a slowdown when reading shared memory. - The most natural way to avoid these prob...
8258e8c3782bc70c92703a14be9683c42e3b707c57e10efd12d774f2bfef4a66
Python
4,393
154
if __name__ == '__main__': # ------------------ # Libraries # ------------------ # Generic libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt # Basic functions in sklearn from sklearn import datasets from sklearn import metrics from sklear...
93917896c2c2c6abf1e7e1a55236f2d9cd53b7971a9f9cbe442783700b363074
Python
4,394
164
"""Example script for training HIVE on HMM simulated data. - Should achieve a dice score close to 1. """ import os import numpy as np from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from osl_dynamics import data, simulation from osl_dynamics.inference import metrics, modes, tf_ops from osl_dynam...
96c4ec5d19273e9b0d13878218d1aed1f2bacc2d252aa7a1f2180d887b993aa9
Python
4,397
115
from dash_extensions.enrich import Serverside, Output, Input, State, callback, clientside_callback, ctx from dash.exceptions import PreventUpdate import numpy as np import RV.constants as c def register_scale_callbacks(): # Update scale using +/- keys on keyboard clientside_callback( """ ...
9e787f65834961037058e29407594d49f9effba1cecbc1c032db446058a4205f
Python
4,397
135
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 27 17:45:40 2022 @author: spiros """ import os import pickle import pandas as pd def zero_entries(df): return df[(df.values == 0).any(axis=1)].index.values.tolist() dirname = "data_synapses_new2/" with open(dirname + 'circuitry_analyzed.pkl...
aa5a363940f18d1348e7a964e1ca7495ea3c5cfcf9858051fb1efe9a0bef486a
Python
4,397
150
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pathlib import sys import unetsl.data import skimage.draw import random SPECKLE_TAG="%start speckle%" WIDTH=64 import numpy class Box: def __init__(self, x, y, w, h): self.x = x self.y = y self.w = w self.h = h def conta...
322e83ceb10444ecacf616dcbfa9885d33b4ab82ef16f0bd36cffe26529e7013
Python
4,398
98
# basic imports import numpy as np import pickle import matplotlib.pyplot as plt def load_data() -> dict: ''' This function loads simulation data and prepares it. Parameters ---------- None Returns ---------- data : The prepared data. ''' ...
7c8a4d19e30b39b8ddcf6e10ed0638fe562ea0f02be7fca0c83420617fe3ea69
Python
4,399
126
dataset_type = 'CocoDataset' #data_root = './data_wenhekoulou/coco/' data_root = './data/coco/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) albu_train_transforms = [ dict( type='ShiftScaleRotate', shift_limit=0.0625, scale_limit=0.0, ...
743e332ab8485e8b4a690edff1027dcd4dba9d8f775925b45560d61026fd9bac
Python
4,401
125
# 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...
db970a089141f8a27f867848e0c939a8ed299bb98c284a06bf8358e182e3efcf
Python
4,401
121
"""Version-neutral TCP transport between CARLA Python 3.10 and Alpamayo Python 3.12.""" from __future__ import annotations import json import socket import struct from dataclasses import dataclass from typing import Any, Mapping import numpy as np MAGIC = b"CA2S" VERSION = 1 MAX_HEADER_BYTES = 1 << 20 MAX_ARRAY_BY...
e3189e8455b34091cdb721b3200d1abf409d7e0c33d435e9f7441b68a9fa72da
Python
4,401
119
import warnings import mmcv from ..builder import PIPELINES from .compose import Compose @PIPELINES.register_module() class MultiScaleFlipAug(object): """Test-time augmentation with multiple scales and flipping. An example configuration is as followed: .. code-block:: img_scale=[(1333, 400), ...
79e1b2564837f263dfc881a9dbf7427698afd5001394e634d9052715d135389e
Python
4,402
134
#!/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>. """Visualize the radar data""" import argparse import math from numpy import...
b62a48ecf9e81c18ba733bffad39d3ab2ef86c9f1dfdc68c2eb44b7fd64a1ba1
Python
4,402
93
""" This file contains code that will read Google Earth annotation files from an s3 bucket and saves the contained information in pandas dataframes as feather files. @author rdalrymple """ import boto3 import pandas as pd import numpy as np from datetime import datetime from bs4 import BeautifulSoup from tq...
22acd16b0d6aeb5f4dad442dedc48cf4016c1f68c1a17a535440a4f9ad9773e0
Python
4,403
120
''' @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...
6821e74f4af898e62778b3c5e23b14479dad7cc39820b7bdfe62a88142ad7997
Python
4,403
131
""" PyTorch dataset classes (torch.utils.data.Dataset) for flat data (non-graphs). Refer to the pytorch dataset tutorial page for the concept of Dataset and DataLoader. """ import os, json import torch import numpy as np import h5py from torch.utils.data import Dataset, DataLoader import sys DEFAULT_DTYPE = torch.floa...
8cd717de250b1b5bf10b34afbe02550183ad0c5a65d5bbcb0b832deadaf9acb4
Python
4,404
113
#!/usr/bin/env python3 # encoding: utf-8 import argparse import os import os.path as osp import cv2 import numpy as np import torch import torch.multiprocessing as mp from config import config from datasets.cityscapes.cityscapes import Cityscapes from engine.evaluator import Evaluator from engine.logger import get_lo...
67926ba2f77ef6551523a525df7e36c3fbd15d0493c97223daaa45da5d1ab814
Python
4,405
123
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch import torchvision import os from PIL import Image from maskrcnn_benchmark.structures.bounding_box import BoxList from maskrcnn_benchmark.structures.segmentation_mask import SegmentationMask from maskrcnn_benchmark.structures.keypoint...
9ae61cbb98629190cb4f87c155984383ac335c9b94730708e5bb65ffc34ff56d
Python
4,405
120
from pymol import stored def interfaceResidues(cmpx, cA="c. A", cB="c. B", cutoff=1.0, selName="interface"): """ http://www.protein.osaka-u.ac.jp/rcsfp/supracryst/suzuki/jpxtal/Katsutani/en/interface.php interfaceResidues -- finds 'interface' residues between two chains in a complex. PARAMS ...
dffa2c132d61a7dbbec9096b210a68d3aa0292d4aaa47f7df70acd1420fe37cd
Python
4,405
108
# 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...
a4ba97cad7890bf0ec8ab614e2d9dd2502cf99089bedb272b44414e12a3df553
Python
4,410
115
# Built-in from pathlib import Path # Third-party import brian2 as b2 import matplotlib from matplotlib import pyplot as plt from matplotlib.backends.backend_pdf import PdfPages # Local from cxsystem2.core.tools import load_from_file class rasterplot_pdf_generator: def __init__( self, workspace_path: st...
a6f030971401c2b0806d5f2775709c20195db965c00f9bfb9eacce33e77f35c4
Python
4,414
126
import os import csv import sys import time import subprocess LOG_FILE = "validation.log" ONLY_ANALYSIS = False ''' Instances and seeds used for the article 'Binary Classification On Hypergraphs' ''' INSTANCES = [ ('adult', None), # 1509029032), # 0.8217306 #('audiology', 1506863181), # 0.9886078 #('breas...
097cf1285306c03d90effaba9514c90ebb0b9f579b8d921eb1bb38863778f6a8
Python
4,415
117
from __future__ import print_function, division, absolute_import import torch.nn as nn from seg_opr.seg_oprs import ConvBnRelu from utils.pyt_utils import load_model __all__ = ['Xception', 'xception39'] class SeparableConvBnRelu(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, ...
43864a3cef80e71c11e781a218ea4af86a07cc90a2948d4ce8ab9da4c629c13d
Python
4,415
123
""" utils Created by: Martin Sicho On: 17.05.22, 9:55 """ import os import re import json import shutil import logging import datetime import git from drugex.logs import config, setLogger, logger from drugex.logs.config import LogFileConfig BACKUP_DIR_FOLDER_PREFIX = 'backup' def commit_hash(GIT_PATH): try: ...
7bab7c23da6afb30dff1c3c10b405ce791e9609935bbdaa0fbfff3e33b8a623f
Python
4,415
134
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import pytest from eelbrain import Factor, datasets, plot from eelbrain._wxgui.testing import hide_plots @hide_plots @pytest.mark.parametrize('Barplot', [plot.Barplot, plot.BarplotHorizontal]) def test_barplots(Barplot): "Test plot.Barplot" ds = dataset...
fd43735fc9157d2923b51be85caa6b07e93a8df2764d814931f3390ca718ccce
Python
4,417
144
import torch import torch.nn as nn import numpy as np def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class BasicBlock(nn.Module): expansion = 1 def __i...
6c51f37a96d353f80c0521c594c6363741372ae61c53d321ddde4b8e7f8fbbb7
Python
4,418
158
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from math import floor import numpy as np from numpy import newaxis FULL_SLICE = slice(None) FULL_AXIS_SLICE = (FULL_SLICE,) INT_TYPES = (int, np.integer) def digitize_index(index: float, values: np.ndarray, tol: float=None): """Locate a scalar ``index``...
c0aad1cb4e243e555c85f74bede0b5c66544fd53f32bf42532e7a3d0bd22a8aa
Python
4,422
104
"""Exports a YOLOv5 *.pt model to ONNX and TorchScript formats Usage: $ export PYTHONPATH="$PWD" && python models/export.py --weights ./weights/yolov5s.pt --img 640 --batch 1 """ import argparse import sys import time sys.path.append('./') # to run '$ python *.py' files in subdirectories import torch import to...
0410600452023ea5275679c4e2da86be25ea76c760876160cb753b5c07e6d993
Python
4,423
112
# 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...
68bdb98df363464ce56f4778e387b9b5f5cc91dfc9346abf132bf33633d0e131
Python
4,424
100
#!/usr/bin/env python # Copyright 2014 Johns Hopkins University (Authors: Vijayaditya Peddinti). Apache 2.0. # 2015 Tom Ko # script to generate multicondition training data / dev data / test data import argparse, glob, math, os, random, scipy.io.wavfile, sys class list_cyclic_iterator(object): def __ini...
fb4704d8dcbfeceb40ce2bead6250e5cf0385767281ce728604b1a9013f797a2
Python
4,426
128
#!/usr/bin/env python3 # Copyright 2016 David Snyder # 2017 Matthew Maciejewski # Apache 2.0. """This script converts a segments and labels file to a NIST RTTM file. It creates flat segmentation (i.e. no overlapping regions) from overlapping segments, e.g. the output of a sliding-window diarization syst...
5b40829ef71e5958b9c5ee15113a672d795df2e47dbf1e73e2809adb67d90591
Python
4,431
150
#%% from pathlib import Path import networkx as nx import numpy as np import pandas as pd import pymaid from src.pymaid import start_instance from src.visualization import adjplot #%% date = "2021-03-10" def load_meta(): meta = pd.read_csv( f"maggot_models/data/processed/{date}/meta_data.csv", index_c...
00c33b3a0b2c95c93405929f2e36998e653c0c8d1f4cb412c29edc71e9a97f89
Python
4,434
171
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 27 14:53:08 2021 @author: Hiroshi Yokoyama """ from IPython import get_ipython from copy import deepcopy, copy get_ipython().magic('reset -sf') #get_ipython().magic('cls') import os current_path = os.path.dirname(__file__) os.chdir(current_path) f...
18204e7331699fdb1d273c1fb21d7ed927e215502fdc6b6fbb3fa7edc85c5912
Python
4,438
122
#!/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 """ ...
76eb8ed249b753a9231d1c209e09148fea8e5d5bb98572122e0a67b27f4e48d4
Python
4,438
151
from abc import abstractmethod from typing import List import torch class Transform(torch.nn.Module): """ Applies transforms or inverse transforms to model inputs or outputs, respectively """ def __init__(self): super().__init__() @abstractmethod def transform(self): pas...
c2f31c03b03f5164e81b278dbd30dfb3a1f83986f812d6ddd01c508650995034
Python
4,438
119
import torch import torch.nn as nn import torch.nn.functional as F class DilatedParllelConvBlock(nn.Module): def __init__(self, nIn, nOut, add=True): super(DilatedParllelConvBlock, self).__init__() self.conv0 = nn.Conv2d(nIn, nOut, 1, stride=1, padding=0, dilation=1, groups=1, bias=False) s...
80331ffa95d20ec5aea10a818c9e9fd4d5f0463cdecb5773adf7fc3e4a9d202b
Python
4,439
109
from lab.nilm_experiments import * from constants.constants import * from constants.enumerates import * devs_taus = { ElectricalAppliances.KETTLE: 0.7, #0.5 ElectricalAppliances.MICROWAVE: 0.975, ElectricalAppliances.FRIDGE: 0.9, ElectricalAppliances.WASHING_MACHINE: 0.5, #0.025, ElectricalApplianc...
7cce72b4e45069bea44526718af6a844bdaac78c0d08d4e4497bebaab5e34fb2
Python
4,440
118
import torch import torchvision.transforms as TT from maskrcnn_benchmark.config import cfg from maskrcnn_benchmark.data import transforms as T from maskrcnn_benchmark.structures.image_list import to_image_list from maskrcnn_benchmark.structures.bounding_box import BoxList from maskrcnn_benchmark.modeling.roi_heads.box...
1e5967d9c375721e69436badbca76cbbb29bf207f1e0d499caa8268d3d1a00d8
Python
4,441
99
# 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 a...
693d26c5f2d2f4baf4bcf09abe90106a7d0dd74798b85088d68fbfcfbb4e4bb8
Python
4,442
120
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, ...
eaec08d6b36eb9338da2ee9918d3049b40ad8f22c606f6bb335e5ca945f6a2bb
Python
4,443
96
# 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...
2536c2a7b7adf5f172c9c44e6933e7dcf902dbd93f99ded1c25e8a703f2dff50
Python
4,444
104
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Softmax from models.baselines.segbase import SegBaseModel __all__ = ['CCNet'] class CCNet(SegBaseModel): def __init__(self, classes=2, aux=True, backbone='resnet50', pretrained_base=True): super(CCNet, self).__init__(c...
8a783d228ce0faaf9d12f545fc3668d5a0f8ae27169b29c307a0d54a401b4f59
Python
4,448
105
import pandas as pd import os from argparse import ArgumentParser import re DICT_MODEL_NAMES = {'BASELINE': 'BL', 'SEGGUIDED': 'SG', 'UW': 'UW'} DICT_METRICS_NAMES = {'NCC': 'N', 'SSIM': 'S', 'DICE': 'D', 'DICE ...
0eb762d612cc6c0bba54da544d03e828172c8f41209613df07b8f770ba3d15b5
Python
4,449
112
__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 import pandas as pd from tmkit.seqnetrr.combo.Param import Param class Separation(Param): """ Class f...
25794b531b86ef23699fe3c2ad828e47f0ef51f1581eb018f937df9d375880d7
Python
4,450
100
import random import torch import torch.nn.functional as F def if_edge_exists(edge_index: torch.Tensor, node1: int, node2: int): ''' Quick lookup for if an edge exists b/w `node1` and `node2` ''' p1 = torch.any((edge_index[0,:] == node1) & (edge_index[1,:] == node2)) p2 = torch.any((edge_index...
01a0e6b8ef085db3a9ea2c7e9cf1edd2c4e1d0f787085ae907131ffeb40ae319
Python
4,452
123
# 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...
b26220e86f6bccefddcc380e27132911c2fab60877b412d18bad7f23b18a6752
Python
4,452
131
from __future__ import division import argparse import os import os.path as osp import sys import time sys.path.append(osp.join(sys.path[0], '..')) import torch from torch.utils import data import models from mmcv import Config from mmdet import __version__ from mmdet.apis import (get_root_logger, init_dist, set_ran...
6669077901cab386363672d9313a6a838ab78aa9f28b9978f165b75e16101b41
Python
4,454
113
# 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...
8c4ae943c2b739e1b85a24699ca394513b29b55181907ef1b72a0b8b11d170e6
Python
4,454
127
"""Abstract Base Class Adapter for EUtils.""" import logging import os import time from abc import ABC from dataclasses import dataclass from typing import ClassVar, Iterable, Iterator, List, Optional, Tuple from xml.etree.ElementTree import Element # noqa S405 import requests import requests_cache from defusedxml.E...
54fa4440bf9dde53992ccdfe72010c77e10d978430b225cb97c15d82aa2301a9
Python
4,456
74
import numpy as np import pytest from simphox.grid import Port from simphox.sim import SimGrid from simphox.typing import Size, Size2, Size3, Size4, Union, List, MeasureInfo np.random.seed(0) EPS_20_20 = 1 + np.random.rand(20, 20) + np.random.rand(20, 20) * 1j SOURCE_20_20 = np.random.rand(2, 3, 20, 20) + np.random....
0a8faf60a48e2bba49612dc1e4f45a56c077ee1b03b1ee42f332e0f1a1ba09dc
Python
4,457
114
from collections import defaultdict import logging from typing import Dict, List from .predict import predict from chemprop.data import MoleculeDataLoader, StandardScaler from chemprop.models import MoleculeModel from chemprop.utils import get_metric_func def evaluate_predictions(preds: List[List[float]], ...