sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
558283c63721f5bff7d332c3635fb47c2dc69960857cbff8aa1aae0ccdd33505 | Python | 7,481 | 197 |
import sys
import time
import wandb
import numpy as np
import pandas as pd
import torch
from hyper_dti.trainer import CrossValidator
from hyper_dti.baselines.tabular_baselines import TabBaselinePredictor
def reproduce_hyperpcm(dataset='Lenselink', split='lpo', drug_encoder='CDDD', target_encoder='SeqVec',
... |
5f06f328592920feb1e3b07e333542a3d3ace351de687f3af80ac035726ca6ec | Python | 7,487 | 257 | import numpy as np
from scipy import linalg
from .utils import get_nfeatures, preprocess_trajs, trajs_matmul
def projection_distance(u, v, weights=None, ortho=False):
r"""Compute the projection distance between sets of features.
The projection distance between subspaces :math:`U` and :math:`V` is
.. mat... |
e7155ce78a538d3de738d1c2bb4bd29b2477ed3449e5354d5c46a357dc777733 | Python | 7,487 | 182 | """
Calculate the wave directions by either interpolating trigger times and
locations or by averaging the corresponding optical flow values.
"""
import neo
import numpy as np
import quantities as pq
import matplotlib.pyplot as plt
from matplotlib import patches
import os
import warnings
import argparse
from pathlib i... |
d16d7b1d1347b4345d231e935eaf905a1f8fe4e4fa2c1616f8ef8444f03d4b77 | Python | 7,492 | 197 | import re, gc
import pandas as pd
from IPython.display import display
from banksy.main import LeidenPartition
from banksy.labels import Label, match_label_series
import leidenalg
from sklearn.metrics.cluster import adjusted_rand_score
def run_partition(
processing_dict: dict,
resolutions: list, ... |
dd7636e3719d594a69a54cbd3f2e82b4a5b00228d134331e8bc06c134883d794 | Python | 7,492 | 215 | import pytest
import geomstats.backend as gs
from .manifold import ManifoldTestData
from .riemannian_metric import RiemannianMetricTestData
class KleinBottleTestData(ManifoldTestData):
skips = ("not_belongs",)
def equivalent_test_data(self):
data = [
dict(
point_a=gs.arr... |
e6b0f0cbb972673d76c13850caa018e61864cc7885f64ce11f48b3c159b90c9b | Python | 7,497 | 212 | """Focused round-trip tests for SanPy-owned NWB recording state."""
from __future__ import annotations
from dataclasses import replace
from datetime import datetime, timezone
import json
from pathlib import Path
import h5py
import numpy as np
import pytest
from pynwb import NWBHDF5IO
import sanpy
from sanpy.bAnalys... |
fbeb067fb59cf0ddf312da53c66b3b603f15b8938376cb29b0c231cb93440410 | Python | 7,499 | 214 |
from pathlib import Path
import imageio.v2 as imageio
import matplotlib.pyplot as plt
import numpy as np
import ppafm.ml.AuxMap as aux
import ppafm.ocl.field as FFcl
import ppafm.ocl.oclUtils as oclu
import ppafm.ocl.relax as oclr
import torch
from matplotlib import cm
from ppafm.ml.Generator import InverseAFMtrainer... |
9dbf1a19b93c636be688932b0d93fbd7d840764a86bddb3ac114c66b0c5e8530 | Python | 7,500 | 233 | """Module for function spaces as geometric objects."""
import math
import geomstats.algebra_utils as utils
import geomstats.backend as gs
from geomstats.geometry.manifold import Manifold
from geomstats.geometry.riemannian_metric import RiemannianMetric
class HilbertSphere(Manifold):
"""Class for space of one di... |
8a06159259beeae58a7c4879e9746a0007f5953fceaab91427fd3587f243793a | Python | 7,506 | 207 | """
Parse features generated by Random Forest classifier and
compute feature importance distribution.
@author: Kyuhwa Lee
Swiss Federal Institute of Technology Lausanne (EPFL)
"""
import os
import scipy.io
import numpy as np
from neurodecode import logger
#------------------------------------------------------------... |
930f5c2648c6d513803f56edc3cf34f87972b9e41638c1acbc117175ee4677ed | Python | 7,509 | 206 | from ppdet.core.workspace import register, serializable
import cv2
import os
import tarfile
import numpy as np
import os.path as osp
from ppdet.data.source.dataset import DetDataset
from imgaug.augmentables.lines import LineStringsOnImage
from imgaug.augmentables.segmaps import SegmentationMapsOnImage
from ppdet.data.c... |
ef6c5aa55806cb4653393f507a0d6e0fe96f724cbfb2a3bda7365bc2eae0524c | Python | 7,509 | 164 | """
author: trentbrick and yannadani
Utils for the discrete layers. Taken from https://github.com/google/edward2/blob/2077d67ab8a5c73c39b8d43ccc8cd036dc0a8566/edward2/tensorflow/layers/utils.py
Which is introduced and explained in the paper: https://arxiv.org/abs/1905.10347
And modified for PyTorch.
"""
import sys
i... |
f6b2459bced3a03a9c577eeb187560ca74bfa3e138699b1d7ff7cfad9018e685 | Python | 7,519 | 193 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
99abbba1a558111ab8d7cde88787a6173498d075e8cbf40d6de1c66c49d5944d | Python | 7,520 | 241 | '''
the preprocessing code refers to the work(Yin, B., Corradi, F. & Bohté, S. M. Accurate and efficient time-domain classification with adaptive spiking recurrent neural
networks. Nat. Mach. Intell. 3, 905–913 (2021)).
'''
import os
import numpy as np
import scipy.io.wavfile as wav
import torch
from torch.utils.data i... |
e09e080e856681f3acc1e31c775364b0aacd64d0ed800745a0223be47c368343 | Python | 7,520 | 205 | from typing import Optional, Sequence
from overrides import overrides
from chromadb.api.types import GetResult, Metadata, QueryResult
from chromadb.config import System
from chromadb.execution.executor.abstract import Executor
from chromadb.execution.expression.plan import CountPlan, GetPlan, KNNPlan
from chromadb.se... |
06b5e15cef73b716f5e9b3291a6324ec124b2904beab86cd26ab8318d8f02870 | Python | 7,522 | 153 | """Metrics and training-only fitting for standalone motif research assessments.
No assay is read here. Callers own grouped splits and must pass training rows only
when fitting paired coefficients or thresholds. Partial AP retains tied score groups.
"""
from __future__ import annotations
import numpy as np
def _inpu... |
78f829efc1c31df20b68e156a6e9b9dc9471e2eefa29afcceae018c739360b5f | Python | 7,528 | 167 | from typing import Tuple
import haiku as hk
from jax import numpy as jnp
from deeperwin.configuration import BaselineOrbitalsConfig, MLPConfig
from deeperwin.model import DiffAndDistances, Embeddings, MLP
from deeperwin.orbitals import OrbitalParams, evaluate_molecular_orbitals
def _determine_baseline_output_shape... |
7bb438cb1800ce45377d34c543115fc6d1cf4767581c0f7052042762655cedee | Python | 7,531 | 222 | # Copyright (c) 2020 PaddlePaddle 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
#
# Un... |
a13f3eb33fd2aa374323d241ac964569bc42ddb8668d6dd1d18a9fbe50177c5b | Python | 7,531 | 224 | import os
import logging
from tqdm import tqdm
import numpy as np
import torch
from torch.nn import functional as F
from model_tools.activations.core import change_dict, flatten
from model_tools.activations.pca import _get_imagenet_val
from model_tools.utils import fullname
from result_caching import store_dict
from cu... |
e4497de4f082d94c9ab68857da1926ec93eb3e1fa963f29d97ded654c3dc3d20 | Python | 7,534 | 184 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
2b1ff6a5be3f9d561075f3e84c663cf92689e9f9be6afbb69491d22b7c6cb786 | Python | 7,537 | 164 | import random
import torch
import numpy as np
from torch_geometric.data import Batch, Data
from torch_geometric.utils import to_undirected, degree, add_remaining_self_loops
from dig.sslgraph.utils.adaptive import eigenvector_centrality, feature_drop_weights_dense, feature_drop_weights, compute_pr, drop_feature_weighted... |
368c8d560dc6d0ee680e98aff131fb3db969d4c37db2888b2fec5496726610cf | Python | 7,537 | 229 | """Utilities for converting Snakemake apps to BIDS apps."""
from collections import OrderedDict
from pathlib import Path
from typing import Optional, Union
# pylint: disable=too-many-arguments
def bids(
root: Union[str, Path] = None,
datatype: str = None,
prefix: str = None,
suffix: str = None,
s... |
747ac20be4d162cb991ed010d50bb7d77be9cf8bdc000fb11254312d4836e105 | Python | 7,537 | 247 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Aggregator module."""
import sys
from logging import getLogger
from pathlib import Path
from click import (
Path as ClickPath,
)
from click import (
confirm,
echo,
group,
option,
pass_context,
style,
)
from ... |
9df10bb2a96aa1afe1ba5197926963765f80f27c19574f8e43ee87ac4539b786 | Python | 7,538 | 136 | """Frozen v3 forecasts, record identity, compressed exports and matched comparisons."""
import gzip
from pathlib import Path
import polars as pl
import pytest
from vdjdb.score.pipeline import load_model, record_scores, write_scores
from vdjdb.validate.confidence import check_nonregression, metrics
def test_v31_defa... |
41282e4b1dc7f34564096c019f65fe414501304aff91f7b6d41ef6289541605b | Python | 7,542 | 204 | import os
import tempfile
from typing import Dict, Any
import numpy as np
from numpy.typing import NDArray
import pytest
import onnxruntime
from unittest.mock import patch, MagicMock
from chromadb.utils.embedding_functions import ONNXMiniLM_L6_V2, EmbeddingFunction
class TestONNXMiniLM_L6_V2:
"""Test suite for ... |
2c0a2756bd4468f6bd9d4c6bf3504002ca7e96bb01ed885f54a3896f31b8a274 | Python | 7,544 | 274 |
from sleepy.gui.tagging.core import DataEvent
from sleepy.gui.tagging.model.event import UserPointEvent
from sleepy.gui.tagging.model.exceptions import UserEventExists
import numpy as np
class Navigator:
def __init__(self, events, changesMade = False):
self.events = events
self.userEven... |
6792f4a6e2ad7f80db1837c73b7f7f21e4f75e30ac2990099e8542dd828c1fbf | Python | 7,554 | 175 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from dataclasses import dataclass
from math import sqrt
import torch
from e3nn.o3._irreps import Irreps
from nequip.data import AtomicDataDict
from nequip.data._key_registry import _GRAPH_FIELDS
from ... |
feedb5f055466c899f405f69d095f7577f68febccec4731c042bebec4d45d528 | Python | 7,557 | 212 | #
# This module contains functions of neural network to apply regression on
# the EFI measurements.
#
from __future__ import absolute_import, division
from __future__ import print_function, unicode_literals
import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa
def build_dense_mlc_model(input_neur... |
ec443a47e6f57e5a793b77887f438fccb220f8c3f320dfd555e2dc1cb5532cb0 | Python | 7,565 | 236 | import click
import torch
from math import log
from corgie.log import logger as corgie_logger
from corgie.boundingcube import get_bcube_from_coords
from corgie import scheduling, stack
from corgie.argparsers import (
LAYER_HELP_STR,
corgie_optgroup,
corgie_option,
create_stack_from_spec,
)
class VoteJ... |
a5585ef98c1ac8fecdb691d4711ba006bf4c22ccca87e6a5a015dcc7be461488 | Python | 7,566 | 314 | import analysis_utils as au
import numpy as np
import seaborn as sns
import matplotlib
# define data_ from experiment
# cam extract with https://apps.automeris.io/wpd/
data_ = [
{
'at': 'at_punish',
'is_switch': False,
'value': 0.07656332326255083,
'PC': 'Data',
},
{
... |
dccefe0806f0fa22eb81a2aa11f4a03d0274dff028e048af1814db7f01470862 | Python | 7,566 | 207 | """Contract tests for `plot_surf` and `plot_flatmap`.
Covers the layout nltools adds on top of nilearn: the sign-aware stat-map
range, the grid shape implied by `view`/`hemi`, the shared colorbar, the
transparency mask, and the errors raised for an empty or invalid request.
"""
import os
import numpy as np
import pyt... |
1bf2958ffbc2dbd66f66648d98faff9fced9519b48127c35e7d62d6643791e2d | Python | 7,567 | 227 | import numpy as np
import torch
import torch_geometric.transforms as T
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
from tqdm import tqdm
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_auc_score, average_precision_score
# import warnings filter
from w... |
13ea23bff0f8d9791fc9e8ec4e59009cd8c2c38fd994c5885fbeb65aa8856abe | Python | 7,568 | 202 | import math
from concurrent.futures import ThreadPoolExecutor, as_completed
import pytest
from chromadb import SparseVector
from chromadb.utils.embedding_functions.chroma_bm25_embedding_function import (
DEFAULT_CHROMA_BM25_STOPWORDS,
ChromaBm25EmbeddingFunction,
)
def _is_sorted(values: list[int]) -> bool:... |
4d8cb8f0d40afa42618488eb8d7bebaf2fc9250f47d541e2db5e03396005876b | Python | 7,568 | 226 | import numpy as np
import pytest
import torch
from ase import Atoms
import ase.build
from ase.calculators.singlepoint import SinglePointCalculator
from nequip.data import AtomicDataDict, compute_neighborlist_, from_ase, from_dict
from nequip.nn.utils import with_edge_vectors_
from nequip.data._nl import (
NEIGHBOR... |
b4ab394e0bbe89bb2b3dc1ba62b8dc4089ec9d9a6449fbfe69f67dc60b3600fe | Python | 7,568 | 161 | from __future__ import annotations
import itertools
import logging
import os
import numpy as np
import xarray as xr
from result_caching import store_xarray
from model_tools.activations.core import flatten
from model_tools.utils import fullname
from custom_model_tools.hooks import GlobalMaxPool2d, GlobalAvgPool2d, Rando... |
6e562b262c19913d374a6933a421b1b8e0cf77bd3a05a97e482229e9ebf4c576 | Python | 7,573 | 228 | import argparse
import json
import os
import time
import traceback
import warnings
import numpy as np
from pydfc import data_loader, multi_analysis_utils
warnings.simplefilter("ignore")
########################################################################################
def run_FCS_estimate(
params_method... |
c29f444e9f33ae1729a6e89d209708bd486e4816d24913c69c102e0b16481e7a | Python | 7,579 | 214 |
from pathlib import Path
import imageio.v2 as imageio
import matplotlib.pyplot as plt
import numpy as np
import ppafm.ml.AuxMap as aux
import ppafm.ocl.field as FFcl
import ppafm.ocl.oclUtils as oclu
import ppafm.ocl.relax as oclr
import torch
from matplotlib import cm
from ppafm.ml.Generator import InverseAFMtrainer... |
4218340fc82302a09e65af486d005dc18a9de164af12679e2b8ee9796d391114 | Python | 7,580 | 163 | import os
aff = os.sched_getaffinity(0)
print('**********************before import torch******************************'+str(aff))
import torch
print('**********************after import torch******************************'+str(os.sched_getaffinity(0)))
os.sched_setaffinity(0, aff)
from DeepPurpose import utils, dataset... |
c0b118a471bcaf6d8fc1882d92e5852d9b09f4d701d15d20208d3e71890b3155 | Python | 7,580 | 194 | import argparse
import glob
import math
import ntpath
import os
import shutil
import pyedflib
import numpy as np
import pandas as pd
from sleepstage import stage_dict
from logger import get_logger
# Have to manually define based on the dataset
ann2label = {
"Sleep stage W": 0,
"Sleep stage 1... |
87acb36ac17594f3f5de89c002321ea3b2813c56315f7b8affe0cbd97d7056ee | Python | 7,583 | 216 | #res model
import torch, random, scipy, math
import torch.nn as nn
import torch.nn.functional as F
import pandas as pd
import numpy as np
from atom3d.datasets import LMDBDataset
#import atom3d.datasets.ppi.neighbors as nb
from torch.utils.data import IterableDataset
from . import GVP, GVPConvLayer, LayerNorm
import to... |
0be371c26f590b885281c3bc6aeadac4da0e1b58732e55bfca0bf180a96f868b | Python | 7,585 | 198 | import os
import pandas as pd
from sklearn.impute import SimpleImputer
import numpy as np
methyl_dir = "./preprocessing_methyl/"
acc_dir = "./preprocessing_acc/"
gene_dir = "./preprocessing_rna/"
train_gene = pd.read_csv(gene_dir + "gene_expression_train.csv", index_col = 0)
rna_gene_list = train_gene.columns.tolist... |
fef2aaed01d02b27b4a537d1bb35f3e2e98291624a78b5efa0fe05dcbf8122be | Python | 7,586 | 198 | # Copyright (c) 2020 PaddlePaddle 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 appli... |
69fa21ea9854e2c8a434a5949b817a6cb6c2cf991b34cf3cbc50ab7d96b5a1d9 | Python | 7,589 | 229 | # simple_test.py - Testing JAGS fits of a non-hierarchical DDM model without lapse process in JAGS using pyjags in Python 3
#
# Copyright (C) 2021 Michael D. Nunez, <m.d.nunez@uva.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... |
9f260dbf3650bd492f3e16cb8cf3fe43b79728a15c5cd36ed890dc32eb7e0b07 | Python | 7,594 | 179 | """
Export feature importance distribution using topography map
TODO: merge with parse_features.py to use its API.
"""
import os
import sys
import mne
import numpy as np
from pathlib import Path
import matplotlib.pyplot as plt
from neurodecode import logger
def export_topo(data, pos, pngfile, xlabel='', vmin=None,... |
b00e4faa0a84c07721fdc2e5a905718de9d0eacc407339d71f7a41a73657c7b6 | Python | 7,601 | 212 | # Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""You may copy this file as the starting point of your own model."""
from collections.abc import Iterable
from logging import getLogger
from os import makedirs
from pathlib import Path
from urllib.request import urlretrieve
from zipfil... |
192ece2e492effdfc68d967a96c8fe55f428dba5dd02d2c3de92677080bad6f6 | Python | 7,603 | 200 | #### make_local_connectivity_tcorr.py
# Copyright (C) 2010 R. Cameron Craddock (cameron.craddock@gmail.com)
#
# This script is a part of the pyClusterROI python toolbox for the spatially
# constrained clustering of fMRI data. It constructs a spatially constrained
# connectivity matrix from a fMRI dataset, where then co... |
b3be1b4cf5b5a267fc6a665b8cc3123ae09741d7a4d244168c0d6ba749ffbc1b | Python | 7,605 | 278 | """Definintion of functions related to connectomes and connectivity measures."""
from scipy.spatial.distance import pdist, squareform
from src.tree_functions import level_from_tree, T_from_level
import numpy as np
def connectome_average(fc_all, sc_all):
"""
Compute the average connectivity matrices for a set... |
431d0beff93754fb485ce68fd1058adcfb0486194c2154bbf35f33b830c14657 | Python | 7,607 | 198 | import torch
import torch.nn as nn
from adni.models import mobilenet, mobilenetv2, shufflenet, shufflenetv2, squeezenet
def make_network(cfg, checkpoint_path, input_3x3=False, pretrained=False, n_channels=1):
if cfg.backbone_name == 'resnet18':
net = torch.hub.load('pytorch/vision:v0.6.0', 'resnet18', pre... |
f8d57c8ac3d620fd62392e757c5792f0f6177e53d1e3ba96cd9cf88a80137b0a | Python | 7,610 | 217 | import json
import logging
from pathlib import Path
import h5py
import numpy as np
import torch
from torch.nn import CrossEntropyLoss
from torch.optim.adam import Adam
from torch.optim.lr_scheduler import MultiStepLR
from idtrackerai import ListOfBlobs, Session, __version__, conf
from idtrackerai.utils import create_... |
faf6702694469758245018c0d50cc2f1cf50cc72df001ad34b1364b460835469 | Python | 7,610 | 208 | # Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""You may copy this file as the starting point of your own model."""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import tqdm
from openfl.federated import PyTorchTask... |
9c2ac7a4024b6da574bb467cd84b57691cb0e50f75d541ebec69fca8e443c9ec | Python | 7,614 | 235 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Mixin class for FL models. No default implementation.
Each framework will likely have its own baseclass implementation (e.g.
TensorflowTaskRunner) that uses this mixin.
You may copy use this file or the appropriate framework-specific ... |
8f740129df09af03c37e3208a0a055ce2c7d4dfdddfe3845827d04bc94dad7eb | Python | 7,620 | 196 | """Adapted from https://github.com/jvanvugt/pytorch-unet (MIT license)"""
import math
from typing import Optional, OrderedDict, Tuple, Union
import torch
import torch.nn.functional as F
from torch import nn
from learning.utils import tensor_center_crop
class UNet(nn.Module):
def __init__(self,
... |
6b00ff2c4650279c77023157955a578e4913101f7f0977e2bf0df049cd43ca99 | Python | 7,628 | 191 | """What goes in each release bundle, declared once and never globbed.
``release.sh`` gathered a bundle with ``cp *.txt``, which would have swept in
``vdjdb_full_filtered.txt``, three ``*_broken.txt`` and three ``*_scored.txt`` side tables. The
shipped zip contains none of them, so a manual step, not the script, define... |
9e5048cc087d5a9f6aca8464827cf3aa4131e4fad3fd11a49ce1ce46669f8305 | Python | 7,629 | 260 | #!/usr/bin/env python3
# Copyright (c) 2024, Moritz E. Beber.
# /// script
# requires-python = ">=3.8"
# dependencies = [
# "numpy ~=1.25",
# "biom-format ~=2.1",
# ]
# ///
"""Generate BIOM files for testing purposes."""
import logging
from datetime import datetime, timezone
from pathlib import Path
import n... |
ebcd6f5580e02746a9763e58c167181ed9779cf360dc20b2e9a78625469014ca | Python | 7,629 | 156 | import pickle
from torch.utils.tensorboard import SummaryWriter
from models.reaction import *
import time
import matplotlib as mpl
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.warning')
mpl.use('Agg')
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":16:8"
args = get_args()
assert args.supervised in [1, 2]
model_s... |
8211216858be626c7a4d2850f2bfcb5578768eebabf3a01fbc2bc4e986e15d42 | Python | 7,634 | 168 | from typing import Dict, Optional, Tuple
import numpy as np
from matscipy.neighbours import neighbour_list
# A direction counts as free only if what is left of it after removing the
# periodic span is a real direction rather than round-off.
_DEGENERATE = 1e-8
def _orthogonal_residual(
vector: np.ndarray, basis:... |
7fadf0b7323fb41869a169343e608dd5839a0c11b34bdfb0a10eba155e1f6dcc | Python | 7,636 | 207 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
"""Interaction Block"""
import torch
from e3nn.o3._irreps import Irreps
from e3nn.o3._linear import Linear
from e3nn.o3._tensor_product._sub import FullyConnectedTensorProduct
from nequip.data import... |
bd490ee3d7d9c8e0755c05b86811b37fd2b5f3b12462d2a6f78eea6719bdec7a | Python | 7,639 | 242 | import numpy as np
from ivac.linear import _ivac_weights
from ivac.utils import (
compute_ic,
compute_c0,
batch_compute_ic,
batch_compute_c0,
)
import ref_corr as ref
from data import indicator_basis, ou_process
def test_corr():
"""Test correlation matrix calculations."""
# generate trajector... |
90126bb32d976b45ba20e5c83c6800e5e2fa08413859073204d428c9df5940d9 | Python | 7,644 | 212 | """Behavior required by the approved DesignMatrix specification."""
import numpy as np
import polars as pl
import pytest
from nltools.data import DesignMatrix
@pytest.mark.parametrize(
"kwargs",
[
{"TR": 0},
],
)
def test_invalid_constructor_controls(kwargs):
with pytest.raises(ValueError):
... |
c4f6764abaee5b3665296ef8b64c7ad399d5e68abe3fafb51fb0a5d45bb1202e | Python | 7,647 | 190 | """Tests for correlation permutation tests and helper functions."""
import pytest
import numpy as np
from scipy.stats import multivariate_normal
from nltools.algorithms import correlation_permutation_test
class TestCorrelationPermutationTail:
"""F011: correlation_permutation_test must accept its documented tail... |
375cb3ca7eb0fba50066c17d0b9c6a28f416975974849360c13e7a4fa46d1f8b | Python | 7,652 | 216 | """
Modified from the code "https://github.com/rusty1s/pyg_autoscale/blob/master/large_benchmark/main.py"
"""
import time
import hydra
from omegaconf import OmegaConf
import torch
from torch_geometric.nn.conv.gcn_conv import gcn_norm
from dig.lsgraph.dataset import get_data, SubgraphLoader, EvalSubgraphLoader
from d... |
2d7462828b87fe38a1bea9b7fe5d039d2f476320a1c2f832be188560aa278d0a | Python | 7,654 | 193 | import os
import subprocess
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
from seqsharp.preprocessing import load_msa
from seqsharp.utils import load_custom_distr
from seqsharp.stats import sample_indel_params, kde
def main():
global gamma_shape_pdf, indel_pdf
# ---- handling... |
0dc044e68d6f55a709b7922de627bf83785f7acaaa9121c29305d9703970d5c1 | Python | 7,655 | 220 | # Based on the code from: https://github.com/klicperajo/dimenet,
# https://github.com/rusty1s/pytorch_geometric/blob/master/torch_geometric/nn/models/dimenet_utils.py
import numpy as np
import torch
from scipy.optimize import brentq
from scipy import special as sp
from math import pi as PI
try:
import s... |
dab35600db0204c41ed254a31df6aa0ed817d0a374eb5b66b9f8985ff2fe5762 | Python | 7,661 | 214 | # -*- coding: utf-8 -*-
import os
import numpy as np
import logging, argparse
import h5py
import configparser
from mpi4py import MPI
import sys
from data_functions import TwoPopAlignmentFormatter
import time
def parse_args():
# Argument Parser
parser = argparse.ArgumentParser()
parser.add_argument("--ve... |
493c28b3dde24b1d8826fe7d214b32be176b1d8f7470b01b58e60c9026ddb6a1 | Python | 7,663 | 210 | ## __doc__="""
## this sctrip is using for Shape-Map which seem no difference between
## SC or BULK
##
## the update of version 1.5
## cutadapt twice to remove the internal adapter which ligated which reverse transcript
##
## the change in version 2.5:
## 1) change to zy made reference
## 2) bowtie... |
b79bf7cf3b7218b2a4a2a82f373be48ca021c0a5e5de741819e4a1796c34e044 | Python | 7,663 | 207 | """Model architectures to be used in experiments.
n_features and n_classes are hardcoded in.
Minimal finetuning on architecture was done.
"""
from typing import Optional
import numpy as np
import tensorflow as tf
import datasets
def create_tabular_model(data: datasets.TabularDataset):
if data == datasets.Tabul... |
c15d5c9bd0badad39ef445d963cd5d4f9af221c6768c6e08ceaa62f319b41e70 | Python | 7,665 | 207 | # Copyright (c) 2020 PaddlePaddle 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 appli... |
fcf421ab88d9153106b53247084e08fdd24405b78917666d0c064a2ada482f87 | Python | 7,665 | 194 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import re
from dataclasses import dataclass, field
from typing import List, Optional
import torch
import torch.nn.functional as F... |
d58008314036e6e9daf8b42c0a8b89edf46aaee5ed071a327a0a7e2a02ed3e8b | Python | 7,666 | 228 | """Datasets for interpretability theory experiments.
This class is used to load in data and store relevant information, such as which features are non-categorical.
"""
import enum
from typing import Any, Callable, Optional
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
im... |
f73ae1696d503dc85cf10556eea5c0a2074f2d9a0fd7c3614be6a1d3c177b1ea | Python | 7,668 | 213 | # Copyright (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""You may copy this file as the starting point of your own model."""
from collections.abc import Iterable
from logging import getLogger
import os
import sys
from openfl.federated import PyTorchDataLoader
import numpy as np
from openfl.fed... |
7ec5180f542a14aafeece32baa41017325d60f0912661156043cc4c7aabeeb36 | Python | 7,669 | 187 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
"""
Functions for loading models from package files.
"""
import torch
import yaml
import warnings
import contextlib
import io
from typing import Dict, Any
from nequip.data import AtomicDataDict
from n... |
f778e3f8ec73244c19a4089a1e0c9d0676a323c99337ef21a7847b728ca1bccb | Python | 7,671 | 221 | import math
import torch
import numpy as np
from torch import Tensor
import torch.nn.functional as F
from numpy import ndarray
from typing import Tuple, Union, Optional
from torch.nn.modules.utils import _pair
def im2col_indices(
x: Tensor,
kernel_height: int,
kernel_width: int,
padding: Tuple[int, i... |
ab9cd9aa16016074c4bf26cf304e31be51cc5bbac09b0a6e53bab79bd6bec4cc | Python | 7,674 | 207 | import torch
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from torch.optim.lr_scheduler import StepLR
from dataset import ConfLmdbDataset, ConfDataLoader
from confnet_dss import ConfNetDSS
import os
from tqdm import tqdm
import argparse
import numpy as ... |
55577b55414770eb9ced9cc0109d4ebd90a73464d4deb0ba44d5877d79893f32 | Python | 7,682 | 218 | """Write a fit or a contrast to a directory of NIfTI maps, designs and a sidecar.
One layout serves both records: every brain map becomes a compressed NIfTI named
`<prefix>_<suffix>.nii.gz`, every design becomes a CSV, and one small JSON
sidecar names the kind of result and whatever describes its columns. Nothing
here... |
abd83b9a8d3d0a3f03b3e608666f45c5779225b1ededf21687f24e35db81986f | Python | 7,688 | 231 | import os
import pytest
import renderapi
from test_data import (
render_params,
rough_parameters)
from bigfeta import bigfeta
import json
import os
import copy
import numpy as np
from shutil import rmtree
import subprocess
TEST_PETSC = os.getenv("BIGFETA_TEST_PETSC", False)
TEST_PETSC = (True if (TEST_... |
a8741e1fa7c238bb3bc3aaee1b85ed71fce3fbd44c64daa2d31086d457dd18a7 | Python | 7,692 | 235 | import os
import time
import pickle
import datetime
from pathlib import Path
import multiprocessing as mp
from ..utils.lsl import start_server
from ..utils.io import pcl2fif, make_dirs
from ..stream_receiver import StreamReceiver, StreamEEG
from ..stream_receiver._stream import MAX_BUF_SIZE
class _Recorder:
"""
... |
ae324571a67243c2ec17a525981f835927d6dfe78e073f92639fc59e75304733 | Python | 7,694 | 194 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
1ccb8eefee36a6e21c2fac98f42569edbbf711ca8bcefbc6832b7aa5b618a320 | Python | 7,700 | 90 | # -*- coding: utf-8 -*-
import functions.rate_coding
import numpy as np
import functions.manifold
import functions.Graphs
import matplotlib.pyplot as plt
import functions.statistics_test as st
from scipy import stats
#%% Load data
data = np.load('/datapath/dataset.npy', allow_pickle=True).item()
#%% Embed... |
e5c172c912715b9a3ea5bf5c14f7467a512ce5ef9b58b398709f8e20aab6021c | Python | 7,701 | 265 | #Copyright (c) 2022, Quirin Strotzer
#All rights reserved.
#This source code is licensed under the AGPL-3.0 license license found in the
#LICENSE file in the root directory of this source tree.
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from matplotlib.widgets import Slider, TextBox
imp... |
8c0c11dee0fafe6a7aca069f7ab87b22cfc79620337eb8a3a2f7cb0c5f0c62a1 | Python | 7,702 | 193 | from __future__ import annotations
import logging
import os.path
from result_caching import store_dict
import pandas as pd
import numpy as np
from brainio_base.assemblies import NeuroidAssembly
from model_tools.activations.core import flatten
from model_tools.utils import fullname
from custom_model_tools.hooks import G... |
986f649d9be88aeb14966fc07507bd630f5c0ec72240022d2d8545a000cb2dd8 | Python | 7,715 | 200 | #### pyClusterROI_test.py
# Copyright (C) 2010 R. Cameron Craddock (cameron.craddock@gmail.com)
#
# This script is a part of the pyClusterROI python toolbox for the spatially
# constrained clustering of fMRI data. It is a demonstration of how to use the
# toolbox and a regression test to make sure that the toolbox code... |
c624c7636a9fbf1f85eab7dc0eb42ac3543e53958601350b3d021d2cefd65d39 | Python | 7,719 | 229 | """Script for running parallel simulations with MPI when called with mpiexec.
This script is called directly from MPIBackend.simulate()
"""
# Authors: Blake Caldwell <blake_caldwell@brown.edu>
import sys
import pickle
import base64
import re
from hnn_core.parallel_backends import _extract_data, _extract_data_length
i... |
f8f00ff7ab06572d1b349783fff0a6d6fbb51c7bc329b49c8eca44876b3fb76e | Python | 7,723 | 144 | """IMGT's F / ORF / P verdict on the segment a chain names (#634).
``proofreading/imgt_alleles.tsv.gz`` is a committed, reviewed authority and three of its six columns
were read by nothing: ``functionality``, ``region_type`` and ``accession``. This module reads the
first. It answers a question no other check asks - `v... |
f700e7b4fde4ee0284f173a59b97586e88e40644aa71c137e7fe09b8e7abf4c0 | Python | 7,726 | 221 | import time
from typing import Tuple, Dict, Any
import torch
# from torch._six import container_abcs, string_classes
import collections.abc as container_abcs
from ..network import Network
from ..network.monitors import Monitor
def recursive_to(item, device):
# language=rst
"""
Recursively transfers ever... |
cb0d679b4027db20f1a950b9f9768d1882e133ca84be09a68d854c39e61c5fa0 | Python | 7,733 | 197 | from abc import ABC, abstractmethod
import logging
import os
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn.decomposition import PCA
from result_caching import store_dict
import brainscore.benchmarks as bench
from brainscore.benchmarks._neural_common import explained_variance
from brainscore.... |
bafc8445ef28d181034665d2c60458822a61271d531ec0921a0249ae42b11c2d | Python | 7,742 | 195 | #!/usr/bin/env python3
# This script is used to transform the OpenAPI spec to ensure that the null type and HashMap is handled correctly.
import json
import sys
import urllib.request
from urllib.error import URLError
from typing import Any
def fetch_openapi_json(url: str) -> Any:
"""Fetch OpenAPI JSON from a URL... |
1335cf5546f40f77f99e72da245d2ff1f2860b7f82883c84610881e527bb592a | Python | 7,746 | 231 | import logging
import warnings
import pyfizi
import numpy as np
import pandas as pd
import scipy.linalg as lin
from numpy.linalg import multi_dot as mdot
from pandas_plink import read_plink
class RefPanel(object):
CHRCOL = "chrom"
SNPCOL = "snp"
BPCOL = "pos"
A1COL = "a1"
A2COL = "a0"
# ch... |
106b71b5e34b3cdf57b0c0876cf810922a5420a06574b72523e757547ca4eac1 | Python | 7,747 | 180 | # -*- coding: utf-8 -*-
#
# PyRates software framework for flexible implementation of neural
# network models and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cognitive Brain... |
9bbddfcc092f307958fe46185168864a72f7ef364a4cc742e5f7a107c8a4146a | Python | 7,747 | 218 | #####################################
### Specify your input parameters ###
#####################################
num_omics = 3 # Number of your omics
dirname = "./example_dataset/"
resDir = "./results/"
#####################################
#from __future__ import print_function
import tensorflow as tf
import numpy a... |
4bec0e83af0016a3a0a902f30b5553d4589bfe2cef2fe22c6d71b6f61089beb9 | Python | 7,748 | 253 | import contextlib
import inspect
import logging
import os
import re
import shutil
import sys
from pathlib import Path
from pprint import pformat
from string import ascii_lowercase
sys.path.append(str(Path(inspect.getfile(lambda: None))))
from pipeline.utils.snakefile import (
get_config,
get_setting,
load_... |
16d0fd7f2fdd950ac0d67da7c8313b198172483c5a33586dce50bf2cc555ed4c | Python | 7,749 | 253 | import contextlib
import inspect
import logging
import os
import re
import shutil
import sys
from pathlib import Path
from pprint import pformat
from string import ascii_lowercase
sys.path.append(str(Path(inspect.getfile(lambda: None))))
from pipeline.utils.snakefile import (
get_config,
get_setting,
load_... |
983b596bec255c23de7bd05fbc328470aa5cc95bf40560ad2bf0d608a12bc755 | Python | 7,752 | 146 | """
The Jansen-Rit Neural Mass Model
================================
Here, we will introduce the Jansen-Rit model, a neural mass model of the dynamic interactions between 3 populations:
- pyramidal cells (PCs)
- excitatory interneurons (EINs)
- inhibitory interneurons (IINs)
Originally, the model has be... |
d2addb1e2b776bd564cac03f2dd16ab2896ed96b26342a77c439c64816a04856 | Python | 7,752 | 205 | """Standardize and resample a DesignMatrix.
`standardize` normalizes columns; `downsample` and `upsample` change the temporal
resolution. Each returns a new `DesignMatrix` with metadata preserved (and
`sampling_freq` updated when resampling).
"""
from __future__ import annotations
from typing import TYPE_CHECKING
i... |
20a6fd0daec7ee63d1fdd890e4a465a456d55f135e32a2d7d740fa2e0367e656 | Python | 7,756 | 241 | """
Plot example experiment of cardiac myocyte before and after bath application of ISO.
This corresponds to Figure 6
"""
import scipy
import numpy as np
import matplotlib.pyplot as plt # just to show plots during script
import seaborn as sns
import sanpy
from sanpy.sanpyLogger import get_logger
logger = get_logge... |
f4738a4dbddfba5afe88f60a29123842ac01bf682eebd233a7c0d1a52e108341 | Python | 7,756 | 205 | """Reusable Qt and pyqtgraph interface utilities."""
from functools import partial
from PyQt5 import QtCore, QtWidgets, QtGui
import pyqtgraph as pg
from sanpy.sanpyLogger import get_logger
logger = get_logger(__name__)
class sanpyCursors(QtCore.QObject):
"""Manage movable measurement cursors over a recording p... |
1f07c06626e66f098b0ba44e0627d2e8f4d74125cf6c58c6ba21ffb16211f123 | Python | 7,763 | 257 | #!/usr/bin/python
from smfishHmrf.HMRFInstance import HMRFInstance
from smfishHmrf.DatasetMatrix import DatasetMatrix, DatasetMatrixSingleField, DatasetMatrixMultiField
from smfishHmrf.spatial import rank_transform_matrix, calc_silhouette_per_gene
import sys
import os
import math
import subprocess
import numpy as np
im... |
2e4af97455d67148642503e0b68535bb51725ef8137a77c226ac7c4267b380b6 | Python | 7,774 | 253 | import sys
import os
__evolution_genome__ = {}
__evo_name__ = None
__evo_id__ = None
__evo_generation__ = None
__get_gene_mode__ = False
def is_evolution_mode():
return not gene('__evo_name__', None) == None
def get_gene_mode():
return __get_gene_mode__
def get_evo_name():
if __evo_name__ is None:
... |
37794f5667effa7720a18a1abe54edd117ba748f365877f2f58a1a1eff7e16b6 | Python | 7,774 | 194 | """
This file stores the original code of the EGAS.
In EGAS you have some choice to your file.
First, you need your file to be h5ad format first.
If not, we have script to exchange gem to h5ad first than using EGAS
This file has been furnished by Lvtongxuan BGI:28650
If you have any Question
please chat with me by us... |
7816cf96a9978c92b636b1fe091b12b842a39badf92780fadba6347c2d912080 | Python | 7,775 | 188 | from typing import Tuple
import numpy as np
import torch
from scipy.ndimage import gaussian_filter
from scipy.ndimage.interpolation import zoom
class GaussianNoiseAugmentation:
def __init__(self,
noise_variance_range: Tuple[float, float],
channel_apply_probability: float,
... |
2a1574cbc1b1acda0426fea60c06e97186118a64b79ea80b1530b248ddc5e733 | Python | 7,776 | 259 | """Unit tests for automatic differentiation in different backends."""
import warnings
import pytest
import geomstats.backend as gs
from geomstats.geometry.grassmannian import Grassmannian
from geomstats.geometry.special_euclidean import SpecialEuclidean
from geomstats.test.parametrizers import DataBasedParametrizer
... |
3f718662d928ba34158b70e851e3cab5cbf7f71c5e99f6447166a9490900a83d | Python | 7,780 | 198 | # Copyright © 2023 German Cancer Research Center (DKFZ), Division of Medical Image Computing
#
# SPDX-License-Identifier: Apache-2.0
import nibabel as nib
import numpy as np
import vtk
from dipy.tracking.streamline import transform_streamlines
from radtract.parcellation import load_trk_streamlines
from skimage.morphol... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.