sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d66bb261b4b9056b129bb4e74b0619e4cb6cbe9df15aa19219fd90239b45ab31 | Python | 4,992 | 155 | #!/usr/bin/env python
import sys
import os
import math
import re
from os.path import isfile, join, isdir
from kn_common import pipetools,pipedef
from kn_pipeline_class import CPipeError,CPipeStep
class CPipeStepInjSeg(CPipeStep):
foldername="inj"
signal_name="inj_mask_TC_org.nii.gz"
def batch_run(sel... |
2242baefab1e9aabc4641e16b43f9b28ace61ecb538eba0fcea091c5736001ec | Python | 4,996 | 148 | """ Compute the cv and regularity according to Young et al., J. Neurophys,
60: 1, 1988.
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, 2020-2025, Later development)
... |
3d62efc5a144560afde13518741d94cb31d896e89657fd5e562bf87ac93d1773 | Python | 4,996 | 139 | from __future__ import annotations
from dataclasses import dataclass
import numpy as np
from scipy import sparse
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from .data import normalize_log_cpm
@dataclass(frozen=True)
class PseudoclusterBundle:
cell_context: np.ndarray
group_exp... |
9db939b233a56ea5a8ef37ac352b462e11e10295a67ebc2b92b9aec49a4a1ce0 | Python | 4,997 | 116 | """
Module written by Jamie D. Costabile for performant computation of the nonlinearity coefficient (NLC)
"""
import numpy as np
import tensorflow as tf
from skimage.util import view_as_windows
from model import ActivityPredictor
from typing import Tuple
# Used in combination with "cnn_fit_test.py" and its derivativ... |
dfd31907b9ea4cff960363eaf129a90396eb985caf30538e90bab708b5afd4ec | Python | 4,998 | 135 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Base classes for classification datasets."""
__author__ = ["felipeangelimvieira"]
from sktime.datasets.base import BaseDataset, _DatasetFromLoaderMixin
__all__ = [
"BaseForecastingDataset",
"_ForecastingDatasetFromLoader",
]
class ... |
26b3b13ca98d3c104e34631258c34e11bebdc22eb0922cc6c48f2077463d78d9 | Python | 4,999 | 131 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
57e3a7b14314086a188c331ec7da96a1cbc351cae4a0a2f7216bc576e70c7d1a | Python | 5,002 | 143 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
d937425e220c23ec6d44cbf192fec409983a277fcb59cad878bc7657c588fedc | Python | 5,002 | 128 | #!/usr/bin/env python3
#
# (C) Copyright 2015 Frankfurt Institute for Advanced Studies
# (C) Copyright 2016 Max-Planck Institute for Brain Research
#
# Author: Philipp Huelsdunk <huelsdunk@fias.uni-frankfurt.de>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... |
805cd97c05f4c387cadd6558f0834861832c97e133c6ad7b9b2854d9b62884d6 | Python | 5,003 | 151 | # Code adapted from https://github.com/Wuyxin/ReFine
import math
import numpy as np
import torch
from torch_geometric.data import Data
EPS = 1e-6
class Explainer(object):
def __init__(self, device: torch.device, model: torch.nn.Module):
self.device = device
self.model = model
self.model... |
833cce4239cd3c6ceafc65f03856c2c2575fc9c23d8abd17fae7bfc96af81cbf | Python | 5,003 | 148 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 22 12:00:41 2022
'This code a chain from the pdb chain cluster with maximum glycan interactions'
@author: sudhanshu
"""
from pyrosetta import *
from pyrosetta.teaching import *
from pyrosetta.rosetta.core.pose import *
import os
import shutil
from d... |
ac0069d77e1328b708d39b69a71a29dba4257921045a5751a587e43f117ef7eb | Python | 5,004 | 142 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
f1cfbc5e64fbd7203a8c338ac0d51b8b28fc979b05a6f43e73fe0b18893a3cef | Python | 5,008 | 132 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
17ccdfe25a70337562c0eaa354933bc1b929a152cf01dc71959da126cdeb28fc | Python | 5,009 | 106 | # ----------------------------------------------------------------------------
# Copyright (c) 2017-2026, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
87c8862284d39fd4fea21f4fcd70c0b5182ea87e03485097d98e3f40d6494834 | Python | 5,009 | 148 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
fade5d475474116edc93c35d4c6146559ddab88b65a31fdfcc954ccfa4909866 | Python | 5,009 | 108 | from expert.src.model import Model
from tensorflow.keras.callbacks import CSVLogger, ReduceLROnPlateau, EarlyStopping
from expert.src.utils import read_genus_abu, read_labels, parse_otlg, transfer_weights, zero_weight_unk, load_otlg
from expert.CLI.CLI_utils import find_pkg_resource
from tensorflow.keras.losses imp... |
2487fe016daf7f1d30a9fa692b2d993fde3f6c0cea0289531d1e4cd093e8fac8 | Python | 5,012 | 146 | dlpfc_config = {
"train_batch_size": 512,
"finetune_batch_size": 0,
"transfer_batch_size": 512,
"train_epochs": 50,
"finetune_epochs": 10,
"transfer_epochs": 50,
"train_task": "supervised_group_identification",
"finetune_task": "cross_model_prediction_clas",
"transfer_task":... |
12d51e31137c205b7e6b88920d202c4b7a75c92df645f650ad11fd4eb84aa84d | Python | 5,013 | 108 | # Copyright 2007 Zachary Pincus
# This file is part of CellTool.
#
# CellTool is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
from scipy import ndimage
import numpy
def warp_images(from_points, ... |
793c81295ccf534fcd37b1c426d9df3d6b565c0e3a3c94192f4965eb83d5f733 | Python | 5,016 | 131 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
5d3b090c8cc0db2e2e556d56617e71e407c0a9dbf08441144aec5d5d02c19952 | Python | 5,017 | 143 | """
@file: mobile_vit.py
Created on 07.07.22
@project: CrazyAra
@author: queensgambit
MobileViT network architecture definition based on:
https://github.com/lucidrains/vit-pytorch#mobilevit
"""
import torch
from vit_pytorch.mobile_vit import MobileViT, conv_nxn_bn, MobileViTBlock, conv_1x1_bn
import torch
import torch... |
9895f69b02c1e1a543502741a5256a797d13beeae3bb219af7af1a44aaa9e1c5 | Python | 5,017 | 135 | """ Short Summary
This script takes the Reuters-50-50 dataset from
https://archive.ics.uci.edu/ml/datasets/Reuter_50_50
and processes it into the standard form we use in this project. Namely, the
following files are generated:
- content.csv
- features.csv
- paper_ids.csv
- authors.txt
- author... |
4e2280468ccd38c10d3a26e2a796a57ce576ad6d0f15afae9b3f00a3b0c9c229 | Python | 5,018 | 110 | # Copyright 2019-2021 The AmpliGraph Authors. All Rights Reserved.
#
# This file is Licensed under the Apache License, Version 2.0.
# A copy of the Licence is available in LICENCE, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
import numpy as np
import tensorflow as tf
from ampligraph.latent_features impo... |
1678e88045c7b6c3d1f453e22cc1c546fced3867b25b3aefed6360c8ff7833b5 | Python | 5,020 | 171 | # coding=utf-8
# Copyright (C) 2022. Huawei Technologies Co., Ltd. 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
#
# ... |
2afba63bf93852dc821cf0287800076e0e6ea5e591ddd9b38858a66054596ace | Python | 5,024 | 191 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten
"""Penalties and penalty functions for change and anomaly detection."""
__author__ = ["Tveten"]
import numpy as np
from sktime.detection._utils import check_larger_than
def make_b... |
f5fe53b66ebbb01af0f9ce537df91bb8766bcbefce53205bbe2fe57b521608cf | Python | 5,026 | 125 | """
Connect populations of neurons with patterns more complicated than simple 'all-to-all' connectivity
William Nourse
January 12, 2022
"""
from sns_toolbox.connections import NonSpikingPatternConnection
from sns_toolbox.networks import Network
from sns_toolbox.neurons import NonSpikingNeuron
from sns_toolbox.renderer ... |
18d15265f188945288aab6b3b8921c41dc8d3be656c21478cc120ebeeb5f5698 | Python | 5,029 | 159 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: johannvk
"""Poisson distribution cost function."""
__author__ = ["johannvk"]
import numpy as np
from sktime.detection._utils import MeanType, check_non_negative_parameter
from sktime.detec... |
1eca013ab196d33d083a37f66df31d83e45f03f63c4d97f674d60c19228955e6 | Python | 5,029 | 138 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
ed4891282c14837844996f5771a9431c55ae3b7319b1f304ce7631cc2fda4b9b | Python | 5,033 | 147 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
"""Atheris fuzz harness for onnx.compose.
Two input paths are exercised per iteration, selected by a fuzzer-controlled
toggle byte read from the *tail* of the input:
* Raw -> a 4-byte big-endian length prefix splits the remaining bytes... |
48584753bb334569cc55016ee0f7f645d57746ceae34aaa3448b8d37b6cdb280 | Python | 5,036 | 137 | import re
from collections import defaultdict
import rdflib
from pyontutils.sheets import Sheet
from pyontutils.namespaces import ilxtr, TEMP, rdfs, skos, owl
from neurondm.core import Config, NeuronEBM, Phenotype, EntailedPhenotype, log, OntId
from neurondm.models.apinat_pops_more import _genlabel, NeuronApinatSimple,... |
07ce283d7cb93097e7e8d4fca0b0b012891920e20714b570987da7a6da24358d | Python | 5,037 | 109 | import warnings
max_warnings = {}
'''overwrites the default number of max warnings by warning name'''
skip_warnings = {}
'''overwrites the default number of skipped first warnings by warning name'''
def filterwarning(*args, **kwargs):
"""add warning filter but only if not already there (i.e. defined by the user),... |
db750ec9e235e640ef9f1da30de2c3363b4dc22c6ede3dbb798103d906713233 | Python | 5,040 | 143 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
165e87294d4d1a451514044402d12b748512f010294509d198607d65326ff096 | Python | 5,044 | 110 | # 这是一个非常简单的使用Web服务上传图片运行人脸识别的案例,后端服务器会识别这张图片是不是奥巴马,并把识别结果以json键值对输出
# 比如:运行以下代码
# $ curl -XPOST -F "file=@obama2.jpg" http://127.0.0.1:5001
# 会返回:
# {
# "face_found_in_image": true,
# "is_picture_of_obama": true
# }
#
# 本项目基于Flask框架的案例 http://flask.pocoo.org/docs/0.12/patterns/fileuploads/
# 提示:运行本案例需要安装Flask,你可以用下面... |
42d94f5e2d47d8b1b57cd4d2386f9aa6c97a59b3d7b66fd969198af65612ae95 | Python | 5,046 | 142 | """Tests for pairwise alignment and alignment statistics."""
from pathlib import Path
from corset_tools.dist_calc.align import (
align_pair,
count_gaps,
count_mismatches,
format_alignment,
trim_alignment,
)
from corset_tools.dist_calc.runner import align_all, select_comparable_pairs
from corset_to... |
12424b8a48f716f7e793d3ad89b6a89174c67d98f94fdfbedea4d6748cd477fc | Python | 5,047 | 134 | """
@file: game_state.py
Last changed on 16.01.19
@project: crazy_ara_cleaning
@author: queensgambit and matuiss
File to group everything to recognize the game state
"""
import chess
## Variants Includes:
# 0 - "is960", board.chess960 = True (lichess: "Chess960")
# from chess import Board(chess960=True), CrazyhouseB... |
d2dc6b3ff1f6914d72c5fa65400f74767eb1f381a2ff01637d3f783e32d48f94 | Python | 5,048 | 163 | import os
import argparse
import json
from labelme import utils
import numpy as np
import glob
import PIL.Image
class labelme2coco(object):
def __init__(self, labelme_json=[], save_json_path="./coco.json"):
"""
:param labelme_json: the list of all labelme json file paths
:param save_json_... |
41b396ce9eeb04f5810747660c745b327e98fbcc14101de48ead367704cd6262 | Python | 5,049 | 139 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
1351798cbf661ce9cb2e6d33b1e7e737aeb1076ff76cd986ffce45b5f3155f93 | Python | 5,053 | 136 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
2a2d8f8eff5635e3d17da2a743ffe889a71e77b5ad197cd43105a7495a0e1c5d | Python | 5,053 | 129 | # Copyright (C) 2022-2025 Shijiazhuang Xianyu Digital Biotechnology Co., Ltd
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... |
3d263e1aa80d2b52fa7ab4e1ed9842cea084b5673691171b3851a8f54152c536 | Python | 5,053 | 139 | import logging
from pathlib import Path
from typing import Any, Union
import torch
import flair.embeddings
import flair.nn
from flair.data import Sentence
from flair.file_utils import cached_path
log = logging.getLogger("flair")
class TextClassifier(flair.nn.DefaultClassifier[Sentence, Sentence]):
"""Text Clas... |
00855b80b6ded8dffe562f9988c202ef2be3475384ac4b15ba3cc66866d1a47e | Python | 5,055 | 97 | import os
import numpy as np
import pandas as pd
import nibabel as nib
from sklearn.linear_model import Ridge
from os.path import join as pjoin
from nilearn.glm.first_level import make_first_level_design_matrix
from had_utils import save2cifti
# define path
# make sure the dataset_path are modified based on your perso... |
53f717d2d114beeb304a11c395144147b60384d7513e2065980e062526252785 | Python | 5,055 | 137 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
b38da12a4186c9b1d8278e93399f323cda90647234a600825e0f14855e8f01d7 | Python | 5,056 | 133 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Python interface for running R codes of CAM pruning,
written by Zhuangyan Fang, Peking University
"""
import numpy as np
import rpy2.robjects as robjects
import rpy2.robjects.packages as rpackages
from rpy2.robjects.vectors import FloatVector, ListVector, IntVector
... |
e959e78fce369b8d5d83179c2a033c203b592e1e2adac45c3bfb983ba19ca589 | Python | 5,056 | 125 | import os
import os.path as osp
import logging
import yaml
from utils.util import OrderedYaml
Loader, Dumper = OrderedYaml()
def parse(opt_path, is_train=True):
with open(opt_path, mode='r') as f:
opt = yaml.load(f, Loader=Loader)
# export CUDA_VISIBLE_DEVICES
gpu_list = ','.join(str(x) for x in o... |
16e45c6639ff48e1cad07ab4d0f144fa5926b9bb27d2e17976b0870e36095e1e | Python | 5,058 | 130 | #!/usr/bin/env python3
#
# Perform regularized majority voting on the mid-sagittal section of the corpus
# callosum. This script is called from segcc.sh.
#
# Initial author: Gabrielle CONVERT (2022)
# Contributor: Yann LEPRINCE (2022, 2023)
#
# CC-parcellation-from-tractography © 2023 by Gabrielle Convert, Clara Fische... |
2c1fed9535bab91141d4771025038d8ce74739de37ee3b57d16de4d9dfa0cd4b | Python | 5,058 | 134 | """
@file: game_state.py
Last changed on 16.01.19
@project: crazy_ara_cleaning
@author: queensgambit and matuiss
File to group everything to recognize the game state
"""
import chess
## Variants Includes:
# 0 - "is960", board.chess960 = True (lichess: "Chess960")
# from chess import Board(chess960=True), CrazyhouseB... |
8dfb5733f92b007b211579d4da3292c99e5128a412aa3eee42c799ceeccd2931 | Python | 5,058 | 146 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 2 11:45:25 2020
@author: sam
"""
import os
import cv2
import numpy as np
import detectron2
from detectron2.config import get_cfg
from detectron2.engine import DefaultPredictor
from detectron2.utils.visualizer import Visualizer, ColorMode
from det... |
0f7bafaeb000d3a20548c8374ee125770353920852f35cf8c9ba778824511cf6 | Python | 5,059 | 114 | # ----------------------------------------------------------------------------
# Copyright (c) 2017-2026, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
4ebc25e0a089f3d4d936bf2f27bf285907b6fdfe6a104301d20fae9adbcd4325 | Python | 5,059 | 133 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import os
import tempfile
import numpy as np
import pytest
import onnx
import onnx.external_data_helper as ext_data
import onnx.helper
import onnx.model_container
import onnx.numpy_helper
def _linea... |
2bddc26a0024c9662679c685eef7da0574759501eedd4aba0513c7909f11c96d | Python | 5,061 | 140 | import torch
import torcheval.metrics as tm
from utils.func import print_msg
class Estimator():
def __init__(self, metrics, num_classes, criterion, thresholds=None):
self.criterion = criterion
self.num_classes = num_classes
self.thresholds = [-0.5 + i for i in range(num_classes)] if not th... |
be8124202b36daa57376f285c74da5d7bb19ea3ccaaa13546995118492db784f | Python | 5,063 | 114 | import torch
from torch import nn as nn
from torchvision import transforms as TF
from vp_suite.base import VPModel
class LSTM(VPModel):
r"""
This class implements a simple encoder-decoder-based video prediction architecture
which passes the vector-shaped encoded latents through several LSTM layers.
"... |
f98ca40d63da89f2ac77d59154096cfba50cf177dec82b9ade0afccae57ae732 | Python | 5,063 | 146 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 22 10:41:52 2021
@author: sudhanshu
Last update: 3/4/2023
Contains:
UNet model, and model_train method.
"""
import torch
import torch.nn as nn
from tqdm import tqdm
def model_train(loader, model, optimizer, loss_fn, scaler, DEVICE):
loop... |
c6247c4eb1c6e5fb2339ba6a32a7fec0e70f9164543dc479fda5a56b9474c52e | Python | 5,065 | 144 | """
Speed comparison between iterative spike-generation vs parallelized
William Nourse
August 24th, 2021
Hello Peter
"""
import numpy as np
import pickle
import time
import sys
"""
########################################################################################################################
ITERATIVE METHOD... |
0ec8cf5e9e62bff12c63e9d12277f1e685bd3faae64013f4f44a1e17390587ba | Python | 5,068 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt_na... |
b491158e1b3a7771125e100cd69e7a8f004b0c7a9826d3a6e0ab8daded023794 | Python | 5,068 | 159 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements adapter for pyts models."""
__all__ = ["_PytsAdapter"]
__author__ = ["fkiraly"]
from inspect import signature
from sktime.utils.adapters.forward import _clone_fitted_params
class _PytsAdapter:
"""Mixin adapter class for pyts ... |
0449122c733d304de0cfe4f07b4fc7caac7fb3550128b34843488954d4799d31 | Python | 5,072 | 142 | """
Filtering functions for protein data bank files.
These all are applied to individual atom dataframes, and remove entries from that dataframe as necessary.
"""
import pandas as pd
PDB_ENTRY_TYPE_FILE = 'atom3d/data/metadata/pdb_entry_type.txt'
RESOLUTION_FILE = 'atom3d/data/metadata/resolu.idx'
def form_size_fil... |
1392c7b9eb49813e02b75a287c6739c09e5574d7859c448eddf7a63d51773df4 | Python | 5,073 | 154 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
3a8dca1f23fc26ab3299ed5d3c0b91afa1cae8f1c586f88f4216e5668e641869 | Python | 5,074 | 162 | import pytest
import h5py
import pandas as pd
import numpy as np
import os.path
import scanpy as sc
from scipy.io import mmread, mmwrite
from scipy.sparse import csr_matrix, csc_matrix
from palantir.io import (
_clean_up,
from_csv,
from_mtx,
from_10x,
from_10x_HDF5,
from_fcs,
)
# Check if fcspa... |
04f9999653cef2e081d8072201840882d9090aa6e577397fff15593b6c808a04 | Python | 5,075 | 147 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
a95b77e11951a6c3b13e5dc613a499c43d2c23e91e578176b50c831433890912 | Python | 5,075 | 170 | import subprocess
from pathlib import Path
import string
from translation_tokenize import tokenize
from translate_common import source, translation, detokenize_transliteration, detokenize_translation
letter_substitutions = {
"ḫ": "h"
}
number_substitutions = {
"0": "₀", "1": "₁", "2": "₂", "3": "₃", "4": "₄",... |
400ac4291bf6460875c402aafc16171771fe49744184a61d637c0a487740f091 | Python | 5,076 | 116 | import os
import sys
import stat
from os.path import join as pjoin, exists as pexists, realpath
import numpy as np
import pickle
from neuropredict import run_workflow
from pyradigm import MLDataset
#---------------------------------
# CHANGE THESE FOR YOUR PROCESSING
#---------------------------------
base_dir = '/u... |
52a0bf0e4bab7e1bf9a3bd92d4a5b7e0daadd3dbc0166be6bc844c654010909a | Python | 5,078 | 130 | from __future__ import annotations
from functools import wraps
from inspect import Parameter
from inspect import signature
from typing import Any
from typing import TYPE_CHECKING
from typing import TypeVar
import warnings
from optuna._deprecated import _validate_two_version
from optuna._experimental import _validate_... |
6229ee784378b2885d95303c7983454c6aa427c3f5fc23ac3559cb98ca4fd64c | Python | 5,081 | 161 | import numpy as np
from tqdm import tqdm
import cv2
def Events2Frames(Events, GT, GT_ts, num_frames_per_ts):
H = GT.shape[2]
W = GT.shape[3]
Events_frames = np.zeros((GT_ts.shape[0]*num_frames_per_ts,2,H,W))
prev_ts = Events[:,2].min()
print('Cumulating spikes into frames...')
for t in tqd... |
29dcd5f2084a7157762088d2f414715534745e82e9a144573cc98674551a608f | Python | 5,090 | 148 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
37f91a9e1a53c2864d4d6fbd151b66a3e60c8b8bea8801a574d7311134fdf258 | Python | 5,091 | 145 | import numpy as np
import SimpleITK as sitk
from pathlib import Path
import pickle
def _validate_inputs(**kwargs):
"""Accepts arbitrary kwargs. If recognized, they are validated.
If they cannot be validated an exception is raised.
A dictionary containing the validated kwargs is returned."""
# Validate... |
516daf91c41dd704032aef040ac575f68b0bbde6b9d32241b1894784454a0b0f | Python | 5,093 | 132 | """Unit tests for all time series regressors."""
__author__ = ["mloning", "TonyBagnall", "fkiraly"]
import types
from contextlib import nullcontext
import numpy as np
import pandas as pd
import pytest
from sktime.datasets.base._base import InvalidSetError
from sktime.datatypes._check import check_is_mtype
from skt... |
6f50d9cea7d5ae06b25126e2c9a19a5f3fe63bf619c45190dc26e2fe89bfde3f | Python | 5,094 | 152 | # SPDX-License-Identifier: LGPL-3.0-or-later
import random
import unittest
from unittest.mock import (
patch,
)
from deepmd.dpmodel.model.base_model import (
BaseModel,
)
from deepmd.dpmodel.utils.update_sel import (
UpdateSel,
)
from ...seed import (
GLOBAL_SEED,
)
def update_sel(jdata):
type_m... |
7d407f7d01b3e6e1407775bf789f5a4da01fef3e4b65f86cdeafacc20e1ada8e | Python | 5,098 | 154 | # type: ignore
from collections import namedtuple
import torch
from torch import nn
from tests.fixtures.models import IdentityModel
class ReLUConvBN(nn.Module):
def __init__(self, C_in, C_out, kernel_size=1, stride=1, padding=0, affine=True):
super().__init__()
self.op = nn.Sequential(
... |
dab69466dacd893ae9102076ff33bc6d4d69c01a950ea79bb03702abac1d7c21 | Python | 5,103 | 161 | import torch
import math
import logging
from typing import List, Union, Tuple
ERROR_MSG = "A physical value of beta must be between -1 and 1 (exclusive)."
def boost(
beta: float, dir: Union[str, torch.Tensor, Tuple[int], List[int]] = "z"
) -> torch.Tensor:
"""
Get the boost matrix for a given rapidity :m... |
6d69498ab783db93f13cc0c2472152b3817cc9628566fd0232a035556e0ddfea | Python | 5,104 | 149 | # Copyright 2022 DeepMind Technologies Limited
#
# 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 agr... |
7df8d00bc195670664e66615467a74905d3609a964aa89d36717968fc9c4e0d0 | Python | 5,104 | 144 | import sys
import numpy as np
import nengo
import time
import pickle
from sns_toolbox.neurons import NonSpikingNeuron
from sns_toolbox.connections import NonSpikingSynapse
from sns_toolbox.networks import Network
# Personal stuff to send an email once data collection is finished
sys.path.extend(['/home/will'])
from e... |
90a57efa178903d87e74e956ae4446f861108b9381c4da11a723d4c806d6d1ad | Python | 5,107 | 126 | from mprl.rl.common.custom_evals_trainer_mixin import perform_relevant_custom_evals, CustomEvaluationsTrainerMixin
from mprl.rl.common.weights_utils_trainer_mixin import WeightsUtilsTrainerMixin
from ray.rllib.agents.ppo.ppo import PPOTrainer, update_kl, validate_config, DEFAULT_CONFIG
from ray.rllib.agents.trainer imp... |
b0952e53f9d45fb48814f5449560f1bc5a8fc34259c8204944b6c7ded73eaf73 | Python | 5,107 | 137 | """
Internal note:
This if from T7 recovery file of figure-5-for-pip
"""
import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as mpl
from tqdm import tqdm
# Plotting
import sciplotlib.polish as splpolish
import sciplotlib.style as splsty... |
b6caf30234ee8482373e0d0704a556299d007139ed6dd3a9179be9d2f5ec7f6d | Python | 5,107 | 112 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
94470403802ed476a87d71f2571b307a303095697aea92fb8e6a669d60d51c00 | Python | 5,108 | 150 | import random
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import numpy as np
import torch
from gpytGPE.gpe import GPEmul
from Historia.history import hm
from Historia.shared.design_utils import get_minmax, lhd, read_labels
from Historia.shared.plot_utils import get_col, interp_col
SEED = 8
def plot... |
1c215464c790c41667100680361e8382d0326e8fe500395d0278f0cbe6928449 | Python | 5,111 | 142 | """
Compare the simulation speed of the different backends
William Nourse
September 9 2021
The correct term is Babes, sir
"""
import numpy as np
import nengo
import time
import pickle
from sns_toolbox.neurons import SpikingNeuron
from sns_toolbox.connections import SpikingSynapse
from sns_toolbox.networks import Netw... |
af5861230e289e922aeee9d0826de70ad894e5a2496e64a0c4f1f2f30e0cbb0f | Python | 5,111 | 179 | # coding=utf-8
# Copyright (C) 2022. Huawei Technologies Co., Ltd. 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
#
# ... |
d2ded415b596f8242e016ea75f90c13093a9c4310dc0048ddb28ca07441362f0 | Python | 5,111 | 126 | # Copyright 2018-2025
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... |
244114af0339fd26ab59e689d52595ade6e23866f586682424af0bc5b64a3983 | Python | 5,114 | 148 | import pdb
import os
import numpy as np
from sklearn.metrics import roc_curve
import torch.nn as nn
import torch
from torch.utils.data import DataLoader
from torch.nn import functional
from cls_TIS_dataset import TISDataset
from cls_TIS_model import TISRoverPlus
def simple_test_run(model, data_loader,... |
bef51dead5e21dfd419959b8e4290dea0b0148af871ed9030c5c2828f961615c | Python | 5,114 | 148 | import os
import cv2
import numpy as np
import torch
import torch.utils.data
import torchvision.transforms as transforms
import albumentations as A
from albumentations.core.composition import Compose, OneOf
import random
from matplotlib import pyplot as plt
from PIL import Image
#https://albumentations.ai/docs/example... |
a37e2c31b4ca5be6e468c53f8ec1e456fd82311d1f97bf3f688ea308d6a09b78 | Python | 5,116 | 173 | # BASILISK: A generative, probabilistic model of side chains in proteins
#
# Copyright (C) 2010 Tim Harder and Jes Frellsen
#
# BASILISK 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 ... |
455d048245d79708c9c2e3ee694b2d1c828f0e38145f640b9f583a1ba0b5c3cb | Python | 5,120 | 132 | import logging
import numpy as np
import networkx as nx
class SyntheticDataset(object):
"""
Referred from:
- - https://github.com/xunzheng/notears/blob/master/notears/utils.py
"""
_logger = logging.getLogger(__name__)
def __init__(self, n, d, graph_type, degree, sem_type, noise_scale=1.0,
... |
6afd4ff1eec7740fa80d38a31c1344a032fa5c5a23484bdb7733f0e4a937cdf9 | Python | 5,121 | 117 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt_na... |
f4f8a7175615bb762dd9659475ba507abc9fe67a89fc8488a20e4db05a985df9 | Python | 5,121 | 125 | """
@file: minimax_agent.py
Created on 24.03.19
@project: CrazyAra
@author: queensgambit
Classical negamax search with alpha beta pruning.
For more details see: https://en.wikipedia.org/wiki/Negamax
"""
import math
import logging
import copy
from time import time
import numpy as np
from DeepCrazyhouse.src.domain.abs... |
b26c6f399ae2211774369d7e7e6af82d847913a4b6d52e969269dc9cae17c58b | Python | 5,124 | 191 | #!/usr/bin/env python
# coding: utf-8
import pytest
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
from scipy import sparse
from time import time
from fnnls.fnnls import fnnls
class nnls_comparison():
def __init__(self):
return
def test(self, repetitions, dimensio... |
36a28be7a74f86d063ac4e1f9be7f5fccbc7b88531cf7d59fcc03bdb7973da3c | Python | 5,127 | 154 | """Time series kshapes."""
import numpy as np
from numpy.random import RandomState
from sktime.base.adapters._tslearn import _TslearnAdapter
from sktime.clustering.base import BaseClusterer
class TimeSeriesKShapes(_TslearnAdapter, BaseClusterer):
"""K-shape clustering for time series, from tslearn.
Direct ... |
ddbf2f8b7566aaf67ef3b4c2e8aee52c327683e717f6011438d69c17172ff54b | Python | 5,128 | 136 | import os
import ase
import networkx as nx
from ase import io
DOS_PATH = os.path.abspath("../dockonsurf/dockonsurf.py")
def connectivity_analysis(graph: nx.Graph) -> list:
"""This function will return a list with the number of connections for each atom in the molecule.
Parameters
----------
graph ... |
cc3608ca78b21017dd82e8855ed6e9a629a81512588d76f758aae555111ee0f2 | Python | 5,129 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt_na... |
e045f6527ef275855a6e92680ba0d7137bbfeea78dcd3fd9bee568a1aaadba93 | Python | 5,129 | 180 | # Copyright (c) OpenMMLab. All rights reserved.
from collections.abc import Sequence
import mmcv
import numpy as np
import torch
from mmcv.parallel import DataContainer as DC
from PIL import Image
from ..builder import PIPELINES
def to_tensor(data):
"""Convert objects of various python types to :obj:`torch.Tens... |
153d9ada91304f3ad7c1b9dd65cabfd0a2e30f83bde23f67947175752019e249 | Python | 5,130 | 118 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt_na... |
60f2c856f696fec6a7aa92f79b48df53909517d550534ce51afdc5ff0ce32a44 | Python | 5,134 | 140 | from __future__ import print_function
from freqAnalysisTools import band
import sys
import pickle
from os import listdir
from os.path import isfile, join, splitext
import numpy as np
import random
# from sklearn import linear_model, svm, ensemble, neural_network
from sklearn import linear_model
from sklearn.metrics imp... |
a98bf3fca890f0df6a28c674902b55b9510a5cef3ee47583164933d504f4fa1d | Python | 5,138 | 139 | #!/usr/bin/env python3
"""One-time migration of the docs gh-pages branch to a versioned layout.
The migration moves the Julia (Documenter.jl) site from ``dev/`` to ``0.7.1/``,
registers it in mike's ``versions.json`` as ``0.7.1 (Julia)``, and replaces
every ``dev/**.html`` page with a redirect stub to the same page un... |
fbedfd014195f03a6c26d57816637e2972caf78812097c504c650c2cbf66a929 | Python | 5,139 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import DeepSTARR
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt... |
ca0d3eba21783d0d8ada7612a19e98e969a68d5db14ac829f326b1272583fcb2 | Python | 5,142 | 138 | #!/usr/bin/env python3
#
# (C) Copyright 2015 Frankfurt Institute for Advanced Studies
# (C) Copyright 2016 Max-Planck Institute for Brain Research
#
# Author: Philipp Huelsdunk <huelsdunk@fias.uni-frankfurt.de>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... |
f9e2340f55082a52f7a41452417379783d59f05a26176ae34364ca214ccc45f4 | Python | 5,142 | 138 | """
1. Theta oscillation cycle feature distributions
================================================
Compute and compare the distributions of bycycle features for two recordings.
"""
####################################################################################################
import numpy as np
import matplo... |
f79e54b09e06183f717330f28165816da22b747f86ca80f65fbe86148a1ce2aa | Python | 5,143 | 148 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import os
import ray
from ray.rllib.utils import try_import_tf
from ray.tune.experiment import DEFAULT_RESULTS_DIR
from mprl.utility_services.cloud_storage import connect_storage_client, upload... |
f8e79be091c342253b6423d7b1b756d1bda0e12e0049182a82f124dbcacb6138 | Python | 5,143 | 163 | """Plotting utilities for ParaDime.
The :mod:`paradime.utils.plotting` module implements plotting functions and
color palette retrieval.
"""
from typing import Any, Optional, Union, TYPE_CHECKING
if TYPE_CHECKING:
import matplotlib.colors
import matplotlib.axes
import numpy as np
from paradime.types import ... |
fb2a729bce3af80bd9233a2b5f772b5e66af5e0724a047ceb4d56d9ec2e2a968 | Python | 5,144 | 113 | # This is a _very simple_ example of a web service that recognizes faces in uploaded images.
# Upload an image file and it will check if the image contains a picture of Barack Obama.
# The result is returned as json. For example:
#
# $ curl -XPOST -F "file=@obama2.jpg" http://127.0.0.1:5001
#
# Returns:
#
# {
# "face_... |
6a7703c10fd87a388b693ae41410ebfbb7cdd31114180a0091eb23bdb448a209 | Python | 5,149 | 165 | from jetnet.datasets import JetNet, normalisations
import numpy as np
import pytest
from pytest import approx
from torch.utils.data import DataLoader
# TODO: use checksum for downloaded files
data_dir = "./datasets/jetnet"
DataClass = JetNet
jet_types = ["g", "q"] # faster testing than using full dataset
gq_leng... |
97f3a15cddfef4d69da2fa8112ecc44a404fbe9aa19f09a57eda18bde8b7ec80 | Python | 5,149 | 119 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug, augment
sys.path.append('../../evoaug_analysis')
import utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt_na... |
18efad0347b2e899198bb12605d9891a6db8eeacd682aa10cd182a8b62cbbee0 | Python | 5,151 | 160 | import argparse
import logging
from pathlib import Path
from typing import Union
import jetnet
import numpy as np
import torch
NUM_DEV_INSTANCES = 50
POLAR_REL = ('polarrel', 'polar_rel')
POLAR_ABS = ('polar', 'polarabs', 'polar_abs')
CARTESIAN = ('cartesian', 'cart')
def prepare(
jet_type: str,
save_dir: Un... |
a6ef9b87aa444b0a7391930465b43a8d5c8fcbaa04786c19c206deea8b3baf39 | Python | 5,151 | 171 | """
lims.py
Some functions for lims interaction.
"""
import urllib2
import json
import urlparse
import platform
import os
import pprint
import datetime
class LimsInterface(object):
""" A lims connection providing donor and behavior info. """
def __init__(self, base_url="http://lims2"):
super(LimsIn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.