sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0d38f085829ea8fc7e06302bc6ae7c3d8cf6a19710f4f840e0d62e6572d1a18b | Python | 9,874 | 291 | import os
import gym
import numpy as np
import torch
from gym.spaces.box import Box
from stable_baselines3.common.monitor import Monitor
from stable_baselines3.common.vec_env import VecEnvWrapper, DummyVecEnv, SubprocVecEnv
from stable_baselines3.common.vec_env.vec_normalize import \
VecNormalize as VecNormalize_
... |
1e7ae6e4d6e9bde252b0dfd59fb9f8fff6383976adccd9f6540133a5ae889ab3 | Python | 9,874 | 230 | # Copyright 2020-21 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... |
34272d6fd4817ca11f8015161d1580b7559fb038ec2c8c5f12dbf20fe24da610 | Python | 9,874 | 293 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset
import pandas as pd
import numpy as np
import torchvision
import torchvision.transforms as T
from torchvision import models
import pytorch_lightning as pl
from pytorch_lightning.loggers import ... |
50a4d3cb3652ede43a2c30ded6b392dd124d9e78e7c0f09961f897569f002d64 | Python | 9,874 | 250 | import argparse
import os
import numpy as np
import pandas as pd
import vtk
from collections import defaultdict
from vtk.util.numpy_support import vtk_to_numpy, numpy_to_vtk
import pymetis
from glob import glob
# Seed for reproducibility
np.random.seed(42)
def read_vtk_mesh(file_path):
reader = vtk.vtkPolyDataRea... |
c2599f430b795f1c18ea23dfb2561022c2cbeadb595847cfc0f30d823299e423 | Python | 9,874 | 208 | import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
# Experimental parameters
D = 6.370
Dp = 3.136-D
T0 = .16
def RR_calc(A, ci, co, z, w):
zbar = z/(A*w)
SNR = A**2*w**2/(ci**2*w**2 + co**2)
ER = 1/(1 + torch.exp(2*zbar*SNR))
DT = zb... |
ec672c2b38cc46987f8bfdd64831c056ca6a14771e3a3b9c694d2a49525a23ab | Python | 9,875 | 215 | import logging
import numpy as np
import tensorflow
from typing import List
from tensorflow_addons import optimizers as addon_optimizers
from tensorflow_addons import activations as addon_activations
from tensorflow_addons import losses as addon_losses
from tensorflow_addons import metrics as addon_metrics
from psg_uti... |
df4d371e40d77e5c9e818df46a463e514b04d89aafcbe1af71056881a39767fb | Python | 9,876 | 382 | # -*- coding: utf-8 -*-
from numba import njit
import numpy as np
from .embed import embed_vector
def _norm_distance(x, y, order=2):
return np.linalg.norm(x - y, ord=order)
def _score_list(x, ys, order=2):
ref_dis = _norm_distance(x, ys[0], order=order)
score_list = [np.exp(-_norm_distance(x, y, order=... |
60ea977faaa7a5c9192021d18cf0b54dca53bb0fee354ece01ba06a80759a2f7 | Python | 9,880 | 238 | import os
from os.path import join
import numpy as np
import pandas as pd
from collections import OrderedDict
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selectio... |
a24fafbe4b243b7f6bf7906afaa285cc498c7bcfcaebcedfca383a7540ca7df6 | Python | 9,880 | 239 | # 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... |
6cf7fd149dbedeb0a1aa17295ac6d51e43a607fb9a66c30536f137a41eefb8e3 | Python | 9,898 | 218 | # This file is part of me-features-to-mol-ID-mapping.
#
#
# Copyright © 2021-2022 Blue Brain Project/EPFL
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the APACHE-2 License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANT... |
aa247d27c533baa8fbcc79416438cc84b5398e6209b934b0fdf3d8f8dee1d1bb | Python | 9,902 | 256 | """Data utils functions for pre-processing and data loading."""
import os
import pickle as pkl
import sys
import networkx as nx
import numpy as np
import scipy.sparse as sp
import torch
def load_data(args, datapath):
if args.task == 'nc':
data = load_data_nc(args.dataset, args.use_feats, datapath, args.s... |
7b6f16299207ec1a1403d59e2d094d04485eeee881f51e76b55b08806070acb8 | Python | 9,905 | 260 | # -*- coding: utf-8 -*-
# Auxiliary functions to evaluate the models.
# COPYRIGHT: TU Delft, Netherlands. 2021.
import h5py
import math
import time
import numpy as np
import matplotlib.pyplot as plt
from pymedphys import gamma
def infer(model, ID, filename, scale, ikey='geometry', okey='dose', cutoff=0.5):
"""
... |
848a50230df0f01686c54278a2a6f1f6600d83da0a45d24362895fe4467f1e42 | Python | 9,908 | 306 | # Copyright (c) Open-MMLab. All rights reserved.
import cv2
import numpy as np
def imconvert(img, src, dst):
"""Convert an image from the src colorspace to dst colorspace.
Args:
img (ndarray): The input image.
src (str): The source colorspace, e.g., 'rgb', 'hsv'.
dst (str): The destin... |
591d564027d0e8d934d98316edf95c7db36f7c0e2e5f22ac1872d474f0e8610a | Python | 9,913 | 221 | '''
collection of chemisorption models.
newns_anderson:
'''
import torch
import numpy as np
class Chemisorption:
def __init__(self, model_name, **kwargs):
# Initialize the class
if model_name == 'gnn':
self.model_num_input = 1
if model_name == 'newns_anderson_semi':
... |
4c9da5ec0cad08b072b99c054129afb3c2214a2f165e3ac4cd5d3048e133bdf5 | Python | 9,917 | 242 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 3 10:42:19 2021
@author: paulmueller
"""
import glob
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.stats import wilcoxon
from iEEG_STC import utils
import os
sns.set_palette("tab10")
sns.s... |
b0b17c32567d77bd3b072faedd86e75cae359888e3172fdcba0907d37164d741 | Python | 9,923 | 248 | import sys
import pickle
import pandas as pd
import os
import numpy as np
import utils.general_utils as general_utils
import utils.plot_utils as plot_utils
import utils.plot_setting as plot_setting
import utils.math_utils as math_utils
import utils.sync_utils as sync_utils
import utils.list_twoP_exp as list_twoP_ex... |
11385cdeb2ebb7f23d1bb092854554ca25707a59f3bb26f43b038fced01f90bf | Python | 9,926 | 242 | # 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... |
d17a7ba5733e40bd0b2939bea5bc3169760a73d5e2edd60c36431456c67a926e | Python | 9,926 | 216 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from functools import wraps
from tmkit.id.Mapping import Mapping as pdbid
from tmkit.topology.pdbtm.Component import Component
class Segme... |
a984cf2902cf3ea250c688f7e75e9c88bc8b5ef50458e6b331b351d2f879b27c | Python | 9,929 | 275 | # 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... |
1a85e48ab578f47f5405aa3aa96da42032a64cf1ba7c0e33552b8a2033212ad9 | Python | 9,930 | 312 | #!/usr/bin/env python
# coding: utf-8
import pymesh
from IPython.core.debugger import set_trace
from scipy.spatial import cKDTree
import time
import os
import numpy as np
import os
import matplotlib.pyplot as plt
import glob
from Bio.PDB import *
import copy
import scipy.sparse as spio
import sys
# import the right ve... |
4505845105ee9516593578bf297323fbaa8917888ae088e271a4f97d1e9d6f00 | Python | 9,930 | 244 | # Copyright 2021 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... |
fa9b9a8c723b878374ebd4b6e185d00b57b61023588edc6f082613f26745daa5 | Python | 9,931 | 240 | import torch
from abc import abstractmethod
from numpy import inf
import numpy as np
class BaseTrainer:
"""
Base class for all trainers
"""
def __init__(self, model, criterion, metric_ftns, optimizer, config, fold_id):
self.config = config
self.logger = config.get_logger('trainer', conf... |
2fc05a54b32a3d3e133aa7cdb2240b5a7e0286e61f94672ec3110143a40bd3bb | Python | 9,932 | 304 | from __future__ import division
import os
import glob
import pickle
from natsort import natsorted
import argparse
import os
import sys
import numpy as np
import tqdm
import pandas as pd
import numpy as np
from pprint import pprint
import glob
import sys
import config
import agents
import agent_analysis
import os
impor... |
5a2a6c6a731a9b247cbb685740ff8f99b19a790272d3e94de76cca900b2db70e | Python | 9,935 | 244 | 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
... |
418b7e0ffb25f072883151e1761ddb6bb1b3e8eb9adbb6806ce85c8b39a760d5 | Python | 9,936 | 372 | #%%
import numpy as np
import pandas as pd
import src.utils as utils
from src.utils import get_best
from src.data import load_left, load_right
from src.models import (
fit_a_priori,
select_dcsbm,
select_rdpg,
select_sbm,
GridSweep,
gen_scorers,
)
from graspy.plot import heatmap
from graspy.mode... |
650b991f83e50990d8bdc2ed72d72a35fd826741fbf90830bee6bf1c326f47dd | Python | 9,937 | 196 | # 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... |
b03cd682a886e840789066b7f767e36b872968ce008200d682cd625815e85a0b | Python | 9,938 | 316 | # 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... |
20aeeac738d2df245afb6c8119a6557afce20302de561682fdd8afb75804e16c | Python | 9,940 | 226 | """
File: gene_pathway_score_prediction.py
Created: 2020-02-28
Last Changed: 2021-01-08
Author(s): H.H. Wiersma
Copyright (C) 2019 H.H. Wiersma
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 Fo... |
48c87b8975d2438293d1f7d000be7eb9885fb6ae5e2305135bd0b8987cba41d7 | Python | 9,943 | 191 | __author__ = 'duarte'
from modules.parameters import ParameterSet, ParameterSpace, extract_nestvalid_dict
from modules.input_architect import EncodingLayer, StimulusSet, InputSignalSet
from modules.net_architect import Network
from modules.io import set_storage_locations
from modules.signals import iterate_obj_list, em... |
fe29fcd7cae9f28593f1bb88516d06da8759335b03b18173297e628688bf2a67 | Python | 9,943 | 255 | import sys
import argparse
import os
from os import listdir
from os.path import isfile, isdir, join
import numpy as np
import pandas as pd
import multiprocessing
import torch
def main():
#####################
# Parsing arguments
#####################
parser = argparse.ArgumentParser(description="Error ... |
aa95f60ec559abf8219662ae8671a197bfc7d127c8ce92cedcda10008cd64938 | Python | 9,944 | 237 | # 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... |
fba503374a85da109dbd15e353dc54e2d3946b19d0cd7fc799545271c81ccb04 | Python | 9,944 | 316 | # Copyright (c) Open-MMLab. All rights reserved.
import logging
import torch.nn as nn
import torch.utils.checkpoint as cp
from ..runner import load_checkpoint
from .utils import constant_init, kaiming_init
def conv3x3(in_planes, out_planes, stride=1, dilation=1):
"""3x3 convolution with padding."""
return n... |
6ef132fbdfc77a389d83582ea6d47adf0c8b0ef8b2ea85f50be58bd257aefdb4 | Python | 9,945 | 234 | import tqdm
import ipdb
import argparse, sys; sys.path.append('../../..')
import random as rand
import torch
from metrics import *
from graphxai.explainers import *
from graphxai.datasets import load_ShapeGGen
from graphxai.datasets.shape_graph import ShapeGGen
from graphxai.utils.performance.load_exp import exp_exist... |
fd85dc839301d91dc88e9a3b2cadd3a95b93f43cb0fe998036d4865753a13887 | Python | 9,945 | 225 | # -*- coding: utf-8 -*-
"""Preview
Code for 'Inf-Net: Automatic COVID-19 Lung Infection Segmentation from CT Scans'
submit to Transactions on Medical Imaging, 2020.
First Version: Created on 2020-05-05 (@author: Ge-Peng Ji)
Second Version: Fix some bugs and edit some parameters on 2020-05-15. (@author: Ge-Peng Ji)
""... |
d79bcfcae4173213717a9787bd99579a6bc41b20b72c578eabc05b13d1a998e0 | Python | 9,947 | 289 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import math
import numpy as np
import torch
from torch import nn
from maskrcnn_benchmark.structures.bounding_box import BoxList
class BufferList(nn.Module):
"""
Similar to nn.ParameterList, but for buffers
"""
def __init__(self... |
8c9c0bd1165898d5573ffdc91ecd3f65015aadeb39c1efa3ae578d08919df21b | Python | 9,949 | 212 | import numpy as np
from drugex.logs import logger
from drugex.training.scorers.interfaces import Scorer
from qsprpred.tasks import TargetProperty, TargetTasks
from rdkit import Chem
class QSPRPredScorer(Scorer):
def __init__(
self,
model,
use_probas=True,
tasks=None,
classe... |
c87f19bf8500e99d9a18c4cf9a28f94f877845ac7c61a95b75230cbb019bb182 | Python | 9,954 | 327 | # Import necessary libraries
import numpy as np
import math
import scipy
import scipy.spatial
import time
import sys
from scipy.spatial import distance, distance_matrix
#sys.path.insert(0, ".")
#import deepAccNet as dan
from .dataProcessingUtils import atypes
from .conversion import dict_3LAA_to_tip
def parse_pdbfile... |
e7ceb0269063fcf1b75e7cd401a185788e7b7886fa1cd2715449decab0c5e38c | Python | 9,955 | 235 | import tqdm
import ipdb
import argparse, sys; sys.path.append('../../..')
import random as rand
import torch
from metrics import *
from graphxai.explainers import *
from graphxai.datasets import load_ShapeGGen
from graphxai.datasets.shape_graph import ShapeGGen
from graphxai.utils.performance.load_exp import exp_exist... |
f8376a81c16040521efc9346bb5ffccbcad6253a888d186966413cda03bdfb59 | Python | 9,956 | 206 | #! /usr/bin/env python
##########################################################################
#skewi.py calculates a single SkewI value for a given chromosome
#Copyright (C) 2020 Jennifer Lu, jlu26@jhmi.edu
#
#This file is part of SkewIT
#
#SkewIT is free software; you can redistribute it and/or modify
#it under ... |
7952e7213e6d49f632ff642af8c81efa392cc04f65fd242ecb75000237147913 | Python | 9,958 | 255 | #!/usr/bin/env python
# ViralGenome_Analysis.py
import os, cmath, math, sys, glob, subprocess, re, argparse, shutil, datetime, csv
import numpy as np
from matplotlib_venn import venn2
import pandas as pd
from collections import defaultdict
from operator import itemgetter
import matplotlib as mpl
import matpl... |
2065867331d3f6c81a2445058a9d27ff8585808d98b7c8b3a0b1dbcb87a989f6 | Python | 9,962 | 241 | from nipype.interfaces.base import CommandLineInputSpec, Directory, File, TraitedSpec, OutputMultiPath, traits, isdefined
from nipype.interfaces.fsl.base import FSLCommand, FSLCommandInputSpec, Info
from nipype import LooseVersion
from nibabel import load
import os
from os import path
class MCFLIRTInputSpec(FSLComman... |
085c81a515fc1e9dfe015a765303b01a8c5ad1561d9d90b40a84d69d71850939 | Python | 9,965 | 285 | import matplotlib.pyplot as plt
import numpy as np
import pathlib
import json
import seaborn as sns
from datetime import datetime
from helper.misc import infer_and_accuracy, clear_print
from helper.data import load_data, get_architecture
from mip.get_nn import get_nn
from gd.gd_nn import GD_NN
colors = sns.color_palet... |
23b82094ad8e278ff1a12e927f36915203e07a2062457ca1d23f57a672928fe2 | Python | 9,981 | 238 | import argparse
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from sklearn.neighbors import BallTree
STEERING_ANGLE_RATIO = 14.7
def calculate_closed_loop_metrics(model_frames, expert_frames, fps=30, failure_rate_threshold=1.0):
lat_errors = calculate_lateral_errors(model_frames, ex... |
0b2c966ddc4be4322d396d71707e0d4443416882a6732f04f890b207f4815236 | Python | 9,984 | 264 | """
File: covariates_explained_by_others.py
Created: 2020/04/15
Last Changed: 2020/06/03
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 Foun... |
a466ef1fa2a939786f827e677f539684684c901fd37f1f6d3b7da62cef50e5e6 | Python | 9,985 | 223 | import os
import json
import pandas as pd
import numpy as np
import pydicom
import datetime
from CBCT_AI.losses import *
from tensorflow import keras as k
from CBCT_AI.Data_preprocessing_v2 import process_raw_patient_data
from CBCT_AI.Dense_Net_Region import Dense_Net_AnatomyLabel
import tensorflow as tf
from tensorflo... |
8caced318bc32ce3db633e5dce66b044becf848ce3d1c9f8fad1440f064064dd | Python | 9,990 | 246 | #!/usr/bin/env python3
"""Actor/level bounding boxes: list 3D, draw in the world, or project into a camera.
Commands:
list [--filter vehicle.*] [--limit N] 3D boxes of matching actors
draw [--filter vehicle.*] [--seconds 30] draw 3D boxes (tracks moving actors)
project --camera <id|type> [--... |
f9c87bde24faaadb04e11ecb4ded7a8d4e1b580ac0773954683bf848207e4d6f | Python | 9,991 | 292 | # 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... |
f188d3125e72415cfef29d0023d28c7954afd4f3886b9908a9b6321c1ac5e235 | Python | 9,992 | 262 | # 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... |
8438bfa9d240629a9dda9839d5dc1d13bafbbbf64f178e3a609f813fdd0e2af7 | Python | 9,997 | 244 | import os
from os.path import join
import numpy as np
import pandas as pd
from collections import OrderedDict
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selectio... |
0d188921967f996fc442ef9768e76bb990b9fa002b24804ea5674f44ec7a5a44 | Python | 9,998 | 285 | import argparse
import os
import os.path as op
from glob import glob
from shutil import copyfile
import pandas as pd
def _get_parser():
parser = argparse.ArgumentParser(description="Run RSFC in AFNI")
parser.add_argument(
"--mriqc_dir",
dest="mriqc_dir",
required=True,
help="P... |
5c67f5f19bbc956267283b84985f6313dad5ad237dab72ba5356448079718120 | Python | 10,000 | 375 | #%%
from operator import itemgetter
import networkx as nx
import numpy as np
import pandas as pd
from bokeh.embed import file_html
from bokeh.io import output_file, output_notebook, show
from bokeh.layouts import gridplot
from bokeh.models import ColumnDataSource, FactorRange, Legend, Span
from bokeh.palettes import... |
0c1062455488de84406db3b5eb1cbd5beca0bb2de205dbc5e647cdb8b63d764f | Python | 10,009 | 259 | import torch
from torch import nn
from .trainer import Trainer
from ..models import FNO, TFNO
from ..utils import compute_explained_variance
class IncrementalFNOTrainer(Trainer):
"""
Trainer for the Incremental Fourier Neural Operator (iFNO)
Implements iFNO approach from [1] that progressively increases... |
c85a1accd3329283a0cd894a219055f663418f1027b928d5c52e2ed87fe52c95 | Python | 10,009 | 235 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 22 09:42:44 2021
@author: jacks
"""
# flatfile for the qiskit qnn module as implemented in my qiskit_ml_1 notebook
# %% imports
import numpy as np
from qiskit import Aer, QuantumCircuit
from qiskit.utils import QuantumInstance
from qiskit.circuit import ParameterVector... |
51b458af96027cf0f388e14f0458db46b055fd9c5f430e1ed7b5868c533ef923 | Python | 10,010 | 213 | """
This file contains functions utilized in the collection and labeling of Google Earth images for use as EO data in
the dark-ships project.
@author: rdalrymple
"""
import os
from PIL import Image
from xml.dom import minidom
from zipfile import ZipFile
from bs4 import BeautifulSoup
from tqdm import tqdm
... |
6ff31e1e87d769f9fdbd4ace3ce13c94ee63b38e9a5f92a541b225aeb5023e44 | Python | 10,011 | 275 | import math
import torch
import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair, _single
from mmcv.utils import deprecated_api_warning
from ..cnn import CONV_LAYERS
from ..utils import ext_loader, print_log
ext_module... |
349d05f5c8875cfee35388cc03250a23dae5afb5ed64efde34d63b474fd2bef4 | Python | 10,015 | 241 | # 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... |
9ac26a0f85128bb511f5d4a88be55053e48df0f607044c350521d085223cffd7 | Python | 10,020 | 310 | """
Plotting functions for RACCOON
F. Comitani @2018-2022
"""
import os
import math
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import seaborn as sns
import pandas as pd
mpl.use('Agg')
sns.set_style("darkgrid")
class Palettes... |
23e5e9f329f06706c0fefac497fbc1999e9cfdcb8d1b9a4a165d64cb05cd870b | Python | 10,021 | 276 | import numpy as np
import numpy.testing as npt
import nibabel as nib
import dipy.io as dio
import dipy.data as dpd
import dipy.core.gradients as dpg
from dipy.sims.voxel import multi_tensor_dki, single_tensor
def assert_image_shape_affine(filename, shape, affine):
npt.assert_(os.path.isfile(filename))
image ... |
abed163152276447463196c22384fb29b6432b7e5fce163bf54f2ba7c2e0aa41 | Python | 10,022 | 244 | """
=====================================================
How to add new bundles into pyAFQ (SLF 1/2/3 Example)
=====================================================
pyAFQ is designed to be customizable and extensible. This example shows how you
can customize it to define a new bundle based on a definition of waypoint... |
17aa1536249ebaf33a4fdbed613f493a414a5a131bbafd2fda23999b40a68133 | Python | 10,024 | 263 | # 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... |
c80e2510a6623e89eb5e433d707a37880f3ee9c20bf20bdf6f5aaadfee0229ef | Python | 10,027 | 264 | # This script is part of navis (http://www.github.com/navis-org/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... |
0d9eef978a1a556dc5dfb10964194990a4d116f22ddf92b216627ae915abc636 | Python | 10,041 | 237 | import h5py
import keras.backend as K
import numpy as np
import os
import os.path
import tensorflow as tf
import threading
from PIL import Image
from keras import backend as K
from keras import losses
from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
from keras.layers import Input, MaxPoolin... |
ae9d4a2efbb61f7d21d2e361a5a145704351cc9733d2bd3e5ba4e64938d8e3e3 | Python | 10,047 | 212 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... |
19ba7d9e98b2f906c0f32ef31142d1a5892b89342ab7266dbca7b1b79b33dbde | Python | 10,057 | 319 | import os
import numpy as np
import pytest
from backend.pipeline import PipelineManager
from backend import jobs, root_tracking
class FakeSettings:
mode = 'initial'
use_gpu = False
active_models = {
'detection': 'fake-detection',
'tracking': 'fake-tracking',
}
def detection_result(... |
44df0fec87c0b0e62cf7dbf7beb6dc8f3608d1a3b0ee5ddf93ff0fcb32cca76a | Python | 10,058 | 246 | """
Author: Benny
Date: Nov 2019
"""
import os
import sys
import torch
import numpy as np
import datetime
import logging
import provider
import importlib
import shutil
import argparse
from pathlib import Path
from tqdm import tqdm
from data_utils.ModelNetDataLoader import ModelNetDataLoader, load_data, PointSampler,... |
ab186b0cb3305b60bba3297188a3ca0d0455f5eec78f8de99644b34ee48e81ab | Python | 10,058 | 273 | #! /usr/bin/env python
# Copyright 2016 Vimal Manohar
# Apache 2.0.
"""This script process a 1995 CSR-IV annotation file and writes to
utt2spk, segments and text files.
"""
from __future__ import print_function
import argparse
import os
import logging
import re
from bs4 import BeautifulSoup
import hub4_utils
lo... |
006ff30148fad98515d35736ce0fc82e1355918147e9f050dcc72030a32272bc | Python | 10,065 | 269 | import torch.nn as nn
import torch.nn.functional as F
import math
import torch.utils.model_zoo as model_zoo
import torch
import numpy as np
affine_par = True #True: BN has learnable affine parameters, False: without learnable affine parameters of BatchNorm Layer
model_urls = {
'resnet18': 'https://download.pytor... |
7832a80d7db23f00b7f238b99fd6aa7f1d6d5666c70f2bb4af5fda81e72038bc | Python | 10,067 | 279 | from src.segmentation.models import *
from pathlib import Path
from src.segmentation.transforms import *
from monai.transforms import (
Compose,
CopyItemsd,
KeepLargestConnectedComponentd,
ScaleIntensityRangePercentilesd,
ToTensord,
FillHolesd,
)
ckpt_dir_path: str = (Path(__file__).parent.pare... |
b05bfb97d6a7302e8a55b06c698a18c3ade357a5796045790061addac15597d5 | Python | 10,068 | 168 | # 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... |
73fa5b949d765660b3769ede780076d5c5ca3fc8964896e0c8a544c91d41455f | Python | 10,071 | 231 | import torch
import numpy as np
from torch.autograd import Variable
from metrics import mrr_mr_hitk
from utils import batch_by_size
import os
import time
from torch.optim import Adam
from models import TransDModule, TransEModule, TransHModule, DistMultModule, SimplEModule
class BaseModel(object):
def __init__(self... |
d56c7525bf32101ce92401fa3901f525d46dced14f5de6549a95019f73dee9ea | Python | 10,074 | 281 | import os
import tempfile
from tqdm import tqdm
CHROMOSOMES = [f"chr{i}" for i in list(range(1, 23)) + ["X", "Y", "M"]]
def interval_from_line(bed_line, pad_left=0, pad_right=0, chrom_counts=None):
chrom, start, end = bed_line.rstrip().split("\t")[:3]
start = max(0, int(start) - pad_left)
if pad_right:
... |
7c60de8ace8f491caf700895613ce85aa7af52ec964680cefc9684b8a4123efd | Python | 10,076 | 241 | import csv
import logging
from abc import ABC
from io import TextIOWrapper
from pathlib import Path
from typing import Dict, Iterable, Iterator, Optional
from oaklib.datamodels.lexical_index import LexicalIndex
from oaklib.datamodels.mapping_rules_datamodel import MappingRuleCollection
from oaklib.datamodels.search im... |
5071f8a01008e997e2273430b0aeac4107ff4409fa85c50961c1554b0843b275 | Python | 10,078 | 212 | # 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... |
52cf82c9bb24d29a86b31e9c879aedfed59aa82fe133468dc9f98ca186535794 | Python | 10,079 | 364 | # %% [markdown]
# ##
import os
import warnings
from itertools import chain
import colorcet as cc
import matplotlib as mpl
import matplotlib.gridspec as gridspec
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import networkx as nx
import numpy as np
impor... |
89629d51906354433a57320b4ff6608982e6dbc37e5300d12c59a6ab480a9c9f | Python | 10,079 | 313 | import numpy as np
import math
from numpy import random
from numpy import linalg
from scipy import sparse
from scPrisma.pre_processing import *
from numba import jit
@jit(nopython=True, parallel=True)
def generate_eigenvectors_circulant(n, alpha=0.9999):
"""
Generate eigenvectors and eigenvalues for a circula... |
2ef515be9d0a5f2d9ebfdb4ec3213673c6a711b45317ea2ae1ff7c7e62dbd09f | Python | 10,092 | 239 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
fb46d20858c9a2461003a2f57ba0d2ec37b5fb1af084c71f658bd7795e6838ea | Python | 10,092 | 274 | import itertools as it
from typing import Tuple, Union
import numpy as np
import scipy.stats as ss
from statsmodels.sandbox.stats.multicomp import multipletests
from pandas import DataFrame
def __convert_to_df(
a: Union[list, np.ndarray, DataFrame],
val_col: str = 'vals',
group_col: str = 'gro... |
b08146cf96ac985d5bbc665728fd8f544df05f0522b6a98a8b942cce047577d8 | Python | 10,100 | 213 | import struct
import time
from typing import List
from PyQt5.QtBluetooth import QBluetoothDeviceInfo, QLowEnergyService, QBluetoothUuid, QLowEnergyCharacteristic, \
QLowEnergyController
from PyQt5.QtCore import QObject, pyqtSlot, QByteArray
from PyQt5.QtWidgets import QAction, QMenu
import SensorChannel as sc
imp... |
cc65df7c3b38946df9a64451a08b5cdde2fcb9f077c4b87595a4938b43e6c774 | Python | 10,100 | 302 | import numpy as np
from scipy import ndimage
from math import ceil, floor
from skimage.util import view_as_windows
from skimage.filters import threshold_otsu
from itertools import product
from os import listdir
from os.path import isfile, join
from PIL import Image
from . import utils as ut
from skimage.segmentation im... |
99de16791d2dd9081da0ab87b8b6c3c765eae1d310263e2eb3fdf76939c60c35 | Python | 10,105 | 300 | # python 3.7
"""Contains the base class for modules in a GAN model.
Commonly, GAN consists of two components, i.e., generator and discriminator.
In practice, however, more modules can be added, such as encoder.
"""
import os.path
import sys
import logging
import numpy as np
import torch
from . import model_settings... |
b0ab068c2ba3871c8a720e85bc464843525130be24a016b72519d5d81ca68283 | Python | 10,105 | 224 | import re
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from collections import OrderedDict
__all__ = ['DenseNet', 'densenet121', 'densenet169', 'densenet201', 'densenet161']
model_urls = {
'densenet121': 'https://download.pytorch.org/models/densenet... |
ba4abde428a4c063d1fd40bd5d05928eeb03289f748eaa273292bc9f5744d152 | Python | 10,111 | 250 | # 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... |
35fffbd43d32af9179be6896f071bed3a72d73a21c485d35a0cf024e5170dd78 | Python | 10,119 | 215 | #!/usr/bin/env python
# coding: utf-8
# REQURES PYTHON3.5 (pytables has an issue with saving to hdf with newer versions)
# if input argument is number, runs 10 interations, random seed and output filename defined by input arg, this is to be used on cluster to run several jobs in parallel, takes 3+ hours
# if input ar... |
673206f8e3de18d4b7885d2e18b9880a3ed13a38d36463d5e2ea51ac7350454f | Python | 10,121 | 254 | import tqdm
import ipdb
import argparse, sys; sys.path.append('../..')
import random as rand
import torch
from metrics import *
from graphxai.explainers import *
from graphxai.datasets import load_ShapeGGen
from graphxai.datasets.shape_graph import ShapeGGen
from graphxai.utils.performance.load_exp import exp_exists
f... |
9da4bfb6827b88b55fd7ca7b7e528537b57fc76fd3d222bae84081db0809eb90 | Python | 10,123 | 286 | from random import sample, shuffle
import cv2
import numpy as np
from PIL import Image
from torch.utils.data.dataset import Dataset
from utils.utils import cvtColor, preprocess_input
class YoloDataset(Dataset):
def __init__(self, annotation_lines, input_shape, num_classes, mosaic, train):
super(YoloData... |
f6944dce12c6d3dfc66150fc3ba61495045e61306c74dd906c3a1cf7fba84413 | Python | 10,123 | 199 | import numpy as np
import functions_basic_sak as funsak
import pandas as pd
from tqdm import tqdm
import os
from skimage import data, util, measure
from scipy.ndimage.measurements import label
import inspect
import pathlib
import AIS_parameters
import AIS_interp
import re
import import_AIS
import matplotli... |
b6292d59bd4cdb890f05f626d4fba2358df6ec937d504fc865bc32b1e92374b6 | Python | 10,125 | 253 | import pandas as pd
import tempfile
from unittest import TestCase
from rdkit import Chem
from drugex.data.corpus.corpus import SequenceCorpus
from drugex.data.corpus.vocabulary import VocSmiles, VocGraph
from drugex.data.fragments import FragmentPairsEncodedSupplier, SequenceFragmentEncoder, GraphFragmentEncoder, \
... |
0af7a9ae1905f54be972e60c8ac7afa9adfe36709e5773aefeceed2f69308592 | Python | 10,132 | 293 | #!/usr/bin/env python3
"""
File: plot_decon_results_per_zscore.py
Created: 2022/01/24
Last Changed: 2022/02/10
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... |
16c55d1bfd08588906ad06b94462292d90a9807f06e1555ae3b53f348b98af2f | Python | 10,135 | 233 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvBlock(nn.Module):
def __init__(self, in_planes, out_planes, stride=1):
super(ConvBlock, self).__init__()
self.conv = nn.Conv2d(in_planes, out_planes, 3, stride=stride, padding=1, bias=False)
self.bn = n... |
9da3f8be356b17de5fbae4323e779c047e8ea6661795a1fff29812706e18767a | Python | 10,136 | 261 | #!/usr/bin/env python3
"""
File: factorization_comparison.py
Created: 2020/06/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 Softw... |
58806029c8a285ed4713753ab577b38e25a3e1c6cef03a0b678aaf114894ee4d | Python | 10,137 | 196 | import os.path
from datasets import load_file
from datasets import get_survival_y_true
from datasets.basic_dataset import BasicDataset
import numpy as np
import pandas as pd
import torch
class ADataset(BasicDataset):
"""
A dataset class for gene expression dataset.
File should be prepared as '/path/to/dat... |
3e239133b6e1bc58654e611db58bf675dd5ddff8b07832605f9d115d0c416290 | Python | 10,140 | 243 | import getpass
import logging
from abc import ABC
from collections import defaultdict
from datetime import datetime
from typing import Any, Dict, Iterator, List
from linkml_runtime.utils.metamodelcore import XSDDateTime
from oaklib.datamodels.summary_statistics_datamodel import (
FacetedCount,
GroupedStatisti... |
9f4dc71be54389d5cfdb3373551040f3417bf1294bbf179b08c933f38adac119 | Python | 10,141 | 193 | __author__ = 'duarte'
from modules.parameters import ParameterSet, ParameterSpace, extract_nestvalid_dict
from modules.input_architect import EncodingLayer, StimulusSet, InputSignalSet
from modules.net_architect import Network
from modules import io
from modules.signals import iterate_obj_list, empty
from modules.visua... |
55352d68cdb979a4543c6ad4e1b96266613e5df7b42c713d506048c681a3e076 | Python | 10,142 | 304 | """
splitting
Created by: Martin Sicho
On: 07.05.22, 15:54
"""
import os
from abc import ABC, abstractmethod
import numpy as np
import pandas as pd
from drugex.logs import logger
from drugex.parallel.interfaces import ResultCollector
class DataSplitter(ABC):
"""
Splits input data into multiple parts.
""... |
bae32ee7b2b09d61ee8fd40e878ab1265d40dcda485a55f4cf84df09450481bc | Python | 10,144 | 226 | #!/usr/bin/env python
#title :Network.py
#description :Architecture file(Generator and Discriminator)
#author :Deepak Birla
#date :2018/10/30
#usage :from Network import Generator, Discriminator
#python_version :3.5.4
# Modified by : Zifei Liang 2022/06/06
# Modules... |
45a11a98b133b4daa2e2b96984cebbda61b90da59af3f998d4949fd698d82222 | Python | 10,146 | 276 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
fa3a9ba5aee90e5fc1cbcd4521a1aca7dae76a1393bd1ae12a2483338dcca02e | Python | 10,147 | 246 | import logging
import unittest
from kgcl_schema.datamodel import kgcl
from linkml_runtime.dumpers import yaml_dumper
from oaklib import OntologyResource
from oaklib.datamodels.association import Association
from oaklib.datamodels.vocabulary import IS_A, LOCATED_IN, PART_OF
from oaklib.implementations import ProntoImp... |
1b2e5d43de6c194f51bcf7d726f68c4da7f52fe6934349477d180d0fdacaa5f9 | Python | 10,152 | 297 | import numpy as np
class Lattice2D:
def __init__(self):
# Build 2D redundancy lattice
self.Nx = 2
self.Nnodes = 4
self.Nelements = 3
self.elements = [1, 2, [1, 2]]
self.A = [[1, 2], [1], [2], [[1, 2]]]
self.level = [1, 2, 2, 3]
self.Nlevels =... |
03cdf873699ba3ac4df4790f2c54a0aa234a05e3a3f97e4ed3ecc0679546809f | Python | 10,159 | 189 | __author__ = 'duarte'
from modules.parameters import ParameterSet, ParameterSpace, extract_nestvalid_dict
from modules.input_architect import EncodingLayer, StimulusSet, InputSignalSet
from modules.net_architect import Network
from modules.io import set_storage_locations
from modules.signals import iterate_obj_list, em... |
5a28a02ad9c9f5192ae104d8fb9b3d90f97085ef1d111dd18e9efcb1a5814d97 | Python | 10,159 | 289 | # Authors: Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import logging
import numpy as np
from numpy.polynomial.legendre import legval
from scipy import linalg
import mne
from mne.bem import _fit_sphere
from mne.forward import _map_meg_channels
from mne.io.pick import pick_types, pick_channel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.