sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
add0520d2b4ee0a3e9ebc763fa89eb82fe54d237a6f2784341e8a253fd1af00c | Python | 1,101 | 50 | # Mocapy: A parallelized Dynamic Bayesian Network toolkit
#
# Copyright (C) 2004 Thomas Hamelryck
#
# This library 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 the
# License... |
9a6cc91c65e4954bfa52e6cb66b1ceff0ddbd858d0f419331ac976e15f598b1f | Python | 1,103 | 38 | # 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 Tile(Base):
@staticmethod
def export_tile() -> None:
n... |
10759ea0a543eec25369a0e2e47839c69207762c91da4380dc83897916fe821f | Python | 1,104 | 35 | """
These are the runs for the SAM tone data
Run with the 0.7686 ASA density
Cell BC09 with NoUninnervated2 (No uninnervated dendrites)
15 dB SPL
Manual copy from DataTableVCN using selection of runs and "print" function
Built: 7 June 2022
"""
samdata = {
'9U': [ # uninnervated dendrites removed
"runANPS... |
4717c7d6f122c13ffbc0457c991282e904cb1eb2d643b5d46185f9f57a8b648b | Python | 1,104 | 36 | # 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... |
a7a008251de3ea7dedb10ac5b0031ff166021dcd06fcd57c4a41dc34f2b92492 | Python | 1,104 | 44 | import pytest
import numpy as np
# from cnmodel.util.matlab_proc import MatlabProcess
try:
import matlab.engine
MATLAB_FOUND = True
except:
MATLAB_FOUND = False
def test_matlab():
global proc
try:
# proc = MatlabProcess()
proc = matlab.engine.start_matlab()
except RuntimeError:
... |
397e13a9184a676ae54bbd69d63cbda1c91643ada145e0ac216fba8e6db41a1e | Python | 1,106 | 26 | from sklearn.utils.class_weight import compute_sample_weight
import numpy as np
import tensorflow as tf
import tensorflow.keras.backend as K
class Mixer(object):
# 给定 F,C,每次抽样决定用哪些样本
def __init__(self, F, C_original):
self.F = tf.constant(F.astype(np.float32), dtype=tf.float32) # num_samples * num_featur... |
dd3ff54415d0e5371f73f5b58b35d3871efdcb94fddddea28ff7e873ed979261 | Python | 1,110 | 23 | from itertools import combinations
from combinations import SystemCombination
import symmetry
import numpy as np
def performance_anhilation(system, substitutions, bonds):
origin = SystemCombination(system, None, None, None, identifier=0)
for elem_old, elem_new, number in substitutions:
atoms_index_lst ... |
df5fe9d4acdd0acb0a654dd5ba80208c907c395d09e29483d83294dc4981616a | Python | 1,110 | 39 | """
Plotting on a large number of facets
====================================
_thumb: .4, .3
"""
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(style="ticks")
# Create a dataset with many short random walks
rs = np.random.RandomState(4)
pos = rs.randint(-1... |
7d949702122972694a3b2d84946eb844b8cd0beee523248c57c57049060076a0 | Python | 1,112 | 30 | # Copyright 2019-2026 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
#
r"""This module includes a number of functions to perform knowledge discovery
i... |
834470f77439a67d37e3f973c14f4620d93a3748e0a58609c57a778c30ac1ea5 | Python | 1,112 | 41 |
class PSD(object):
"""
Base class for postsynaptic density mechanisms, possibly including cleft.
May accept either NetCon or pointer inputs from a Terminal, and directly
modifies the membrane potential and/or ion concentrations of the
postsynaptic cell.
"""
def __init__(self, section... |
e3d21cb628ce59a9d658c636ffa3f32a39eba6f24712a26e4b0ee1411f7ca32d | Python | 1,113 | 41 | import urllib
from pathlib import Path
from pytest import mark
from asreview import ASReviewData
from asreview.datasets import DatasetManager
from asreview.search import fuzzy_find
def exists(url):
return urllib.request.urlopen(url).getcode() == 200
@mark.parametrize("keywords,paper_id", [
("bronchogenic ... |
2d70d94f06c5a8688fb27d724913e4edd79d7cce427ad59f0a88ec3773d2c28f | Python | 1,114 | 39 | """
Plotting on a large number of facets
====================================
_thumb: .4, .3
"""
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="ticks")
# Create a dataset with many short random walks
rs = np.random.RandomState(4)
pos = rs.randint(-1, 2, (... |
81ac2f41d7aa62850343a250aeb071cb811266e0407eab5df5eb4cdf01001069 | Python | 1,114 | 34 | import sys
import clifn
argvs = [
['clifn',],
['clifn', '-o',],
['clifn', 'sub-command-1', 'a'],
['clifn', 'sub-command-1', 'b', 'c'],
['clifn', 'sub-command-1', '-o', 'd'],
['clifn', 'sub-command-1', '-o', 'e', 'f'],
# demo spec does not account for sub-command-2 by itself
#['clifn', '... |
bc094c374828807ce50121afbba821da71fc7f45a21cd4f40e45ff9e24fed559 | Python | 1,114 | 41 | """Ensembling operations."""
import pandas as pd
import atom3d.datasets.ppi.db5 as db5
import atom3d.util.formats as dt
def identity_ensembler(pdb_files):
return {x: None for x in pdb_files}
# An ensembler maps a list of files to an ensemble map (a 2-level dictionary).
#
# An ensemble map takes the form of a 2... |
1c2db8ac5b06371e0d9158c74ba6b01f17ea241e6bc820c17bbeb8c6917ed8ac | Python | 1,115 | 35 | import torch
import torch.nn as nn
class TISRoverPlus(nn.Module):
def __init__(self):
super(TISRoverPlus, self).__init__()
self.features = \
nn.Sequential(\
# 1
nn.Conv2d(in_channels=1, out_channels=32, kernel_size=(7, 4)),
nn.ReLU(),
... |
9f051d118054d734d031d5f09e79bd9815fb75b622663b1da5b8ee9ad653823b | Python | 1,115 | 32 | """ShapeletTransformClassifier test code."""
import pytest
from sktime.classification.shapelet_based import ShapeletTransformClassifier
from sktime.classification.sklearn import RotationForest
from sktime.datasets import load_unit_test
from sktime.tests.test_switch import run_test_for_class
@pytest.mark.skipif(
... |
531973001d1e2da6151f351bdb6c4f9c712b924c05fe64355a6d84c57b3f3af6 | Python | 1,117 | 28 | from rare_disease_id_util import isNotGroupOfDisorders, isDisease
import pandas as pd
from tqdm import tqdm
df = pd.read_excel('for validation - row id added - by text.xlsx')
dict_ordo_isNotGroupOfDisorders = {}
dict_ordo_idDisease = {}
df['ORDOisNotGroupOfDisorder'] = ""
df['ORDOisDisease'] = ""
for i,... |
8288fd8e466150006793d65a791c5ef52730616fe035cb178559f9ed5eb45e3b | Python | 1,117 | 50 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Neural and geometric building blocks for DPA4C."""
from .bispectrum import (
BispectrumLayout,
build_bispectrum_layout,
derive_bispectrum_ranks,
enumerate_degree_triples,
)
from .charge_state import (
ChargeStateEmbedding,
canonicalize_charge_spin... |
11ec71df92eeaf05f66027fa074cbecdc38fe477d57b62372115b911e42efa07 | Python | 1,118 | 32 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import numpy as np
from onnx.reference.op_run import OpRun
class GlobalLpPool(OpRun):
def _run(self, x, p=2):
spatial_axes = tuple(range(2, x.ndim))
if any(x.shape[ax... |
92bd1bd772fa789e2bb81d98875d961765eabc7930182f27124aac6a294ad262 | Python | 1,118 | 39 | """
Scatterplot heatmap
-------------------
_thumb: .5, .5
"""
import seaborn as sns
sns.set_theme(style="whitegrid")
# Load the brain networks dataset, select subset, and collapse the multi-index
df = sns.load_dataset("brain_networks", header=[0, 1, 2], index_col=0)
used_networks = [1, 5, 6, 7, 8, 12, 13, 17]
used... |
c9da58584762677b4b81dc9ccaed1e7e3f27564036e8ea2b579dcc5493a9419d | Python | 1,118 | 38 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
def reshape_reference_implementation(
data: np.ndarray, shape: np.ndarray, allowzero: int = 0
) -> np.ndarray:
# replace zeros with c... |
26326ebc87acb1ce2cd1dfbee1d794f57e1f9c2052a431ccdc70630693fe59db | Python | 1,121 | 34 | # SAFE TEAM
#
#
# distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) #
#
import json
class InstructionsConverter:
def __init__(self, json_i2id):
f = open(json_i2id, 'r')
self.i2id = json.load(f)
f.close()
def convert_to_ids(se... |
f231de3d929f851cb6c99392ae6fbac1bd9144e8440db33c2350f984527c0c7f | Python | 1,121 | 36 | # 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... |
3ca27448a7f3be4b6eaaff6845e27185b763014e84c609b5187ab32cb6c7d5e1 | Python | 1,123 | 35 | #!/usr/bin/env python
from __future__ import print_function
import sys,os
import argparse
import logging
from Bio import SeqIO
desc = 'Filtering contigs by length'
epi = """DESCRIPTION:
A simple script for filtering a fasta by length.
It uses biopython.
Output is written to STDOUT
"""
parser = argparse.ArgumentParser(... |
bf43b9f0e545e42fdb06b51516c692d97f9c40bef6e841ef92808c3b34177547 | Python | 1,123 | 42 | # Copyright (c) OpenMMLab. All rights reserved.
import collections.abc
import warnings
from itertools import repeat
import torch
from mmcv.utils import digit_version
def is_tracing() -> bool:
if digit_version(torch.__version__) >= digit_version('1.6.0'):
on_trace = torch.jit.is_tracing()
# In PyT... |
da72b860665b0f75114b923b7419a04efe618687711a87ea0c4be97cec911cc1 | Python | 1,124 | 38 | # SAFE TEAM
#
#
# distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) #
#
import numpy as np
class FunctionNormalizer:
def __init__(self, max_instruction):
self.max_instructions = max_instruction
def normalize(self, f):
f = np.asarray(... |
f21e1186748b94f0a186e4ca5330a569bf02c5faa1087a72e701f004f634ced3 | Python | 1,126 | 33 | """General setup for module."""
from setuptools import setup, find_packages
VERSION = "netplotbrain/__version.py"
VERSION = open(VERSION, "rt").read()
VERSION = VERSION.split('"')[1]
setup(name='netplotbrain',
version=VERSION,
python_requires='>3.5',
setup_requires=['pytest-runner'],
tests_re... |
9c00a2468af70951e1bb411d6312160a5ab6fee2433e20bb9332cb6eadaa79e6 | Python | 1,129 | 28 | """Tests for bycycle.plts.cyclepoints."""
from bycycle.cyclepoints import find_extrema, find_zerox
from bycycle.tests.tutils import plot_test
from bycycle.tests.tsettings import TEST_PLOTS_PATH
from bycycle.plts.cyclepoints import *
###################################################################################... |
0386ee8a9985b6b4bb7e10019b0f57e0fc2888d753072df2123dd5cf3f44b054 | Python | 1,130 | 36 | from __future__ import print_function
import collections
from .augment import Augment
from .section import Section, PartialSection, MixedSection
from . import perturb
__all__ = ['MissingSection', 'PartialMissingSection', 'MixedMissingSection']
class MissingSection(Section):
"""
Simulate full missing sectio... |
ab6dad88f9931b2e66d9e00588388c857d3bec46c843766ee2b66bd0115b644f | Python | 1,130 | 44 | from math import inf
from lgn.g_lib import GTau
def cg_product_tau(tau1, tau2, maxdim=inf):
"""
Calulate output multiplicity of the CG Product of two G Vectors
given the multiplicty of two input G Vectors.
Parameters
----------
tau1 : list of int, `GTau`.
Multiplicity of first repres... |
662cb77ee5249f16559efb65da8ab91b52f7ec8b32f1f341ad4c08f49007eabc | Python | 1,131 | 37 | # 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... |
795665df974c481e4bc28a519cc15cd56c44e7683bcfa8a1c1d20b585a6d6997 | Python | 1,133 | 33 | import numpy as np
# Normalize an image to have intensity values between 0 and 1.
# This function finds the 1st and 99th percentiles of the pixel values
# and uses them to scale the image. If the image is uniform (all pixel values are the same),
# it returns a blank image (all zeros).
def norm_pic(im):
# Find the ... |
7a163a0d17119db7167ef361a9360994dac473281996774e582e013de70c0661 | Python | 1,133 | 42 | from __future__ import annotations
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from libpysal.weights import W as libpysal_W
from scipy.stats import norm
def pysal_to_pandas(W: libpysal_W) -> pd.DataFrame:
return pd.DataFrame(*W.full()).astype(int).T
def plot_gmm(gmm, hist_data, save_... |
d645804d38a7e690efaf1804d767951cc8727cdb356ee81d6c5162dcf7924428 | Python | 1,133 | 49 | from __future__ import print_function
"""
Run unit tests for vcnmodel
"""
import os, sys
from pathlib import Path
import pytest
import vcnmodel
def main():
# Make sure we look for the right path first.
path = Path(__file__).parent
sys.path.insert(0, str(path))
# Allow user to audit tests with --audi... |
979c34206f336187c29c09d4ea5c207ae5c72610d3f94d13a0f8e0b5ee1881e6 | Python | 1,134 | 44 | from math import inf
from lgn.g_lib import GTau
def cg_product_tau(tau1, tau2, maxdim=inf):
"""
Calulate output multiplicity of the CG Product of two G Vectors
given the multiplicty of two input G Vectors.
Parameters
----------
tau1 : list of int, `GTau`.
Multiplicity of first repres... |
b80cc14c2d2ef81bc35c27ad493662542f3bb6fd3b92f329a68a87686b4431bc | Python | 1,135 | 28 | #-------------------------------------------------------------------------------
# elftools tests
#
# Seva Alekseyev (sevaa@sprynet.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
from elftools.elf.elffile import ELFFil... |
e73a2251accc58fb48c795a1a5f4912ab087e4f02c186b4595c614ce87e735ea | Python | 1,135 | 38 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class SpaceToDepth(OpRun):
def _run(self, data, blocksize=None, mode=None):
if len(data.shape) != 4:
raise RuntimeErr... |
ab6432c3a5da6e51316dd5a1dc18dafcdaa9661c49f3234c55f0071ed48c1e59 | Python | 1,136 | 37 | import pytest
from flair.data import Sentence
from flair.datasets import NEL_ENGLISH_AIDA
from flair.embeddings import TransformerWordEmbeddings
from flair.models import SpanClassifier
from tests.model_test_utils import BaseModelTest
class TestEntityLinker(BaseModelTest):
model_cls = SpanClassifier
train_lab... |
c567f9daf53d929d13180d1b836433dc7eccbebea95e2ff1abbbd3183cfd99a0 | Python | 1,136 | 28 | # 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... |
786e6e9963d992a8084a030a1bc735f4283cc04a782435199a1c6ab937c98bcf | Python | 1,137 | 39 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Tests for random_state Parameter."""
__author__ = ["Ris-Bali"]
import numpy as np
import pytest
from sktime.datasets import load_airline
from sktime.forecasting.ets import AutoETS
from sktime.forecasting.exp_smoothing import ExponentialSmoothi... |
7a4f6d1ecd734d7482d21596eb1dd90ea46d070c49325536d8e50376208c20db | Python | 1,137 | 37 | # 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... |
7b08023cf7a7117eb01df477e469fa5b41a9dbed4d92095d0e5bb76b54fc3c59 | Python | 1,137 | 45 | import csv
import glob
import os
import sys
import pyrosetta
from pyrosetta import pose_from_pdb
pyrosetta.init()
files = sorted(glob.glob('../pyrosetta_mut/*.pdb'))
match = 0
nomatchfiles = []
jobid = int(sys.argv[1])
num_jobs = int(sys.argv[2])
perjob = int(len(files) / int(num_jobs))
nums = list(range(len(files)... |
7c633054753eabeed0e32dc3aa7110c26bd4ec068131c731834c8a906a0fecd9 | Python | 1,137 | 45 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 14 09:42:34 2022
@author: sam
"""
import h5py
import glob
from natsort import natsorted
import os
import cv2
folder='/home/sam/bucket/octopus/apartment/high_res'
file_list=natsorted(glob.glob(folder + '/*asTimes'))
for filename in file_list:
... |
97276403fa297daebe89cc54955a9c76d2d4aa491632d4e95208c6d13f514e82 | Python | 1,137 | 34 | #!/usr/bin/env python
from setuptools import setup
import sys
from pathlib import Path
import stream as st
if sys.version_info.major != 3:
raise RuntimeError('STREAM requires Python 3')
# No dependency packages are specified in setup.py file
# STREAM is built based on bioconda recipe.
# All the required package... |
61cad00728c287f4fbad05ec7b06ea546d7d88ca6f0f28fa06f33f6c4a7ef67a | Python | 1,139 | 39 | import pandas as pd
import sys
from hbip.utils.analysis_utils import plot_correlation, add_max_identity
def main(scores_path, title=None, add_max=False):
pd.options.display.width = 100
pd.options.display.max_columns = 10
if add_max:
df_max = add_max_identity(scores_path)
else:
df_max... |
c40fd18ed80f96c54713ef1815005e29d254b09173cc36f5d98fd94e327aae76 | Python | 1,139 | 65 | # SPDX-License-Identifier: LGPL-3.0-or-later
from deepmd.dpmodel.model.make_hessian_model import (
make_hessian_model,
)
from .dipole_model import (
DipoleModel,
)
from .dos_model import (
DOSModel,
)
from .dp_linear_model import (
LinearEnergyModel,
)
from .dp_zbl_model import (
DPZBLModel,
)
from... |
68cd349bd20aad753ac82c3bd47980f14a617542e6d62ed5a1d19c69c5d9999f | Python | 1,140 | 34 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceL1_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=None):
axes = tuple(axes) if axes is not... |
1063adc56822d436bf8bebf6df1dc8ec1a100675b97846c0c104dc79a7c3eb7c | Python | 1,142 | 28 | # 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... |
a1abe420b4662f42613a7cbfc4bf2770b533c68c82c0c21be74dd521c002dbba | Python | 1,142 | 37 | import os
from abc import ABC, abstractmethod
from typing import Dict, List
class Proposer(ABC):
"""Base class for proposer"""
@abstractmethod
def __init__(self,
model_name: str,
model_args, # let's enforce everything to be passed i... |
ef3fa251491065c17c74ae575fb94fe5a4c08f73d85b56e7fae8b6deebcad62b | Python | 1,142 | 51 | # https://github.com/dgg32/gpt-3-extract
# Sixing Huang
import os
import sys
import openai
from tenacity import (
retry,
stop_after_attempt,
wait_random_exponential,
) # for exponential backoff
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
def completion_with_backoff(... |
bf536eeb4862ed857ff256fb527d1e3adef9a21eb1321e57dc42015741dcb741 | Python | 1,143 | 39 | """cloud_cover_dataset.py"""
"""
Author: Yimin Yang
Last revision date: Jan 18, 2022
Function: dataloader for cloud cover dataset
Ref: https://github.com/HansBambel/SmaAt-UNet
"""
import os
from torch.utils.data import Dataset
import numpy as np
class cloud_maps(Dataset):
def __init__(self, folder, train=True, ... |
7c899f5b70e52797d237f0767e460171d6c28e99d7cda7f82b55789fbccbc942 | Python | 1,145 | 36 | from __future__ import print_function
import collections
from .augment import Augment
from .section import Section, PartialSection, MixedSection
from . import perturb
__all__ = ['BlurrySection', 'PartialBlurrySection', 'MixedBlurrySection']
class BlurrySection(Section):
"""
Simulate full out-of-focus secti... |
afdd29fb296949c764c8e71bc7e109c981f4d1a6afbdc5007ef9f35354fe7032 | Python | 1,145 | 34 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class DynamicQuantizeLinear(OpRun):
def _run(self, x):
# args: x, y_scale, zero_point
dtype, qmin, qmax = np.uint8, 0, 25... |
bfeb9120bd85aed14e672da9b3b78375559516b691d59ff0a84e9bbf2dcfb978 | Python | 1,145 | 39 | # -*- coding: utf-8 -*-
"""
Created on Thu May 14 20:13:55 2020
@author: daniel
"""
import parameters as p
class DendStat(object):
def __init__(self):
self.dends = p.input_dends
self.dend_inputs = [[] for d in self.dends ]
self.pf_inputs = [[] for d in self.dends ]
self.dend_syns =... |
34e397c0c6d8da66678042861a3c4695963f32be476b8e411d4d5281a26a8b70 | Python | 1,146 | 33 |
from graynet import parcellate
import networkx as nx
import plotly
from os.path import join as pjoin, isdir, realpath, dirname, basename
# import plotly.plotly as py
# plotly.offline.init_notebook_mode(connected=False)
from graynet.vis_network import draw3Dnx
coords, faces, annot = parcellate.read_freesurfer_atlas('... |
0376354b537497c0e0f670b1f6aa03a8ba4755c275d9f5dc154df2ed15d175e4 | Python | 1,148 | 40 | from pathlib import Path
import numpy as np
import pytest
from pandas.testing import assert_frame_equal
from asreview import ASReviewData
@pytest.mark.xfail(raises=ValueError, reason="Bad record_id")
def test_bad_record_id():
data_fp = Path("tests", "demo_data", "generic_bad_record_id.csv")
as_data = ASRevi... |
58dc1e0f9a2cefa3cce8dbaccae5f945fa4a534a250a8aae6d405e0bbb37f2e5 | Python | 1,148 | 24 | # 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... |
7619658a3e959277719a54cb18f1601c3b1e28bc58e2aff9f8f70ed8f06edb24 | Python | 1,148 | 41 | import pandas as pd
file = r'C:\Users\chaochaoyan\Documents\retrosynthesis\retrosim\retrosim\data\data_split.csv'
data = pd.read_csv(file)
prod_smiles = data['prod_smiles'].tolist()
split = data['dataset'].tolist()
rxn = data['rxn_smiles'].tolist()
products = {'train': [], 'test': [], 'val': []}
for s,... |
aca41a9757c927ccfff1ca46749796ce72e76967a32c7f78aea55ea483899dc8 | Python | 1,149 | 33 | # 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
#
# ... |
e79c4e24e33f534d269a654abef75ba0b12fa82cb0f52e967f3bfe3a848d4795 | Python | 1,150 | 54 |
fi=open('scATAC_RefLoop.txt')
header=fi.readline().rstrip().split('\t')
import os
os.chdir('./scATAC_RefLoop')
fo_list=[]
for one in header:
fo_list.append(open(one+'.longrange','w'))
for line in fi:
seq=line.rstrip().split('\t')
if 1==1:
sss=seq[0].split('.And.')
out=sss[0].replace... |
3bece0b9cf9943af5b043026458819d259df9bfe7c2a1d3ffc6c905e7e5aa2b4 | Python | 1,151 | 36 | import torch
import torch.nn as nn
from .networks import get_network, LinLayers
from .utils import get_state_dict
class LPIPS(nn.Module):
r"""Creates a criterion that measures
Learned Perceptual Image Patch Similarity (LPIPS).
Arguments:
net_type (str): the network type to compare the features: ... |
f0f7348a9a4a4e5fed04ba21b5f8174d303ae3f5a04f8f0fd0e65f4c2381d84a | Python | 1,151 | 36 | # 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.model import expect
class SingleSign(Base):
@staticmethod
def export() -> None:
... |
631a171eaf5fab4000ecfffed386a510d62303734f750f152aef62b5d9bcd768 | Python | 1,152 | 46 | #!/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Set up the datasets included in sktime."""
# The file is adapted from:
# https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/datasets/setup.py
___author__ = ["mloning"]
def configuration(parent_package=... |
1437ad414fb57a2442524d4eee16eb624d82dcc9ae80d81ea2bbf71f2d60d4fb | Python | 1,153 | 36 | import os
from PIL import Image
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser(description="...")
parser.add_argument("--dir", help="...", type=str, required=True)
args = parser.parse_args()
def get_bad_filenames(filenames):
return [f for f in filenames
if f.endswith('.jpg') ... |
97d828fe1c1d1ea18f9c64dab87b3ffc83c2e290ccf6d56566b2cb76b64b8986 | Python | 1,153 | 34 | # 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... |
0a729f906470cba7d932ec1ba33319e0c5ffc9bb98c08d9a154305a3d0d2607a | Python | 1,154 | 31 | """Analyzers for benchmark results (v2, strategy pattern).
These evaluators consume the flat results table produced by the v2 benchmarking
framework (``BaseBenchmark.run`` / ``BenchmarkingResults.to_df``) and compute
analysis results: ranking, omnibus / pairwise significance tests, and the
critical-difference diagram.... |
586323f1e09b2d3ccc28ea7ba6795900e32c59f2dcd577058d2886031b1c8fd6 | Python | 1,154 | 40 | import matplotlib.pyplot as plt
import pandas as pd
def main():
path_to_results = "results/mot20_eval/baseline/results.csv"
df = pd.read_csv(path_to_results)
plot_AP_vs_od_latency(df)
plot_avg_latency_vs_od_latency(df)
def plot_AP_vs_od_latency(df):
plt.figure(figsize=(8, 7))
plt.plot(df["... |
78ed6697fb434ac0d8abe36cb008f512ca86086eff6cf96f58233b1c87780dd8 | Python | 1,154 | 52 | #!/usr/bin/env python
__doc__ = """
Augmentor - No Box Occlusion
"""
from augmentor import *
def get_augmentation(is_train, **kwargs):
# Mild misalignment
m1 = Blend(
[Misalign((0,10), margin=1), SlipMisalign((0,10), margin=1)],
props=[0.7,0.3]
)
# Medium misalignment
m2 = Blend(
... |
a0a98643e52a30830b032989afccaba1c98a465f1563f6cc2aa848a5b81a55a3 | Python | 1,154 | 45 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class Squeeze_1(OpRun):
def _run(self, data, axes=None):
if isinstance(axes, np.ndarray):
axes = tuple(axes)
... |
8c6ac8937f7bcc1a747705952f47a8fb902b7df45ddfb24c5e2e785e7b7522f7 | Python | 1,156 | 40 | # 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 PRelu(Base):
@staticmethod
def export() -> None:
node ... |
ec2cee8aabc3cd976fec4ef6fae1898d2a5c040a8582d7608c9fb096878c5b0d | Python | 1,156 | 41 | import cProfile
import pstats
import random
import torchvision # type: ignore[import-untyped] # noqa: F401
from tqdm import trange # noqa: F401
from torchinfo import summary # noqa: F401
def profile() -> None:
"""
Prints top N methods, sorted by time.
Equivalent to:
python -m cProfile -o dat... |
94f7b7db7b508a5f3a2da78b5a9e152f57ed7fe8e1fb3b57debdf9fe18b7ace0 | Python | 1,157 | 41 | """Fractional differentiation of S&P 500."""
import sys
import matplotlib.pyplot as plt
import pandas as pd
import pandas_datareader
import seaborn
sys.path.append("../..")
from fracdiff import Fracdiff # noqa: E402
def fetch_spx():
"""Fetch 'Adj Close' value of Yahoo stocks."""
return pandas_datareader.d... |
72ed83a5083462177c24e669efc4361ede6698394385fd6597d76da1e127a183 | Python | 1,158 | 41 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class Normalizer(OpRunAiOnnxMl):
@staticmethod
def norm_max(x):
"""Max normalization"""
... |
3a5008721fcf4ef84cb6cb75f31bca6e50c5a45c6ca088b2e5907100d8e6300a | Python | 1,159 | 43 | from __future__ import print_function
import numpy as np
try:
import datatools
dtools = True
except ImportError:
import skimage.measure as measure
dtools = False
from .augment import Augment, Compose
class Label(Augment):
"""
Recompute connected components.
"""
def __init__(self):
... |
1643dfd2fcab2e8dc4471ac36ec44751dec55202726a30fcecd8a25c88978666 | Python | 1,161 | 33 | # 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... |
7a477f531e5451f2486f0f2880b245feeb8105cb5d2ca5cd1c4fe910cc9edda4 | Python | 1,161 | 63 | from __future__ import annotations
from enum import IntEnum, StrEnum, unique
@unique
class Mode(StrEnum):
"""Enum containing all model modes."""
__slots__ = ()
TRAIN = "train"
EVAL = "eval"
SAME = "same"
@unique
class RowSettings(StrEnum):
"""Enum containing all available row settings."""... |
f8fdfc695f54463ccd0d4ea6b20469720777190c0354f81885868e9eb435e920 | Python | 1,161 | 51 | import os
from PIL import Image
from tqdm import tqdm
import cv2
import numpy as np
import argparse
parser = argparse.ArgumentParser(description="...")
parser.add_argument(
"--dir",
help="...",
type=str,
required=True
)
args = parser.parse_args()
DIR = args.dir
SHOW = False
def is_img(filename):
"""Check... |
0f4e87d4530021b783aa1969df6630f56b1a05daaeac1895f2eb20620d7207fa | Python | 1,164 | 36 |
class Cell:
"""
A cell is a point in space that can have a state and a spawn time.
The spawn time is the iteration time at which the cell was created.
The state is the current state of the cell.
The next state is the state the cell will have at the next iteration.
"""
def __init__(self, st... |
5818cc996d47b4622b78990cac794320fcab7f0a0b13fcea1622e6a54a73f00b | Python | 1,164 | 34 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceL2_1(OpRunReduceNumpy):
def _run(self, data, axes=None, keepdims=None):
axes = tuple(axes) if axes is not... |
4324bb29fa2b4955a6479061b15040ae3887b08e91bd14bd57ca5f04b34d3306 | Python | 1,165 | 38 | import warnings
from tqdm import tqdm
with warnings.catch_warnings():
warnings.simplefilter('ignore', category=UserWarning)
from joblib import Parallel, delayed
import time
import random
def text_progessbar(seq, total=None):
step = 1
tick = time.time()
while True:
time_diff = time.time()-... |
43bf226f0b8cbfccc033b6fdd4ac3de2e098edcc995798d312786a5591d1da99 | Python | 1,165 | 33 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class QLinearMatMul(OpRun):
def _run(
self, a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point
):
... |
1a212bd3ae55a6c60991132d575eb0fd74e261151f68c9a2103b5ad3408ab624 | Python | 1,166 | 36 | import sys
import importlib.util
from pathlib import Path
from tempfile import TemporaryDirectory
import pytest
from git import Repo
test_impl_filepaths = [path for path in Path(__file__).parent.rglob("_*.py") if "__init__" not in str(path)]
test_impl_filepath_stems = ["impl_" + p.stem[1:] for p in test_impl_filepaths... |
f7529155108cd022e30fcce221b8725f038b2721a96a5c9a5f39b578050513bb | Python | 1,166 | 26 | # 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... |
f9b39b532d8dbca47afac30c183db73b03f3b8b9c73fdc0ee94ee28749c1acc3 | Python | 1,166 | 20 | # Copyright (c) OpenMMLab. All rights reserved.
from .attention import MultiheadAttention, ShiftWindowMSA
from .augment.augments import Augments
from .channel_shuffle import channel_shuffle
from .embed import HybridEmbed, PatchMerging, PatchEmbedV2
from .helpers import is_tracing, to_2tuple, to_3tuple, to_4tuple, to_nt... |
909b62449094bf4dc3a77b7a2eb37ad2fd5760f7dbce66f799fff03206ff9c90 | Python | 1,168 | 47 | import os
import pandas as pd
from sqlalchemy import create_engine, inspect, Table, Column
from sys import exit
class MysqlClient:
def __init__(
self,
user,
password,
hostname,
):
self.db_url = 'mysql+mysqlconnector://{user}:{password}@{hostname}'.format(
u... |
21b09293eeee0cf49243d4a63d3928f2698398ec7f918a430e2a04a1570c2cb4 | Python | 1,170 | 34 | # 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... |
e8ddaefa44a5d1b99d633c4edb2f1622522eb6ab139190530c05714a852defbe | Python | 1,170 | 34 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class PRelu(OpRun):
def _run(self, x, slope):
try:
return (np.where(x > 0, x, x * slope).astype(x.dtype),)
ex... |
7fd9c3d5dbc05fe13f6da1c57bac455c32c1648d4200a18ebd29d332572be977 | Python | 1,172 | 38 | # Copyright 2019-2026 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
#
r"""This module includes neural graph embedding models and support functions.
... |
030dfdb25777971dd3c1c1bf56e43e3c2bb732fb5c841f91354fa68ea7610526 | Python | 1,173 | 32 | import numpy as np, os, sys
import tifffile
import h5py
if __name__ == '__main__':
#get location
location_to_save = sys.argv[1]
print(location_to_save)
#make dirs
if not os.path.exists(location_to_save): os.mkdir(location_to_save)
pth = os.path.join(location_to_save, 'input_patches')
... |
98545074dc6f4475e29e85ac9d924d748d4c54fb35f699365c3aee65b004d97a | Python | 1,174 | 33 | from .base import BasePlugin, Pluggable, TrainerPlugin, TrainingInterrupt
from .functional.anneal_on_plateau import AnnealingPlugin
from .functional.checkpoints import CheckpointPlugin
from .functional.deepncm_trainer_plugin import DeepNCMPlugin
from .functional.linear_scheduler import LinearSchedulerPlugin
from .funct... |
65b745aca664679ab93039c8dca235fcd217abdefe6283a5edff819ba615454a | Python | 1,176 | 36 | from typing import Dict, List
from gln.test.model_inference import RetroGLN
from rxnebm.proposer.proposer_base import Proposer
class GLNProposer(Proposer):
"""GLN proposer, wrapping around gln.test.model_inference.RetroGLN"""
def __init__(self, gln_config: Dict) -> None:
super().__init__()
s... |
b82867032f799735246760de07c0e558be9fbad3ac560cdcb633173ca9cc092a | Python | 1,176 | 36 | import argparse
from keras.optimizers import *
def get_parser():
print('Receiving parser values')
parser = argparse.ArgumentParser(description='Process some integers.')
# Data
parser.add_argument('--tl_data', type=str, default=None) # [leenay]
parser.add_argument('--tl_data_category', ty... |
281ad164a282dcb990d8b3ffd2f6e2edd8025c7373b44d59cc789026e405bd2e | Python | 1,177 | 40 | import numpy as np
from neuron import h
from cnmodel.util import reset
def test_max_open_probability():
reset(raiseError=False) # reset() fails as unable to remove all neuron objects, unless we ignore the error
sec = h.Section()
# Create AMPA and NMDA mechanisms
# AMPA uses mode=0; no rectificat... |
395c3ed25f34fa337c6ed0ffab10935e00c615fa4d90a034d0a71fc01a4b4dc7 | Python | 1,177 | 39 | import numpy as np
from Historia.mech import mech_out as glv
from Historia.mech import scan_logfile as slf
def extract_features(path_in, dim, path_out, nc):
XA = np.zeros((0, 12), dtype=float)
X = np.zeros((0, 12), dtype=float)
YA = []
Y = np.zeros((0, 14), dtype=float)
l = []
for i in range(... |
8f15aed14c8b15d51cd94cf1d4a14cffdaf7cb3ec7d96545e1076f2acf6c2e21 | Python | 1,177 | 30 | import signal
from multiprocessing import Process
from concurrent.futures import ProcessPoolExecutor
from concurrent.futures.process import _process_worker as _process_worker_base
def _process_worker(call_queue, result_queue):
""" This worker is wrapped to block KeyboardInterrupt """
signal.signal(signal.SIGIN... |
f51f290551ad2342785a6946ba8a5521836086e9c593ab566632e25559cd29df | Python | 1,177 | 31 | r"""
_____ _____ ______ _ _ _______
/\ | __ \ | __ \ | ____| | \ | | |__ __|
/ \ | |__) | | | | | | |__ | \| | | |
/ /\ \ | _ / | | | | | __| | . ` | | |
/ ____ \ | | \ \ | |__| | | |____ | |\ | | |
/_/ \_\ |_| \_\ |_____/ ... |
67636536df49f69e4dd020867d2234e9f98a324841b3eecd3c6b0854f57a3ffc | Python | 1,179 | 32 | """
Custom exceptions for the seaborn.objects interface.
This is very lightweight, but it's a separate module to avoid circular imports.
"""
from __future__ import annotations
class PlotSpecError(RuntimeError):
"""
Error class raised from seaborn.objects.Plot for compile-time failures.
In the declarati... |
ca31cac30902042447cf633daa6791f8ebdcc42c25976526a7974581a37c712b | Python | 1,179 | 32 | # -*- coding: utf-8 -*-
# Written (W) 2008-2012 Christian Widmer
# Written (W) 2008-2010 Cheng Soon Ong
# Written (W) 2012-2014 Daniel Blanchard, dblanchard@ets.org
# Copyright (C) 2008-2012 Max-Planck-Society, 2012-2014 ETS
# This file is part of GridMap.
# GridMap is free software: you can redistribute it and/or m... |
041f633bd647453432042f1ea70d5f427afaa7ee7b1e023ae7022a19a31cc47f | Python | 1,180 | 43 | import yaml
import json
import logging
import os
from jsonschema import validate, ValidationError
log = logging.getLogger(__name__)
def read_taxonomy_details_yaml(config_path):
absolute_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), config_path)
with open(absolute_path, 'r') as file:
... |
72bb11626654642b64557225788249809160f787701f2506b13eb391218a9ef3 | Python | 1,181 | 42 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.