sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e3da6614c671444b7009483ee85b15834192a35f490f5af935b5b9b9148e577e | Python | 10,771 | 296 | # copyright (c) 2022 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
ca0f1d4a52478a4b9477e8d0f0ace646159e1c197bf6c172ac132ce7b26bbf12 | Python | 10,774 | 357 | # Reference: https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py
from typing import Any, Callable, List, Optional, Type, Union
import torch
import torch.nn as nn
from torch import Tensor
__all__ = [
"ecg_resnet18",
"ecg_resnet34",
"ecg_resnet50",
"ecg_resnet34_psvt",
]
def conv... |
0bc56a54441711c34ce4c0a6ffede26a5d38f2f7d3cb1f8b001a9d6e0b76e0b8 | Python | 10,776 | 258 | #
import os
import numpy as np
import pandas as pd
import torch
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
from tqdm import tqdm
from Code.tsnes.colors_dict import return_colordic
########
dict_protfam, dict_enz, dict_drugfamcols = return_colordic()
DPI = 400
########
FOLDER_ANNOT = 'Annotat... |
31e926a2fcf63dd7f7bb6ee067fcc71169ac9218b462290bd521fa26eb66b245 | Python | 10,779 | 287 | from pathlib import Path
import mne
import numpy as np
from .current_source_density import (current_source_density,
dir_current_source_density)
from .. import io
from ... import logger
def notch_filter(raw, freqs=np.arange(50, 151, 50), picks=None, **kwargs):
"""
Apply a... |
be4c6d1b6d639259d23c018ef662109574e0fde147a2918bfdbc2f787b845210 | Python | 10,781 | 313 | """
NERF!
Note that this was designed with compatibility with biotite, NOT biopython!
These two packages use different conventions for where NaNs are placed in dihedrals
References:
https://benjamin-computer.medium.com/protein-loops-in-tensorflow-a-i-bio-part-2-f1d802ef8300
https://www.biotite-python.org/examples/gall... |
4117f91b743c0e191c43573bcf61cff2787481e5d41dca563b67a3dee2d99c64 | Python | 10,795 | 415 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.16.1
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# %% [ma... |
96da64f0347d02944f5e604d3bbb2d624aed694360873f0bf25b82fc6a1609b9 | Python | 10,797 | 297 | import warnings
import numpy as np
from sklearn.cluster._agglomerative import (
METRIC_MAPPING64,
DistanceMetric,
IntFloatDict,
_fix_connectivity,
_hierarchical,
_single_linkage_tree,
heapify,
heappop,
heappush,
paired_distances,
)
import geomstats.backend as gs
def linkage_t... |
c93291e4314d3b40a4063bf5275429e1d91b80534993007e964abaff985fc173 | Python | 10,797 | 337 | """Statistical Manifold of Poisson distributions with the Fisher metric.
Lead author: Tra My Nguyen.
"""
from scipy.special import factorial
from scipy.stats import poisson
import geomstats.backend as gs
from geomstats.geometry.base import VectorSpaceOpenSet
from geomstats.geometry.euclidean import Euclidean
from ge... |
05deb8192c3fd3269f23ace8c47b2b895769757979f3589411e7d7b805e5543f | Python | 10,800 | 360 | import geomstats.backend as gs
from geomstats.test.data import TestData
from .riemannian_metric import (
RiemannianMetricComparisonTestData,
RiemannianMetricTestData,
)
def _expected_jacobian_circle_immersion(point):
return gs.stack(
[
-gs.sin(point),
gs.cos(point),
... |
d0ceca563509c293d7ba541df1f5824df08b7f922788eb9da5f2ed6467da9b63 | Python | 10,810 | 371 | from __future__ import annotations
import argparse
import dataclasses
import glob
import json
import os
import re
from typing import List
from mace.tools import deprecation
# matplotlib/pandas are not mace-torch dependencies: guard the import so the
# console entry point resolves (and --help works) in a clean instal... |
12b4068b9c0e8e5a9c0fdb3493e799372646d88e14a9e7ff108ab4584d21cf15 | Python | 10,828 | 313 | """
Wrappers for backend modules, e.g. TensorFlow, JAX, NumPy, CuPy.
The interface tends to follow NumPy's conventions.
"""
from argparse import Namespace
from functools import partial
import numpy as np
class ModBase:
def __init__(self, mod=None):
assert mod is not None
self.mod = mod
f... |
3f09ada69a1ac43bd114f310675612c58cb7ee870337cf0fdfc342136da126c4 | Python | 10,828 | 280 | """The authorship gate's rules, pinned against what the tools really emit.
The policy is narrow on purpose: an assistant may be used, it may not be
credited as an author. So the rejected cases are all authorship claims, and
the accepted ones include every way of saying a tool helped.
Samples marked "seen on this repo... |
b560b9118fb3b506a93b1372ebddd6fb1bcd9377bff25ec7442dbe813df0e023 | Python | 10,830 | 278 | ###########################################################################################
# Implementation of the symmetric contraction algorithm presented in the MACE paper
# (Batatia et al, MACE: Higher Order Equivariant Message Passing Neural Networks for Fast and Accurate Force Fields , Eq.10 and 11)
# Authors: I... |
bba38d40643805d005f9446bfa8fbd77dae9b0b00dbd3ceeb68637221b176852 | Python | 10,833 | 306 |
import os
import random
import numpy as np
from tqdm import tqdm
import torch
from torchvision import transforms
from skimage.metrics import (
mean_squared_error,
structural_similarity,
peak_signal_noise_ratio
)
from pytorch_radon import Radon, IRadon
from pytorch_radon.filters import LearnableFilter
fr... |
d8d90c4504e1cf3bb427efa19c61fdb0d73003255f20c7db75cba9123bc650bd | Python | 10,842 | 205 | import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
class Metrics(object):
"""
Class for storing all kinds of performance estimations
:param (manager.Config) config: configuration object
:param (tuple) shape: tuple w/ shape (n_hyperparams, dataset_length, n_r... |
a577080cb294a146d75b3d5b57c1d7b8e6409e3c928303082b0c2158f8f0f6cb | Python | 10,847 | 298 | import matplotlib.pyplot as plt
import numpy as np
import csv
ekw = dict(ecolor=(0, 0, 0, 1.0), lw=1, capsize=3, capthick=1)
color1 = (0, 176/255, 80/255, 1)
color2 = (1/255, 127/255, 157/255, 1)
color3 = (120/255,110/255,120/255,1)#(117/255,117/255,117/255,1)#(253/255, 97/255, 0, 1)
#color11 = (0, 176/255, 80/255, ... |
11adf59131f49221d0200a59f09a5e6580da87ed67b4487b5f1d775c2eb25508 | Python | 10,857 | 262 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
"""_key_registry.py: manage information about what kinds of data different keys refer to."""
import torch
from e3nn.io._cartesian_tensor import CartesianTensor
from . import _keys
from typing import Di... |
e293668b17553d8efa47ff9563b6f37af7d815a3f5065798a1d3531f867baf73 | Python | 10,866 | 213 | """Turn enriched clonotypes into clusters: the Hamming-1 graph, its components, and a layout.
Stage two. :mod:`vdjdb.motifs.tcrnet` says *which* clonotypes are more connected than the background
explains; this says *to each other*. Within one ``(species, gene, epitope)`` an edge joins two
enriched clonotypes one subst... |
1a1863188a4b870996e332d3e540011bd9b4977e72335eaa7457608c21bb1a43 | Python | 10,868 | 361 | import numpy as np
import scipy.signal as sig
import scipy.stats as stats
from scipy.stats import median_abs_deviation as mad
import pickle
from pyimzml.ImzMLWriter import ImzMLWriter
from scipy.io import loadmat
from brainpy import isotopic_variants, parse_formula
import random
from spike.File import Solarix ... |
181011fe70eefb0c45d934e741055956e80ce0d4ca31327e9c1fa1cb942ed84e | Python | 10,869 | 320 | # Copyright (c) 2022 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... |
2ba2524a82ce0ba5972403d49dae2e9778d413eb18bf8a808932dd5e6829de61 | Python | 10,870 | 259 | import json
import random
import os
import matplotlib.pyplot as plt
import scipy.stats as stats
import pandas as pd
import seaborn as sns
def plot_each(rdict):
colormap = {'bw': 'dodgerblue', 'ic': 'mediumorchid', 'uf': 'olivedrab', 'ik': 'orange', 'io': 'midnightblue'}
linestylemap = {'bw': {'ic': 'solid',
... |
3e2160f6c887e88ce7cc003c90386e91198273130d43683bb9b85de5ad9bfafd | Python | 10,871 | 357 | """Helper functions and classes for tests"""
from __future__ import annotations
import functools as ft
import itertools as it
import re
import subprocess as sp
from datetime import timedelta
from pathlib import Path
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Mapping,
Protoco... |
d66c3d211bfac2c9249e785760e57e1a09cbe4ccf8a87926e71f8f53e0515bee | Python | 10,881 | 253 | import argparse
import torch
import torch.nn as nn
import torch.optim as optim
import pandas as pd
import numpy as np
from sklearn.model_selection import KFold
from sklearn.model_selection import train_test_split
from sklearn.metrics import precision_recall_curve, roc_curve, auc
from torch.utils.data import DataLoader
... |
2adc15d851b18edb69a02d5c072835cf5263cacc5e75de9ebd7e3aec7be487dc | Python | 10,885 | 326 | from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Set, Tuple
from uuid import UUID
from chromadb.api.types import IDs, convert_np_embeddings_to_list
from chromadb.errors import InternalError, InvalidArgumentError
ConditionalHttpGetPayload = Dict[str, Any]
ConditionalHttpJsonPayload = Di... |
ba82d699c0932cc2c5464328df538e7b2529371f2acec1160dfc46670a64d917 | Python | 10,886 | 264 | import numpy as np
from numpy.testing import assert_array_almost_equal, assert_allclose, assert_raises
from scipy.stats import pearsonr
from sklearn.base import clone
from sklearn.utils import check_random_state
from gemmr.generative_model import GEMMR
from gemmr.estimators import SVDPLS, SVDCCA, NIPALSPLS, NIPALSCC... |
bc9c9d2a86e7aa82f97b22a7bde7097c59eca006d969a99e9e8a853847cb4f66 | Python | 10,895 | 334 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 13 21:29:47 2022
@author: lingang
"""
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.utils.data
from sklearn.metrics import accuracy_score,f1_score
import os
import random
import h5py
from biosppy.signals impo... |
d1b79477d47f0fb476cdec1bb28c9cfeb2f71b36e7b090be223391c7a43edf5d | Python | 10,898 | 224 | """Does this build still reproduce the last release?
Marked ``release``: needs ``VDJDB_REFERENCE_ZIP`` and a built legacy directory
(``VDJDB_LEGACY_DIR``, default ``out/legacy``).
``tests/release/test_reference_contract.py`` checks the *reference* -- its shape, its column orders,
its zero point against itself. This m... |
81b2bbd77f958ae25ee6ec493846aa3641f6fd0447515568782578ad252f35f6 | Python | 10,904 | 258 | """An independent, brute-force neighbour list, and the vocabulary to compare
one neighbour list against another.
``mace/data/neighborhood.py`` delegates the search to matscipy, so a test that
only checks matscipy against itself checks nothing. This module enumerates
periodic images in plain numpy at O(N^2 x images) an... |
067a6db436dde23fbad7a5890978f74e0c5a626df146e2b55bf83d891e4848c7 | Python | 10,907 | 292 | #!/usr/bin/env python
import concurrent.futures
import dataclasses
import itertools
import numpy
import renderapi
import bigfeta.bigfeta
import bigfeta.utils
import bigfeta.qctools.statistics
@dataclasses.dataclass
class SolveStats:
"""Statistics derived from a solve"""
scale_mean: numpy.ndarray
scale... |
7792ebca71b4394f1f16a43404491b2fa3eedad581bfebefd8a36f4faf1c387b | Python | 10,910 | 290 | """Infers on the NSRR dataset using an ensemble of trained models"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import datetime
import json
import os
import pickle
from pprint import pprint
import sys
import time
# TF logging control
os.en... |
ce662c90120da574c268aa0f3a9e7b9bc0bb76f156b68db54b016fba576f718b | Python | 10,911 | 277 | # Copyright 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import signal
import subprocess
import sys
from logging import getLogger
import psutil
from openfl.transport.grpc.interop import FlowerInteropClient
from openfl.utilities.path_check import is_directory_traversal
logger = getLogger(__... |
677b6fbdf136e6830092ec10b3222576bf5d8473091f182f098a518773f29125 | Python | 10,916 | 372 | # %% [markdown]
# ## Assessing dynamic Functional Connectivity (dFC) using multiple methodologies
#
# In this demo we will illustrate how to use the tools implemented in `pydfc` toolbox,
# specifically the ones in `multi_analysis_utils` module,
# to assess dFC using multiple methodologies simultaneously.
#
# We use sam... |
51cbe8032a092ba2d95a5ebdb6764d65ab2759dcd484a02b544d9ffcb73ee631 | Python | 10,927 | 220 | """
File containing input processing layer, including Pairwise Feature construction layer
"""
import functools
from typing import Literal, Optional, Tuple, Dict
import jax.numpy as jnp
import numpy as np
import haiku as hk
from deeperwin.configuration import (
InputFeatureConfig,
MLPConfig,
)
from deeperwin.mod... |
d2bd9adfce0bb1f608de7b143dc2412670ee831dda6074bba8fee1615da138ab | Python | 10,933 | 368 | #!/opt/conda/bin/python
import argparse
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import os.path as op
import pandas as pd
import seaborn as sns
from afqinsight.datasets import AFQDataset
from afqinsight.plot import plot_tract_profiles
from groupyr.transform import GroupExtractor
fro... |
c4a8ea2113c33461a78443261414abac0ed92e2d44898b6d8b23fc979831a4fa | Python | 10,941 | 207 | import os
import torch
import hydra
from omegaconf import OmegaConf
from sklearn.metrics import roc_auc_score
from torch_geometric.utils import add_remaining_self_loops
from benchmarks.xgraph.gnnNets import get_gnnNets
from benchmarks.xgraph.dataset import get_dataset, get_dataloader
from benchmarks.xgraph.utils impor... |
3758afcee7d531f55d0019ecce52928d3184b3656ffc746987349c5538273639 | Python | 10,942 | 288 | # 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... |
95ef66616936d566ed30e241ec667589dab1c7c0284fad63cb934f2ffdb5810e | Python | 10,949 | 360 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
import os
import importlib
import argparse
import glob
from utils.ddp_utils import is_master
from utils import logger
from .dataset_base import BaseImageDataset
SUPPORTED_TASKS = []
DATASET_REGISTRY = {}
SEPARA... |
b3e503c75e4e3f8dd9d9aeace5fc86486f8868773766eb19882dbc966ae9d183 | Python | 10,950 | 266 | import tensorflow as tf
from common.models.local_pooling import AttMaxPool2D
class ConvBlock(tf.keras.layers.Layer):
def __init__(self,
filters,
use_bias,
max_pool_size,
max_pool_strides,
num_layers,
use_max_pool... |
a346453cff879dc15cb307bc56d067d384ba515c76d3d4d03d3cc39419ee3518 | Python | 10,953 | 333 | import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
import itertools
import json
import sys
from os import path
from modules import _ResidueModule
from modules import _ResidueModuleDense
nameScript = sys.argv[0].split('/')[-1]
# we are goi... |
f8294da62ec6df9f36d29df117b1ba9be47f6cc92ffc3d78b7a92b54e6ea7d16 | Python | 10,955 | 330 | import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
import itertools
import json
import sys
from os import path
from modules import _ResidueModule
from modules import _ResidueModuleDense
nameScript = sys.argv[0].split('/')[-1]
# we are goin... |
1de542a2924e78105e9f7826aa8a707da03f1e86a93683a4e3e26c04ec181fd1 | Python | 10,961 | 287 | """mass_ss.py: Defines the MASS class that manipulates the MASS database."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from sleeprnn.data.dataset import Dataset
from sleeprnn.data.dataset import KEY_EEG, KEY_MARKS, KEY_N2_PAGES, KE... |
346c0e1d854a791b96641083a1cf282fe84f30e9c0019f90c0509eca1a5ba8c3 | Python | 10,966 | 318 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 20 12:30:43 2021
@author: nicol
"""
# -*- coding: utf-8 -*-
"""
Created on Tue May 18 12:25:43 2021
@author: nicol
"""
import os, glob, tqdm
from skimage.io import imread, imsave
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import matplo... |
6516c851ff0578d64f3592aab8a277e0439e1a0a6112ba657b396b17325d346c | Python | 10,968 | 319 | """Analysis pipelines."""
import numbers
import numpy as np
from scipy.spatial.distance import pdist
import pandas as pd
import xarray as xr
from sklearn.utils import check_random_state, deprecated
from sklearn.model_selection import KFold
from .analyzers import analyze_resampled, analyze_splithalf
from ..sample_an... |
a31d42873a0f3dd5dc05329f52c1cacc747cd0060ae9ab815ef2a89401e56802 | Python | 10,968 | 372 | """
Django settings for celsusdjango project.
Generated by 'django-admin startproject' using Django 4.1.1.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
import o... |
e2f93b27c0978a174c73a0520b4ecca7de370475571c53b4c49a5332e9aff452 | Python | 10,972 | 338 | import random
import pytest
import geomstats.backend as gs
from geomstats.geometry.diffeo import ComposedDiffeo
from geomstats.geometry.full_rank_correlation_matrices import (
EuclideanCholeskyDiffeo,
EuclideanCholeskyMetric,
FullRankCorrelationMatrices,
LogEuclideanCholeskyDiffeo,
LogEuclideanCho... |
ee47423741268eea0773f903d2886e8baef9811ec993951012167a282d80c0ec | Python | 10,973 | 313 | from pathlib import Path
from typing import Optional
from collections.abc import Sequence
import numpy as np
def force_remove(*paths: str | Path) -> None:
"""Delete scratch files regardless of -nocleanup.
Unlike mrtrix3's app.cleanup() (which retains everything when the script
was told to keep intermedia... |
f3bb450c33deac69a57eda4c1a975d29c68540cb81625470a1287b41340390ab | Python | 10,973 | 327 | import os
import cv2
import numpy as np
import os.path as osp
from functools import partial
from .metrics import Metric
from scipy.interpolate import splprep, splev
from scipy.optimize import linear_sum_assignment
from shapely.geometry import LineString, Polygon
from ppdet.utils.logger import setup_logger
logger = set... |
b6f2cfdd1b36a8dd75112ccb68788b1819f2f538d60487f3d856872f0b84226b | Python | 10,974 | 379 | """Functionality to load datasets."""
import warnings
import numpy as np
import xarray as xr
import pandas as pd
import pkg_resources
import atexit
from ..generative_model import GEMMR
import os
_default_data_home = os.path.expanduser('~/gemmr_data/gemmr_latest')
_remote_urls = {
'synthanad_cca_cca.nc': 'http... |
256d6c60ed506b232c97383c45912a4f7033d63be51e29ef781f516d0d444643 | Python | 10,976 | 241 | import numpy as np
import scipy.stats
from scipy import ndimage
from scipy.optimize import curve_fit
from .imutils import nan_to_zero
# try to use cv2 for faster image processing
try:
import cv2
cv2.connectedComponents # relatively recent addition, so check presence
opencv_found = True
except (ImportErr... |
7ddb24864b23d09d717cca44e19f1e7e04485f75552156a41c93abb432fdc8e7 | Python | 10,980 | 332 | from PymoNNto.Exploration.UI_Base import *
from PymoNNto.NetworkBehavior.Recorder.Recorder import *
from PymoNNto.Exploration.Network_UI.Neuron_Classification_Colorizer import *
from PymoNNto.NetworkBehavior.Structure.Structure import *
import numpy as np
class Network_UI(UI_Base):
def __init__(self, network, mo... |
bf561130f09eba7ec25dcad96222e7e2e3ecdc35eb9831c35169a80c23805a67 | Python | 10,982 | 311 | from typing import Dict, Any, Type, Set
from chromadb.api.types import (
EmbeddingFunction,
DefaultEmbeddingFunction,
SparseEmbeddingFunction,
)
from chromadb.utils.embedding_functions.config_validation import (
validate_embedding_function_config_is_safe,
)
# Import all embedding functions
from chromad... |
8c014ff64f6d752b67d65e175ff1f34ff5e36a44a37eeee9b67323baf8564a68 | Python | 10,984 | 323 | import logging, h5py, os, pickle
from pathlib import Path
from util import openH5File, encode4h5, parse_suffix, config_logger
import numpy as np, pandas as pd
import torch
from load_data import load_expression, load_edges, load_genelist
from initialization import initialize_kmeans, initialize_Sigma_x_inv, initialize_... |
435b004438e8460137d3ddff218da51ade03de3bef04f1a04111afb9902c5d7f | Python | 10,986 | 325 | from __future__ import annotations
import itertools as it
import operator as op
from collections import UserDict
from string import Formatter
from typing import TYPE_CHECKING, Any, Iterable, Optional, Union, cast
import attr
import more_itertools as itx
from cached_property import cached_property
from typing_extensio... |
0179d9a70954145c2578ced9022abf4bcf01bf3e38105d16b82d242bdace8039 | Python | 10,994 | 310 | # SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2020-2026, Christian Gaser. See LICENSE.
"""
Tail approximations: how a permutation test stops needing so many permutations.
Counting exceedances cannot report a p-value below ``1/n_perm``. That floor -- not
the statistic, and not the number of elements -- is wha... |
ebc4b11e5297c4c44d7cc408e49cb820257284a78aa076402e8b8fdc4d5906c8 | Python | 10,996 | 300 | # 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... |
239801598793a1d6a6220492e0d21b0154de31b59ccb3f551c7447cbfbafb69e | Python | 11,008 | 305 | import torch
import numpy as np
import pytorch_lightning as pl
from collections import defaultdict
from torch import nn
from torch.nn import functional as F
from typing import Optional
import sys
sys.path.append('..')
from .fidelity_message_passing import FidelityGNN
from multifidelity_gnn.src.reporting import get_m... |
2c706bd88630d545029517f1fc4dbcfca62a2ec6d584a02bb0964dd0da06ff37 | Python | 11,011 | 389 | import pandas as pd
import os
import pathlib
import ants
from typing import Union, List, Tuple
import multiprocessing
import SimpleITK as sitk
from nipype.interfaces.dcm2nii import Dcm2niix
import numpy as np
from HD_BET.run import run_hd_bet
from nipype.interfaces import fsl
from intensity_normalization.normalize.zsco... |
cfb3dad728fa528d025be3eea8ba182b7585431c85ca654cf7acac0a401fd858 | Python | 11,011 | 355 | import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
import itertools
import json
import sys
nameScript = sys.argv[0].split('/')[-1]
# we are going to give all the arguments using a Json file
nameJson = sys.argv[1]
print("===================... |
9abd11edfb1f2df412b83876bf03b84299b52fa0a6679df2073ca696c27cf025 | Python | 11,025 | 296 | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "marimo",
# "nltools>=0.6.0",
# ]
# ///
# Encoding Models — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py.
import marimo
__generated_with = "0.23.9"
app = marimo.App(width="medium")
... |
001e91ecbff9d9ad5514e2618e85b2713730edc8b4dff60b86e3b68774d4a932 | Python | 11,039 | 222 | from fairseq.dataclass.utils import gen_parser_from_dataclass
from fairseq.models.transformer import TransformerModelBase
# from fairseq.models.mymodel.transformer_base import TransformerModelBase
from fairseq.models import register_model, register_model_architecture
from fairseq.models.transformer.transformer_config i... |
16f00de22eed7338df2a51473785b0d20d400c7a7741c216ab88c3d9f3f9d8cf | Python | 11,047 | 299 | """Tests for matrix permutation tests (Mantel test) and utilities."""
import pytest
import numpy as np
from nltools.algorithms import matrix_permutation_test
class TestMatrixHelpers:
"""Test helper functions for matrix permutation."""
def test_extract_upper_triangle(self):
"""Test extraction of upp... |
d99c3f55eb935f9cb5bad82e4fd58f1f27725201484f71465a3a84c96eafd0f6 | Python | 11,060 | 342 | """
For Fig 2B go to:
Z:\people\gritti\IRIR\supFig2_3
"""
import os, glob
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
import seaborn as sns
import numpy as np
from scipy.stats import binomtest
plt.rcParams.update({'font.size': 15})
rc('font', size=8)
rc('font', family='Arial')
# pl... |
db846646f26291daaa11906b24c0fe2032dc4c923421a24ec49217e6a6b19b67 | Python | 11,061 | 311 | import os
from pathlib import Path
from ruamel.yaml import YAML
from copy import copy
from types import SimpleNamespace
from snakemake.logging import logger
yaml = YAML()
yaml.indent(mapping=4, sequence=4, offset=4)
# Todo: re-evaluate if this is the most elegant solution to hardcode
# the settings path here
SETT... |
c0acd7b92ff7fc7d2a5f44af1c9d20e1b2aa16938e63293646bba6d4bce44980 | Python | 11,062 | 311 | import os
from pathlib import Path
from ruamel.yaml import YAML
from copy import copy
from types import SimpleNamespace
from snakemake.logging import logger
yaml = YAML()
yaml.indent(mapping=4, sequence=4, offset=4)
# Todo: re-evaluate if this is the most elegant solution to hardcode
# the settings path here
SETT... |
aed91052fde318bbe1e0a2ac6431e7808e596dc012ac526524a179227c52c36d | Python | 11,069 | 283 | import paddle
import paddle.nn as nn
import paddle.nn.functional as F
from ppdet.core.workspace import register
from ppdet.modeling.clrnet_utils import accuracy
from ppdet.modeling.assigners.clrnet_assigner import assign
from ppdet.modeling.losses.clrnet_line_iou_loss import liou_loss
__all__ = ['CLRNetLoss']
class ... |
391acc9eb8033e3eb0a029f2250f2917dabb974039695f5feaf1b5e1301b6e52 | Python | 11,076 | 303 | import numpy as np
from scipy import stats, spatial, signal
"""
Functions for handling clusters and spike trains.
-> get_session_* functions require an instance of SubjectSessionInfo to work
-> other functions are auxiliary to the get_session_*, but can be used independently
the appropriate i... |
9a19901a8182e4684c77eca0f3acf3a92acc545fa3d365ef31f384ce826ab98c | Python | 11,080 | 271 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from math import sqrt, prod
import torch
from e3nn.o3._irreps import Irreps
from e3nn.util.jit import compile_mode
from nequip.data import AtomicDataDict
from ._graph_mixin import GraphModuleMixin
fro... |
8a4192a9e3b0dbd5f8dc84f40a63cffdf416302afc6d09b91006452aea050ee8 | Python | 11,081 | 311 | import os
from pathlib import Path
from ruamel.yaml import YAML
from copy import copy
from types import SimpleNamespace
from snakemake.logging import logger
yaml = YAML()
yaml.indent(mapping=4, sequence=4, offset=4)
# Todo: re-evaluate if this is the most elegant solution to hardcode
# the settings path here
SETT... |
dd9d46502793b481621d77808d008e158dbad93e35b9336407e3210fe88b3abd | Python | 11,083 | 338 | import click
import six
from corgie import scheduling, residuals, helpers, stack
from corgie.log import logger as corgie_logger
from corgie.layers import get_layer_types, DEFAULT_LAYER_TYPE, str_to_layer_type
from corgie.boundingcube import get_bcube_from_coords
from corgie.argparsers import (
LAYER_HELP_STR,
... |
4ddf5a9f9d77020644a436dae3fe634c65a26e7a633a33afa20bd0b99f82116d | Python | 11,086 | 228 | """
File containing FermiNet embedding layer, including necessary symmetrical/convolutional feature construction layers.
"""
import jax.numpy as jnp
import haiku as hk
from deeperwin.configuration import (
EmbeddingConfigFermiNet,
MLPConfig,
)
from deeperwin.model.definitions import *
from deeperwin.model.mlp... |
1456e1650644fd1e1502297de4467555e9ee57d0446c7da03fb82b6850560019 | Python | 11,090 | 290 | import argparse
import os.path as osp
import time
import torch
import torch.nn.functional as F
from tqdm import tqdm
from torch_geometric.datasets import Reddit, Reddit2
from torch_geometric.nn.conv import MessagePassing
from torch.nn import Linear
from torch import Tensor
from logger import Logger
parser = argparse... |
253351da5a63eb7686ea83d15ab4b2ce5ac53d8a8e2831d640fc7f3011136b22 | Python | 11,090 | 315 | from itertools import cycle
import cv2
import numpy as np
from qtpy.QtCore import Qt, Signal # type: ignore[reportPrivateImportUsage]
from qtpy.QtGui import QColor, QPainterPath
from qtpy.QtWidgets import (
QCheckBox,
QDialog,
QGridLayout,
QHBoxLayout,
QListView,
QListWidgetItem,
QMessageB... |
443e90745fbbdedd7789ab42261d65008b8a0b6c38e7303baf706d2eae49731a | Python | 11,095 | 290 | # -*- coding: utf-8 -*-
import copy
import numpy as np
from scipy import stats
import functions.rate_coding
from sklearn import preprocessing
from scipy.signal import correlate
from scipy.signal import correlation_lags
import matplotlib.pyplot as plt
#%%
def Time_locked_activity(data, frames, day = ... |
8fce1814132d5fb02e416ed56e60a8f44fcc2f0e869b51eb6a2f4bdf7615c050 | Python | 11,095 | 295 | # All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
from argparse import Namespace
from dataclasses import dataclass, f... |
dbc26fee4dd9518679426030f3d368e2629b3e8215ad1cc069b99d14c3e310b8 | Python | 11,095 | 241 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 7 14:33:58 2018
@author: ngritti
"""
import glob, os, re
import numpy as np
from functools import reduce
from . import imgHandling, patFun
class rawData(object):
def __init__(self, paramFile):
if not os.path.isabs(paramFile):
... |
46ed56d1803949686f361850bd197f33fd55e12af9d0caebed2d3a7034b8d35b | Python | 11,098 | 322 | import os
import re
from itertools import product
from bids.layout import BIDSLayout
def read_bids_dataset(bids_input, subject_list=None, collect_on_subject=False):
"""
extracts and organizes relevant metadata from a bids dataset necessary
for the dcan-modified hcp fmri processing pipeline.
:param b... |
12523eacd62b957451213074f0735b497ece5e3120d90b629bbb0cc18dc64855 | Python | 11,099 | 241 | """Exclusive per-stage wall time and process memory measured during each build.
Reports retain seconds, shares, input rows and core count. Fixed reference
profiles define time budgets scaled by input rows on the same core count.
Network fetches are excluded from compute budgets; memory limits are absolute.
"""
from __... |
893111661756f7227b27060128f1f2cf7fcbea279f280b580eb4706fd0040e1d | Python | 11,099 | 277 | import os
import torch
import torch.nn.functional as F
import torch.distributions as D
from collections import OrderedDict
from torch.autograd import Variable
from itertools import chain as ichain
from .networks import define_Linear_Transform, define_Linear_Inverse, define_Linear_Discriminator, define_Gene_Inference, d... |
e05022bbba737af1f5e11cf11c93eb909c7af719476b10181a25bd57e9f4d536 | Python | 11,100 | 308 | '''
Metrics to measure calibration of a trained deep neural network.
References:
[1] C. Guo, G. Pleiss, Y. Sun, and K. Q. Weinberger. On calibration of modern neural networks.
arXiv preprint arXiv:1706.04599, 2017.
'''
import math
import torch
import numpy as np
from torch import nn
from torch.nn import functiona... |
bdede4dc28e9e9695ecce8cda65093f8073aca9fe4e0bd8d84a9fa9a0cff2083 | Python | 11,104 | 293 | """
You are standing in an open field west of a glass building, with a sliding electric front door.
There is a small mailbox here.
> Open mailbox.
There is a letter.
> Read letter.
-------------------------------------------------------------------------
Welcome to ModelAngelo! Have a look around...
This is the build_n... |
232a838b1cc8b04931ca18d59c40bf398a645405e13c2ea00e70f1847591e51d | Python | 11,106 | 223 | import numpy as np
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.multiclass import OneVsRestClassifier
from sklearn import svm
from sklearn.model_selection import StratifiedKFold, KFold
import os
def svmLit(df, params_lit, random_seed: int = None):
"""
Performs SVM species cl... |
3839d944f18aa597f4ead815fd5a224f09a6d15857a64a85f3d93c27204fc770 | Python | 11,106 | 266 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... |
8c3e67fe14eaace818739737f40f283dd8747f5a29a422795f948cdca2408545 | Python | 11,117 | 286 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network model_templates 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 Cogn... |
b7ed20f8bcfcba1dccc46d88dcd29b5515ce0e908fd8c98ae49b703e81b5e23a | Python | 11,121 | 269 | """
A function on top of MEArec simulator to simulate several drift on
a Neuropixel-128 or Neuronexus-32.
"""
from configuration import *
import elephant
import neo
import quantities as pq
def generate_drift_recordings(base_folder=None, probename='Neuronexus-32',
drift_mode='static',... |
462eadd29f16ea247cf50b80144d12a06b6025c4ce28ce6b342f5728508f987f | Python | 11,123 | 309 | import typing
import warnings
import torch
import torch.nn as nn
import torch.nn.functional as F
class PCLayer(nn.Module):
"""PCLayer.
PCLayer should be inserted between layers where you want the error to be propagated
in the predictive coding's (PC's) way, instead of the backpropagation's (B... |
32207c54a12bfb749972f816a549bc357f797b081738e328f47219be93a660ab | Python | 11,133 | 275 | #
import os
import numpy as np
import pandas as pd
import torch
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
from tqdm import tqdm
from Code.tsnes.colors_dict import return_colordic
########
dict_protfam, dict_enz, dict_drugfamcols = return_colordic()
DPI = 400
########
FOLDER_ANNOT = 'Anno... |
c26f243e22923f0b66dcce7d85f99ea03388f5c44326cb2778f4ebd06a8ae040 | Python | 11,133 | 299 | import warnings
from nltools.mask import (
collapse_mask,
create_sphere,
expand_mask,
roi_to_brain,
roi_to_brain_from_atlas,
)
import nibabel as nib
from nltools.data import BrainData
import numpy as np
import pandas as pd
import pytest
def test_create_sphere():
# Voxel counts on the standard... |
d9cbc786dbf1db8002ca1c5b99efd949fdfd3ddc39bc2e0e2f7fc33d54f719d0 | Python | 11,137 | 333 | import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
import itertools
import json
import sys
from os import path
from modules import _ResidueModule
from modules import _ResidueModuleDense
nameScript = sys.argv[0].split('/')[-1]
# we are goin... |
2e9e3cd140955be21ec4d0dce87a3ec334f82598342ceba8419da5b5b5dd3eeb | Python | 11,143 | 235 | import argparse
from math import ceil
from typing import Optional, Sequence
import pytorch_lightning as pl
import torch
from pytorch_lightning.callbacks import LearningRateMonitor, ModelCheckpoint
from torch.utils.data import DataLoader, ConcatDataset
from data.dataset import Brats184, Brats313, GanBrats, MrSliceDatas... |
a7a30e8b5bd043036aff82e7bf4499945128df6f48e7a2ec0ed2a013e44656ab | Python | 11,146 | 324 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
"""
LAMMPS ML-IAP integration test mixin.
This mixin provides tests for LAMMPS ML-IAP integration, verifying that
models compiled for LAMMPS produce identical results to direct NequIP calculations.
"""... |
2d42c1e939704c20ea04dd929f2087f009704e14c912e02185937fc683dfc5c7 | Python | 11,165 | 241 | import os
import pickle
import time
import matplotlib
import matplotlib.pyplot as plt
from einops import rearrange
from jax import vmap, pmap, jit, value_and_grad, local_device_count
from jax.example_libraries import optimizers
from jax.lax import scan, cond
import jax.numpy as np
import jax.random as random
... |
9f9066a051a9502f8c032b658bbc6b27026509e9bb0a78a9fc95ef3e3ec2f57a | Python | 11,165 | 287 | """`BrainData.align` wraps a value as `BrainData` only when it is spatial.
The v0.5.1 dict container is retained (`transformed`,
`transformation_matrix`, `common_model`, plus `disparity` and `scale` for
procrustes, plus `roi_labels` at ROI scale). A value is a `BrainData` when
its columns are a voxel axis matching the... |
b07f252eb76851468b4d67bb152d850a42339a53cfa22dc8becbe7099efd240a | Python | 11,179 | 213 | import torch
import torch.nn as nn
from torch import Tensor
import pygmtools as pygm
class Sinkhorn(nn.Module):
r"""
Sinkhorn algorithm turns the input matrix into a bi-stochastic matrix.
Sinkhorn algorithm firstly applies an ``exp`` function with temperature :math:`\tau`:
.. math::
\mathbf{S}... |
1df57c156805351e92717a445598adb4ae0609c18909f8f11fd0e2293486720f | Python | 11,183 | 262 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 18 16:39:48 2021
@author: benozzo
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from scipy import stats
from joblib import Parallel, delayed
import pdb
import os
def compute_stat_test(data, group):
"one way an... |
5e270dc32053ce62920db4ae14a1e137f37404a4e47cd7f3d2a2fbef9f1404da | Python | 11,185 | 290 | # 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 ... |
bac6876721ccf4874b698c116606c1f60859b98884ac46fcb2aa5947720d84af | Python | 11,186 | 218 | # %%
import sys
import os
import random
import time
import glob
import numpy as np
import math
import h5py
from scipy.io import savemat, loadmat
import multiprocessing as mp
sys.path.insert(1, '../..') # the path containing "suns" folder
os.environ['KERAS_BACKEND'] = 'tensorflow'
# os.environ['CUDA_VISIBLE_DEVICES'] =... |
b29e85715ff903d646274061e69ba514515b1ffef0cefe52c76ac1f72c58f788 | Python | 11,187 | 246 | import io
import click
import pandas as pd
from uniprotparser.betaparser import UniprotSequence, UniprotParser
from curtainutils.common import read_fasta
import re
# Regular expression to extract position and residue from the index column
reg_positon_residue = re.compile("_(\w)(\d+)")
def lambda_funct... |
d200185a600801f0dfcda3bc2a5033624e64d2b73063a0cced8e1aa58b684b14 | Python | 11,187 | 335 | """
Estimate T2 and S0, and optimally combine data across TEs.
"""
import argparse
import logging
import os
import os.path as op
import numpy as np
from scipy import stats
from threadpoolctl import threadpool_limits
from tedana import __version__, combine, decay, io, utils
from tedana.workflows.parser_utils import is... |
110d97f71184df64ef02d5a9b81055d47dc9c56da2b6104049c49e7176a7d9ad | Python | 11,189 | 218 | # %%
import sys
import os
import random
import time
import glob
import numpy as np
import math
import h5py
from scipy.io import savemat, loadmat
import multiprocessing as mp
sys.path.insert(1, '../..') # the path containing "suns" folder
os.environ['KERAS_BACKEND'] = 'tensorflow'
# os.environ['CUDA_VISIBLE_DEVICES'] =... |
6d2a44268a45cdaafdc35f898ef90c6ea2f671a184fc7cc894c771996141d4f5 | Python | 11,191 | 257 | """The submission template, generated from the field registry.
Two files, one declaration. ``template.tsv`` is the machine-readable form; ``template.xlsx`` is the
one most submitters open, and it carries the three things a plain `.tsv` cannot:
* **every cell formatted as Text.** This is not decoration. ``method.frequ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.