sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
560fc13c940515828f8a7ce441b69a2ddb22299360124f0c71eb3bd66568cbe6 | Python | 2,621 | 94 | 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
import numpy as np
import matplotlib.pyplot as plt
import networks
#random seed
manualSeed = 1
np.random.seed(manualSeed)
random.seed... |
06bb38915be53ce5194cf4599b3eafd4c5259af1272645344388f6f514aa6ecf | Python | 2,623 | 94 | 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
import numpy as np
import matplotlib.pyplot as plt
import networks
#random seed
manualSeed = 1
np.random.seed(manualSeed)
random.seed... |
e30022c0f3232abba1c7b24507f3a33b72f9d9d002f7efb4dc534d7b9e3d6b10 | Python | 2,624 | 65 | from sklearn.model_selection import train_test_split
import numpy as np
import pandas as pd
def num_to_text(number_to_class, anno_list):
"""
Convert list of class numbers to list of class names
"""
return np.vectorize(number_to_class.get)(anno_list)
def split_data(orig_pose_dictionary, vocabulary, ... |
33964f34040b1f60a13c457573bea6b3ffa8e1573ac13dc306b57805e177dc48 | Python | 2,625 | 76 | import synapseclient
import argparse
import getpass
import synapseutils
parser = argparse.ArgumentParser(description='Download RNAseq and genotypes of CMC.')
args = parser.parse_args()
user = input("Synapse username:")
password = getpass.getpass('Synapse password:')
syn = synapseclient.Synapse()
syn.login(user,pas... |
78b263e69fc73eaf6f317abb7a42e83534d1d950d1b86d361fdb429ed0c04a06 | Python | 2,625 | 85 | import torch
import pytest
from ..patching import MultigridPatching2D, make_patches
from neuralop.tests.test_utils import DummyModel
# Input shape params
batch_size = 16
channels = 1
side_len = 128
@pytest.mark.parametrize("levels", [1, 2, 3])
@pytest.mark.parametrize("padding_fraction", [0, 0.1, 0.2])
def test_mak... |
9dc1dd027836e94d1ea8e5fd59c7945d1e17af81ce46e720d9a3f5d301462c6c | Python | 2,625 | 91 | """
Adapter for PubMed,
.. warning ::
this is currently highly incomplete.
"""
import logging
import re
from dataclasses import dataclass
from typing import Optional
from oaklib.datamodels import obograph
from oaklib.datamodels.vocabulary import HAS_DEFINITION_CURIE, RDFS_LABEL
from oaklib.implementations.ncbi.... |
1472e1dda2537dc14db39a9ef3e7ba99b57965ca5b02ce953fdaef87f6b86bfa | Python | 2,628 | 91 | import preprocess as ppc
import epoch as epo
import cleaning as cln
import evoked as erp
import stats as st
import plotting as pl
import mne
import sys
import datetime
import os
import fnmatch
import numpy as np
########### Setup for logging ################
protocol = 'WORDS'
if protocol == 'WORDS':
... |
58988f38d92dba4388b8eb80c34669dd312411121fc38ea44f5ece16dd095509 | Python | 2,630 | 87 | #!/usr/bin/env python
# coding: utf-8
#
# Author: Kazuto Nakashima
# URL: http://kazuto1011.github.io
# Created: 2018-03-26
from __future__ import absolute_import, print_function
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
from .deeplabv3 import _AS... |
9b041e4d32acf3cbbe1d7a0ec82c0e7a6f46259257269c36431f899b4fc8886d | Python | 2,630 | 69 | import numpy as np
from itertools import zip_longest
from scripting.spectrum import metadata
from scripting.spectrum.dataset import extract
def get_epochs(data, num_seg):
"""Get (start, stop) ranges for data.shape[1] divided into 'num_seg'
Args:
data (ndarray): score data from dset. (dset['dat... |
bb461f0b068a0f1b0b61d550ed6c42a32b79194318b828f4c43b2ffb8928b382 | Python | 2,630 | 56 | # Parse TargetALS samplesheet to make molgenis-compute samplesheet
import os.path
import glob
import argparse
parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for TargetALS.')
parser.add_argument('samplesheet', help='TargetALS samplesheet')
parser.add_argument('fastq_base_dir', help='pat... |
99cb1b2ce6c3b43498398dbedcbfa5ea39e8908248a08f92bf81b284b509007d | Python | 2,631 | 64 | # 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... |
3410d18720f4e872ee027129fc12e2b8623da86fe2011ba3a36110b98a9715d8 | Python | 2,632 | 92 | import pickle
import numpy as np
import more_itertools
from PIL import Image as PIL_Image
from keras.preprocessing import image
from charpragcap.utils.image_and_text_utils import split_dataset,index_to_char,get_img_from_id
from charpragcap.utils.config import *
from charpragcap.resources.models.resnet import resnet
i... |
5f1b1b7b261853834dc5b91dd28d3496368bcdbf8106187da75aabac810597b2 | Python | 2,632 | 81 | import json
import os, errno
import sys
import time
import shutil
import subprocess
from subprocess import Popen, PIPE
BASE_NAME = 'random'
INSTANCES = [
#('adult', 1506844911), # 0.8217306
#('audiology', 1506863181), # 0.9886078
('breast', 1506930659), # 0.9663081
#('breast_original', 1506901272), # ... |
972468201eeff6285bd0f52a317cb788f1960b0c5bd9f46e62b5be243f155cf9 | Python | 2,633 | 83 | import numpy as np
from cgtasknet.tasks.reduce import CtxDMTaskParameters, DMTaskParameters, DMTaskRandomModParameters, GoDlTaskParameters, \
GoDlTaskRandomModParameters, \
GoRtTaskParameters, \
GoRtTaskRandomModParameters, GoTaskParameters, GoTaskRandomModParameters, MultyReduceTasks, RomoTaskParameters, \... |
153eed255d151d3b6eae8c13e26f3742be352d59ec313976444e19962daafee4 | Python | 2,634 | 78 | # 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... |
51f21e83fa19bdaa85860c6f3cd55df661fe103521b0f5c479c20f5779d37386 | Python | 2,635 | 59 | """
© 2022, ETH Zurich
"""
import os
from rescoss_logp_ml.utils import NUM_INNER_FOLDS, LEARNING_CURVE_SIZES, SEED, PROC_DATA_PATH, FOLDER_NAMES
import pandas as pd
import argparse
import shutil
def get_sample(csv, n, split_type):
df = pd.read_csv(csv)
if split_type == "random" or split_type == "scaffold":
... |
0f435416ce3ccda7cc3ad0f6c282d49767c25b1ed144528fd6bd8ecf2ca58048 | Python | 2,638 | 75 | # basic imports
import os
import pickle
import numpy as np
# framework imports
from cobel.agents.sfma import SFMAAgent
from cobel.interfaces.gridworld import InterfaceGridworld
from cobel.misc.gridworld_tools import make_open_field
# local imports
from sfma_memory import SFMAMemory
def single_run(world: dict, batch_s... |
e43fff9baca7a692a0aeaf8d62a79ffb4db3520fd432069a7c7087f8b2cf9908 | Python | 2,638 | 90 | from abc import abstractmethod
import torchvision.transforms as transforms
from utils import augmentations
class TransformsConfig(object):
def __init__(self, opts):
self.opts = opts
@abstractmethod
def get_transforms(self):
pass
class EncodeTransforms(TransformsConfig):
def __init__(self, opts):
super(... |
10555b38fcab8cb21e4b3379b89832ab8e4dad977a9b70fda71b85bc9ab4a9ab | Python | 2,639 | 90 | """
2020-01-27 Master script to run a parallel jobs; input - number of threads to run
2020-07-02 Load .npy instead of .pkl
args:
num_threads
delta0
tol
"""
import logging
import subprocess
import sys
import carpet.various.parallel_with_threads as pwt # to find fixpoints faster
import carpet
from sim_geome... |
23734cc6d4dd4276f6fc37817f24508979a8d03f76736f45bcb0badda181bec1 | Python | 2,640 | 78 | import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
from math import exp
def gaussian(window_size, sigma):
gauss = torch.Tensor([exp(-(x - window_size//2)**2/float(2*sigma**2)) for x in range(window_size)])
return gauss/gauss.sum()
def create_window(window_siz... |
6ad48069fc3964ceac0f48e7d3911076f99fb5d7e951d9e5833e11317b4cd668 | Python | 2,640 | 114 | #%%
from src.data import load_metagraph
mg = load_metagraph("G")
meta = mg.meta
meta = meta[meta["left"]]
class1 = [
"KC",
"MBIN",
"MBON",
"uPN",
"tPN",
"vPN",
"bLN",
"pLN",
"APL",
]
class2 = ["ORN"]
meta = meta[meta["class1"].isin(class1) | meta["class2"].isin(class2)]
meta["merge... |
577ca2acb2bb2108d9db220d540c0d0c28b1125306f4d0df8f5f7163aaf05bca | Python | 2,642 | 63 | # 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... |
59bceb52fb794e753fc374605e8ec42e99dc694c3b416f86f9730d17310edf93 | Python | 2,643 | 87 | import torch.nn as nn
import torch.nn.functional as F
class EmbeddingNet(nn.Module):
def __init__(self):
super(EmbeddingNet, self).__init__()
self.convnet = nn.Sequential(nn.Conv2d(1, 32, 5), nn.PReLU(),
nn.MaxPool2d(2, stride=2),
... |
7ad16c42ac996f2f5cec5f6c61bf30cd70038c74e9352a89abc4cb821e471e80 | Python | 2,644 | 86 |
import cv2
import torch
import fractions
import numpy as np
from PIL import Image
import torch.nn.functional as F
from torchvision import transforms
from models.models import create_model
from options.test_options import TestOptions
def lcm(a, b): return abs(a * b) / fractions.gcd(a, b) if a and b else 0
transforme... |
c5fe6017fa1d5edb858b06b84b910f71bbb0936cbc2739ec92369feef9ee963e | Python | 2,645 | 88 | import argparse
import os
import sys
import numpy as np
import torch
import torchvision.transforms as transforms
from PIL import Image
from networks.drn_seg import DRNSeg
from utils.tools import *
from utils.visualize import *
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(... |
c4235a6a6e308520e0b5765266a49d7a58757f531eb79e5660d3335e7325af92 | Python | 2,646 | 69 | import ipdb
import random
import torch
import matplotlib.pyplot as plt
from graphxai.explainers import PGExplainer
from graphxai.gnn_models.node_classification.testing import GCN_3layer_basic, GIN_3layer_basic, test, train
from graphxai.datasets.shape_graph import ShapeGGen
# Load dataset:
# Smaller graph is shown t... |
92913a0ba4b30e0ee0ffe3cb2778cd83c3a40474eda4a46630d0d7b4df54cfd7 | Python | 2,647 | 106 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from typing import List, Tuple
class Position:
def __init__(self, sequence: str):
"""
Initialize Position object.
... |
ee50090983b46f813dbb1434bd63de053f2869a28f0a74b6405baad6538f376d | Python | 2,648 | 80 | """
"""
import logging
import os
import sys
import subprocess
import carpet.various.parallel_with_threads as pwt
import carpet
import numpy as np
from sim_physics import period, N
## Script
script_path = '.'
script_name = "worker_residence.py"
def integrate_trajectory_script(*args):
'''
args: irun, ncycle, D... |
b9141c09a95fcfea2345244a8b2891ff9f2a4053e44991193285bc7a1c626841 | Python | 2,649 | 106 | '''
Statistics of hyperpolarized fits
'''
import pandas as pd
from pylab import *
from matplotlib import gridspec
import seaborn
from file_management import *
from os.path import join
width, height = 6, 3
table = pd.read_csv(join(config['root'], 'Deciliated', 'tables', 'selection_deciliated.csv'))
# Selection
print... |
64e9f965d4346f64963f7ac6d5faddada50030b418f018f31ae0fbefbf4964c3 | Python | 2,651 | 79 | """Example script to load Scanbox data as a SIMA sequence."""
from __future__ import division
import argparse
import fnmatch
import os
import numpy as np
import sima
from sima import imaging_parameters
def sbxread(path, info_path):
"""Read in an .sbx file and return a SIMA sequence.
Based off of the sbxRea... |
6543dc4e31b2025df83dd2d6828d1078d71d30068a8659ad6819b84553b87060 | Python | 2,651 | 56 | import numpy as np
from Utils import load_channel_raw
from PrePro import clip_filt_norm
"""This script does all of the pre-processing except for concatenation and standardization, which is done in main.py."""
# Load raw sigs of each component and each force platform (load_channel_raw returns object of shape (N, C, L)... |
a7ed325085ab923487f6f762c238b80df9cde4039186df854cf3584a2054c6de | Python | 2,651 | 88 | """
Refer to https://github.com/rosinality/stylegan2-pytorch/blob/master/prepare_data.py
"""
import argparse
from io import BytesIO
import multiprocessing
from functools import partial
from PIL import Image
import lmdb
from tqdm import tqdm
from torchvision import datasets
from torchvision.transforms import funct... |
ac212eb1b60e0f743ec549a12a8622979eca12656fcb0f1226d768b807cfa597 | Python | 2,651 | 61 | # 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... |
fdc94f6e91219f79e6a7393a1c27edc8fc5f40f1d7439bf7d59808d9e2b7b3ff | Python | 2,652 | 60 | # Copyright 2023 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... |
309d76bd305814a163a9aa0c3f5a4b16f98bc3cc10513892ab2ea91eac9fec10 | Python | 2,653 | 77 | # Copyright 2015-2022 The MathWorks, Inc.
import sys
import warnings
from shutil import rmtree
from os.path import exists
use_build_msg = '.*Use build and pip and other standards-based tools.*'
excTxt = ''
if 'bdist_wheel' in sys.argv[1:]:
# If "python setup.py bdist_wheel" is executed, we need to
# import f... |
0a348b5f8571a5c1ea6f5fe2961fd3bd77d25aedf9dce1ec60e7e4f8cd24b647 | Python | 2,655 | 101 | from os.path import basename
from pathlib import Path
import numpy as np
import pandas as pd
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from graspy.datasets import load_drosophila_left
from graspy.utils import binarize, symmetrize, is_fully_connected
from graspy.plot i... |
f17a819c67291a18eddcbcc2deeca27151390cb1c8e6346c67db5c1a2c082a37 | Python | 2,656 | 64 | """ A predictor that works with the flat format of s2 data
i.e., one excerpt per dictionary instead of a nested dict"""
import json
import operator
from typing import Tuple
from overrides import overrides
from allennlp.common.util import JsonDict
from allennlp.data import Instance
from allennlp.service.predictors.pre... |
0c8984c85696d927a936028603911efa8ef6384f81b2ed2991328f022677d481 | Python | 2,658 | 80 | __author__ = 'jieqing jiao'
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
from . import kt
def make_basis(inputf1, dt, beta_lim=None, n_beta=128, beta_space='log', w=None, k2p=None,
fig=False):
if beta_lim is None:
beta_lim = [10e-6, 10e-1]
... |
6be621aab896ee9e74d4909e65317994b430d592c26b3e52479f49bfe2dedd91 | Python | 2,658 | 66 | 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_d = param[1] # decay1
ca_trace = np.zeros(len(ca_times))
for n, spk in enumerate(spike_times):
ca_trace_tmp = np.exp(-(ca_times-spk)/tau_... |
0ff5846410882e0df33df50c9f60d90360ea1e74d69b022b7c5e3b5692c9f241 | Python | 2,661 | 75 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""
Implements the Generalized R-CNN framework
"""
import torch
from torch import nn
from maskrcnn_benchmark.structures.image_list import to_image_list
from ..backbone import build_backbone
from ..rpn.rpn import build_rpn
from ..roi_heads.roi_he... |
868499927662cf1511f8e46cffb916ce724dc76896538a425efc7e378b313bce | Python | 2,661 | 46 | from data.config import voc, tt100k, coco
accumulated_slice_list = []
slice_list = []
anchor_size_list = []
def get_anchor_nums(feature_map, anchor_box, square_anchor_num=2):
global accumulated_slice_list
global slice_list
global anchor_size_list
if not accumulated_slice_list:
before = 0
... |
f05321f6e5831bb2779a766c11d95a1b850192205a3962202089e65494a2c389 | Python | 2,662 | 89 |
import math
import glob
import argparse
parser = argparse.ArgumentParser(description='Create slurm job to merge gVCFs')
parser.add_argument('list_of_vcfs', help='.txt file with list of path of VCFs to merge (only for chr15, this will be replaced for other chr numbers)')
parser.add_argument('jobs_dir', help='directo... |
9022cb4cf75e7d1ffdc4bdf8d3c21b07a849c041779f8167b87edc04c0bcf061 | Python | 2,663 | 70 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch import nn
from .roi_box_feature_extractors import make_roi_box_feature_extractor
from .roi_box_predictors import make_roi_box_predictor
from .inference import make_roi_box_post_processor
from .loss import make_roi_box_loss_... |
ad2e6d2f8b9a082982795699cc6c59f6049616717b89d9bb2fca4663d10a5296 | Python | 2,663 | 75 | '''
@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... |
d26a2401f320c0f8cf070f84cb74050c07a20880773cc3a4280abe3cb4928a36 | Python | 2,663 | 81 | import backend.evaluation
import zipfile, tempfile, os
import PIL.Image
import numpy as np
def test_evaluate_single():
ytrue = np.zeros([100,100], 'uint8')
ytrue[:,:50] = 255
ypred = np.zeros([100,100], 'uint8')
ypred[:50] = 255
tmpdir = tempfile.TemporaryDirectory()
ytrue_png = os.path... |
5c3c7aaa05ae0b9a3baea998701aa1fa923949e0932c4e6a23ad975ef30581ff | Python | 2,664 | 72 | from __future__ import print_function, division
import numpy as np
from ase.db import connect
from tinnet.regression.regression import Regression
lr = 0.0007277509272133079
lamb = 0.1
atom_fea_len = 177
n_conv = 5
h_fea_len = 33
n_h = 5
Esp = -4.24
db = connect('train.db')
images = np.array([r.toatoms()
... |
91aa74afd5ea36259a2fde334717e985966a22546f0c31c1d98d82038a7f003f | Python | 2,665 | 72 | from __future__ import print_function, division
import numpy as np
from ase.db import connect
from tinnet.regression.regression import Regression
lr = 0.006326505613656666
lamb = 0.1
atom_fea_len = 139
n_conv = 3
h_fea_len = 253
n_h = 1
Esp = -3.343
db = connect('train.db')
images = np.array([r.toatoms()
... |
4662e2466f3bfbecc9176eb51518e7f5bde4141cd0eadfe621c2e4e19d107883 | Python | 2,666 | 72 | import sys, os, importlib
import argparse
import glob
#sys.path.append(os.path.abspath('../'))
from wmhpypes.interfaces import ibbmTum
from wmhpypes.workflows import ibbmTum_wf
from nipype.pipeline.engine import Workflow, Node
from nipype import DataGrabber, DataSink, IdentityInterface, MapNode, JoinNode
from nipype.in... |
70069139b5dbc497fac767b8f25a9bab88ceda1928bf0e527c362774abcde46d | Python | 2,666 | 74 | # basic imports
import numpy as np
import pickle
import matplotlib.pyplot as plt
def compute_action_probabilities(q: np.ndarray, beta: float) -> np.ndarray:
'''
This function computes the action selection probabilities for a given set of Q values under softmax policy.
Parameters
----------
q ... |
8966e8cc2a189384062b0fef9901a1b33d0c2e130ec054feaac8cdd6f91ff6f7 | Python | 2,666 | 96 | import argparse
import torch
from torchvision import utils
from model import Generator
if __name__ == "__main__":
torch.set_grad_enabled(False)
parser = argparse.ArgumentParser(description="Apply closed form factorization")
parser.add_argument(
"-i", "--index", type=int, default=0, help="index... |
c846f18d8293f3c338e373e56ab8e8370eb92354b592cbed32dbfe7887c08451 | Python | 2,666 | 92 | """
ANCOVA
======
Example 1
---------
Based on [1]_, `Exercises
<http://www.bio.ic.ac.uk/research/crawley/statistics/exercises/R6Ancova.pdf>`_
(page 8).
"""
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from eelbrain import *
y = Var([2, 3, 3, 4,
3, 4, 5, 6,
1, 2, 1, 2,
1, 1, 2, ... |
f784986807a40b328931bf329f42cd20f1b47ee6d0ae1c6cdf95e203494bfca5 | Python | 2,668 | 81 | import torch
import torch.nn.functional as F
from torch_geometric.nn import GCNConv
from graphxai.datasets.ba_houses import BAHouses as BAH
#from graphxai.gnn_models.node_classification import train, test
class GCN_1layer(torch.nn.Module):
def __init__(self, hidden_channels, input_feat, classes):
super(GC... |
0935f6c3f39c3e7cdaa17cc350e2df16b3470f4cf1d778b25d50461792a9e4ea | Python | 2,669 | 72 | from __future__ import print_function, division
import numpy as np
from ase.db import connect
from tinnet.regression.regression import Regression
lr = 0.0007277509272133079
lamb = 0.1
atom_fea_len = 177
n_conv = 5
h_fea_len = 33
n_h = 5
Esp = -4.24
db = connect('design_space.db')
images = np.array([r.toatoms()
... |
1ad222898351d21ae06a9769c2872f9952fa5af2a8c9a674c6cad9a9b64610a1 | Python | 2,670 | 72 | from __future__ import print_function, division
import numpy as np
from ase.db import connect
from tinnet.regression.regression import Regression
lr = 0.006326505613656666
lamb = 0.1
atom_fea_len = 139
n_conv = 3
h_fea_len = 253
n_h = 1
Esp = -3.343
db = connect('design_space.db')
images = np.array([r.toatoms()
... |
9bb94a6896b1067fd7b344c5cea294bfd14e0676691841fafa054c9b9c07bd89 | Python | 2,670 | 71 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Factory method for easily getting imdbs by name."""
from __future__ ... |
d8107fedf0df5fce6e1d117e9bddeda3924ed59529721d8e1465de87849c087a | Python | 2,672 | 72 | from dataclasses import dataclass
from typing import Any, Dict, Union
from linkml_runtime import CurieNamespace
from oaklib.interfaces.obograph_interface import OboGraphInterface
from oaklib.interfaces.taxon_constraint_interface import TaxonConstraintInterface
from oaklib.io.streaming_writer import StreamingWriter
fr... |
b00039bcc433f4c7cc0abd530517c71cd15fcb22d582d1f45b793077a885efc7 | Python | 2,673 | 79 | import os
import numpy as np
import warnings
import sys
from numpy.testing import assert_array_equal, assert_equal
from bruker2nifti._cores import scan2struct, write_struct
here = os.path.abspath(os.path.dirname(__file__))
root_dir = os.path.dirname(here)
def test_scan2struct_with_banana_data_slope_no_slope():
... |
203a64cf3f4f569b35f0cdd9ee27d181b42e9cf2c933f4e653ff5d6b3780a6a6 | Python | 2,674 | 80 | import pandas as pd
from rdkit import Chem
from drugex.training.interfaces import Environment
from drugex.training.scorers.smiles import SmilesChecker
class DrugExEnvironment(Environment):
"""
Original implementation of the environment scoring strategy for DrugEx v3.
"""
def getScores(self, smiles,... |
38de56ba84098b38fce9b3572a164481e272c2c2790a3d901ea541a7d1cb15a2 | Python | 2,674 | 107 | import numpy as np
import torch
from torch.utils.data import DataLoader
from dataset.SingleImageDataset import SingleImageDataset
from contextlib import nullcontext
def traintest(
args,
model,
device,
dataset,
dataloader_kwargs,
image_dataset_kwargs,
image_datal... |
ec33bf574a06d70fc41323c6ceee1e13fc871e3b4c2f0b7a2652b53d15001707 | Python | 2,675 | 60 | ##########################################################
## ccAF: plottingClassifiers.py ##
## ______ ______ __ __ ##
## /\ __ \ /\ ___\ /\ \/\ \ ##
## \ \ __ \ \ \___ \ \ \ \_\ \ ##
## \ \_\ \_\ \/\_____\ ... |
72866f5b8de87511f6bfe72d0c94092df72f589115b9f5642851c9e4147690ce | Python | 2,678 | 71 | import sys
import os
import pandas as pd
import numpy as np
import argparse
from sklearn.decomposition import PCA
from pathlib import Path
from datetime import datetime
parser = argparse.ArgumentParser(description='Do PCA over correlation matrix')
parser.add_argument('corfile',help='Path to correlation file')
parser.a... |
56198c0fc462c084d530c346444ede3929e4b1cd62b04374178e2ed4e94836bc | Python | 2,680 | 86 | from setuptools import setup, find_packages
from collections import defaultdict
from typing import List, DefaultDict
import re
VERSIONFILE = "navis/__version__.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr = mo.gro... |
fb06bd5438325f77176567b61e68f7bff85bec65f4b06fe9b989d699772a6c8a | Python | 2,681 | 70 | # 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... |
ef8aca48439d9143b5bf49533e6ad7b182c7d9bef62f1320b92e5206e49900bf | Python | 2,684 | 75 | # 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... |
0d6539caf1d0f7e122c2103df82672aae3bdf5d5a90306d40b15b54396de4df9 | Python | 2,685 | 93 | '''
Plotting cell and cilia movement
'''
import numpy as np
from skimage.draw import polygon, circle
__all__ = ['cell_border', 'plot_cell', 'cell_mask', 'cell_indices']
cell_length = 120.
cell_width = 35.
def cell_border(theta = 0.):
'''
Returns cell coordinates in um, centered on 0.
The cell points towa... |
a9d2a65130fca86ac2efe4617526a89d197bb066c14ac8be44c44224433f4077 | Python | 2,685 | 63 | # 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... |
7da2cee5cbbce9863b89a68da07bc91fbb5921c632af053904d501c939259c33 | Python | 2,686 | 86 | import os.path as osp
import mmcv
import torch
from mmcv.parallel import collate
from mmcv.utils import build_from_cfg
from mmdet.datasets.builder import PIPELINES
from mmdet.models import build_detector
def model_aug_test_template(cfg_file):
# get config
cfg = mmcv.Config.fromfile(cfg_file)
# init mode... |
c37133d25d61b200592ad52593716fd1b3c67e2261be98a05928741182532f31 | Python | 2,686 | 71 | # 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... |
09448c01628289301fdbfd9f0ce4e7ed3fccd142fd5128c9f5ca4a5afd069013 | Python | 2,687 | 92 | import numpy as np
class RC :
def __init__ ( self , Name, Parameter ) :
self.name = Name
self.modelType = 'normal'
self.path = Parameter['path'] + self.name + "_"
self.I = Parameter[ 'I' ]
self.N = Parameter[ 'N' ]
self.O = Parameter[ 'O' ]
self.S = Parameter[ 'S' ]
self.g = Parameter[ 'G' ]
self.... |
51d93ff807a5e5ae32d05fc06d2562240db31dacc2f0071e778f37f3f7febfbd | Python | 2,687 | 75 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .cond_bn import ConditionalBatchNorm1d
# adopted Generator ResBlock from https://arxiv.org/abs/1909.11646
class GBlock(nn.Module):
def __init__(self, in_channels, out_channels, condition_dim, dropout):
super().__init__()
self... |
69f12a74aafd7ad39f56990c874a26b0329f12e3ff69515f4b05aadf302c4c86 | Python | 2,689 | 86 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 29 22:32:00 2020
@author: taozhou
"""
""" Parts of the U-Net model """
import torch
import torch.nn as nn
import torch.nn.functional as F
class DoubleConv(nn.Module):
"""(convolution => [BN] => ReLU) * 2"""
def __init__(self, in_channel... |
21fd9c8f88cca70752561755e2d527f0a0c6d1d921d52df6b12e60190e1cd413 | Python | 2,690 | 70 | # 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... |
6b8bfce6685a78a5fd23743afb2b28cf47818277fe38438fe327723fc45c1048 | Python | 2,690 | 91 | """
File: container.py
Created: 2020/05/06
Last Changed: 2020/06/02
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either versi... |
f86e7e55a5bd70ed05a0d1b8ac690267547920297cfbf69d8ba2a1a4a5723483 | Python | 2,691 | 64 | import unittest
from selene_sdk.predict.model_predict import in_silico_mutagenesis_sequences
class TestModelPredict(unittest.TestCase):
def setUp(self):
self.bases_arr = ['A', 'C', 'G', 'T']
self.bases_encoding = {'A': 0, 'C': 1, 'G': 2, 'T': 3}
self.input_sequence = "ATCCG"
def test... |
66e23979adff9fa47b3c62ac4cbf8107b019f337888fd1dd63e22aeb62a24673 | Python | 2,692 | 97 | # 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... |
ca8dfe7cffd6a06c8fef61fffc054e2dd1d1dc27881f04fdf404ff0be1b9f812 | Python | 2,692 | 86 | '''
@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... |
db6fcff0f40d552c276bcab05b3d31ab2697148a1ac5a59aeb9f6707a90d48dc | Python | 2,692 | 59 | __author__ = 'jieqing jiao'
__contact__ = 'jieqing.jiao@gmail.com'
import numpy as np
from niftypad import basis
from niftypad.kt import dt2tdur
from niftypad.models import get_model_inputs
from niftypad.tac import TAC, Ref
# test data
dt = np.array([[
0, 15, 30, 45, 60, 90, 120, 150, 180, 210, 240, 270, 300, 36... |
69cea791c1ebc0f319a240a4e90a5bdd463581b299d00298883eb30e4a02d25f | Python | 2,693 | 105 | from os.path import basename
from pathlib import Path
import numpy as np
import pandas as pd
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from graspy.datasets import load_drosophila_left
from graspy.utils import binarize, symmetrize, is_fully_connected
from graspy.plot i... |
bf1dde32591e138ac18b1c4cdc9d93e24ca15c93731b0a6077eff902ee575943 | Python | 2,693 | 60 | # 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... |
2cd167c57374d8dd20fe9133d211129443ba4d2c1c6c78fee41f3be247bcae9d | Python | 2,695 | 60 | # 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... |
ee006232f819229a3b179b1faf97d1619b93b0ecd360fb5d9b397a13c4d97013 | Python | 2,695 | 61 | # 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... |
55ae2839fdc475bbfbe4ce78b015fbb01f322f5830f6f2af807025d8f49edff5 | Python | 2,696 | 65 |
# loop through all subdirs to find all fastq files
import os.path
import re
import argparse
parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for MSBB.')
parser.add_argument('samplesheet', help='MSBB samplesheet from synapse')
parser.add_argument('fastq_dir', help='path to fastq file di... |
59c9accf29fe6874c4ac9e88ede04de83c4e322fec3b57e8e0b8daf2b24dc7ef | Python | 2,696 | 60 | ####################################################################################################
# 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 ... |
cc8ec04a0cd8f3a8d3e41e33043c39eddfc538ed3aca1af753d26b80fab140b9 | Python | 2,696 | 71 | import os
import glob
import argparse
import pickle
import numpy as np
from openeye import oechem
from utils import generate_eisenberg_grids
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Generate PfAbNet ESP grid input')
parser.add_argument('--input_mols_dir', type=str, d... |
045fff993bb1c3bdcdfb17837bbbc61af14b830f6be039bd4a9c13b45a53b9d4 | Python | 2,697 | 83 | #%%
import os
from pathlib import Path
import matplotlib.pyplot as plt
import seaborn as sns
from IPython import get_ipython # just to decieve flake8
import ijson
import src.utils as utils
import numpy as np
import pandas as pd
import seaborn as sns
base_path = "./maggot_models/simulations/runs/"
experiment = "sbm_... |
234034b72edda5434d5d5fe75d372475f3c6e7912d16f73e58268411b282c815 | Python | 2,697 | 65 | # -*- 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-13 (@author: Ge-Peng Ji)
"""
import torch
import torch.nn.functional as F
import numpy as np
import os
import argparse... |
543042d152f97f729f5b42efb01d2afef521b4acb4c6f582d773cd6d5cba5ab6 | Python | 2,697 | 63 | # 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... |
22d41f592fcdffec4a93468381d799784565fa8c068117e1ddc0ce12232c885f | Python | 2,698 | 105 | from os.path import basename
from pathlib import Path
import numpy as np
import pandas as pd
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from graspy.datasets import load_drosophila_left
from graspy.utils import binarize, symmetrize, is_fully_connected
from graspy.plot i... |
b72c505102dab3fcf3a559119569f55ffa1ed482ab78e02c286109a82f119f96 | Python | 2,698 | 47 | import os
from optparse import OptionParser
import train
storage_path = ""
def run(storage_path):
saved_model = os.path.join(storage_path, "pretrain/models_coordconv/")
pretrain_experiment = train.model_runner(batch_size=256, seq_length=1000, n_channels=5, n_classes=919)
pretrained_model = pretrain_experi... |
f60c361f9dd17834099b46497e166fc2746c1015f41bd5d74d2e6212bddcbff1 | Python | 2,698 | 72 | # 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... |
8c8cd1a5188a304b9e69ee2536da7d4abff2fd6bd9378f1fb997968827bafaac | Python | 2,700 | 86 | # Analyze result from different runs
## Plots
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib import offsetbox
from matplotlib import cm
import seaborn as sns
import os
import numpy as np
import argparse
parser = arg... |
8e4bc5caf8b051772f2075c60cb4af9dcec2f93c3fe13e56b27b5b4dc7178983 | Python | 2,700 | 71 | # 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... |
991e11fd80d94d72553f85a9213ca446db26e071fb45fe8f8811ab33226d58e1 | Python | 2,700 | 71 | # 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... |
3b865cb9091ebc4daa524ee7a34174bd59ad5d7107582c9f48ee360a76091530 | Python | 2,701 | 76 | import os
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import ModelCheckpoint
from argparse import ArgumentParser
from omegaconf import OmegaConf
from utils.utils import get_commit_hash
from synthesizer import Synthesizer
from utils.loggers import SynthesizerLogger
def main(args):
model... |
76fe3bb1d3ff56941bb74882c6c44260f90e4a598564d6ebc291dc80a7b25fc2 | Python | 2,701 | 107 | from os.path import basename
from pathlib import Path
import numpy as np
import pandas as pd
from sacred import Experiment
from sacred.observers import FileStorageObserver, SlackObserver
from graspy.datasets import load_drosophila_left
from graspy.utils import binarize, symmetrize, is_fully_connected
from graspy.plot i... |
297fc9c275af906758bd593f6d59894042c262c54039ac1a46cca96d6f77f19a | Python | 2,704 | 88 | import argparse
import logging
from pathlib import Path
from tqdm import tqdm
import cv2
from dotenv import dotenv_values
from labelbox import Client, MediaType
from labelbox.schema.queue_mode import QueueMode
from labelbox.exceptions import ResourceNotFoundError
from cenfind.core.data import Dataset
from cenfind.cor... |
db07b11964ff72e371c1fa79be3790a5432a4e6232b2baf5bbd5d691fc5bdd78 | Python | 2,706 | 111 | # %% [markdown]
# # THE MIND OF A MAGGOT
# %% [markdown]
# ## Imports
import os
import time
import warnings
import colorcet as cc
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import numpy as np
import pandas as pd
import seaborn as sns
from anytree import LevelOr... |
87067100734baaa3911dab7cd0b16afbbc982fc4afb2c0a826e3af797efe8ea5 | Python | 2,707 | 88 | import fnmatch
def heur(physinfo, take=""):
"""
Set of if .. elif statements to fill BIDS names.
It requires the user (you!) to adjust it accordingly!
It needs an ``if`` or ``elif`` statement for each file that
needs to be processed.
The statement will test if the ``physinfo``:
- is s... |
980585e7d1d698f73b6e34886da0f33d166ea6594abe3e6d7c2e8f71426731a4 | Python | 2,707 | 78 | import inspect
class ViewInstance:
"""Mixin endowing inheritors with echo and print str representations.
The returned string reprs will not include protected attrs and methods.
These attrs/methods start with '_' are never intended to be part of
a public interface. (Note: this exclusion will also e... |
18b5b80979bd317ab8f148cddbeb93b7f3b8418373107b063241cf5a589ee8b5 | Python | 2,709 | 76 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.