sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4657a8d809509c1cf7b67599387857d99c2b756cd7b746367d4fd5a9c3c0e017 | Python | 14,990 | 406 | import numpy as np
import torch
from pymonntorch.NetworkCore.Base import *
from pymonntorch.NetworkCore.Behavior import *
class NeuronGroup(NetworkObject):
"""This is the class to construct a neuronal population.
Attributes:
size (int): The number of neurons in the population.
behavior (list... |
fabe286a1dbd3a5260a780d170ab7667a68d211187271fb758ca3940b07f0cf8 | Python | 15,015 | 455 | # 20210129
import os, sys
import numpy as np
import tifffile
from sanpy.sanpyLogger import get_logger
logger = get_logger(__name__)
class bAbfText:
"""
mimic a pyabf file to load from a text file
"""
def __init__(self, path=None, theDict=None):
"""
path is either:
path... |
4afdf4d97533cb4e400d0e29d6ba5a225490d337800bac5103ceeffc639b37ab | Python | 15,028 | 382 | """
Inspired by the U-Net implementation from https://github.com/jvanvugt/pytorch-unet,
released under the MIT License, copied below:
MIT License
Copyright (c) 2018 Joris
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),... |
71edf3e3acb646cd1b6628c8aa46435c07d44db705a5ed7890009169d1d2f688 | Python | 15,042 | 386 | # 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... |
e4afb1af18845b19197011fb255942417c4ade4f9d38df0637b4302d40af990d | Python | 15,058 | 448 | #cript containing the modular version of the code
# so far we have only implemented the non_linear_embedding layer
# for simplicity we can just use dense layers for the merge operations
import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
import torch.nn.functional as F... |
3be9d99849226b8c970fc02f0ea78b4a6eddfe0a3e5ad53f369d5967439e6212 | Python | 15,061 | 428 | # 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
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
from f... |
82ee10c18769ce89357275af8849119d2f69855b0660bd8ce2a83d6fb2c00728 | Python | 15,062 | 410 | """Tests for nltools.algorithms.outliers — outlier detection and robust statistics."""
import numpy as np
import polars as pl
import pytest
from nltools.algorithms.outliers import trim, winsorize, find_spikes, zscore
class TestWinsorize:
"""Test winsorizing outlier handling."""
def test_std_replace_with_cu... |
3694f32249318890a7cdd2f14c9bca170c6702a4a2465b2ea3cbbdfbedf3f1ad | Python | 15,063 | 479 |
import unittest
from unittest.mock import MagicMock
from sleepy.gui.tagging.control import TaggingControl
from sleepy.gui.exceptions import UserCancel
from PyQt5.QtWidgets import QMessageBox
from sleepy.test.core import TestBase
class ControlTest(unittest.TestCase):
def standardScenario():
... |
459ef73a8124061ebd4ef20cb6cc07ea3698be61cbf55561933ea3638b9991a7 | Python | 15,063 | 252 | """Proofread current structure associations and deposited coordinate-file coverage.
The reviewed dataset mapping is an input, independent of automatic evidence assembly.
Archives are streamed without extraction. No molecular inference or source editing occurs.
"""
from __future__ import annotations
import gzip
import... |
92bffed0e97a3883d05270157b500d7d05dda5cd2fff8d8836deab0411ed610a | Python | 15,065 | 426 | # 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... |
b99971da9e3dace103203bdbb7601e64c75ba9f5b792190fe00fdd42f59aa04f | Python | 15,069 | 392 | """Tests for nltools.plotting.adjacency — polars-native label distance and silhouette plots."""
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import polars as pl
import pytest
from nltools.plotting.adjacency import (
_plot_between_label_distance,
_plot_mean_label... |
2fc4566b8c72df60ee4a76081d31af220d68780f21ca8a18de1ee12eddc31609 | Python | 15,072 | 436 | from pathlib import Path
import os
import copy
import sys
import numpy as np
import pandas as pd
import random
import torch
import torchvision
import matplotlib as mpl
mpl.use("Agg") # save img on the remote cluster
import matplotlib.pyplot as plt
import seaborn as sns
from data_classes import VOPADataset
from models... |
7175a05d47f483073c02da72e2be04f24eef02b9d08dfe5ab4731900f50766bf | Python | 15,072 | 412 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Using vedo 2024.5.1
import os, sys
from glob import glob
from datetime import datetime
import numpy as np
from vedo import __version__ as _vedo_version
from vedo import settings, mag, precision, load, sys_platform, show
from vedo import fit_circle, printc, Plotter, Text2... |
da192cb94bb8c27b09b015b0d04882c7e0df6ca168b070a634abacf604e08a14 | Python | 15,075 | 448 | #cript containing the modular version of the code
# so far we have only implemented the non_linear_embedding layer
# for simplicity we can just use dense layers for the merge operations
import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as nn
from torch.utils import data
im... |
50c891d5826ab8542068c7c6efec89fb5d035efb8f7c0e1f1e75d1ecd2d54b56 | Python | 15,087 | 383 | import torch
import torch.nn as nn
from .mol_tree import Vocab, MolTree
from .nnutils import create_var
from .jtnn_enc import JTNNEncoder
from .jtnn_dec import JTNNDecoder
from .mpn import MPN, mol2graph
from .jtmpn import JTMPN
from .chemutils import enum_assemble, set_atommap, copy_edit_mol, attach_mols, atom_equal,... |
2ed8d7342f938fa88fc3f968a2fb6f9f381b20a60d21071b735db0d6965e06e9 | Python | 15,089 | 433 | import neuprint
from neuprint import fetch_neurons, fetch_adjacencies, NeuronCriteria
from neuprint import fetch_synapse_connections, SynapseCriteria
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
import plotting_help as ph
# ------------------ Pl... |
e38dd3ea5bf898e9365b47c7fe3655187dc13af7b0e1aad4f6605a0f5368cd61 | Python | 15,089 | 502 | from __future__ import annotations
import argparse
import json
import ase.io
import numpy as np
import pytest
from ase import Atoms
from ase.calculators.calculator import Calculator, all_changes
from ase.io.cube import read_cube_data
from mace.cli import polar_density_cube
from mace.cli.polar_density_cube import (
... |
133e8b8e4c114dd0993ec94d9921c81859768d31e889063c33bba07b1f0b0f40 | Python | 15,094 | 386 | import numpy as np
from numpy.random import default_rng
# import matplotlib.pyplot as plt
from ewers.time_intervals import interval, find_nonoverlapping_interval, seg_available, seg_long_calls, get_duration
def make_annotation_text_files(data_folder,
clip_length,
... |
6f3a9ee5ab153ce87593603678d51ec119dd2f00b1c12feac6af41182e63ffd3 | Python | 15,100 | 447 | # -*- coding: utf-8 -*-
"""
Functions to facilitate dFC simulation.
Created on April 25 2024
@author: Mohammad Torabi
"""
import numpy as np
from scipy import signal
from tvb.simulator.lab import *
from pydfc import TIME_SERIES, task_utils
################################# Simulation Functions #####################... |
17919bca9cbeec793d43b1758f7a65f53a5d57d7626f8cf668e06dcf298ac98d | Python | 15,111 | 468 | """
Time Series class
Created on Jun 29 2023
@author: Mohammad Torabi
"""
import os
import warnings
from copy import deepcopy
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
from .dfc_utils import print_dict
################################# Parameters ##################################... |
9b554de35867a0e0a88272787ddaec6cb0b2c346945637ee58bf39d12ed02f4c | Python | 15,125 | 365 | #!/usr/bin/env python3
__doc__ = \
"""The Developmental Cognition and Neuroimaging (DCAN) Labs fMRI Pipeline [1].
This BIDS application initiates a functional MRI processing pipeline built
upon the Human Connectome Project's minimal processing pipelines [2]. The
application requires only a dataset conformed to the BID... |
1d2f01cfc93de1a440c114dbf781fd4974f198cf9203ebe60b8bca3da0acad33 | Python | 15,130 | 414 |
import os
import random
import time
from functools import partial
from pathlib import Path
import numpy as np
import torch
import webdataset as wds
import yaml
from torch import optim
import mlspm.data_loading as dl
import mlspm.preprocessing as pp
import mlspm.visualization as vis
from mlspm import graph, utils
fro... |
2ca59eb5db83fbc3e4652c7f6484bd147d537218ad6433c1c33e5dfcf5f78e58 | Python | 15,138 | 440 | 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
import gc
gc.collect()
nameScript = "zou.py"
nameJson = "zou.json"
test_index = int(sys.argv[1])
print("=========================... |
a833998358447623c64c1bd2de24d3700b300e41f166d75b70382796ef760417 | Python | 15,138 | 413 | import click
from cloudfiles import CloudFiles
from cloudvolume import PrecomputedSkeleton, Skeleton
import numpy as np
import os
import pickle
import time
from corgie import scheduling, argparsers, stack
from corgie.log import logger as corgie_logger
from corgie.boundingcube import get_bcube_from_vertices
from corgie... |
1904f37ccfd613a3f5382a6f6276a71f430e953ae08319c9c1a44295c87c3f4b | Python | 15,145 | 436 | # pylint: disable=invalid-name, no-member, arguments-differ, missing-docstring, line-too-long
import sys
import os
import pickle
import time
import numpy as np
import torch
#sys.path.append("../")
# get the utils.py module in the path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from u... |
38213d967207aabfed86d7db6440eadc2d020231dd9c123ef6edbc58a8e5eb2f | Python | 15,150 | 345 | """
QIF mean-field parameter fitting with analytical gradient via sensitivity equations.
Demonstrates CircuitTemplate.get_jacobian_func() used to propagate parameter
gradients through an ODE trajectory with the forward sensitivity method.
Problem
-------
Recover the background excitability eta and the recurrent coupl... |
43e689d29e8bd7f5d2c90a9244f0740c039d017487db9127db471a7f7f6eca55 | Python | 15,155 | 378 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import torch
import torch.nn.functional
from e3nn.o3._linear import Linear
from nequip.data import AtomicDataDict
from nequip.data._key_registry import get_field_type
from ._graph_mixin import GraphMo... |
04d2d4085221855c1e8723d9f0a340f40d9bb528b5a79a8cef421e4cb94a9d8b | Python | 15,171 | 245 | from DeepPurpose import utils, dataset
from DeepPurpose import DTI as models
import warnings
import itertools
import numpy as np
import pandas as pd
import wandb
from tqdm import tqdm
import sys
warnings.filterwarnings("ignore")
import random
import argparse
def main(num_samples, val_setting, cuda_id, num_workers, da... |
c37f35c89d037a220b3b1acec490f77d273a40ee0a086b4515f1e70f2591e3b7 | Python | 15,172 | 390 | #!/usr/bin/env python3
#
# Sniffles2
# A fast structural variant caller for long-read sequencing data
#
# Created: 09.09.2021
# Author: Moritz Smolka
# Contact: moritz.g.smolka@gmail.com
#
from dataclasses import dataclass
import collections
from sniffles import util
@dataclass
class Group:
"""
A sequence t... |
da5b60c7b225bd397a8b676edb7c8c9747fe62f898f4989bf7177b473e27fbcd | Python | 15,173 | 410 | from abc import abstractmethod
import json
from overrides import override
from typing import (
Any,
ClassVar,
Dict,
List,
Optional,
Protocol,
Union,
TypeVar,
cast,
)
from typing_extensions import Self
from multiprocessing import cpu_count
from chromadb.serde import JSONSerializable
... |
98a064959e51af1ae8542f40620d5d1265674eb7c6c56aeef92af31abb7d877b | Python | 15,183 | 393 | from functools import partial
import torch
import torch.nn.functional as F
from torch.nn import Parameter
from torch.nn import Sequential, Linear, BatchNorm1d
from torch_scatter import scatter_add
from torch_geometric.nn import GINConv, GCNConv, global_add_pool, global_mean_pool
from torch_geometric.nn.conv import Mes... |
ee8dcc372be787f391fd4a69a55b5207bb93552dad47cb7185550c8740720fd1 | Python | 15,188 | 386 | # 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 types
import torch
def get_fused_adam_class():
"""
Look for the FusedAdam optimizer from apex. We first try to load the
... |
240b83004bdbc3f2553ffaa13ecf155f672b696e739a03f0103b05679b03dfb8 | Python | 15,206 | 359 | import numpy as np
# import keras.backend as K
from keras.models import Model
import keras.layers as KL
# from keras.layers import Layer
from keras.layers import Conv3D, Activation, Input, UpSampling3D, concatenate, AveragePooling2D
from keras.layers import LeakyReLU, Reshape, Lambda
from keras.initializers impo... |
22900ab30a9d1a54497dec390dc52a7bdd28d95e95b51446526af749338a4570 | Python | 15,208 | 399 | """Utilities for creating and manipulating brain masks."""
__all__ = [
"collapse_mask",
"create_sphere",
"expand_mask",
"roi_to_brain",
"roi_to_brain_from_atlas",
]
import os
import nibabel as nib
from nltools.templates import get_brainspace
import numpy as np
def create_sphere(coordinates, radi... |
84d882c456bfd748f7996f17b60d9171bb9487b3ecb9ea9849c4acc5cfc8f857 | Python | 15,210 | 358 | #!/usr/bin/env python3
#
# Sniffles2
# A fast structural variant caller for long-read sequencing data
#
# Created: 27.08.2021
# Author: Moritz Smolka
# Contact: moritz.g.smolka@gmail.com
#
from dataclasses import dataclass
import gc
import math
import pysam
from sniffles import leadprov
from sniffles import cluster... |
d2d7e3cf35a1139e8f27c5feb4dd8ac02c4af97c4794e7c1c566abbeea243275 | Python | 15,210 | 393 | import datetime
import logging
import os
import sys
import time
from typing import Optional, TextIO
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.distributed as dist
from torch.distributed.algorithms.join import Join, Joinable, JoinHook
from .utils import _calc_plot_dim, _get_distribute... |
39f51ea92ea2b7ea140dec974918c11042ccb28491e326e0d64daab8b831de65 | Python | 15,211 | 458 | import glob
import os
import pickle
from typing import List, Union
from copy import deepcopy
import numpy as np
import pandas as pd
from Bio.PDB.mmcifio import MMCIFIO
from Bio.PDB.StructureBuilder import StructureBuilder
from model_angelo.utils.misc_utils import assertion_check
from model_angelo.utils.protein import... |
77b33d0da1e9a03907d21591801931851154aeef442f76c3cf37b9798ffbf4d5 | Python | 15,211 | 462 | # in this script to fellow fairly closely Zou et al
# but the create a equivariant descriptor for each type
# of tree topology from the beggining
# We use a an embedding "across sequences" instead to
# within sequences.
import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as... |
8384d4a6d0a6903b63a4a9d97a631691edcf0837c49cdac92efb7fc59b668cef | Python | 15,244 | 404 | # 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 torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.models import (
... |
adb7cadb6468e3f8c32114f6154e48820be536bf998a1533c9736d568a49862e | Python | 15,280 | 302 | import os
import os.path as osp
import numpy as np
import torch
import networkx as nx
from networkx.algorithms import tree
from math import pi
from rdkit import Chem
from rdkit.Chem.rdchem import BondType
from torch_geometric.data import Data, InMemoryDataset, download_url, extract_tar
atomic_num_to_type={1:0, 6:1, ... |
8cfd21eeca71d1f518a611c45dfb5c2cadbbeba77dbfce1bfbf549c49bcda8a2 | Python | 15,287 | 339 | # based on https://github.com/lopeneljxi/keras-unet-collection
from __future__ import absolute_import
from .layer_utils import *
from .backbone_zoo import backbone_zoo, bach_norm_checker
from tensorflow.keras.layers import Input
from tensorflow.keras.models import Model
from tensorflow import pad
def UNE... |
3dcabbe634d58f41eb7f1079693effe7c6c415acfb3292d13717f8c21bec4db8 | Python | 15,290 | 378 | # Copyright 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import ast
import inspect
import re
import sys
from importlib import import_module
from pathlib import Path
from typing import Any, Dict, List, Optional
import nbformat
from nbdev.export import nb_export
class CodeAnalyzer:
"""Analyze... |
5ba76955c8d14479e05c37b09e8f92678741e26176388e3738665f6172f84987 | Python | 15,298 | 495 | """Tests for the MACE TorchSim model interface.
Uses factory functions (mirrored from the torch-sim test conftest) to build
model/calculator consistency tests and ``validate_model_outputs`` tests from
fixture names. Unlike the upstream factories we feed them sim_state *fixtures*
(built from ASE atoms) instead of the ... |
c161152198dafef87f870fabb040dd263c6cd2233f0540db97204966ed06b390 | Python | 15,325 | 362 | # import warnings
# warnings.filterwarnings('ignore')
import os
import sys
import time
sys.path.append(
os.path.abspath("/hwfssz5/ST_BIOINTEL/P20Z10200N0039/06.groups/01.Bio_info_algorithm/renyating/project/SGAE"))
import tqdm
import joblib
import numpy as np
import gc
import torch
import torch.nn a... |
4cba459aac9307bee72b3673e73689b7bf9d9e4f87c7f129cdbeb56e4eed1de8 | Python | 15,326 | 468 | # ==============================================================================
# Copyright 2025 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
from dataclasses... |
1ee838b2ddbbb70192512f46b9eea3534bef68ff6f87ffc15b157cde53fd8842 | Python | 15,327 | 464 | # in this script to fellow fairly closely Zou et al
# but the create a equivariant descriptor for each type
# of tree topology from the beggining
# We use a an embedding "across sequences" instead to
# within sequences.
import numpy as np
# import matplotlib.pyplot as plt
import torch
import h5py
import torch.nn as... |
12396c2c3361ec660a48c5fa913dd81e62b051505493e780fc39aa99f8b7ec32 | Python | 15,345 | 489 | """Tests for the standalone published-DANDI NWB collection."""
from datetime import datetime, timezone
from pathlib import Path
import numpy as np
import pytest
from pynwb import NWBHDF5IO, NWBFile
from pynwb.icephys import (
CurrentClampSeries,
CurrentClampStimulusSeries,
IntracellularElectrode,
Volt... |
dc3ca1bc17cbe7c9cc7120024c2e6a3805a3cd80d97811bb0f2beff1e79e8b69 | Python | 15,370 | 502 | import os
import numpy as np
import shutil
import torch
from time import time
import networkx as nx
from pdb2sql import interface
from .tools import BioWrappers, PSSM, BSA
from .Graph import Graph
class ResidueGraph(Graph):
def __init__(
self,
pdb=None,
pssm=None,
contact_distanc... |
671c71facb43a1d2c47e70ed3c7666637977c0fe6aae14b3214053ea5bf40d0d | Python | 15,371 | 363 | import numpy as np
# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import os
import sys
import time
import NALSM_CONSTRUCTOR_N_MNIST_NOISE as construct
import NALSM_PARALLEL_SAVE as parasaver
import NALSM_SIM_SUPPORT as runSupport
import NALSM_GEN_SUPPORT as sup
class... |
a426eb1971c75af081ff1767e38b3df8ccc7d201fea2b924fd91e987bcc6b6e8 | Python | 15,372 | 538 | import time
import h5py
import json
import sys
import os
import six
import copy
import argparse
import torch
import torchfields
import numpy as np
from tqdm import tqdm
from pathlib import Path
from cloudvolume import CloudVolume
from cloudvolume.lib import Vec, Bbox
def spec_to_bbox(spec):
return get_bbox(x_s... |
df0434eabf2b418db128a70c5f8479a59341602793d8df3c0b023a76b609f881 | Python | 15,378 | 412 | """Run the standalone DANDI NWB API through a thin NiceGUI interface."""
from __future__ import annotations
from nicegui import ui
from nicegui.events import GenericEventArguments, ValueChangeEventArguments
from dandi_dataset import DandiSweepPlotData, DandiTracePlotData
from gui.app_state import DandiAppState, Dand... |
dc6d4b4a948cfb8789d828daf26b92973475b0fd4062b288e2bcc68eb7aa2033 | Python | 15,398 | 370 | import os
import sys
import time
import numpy as np
from numpy import linalg as LA, argpartition
from scipy import sparse
from joblib import Parallel, delayed
from sklearn.base import BaseEstimator, TransformerMixin
class CoEmbedding(BaseEstimator, TransformerMixin):
def __init__(self, n_embeddin... |
8e1b8265d7d4c15123493dcf2ebe1113ea246e96e4c1994d2aeb99a086272e31 | Python | 15,405 | 388 | """Tests for Adjacency statistical methods: similarity, NaN handling,
threshold, Fisher transforms, ttest, label distance."""
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import pytest
from nltools.data import Adjacency
@pytest.fixture(autouse=True)
def _close_figs():... |
c5cb334d90a4d297f94278e5bcebb532fc590ece398d93ea4420e631f328e8e7 | Python | 15,411 | 465 | """metrics.py: Module for general evaluation metrics operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from sleeprnn.common import constants
from sleeprnn.data.utils import stamp2seq
def by_sample_confusion(events, detecti... |
fd3b4e4b6d69802311b61c48f30728cc260ed4bdbe52cfa7b412cff2f9d5846d | Python | 15,414 | 317 | # TODO: refactor to not duplicate as much between shared and independent optimization; potentially formulate independent optimization as shared with a single geometry?
import logging
from typing import Callable, Dict, Optional, Any, Tuple, List
from deeperwin.geometries import GeometryDataStore, distort_geometry
import... |
312676028c8fd28729c8cf8f6fecd65a3b4572a3e4baed863d60305fefad4fe9 | Python | 15,422 | 504 | import os
import numpy as np
import shutil
import torch
from time import time
import networkx as nx
from pdb2sql import interface
from .tools import BioWrappers, PSSM, BSA
from .Graph import Graph
class ResidueGraph(Graph):
def __init__(
self,
pdb=None,
pssm=None,
contact_distanc... |
fd40b84dec68714aee18fbb9f96419a34bf0aac20fc3946e288d5d4499edbcde | Python | 15,427 | 418 | import inspect
import warnings
import numpy as np
import pytest
from nltools.data.roc import Roc
def _make_roc_data(seed=0, n=40):
"""Two separable Gaussian classes for a deterministic, non-perfect ROC."""
rng = np.random.default_rng(seed)
pos = rng.normal(1.0, 1.0, n)
neg = rng.normal(-1.0, 1.0, n)... |
9026b54aed3586dce6c7f73f94600e608c10b45d862c27390a0f7901b1717652 | Python | 15,428 | 421 | # -*- 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 matplotlib as mpl
import pandas as pd
import seaborn as sns
import scipy.ndimage as ndi
fro... |
e8a3cf3de28ac117680f51172cfe80ea00ff2ab4abf164a733e667d6db255dcf | Python | 15,428 | 503 | """
Arena hardware controller
Author: Tal Eisenberg, 2021
This module provides convenience functions for communicating with the arena hardware
over MQTT. It allows sending commands, and also stores sensor readings in the global state.
"""
import shutil
import threading
import mqtt
import time
from subprocess import S... |
f0b99a1438d1cd7e3b7d841b332bcd763c8b8c21f2722ca24070119293795b6f | Python | 15,460 | 307 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from rdkit import Chem
from dig.ggraph.utils import check_valency, convert_radical_electrons_to_hydrogens
from .graphaf import MaskedGraphAF
class GraphFlowModel(nn.Module):
def __init__(self, model_conf_dict):
super(Gra... |
2ab8c732511f40d73113c5c676992d5e5e42afd924573fde3cbd61b6c5f791fd | Python | 15,465 | 467 | import argparse
import os
from pathlib import Path
import ase.io
import numpy as np
import pytest
import torch
from ase.atoms import Atoms
from e3nn import o3
from mace.calculators import MACECalculator
from mace.cli.eval_configs import run as mace_eval_configs_run
from mace.cli.run_train import run as mace_run
from ... |
8d54221598332d589ba6ce4302f994cf5730fe2684455c3f091d28ab62dee06a | Python | 15,467 | 307 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* ... |
399b96df3f736014b71b18250bbd8ece3825efddfce90bf7e9fb095ca9a14e7f | Python | 15,486 | 436 | # 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... |
a5bd96693b619d2e4487a6a606b23db25d30bc29a25d5cbb0f93f354cb73bb56 | Python | 15,486 | 477 | """Tests for the optional NWB current-clamp loader."""
import json
from datetime import datetime, timezone
from pathlib import Path
from typing import Optional
from unittest.mock import Mock
import numpy as np
import pytest
pytest.importorskip("pynwb")
from pynwb import NWBHDF5IO, NWBFile # noqa: E402
from pynwb.i... |
9f6090522275b547f7d1920e5a01adde72472833809a70c90514d4b403ae75f3 | Python | 15,489 | 390 | # Copyright 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import collections
import concurrent.futures
import logging
import os
from pathlib import Path
import tests.end_to_end.utils.data_helper as data_helper
import tests.end_to_end.utils.defaults as defaults
import tests.end_to_end.utils.excepti... |
8c6c863de1f6365d1bc169974f8ff1dde9f311eb05ddfd726061e37af3ebe8a9 | Python | 15,505 | 368 | """Outlier detection, robust statistics, and data normalization."""
import numpy as np
import polars as pl
import nibabel as nib
def zscore(data):
"""Z-score every column of a Polars or pandas DataFrame/Series.
Pandas inputs are converted to Polars; the result is always Polars (a
DataFrame for DataFrame... |
16ccb3ad515405b8857812aa880131ea8f9a778371fe86e487c9450313f8e965 | Python | 15,508 | 315 | """
Logic for Markov chain Monte Carlo (MCMC) steps.
"""
import copy
import functools
from typing import Dict, Tuple
import jax
import jax.numpy as jnp
import numpy as np
import chex
from deeperwin.configuration import MCMCConfig, MCMCLangevinProposalConfig, PhysicalConfig, LocalStepsizeProposalConfig
from deeperwin.... |
068faf257995abde351b0374a74d04c16a76002f98635375c15dbf8a5b9a1c2d | Python | 15,511 | 560 | #!/usr/bin/env python
# encoding: utf8
"""
Collaborative Brain Wave Analysis Pipeline (Cobrawap)
"""
import argparse
import inspect
import logging
import os
import re
import shutil
import subprocess
import sys
from pathlib import Path
from pprint import pformat
sys.path.append(str(Path(inspect.getfile(lambda: None)).... |
2df5f39850e8160e88998107cc0ba14e246c0c55e47beb1f3dfd07fb4144da22 | Python | 15,511 | 560 | #!/usr/bin/env python
# encoding: utf8
"""
Collaborative Brain Wave Analysis Pipeline (Cobrawap)
"""
import argparse
import inspect
import logging
import os
import re
import shutil
import subprocess
import sys
from pathlib import Path
from pprint import pformat
sys.path.append(str(Path(inspect.getfile(lambda: None)).... |
ac399fe0aaa6075de22aa18110a94985bef491c22c1b36a2399f4d57d138fdf7 | Python | 15,512 | 332 | import pandas as pd
import numpy as np
import scipy.io as sio
import os
import multiprocessing
import time
import random
from tqdm import tqdm
from scipy import stats
from sklearn.linear_model import Ridge
from sklearn.svm import SVC
from sklearn.metrics import make_scorer
from sklearn.model_selection import GridSearch... |
1ba3f0141cad94567f676595d53f585a6fbfe2914108a1313d9330476e0453bd | Python | 15,514 | 408 |
import os
import pickle
import random
import time
from functools import partial
from pathlib import Path
import numpy as np
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
import webdataset as wds
import yaml
from torch import nn, optim
from torch.distributed.algorithms.join import Jo... |
4d3b31063f0346a76cd3b26d891549ec589c4b0651904fce336e2c7131960cb9 | Python | 15,522 | 278 | # 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 ... |
1038c1f09c6b5ae5412f62295f4ae9aba723c4c3e6f4dedb1759d9d581761bb3 | Python | 15,535 | 307 | """
--------------------------------------------------------------------------------
Date: 29/09/2021
@author: Nikolaos Vardalakis
--------------------------------------------------------------------------------
Implementation Notes
--------------------------------------------------------------------------------
... |
1c3e3eedafa89b319d60f3ba70924c690a7bdb8e3bb581f37109e62527d2b3c0 | Python | 15,535 | 390 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from typing import Union, Optional, List
import torch
from e3nn.o3._irreps import Irreps
from e3nn.util.jit import compile_mode
from nequip.data import AtomicDataDict
from nequip.data.misc import che... |
1b7b51277627e745d39ab79c6c1e732269ed4fe927e172b0fd2ad7c94b09de24 | Python | 15,541 | 508 | import math
import time
from abc import ABC, abstractmethod
import pylsl
import numpy as np
from ._buffer import Buffer
from .. import logger
from ..utils.timer import Timer
from ..utils.preprocess.events import find_event_channel
from ..utils.lsl import lsl_channel_list
_MAX_PYLSL_STREAM_BUFSIZE = 10 # max 10 sec ... |
a45800653f113bbbfa6b88ba08c24791ae7612a1e2c71fc605b17ce57332e053 | Python | 15,546 | 262 | # %%
import sys
import os
import random
import time
import glob
import numpy as np
import h5py
from scipy.io import savemat, loadmat
import multiprocessing as mp
import tensorflow as tf
os.environ['KERAS_BACKEND'] = 'tensorflow'
# os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set which GPU to use. '-1' uses only CPU.
fr... |
192afebbfaeb8db0cbeb9cf6299fea3e999f880410f3fdab459dc163e1fb1057 | Python | 15,564 | 397 | #!/usr/bin/env python
# encoding: utf8
'''
Collaborative Brain Wave Analysis Pipeline (Cobrawap)
'''
import os
import sys
import logging
import argparse
import subprocess
import shutil
import re
from pprint import pformat
from pathlib import Path
import inspect
sys.path.append(str(Path(inspect.getfile(lambda: None)).p... |
23a8d7fc3141e7160471578ba448472e711b3f53d334c4d6c5eee2f64826584b | Python | 15,566 | 279 | """Instantiate experiment object for tabular data.
This file runs the experiment with code designed specifically for tabular data;
i.e., the number of features is relatively small.
"""
import enum
from typing import Any, Callable, Optional
import numpy as np
import pandas as pd
from sklearn.model_selection import tr... |
786787ec8fb860a510020fb06eb1027665df4e19c1a8299c1c61d30546ad686a | Python | 15,570 | 376 | from collections.abc import Sequence
from typing import Literal
import numpy as np
from idtrackerai import Fragment, ListOfFragments, Session
from idtrackerai.utils import track
def none_max(*args):
"""Maximum of the arguments that are not None."""
return max(filter(lambda item: item is not None, args))
d... |
be7e1abd39448baa5ade7006bbe5d128ee1c304042a0a707b3c284e49333687c | Python | 15,573 | 450 | import os
import pickle
import sys
import time
from itertools import product
from random import shuffle
import warnings
import numpy as np
import torch
import tqdm
from loguru import logger
from scipy.spatial import cKDTree
from model_angelo.data.dataset_preprocess import decompress_data
from model_angelo.utils.grid ... |
f8e487d3766b22daaa354708e12d176663d48dd51e3114440445bd255a38b584 | Python | 15,574 | 468 | """Manage SanPy spike-detection parameters and presets."""
from __future__ import annotations
import glob
import json
import os
import pathlib
from enum import Enum
from typing import Any, Mapping, Self
import pandas as pd
from pydantic import BaseModel, ConfigDict, Field, ValidationError
from sanpy.sanpyLogger imp... |
6bfd9ec815fa8f3417378ba330a82332d41380be94bdb4d2074e9905c00b06d8 | Python | 15,582 | 378 | import torch.optim as optim
import torch
import torch.nn as nn
import torch.nn.functional as f
import torchvision.transforms as transforms
import torchvision as tv
import torch.utils.data as data
import os
import matplotlib.pyplot as plt
import random
from torch.utils.data import Dataset, DataLoader
import time
import ... |
a8654e55a4d91eaf1eecaa99d95494dd134c18c37acd16b1e853a5dd18eaac26 | Python | 15,587 | 415 | """The two calculator surfaces that scale or select, neither of them asserted.
`energy_units_to_eV` and `length_units_to_A` multiply every energy, force and
stress the calculator returns. Nothing exercised them, and a wrong factor is the
quietest kind of wrong: the numbers stay plausible and a user comparing against
a... |
a3d2b5fd1fded081231ae9882294c074059586c9edd01e231e267d25ff0f82ad | Python | 15,611 | 379 | # 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... |
b4f4f8f904c98b3c628ae26f251b209bd51f08f69a8873dc09d617b8f5ad5f66 | Python | 15,620 | 362 | # Copyright © 2023 German Cancer Research Center (DKFZ), Division of Medical Image Computing
#
# SPDX-License-Identifier: Apache-2.0
from radiomics import featureextractor
import pandas as pd
import os
import nibabel as nib
import numpy as np
import argparse
import joblib
from scipy.ndimage import map_coordinates
from... |
1e3443715d95b58312414f0a3b56ab8653ed1bb9a35e51d9e79aba6aeb639246 | Python | 15,627 | 436 | # 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 numpy as np
import torch
from . import FairseqDataset, data_utils
def collate(
samples,
pad_idx,
eos_idx,
... |
52ddd5f893e469b58a43d128989823cc8c5c89488e32a38c9176afe17f2fb083 | Python | 15,630 | 509 | import os
import torch
import argparse
import numpy as np
import matplotlib.pyplot as plt
from torchvision import transforms
from tqdm import tqdm
from time import time as t
import sys, os
sys.path.insert(0, os.getcwd() + "/bindsnet/")
from bindsnet import ROOT_DIR
from bindsnet.datasets import MNIST, CIFAR10, Data... |
415438b9b49fb1d86d2b040253ad5d70bfb66e4fc9fcee458faf2bd8a455a232 | Python | 15,637 | 496 | #!/usr/bin/env python3
__description__ = \
"""
Run full test suite on PyCmdMessenger/arduino interface.
"""
__description__ = "Michael J. Harms"
__date__ = "2016-05-30"
__usage__ = "run_test.py serial_device [s] (optional s will test string interface)"
import PyCmdMessenger
import time, string, sys, struct, random
BA... |
bbc6978ed4e5116fc97eadd4b2e9da66138f469121bbb5a39c5b309fd96b9c7d | Python | 15,639 | 423 | from __future__ import absolute_import
import torch
import numpy as np
import pandas as pd
import scipy
import os
import copy
from pysurvival import utils
from pysurvival.utils import optimization as opt
from pysurvival.models import BaseModel
from pysurvival.models._svm import _SVMModel
# Available Kernel functions
K... |
ebae8f44d0a542a01a60fdeb2ab6718b3be5c2f344cc02b781f0e301f5d08ab4 | Python | 15,664 | 425 | #!/usr/bin/env python3
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import method.io as io
import method.nn as nn
import numpy as np
import argparse
import matplotlib.pyplot as plt
from sklearn.metrics import auc, RocCurveDisplay
from sklearn.model_selection import RepeatedKFold, RepeatedStratifiedKFold
from skle... |
cc70fef2ddb991def04cbc4ab4706da851e38cc88d629a44c0a820957032716c | Python | 15,680 | 424 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""XGBoostTaskRunner module."""
import json
import logging
import os
import numpy as np
import xgboost as xgb
from sklearn.metrics import accuracy_score
from openfl.federated.task.runner import TaskRunner
from openfl.utilities import Met... |
8cab87f9d582fd8eed4b47b07ab70599d6fcc5ad2e1124e2e33cffcbba50c399 | Python | 15,685 | 418 | import torch
from torch.autograd import Variable
import torch.nn.functional as F
from torch.utils import data
from torch.utils.data import SequentialSampler
from torch import nn
from tqdm import tqdm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from time import time
from sklearn.metrics impo... |
907999bc7cc9ea3fd45127fc0161daa0f57664bb51306339f9c7e401f7bbc361 | Python | 15,693 | 363 | import numpy as np
# import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import os
import sys
import time
import NALSM_CONSTRUCTOR_MNIST_NOISE as construct
import NALSM_PARALLEL_SAVE as parasaver
import NALSM_SIM_SUPPORT as runSupport
import NALSM_GEN_SUPPORT as sup
class... |
bf1660c488157a7326ba7f72b70e1e566c310290b1f9902e614bcded6860189b | Python | 15,694 | 508 | """
Manage the image processing system.
Author: Tal Eisenberg, 2021
Start and stop the video system.
Create ImageSource and ImageObserver objects based on video configurations.
Manage video recording and image capture.
"""
from threading import Timer
from pathlib import Path
import json
from configure import get_con... |
cabd77f28ae2b503e603f59847c70cfaa01caeb3367bc8eee1ec1403bf957fed | Python | 15,698 | 508 | """
Manage the image processing system.
Author: Tal Eisenberg, 2021
Start and stop the video system.
Create ImageSource and ImageObserver objects based on video configurations.
Manage video recording and image capture.
"""
from threading import Timer
from pathlib import Path
import json
from configure import get_con... |
8a508562d9136258dd95fb180ca6d95711821a44cc9ecbf9658ef41cb059c3be | Python | 15,720 | 350 |
import numpy as np
import matplotlib.pyplot as plt
import pandas
import pickle
from matplotlib.colors import LogNorm
from copy import deepcopy
#
# from allensdk.api.queries.ontologies_api import OntologiesApi
# from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache
# from mcmodels.core import Voxel... |
419ba905b519a094abbfd59a68feb2edc4fb4549339e56f088b7149e5cc87aba | Python | 15,732 | 365 | """
Gradient-based parameter fitting via symbolic ODE Jacobians
============================================================
In this tutorial, you will learn how to use PyRates' symbolic Jacobian function generator,
:code:`CircuitTemplate.get_jacobian_func`, to fit model parameters with a gradient-based optimizer.
The... |
ac3efda777fe53da63dc5aaaf46e75a6df7565fc563115f71f7b5a3480f9d747 | Python | 15,743 | 381 | from DeepPurpose import DTI as models
from DeepPurpose.utils import *
from DeepPurpose.dataset import *
from prettytable import PrettyTable
import wget
from zipfile import ZipFile
def repurpose(target, target_name = None,
X_repurpose = None,
drug_names = None,
train_drug = None,
train_target = ... |
d9ba85e5b55c0741226d2457c544e4dbbe87fe360d728910d11c8b666060a418 | Python | 15,746 | 394 | #!/usr/bin/env python3
#
# Sniffles2
# A fast structural variant caller for long-read sequencing data
#
# Created: 09.09.2021
# Author: Moritz Smolka
# Maintainer: Hermann Romanek
# Contact: sniffles@romanek.at
#
from dataclasses import dataclass
import collections
from sniffles import util
@dataclass... |
820fc2c305986a7b28de723a8770ba08cf873041c368e58e013eed4a14460df3 | Python | 15,762 | 311 | """
--------------------------------------------------------------------------------
Date: 29/09/2021
@author: Nikolaos Vardalakis
--------------------------------------------------------------------------------
Implementation Notes
--------------------------------------------------------------------------------
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.