sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
8120ecb138e1cae25524a56b34e0f52dea4261b82185511e945c9ed41fe914d4 | Python | 9,283 | 225 | #!/usr/bin/env python
# author: Jannes Spangenberg
# e-mail: jannes.spangenberg@uni-jena.de
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')
from argparse import ArgumentDefaults... |
ccc45fa878f024ddfa2dbfb9e9bec63da8bdb221f96eaec93e0f3b9f5c817251 | Python | 9,284 | 226 | # Copyright 2021 Calico 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, ... |
fb510e5a35dd6fef345f0ce6fbfeceaf0ce07d31672690ec0037af18af9529a0 | Python | 9,291 | 267 | #!/usr/bin/env python
import sys
import numpy as np
from scipy import optimize
import matplotlib
import matplotlib.pyplot as plt
import os
import argparse
from datetime import datetime
np.set_printoptions(suppress=True)
matplotlib.use('agg') # Gets rid of GUI dependencies
USAGE="""
Eliminates images which are too d... |
2bc8135d5fddd2051b2b3f9510b844aab3de28d1a667ef812ecd505941dfcce2 | Python | 9,295 | 246 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import textwrap
from drf_spectacular.extensions import OpenApiSerializerExtension
from drf_spectacular.plumbing import build_basic_type, force_instance
from drf_spectacular.serializers import PolymorphicProxySerializerExtension
from drf_spectacular.... |
ed331f312ef39890ffa8d5721b34cb99905035b81905f7127fe3ef66934cf0e3 | Python | 9,295 | 337 | """This module contains string formatters for nelpy."""
from collections import namedtuple
from math import floor
import numpy as np
__all__ = [
"BaseFormatter",
"ArbitraryFormatter",
"PrettyBytes",
"PrettyInt",
"PrettyDuration",
"PrettySpace",
]
class BaseFormatter:
"""
Base format... |
fc8267d432b18bbfbf7d662ab59bbfc8bb164c1fcfd85d53400ff9df72c5f463 | Python | 9,295 | 253 | # 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, ... |
e1cc29758c79473ffac448e4a153a1e1ea816feb8902c0089293111e543042f3 | Python | 9,297 | 204 | #!/usr/bin/env python
# author: Jannes Spangenberg
# e-mail: jannes.spangenberg@uni-jena.de
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
import pandas as pd
import json
def parse() -> Namespace:
parser = A... |
b51e80a7f29e76e8eb43e0bc6247af6929e611ea55002cabecb28bd0d41a0598 | Python | 9,298 | 261 | """
Entrypoing
"""
import pathlib
#If proto/thalamus.proto exists (implies we are in repo checkout) then regenerate protobuf interfaces if they are out of date
from ..build import generate
THALAMUS_PROTO_PATH = pathlib.Path.cwd() / 'proto' / 'thalamus.proto'
THALAMUS_PROTO_GEN_PATH = pathlib.Path.cwd() / 'thalamus' /... |
c8323b9ec2635bdc4c5e9f50c81791f8aa702700334763a25dbf20e1c797ea57 | Python | 9,300 | 323 | # -*- coding: utf-8 -*-
"""Input/Output Nifti volume utilities."""
import os
from pathlib import Path
import shutil
import gzip
import nibabel as nb
import numpy as np
from .. import execute_command
from .filename import get_filename
__all__ = [
"load_volume",
"save_volume",
"mri_convert",
"copy_hea... |
e17f15f5adb83bd446a39349c4688a262a7932c56bac81288160aaba71433e77 | Python | 9,304 | 296 | """Brain-Score wrapper for DeepEISNN EI-SNN CIFAR10 ResNet18."""
from __future__ import annotations
import functools
import json
import sys
from collections import OrderedDict
from pathlib import Path
from typing import Any, Iterable
import numpy as np
if not hasattr(np, "int"):
np.int = np.int32
import torch
... |
2a316633d9c76416d9dc7685426f7ebf77f7e2ccddfbe0b170a6ae07c0c608f5 | Python | 9,307 | 267 | from __future__ import print_function
import time
import requests
from requests import ConnectionError, HTTPError, Timeout
import tweepy
from tweepy.error import RateLimitError, TweepError
import datetime
class NoTimelineError(ValueError):
def __init__(self, sn, *args, **kwargs):
msg = "user '%s' has no ... |
d881a1efdacea947dc5a639734d0421b0766e5a990e08ab101f8c3eca9cd1506 | Python | 9,307 | 211 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to compute the maximum Apparent Fiber Density (AFD), the fiber ODFs
orientations, values and indices (peaks, peak_values, peak_indices), the Number
of Fiber Orientations (NuFO) maps from fiber ODFs and the RGB map.
AFD_max map is the maximal fODF amplitude for ... |
a9af48d5e6a2bd4a3bd27a80e73c5fc0bf5aeec72cfbfc2b8a8d873b9f4f1276 | Python | 9,308 | 309 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
8b469ce43b1441d0a81a4e47557131a9f995ed6b6f27f6f6b679c627e8590939 | Python | 9,309 | 306 | import json
import random
import torch
import numpy as np
import pandas as pd
from jarvis.core.graphs import Graph
from jarvis.core.atoms import Atoms
from pymatgen.io.jarvis import JarvisAtomsAdaptor
from pymatgen.core import Structure
#from alignn.models.alignn import ALIGNN
from alignn_multi import ALIGNN_ft
#f... |
86fc33fd84a15bc80883bc034fca9e3af4975f7d6ed0289da4bbdeedb82e30bf | Python | 9,310 | 306 | import json
import random
import torch
import numpy as np
import pandas as pd
from jarvis.core.graphs import Graph
from jarvis.core.atoms import Atoms
from pymatgen.io.jarvis import JarvisAtomsAdaptor
from pymatgen.core import Structure
#from alignn.models.alignn import ALIGNN
from alignn_multi import ALIGNN_ft
#f... |
eaa156711e42251ab6bd12999b0cdd8976893bf9034fb852302053d678a0d663 | Python | 9,310 | 186 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Manuel Heger, Henrik Zunker
#
# 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... |
3a0643911370b4512040448f6d7162fca9963a1c66a97e24a3c4b9ba66750ab7 | Python | 9,313 | 306 | import json
import random
import torch
import numpy as np
import pandas as pd
from jarvis.core.graphs import Graph
from jarvis.core.atoms import Atoms
from pymatgen.io.jarvis import JarvisAtomsAdaptor
from pymatgen.core import Structure
#from alignn.models.alignn import ALIGNN
from alignn_multi import ALIGNN_ft
#f... |
6c7a68875e0ef32486c3801e4566e701a1acd72783e6e40fda83c2329e96b5e7 | Python | 9,313 | 247 | import warnings
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
import mmcv
import numpy as np
import torch
import torch.distributed as dist
from mmcv.runner import BaseModule, auto_fp16
import matplotlib.pyplot as plt
import matplotlib
from depth.utils import colorize
class BaseDepther(B... |
7fe232a92bd9915578277da352cd4a62686e3bce2c940eb6218e9641f3dc4e3c | Python | 9,313 | 263 | import argparse
import torch
from torch.nn import Parameter
import torch.nn.functional as F
from torch.utils.data import DataLoader
import torch_geometric.transforms as T
from torch_geometric.nn import GCNConv, SAGEConv
from ogb.linkproppred import PygLinkPropPredDataset, Evaluator
from logger import Logger
class... |
de25ab061400ca19091469f63d25b18d9c2b953ca097644950394feb3a2a0661 | Python | 9,313 | 211 | # 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... |
405a3fd7c9326aaa97e254c216d8f849650b14f5f930e5b18a9ddc75b1e74a9f | Python | 9,315 | 306 | import json
import random
import torch
import numpy as np
import pandas as pd
from jarvis.core.graphs import Graph
from jarvis.core.atoms import Atoms
from pymatgen.io.jarvis import JarvisAtomsAdaptor
from pymatgen.core import Structure
#from alignn.models.alignn import ALIGNN
from alignn_multi import ALIGNN_ft
#f... |
838181203857ca4e00072ed467617cbb1a8d2a33417abfb5eb982980807a0239 | Python | 9,315 | 306 | import json
import random
import torch
import numpy as np
import pandas as pd
from jarvis.core.graphs import Graph
from jarvis.core.atoms import Atoms
from pymatgen.io.jarvis import JarvisAtomsAdaptor
from pymatgen.core import Structure
#from alignn.models.alignn import ALIGNN
from alignn_multi import ALIGNN_ft
#f... |
7c634431a180ecece2998cc91ef02ca4c09039d0eb2b1f8bd3bfbb32a6ffe26f | Python | 9,316 | 233 | 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 pickle
import random
import math
import json
from collections import defaultdict
import numpy as np
import pandas as pd
import nibabel as nib
from monai.transforms... |
c2a611e4a64f9bbf3a1435a2b28bf9b9d5bff7ad09d5ba26b7a9b4fb115182ed | Python | 9,319 | 213 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import random
from typing import Any
from ultralytics.utils import LOGGER
class GPUInfo:
"""Manages NVIDIA GPU information via pynvml with robust error handling.
Provides methods to query detailed GPU st... |
0770d877a07d5962236e5adea12720c3651f69ce261aa0572f8f0bc2469f978c | Python | 9,322 | 216 | from pyrosetta import *
from pyrosetta.toolbox import *
from pyrosetta.teaching import *
import pandas as pd
import sys
from pyrosetta.rosetta import *
import multiprocessing as mp
import time
init("-mute all")
# Ref2015
sfxn = get_fa_scorefxn()
# 20 canonical amino acids
amino_acids = ["A", "C", "D", "E", "F", "G", ... |
57f299828633344dc2b8d488a81b207b37005d95dd7c8903e8a557ec98401638 | Python | 9,323 | 253 | # 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, ... |
d3668887a4e52a66bc80cdb0ddee71005b99d78db082e04881b7e73f0a51f406 | Python | 9,323 | 288 | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
A standalone module for aggregating metrics.
Metrics can be logged from anywhere using the `log_*` function... |
601a7f9ae544d43f4ae13449c06dd70dc5176fa70680a8aedf20a90f74840ab4 | Python | 9,326 | 310 | import asyncio
import json
import os
import warnings
from pathlib import Path
from mcp.server.fastmcp import FastMCP
import parsl
from parsl import bash_app
from chemgraph.mcp.server_utils import load_parsl_config, run_mcp_server
from chemgraph.schemas.xanes_schema import (
xanes_input_schema,
xanes_input_sc... |
63582a241e0803e2371d4323d87f9d7236ffe2555c10a550a1b97d5d8c45b6e8 | Python | 9,331 | 299 | """
Code for running other spatial segmentation methods
"""
import contextlib
import numpy as np
import pandas as pd
import sys
# TODO: do all the citations and stuff properly
class CellChat:
def __init__(self):
pass
def run(self, adata, group_by="class"):
# set up to run the R code
... |
0b3ac8a6aedcf56068d30afdbbdaf454fe99d6c68194ffe71d1e578483f76fd8 | Python | 9,332 | 220 | """Train linearizing encoding models using the NSD-core subject-unique image
features and fMRI responses, and use them to predict fMRI responses for the:
(i) NSD-core's test images.
(ii) NSD-synthetic 284 images.
Parameters
----------
subject : int
Number of the used NSD subject.
train_test_session_control : int
If ... |
50ecf43fbd476193da9c01d8af2ca9731eedf28e38b8076d4cc1b3ac9d9bf2bb | Python | 9,332 | 255 | # -*- coding:UTF-8 -*-
import os
import sys
import torch
import torch.nn as nn
from spikingjelly.activation_based import functional
# from conf import settings
from conf import global_settings as conf_set
import torch.optim as optim
import time
import argparse
import train_utils
from torch.cuda.amp import autocast, Gr... |
aa89d3a97550778b9d2d9ceb18b64564bf65658c1ab0c433a579a3d5a8c0fda6 | Python | 9,332 | 297 | """Brain-Score wrapper for DeepEISNN EI-SNN ImageNet ResNet18."""
from __future__ import annotations
import functools
import json
import sys
from collections import OrderedDict
from pathlib import Path
from typing import Any, Iterable
import numpy as np
if not hasattr(np, "int"):
np.int = np.int32
import torch... |
5fe521aa8ec6b06a4e40cb4c53d9ab98319860f08bf4a85fb09f9805cfa13abe | Python | 9,334 | 250 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Search through all SCILPY scripts and their docstrings to find matches for the
provided keywords.
The search will be performed across script names, docstrings, help files,
keywords, and optionally synonyms.
The output will list the matching filenames along with the occ... |
f12215e7d6da272870d687aa482d66a851e8b35d5abe26e07de76925a3297536 | Python | 9,334 | 186 | import matplotlib
import os
# if not matplotlib.is_interactive():
# matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
import numpy as np
import pathlib
import pickle as pkl
from neuron_interface.neurosim.cells import L5_TTPC2_cADpyr
from helper_functions.cell_type_lib import CellType
from helper_functions.lo... |
87d8ed08dbac6fb4ce00fbd73369a03d81d46bad3bc13221a0d0b6ce1b46a4b9 | Python | 9,344 | 302 | from collections.abc import Sequence
from functools import partial
from pathlib import Path
from aislib.misc_utils import ensure_path_exists
from docs.doc_modules.c_sequence_outputs.utils import get_content_root
from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save
from docs.doc_modules... |
92bcf01cf14a08d2760c2debdc5ea6f416fb213dd338142e6760d8ab0d06209a | Python | 9,346 | 268 | """
Audio Preprocessing Pipeline for AVPENet.
Implements Algorithm 1 from the paper:
Stage 1: Noise reduction (spectral subtraction)
Stage 2: Resampling (48 kHz → 16 kHz)
Stage 3: Voice Activity Detection
Stage 4: Normalisation
Stage 5: Mel-spectrogram extraction
Output: Mel-spectrogram M ∈ R^{128... |
97cfa11e227d808b1de92963a20594e4320add7fc19d6cc16174cc6302983392 | Python | 9,346 | 285 | """
This script computes the projections of neural activity onto the switch evidence
dimension for actor and observer trials.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import json
from pyTdr.tdrLoadAccData import tdrLoadAccData
from ... |
80021344e1c73e81ed17a0659a116b36d949b26ff6cc23c082a6189973366da4 | Python | 9,347 | 275 | import os
import sys
import time
import json
from typing import List, Dict, Optional, Any, Tuple
from openai import AzureOpenAI
import tiktoken
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
from config.azure_config import (
AZURE_CONFIG,
PROMPT_CONFIG,
RETRY_CONFIG,
TOKE... |
b19acdcd8f30ee06e2076b4f586b8a223ed4d7de2c48ae32653b74675e5d95b4 | Python | 9,349 | 212 | # 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... |
ce4077a634d5dfbaea7715bece4c8a2156f09966ad73ae7da875b35d26831c2b | Python | 9,350 | 233 | import torch
import meshio
from pathlib import Path
from scipy.spatial import cKDTree
import numpy as np
from torch_cluster import radius
def npy_to_mesh(
inp_npyfile,
outp_meshfile,
single_case_handling: callable,
inp_vtkfile='/mnt/home/naghavis/Documents/Research/DeepCardioSim/deepcardio/LVmean/LV_m... |
d9153ee2bac35af876b8130901105bb49e6991b20f15d012c8ba1d788905536b | Python | 9,350 | 240 | import os
import sys
import torch
import pandas as pd
from model.Ouroboros import Ouroboros
from utils.chem import gen_standardize_smiles, check_smiles_validity, is_valid_smiles
import gc
class Pharm_Profiler:
def __init__(self,
encoder,
standardize = False
):
self.encoder... |
fc2fb104fdb9a0c4df09cccd09ced92a067d797fc4adaac8d4755b9e65b1059a | Python | 9,353 | 250 | import sys
import yaml
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.stats import scoreatpercentile as sap
pathpath,myrun = sys.argv[1:]
plot_example_recs = False
with open(pathpath) as yfile: pathdict = yaml.safe_load(yfile)
rundict_path = pathdict['configs']['ru... |
a5f3ae62bbd4875453c69b2c38166b0822f98f6393743efeeb585a574be13da3 | Python | 9,356 | 281 | import logging
import os.path as op
import immlib
import nibabel as nib
import numpy as np
from dipy.align import resample
from dipy.io.stateful_tractogram import Space
from dipy.io.streamline import load_tractogram
import AFQ.data.fetch as afd
from AFQ.definitions.image import ImageDefinition
from AFQ.definitions.ma... |
16bd038ba08bce855d3076dde8966324e713367ac79c115a4ff04097bbfabb89 | Python | 9,357 | 248 | import imgRetrivalUtil
import torch
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
from tqdm import tqdm
from PIL import Image
import torchvision
from torchvision.transforms import v2
from pytorch_grad_cam import GradCAM, GradCAMPlusPlus, EigenCAM
from pytorch_grad_cam.utils.model_targets impo... |
825cc046d100c39549fd794f2653f23213c79934ce071b2a74c85fd772c825ec | Python | 9,357 | 254 | #!/usr/bin/env python3
"""
Fig1d_ScreeningRanked.py
Creates ranked bar plots of iGABASnFR mutant library screening results.
Mutants are sorted by performance metrics (ΔF/F, F0, kinetics) and displayed
as bars, separated into singles vs combos and positive vs negative responders.
Usage:
python Fig1d_ScreeningRanke... |
4a91699c71a3d50db800f722a3d51037717957a0215e8e429cb998b41b657b19 | Python | 9,359 | 268 | import numpy as np
import re
import sys
from Switching.SwitchingHelper import parseAllData
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import r2_score
import pickle
import platform
from pathlib import Path
from tqdm import tqdm
############... |
b450f73e68fc785ed25f30946d459e681b70bb8c90a964030b023276f247860a | Python | 9,359 | 244 | """
Denoising pipeline for suite2p fluorescence traces.
Ported from Functions/twoPhoton/denoiseSuite2pData.py.
Requires:
- pybaselines (baseline estimation)
- scipy (signal processing, peak detection)
- oasis (OASIS deconvolution — optional; install from
https://github.com/j-fri... |
e1fae37dbc23ec32e8c92b59ef4eb446a99bb9bb73e54e3f501448e774b770d8 | Python | 9,359 | 245 | import os.path
import subprocess
import unittest
import tests.bam
import tests.gtf
import tests.test_config as test_config
class BaseTest(unittest.TestCase):
def setUp(self):
self._rmats_command = test_config.RMATS_COMMAND
self._rmats_return_code = None
def _run_test(self):
self._run... |
2e5f8e5b3aa22e3e45acd70c35293205451d9bf9e08d2f84e01e70059b78376e | Python | 9,363 | 295 | import os
import random
import numpy as np
import pandas as pd
import torch
import scanpy as sc
from torch.backends import cudnn
from harmony import harmonize
from tqdm import tqdm
from sklearn.mixture import GaussianMixture
from sklearn.cluster import KMeans
def set_seed(seed=2024):
"""
Set ra... |
619cb3856577591600b63058b203f2be48a072d21fb60f4c0e24830251f2af43 | Python | 9,363 | 213 | from bread.data import Features, Segmentation, Lineage, BreadException, BreadWarning
from .._lineage import LineageGuesser
from ._model import LineageClassifierDeep
from ._extraction import extract_features, NUM_FEATURES
from dataclasses import dataclass, field
from typing import List
from pathlib import Path
import to... |
213ab0ffbf155b60140f211e4df4eee4c915e24ea6501e673480891de5fea179 | Python | 9,370 | 257 | '''
Correlogram.py: calculates shuffle corrected cross-correlogram, averaged across all neuron pairs
Usage: python3 Correlogram.py --file filename
Optional parameters specifying start and end time, e.g.
python3 Correlogram.py --file Ethanol10min.csv --tstart 19.792 --tend 79.792
if start and end time of spikes to be an... |
ab5cc10a968ad72d579ba8daf2f7d0e09a905a7284cdf56dbef2a741c97a1332 | Python | 9,372 | 194 | #!/usr/bin/env python
"""
UC480 Camera QPD functionality.
Hazen 04/17
"""
from PyQt5 import QtCore
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
import storm_control.sc_hardware.baseClasses.lockModule as lockModule
import s... |
bd29d226e179a2c5a4610672fa296c2b5c93b87477e13d9262000e8e4b44014c | Python | 9,372 | 256 | """Compare the ID and OOD generalization performances of different encoding
models.
Parameters
----------
subjects : list
List of the used NSD subjects.
train_test_session_control : int
If '1', use the train and test splits consist of image conditions from
non-overlapping fMRI scan sessions.
zscore : int
Whether t... |
e9b1118ae3037e4acf204a4f5e1e3cf48b8321be084d75db57ed713928361ed5 | Python | 9,372 | 330 | # -*- coding: utf-8 -*-
import sys
import time
from PyQt5.QtGui import (
QBrush,
QPainter,
QPen,
QPixmap,
QKeySequence,
QPen,
QBrush,
QColor,
QImage,
)
from PyQt5.QtWidgets import (
QFileDialog,
QApplication,
QGraphicsEllipseItem,
QGraphicsItem,
QGraphicsRectItem,... |
4083731039612d89794d512453a9e101c780e43f9f61784c93b682f59e6c7ca9 | Python | 9,375 | 218 | import numpy as np
from pfcmap.python.utils import data_handling as dh
from scipy.stats import gmean
from scipy.stats import scoreatpercentile as sap
import matplotlib as mpl
from matplotlib import pyplot as plt
def get_halfwaves(vals,rolldownthr,minpeakheight,mindur_pts=0,mode='trough'):
starts0 = np.where(np.dif... |
f958d4b11e72eace8f1282ccd67e34adcea096ce7da9ad8e1390b47003d64f8c | Python | 9,377 | 228 | import os
import PyQt5
from lasagna.alert import alert
from lasagna.plugins.ara.ara_plotter import ARA_plotter
from lasagna.plugins.lasagna_plugin import LasagnaPlugin
from lasagna.utils.pref_utils import get_lasagna_pref_dir
from lasagna.utils import preferences
class AraPluginBase(ARA_plotter, LasagnaPlugin, Py... |
85170ae76d9932002d53f52ca4390d3b4409d5c43368827a6a4cac63f377febc | Python | 9,379 | 209 | """Non-negative matrix factorization dimensionality metrics, port of
``calNMF.m`` (called from ``ExtractNetMet.m`` for the ``num_nnmf_components``
/``nComponentsRelNS``/``nnmf_residuals``/``nnmf_var_explained`` fields).
**Not bit-reproducible against MATLAB, and not even algorithm-identical** —
unlike the rest of this... |
7f6ac0ad20d9eaa12532e65f53da3a5604fa49c6229cc1a40796b0bdb1843f58 | Python | 9,380 | 262 | from __future__ import annotations
import json
from pathlib import Path
import pytest
from PySide6 import QtCore
from PySide6 import QtWidgets
from pytestqt.qtbot import QtBot
from labelme._widgets._settings_dialog import _LabelFlagsEditor
from labelme._yaml import safe_load
from .conftest import MainWinFactory
fro... |
b4e19ce36cda4a5bb7c15c9420f28bba628aaeb4862547b6deec20e460e239a5 | Python | 9,381 | 238 | import argparse
from pathlib import Path
import glob
from PIL import Image
import ttach as tta
import cv2
import numpy as np
import torch
import albumentations as albu
from catalyst.dl import SupervisedRunner
from skimage.morphology import remove_small_holes, remove_small_objects
from tools.cfg import py2cfg
from torch... |
0813c767fa222d3f65e13dd66c34049ccaf55298125c809aa62207c49dc1d330 | Python | 9,383 | 208 | #!/usr/bin/env python
# author: Jannes Spangenberg
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
import pandas as pd
import json
import sys
def parse() -> Namespace:
parser = ArgumentParser(
formatt... |
74429fbd22af7bf64ae75113c93aa6eb5609a4e7576e2649654044579349c154 | Python | 9,386 | 223 | from typing import Dict, List
from typing import TYPE_CHECKING
from math import prod
from copy import deepcopy
from zigzag.utils import pickle_deepcopy
if TYPE_CHECKING:
from zigzag.classes.workload.layer_node import LayerNode
class Loop:
"""
Collect information of each single loop tuple in mapping.
... |
d53a190a04b971cf20d0057c6b8f24c7e6359ca925a85f839809d6f1788e00b9 | Python | 9,388 | 197 | """Exercise the original planner/executor/analyst flow without a live model."""
import asyncio
import json
import pytest
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from langchain_core.tools import StructuredTool, tool
from chemgraph.graphs.graspa_mcp import construct_graspa_mcp_graph
fr... |
39c6f69cb2e69d0144a89dc4085489ca20ffa3700120abe89256bea2afa91de1 | Python | 9,391 | 210 | import argparse
import matplotlib.pyplot as plt
import time
import os
import torch
import torch.nn as nn
from fvcore.nn import parameter_count_table
from torch.utils.data import DataLoader
from prefetch_generator import BackgroundGenerator
import pandas as pd
from my_dataset.my_dataset_new import MyDataset
from functi... |
3cd62737a1e416270225c078999ad465acfd4bb72d18f231dda8ff09d1855c74 | Python | 9,391 | 260 | import torch
from torch import nn
import torch.nn.functional as F
import pytorch_lightning as pl
from torch_geometric.nn import GATConv
from transformers import AutoModel
from sklearn import metrics
from sklearn.metrics import f1_score, precision_score, recall_score
import numpy as np
# cuda = torch.device('cuda')
cl... |
3012c51acfca243bd4f94410e2ef735cd225739223a73a806565a6854518ed13 | Python | 9,393 | 250 | """
Predict using trained ResNet3D model
"""
import os
import argparse
import torch
import torch.nn as nn
import numpy as np
import pandas as pd
from torch.utils.data import DataLoader
from data.dataset import MRIDataset
from models.resnet3d import ResNet3D18
def load_model(checkpoint_path, device):
print(f"Loadi... |
111a7bed6a9b43eb45406aacb7a044b7fe208df7f6130a62c8d23722aa392222 | Python | 9,394 | 182 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from multiprocessing.pool import ThreadPool
import torch
from PIL import Image
from ultralytics.models.yolo.segment import SegmentationPredictor
from ultralytics.utils import DEFAULT_CFG, NUM_THREADS
from ultralyt... |
30c5c5f55386cf85377b5adc45ab543a24f4f88e6d95c30024c425275eaf314f | Python | 9,396 | 226 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Henrik Zunker
#
# 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 Lice... |
acc13d773935b17d77520920dc892293d7b2dd790dec7826925b3a9763d40297 | Python | 9,396 | 228 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
# external inputs
import numpy as np
import nibabel as nb
from nipype.interfaces import fsl
# local inputs
from ..io.get_filename import get_filename
from ..skullstrip.skullstrip_epi import skullstrip_epi
from ..cmap.generate_coordinate_mapping impor... |
02b210f9250180cc1f65f91dba9597d33d5cf4a0e3665a8517ced4ba7a6e81d9 | Python | 9,398 | 240 | # -*- coding: utf-8 -*-
from flair.parser.utils.fn import pad, stripe
import torch
import torch.autograd as autograd
import pdb
def kmeans(x, k):
x = torch.tensor(x, dtype=torch.float)
# count the frequency of each datapoint
d, indices, f = x.unique(return_inverse=True, return_counts=True)
# calcula... |
8c05ec74842d9c7ab3be4392a56257e083b548a6a4c7ec5e8961e49fa3052771 | Python | 9,398 | 265 | import numpy as np
from scipy.spatial.distance import pdist, squareform
import os
import pandas as pd
import json
def compute_rdm_pearson(vectors):
"""
Compute RDM matrix based on Pearson correlation distance
Parameters:
vectors: numpy array, shape (n_items, n_features)
Returns:
rdm:... |
a299be835ecb86ee500306233fe6c8210519c337c43d54e41ece6d9114bc0ea5 | Python | 9,398 | 181 | from nipype.interfaces.utility import Function
from PUMI.engine import NestedNode as Node, AnatPipeline, QcPipeline
from PUMI.pipelines.multimodal.image_manipulation import pick_volume, vol2png
from nipype.interfaces import fsl
@QcPipeline(inputspec_fields=['func2anat', 'wm_bb_mask'],
outputspec_fields=['... |
322b33f53692f6f91b9767aa037efe963af468649991ee7db914ec53218d529c | Python | 9,400 | 258 | # -*- coding: utf-8 -*-
import unittest
import arbor as A
from arbor import units as U
import numpy as np
try:
from scipy.sparse import diags
from scipy.sparse.linalg import spsolve
scipy_found = True
except ModuleNotFoundError:
scipy_found = False
"""
Tests for the correct scaling of the amount _an... |
e0413ea9f102eabce813d85dbdf46d9bfbddfa055b5f2bc856fa0f98e10f199a | Python | 9,400 | 228 | """
Classes for generating random sets of intervals over larger regions.
"""
import bisect
from bx.bitset import BitSet
random = __import__("random")
class MaxtriesException(Exception):
pass
def throw_random_list(lengths, mask, allow_overlap=False):
rval = []
throw_random_gap_list(lengths, mask, lamb... |
0995b7c1d3cdfca75dd29935d5aa1c12312d25a1946295e5207a1adf58c99264 | Python | 9,406 | 275 | """Collection of data augmentation methods."""
import numpy as np
import torch
from mcmlnet.utils.logging import setup_logging
from mcmlnet.utils.tensor import TensorType
logger = setup_logging(level="info", logger_name=__name__)
def _sample_selection_mask(x: TensorType, p: float) -> TensorType:
"""
Create... |
6daaa9ff84db90f860b2bdbad89004f1538173097bdf5117223d69e7a91a462b | Python | 9,406 | 274 | import sys
import getopt
import anndata as ad
import numpy as np
import pandas as pd
import igraph as ig
from scipy import stats
import matplotlib.pyplot as plt
import random
# keep result Repeatable
random.seed(42)
###########################################################
# grid functions
#######################... |
807e5a9dcbed8583e9553c86f3094b5c9df8f28c2e88ced000d5612fef710e42 | Python | 9,408 | 233 | import numpy as np
import random
import skimage.io as skio
import numpy as np
import glob
import os
from natsort import natsorted
import json
from sklearn.model_selection import KFold
import shutil
from tqdm import tqdm
SAMPLE_LIST = ['5um S-20-28',
'5.2um LADAF-2021-17 Left Kidney',
'5.2... |
4568c31391b105598ab73f778c9e28b575e55af5a69664a9acbbe874acc877ae | Python | 9,409 | 239 | #This program reads through all analyzed experiments, extracts the dt between PSP and spike
#Run with execfile('TBSanal.py'). ARGS: name of file with list of experiments
#may need to adjust min_height to exclude artifacts or include smaller spikes
#make pause=0 to pause between display of detected spikes for experimen... |
6dbc8cc25a132efdcf1e3356eb416372799f478b569d88f9e64dfefc985b50ad | Python | 9,409 | 197 | import sys
import argparse
import numpy as np
import pickle
from matplotlib import pyplot as plt
from scipy import sparse
import nibabel as nib
from nilearn import plotting
from nemo_save_average_matrix_figure import make_triangular_matrix_symmetric, average_input_matrices
from nemo_save_average_glassbrain import parc... |
1228b1487780a339a13028a5f6fc2905a7b498fb77116c83dbd849cfb6573d58 | Python | 9,410 | 367 | # 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 t... |
d01eb4e27796a10c314068fffc11ff926f9c536d91a9ae419029f6493f30adbc | Python | 9,410 | 269 | import torch
from torch.utils.data import DataLoader, TensorDataset
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from torch.optim.lr_scheduler import StepLR
import os
import os.path as osp
from tqdm import tqdm
import argparse
import time
import numpy as... |
ac5205a8209a6df5d67a087d9e225c8b7b37a1570c79c789af57b28ec7d0e9aa | Python | 9,412 | 229 | """Shared helpers for labelled GIFTI statistical surface visualisations."""
from __future__ import annotations
import csv
from collections.abc import Mapping, Sequence
from pathlib import Path
import nibabel as nib
import numpy as np
NIFTI_INTENT_LABEL = 1002
NIFTI_INTENT_POINTSET = 1008
NIFTI_INTENT_TRIANGLE = 100... |
534a3ce13625a3bd9dc4fdc50577766e5c085ea14b741a7e39045419563b128d | Python | 9,415 | 300 | """Brain-Score wrapper for DeepEISNN EI-SNN CIFAR10 VGG19."""
from __future__ import annotations
import functools
import json
import sys
from collections import OrderedDict
from pathlib import Path
from typing import Any, Iterable
import numpy as np
if not hasattr(np, "int"):
np.int = np.int32
import torch
fro... |
97aa6e5e64bee5ff7d8cf77b641ac3e0efdf632c24c0c8dc26e4a9166adf5c24 | Python | 9,417 | 255 | '''
Reaction diffusion
-------------------
Implements a reaction-diffusion model for generating a self-organising mosaic
of spots.
'''
import numpy
from numba import jit
@jit
def reactionDiffusionIterator(u, v, coefficients, Dv, idx, steps):
'''Iterates through the reaction diffusion equations for the specified
... |
a78c053b7a61400f69039d5aefb40215c64cbf05e5f664e89a0196076a424552 | Python | 9,424 | 230 | from copy import deepcopy
from typing import List, Tuple
import torch
from torch import nn
from torch_geometric.nn import ChebConv, knn_graph
def MLP(channels: List[int], do_bn: bool = True) -> nn.Module:
""" Multi-layer perceptron """
n = len(channels)
layers = []
for i in range(1, n):
layers... |
c525e40cb91ea3e8f408dfec8cbeb2c9d6f0c2bce718310c5de35250cd7efe87 | Python | 9,424 | 209 | #!/usr/bin/env python
# author: Jannes Spangenberg
# e-mail: jannes.spangenberg@uni-jena.de
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
import pandas as pd
import json
import sys
def parse() -> Namespace:
... |
766811eee43d231c46607226c80e71336782bf0bf9aecd4f8a395124ad173fa4 | Python | 9,427 | 166 | """
DyNeMo: Training
================
This tutorial covers how to train a DyNeMo model. We will use MEG data in this tutorial, however, this can easily be substituted with fMRI data.
"""
#%%
# Getting the Data
# ^^^^^^^^^^^^^^^^
# We will use resting-state MEG data that has already been source reconstructed and prepa... |
aebf0cc3022edf4c26669dcfff105973d2a93b3748aad1472291d16177794ee8 | Python | 9,427 | 306 | import tensornetwork as tn
from tensornetwork.matrixproductstates.mpo import FiniteMPO
from tensornetwork.backends.abstract_backend import AbstractBackend
import numpy as np
from typing import Any, List, Optional, Text, Type, Union, Dict, Sequence, Set, Tuple, Iterable
Tensor = Any
__all__ = ['FiniteZXZ', 'Fi... |
ac3d07ea6eda88554317e56a8fefedaba8fd8fb5f68b3aa2127a21aaafff41f3 | Python | 9,429 | 294 | import os
import random
import numpy as np
import pandas as pd
import torch
import scanpy as sc
from torch.backends import cudnn
from harmony import harmonize
from tqdm import tqdm
from sklearn.mixture import GaussianMixture
from sklearn.cluster import KMeans
def set_seed(seed=2024):
"""
Set ra... |
af7b02f9d1c3a2ec9a6281c6768058d2e3b4a8e3af0fafc76fde9dd9c7863199 | Python | 9,433 | 260 | import os
import os.path as osp
from typing import Any, Callable, Dict, List, Optional, Union
import fsspec
import numpy as np
import torch
from torch_geometric.data import Data, InMemoryDataset
from torch_geometric.io import fs
from torch_geometric.utils import coalesce
class EgoData(Data):
def __inc__(self, k... |
155701a9ca00f41a7e633a823b8edd4902a37ec0295827c972dec037370980b7 | Python | 9,434 | 277 | from typing import Tuple, Dict, List
import numpy as np
import torch
from numba import njit, prange
from scipy.ndimage import label
from torch import Tensor
from tqdm import tqdm
from skoots.lib.cropper import crops, get_total_num_crops
def efficient_flood_fill(skeleton: Tensor) -> Tensor:
"""
Efficiently f... |
3a8fca2c9a04365e4242e5505af7213d4d87078dab29b0126ce476b1638f23dd | Python | 9,435 | 294 | """Eye position-based OOG task for MWorks.
The main class in this file is TaskManager, which is a task to be run by
oog.mwel.
"""
################################################################################
#### Determine whether on laptop or on rig and update sys.path accordingly
###############################... |
18c02af43052d3f7ab9e8545a818205c206b81007d049186b3178b7f47b11920 | Python | 9,439 | 204 | """
Script to do PHATE vizulations. Basis for Supplementary Figures.
"""
import gc
import sys
import scanpy as sc
import run
import matplotlib.pyplot as plt
import numpy as np
import importlib
import pandas as pd
import random
import phate
from sklearn.cross_decomposition import PLSRegression
from sklearn.decompositio... |
81d765102aea06f5d81754762e05a731217094c70ac6f11649d520c03a58c58e | Python | 9,440 | 308 | """
Representation Processor
============
These are core classes of representation processor.
Repr Processor: the basic representation processor
- Event Processor
"""
import numpy as np
from abc import ABC, abstractmethod
import pretty_midi as pyd
class ReprProcessor(ABC):
"""Abstract base class severing as... |
01907d51b5b6333a599828e73a594ad052be51e8913a16eea5063ccb2ac1f6e9 | Python | 9,441 | 226 | from typing import Dict, List
from math import log2, ceil, prod
from zigzag.classes.hardware.architecture.operational_array import (
Multiplier,
MultiplierArray,
)
class Adder:
def __init__(
self,
fan_in: int,
unit_cost: float,
unit_area: float,
input_precision: Lis... |
1d48418a53338e0334e8153204ecc8108e72380a735972104b795f9c4440da4e | Python | 9,441 | 223 | #! /usr/bin/env python
"""Measure inter-surface distances and relative orientations between two surfaces.
Usage: python interdistance_orientation.py surface1.gt surface2.gt [options]
"""
__author__ = "Benjamin Barad"
__email__ = "benjamin.barad@gmail.com"
__license__ = "GPLv3"
from cProfile import label
import click... |
2eac6e6276275c2b9a903f140a76249df72ee6df99fb1bfc83499f6ed9bba69d | Python | 9,449 | 289 | from multiprocessing import Pool
#all created batches are stored in ./Training_Data/ which should exists
def job(pro_id):
process=str(pro_id)
from multiprocessing import Pool
from PIL import Image
import numpy as np
import os, umap, torch, h5py, time, sys
from scipy.ndimage import gaussian_filt... |
d228eed894c9e8d02ad00b5da19a3324f7bf69459de01a1e4197c80bd7922c52 | Python | 9,450 | 223 | """
Script to find optimal number of PLS components based on cross-validation.
"""
import numpy as np
import pandas as pd
import scanpy as sc
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import cm
import seaborn as sns
from joblib import Parallel, delayed
from numpy.random import default_rng
fro... |
af798563ce9325103577edd78e42896901d2a17d3391883cfa1e217e7422006a | Python | 9,451 | 185 | """
(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
... |
817b1ec92d954fe99f053e66de1b7e9fdcf04a7a7916b15ead293cd7742ad4e0 | Python | 9,455 | 227 | """Test what a remote run leaves behind, and that it says so.
Run from the repo root::
uv run python python/test_remote_working_dirs.py
Express mode's claim is that the ``.meanap`` bundle is the whole run. That is
true of the *output folder*, which is removed once the bundle reads back — but
it was never true of... |
960c8fabbf642fa15309f1949795df966bffc82fa545b8f44b3e955bc6ef226f | Python | 9,455 | 257 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import torch
from hydra import compose
from hydra.utils import instantiate
from omegaconf import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.