sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
d871806e3bfef067d1d452005a7be9ce37adbc51e44d1bd6e9c331d840a256da
Python
21,629
636
# Created by: Marc Canela from pathlib import Path from typing import Dict, Tuple, Union import matplotlib.pyplot as plt import numpy as np import pandas as pd from imblearn.over_sampling import SMOTE from scipy.stats import entropy from sklearn.cluster import KMeans from sklearn.decomposition import PCA from sklearn...
39fcbfb9be8b82185c739dcb276cc4a258c0a39fa38348ccd346f18e57e1f697
Python
21,631
499
import slicer, vtk import numpy as np from io import StringIO import warnings # # Feature # class Feature(): def __init__(self, name, projectTo, exportXYZ): self.name = name self.projectTo = projectTo self.exportXYZ = exportXYZ def addSourceNode(self, sourceNodeID, property, visible): shNode =...
2a4e33b92cc32fd346c1a4078698793cd3ef5e443bdacfc73a7b89e29a25b826
Python
21,633
486
from collections.abc import Sequence from decorator import decorator import copy import math import types import inspect import torch from torch import nn from torch import autograd from torch_scatter import scatter_add from torchdrug import core, layers, utils, data from torchdrug.layers import functional from torc...
a7c22b5f236b702aa3342a1c5590b3b03c9e8f4cfb8d44f640282c4dd4c33582
Python
21,640
671
# -*- coding: utf-8 -*- """ Created on Wed Aug 16 11:25:30 2023 @author: DELINTE Nicolas """ import numpy as np from tqdm import tqdm from sklearn.cluster import KMeans from dipy.io.streamline import load_tractogram, save_tractogram from unravel.utils import tract_to_ROI, xyz_to_spherical, get_streamline_density fro...
e8fe36959a8b661d67f1bc115fc4d351343ee4a19c829e6ce9e0f8532f4aa11e
Python
21,641
511
import matplotlib.pyplot as plt import matplotlib.ticker as ticker import jax.numpy as jnp import jax import os import json import sys import glob import matplotlib.colors as mcolors from matplotlib.colors import to_rgba from collections import Counter from scipy.stats import gaussian_kde plt.rcParams["font.sans-s...
7cd943635bf909ede855ad72d5630ce52e4cb9eb5cf0b359a00397b59a98741d
Python
21,659
517
import sys, math import numpy as np from Parameters import * ###################### ##### GLOBAL ##### ###################### s1, s2, W, V, H = '', '', None, None, None MULTIPLE_HAIRPIN = True MAX_LOOP = 9999 MAX_SEQ_LENGTH = 100 V = np.zeros((MAX_SEQ_LENGTH, MAX_SEQ_LENGTH)) W = np.zeros((MAX_SEQ_LENGTH, MAX_S...
45aa20d469c7defaf6e72db230f63d216021358d1d8acd456427f5b551e3585e
Python
21,679
484
import argparse import time import warnings import torch import os, time import sys import yaml import wandb import datetime import logging import random import numpy as np import pandas as pd import transformers import json import torch.nn as nn from tqdm import tqdm from torch.utils.data import DataLoader from typing...
d0a109a013b353ec3e98c42ef5061a32152a72b181c4199e465d21bfc34fbc82
Python
21,697
639
from collections import defaultdict from typing import Any, Dict, Iterable, List, Literal, Optional, Tuple, Union import torch from torch import Tensor from torch.utils.dlpack import from_dlpack, to_dlpack import torch_geometric from torch_geometric.utils.num_nodes import maybe_num_nodes def to_scipy_sparse_matrix(...
75441a5c0fbdba40694a4e0efa4e24cc688686abac5ed8f47883cccd004f79dc
Python
21,707
462
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ Local streamline HARDI tractography using scilpy-only methods -- no dipy (i.e no cython). The goal of this is to have a python-only version that can be modified more easily by our team when testing new algorithms and parameters, and that can be used as parent classes ...
04e01417daadbfd679e67ce84fddf8bdfa01235d5f7216caddf4af693a7c20cb
Python
21,708
553
import importlib.util import json import os import shutil from pydantic import BaseModel, Field, model_validator, field_validator from typing import Union, Optional, Any, List, Type from chemgraph.schemas.atomsdata import AtomsData from chemgraph.schemas.calculators.emt_calc import EMTCalc from chemgraph.schemas.calcu...
17bcfa82cd95fb0bfe9fc74a30bd4ce7d576b0be71fee159f58a46f437abcdcb
Python
21,711
753
import os import h5py import logging import unittest import pandas as pd import numpy as np from numpy.testing import assert_array_equal from heig.sumstats import check_input, map_cols, read_sumstats, GWAS, GWASLDR, GWASY2 MAIN_DIR = os.path.join(os.getcwd(), "test", "test_sumstats") log = logging.getLogger() log.set...
c549a73ee20462dd5c71be98b2d54e8c999ea82e1ddf20df24744c08f519468a
Python
21,712
531
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import numpy as np from ultralytics.cfg import TASK2DATA, TASK2METRIC, get_cfg, get_save_dir from ultralytics.utils import DEFAULT_CFG, DEFAULT_CFG_DICT, LOGGER, NUM_THREADS, checks, colorstr RAY_SEARCH_ALG_REQUIR...
012614ee16277b365a907b1b4e05bba29f628c5de1a078e3e517e04a55f7e734
Python
21,721
524
""" (C) Copyright 2019 IBM Corp. 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 ...
4fb6088f7f8ac697109d7858412d7b6d1ca238c23d8f9df1839563013679b804
Python
21,727
553
#pylint: skip-file #type: ignore """ Implementation of the context dependent reach task """ import time import math import typing import asyncio import logging import datetime import numpy as np import os import stl from . import task_context from .widgets import Form, ListAsTabsWidget from .util import wait_for, wai...
7cef74d041d057669474acd2e7d11e2d8e10b784fc71a160f1d121a5658dce61
Python
21,728
568
"""The FunctionGui class is a Container subclass designed to represent a function. The core `magicgui` decorator returns an instance of a FunctionGui widget. """ from __future__ import annotations import inspect import re from collections import deque from collections.abc import Callable from contextlib import conte...
5bbaf31adf2ebe446f14030fec481c6724e74e5b7314b758c0fce5d937de8d5c
Python
21,734
568
# Copyright (C) 2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import json import operator from collections.abc import Iterable, Iterator from functools import reduce from textwrap import dedent from typing import Any, TypeAlias from django.db import models from django.db....
89041bd42272c544afc0f323129ab9c475c11bd1774e7edb9a8b3d48032de9a0
Python
21,734
470
"""Hermetic usage accounting across providers, storage, and graph execution.""" from concurrent.futures import ThreadPoolExecutor import uuid import pytest from langchain_core.language_models.fake_chat_models import FakeMessagesListChatModel from langchain_core.messages import AIMessage, AIMessageChunk from langchain...
205df60889415cbc60d26177aa363ef28bc2f28fea608bff47673b6950a8a5c1
Python
21,739
330
""" If you use this code, please the SynthSR paper in: https://github.com/BBillot/SynthSR/blob/master/bibtex.bib Copyright 2020 Benjamin Billot 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:...
be17430977288bda951d8e5b1689ca4b6d346340c0b998f28a5082a3dc1095b1
Python
21,741
549
# Copyright 2024 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
e1f1e30d7f95cb8121be9c0b562106b4092f578389fd133e692b08e5cdfb8b69
Python
21,744
670
from tierpsy.gui.HDF5VideoPlayer_ui import Ui_HDF5VideoPlayer import sys import tables import os import numpy as np from functools import partial from tierpsy.analysis.compress.Readers.readLoopBio import readLoopBio from PyQt5 import QtWidgets, QtCore, QtGui from PyQt5.QtCore import Qt from PyQt5.QtWidgets import Q...
3fbfe11d630a8378637ad8b3d246e9d276c4c4abf33174ec161216e5b10aab02
Python
21,765
426
# -*- coding: utf-8 -*- # @Author: Jie Yang # @Date: 2017-12-04 23:19:38 # @Last Modified by: Jie Yang, Contact: jieynlp@gmail.com # @Last Modified time: 2018-12-16 22:15:56 from __future__ import print_function import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F...
c6f709bab66f5b86b4708ee8935198944a8cb20ed9711afeef1e16d20e9a5aa5
Python
21,781
752
"""Generate a QC summary HTML report from pipeline plots.""" from __future__ import annotations import html import json import shutil from pathlib import Path from datetime import datetime STEPS = { 1: { "name": "Preprocessing", "subpanels": [ { "name": "PSD", ...
5159bb8020f85eed2e08de3579e99a56d036151f18930eab0a9e8727a396ed5f
Python
21,783
546
""" ENIGMA-style cortical surface plotter for AAL atlas on fs_LR 32k space. Loads fs_LR 32k inflated surfaces and AAL 32k label files, maps per-ROI statistic values to vertex-level scalars, and renders publication-quality views with ENIGMA-like matte directional lighting and medial wall masked in white. It produces o...
a48580d836983fdaae5b2436b9eb5c5f3dde7eedd12ace3eee48cc06f3fb28f8
Python
21,792
693
# Created by: Marc Canela from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import pandas as pd from scipy.stats import uniform from shapely.geometry import Polygon from skimage.draw import polygon from skimage.feature import graycomatrix, graycoprops, hog, local_b...
fd51e8fbb8048f506d03472fe2db9a3494076337053d1071aa138d79bfff4831
Python
21,800
642
import asyncio import random import time from collections.abc import Sequence from concurrent.futures import ThreadPoolExecutor from contextlib import contextmanager from math import isclose from pathlib import Path from typing import TYPE_CHECKING, Any import numpy as np import pandas as pd import pytest import torch...
ae102ae5817e60c05465e28a097447537d2b92155e2680c07a1128d7988d9a7a
Python
21,805
635
import matplotlib.pyplot as plt from matplotlib import cm import numpy as np import torch def plot_selected_cell_type_flow( pcloud_list, model, device, finaltruth, selected_cell_type, arrow_sample_size_per_type=55, xlim=(-0.2, 1.5), ylim=(-0.5, 2), height_scale=1.0,size=1,alpha=1,save_path=None ): fi...
22fd6c50040d4951a4423d871214ca87a95c2f02215bd5edc2d512ef99831b47
Python
21,823
515
#alg_name = 'mlp_cs' import os os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1 os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1 os.environ["MKL_NUM_THREADS"] = "2" # export MKL_NUM_THREADS=1 os.environ["VECLIB_MAXIMUM_THREADS"] = "2" # export VECLIB_MAXIMUM_THREADS=1 os.envi...
237fd4e711270b53ceefe992297b4bdbf150dc6e46af3f8cd64ecc91996f3794
Python
21,827
795
# !/usr/bin/env python # -*- coding: utf-8 -*- ''' @Author: Yong Bai, yong.bai@hotmail.com @Time: 2022/10/19 15:42 @License: (C) Copyright 2013-2022. @File: cci_analysis.py @Desc: ''' from typing import Union import numpy as np import pandas as pd import squidpy as sq import scanpy as sc from scipy.stats import entro...
5545658daa20c5e8412e83f237b34003b0f3d5de2c83f06a3b0755356ef8f02b
Python
21,833
593
import pandas as pd import sys import os from glob import glob import anndata as ad import scipy.sparse as sp import anndata test_name_to_expectations = { "no_edits_edge_case_test": { "folder": "strandedness_tests", "total_edit_sites": 0, "expectations": [] }, "edge_case_test": { ...
2c61247b061cfc8532542a627351e8816b75acb3eb16bcdbf45d2cfcd69cd963
Python
21,838
490
import pdb import numpy as np import glob import os from os.path import join import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from labellines import labelLine, labelLines import seaborn as sns import math from statannot import add_stat_annotation import pickle def ...
5f1d932506949402144dc325c35ef38800715b8f4f3ea195f0434458bc0437b7
Python
21,842
600
import torch from torch import nn from torch_geometric.nn import RGCNConv,FastRGCNConv,GCNConv,GATConv import torch.nn.functional as F class BotRGCN(nn.Module): def __init__(self,des_size=768,tweet_size=768,num_prop_size=5,cat_prop_size=3,embedding_dimension=128,dropout=0.3): super(BotRGCN, self).__init__(...
c360b5be84981ace1b99a08d6e39761b80ce2beef52a710a19f25707dc56d3e9
Python
21,848
483
"""Assembling the one table every statistical analysis in step 5 is run on. MATLAB's ``doStats``/``doClassification``/``doLDA`` each take a ``recordingLevelData`` table that ``MEApipeline.m`` builds inline, and each re-derives the things they need from it — which columns are metrics, which recordings belong to the sam...
5049214683feedab5e88c76a98f4de2f82525ce7f8f7e16536728d3166a2fdd8
Python
21,860
594
# -*- coding: utf-8 -*- from importlib.resources import files import json import logging import os import tqdm import numpy as np from scipy import ndimage as ndi from scipy.spatial import cKDTree from scilpy.tractanalysis.reproducibility_measures import compute_bundle_adjacency_voxel SCILPY_LUT_DIR = files("scilpy"...
97bc42762f90548825ba5c55e2b4962c6f6ba2a51371f6b9f533bb0dc8460523
Python
21,864
562
import sys from pathlib import Path import os sys.path.append(str(Path(os.path.abspath(__file__)).parents[3])) # limit CPU load for the server os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1 os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1 os.environ["MKL_NUM_THREADS"] = "2" # ex...
162c612980d35c34de2acbcc44983f9a253c8da9496577f21c283e6778d00409
Python
21,867
485
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import numpy as np class KalmanFilterXYAH: """A KalmanFilterXYAH class for tracking bounding boxes in image space using a Kalman filter. Implements a simple Kalman filter for tracking bounding boxes in im...
c6a7716466936d76a2688a00da64ee996a554fca4fe09bbb06eebcf7d59e593a
Python
21,893
696
# -*- coding: utf-8 -*- # python standard library inputs import os import datetime import warnings import subprocess import functools import shutil as sh from shutil import copyfile from abc import ABC, abstractmethod # external inputs import numpy as np from scipy.stats import norm from scipy.sparse.linalg import ex...
aaecd50274d87c0c15c599503155b771389fa14ff9b88be84472750d6b83ad63
Python
21,912
558
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
b27fcff53a8e19b80dcbdd271895c8125ec90d41abc6aa36f274bd33ba7cbc9b
Python
21,912
564
import json import os import re import sys import numpy as np import pandas as pd import tables from PyQt5.QtCore import QPointF, Qt from PyQt5.QtGui import ( QPixmap, QImage, QPolygonF, QPen, QPainter, QColor) from PyQt5.QtWidgets import ( QApplication, QFileDialog, QMessageBox, QWidget, QPushButton) from ti...
586641c6b03e9e53cb62de90d5f01957b4b267209ed109f58b9802d7788a74d7
Python
21,932
549
#!/usr/bin/env python """ This module enables the processing of camera frame(s) with operations like averaging, slicing, etc.. It is also responsible for keeping tracking of how many different cameras / feeds are available for each parameter file, whether the cameras / feeds should be saved when filming and what exten...
d40d39cd0fcebd3cfe29e3899f67bc13183fa6e139157d2e8a8b2bcaabff7b02
Python
21,937
561
import numpy as np import scipy as sp import matplotlib.pyplot as plt from skimage.feature import peak_local_max import pandas as pd from IPython.display import display from .utils import stat as stat from .utils import filters as flt from .utils import util from .utils import vis # import NFT.linking as NFTLinking ...
de3ef3d366f65f96083849f9a13af28668c16f158a9c79e882aa8593d06d8ba0
Python
21,945
440
#!/usr/bin/env python from __future__ import print_function import os import json import argparse import csv import re import sys import urllib.request import errno import gzip from collections import OrderedDict def prRed(skk, f): print("\033[91m{}\033[00m" .format(skk), file=f) def prGreen(skk, f): print("\033[92m{...
c783c63dcab8af2de916374f487ddb9caa762fd3a2977636eaefee89fb3e5c47
Python
21,949
601
# Copyright 2024 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
29c968b293e5ef25bb60c0a5a09fa10ebf130e6c8a5aaed07ee39dcb566a4f6f
Python
21,958
575
# -*- coding: utf-8 -*- """ Analyses of the EMPRISE data set by Joram Soch <soch@cbs.mpg.de> """ # import modules import os import time import shutil import NumpRF import EMPRISE import numpy as np import scipy as sp # import pandas as pd # import nibabel as nib # import matplotlib.pyplot as plt ### linear-model cv...
4321884f822f42ad0c4f8baa5091eab215d19468db37dd3875c3b9e1f61cf2f5
Python
21,959
537
""" Gated Recurrent Unit """ from typing import Callable, Union, Optional import braintrace import brainstate import brainunit as u import jax import jax.numpy as jnp import numpy as np __all__ = [ 'FiringRateState', 'SpikeFunction', 'EGRU', 'MergeEvents', 'Network', ] class FiringRateState(bra...
96b9d93f255ccaec77a11eda32dbe4a90a48300902149a254cab6aaf3becd6fb
Python
21,960
573
import os import csv import re from typing import Tuple import tkinter as tk from tkinter import messagebox from tkinter import font as tkFont from PIL import Image, ImageTk from util.config_vars import config class ManualImageEvaluator: """Evaluation GUI for manual labelling of defacing success.""" def __ini...
11111252b98b26fd6bfd92cacee0a99833e5b85b66a0b5d54c3f0e3dde6c6f4e
Python
21,963
562
"""Tests for mcmlnet.utils.tensor module.""" import numpy as np import pytest import torch from mcmlnet.utils.tensor import ( array_conversion_decorator, convert_to_numpy, convert_to_torch, tensor_conversion_decorator, ) class TestBasicMethods: """Test cases for basic conversion functions.""" ...
cb7bc6f8de0aa49ffded3b812696625776c4dc71efbfc47de686b0909bdaee7c
Python
21,963
495
import os import h5py import itertools import numpy as np import datajoint as dj from commons import lab from scipy import ndimage from pipeline.utils import h5 from datajoint.hash import key_hash from .exceptions import PipelineException from pipeline import meso, stack, mice, experiment, shared #dj.config['extern...
e8f739356998521cd6e2cf00299915605dade1a17ddbd797175c3ea66b08753e
Python
21,965
149
import math import numpy as np import pandas as pd import networkx as nx import matplotlib.pyplot as plt from numpy import array import os def sign(x): y = 0 if x == '6': y = -1 elif x == '9': y = 0 elif x == '1': y = 1 return y def xs(x, y, w): if len(x) == len(y) ==...
90f8b14c8a1aa086288b248a8cc79f58f099c8b8f7c442ecd813ac686c0ebaa2
Python
21,981
646
import asyncio import random import time from collections.abc import Sequence from concurrent.futures import ThreadPoolExecutor from contextlib import contextmanager from math import isclose from pathlib import Path from typing import TYPE_CHECKING, Any import numpy as np import pandas as pd import pytest import torch...
d3da40f75e11ccb885cb31f7f1abddbae4fd76aa6034fef39065248341fac877
Python
21,982
548
## ------------------------------------------------------------ ## IMPORTS ## ------------------------------------------------------------ ## ----- MATH / STATS ----- ## import torch import numpy as np ## ----- PLOTTING ----- ## import matplotlib as mpl from cycler import cycler from IPython import display from tqdm....
fc35129ead11aad22cdaae2ca22e8c122f2f405ad25275f0bb5ab402a435cea4
Python
21,982
440
import dtiplayground.dmri.preprocessing as prep from dtiplayground.dmri.common.dwi import DWI import dtiplayground.dmri.common import yaml from pathlib import Path # import SUSCEPTIBILITY_Correct.utils as utils from dtiplayground.dmri.common import measure_time import dtiplayground.dmri.common.tools as tools import ...
5b6875ec4b31be21258587efa5f96eb5308de2a2a8b0abf97f9c1f7988db0cc5
Python
21,983
692
import warnings from collections.abc import Callable from enum import Enum from functools import partial from typing import TYPE_CHECKING, Literal, Union import polars as pl import torch from torch import nn from torchsurv.loss.cox import neg_partial_log_likelihood from eir.setup import schemas from eir.setup.output_...
ae3167253b300a9f1b652994d663fe03037c14fb624b867c1b91573abdb73cd0
Python
21,992
507
"""Test the remote-data abstraction: store protocol, cache, budgeting, redaction. Run from the repo root:: uv run python python/test_remote_cache.py The point of this layer is to let a batch bigger than the local disk run at all, so the checks that matter are the ones about *bounds*: that a cache honours its bud...
99f56a6855525d1c2ccfac58607fcc659f42b8f53a82aa56db047ad9aed5613b
Python
21,998
655
""" Reuseable widgets """ import typing import logging import functools from ..qt import * from ..config import ObservableCollection, ObservableDict from .util import remove_by_is, isdeleted LOGGER = logging.getLogger(__name__) class ColorWidget(QWidget): """ Widget for rendering a selected color """ def _...
802adbeead9970aedd39093b938de1aaf9162d7796b43adc713c648c9720ea9c
Python
22,000
396
import sys from pathlib import Path p_dir = str(Path(__file__).absolute().parents[1]) if p_dir not in sys.path: sys.path.insert(0, p_dir) import os import time from argparse import ArgumentParser, Namespace import json import logging import random from functools import partial import warnings # from rich.traceback im...
2db6711edc6ab7ea5437457f7bac30febfbbb3f215872c265268040c1361165e
Python
22,001
595
""" code for interpreting time-series feature hits and testing specificity of synapse-hctsafeature relationships """ import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap from palettable.colorbrewer.sequential import (PuBuGn_4...
fc0eaf5a455ba3454fd1fa13b09d84f073a354a33c7dcda00320045d00f3abc8
Python
22,011
640
"""utils.py.""" import functools import logging import operator from collections.abc import Mapping from typing import Any import jax.numpy as jnp import networkx as nx import numpy as np import numpy.typing as npt import pandas as pd import scipy.stats as st from jax import Array from numpyro.diagnostics import summ...
f6787828ed2ef765c5c85f8fa1de5f91ca4b5188f2e2371220d19a9d99cdc8ed
Python
22,021
688
# -*- coding: utf-8 -*- # Original source: github.com/scilus/scilpy # Copyright (c) 2012-- Sherbrooke Connectivity Imaging Lab [SCIL], # Université de Sherbrooke. # Licensed under the MIT License (https://opensource.org/licenses/MIT). # Modified by John Kruper for pyAFQ # OpenCL and cosine filtering removed # Replaced ...
ca56385c5e71e59a6d4fdc6c8f2b45c9ac7e47a3d043793f6c4cde90da01f65b
Python
22,025
642
import json from collections.abc import Generator, Iterator, Sequence from copy import deepcopy from dataclasses import dataclass from pathlib import Path from typing import ( TYPE_CHECKING, Any, Union, ) import numpy as np import torch from aislib.misc_utils import ensure_path_exists from diffusers.schedu...
2bd6614abd3e4f1e83c6f6d57d7ffd7bc6d01f66e7ddd438b15f1fee816a1062
Python
22,031
451
import numpy as np import pandas as pd import xarray as xr from xarray import DataArray import itertools from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly, array_is_element, walk_coords from brainscore_core import Score from brainscore_vision.benchmarks import BenchmarkBase from brai...
a9e23a3b1133b30c2c573d7a5dd7c1a02d4d1d9bd5ed74f605efbb89397517a2
Python
22,031
504
import torch from torch import nn from torch.nn import functional as F from torchvision.models import resnet as tvr from os.path import isfile from ..util.util import Dict, lookup_nn, get_nd_conv, get_nn, resolve_pretrained from torch.hub import load_state_dict_from_url from .ppm import append_pyramid_pooling_ from typ...
670e2e9249a045d5fd7e92ea03f0d73a961a7b46f25eb60918284921dd5c701e
Python
22,040
597
import numpy as np import pandas as pd from pandas import DataFrame from scipy.spatial import distance_matrix import scanpy as sc from anndata import AnnData from sklearn.neighbors import kneighbors_graph, NearestNeighbors import scipy import ot import torch import gudhi import networkx as nx from torch_geometric.nn im...
1810fbe293c0ed5fd66a143f553630dbee87417449243567e79e50083b9117db
Python
22,054
562
from dataclasses import dataclass, field from typing import Any, Literal, Protocol, Union, cast from torch import nn from eir.models.fusion import fusion from eir.models.input.array.array_models import CNNModelConfig from eir.models.input.image.image_models import get_image_model_class from eir.models.input.sequence....
955a7a852884b15ca1028ff5eff5190de8a90b99af51c09e2f12d2b2d929496d
Python
22,056
519
""" Stratified k-fold linear probe evaluation on the GMA dataset. Uses a multiple-instance learning (MIL) setup: - All sessions per infant are used (not just the last). - Each seq_len window of a recording is a separate training example. - Splits are subject-level: no infant spans train and test folds. - Test ...
d5062a54653ae00bca339d082572934ee66ee7f37759df6b7ebdba579c982b3d
Python
22,066
622
# Copyright 2019 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn # # 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...
15e275ae1ae1e2fba9cbfbbae344711d08f343cde2275a39b54877fbc8b5c383
Python
22,081
449
"""(C) Copyright 2019 IBM Corp. 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 d...
588535ded815b581ea4850d915616f80955cea7d0403a6da77bb733899dc70c0
Python
22,084
543
""" Membrane thickness measurement for surface morphometrics pipeline. Analyze density sampling CSV files to measure membrane thickness by fitting dual gaussians to density profiles. Writes per-triangle thickness back into the surface graph/.vtp/.csv in place, and generates summary statistics and plots. Pipeline Cita...
16ce65fcf3bbd68cd5d97038ba8b406c57bb6e49e51405fcc75fd9084e540e47
Python
22,085
405
#!/usr/bin/env python # Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder. # # This file is part of Slamdunk. # # Slamdunk 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 Free Software Foundation, either version 3 of the #...
561e7bb736d3e0371a5f70d8b123d5fa6b7e63112f6e9109a2e8b27296896cb1
Python
22,085
608
"""Atomistic LIne Graph Neural Network. A prototype crystal line graph network dgl implementation. """ from typing import Tuple, Union, List import dgl import dgl.function as fn import numpy as np import torch from dgl.nn import AvgPooling # from dgl.nn.functional import edge_softmax try: from pydantic.typing im...
d4ef4b0a58a9d6e17af73ef95cfbc5c4f92223683df277da8209683a2ecd1e67
Python
22,105
632
"""Data preprocessing functionality.""" import numpy as np import torch import torch.jit from sklearn.model_selection import KFold from mcmlnet.transforms.physiological import PhysiologicalToPhysicalTransformer from mcmlnet.utils.loading import SimulationDataLoader from mcmlnet.utils.logging import setup_logging from...
8eee096c748c41c168200f1d30ec26d10baf037c36a48522636ae258385e56cc
Python
22,121
662
# Copyright (C) 2021-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from collections.abc import Callable from http import HTTPStatus from pathlib import Path from typing import Any from uuid import uuid4 import pytest from cvat_sdk import exceptions from cvat_sdk.core impo...
63d51fa299b2ba2feed969718ef2f718bf650fd284d4cdc92d4e58d33aefc8ae
Python
22,127
553
#!/usr/bin/env python """ This module enables the processing of camera frame(s) with operations like averaging, slicing, etc.. It is also responsible for keeping tracking of how many different cameras / feeds are available for each parameter file, whether the cameras / feeds should be saved when filming and what exten...
ee1b4288327b580d5a5faa7a3857ab6f0dd512743fd403f1d1bc948196473b43
Python
22,133
702
from pathlib import Path from typing import TYPE_CHECKING import numpy as np import pandas as pd import torch from lifelines import KaplanMeierFitter from matplotlib import pyplot as plt from sklearn.preprocessing import KBinsDiscretizer from torchsurv.metrics.auc import Auc from eir.experiment_io.output_object_io im...
7b03b786be6c45ebc4775fe1b12f24c2c2a4f5f009a0613884786590dab6d3af
Python
22,165
560
#!/usr/bin/env python3 """ Non-Physiological Artifact Detector using Deep Lightweight CNN (DLCNN) Binary classifier for detecting non-physiological artifacts (electrode artifacts, cable noise) in EEG data. Authors: Evans Nyanney, Parthasarathy D Thirumala, Shyam Visweswaran, Zhaohui Geng Year: 2025 License: MIT """ ...
8b331c7499fc1fcfc24fade3309958a970df0387bd2870c7d9225b8b96ca03a4
Python
22,168
499
"""Gabor-filter entropy features for arbitrary image sets. This is a standalone Python port of the descriptor behind the GaborFilterEntropy4x4Cosine model from the EntropyReanalysis MATLAB scripts. The default settings match that model: 256x256 grayscale images, six octave frequency bands [1, 2, 4, 8, 16, 32], si...
83bbd94d078312b8417c8479a32b277d94ab16dc522d201c1d21f7a0c81088fc
Python
22,170
517
import numpy as np import pandas as pd from pathlib import Path import json import cv2 import tifffile from typing import List, Tuple, Union from concurrent.futures import ProcessPoolExecutor, as_completed from brainglobe_atlasapi import BrainGlobeAtlas from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.mo...
f91299e973eb76ccf06e137c57b959a558797ff0088350d0772fa27f91647e15
Python
22,175
465
"""Test CAT-NAP (suite2p calcium imaging) parity with MATLAB. Run from the repo root:: uv run python python/test_pipeline_catnap.py Ground truth comes from a complete MATLAB CAT-NAP run kept in the gitignored ``local/`` folder (see ``python/CATNAP_PORT_PLAN.md``). Because that data is not committed, this test **...
eb9c48f03c7de5e2e86036a60cce1d0f8f8ce6370538ee21704fdd28937112b6
Python
22,202
660
import os, json, sys, shutil sys.path.insert( 0, os.path.join( os.sep, 'usr', 'share', 'gkg', 'python' ) ) import os, json, sys, shutil import nilearn from nilearn import image import numpy as np import nibabel as nib import pandas as pd from CopyFileDirectoryRm import * def runFuncPreproccessing( Dir, ...
12cfc70dbc319b277810af1c50a3667dc4053113ea3bf32005d55985fec28c88
Python
22,203
589
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
72e28f9827252a6722aa0f6a0ae6b6a822ae5a9f2b9d452799db93fbab71e02c
Python
22,208
598
""" BANet Paper: `` - https://arxiv.org/abs/2104.01136 ResT code and weights: https://github.com/wofmanaf/ResT """ import torch import torch.nn as nn from torch.nn import Module, Conv2d, Parameter, Softmax from torchvision import models from timm.models.layers import DropPath, to_2tuple, trunc_normal_ class Mlp(...
d0091191fe05e9a1acf476cf11fa92dd14c3bf2e233a31a17054e36c09915c3c
Python
22,212
521
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import datetime import gc import multiprocessing as mp import os import queue import socket import sys import time import uuid from contextlib import closing from typing import List, Optional import psutil import torch from ..logger import get_...
1f0e89a6ec964abbde280918e54d70fd6d1faf3508c46f42c47713358bf04d38
Python
22,219
535
# Required libraries import os os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:100" os.environ['KMP_DUPLICATE_LIB_OK']="True" os.environ['CUDA_LAUNCH_BLOCKING']="1" import random import glob import matplotlib.pyplot as plt from dataset_patches import MyDataset from dataset_patches import Custom3DAugmentation...
2697603b28dd595df3fdedd51755ba6b3745b1b31cf8345c6e31332defc93885
Python
22,222
585
""" Ablation studies and additional experiments from the TChemGNN paper. This script implements: 1. Ablation study with different GNN layer types (Table 2) 2. Random Forest baseline for FreeSolv 3. Analysis of predictions at different node positions (Table 5) """ import os import argparse import pandas as pd import nu...
e27d0534849f1234d4cec5041d3410ad8724b483b6f63082d28e2362a35d4dda
Python
22,227
590
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
de64a7fa3949f93f5abf3f9b1186c35c99be811e48303a5adce1de0d47b8e12b
Python
22,240
626
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations import logging from collections.abc import Callable, Mapping, Sequence from typing import TypeAlias, cast import attrs import cvat_sdk.models as models from cvat_sdk.core import Client from cvat_sdk.core.progress...
2b55fa8ad90470ba523934bbd3aa82445d431f770969aa70aaf21674d538ab4a
Python
22,280
526
# This file is part of Zennit # Copyright (C) 2019-2021 Christopher J. Anders # # zennit/rules.py # # Zennit is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your ...
539bdc6609e91369022342437b77a35e94115ff1a8b8b38c283eb5e7bc16d7ed
Python
22,283
536
import sys import os import numpy as np import glob import fabio from functools import partial from PySide6.QtWidgets import ( QGroupBox, QDialog, QWidget, QScrollArea, QGridLayout, QLabel, QCheckBox, QVBoxLayout, QDoubleSpinBox, QPushButton, QHBoxLayout, QSizePolicy, ...
5a630c199a0a7c95ec4a4c0f3b198e8b9741a31f682f9d82bd9a0245ec5f256b
Python
22,303
536
# Required libraries import os os.environ['PYTORCH_CUDA_ALLOC_CONF'] = "max_split_size_mb:100" os.environ['KMP_DUPLICATE_LIB_OK']="True" os.environ['CUDA_LAUNCH_BLOCKING']="1" import random import glob import matplotlib.pyplot as plt from dataset_patches import MyDataset from dataset_patches import Custom3DAugmentation...
a8fcac620f6f5bc5507ac87faf5c1ba6b3e4bc365aa2d831510f79de84f37a1c
Python
22,308
663
# Copyright 2024 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
e0aa574c7629f92fc2d9ee75fae6e5f028482713ce2d59add26db579d3d80a9d
Python
22,314
662
# Copyright 2024 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
3accbfc4f847ac2ef826ad687adfc366f8d2bc3ab63ef5e4a13adfed1d291b57
Python
22,325
576
"""``IsocortexCoordinateProjector``: depths, 2-D placement, and hemispheres. The mini-CCF's streamlines run straight down +y, so a query at a voxel corner has an offset residual of exactly zero and the projected view coordinate is an exact integer -- assertions here are equalities, not tolerances. """ import numpy as...
dd68b5a7a9756674084a0671afa35dc6cc60e0931c1e98c26e45507497df44b1
Python
22,327
552
"""Automatic sleep staging of polysomnography data.""" import glob import logging import os import warnings import antropy as ant import joblib import matplotlib.pyplot as plt import mne import numpy as np import pandas as pd import scipy.signal as sp_sig import scipy.stats as sp_stats from mne.filter import filter_d...
2a31a868ffcbf70b11fb6df6784639b017c879a3454483683a7d48b60ff85108
Python
22,330
457
import pathlib import shutil import matplotlib import argparse import matplotlib.patches as mpatches import numpy as np import h5py matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt from postprocessing_modules.axonal_delay_kernel import get_axonal_delay_kernel from helper_functions import __file__ MODULE_BASE = ...
d09eb8739d7496568b8022a64d2af5f11167e0094fc4f4d2bb83509645988f35
Python
22,332
467
import warnings import logging from pathlib import Path import torch.nn from torch.nn.parameter import Parameter import torch.nn.functional as F import torch.autograd as autograd import flair.nn import torch from flair.data import Dictionary, Sentence, Token, Label from flair.datasets import DataLoader from flair.emb...
3836473d39fa355499b4dca0c5d257169168870e1063f4082c194deb8811219b
Python
22,336
595
''' Created on Nov 7, 2022 @author: Yanay Rosen ''' import torch import torch.nn as nn import torch.nn.functional as F from scvi.distributions import ZeroInflatedNegativeBinomial from sklearn.cluster import KMeans from scipy.stats import rankdata import scanpy as sc import numpy as np def full_block(in_features, ou...
af43610a5be80fa8c1752da0cefe74ae5e626aeae4385156214b244b6127fa22
Python
22,341
566
#pylint: skip-file #type: ignore """ Implementation of the distractor suppression task """ import time import math import typing import asyncio import logging import datetime import numpy as np import os import stl from ..qt import * from . import task_context from .widgets import Form, ListAsTabsWidget from .util i...
c862bc007e47a31d2270aa750596b83f85e95411040a1bd2e88df085356ae97a
Python
22,349
588
""" Module for reading a config file and wrapping it in a ObservableCollection """ import os.path import abc import json import enum import typing import pathlib import itertools RemoteStorage = typing.Callable[['ObservableCollection.Action', str, typing.Any, typing.Callable[[], None]], bool] def get_storage_type(va...
b6b137496498529a59feac09b93e7c609263952ed140bbc8b3b4c08fcd122ce3
Python
22,363
526
import multiprocessing import os import random import time from collections import deque import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np import torch from torch import nn, optim from torch.distributions import Normal from env import Env # 导入自定义环境 from utils imp...
22bc75fa1b6c7073df9ad85a7384fc48ed79abb217564fdf945649ca5c00054b
Python
22,364
706
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Kathrin Rack, Wadim Koslow, Martin J. Kuehn # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file exce...
0f7aa64433a7f713804ca6c47e023288e71f6464e04422ef9ba43db692e136a3
Python
22,373
555
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved """ViTDet backbone adapted from Detectron2. This module implements a Vision Transformer (ViT) backbone for object detection. Rope embedding code adopted from: 1. https://githu...