sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cb14e6101c2d911a97d529e738fdc4a7444d15cefc0f4b853346a62db49f1c24
Python
6,064
206
"""Base jobs for ORCA.""" from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.orca import ORCA, OrcaProfile, OrcaTemplate from quacc import get_settings from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize from quacc.utils.dicts import recursive_dict_merg...
afcacf167640c05aa77dc80eefd7a79e024943177a73da7399ab1270d86ac5a1
Python
6,065
222
#Path hack. import sys; import os; sys.path.insert(0, os.path.abspath('..')); import inspect filename = inspect.getframeinfo(inspect.currentframe()).filename path = os.path.dirname(os.path.abspath(filename)) import pickle import numpy as np import matplotlib.pyplot as plt from mysql import db class Player: ...
d634dd075d2e99d1907268beb29be90d19dff131b58d4cefc8851753a23975ed
Python
6,065
181
''' 4SM/model.py Copyright (C) 2021 Sharif Amit Kamran, Hussein Moghnieh 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 2 of the License, or (at your option) any later version. This ...
65f9425450e0843fe2f1e90168abcd53830b7093bf9edc0abf9dc29fcdad9aa8
Python
6,066
162
"""helper module This module contains helper functions for processing spike trains @author Iris Yoon irishryoon@gmail.com """ import numpy as np import matplotlib.pyplot as plt from itertools import combinations from scipy.signal import correlate # --------------------------------------------------------------------...
2290f951f271c6d2022ca1058a6813e2f2d690d81c6326e9f4d6e08ca454c80e
Python
6,067
194
"""""" import logging import warnings import cv2 import numpy as np from pupil_recording_interface.decorators import process from pupil_recording_interface.process import BaseProcess logger = logging.getLogger(__name__) logging.captureWarnings(True) def deprecation_warning(argument_name, process_name): msg = (...
9023f25b9a3937838f6866acb396acdb47900720951068c51f0b05122801222e
Python
6,068
172
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 import (ADATrainer, CenterLossTrainer, CORALTrainer, DANNTrainer, DANTrainer, DDCTrainer, JANTrainer) class D...
11143c5eeabdc71cc56582ea7e6f6e744aedb0917ae0d2ea64477d4cc1665419
Python
6,070
166
import numpy as np import pandas as pd from statsmodels.stats.proportion import proportion_confint from .utils import ( _check_data_dir, _get_filepath, _iter_bed, _load_chrom_mat, _parse_cell_names, echo, secho, ) def profile(data_dir, regions, output, width, strand_column, label): ""...
146f1be1151c91ca4c106621a86bced5f3dc206f1733c29f30289169c3ee351a
Python
6,070
158
## # \file psf.py # \brief Compute the Gaussian point spread function (PSF) associated with # a slice acquisition in the coordinates of the reconstruction # space # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date April 2016 # # Import libraries import numpy as np ...
4f440570619cbad68e0b935aadccda2bfcbe3debed9ead9a48e7a30c32842786
Python
6,070
144
from typing import Tuple import torch import torch.nn as nn class InceptionConv2d(nn.Module): def __init__(self, in_channels: int, out_channels: int, bias: bool = True): super().__init__() self.conv5x5 = nn.Conv2d(in_channels, out_channels, kernel_size=5, stride=1, padding=2, bias=bias) s...
8461005584752dbf066b6af5a93d8c425b59e92f23bde5c09e05816d241497d5
Python
6,071
177
import argparse import gdstk import meep as mp gds_file = "coupler.gds" CELL_LAYER = 0 PORT1_LAYER = 1 PORT2_LAYER = 2 PORT3_LAYER = 3 PORT4_LAYER = 4 SOURCE_LAYER = 5 UPPER_BRANCH_LAYER = 31 LOWER_BRANCH_LAYER = 32 default_d = 0.3 t_oxide = 1.0 t_Si = 0.22 t_air = 0.78 dpml = 1 cell_thickness = dpml + t_oxide + t...
60b3f1c2a0691a3011f8ed635570d9474e3a00ad6bd407e119929e71c60fe448
Python
6,072
165
import time import os import subprocess import sys sys.path.insert(0, '/home/jupyter/repos/genformer') import re import argparse import collections import gzip import math import shutil import matplotlib.pyplot as plt import numpy as np import time from datetime import datetime import random import seaborn as sns impo...
e7dfba5322ae8a2f69520ba6cfc7f4a4870f245f9b2e3bb823ad77b1fabb06ff
Python
6,074
154
# coding=utf-8 # Copyright 2020 The Trax Authors and The HuggingFace Inc. team. # # 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 r...
84c38ce7319352357d89137b90c957fdd21f04e78c6b88093a1314753df8a790
Python
6,077
189
from scipy.integrate import solve_ivp import matplotlib.pyplot as plt import numpy as np import math as m from mpl_toolkits.mplot3d import Axes3D import torch import torch.optim as optim from Rosenbrock import Rosenbrock_func from Quadratic import Quadratic_func from Rastrigin import Rastrigin_func def ...
9dc1e7b32dc15e8200ed73f3f303025c2a664e0597ae853ca5d6458f4394e2e9
Python
6,077
120
#! /usr/bin/env python # -*- coding: utf-8 -*- #! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, arithmetic_mean, geometric_mean import common_setup from common_setup import IssueConfig, IssueExperiment from rel...
a03582686cec88358cda308d3c5a7291f248c8bf3faabbd33ee585d878d24ef7
Python
6,077
183
"""Test various helper functions.""" # Authors: The PyPREP developers # SPDX-License-Identifier: MIT import numpy as np import pytest from scipy.stats import median_abs_deviation from pyprep.utils import ( _correlate_arrays, _eeglab_create_highpass, _get_random_subset, _mad, _mat_iqr, _mat_qu...
f5a9dfce663a4c17d43c3c810ce758d3b92a9931e9675b4ad232fea7525670e6
Python
6,077
162
######################## BEGIN LICENSE BLOCK ######################## # This code was modified from latin1prober.py by Rob Speer <rob@lumino.so>. # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by...
1400441684c4209bb3a6bc6b26e0484f72e59949f24463805cf78b97fa167ac4
Python
6,078
144
from unittest import TestCase from pyseg.diff_geom import SpaceCurve import math import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # Test parameters N_SAMPLES = 100 # L_BOUND = 0.5 * np.pi # U_BOUND = 1.5 * np.pi L_BOUND = (-0.15) * np.pi U_BOUND = 0.5 * np.pi C_MODE = 2 EPS = ...
0b930af0985560660558fbf1b0e46ca99027bce5de7d8439ee6d589b496e5b93
Python
6,079
193
# coding: utf-8 from collections import namedtuple import datetime import sys import struct PY2 = sys.version_info[0] == 2 if PY2: int_types = (int, long) _utc = None else: int_types = int try: _utc = datetime.timezone.utc except AttributeError: _utc = datetime.timezone(datetime.t...
5dc7736303870cd5420214e9c49d68df131b1be6a9b304b53adc68029f7bb14b
Python
6,079
208
""" Cog SDK: Define machine learning models with standard Python. This package provides the core types and classes for building Cog predictors. Example: from cog import BaseRunner, Input, Path class Runner(BaseRunner): def setup(self): # Load model weights self.model = load_mo...
cf4789aaf11e79b7b4020746673d6e4a1c11ce717a7b28f3c9c042c097b14078
Python
6,081
156
import numpy as np import APT_interface as apt import multiResData import os import pdb import matplotlib matplotlib.use('TkAgg') from matplotlib import pyplot as plt import cv2 from cvc import cvc import pickle def write_tfrecords(lbl_file,view,cache_dir,net,nsamples): cache_conf = apt.create_conf(lbl_file,view,...
5f1a313463febcc502cb348b83ae0c0e48dca4ae68656237755fa58ac4a40c3a
Python
6,083
197
# 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...
2565ae8ccc1444b0a1eb62a37c5777eac8b2c44665c17b4100470b19d54e8bdc
Python
6,084
176
"""VSI format loader (Olympus/Evident slide scanner) for volume_io.""" from __future__ import annotations import numpy as np try: import bioformats import javabridge _HAS_BIOFORMATS = True except ImportError: _HAS_BIOFORMATS = False from regtools.utils.io.volume_io import ( Volum...
608517c544713399c040e60d2fffa0ade375171a4975ccbe0d0301dfd36d1434
Python
6,085
226
import argparse, importlib, logging, os, subprocess from .. import __version__, __picture__ from ..logger import set_logger def parse_args(): parser = argparse.ArgumentParser( description="MiaoNet", formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add_argument( "-v"...
71ca2247b33afcfee5002a8cbdc5ed6d40d78007b9d2a5e51f56570a20fc3063
Python
6,086
118
import os import unittest from hed import load_schema from hed.errors import HedExceptions, HedFileError class TestHedSchema(unittest.TestCase): base_schema_dir = "../data/schema_tests/wiki_tests/" @classmethod def setUpClass(cls): cls.full_base_folder = os.path.join(os.path.dirname(os.path.real...
1b2dba7f5fe319aa7238c8043116a368e7c0a5db3741997072c6c6c255be6cb9
Python
6,087
145
import pandas as pd import math import sys # how to run this file: # python3 molecule_padding.py n abc.txt def.txt ghi.txt # n = amount of padding around the image # you can enter any # of .txt files (needs to be at least 1) cols = ['x','y','z'] file_names = sys.argv[2:] if len(file_names) > 0: for file_name in...
4756b50504a9b547ed30268804a142a24af442cc77d49a0451ee1131bf15f139
Python
6,087
177
# 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...
b224dd86fe1aa0a9aea32e7458f93fad7508417830f6ee69d19625a616f072d8
Python
6,087
173
"""Column type for a column in a ColumnMapper.""" import copy from enum import Enum import pandas as pd from hed.errors.error_types import SidecarErrors class ColumnType(Enum): """The overall column_type of a column in column mapper, e.g. treat it as HED tags. Mostly internal to column mapper related code...
d79dcb7ce2e0760cdd8bd1af91729b95d066f0a58e807dcabde0200552fb5301
Python
6,087
139
# 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...
c1392c494a193c1876f581831801f81afe35ce9040c8fc7afadafcb6896644c2
Python
6,089
172
""" New median implementation """ import numpy as np from .buffer import Buffer from .utils.utils import distance_buffer class Median(Buffer): """New median""" def __init__(self, L=62, dtype=float, initB=None): Buffer.__init__(self, L=L, dtype=dtype, initB=initB) def update(self, new_value: fl...
1ef0c3abd6d5a9a3778dc4b70f25491cfeee4ea1736d285d91fecd152a077e4c
Python
6,096
186
"""Download files with progress indicators. """ import email.message import logging import mimetypes import os from typing import Iterable, Optional, Tuple from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response from pip._internal.cli.progress_bars import get_download_progress_renderer from pip._internal...
9347a3b10f6a8836141f67e18abe2592144a76428ff73fcf9ed12df7c8fdcc37
Python
6,096
193
from __future__ import division, print_function import unittest import numpy as np import matplotlib.pyplot as plt import nitime.algorithms as ntalg from soundsig.sound import plot_spectrogram from soundsig.timefreq import GaussianSpectrumEstimator,MultiTaperSpectrumEstimator,timefreq,AmplitudeReassignment,PhaseR...
2c1716d1cb027bc7a4d2deba42758e2f78f50dad1f895ec029443db540d6ecc2
Python
6,097
175
import pytest import os import numpy as np import nibabel as nib from pathlib import Path from pyrelimri.similarity import image_similarity from pyrelimri.brain_icc import (voxelwise_icc, setup_atlas, roi_icc) from nilearn.datasets import fetch_neurovault_ids from collections import namedtuple from nilearn.masking impo...
a3e5e9d15b50c6374f2b83a6b069344102e31649fa6de79e74401417d603b2c9
Python
6,098
134
import os from typing import Dict, Iterator, List, Tuple, Union from urllib.parse import quote, unquote import numpy as np import pandas as pd from torcheeg.datasets.module.base_dataset import BaseDataset from .base_model_selection import BaseModelSelection from .utils import create_subset, read_indices, validate_gro...
7268ba87adf160d5e141eeca11610c6803631c5cb9c9038fb7fd7f4425b25cc6
Python
6,100
173
"""Locations where we look for configs, install stuff, etc""" # The following comment should be removed at some point in the future. # mypy: strict-optional=False # If pip's going to use distutils, it should not be using the copy that setuptools # might have injected into the environment. This is done by removing the...
570308446ba0e35df81365b5dd50b0179c95ea2d482423996ef0ee020c452faa
Python
6,101
185
from __future__ import annotations from wikibaseintegrator.models.basemodel import BaseModel from wikibaseintegrator.wbi_config import config from wikibaseintegrator.wbi_enums import ActionIfExists class LanguageValues(BaseModel): def __init__(self) -> None: self.values: dict[str, LanguageValue]...
71b2e4c97dbbac55a853d317315235e83a5887a9a577ef7643f5957c4126405e
Python
6,101
173
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...
b16630d97fe07f1e3580380efc3d856341c5570c725ddad4eebaa10f308b8cef
Python
6,101
186
import os import matplotlib.pyplot as plt from scipy.optimize import minimize import autograd.numpy as np from autograd import value_and_grad rows, cols = 40, 60 # Fluid simulation code based on # "Real-Time Fluid Dynamics for Games" by Jos Stam # http://www.intpowertechcorp.com/GDC03.pdf def occlude(f, occlusion...
b6319532bdee09342c2753d835b8a9fee45251e994975da1e15bc507e3807db3
Python
6,101
154
from jax import numpy as jnp, random, nn, jit import numpy as np import sys, getopt as gopt, optparse from csdp_model import CSDP_SNN as Model from ngclearn.utils.io_utils import makedir ## bring in ngc-learn analysis tools from ngclearn.utils.metric_utils import measure_ACC, measure_CatNLL from ngclearn.utils.v...
edee85dc7020d740c2115c0b269b4b16b3bffcecb8eba85001e81d6500760f24
Python
6,101
183
import time import numpy as np import pytest from pupil_recording_interface import __version__ from pupil_recording_interface.manager import StreamManager class TestManager: def test_init_folder(self, tmpdir): """""" folder = StreamManager._init_folder(tmpdir, "here") assert folder == tm...
934466ce79b91672393f9058afd2983d222f8902360b7ab1d88d241f2f23501c
Python
6,102
170
import torch import torch.nn as nn import torch.nn.functional as F from ..initializer import create_initializer class BottleneckBlock(nn.Module): expansion = 4 def __init__(self, in_channels, out_channels, stride, stage_index, base_channels, cardinality): super().__init__() ...
d155325544f84752eae0e3b38fbec11370e356200c88231fd78ea79ce4685c62
Python
6,102
203
#!/usr/bin/env python # Written by Minh Nguyen and CBIG under MIT license: # https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md from __future__ import print_function, division import argparse import json import time import pickle import numpy as np import torch import cbig.Nguyen2020.misc as misc from cbig.N...
b6baad9dbae3f25a230c0048eb3490defe27fc14e52d16d548185a08a3dba7ec
Python
6,104
108
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 # ** should be registered in torchdrug.layers.geometry.__init__, for to b...
b7d7846e737edbefdde760130635c231746eca5a5fe995142cf04717d4f27749
Python
6,105
195
# 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...
35cbe46ba592c42e00b0dc220cef732d5dd2fcce670aaedc1c06da314c1bce1b
Python
6,108
154
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt rec_header_dtd = \ [ ("nx", "i4"), # Number of columns ("ny", "i4"), # Number of rows ("nz", "i4"), # Number of sections ("mode", "i4"), # Types of pixels in the image. Values used by IMOD: ...
b5c0d51c6520c76580f0585f25601c9aa909afa050310a977590761e39d151d1
Python
6,108
147
import matplotlib matplotlib.rcParams['figure.facecolor'] = '1.' matplotlib.use('Agg') import ants import time import numpy as np import nibabel as nib import matplotlib.pyplot as plt import matplotlib.animation as animation from skimage.filters import threshold_otsu from nibabel.processing import resample_to_output, ...
29c5c89318753201fe55d161cc1005d5e31eb7c37ad8992d04b948bc1f8bf99e
Python
6,109
153
"""Single-image RegistrationTab: Cancel terminates the run + Open Output Folder. Built under offscreen Qt. Verifies that: * the Cancel button is wired to a handler that calls the terminal-job mixin's ``cancel_job()`` - i.e. it really stops the running registration process, not merely resets the UI; * an "Ope...
46642c5bcf9af56ef028636065a9919d2bfee8e5311a195f2ed320f29409d105
Python
6,109
99
# -*- coding: utf-8 -*- """ Extract Volume statistics from recon-all segmentations """ import os import glob import subprocess from nipype import logging from nipype.interfaces.base import ( traits, TraitedSpec, Directory, BaseInterfaceInputSpec, BaseInterface ) from traits.trait_types import Str _...
56dec808869e1a378f282dfe4def9f7ebdb03652109aeb89aa2f859e45debb43
Python
6,109
175
import sys, os import numpy as np import keras from keras.models import Model from keras.layers import Input, Dense, Dropout, Flatten from keras.layers.merge import concatenate from keras.layers.convolutional import Conv2D, Conv1D from keras.layers.pooling import MaxPooling2D, AveragePooling1D from keras import backend...
22272d1798430facf9a869466a8032ce87f2804aefe8c3ebe906e93dd5bf78f4
Python
6,110
145
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ from qtpy import QtGui, QtCore, QtWidgets from qtpy.QtWidgets import QMainWindow, QApplication, QDialog, QWidget, QScrollBar, QSlider, QComboBox, QGridLayout, QPushButton, QFrame, QCheckBox, QLabel, QProgressBar,...
314ec1d54b48b88a97e506214bfe8edabdbafb5d617ba3804002d5d1e4f42073
Python
6,111
103
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
5328db4c6c35fef92568d32c8a6b10779e2c1e73af9f18341d2db51ab1dac9af
Python
6,111
153
""" Unit tests for regtools/ome_zarr_converter/points.py The `load_points` entry point now delegates to `regtools.utils.io.points_io.load_points_file`, whose format-detection, TXT, and CSV behaviors are covered in test_points_io.py. These tests focus on what `ome_zarr_converter.points` owns: the Neuroglancer pr...
6a91a72bbd4ffebdfc7348c5b955cf4586893a5feb8a327ea5b967f6997c1166
Python
6,111
179
# 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...
f732493a407e2c1b78f37959016cdd2e13070343786ec285fcbeb56444f1935c
Python
6,111
125
import os from typing import Tuple, Callable, Union import pandas as pd from sklearn import model_selection from torcheeg.datasets.module.base_dataset import BaseDataset from ..utils import get_random_dir_path from .utils import create_subset, ensure_cache, read_indices, write_indices def train_test_split_cross_sub...
1096677f61f2a19e3736bbe170fc3379b9f1695c77a37a0143f28929f6d43436
Python
6,112
146
import pandas as pd import numpy as np from tests.mock_data import MockCvOutput, MockCuppaClassifier, MockTrainingData from cuppa.classifier.cuppa_prediction import CuppaPredictionBuilder, CuppaPrediction, CuppaPredSummaryBuilder, CuppaPredSummary class TestCuppaPredictionBuilder: def test_can_build_predictions...
a8bab903bb7aeec5297dde11612e187b766b7f6c821b122201975a15c146c46a
Python
6,113
134
import os import re from typing import Iterator, Dict, Tuple, Union import pandas as pd from sklearn import model_selection from torcheeg.datasets.module.base_dataset import BaseDataset from .base_model_selection import BaseModelSelection from .utils import create_subset, read_indices, write_indices class KFoldCross...
89c5b1a013c84c7179e1a2d75c34605ff0469afb97c19b2a22182a26bef6e4e8
Python
6,115
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...
e9405133b3ba6e75063de46506ca0a71b873869b0b78f7569ee45bab0f1a1470
Python
6,116
167
""" Unit tests for regtools/utils/image_processing.py Covers: - auto_contrast - preprocess - remove_artifacts """ import numpy as np import cv2 import pytest # =========================================================================== # auto_contrast # ========================================...
1eaebc70087d526664ff89882fa052a4f2b7327e7c80ac3302aae8fa88131e0f
Python
6,117
132
from importlib.util import find_spec import anndata as ad import numpy as np import pandas as pd import pytest import statsmodels.api as sm if find_spec("formulaic_contrasts") is None or find_spec("formulaic") is None: pytestmark = pytest.mark.skip(reason="formulaic_contrasts and formulaic not available") def _...
9b24700e5fe4beaf35838041fbddc68c6fa1dd9b1aab7cb52f5e45701c747b94
Python
6,117
146
#!/usr/bin/env python """ toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Fr...
55a5ca2079b94e4f9d8f3ad08d3f7fb6e3a4350012226ae403ed9495ed0cf8a5
Python
6,118
157
import csv import os import fnmatch import numpy as np from mahotas.features.texture import haralick_labels import nibabel as nib import ExtendGaborFeatures import Biopsy5by5WindowV3 import FirstOrderFeatures import MultiModality def String_f(listOfStrings,Pstrings): for Strings in listOfStrings: ...
572695723a473a535e9848dfc93dce0eeb3bbab7727b92b9229444b65e76ab54
Python
6,118
160
import argparse import numpy as np import torch import torch.nn as nn import torch.optim as optim import random from dataloaders.data_loader_s2r import S2R_Dataset_train, S2R_Dataset_test from torch.utils.data import DataLoader from model.resinf_foreal import ResInf from engine_s2r import * import wandb from utils imp...
b5a9876b017320b15902b252f5502eca5a0349a554bace5f8553e0c1e56c6d7d
Python
6,118
146
from neuron import h from network.Segment import Segment import numpy as np class Cell(object): def __init__(self, index: int, name: str, cell_param: dict) -> None: # name: cell name, string # index: cell index, int # cell_param: cell parameters, dictionary self.index = index ...
1faa713fc7d20072b5eb358e622b43f054164e8ea6ae461a2ad053ae3a0aadb1
Python
6,120
194
import json from collections import Counter import warnings from tqdm.auto import tqdm import random import math import numpy as np import pandas as pd # from pandas.core.common import SettingWithCopyWarning # warnings.simplefilter(action="ignore", category=SettingWithCopyWarning) pd.set_option('mode.chained_assignme...
4bec8a40696f218922c2545728803a817449ad24fe0517de834b0ffec87c6028
Python
6,120
132
import os from typing import Tuple, Union import pandas as pd from sklearn import model_selection from torcheeg.datasets.module.base_dataset import BaseDataset from ..utils import get_random_dir_path from .utils import create_subset, ensure_cache, read_indices, write_indices def train_test_split_cross_trial( ...
0311f5857f3d2d1d41d9f9115a487a050ebaa6821e7ee831b44efcee184bb0ea
Python
6,121
163
from __future__ import annotations from collections import defaultdict import pandas as pd from joblib import Parallel, delayed from loguru import logger from pandas._typing import FilePath from tqdm import tqdm from tqdm_joblib import tqdm_joblib from .pair_evaluator import PairEvaluator, DeltaType def get_pair_e...
09f9d2c3037074127459a16910c82180e62d26c189d357853f2de535167d967e
Python
6,121
202
# 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...
d835fd80a9654ae4b28a00ece3e0ba8de6ecd242daf48c0222a3a6e0eae5d286
Python
6,122
186
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Tong He and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md """ import os import time import random import argparse import numpy as np from pathlib import PurePath import keras from keras import backend as K from keras.o...
e92992c7771aee861c1d8f642923e3c646671456efb80f473211366d496631fc
Python
6,122
153
"""Multi-slice propagation of a contour edit. Given a SliceEditState on slice Z, propagate the same per-handle displacement to neighbouring slices Z±N. The naive copy fails because the neighbour slice's pristine contour has a different shape - same anatomical region, slightly different boundary at that z. The ri...
abfd28c7ef2a5dd527a07fbcde59ee2203a6bd3843820ec2d9d1253ad841768f
Python
6,124
84
"""This file is to explore how the hyperparameters influence neural network dynamics""" import os.path as path import datetime import argparse from eworm.network import process chemotaxis_neuron = ["AWAL", "AWAR", "AWCL", "AWCR"] # 82 sensory_neuron = ["ASIL", "ASIR", "ASJL", "ASJR", "AWAL", "AWAR", "ASGL", "ASGR", ...
68e3b0b46c9cc3a2e7156129ea5d3a396364dec1f03931a026b6a171a5077897
Python
6,125
240
from __future__ import annotations import re from pathlib import Path from typing import TYPE_CHECKING from ase.calculators.genericfileio import ( BaseProfile, CalculatorTemplate, GenericFileIOCalculator, read_stdout, ) from quacc.calculators.mrcc.io import read_mrcc_outputs, write_mrcc if TYPE_CHEC...
6dc2a263edc774df61df4c66fb1773981d116af79f60845a02247eddb0a8d862
Python
6,125
182
# 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...
3ea64fb4dc94995830e4cd67a47db81615909802ce98126da771143474a8dc72
Python
6,126
172
# 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...
56b71e36210fe8bbb9c1ecf9646f3ec626ba6e0573a54a8b1b24c3e7fa64d71c
Python
6,128
131
from typing import List import torch import torch.nn as nn from .mmd_like import _MMDLikeTrainer def _compute_covariance(data, eps: float = 1e-6): n = data.size(0) device = data.device ones_vector = torch.ones(n).resize(1, n).to(device=device) one_onto_D = torch.mm(ones_vector, data) mult_rig...
f7091cb698f1656e1dfd8681b6d6183cc7ee68416f07ea803f9874cb62e96a05
Python
6,128
176
# -*- coding: utf-8 -*- """ Created on 15 october 2023 @author: divyoj """ ## importing libraries: import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import os # # note that this must be executed before 'import numba' # os.environ...
53cce7c4fbbe20fe459c91d470704adbb0ec90bbc6fa079610708eb7198b691c
Python
6,129
153
#! /usr/bin/env python from __future__ import print_function from collections import deque, defaultdict import itertools import time import invariants import options import pddl import timers class BalanceChecker(object): def __init__(self, task, reachable_action_params): self.predicates_to_add_actions ...
6225d0cdbefa83e87c8e470ea6a8f7343a2059d366ae75e65be6ce0cb3570c62
Python
6,129
139
import numpy as np import os import pandas as pd import torch import torchvision from constants import * from src.utils import map_to_score_grid, score_to_class from src.dataloaders.rocf_dataloader import get_dataloader from config_eval import config as cfg_eval class RegressionEvaluator: def __init__(self, mod...
341a69256e79f44c6b480dd079a648efb48655c2917ba09ac198adc08c1c0562
Python
6,130
137
from typing import List, Tuple, Union import numpy as np import torch from torch import nn from torch.utils.data import DataLoader from ..classifier import ClassifierTrainer class WCELossTrainer(ClassifierTrainer): r''' A trainer class for EEG classification with Weighted Cross Entropy (WCE) loss for imb...
15a27472f35f712d11871ff6cdca7d3dea7996f40fc3c03d0501dbcf7775f21d
Python
6,131
188
"""High-pass filter and locally detrend the EEG signal.""" # Authors: The PyPREP developers # SPDX-License-Identifier: MIT import logging import mne import numpy as np from pyprep.utils import _eeglab_create_highpass, _eeglab_fir_filter logger = logging.getLogger(__name__) def removeTrend( EEG, sample_ra...
93cb2aa1bcd187c183ec92ba388379e06c7735d84d4d316a7aa380ff5c035045
Python
6,131
176
# 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...
52471e1140fd165767a9065ea96a8b5dd19b30b5f0f858b93c9c34e70da90101
Python
6,132
143
## Importing these packages is specific for this simulation case import numpy as np import hmp from hmp import simulations from hmp.models import EventModel from hmp.patterns import HalfSine from hmp.distributions import Gamma from hmp.patterndata import PatternData from test_io import init_data, init_data_large, i...
13bc8265557fe970e4abbb5b2c79987760802328fb5507297fbad08475cc323f
Python
6,133
179
from __future__ import annotations # built-in from collections import defaultdict from itertools import groupby, zip_longest from typing import Any, Iterator, Sequence, TypeVar # app from .base import Base as _Base, BaseSimilarity as _BaseSimilarity try: # external import numpy except ImportError: numpy...
13d95e5e00fb0ddd4a94e50290c63c9b4aba4158107d522191cedaf7521e0d16
Python
6,133
236
from glob2 import glob import tifffile import os import numpy as np import matplotlib.pyplot as plt from skimage import exposure from imgaug import augmenters as iaa import cv2 import tensorflow as tf from tensorflow.keras.preprocessing import image def normalize99(X): """normalize image so 0.0 is 0.01st percentil...
47639b6d9f3fdfe46a728a3e3ea081f017f75b5d1d5fc6f37ce8b5a31d88d80a
Python
6,133
135
from datetime import datetime import gzip import json import pandas as pd #Defining JSON data loading function def json_loading(f,g,s,fold): begin_time = datetime.now() genes_df = pd.read_csv(g, sep='\t') genes_list = genes_df['gene symbol'].tolist() #Creating a list containing the ...
27244af281531d204ccfce92e5f1a79f972022630ef83290a2361840099c3cc2
Python
6,134
180
import os import argparse basepairs = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'N': 'N', 'W': 'W', 'S': 'S', 'M': 'K', 'K': 'M', 'R': 'Y', 'Y': 'R', 'B': 'V', 'V': 'B', 'D': 'H', 'H': "D", 'Z': 'Z'} iupac_alphabets = {'A': ['A'], 'T': ['T'], 'C': ['C'], 'G': ['G'], ...
2b44dc62dbf8aa9ddac4446942080d3d6c1c4d8a60845e6814f4b0af9877f6dc
Python
6,138
120
#! /usr/bin/env python # -*- coding: utf-8 -*- #! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, arithmetic_mean, geometric_mean import common_setup from common_setup import IssueConfig, IssueExperiment from rel...
1de58aecc08bf8a7eb899378b13787e725fa36a783d1c88681c1318c1685cd85
Python
6,140
179
# test_levenshtein.py import pytest from fba.levenshtein import ( indexkeys, bytes2set, set2bytes, create_index, query_index, select_query, format_one_query, match_barcodes_paired_fastss ) test_data = [ ('ACGT', 0, {'ACGT'}), ('ACGT', 1, {'ACG', 'ACGT', 'ACT', 'AGT', 'CGT'}), ...
a591db5877a6bc05583a262d448f9f4079d2ee25eded3406efcea2fdb3fd591a
Python
6,140
141
from __future__ import print_function from collections import namedtuple from pddlstream.algorithms.constraints import to_constant, ORDER_PREDICATE, ASSIGNED_PREDICATE, \ get_internal_prefix from pddlstream.algorithms.downward import make_action, make_domain, make_predicate from pddlstream.algorithms.focused impo...
1d721f4ee5b7cd1074b03936a505200feb83a1b34dde916a9a63be386f977251
Python
6,141
157
import os from csv import DictReader from glob import glob from datetime import datetime import scipy.sparse as sp_sparse from .utils import _check_data_dir, _get_filepath, _load_chrom_mat, echo, secho def _filter_by_name(file, cell_stats_path, keep=True): fpath = _get_filepath(file) cells_to_keep_idx = [] ...
10af0e022496ece4fc8f69023e7b4ffc86c968656039c69377fe59f5bd7fc882
Python
6,142
167
import itertools import numpy as np import pandas as pd import scipy.stats def _power(X, power): return X**power if isinstance(X, np.ndarray) else X.power(power) def asarray(x): return x.toarray() if scipy.sparse.issparse(x) else x class DE: def __init__( self, series: pd.Series, ...
14b5d3573bc4a3295be6915137cb9b9579365bef7811661ccd2d6d96d3b3256c
Python
6,143
162
# Node group "Symmetry Instance" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are regene...
3c18bf59e8294c8beb0c5ef0eeddf42460c26af6d60be02276441b46e938c2a5
Python
6,143
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...
4493bbf85c072bbdcff549d517680d801cf38816f0f8f7e6442224e3a0e761e2
Python
6,143
182
import json from pathlib import Path import numpy as np import torch import tqdm from scipy.stats import pearsonr, spearmanr from .prix_fixe_net import PrixFixeNet from .dataprocessor import DataProcessor from typing import Any from abc import ABCMeta, abstractmethod # default metrics to compute DEFAULT_METRICS = ...
5d5f35aa01231172109eb184fc5dfce35dc1ce31d7bd68b6ac1d242f71d9debd
Python
6,143
134
import os from pathlib import Path import subprocess import sys import textwrap import unittest class TestOptionalModelDependencies(unittest.TestCase): def run_without(self, modules, body): root = Path(__file__).resolve().parents[2] script = ''' import importlib.abc import sys import torch import ...
601525e53addd1d21f7022a095babdefb5d4c1d90a11a9c6b1e934e7e7271568
Python
6,143
139
#!/usr/bin/env python import os import argparse import sys sys.path.append(os.path.dirname(__file__)+'/..') from maggie import score, utils, visual import numpy as np import pandas as pd if __name__ == "__main__": parser = argparse.ArgumentParser(description='MAGGIE framework working with FASTA files') pars...
909cc0378b4c1f28e33a65594db9bbbf1921c44ac44c1feb828c88b34e2f0d5b
Python
6,143
141
"""Define observation extractor class.""" import re import itertools from collections import defaultdict from tqdm import tqdm from constants import * import bioc class Extractor(object): """Extract observations from impression sections of reports.""" def __init__(self, mention_phrases_dir, unmention_phrases...
c119ae56d02d8a1baf0b0581a89e861501a1285a7115b2bd4e2a21cb13a8f863
Python
6,143
166
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_ode.ipynb. # %% auto 0 __all__ = ['ode_solve', 'ODEF', 'ODEAdjoint', 'NeuralODE'] # %% ../nbs/00_ode.ipynb 3 import os, math, numpy as np import torch import torch.nn as nn def ode_solve(z0, t0, t1, f): """ Simplest Euler ODE initial value solver """ ...
dcd7cc35a7135f5e2f03e08065dc8675ab2dbe39d26b292529b18336bc4cc950
Python
6,143
152
# Node-group asset "Evaluate While Planar" (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_...
1768265734df9a0fe45533ede873f53566bbeb21b106fcd93f16fcc2ed7b725f
Python
6,144
197
import torch from torch import nn from torch_scatter import scatter_mean, scatter_add, scatter_max, scatter_softmax class Readout(nn.Module): def __init__(self, type="node"): super(Readout, self).__init__() self.type = type def get_index2graph(self, graph): if self.type == "node": ...
2481d68c1c83970aab129f70d52258264aeb4a492afe7312d791202c8055419b
Python
6,145
162
import unittest from hed.errors import ErrorHandler from hed.models import HedString from hed.schema import load_schema_version class TestBaseTagBase(unittest.TestCase): schema_version = "8.0.0" @classmethod def setUpClass(cls): cls.hed_schema = load_schema_version(cls.schema_version) cl...
fde441d219fa806f58fd086b4f76b4e75659307d8d7ff747d67a00551044d2c4
Python
6,145
174
from functools import partial import torch import torch.nn as nn from torch.nn import Parameter import torch.nn.functional as F class Flatten(nn.Module): def forward(self, x): return x.view(x.size(0), -1) class SELayer(nn.Module): def __init__(self, channel, reduction=16, ret_att=False): sup...