sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
408a93bed59840012464f12a0ebb059958dddf120295c53e4106d62b80b9f7fe
Python
8,756
231
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 12 11:32:51 2018 @author: Carlos A Ariza, PhD """ '''This python script extract Image Features''' import cv2 import pandas as pd import numpy as np from matplotlib import pyplot as plt from pathlib import Path from skimage import measure from pair_...
d992eb00c801ff697d556cc034595dc7bb1edaa803591d012a957296bb5b15d3
Python
8,756
245
import random import os import numpy as np import torch import scanpy as sc import pandas as pd from scipy import stats import scipy.stats as st import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as plt import os import scanpy as sc def make_average(df): dfT = df.T dfT['Index'] = dfT.i...
81f99f31335ee2ad075baddc905d1b2add9e9d18416ae5e5c2f9f5a18276fbd2
Python
8,757
254
# -*- coding: utf-8 -*- # # Update trialdefintions/time axis of Syncopy data objects # akin to ft_redefinetrial # # Builtin/3rd party package imports import numpy as np from numbers import Number # Local imports import syncopy as spy from syncopy.shared.kwarg_decorators import unwrap_cfg from syncopy.shared.parsers i...
e38d83f35ede424f90b05a0148bce5a01ac9aa089522c424d04c6bdd6549087b
Python
8,757
216
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ...
088b0f7d32e02b982fbbf7cb104f9d7ffe9c91c5d6e606d7db4cab146003949a
Python
8,758
244
# Copyright (C) 2019 Computational Science Lab, UPF <http://www.compscience.org/> # Copying and distribution is allowed under AGPLv3 license import torch import rdkit from rdkit import Chem from rdkit.Chem import AllChem from gPPMol.utils import * import numpy as np import multiprocessing import math import random imp...
19cb80bc2e5b5502ddb2c540bd5b1bd2c6b75020d2a74731fd0a6228d97d1109
Python
8,758
267
from abc import ABCMeta, abstractmethod import numpy as np from scipy import sparse import meep as mp ABC = ABCMeta("ABC", (object,), {"__slots__": ()}) # compatible with Python 2 and 3 # ---------------------------------------------------------------------- # Basis is the abstract base class from which classes d...
bb2b434abbae246ea5af3f1425121c24a4b695bb69b625bffab7d096fb87b8d5
Python
8,762
258
import numpy as np import numba @numba.njit def accuracy_cost(x, target_timeseries, weights, cost_matrix, dt, interval=(0, None)): """Total cost related to the accuracy, weighted sum of contributions. :param x: State of dynamical system. :type x: np.ndarray :param target_...
cace53245a725b21b42d34029ba3d083406582793ada7a0aa563a13bce682002
Python
8,762
234
import math import numpy as np import torch from torch import nn from typing import List, Optional, Tuple from .functions import * from .blocks import \ UNetConvBlock, \ UNetUpBlock class GUNet(nn.Module): def __init__( self, in_channels: int, out_channels: int, ...
fa21d68d38a43daf04e40c0c4c043cfbb562ec8df82031eb98d3015f7382ab2f
Python
8,762
253
# 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...
0d90b0c6a4c0766208648a0afddf56db52478b88831e4f7ee3210b2b60e46d52
Python
8,767
147
""" Created on Sun Feb 21 05:22:32 2021 @author: Haotian Teng """ # from bwapy import BwaAligner # from bwapy.libbwa import Alignment import sys if 'bwapy' in sys.modules: raise ImportError("Loading bwapy again will cause error, please restart " \ "the process.") import bwapy import re import...
5f60cf0370b04e59113b3f467ab40e4192955b3997d6dba9da7aaa70ec09029b
Python
8,768
233
# 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...
0eff9d1b89a13cb64b74d421ea8a82d15a7c047600471a35f3626ea020c698d7
Python
8,769
248
""" Unit tests for regtools/registration/core/io_utils.py Covers: - extractNiftiMetadata - loadNiiImages - getMutualInformation / getNormalizedMutualInformation - getDiceCoefficient / getMSE / getPSNR """ import os import tempfile import shutil import numpy as np import nibabel as nib import ...
2a9ee05affc8e9b89cea8c6a9e60184bc2be60c21b2761d562796cc0943bad2d
Python
8,771
199
import numpy as np import pandas as pd from scipy import optimize def get_resting_membrane_potential(voltage, current): voltage = np.array(voltage) current = np.array(current) index_end_resting = None for index in range(5000): current_difference = current[index+1] - current[index...
51ff90a81f303b6be59b0fed1f0b507075afc81f8c1d4521de685d12b74d26af
Python
8,771
257
# 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 applicable law or agreed to in writing, software # distributed under th...
f79cbaf6215b49b8bfab8060ca53f5b8ce4d424bdb6c87ae9cd95f05de496085
Python
8,771
333
# Authors: Jose C. Garcia Alanis <alanis.jcg@gmail.com> # Rhys Hobbs <iskandarrhobbs@gmail.com> # # License: BSD-3-Clause from tqdm import tqdm from joblib import Parallel, delayed import numpy as np from scipy.linalg import pinv from scipy.stats import t from mne.utils import logger from mne.stats.cluster_...
cdb48d2bbc118eaab953427b5f73d612d7e59721ed744536fa2310a0c0c84ac8
Python
8,772
223
#!/usr/bin/env python3 # Diana Giraldo, Jan 2024 # Last update: April 2024 import os, sys from pathlib import Path import argparse import torch import numpy as np import nibabel as nib repo_dir = os.path.dirname(os.path.realpath(__file__)) sys.path.insert(0, repo_dir) from prettier.srr_mri import reconstruct_volum...
890703f17e616ec8a61f09835643d1f06151dff7c325c8e9a0d7b7943c0fe9e2
Python
8,773
269
import sys import time import timeit #import distutils # prefer packaging in future import packaging import h5py #from scipy import stats import scipy.io as sio import skimage.measure import numpy as np import PoseTools # prefer packaging module in future ## MK 20200608 -- Fixing this based on documentation. ## TEST ...
4bc9cd9a384bbd5128025820f7ef3d48cde949af8cafff0f93cc75917f478f02
Python
8,774
210
"""Regression tests for the post-merge RegistrationTab bug sweep. Covers four verified bugs in ``registration_tab.py``: (a) Cancelling a run that used an auto-generated output dir must still surface the "Open Output Folder" button (the pending path was never transferred to the completed slot, leaving th...
cd6a2204f219a79b25e26fb8c2a96a1067c6ffab9f791d803c2da8b0e73bee25
Python
8,775
212
from typing import List, Tuple import torch import torch.nn as nn import torch.nn.functional as F from .mmd_like import _MMDLikeTrainer class WalkerLoss(nn.Module): def forward(self, P_aba, y): equality_matrix = torch.eq(y.reshape(-1, 1), y).float() p_target = equality_matrix / equality_matrix.s...
1ff98cb73e0bb938e734379207489aec18aae096564ba5466f99ccced439dcc0
Python
8,777
171
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import scipy.stats as stats import scipy.signal as signal import matplotlib.pyplot as plt import matplotlib.axes as axes #Scatter plots def bivariable_std(datax,datay,ax,meanx_zero=0,meany_zero=0,stdx_zero=1,stdy_zero=1,mean_axis=1,cmap=plt.cm.Blues,ma...
cfa5158057103a9dc3711993ef7011fb42c746d126d7bc9abf638a52e0b9075d
Python
8,778
245
import io import os import time import torch.distributed as dist import torch.utils.data as data from PIL import Image from .zipreader import is_zip_path, ZipReader def has_file_allowed_extension(filename, extensions): """Checks if a file is an allowed extension. Args: filename (string): path to a fi...
32c3b9dd84370260f6c31517ecc03bd5f69ce0af784ebd8e839c2e2833bff227
Python
8,780
207
# trace generated using paraview version 5.5.1 #### import the simple module from the paraview from paraview.simple import * #### disable automatic camera reset on 'Show' paraview.simple._DisableFirstRenderCameraReset() # create a new 'EnSight Reader' heart_remeshed_3D_MAPSensicase = EnSightReader(CaseFileName='heart...
a1a29a69386206b39c58ddb1ef353dbc294971556526af0417ef5f5170436ffd
Python
8,783
194
import io import os import shutil import unittest from hed import schema from hed.errors import ErrorContext, ErrorHandler, HedFileError from hed.models import Sidecar, TabularInput class Test(unittest.TestCase): @classmethod def setUpClass(cls): base_output_folder = os.path.join(os.path.dirname(os.p...
a4a41886dceeadef5c4302088dd1e25d68ca74464946d4faeb7b6e5a22954669
Python
8,784
237
from __future__ import annotations import copy from functools import cached_property from typing import Iterable, TYPE_CHECKING import numpy as np import pandas as pd from sklearn.compose import make_column_selector from cuppa.components.passthrough import PassthroughTransformer from cuppa.constants import SUB_CLF_N...
da2a515d6e4e64a24f00fff3b775a5dfbf102f32212b65361e2d1eb88d371885
Python
8,785
232
# \file transform_initializer.py # \brief Class to obtain transform estimate to align fixed with moving # image # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date Feb 2019 # import os import numpy as np import SimpleITK as sitk import pysitk.python_helper as ph import pysitk.sim...
4921eb14f98153057cffc04e8a919d57d0a961f7c216852205e75e49f8b4b5bb
Python
8,787
216
# 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...
b66860f0c31f9e4e88befc7f0c9d76a864d8f38d57cefc97e33843644fbb3196
Python
8,788
185
import numpy as np import pandas as pd import pickle as pkl from joblib import Parallel, delayed from sklearn.decomposition import PCA from src.utils import parse_config, logger, DictObj class PCAComputer: """ This class loads individual features and compute PCA matrices for these features, based on all activ...
c6dee4f441bbd77a9615d27c4408385964164efcf45469066c32f4c6c9918db0
Python
8,788
180
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 23 18:43:14 2023 @author: daltonm """ import dill import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import itertools import os from scipy.stats import binomtest, ttest_rel from pathlib import Path from imp...
8320915e71f524c7026d20af3ebaaed71c4e5379b9e89da1dfe69f7fcfb96901
Python
8,791
197
# -*- coding: utf-8 -*- # !/usr/bin/env python3 """ Compute log-odds of answers house for the different generative prior values and the different levels of sensory likelihood. It plots a barplot for the selected experiments (args --experiments). Whether subjects' behavior or ideal observer behavior or both are plotted...
cee8fd79e113e87820ee540c5230bedfd214106da884dc86892089fc59733dd3
Python
8,792
196
"""Registry of deprecated items and the major release that removes each one. Every deprecated item in hedtools is listed in SCHEDULED_REMOVALS with a check that tells whether it still exists. The first test fails as soon as the package's major version reaches an item's removal release while the item is still present, ...
c2e9f66be85d48b1f8ee00edc62e0ab07a33bd3424e519d76ae272e6f18ab1b0
Python
8,794
293
# 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...
decb7d9d571a289a8069a391b67f2d297132be0f1229f55c92de0867b0aa73c0
Python
8,796
211
import argparse import cProfile import os import json import sys import snakemake import time import requests from typing import TextIO from typing import Dict import merlin as m from merlin.core import dataset from merlin.core import executor from merlin.util import snakewriter def build_parser(): parser = argp...
fdb05c48e976dd7b5542b9c7656da7dba36ac6c6f2938017f991f5f7ac15289e
Python
8,802
214
""" 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 """ import numpy as np import matplotlib.pyplot as plt fro...
654b9ea3bffd6ac5c8409ee49c3cb949118defd61085b52fcae1f198fe949074
Python
8,804
182
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 23 18:43:14 2023 @author: daltonm """ import dill import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import itertools import os from scipy.stats import binomtest, ttest_rel from pathlib import Path from imp...
4c78c6bec351231f3641288d8778a349fcf5c0037ab90310fb1b1314968dfa6e
Python
8,806
284
# 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...
db626147c658d1a2f14950859caadce9fd62cfa1afe362b6e036a3eda4e37d28
Python
8,809
223
"""Unix.""" from __future__ import annotations import os import sys from configparser import ConfigParser from pathlib import Path from .api import PlatformDirsABC if sys.platform == "win32": def getuid() -> int: msg = "should only be used on Unix" raise RuntimeError(msg) else: from os impo...
dd79d0236cde7f587481d830977ab27c9d2b4a5aded964960195617c163fccd0
Python
8,810
332
from __future__ import annotations import pytest jf = pytest.importorskip("jobflow") from ase.build import bulk, molecule from quacc import flow, job from quacc.recipes.emt.core import relax_job, static_job # skipcq: PYL-C0412 from quacc.recipes.emt.slabs import bulk_to_slabs_flow def test_tutorial1a(tmp_path, m...
4ebf7faa59f9a9c594d8d85efaa2d9f04e0d2529813f854aeda6e9784357f393
Python
8,812
257
from dreamcoder.program import * from dreamcoder.differentiation import * import signal class EvaluationTimeout(Exception): pass EVALUATIONTABLE = {} class Task(object): def __init__(self, name, request, examples, features=None, cache=False, test_examples=None): '''request: the type of this task ...
8ed8c4816a539b7beba73f0ce7b9d153f14c40833f021b54ef631f05485011b6
Python
8,813
226
import numpy as np import matplotlib.pyplot as plt import pandas as pd """ Created on Mon Jun 24 16:04:07 2019 @author: Hannah Choi """ """ This code is called in main run files to refine hierarchy scores via iterations. """ # In[]: Cortico-cortical iterations def iterativeCC(dfi,dfV,n_iter): ...
b99f36d4f06a42ba248546f07bb134528744ada307ab3a12813bdf27c308977d
Python
8,813
238
import collections import contextlib import functools import os import re import sys import warnings from typing import Dict, Generator, Iterator, NamedTuple, Optional, Tuple from ._elffile import EIClass, EIData, ELFFile, EMachine EF_ARM_ABIMASK = 0xFF000000 EF_ARM_ABI_VER5 = 0x05000000 EF_ARM_ABI_FLOAT_HARD = 0x000...
1d1f0317e00c069f2ad4bfe0fbb53bd04d4d111d4e0c997135343c3b77b9be35
Python
8,814
245
import numpy as np import monai.transforms as transforms import json import math import os import pickle import nibabel from joblib import Parallel, delayed from subprocess import run # inspired by the NVIDIA nnU-Net GitHub repository available at: # https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorc...
2dab6bf778898ae64c1f8d22ba927d0b6ac9dc45ead945a5a1a5c8783971a480
Python
8,816
192
import os from pathlib import Path from typing import Any, Callable, Dict, Tuple, Union import mne import numpy as np from torcheeg.io import EEGSignalIO, MetaInfoIO from .base_dataset import BaseDataset def default_read_fn(file_path, **kwargs): # Load EEG file raw = mne.io.read_raw(file_path) # Conver...
6257ad4929b9a0a595326e170b0459894826dc5cb00664b6e38fdb58d42cc19f
Python
8,816
215
import os, sys sys.path.append('../../4K_HETU/app') import arrayexp import globals.global_func as gf import numpy as np import arrayparams import torch import math import time import logging if __name__ == '__main__': logname = './logs/log' logger = logging.getLogger() logger.setLevel(logging...
ac20881ccc8cbad1285716241afc87417c6359520438343ffdb030831ed8887b
Python
8,816
346
# coding: utf-8 # In[1]: import torch import numpy as np import torch.nn.functional as F import torch.nn from torch.autograd import Variable import torch.backends.cudnn as cudnn use_cuda = torch.cuda.is_available() # In[2]: class E2EBlock(torch.nn.Module): '''E2Eblock.''' def __init__(self, in_...
1b4911fcae864aaf1643015dd1286da370d874c277585c728cea033647c906af
Python
8,817
214
from collections.abc import Sequence import torch from torch import nn from torch.nn import functional as F from torchdrug import core, layers from torchdrug.layers import functional from torchdrug.core import Registry as R @R.register("models.ProteinResNet") class ProteinResNet(nn.Module, core.Configurable): "...
4816f6895d5cadbf3d30345310a63ce91e00fd43960294d09fd55055c3033a51
Python
8,821
257
"""Utilities related archives. """ import logging import os import shutil import stat import tarfile import zipfile from typing import Iterable, List, Optional from zipfile import ZipInfo from pip._internal.exceptions import InstallationError from pip._internal.utils.filetypes import ( BZ2_EXTENSIONS, TAR_EXT...
40218ebc0b97457839fa4615783f820e43a31cb60bff39c9466c79a62097ada0
Python
8,823
212
from __future__ import print_function import os from pddlstream.algorithms.reorder import get_partial_orders from pddlstream.language.constants import EQ, get_prefix, get_args, str_from_plan, is_parameter, \ partition_facts from pddlstream.language.conversion import str_from_fact, evaluation_from_fact from pddlst...
289777aa15e357cdcb00e1cd58558bd431060a6c5c0224c01b1de0e05d94b07c
Python
8,827
291
import math from typing import Literal, Tuple, Union Padding2D = Union[int, Tuple[int, int], Literal["same", "valid"]] IntOr2 = Union[int, Tuple[int, int]] Padding = Union[int, Literal["same", "valid"]] def linear_output_shape(N: int, out_features: int) -> tuple[int, int]: return N, out_features def conv1d_out...
9517100cbc08e21365efdfcdb347a338ba806237a517da474815939d9a988815
Python
8,830
302
#!/usr/bin/env python3 """ m6a_supervised_cnn.py Author: Anupama Jha <anupamaj@uw.edu> This module predicts whether an adenine is methylated or not. The model is trained with Fiber-seq HiFi read sequence, inter-pulse distance and pulse width signal from pacbio. The model is a convolution neural network. """ import tor...
0aea5937b07611b9fd3248e716fe6aed8b397fb97f9f11af5e7198a4cb14c36b
Python
8,831
231
# # 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,...
df841bb5b6c4a3ac4123246489dc741d53ffdd97e75db0b455533ee192b97a42
Python
8,831
219
"""Smoke tests for regtools/registration/compose_deformations.py. The full composition flow invokes ANTs ``apply_transforms``, which is too heavy for a unit test. These tests mock ``rg.antsTransformation`` so the helper logic, shape resolution, and Laplacian path can be exercised on tiny synthetic data. """ ...
09b7e00531fcc0d1b89ec32fe14f79875d832a1df7e4b0fdad3359b78b422b8a
Python
8,833
197
"""User preference persistence for the CCF boundary editor. Editor settings (mode toggles, brush radius default, per-region radius memory) used to be five separate ``self._foo`` bools cluttering ``__init__`` and resetting to defaults on every launch. This module collects them into one dataclass and round-trips th...
51da52da3b7d8991a167f18efdefc42eae2e0c4ee7fdcdb2a1d12327eb2199b0
Python
8,833
186
""" Created on Fri May 20 14:53:39 2022 @author: Haotian Teng """ import os import sys import toml import torch import argparse import itertools import numpy as np from tqdm import tqdm from typing import Dict,List from xron.utils.seq_op import Methylation_DP_Aligner from xron.nrhmm.hmm import GaussianEmissions, RHMM...
4df5586e022a184db049835b672ea5c1f1cea823914dd13e664cb1483352c77d
Python
8,838
241
"""Testing CLI command find.""" import subprocess import os def test_all_nodes(): """Tests for returning all nodes.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'find', 'pass_simple_branch.swc'], stdout=subprocess.PIPE, ...
52f4b140bd29e2ef2ada425776a28df60ece660683be456936834b0f508f36b0
Python
8,838
253
# 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...
b5aa6d47b00d4270c05b3e055aff2f9fcfc0b2096485d92dc61cf076048bf45f
Python
8,838
85
#! /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, geometric_mean from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run BENCHMAR...
0cbf1af9f12f37599ad999ca06f6d70697140d568b077903f9df9c294775b0ec
Python
8,842
256
from string import Template as _pyTemplate from typing import Any, Mapping, Protocol, Self, cast from elasticai.creator import template as tpl class Template(Protocol): def substitute(self, mapping: dict[str, Any] = {}, /, **kwargs) -> str: ... class _Definition(tpl.TemplateParameter): def __init__(self, t...
459c9a989e166e831660fb27d0c0924570cde9b0662b8e2748898db36da46788
Python
8,842
235
import os import torch import h5py # from network.D2NNet import D2NNet from network.ddnn import ddnn from network.led_nn import led_nn from network.basic_nn import basic_nn from utils.loaders import dataset_loader, grab_testdata, save_object, net_load from datetime import datetime def train(model, optimizer,...
01213e4308c521e1914d8931d40f8e4b0d4102eec75727a226f9a4a0db929943
Python
8,843
189
# 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...
2040fe217ebf48345114281c5ccd1a7e7431e07eef3460732806c24c3d7ba980
Python
8,844
213
from typing import Optional from netket.operator import AbstractOperator, Adjoint from netket.vqs import VariationalState, FullSumState from netket.utils.types import DType from .overlap import InfidelityOperatorUPsi, InfidelityUPsi import warnings def InfidelityOperator( target: VariationalState, *, U...
242be133ad5db48022a5c79c00f243991292cef86b3fe68a03bd7b6878ce390f
Python
8,844
223
from __future__ import annotations import pandas as pd from sklearn.compose import make_column_selector from cuppa.constants import SUB_CLF_NAMES, META_CLF_NAMES from cuppa.components.calibration import RollingAvgCalibration from cuppa.components.feature_selection import Chi2FeatureSelector, MaxScaledChi2FeatureSelec...
c3084186995d60b1124fcad5446183cee74acc9612a56f6312549a86ca6b311b
Python
8,848
339
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ### Connectivity matrix utilities import numpy as np import numpy.linalg as linalg from scipy.io import loadmat import networkx as nx def loadConnectome(No_nodes, filename='../input_data/AAL_matrices.mat', field='C'): """ Load a square connectivity matrix Pa...
ca1ead66d7c22ef6fd321cde5628ba4e11bb2fdeae1aeee80327b12f274d7032
Python
8,850
257
""" eCCA ==== This script shows how to use the reference pipeline for c-VEP decoding (see [1]_), which learns templates by averaging repeated trials and spatial filters by using canonical correlation analysis (CCA). This method is implemented as eCCA in PyntBCI. References ---------- .. [1] Martínez-Cagigal, V., Thiel...
f59b8432e87aeff69650985021048bbb4f3a1bc162a02b943ccdfccddc3c4c3c
Python
8,850
266
"""Radiation pattern of an on-axis dipole in cylindrical coordinates. Tutorial Reference: https://meep.readthedocs.io/en/latest/Python_Tutorials/Near_to_Far_Field_Spectra/#radiation-pattern-of-an-antenna-in-cylindrical-coordinates """ import argparse import cmath import math from typing import Tuple import matplotl...
51281b522ca7f3cf5beacdf9afe16d91f32b6e30712733930dfc0db5d48d8711
Python
8,852
275
""" ============================================= Plot results of multivariate pattern analysis ============================================= Creates figures to show classifier performance at multiple time points of the EEG epoch. Authors: José C. García Alanis <alanis.jcg@gmail.com> License: BSD (3-clause) """ import...
174c26d78c59e5c4f49c6bb723adc3ac1c75ca336e93ac0fd13961e8a4b7529b
Python
8,853
236
import json import logging import os import pathlib import time from threading import RLock from typing import Union, List import boto3 import requests from botocore.exceptions import ClientError from pydantic import BaseModel, Field, ValidationError from NDATools import exit_error from NDATools.Utils import get_requ...
feb922dd30567071021125d3619525c80dc4460a31d2e1a1527b6fb4345965c0
Python
8,853
241
"""Testing CLI command find.""" import subprocess import os def test_all_nodes(): """Tests for returning all nodes.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'find', 'pass_simple_branch.swc'], stdout=subprocess.PIPE, ...
25da90af2e4e53c819bb170fa3543321912f0dc1b9deb6049597dea98ed29e20
Python
8,855
241
"""Testing CLI command find.""" import os import subprocess def test_all_nodes(): """Tests for returning all nodes.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'find', 'pass_simple_branch.swc'], stdout=subprocess.PIPE, ...
f9391c9c7cf03ef0379c052ceb4a6109ab2177bbffed9ae433d8ef4e137a6976
Python
8,855
347
#!/usr/bin/env python # coding: utf-8 # ## Visualization of f-statistic distributions for selected features # In[1]: import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import pancancer_evaluation.config as cfg import pancancer_evaluation.utilities.ana...
c256ee767a4cbdf6ce8aea26ae13760bdfa20d785689001c5ce8486775fe2105
Python
8,858
189
# coding=utf-8 # Copyright 2020, The RAG 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...
d3c12dc37a85a4575e40ce62941fa45ca18067002cfe16b418de54df1d2bd6e9
Python
8,858
258
""" Handling of Core Metadata for Python packages (including reading and writing). See: https://packaging.python.org/en/latest/specifications/core-metadata/ """ import os import stat import textwrap from email import message_from_file from email.message import Message from tempfile import NamedTemporaryFile from typin...
424f5f3e9199a9ff129058b1e02c4df209afa34221897e4da909f9782b494687
Python
8,860
237
# # 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,...
a930f661b01b25df7214088415cf84ce9f9c1462f2d93d24fd84a68142c1599d
Python
8,860
230
from os import path as op from stormdb.access import Query import pickle import numpy as np from scipy import stats from mne.stats import spatio_temporal_cluster_1samp_test, spatio_temporal_cluster_test, fdr_correction, ttest_1samp_no_p from sklearn import linear_model from sklearn.impute import SimpleImputer as Impute...
d907cd8d29aa1cff0cc6fb7b2020bdc15c862593153494b5065ef7339eca3345
Python
8,861
282
#!/usr/bin/env python # coding: utf-8 # ### Comparison of optimizers for LASSO parameter range experiments # # sklearn has 2 ways to fit logistic regression models with a LASSO penalty: [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) (using the libl...
e80c1718ded4fed517931313795b0a58303f8f0fef0f47a82260f0c2ccea949d
Python
8,861
231
# 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...
f2a7d537846ac75dd306e7484ec87996aca6e52a523c3f76d8817be5f509d4d6
Python
8,861
217
#!/usr/bin/env python # Copyright (c) 2018-2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module contains the result gatherer and write for CARLA scenarios. It shall be used from the ScenarioManager only. """ from...
db9047dbba76fe0f266a2d082bfbe7f9684d20ce36a00020e8065887db8a5832
Python
8,862
181
# Dominance analysis, following math here: https://github.com/dominance-analysis/dominance-analysis # C. Cocuzza, 2021 # This version is flexible to inputting difference sources # Multiple regression model to test how each network influences the explained variance (accuracy) of the act-flow prediction. # So, the IVs...
839895f7f374aaba1b4697aca3b5adcee6462e22c242971ea2a59f3f96b5e61c
Python
8,864
227
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from _negative_binomial import ZeroInflatedNegativeBinomial from dataclasses import dataclass, field import numpy as np import pdb @dataclass class ModelConfig: """ Model configuration for crispAI models -...
4ffe37a2c788c7dca357460f89ea91c673f193631fbdf94109a49031cde57af2
Python
8,868
250
#!/usr/bin/env python3 # coding: utf-8 from __future__ import division """ Creates a MobileNet Model as defined in: Andrew G. Howard Menglong Zhu Bo Chen, et.al. (2017). MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications. Copyright (c) Yang Lu, 2017 Modified By cleardusk """ import...
826922a582f2f7157928730ffaab8fd843c9a46c1c1c2d8dbc33c377be25a6d0
Python
8,868
229
import os import numpy as np import h5py from ...utils.collections import dotdict def loadDefaultParams(Cmat=None, Dmat=None, lookupTableFileName=None, seed=None): """Load default parameters for a network of aLN nodes. :param Cmat: Structural connectivity matrix (adjacency matrix) of coupling strengths, will...
238651869dc884844a50e0bd4e0c5876cc9e0f8b6aa092ce33594ebcdc0ca620
Python
8,869
231
import torch.nn as nn import torch.nn.functional as F from layers import GraphConvolution, GraphConvolution2, InecptionGCNBlock, GraphConvolutionBS, snowball_layer,GCN from GCN import snowball, truncated_krylov, graph_convolutional_network import numpy as np from torch.nn.parameter import Parameter import torch import...
9bfbdb28c2fc3ccc70b034df98e3c5a10b2dcc3c901dce7cf93661709a70cfff
Python
8,869
499
from __future__ import annotations import re from collections.abc import Iterable, Mapping, Sequence _NUMBER_RE = re.compile( r"[-+]?(?:\d+(?:\.\d*)?|\.\d+)" ) def normalize_metadata_field( field_name: object, ) -> str: """ Normalize a metadata field name for semantic matching. Examples --...
dc8e04e784213108715a23222c736e069752b10ecb8d6fe9994d12ea1f5c4f4c
Python
8,871
269
import warnings from typing import Optional, Tuple, Union import torch import torch.nn.functional as F from torch.distributions import Distribution, Gamma, Poisson, constraints from torch.distributions.utils import ( broadcast_all, lazy_property, logits_to_probs, probs_to_logits, ) # The functions her...
51a26e22b456fd5364db1f081b00bbf4999b374c5301181458d85c73024f1995
Python
8,872
266
import sys from collections import defaultdict as d import re from optparse import OptionParser, OptionGroup #Author: Martin Kapun #Modified by: Siyuan Feng ######################################################### HELP ######################################################################### usage="""python %pro...
2fe1bf0b9eaa59f5c7de9163bde3c5948aad4cc87f762fc265e83b24fae54c7c
Python
8,873
233
import warnings import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import pytest from SurvivalEVAL import CompetingRisksEvaluator, one_calibration_cr from SurvivalEVAL.evaluations.calibration.single_time import one_calibration @pytest.fixture def grouped_data() -> tuple[np....
e4842594caf1e9b0ef40e5ca5f10f39c39edb2d91892b5b82b3b6ca63a23a77e
Python
8,874
251
## # \file export_side_by_side_simulated_vs_original_slice_comparison.py # \brief Script to generate a pdf holding all side-by-side comparisons. # # This function takes the result of simulate_stacks_from_reconstruction.py as # input. The script relies on ImageMagick. # \author Michael Ebner (michael.ebner.14@u...
b4669a367474d37070c25aeb4cbb5633dc8277277a0b167034a1ce5b39c9835f
Python
8,877
184
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from skimage.transform import resize import matplotlib import numpy as np import comparison_datasets import torch plt.rcParams.update({'font.size': 20}) color_map = matplotlib.colors.LinearSegmentedColormap.from_list("", ["white","red"]) normal_c...
e835acaaef11ce35f94ceabd164f32d2a18f42c8117f71675e40789058410af2
Python
8,877
225
# Functions for performing classification of prefential parameters and # preferred corticospinal wave import numpy as np from sklearn.linear_model import LogisticRegression from sklearn.model_selection import RepeatedStratifiedKFold from sklearn.svm import SVC np.random.seed(149) # Identify nodes that were s...
56004e5eb906c78711b60ec9df99459122beaac7a3e84e38359ac9c770f87c44
Python
8,878
220
#!/usr/bin/env python from irescue._version import __version__ from irescue._genomes import __genomes__ from irescue.misc import writerr, versiontuple, run_shell_cmd from irescue.misc import check_requirement, check_tags from irescue.map import makeRmsk, getRefs, prepare_whitelist, isec, chrcat from irescue.map import...
b56803df44188e67cbabc6c3c192b77d89143b82f9d7157edd4c64ddaae9d37c
Python
8,879
221
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import sklearn as skl from sklearn import metrics as sklm def convert_to_numeric(data): df = data.copy() columns = df.columns df_new = pd.DataFrame(columns = columns) for i in columns: new_values = pd.t...
0dbafeecde786244e5a1f0f7c99f4e30c3ad2ac89897ce9ec62653113355cd8e
Python
8,881
213
import pandas as pd import numpy as np import random from sklearn.impute import SimpleImputer from sklearn.impute import KNNImputer from sklearn.experimental import enable_iterative_imputer from sklearn.impute import IterativeImputer from sklearn.linear_model import LinearRegression from impyute.imputation.cs import ...
46d8e68468d9529c0d34ae5d0d1b38bc3aaf308e5eb7d4380d4150c79e03c1e3
Python
8,881
172
import os import pandas as pd import numpy as np from nilearn.glm.first_level import make_first_level_design_matrix from nipype.interfaces.fsl.model import SmoothEstimate from glob import glob def smooth_estimate(img_paths, mask_path, out_path): """ Estimate smoothness parameters for a Z-statistic image. ...
c310273e7823a0dead752764f8bf23ed0e5ea769ade8f5e098257d50699cf847
Python
8,881
267
from contextlib import contextmanager from pathlib import Path import bmesh import bpy import databpy as db import numpy as np def path_resolve(path: str | Path) -> Path: if isinstance(path, str): return Path(bpy.path.abspath(path)) elif isinstance(path, Path): return Path(bpy.path.abspath(str...
07c80aa3302fe50c670809584501f1b39494cd59fb1d9228f1baba6df05e38e3
Python
8,891
191
import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.autograd import Variable import torchvision.transforms.functional as VF from torchvision import transforms import sys, argparse, os, copy, itertools import pandas as pd import numpy as np from sklearn.utils import shuffle from sklear...
13ad0cdf40f0cac796ccda4005310a06b1919b83c0299a2e5784f3a1eb0212fa
Python
8,894
220
import sys import APT_interface as apt import TrkFile import link_trajectories as lnk from poseConfig import conf import argparse from pathlib import Path import numpy as np import tempfile from TrkFile import to_mat import hdf5storage from scipy import io as sio def parse_args(argv: list): parser = argparse.Arg...
9b1b9f99d043426eeedba41344a939e9d3a96670f906f83957cc80207b2c09cd
Python
8,894
288
"""""" from collections import deque from queue import Queue import logging import warnings import cv2 import numpy as np from pupil_recording_interface.decorators import process from pupil_recording_interface.process import BaseProcess from pupil_recording_interface.externals.gaze_mappers import ( Binocular_Gaze...
5ded06e039c287e27c87f081a5868aca7e8c6ca4e9e78db70e37720c7b8fc46c
Python
8,895
226
""" Bonito train """ import os import re from glob import glob from functools import partial from time import perf_counter from collections import OrderedDict from datetime import datetime from bonito.schedule import linear_warmup_cosine_decay from bonito.util import accuracy, decode_ref, permute, concat, match_names...
6e843608c197cbc218480dabb3beb1fd411fb3df663ceff055b5cbf60fb093df
Python
8,895
184
""" INVARIANCE_LADDER.py - written 2026-09-14. Rewritten the same day after the first version's own prediction was FALSIFIED. The falsification is kept in section 0, because it is where the result came from. THE POINT OF THIS FILE ---------------------- Everything else in this project MEASURES a disagreement. Th...
afa5cb22bfcfdd47f8072e327bdde247d099d9e60e037fd9390b48f80803f940
Python
8,895
286
# 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...
871231f5961ad527890a41af3192d08d052ac82d4422771795c4b0a011da2839
Python
8,896
253
#!/usr/bin/env python # # Copyright 2009, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...