sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6a6d571a6d1d537bb6995967b07131da5daf134000f60f5dfa7b7a6d5d7103e2 | Python | 470 | 18 | """
Multiple linear regression
==========================
_thumb: .45, .45
"""
import seaborn as sns
sns.set()
# Load the iris dataset
iris = sns.load_dataset("iris")
# Plot sepal with as a function of sepal_length across days
g = sns.lmplot(x="sepal_length", y="sepal_width", hue="species",
truncate=T... |
0eca98590c3448fcc9451ef2fa4218044ae3a4937b5d2d36e3e543554fe9130f | Python | 471 | 19 | """
Annotated heatmaps
==================
"""
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme()
# Load the example flights dataset and convert to long-form
flights_long = sns.load_dataset("flights")
flights = (
flights_long
.pivot(index="month", columns="year", values="passengers")
)
# Dr... |
1d5175b4f88e29f3162d9467dd59da1ac0cdffc6d9910608648336ab8a2ba2ed | Python | 471 | 23 | """
Cell definitions for models.
This class includes a number of different cell definitions and default
conductances for point models.
"""
from .bushy import *
from .tstellate import *
from .dstellate import *
from .cartwheel import *
from .pyramidal import *
from .sgc import *
from .octopus import *
from .tuberculo... |
e33756cbbd8208ac1a08af41a4a0501032c48d7f740f4e288c32e6e949fea43c | Python | 471 | 17 | """InceptionTime deep learning classifiers.
This subpackage provides InceptionTime based classifiers implemented in
TensorFlow and PyTorch backends.
"""
__all__ = [
"InceptionTimeClassifier",
"InceptionTimeClassifierTorch",
]
from sktime.classification.deep_learning.inceptiontime._inceptiontime_tf import (
... |
f4143deb7d67be6f9165b6c540c8f5cf12be09b786c3af3086e94087abc0f99a | Python | 471 | 19 | """
Lineplot from a wide-form dataset
=================================
_thumb: .52, .5
"""
import numpy as np
import pandas as pd
import seaborn as sns
sns.set_theme(style="whitegrid")
rs = np.random.RandomState(365)
values = rs.randn(365, 4).cumsum(axis=0)
dates = pd.date_range("1 1 2016", periods=365, freq="D")
d... |
004a01dbd05e963408a856dc585480adbe6c243bd6d9b1d638e03bb21768a759 | Python | 473 | 17 | """ Tests for the various cli programs """
from pyontutils.integration_test_helper import _TestCliBase, Folders
class TestCli(Folders, _TestCliBase):
commands = (
['googapis', '--help'],
['graphml-to-ttl', '--help'],
['necromancy', '--help'],
['ontload', '--help'],
['overl... |
1fc51e4d70e4be4f13cbf53811245c7e97ebfad6c545a7ba5c8edf204972b8e0 | Python | 473 | 18 | import json
import os
from .. import __path__ as netplotpath
def _load_profile(**kwargs):
"""
Loads profile.
"""
profilename = kwargs.get('profile', 'default')
if profilename != 'default' and os.path.exists(profilename):
profilespath = profilename
else:
profilespath = netplotpa... |
6b5e990032a917bf4dba25d746d1a91e93f72d812df0eabe17b54c6fecefc8ab | Python | 473 | 24 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Backward-compatibility shim for onnx.version.
This module is deprecated. Use ``onnx.__version__`` instead.
"""
from __future__ import annotations
import warnings
from onnx import __version__ as version
warnings.warn(
"onnx.ve... |
bed7ae3d363ee72cedc60b43488b5069a085096eaacffffca4a03bdb76be5e71 | Python | 473 | 12 | # 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
#
"""Provides backward compatibility to AmpliGraph 1 APIs."""
from .evaluate impo... |
fcdd0ada208c547c2f10c63b77b2f58ae7c336a06370cf5abafdb736872205e7 | Python | 473 | 14 | import os
def get_all_models():
path = 'tool data/models/'
# get all folders names in the path
folders = [f for f in os.listdir(path) if os.path.isdir(os.path.join(path, f))]
return folders
def get_all_datasets():
path = 'tool data/datasets/'
# get all folders names in the path
folders = [f... |
c8868741815cc401588656c0ad1bbc1dae300615ee08baf0da28b5cd24dc14e0 | Python | 475 | 15 | # coding = utf-8
import os
from sasa.estimator import SASA_Classiffer
if __name__ == '__main__':
# data path
src_train_path = os.path.join("Dataset/phase1_TrainData/cityA/X.npy")
tgt_train_path = os.path.join("Dataset/phase1_TrainData/cityB/train/X.npy")
tgt_test_path = os.path.join("Dataset/phase1_T... |
e12d0ca8d4236c54b1938b1ff6ee820aec7029cb889c9bbd979687c54b88d6d3 | Python | 475 | 18 | """
The scripts in this folder came from https://github.com/ECP-CANDLE/Benchmarks.
"""
from __future__ import absolute_import
# import from file_utils
from .file_utils import get_file
# import from helper_utils
from .helper_utils import fetch_file
from .helper_utils import set_up_logger
from .helper_utils import ver... |
51ad223436b08d00cbfa8ffc017e6797aa92160a168b9e0e5aeec2bf7e5a3c36 | Python | 476 | 17 | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.utils import collect_env as collect_base_env
from mmcv.utils import get_git_hash
import mmcls
def collect_env():
"""Collect the information of the running environments."""
env_info = collect_base_env()
env_info['MMClassification'] = mmcls.__versio... |
f36bdd2516c9f1919411754f7ee27a7ffb2d2311b160df8ee492e505cf126154 | Python | 476 | 16 | """
Smooth kernel density with marginal histograms
==============================================
_thumb: .48, .41
"""
import seaborn as sns
sns.set_theme(style="white")
df = sns.load_dataset("penguins")
g = sns.JointGrid(data=df, x="body_mass_g", y="bill_depth_mm", space=0)
g.plot_joint(sns.kdeplot,
fi... |
7f9d4183cccedcca7bddae8c983ee00c7b078072563f1bc75f1836c8a40aa620 | Python | 477 | 17 | # 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 SequenceLength(OpRun):
def _run(self, input_sequence):
if not isinstance(input_sequence, list):
raise TypeError... |
9e8ce926f794a8a3679d1ed0b2b860f29a4382a71644e6147d6b62768f02e74c | Python | 477 | 15 | import utils
import os
model_url = "https://modac.cancer.gov/api/v2/dataObject/NCI_DOE_Archive/NCI-DOE_RT/Canine_tumor_classifier/Tumor_type_classifier_models"
cnn_17 = "17CT.model.h5"
cnn_18 = "18CT.model.h5"
models = [cnn_17, cnn_18]
for model in models:
data_loc = utils.fetch_file(model_url + model, unpack=F... |
c3395edea83dbc794c55c5040fc2b61accd14a09ddde3aadf03bdcf8683836f7 | Python | 478 | 15 | # Copyright 2019-20213The 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
#
from .TransE import TransE
from .DistMult import DistMult
from .HolE import Hol... |
68d5e796fe8745e308039647e5efc552848c2216ca4eb4a50e52507d75cc816e | Python | 481 | 12 | """Module defining decoders."""
from onmt.decoders.decoder import DecoderBase, InputFeedRNNDecoder, \
StdRNNDecoder
from onmt.decoders.transformer import TransformerDecoder
from onmt.decoders.cnn_decoder import CNNDecoder
str2dec = {"rnn": StdRNNDecoder, "ifrnn": InputFeedRNNDecoder,
"cnn": CNNDecoder,... |
92cd3c7e75f5176c833a45debb213c883fce5d5b79acd4e7bcbc8be8d844f1d8 | Python | 481 | 21 | """
Multiple linear regression
==========================
_thumb: .45, .45
"""
import seaborn as sns
sns.set_theme()
# Load the penguins dataset
penguins = sns.load_dataset("penguins")
# Plot sepal width as a function of sepal_length across days
g = sns.lmplot(
data=penguins,
x="bill_length_mm", y="bill_dept... |
d546ffa684d501d5b565afcadf89efa32c7996a09bec4b115310ce7e435e52ad | Python | 481 | 23 | import sys
fi=open(sys.argv[1])
fo=open(sys.argv[2],'w')
V={}
for line in fi:
seq=line.rstrip().split('\t')
#print(seq)
this_tag=seq[0]+'\t'+seq[1]+'\t'+seq[2]+'\t'+seq[3]+'\t'+seq[4]+'\t'+seq[5]
if this_tag not in V:
V[this_tag]=[[float(seq[-1]),seq[-2]]]
else:
V[this_tag].append([... |
edc01f2519e1c11cef2123dc58f4bff35fb935697d96dc5981bf1be786ab9049 | Python | 481 | 19 | import logging
import sys
def setup_logger(name):
"""
Set up a logger that writes to standard output
"""
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
# Check if logger already has handlers to avoid duplicates
if not logger.handlers:
handler = logging.StreamHandle... |
42aa58fd0c474019883f96a9495f6ddd34f24f2ab39d66f1de2b6b8a9f8a75c0 | Python | 482 | 19 | # 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 OpRunUnaryNum
class Softmax(OpRunUnaryNum):
def _run(self, X, axis=None):
if X.size == 0:
return (X,)
axis = axis ... |
cc7bb975c418d45f1a88ceede6204009b8fbc002a14727b15f11e3732e92ea79 | Python | 482 | 24 | """
Multiple bivariate KDE plots
============================
_thumb: .6, .45
"""
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(style="darkgrid")
iris = sns.load_dataset("iris")
# Set up the figure
f, ax = plt.subplots(figsize=(8, 8))
ax.set_aspect("equal")
# Draw a contour plot to represent e... |
dac9b0293a1863430f01626c3b9d04a7d5c69547fb91bd60f62946a4c64f78bb | Python | 483 | 19 | """
Plotting a three-way ANOVA
==========================
_thumb: .42, .5
"""
import seaborn as sns
sns.set_theme(style="whitegrid")
# Load the example exercise dataset
exercise = sns.load_dataset("exercise")
# Draw a pointplot to show pulse as a function of three categorical factors
g = sns.catplot(
data=exerci... |
3c569cab205eb75cea6d8251c2b22b812eb8fac47ab1c7f5f9ba0066ad40ed81 | Python | 484 | 21 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import dataclasses
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from collections.abc import Callable
from onnx import ModelProto, NodeProto
# A container that hosts the test functi... |
7c2f3a126205a90e5bdec114cec928ac81fdbd1eb4d2056fce878cde1b8f4108 | Python | 484 | 20 | """
Runs a sweepstim 2 test and ensures that the display sequence and sweep table
match the expected values.
"""
from camstim import SweepStim, Stimulus, Window, Warp
from psychopy import visual
window = Window(fullscr=True, monitor="GammaCorrect30",
warp=Warp.Spherical)
stim = Stimulus.from_fil... |
ccbdfb49df72aeb88e81c16734530a4407687465578b90f5919ab7df1da4509d | Python | 484 | 14 | import seaborn as sns
# tab10 = sns.color_palette("tab10")
# tab10_pastel = sns.color_palette("pastel")
# method_palette = dict(zip(["GM", "BGM"], [tab10_pastel[0], tab10[3]]))
# tab10 = sns.color_palette("tab10")
tab10_colorblind = sns.color_palette("colorblind")
method_palette = dict(zip(["GM", "BGM"], [tab10_color... |
d71345fa447f727298df0f4d3c3144ecea53ecc87604b3b239b83005fd4f1791 | Python | 487 | 21 | # 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 _global_average_pool(x: np.ndarray) -> np.ndarray:
axis = tuple(range(2, np.ndim(x)))
y = np.average(x, axis=axis)
for _ in a... |
7094a80b72735ef5eb8d21e9a6bd0294c63fe96c0e2cffe9b91287b1cb097182 | Python | 491 | 15 | """
Scatterplot with marginal ticks
===============================
_thumb: .66, .34
"""
import seaborn as sns
sns.set_theme(style="white", color_codes=True)
mpg = sns.load_dataset("mpg")
# Use JointGrid directly to draw a custom plot
g = sns.JointGrid(data=mpg, x="mpg", y="acceleration", space=0, ratio=17)
g.plot_jo... |
679639d784e1af67577beca5d4c7f58cf0ff0b4de6d3cc0313888022d73696b7 | Python | 492 | 17 | """damage_profile — overlap statistics between subject maps and brain atlases."""
from bcblib.tools.damage_profile._atlas import AtlasSpec, load_atlas, detect_atlas_format
from bcblib.tools.damage_profile._atlas_manager import (
get_preset_atlas,
list_preset_atlases,
)
from bcblib.tools.damage_profile._core im... |
00374fa15a06260f615e1e66c24908f70c5ea8a4b0086a9c827f0b5659b5d52e | Python | 494 | 18 | """Test functions for load_hierarchical_sales_toydata."""
__author__ = ["fkiraly"]
from sktime.datatypes import check_raise
def test_load_hierarchical_sales_toydata():
"""Test that load_hierarchical_sales_toydata runs and returns expected format."""
from sktime.datasets import load_hierarchical_sales_toydat... |
56b27930a3dbda24038a4938edd7782e2452f142e173e05a54cd06d1c54618de | Python | 494 | 19 | # 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 _vcelu1(x: np.ndarray, alpha: float = 1.0) -> np.ndarray:
positive_input = np.maximum(0, x)
negative_input = np.minimum(0, alpha ... |
18a7bb33dfbe472b2ff72c4bc3b87ebc242b2df1700a93a03d44d59b9c3dbb93 | Python | 495 | 18 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import ml_dtypes
import numpy as np
from onnx.reference.op_run import OpRun
class Det(OpRun):
def _run(self, x):
# Compute low-precision inputs in float32, then restore the input dtype.
... |
a308910fdf162d37587d6c7b5dd50929a9d78e4a14bd22d4c45987161c0941e8 | Python | 495 | 21 | """
Violinplots with observations
=============================
"""
import numpy as np
import seaborn as sns
sns.set()
# Create a random dataset across several variables
rs = np.random.RandomState(0)
n, p = 40, 8
d = rs.normal(0, 2, (n, p))
d += np.log(np.arange(1, p + 1)) * -5 + 10
# Use cubehelix to get a custom ... |
0262f6e2b4b3b300ad7e9f46051b6252811dbc3be7a40b525235eda19d34909a | Python | 496 | 19 | fi=open('gencode.v39.annotation.gtf.pc.sorted.changed.bed')
fo=open('gencode.v39.annotation.gtf.pc.sorted.changed.bed.uniqGene.bed','w')
GENE={}
for line in fi:
seq=line.rstrip().split('\t')
this_gene=seq[3]
this_len=int(seq[4])
if this_gene not in GENE:
GENE[this_gene]=[[this_len,line]]
else... |
3c474d156204f47e4fbf3bb94da29c0d6f4558b991de0e16877cc5596f47fe45 | Python | 497 | 24 | """
Read the ASA table (by size), as exported into a csv file
"""
from __future__ import print_function
import pandas as pd
import numpy as np
fn = 'VCN_ASA.csv'
df = pd.read_csv(fn)
print(df['7'][0])
for k in df.keys():
n = 0 # count how many
while not np.isnan(df[k][n]):
if n == 0:
pri... |
f21e72c6e9edb928af76afd7bc8c7541e21277e9318ec5bc9168d33a50d05d57 | Python | 497 | 20 | from setuptools import setup
setup(
name='robustlink',
version='0.1.0',
description='A python package for linking genes and enhancers',
url='https://github.com/FangmingXie/robustlink',
author='Fangming Xie, Eran Mukamel',
author_email='emukamel@ucsd.edu',
license='MIT',
packages=['robus... |
c1a6d3a57b84714aede6f19e9b51a03a536fd4b421f0c91798745d49aeddf8e5 | Python | 498 | 19 | """TDE classifiers - numba methods."""
__author__ = ["MatthewMiddlehurst"]
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.utils.numba.njit import njit
if _check_soft_dependencies("numba", severity="none"):
from numba import types
@njit(fastmath=True, cache=True)
def _histogram_inte... |
89fc02cbc8a13be017b7739af0a321fe2f1c737ac1c046c2e8b30def3a6719a2 | Python | 501 | 16 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops._op_common_random import _CommonRandom
class RandomUniform(_CommonRandom):
def _run(self, dtype=None, high=None, low=None, seed=None, shape=None):
dtype = self._dtyp... |
75e5ae52157fc1137520373934ea4fb76e1c1b5d10f9e8105b7c6fd6af85e652 | Python | 503 | 21 | # Capture the original matplotlib rcParams
import matplotlib as mpl
_orig_rc_params = mpl.rcParams.copy()
# Import seaborn objects
from .rcmod import *
from .utils import *
from .palettes import *
from .relational import *
from .regression import *
from .categorical import *
from .distributions import *
from .timeseri... |
dcae6453e61e0d9915f47051e236522473ba060cd4c029fff348c54659f1ecde | Python | 503 | 19 | # 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 MatMulInteger(OpRun):
def _run(self, A, B, a_zero_point=None, b_zero_point=None):
A32 = A.astype(np.int32)
if a_zer... |
40eed9da410002d418313ff8cecf65043b79f5e715ea5fbc1cea480b8dc01e16 | Python | 504 | 21 | from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="probemapper",
version="0.0.1",
author="Tomoyuki Mano",
author_email="tomoyuki.mano1@oist.jp",
description="",
long_description=long_description,
long_description_content_type="text/markdown... |
482610bc40daf52b9995b2c4ba9914fcdb249971ea238678252cc9e7381cc416 | Python | 504 | 27 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import sys
import atheris
with atheris.instrument_imports():
from onnx import checker
def TestOneInput(data):
try:
checker.check_model(data, full_check=True)
except Exception:
... |
530ff4296a1a8d9508b9e7b89df841823e1448904834b38183285deb42247a4e | Python | 504 | 11 | from setuptools import setup
setup(
name='mprl',
version='1.0',
description='Multiplayer Rienforcement Learning. Research Code Release for P2SRO. https://arxiv.org/abs/2006.08555',
author='J.B. Lanier, Stephen McAleer',
author_email='johnblanier@gmail.com',
packages=['mprl'], #same as name
instal... |
211a45cccd901f008ec7356d95cff2f00d8da23a930d329cda6e4f0b44df6d8b | Python | 505 | 17 | #!/usr/bin/env python3
import os
import re
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
config_h = os.path.join(base_path, 'include', 'spdlog', 'version.h')
data = {'MAJOR': 0, 'MINOR': 0, 'PATCH': 0}
reg = re.compile(r'^\s*#define\s+SPDLOG_VER_([A-Z]+)\s+([0-9]+).*$')
with ... |
9e4a3e9f98060acc5a6a35d522f4484cf4eaf0ed2dcf7ccb0105ecd8dcb825fc | Python | 505 | 19 | import matplotlib.pyplot as plt
import numpy as np
C=np.loadtxt("C_chlor")
t=np.loadtxt('t_chlor')
fig=plt.figure(figsize=(25,20))
plt.title('Chlorpromazine', fontsize=36, fontweight='bold')
plt.xlabel("Time (Minutes)", fontsize=34, fontweight='bold')
plt.ylabel("Chlorpromazine Concentration (Moles per cm3... |
50ef89a75b30227383e1559ae909f5633b462ce83f8f3b130664e6796520ca3c | Python | 508 | 17 | from flair.data import Sentence
from flair.embeddings import DocumentTFIDFEmbeddings
from tests.embedding_test_utils import BaseEmbeddingsTest
class TFIDFEmbeddingsTest(BaseEmbeddingsTest):
embedding_cls = DocumentTFIDFEmbeddings
is_document_embedding = True
is_token_embedding = False
default_args = ... |
bf93773db5baac7c802219f65b4c1c1cb4d2d65a0e999c4077fa88fd94a33986 | Python | 508 | 17 | """ Tests for the various cli programs """
import sys
from pyontutils.utils import get_working_dir
from pyontutils.integration_test_helper import _TestCliBase, Folders
extras = tuple()
if get_working_dir(__file__):
# strange that make_config failed in travis in a pipenv as couldn't find pyontutils?
extras += ... |
490533f34d094b98c7f071aaf0b786e82ca397a3ec18f70bb49935855727877f | Python | 510 | 18 | import pathlib
import runpy
import pytest
import sys
from e2e.features.molecular.test_genes import xfail_if_allen_api_unavailable
examples = pathlib.Path('./examples').resolve().rglob('*.py')
python_version = sys.version_info
@pytest.mark.parametrize('example', examples)
@xfail_if_allen_api_unavailable
def test_scri... |
3a5dc57515aceebc7e7135480bef5fd4805571374234c5ee355178771240fd48 | Python | 511 | 28 | from zro import RemoteObject
from toolbox.IO.nidaq import DigitalInput
class DIServer(RemoteObject):
def __init__(self):
super(DIServer, self).__init__(rep_port=6500)
self.di = DigitalInput("Dev3", port=0)
def start(self):
self.di.start()
def stop(self):
self.di.stop()
... |
17357a3c5c02285a0504d7029501fb99522912be1f724a466a35c36cd58819fd | Python | 512 | 16 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops._op_common_random import _CommonRandom
class RandomNormal(_CommonRandom):
def _run(self, dtype=None, mean=None, scale=None, seed=None, shape=None):
state = self._get... |
ce89c2d8b856b6615f5dce6f5b6b6eeba9be278eaac34d1f2f854b23bb25abe1 | Python | 512 | 22 | #-------------------------------------------------------------------------------
# elftools: common/exceptions.py
#
# Exception classes for elftools
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
class ELFError(Ex... |
c85058e1570a770f47345071c5d74cb5ecbb4f1379195cc50c105cbc0a9f6f12 | Python | 513 | 17 | #!/usr/bin/env python
AUDIT_TESTS=False
# import adjust_areas
# import DataTablesVCN
# import vcnmodel.cell_config
# import vcnmodel.cellInitialization
# import vcnmodel.generate_run
# import vcnmodel.get_axon_lengths
# import vcnmodel.get_spike_rates
# import vcnmodel.make_standardized_axon
# import vcnmodel.model_par... |
0e22b2a27cff2d9bf5b4512a6541974e2faf34bb544a8ad17b682b6c5e10d5a5 | Python | 514 | 19 | import matplotlib.pyplot as plt
import numpy as np
C=np.loadtxt("C_psi")
t=np.loadtxt('t_psi')
fig=plt.figure(figsize=(25,20))
plt.title('Psylocybin', fontsize=36, fontweight='bold')
plt.xlabel("Time (Minutes)", fontsize=34, fontweight='bold')
plt.ylabel("Psilocybin Concentration (Moles per cm3)", fontsize... |
a61c7c4d2292c52bec28c15996ba63d9184220b7bf2948f46b3224f3abd16f75 | Python | 515 | 19 | """
Faceted logistic regression
===========================
_thumb: .58, .5
"""
import seaborn as sns
sns.set(style="darkgrid")
# Load the example titanic dataset
df = sns.load_dataset("titanic")
# Make a custom palette with gendered colors
pal = dict(male="#6495ED", female="#F08080")
# Show the survival proability... |
71a8ce218783947bb6854a8363203e50c3b45dc0268d137500da8d395a16066d | Python | 517 | 22 | import sys
import os
import pathlib
import logging
_logger = logging.getLogger(__name__)
def create_dir(dir_path):
"""
dir_path - A path of directory to create if it is not found
:param dir:
:return exit_code: 0:success -1:failed
"""
try:
if not os.path.exists(dir_path):
p... |
2aa9ca0ce1196b68d6ad13cd26b81187e1f6c32ed803a61393bf36ce97ad0185 | Python | 519 | 18 | """
Grouped violinplots with split violins
======================================
_thumb: .43, .47
"""
import seaborn as sns
sns.set(style="whitegrid", palette="pastel", color_codes=True)
# Load the example tips dataset
tips = sns.load_dataset("tips")
# Draw a nested violinplot and split the violins for easier compa... |
53577830351bb85a8db0b63901485e8b38e589594501f1b755d8b682dc633961 | Python | 521 | 18 | import logging
logger = logging.getLogger('base')
def create_model(opt):
model = opt['model']
if model == 'sr':
from .SR_model import SRModel as M
elif model == 'srgan':
from .SRGAN_model import SRGANModel as M
elif model == 'sftgan':
from .SFTGAN_ACD_model import SFTGAN_ACD_M... |
dce6c1370f3bbd007e81e6d097e88ff00a19225f165da3dc92fc75418e9b7845 | Python | 522 | 17 | from setuptools import setup, find_packages
setup(
name="q2-picrust2",
version="2026.7.1",
packages=find_packages(),
package_data={'q2_picrust2': ['citations.bib']},
author="Gavin Douglas & Robyn Wright",
author_email="robyn.wright@dal.ca",
description="Metagenome inference based on marker ... |
e0f9516a309f0d8194c959d108d0e49ac566114073c08d0eca6004025c760131 | Python | 522 | 18 | """
Scatterplot with categorical variables
======================================
"""
import pandas as pd
import seaborn as sns
sns.set(style="whitegrid", palette="muted")
# Load the example iris dataset
iris = sns.load_dataset("iris")
# "Melt" the dataset to "long-form" or "tidy" representation
iris = pd.melt(iris,... |
e1f3de84aa12e82d13e539a194cf1781ed479fb10cc11ab429d6f5d30f86f54c | Python | 523 | 21 | """
Joint kernel density estimate
=============================
_thumb: .6, .4
"""
import numpy as np
import pandas as pd
import seaborn as sns
sns.set(style="white")
# Generate a random correlated bivariate dataset
rs = np.random.RandomState(5)
mean = [0, 0]
cov = [(1, .5), (.5, 1)]
x1, x2 = rs.multivariate_normal(m... |
8905e5431e3c4c6b96a8cf5cdbba0f650223eba55714d1d99f0fe410ea91b5e3 | Python | 524 | 23 | """
Line plots on multiple facets
=============================
_thumb: .48, .42
"""
import seaborn as sns
sns.set_theme(style="ticks")
dots = sns.load_dataset("dots")
# Define the palette as a list to specify exact values
palette = sns.color_palette("rocket_r")
# Plot the lines on two facets
sns.relplot(
data... |
2c33744debd888b64d057cff77a9f7dce8e7447535195254761e5175d79702ed | Python | 528 | 28 | # SPDX-License-Identifier: LGPL-3.0-or-later
from deepmd.dpmodel.loss.dos import (
DOSLoss,
)
from deepmd.dpmodel.loss.ener import (
EnergyLoss,
)
from deepmd.dpmodel.loss.ener_spin import (
EnergySpinLoss,
)
from deepmd.dpmodel.loss.property import (
PropertyLoss,
)
from deepmd.dpmodel.loss.tensor impo... |
2cf633ac8398aaf40adec547f21d9294ad4df5123498196127d2f0fa448de072 | Python | 528 | 28 | # SPDX-License-Identifier: LGPL-3.0-or-later
from deepmd.pt_expt.loss.dos import (
DOSLoss,
)
from deepmd.pt_expt.loss.ener import (
EnergyLoss,
)
from deepmd.pt_expt.loss.ener_spin import (
EnergySpinLoss,
)
from deepmd.pt_expt.loss.property import (
PropertyLoss,
)
from deepmd.pt_expt.loss.tensor impo... |
2e463a39707681d1a4012c10152163e6911df818a17b39c18dd5537254edc98a | Python | 528 | 26 | import logging
import tempfile
from shutil import rmtree
log = logging.getLogger(__name__)
def handle_cache(func):
"""Decorator to handle cache
It fixes https://github.com/ANTsX/ANTsPy/issues/117
"""
def cache(*args, **kwargs):
"""Cache wrapper"""
cache_dir = tempfile.mkdtemp() + "... |
617fd25bf7b68a44cda8505ff321fc774cc086c48f0be0d7c60a0607bb122615 | Python | 529 | 13 | #Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#This program is free software;
#you can redistribute it and/or modify
#it under the terms of the MIT License.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHA... |
efac634dfb3ad88a8b19f99cfc29d8aa4a84abb99b8b1864b06e34537485baa7 | Python | 529 | 14 | # ----------------------------------------------------------------------------
# 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.
# ------------------------------------------------... |
76aec30a011d1c2073ab87a0732cf37f97411cf75f8f364b2ff8c7f7800d9e6e | Python | 531 | 14 | from __future__ import print_function
import numpy as np
from numpy import ndarray
def emg2feature(emg, emgTimeFrameNum):
emgFeature = np.zeros((emgTimeFrameNum,1), dtype=float)
emgLen = emg.shape[0]
emgShortSegmentLen = int(np.floor(emgLen / emgTimeFrameNum))
for i in range(emgTimeFrameNum):
s... |
40dcfc670b207361a186d6617ec930972c3bacf43fb0a2176e5a70402d415cf2 | Python | 532 | 25 | import random
import numpy as np
import tensorflow as tf
def data_dict_to_array(data_dict, names):
"""
data_dict: dict each entry is a subject
names: list of strings
return numpy tuple array
"""
data_out = [data_dict[name] for name in names]
data_out = tuple(data_out)
data_out = np.c... |
4add257604e9d07e42fe16a629f5f9371f8d1fd1e641d99e090ab7dc0c230175 | Python | 535 | 22 | """Recursively set the kernel name for all jupyter notebook files."""
import sys
from glob import glob
import nbformat
if __name__ == "__main__":
_, kernel_name = sys.argv
nb_paths = glob("./**/*.ipynb", recursive=True)
for path in nb_paths:
with open(path) as f:
nb = nbformat.read... |
4d9193e13348f909b66a8fdd6eaa81d9ab1fa2e1835913786795880815f11ed6 | Python | 536 | 16 | #!/usr/bin/env python
import argparse
import torch
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Removes the optim data of PyTorch models")
parser.add_argument("--model", "-m",
help="The model filename (*.pt)", required=True)
parser.add_argument("... |
178c41e772037ea65301e8b14ddc050d76feb05d11d64bd042ad00490a92b180 | Python | 537 | 20 | """
Paired categorical plots
========================
"""
import seaborn as sns
sns.set_theme(style="whitegrid")
# Load the example Titanic dataset
titanic = sns.load_dataset("titanic")
# Set up a grid to plot survival probability against several variables
g = sns.PairGrid(titanic, y_vars="survived",
... |
2c7866aa82ec3dbe02e1bca2c786479c093b1fd7210de0bb648c57b56dd73046 | Python | 538 | 20 | from __future__ import division
import mkl
mkl.set_num_threads(1)
from SPHARM.lib import plotting as plt
import os
path = '../../../Data/Synthetic_cells/output/'
if os.path.exists(path):
kwargs = {'max_threads': 100, 'voxel_size': 1}
for gridsize in [20, 40, 60, 80, 100, 120, 140, 160, 180, 200]:
pl... |
460398758ec9dc6fe83833dce323631bd52f615b45e0da716e1c96d346dbddc3 | Python | 538 | 19 | """
Faceted logistic regression
===========================
_thumb: .58, .5
"""
import seaborn as sns
sns.set_theme(style="darkgrid")
# Load the example Titanic dataset
df = sns.load_dataset("titanic")
# Make a custom palette with gendered colors
pal = dict(male="#6495ED", female="#F08080")
# Show the survival prob... |
c07cafc3137032ab68b45e378ae5261b69bc2074972d9e93a87f03298e7320df | Python | 539 | 8 |
#=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick Mueller
# Computer Vision Studio
# Friedrich Miescher Laboratory of the Max Planck Society
# Systems Biology of Development, Univer... |
5dfd2aae7bd5dece16aeaa063e4a0d33727419d4d2f834b32ef9005f7563b35e | Python | 540 | 15 | from .stochastic_terminal import StochasticTerminal
from .psd import PSD
class Synapse(object):
"""Encapsulates a synaptic connection between two cells.
Instances of this class are created by calling `Cell.connect()`.
"""
def __init__(self, pre_cell, pre_opts, post_cell, post_opts, type='multisite'):... |
c6201d818871c308d64efde8a534c3b38e82c76a6f82b9acd7a920490f7e45a0 | Python | 540 | 24 | __author__ = "Paul B. Manis and Luke Campagnola"
__version__ = "0.50"
try:
import faulthandler
faulthandler.enable()
except ImportError:
pass
import logging
logging.basicConfig(level=logging.INFO, format="[%(process)s] %(message)s")
import os
dirname = os.path.abspath(os.path.dirname(__file__))
libpath = ... |
b4353bb43ae992c02c8115f8cc52bd0d25a724a0074dbdee5d1c4f567c308e64 | Python | 541 | 12 | # Copyright (c) OpenMMLab. All rights reserved.
from .eval_hooks import DistEvalHook, EvalHook
from .eval_metrics import (calculate_confusion_matrix, f1_score, precision,
precision_recall_f1, recall, support)
from .mean_ap import average_precision, mAP
from .multilabel_eval_metrics import ave... |
12f2b2a216bacb635ebd37029c0b28e248d27c539e46ffb4a7c8c1ddf1ca7ffd | Python | 543 | 19 | from livingTree import SuperTree
from tqdm import tqdm
def construct(cfg, args):
print('Reading microbiome structure...')
with open(args.input, 'r') as f:
con = f.read().splitlines()
print('Generating Ontology...')
otlg = SuperTree()
str_cumsum = lambda x: [':'.join(x[0:i]) for i in range(1, len(x)+1... |
a3e3f9e5ce92ec7bea0b7dc2257241b5007d1027a07dfb7e58a3f29363994d0e | Python | 544 | 17 | #!/usr/bin/env python3 -u
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Base classes for defining estimators and other objects in sktime."""
__author__ = ["mloning", "RNKuhns", "fkiraly"]
__all__ = [
"BaseObject",
"BaseEstimator",
"BasePanelMixin",
"_HeterogenousMetaEstimat... |
666dfd0ddd65a4127b14c3d2d695ef3c0f56507aff19d4a4388567f443e41045 | Python | 545 | 18 | """Settings for bycycle tests."""
import os
from pathlib import Path
###################################################################################################
###################################################################################################
# Settings for test simulations
N_SECONDS = 10
F... |
767df8c27c74d907b8e297cbb5186f29ee35f97f1245fe63e797e6083ad35822 | Python | 545 | 18 | # -*- coding: utf-8 -*-
"""
NetworkUnit is a SciUnit library for validation testing of neural network models.
:copyright: Copyright2018 by the NetworkUnit team, see AUTHORS.txt.
:license: Modified BSD, see LICENSE.txt for details.
"""
from . import tests, models, capabilities, scores, plots
def _get_version():
i... |
0bb27abf9223a55895abb5dcfc082396b4caae60ac77608283ad71d15299ece0 | Python | 547 | 17 | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Yaoyao Liu
## Tianjin University
## liuyaoyao@tju.edu.cn
## Copyright (c) 2019
##
## This source code is licensed under the MIT-style license found in the
## LICENSE file in the root directory of this source tree
##++++++++++++++... |
c8d3c42a3c2cbe46fa063db5b91f0a0352fef40bb2e4ce792105654ca1d1ed7a | Python | 547 | 20 | from __future__ import annotations
import random
import numpy as np
import torch
def set_seed(seed: int = 42) -> None:
"""Set random seeds for reproducible NumPy/PyTorch experiments."""
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.cud... |
8f4d340eb5f5bfd6488cf0ede1902e82e1895cd7a921d8301e02d9962934b759 | Python | 548 | 26 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Neural-network building blocks of the Uni-Mol v1 backbone."""
from .encoder import (
GaussianLayer,
NonLinearHead,
SelfMultiheadAttention,
TransformerEncoderLayer,
TransformerEncoderWithPair,
)
from .heads import (
DistanceHead,
MaskLMHead,
... |
08250474c0fbe833cbaf4726b890e29020beff8de2c818d575be79b2343af156 | Python | 549 | 18 | """Compositions for classifiers."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
__author__ = ["mloning", "fkiraly"]
__all__ = [
"ClassifierPipeline",
"ColumnEnsembleClassifier",
"MultiplexClassifier",
"SklearnClassifierPipeline",
]
from sktime.classification.compose._colum... |
97b4694acf362b2b89447240bfe6f676e8c8c91c2a52b64fda192fa12475ec51 | Python | 549 | 25 | from importlib.metadata import version, PackageNotFoundError
from .core.STDataset import STDataset
from .run import run
from .core.io import load_10X, load_anndata_h5, load_table
from .core.combinations import find_combinations
from . import filters, normalizers, plot
try:
__version__ = version("svgbit")
except ... |
c58cffd3cd85bbf4694c5ee20d4cac03d882e994a906925a2194d65057217f04 | Python | 549 | 16 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Dynamic time warping distances."""
__all__ = [
"DtwDist",
"DtwPythonDist",
"DtwDistTslearn",
"SoftDtwDistTslearn",
"DtwDtaidistMultiv",
"DtwDtaidistUniv",
]
from sktime.dists_kernels.dtw._dtw_dtaidist import DtwDtaidist... |
1edecb11feae49b153871ac172eda495d3e804e045fe75466762f5edbcae5924 | Python | 553 | 16 | from flair.data import Sentence
from flair.models import RegexpTagger
def test_regexp_tagger():
sentence = Sentence('Der sagte: "das ist durchaus interessant"')
tagger = RegexpTagger(
mapping=[(r'["„»]((?:(?=(\\?))\2.)*?)[”"“«]', "quote_part", 1), (r'["„»]((?:(?=(\\?))\2.)*?)[”"“«]', "quote")]
)... |
5c634ff466b22a58e8f59287979f39132082490cdeea5dedc90b08dcd4214a86 | Python | 553 | 18 | import os
os.environ['DLClight'] = 'True'
import glob
import deeplabcut
LOC='recordings/'
CONFIG=LOC+'/config.yaml'
### Train DLC model with parameters in config.yaml
deeplabcut.train_network(config=CONFIG)
folders = sorted(glob.glob(location))
BEHAVIOUR='/rearing'
for f in folders:
print('Processing '+f)
de... |
d04217cda336cfe1585d490c4934182a34e05de368e21c54eefe891d25d96299 | Python | 554 | 20 | """
Paired categorical plots
========================
"""
import seaborn as sns
sns.set(style="whitegrid")
# Load the example Titanic dataset
titanic = sns.load_dataset("titanic")
# Set up a grid to plot survival probability against several variables
g = sns.PairGrid(titanic, y_vars="survived",
x_va... |
20f97760e15e82c172d6699a9e767c947c1aa9604ce127fac0064f46d3e48af7 | Python | 555 | 18 | from torch.nn import ParameterDict
class ParameterDictNew(ParameterDict):
"""We modify ParameterDict so that keys can be non-strings.
In our case, tuples of integers, but this code is universal."""
def __getitem__(self, key):
return self._parameters[str(key)]
def __setitem__(self, key, param... |
56d03e023697a92b64c087e62f2306eeb18185a9167049ffc6889134244f58ff | Python | 555 | 18 | """
The cnmodel.data package contains information about ion channel densities,
connectivity, synaptic properties, and population distributions. These values
are used by the Cell, Synapse, Population, and related classes to determine
all model construction parameters.
Values are stored in python strings that contain h... |
7503c40646a1d847bca1c9ed55b016e65eb6cc06f36393b725d3a3fcdbb38127 | Python | 555 | 26 | """Type definitions for ParaDime."""
from typing import Callable, Literal, Tuple, Union
import numpy as np
import numpy.typing as npt
import scipy.sparse
import torch
Rels = Union[
np.ndarray,
torch.Tensor,
scipy.sparse.spmatrix,
Tuple[np.ndarray, np.ndarray],
]
TensorLike = Union[
np.ndarray,
... |
9fd9b3149e2cc6d2e0aa7b22151e5df972baff4db93dd06fd9554dd4a5fb5a80 | Python | 555 | 16 | from __future__ import print_function
import numpy as np
from scipy import signal
from featureExtractor import FeatureExtractor
class FeatureExtractorWavelet(FeatureExtractor):
def __init__(self, params):
self.params = params
self.extractorType = 'wavelet'
def getFeatures(self, eegSegment, ti... |
0d483ef58f8bd06186b77ef2888ce53c5e338a9e1e0b0472e52a3400e3ec60da | Python | 556 | 21 | """
Scatterplot with marginal ticks
===============================
_thumb: .68, .32
"""
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="white", color_codes=True)
# Generate a random bivariate dataset
rs = np.random.RandomState(9)
mean = [0, 0]
cov = [(1, 0), (0, 2)]
x, y = rs.... |
e822f93d22551a2ac8fb87938a51c0ccb16b8635fadd5093cdafc7a4b406c46a | Python | 557 | 16 | from sktime.clustering.agglomerative import TimeSeriesAgglomerativeClustering
from sktime.datasets import load_basic_motions
def test_agglomerative_basic_run():
"""Test that agglomerative clustering runs without error on simple data."""
X, _ = load_basic_motions(split="train")
X = X[:10]
clst = TimeS... |
f2aa2c50eb6149b49e4005b3fc364c8a285983a79680d1e3da8a84bdebd47e61 | Python | 557 | 15 | # 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.
def configuration(parent_package='',top_path=None):
from numpy.d... |
6aeed3e0cb331fc5c44f47e3e2a12904fa7c8fa5b806f8730994d725f583697f | Python | 558 | 20 | """ Main entry point of the ONMT library """
from __future__ import division, print_function
import onmt.inputters
import onmt.encoders
import onmt.decoders
import onmt.models
import onmt.utils
import onmt.modules
from onmt.trainer import Trainer
import sys
import onmt.utils.optimizers
onmt.utils.optimizers.Optim = on... |
1413f655324b2ffae1d33fc728162dc6d89e211aeb6081cf4030d24c9a7e8278 | Python | 559 | 24 |
"""
Metric Encoder class for json dumps
"""
import json
from json import JSONEncoder
from ts.metrics.dimension import Dimension
from ts.metrics.metric import Metric
class MetricEncoder(JSONEncoder):
"""
Encoder class for json encoding Metric Object
"""
def default(self, obj): # pylint: disable=ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.