sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
217257f6be632156e68ac9e23c577721844f14649df0a7426b34593c4c827718 | Python | 7,010 | 122 | """
Training and testing for OmiEmbed
"""
import time
import warnings
from util import util
from params.train_test_params import TrainTestParams
from datasets import create_separate_dataloader
from models import create_model
from util.visualizer import Visualizer
if __name__ == "__main__":
warnings.filterwarnings... |
d7bc0a39741abc5d36a5177d142c5021372d45d5507a99fcd7950c15ef36d350 | Python | 7,014 | 176 | '''
Author: Naiyuan liu
Github: https://github.com/NNNNAI
Date: 2021-11-23 17:03:58
LastEditors: Naiyuan liu
LastEditTime: 2021-11-24 19:19:22
Description:
'''
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 mode... |
88a3000aee73ff99922aa4977aa152bab01a498e460cc1a52357c4e7d953b8e6 | Python | 7,016 | 206 | ####################################################################################################
# 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 ... |
8ab415b281eefe462963e3cc5d383cd9a7fac08186892bf136f2ad37b8ad7d47 | Python | 7,024 | 186 | """
Provides the BrukerMetadata class for reading Bruker MRI metadata.
The BrukerMetadata class should be instantiated for each study. Dictionaries
are structured as follows:
subject_data {
[key_from_subject_file]: [corresponding_value]
}
scan_data {
[scan_number]: {
'acqp': { [key_from_acqp_file]: [correspo... |
9d8745daae40a5e5b904357835ebd846cf0c500d7b534f4e1077b267a020b288 | Python | 7,025 | 177 | import numpy as np
from sklearn import preprocessing
from numpy import dtype, random, sqrt
from scipy import linalg as LA
import time
class BLS:
def __init__(self, N1, N2, N3, s, c,idx):
self.weightOfEachFeatureWindow = []
if N1*N2 >= N3:
random.seed(67797325+idx)
self.weig... |
1d9d484e244c093420aa9f4504a3089c3386249bf31a0493a32ff351ccfb5a39 | Python | 7,030 | 168 | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init
from mmcv.ops import batched_nms
from ..builder import HEADS
from .anchor_head import AnchorHead
from .rpn_test_mixin import RPNTestMixin
@HEADS.register_module()
class RPNHead(RPNTestMixin, AnchorHead):
"""RPN he... |
6f1a8bc3d4d5b088629574354ae003d0b97135c657faacc8f4e440d4dd02ae5c | Python | 7,030 | 98 | from functions import *
from qiskit import *
starttime = datetime.now()
#Perform amplitude amplification for predecessors of the 01101 attractor state in the network of Giacomantonio et al.
#Running this script required 2sec for nrshots=10000 on a MacBook Pro with a 2.3GHz Quad-Core processor and 16 GB of RAM
GiacoPa... |
ebf94a0f9b0318e2dbd093e9c13f871597669136996a7383884affbcf69e4eae | Python | 7,030 | 266 | #!/usr/bin/env python3
"""
I/O and related utils.
Attributes
----------
EXT_1D : list
List of supported TXT/1D file extensions, in lower case.
EXT_NIFTI : list
List of supported nifti file extensions, in lower case.
FIGSIZE : tuple
Figure size
SET_DPI : int
DPI of the figure
LGR :
Logger
"""
impor... |
f9011ab08f187d12b18c281adf3e4b1a21af11dcc41ef308ad1fb599982b454c | Python | 7,030 | 174 | import os
import sys
import json
import time
import pydicom
import datetime
import pandas as pd
import numpy as np
from dicom_scp_class import Retriever_SCP
from dicom_scu_class import Retriever_SCU
def inspect_rtplans(day):
infofile = "setup_information.json"
f = open(infofile)
info = json.load(f)
f.c... |
32b2e39715a1330e14e9681d67c6fe6fe45508990252a12136c0484297ca0090 | Python | 7,031 | 151 | #! /usr/bin/env python3
"""Deterministic clip from a CARLA recorder log, then a batch of prompts x seeds.
python single_view_replay.py --port 2000 --log /abs/path/drive.log --start 5 --duration 3 \\
--batch batch.yaml --out ./clips --results ./results
The recorder log is replayed in sync mode (``client.re... |
7eb9fcb0cf91aa8e4c77f8a0f6d41d436737a2a9657acc62a52e540a3659fc6e | Python | 7,032 | 176 | from __future__ import absolute_import
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
# ---------------... |
51e0780be18fe3934042ffad66b13cb889b75fc42f420342c006b1822a7ab06a | Python | 7,033 | 176 | from collections import defaultdict
import csv
import json
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_NA... |
d29409f2f47eed27b792cd1ee0406e0923a7ebb3d7dca3c2860ebd279bd487e3 | Python | 7,033 | 180 | import torch
import networkx as nx
from typing import List
from torch_geometric.data import Data
from torch_geometric.utils import convert, to_undirected
from torch_geometric.utils.subgraph import k_hop_subgraph
from networkx.linalg.graphmatrix import adjacency_matrix as adj_mat
from .nx_modified import swap
device =... |
5a7f5d6045bcd160bb07756291c82b221470f0bb6511f6a34cd9c54bbea97a9d | Python | 7,037 | 228 | """
Training script for Navier-Stokes equation using neural operators.
This script trains a neural operator on the 2D Navier-Stokes equations
for fluid dynamics simulation. The model learns to predict velocity fields
from initial conditions, supporting multiple resolutions and distributed training.
"""
import sys
fr... |
924cd1a7371e2befdc52855c46fe4c1a51a31e9178518b67548a1f142972de0e | Python | 7,038 | 144 | from . import config, optimize_constants
import roboscientist.equation.equation as rs_equation
import numpy as np
from copy import deepcopy
import torch
import random
import torch.nn.functional as F
def build_single_batch_from_formulas_list(formulas_list, solver, batch_Xs, batch_ys):
batch_in, batch_out = [],... |
adb4f74691f512553c79a18fd4b14f3c978937d8a07748b915e91a962c598dd0 | Python | 7,040 | 170 | #%%
import os
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
print(os.getcwd())
except:
pass
#%%
import sys
sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/")
import pandas as pd
import numpy as np
import connectome_tools.process_matrix as promat... |
65646bbeb8cbaa53c2839b4a7a9801c9cc640baa562817bd732ddf35c8f2e694 | Python | 7,043 | 238 | # %%
import datetime
import os
import time
from pathlib import Path
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymaid
import seaborn as sns
from navis import NeuronList
from src.data import load_maggot_graph, load_navis_neurons, load_palette
from src.graph im... |
83150cf3da0e6f5f0c121c9c78bfef168f1b85ad16538050b4ae5ce6b93974b2 | Python | 7,048 | 167 | ## The model quantization code is mostly from https://medium.com/@fanzongshaoxing/post-training-quantization-of-tensorflow-model-to-fp16-8d66b9dfa77f
import tensorflow as tf
from tensorflow.core.framework import types_pb2, graph_pb2, attr_value_pb2
from tensorflow.tools.graph_transforms import TransformGraph
from goog... |
9ef01fafb4e57c947aa936ea95c186d694c71adf9d232ba62f9b02455a997a5a | Python | 7,050 | 154 | from __future__ import print_function
import numpy as np
import random
from tqdm import tqdm
import os
#import cPickle as cp
#import _pickle as cp # python3 compatability
import networkx as nx
import pdb
import argparse
cmd_opt = argparse.ArgumentParser(description='Argparser for graph_classification')
cmd_opt.add_ar... |
bc43667a43c9c21a4794ab3d8158c7bdcb64940df6f038583913b21d672e8e62 | Python | 7,053 | 189 | ####################################################################################################
# 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 ... |
d5308f2b825286c0774176d2a7511de6b12cc60825d025adb6bdcd124a2b91b9 | Python | 7,054 | 201 | """
Classes for managing, resampling and summarizing data using pandas dataframes
"""
from dataclasses import dataclass
import itertools
from pathlib import Path
from typing import Optional
import numpy as np
from numpy.random import PCG64
import pandas as pd
@dataclass
class ferret():
""" Data associated with ... |
28ef669dadc50d388f6e07756ebfea43f476c4536318faafa5fa1e4e5eadd3b3 | Python | 7,055 | 187 | import torch
from torch import nn
import torch.nn.functional as F
class ChannelMLP(nn.Module):
"""Multi-layer perceptron applied channel-wise across spatial dimensions.
ChannelMLP applies a series of 1D convolutions and nonlinearities to the channel
dimension of input tensors, making it invariant to spat... |
e4dd881149cc7c84ed911776955733e57927d559dcbe623fc86fd3981f385601 | Python | 7,056 | 264 | # %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from graspy.embed import ClassicalMDS, LaplacianSpectralEmbed, OmnibusEmbed, selectSVD
from graspy.match import GraphMatch
from graspy.models import DCSBMEsti... |
1620ed88361a2f2befeebb0a964a61e2be46c4ad0341f39c7e15f7fc8b2da7a9 | Python | 7,058 | 223 | """
Training script for MHD64 dataset using neural operators.
This script trains a neural operator on the 3D magnetohydrodynamics (MHD)
dataset with 64x64x64 resolution. The model learns to predict the next time step
in the MHD simulation, supporting both next-step prediction and autoregressive
evaluation modes.
"""
... |
96d5554b61637f934864382fc360926e839d64ad5de806304459b6711a391b68 | Python | 7,059 | 193 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch.nn import functional as F
from maskrcnn_benchmark.layers import smooth_l1_loss
from maskrcnn_benchmark.modeling.box_coder import BoxCoder
from maskrcnn_benchmark.modeling.matcher import Matcher
from maskrcnn_benchmark.struc... |
495fcedc1e18450d886850158ed23885fbef4ed2dfe172264f85777bda17abcb | Python | 7,061 | 177 | import numpy as np
import torch
import torch.nn as nn
def calc_iou(a, b):
area = (b[:, 2] - b[:, 0]) * (b[:, 3] - b[:, 1])
iw = torch.min(torch.unsqueeze(a[:, 2], dim=1), b[:, 2]) - torch.max(torch.unsqueeze(a[:, 0], 1), b[:, 0])
ih = torch.min(torch.unsqueeze(a[:, 3], dim=1), b[:, 3]) - torch.max(torch.u... |
d15317b4373a020257fe6f9f9fa0d106b4f701b93f7821d0d5d65d2605019d5d | Python | 7,061 | 195 | # 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... |
6d933630acc60190302d9cba72489dd02e7cb5b069b47bcc444d8e72742e1365 | Python | 7,064 | 269 | import numpy as np
import pandas as pd
from numba import jit
from typing import Union, Optional
# NOTE: these are features used in computing the "features" dataframe
# e.g. syllable-associated DA is computed via these functions
__all__ = [
"nanargmax",
"argmax",
"idxmax",
"peak_to_peak",
"peak_to_peak_signed",... |
20bad992212a530c3fcb09c5395072dd13f80bcf0641ad939256d9903a33be1c | Python | 7,065 | 221 | import torch
import math
from torch import nn
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mp
import torch.nn.functional as F
import pandas as pd
import scipy.io as io
import collections
# torch.manual_seed(1) # reproducible
# Hyper Parameters
TIME_STEP = 1 # rnn... |
4387d5cf8dd4664d4fd3c992a557849c5ea4c4d467705ccf379f506d596b81ef | Python | 7,066 | 213 | from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import scipy.sparse as sp
import torch.optim as optim
from torch.autograd import Variable
from utils_cora import accuracy, load_data_cora
from model import AGNN
import networkx as nx
import torch
imp... |
e09bc5772840755445249b64e979fdce18f4edfc461ea0de3356154d9ac95bd0 | Python | 7,067 | 246 | """
Adapted from https://github.com/d-li14/efficientnetv2.pytorch
Creates a EfficientNetV2 Model as defined in:
Mingxing Tan, Quoc V. Le. (2021).
EfficientNetV2: Smaller Models and Faster Training
arXiv preprint arXiv:2104.00298.
import from https://github.com/d-li14/mobilenetv2.pytorch
"""
import torch
import torch.... |
576b8a100727cbdbef29130e9ce838e093bc5067f039ad68f97a0aac6a941340 | Python | 7,068 | 176 | """
Mask R-CNN
Multi-GPU Support for Keras.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by Waleed Abdulla
Ideas and a small code snippets from these sources:
https://github.com/fchollet/keras/issues/2436
https://medium.com/@kuza55/transparent-multi-gpu-training... |
34073da5d7f0137ef689d4c44b04c50eac60632fd9ce3c2ba46d8c72b76ed6ac | Python | 7,074 | 222 | # -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from datetime import datetime
from recommonmark.parser import CommonMarkParser
extensions = []
templates_path = ['templates', '_templates', '.templates']
source_suffix = ['.rst', '.md']
source_parsers = {
... |
6e9ea3b0081d5aebc647b946336efbc591e2ba4a93e119ec85aeda85c9c2c3a5 | Python | 7,077 | 177 | """Data file location, download, and caching.
Resolution order for finding a benchmark file:
1. ``data_dir`` argument passed by the caller, if not None.
2. ``MEDMNIST_NAS_BENCH_DATA`` environment variable, if set.
3. The default cache directory ``~/.cache/medmnist_nas_bench/`` (or
``$XDG_CACHE_HOME/medmnist_nas_be... |
c0469b2ca81aa67e85b8ecdd31afb9ea8e647977db8a4d034ccb2ff1e1a20304 | Python | 7,077 | 162 | """Public BAMPE regressions for #806, including bounded native probes."""
import json
import struct
import subprocess
import sys
import pytest
from conftest import macs3_env
from test_Parser_bam_truncation import write_bam
HEADER = (b'BAM\1' + struct.pack('<ii', 0, 2)
+ struct.pack('<i', 5) + b'chr1\0' +... |
1f3a325f566f6768a6550afcee59954d9c731e92ba3121588db77d8037700578 | Python | 7,081 | 205 | import os
import sys
import glob
import h5py
from tqdm import tqdm
import time
import multiprocessing as mp
from functools import partial
import pickle
from .ResidueGraph import ResidueGraph
from .Graph import Graph
class GraphHDF5(object):
def __init__(self, pdb_path, ref_path=None, graph_type='residue', pssm_... |
0a7d3ba1c2392c7e9eeb36ee8eb258346088aa66440ee9445ae6f42b66419726 | Python | 7,083 | 246 | #%%
import networkx as nx
import numpy as np
import pandas as pd
from bokeh.io import output_file, show
from bokeh.layouts import gridplot
from bokeh.models import ColumnDataSource, FactorRange
from bokeh.plotting import curdoc, figure, show
from mpl_toolkits.axes_grid1 import make_axes_locatable
from graspy.plot impo... |
0e4b434337d89e4b9f4362e48f8c87a5613c1dcab74b56c3985851034382a538 | Python | 7,086 | 238 | # Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
"""
Misc functions, including distributed helpers.
Mostly copy-paste from torchvision references.
"""
import io
import os
import time
from collections import defaultdict, deque
import datetime
import torch
import torch.distributed as dist
class Smo... |
1131800859e730440b05ae9a7b8ec5ba59244af59e511e2017f81ceeba5144b9 | Python | 7,089 | 198 | import bisect
import math
from collections import defaultdict
import numpy as np
from torch.utils.data.dataset import ConcatDataset as _ConcatDataset
from .builder import DATASETS
@DATASETS.register_module()
class ConcatDataset(_ConcatDataset):
"""A wrapper of concatenated dataset.
Same as :obj:`torch.util... |
e5d667d7ead70e8a619bd2320a239780caa4bac231ac42e9a56bd850d7d07e09 | Python | 7,093 | 174 | # Copyright (c) Open-MMLab. All rights reserved.
import os.path as osp
import time
import warnings
import torch
import mmcv
from .base_runner import BaseRunner
from .checkpoint import save_checkpoint
from .utils import get_host_info
class EpochBasedRunner(BaseRunner):
"""Epoch-based Runner.
This runner tra... |
d18273fbd4a50c264c3b4974c0c7b3056ef911dc0b5a56da3ab9c46252990681 | Python | 7,094 | 141 | import os, sys
import shutil
import matplotlib.pyplot as plt
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing
import tensorflow as tf
# tf.enable_eager_execution(config=config)
import nump... |
660c3154b55f602fc7392a36997c017d5d181cf4b12e117821a43546d7aa8616 | Python | 7,096 | 176 | from collections import OrderedDict
import csv
from typing import List, Optional, Union
import numpy as np
from tqdm import tqdm
from .predict import predict
from chemprop.args import PredictArgs, TrainArgs
from chemprop.data import get_data, get_data_from_smiles, MoleculeDataLoader, MoleculeDataset
from chemprop.uti... |
9c313992587e77bbfad7030d56d63df2fc8c551dfa58f163b6f000a39453f200 | Python | 7,097 | 159 | import os
import time
import unittest
from datetime import timedelta
from oaklib.utilities.caching import CachePolicy, FileCache
class TestCachePolicy(unittest.TestCase):
def test_refresh_policy(self):
policy = CachePolicy.from_string("refresh")
self.assertTrue(policy.always_refresh)
se... |
e6d69a562a982c55e1d1486026140bdfe6ada6ae628a91a9f9536e08f66fc658 | Python | 7,097 | 188 | import tensorflow as tf
class generator(tf.keras.Model):
def __init__(self, n_input=7, n_past_points=40, n_labels=3, data_noise_dim=50):
super(generator, self).__init__()
self.n_input = n_input
self.n_past_points = n_past_points
# Single dense layer to generate initial representat... |
3fc70781448d525fdccaf0582befc7ba9b4321cb41b1f5e33255a73d8fa34729 | Python | 7,099 | 275 | """
Functions to use `Connectome Workbench <https://www.humanconnectome.org\
/software/connectome-workbench>`_.
"""
import os
import pathlib
import re
import subprocess
import warnings
from typing import Optional
import nibabel as nib
from osl_dynamics import files
from osl_dynamics.utils.progress import progress
... |
43da9899ede36473e3fbefc7ff49732135e9fb17d1b11f9c75d93867e8f67f19 | Python | 7,100 | 191 | import torch
from torch import nn
from .conv_ws import ConvAWS2d
from .registry import CONV_LAYERS
import torch.nn.functional as F
#class Flatten(nn.Module):
# def forward(self, x):
# return x.view(x.size(0), -1)
#
@CONV_LAYERS.register_module('MDConv')
class MDconv(ConvAWS2d):
def __init__(self,
... |
059cc4812180b00f92a192aea7604df5a8fe1031519a0eb80e39761ceb4e79e5 | Python | 7,104 | 207 | # 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... |
2017e27684a72ca26232792ddb28dbf3162076fd72e67c49598c60b2f56339d7 | Python | 7,104 | 183 | import torch
from torch.nn import functional as F
from maskrcnn_benchmark.modeling.matcher import Matcher
from maskrcnn_benchmark.modeling.balanced_positive_negative_sampler import (
BalancedPositiveNegativeSampler,
)
from maskrcnn_benchmark.structures.boxlist_ops import boxlist_iou
from maskrcnn_benchmark.modeli... |
4f721ccb2931eae92b90b721b8178bb6e585e2fc0df0fe2a5151a8e696bafb42 | Python | 7,104 | 133 | # pylint: disable=no-self-use,invalid-name,unused-import
import tempfile
from pathlib import Path
from unittest import TestCase
from allennlp.common import Params
from allennlp.data import DatasetReader, Vocabulary
from allennlp.data.dataset import Batch
from allennlp.models import Model
from pytest import approx
from... |
58421fc8e525fe838064395b51a3074c19803e01bc2e05ebf169f25cf1fe52c8 | Python | 7,104 | 206 | from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import scipy.sparse as sp
import torch.optim as optim
from torch.autograd import Variable
from utils_cora import accuracy, load_data_cora
from model import AGNN
import networkx as nx
import torch
imp... |
e8a0be43952b15b69d1726b832ffd775c3af88a1c17fd38eca8f684ad3674565 | Python | 7,104 | 257 | # %% [markdown]
# ##
import os
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.patches import Circle
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
from sci... |
bbfe0eeaddc9fd19c9c96eafdf0a15c6122eb59ef67df88546abb22e1602ab09 | Python | 7,106 | 181 | # 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... |
c8eef8a4b31572c47805c12569b4527b9a40649eb9a3706dd6e9326bdbb3068f | Python | 7,106 | 208 | # Copyright (c) Open-MMLab. All rights reserved.
import sys
from collections.abc import Iterable
from multiprocessing import Pool
from shutil import get_terminal_size
from .timer import Timer
class ProgressBar:
"""A progress bar which can print the progress."""
def __init__(self, task_num=0, bar_width=50, s... |
12d71b2d491309fb364b847f86c4a90f91651bf6ff1acab0a82a682be57a6a5f | Python | 7,108 | 206 | # 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... |
2181a83c7ae9e31b89b51952fdf3c50e1f2b969bad2a31a7fee3b05ca61ad412 | Python | 7,108 | 225 | # 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... |
01930a2f4c34a5c215faad926501f5500dcce06044a2e802b2baa44d08572db7 | Python | 7,110 | 203 | from collections import OrderedDict
from typing import Any, Dict, List, Tuple, Union
import numpy as np
from cgtasknet.tasks.reduce.ctxdm import CtxDM1, CtxDM2, CtxDMTask
from cgtasknet.tasks.reduce.dm import DMTask1, DMTask2, DMTaskRandomMod
from cgtasknet.tasks.reduce.go import (
GoDlTask1,
GoDlTask2,
G... |
fa908c8adfd8494b3abba9acca3166c407c7eb5d43dfca763a13b97bf02d8b05 | Python | 7,110 | 181 | from termcolor import colored
from scipy.stats import t
from scipy.stats import norm
import math
import re
import sqlite3
import argparse
from beautifultable import BeautifulTable
from datetime import datetime
##### !! Don't change values below !! ####
# Number of genes included in the coreg table
# Used for calculati... |
556275f3d182a44a657622abc6f2e804a7cf097c283d0a1fdb57a3fa67ca29e1 | Python | 7,112 | 184 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"Line plots"
from itertools import cycle, repeat
import numpy as np
from .._data_obj import ascategorial, asndvar, assub
from ._base import EelFigure, Layout, LegendMixin, XAxisMixin, AxisScale, frame_title
from functools import reduce
class LineStack(LegendM... |
fca119fc0606182b91bdce6bf980f67436c95b22179c42b32deac140661ecf69 | Python | 7,113 | 194 | """
DeepCT architecture without Sigmoid layer
for multiple cell type per position computation at once (TODO: Add our names).
"""
import numpy as np
import torch
import torch.nn as nn
from torch.utils.tensorboard import SummaryWriter
class DeepCT(nn.Module):
def __init__(
self,
sequence_length,
... |
edad298e98925b8d1ce18f9e2d67ef4a211d3f1196da2419b0063f379377b883 | Python | 7,114 | 193 | import contextlib
import functools
import logging
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
from pathlib import Path
from typing import List
import cv2
import numpy as np
import tensorflow as tf
from csbdeep.utils import normalize
from skimage import measure
from skimage.exposure import rescale_intensity
fr... |
d7d74a72b5bf500af517f188740f6fb8144c1bc11b09a12c18976982e78ff8f7 | Python | 7,118 | 202 | """
File: perform_deconvolution.py
Created: 2020/10/08
Last Changed: 2020/11/20
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, e... |
e14a002836068914c8657e95dc794c1a399a1c90a675271591a32ed3f52783ca | Python | 7,120 | 171 | #!/usr/bin/env python3
"""Prove an imported vehicle really works, on a running CARLA server.
python3 verify_vehicle.py --id vehicle.ford.transit
python3 verify_vehicle.py --id vehicle.ford.transit --keep
A factory entry proves nothing on its own: a vehicle whose SkeletalMesh failed to load
still LISTS while b... |
d4448c9246b4798b0ba2c6208f00b454835f9b02be427f5b7e01f13f4478f32c | Python | 7,127 | 179 | #!/usr/bin/env python
# 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 appli... |
cbf5f2a24367ebdcf0324324b934a51b3ee54076f305397579241c39fcd82705 | Python | 7,131 | 267 | #%% [markdown]
## Embedding graphs with covariates
# > Some experiments on a real dataset of interest using CASE (and soon to use MASE/OMNI)
# - toc: true
# - badges: true
# - categories: [pedigo, graspologic]
# - hide: true
# - search_exclude: true
#%% [markdown]
### Preliminaries
#%%
import os
from pathlib import Pa... |
c25850e16d12d67742e5ee3facaadae353243259a7aa24d80b082527bd1a0c61 | Python | 7,132 | 191 | import torch
from torch import nn
from .conv_ws import ConvAWS2d
from .registry import CONV_LAYERS
import torch.nn.functional as F
#class Flatten(nn.Module):
# def forward(self, x):
# return x.view(x.size(0), -1)
#
@CONV_LAYERS.register_module('MDConv')
class MDconv(ConvAWS2d):
def __init__(self,
... |
2c3f2c15b74298066e9a83c4ca14eb82bf26c508fcc86e437eb3cad039bc5991 | Python | 7,133 | 172 | #%%
import os
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
print(os.getcwd())
except:
pass
#%%
import sys
sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/")
import pandas as pd
import numpy as np
import connectome_tools.process_matrix as promat... |
03c805c12aadb9c2c0cc210d238ca1e38ed395a413ab0f29fbc7cf2224e3a8b7 | Python | 7,135 | 173 | #!/usr/bin/env python3
"""Prove an imported prop is spawnable on a running CARLA server.
This is the acceptance test for import_prop.py, and it is deliberately the same
thing Docs/content_authoring_props.md tells a user to type:
for bp in bp_lib.filter('*windmill*'):
print(bp.id) # -... |
2379dcd8eadaad8016dec8257e372d14638f7c5562c0395151773bb17b76ff0c | Python | 7,135 | 187 | #!/usr/bin/env python3
#######################################################################
#######################################################################
## Created on July 4th 2018 to create IGV session file from file list
#######################################################################
##########... |
24af2c596756efc9c9929a4bdcbd512ca26e0ec7a52b1d6e3f7e4fd4531f4b5e | Python | 7,138 | 210 | """Asynchronous training runs with explicit state and progress."""
import copy
import threading
import time
import traceback
import typing as tp
import uuid
from . import jobs
from . import training
TERMINAL_TRAINING_STATES = {'completed', 'cancelled', 'failed'}
class TrainingRun:
def __init__(
self,
... |
c5ece142947301c2c719a43a8b7f36bdd17febec223dc4b3f7f5dc517a5455f6 | Python | 7,138 | 259 | """
A python logger
Usage:
# Set logger verbose level.
import os
os.environ['VERBOSE'] = 1
import logger
log = logger.get('../logs/sample_log')
log.info('Hello world!')
log.info('Hello again!', verbose=2)
log.warning('Something might be wrong.')
log.error('Something is wrong.'... |
ef8a21d6b032f340e3143a05641ae9c12ab07439a30bf5dacf3a5121c845a0ba | Python | 7,141 | 164 | # 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 in... |
9b846ea4c2a772e8becebada8d7a1076f158555c2a51a7e1bb74d6f2b5de1b65 | Python | 7,144 | 179 | #!/usr/bin/env python3
"""
File: create_CIA_jobs.py
Created: 2020/04/22
Last Changed: 2020/06/08
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 Sof... |
1c13cdefb176fda48dc218cc4f3d865ba2f9865e08343923d90d307b44555fbd | Python | 7,145 | 178 | import torch
import torch.nn as nn
from torch_geometric.data import Data
from torch_geometric.nn import global_max_pool, global_add_pool
from model_utils import init_weight, MLP
from typing import List, Tuple
def seed_all():
torch.manual_seed(123)
torch.cuda.manual_seed_all(123)
class GATMode... |
e9a0f1017b018aafe498833e484bf30637ebda426be50374ff3b822ecf468c35 | Python | 7,152 | 160 | # Auto-anchor utils
import numpy as np
import torch
import yaml
from scipy.cluster.vq import kmeans
from tqdm import tqdm
from utils.general import colorstr
def check_anchor_order(m):
# Check anchor order against stride order for YOLOv5 Detect() module m, and correct if necessary
a = m.anchor_grid.prod(-1).... |
eb465d9d1c4ed546a5caa45fec41f7b7d9b9ed00069f126641707484c9742f31 | Python | 7,152 | 180 | from .config import HOME
import os
import os.path as osp
import sys
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
import cv2
import numpy as np
COCO_ROOT = osp.join(HOME, 'data/coco/')
IMAGES = 'images'
ANNOTATIONS = 'annotations'
COCO_API = 'PythonAPI'
INSTANCES_SET = 'insta... |
51a48fc19e8fe6cb7693f292d3356884699c217cd98e19dc5eced393a2269827 | Python | 7,154 | 166 | 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... |
a9b17b3d0ad517c2c5826832740f60612b99c18cffca2ad1fb4167cf58cb3aae | Python | 7,155 | 205 | """
Variational Animal Motion Embedding 1.0-alpha Toolbox
© K. Luxem & P. Bauer, Department of Cellular Neuroscience
Leibniz Institute for Neurobiology, Magdeburg, Germany
https://github.com/LINCellularNeuroscience/VAME
Licensed under GNU General Public License v3.0
"""
import os
import torch
import numpy as np
from... |
715ff7be07a3e1078a00b7a2c0ad24f74e32be6d2565053e567c842eec15526f | Python | 7,156 | 182 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import bisect
import copy
import logging
import torch.utils.data
from maskrcnn_benchmark.utils.comm import get_world_size
from maskrcnn_benchmark.utils.imports import import_file
from maskrcnn_benchmark.utils.miscellaneous import save_labels
from... |
cc353eef68f1f5d79cfce6ffe1f2d478da03356a4ce5f5554842a8f546d58b55 | Python | 7,157 | 166 | # -*- coding: utf-8 -*-
'''
@author: Mahbub Ul Alam (mahbub@dsv.su.se)
@version: 1.0+
@copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se)
@license : MIT License
'''
import neural_network_architecture
import features_extraction
import torch.nn as nn
import torch
from torch import LongTensor, FloatTensor
import ... |
3ce23516fd0d927ac02e3d23dfa08831a90af2b735469040855fb1d2c3b760d2 | Python | 7,159 | 204 | # 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... |
6a0869a9a33fd6a2d9d6e1663b7be8069eae9c4ad0dc270700d309ce8f86d973 | Python | 7,162 | 270 | # %% [markdown]
# ##
import os
import time
from pathlib import Path
import matplotlib as mpl
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from graspy.embed import OmnibusEmbed, selectSVD
from graspy.models import DCSBMEstimator, SBMEstimator
from gr... |
a16049a3ee27ea2e9c2e780540d9ef62e4a3591f0d6d62c1a6dd6924480a16de | Python | 7,163 | 191 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
916f14bc8109d7a58c2ae39a08c9d5ceec6045068b11f0ae8a47291702772abf | Python | 7,166 | 253 | __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
import warnings
from Bio.PDB.PDBParser import PDBParser
from Bio.PDB.Polypeptide import PPBuilder
class Se... |
9a22b8431556ad0d1372e0861a1a0f5681132b8cec726dc9e6d6333aa8ef8bc7 | Python | 7,166 | 131 | #%%
import pymaid
from pymaid_creds import url, name, password, token
rm = pymaid.CatmaidInstance(url, token, name, password)
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib as mpl
from data_settings import data_date, pairs_path
from contools import Prom... |
7b0ea000c7233cfa9c4f4110a1a47e7c952b87ab5fa3b77bcdc6ade925ac369d | Python | 7,168 | 159 | #%%
import os
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
print(os.getcwd())
except:
pass
#%%
import sys
sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/")
import pandas as pd
import numpy as np
import connectome_tools.process_matrix as promat... |
c6440b0db5d17bd3380f8025fc310c30a77e3db77a76f44cd4034b6826584163 | Python | 7,170 | 203 |
import numpy as np
from csbdeep.internals.blocks import conv_block2, resnet_block
from csbdeep.utils import _raise, backend_channels_last, axes_check_and_normalize, axes_dict, load_json, save_json
import tensorflow as tf
def multiscale_unet(
input_shape,
n_channel_out=1,
n_depth=3,
n_... |
e01bd3c86fdf8e9697f673dcc55f0fff7113a5cd9b92889bf13ee762c8104599 | Python | 7,172 | 236 | from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import scipy.sparse as sp
import torch.optim as optim
from torch.autograd import Variable
from utils_cora import accuracy, load_data_cora
from model import AGNN
import networkx as nx
import torch
imp... |
3da0250646a42ec63deb4d62a2e8e4159de1e25ad1afd1ccc544d9e86f837e8d | Python | 7,176 | 184 | """GUI to detect and load stc files and experimental conditions
Prompts user for experiment design information, and upon submission
loads stcs into an ``eelbrain.Dataset`` via a ``DatasetSTCLoader``
instance.
"""
import os
import wx
from . import get_app
from .frame import EelbrainFrame
from .._io.stc_dataset import... |
8f3c0feba89701cfbc7102875e7cec735ff9e4845c68bbbd7a8f5a2da50f053b | Python | 7,179 | 183 | import os
import logging, glob
from pathlib import Path
from functools import reduce, partial
from operator import getitem
from datetime import datetime
# from .logger import setup_logging
# import logger.setup_logging
# from . import logger
from .logger import setup_logging
from .util import read_json, write_json
# pr... |
9874ad0df6dcece58fcaa194340f6701479facd28c2a02257db36d59c9486c42 | Python | 7,179 | 219 | from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import torch.backends.cudnn as cudnn
import numpy as np
import torchvision
from torchvision import datasets, models, transforms
import matplotlib.pyplot as plt
from PIL imp... |
d44afcacc4f52a18ef43136925c30679a6e2c89e3de6c335c70ea04d2d7aaff0 | Python | 7,181 | 162 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
004cc55b7ef114a63d91019fe80df28b8da645f9282327db66921c21b0e0ed79 | Python | 7,182 | 212 | # %%
import os
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
print(os.getcwd())
except:
pass
# %%
import sys
sys.path.append("/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/")
import pandas as pd
import numpy as np
import connectome_tools.process_matrix as prom... |
6f5dcf5974bd70bf44c8fb9f6544aae1c425a082e25adeed53398a191e4bdf48 | Python | 7,182 | 185 | # 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... |
ec2252a38b834673436cd9cb4ed24c073b2a514e470b088eddcd4265b162c6f9 | Python | 7,182 | 236 | """Tests for the DatasetSchema TOML loader."""
from __future__ import annotations
import pytest
from cropro.schema import DatasetSchema
# --------------------------------------------------------------------------- #
# Helpers
# --------------------------------------------------------------------------- #
def _wri... |
560cacaee35463243d3ad2e3887a497c97092feede5b776187ecdd30c174c6f3 | Python | 7,184 | 171 | #%%
import os
import sys
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
print(os.getcwd())
except:
pass
# %%
import sys
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/')
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
fr... |
ae68537e9ad8f593d9f2e47ad6269b551f916dbe2ae47d202c086bf653eaf354 | Python | 7,187 | 169 | """
File: create_groups.py
Created: 2020/03/12
Last Changed: 2020/03/20
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 ve... |
1ef2bc91b1fe14185655a903251fa9a8dfba42c0d246e947ab021dd45644ddc6 | Python | 7,188 | 148 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torch.utils.data.distributed import DistributedSampler
from torch.utils.tensorboard import SummaryWriter
import pytorch_lightning as pl
import random
import numpy as np
from omegaconf import OmegaCo... |
1a62a428d03744d8eca689b6fa5d6e3c1aa0797f465034a3c5f13fc4dfc1a837 | Python | 7,191 | 174 | #%%
import os
import sys
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/')
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
except:
pass
from pymaid_creds import url, nam... |
c520e4b8f566e0ba226160a877513d3e1b9134cea308ccb57daf016db1ff8017 | Python | 7,192 | 207 | # 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... |
6930cafa10d5da0c1ce9f402dc84bf6af63a241df3b1d990b1fc472569ed7b32 | Python | 7,198 | 190 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib
# ----------------------------------------------------------------------
def multi_layer_polar_plot(
data1: np.ndarray,
data2: np.ndarray = None,
group_labels: list[str] = [],
external_labels: list[str] = [],
internal_labels: lis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.