sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b620c4e0a84753edda2d66cef4eaf6be9b4223fe8626b96bad02a7489c9a6389 | Python | 11,651 | 278 | """Test suite for accurate behavior of models provided under pyrates.model_templates"""
# external _imports
from typing import Union
import numpy as np
import pytest
# pyrates internal _imports
from pyrates import integrate
# meta infos
__author__ = "Richard Gast"
__status__ = "Development"
###########
# Utility #... |
9742c4110ca557ea5d83bb6664230dd889a2663304fb566653eb3db109db2e6d | Python | 11,652 | 334 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torch import nn, Tensor
from typing import Optional, Dict, Tuple, Union
import argparse
from utils import logger
from ... import parameter_list
from ...layers import norm_layers_tuple, LinearLayer
from ...mis... |
4557b17c5fd297ca451c8690a923a0e6ba3948aff3a93d6b8b3678b37f2fe407 | Python | 11,657 | 310 | # 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 torch
from fairseq import metrics, utils
from fairseq.criterions import register_criterion
from fairseq.criterions.ctc imp... |
bfb51d2a1f1dbe9766ec63ce98ece3e39444507cccb92085e61fea992d906a16 | Python | 11,661 | 356 | from __future__ import absolute_import
import numpy as np
import pandas as pd
import scipy
from sklearn.metrics import mean_absolute_error, mean_squared_error
from sklearn.metrics import median_absolute_error
from pysurvival.models.non_parametric import KaplanMeierModel
from pysurvival.utils._metrics import _concordanc... |
cff9224787c1156fe9c389960140fb5e21d13170faedaa620b05612049d9d3fa | Python | 11,669 | 265 | #based on https://github.com/oyxhust/HAM
#please download the code in the link above, and place it in a folder called HAM, for this code to work
import torch
import torch.nn.functional as F
import torch.nn as nn
import pytorch_lightning as pl
from HAM.models import AttentionNet
from HAM.utils.tools import load_checkpo... |
91076914b951a4298b8b77028c12ea1357e9209b2b44f18614496a5da50b8591 | Python | 11,671 | 353 | # Method signatures differ between Qt bindings, so overrides can't match them all
# pyright: reportIncompatibleMethodOverride=false
import logging
from pathlib import Path
from typing import Literal
import numpy as np
from qtpy.QtCore import Signal # type: ignore[reportPrivateImportUsage]
from qtpy.QtCore import QEve... |
96a8ec03fb8697c9f314a0276aaaa4ebdffb31ecb0aa177f36ac2b84ab71ea59 | Python | 11,672 | 292 | """
Calculate the optical flow (vector field) signal
using the Horn Schunck algorithm.
"""
import argparse
from pathlib import Path
from scipy.ndimage import gaussian_filter
from scipy.signal import hilbert
import neo
import numpy as np
from copy import copy
import matplotlib.pyplot as plt
from utils.io_utils import l... |
2d4551822dbe77460b9d113514303fa0500b89b1f0bde9d405b2e558e95f6fa3 | Python | 11,674 | 363 | """Statistical Manifold of Binomial distributions with the Fisher metric.
Lead authors: Jules Deschamps, Tra My Nguyen.
"""
from scipy.special import factorial
from scipy.stats import binom
import geomstats.backend as gs
from geomstats.geometry.base import VectorSpaceOpenSet
from geomstats.geometry.euclidean import ... |
717601baaaff3dc0ed11b7f5c58681d3f5ff804ffad7792c45054ce38b9b6db5 | Python | 11,676 | 292 | """
Calculate the optical flow (vector field) signal
using the Horn Schunck algorithm.
"""
import argparse
from pathlib import Path
from scipy.ndimage import gaussian_filter
from scipy.signal import hilbert
import neo
import numpy as np
from copy import copy
import matplotlib.pyplot as plt
from utils.io_utils import ... |
99041abfd920a373944beb6fbec05b9907face86194a1970823555a10218b312 | Python | 11,680 | 295 | """
This module is copypasted from current scikit-image master after Vilim's upgrade
for 3D registration support. Can be removed once the new scikit-image version including
this feature is released.
Port of Manuel Guizar's code from:
http://www.mathworks.com/matlabcentral/fileexchange/18401-efficient-subpixel-image-reg... |
e850cdef96539d0ff68dbea8ea44718399d18be03109ecb96c99622c0de25d86 | Python | 11,682 | 299 | # Copyright 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
This file contains callback that help setup for secure aggregation for the
collaborator.
"""
import json
import logging
import struct
import numpy as np
from openfl.callbacks.callback import Callback
from openfl.protocols import utils
... |
fada619f9a7795207b695b517735cf7e3f7fabc8a6700fbba6ccd29c14132aff | Python | 11,682 | 291 | """
Calculate the optical flow (vector field) signal
using the Horn Schunck algorithm.
"""
import argparse
from scipy.ndimage import gaussian_filter
from scipy.signal import hilbert
import neo
import numpy as np
from copy import copy
import matplotlib.pyplot as plt
from distutils.util import strtobool
from utils.io_u... |
d18799a92a2709ada75dd09e15fbbe21006484f67c9ef47339cd52c3e376284a | Python | 11,688 | 317 | # Copyright (c) 2023 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 ap... |
6bbf53f4e1beb1345ac1c800f4974af467ecd3fdde59ad5ccf9c49e4e2469ebc | Python | 11,697 | 433 | """
Author: RObert H Cudmore
Date: 20210811
Purpose:
Provide functions to generate stimulation patterns and save them as Axon-Text-Files (atf).
Usage:
coming soon.
Notes:
Opening atf files in pClamp is slow, you want to open abf files instead.
To acheive this, open the generated atf in Clampfit and save it as ab... |
40e0eee4c1bae6818b3025599daa7d106bb4d433e7cb5419c7d93bf3a476fa76 | Python | 11,701 | 343 | """
This module includes functions and classes to handle structured NeuronGroups.
"""
import torch
from pymonntorch.NetworkCore.Behavior import Behavior
def vec_to_mat(vec, repeat_count):
"""
Stack `repeat_count` numbers of the input vector on first dimension.
Args:
vec (torch.tensor): The vector... |
84356874cac5db7cd59486c51665fad21834957e6ab6710289d08fbdb0a6ad03 | Python | 11,709 | 289 | # 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... |
d949d355a6b470b93f6e43b63690da861f5ec9912ab01b1c6d1a3a767a314018 | Python | 11,722 | 350 | # Command line interface for predicting fnat
import logging
import multiprocessing as mp
import os
import shutil
import re
import tempfile
import warnings
from io import TextIOWrapper
from pathlib import Path
import argparse
import torch
from Bio.PDB import PDBParser, PDBIO, Structure, Model, Chain
from Bio.PDB.Polypep... |
48a82374ba89219af96ec46f82031d49994b8121e8e67caf70be7a462a9009a0 | Python | 11,727 | 196 | """Drive the chunk checks and report.
Two tiers, in order of cost:
1. :mod:`vdjdb.qc.lint` -- text-level, never parses the body. Catches the class of problem that
otherwise appears as a confusing parser error three stages later.
2. :mod:`vdjdb.qc.rules` -- row-level, vectorised over all 230 chunks in one pass.
Li... |
32b0681b444f32a8182b8046b3ade67de071e8add0708531dde15375432a748f | Python | 11,733 | 332 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Experimental Experiment module."""
import asyncio
import logging
from contextlib import asynccontextmanager
from enum import Enum, auto
from pathlib import Path
from typing import Any, Iterable, List, Optional, Tuple, Union
from openfl... |
60cbdab8dc1885b031831d17000d75dd010ab1df5038c416fa6aaa4dc1df56c6 | Python | 11,733 | 293 | import math
import sys
from optparse import OptionParser
import numpy as np
import rdkit
from rdkit import RDLogger, Chem
from rdkit.Chem import Descriptors
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
from dig.ggraph.method impor... |
07c33113d0c299d6e824ffb5990cac697b3cc5302b9f9d02ea1a46b172938f47 | Python | 11,734 | 267 | import cv2
import pytest
import torch
import numpy as np
import pandas as pd
from dynaphos.simulator import GaussianSimulator
from dynaphos.cortex_models import (
get_visual_field_coordinates_from_cortex, remove_out_of_view,
get_visual_field_coordinates_grid, get_mapping_from_cortex_to_visual_field,
get_co... |
1c1524efbb7297292110fc2bde57cb835f5be7c7978a42f0490ff52de5d3ee30 | Python | 11,752 | 347 | from __future__ import annotations
import argparse
import importlib.metadata as impm
import logging
import sys
from pathlib import Path
from typing import Any, Callable, Sequence, TypeVar
import attrs
import more_itertools as itx
from typing_extensions import overload, override
from snakebids import bidsapp
from sna... |
de0e5f733685d94423ccc097b67d9eb0d176cce217614a256cf68fcc2a820e47 | Python | 11,752 | 378 | """
Plot Metrics
Author: Mathijs de Boer
This script is used to create plots and run statistical tests of the collected metrics.
To use this script, run collect_metrics.py on your segmentations first.
Note that this script is not quite universal, and is written with our dataset in mind.
That is, we manually check for ... |
6e7ccc8c8982ea08812028ce67a6df1ad64dd36dc36564656f3be7882d85ef2a | Python | 11,778 | 371 | import click
import torch
import procspec
from corgie import scheduling, helpers, stack
from corgie.log import logger as corgie_logger
from corgie.boundingcube import get_bcube_from_coords
from corgie.argparsers import (
LAYER_HELP_STR,
corgie_optgroup,
corgie_option,
create_stack_from_spec,
)
from ... |
029014a1ee4fb04e2d6a71a14ab8f28409d45f9d18f291e97cd71275fda2f2dd | Python | 11,780 | 289 | '''
Description:
Author: voicebeer
Date: 2020-09-14 01:01:51
LastEditTime: 2021-12-29 05:31:44
'''
# standard
import argparse
import torch
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import copy
import random
import time
import math
from torch.utils.tensorboard import SummaryWriter
#
impo... |
1a48bd0b05aec45cbbe158b349f18979d552dc5591bb8f01dba14105a3937372 | Python | 11,785 | 289 | """Test suite for basic parser module functionality.
"""
# external _imports
import numpy as np
from copy import deepcopy
import pytest
# pyrates internal _imports
from pyrates.backend.parser import parse_equations
from pyrates.backend.parser import ExpressionParser
from pyrates.backend.computegraph import ComputeGra... |
1357045abadb4e8fc951c97da72438202863ca9ece767d89bda053891ff2ed17 | Python | 11,786 | 316 | import yaml
import argparse
import torch
import collections
import glob
import pickle
import numpy as np
import pandas as pd
def save_to_output(data_list, output_file, file_name, first_output):
if data_list == []: return
cassette_detected_list = []
indeces_list = []
name_list = []
... |
8a01f02d1836210d30f54d23d4c4ba648cd28a0eab394786672cf61daf10eca9 | Python | 11,786 | 270 | import torch
from torch_geometric.utils import to_dense_adj, dense_to_sparse, dropout_adj, degree, add_remaining_self_loops
from sklearn.preprocessing import MinMaxScaler
from torch_geometric.data import Batch, Data
from dig.sslgraph.utils.adaptive import degree_drop_weights, pr_drop_weights, evc_drop_weights, drop_edg... |
88b4f66c4eec4f98912f5f5d01541d9800c420328349ba705aa09958fac9739d | Python | 11,788 | 416 | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
# tdot function courtesy of Ian Murray:
# Iain Murray, April 2013. iain contactable via iainmurray.net
# http://homepages.inf.ed.ac.uk/imurray2/code/tdot/tdot.py
import numpy as np
from scipy import linalg... |
e063f51e2831fc869008fd7211330029ff95dec2c5568fa7866935c468ede10e | Python | 11,790 | 330 | 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... |
5877b0014907d882d42840c179374ebb3a18720379dad398307f849b2b9aa8e5 | Python | 11,795 | 331 | 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... |
e761e092904a3e7287a4a7c24d3498da4947fc6f287331044d678b0548e740cb | Python | 11,796 | 401 | import pandas as pd
import os
import matplotlib.pyplot as plt
import sys
import numpy as np
import random
import ipywidgets as widgets
from ipywidgets import Box, IntSlider
from sklearn.preprocessing import LabelEncoder
import xgboost
from sklearn.svm import LinearSVC
from sklearn.discriminant_analysis import LinearDi... |
132fc6635bc9529506f508045bb383efa82abd80d24a987fa13faad706e42a63 | Python | 11,802 | 310 | # 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 torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.incremental_decoding_utils import wi... |
e00eea711dededde11481d2891e62594b7c85565f2c2bd9f23608489aac9ca72 | Python | 11,802 | 301 | import os
from typing import Optional
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm, gridspec
from ..utils import _calc_plot_dim, elements
from . import MoleculeGraph
CLASS_COLORS = "rkbgcmy"
def plot_graphs(
pred: Optional[list[MoleculeGraph]] = None,
ref: Optional[list[Mole... |
0fee6d22be13fe497d798b4edfbe8ab99d51231d7ad15dbe468282d1de3475df | Python | 11,810 | 283 | """Test suite for accurate behavior of models provided under pyrates.model_templates"""
# external _imports
from typing import Union
import numpy as np
import pytest
# pyrates internal _imports
from pyrates import integrate
# meta infos
__author__ = "Richard Gast"
__status__ = "Development"
###########
# Utility #... |
62ec7333496050d2d9e3004943016c7454bc5c2f3d6bfbf1302c3086fb4bf19f | Python | 11,810 | 331 | """Coordinate asynchronous DANDI backend work for the NiceGUI demo."""
from __future__ import annotations
import asyncio
from dataclasses import replace
from nicegui import run
from dandi_dataset import DandiDataset, DandiSweepPlotData
from dandi_transport import LindiNwbTransport
from gui.app_state import DandiApp... |
823c3996d31bb87c36d44f3f8eed2afa5c443b658ffc246ee1d6f62b334590b9 | Python | 11,818 | 339 | import json
import logging
from abc import ABC
from collections.abc import Callable, Sequence
from pathlib import Path
from typing import Literal
import numpy as np
import torch
from torch import Tensor, nn
from torchvision.models.resnet import BasicBlock, ResNet
class ResNet18(ResNet):
__call__: Callable[[Tens... |
5151fbb62b34bcf4195ddadd15bbce39330373a01d4d6fb77f24aaddaadd6a2e | Python | 11,821 | 221 | """Per-cluster position weight matrices, and the background they are read against.
Stage three. A cluster is a set of CDR3s; its logo is one column per position, and each column is
read against what the background repertoire puts there, so that a residue the germline supplies
anyway does not look informative.
The shi... |
3f0ce23757f751788060e6de0ab8abe2fc6cf8d0d892b48c29b2046e84e1cc1f | Python | 11,824 | 346 | from argparse import Namespace
import numpy as np
class Optimizer:
def __init__(self, name=None, displayname=None, dtype=None):
self.name = name
self.displayname = displayname if displayname is not None else name
self.dtype = dtype
self.pinfo = None
self.evals = 0
def... |
98570558681bbcf1f4801b080fbb7b21bf786c089fbb4e37a27ebc367d8f98a4 | Python | 11,828 | 288 | '''
Description:
Author: voicebeer
Date: 2020-09-14 01:01:51
LastEditTime: 2021-12-28 02:01:18
'''
# standard
import argparse
import torch
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import copy
import random
import time
import math
from torch.utils.tensorboard import SummaryWriter
#
impo... |
2047b804450340913a94949eda34b2ff415e307d86d1ba1d69b3960cc4548b5d | Python | 11,831 | 289 | '''
Description:
Author: voicebeer
Date: 2020-09-14 01:01:51
LastEditTime: 2021-12-28 01:55:41
'''
# standard
import argparse
import torch
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import copy
import random
import time
import math
from torch.utils.tensorboard import SummaryWriter
#
impo... |
cbfd359c56b3e523c1ea1fce32a5d235b26ce3bec7e1f4832af5dd9b86e127bc | Python | 11,833 | 387 | from rdkit import Chem
from rdkit.Chem import Descriptors, AllChem
from rdkit.ML.Descriptors import MoleculeDescriptors
import pandas as pd
import numpy as np
import argparse
import os
import torch
from joblib import dump
from pathlib import Path
from sklearn import preprocessing
from sklearn.model_selection import P... |
e734644b9d5f0040218f6f1818842cc7b344c0619be3cc09d992a92b9f537aa5 | Python | 11,835 | 289 | """Test suite for basic parser module functionality.
"""
# external _imports
import numpy as np
from copy import deepcopy
import pytest
# pyrates internal _imports
from pyrates.backend.parser import parse_equations
from pyrates.backend.parser import ExpressionParser
from pyrates.backend.computegraph import ComputeGra... |
4223ef04fff57f3e84aa544b456a817b0ffe10e8226d2e078b1e7e4265edc4f6 | Python | 11,838 | 353 | # ==============================================================================
# Copyright 2025 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
"""Unit tests fo... |
a49b09423614d7e9b95487458f607a33fd1eed3405911930bbeca5be0d2a7ef4 | Python | 11,838 | 365 | import glob
import os
import re
from typing import Optional, Tuple
import numpy as np
import torch
import torch.distributed as dist
elements = [
"H",
"He",
"Li",
"Be",
"B",
"C",
"N",
"O",
"F",
"Ne",
"Na",
"Mg",
"Al",
"Si",
"P",
"S",
"Cl",
"Ar",
... |
0095e1ca640c8ae04ff4fd7cdf42247f9b1b5660004d84cae76afb4631b9c907 | Python | 11,840 | 271 | import torch.nn as nn
from fairseq import utils
from fairseq.models import FairseqEncoder
import torch
from fairseq.models import FairseqDecoder
from fairseq.models import FairseqEncoderDecoderModel, register_model
from fairseq.models import register_model_architecture
class SimpleLSTMEncoder(FairseqEncoder):
de... |
9e1e2e179c35e7427007cadf092df4b6da2b06c11cf383dc98464fe0bfeb53e0 | Python | 11,840 | 440 | """Radial kernel functions.
Lead author: Yann Cabanes.
References
----------
.. [1] https://en.wikipedia.org/wiki/Kernel_(statistics)
.. [2] https://en.wikipedia.org/wiki/Radial_basis_function
Notes
-----
We chose not to apply the normalization coefficients used in some references
in order that the kernel functions ... |
5e0b35bec911cd56476442aeba4be94349eb8f2ec6ef41f276847dc3d65d2edd | Python | 11,856 | 358 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Proto utils."""
import logging
from openfl.protocols import base_pb2
from openfl.utilities import TensorKey
logger = logging.getLogger(__name__)
def model_proto_to_bytes_and_metadata(model_proto):
"""Convert the model protobuf to... |
b14b2d5119b9e1cd82b0a56550a8d2cbd7a8fbe5c1055a3955a547ed5c5f3510 | Python | 11,871 | 351 | # -*- coding: utf-8 -*-
# OS stuff
import os
import sys
import warnings
from pathlib import Path
import json
# Computational stuff
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec
from matplotlib import ticker
# Other scripts and my stuff
script_di... |
8a6636c1977b8389a1718672cd53b05869f2126e13021a7f390606de030d0e7b | Python | 11,888 | 314 | import numpy as np
import os
from os import path
from glob import glob
import sys
import h5py
from tensorflow.python.ops.gen_batch_ops import batch
sys.path.append('../')
from utils import *
from processing import *
from signal_model import *
import subspaceMSI as subspace
from tensorflow import keras
... |
e878f27341da0df07fd28b40f5edc481045449c4202b3acbfb075d65b2cadef2 | Python | 11,899 | 324 | "Functions to manage logging and exception handling"
import logging
import logging.handlers
import multiprocessing
import os
import threading
from collections.abc import Callable
from contextlib import suppress
from datetime import datetime
from functools import wraps
from importlib import metadata
from pathlib import... |
4f89bd495fee40600dc8fc230d22ec9229a48486b5d11937c2e7aec7f30bba0f | Python | 11,902 | 293 | import torch
from torch import nn
from torch.nn import Linear, Embedding
from torch_geometric.nn.inits import glorot_orthogonal
from torch_geometric.nn import radius_graph
from torch_scatter import scatter
from math import sqrt
from ...utils import xyz_to_dat
from .features import dist_emb, angle_emb
try:
import... |
378bf6e20b1de67e3ab1462f943172802af35871791f6f2c53415806227ed6c8 | Python | 11,904 | 357 | # 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... |
59260fe5afa6d8e07217b1552e68882c8bfa46417cae48907a4f656fa659dafb | Python | 11,904 | 229 | """Read ``chunks/`` into one polars frame.
``chunks/`` is the data: one file per publication, 230 files, ~203k rows. Everything else in the
repository is machinery for validating, assembling and publishing it.
Three properties this reader guarantees that the pandas one did not:
* **Determinism.** ``runBuidDatabase.p... |
f1d5774561c612d47ca6d46dda615dc88f277fcd36bf070b93498e92da9ba4dc | Python | 11,910 | 370 | # %% [markdown]
# ## Assessing dFC using individual methodologies
#
# In this demo we will illustrate how to use each of the dFC assessment methods
# implemented in pydfc toolbox.
#
# We use sample data from an openneuro dataset by: Lukas Snoek and Maite van der
# Miesen and Andries van der Leij and Tinka Beemsterboer ... |
bded10a9caa988ef507f617e35ce69ccfeeba1c3bfa60d7e6ee3ec060c0b7791 | Python | 11,913 | 289 | import numpy as np
from numpy.random import randint
from scipy.special import softmax
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.model_selection import StratifiedKFold, KFold
import os
def get_intersection(A, B):
"""
Computes intersection between two binary-valued sequence... |
12435a4b7d14d8adeb472b6af5d0f29cb0c8c29f069f0cad9cc7b8ad8a7354e4 | Python | 11,914 | 362 | import click
import procspec
from corgie import scheduling, argparsers, helpers, exceptions
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_HE... |
440522a32f62f1ace22451c86a96c69c5be0fc24d7b8eb66c0543f7681e66e63 | Python | 11,931 | 302 | import numpy as np
import argparse
from sklearn.metrics import f1_score
import nrrd
import os, sys
import json
from scipy.spatial.distance import directed_hausdorff, euclidean
import torch
from torcheval.metrics.functional import multiclass_f1_score, binary_f1_score
import glob
# from funcs.utils import timeit
try:
... |
38226fe385bfcc9d1f21f0b9f825588b96844520cfcc8a7a5e0f11aa1d489818 | Python | 11,932 | 381 | # -*- coding: utf-8 -*-
# -*- mode: python -*-
# Adapted from mpl_toolkits.axes_grid1
# LICENSE: Python Software Foundation (http://docs.python.org/license.html)
import matplotlib.pyplot as plt
from matplotlib.offsetbox import AnchoredOffsetbox
from matplotlib.ticker import FormatStrFormatter
import numpy as np
from s... |
1ddd5c242ec65b6a12da66d1f27591332676c825527d80d77615a73e2903c1a3 | Python | 11,933 | 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... |
6b2c5a0143fd4e4b00c93340a423f89d01f742adf13edc50fed8564b0ff108c4 | Python | 11,936 | 295 | # 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... |
3efceb892a198cc72fb8dda42f76ca5b9438504c2b40cd48186a177f8200e4f3 | Python | 11,941 | 510 | # %% [markdown]
# # Preamble
# %%
import numpy as np
import scipy as sp
from joblib import Memory
import dgamem.traj as dga
import dgamem.traj_ref as ref
memory = Memory("data/cache")
# %% [markdown]
# # System
# %%
dt = 1e-3 # sampling interval in ns
area = 0.1**2 # histogram bin area
@memory.cache
def comput... |
66c36eb3f38b750768b3fafac2c447f7b24951197ad04d7ebfbd1a19f0116ac0 | Python | 11,947 | 328 | import json
import math
import click
import torch
from corgie import helpers, residuals, scheduling
from corgie.argparsers import (
corgie_optgroup,
corgie_option,
create_layer_from_dict,
)
from corgie.boundingcube import get_bcube_from_coords
from corgie.log import logger as corgie_logger
from corgie.spec... |
a31a9517f0689d422e76e4560c0090b0131af40e8d89898f048a206dc1fd3098 | Python | 11,959 | 360 | import random
import pytest
import geomstats.backend as gs
from geomstats.geometry.discrete_curves import (
DiscreteCurvesStartingAtOrigin,
DynamicProgrammingAligner,
ElasticMetric,
FTransform,
IterativeHorizontalGeodesicAligner,
L2CurvesMetric,
ReparametrizationBundle,
RotationBundle,... |
6901c2a41547336b521fed1bb89cd0b6c8cf247570778181977ff3a1c0e9c131 | Python | 11,963 | 314 | import os
import re
import torch
import numpy as np
from torch_geometric.utils import dense_to_sparse
from torch_geometric.data import Data, InMemoryDataset, \
download_url
try:
from rdkit import Chem
except ImportError:
Chem = None
import os.path as osp
import zipfile
import gzip
x_map = {
'atomic_nu... |
9f671d26d82079b59a92229af3fb5bde3a0399ffc610f0a9ce9c708d06caff0a | Python | 11,965 | 186 | import numpy as np
from rdkit import Chem
from dig.ggraph.dataset import PygDataset
bond_type_to_int = {Chem.BondType.SINGLE: 0, Chem.BondType.DOUBLE: 1, Chem.BondType.TRIPLE: 2}
zinc_atom_list = [6, 7, 8, 9, 15, 16, 17, 35, 53]
qm9_atom_list = [6, 7, 8, 9]
class QM9(PygDataset):
r"""A `Pytorch Geometric <https:/... |
dc9e0475a0334e2c79d9bb53b32b9da98a5ceb12eabe3f38e284c244ebe3ff7f | Python | 11,969 | 348 | """Export a folder-backed SanPy analysis collection to individual NWB files."""
from __future__ import annotations
import logging
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
import sanpy
from export_sanpy_banalysis_to_nwb import (
NwbExportMetadata,
NwbExportVeri... |
5f6c3fa3ef41b6365cab15ffc8cfc31780d4c1814b0a856507adc87db2efaa7a | Python | 11,972 | 217 | # 2026-09-26 Turn the sweeps into the committed tables the docs cite, and the data the figures
# read. Nothing is recomputed here; this only reshapes what `sweeps.py` measured (CLAUDE.md 0b).
#
# uv run python docs/tuning/report.py
#
# Writes, all committed:
# docs/tuning/scorecard.tsv every cell, every i... |
01bf9bf2bb51fdab1a074b636cf7e01167e9ad86563098a67464d0b4828aa112 | Python | 11,980 | 239 | # Copyright (c) 2018, 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 ... |
2fb1b588351b14903ce26f3e7b5af45f90b3ab798f954bde06736e7045461acb | Python | 11,991 | 338 | # Author: Guoqing Bao
# School of Computer Science, The University of Sydney
# Date: 2019-12-12
# GitHub Project Link: https://github.com/guoqingbao/Pathofusion
# Please cite our work if you found it is useful for your research or clinical practice
#%%
# from IPython import get_ipython
#%%
from PIL import Image
# mak... |
341bbeb07cb02ae7c212d07dc9cd3e7b9d3972bf2bee17c7a8fbef1e61919d95 | Python | 11,994 | 303 | import numpy as np
import neo
import warnings
from itertools import product
import sys
from copy import copy
import quantities as pq
from pathlib import Path
from snakemake.logging import logger
from .parse import get_base_type, get_nan_value
def remove_annotations(objects, del_keys=['nix_name', 'neo_name']):
if ... |
9c853cf8b2ebdba16e66ceadb2e5dcbc5138703dd852ffdd68e0a0738eac5d3b | Python | 11,999 | 369 | """Base class for optimization to hold common functionality
This basically follows the Template Method pattern. The (partially) abstract
base class holds the common functionality while the concrete implementation
take care of the specifics for optimization of the model.
"""
from __future__ import annotations
__all_... |
4fc83c69b6b3f0b977d531d5c7834c3a3914670858bfae1e5eed1ef4e23a7ab9 | Python | 12,000 | 303 | import numpy as np
import neo
import warnings
from itertools import product
import sys
from copy import copy
import quantities as pq
from pathlib import Path
from snakemake.logging import logger
from .parse import get_base_type, get_nan_value
def remove_annotations(objects, del_keys=['nix_name', 'neo_name']):
if ... |
68db7feb6f089dfbdec523765152986c39ed25abfa97d8ab6d6f5f5cb5d9d7b9 | Python | 12,001 | 299 | # import pdb
import random
import numpy as np
import pandas as pd
from scipy.spatial.transform import Rotation as R
from torch.utils.data import Dataset
from utils.hand.enhance import finger_tapping_distance
from utils.seed import set_seed
class PDHandData(Dataset):
# start from 0.5s (30~)
# random cut inter... |
a047cdbfc1b14456711ecaa5150af0acdf85b14b2fd2396f6377670e79b0fd3c | Python | 12,001 | 352 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch
import torchvision
import sys
from copy import deepcopy
from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator
f... |
0e2233c15c579926b677f286952b43a3065f2dcc893e5a7d906c5e896bd8bec0 | Python | 12,008 | 303 | import numpy as np
import neo
import warnings
from itertools import product
import sys
from copy import copy
import quantities as pq
from pathlib import Path
from snakemake.logging import logger
from .parse import get_base_type, get_nan_value
def remove_annotations(objects, del_keys=['nix_name', 'neo_name']):
if ... |
d72ba76af5d1cc622949b70198a935528d496dbfcb1a48f0090049360fd09c64 | Python | 12,014 | 312 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""TensorDB Module."""
from threading import Lock
from types import MethodType
from typing import Dict, Iterator, Optional
import numpy as np
import pandas as pd
from openfl.databases.utilities import ROUND_PLACEHOLDER, _retrieve, _searc... |
2759feeb0bc887b29c778bdce90c8ffca61e84057c0ce683c1c6e095a4265692 | Python | 12,021 | 357 | from functools import lru_cache
import logging
from typing import Any, Dict, List, MutableSequence, Optional
from typing_extensions import override
import torch
from lightning.fabric.utilities.distributed import _distributed_is_initialized
from lightning.fabric.utilities.types import _DEVICE
from lightning.pytorch.ac... |
a0ecd0cd705f481ec27e8ebd2d584d9dbb1c046ed1a5df21cc9d3b7f13977e5f | Python | 12,022 | 301 | import json
import logging
from pathlib import Path
from idtrackerai import (
GlobalFragment,
ListOfFragments,
ListOfGlobalFragments,
Session,
__version__,
conf,
)
from idtrackerai.utils import create_dir, get_params_from_model_path
from ..network import DEVICE, IdCNN, IdentifierBase, Identifi... |
41af91882b9940bdfc560f18e72b5c8d4c2c4cea505f255fb3e556966ce610f2 | Python | 12,023 | 378 | '''
Description:
Author: voicebeer
Date: 2020-09-08 07:00:34
LastEditTime: 2021-12-22 01:53:49
'''
# For SEED data loading
from torch.utils.data import Dataset, DataLoader
import torch
import pickle
import copy
import os
import scipy.io as scio
# standard package
import numpy as np
import random
random.seed(0)
# DL... |
132eddd52042f6fe3563dfe365011de2bbe2b872f5263420ec675b17ae75bf78 | Python | 12,038 | 287 | """
Time-frequency analysis using Morlet wavelets or multitapers
Kyuhwa Lee
EPFL, 2019
"""
import sys
import mne
import pdb
import scipy
import numpy as np
from pathlib import Path
import mne.time_frequency
import multiprocessing as mp
import matplotlib.pyplot as plt
from scipy.signal import lfilter
from scipy.signa... |
19e1f111b67b2efab54ec7095f22191c006f0111bfcf676f1f64a8ab8e81db1e | Python | 12,038 | 464 | # %% [markdown]
# # PV-IN KCNC2 Kv3.2 A new genetic cause of childhood epilepsy
#
# %% [markdown]
# ## imports and config
# %%
import logging
import platform
from itertools import product
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from neuron import h
from tqdm impo... |
03c1508af3306175774dedd897dfd3ab6eefc2f9000abd0d6fe4d08ab65f1f8a | Python | 12,044 | 331 | # 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... |
e75e8a5746d206af222584daa60b5e14833d3f7d6d465efe3b5f2e5d26649186 | Python | 12,046 | 332 | from overrides import override
from typing import Optional, Sequence, Dict, Set, List, cast
from uuid import UUID
from chromadb.segment import VectorReader
from chromadb.ingest import Consumer
from chromadb.config import System, Settings
from chromadb.segment.impl.vector.batch import Batch
from chromadb.segment.impl.ve... |
8a17ed1882b7c59be98dce2d6e6312ba8871b65b0e768a07d9c4d3638f0b1423 | Python | 12,048 | 329 | import matplotlib
matplotlib.use("Agg") # headless backend for plot tests
import numpy as np
import polars as pl
import pytest
from nltools.data import Adjacency
from nltools.data.designmatrix import DesignMatrix
class TestDesignMatrixDiagnostics:
"""
Test collinearity diagnostics and cleaning.
Behavi... |
4d7180adf2965dd4d43a2e71af2b939d772db35a633e1001ee962090b061e1df | Python | 12,052 | 299 | # 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... |
6635ad93b14623785140eb7ec5b7cc5bd25df9c23b346e935083b4dda81a2169 | Python | 12,062 | 326 | import copy
import numpy as np
import analysis_utils as au
def fit_data(df,
config_columns,
mean_columns,
metric_column,
method_column,
plot_column,
raw_data,
process_plot_column_fn_in_raw_data=lambda plot: plot,
... |
7a2eed14646d8bbeff1f2eddd6ef1c9a5f56a1573346b37c35ffb7de664dcb5d | Python | 12,066 | 340 | # 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... |
00aba6e77fd90242617c1b7f221272bfe3dfa02df24dd221ae9a3ccd35059a66 | Python | 12,079 | 311 | # 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... |
9febd2fc31c29e30def3b8653293cbfb93856a671cb32f1565f1212adec9919d | Python | 12,096 | 262 | # -*- coding: utf-8 -*-
"""
Optimization of hyper parameters.
Both grid search and random search using the ``hyperopt`` library are
supported.
The hyper parameter specification of a reconstructor class, optionally
including default options for optimization, are specified in the class
attribute :attr:`~dival.Reconstru... |
d07ba92fc7fe8495caaad710cc6f912dcfd1c4186c48d1e8d110d219f37c2ef1 | Python | 12,099 | 242 | """The new format: the joined view, the parquet round-trip, and the generated schema."""
from __future__ import annotations
import gzip
import json
import polars as pl
import pytest
from vdjdb.assemble.evidence import build_evidence
from vdjdb.emit import legacy, vdjdb3
from vdjdb.schema import CHAIN_COLUMNS, RECORD... |
0ab972a2349578c1f7b7efebac401b0aff82b0ba3c09935514b807b45c9fdc66 | Python | 12,111 | 241 | # Copyright (c) 2018, 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 ... |
08b3b8d3d4bb3a06224af4f0ddbaca2ae461ace0cf90226e0eddd149fbd13e53 | Python | 12,116 | 338 | import pytest
import geomstats.backend as gs
from geomstats.test.random import (
EmbeddedSpaceRandomDataGenerator,
MatrixVectorSpaceRandomDataGenerator,
VectorSpaceRandomDataGenerator,
)
from geomstats.test.vectorization import generate_vectorization_data
from geomstats.test_cases.geometry.complex_manifold... |
33813e242f7b9bb6a418d6c0bd3c7fabc1176759296ef9cca20f53974f0ca972 | Python | 12,118 | 267 | from itertools import islice
import numpy as np
from numpy.lib.format import open_memmap
from tqdm import tqdm
from dival.datasets import Dataset
def generate_cache_files(dataset, cache_files, size=None, flush_interval=1000):
"""
Generate cache files for :class:`CachedDataset`.
Parameters
----------... |
62e58c891de9957ddbe8e6111c92b44b8b008c86f49cec2bb3a96947c0959f08 | Python | 12,120 | 296 | """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 os
import time
import numpy as np
import pyedflib
from sleeprnn.common import constants
from sleeprnn.data import utils
fro... |
12bba46396cf272b7d03f9d3a6ed3d125ead190f8e9d900a1c5540d2c7f781fa | Python | 12,121 | 300 | """
Note:
When exporting to Panda Dataframes format, raw.as_data_frame() silently
scales data to the Volts unit by default, which is the convention in MNE.
Try raw.as_data_frame(scalings=dict(eeg=1.0, misc=1.0))
Kyuhwa Lee, 2014
Swiss Federal Institute of Technology Lausanne (EPFL)
"""
import mne
import numpy as np
f... |
cc4040c3895d87d554ae7a4e9752bc24491e4e2ce917b271813e03f766b863d8 | Python | 12,128 | 347 | from __future__ import absolute_import
import copy
import tempfile
import pyarrow as pa
import os
import torch
import zipfile
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from pysurvival import utils
from pysurvival.utils._functions import _get_time_buckets
class BaseModel(o... |
9619a5765d1f40e3167fd7b72912354ed802490b1b332988b687dc75f21644ed | Python | 12,142 | 316 | # 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 ... |
a7ab3a2a3e6e05a1c86a752db1402777274d6b12bfcfaf5083cbf50ade814697 | Python | 12,169 | 366 | import numpy as np
import imgaug.augmenters as iaa
from .operators import BaseOperator, register_op
from ppdet.utils.logger import setup_logger
from ppdet.data.culane_utils import linestrings_to_lanes, transform_annotation
logger = setup_logger(__name__)
__all__ = [
"CULaneTrainProcess", "CULaneDataProcess", "Hor... |
9d5500feff5c561d71466f1a01b6c0d04b1358c54c32bdcf7ebb5355f885077d | Python | 12,184 | 374 | import torch
import numpy as np
from torch.utils.data import Dataset
from scipy.signal import firwin
from neo.io.neuroscopeio import NeuroScopeIO
from scipy.signal import resample
class seqDS(Dataset):
"""
A Dataset class for phase coding working memory task,
using real LFP as reference oscillation
""... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.