sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
863d23702ce4ff02b244ada7861eee4edc3b50dc11f437debb466d87075d86a6 | Python | 8,062 | 204 | # 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... |
6d39cf98ec4af153b2c344f980bf1ab19dc1874fc7cff03870d338f70ba1c28a | Python | 8,065 | 200 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import RidgeClassifier
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.svm import SVC
from torchvision import datasets, transfo... |
53b3205c823c8b0bc1f4d01d2bbd2b49e95d3ec5f8fa533c8e6b4d9470f7f24d | Python | 8,066 | 248 | # Copyright (c) 2019 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... |
156fb08940edbbd1cd5f2319083520730bb79bcb80ff79126abdc2a5ffd2f133 | Python | 8,068 | 206 | import logging
import warnings
from collections.abc import Callable, Sequence
from pathlib import Path
from typing import Any
import numpy as np
import torch
from idtrackerai import Blob, ListOfBlobs, ListOfFragments, Session
from idtrackerai.base.network import DEVICE, IdentifierBase, get_onthefly_dataloader
from id... |
a02c3286ea3965abe5d063b44a10942865e42ce34d972d40bb4f7005b30e2dcd | Python | 8,068 | 204 | """`--work_dir` and `--num_workers`, neither of which any run passed.
`--work_dir` is not one of the four output directories; it is where the training
split records the validation indices it chose, and it only writes that file when
the split is large enough to be worth recording (ten or more configurations).
Every exi... |
103886d4f9e4f805227b6ab6fac6cc64dcc97dd9e380629dc6efbebf8f5c7f74 | Python | 8,072 | 181 | # 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... |
b72e43087d17fe5c8faec60c41441e376b27fca1e07f74872548416a587d2f53 | Python | 8,073 | 227 | import subprocess
import sys
import numpy as np
import pytest
import torch
from skimage.data import shepp_logan_phantom
from skimage.transform import radon, resize
from sparse_ct.data import create_circular_mask
from sparse_ct.radon import IRadon, LearnableFilter, RampFilter
from sparse_ct.reconstructor_2d import N2S... |
ffc1675b3549524fc02b2698d3d551e83beec9a87f77faaf80577ab270ef8526 | Python | 8,073 | 222 | ################################################################################
# Import, Set up MPI Variables, Load Necessary Files
################################################################################
import os
from os.path import join
import sys
import matplotlib
import matplotlib.pyplot as plt
from matp... |
cbfc62573ace4bc7b6a9d622dba1ed1fd2d0c20612ea619ceb193a1b8e0a0325 | Python | 8,074 | 252 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
import torch
from torch import nn, Tensor
from typing import Optional, Tuple
import argparse
from torch.nn import functional as F
from utils import logger
from .base_layer import BaseLayer
class LinearLayer(Base... |
ed94e9505c16a8a766c5be1ed991ec296ecc2124ec7edca14528eed4ae6385f3 | Python | 8,075 | 215 | # 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 logging
import numpy as np
import torch.utils.data
from fairseq.data import data_utils
logger = logging.getLogger(__name__)
class Ep... |
42df68b0115a298d47bb5774bb1fc325dc4672c7715e7a9830b9de7b869c69ec | Python | 8,076 | 233 | import math
from collections import OrderedDict, namedtuple
import torch
import torch.nn as nn
from einops.layers.torch import Rearrange
from model_angelo.models.common_modules import FcResBlock, LayerNormNoBias
from model_angelo.utils.residue_constants import canonical_num_residues
from model_angelo.utils.torch_util... |
992f6d5c33e82e18bb2630e761410fefd54015415cc25b9781e42c31fc0d8406 | Python | 8,076 | 257 | import torch
import click
import json
from corgie.log import logger as corgie_logger
from corgie import scheduling, helpers, stack
from corgie.helpers import BoolFn
from corgie.boundingcube import get_bcube_from_coords
from corgie.argparsers import (
LAYER_HELP_STR,
create_layer_from_spec,
corgie_optgroup,
... |
4ce7659c3ab83bd432c02dce704e89e2e1384c867eb64377b7e64631c0e4b997 | Python | 8,077 | 252 | import xarray as xr
import pandas as pd
import numpy as np
import scipy.stats as stats
def run_pipeline(df, analysis_window, col_name):
"""
Runs the visual analysis pipeline on a DataFrame. Creates and returns
the mean DataFrame, finds visually responsive cells, finds preferred and
ortho orientations (... |
1785fbd4d09b37bdbfa8946acc14a8f38e60c2c77855cc00b04f462dae8cbaaf | Python | 8,078 | 242 | r"""Illustrate how a Kalman-like filter can be defined on Lie groups.
A generic Kalman filter class is defined for systems on Lie groups for which
the exponential is surjective. Its use is illustrated on two localization
problems, a linear and a non-linear one. In both cases, the propagation model
is known, and sparse... |
6a288e7b13aa397130c39bda8875af4f81974c1b7109832f4e94e8c5b49525dd | Python | 8,079 | 243 | """
NeuroLearn Mask Classes
=======================
Classes to represent masks
"""
__all__ = ["create_sphere", "expand_mask", "collapse_mask", "roi_to_brain"]
__author__ = ["Luke Chang", "Sam Greydanus"]
__license__ = "MIT"
import os
import nibabel as nib
from nltools.prefs import MNI_Template, resolve_mni_path
imp... |
30d6b4bf46320ae83022521c3ac100120d42cbef658970c06ba3264211883527 | Python | 8,081 | 171 | # Author: Youzhi Luo (yzluo@tamu.edu)
# Updated by: Anmol Anand (aanand@tamu.edu)
import os
import torch
from torch_geometric.loader import DataLoader
from torch_geometric.data import Batch
from torch_geometric.datasets import TUDataset
from .model import RewardGenModel
from dig.auggraph.dataset.aug_dataset import Sub... |
89d84b3955a7a68446b7b6282cf136cccd43aafa3795777221df83298c762c52 | Python | 8,085 | 273 | #!/usr/bin/env python3
# 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 os
import subprocess
import sys
from setuptools import Extension, find_packages, setup
if sys.version_info < (... |
121d4110067e713bdc39b246ac5f6ddda9676f9e4e984a408537a9259cbe97d5 | Python | 8,089 | 195 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import lightning
from lightning.pytorch.callbacks import Callback
from nequip.train import NequIPLightningModule
from typing import Dict
class LossCoefficientScheduler(Callback):
"""Schedule loss ... |
77a318ab5cbb9e1222e586e22f3deec3765bcbfc7cabcacc963efc2f62bb73c2 | Python | 8,090 | 229 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 12 15:25:17 2018
@author: ngritti
"""
# from csbdeep.models import CARE
# from deeprest.rawDataClass import rawData
# from deeprest.modelClass import modelRest
# from deeprest.timeLapseClass import sampleTimeLapse
import time, os, glob
from tqdm imp... |
cda77ddd0c6c2b2ac4e8da4830e6cbbedd61e28ae03f514fcf6b9c4ee40322ad | Python | 8,093 | 178 | import numpy as np
from sklearn.decomposition import PCA
from scipy.spatial.distance import euclidean
from typing import List, Tuple
class ManifoldGeometry:
"""
Implementation of https://www.biorxiv.org/content/10.1101/2021.03.21.436284v1.full.pdf
that computes the statistics of manifold geometry relevant... |
f4bfcf4061f2033963d0305cf59c3a31591b20e1a31f4c04ee729f436936328b | Python | 8,097 | 267 | """Simple parser routines for TOML and JSON
FIXME: about everything
"""
__all__ = ["read_smiles_csv_file", "read_config", "write_json"]
import sys
import io
import tomllib
from pathlib import Path
import csv
import json
import yaml
from typing import List, Tuple, Union, Optional, Callable
from rdkit import Chem
fro... |
4ca89322161f069212896ae3864fa24314fdf4a08b87db467b5725d4ca4cbcc2 | Python | 8,099 | 243 | """
Code to visualize with pymol
Example usage:
python ~/protdiff/protdiff/pymol_vis.py pdb2gif -i projects/generated/generation-with-history/sampled_pdb/sample_history/generated_0/*.pdb -o generated_0.gif
"""
import os
import glob
import re
import warnings
import multiprocessing as mp
import argparse
import tempfile
... |
b053fdd6a7956e1fdc834eb76fd2ea205da471e7762a1dcac8ffd444a9252b20 | Python | 8,099 | 263 | #!/usr/bin/env python3
import os
import random
import shutil
import tarfile
from functools import partial
from pathlib import Path
import numpy as np
import torch
import webdataset as wds
from torch import nn, optim
import mlspm.data_loading as dl
import mlspm.preprocessing as pp
from mlspm import graph, utils
from ... |
65c477517c1604dacaaa2953f15219801d7abae4ab92c1a9aef32fc5935e0209 | Python | 8,105 | 202 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
# This Muon implementation is based on the original Keller Jordan GitHub repository:
# https://github.com/KellerJordan/Muon/blob/master/muon.py
import torch
# This function is adapted from Muon (http... |
f90f955b28cde29e33c0fcd3a6d7d878b685c534090017424a2d7efb50769ec2 | Python | 8,105 | 204 | from typing import Dict, List
import torch
from model_angelo.utils.fasta_utils import FASTASequence, filter_small_sequences
from model_angelo.utils.torch_utils import get_module_device
def crop_long_chain(chain: FASTASequence, max_chain_length=1024):
length = len(chain.seq)
i = 0
chain_crops = []
ch... |
c2f3a9ba36df23a920f7c81dc018462baab5afba4455b61a78b3181604f6b8b4 | Python | 8,113 | 218 | import logging
from collections.abc import Callable
from pathlib import Path
import cv2
import numpy as np
from idtrackerai import Session
from idtrackerai.GUI_tools import VideoPathHolder
from idtrackerai.utils import create_dir, load_trajectories, track
def draw_collage_frame(
positions: list[tuple[int, int]]... |
16a913de67681627543dc3725f7d30d2f1618337478308bce70dbf6ad3ad58cc | Python | 8,117 | 216 | # 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... |
04d34dcc3e17b59a5947179c4df931c6813bf05cc762562d9386a1a41b3c8751 | Python | 8,125 | 238 | import os, gc
import matplotlib.pyplot as plt
import scanpy as sc
from typing import Union, List
import numpy as np
import pandas as pd
from utils.plotting import plot_2d_embeddings, plot_labels_seperately, plot_label_subset
from banksy.labels import plot_connections
import anndata
from typing import Tuple
import matp... |
b7daf2408897e03115c23d38dbeba426ecc6de3a0da89480e98c06ef679a50b5 | Python | 8,129 | 413 | """Autograd based computation backend."""
import autograd.numpy as _np
from autograd.numpy import (
abs,
all,
allclose,
amax,
amin,
angle,
any,
arange,
arccos,
arccosh,
arcsin,
arctan2,
arctanh,
argmax,
argmin,
asarray,
broadcast_arrays,
broadcast... |
d0d7525adb0eebed1f9baeba861342baca3ddd5d23fbb2315e44bd54a68610f6 | Python | 8,134 | 232 | """Tests for the decoding functional core — whitelist and coefficient back-projection."""
import numpy as np
import pytest
from sklearn.decomposition import PCA
from sklearn.feature_selection import (
SelectKBest,
f_classif,
)
from sklearn.linear_model import LogisticRegression, Ridge
from sklearn.multiclass i... |
25529d927441c684a4a587e911ee14c3022670a2e107bdf908deae1192588554 | Python | 8,135 | 239 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import sys
import numpy as np
from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator
from openfl.experimental.workflow.runtime import LocalRuntime
from openfl.experimental.workflow.placement import aggregator... |
9d3efadfb62f1968ddcabcbeb3c38db52295df60968bea8ff0f70382a8c12b60 | Python | 8,138 | 208 | import unittest
import numpy as np
import torch
from foldingdiff import losses
class TestRadianSmoothL1Loss(unittest.TestCase):
def test_easy(self):
"""
Easy test of basic wrapping functionality
"""
l = losses.radian_smooth_l1_loss(torch.tensor(0.1), torch.tensor(2 * torch.pi), b... |
73fbc161651f810c385c1dd9488ecce30690e90bc134a34f45c95a363d809bdf | Python | 8,140 | 258 | #!/usr/bin/env python3
#
# Sniffles2
# A fast structural variant caller for long-read sequencing data
#
# Created: 02.01.2024
# Author: Hermann Romanek
# Maintainer: Hermann Romanek
# Contact: sniffles@romanek.at
#
from typing import Tuple
from unittest import TestCase
from unittest.mock import Mock
from... |
e7d88e210482f1adea16e6b75fe7a4b0513757df412d0ddff6295842fdde495b | Python | 8,140 | 173 | """Continuous motif ordering, geometric support and training-only decisions."""
import numpy as np
import polars as pl
import pytest
from vdjdb.score.membership import separated
from vdjdb.validate.membership import fit_pair, predict_pair, ranking_metrics, select_threshold
def test_separation_missingness_and_binary_... |
2e2249268130c850fcbd27f574e9e825e5c871956bf911483e4bdeaac6a409e2 | Python | 8,148 | 273 | #!/usr/bin/env python
"""Tokenize SMILES
Assumes correct SMILES syntax e.g. that elements other than the basic ones are
in brackets.
"""
import os
import argparse
import tomllib
import pathlib
import json
import datetime
import multiprocessing as mp
from collections import Counter
import logging
import logging.handle... |
089858876e7cac3e13fc56db1f5d14a4a979ce25db593a643a981a2d2d23bd27 | Python | 8,150 | 217 | import os, sys
import argparse
import torch
import torch.nn.functional as F
from torch_geometric.loader import DataLoader
import numpy as np
from sklearn import metrics
from sklearn.metrics import confusion_matrix, accuracy_score, balanced_accuracy_score
from sklearn.model_selection import train_test_split, Str... |
fac03384d845bbfe3003bb826e43bafa7e6454df4c168d5bd43c52f4a3b6a1e8 | Python | 8,151 | 237 | from __future__ import annotations
from abc import abstractmethod
from enum import Enum
from typing import (
Any,
List,
Optional,
Dict,
Tuple,
TypeVar,
)
from dataclasses import dataclass
from pydantic import SecretStr
from chromadb.config import (
Component,
System,
)
T = TypeVar("T... |
7824cef83e23349dada7b052de7fbb7e1c8e4c7f3b9c2394ad18cd4f97d1b9ad | Python | 8,152 | 224 | """Shared parity harness for accelerated tensor-product backends.
BackendTestBase builds a ScaleShiftMACE, converts it e3nn -> backend -> e3nn
and checks forward (energy/forces/stress) and backward (all parameter grads)
parity. Backend test classes (tests/backends/test_cueq.py, test_oeq.py)
inherit from it and provide... |
525577ca4cf73f586f9458d34ada1f03d0202b9b33b930d8df78c872b993d0d4 | Python | 8,153 | 201 | # -*- coding: utf-8 -*-
# /usr/bin/env python3
#
# This software and supporting documentation are distributed by
# Institut Federatif de Recherche 49
# CEA/NeuroSpin, Batiment 145,
# 91191 Gif-sur-Yvette cedex
# France
#
# This software is governed by the CeCILL license version 2 under
# French law... |
0f17897e2d15324d0714486bea21390f09109d33844a15a7dc9ebd4fd57ad74b | Python | 8,160 | 200 | #!/usr/bin/python
#
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
22c44a06c476d10a160224ee57563238321b11db80abafa0d8b18e2527b80ac3 | Python | 8,163 | 245 | # Copyright 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging
import docker
import subprocess
from functools import lru_cache
import tests.end_to_end.utils.defaults as defaults
import tests.end_to_end.utils.exceptions as ex
log = logging.getLogger(__name__)
def remove_docker_network(... |
6507dc3b64a13c91f2d3333de84d3cf18a4e911d1e130525a5c3b2af30d41bd0 | Python | 8,166 | 189 | # 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 ... |
624bdc42f3f8330bed3fd7fd1a55d84190cfacdbe1d389d4642ed8ac199be004 | Python | 8,167 | 228 | """Dataset, resource, and atlas lookups.
Functions to fetch example datasets, bundled resources, and parcellations. The
curated example datasets (`fetch_pain`, `fetch_emotion_ratings`) are hosted on
the ``nltools/niftis`` Hugging Face dataset and resolve through the same
`fetch_resource` machinery as the MNI templates... |
dec389f37991f07c0803f85e8d3041c86f597c583fb08b0aa9179fae61b7faa1 | Python | 8,169 | 245 | #!/usr/bin/env python3
from typing import Sequence, Tuple, Union
import torch
import torch.nn as nn
from monai.networks.blocks.dynunet_block import UnetBasicBlock, UnetResBlock, get_conv_layer
class UNesTBlock(nn.Module):
""" """
def __init__(
self,
spatial_dims: int,
in_channels: i... |
1eaffd54b57075f671e0513485fcb209f04996650f81eb59ea5ccff09f11c0fb | Python | 8,170 | 257 | import os
import numpy as np
import torch
import tables
from torch.utils.data import DataLoader, TensorDataset
from scipy.sparse import coo_matrix
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import torchvision.datasets as dsets
import torch.nn.functional as F
imp... |
9293524029641916ea676de19e727662fd9a11f104f98155d5096274b6fec125 | Python | 8,173 | 226 | #!/usr/bin/env python3
"""Require that a commit's authors are people.
Using an assistant is fine and needs no disclosure rules here. Claiming one as
an author is the problem: GitHub builds the contributor list from the author
and committer identities and from `Co-authored-by:` trailers, so any of the
three can put an ... |
c4c4e44d1787c5286402c78c378af4cce9c4b7824a5b234271cb63b72a365785 | Python | 8,181 | 183 | """Every MHC call resolves against one of two authorities, or the build stops.
`assert_mhc_resolves` is the gate the corpus already satisfies: measured over 192,793 records, no
blank MHC cell and no unresolved name in either column. These tests fix that as a contract rather
than a property of today's data.
"""
from __... |
621f764fc2b726b72735e878e43a1e8c1f5e2d1eced622f3476a644bdb96404b | Python | 8,182 | 271 | import numpy as np
import torch
import torch.nn.functional as F
from model_angelo.utils.torch_utils import is_ndarray, shared_cat
def get_affine(rot_matrix, shift):
is_torch = torch.is_tensor(rot_matrix) and torch.is_tensor(shift)
is_numpy = is_ndarray(rot_matrix) and is_ndarray(shift)
if is_torch or is... |
807ff5634d2b39078be5f131720df9f7591a1f0c23f6f8313355446f2eed4494 | Python | 8,186 | 258 | import os
import numpy as np
import torch
import torch.nn as nn
import argparse
import matplotlib.pyplot as plt
from torchvision import transforms
from tqdm import tqdm
from bindsnet.analysis.plotting import (
plot_input,
plot_spikes,
plot_voltages,
plot_weights,
)
from bindsnet.datasets import MNIST
... |
689fd15df6a1e86e6e224d08144055a748fbb12cd54da99572e3e151805551fa | Python | 8,189 | 189 | # -*- coding: utf-8 -*-
"""Provides standard datasets for benchmarking.
"""
from warnings import warn
from functools import partial
import numpy as np
import odl
from dival.datasets.ellipses_dataset import EllipsesDataset
from dival.datasets.lodopab_dataset import LoDoPaBDataset
from dival.datasets.angle_subset_dataset... |
bb1c978b5c96fe4003ea83a2a235858540adbc4208a7df421b2bf53e959a093f | Python | 8,191 | 216 | """Two-sample permutation test (group-label shuffling).
Tests whether two independent groups differ in mean by randomly reassigning
observations to groups — the permutation analogue of an independent-samples
t-test. Permutations run on joblib workers; `n_jobs` sets how many, and a
given `random_state` gives the same r... |
ae645f4435d527b00e643ea2436f321dde628028c101d0b93fdce6721701e843 | Python | 8,193 | 250 | import cv2 as cv
import numpy as np
import datetime
import experiment as exp
from experiment import session_state
from video_system import image_sources, image_observers
import schedule
import arena
import data_log
import video_system
def detect_aruco(src_id):
test_image, _ = image_sources[src_id].get_image(scal... |
043b73f449a3fb47649aeef7a070de370217f295095a70bba9701111db6fbcff | Python | 8,196 | 202 | """
This is the data preprocessing that should return
the .pt with the data to run the model
"""
import os
import pandas as pd
from scipy.sparse import csr_matrix
import json
import argparse
from rdkit import Chem
from rdkit.Chem import Descriptors
import torch
from torch_geometric.data import HeteroData
import ... |
7636631db53e310e56540531b08b98c9021e9cf63718ec5ffe5fbdfa8fd489fd | Python | 8,203 | 220 | from collections.abc import Sequence
from pathlib import Path
from qtpy.QtCore import Qt, Signal # type: ignore[reportPrivateImportUsage]
from qtpy.QtGui import QFocusEvent
from qtpy.QtWidgets import (
QFileDialog,
QHBoxLayout,
QListView,
QListWidget,
QMessageBox,
QPushButton,
QSizePolicy,... |
0eba7f9a9a9598c5a22c251c524a0e8d910ce1cad6405482a9555ea11ee8cddf | Python | 8,208 | 159 | """Whether the recorded MHC could present the recorded epitope at all (ROADMAP phase 9e).
`proofreading/mhc_alleles.tsv.gz` answers whether IPD-IMGT/HLA lists a name. That is a weaker
question than it looks: a name can be in the registry and still be unusable, because what every
presentation model reasons over is the ... |
3aaf48423ef709ab12a5d9c8df665a544888c1227c9677d2af9cc1be8f2647ff | Python | 8,208 | 254 | # 20210619
from PyQt5 import QtCore, QtWidgets, QtGui
from sanpy.sanpyLogger import get_logger
logger = get_logger(__name__)
import sanpy
from sanpy.interface.window_state import WindowState
from sanpy.bExport import bExport
from sanpy.interface.plugins import sanpyPlugin
# from sanpy.interface.plugins import Respo... |
70663d8de617e8f8c4e2d50fb1650a44619aa7218da7238bee3038de8a1f6255 | Python | 8,208 | 266 | """Code for the dataset_generator for both tasks."""
import itertools
import os
import numpy as np
import tensorflow as tf
@tf.function
def batch_equalizer_fn(*args):
"""Batch equalizer.
Prepares the inputs for a model to be trained in
match-mismatch task. It makes sure that match_env
and mismatch_env... |
b00ecd7bf6bfd9b49c9ded0d661a24f0a573fb37c7e2d6c302149183ccbd2fde | Python | 8,216 | 241 | # 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 app... |
13f9d6298c2a1f0e4db80674198fb8f84f7dac35fa10ebd5b98f7fd099b74199 | Python | 8,220 | 246 |
from sleepy.gui.processing.view import PreprocessingView
from sleepy.gui.exceptions import UserCancel
from sleepy.gui.tagging.model import Navigator
from sleepy.processing.engine import Engine
from sleepy.gui.tagging.model.event.user import UserPointEvent
from PyQt5.QtWidgets import QFileDialog, QMessageBox
fro... |
099fd0877cd6f3a4d98067df5a49b876217e20615b64f0071948d1289876e6d1 | Python | 8,224 | 201 | # -*- coding: utf-8 -*-
import unittest
from io import StringIO
from unittest.mock import patch
import json
import numpy as np
import odl
from odl.solvers.util.callback import CallbackStore
from dival import get_standard_dataset
from dival.data import DataPairs
from dival.evaluation import TaskTable
from dival.measure ... |
9b55117d8b588aac884d7e224928d8df755b81c5c8b2380f81a1d09f1334f7b4 | Python | 8,225 | 258 | # -*- coding: utf-8 -*-
#
# gUtils documentation build configuration file, created by
# sphinx-quickstart on Thu May 21 14:35:42 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... |
a68b9784ca15f48cc90d193f0c7da8a5d40629fa70bee41b8897147c473b76bc | Python | 8,226 | 236 | from numba import jit
import math
import numpy as np
def extract_traces_around_points(stack, points, **kwargs) -> dict:
return dict(traces=_extract_traces_around_points_jit(stack, points, **kwargs))
@jit(nopython=True)
def _extract_traces_around_points_jit(
stack, points, kernel=(0.5, 1, 1), kernel_mult=2, ... |
74bf49ea41a3fedf53b06e191a5c495facbaf0469e29f44bca7dbe57559c141e | Python | 8,229 | 223 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 10 16:06:38 2020
@author: Tom
"""
import tensorflow as tf
from tensorflow import keras as k
import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
class SurvivalModel(object):
def __init__(self,
model,
base_model... |
44cf808936db05824840ba1722a463022fb1a3b9faa9e1cf71d3c257d93d6aa0 | Python | 8,236 | 272 | """Utility module of reusable algebra routines."""
import math
import geomstats.backend as gs
EPSILON = 1e-6
COS_TAYLOR_COEFFS = [
1.0,
-1.0 / math.factorial(2),
+1.0 / math.factorial(4),
-1.0 / math.factorial(6),
+1.0 / math.factorial(8),
]
SINC_TAYLOR_COEFFS = [
1.0,
-1.0 / math.factori... |
e5708ebb20dd072e3a10d01c776902c22a5d945a535cbbbb4017e9c7acc1cf48 | Python | 8,236 | 214 | """`--foundation_model_readout` decides whether the foundation readout is copied.
It stopped being read in November 2023: `6c8de70c` replaced
`load_readout=args.foundation_model_readout` with `load_readout=True`, and the
flag has done nothing since. The behaviour it used to control was reachable only
through `--founda... |
0bb7c833ca65105267adc2f083e1fe95ab645daa830358aff46cbb9f8948155c | Python | 8,238 | 243 | # 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... |
735a8eb807b2f05ed8f3a293f1f9651b0eb391ea9b13efdd50eb814a3461d5fc | Python | 8,238 | 208 | '''
get_zdFF.py calculates standardized dF/F signal based on calcium-idependent
and calcium-dependent signals commonly recorded using fiber photometry calcium imaging
Ocober 2019 Ekaterina Martianova ekaterina.martianova.1@ulaval.ca
Reference:
(1) Martianova, E., Aronson, S., Proulx, C.D. Multi-Fiber Photometry
... |
d6741e633bb6f1e97357307182496a877c544740ab3a01ca3984d3a7217a7719 | Python | 8,239 | 207 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
97dccbeb06d4c0890ed4e1a61be3b5386cc388fdca7b7cdcc86ea43a429368ab | Python | 8,241 | 227 | from itertools import product
from typing import Optional, List
import tqdm
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import ModuleList, Linear, BatchNorm1d
from torch_sparse import SparseTensor
from torch_geometric.nn import MessagePassing
from torch_geometric.nn import PNACo... |
70e52c620fae52aad44e530412d9aeade2613e7194f0ccf5c7da5dfbded1b90d | Python | 8,246 | 230 | """Cross-cutting utilities used across the nltools package."""
__all__ = ["DesignMatrixWarning", "ResamplingWarning"]
import contextlib
import inspect
import re
from os.path import dirname, join, sep as pathsep
import polars as pl
# ---------------------------------------------------------------------------
# pola... |
73c49eedbd9ed4f0938bd5b86ecbca395eda56001d6a8b35a895cde5e8f073cf | Python | 8,247 | 235 | # 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.
"""isort:skip_file"""
import argparse
import importlib
import os
from contextlib import ExitStack
from fairseq.dataclass import FairseqDatac... |
4e97fc91d0a6bd140cfc51a7f6d2f81c2ee2d6711c6941eaabe815ee1ca0716c | Python | 8,249 | 197 | # 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... |
c0979dbacffd71a8f6abdb8dc7381be26f8ed2752fed7ddcdf8c97ed9f270910 | Python | 8,252 | 209 | import argparse
import os
import torch
import numpy as np
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping
from pytorch_lightning.loggers import WandbLogger
# Imports from this project
from ..src.graph_models import Estimator
from ..src.data_loading import Geometric... |
7b4f0d8d0f355b07064e9da53bf2758904afb0c8706d74d536bc19070cfdd5d2 | Python | 8,255 | 246 | """Tests for stable recording identities owned by an analysis directory."""
from pathlib import Path
from unittest.mock import Mock
import pandas as pd
import pytest
import sanpy
from sanpy.analysisDir import _normalized_file_key, analysisDir
def test_normalized_file_key_is_relative_and_portable(tmp_path: Path) ->... |
5f9a87fcbcb147a1d6d40a567a92c0540e7b87c3c1bfe1b2367bd57a5821c659 | Python | 8,260 | 206 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 27 13:29:39 2022
@author: shah
"""
from tensorflow import keras
from Utils import psnr, SSim
class UNetfairSIM:
"""This class is the implement UNetwork architecture for the image denoising task
Parameters
----------
... |
6a82dad529a22ceead429e6dbe4fa4f2fa4ed60d50d80ae0eca5f3bd6df08436 | Python | 8,261 | 267 | """The complex Poincaré disk manifold.
The Poincaré complex disk is a representation of the Hyperbolic space of dimension 2.
Lead author: Yann Cabanes.
References
----------
.. [Cabanes2022] Yann Cabanes. Multidimensional complex stationary
centered Gaussian autoregressive time series machine learning
in Poi... |
c0530f7437b3c65a00bbbc74e5e1681cb1f43b1abc84feb01799d3b3915f05d3 | Python | 8,261 | 218 | import matplotlib.pyplot as plt
import numpy as np
import csv
def load2(filename):
sim = []
col = []
num = []
mes = []
with open(filename, newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for i, row in enumerate(reader):
if i>0:
sim.app... |
79ec463127d8df9a8162f77c335980bdae8d6dabfda560f92feabd3d8578fc8b | Python | 8,262 | 234 | import inspect
from pymonntorch.NetworkCore.Base import *
# This class can be used to add tag-searchable functions to the neurongroups, synapsegroups and the network object.
# It has a main execute function which can be called with module(...) or module.exec(...)
# Other "normal" functions can be added as well.
# Via... |
8a525c480189b72096636dbe51fd339de3af255d3470817e99f3d5a0123b2462 | Python | 8,269 | 165 | import os
import time
import numpy as np
from tqdm import tqdm
from torch.autograd import Variable
from .model import GeneSGAN
from .evaluate import eval_w_distances, label_change
from .utils import Covariate_correction, Data_normalization, parse_train_data, parse_validation_data
__author__ = "Zhijian Yang"
__copyrigh... |
1299176387ba5642a2d836f0a0864ca085d756a59258b329d3b2d65bc975bb90 | Python | 8,272 | 228 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 7 14:33:58 2018
@author: ngritti
"""
import sys, copy, os
import numpy as np
from tifffile import imread
import matplotlib.pyplot as plt
from . import patFun
def load_images(fList,shape,offset=4,delta=4,verbose=True):
''' Load raw data as nD ... |
6edea3096b6a19fabe75e561c74414285022ad2b49856a1f2b0b9067fc78d250 | Python | 8,276 | 185 | import math
import json
from openpyxl.worksheet.table import Table, TableStyleInfo
from openpyxl.styles import Alignment
from nilearn import plotting,image,surface,datasets
from utilityFunctions import *
import collections
bn_atlas_file = 'PROJECT_DIR/scripts/features/bnatlas_tree.json'
parent_substitutions={
'Am... |
e13604274de9a9112a3d2f10a34b24f866ca39e32b663f60d361094e0a8b4346 | Python | 8,281 | 224 | # Copyright 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import os
import shutil
import xml.etree.ElementTree as ET
import logging
from pathlib import Path
from rich.console import Console
from rich.logging import RichHandler
from openfl.utilities.logging import setup_logger
from ... |
86a4f0f740c0db3eb775712f496ffff3cf6dd1d1291a927f9418c83c4b67bbf4 | Python | 8,283 | 223 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import torch
from e3nn.o3._irreps import Irreps
from e3nn.o3._spherical_harmonics import SphericalHarmonics
from e3nn.util.jit import compile_mode
from nequip.utils.global_dtype import _GLOBAL_DTYPE
f... |
7bc7d94478e8799152dea56f628c24f70f72d5e2a186ea782c3a96d242e29ce1 | Python | 8,285 | 244 | """K-means clustering.
Lead author: Hadi Zaatiti.
"""
import logging
from random import randint
from scipy.stats import rv_discrete
from sklearn.base import BaseEstimator, ClusterMixin
import geomstats.backend as gs
from geomstats.learning._template import TransformerMixin
from geomstats.learning.frechet_mean impor... |
70373b584dce5976e0927b2f05e6efeecaf0ff8d664eff5522695b0de437427b | Python | 8,293 | 255 | """
This module includes functions and classes to facilitate recording of network object \
variables through out the simulation time.
"""
import copy
import torch
from pymonntorch.NetworkCore.Behavior import Behavior
def get_Recorder(variable):
"""Returns a `Recorder` instance for the given variable.
Args:
... |
5a0914e61d1a33f3213a888b44c38689da31880bf4a16c83d6bb63fd182e6bd6 | Python | 8,295 | 192 |
import os
import pickle
import random
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
import torch
from torch.utils.data import Dataset
from hyper_dti.settings import constants
class DUDEData(Dataset):
target_embeddings = {}
drug_embeddings = {}
target_scaler =... |
adbe9b3aac2b2038e686a010de43e64077fb51e975940e9771b35e17d9e720ef | Python | 8,300 | 218 | import matplotlib.pyplot as plt
import numpy as np
import csv
def load2(filename):
sim = []
col = []
num = []
mes = []
with open(filename, newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for i, row in enumerate(reader):
if i>0:
sim.app... |
1c7b66be3db732209e476af2890bc6e9fe677f5b26d6bdcae373be8130e9f723 | Python | 8,302 | 261 | """Neurodesign documentation build configuration file.
This file is execfile()d with the current directory set to its
containing dir.
Note that not all possible configuration values are present in this
autogenerated file.
All configuration values have a default; values that are commented out
serve to show the defaul... |
a5c21ff4016085e283f450115772c2a7314836b549cc7a4cb7df125cf8975b67 | Python | 8,303 | 159 | # Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
from mpi4py import MPI
import numpy as np
from nest_elephant_tvb.transformation.communic... |
a6dd6e593c8c2f4aad67ffcde353f9f57375a018445be0e380f3456cc034da0a | Python | 8,304 | 186 | import math
import json
from openpyxl.worksheet.table import Table, TableStyleInfo
from openpyxl.styles import Alignment
from nilearn import plotting,image,surface,datasets
from utilityFunctions_yz import *
import collections
bn_atlas_file = 'PROJECT_DIR/scripts/features/bnatlas_tree.json'
parent_substitutions={
... |
3e0c757ebd6d1a52806e23141d4a9d85559e84ba456d5705ede56b57a397bb43 | Python | 8,308 | 233 | from numba import njit, jit, objmode
from numba.experimental import jitclass
from numba import int32, int64, float32, float64, boolean
from numba import deferred_type
from numba import typed, types
from numba.types import pyobject
import numpy as np
from scipy.io import loadmat, savemat
from .DTW import DTW
from .LBKe... |
e4a81c82fe69fbfc9281d53b3a400380740964d08606e3a523c9714b3d914e83 | Python | 8,314 | 219 | import os
from rdkit import Chem
from rdkit.Chem import rdChemReactions
from collections import defaultdict
import time
import pickle
from urllib.request import urlopen
from urllib.parse import quote
# import cirpy
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.*')
def cir_convert(ids):
# the website some... |
10f3bb7f75e53d4eae9b720c21769bb1cfcb2236b946d1286c8b1cd3b98e6dc0 | Python | 8,316 | 220 | """
Bar visual feedback class
Kyuhwa Lee, 2015
Swiss Federal Institute of Technology (EPFL)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any lat... |
db0a5e4499d821dc70ad8ce1adf10ebd4f196f3cf8264f320f54b9e897dcded6 | Python | 8,319 | 180 | import argparse
import sys
from datasets import *
from model import *
import os
import torch
from torch_geometric.data import DataLoader
from metric import compute_cla_metric, compute_reg_metric
import numpy as np
from texttable import Texttable
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')... |
9232575b5d67b51cc1307d486dbeed3f3377e49f215277e0920713463b18e2b6 | Python | 8,321 | 234 | from chromadb.api.types import (
SparseEmbeddingFunction,
SparseVectors,
Documents,
)
from typing import Dict, Any, TypedDict, Optional
from typing import cast, Literal
import warnings
from chromadb.utils.embedding_functions.schemas import validate_config_schema
from chromadb.utils.sparse_embedding_utils im... |
76f36cdd2b595831dce09960a200d0fa174d418d7014320ee39570a08ff17d8f | Python | 8,325 | 217 | import pickle
import numpy as np
from aux_fun import remove_SPH, construct_target_C, performance
from regularization import get_firing_power, alarm_generation, alarm_processing
from evaluation import alarm_evaluation, sensitivity, FPR_h, statistical_validation
from datetime import timedelta as t
import os
def ... |
eb07fcf3fc0aea37785ef40a2a28bff72035f931b39bbb58ced6c92f3a29b76d | Python | 8,327 | 241 | import os
from functools import wraps
from typing import Callable
import numpy as np
import pytest
import torch
import torch.nn.functional as F
from e3nn import o3
from torch.testing import assert_close
from mace import data, modules, tools
from mace.modules.wrapper_ops import CuEquivarianceConfig
from mace.tools imp... |
153dd2f2472f17d2e9fe156fa4cc8cb07a89d4aad80f0d8ae9f91c14013dab13 | Python | 8,328 | 235 | import logging
import random
import re
import string
import time
import traceback
from enum import Enum
from typing import cast, Dict, List, Optional, TypedDict, TypeVar
from overrides import override
from pydantic import SecretStr
import yaml
from chromadb.auth import (
ServerAuthenticationProvider,
ClientA... |
0e1674afa561bea221c840a50283f58353266feadb4d9591d4c666150384cdbf | Python | 8,330 | 226 | # Copyright (c) 2017-present, Facebook, Inc.
# 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 logging
from dataclasses im... |
937c9b7db8775bd2913480dd4dc7133330754f1f4cae1fefe51b687211e0735f | Python | 8,330 | 224 | """Linear regression estimators for structured Euclidean data.
This module defines estimators for regression between Euclidean spaces. Inputs
and outputs may be vectors or higher-order tensors; structured data are
flattened before fitting and reshaped back according to their spaces.
It also provides a :class:`LinearR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.