sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b5c74d63bbd6b3bbf42b1af04a335288f214e285fe8dba52fd3d020f797519b0 | Python | 4,652 | 135 | # 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... |
13b2970319e87a60d49d05a1b6e641bf36bbd5beb75cc9197595a7730b620b85 | Python | 4,654 | 166 | """Tests functions for the Bycycle class - bycycle.objs.fit."""
from inspect import ismethod
import pytest
import pandas as pd
import numpy as np
from bycycle.tests.tutils import plot_test
from bycycle.objs.fit import Bycycle, BycycleGroup, BycycleBase
#############################################################... |
c045d3883d9e32e3920943b896ca7ce4ed01f57d494fa89ac43e1fd0dbcb7b6f | Python | 4,654 | 131 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 19 14:18:11 2019
@author: daniel
"""
from neuron import h
import parameters as p
class Spine():
"""
Spine class. Create a spine with neck and head.
Based on Mattioni and Le Novere, (2013).
https://senselab.med.yale.edu/ModelDB/ShowModel.cshtml?model=15028... |
1224dc095d0d9235216f241c2bd267c5fb54dffcd7fe5d5417850c88e9ad66f5 | Python | 4,657 | 160 | import argparse
import os
from rxnebm.data.preprocess import clean_smiles, prep_crem, prep_nmslib, smi_to_fp
def parse_args():
"""This is directly copied from trainEBM.py"""
parser = argparse.ArgumentParser("trainEBM.py")
parser.add_argument(
"--train_from_scratch",
help="Whether to train ... |
fc135cb6e860917e868cd2f371917e66e3f3abddbe5d0f92dbd1f0862e2ce7e1 | Python | 4,657 | 115 | 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... |
4fd9a473c946aa315163cf3e1cc854a55c4bc96499a1ab71f7ab70e04a6e0728 | Python | 4,658 | 161 | """Tests for feature importance in time series forests."""
from unittest.mock import MagicMock, patch
import numpy as np
import pandas as pd
import pytest
from sktime.classification.interval_based import TimeSeriesForestClassifier
from sktime.tests.test_switch import run_test_for_class
from sktime.utils._testing.pan... |
024218b5bf685a87052be887d7ab61e63e6a43a1547a75e0922ded22a124eb36 | Python | 4,663 | 139 | dlpfc_config = {
"train_batch_size": 512,
"finetune_batch_size": 512,
"transfer_batch_size": 512,
"train_epochs": 50,
"finetune_epochs": 20,
"transfer_epochs": 2,
"train_task": "supervised_group_identification",
"finetune_task": "cross_model_prediction_clas",
"transfer_task": "superv... |
063bd99f88b78a7329f91c14e7bcd55e1b26a98da29020128acb13cc495a6442 | Python | 4,663 | 115 | """AA_TransUNet.py"""
"""
Ref: https://github.com/The-AI-Summer/self-attention-cv
Author: Yimin Yang
Last revision date: Jan 18, 2022
Function: Built AA_TransUNet
"""
from einops import rearrange
from bottleneck import *
from Precipitation_Forecasting.precipitation_lightning_base import Precip_regression_base
from en... |
374ecf86e748b2b19995b1166ca1c74d7ff106cb226450cf04719427916684c3 | Python | 4,666 | 139 | import logging
import os
import tempfile
from pathlib import Path
from typing import Optional
from flair.datasets.biomedical import (
CoNLLWriter,
Entity,
InternalBioNerDataset,
filter_nested_entities,
)
from flair.splitter import NoSentenceSplitter, SentenceSplitter
from flair.tokenization import Spac... |
672e862745deda86308b98324e340789b8c351985367a18aa8f197ca4fdf4d42 | Python | 4,670 | 132 | #
# # Netplotbrain with network based statistics
#
# [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/nbs.ipynb)
#
# ## Plotting significant results from network based statistics
# Netplotbrain aims to try and integrate with other tools, minimizing the wo... |
85d2082f47b7e3e47e6bf8915e54984e4571f3cde63cb9c18b4f750863dc0558 | Python | 4,672 | 126 | from copy import deepcopy
import sys, os
import torch
import numpy as np
from vp_suite.models import EF_ConvLSTM as OurEF_ConvLSTM
from vp_suite.utils.models import state_dicts_equal
REFERENCE_GIT_URL = "https://github.com/Hzzone/Precipitation-Nowcasting.git"
REPO_DIR = "Precipitation-Nowcasting"
# noinspection Py... |
5450e63b4b4dc1fe055d702fd7929044b1e7a9421ea40aa1632b24427ff1abc5 | Python | 4,673 | 148 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 12 16:22:41 2022
Big simulation: short version of shj-multiunit.py - to run SHJ with many
units (hippocampus scale) and save results
@author: robert.mok
"""
import os
import sys
import torch
# import matplotlib.pyplot as plt
import pickle
locatio... |
15749895bd71e37b080c10d763093896001dd40d870eb27ec34607fed881c646 | Python | 4,678 | 166 | import torch
from torch.nn import Parameter
from lgn.g_lib import g_tensor, g_tau, parameter_dict_new
GTau = g_tau.GTau
GTensor = g_tensor.GTensor
ParameterDictNew = parameter_dict_new.ParameterDictNew
class GWeight(GTensor):
"""
Core class for creating and tracking G Weights that
are used to part-wise m... |
37bcb3a150656e4e9f02597148307098ef6679b3963492e02ace51ebab830677 | Python | 4,678 | 104 | import os
import glob
import dxpy
import dx_utils
BIONANO_ROOT = '/Solve3.4_06042019a/'
SCRIPTS_DIR = os.path.join(BIONANO_ROOT, 'PIPELINE', 'Pipeline')
HYBRID_DIR = os.path.join(BIONANO_ROOT, 'HybridScaffold', '06042019')
TOOLS_DIR = os.path.join(BIONANO_ROOT, 'RefAligner', '8949.9232rel')
os.environ['PATH'] = HY... |
849c8ce8a4a6523269634adc3bfd686233a4a081a685bed0122af332598dc67f | Python | 4,678 | 161 |
# To build and upload a new version, follow the steps below.
# Notes:
# - this is a "Universal Wheels" package that is pure Python and supports both Python2 and Python3
# - Twine is a secure PyPi upload package
# - Make sure you have bumped the version! at ts/version.py
# $ pip install twine
# $ pip install wheel
# $... |
f5141432b47ce82789416eca1d3c7ec6469599047db8fe4aa7ea35c2babce88c | Python | 4,680 | 123 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Keep graph orchestration separate from descriptor preparation semantics."""
import copy
import unittest
from unittest.mock import (
call,
patch,
)
from deepmd.dpmodel.descriptor.base_descriptor import (
BaseDescriptor,
)
from deepmd.dpmodel.model.base_model ... |
3a79d3ba1a6bcb9c886558c5183a749611362b3d78b29ae4adfc694cc20f3402 | Python | 4,681 | 131 | import math
import asyncio
from time import time, sleep
from functools import wraps
from concurrent.futures import ThreadPoolExecutor
import nest_asyncio
from .utils_fast import chunk_list, log
def async_getter(function, listOfArgs):
async def future_loop(future_):
loop = asyncio.get_event_loop()
... |
0853b5f889e64d071d3dbeca84a6007325265879fa3fa71d980fd263008ac087 | Python | 4,686 | 143 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: johannvk, Tveten
"""Multivariate Gaussian likelihood cost."""
__author__ = ["johannvk", "Tveten"]
import numpy as np
from sktime.detection._utils import (
CovType,
MeanType,
ch... |
4efa29c70fb22e2f5104087261427b794f90040005469a70bfcdb11ff7b47668 | Python | 4,688 | 179 | import sys
sys.path.append("../../")
import copy
import numpy as np
import torch
import sklearn.datasets
import sklearn.decomposition
from matplotlib import pyplot as plt
import pandas as pd
import seaborn as sns
import paradime.dr
import paradime.relations
import paradime.transforms
import paradime.loss
import par... |
da5722cbbeda7ff6cd48da777abb528b026f548e7c2dcc092d12b45294e443b8 | Python | 4,689 | 117 | import sys
from functools import reduce
from os.path import splitext
import pickle
import numpy as np
from parameterSetup import ParameterSetup
from evaluationCriteria import labels2ID, getEpisodeLengths
from sequentialPrediction import classifySequentially
from writePredictionResults import writePredictionResults
from... |
3f7a73fdc824a948c81cb94fef832353646807a7830c1102f62015324f1f3181 | Python | 4,692 | 111 | #-------------------------------------------------------------------------------
# elftools example: dwarf_decode_address.py
#
# Decode an address in an ELF file to find out which function it belongs to
# and from which filename/line it comes in the original source file.
#
# Eli Bendersky (eliben@gmail.com)
# This code... |
93fe78098c7d96a92be5d0611489d992db131a1f3458d20442d649e2013d1be3 | Python | 4,694 | 133 | # 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... |
a96f26a0f51e7f29f96953615b748b992e8818b4f4937d4bb80db6a99542bf07 | Python | 4,694 | 108 | """
Parameters:
---------
pial surface mesh: {h}.pial.ply
alpha surface mesh: {h}.alpha.ply
Returns:
-------
major sulcal depth: {h}.sulc.asc
shrunken sulcal depth: {h}.sulc.shrink.asc
"""
def sulcal_depth(subjects_dir, subject, hemi):
import numpy as np
import scipy
import scipy.spatial
... |
d227a5f3d823be3f246c00af194d2264d8a1c0eadaa774026143238621b2be3e | Python | 4,696 | 139 | import logging
import shutil
import qt
import vtk
import abc
import os
from typing import Callable
import slicer
from pathlib import Path
from ElastixLib.preset import Preset, UserPreset, createPreset
class ElastixDatabase(abc.ABC):
@property
def logCallback(self):
return self._logCallback
@logCallbac... |
3797815c09a56ad5b88152b754edd0f635e34898e649dc6b2bf31feba81e85ce | Python | 4,697 | 122 | # 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... |
125dd0d7bb8a5719f877b8b6abd47da3c88cd2ec76eb980a3098f19cb71d3b13 | Python | 4,699 | 80 | import toolshed
import collections
import hashlib
slivar_found = collections.defaultdict(list)
# first file is tsv from slivar
for d in toolshed.reader(1):
slivar_found[d["sample_id"]].append(d["chr:pos:ref:alt"])
shared_affected = 0
shared_affected_solved = 0
exact_match = 0
sv_del = 0
oocyte = 0
indel_plus_sv... |
369fdf82743875996275b8f384252943527a5e8a5474d554f9adb7335aeae09b | Python | 4,700 | 156 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2023 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#
"""Interface with the `b... |
ab3ab92d2d8df648103ce1b6bd1c947e50ec89a43bb6371cc14e7f31daa095be | Python | 4,701 | 149 | # Copyright 2019-2020 The ASReview Authors. 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... |
c4e5117a0ad3c05ca4a54dcf1987d688a249cafbb40ea8d55c6db53fbc77296f | Python | 4,703 | 149 | from typing import Dict
import torch
import torch.nn as nn
from torch.nn.modules.batchnorm import BatchNorm2d
from torchaudio.transforms import Spectrogram, MelSpectrogram, AmplitudeToDB, MFCC
from torchlibrosa.augmentation import SpecAugmentation
from .Cnn10Att import Cnn10Att
from utils.arguments import AudioArgume... |
7ad71d1a4f5267a8a0648494d2603a4cb3be5604ea8307153b7059fe09a2bbb3 | Python | 4,709 | 137 | """Find zero-crossings for individual cycles."""
from operator import gt, lt
import numpy as np
###################################################################################################
###################################################################################################
def find_zerox(sig, ... |
9f933ac843e664b52225e1c1b07726e93af5d40e831888ab0a3578880f82ae9f | Python | 4,710 | 149 | # 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... |
03d38c4c1e4828fc73ee36a6c9e519649dc5173909552177d82a8e55bf9fbf54 | Python | 4,712 | 148 | import torch
from numpy import pi
# Hack to avoid circular imports
from lgn.g_lib import g_tau, g_tensor
from lgn.g_lib import rotations as rot
GTau = g_tau.GTau
GTensor = g_tensor.GTensor
class GWignerD(GTensor):
"""
Core class for creating and tracking WignerD matrices.
At the core of each `GWignerD`... |
24d046b3d11c2c230b0b72573ef408a226d2ba8329a27589701eb6738ad6ee0f | Python | 4,714 | 117 | import numbers
import numpy as np
class MockStreamData:
"""Mock StreamData class for tests.
Defines the same attributes as StreamData with basic data
validation, and tries to ensure convenient defaults so that only
arguments required for a specific test need to be provided.
Args:
stream_i... |
30cf42b7327313d405ebd2c87f9db3ae51a95393c4d7b073763512d5e4da42a8 | Python | 4,714 | 120 | import collections as col
import numpy as np
import pandas as pd
import logging
import os
import sys
import click
import atom3d.datasets.datasets as da
import atom3d.splits.splits as spl
import atom3d.util.file as fi
import atom3d.util.formats as fo
import util
logger = logging.getLogger(__name__)
class Scores(obj... |
91ef4e88a6ceee04adb08d8b0f3a1b8383022f19dd74da94c01f99f50b871e45 | Python | 4,714 | 129 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class CumProd(Base):
@staticmethod
def export_cumprod_1d() -> None:
... |
3a1052383113fa18ce553adca22c3f8029b4bf38098e79d722909bf904acd549 | Python | 4,715 | 144 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import ml_dtypes
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def einsum_reference_implementation(
Eqn: str, Operands... |
b1a8afa2c4f1a69c831143ec41e66ee609d795b4c29be38984923c55daaafb33 | Python | 4,716 | 161 | import pandas as pd
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import MinMaxScaler
import CRISPRspec_CRISPRoff_pipeline as pipe
import pickle
def prepare_pretrain_data(config):
co... |
9ff92aa4dc18bb44bba48f99ebf1eb0edfd917e8433959d50424f55aed8e2321 | Python | 4,717 | 141 | """ Used as a master args reader for scripts that read, add, and update Interlex data through its API
Usage: foo.py [-h | --help]
foo.py [-v | --version]
foo.py [-k API_KEY] [-d DB_URL] [-p | -b]
foo.py [-k API_KEY] [-d DB_URL] [-p | -b] [-o OUTPUT]
foo.py [-f FILE] [-k API_KEY] [-d DB... |
e3d56792ecd5901d80663ef29c8c2d9f58fc74268b779c78306c90022e0a09b4 | Python | 4,718 | 107 | from sns_toolbox.connections import NonSpikingPatternConnection
from sns_toolbox.networks import Network
from sns_toolbox.neurons import NonSpikingNeuron
import sns_toolbox.backends as backends
import numpy as np
import cv2 as cv
import sys
import time
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
a43cdf440d8263f81702386c2ffd8ff62631243eafa6bc7d20b98c039439a7e0 | Python | 4,719 | 172 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 28 11:23:00 2016
@author: wanglab
"""
import os, numpy as np, cv2, zipfile
# Copyright: Luis Pedro Coelho <luis@luispedro.org>, 2012
# Tim D. Smith <git@tim-smith.us>, 2015
# License: MIT
from io import BytesIO
import zipfile
import nu... |
ab5f6997bcdb4ba654a3fdcefbccf760a4f0bf2713e92a6c9c65a59ff403327a | Python | 4,720 | 135 | """
@file: train_config.py
Created on 01.11.19
@project: CrazyAra
@author: queensgambit
Training configuration file
"""
from dataclasses import dataclass
@dataclass
class TrainConfig:
"""Class which stores all training configuration"""
# div factor is a constant which can be used to reduce the batch size an... |
b7367c82fe495eb16acddff0487aa737db8648553cc8f234dd047e36de77cbd0 | Python | 4,720 | 152 | from argparse import Namespace
import argparse
from pathlib import Path
import torch
import os.path as osp
from utils.utils import get_model_folder, get_best_epoch
from utils.argparse_utils import (
parse_data_settings,
parse_eval_settings,
parse_model_settings,
parse_training_settings,
)
from utils.ini... |
6062e8e44c43bb04e11e3073cd6f673c1cb13878c5f4b1693b0b2bc734b83194 | Python | 4,721 | 129 | # 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... |
22977aaac4570fb9d71238b37392481ce082e2d37bc150acc71bb65df66b0058 | Python | 4,723 | 121 | # Copyright 2023 The TensorFlow Authors. 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 applica... |
836a59d86f9523862f0110fd30c0d220718394711302da299e55e96f0fb05a71 | Python | 4,724 | 136 | import torch
import torch.nn as nn
class MaskLevel(nn.Module):
"""
Mask level for implementing hard and soft cutoffs. With the current
architecutre, we have all-to-all communication.
This mask takes relative position vectors p_{ij} = p_i - p_j
and implements either a hard cutoff, a soft cutoff, ... |
1015db02519ed3e10396c95d401afbb123567cb3086b73fb620262cfb7522d5d | Python | 4,725 | 137 | import torch
import torch.nn as nn
class MaskLevel(nn.Module):
"""
Mask level for implementing hard and soft cutoffs. With the current
architecutre, we have all-to-all communication.
This mask takes relative position vectors p_{ij} = p_i - p_j
and implements either a hard cutoff, a soft cutoff, ... |
8048bc68db28da719923b139d9c24fc79b0b904e797dbe26f4c22f063e4e47a9 | Python | 4,727 | 129 | """Simplified split-apply-combine paradigm on dataframes for internal use."""
from __future__ import annotations
from typing import cast, Iterable
import pandas as pd
from seaborn._core.rules import categorical_order
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Callable
from pandas ... |
2816ff7b64c40d8541705f890ebf01930bbf63c0f9ad3ee6df1ef0885fb579de | Python | 4,728 | 96 | #!/Users/ssg/.pyenv/shims/python
# -*- coding: utf-8 -*-
import sys
import time
from os import listdir
from os.path import split, splitext, isfile
from parameterSetup import ParameterSetup
from classifierClient import ClassifierClient
from eegFileReaderServer import EEGFileReaderServer
from fileManagement import select... |
242a79b67828efcff8b9c9c158aeb105ca3df5c3a7640b538a21cd1ebad2465c | Python | 4,732 | 135 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
from collections import OrderedDict
import torch
def convert_conv1(model_key, model_weight, state_dict, converted_names):
if model_key.find('features.0.0') >= 0:
new_key = model_key.replace('features.0.0', 'backbone.conv1.conv')
else:
... |
9754209e7aaacd8cf1ce77adbfff876af376b81c3801fd55e7eb88dae3a0a2a7 | Python | 4,732 | 137 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
def _batchnorm_test_mode(x, s, bias, mean, var, epsilon=1e-5):
dims_x = ... |
4582a96d8acec42a1cda7e70513fb52fa07ac3d38b8347d8293861aa9699a713 | Python | 4,734 | 95 | import warnings
from typing import Union
from torch import nn as nn
from torchvision import transforms as TF
from vp_suite.utils.models import ScaleToModel, ScaleToTest
from vp_suite.base import VPModel, VPDataset
from vp_suite.utils.dataset_wrapper import VPDatasetWrapper
def check_model_and_data_compat(model: VPMo... |
8de77e60e91f108f22c371ec3544c8483d4a509aa350914e83cf15139e0f88da | Python | 4,738 | 158 | '''
crossovers.py
@author: Nicholas Browning
'''
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from builtins import range
from past.utils import old_div
import numpy as np
import copy
from . import Individual
def mutate(settings, individuals, mutator_op,... |
2f1ce063e505b5115d98439a9ded8956e214b3ad8501c711cd8986379f39918d | Python | 4,739 | 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... |
bd1a16fb31f3d532b2493e4d184fb0b3a20f3c9f20e853ecf87cb46b97ecd619 | Python | 4,740 | 124 | # Copyright 2019-2021 The ASReview Authors. 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... |
23503ff2fdd4f5b4362973b96ec6d257fe299c7a556c0e2e2733823418372ae3 | Python | 4,742 | 99 | #-------------------------------------------------------------------------------
# elftools example: dwarf_location_info.py
#
# Examine DIE entries which have either location list values or location
# expression values and decode that information.
#
# Location information can either be completely contained within a DIE... |
17cd68a3fe8a979753f38296b605653b63e145d059090da857b009cda9e02121 | Python | 4,744 | 119 | # -*- coding: utf-8 -*-
from __future__ import print_function
import click
import os
import re
import face_recognition.api as face_recognition
import multiprocessing
import itertools
import sys
import PIL.Image
import numpy as np
def scan_known_people(known_people_folder):
known_names = []
known_face_encoding... |
4a46e19573e7715aa86f6c344df14b128b489da56e199fbf95d33c63dc77a670 | Python | 4,747 | 121 | # 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... |
94b069669acd24653e61f5405e89bdfef233f200d5c2cd95deec9fd8994b14eb | Python | 4,747 | 121 | #!/usr/bin/env python3
"""Prepare matched Illumina/PacBio colorectal cancer cells."""
from __future__ import annotations
import argparse
import re
import sys
from pathlib import Path
import anndata as ad
import numpy as np
import pandas as pd
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
from... |
ed61cef2d95d1e181b6c114a87408c2836c523574ac0046c1fc29ec0be124532 | Python | 4,747 | 134 | from __future__ import print_function
import numpy as np
import pyqtgraph as pg
from neuron import h
import cnmodel.util as util
from cnmodel.protocols import Protocol
from cnmodel.util import custom_init
from cnmodel.util import sound
class PopulationTest(Protocol):
def reset(self):
super(PopulationTest... |
bf5057b9508f10a833a66fe550963bc28150f9603d1e39b89a6881cac534796a | Python | 4,748 | 141 | import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
MODE = 'CRISPRON'
def main():
# get all folders in the current directory
folders = [f for f in os.listdir('.') if os.path.isdir(f)]
results_of_all_folders = []
for folder in folders:
if MODE == 'DEEPHF':
... |
0bff973db67d29a91b51cf5bc3a3356b557be86069cb3d91abcf8104efd66974 | Python | 4,749 | 121 | import os
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.nn.parallel import DataParallel,DistributedDataParallel
class BaseModel():
def __init__(self, opt):
self.opt = opt
self.device = torch.device('cuda' if opt['gpu_ids'] is not None else 'cpu')
print("... |
a30355bfdf33248a0e6a30b93554a744c82f34a9c64e3a9a668fe8944959a697 | Python | 4,750 | 114 | # 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... |
27b06e8ac3ee56ad108b1c3c5ff632ee72a718c0e3a10784c06afb7fd2c63550 | Python | 4,752 | 151 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 29 15:50:17 2020
@author: sam
"""
import os
import subprocess
import time
import numpy as np
import json
import scipy.io
import pandas as pd
def submit_job(job_args, slurm_args=None, mpicmd='srun', \
max_queued=None, wait_time=None, debug=Fals... |
0917c8a6677c837c3183c6f2018af8299999d64ca952ad40e9159d682b220b27 | Python | 4,753 | 126 | # 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... |
1fcb7f450601be172b297a3dc8b6ef9fd2170e099b85c5a44ab0f88c36d7d135 | Python | 4,753 | 143 | # Copyright 2023 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... |
632fab05ba0df4a03deeed18ab0eda8f9761de910ee9c18931c9efff41ab06e6 | Python | 4,753 | 139 | import numpy as np
from scipy import linalg
from matplotlib import pyplot as plt
from nlgc.opt.e_step import sskf
from nlgc.opt.m_step import solve_for_a, solve_for_q, calculate_ss, compute_ll
from nlgc.opt.opt import NeuraLVAR, NeuraLVARCV
def generate_processes(seed=0):
np.random.seed(seed)
# n, m, p, k = 1... |
387ce9a5e853f61a9f3b6084cd6eb0d690a5b189ce2e946a2a1fba309e06dc19 | Python | 4,754 | 200 | import numpy as np
import h5py
from sklearn.preprocessing import StandardScaler
from scipy import signal as sig
from pathlib import Path
from net import RNN
from net import CNN
# LOADING
def check_load(p="project_datasets/"):
return Path(p+"pre_data.mat").exists()
def save_pre_processed(X, y, Xval, yval, Xtest,... |
f967ce11fcec4605327bdba883c6db1caf67924622f7da57e941c6ae0e9d5cf8 | Python | 4,756 | 144 | # Copyright 2019 The TensorFlow Authors. 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 applica... |
911c39b571571cdebdc87ce20dfcd4b3755e3ebfbdd93c1be7be7427dc28f0f9 | Python | 4,759 | 142 | import glob
import os
import shutil
import autokeras as ak
import numpy as np
import tensorflow as tf
from callbacks import create_callbacks
from layers import MSEWeighted
from networks import NAS_automodel as model
class Trainer:
def __init__(
self,
save_model_path,
auto_model_params,
... |
a3c0627f71107e07f4670677384c1f1b584af0b6593bfad00308b50dc6649822 | Python | 4,759 | 122 | # 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... |
53bb77378b2b0859705e0a64ae8bab58d1207163f0ce9e786116007ac27cda47 | Python | 4,761 | 104 | # 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... |
c010cf618b32d33569e6e845145d989e9cabf17435787d27d236519cdcd1f3ba | Python | 4,761 | 164 | import os
import sys
import random
import math
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import auc, precision_score, classification_report, plot_confusion_matrix, f1_score, confusion_matrix
from sklearn... |
a983c197cde51e597fd5bbb4abf21d4e78e376ad3195740e1675da73a3f5299d | Python | 4,762 | 156 | import logging
import os
import os.path as osp
from pathlib import Path
import torch
import glob
import matplotlib.pyplot as plt
def get_model_folder(args):
make_dir(args.save_dir)
path = Path(args.save_dir) / get_model_fname(args)
path.mkdir(parents=True, exist_ok=True)
return path
def get_model_fn... |
3ff39a6ce8d3700bab9f0829009fff373f1e84ff429fb2e52a1c9f4126a82996 | Python | 4,769 | 143 | import numpy as np
import pandas as pd
import sys, os
from random import shuffle
import torch
import torch.nn as nn
from models.gat import GATNet
from models.gat_gcn import GAT_GCN
from models.gcn import GCNNet
from models.ginconv import GINConvNet
#from read_smi_protein import *
from torch_geometric.data import InMem... |
e782d290bd071ea33f032a063a20c203c240e767f5ee7a0f54cbf3287d5bf563 | Python | 4,769 | 130 | # coding = utf-8
# Copyright (C) 2021. 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
#
... |
e6f44f0436294dc529414367facbd8acfd094a6a401d16b1a66f63b228476a57 | Python | 4,770 | 128 | from __future__ import division
import numpy as np
from skimage import io
import warnings
from helper_lib import filelib
from SPHARM.classes.time_spectrum import TimeSpectrum
class MovingSurface(object):
"""
Class for storing the dynamics of an object surface.
"""
def __init__(self, name=None):
... |
6f5f3d1e56e9c71d995f437cc7dda76fc743bf515a04080404f4984a755ef7f7 | Python | 4,776 | 132 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn.utils.weight_init import trunc_normal_
from ..builder import HEADS
from .cls_head import ClsHead
@HEADS.register_module()
class ConformerHead(ClsHead):
"""Linear classifier head.
Args:
... |
fab15f0080ec5e7a6da2c8d4153682161c4edf688ca15b1153d32d0c783a2be3 | Python | 4,777 | 207 | #%% [markdown]
# # Explain GM vs. BGM
#%%
import datetime
import time
import matplotlib.pyplot as plt
import numpy as np
from giskard.plot import scattermap
from graspologic.simulations import er_corr
from matplotlib.patheffects import Normal, Stroke
from pkg.io import FIG_PATH, OUT_PATH
from pkg.io import glue as de... |
dfba4d6af859979b2e686d5a6ced2a1d5acb8f4cd11ded1fee7c6d34c38a4f36 | Python | 4,781 | 131 | # 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
#
... |
f3ff06550ef12f57c267cd6da1373c7022cd3d1de677dd7a33bcc279e86a9eba | Python | 4,782 | 125 | # 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... |
60d00beb7cbe414d935a0cec0114d26df67fd0b5fe9e15a457adb410b25f0de1 | Python | 4,786 | 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... |
999cf0b83d6158172b6edbff3bc90543505f204b2607a5fdd8cceeab149aebf3 | Python | 4,790 | 157 | import logging
import shutil
import tempfile
import numpy as np
import pytest
import torch
import torch.nn as nn
from mmcv.runner import build_runner
from mmcv.runner.hooks import Hook, IterTimerHook
from torch.utils.data import DataLoader
import mmcls.core # noqa: F401
def _build_demo_runner_without_hook(runner_t... |
0bf1ac939fd9ec44fd7c0951d99204eb190b9a7b54c1ce63dd1097b6c297ceed | Python | 4,792 | 161 | """
inter_r_variation.py
Simulates networks with different R group sizes to investigate
the effect of the unabalanced group size on cue conflict
outputs.
"""
import numpy as np
import matplotlib.pyplot as plt
from extended_ring_model import *
from dict_key_definitions import rmkeys, decodekeys
from test_utilities imp... |
6b2d94a32419767cdd08c030a4af9ebe79f3c780c254485b411cf9e44cdeadf2 | Python | 4,792 | 120 | # 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... |
aaebbf8327b45aae230907f2aff5665191ada067a1259491fc14e938aac138df | Python | 4,792 | 153 | # 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
#
... |
e92b53ffd8c3726fd9a5417098f3afc53e4b65a332486a5b714ef5287521f5c9 | Python | 4,795 | 134 | """Persistence layer for benchmark results.
This module is the single entry point for all benchmark result I/O.
It coordinates two complementary mechanisms:
1. **Final-format storage** — a single results file at ``path``,
with format selected by file extension via
`sktime.benchmarking._storage_handlers` (JSON, ... |
fb160cd1f957c609fee4e197a39d53c8c52e37f5dc1b69cc3e00883c32eb7d09 | Python | 4,795 | 145 | import os
import sys
import random
import builtins
import torch
import numpy as np
import torch.distributed as dist
import torch.multiprocessing as mp
from munch import munchify
from torch.utils.tensorboard import SummaryWriter
from utils.func import *
from train import train, evaluate
from utils.metric... |
bfae321e74543cd0c9afb624851abb2132c546717d86abfec63aaccec80097d7 | Python | 4,802 | 123 | import warnings
from pathlib import Path
import nibabel as nib
import numpy as np
from scipy.ndimage import binary_erosion
# Private import for functions that STAY in this module
from bcblib.imaging.io import load_nifti as _load_nifti
def get_mask_perimeter(array, binarise_thr=0.5):
"""
Returns a binary mas... |
6ab2106530d5dc953222bf14605984f81ed1d06a0c9360090275b9e7658e4d0d | Python | 4,803 | 133 | import numpy as np
from neuron import h
from .psd import PSD
class GluPSD(PSD):
"""
Glutamatergic PSD with ionotropic AMPA / NMDA receptors
This creates a set of postsynaptoc NMDA and AMPA receptors, one pair
per terminal release site. Receptors are connected to the XMTR range
variable of the te... |
96356156ca523961e543998efdb10fb712b3f30b856261996dd35b8a19e42ccc | Python | 4,806 | 174 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class ReduceMean(Base):
@staticmethod
def export_do_not_keepdims() -... |
fda2639f22e233babdca50c7eb106d6bd971b069b9b405d319df7ed490794afd | Python | 4,810 | 121 | """BaseEstimator interface to dynamic time warping distances in dtw_python."""
__author__ = ["fkiraly"]
from sktime.dists_kernels.base._delegate import _DelegatedPairwiseTransformerPanel
class DtwPythonDist(_DelegatedPairwiseTransformerPanel):
r"""Interface to dynamic time warping distances in the dtw-python pa... |
77dc5666b0f3b5f3f21be1a582a185b16c595ee29e3297520500da87e6617999 | Python | 4,814 | 158 | from __future__ import print_function
__author__ = 'pbmanis'
"""
showmap reads the basic file and then shows the maps of the results.
"""
import matplotlib.pyplot as pl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pickle
import os
from sets import *
simpath = 'Simulations'
showtraces = False
#f... |
258e43c023a9ab10bc3daf61a9583a6297af6964f871f99abe5bb309f59757e2 | Python | 4,815 | 111 | import os
import numpy as np
from os.path import join as pjoin
import pandas as pd
import scipy.io as sio
import nibabel as nib
from nibabel import cifti2
import scipy.io as sio
def save2cifti(file_path, data, brain_models, map_names=None, volume=None, label_tables=None):
"""
Save data as a cifti file
If ... |
345d39caee22319653ec72b4a84f103e0ccee11f26cb176c4968d3f7d0c53b05 | Python | 4,815 | 163 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten
"""L2 cost function for change and anomaly detection."""
__author__ = ["Tveten"]
from sktime.detection._utils import check_mean, col_cumsum
from sktime.detection.costs._base import ... |
50f24a0afea2d604cd92c2034beccdebc09f469fe2915ef73a534d6a2ee1630d | Python | 4,815 | 145 | """Streamline ratio computation for the Yeh HCP1065 tractography atlas."""
import os
import tempfile
import warnings
from pathlib import Path
from typing import Callable, Optional
import nibabel as nib
import numpy as np
try:
from dipy.tracking.utils import target as _dipy_target
_HAS_DIPY = True
except Impo... |
b647229265ac01bcd602c57e34a65ee766806a4a1975366a4f8dfb029162a41a | Python | 4,815 | 114 | #!/usr/bin/env python
import itertools
import pandas as pd
import numpy as np
import sys
from collections import Counter
rbhfile = "/Users/darrin/Downloads/BFL_EMU_RES_reciprocal_best_hits.rbh"
rbhfile = "/Users/darrin/Downloads/COW_EMU_HCA_RESLi_reciprocal_best_hits.rbh"
rbhfile = "/Users/darrin/Downloads/EMU_RES_re... |
ba9c87fc3d3a73a533ad549f093a994f937a563f117e79bf26520d3af78f5e21 | Python | 4,816 | 130 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from shape_inference_test_utils import TestShapeInferenceHelper
import onnx
import onnx.helper
import onnx.parser
import onnx.shape_inference
from onnx im... |
25d38f42318f785db8f7915461b88f2b4247a93beab22a984cd98312275b478d | Python | 4,818 | 150 | # 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... |
68cf50ad4e4157e70a0eefada0ac02ddc6704f305c66a79dff07a1ca99031681 | Python | 4,818 | 106 | import torch
import torch.nn as nn
import torch.nn.functional as F
'''
Policy networks. The neural policy networks were trained by minimizing the negative
log-likelihood of selecting the transformation a that was used in the literature
to make molecule m. This is essentially supervised multi-class classification. To
e... |
0fd3d877bcf5a2f570e069f414812915b757aa3cd98ee99deda71501c73c67a3 | Python | 4,819 | 219 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""
Public building blocks for the SeZM descriptor.
This package re-exports the helper functions, embeddings, equivariant layers,
and quaternion-based Wigner-D utilities used by the SeZM descriptor and model.
"""
from .activation import (
GatedActivation,
SwiGLU,
)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.