sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9a155e000cf41d53a26e7bb83c30b6bb0f6a4fe1303c6ae8c6ddb8f0aeebdbcb | Python | 6,129 | 151 | ####################################################################################################
# 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 ... |
5039049e83327ee055a16222cb153ac5fc060d6267607369d05443757fede52b | Python | 6,131 | 153 | """
pocket_to_pocket_align.py: Align a list of cofactor pockets in the training set to a list in the testing set.
Pablo Gainza - LPDI STI EPFL 2019
Released under an Apache License 2.0
"""
import sys
from Bio.PDB import *
from subprocess import Popen, PIPE
from IPython.core.debugger import set_trace
import numpy as... |
eddb27334fc15ce3927cad1b636849ffbf57293f726f3e1d8c32498a4e9c536f | Python | 6,131 | 143 | """Denoising source separation"""
# Authors: Daniel McCloy <drmccloy@uw.edu>
#
# License: BSD (3-clause)
import numpy as np
from mne import Epochs, EpochsArray, compute_covariance
def dss(data, data_max_components=None, data_thresh=0,
bias_max_components=None, bias_thresh=0, return_data=True):
"""Proces... |
bec9dbe1326fadf35b720273fe66b947c454f0189c6ba3cc02ed79405a27c78f | Python | 6,133 | 136 | import numpy as np
import scipy.io
import os
import matlab.engine
import glob
import mahotas as mt
import pickle
from sklearn.metrics import confusion_matrix
from sklearn import metrics
from sklearn.neighbors import LocalOutlierFactor
from sklearn.externals import joblib
from utils_noisescope import *
import logging
im... |
f48d14128cd0c1e89554c9912fb6c1b1e3918176970c9fa2a90a3ffca799c32a | Python | 6,133 | 148 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
81354088ec7f76fbace8a4cec0013bbd465a46bf6c270f7a6f27e037c553bca2 | Python | 6,134 | 148 | #!/usr/bin/env python3
"""
File: combine_results.py
Created: 2020/11/04
Last Changed: 2020/12/01
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 Soft... |
231fc74b395ad63ebde6b904bea733e74acbe093d959f09bf60f00a233f08dc7 | Python | 6,135 | 172 | #!/usr/bin/env python3
"""
File: rosmap_truth.py
Created: 2020/06/30
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 Software Foundati... |
9390aa212f95734dee505d53b513f5b8ec7dc8b118cac0905296e0e23de8275b | Python | 6,138 | 186 |
experiments = [
('20190328', 'SS29893-tdTomGC6fopt', 'fly3', '001'), #asymm
('20190328', 'SS29893-tdTomGC6fopt', 'fly3', '002'), #asymm
('20190328', 'SS29893-tdTomGC6fopt', 'fly3', '005'), #asymm
('20190328', 'SS29893-tdTomGC6fopt', 'fly3', '006'), #asymm
('20190328', 'SS29893-tdTomGC6fopt', 'fly3', '007'), #asym... |
a22a7d5dc6fc6adc46ffc24f7644e3382494a208a4dcce63d30b51b310b3940a | Python | 6,139 | 210 | from collections import abc
import os
import torch
from torch.nn import functional as F
from torch.autograd import Function
from torch.utils.cpp_extension import load
module_path = os.path.dirname(__file__)
upfirdn2d_op = load(
"upfirdn2d",
sources=[
os.path.join(module_path, "upfirdn2d.... |
e26f1dd0c9cdd7d1ce980a8dce8c86c6154bb74b25b4115efdb21a86e13057a9 | Python | 6,140 | 152 | # Copyright 2020 Google Research. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
240a78df9fb4476528d8280f4a8b88e7137ba35f08df7fdb1fb44fd96918a04e | Python | 6,141 | 173 | #!/usr/bin/env python3
#
# Expansion Hunter Denovo
# Copyright (c) 2017 Illumina, Inc.
#
# Author: Egor Dolzhenko <edolzhenko@illumina.com>,
# Sai Chen <schen6@illumina.com>
# Concept: Michael Eberle <meberle@illumina.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the ... |
9234cc74f0ff5ae2e9e8cf8e496f9e096f480af524ac7ae90ee39d9a6bdc8949 | Python | 6,142 | 148 | #!/usr/bin/env python3
"""
File: combine_results.py
Created: 2020/11/04
Last Changed: 2020/12/01
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 Soft... |
cef71496d88152eef3d832715273f08bfaa5fc3d1a2e88ab1141415ec85273f6 | Python | 6,142 | 177 | # coding=utf-8
# 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
#
# less required by applicable law... |
b6b7b1e8656350d306f96b8ade56349bcf35f72816e29c0c0150ddb8f8788052 | Python | 6,143 | 163 | import logging
import os
from pathlib import Path
import pandas as pd
import tensorflow as tf
from tqdm import tqdm
from cenfind.core.data import Dataset
from cenfind.core.detectors import extract_foci, extract_nuclei, extract_cilia
from cenfind.core.measure import Assigner
from cenfind.core.serialise import (
sa... |
e286b501a7c09053812f0946fa338a6194359d3b56c2adbd4287dff7e485481d | Python | 6,143 | 133 | # 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... |
1ef40a270910c2dc6da0a7660a14b0ebee83edc2b4ad58c61acd117721d0ca0e | Python | 6,145 | 151 | import tqdm
import ipdb
import argparse, sys; sys.path.append('../../formal')
import random as rand
import torch
import numpy as np
from metrics import * # Should import from formal
from graphxai.explainers import *
from graphxai.datasets import load_ShapeGGen
from graphxai.datasets.shape_graph import ShapeGGen
from g... |
ef6a21a18f0fda110f74ded10ce6d73919e37c405b448e3fd1d571ccf5a13186 | Python | 6,147 | 146 | import datetime
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import seaborn as sns
import torch
from scipy import stats
from benchnirs.load import load_dataset
from benchnirs.process import process_epochs, extract_features
from benchnirs.learn import machine_learn, deep_learn
ALL... |
5b96f1cb3f5745803c1f59334b7d32c085b28766e291f2ef3ce8fee07790f658 | Python | 6,148 | 147 | import numpy as np
import os
import pickle
import torch
import torch.nn.functional as F
import torch.utils.data as data
import pdb
from torch.autograd import Variable
INPUT_DIM = 224
MAX_PIXEL_VAL = 255
MEAN = 58.09
STDDEV = 49.73
class Dataset(data.Dataset):
def __init__(self, datadir, trainval_label, tear_typ... |
c85aaaf35d18082ce7bdd8bc0b02689aaa6c702b429968c180d25e1bad63f3e5 | Python | 6,150 | 212 | import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import fftconvolve
import weave
from weave import converters
from .Filter import Filter
from . import Tools
class Filter_Exps(Filter):
"""
Filter f(t) defined as linear combination of exponential functions:
f(t) = sum_j b_j*exp(-t/tau... |
3f14f17c8bfa4c4d3ffe283e9c9ea911931376846ca7e841b17934b22ae1799c | Python | 6,153 | 153 | # 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... |
6008130d0bc5821223d118725bad87a6d4a25239eba0ff4dc3166b1eb1294393 | Python | 6,159 | 170 | # 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... |
2939a3ba9897a8acbf9df2dec3f51b1200cc72db88ea961ea217782373d9e976 | Python | 6,160 | 198 | from io import BytesIO
"""
StyleMapGAN
Copyright (c) 2021-present NAVER Corp.
This work is licensed under the Creative Commons Attribution-NonCommercial
4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
Creative Commons, PO Box 1866, Mo... |
e23331e27717e47ee256bde4a585f1e7fc4e04765a55717ab135a081f59a0a55 | Python | 6,161 | 169 | import itertools
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import lines
import numpy as np
def _get_labels(style):
labels = "abcdefghijklmnopqrstuvwxyz"
if style == "lowercase":
return labels
elif style == "uppercase":
return labels.upper()
else:
raise ... |
598dba41fcdd60ef3ef63ecc95e1b36c8dfad01932069438d11f354cb35eec0d | Python | 6,163 | 148 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
776eebffac5916a297b2570798b3308f241b5db455114fbfc57e257d41b74fc6 | Python | 6,163 | 150 | import torch
import torch.nn as nn
from torchvision.ops import nms
import numpy as np
class DecodeBox():
def __init__(self, anchors, num_classes, input_shape, anchors_mask = [[6,7,8], [3,4,5], [0,1,2]]):
super(DecodeBox, self).__init__()
self.anchors = anchors
self.num_classes = n... |
159c5b906b5fb7a3c1896255cf297c52d2cca755ef2077353b8c11415aa8f50c | Python | 6,165 | 164 | #!/usr/bin/env python3
"""Control the map's light sources via the LightManager: street/building/vehicle.
Commands:
list [--group all|street|building|vehicle|other] count / show lights
on --group street [--color 255,220,150] [--intensity 2000] turn on (+set)
off --group street ... |
fcf08a75e4a8067d2c36903981c974258f61e7b784c5c4c8421b654e36912941 | Python | 6,165 | 219 | """
Training a SFNO on the spherical Shallow Water equations
==========================================================
Using the small Spherical Shallow Water Equations example we ship with the package
to train a Spherical Fourier-Neural Operator (SFNO).
This tutorial demonstrates how to train neural operators on sp... |
b0199e5bc9764f32c8c31dd043fc443c772ab8c1db31e4a4919fbb05b88cc479 | Python | 6,168 | 158 | from experiment import setup_seed, one_dim_data
from train import train
from utils.dataTrans import get_dataloader
from sklearn.model_selection import train_test_split
from model import SoundNet, SoundNet_no_padding, SoundNet_UCR, SoundNet_UCR_np, SoundNet_UCR_np_small
import numpy as np
import torch
from sklear... |
6fb093e229300cae874b0a5e5ba000bd10994f90b5940e5d9b41bc1bd1feef2f | Python | 6,169 | 148 | 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... |
5e3529da7c0417d4f66dec7458cfd956f64865d6fefaee6639b5598b21c296bb | Python | 6,172 | 185 | import tensorflow as tf
import numpy as np
from pathlib import Path
import glob
from scipy.spatial import cKDTree
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_auc_score
from tensorflow import keras
import os
import time
import pickle
import sys
"""
train_evaluation_network.py: T... |
726522cac0c7f7f652a95112c391f3a50a620d512a650d5f1aa0571cb94174ba | Python | 6,173 | 154 | import csv
from typing import List, Optional, Union
import torch
from tqdm import tqdm
from chemprop.args import PredictArgs, TrainArgs
from chemprop.data import get_data, get_data_from_smiles, MoleculeDataLoader, MoleculeDataset
from chemprop.utils import load_args, load_checkpoint, makedirs, timeit, load_scalers, u... |
b84d72f01a2ed4cb89172c9d42277840f8d5b3a4945975cebdd41c0a8e26a535 | Python | 6,177 | 175 |
import numpy as np
from numpy.linalg import inv
import cortex
import nibabel
import csv
from scipy.stats import zscore
from utils import get_hrf, hrf_convolve
from utils import load_and_process
from utils import get_contrast_and_Tstat, getPValue_preFDR, fdr_correction
data_path = ('../data/')
total_time = dict(BW ... |
8ecf1d24dc10bcce3e95b1671b077a6e2252d23d93f4a85a2162d2a921b7103b | Python | 6,178 | 170 | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
from maskrcnn_benchmark.modeling.box_coder import BoxCoder
from .loss import make_retinanet_loss_evaluator
from ..anchor_generator import make_anchor_generator_retinanet
from .inference import make_retinanet_postprocessor
from maskrcnn_benc... |
15e91cc7e0981df98f0f03edd6bce0ab26386dbc5eb1016126b807fd4560fd5b | Python | 6,184 | 200 | import unittest
import numpy as np
import numpy.testing as npt
from grr.GainEstimator import GainEstimator
class GainEstimatorAttributesTests(unittest.TestCase):
def setUp(self):
self.gainEstimator = GainEstimator(dt=0.1)
self.expectedNumReps = 3
self.expectedNumSweeps = 6
self.... |
a11fbeff38187267007e27d0b6b3518f7b20768c8c2b15ae7a7578db4f01dadf | Python | 6,185 | 153 | #!/usr/bin/env python3
"""Record a CARLA simulation to a .log for later replay, then verify it captured.
Commands:
start --file run.log begin recording (server-side file)
start --file run.log --extra also record velocities/controls (bigger file)
stop stop recording... |
d127322f5e5b33e7b053db4f8d67f7ac7d70b7e54ed6a08f43e1565672b92988 | Python | 6,185 | 202 | # %% [markdown]
# ##
import datetime
import os
import time
from pathlib import Path
from tqdm import tqdm
from src.data import join_node_meta
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymaid
import seaborn as sns
from giskard.plot import dissimilarity_cluste... |
2c20c84a69327750147e7482a032f6a21464a49009cce357b87e26ad4b2361ab | Python | 6,189 | 157 | #!/usr/bin/env python3
"""
@ Lina Teichmann
INPUTS:
call from command line with following inputs:
-participant
-bids_dir
OUTPUTS:
epoched and cleaned data will be written into the preprocessing directory
NOTES:
This script contains the following preprocessing steps:
- ... |
781ab5b3502c00041f28842a7663179bcef690611cd7d8c51c2f3f09ba22e7d7 | Python | 6,193 | 171 | # 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... |
d53365384c93b3fe919388b43c5f692b1d9791b6f4495de289ac1f94d5ac6ef8 | Python | 6,194 | 181 | """ this code establishes the real-time port b/t FDTD and Python to enable state and reward passes
for optimization of photonic crystals by RL. NOEL, Renjie Li, December 2021
"""
class FdtdRlNanobeam():
def __init__(self):
self.numMirror = 9
self.numTaper = 4
#self.cavLi... |
357aad44596f82354ac90f5d068b9a51e2a3e5594b3f4c37a5ef0feefcd70c1c | Python | 6,197 | 153 | import torch
from mmdet.core import force_fp32, images_to_levels
from ..builder import HEADS
from ..losses import carl_loss, isr_p
from .retina_head import RetinaHead
@HEADS.register_module()
class PISARetinaHead(RetinaHead):
"""PISA Retinanet Head.
The head owns the same structure with Retinanet Head, but ... |
6538715dbf95db9b84676fb6be754c5f65255f055afbf7ca2ea09bd376aea2e0 | Python | 6,197 | 192 | # 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... |
bb3bb47e03fcbc581f552a0c155cbca93f1858f4702b133a3c0144edeabdbcb5 | Python | 6,197 | 225 | #%%
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from anytree import LevelOrderGroupIter
from sklearn.metrics import adjusted_rand_score
from graspologic.cluster import AutoGMMCluster, DivisiveCluster
from graspologic.embed import AdjacencySpectralEmbed
from g... |
fec7e120fb92505b156c19f761fe8ea271073745fd6073ea1d967efc334863cf | Python | 6,197 | 235 | """
U-NO on Darcy-Flow
==================
Training a U-shaped Neural Operator (U-NO) on the small Darcy-Flow example we ship with the package.
This tutorial demonstrates the U-NO architecture, which combines the resolution invariance
of neural operators with the multi-scale feature extraction of U-Net architectures.
... |
3209fd196fa6913802af2911a2a618c80a6f287ce65cb797add594fb5750dac5 | Python | 6,198 | 206 | import sys
import analysis.util as util
import analysis.visualizer as vis
def analyze_tutorial(
filepath,
out_dir,
epoch,
train_tar_path=None,
test_tar_path=None,
train_true_path=None,
test_true_path=None,
num_seq_tar=4,
num_seq_free=None,
... |
7be98d9c217314f257becdb4b3224e30a3b1b5bc55a75d386b460d76e83dc539 | Python | 6,200 | 180 | import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torchvision
import torchvision.transforms as transforms
import os, random, sys, math
import numpy as np
import matplotlib.pyplot as plt
import networks
#random seed
manualSeed = 1
np.random.seed(manualSeed)
rando... |
39d7fbfae911e117556acfdbafe197c112581f5546ade08df4e088f7e200879f | Python | 6,201 | 103 | import numpy as np
import pytest
from simphox.mode import ModeSolver, ModeLibrary
from simphox.grid import Grid
from simphox.typing import Size2
from simphox.utils import TEST_ONE, TEST_INF, SILICON, AIR, Box
@pytest.mark.parametrize(
"waveguide, sub, size, wg_height, spacing, rib_y, vertical, block, gap, seps, ... |
5d4136f43f4712aebde5652af369648c614a354913b95094403799a09c24cc4c | Python | 6,203 | 159 | # 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... |
a093686f999ae61e445828066456892ee02db397a083122804cf75023f4734d9 | Python | 6,203 | 151 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
228901739d34c2ad8a645e335d6813a977c89a79093c5660f49dfc4ae7b70e58 | Python | 6,204 | 206 | #%% Load
from operator import itemgetter
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from graspy.plot import gridplot, heatmap, pairplot
from mpl_toolkits.axes_grid1 import make_axes_locatable
from graspy.utils import augment_diagonal, pass_to_rank... |
5293d66584fb16997d560c58e3d7623cfca376993034f1d243fce5fa37d57891 | Python | 6,204 | 151 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
f16a95fecb1869a0dc4954f80f5067b91502c9774d829290be438d36dbd10751 | Python | 6,208 | 180 | import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torchvision
import torchvision.transforms as transforms
import os, random, sys, math
import numpy as np
import matplotlib.pyplot as plt
import networks
#random seed
manualSeed = 1
np.random.seed(manualSeed)
rando... |
1454ab834effa5733cc13cf61c9a69a3e787d6d5452903a9cee9a03737995026 | Python | 6,209 | 177 | __author__ = 'duarte'
import copy
from preset import *
import numpy as np
"""
single_neuron_patterned_synaptic_input
- main spike_input stimulus processing
"""
run = 'local'
data_label = 'example2'
# #####################################################################################################################... |
2fda4200b76f4fe52be780004381ce6154b6139848998e6e828dbe5f2eec50cb | Python | 6,213 | 163 | # 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... |
dd94b14eb1fb14be90c90ff8c3feba167fd32deb808107b2d3bbbfae861dafca | Python | 6,214 | 145 | # Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
import time
import carla
from . import SyncSmokeTest
WORLD = "Town10HD_Opt"
class TestWalkerBo... |
c44a5ff5a5e365b1aa4a912bd27bb44600a070c17029be0ee6a0c2fc541c3c8e | Python | 6,215 | 193 | import argparse
import re
import tempfile
from collections import OrderedDict
import torch
from mmcv import Config
def is_head(key):
valid_head_list = [
'bbox_head', 'mask_head', 'semantic_head', 'grid_head', 'mask_iou_head'
]
return any(key.startswith(h) for h in valid_head_list)
def parse_co... |
ffca87532e1351f3759436a38091f63c31626be46ee1caf68f0231fd8c6ed65d | Python | 6,216 | 190 | import os
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torchvision
import numpy as np
import seaborn as sns
import cv2
__all__ = ['show_heatmaps', 'show_img_with_heatmap', 'visualize_with_circles', 'save_images']
def save_images(image, output, epoch, args, curr_epoch):
mean=[0.485,... |
3afb4e772c35e80ae749c01fee77752a1f09db818e738861bd8c90ab61289028 | Python | 6,218 | 147 | import FBEM
import h5py
import FBEM.logs
import json
from FBEM.various import path_to_string, subdirs
import os
def get_ranges_csv_str(input_folder):
'''
Read from `ranges.csv` what range of nodes/triangles each geometrical object had.
'''
with open(os.path.join(input_folder, 'ranges.csv'), 'r') as ra... |
00d0aa1751e9fde8839717c39bdc992197f89ba87e7810770d997b4e9556ad73 | Python | 6,219 | 204 | """
Copyright 2020 - by Jerome Tubiana (jertubiana@gmail.com)
All rights reserved
Permission is granted for anyone to copy, use, or modify this
software for any uncommercial purposes, provided this copyright
notice is retained, and note is made of any changes that have
been made. This softwar... |
19b5df6067b629a1d5083ead37ec5647dd7163c5fdf4d7fe1a8bd032f8196817 | Python | 6,219 | 146 | from pathlib import Path
from os import chdir
import unittest
import numpy as np
from nipype.interfaces.base import CommandLine
from qipype.fitting import LtzWaterMT, LtzWaterMTSim, qMT, qMTSim
from qipype.commands import NewImage, Diff, ZSpec, Lineshape
vb = True
CommandLine.terminal_output = 'allatonce'
class MT(u... |
fd514f6f669c901ea84c37790370450e9cec35d37506f1cb9a4c4c36e173eecc | Python | 6,220 | 126 | import torch
import torch.nn as nn
class B2_VGG(nn.Module):
def __init__(self):
super(B2_VGG, self).__init__()
conv1 = nn.Sequential()
conv1.add_module('conv1_1', nn.Conv2d(3, 64, 3, 1, 1))
conv1.add_module('relu1_1', nn.ReLU(inplace=True))
conv1.add_module('conv1_2', nn.Co... |
8b6e99ad397c1cf0169b556f18f52c7fdf937d98ff72b4fe76e80c1782759497 | Python | 6,234 | 111 | import torch, logging, argparse, os, time
import pandas as pd
from torch.optim import lr_scheduler
from torch.utils.data import DataLoader
from torch.utils.data.dataset import random_split
from torch.nn.parallel import DataParallel
from torch.nn import CosineSimilarity
from lib.data_io import BrainFMRIDataset
from lib... |
9f07efec5b3a342ecd4486fb761aaef5fb9910920abda6159813d3e5319b10fd | Python | 6,234 | 160 | def remove_digital_filter(dic, data, truncate=True, post_proc=False):
"""
Remove the digital filter from Bruker data.
Parameters
----------
dic : dict
Dictionary of Bruker parameters.
data : ndarray
Array of NMR data to remove digital filter from.
truncate : bool, optional
... |
ed5de393c54a37535ce3d6b2a657f4792f784ab2ba7f94384d2f12479026afdc | Python | 6,237 | 228 | #%% IMPORT MODULES
from __future__ import division
import pickle
import argparse
import json
from os.path import exists
import numpy as np
import grr.GIF_network as gfn
from grr.Tools import check_dict_fields
from ezephys.stimtools import BiexponentialSynapticKernel
from lib import generate_models_argparser
#%% ... |
d14aa1ede62f41d37ab74b742d60ba51ea28881d74313e39fad5851c8501e4dc | Python | 6,238 | 151 | # 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... |
831720b14470cf7f6b9566b8f50715b5aa8bf88b8765d798a61845aea9a9547d | Python | 6,239 | 181 | import shutil
import sys
from timeit import default_timer as timer
import pyslow5
import os
import click
import numpy as np
from random import randrange
POS_SLOW5_DIR = ''
NEG_SLOW5_DIR = ''
CUTOFF = 1500
SUB_SAMPLE_SIZE = 3000
SAMPLING_C0 = 4
BATCH = 20000
IS_PICO = True
LABEL = 1
MAD_SCORE = 3
REPEATED = False
OUTPU... |
8339a8331f9603b10a85dd323541f17557cfc2702a93425e59692991b6a88ce0 | Python | 6,239 | 219 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
##################### IMPORTS #######################
import os
import sys
from keras.models import model_from_json
from matplotlib import pyplot as plt
import numpy as np
from keras.callbacks import ModelCheckpoint
from rdkit.Chem.Draw import IPythonConsole
import os,... |
862cf7b5af256485295b39d032a40ade14f6c2e9b23dc70e05ad157cf32d500e | Python | 6,240 | 169 | # 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... |
c4b1699d24ab317b11094cba4b894552a5f6b46940596d0b0dfc6b8615124700 | Python | 6,241 | 168 | import os.path
import pandas as pd
import numpy as np
import utils2p
import flydf
import utils_Florian as utils
if not os.path.isdir(utils.output_dir):
raise RuntimeError(f"Output directory {utils.output_dir} does not exist. It is specified in utils.py and created by 00_trials_for_paper.py.")
trials_for_pape... |
fa197410ce4e2d54a69db7ef53be767d2583f4b11e0327930e59b7749780bbf7 | Python | 6,241 | 193 | '''
Simulates Paramecium motion.
Uses quaternions for 3D motion.
The cell coordinate system is chosen so that the cell points upward (along positive z axis).
'''
import numpy as np
from pyquaternion import Quaternion
from numpy.linalg import norm
import imageio
__all__ = ['MovingCell', 'PlaneMovingCell']
class Movin... |
60892eb2c09505b545ea90967e66550191f0aeed95f523a55ed0b854189338b0 | Python | 6,242 | 218 | from typing import Callable, List, Tuple
import numpy as np
import pytest
import tensorflow as tf
from multi_phase import RANDOM_SEED
from multi_phase.utils.augmentation import DiffAug, StdAug
tf.random.set_seed(RANDOM_SEED)
PCT_CORRECT_THRESHOLD = 0.6
DEFAULT_IMG_SIZE = [4, 6, 8]
NUM_HOMOGENOUS_DIMS = 3
TEST_IMG_D... |
d7394217bdfb5398817318b56f0e31988432e8abba56c28d141dde723984c9e1 | Python | 6,242 | 149 | # 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... |
eccf5761195fdd79273eccf25505cd68d985f21684be1cbd62661a2a1f5b3e72 | Python | 6,244 | 158 | """ Data reader for AllenNLP """
from typing import Dict, List
import jsonlines
import logging
from overrides import overrides
from allennlp.common import Params
from allennlp.data.dataset_readers.dataset_reader import DatasetReader
from allennlp.data.fields import LabelField, TextField, MultiLabelField, ListField, ... |
5855977a8005965a733d5e8a44e0bd874f5ff0be3e23be12b94ed0f86156fa59 | Python | 6,248 | 191 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
import fnmatch
import re
import numpy as np
from .._data_obj import cellname
from . import stats
from .contrast import parse
# array functions: work on array, take axis argument
np_afuncs = {'min': np.min,
'max': np.max,
'sum': np.s... |
bf0a8a0dfd11371d0b83b1bb027ce7a13c548af0d98131e485d50d4fefb07883 | Python | 6,248 | 164 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import MSELoss
class FocalLoss(nn.Module):
"""
Focal loss (https://arxiv.org/abs/1708.02002) implementation.
"""
def __init__(self, pos_weight=1, gamma=2, logits=True, reduction=True, weight=None):
sup... |
b28da9b0279365aaec41df8003fbf56437b48eea36a8e1138df820b11a1a108e | Python | 6,249 | 155 | from typing import List, Union
import numpy as np
from rdkit import Chem
import torch
import torch.nn as nn
from .mpn import MPN
from chemprop.args import TrainArgs
from chemprop.features import BatchMolGraph
from chemprop.nn_utils import get_activation_function, initialize_weights
class MoleculeModel(nn.Module):
... |
5136e72969bf401cee7bb512545b863f1f1478e2dca3b93f246259216a19a755 | Python | 6,251 | 152 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
f4cd92aa92788818663c71b81904c4acaab2a080847a682520072702db15e15c | Python | 6,254 | 213 | import torch
import torch.nn as nn
import torch.nn.functional as F
from function import FakeQuantize
# 计算S和零点
def calc_ScaleZeroPoint(min_val, max_val, num_bits=8):
qmin = 0.
qmax = 2. ** num_bits - 1.
# S=(rmax-rmin)/(qmax-qmin)
scale = float((max_val - min_val) / (qmax - qmin))
... |
ae600730ee5fdc7e9b048c668ce10b7f6b85fd78444894a8f4c0912180b41706 | Python | 6,257 | 254 | #%%
from operator import itemgetter
from pathlib import Path
from warnings import filterwarnings
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.cluster import AgglomerativeClustering
from tqdm import tqdm
import src.utils as utils
from g... |
c4a1574dc7f1ee20fefcd58ca4a08749a41e3c82797a006efc32977e6d50529c | Python | 6,257 | 181 | import argparse
import glob
import logging
import os
import re
import time
import yaml
from pandas import DataFrame, read_csv
from lib import ( ColocalisationResult, SegmentedFile, colocalisation,
utils)
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format='%(name)s:%... |
314003afb74ad0d48689f637c961a40e525cfa5574aefb06f26455d5a6e241fc | Python | 6,260 | 187 | # -*- coding: utf-8 -*-
from pyspark.streaming.kafka import KafkaUtils, Broker
from pyspark import SparkContext
from pyspark.sql import SparkSession
from pyspark.streaming import StreamingContext
import numpy as np
import os
from getopt import getopt, GetoptError
from sys import argv
import traceback
import cv2
import ... |
93d6f543733078c3fc9ac1f94bc33ec105db0c3e7347dbbd43d35ce466bb9d98 | Python | 6,265 | 165 | import os
import logging
from pathlib import Path
from functools import reduce, partial
from operator import getitem
from datetime import datetime
from logger import setup_logging
from utils import read_json, write_json
class ConfigParser:
def __init__(self, config, fold_id, resume=None, modification=None, run_id... |
cf7164194c793cfb30185979b434b9c61799532b204452bcc41f329d0d6fb936 | Python | 6,265 | 126 | import os
import shutil
import webbrowser
from dash_extensions.enrich import DashProxy, ServersideOutputTransform, FileSystemBackend
from RV.layout import get_RV_layout
from RV.callbacks.annotation_callbacks import register_annotation_callbacks
from RV.callbacks.bad_channel_callbacks import register_bad_channel_callb... |
f221625a46a4cedb776d924118e09f96c890a2d870ef342e6dada656a40ccc0f | Python | 6,265 | 215 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"Utilities for testing"
from contextlib import ContextDecorator, contextmanager
from functools import reduce
from importlib.util import spec_from_file_location, module_from_spec
import os
from operator import mul
from pathlib import Path
import shutil
import temp... |
8a7d56d662f000d175dead03107e30a50ee19d79c2829532b6eb4fed3e45f707 | Python | 6,266 | 197 | import numpy as np
import torch
import random
import cv2
class Scale(object):
"""
Resize the given image to a fixed scale
"""
def __init__(self, wi, he):
'''
:param wi: width after resizing
:param he: height after reszing
'''
self.w = wi
self.h = he
... |
e47537135ae07246304d468b60bc0e2787c55ffdb5fde34bc55a3c0a02ab5894 | Python | 6,266 | 182 | """
defaultdatasets
Created by: Martin Sicho
On: 25.06.22, 19:42
"""
import numpy as np
import pandas as pd
import torch
from torch.utils.data import DataLoader, TensorDataset, Dataset
from drugex.data.corpus.vocabulary import VocSmiles, VocGraph
from drugex.data.interfaces import DataSet, DataToLoader
class Smile... |
ae10151febf2ba23dc08a4af8b8c80d2c21ea38c93234d47142af0948fb3c58a | Python | 6,267 | 165 | import math
import torch
import logging
import torch.nn.functional as F
from torch import nn
from ..densebox.loss import make_retinanet_loss_evaluator
from ..densebox.inference import make_retinanet_postprocessor
from maskrcnn_benchmark.layers import Scale
from maskrcnn_benchmark.nas.modeling.micro_heads import Micro... |
ad0f1ac79d180f83a9949251d0a0dd784d7892d76fd26e5f339edaa0ca4abc34 | Python | 6,269 | 211 | """Setup for nox."""
import os
import shlex
import shutil
import sys
from pathlib import Path
from textwrap import dedent
import nox
try:
from nox_poetry import Session
from nox_poetry import session
except ImportError:
message = f"""\
Nox failed to import the 'nox-poetry' package.
Please instal... |
3e1dd9c15befdee7aacc592ad3c9194dc8d8e117e282e04bc3cb2a49efe8212c | Python | 6,273 | 180 | import logging
# %%
import copy
import json
import pathlib
import pickle
import pprint
import warnings
from collections import defaultdict
import box
from box import Box
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.io
from scipy import optimize, signal, stats
from scipy.optimi... |
ca58b6930679feb011fd0eab1b87f16c9287e3d734de8b9241d48b32e794f5d0 | Python | 6,273 | 143 | import os.path
import pickle
import numpy as np
from sklearn.experimental import enable_hist_gradient_boosting
import sklearn.preprocessing
import sklearn.model_selection
import sklearn.ensemble
import pandas as pd
import imblearn.over_sampling
import flydf
from flydf.core import _fix_dtypes
import utils_Florian as ... |
be1f7f5ee4fea50ce5afafd567af304d2162936f2b7e0a888c3692dbb713dcd1 | Python | 6,274 | 205 | import tensorflow as tf
from typing import Tuple, Union
DROPOUT_PROB = 0.5
EPSILON = 1e-12
# -------------------------------------------------------------------------
class InstanceNorm(tf.keras.layers.Layer):
"""Instance normalisation layer for Pix2Pix generator"""
def __init__(self, name: Union[str, Non... |
317c65fbfaffb657c8fab15b6983fd16dfba5c6482a6db7b70354d464a6e757c | Python | 6,280 | 195 | import torch.nn as nn
from mmcv.cnn import ConvModule
from ..builder import BACKBONES
from ..utils import ResLayer
from .resnet import BasicBlock
class HourglassModule(nn.Module):
"""Hourglass Module for HourglassNet backbone.
Generate module recursively and use BasicBlock as the base unit.
Args:
... |
65a4d6849dbe414787a7fc4068e8289124616aa392a11574fe9868f7e75c2375 | Python | 6,280 | 175 | from functools import partial
import numpy as np
import pandas as pd
import psutil
import tsfresh.utilities.dataframe_functions as tsfresh_utils
from sklearn.base import TransformerMixin
from sklearn.model_selection import StratifiedShuffleSplit
from sklearn.pipeline import Pipeline
from tsfresh import extract_feature... |
c5e586c109e2ad591790044aace8defc6b9c29f9c3ba3b8c9aa5de556a936a79 | Python | 6,282 | 171 | # 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... |
fe0fcab6c8b8fe6e53a99e31c753c4fbb20e0dbfdc3a53af966073eaf18f4cb3 | Python | 6,282 | 173 | import torch
import torch.nn as nn
import numpy as np
from typing import List
from config import cfg
class ImageBasedCrossEntropyLoss2d(nn.Module):
def __init__(self, classes, weight=None, size_average=True, ignore_index=255,
norm=False, upper_bound=1.0):
super(ImageBasedCrossEntropyLoss2... |
625602799d9d1f2f0be72154cb0bc7dfe417568e6014160139cce22c2c51b417 | Python | 6,284 | 159 | from collections import defaultdict
import csv
from logging import Logger
import os
import sys
from typing import Callable, Dict, List, Tuple
import numpy as np
import pandas as pd
from .run_training import run_training
from chemprop.args import TrainArgs
from chemprop.constants import TEST_SCORES_FILE_NAME, TRAIN_LO... |
6ea9b54e5fce765c32a8fcbca865e6d32d34684e48853074f2dde985163d3490 | Python | 6,286 | 180 | """
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.nn.modules.conv import _ConvNd
from torch.nn.modules.utils import ... |
c99a8b7936512f82ca97f1fe2230977e877c3baeb2bba61f5793659f0df57cb9 | Python | 6,287 | 172 | import os
import random
import time
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from util.datasets import load_dataset
from lib.models import get_model_class
from util.logging import LogEntry
def run_epoch(data_loader, model, device, train=True, early_break=False):
... |
7a8ff290003f31699ba22688500bece3b68dc0ec442f4378d26ec5bdb09f19a7 | Python | 6,288 | 174 | """
Vowel unmasking data pre-processing to filter summary data into a form that
is amenable for data analysis
Here we do some general housekeeping to get the columns into a common format,
create columns to make the statistics in R more straightforward and bring
together some columns containing redundant information... |
a1e98bc1d8035e7f0be9ca47086aca65167c70cda31d8b2bf2814286fc2649aa | Python | 6,289 | 163 | # 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... |
5d6f01c8bdc5b29695ad9bff45ea96c9e91337a2a29affbf7473acc19e9b2a21 | Python | 6,290 | 202 | import os
import shutil
import tempfile
import numpy as np
from eelbrain import fmtxt
from eelbrain.testing import TempDir
from eelbrain.fmtxt import html, tex, read_meta
from eelbrain import datasets, plot
def test_code():
"test fmtxt.Code"
s = ' '
br = '<br style="clear:left">\n'
assert html(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.