sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e8991aa10f0fd679467de04d633dd445fa4a508f0a55ffce79279bd79180823c | Python | 5,851 | 149 | # 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... |
fd3801627218458be23c1232a25b8ea39d5b9e8f9835df0225aa59a8f4ccbf57 | Python | 5,851 | 149 | #!/usr/bin/env python3
"""Control traffic-light actors: state, freeze, timing — all, by junction, or one.
Commands:
list every traffic light (id, state, location)
set --state green|red|yellow|off <selector> set the light state
timing [--green S --yellow S --red S] ... |
bc1f818573bbcaf2971eaf06a4bc8a690008784998758e85e782da9641148c97 | Python | 5,852 | 158 | import torch
import torch.nn as nn
import timm
from pg_modules.blocks import FeatureFusionBlock
def _make_scratch_ccm(scratch, in_channels, cout, expand=False):
# shapes
out_channels = [cout, cout*2, cout*4, cout*8] if expand else [cout]*4
scratch.layer0_ccm = nn.Conv2d(in_channels[0], out_channels[0], k... |
6b11fabd5ef8f483ebea491497606dc0755c9929430a329a67752c72367b10be | Python | 5,853 | 152 | import os
import argparse
from copy import deepcopy
import tensorflow as tf
from utils.load_data import load_mabe_data_task1
from utils.dirs import create_dirs
from utils.preprocessing import normalize_data, transpose_last_axis
from utils.split_data import split_data
from utils.seeding import seed_everything
from trai... |
9a01029c15ba57529e9bc1564917d7568724f11954693b68581659bbd130da3d | Python | 5,853 | 150 | # 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>.
from numpy import random
from . import SmokeTest
import time
import carla
TM_PORT = 7056
NUM_TICKS ... |
f0e62cc0cc64f95230c48fd9ab8cde0fab889cede0701528b55a1c05201c0030 | Python | 5,853 | 174 | import torch
import torch.nn as nn
from model.cell import MaskMaker, MaskedLinear
class InferenceModel(nn.Module):
def __init__(self, h_dim, z_dim):
super().__init__()
self.h_dim = h_dim
self.z_dim = z_dim
self.num_time_layer = len(h_dim)
mask = self.get_mask_matrix()
... |
f69ebe7b84e85abf61c67b0c520be35c5e6f38a5f7d0bb867c8af628fa576393 | Python | 5,857 | 161 | import copy
from simphox.utils import random_vector
from simphox.circuit.vector import tree, hessian_fd, hessian_vector_unit, PhaseStyle
from simphox.circuit import cascade, vector_unit, rectangular, balanced_tree
from scipy.stats import unitary_group
import pytest
from itertools import product, zip_longest
import num... |
660c343e1f4e5cf787ffc983f768a1c422c943d36c73f20c4a9c1a14f24db998 | Python | 5,858 | 134 | # basic imports
import os
import gc
import pickle
import numpy as np
import pyqtgraph as qg
# framework imports
from cobel.agents.sfma import SFMAAgent
from cobel.interfaces.gridworld import InterfaceGridworld
from cobel.misc.gridworld_tools import make_empty_field
from cobel.memory_modules.memory_utils.metrics import ... |
39119b0195254a4e2549b5b91c021fea68063fe5bc1cb5b4023673d8ef7eda91 | Python | 5,859 | 184 | import argparse
import logging
import pandas as pd
import seaborn as sns
from matplotlib import colors
from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
sns.set() # Set seaborn as default style
sns.set_theme()
sns.set_style("ticks")
def generate_cmap():
"""
Gen... |
e40931a1521af554f22eb0381640b44595785eaabd050b70115502db6542337d | Python | 5,860 | 120 | import torch
from torch import nn
import torch.nn.functional as F
from neural_networks.variational import VIBNet
from neural_networks.custom_modules import ConvDropRelu, LinearDropRelu, VIBDecoder, IBNNet
class VAE(VIBNet):
'''
Architecture introduced in: ENERGY DISAGGREGATION USING VARIATIONAL AUTOENCODERS
... |
1b5c5e955dc9918bdba62d102bb70fa1cca7f9663068727253cf5a2ad6713cb6 | Python | 5,863 | 165 | """Feature learning based on sparse filtering"""
# Author: Jan Hendrik Metzen
# License: BSD 3 clause
import numpy as np
from scipy.optimize import fmin_l_bfgs_b
from sklearn.base import BaseEstimator
class SparseFiltering(BaseEstimator):
"""Sparse filtering
Unsupervised learning of features using the spar... |
5e55c60993919058bd919d14446bbbed94b143889145a9fbeee9c6518707624d | Python | 5,865 | 132 | # basic imports
import os
import gc
import pickle
import numpy as np
# framework imports
from cobel.agents.sfma import SFMAAgent
from cobel.analysis.rl_monitoring.replay_monitors import ReplayMonitor
from cobel.interfaces.gridworld import InterfaceGridworld
from cobel.misc.gridworld_tools import make_open_field, make_g... |
e6c28c96436d0bda36d03dfb481b004b170ecb929db1ad39d5070834cb954ee0 | Python | 5,865 | 156 | # 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... |
730f57a5df09415c7f8428366f8c1bb7be65dc544a92e838d92f8facfd44e738 | Python | 5,866 | 168 | """
Tree-structured Parzen Estimators optimization for RACCOON
F. Comitani @2021
"""
import os
import logging
from math import inf
import operator
import optuna
from optuna.samplers import TPESampler
optuna.logging.set_verbosity(optuna.logging.WARNING)
class Objective:
""" Objective function class for Opt... |
90108e108f2c1693125b9aade8cf092064d374d5416153a38571f15bbe87dbbe | Python | 5,866 | 146 | import os
import cv2
import glob
import torch
import shutil
import numpy as np
from tqdm import tqdm
from util.reverse2original import reverse2wholeimage
import moviepy.editor as mp
from moviepy.editor import AudioFileClip, VideoFileClip
from moviepy.video.io.ImageSequenceClip import ImageSequenceClip
import time
fr... |
3f69b27c0f3259caac87080073dced54fc35d2d4d9f51d2681ff5326704df40e | Python | 5,867 | 204 | #%%
from src.data import load_metagraph
import os
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
import pymaid
from graspologic.utils import binarize, remove_loops
from src.data import load_metagraph
from src.graph import MetaGraph
from src.io impor... |
7e026c47cef2330bf45839f9c601674b6ab06f18f0fae99212aaf06e2018458f | Python | 5,867 | 170 | # 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... |
0288a17aeebb17df99aaa79447ad9f24d84b84a9db4c04c72c0679e469df151e | Python | 5,868 | 195 | import hydra
from omegaconf import OmegaConf
import torch
from src.landmarks.common import run_episode
from src.landmarks.transforms import *
from monai.transforms import (
Compose,
ScaleIntensityRangePercentilesd,
CastToTyped,
)
import numpy as np
PANDAS_FCSV_KWARGS = {
"comment": "#",
"names": [
... |
85ca3293614133b80e7c89ebdd0eb52ba70c3ee9e86bbc8e726c91c1d9b7795d | Python | 5,870 | 170 | # ---------------------------------------------------------------------------- #
# An implementation of https://arxiv.org/pdf/1512.03385.pdf #
# See section 4.2 for the model architecture on CIFAR-10 #
# Some part of the code was referenced from below ... |
29cd33bb3657671f3d1dc13ddb2384ec1db582f3215d77136343750ecbbc911c | Python | 5,872 | 149 | """Minimal PCD point-cloud I/O and voxel downsampling with pure numpy.
No open3d / pcl dependency. Supports the subset of the PCD format that
Autoware's pointcloud_map_loader consumes: binary (plus ascii and
binary_compressed for the reader -- the prebuilt autoware-contents maps are
binary_compressed), float32 fields,... |
775b4fca4bf8d26b2433390f08e2b98570c1115b5f9b9a794cc34dee782d963e | Python | 5,872 | 170 | #coding = utf-8
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law ... |
4bbe48ffa4cdb44e105f3d21f1dfadbe2e75ff09afb3c167c1988963aa270b9b | Python | 5,873 | 176 | # coding = utf-8
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law... |
22be2b14b50f121944e7f97ffbceaae7018649daaa354d823231b1fcd368e7c4 | Python | 5,874 | 211 | # %% [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... |
a703aac5683c755978a0c19b55ef7f3d20b3565c9b0cf5df91b83c355020f001 | Python | 5,875 | 97 | import graph_nets as gn
import numpy as np
import tensorflow as tf
from rdkit.Chem.rdmolfiles import MolFromSmiles
from rdkit.Chem.rdmolops import AddHs
from scipy.spatial.distance import pdist, squareform
from scipy.spatial import KDTree
class GraphBuilder:
def __init__(self, dtype_np=np.float32, dtype_tf=tf.... |
46e2ed6de5a9255316c7ed3e06fda2c3c493d3402a1c47820c0a33673582fa40 | Python | 5,876 | 155 | 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, MetadataField
from allennlp.data.instance import Instance
from ... |
1ffa031837c710f67002058531956609971aff92e7b249dfc6280941d526dc39 | Python | 5,877 | 123 | import argparse
import gzip
parser = argparse.ArgumentParser(description='Merge MetaBrain with eQTLs from Sieberts et al.')
parser.add_argument('Sieberts_eqtls', help='eQTLs from Sieberts et al. study')
parser.add_argument('name', help='name that is given in output columns')
parser.add_argument('MetaBrain_eqtls', help=... |
48cd08c4530ddc0bc061727611c6acd5ac5f523b3df4af87c00bdbbc0a56e435 | Python | 5,877 | 153 | import pandas as pd
import numpy as np
import argparse
import os
from mismatch import adni_reference
def AssignGroup(subject_path, biomarker_path, output_path, binarization_sd=0.5, adni_reference_dir=None):
if adni_reference_dir is None:
adni_reference_dir = os.path.join(os.path.dirname(__file__), "adni... |
1d34e90ced996bd466ce74cc2219a8ae21d577d66f79d4a8e80c5b5990d666a8 | Python | 5,879 | 236 | # %%import numpy as np
from numpy.core.numeric import ones
import scipy
from scipy import io
import matplotlib.pyplot as plt
from pathlib import Path
import pandas as pd
import pymc3 as pm
import seaborn
import arviz as az
import numpy as np
import theano.tensor as tt
import theano
from sklearn.preprocessing import Pow... |
75e582427134f87cffb824bf3099052a572d5555ab2662cf85afe01bc5c23d4b | Python | 5,879 | 176 | import pandas as pd
from sklearn.metrics import roc_auc_score
import seaborn as sns
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
def annotate_heatmap(im, data=None, valfmt="{x:.2f}",
textcolors=["black", "white"],
threshold=None, **textkw):
"""
... |
14938bb7a7b99ec3e207d6218d582d45824af71cd7b529d64732e0903acbb843 | Python | 5,880 | 143 | #!/usr/bin/env python3
"""
File: export_cf_interaction_replication_to_excel.py
Created: 2022/05/16
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published ... |
5498d6dbd865699074b2d409ad0ebe0f5ea503c564e5fcbb69713c1d91503807 | Python | 5,880 | 180 | #
# 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 terms of the GNU General... |
7ad5935a0c3d7ab14573a4b2bda3df8ae766c6a3fd0d7ee388e2780b6426df6a | Python | 5,882 | 163 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from pathlib import Path
from pickle import dump, HIGHEST_PROTOCOL, Unpickler
from itertools import chain
import os
from .._data_obj import NDVar, SourceSpaceBase
from .._utils import ui
class EelUnpickler(Unpickler):
def find_class(self, module, name):
... |
1c259d142161bd398272cb119d45afb6b9efc6e1945d14b229f8a82c624040a9 | Python | 5,884 | 160 | import argparse
import os, pickle, shutil
# Don't log the TensorFlow info messages on imports
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "1"
import tensorflow as tf
from lfads_tf2.models import LFADS
from lfads_tf2.defaults import get_cfg_defaults
from lfads_tf2.tuples import BatchInput
from yacs.config import CfgNode as C... |
ce22010b99563d220dcdad8cafd9d7f1e61dfbf12548ccaec07aa61fd0731a83 | Python | 5,885 | 139 | import warnings
import pandas as pd
pd.options.display.max_columns = 10
import os
import argparse
import re
import shutil
DICT_MODEL_NAMES = {'BASELINE': 'BL',
'SEGGUIDED': 'SG',
'UW': 'UW'}
DICT_METRICS_NAMES = {'NCC': 'N',
'SSIM': 'S',
... |
c35dc4240620a6983d2562fc86ffbcf5c6a55abff9c31618435c3c526bb5e869 | Python | 5,886 | 171 | """
Loading and saving individual conformations
===========================================
The module :py:mod:`polychrom.polymerutils` provides tools for saving and loading individual conformations. Note that
saving and loading trajectories should generally be done using :py:mod:`polychrom.hdf5_format` module. This ... |
9a4eede1e3ef4a8054960039a770c3347095ff38c709ef08a4fbdc676f43f6df | Python | 5,887 | 136 | r"""
Polymer simulations with ActiveBrownianIntegrator
-------------------------------------------------
This is a sample python script to run a polychrom simulation with the `ActiveBrownianIntegrator' custom integrator in
polychrom.contrib.integrators. This integrator is used to simulate a polymer where each mononmer... |
c282a3a83533b1f3c4cc0a6c369a9407ba5028f1cfc8538d84e65e1f122422c3 | Python | 5,887 | 129 | # Copyright (c) # Copyright (c) 2018-2020 CVC.
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module implements an agent that roams around a track following random
waypoints and avoiding other vehicles. The agent also responds to traffic ... |
6ebe9c18f58ee94a6be9974c572869bdd2e588054a6a674e8d077abbba80bc09 | Python | 5,888 | 146 | import sys
sys.path.append(".")
sys.path.append("..")
import argparse
import math
import os
import numpy as np
import torch
import torchvision
from torch import optim
from tqdm import tqdm
from utils.common import CLIPLoss
from models.stylegan2.model import Generator
from base.models.perceptual_model import Perceptual... |
bf93e9bf6fb77aa5ed212d8ee4f607e5a85aa4992398d6a64d434ce28a0cc088 | Python | 5,888 | 203 | """
Skeleton handling
Label conventions:
{0: 'Somatic',
1: 'Axonal',
2: 'Basal dendrite',
3: 'Apical dendrite',
4: 'Unknown/Ambiguous dendrite',
5: 'Unknown/Ambiguous'}
"""
import os
import json
import h5py
import numpy as np
import cloudvolume as cv
from meshparty import skeleton_io
from meshparty.skeleton impo... |
296ce095b08a84732ebdd6c40f8b08fe56dd65ff9e47fe5f686d223d10f471fe | Python | 5,890 | 149 | # Analysis
import numpy as np
# Statistics
from statsmodels.stats.proportion import proportion_confint
from scipy.stats import binom
from scipy.stats import friedmanchisquare, wilcoxon, chi2, pearsonr
from sklearn.metrics import r2_score
# Builtin
import pdb
class Classifierbinomial:
## "data" is the observati... |
e8a55d8f47897ec37aa4d1dd579b0858382c6571ad7ece2dba399618d1abfe7c | Python | 5,893 | 200 | import os
import numpy as np
import pandas as pd
import math
import random
import matplotlib.colors as colors
from sklearn.model_selection import train_test_split
from sklearn.decomposition import PCA
import scanpy as sc
# Plotting
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.colors as color... |
15c6e190d594ade385062f6e6a87449e52aecd3383c383aa00a5f83f9bb75d41 | Python | 5,894 | 149 | # 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... |
b8c6debfd0de1f70dc81b8f7aa986a541efb8aa17b8d984fed73f7fd2f5bdf5a | Python | 5,894 | 174 | #!/usr/bin/env python3
"""
File: create_markergenes_upsetplot.py
Created: 2021/01/13
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 So... |
4aad694fed97b88642d12824f37615096e26960043b340f14d26c0dbc03caa5c | Python | 5,897 | 121 | #!/usr/bin/env python
#######################################################################
#######################################################################
## Created on July 4th 2018 to create IGV session file from file list
#######################################################################
###########... |
a258ff3c899579c426173838bf2b2a6ef7ef9aed467f95cfcb655da2d5bcf154 | Python | 5,897 | 161 | # -*- 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 os
from PIL import Image
import torch.utils.data as data
import torchvision.transf... |
4de9ebe7cb7fec9175868d608a1963427d64ba7508cfa1f278a18bef7faba253 | Python | 5,898 | 177 | import cuslines
import numpy as np
from math import radians
from tqdm import tqdm
import logging
from dipy.data import small_sphere
from dipy.reconst.shm import OpdtModel, CsaOdfModel
from dipy.reconst import shm
from dipy.io.stateful_tractogram import StatefulTractogram, Space
from nibabel.streamlines.array_sequenc... |
295844669f1aee85531e7e1fd491fbce54f48645199cf5273f2c2f44d89be764 | Python | 5,901 | 145 | """Lazy access to the NuRec integration package that lives beside this one.
``PythonAPI/examples/nvidia/nurec/`` is a demo project with its own dependency set (gRPC stubs,
Docker orchestration, an NVIDIA container). ``carla_cosmos`` is an installed library and must
not depend on it: everything in :mod:`carla_cosmos.n... |
2cafd720eccc03d1af97ab873059d8b5c4493c65d5f74c6994d71d8112ee5b28 | Python | 5,902 | 132 | # 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... |
7df5a1a3444a00b5c324fd5bb91bb72bfdf00170ada5d908c346dd8dd8f5b61e | Python | 5,903 | 189 | import selfies as sf
import pandas as pd
def TEST():
print('working')
def SMILES_to_SELFIES(SMI):
try:
mol_SELFIES = sf.encoder(SMI)
return mol_SELFIES
except:
val = "Invalid SMILES..."+' : '+str(SMI)
print(val)
def SELFIES_to_SMILES(SELFIES):
tr... |
22474d13ea7e2bb3e274e62d372c5b77a46f93e58d42e9106f20ef5ef2a4d21d | Python | 5,905 | 176 | """
RNNTG is basis class for MTRNN, SCTRNN and PVRNN.
"""
from abc import abstractmethod
import torch
import torch.nn as nn
torch.set_printoptions(threshold=10000)
class RNNTG(nn.Module):
def __init__(self):
super(RNNTG, self).__init__()
self.device = 'cpu'
self.data_size = 0
self... |
0db5058302179684a93d206d7e4f4778ed49359ba1acd836ee1432197e2654d3 | Python | 5,906 | 181 | """Progress bars.
All progress bars printed by osl-dynamics are made with :func:`progress`
or :func:`parallel_map`, so they look the same and can be turned off
together. Progress bars are shown when the :code:`osl-dynamics` logger is
enabled for :code:`INFO` messages.
"""
import logging
import os
import sys
from conc... |
5919f081cf75511dc175bb1877249d245fc1be2d169d414fdf10e02550695e4a | Python | 5,909 | 214 | import numpy as np
import zarr
from skimage.filters import gaussian, median
from skimage.morphology import square
from skimage.transform import warp, EuclideanTransform, AffineTransform
from skimage.registration import phase_cross_correlation
from skimage.util import img_as_float32
from skimage.exposure import rescale... |
5a61c289bd288773274750cb2ec6bf2995eb2284b5192b021868221ac76a84c2 | Python | 5,910 | 146 | import torch
import torch.optim as optim
from torch.utils.data import DataLoader
import os, argparse
import json
import numpy as np
from tqdm import tqdm
from model import Net
from data import CelebADataset
from loss import custom_loss, get_labels
from utils import visualize_keypoints
def train(model, train_dataloa... |
3a98c3741959b2edd0af961ba15fe19308a5ab097fb9e2e57154c51b51820fc3 | Python | 5,913 | 165 | """
This module provides the RPKMFileSampler class.
"""
import numpy as np
from selene_sdk.samplers.file_samplers import FileSampler
from selene_sdk.samplers.samples_batch import SamplesBatch
from tqdm import trange
class RPKMFileSampler(FileSampler):
"""
A sampler for which the dataset is loaded directly fro... |
8a9343a18ce5a818486ded1177f981bd1b57e3e40b17477c285b5d2d88a6078c | Python | 5,914 | 147 | 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... |
0aaba6536f35d00fe24bbdc6c7a53e92a411689ffe6011db62f11e4dad296977 | Python | 5,915 | 135 | import pandas as pd
import matplotlib.pyplot as plt
##################################################################################################
##################################################################################################
# Experiment 1 - Obtains Plots for Figure 5 of the Article
##########... |
58c3b77f0e7af0531905b8484e31fa7cfbd24ce3d31c716d5b0320424d9533a3 | Python | 5,916 | 152 | """
Resampling layers
=================
When working with neural operators, we often need to change the resolution of our data.
For some architectures, like the FNO, this is handled automatically due to the
resolution-invariant nature of the Fourier domain.
However, for other architectures, like the U-Net, we need t... |
74e4d848b85d46284ab73bc688d768c27c7c56334de9a2b317c3e0b26abf41cd | Python | 5,918 | 170 | import warnings
import matplotlib.pyplot as plt
import mmcv
import numpy as np
import torch
from mmcv.ops import RoIAlign, RoIPool
from mmcv.parallel import collate, scatter
from mmcv.runner import load_checkpoint
from mmdet.core import get_classes
from mmdet.datasets.pipelines import Compose
from mmdet.models import... |
5deca85a4d2acf8d92d03adae39a8a4c6850f70f234a92afd3190607081fe99d | Python | 5,919 | 204 | from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
from tqdm.auto import tqdm as pbar
import logging
from tctx.analysis import simbatch as sb
from tctx.networks import space_turtle as turtle
from tctx.util import sim
from tctx.analysis import simsampling
####################################... |
8307cac03e4ed69929b0dadf4bf63f178f210abb324884935173ecab730293d9 | Python | 5,920 | 142 | # 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... |
f523ac9010a3b238a997060f04e36348f1bda37df294f2c80e7e7f1b15e2f4c4 | Python | 5,920 | 190 | from __future__ import annotations
import logging
from palm_tools.data_structure.trackset import TrackSet
from .ts_post_processing import PostProcessingStep
from .post_processing_params import PostProcessingParameters
from typing import List
import numpy as np
import pandas as pd
from tqdm import tqdm
import os
clas... |
8646b5b1dc72c78e792de348f8443d02957b4cc2926ca203f0c391512047c640 | Python | 5,921 | 140 | import torch
import torch.nn as nn
import torch.nn.functional as F
OPS = {
'k3_e3': lambda C_in, C_out, stride, dilation, affine, track: MBBlock(C_in, C_out, 3, stride, 3, 1, dilation, affine=affine, track = track),
'k3_e6': lambda C_in, C_out, stride, dilation, affine, track: MBBlock(C_in, C_out, 3, stride, 6... |
64d70d73b9b08e56142bdfa436a83d50251cde127a53c4aa06754a4c5d6a7a69 | Python | 5,922 | 135 | import numpy as np
import databricks.koalas as ks
import pandas as pd
earth_radius_km = 6378
earth_radius_m = 6378E3
def extract_koalas_df_from_s3(s3_url: str, n_rows: int = None, is_ais=True):
"""
TODO read multiple csv's into one df (shouldn't have to change much here)
This function reads a ... |
51fe559cead927f0566295c27eae0ddd5d2e558bfe348ef87bc3dd1b4cecce21 | Python | 5,923 | 149 | """Modified version of DeepLab model to improve the performace for dense prediction. """
import torch
from torch import nn
from torch.nn.functional import interpolate
class BaseDeepLabModel(nn.Module):
"""Implementation of BPARC DeepLab model for dense prediction instead of segmentation.
Args:
in_dim ... |
785bc64c6927b72a52f63efc48574a1effcfa07a649cae3470a7b5e2c3968388 | Python | 5,923 | 136 | from .vehicle_wheel_smoke_test import VehicleWheelSmokeTest
import carla
import math
ANGLE_TOLERANCE_DEG = 2.0
# Small steps, so that none of them looks like a teleport.
MOVE_TICKS = 10
# Far enough in one frame for the simulator to treat it as a teleport.
TELEPORT_DISTANCE_M = 20.0
class TestVehicleWheelSpin(Veh... |
7bede0b95e48a8e7da0fddc8f0c03ebdf991da171d94fdafb66700822ad45055 | Python | 5,924 | 190 | import os
import sys
from types import ModuleType
from typing import Optional, Tuple
import mne
import numpy as np
from ...base import DatabaseBase, ALL, load_fids
########################################################################
class Database(DatabaseBase):
""""""
fids = load_fids(os.path.join(os.... |
ed4c4eb5e7df54c92b324190324e8ed0a33ac99acccbc0fc7f27235db464eeac | Python | 5,926 | 140 | #%%
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... |
b937b8f5ce1ad69a0d462e2f7c5e88d1d8e230c7dbde1c62868b1540e83bdd88 | Python | 5,927 | 163 | # 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... |
1ae9ad5bef1279bc2b0b59fbdfc208754aa26f74e3d332805a324c8febceb2e1 | Python | 5,929 | 183 | from hebbcl.parameters import parser, set_hpo_args
from hebbcl.tuner import HPOTuner, save_tuner_results, validate_tuner_results
if __name__ == "__main__":
# configs = [
# "interleaved_vanilla_1ctx",
# "blocked_vanilla_1ctx",
# "interleaved_vanilla_2ctx",
# "blocked_vanilla_2ctx",... |
2fef054410ea8409ede0a78bdcf816105b5ac8ecfd11c4e4631bec74906fd566 | Python | 5,930 | 190 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
from typing import Any, Dict, List, Tuple
import os
import subprocess
import numpy as np
import pandas as pd
from tmkit.interface import T... |
844f9d48ab3eb12ef5bfe38982139ba200cf84046741818fc9b799c5cb439627 | Python | 5,934 | 178 | import torch
import torch.nn as nn
from util.logging import LogEntry
from lib.distributions import Normal
class BaseSequentialModel(nn.Module):
model_args = []
requires_labels = False
is_recurrent = True
def __init__(self, model_config):
super().__init__()
if 'recurrent' in model_c... |
061526ea51639e4a393bae419b71ecafeb7f98375b9a1ca06c4d804c6cfff5e2 | Python | 5,939 | 154 | import os
from chemproppred.utils import *
# function to fill in needed data
def process_df(df, n_bits, req_length):
# create long smiles
df["monomer"] = df["smiles"]
smiles = df["smiles"].value_counts().index
for smile in smiles:
if isinstance(smile, str):
idx = df.index[df["smil... |
c7a73f951aaf5c5bccf16c194337f42299215dae6390259fa84f4057260be91b | Python | 5,941 | 143 | #!/usr/bin/env python
from IPython.core.debugger import set_trace
# coding: utf-8
import sys
from open3d import *
#import ipdb
import numpy as np
import os
from sklearn.manifold import TSNE
from Bio.PDB import *
import copy
import scipy.sparse as spio
from default_config.masif_opts import masif_opts
import sys
from sci... |
73a5a5087f7b653a325e9d79f88465cc28a679d1b347125cc7492f3fb2154fb1 | Python | 5,942 | 168 | '''
Retrieves the pdf files from the URLs provided in
/data/talksumm_papers_urls.txt
Author: Tomas Goldsack
'''
import urllib.request
from time import sleep
import numpy as np
import re, logging, os, requests
from datetime import datetime
ACL_BASE_URL = "https://aclanthology.org/"
ARXIV_BASE_URL = "https://arxiv.org... |
ada6567459df7ee453652fb6b2d13f5d6fc7013b2228e59f7cbd603bce765319 | Python | 5,942 | 220 | import numpy as np
import matplotlib.pyplot as plt
import time
from helper import *
from ALsim import ALsim
import sim
import sys
import os
from ALsimParameters import std_paras
import random
import scipy.optimize as opt
import genome
"""
Run an optimization method to align the AL simulation with experimental observat... |
e941f6e8c23c6bce62570325e51ca274bea6f7fdba13d6b2fc4d04428a3d89f0 | Python | 5,942 | 161 | from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvLayer(nn.Module):
"""
Convolutional operation on graphs
"""
def __init__(self, atom_fea_len, nbr_fea_len):
"""
Initialize ConvLayer.
Parameters
... |
1dc92b172462dc2806fac86513aaf12678a1045a775f8e43b4772646273e4544 | Python | 5,947 | 203 | # -*- coding: utf-8 -*-
"""Parser for phys2bids."""
import argparse
from phys2bids import __version__
def _get_parser():
"""
Parse command line inputs for this function.
Returns
-------
parser.parse_args() : argparse dict
Notes
-----
# Argument parser follow template provided by Ra... |
8308c194ab56624bffe7d3ab8196c3e25e2a9bf1eb3a554a0f65476720017b6a | Python | 5,948 | 160 | # 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 ... |
c72bd6bcecc8797939717e90b8ed0db19813773d45f85d524f9ca7c906546daa | Python | 5,951 | 146 | ####################################################################################################
# Copyright (c) 2018 - 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 ... |
e15fa350fac6cc8b52ad120e17a83550a99da0b2ea7b3aebf2da85f983fe9cec | Python | 5,952 | 159 | '''
This file contains application-specific functions to change the object volume
Every function receives volume as an argument and returns volume after modification
'''
import numpy as np
from voltools import transform
import skimage
import scipy
def replace_material(volume, src_num, dest_num):
'''Cha... |
0bbfe8d6b6b527014de90fd2ea504fa2580924a4a9398b647073f28de7589612 | Python | 5,954 | 154 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# This file comes from
# https://github.com/facebookresearch/detectron2/blob/master/detectron2/evaluation/fast_eval_api.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Copyright (c) Megvii Inc. All rights reserved.
# This file was copied from pr... |
1e6178790ca70d6b004f5d16f0e2a49fe8483e9b6d9ebeecdbc517b6367b025c | Python | 5,959 | 146 |
import paddle
import argparse
import cv2
import numpy as np
import os
from models.model import FaceSwap, l2_norm
from models.arcface import IRBlock, ResNet
from utils.align_face import back_matrix, dealign, align_img
from utils.util import paddle2cv, cv2paddle
from utils.prepare_data import LandmarkModel
def get_id_e... |
60e6b256eb582d98f831543d870cf7eed7cddc18123ce57edd56369afe06329a | Python | 5,963 | 198 | # coding=utf-8
# Copyright (c) 2021, NVIDIA CORPORATION. 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 re... |
bfdd89770b18af9618b74edecd8439a828c006118436f979afba36b6494271db | Python | 5,964 | 161 | # -*- coding: utf-8 -*-
# File : replicate.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 27/01/2018
#
# This file is part of Synchronized-BatchNorm-PyTorch.
# https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
# Distributed under MIT License.
import functools
import torch
from torch.n... |
92506a5602a28f326fa97b966431e047013630f525e74a0235627008d83a8565 | Python | 5,970 | 141 | 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... |
8193ace54695f39647914e55fc6087f40ef917c104c7071da1253c7df86ad934 | Python | 5,979 | 152 | # 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... |
499897961d9407a0710718e4b45727991ea9a5da009feea579d8b69c09154a07 | Python | 5,981 | 184 | #!/usr/bin/env python
import os, sys, time, glob, re
import numpy as np
import scipy as sp
from itertools import product
sys.path.append("./")
pycodefile='ompsimulator'
paramdictnames='dpmodel_params, signal_params, run_params'
exec('from %s import %s' % (pycodefile, paramdictnames))
exec('paramdicts=[%s]' % paramdi... |
5463967edf07c7273c0221554cb46e299d743d04d65ec07582f5a9cc5accdc1a | Python | 5,981 | 158 | # 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... |
2d3ff8ab0d4d252034a9af56504e20e9b737e15cf7b8bf8e46cc7a29288e6ec4 | Python | 5,985 | 218 | from __future__ import absolute_import, division, print_function, unicode_literals
def add_archs(archs):
global MODEL_ARCH
for x in archs:
assert x not in MODEL_ARCH, "Duplicated model name {} existed".format(x)
MODEL_ARCH[x] = archs[x]
MODEL_ARCH = {
"default": {
"block_op_type"... |
996fb7c9a1df182ee40fd53617ae3cf94a403e02f4550d1114bd1120a17a2fd8 | Python | 5,986 | 135 | ####################################################################################################
# Copyright (c) 2019 - 2021, 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 ... |
169eb330ff6b63caf6d889aaf62f35c32d0912d8d6e2747646bda29d2f8ea3fe | Python | 5,987 | 218 | from __future__ import absolute_import, division, print_function, unicode_literals
def add_archs(archs):
global MODEL_ARCH
for x in archs:
assert x not in MODEL_ARCH, "Duplicated model name {} existed".format(x)
MODEL_ARCH[x] = archs[x]
MODEL_ARCH = {
"default": {
"block_op_type"... |
5d1b7a6e0766c2a53a0075a3889ffda9f48eaf086cb2ef0739767a75bea65f70 | Python | 5,988 | 159 | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# 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 applicab... |
5c3759652a6a49962715f7a5b0fe1e85d1685d2a57811876ac84b7b905a614c4 | Python | 5,989 | 171 | ####################################################################################################
# Copyright (c) 2019, 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 softwar... |
e7ad09e02056f7115942eaf070eeb52111e86bd5006e5e7c06d70b5435bae5a9 | Python | 5,991 | 186 | #!/usr/bin/env python
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""Script that helps users to manually replay a log previously recorded"""
i... |
1282f5443d45ad23ac96d7d307cbfad2ee713fbb3f329c6d623763199a96ae76 | Python | 5,992 | 184 | # 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... |
1f2ae7802f8a791713c64c044aa95559a99291bc6da2432c3590d8818be88902 | Python | 5,993 | 172 | '''
Tools for model fitting.
This requires brian2modelfitting.
'''
import numpy as np
from file_management import *
import yaml
from brian2 import *
from brian2modelfitting import *
import os
import inspect
import datetime
from time import time
import sys
from brian2.units.constants import faraday_constant as F
from br... |
f710bbc5adb5acac02e0187b82ca404ef86107e3dd64568eeb0b75c633a81b08 | Python | 5,994 | 127 | import logging
from utime import Defaults
from psg_utils.utils import ensure_list_or_tuple
from yamlhparams import YAMLHParams as _YAMLHParams
logger = logging.getLogger(__name__)
def _handle_channel_sampling_group_renaming(hparams):
"""
Replace 'access_time_channel_sampling_groups' and/or 'load_time_channel... |
3e2d97c45947de53d48e2b25d7c2f3e2d5fa634ff114059e11499004db58726f | Python | 5,995 | 171 | # -*- coding: utf-8 -*-
from .core import *
from .. import _logging as logging
import tensorflow as tf
__all__ = [
'SubpixelConv1d',
'SubpixelConv2d',
]
def subpixel_conv2d(net, scale=2, n_out_channel=None, act=tf.identity, name='subpixel_conv2d'):
"""It is a 2D sub-pixel up-sampling layer, usually be u... |
9d2d34fdbe65e3fb6ba46d062fae272adfa59dd4641f74908f0117d2f0b78b8e | Python | 5,996 | 206 | # %%
import copy
import json
import logging # import first to make sure logging works
import pathlib
import pickle
import pprint
import warnings
from collections import defaultdict
import box
import matplotlib.pyplot as plt
import numpy as np
import oasis
import pandas as pd
import scipy
import scipy.io
from numpy.co... |
4da3456b92800716f1882fef7e6018094a517c5853f604a7f3c0afbefbdfea92 | Python | 5,997 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.