sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9146a9e81b16dbe08c45997f790f47b2b92b5301c02534988539dccd65177870 | Python | 5,842 | 162 | from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
from cv2 import imwrite, imread
import csv
from imutils import rotate_bound
from skimage import transform, filters
from rocf_scoring.helpers.helpers import *
import time
from rocf_scoring.config import DATA_DIR, DE... |
3afbcb5e3790de604e114b41ba7ce846d6c9fa5287920709a89e42dc0b96fbd8 | Python | 5,843 | 170 | """Each encoder should have following attributes and methods and be inherited from `_base.EncoderMixin`
Attributes:
_out_channels (list of int): specify number of channels for each encoder feature tensor
_depth (int): specify number of stages in decoder (in other words number of downsampling operations)
_... |
1dac4f947a59b900375ecd3d4bea5fb2793e78a124d4837c351a203237b6b966 | Python | 5,845 | 167 | import torch
import torch.nn as nn
from elasticai.creator.nn.integer.math_operations.math_operations import MathOperations
from elasticai.creator.nn.integer.quant_utils.calculate_quant_params import (
calculate_asymmetric_quant_params,
calculate_symmetric_quant_params,
)
class QParams(nn.Module):
def __i... |
e83f600193daaa5165594c5b2ab7148af80d3dd93a4c6256cb16cea1f2e4c328 | Python | 5,845 | 148 | """
Created on Thu March 9 2023
@author: meine
"""
import numpy as np
import pandas as pd
import cobra.core.model as cobra_model
from dnngior.reaction_class import Reaction
from dnngior.variables import *
import os
import sys
from math import exp
from pathlib import Path
class NN:
def __init__(self, path=None, mo... |
f6ce5f23aa6f6e91cd0559f83dc1d7fb0aa2a5247d4c201f533e8eabc8cd1c7f | Python | 5,845 | 147 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
"""
Class to drag,annotate and remove the data points.... |
1994f84ccf3228f15250852a8030c41917571a639c45ed5c4e3f4dd4dd0400b8 | Python | 5,846 | 161 | """Per-trial features from microsaccade event lists.
The primary feature used in Nouri et al. 2025 is the microsaccade rate
binned at 15 ms within a 100-600 ms post-stimulus window. Secondary
descriptors (peak velocity, amplitude, duration, direction) are reported
per-event but can be aggregated per-trial for descript... |
d5f964b64726279147429566c7c50aa2885d71cb6e04c67c9df70a1520259848 | Python | 5,847 | 183 | from collections.abc import Callable, Sequence
from typing import Any, overload
from cocotb.handle import LogicArrayObject, LogicObject, SimHandleBase
from cocotb.triggers import RisingEdge
from cocotb.types import LogicArray, Range
def bitstring_to_logic_array(value: str) -> LogicArray:
return LogicArray(value,... |
2e6136f97bb4cd873ec21fbc011d97b62ab983499d5f9695dff25dc1df62f203 | Python | 5,848 | 171 | """
Optuna example that optimizes multi-layer perceptrons using PyTorch Lightning.
In this example, we optimize the validation accuracy of fashion product recognition using
PyTorch Lightning, and FashionMNIST. We optimize the neural network architecture. As it is too time
consuming to use the whole FashionMNIST datase... |
38dff6af69491cb4108bef3b2db0d286b008a69bb3313d63f8b54ea59114ea61 | Python | 5,848 | 240 | class ExperimentParameter:
def __init__(self, name, path, factor):
self.name = name
self.path = path
self.factor = factor
class Wire4mm(ExperimentParameter):
cor = []
slices = []
def __init__(self, name, path, factor):
super().__init__(name, path, factor)
class ESF(... |
52c6bf465b80df2ec5c143b3a8bd439ced2663c7cbc5a7fcaf32030b0d7e6f12 | Python | 5,850 | 219 | from __future__ import print_function
from collections import namedtuple
from pddlstream.utils import INF, str_from_object
EQ = '=' # xnor
AND = 'and'
OR = 'or'
NOT = 'not'
EXISTS = 'exists'
FORALL = 'forall'
WHEN = 'when'
IMPLY = 'imply'
MINIMIZE = 'minimize'
MAXIMIZE = 'maximize'
INCREASE = 'increase'
PARAMETER = ... |
43bed07f6c6a24f9685fc17ba2347bfac0ec79252aeef7c75c9451be0a8c0a37 | Python | 5,852 | 160 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
a58c4754ee53358bd23464e5205d8fb967cface026a4181d2a5fdcbbb054055f | Python | 5,853 | 126 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from yacs.config import CfgNode as CN
_C = CN()
_C.BIOM_MODEL_IDX = 0
_C.GENDER_ID = -1 # 1=male, 2=female, -1=both
_C.NN_ENSEMBLE_SIZE = 16 # 10 number of nets to train in ensem... |
0f28636b2f7e95d91b65db72e095408555e252a51d470d80910412a3f7c0be0e | Python | 5,856 | 175 | import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.math_operations import get_padded_count
from elasticai.creator.nn.integer.ram.design import Ram
from e... |
5afd973684f30fc8a2792b98194a597919655222d19e8cedc2742d28cb2a11ee | Python | 5,856 | 168 | import bct
import math
import numpy as np
from sklearn.utils import check_random_state
def strength_preserving_rand_rs(A,
rewiring_iter = 10, sort_freq = 1,
R = None, connected = None,
seed = None):
"""
Degree- and... |
5ca434c5df0e9bf0bb357ec416df4638d7bd6f66874a345f1c703345a0ef8118 | Python | 5,857 | 159 | #!/usr/bin/env python
# coding: utf-8
"""
Author:
Hermann F. Degenhardt <degenhardthf@nih.gov>
Maximilia F. S. Degenhardt <frazaodesouzam2@nih.gov>
"""
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import random, math, os, sys, json
sys.path.append("../sr... |
b280f5616dc79b0bf1493db3161187eb0fe4a6595478f54c34e13caa8fa0d4b8 | Python | 5,858 | 168 | ##
# \file simulate_stacks_from_reconstruction.py
# \brief Simulate stacks from obtained reconstruction
#
# Example call:
# python simulate_stacks_from_reconstruction.py \
# --dir-input dir-to-motion-correction \
# --reconstruction volumetric_reconstruction.nii.gz \
# --copy-data 1 \
# --dir-output dir-to-output
#... |
d31f87e94a7f5d35219d8d91c8e53575b976f5292a73af8442dfe818191ee28a | Python | 5,858 | 161 | import torch
from collections import OrderedDict
from torch import nn as nn
from torchvision.models import vgg as vgg
NAMES = {
'vgg11': [
'conv1_1', 'relu1_1', 'pool1', 'conv2_1', 'relu2_1', 'pool2',
'conv3_1', 'relu3_1', 'conv3_2', 'relu3_2', 'pool3', 'conv4_1',
'relu4_1', 'conv4_2', 'rel... |
ba1827e33cf370c409b21a79eb3225aa3a6b0de7215c68e3697d7037767d6de1 | Python | 5,859 | 141 | import argparse
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import plot_likert
import seaborn as sns
from matplotlib.transforms import ScaledTranslation
sns.set_context("paper")
sns.set_theme(style='white', palette='vlag')
# Read data
parser = argparse.ArgumentParser()
parser.add... |
5a1cb706c03be90426b04b3175d9a521f8d9143abcf5474b496305707acb5ce0 | Python | 5,860 | 149 | """Undo-history side-panel tests for the CCF Boundary Editor.
The panel surfaces the last 20 undo entries with human-readable
labels. Clicking an entry pops every newer snapshot off the stack
and applies each one's pre-mutation state - landing the viewer at
the chosen point in history.
"""
import numpy as np
... |
2f72afb4a9d4bce5b2ba456a87a27e5db6a17ecc5daf706ea359f0d5cc4b27f6 | Python | 5,862 | 176 | from __future__ import annotations
from importlib.util import find_spec
import pytest
torch = pytest.importorskip("torch")
pytest.importorskip("ray")
pytest.importorskip("fairchem")
pytest.importorskip("fairchem.core")
if find_spec("fairchem"):
from huggingface_hub.utils._auth import get_token
if not get_t... |
b0a39847ba86c0f6c7bf21d8bca8e0d553ae06179e142ecbdc674a2f51d47d06 | Python | 5,862 | 184 | import random
import unittest
import torch
import torch.nn as nn
from torch.utils.data import Dataset
from torch.utils.data.dataloader import DataLoader
from torcheeg.trainers.imbalance import LALossTrainer, LDAMLossTrainer, EQLossTrainer, FocalLossTrainer, WCELossTrainer
class DummyDataset(Dataset):
def __init... |
36486c1ef8945788f2884c95aa90fe2c6ee5254f0c6943ef8d9a4c3e860c53f4 | Python | 5,868 | 190 | import cocotb
import pytest
from cocotb.triggers import Timer
from matplotlib import pyplot as plt
from torch import asarray, no_grad
import elasticai.creator.nn.fixed_point as nn
from elasticai.creator.arithmetic import FxpArithmetic, FxpConverter, FxpParams
from elasticai.creator.testing import CocotbTestFixture, ea... |
80651a25694a608e2fabc57f5a436d589b7255c628a739fecd84669fbaa3edb2 | Python | 5,869 | 92 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import suites
from lab.reports import Attribute, gm
from common_setup import IssueConfig, IssueExperiment
try:
from relativescatter import RelativeScatterPlotReport
matplotlib = True
except ImportError:
print 'matplotlib not availabe, scatter plots ... |
7eebaf56b09eb6ee60b313c1e37111ca37cef1a45e4b7ac5407a4382222d6ece | Python | 5,871 | 133 | class AbstractProvider(object):
"""Delegate class to provide the required interface for the resolver."""
def identify(self, requirement_or_candidate):
"""Given a requirement, return an identifier for it.
This is used to identify a requirement, e.g. whether two requirements
should have ... |
d10516b2deabc267af56845888a810ca2aaefe3cca4773d597219c639876048d | Python | 5,871 | 207 | import numpy as np
from numpy.typing import NDArray
from sklearn.base import BaseEstimator, ClassifierMixin, clone
from sklearn.utils.validation import check_is_fitted
AGGREGATES = ("mean", "median", "sum", "min", "max")
class AggregateGate(ClassifierMixin, BaseEstimator):
"""Gate described by an aggregate func... |
4fd7b42165dfc2ff7cfcdd3d11e378c31d4ba1ad5f883b1d170f63134b4b0ad6 | Python | 5,872 | 138 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
e6e6737bad0839449b2f033fda5a63166e78b613fd85e8dd7d3fcf102eef029a | Python | 5,873 | 194 | from dataclasses import dataclass
from unittest import TestCase, main
import torch
from torch import Tensor, cat, tensor, testing, zeros
from torch.nn import BatchNorm1d, Linear, Sequential
from elasticai.creator.nn import Sequential as SequentialCreator
from elasticai.creator.nn.fixed_point import (
BatchNormedL... |
a46bcf56d5551fde8f0e6131913e9ff595b7c3332c11c6026226d5bc1852b5c3 | Python | 5,874 | 150 | # Copied from https://github.com/drorlab/atom3d/blob/v0.2.1/atom3d/datasets/ppi/neighbors.py
"""Methods to extract protein interface labels pair."""
import click
import numpy as np
import pandas as pd
import scipy.spatial as spa
import atom3d.util.log as log
logger = log.get_logger('neighbors')
index_columns = \
... |
e09fc8a33d0f2bd1074d660f4364e5682e71fde6dc4d891137bc8535e29f3283 | Python | 5,878 | 162 | import time
import numpy as np
from matplotlib import pyplot as plt
from median.filter_median import run_filter_median
from median.median import run_new_median
from median.utils.utils import run_classic_median
def test_runners():
"""multiple test"""
N = 100000
data = np.random.default_rng().standard_nor... |
21852106cc2bede40148b9333f8f4c849024dc87b269c0dd322daf9b6a868471 | Python | 5,881 | 212 | import sys
import numpy as np
import pandas as pd
import axelrod as axl
import dask_ml.cluster
def get_least_squares(vector, game=axl.game.Game()):
"""
Obtain the least squares directly
Returns:
- xstar
- residual
"""
R, P, S, T = game.RPST()
C = np.array([[R - P, R - P],... |
d3ca56bef6769892fe79287689d9f9342d5c1db2346186a3d8715a715f72bc43 | Python | 5,881 | 147 | import numpy as np
from scipy import signal
import torch
from typing import Callable
from specs import *
from PIL import Image
from boltons.cacheutils import cachedmethod
from scipy.interpolate import interp1d
from allen_data import ProcessedAllenNeuronMorphology, ProcessedAllenNeuronElectrophysiology
from utils import... |
6dd9c787189780887d10d83db184a301243da95e044453e0fe1ca95d8dab068e | Python | 5,882 | 164 | #!/usr/bin/env python3
"""
pdbfixer_clean_fromfile.py
Clean a local PDB file with PDBFixer and write <pdbid>_cleaned.pdb
into an output directory. No downloading.
Usage:
python3 pdbfixer_clean_fromfile.py --in /path/4LDJ.pdb --outdir /content/work/4ldj_wt --pdbid 4ldj
"""
import argparse
import json
import os
impo... |
8c60e5a7a20c6e59ee8cae2ed5e9e2f1501d9f6598c9c49d43e3fa8da18150cc | Python | 5,882 | 179 | """
Tools for converting old- to new-style metadata.
"""
from __future__ import annotations
import functools
import itertools
import os.path
import re
import textwrap
from email.message import Message
from email.parser import Parser
from typing import Iterator
from .vendored.packaging.requirements import Requirement
... |
b1016032d1713bb537a09833e7ea3869f2e9bc0b7bb01caff150e594b856407d | Python | 5,882 | 129 | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConfidenceBasedSelfTrainingLoss(nn.Module):
"""
Self training loss that adopts confidence threshold to select reliable pseudo labels from
`Pseudo-Label : The Simple and Efficient Semi-Supervised Learning Method for Deep Neural Networ... |
0835a8e3913aa499feef414ca57d17f3c35b5912e711e396ca171c0189d67d93 | Python | 5,884 | 100 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... |
5b76cdeda66f883cb58c6b327dcb5012fd4414ed4bbf098192868f26c7e66f00 | Python | 5,884 | 198 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Copyright (C) 2012 Computational Neuroscience Group, NMBU.
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 you... |
24b413e824cc4cf3108bf22832907acbe045968a5e8c99bb001f49d7af056322 | Python | 5,885 | 183 | # https://github.com/sunny2109/ShuffleMixer/blob/main/basicsr/archs/shufflemixer_arch.py
#import math
import numbers
import torch
import torch.nn.functional as F
from torch import nn
#from torch.nn import init
from einops import rearrange
class PointMlp(nn.Module):
def __init__(self, dim, mlp_ratio=4):
su... |
d1cba1c8eec9797825cbfc1ac5a2605cf30a87347d049012b98edd0c270db47a | Python | 5,887 | 134 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
95544d4c32df370b51a4c100a95f2d44b6445c4a2f8390c955472f874ec1c427 | Python | 5,888 | 203 | """
Created on 07/10/2020
:author: Chinchien
:summary: this module contains tools for organising files
"""
import json
import os
import sys
from pathlib import Path
__all__ = ['extract_filename_from_path',
'compare_filenames',
'compare_paths_by_first_element',
'compare... |
b7e1b6ce07c5377b3d033389513a398b427f1e17dc6d102dcb44249d96725971 | Python | 5,888 | 186 | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvBnRelu(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
kernel_size: int,
stride: int = 1,
padding: int = 0,
dilation: int = 1,
groups: int = 1,
... |
04e9af9aed14b22dfc51d682076ced03f660c4d7f8c8b3d5f585e110e4070725 | Python | 5,894 | 159 | # -*- coding: utf-8 -*-
r"""
This file implements the bond charge dipole model with regularization (BC(R)).
Atomic pairwise interaction predictions from the network are interpreted as bond charges.
The dipole moment is expressed as:
$$
\begin{aligned}
\mu = \sum_{ij}{}^{1}\mathbb{I}_{ij} \cdot \mathbf{r}_{ij}
\end{a... |
068dfe4bb0e7d1d3552f3d0244a48d09d486af6d16369debf63316f6fc6957ae | Python | 5,894 | 125 | from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.LUT.design import LUT as LUTDesign
from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port
fro... |
49058789b4943405be4c9bf2d5c1310742d27cff2f050284cbf0a928d41640b7 | Python | 5,895 | 152 | import argparse
from loader import MoleculeDataset
from torch_geometric.data import DataLoader
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from tqdm import tqdm
import numpy as np
from model import GNN, GNN_graphpred
from sklearn.metrics import roc_auc_score
from ... |
d8ac97c5ed03f665ea78b7b2feb09a0d70e3de91b0171dedc70a1b1d9b07db82 | Python | 5,896 | 138 | #!/bin/usr/python3
# Use example: python preprocessing_bids.py /home/melanie/BIDS_data_test /home/melanie/BIDS_data_test/transforms
## Import libraries
import os
import shutil
import tempfile
from glob import glob
import argparse
import numpy as np
import pandas as pd
import torch
import torchio as tio
from monai.da... |
430832ce10e4014f3188f05f385b0fe884a211c0480799c467e98d2f5d79250d | Python | 5,898 | 171 | """
Script for filter a SynGraphMCF object by extracting a filament network
Input: - A STAR file with a list of graphs (SynGraphMCF) as it is returned by
by mb_graph.py script:
+ Density map tomogram
+ Segmentation tomogram
+ MbGraphMCF object
... |
ffc6250529f161ee63c29faa9aa69ac3a4e84c0dfed8e6b5d9ad77d1758c81c2 | Python | 5,898 | 152 | import hashlib
import json
import os
from copy import copy
from pathlib import Path
import numpy as np
import pandas as pd
from ..utils import (ensure_cache as _ensure_cache, compute_fingerprint as
_compute_fingerprint, validate_cache)
def validate_metadata(info, columns=()):
if not isi... |
7df3ca8623290cfe6545c59ad666f581b1c1c1283843cdcd15c49943b8acca8e | Python | 5,900 | 174 | import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import torch
import torch.optim as optim
import sys
sys.path.append("..")
from PIDAO_SI import PIDAccOptimizer_SI
from PIDAO_Sym_Tz import PIDAccOptimizer_Sym_Tz
from PIDAO_SI_AAdRMS import PIDAccOptimizer_SI_AAdRM... |
716936399f85e1458cd82d5e99eb884cb045be059c4d513d3b6838e5d58c5298 | Python | 5,901 | 134 | import os
import tempfile
import unittest
import numpy as np
from torcheeg.model_selection import KFoldCrossSubjectTrainValTest
from .test_utils import _make_dataset
class TestKFoldCrossSubjectTrainValTest(unittest.TestCase):
_splitter_class = KFoldCrossSubjectTrainValTest
_parameters = {'all_subjects': [0... |
7d3895aa1a6d0db981f6af59cc2349c7fd2a18df3a4bc02c6ee143751651e35f | Python | 5,901 | 259 | # string functions
import numpy as np
from pyclamp.dsp.dtypes import *
#-------------------------------------------------------------------------------
def strfind(S, s):
I = []
d = len(s)
done = len(S) == 0 or d == 0
i = 0
while not(done):
k = S[i:].find(s)
done = k < 0
if not(done):
i +=... |
3b03b153998c5f133d2ddc487ee4629f0c828e1e103f79513b7c35211105b49d | Python | 5,902 | 169 | import numpy as np
import pandas as pd
from torch.utils.data import Dataset, DataLoader
import torch
from tqdm import tqdm
from .data import genseq, genemb
from .utils import *
mers5 = [f'{i}{j}AC{k}' for i in 'ATG' for j in 'AG' for k in 'ATC']
mers5 += ([f'{k}{i}{j}AC' for i in 'ATG' for j in 'AG' for k in 'ATCG']... |
a1e23f550b64a11ae0608f984a354b5870f2898e4589403345a61e152c5d2630 | Python | 5,902 | 128 | import os.path
from collections import defaultdict
from lxml import etree
import zipfile
from ckg.graphdb_builder import mapping as mp, builder_utils
#################################
# Human Metabolome Database #
#################################
def parser(databases_directory, download=True):
config = builde... |
5cad7c77c517b1f7fa04038e4c7092c5b08805fc7a7b968463b64e65e6cfd4d9 | Python | 5,904 | 149 | """No test may put a real window on the developer's screen.
Two paths in this codebase reach past the test process and pop a window that
outlives pytest. Both were observed during a normal ``run_tests.py`` run:
* ``_TerminalJobMixin._start_terminal_job`` -> ``QProcess`` -> ``wt`` /
``cmd start`` running t... |
9d6d475f55023d7f64cf5b6bd7fb7585172d5fa31eecc3ae12ff781e73c12488 | Python | 5,904 | 158 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
38fd9660a07ef1d1858e5b4c4210cb7d66e1b1db0bb9a86b49a2876daa01a424 | Python | 5,905 | 145 | import csv, datetime
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier, VotingClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.pipeline impo... |
625ed90391ebbd2a01a4430d4857cf5fe9f59c6b7c6de10abb37157963035e92 | Python | 5,909 | 180 | import unittest
import numpy as np
from neurolib.models.fhn import FHNModel
from neurolib.utils.stimulus import ZeroInput
from neurolib.control.optimal_control import oc_fhn
import test_oc_utils as test_oc_utils
p = test_oc_utils.params
class TestFHNNoisy(unittest.TestCase):
"""
Test fhn in neurolib/optima... |
74a8936290a18cbbff26f53ef8f1d8eacbdaf5a0b44432e15ab6e439b37f8dd6 | Python | 5,909 | 268 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.16.7
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# +
import n... |
fb5d4b6626f5cc5bc214579f3530686561c7bb08c1f36cb31b808c2fb0c0904f | Python | 5,911 | 169 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Hybrid LFP scheme example script, applying the methodology with the model of:
Potjans, T. and Diesmann, M. "The Cell-Type Specific Cortical Microcircuit:
Relating Structure and Activity in a Full-Scale Spiking Network Model".
Cereb. Cortex (2014) 24 (3): 785-806.
doi: ... |
2dbba97e5a4003c1c464585b9d25a580dd8bdef4fa6917821075073663572d96 | Python | 5,912 | 146 | r"""Test OpenBabel executables from Python
Note: Python bindings not used
On Windows or Linux, you can run these tests at the commandline
in the build folder with:
"C:\Program Files\CMake 2.6\bin\ctest.exe" -C CTestTestfile.cmake
-R pytest -VV
You could also "chdir" into bu... |
3e85daff4c77ddca1c6e835b560ef603a465899b0f70e606687fc12d2c332976 | Python | 5,913 | 144 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
"""
Class to drag,annotate and remove the data points... |
f28a5ebe85499eb64d5187f8623330c13bed3f856cd7f624509e14c5d9bdbde3 | Python | 5,914 | 173 | """
Script for thresholding GraphMCF instances according to its properties
Input: - File with a GraphMCF (.pkl)
Output: - Output view (interactive window or .pdf file)
"""
__author__ = 'Antonio Martinez-Sanchez'
# ################ Package import
import sys
import time
import getopt
from pyseg.globa... |
c749be15a986539f5f9f789d631fec7c9fe4eb0be225640e55124914aa5f9415 | Python | 5,916 | 130 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 6 10:34:58 2024
@author: daltonm
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from pathlib import Path
import dill
import re
import seaborn as sns
from scipy import sparse
from skle... |
f4880c401897daf7fff47ff933c08b34e51e453ae61603a2473ff352af9ddb3e | Python | 5,916 | 157 | """The ``exterior_damage_aware`` Laplacian correspondence mode: exterior-boundary
matching with tear correspondences pruned via ``geometry_registration.damage_mask``.
"""
import numpy as np
import pytest
pytest.importorskip("cv2")
pytest.importorskip("triangle")
pytest.importorskip("networkx")
pytest.import... |
eb4c1bec230d3c70608eb967ebcd9430f8b4c755ac18c50a452cbdbf010506f9 | Python | 5,917 | 151 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
f6fa5551e0d56f8c75a8dc6e8a0e6f4d77752bcb7f68d880b3976d3c6cfa998d | Python | 5,918 | 166 | from typing import Optional, Callable, Tuple
from torch import Tensor
import torch.nn as nn
__all__ = ['rey_classifier_3', 'rey_classifier_4']
_DROPOUT_RATES = (0.3, 0.5)
_BN_MOMENTUM = 0.1
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, norm_layer, downsample, dropout):
super... |
f07416f79411fd7cd2f2d977f753a32368f55d741bcae06a6d7a7302b26eebab | Python | 5,921 | 116 | #############################################################################################
# Take the 1000 CCA attempts in the task evoked and resting state (with fake triggers) data
# Crop eah evoked array of the 1000 to a time window slightly longer than that used for CCA training
# Compute the correlation matrix,... |
b89cdb2fe7464157415ac63d9b1701c469210687bd0975add7a7c2a6291605f6 | Python | 5,924 | 116 | import importlib.resources
from pathlib import Path
from sitetack.app.fasta import Fasta
from sitetack.app.sequence import Sequence
from sitetack.app.enums import PtmKind, OrganismKind, LabelKind
from sitetack.app.model import Model
class TestFasta:
@classmethod
def setup_class(cls):
with importlib.re... |
1617efceeb00eb8ceae3dd2e6d0f2ffdfef8783526e11e06d6f063773c47c9ad | Python | 5,926 | 152 | from typing import Any, List
import torch
from pytorch_lightning import LightningModule
from torchmetrics import MaxMetric, MeanMetric
from torchmetrics.classification.accuracy import Accuracy
class MNISTLitModule(LightningModule):
"""Example of LightningModule for MNIST classification.
A LightningModule or... |
15e4dc7e111365ffb6668b3492f66cae13ae6f9b21de7980a02381cfa240e816 | Python | 5,927 | 133 | """Per-slice memoization caches for the CCF boundary editor.
Extracted from the viewer so the cache semantics - LRU eviction, version-
keyed invalidation, per-region contour memoization, QBrush memoization,
pristine volume memoization - can be unit-tested without a QApplication.
The viewer still *computes* the ... |
4216cfa24e3055dc149d42b74c47c27fea81d574397ab2534a56efd41127788b | Python | 5,928 | 140 | #! /usr/bin/env python
from standard_experiment import REMOTE, get_exp
from downward import suites
#from lab.reports import Attribute, avg
import os.path
# Set the following variables for the experiment
REPO_NAME = 'fd-issue123'
# revisions, e.g. ['3d6c1ccacdce']
REVISIONS = ['issue123-base']
# suites, e.g. ['gripp... |
915fb6b3bebea32a4eefc5635b309db5c42ff7a569a87331f991a848ef722969 | Python | 5,929 | 155 | from unittest import TestCase
from pyseg.globals import *
from pyseg.disperse_io import *
from pyseg.factory import MembSideSkelGraph
from pyseg.vtk_ext import vtkClosestPointAlgorithm
from pyseg.vtk_ext import vtkFilterRedundacyAlgorithm
import vtk
import numpy as np
__author__ = 'martinez'
# Test variables
TEST_RES... |
3c694a14dc1e53ccb8f8db84c1df26a86cb78ac9e82a831208842163f78c6184 | Python | 5,931 | 198 | import os
import sys
import dask.array as da
import dask.dataframe as dd
import joblib
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from dask.distributed import Client
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
m... |
2f549750e41adc4d1409dfae7f6383e72b3fd40d17c030d12e3fdb7a1ff2233a | Python | 5,932 | 145 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
"""
Class to drag,annotate and remove the data points.... |
527ee1cd46db56a5217c5a2b9faa8a574bd08e4a80dcbb5dad739f96ebf6c0b2 | Python | 5,932 | 131 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 24 14:43:34 2022
@author: benozzo
"""
import matplotlib.pyplot as plt
from plotting_functions import figure_layout, set_size
import numpy as np
import scipy.stats as stats
from scipy.io import loadmat, savemat
from network_separation_library impor... |
0ef73309e77421053cc94bac4e67c053d96c6d350a557e966e7532743580f9dc | Python | 5,933 | 96 | from typing import List
import torch.nn as nn
from .dann_like import _DANNLikeTrainer
class DANNTrainer(_DANNLikeTrainer):
r'''
The individual differences and nonstationary of EEG signals make it difficult for deep learning models trained on the training set of subjects to correctly classify test samples fr... |
62522f243071bb9c1b01dcaa64c3716a59d3ac405f8625a1a485d3a083130349 | Python | 5,935 | 198 | from __future__ import annotations
import os
from pathlib import Path
import pytest
from ase.build import molecule
from quacc.recipes.orca.core import (
ase_quasi_irc_job,
ase_relax_job,
freq_job,
relax_job,
static_job,
)
FILE_DIR = Path(__file__).parent
def test_static_job(tmp_path, monkeypat... |
8aa4579e300c8277dd75a105b4f7ada470454b33089e440111cbd2d24a7aba61 | Python | 5,935 | 151 | # 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 biotite.structure
import numpy as np
import torch
from typing import Sequence, Tuple, List
from esm.inverse_folding.util import (
... |
3e0ce85d1adcd0c6b51e9c41a643b251007876eb76296fbd4f1d6ec506294844 | Python | 5,936 | 158 | import matplotlib.pyplot as plt
import matplotlib.pylab as pl
from Functions.f_AnalysisFunctions import *
from Functions.f_SignalProcFuncLibs import *
from Functions.f_ECGAnalysis import *
from Functions.f_AnalysisGraphs import *
from Functions.f_AnalysisStatistics import *
import os
import pandas as pd
import... |
93dc6a52ad48a7d0e87fa1db4c2e4aaa38cc882ce2d440fa8d3e09cf803c9722 | Python | 5,940 | 154 | from collections import deque
from typing import Generator, Optional
import cv2
import torch
from torch import Tensor
from torch.nn import Module
from torchvision import transforms
import random
def resize(vid, size, interpolation='bilinear'):
# NOTE: using bilinear interpolation because we don't wor... |
04e7b20c4fc6e3f1bb187ee83c2c6ca22632fc93d9d755270ace059597e34ce2 | Python | 5,941 | 138 | import numpy
from scipy import stats
from OnlineDetectors.online_nab_detector import OnlineAnomalyDetector
class BayesChangePtDetector(OnlineAnomalyDetector):
def __init__(self, *args, **kwargs):
super(BayesChangePtDetector, self).__init__(*args, **kwargs)
# Set up the matrix that will hold ou... |
4a2df7d460c28c761cc89ab08bd8dfad830f21c172074fe1f6ac32c09a278667 | Python | 5,943 | 119 | #%%
import pandas as pd
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import eigs
import numpy as np
import scipy as sp
from tqdm import tqdm
#%%
import matplotlib.pyplot as plt
np.random.seed(0)
neurotransmitter_effects = {
'ACH': 1, # Excitatory
'DA': 1, # Excitatory (can have inhibit... |
e4b6842bce2c2d81367bb07133a5b5ea1a19946682523dfd97fe87ce869f2c3b | Python | 5,945 | 187 | import torch.nn as nn
import torch.utils.model_zoo as model_zoo
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth',
'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth',
're... |
859b3ff1a458a6a8103901b46d43e1c828520d59e08d31a16fe04bd3ab6031e2 | Python | 5,946 | 142 | import math
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from typing import Any, Dict, Optional
from models.model import Model
class Hu1DCNN_Net(nn.Module):
"""
Deep Convolutional Neural Networks for Hyperspectral Image Classification
Wei Hu, Yangyu Huang, Li... |
63884f183369efd027bd58b9e2381963b70f470f9c58ccf5fe88d478bba4519d | Python | 5,947 | 170 | import numpy as np
from pandas import CategoricalDtype
def mean_agg(x):
return x.mean()
def sparse_sum_agg(x):
return x.sparse.fill_value if x.sparse.npoints == 0 else x.sum()
def sparse_max_agg(x):
return x.sparse.fill_value if x.sparse.npoints == 0 else np.max(x.values.sp_values)
def purity_agg(x)... |
aa349edf21c32c2481e280d140343860911d4db2f5e9b378ac8297ad7e75e786 | Python | 5,947 | 157 | """
Created on Tue Dec 28 13:33:50 2021
@author: Haotian Teng
"""
import torch
class NearstEmbedding(torch.autograd.Function):
"""Get the nearest embedding of given input, used in VQ-VAE:
https://arxiv.org/pdf/1711.00937.pdf
"""
@staticmethod
def forward(ctx,input,embd_weight):
"""
... |
d9dacf5d2326273ba5bbcd1562e1e54973d0d94a08f5ff01b2504e94489eb6db | Python | 5,947 | 153 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
7b3cb2c5142f6704f588c96fdafc263a7fb4b6478981800db72c77ff09e7b1e5 | Python | 5,948 | 208 | # Node-group asset "Periodic Array" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKIN... |
9556a26717e76e6f8d3e1760b47c8880fd6cb8c4b66a628995553e318bf8b17b | Python | 5,949 | 106 | import torch
from torch import nn
from torch_cluster import knn_graph, radius_graph
from torchdrug import core, data
from torchdrug.layers import functional
from torchdrug.core import Registry as R
from torch_scatter import scatter_min
@R.register("layers.geometry.AdvSpatialEdge")
class AdvSpatialEdge(nn.Mo... |
c22a7f91177941302b5ab2ac51306c1a5a0b73f523816648eedbd62e741e7939 | Python | 5,949 | 172 | """
Script for filter a MbGraphMCF object by extracting a filament network
Input: - A STAR file with a list of graphs (MbGraphMCF) as it is returned by
by mb_graph.py script:
+ Density map tomogram
+ Segmentation tomogram
+ MbGraphMCF object
... |
498d0b06d739c6331a696f1da25e549677f80d2aad2ba0df84b1ece907dfb10e | Python | 5,951 | 151 | from abc import abstractmethod
import pandas as pd
from anndata import AnnData
from anndata._core.sparse_dataset import sparse_dataset
from cirrocumulus.abstract_dataset import AbstractDataset
from cirrocumulus.anndata_util import ADATA_LAYERS_UNS_KEY, ADATA_MODULE_UNS_KEY
# string_dtype = h5py.check_string_dtype(da... |
27ddc54836aedb0bc9b491738e6c53f4ce0fc8233ac243ff5c91f1fe75f2572b | Python | 5,952 | 181 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
5e1c8ab03230de7bf3ebe2f172d37214bc07a3e57cd94a6d3abda66fdfc682c6 | Python | 5,953 | 178 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 31 15:56:34 2023
@author: daltonm
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import pickle
import dill
import os
import glob
import math
import re
import seaborn as sns
from scipy.ndimage import med... |
8aa95f0b6c2b21fbfdd853df183fa80453f89e330c3373cfc3248aa4ca891c60 | Python | 5,953 | 172 | """
Script for filter a MbGraphMCF object by extracting a filament network for single oriented membrane.
Input: - A STAR file with a list of graphs (MbGraphMCF) as it is returned by
by mb_graph.py script:
+ Density map tomogram
+ Segmentation tomogram
+... |
08c3cf31f96204422502f82a47d11d86fdd2d9a9b53950f480d1d9eda97193aa | Python | 5,954 | 117 | ############################################################################################
# Take the 1000 CCA attempts in the task evoked and resting state (with fake triggers) data
# Crop each evoked array of the 1000 to the time window used for CCA training
# Compute the correlation matrix, saving the image (heatm... |
7495110ec831e862e20bcb30549d57bed8543d441db14855dd0667daeca8ea4f | Python | 5,955 | 183 | """Core recipes for VASP."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc.calculators.vasp import Vasp
from quacc.runners.ase import Runner
from quacc.schemas.ase import VibSummarize
from quacc.schemas.vasp import VaspSummarize
from quacc.utils.dicts import recursive_dict_merge
if ... |
34dd1723a361895f4a5034437b231284d45f8fb5aec5b7220a3b0268d0e00192 | Python | 5,956 | 137 | """
Generate artificial spiketrains in order to test the cell assembly analysis pipeline
last modified: András Ecker 06.2022
"""
import os
import h5py
import numpy as np
import pandas as pd
from assemblyfire.config import Config
def def_assemblies(pattern_names, N, n, overlap):
"""Defines cell assemblies (one f... |
cf84648407cc283f1190d43f42c06b532d20cd6dfc6f99a20eb06180165d3218 | Python | 5,956 | 196 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
ef42c29a3c9b807adf9732a40495785175eceaae6b7b74aed9929c509ba80c3e | Python | 5,957 | 202 | from __future__ import unicode_literals
###############################
##### Model Name Defaults #####
###############################
# default model names
RNA_SAMP_TYPE = 'RNA'
DNA_SAMP_TYPE = 'DNA'
STANDARD_MODELS = {
DNA_SAMP_TYPE:'tombo.DNA.model',
RNA_SAMP_TYPE:'tombo.RNA.180mV.model',
}
ALTERNATE_MOD... |
f9379b1a63180c15473881979b026c697d771c19334c31eacc6bc8ef2c84e1b7 | Python | 5,957 | 212 | """Core recipes for Q-Chem."""
from __future__ import annotations
from importlib.util import find_spec
from typing import TYPE_CHECKING
from quacc import job
from quacc.recipes.qchem._base import run_and_summarize, run_and_summarize_opt
from quacc.utils.dicts import recursive_dict_merge
has_sella = bool(find_spec("... |
2b5c4eae9d637c0c342a036d1aeb4b58350b938f019730a25e7332b169b5bfef | Python | 5,958 | 169 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
c183edd0fd18f51dabb8a8d9b0cb9841fbb752f9e31fb11cf98851e58fe291ae | Python | 5,958 | 131 | """ evealuation functions for MolNexTR """
import numpy as np
import multiprocessing
import rdkit
import rdkit.Chem as Chem
rdkit.RDLogger.DisableLog('rdApp.*')
from SmilesPE.pretokenizer import atomwise_tokenizer
def canonicalize_smiles(smiles, ignore_chiral=False, ignore_cistrans=False, replace_rgroup=True):
""... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.