sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
7d1a7677bce3de41e0b77f8fb4583e257e68ce1a15385ec6ee9765199d720c46 | Python | 9,676 | 239 | #!/usr/bin/env python
from __future__ import print_function
from logging import info
import random
import numpy as np
import datetime
from ltlib.evaluation import conll_summary, per_type_summary, is_iob_tagging
from keras.models import Model
from keras.layers import Input, Embedding, merge, Flatten, Dense
from kera... |
d427861f529727ec21c514f17563581b01738b4e46397ae2b57f317614f75f50 | Python | 9,677 | 225 | # -*- coding: utf-8 -*-
# @Author : LG
model_dict = {
"mobile_sam.pt": {
"urls": [
"https://huggingface.co/yatengLG/ISAT_with_segment_anything_checkpoints/resolve/main/mobile_sam.pt",
"https://www.modelscope.cn/api/v1/models/yatengLG/ISAT_with_segment_anything_checkpoints/repo?Revi... |
2098337a9cf56ba4b560e1b28a6d6c64a4f48fe07b5fd74aefe54ac419cbc52f | Python | 9,678 | 237 | """
Original script created on Tue Apr 5 22:16:54 2016
@original_author: Junyue
@modified_by: Beth Martin (well information additions)
@adapted_for_snakemake: Steven Dupas (SD)
ORIGINAL SOURCE: This script is adapted from the sci-RNA-seq3 pipeline
This script processes sci-RNA-seq3 data by:
1. Extracting ligation an... |
3b958a554991096db78c2dfbb64b31ba805279788588122a40fb9b6824e46bfe | Python | 9,680 | 331 | # ---------------------------------------------------------------
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the NVIDIA Source Code License
# for Denoising Diffusion GAN. To view a copy of this license, see the LICENSE file.
# -----------------------------------------... |
6d2d6b3b4926be12cdfdb3954f4c8dade68211204a45172f3e39a413d5e19ab3 | Python | 9,680 | 252 | """
Tools for projecting stimuli into AC model space
"""
import os
import re
import json
import inspect
from functools import partialmethod
import numpy as np
import scipy.signal
from scipy.io import wavfile
import matplotlib.pyplot as plt
from nems.distributions.base import Distribution
from nems.layers.base import... |
176c8afa50551690f295cda507761bca901e1b2a35e0ae256fc2c9bb0ce7c780 | Python | 9,683 | 247 | 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... |
1824bdae5f317cfc288f16f3b75b5028d4f769ebb43d220693bd0868dae40925 | Python | 9,684 | 327 | import os
import subprocess
import time
from collections.abc import Sequence
from functools import partial
from pathlib import Path
from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save
from docs.doc_modules.serve_experiments_utils import load_data_for_serve
from docs.doc_modules.serving... |
6478edc21414263bae3932716a15091f5480c62f771ed6f692d0324d0a9d8ddc | Python | 9,685 | 334 | import tarfile
from pathlib import Path
import h5py
import numpy as np
from scipy.io import loadmat
def extract_models(path="../Models/hmms_20240125.tar.gz"):
"""
Extracts the models from the tar.gz file
:param path: path to the tar.gz file
:return: path to extracted models
"""
path = Path(pa... |
1b838aa31ae07a284a498972603092d2f1fb7782cdf2ec35dd10579997b9d427 | Python | 9,688 | 323 | # user feature generation: Alhosseini
import re
import json
import datetime
from operator import itemgetter
from math import log
import pandas as pd
import numpy as np
import csv
import collections
# path="/data2/whr/zqy/327/"
# chooses = ["gilani-2017","cresci-stock-2018","cresci-rtbust-2019","cresci-2015","botometer... |
14a35339a5f6917ddade62fdccc97baed96df05bdf316be18dbf706d69eaef65 | Python | 9,690 | 237 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Prepare a typical command for eddy and create the necessary files. When using
multiple acquisitions and/or opposite phase directions, images, b-values and
b-vectors should be merged together using scil_dwi_concatenate. If using
topup prior to calling this script, image... |
bb7d3933ac2dd68db361dd99236164d079ddf593dc5457ce4b30ac0465839147 | Python | 9,690 | 260 | import numpy as np
import h5py
import yaml
import sys
import os
import matplotlib.pyplot as plt
import matplotlib as mpl
import shapely
from shapely.ops import polylabel
from importlib import reload
pathpath = 'PATHS/filepaths_IBLTuning.yml'#
myrun = 'runIBLTuning_utypeP'
layers = ['5','6']
figdir_gen = 'FIGURES/fl... |
e9185ffe9e3047ec37d958517cb2c3441b76cd692bba373620f9b997a02f9c81 | Python | 9,691 | 293 | import base64
import io
import string
import uuid
from typing import Any
import numpy as np
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
from PIL import Image
from pydantic import BaseModel
from eir.setup.streaming_data_setup.protocol import PROTOCOL_VERSION
app = FastAPI()
class ConnectionManager:
... |
1e269e9c18e7da729b2a76d4847a827e9ffa3759a8dd8f601d9a5913ab7949eb | Python | 9,695 | 204 | # This file is part of connectome-manipulator.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Blue Brain Project/EPFL
"""Module for comparing connectomes based on synapse properties:
Structural comparison of two connectomes in terms of synapse properties per pathway,
as specified by the config. For each... |
e32faf8d00509a7320d83fa0960eb07957e8dd6c54627b64f85d2edcf572fce1 | Python | 9,695 | 274 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from typing import Tuple
from . import ELA_MEM_LM
#-----------------------------------------------------------------------------------
# plot_model_empirical
#-----------------------------------------------------------------------------------
#--... |
9ca29e115213b3b1abb4105e0eb3f377674d3a8e08b684e8ca2f23fed1564bf9 | Python | 9,696 | 295 | import functools
import typing
import bisect
import pdb
import logging
from ..qt import *
from ..config import *
LOGGER = logging.getLogger(__name__)
class Delegate(QItemDelegate):
def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex) -> QWidget:
if index.column() == 1:
... |
b5d192a809da13a792ef051b8919ae1191abc48635c8fdcbb023eb1ff7abed3f | Python | 9,698 | 232 | import os
import os.path as osp
import numpy as np
import torch
from torch.utils.data import Dataset
import cv2
import matplotlib.pyplot as plt
import albumentations as albu
import matplotlib.patches as mpatches
from PIL import Image
import random
from .transform import *
CLASSES = ('ImSurf', 'Building', 'LowVeg', 'T... |
1b94cd5c82a47282ceea98f9ebe073b458d69d21648ea89217aaf0bf3ace7dab | Python | 9,699 | 223 | # Copyright 2021 HIP Applied Computer Vision Lab, 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... |
efedf4ec97534317a0442b4960393c0dd4a003911378eae752861ad650d854f2 | Python | 9,699 | 264 | #!/usr/bin/env python3
"""
CNN vs Rule-Based Artifact Detection Evaluation
Compares trained DLCNN models against rule-based heuristic detectors
for EEG artifact detection across three artifact categories.
Authors: Evans Nyanney, Parthasarathy D Thirumala, Shyam Visweswaran, Zhaohui Geng
Year: 2025
License: MIT
"""
i... |
3d9a9474adf77582b7f7a9904119983503356855bcc08d6c996bb0ec37f50df3 | Python | 9,702 | 237 | import unittest
import logging
import numpy as np
import pandas as pd
import scipy.stats as stats
from batchglm.api.models.numpy.glm_nb import Simulator
import diffxpy.api as de
class TestPartitionNull(unittest.TestCase):
def test_null_distribution_wald(self, n_cells: int = 4000, n_genes: int = 200):
""... |
598666cb5ac9e23b292f826c87664311340b9c204e8eee468ecda502e791175a | Python | 9,702 | 218 | from typing import Union, Tuple, Optional
from torch_geometric.typing import (OptPairTensor, Adj, Size, NoneType,
OptTensor)
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Parameter
import torch.nn as nn
from torch_sparse import SparseTens... |
3b79a58b7e439a55904151b59fab595ff9fd9329bd4964efec6349e4c567cc7d | Python | 9,709 | 344 | # -*- coding: utf-8 -*-
"""
Interface to read/write image stacks saved as a list of files
The filename is given as regular expression as described
`here <https://docs.python.org/2/library/re.html>`_.
It is assumd that there is a single digit like regular expression in the file
name, i.e. ``\\d{4}`` indicates a place... |
54875db17e0179de5d5d23f1678ce2a897759156ec0b3c90cd21ef0c310771ee | Python | 9,709 | 270 | """Tensor utilities and type conversions."""
from collections.abc import Callable
from functools import wraps
from typing import Any, TypeAlias
import numpy as np
import torch
TensorType: TypeAlias = torch.Tensor | np.ndarray
def convert_to_torch(
data: TensorType,
) -> tuple[torch.Tensor, bool, torch.device |... |
814c95b7d59c66ed2fec0d0dff159f69b1d1ae318f7490fdbd82a92d8f62d8e3 | Python | 9,710 | 308 | import textwrap
from typing import Any, Dict, List, Optional, Tuple, Union
import matplotlib # type: ignore
import matplotlib.pyplot as plt # type: ignore
import numpy as np
from anndata import AnnData # type: ignore
from matplotlib.axes import Axes # type: ignore
from numpy.ma import masked_array
from numpy.typin... |
e15275e6b90de12b7079eb3dc0f59f6832b51bb6d7b93244d170a03a361cb8b1 | Python | 9,710 | 321 | 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... |
45f2771161b9fe12ef07e79ffc89b26bfa6c5b2fdb09ccc712d19d10d9d81069 | Python | 9,722 | 243 | from typing import List, Optional, Tuple, Union
from torch import Tensor
from torch.nn import (
BatchNorm1d,
Dropout,
InstanceNorm1d,
LayerNorm,
ReLU,
Sequential,
)
from torch_geometric.nn.aggr import Aggregation, MultiAggregation
from torch_geometric.nn.conv import MessagePassing
from torch_g... |
413432c5f49106aa22bf06b5120612c4dddd5b78efe0cbeb1dae2932b3a5d9f0 | Python | 9,725 | 234 | # the following is from github.com/jcouto/btss
from statsmodels.stats.proportion import proportion_confint
from scipy.special import erfc # import the complementary error function
from scipy.special import erf # import the error function
# This has example ways to fit the psychometric function and getting confidence in... |
00bd3b19a565d838a7964dcfc6bbc410df4bbe0c4a01d8a900edd7fe88a42035 | Python | 9,729 | 274 | import math
import os.path
import unittest
import tests.base_test
import tests.output_parser as output_parser
import tests.test_config
import tests.util
class DartsModelBaseTest(tests.base_test.BaseTest):
def setUp(self):
super().setUp()
self._test_base_dir = tests.test_config.TEST_BASE_DIR
... |
086ffbe92ce09bf3fae5aecb24a82482bb5dab5e6bf9b70a96e2ece0a0a72913 | Python | 9,729 | 225 | import numpy as np
from typing import Union, Tuple
from ..config import NP_COMPLEX
from .transfermatrix import PairwiseUnitary
class MZI(PairwiseUnitary):
"""Mach-Zehnder Interferometer
Class simulating the scattering matrix formulation of an ideal phase-shifting Mach-Zehnder interferometer.
This can im... |
bd0fc497dc57652e8912e023d253a9f137a60b6b2c95680b4238fee128ff70ed | Python | 9,729 | 270 | import os
import matplotlib.pyplot as plt
import pandas as pd
import torch
from mcmlnet.experiments.plotting import (
add_theoretical_bounds,
plot_scaling_fit,
setup_plot_style,
)
from mcmlnet.experiments.utils import (
compute_mae_ci,
neural_scaling_fit,
neural_scaling_fit_log_scale,
)
from m... |
8fe86148bd472de6c934521e7468ed416a6a0132df0549f30d3a61938adb8fac | Python | 9,731 | 234 | import pandas as pd
import shutil, os
import os.path as osp
import torch
import numpy as np
from dgl.data.utils import load_graphs, save_graphs, Subset
import dgl
from ogb.utils.url import decide_download, download_url, extract_zip
from ogb.io.read_graph_dgl import read_graph_dgl
class DglGraphPropPredDataset(object):... |
a019249d4445dc6f66d05b58ea2815912aca6e6985a9dcdc0a1bde3405387a69 | Python | 9,732 | 247 | """Test the image condition identification accuracy of the encoding model's in
silico neural responses for NSD-synthetic's images.
Parameters
----------
subjects : list
List of the used NSD subjects.
ncsnr_threshold : float
Lower bound ncsnr threshold of the kept vertices: only vertices above this
threshold are use... |
8035382a4c8a0fe7419ab374c3a4a31e60231ff1502a564fb09b0da56af4f7ed | Python | 9,739 | 282 | # FetMRQC: Quality control for fetal brain MRI
#
# Copyright 2023 Medical Image Analysis Laboratory (MIAL)
#
# 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/licens... |
91a42f66b1d8303a81a09064ffdb9c7381263c0b5dc5212f3070f6ae2640da07 | Python | 9,741 | 286 | from typing import List, Final
import torch
from mlcg.nn import MLP
from mlcg.geometry import compute_distance_vectors
from .base import RANGE
from ..blocks import (
RANGEInteractionBlock,
AggregationBlock,
BroadcastBlock,
PaiNNBlock,
)
from ..system import System
from ...utils import create_instance... |
ec44282414071dadc7e87b7323a3f511a33a6798bb97dfa42cc843efbcf676a3 | Python | 9,746 | 273 | import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt
import glob
import sys
import os
import re
import json
from matplotlib.ticker import ScalarFormatter
plt.rcParams["font.sans-serif"] = ["DejaVu Sans"] # Best available
plt.rcParams["font.family"] = "sans-serif"
plt.rcParams.update({
"font.si... |
d5edb65086ab27bb6603a65c0b45f821fea15b245caa2876ebc8ce55d538ba7b | Python | 9,749 | 263 | from __future__ import annotations
from dataclasses import replace
from typing import TYPE_CHECKING, List
import napari.layers
import numpy as np
from napari.qt.threading import FunctionWorker
from PyQt5.QtWidgets import QApplication
from brainways.pipeline.brainways_params import BrainwaysParams, TPSTransformParams... |
a49ff03b8f909b4c684d8ab50e419234b804ee5bca7ba9a33baacd20c9de6788 | Python | 9,753 | 300 | import torch
import torch.nn as nn
from einops import rearrange, repeat
class MultiHeadAttention(nn.Module):
def __init__(self, embedding_dim, head_num):
super().__init__()
self.head_num = head_num
self.dk = (embedding_dim // head_num) ** (1 / 2)
self.qkv_layer = nn.L... |
5f8a0b9869151e129f5a8315baa7b2b3a3ff61dae3bc187e55824ab7ff440255 | Python | 9,755 | 245 | """
This script will extract two intensity features, median and std, as well as six haralick features from image.
It is tested to work with Visium he and if images.
A conda env is available in the project folder.
# input folder must have the raw tif image and the spot_metadata csv file.
# The spot metadata file MUST ... |
40e8c9e1786d8d2066e2bad2ff61691d99097ae4c9f43ab381a33067aaa99e4f | Python | 9,756 | 179 | import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import cebra
def knn_decoder_function(embedding_train, label_train, embedding_test, label_test, arglist, K_num=1):
"""
Calculate temporal decoding accuracy for no-distractor trials (training and testing dataset).
Parameters:
- embedding_... |
0616a905729db6e6c391081ba0cb5525ea4050b026f2fdd07e820b1aedb94508 | Python | 9,757 | 298 | """Wrappers for scikit-learn."""
import logging
from typing import Dict, Optional, Tuple, Union
import numpy as np
from scipy import special, stats
from sklearn.linear_model import LinearRegression
from sklearn.mixture import GaussianMixture
from osl_dynamics.utils import plotting
_logger = logging.getLogger("osl-... |
7122ca1e6bf1041a1bacdc39876069f2f82106da28806e874659a89d58958b18 | Python | 9,757 | 140 | """ This script investigates the capability of the CNN to correctly classify samples of rotor blades from previously
unseen values of a certain meta parameter.
"""
import os
import argparse
from utils.env_config import setup_environment
import timm
from data.dataloader import prepare_dataloaders, prepare_dataset_pa... |
bfd530ccd1fad598045428bdd72e77bdc8086753059d2f13ea8b6023adf3585a | Python | 9,758 | 288 | """The shared voxel-matching helper.
This is the common core beneath the closest-streamline search, surface-voxel
collapsing, and 2-D coordinate calculation, and both open contributions reduce
to its behaviour. It is pure and takes small arrays, so it can be covered
exhaustively.
Its contract, stated plainly: given a... |
1e8e4be469dff5d6b91d32f4b018e4500b11fd3ded47e626c3dbb5d6b99f2582 | Python | 9,759 | 234 | import os
import os.path as osp
import numpy as np
import torch
from torch.utils.data import Dataset
import cv2
import matplotlib.pyplot as plt
import albumentations as albu
import matplotlib.patches as mpatches
from PIL import Image
import random
from .transform import *
CLASSES = ('Building', 'Road', 'Tree', 'LowVe... |
357e8fc8a2d871c127b2419fd53d2365a38cc88f9757ef5f64b11a4ca9808324 | Python | 9,760 | 304 | # NOQA
# flake8: noqa
#pylint: skip-file
#
# impyute documentation build configuration file, created by
# sphinx-quickstart on Sat Mar 11 02:25:20 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogene... |
ca8632ba9c5907fb610bde51f43dd6807a0c4aba6b41d1e95e952f2b882691ed | Python | 9,761 | 205 | import gzip, random, numpy as np, argparse, joblib, linecache
from sklearn.metrics import jaccard_score
from shared import *
import tempfile
NUM_WORKERS = 4
def main():
parent_parser = argparse.ArgumentParser(
prog="base_maker", description="Predict score given a trained classifier", add_help=False
)... |
9c2f723ee6ebec7807f75e4ed10386418eced8cbb5eb53bb1817bfd8068cc190 | Python | 9,762 | 264 | # This file is part of Mooney computational modeling project.
#
# Mooney computational modeling project is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
eb79b9db879e9a14686bbe91879a485f7ffa47b1cd473beb40653f20f1201fb9 | Python | 9,764 | 296 | from . import BasePositivity
import pandas as pd
import numpy as np
from sklearn.exceptions import NotFittedError
class Support:
"""Base Support class
"""
def __init__(self, support=None):
self.support = support
def __str__(self):
return "support: " + self.__repr__()
def __repr_... |
15f85ac00256990053aff62995f9d7928a3ac1dbee33df31454b9409f0fa6a66 | Python | 9,765 | 301 | from argparse import Namespace
from collections.abc import Mapping, Sequence
from copy import deepcopy
from pathlib import Path
import pytest
import yaml
from aislib.misc_utils import ensure_path_exists
from eir.predict_modules.predict_config import (
_check_matching_general_output_configs,
_get_maybe_patched... |
c230711edc79ec4fa2c9cd1eaaa05c8d46b37780adacd4b63449eca997185491 | Python | 9,770 | 275 | #!/usr/bin/env python3
"""
A few items to deal with sets of benchmarks.
"""
import os
import re
import csv
import glob
import json
import logging
import subprocess
import samreader as Sr
class Benchmarks(object):
"""
Iterable for all benchmarks found in our test directory.
"""
def __init__(self,
... |
8b64deb52666dee46e4f4d46efcd1466e20cef3c20a698b6fb3e822c605d318b | Python | 9,774 | 211 | import sys
import time
import numpy as np
import pandas as pd
from scipy.stats import norm
import my_setup
class BatchAcquisitionFunction:
def __init__(self, model, model_args, domain, data, model_output_transform=None, config=None):
self.label = "BatchAcquisitionFunction"
self.model = model
... |
edae497772fef319b37f6393e51ea44be5f14712d2670259282ef66bb2d15f07 | Python | 9,774 | 298 | #!/usr/bin/env python
"""Smoke test for EnsembleLauncherBackend on an HPC compute node.
Must run **inside** a PBS interactive allocation on Polaris or Aurora,
in a venv where ``ensemble_launcher`` is installed (it is built from
source by ``scripts/hpc_setup/install_remote.sh`` -- PyPI wheels only
support Python <3.12)... |
3b6c74b393b2340745dfa4120935fe98b08f8dee3783b9a88875ceeaa18d0ecf | Python | 9,779 | 251 | # Kai Sandbrink
# 2023-02-01
# This script has project-specific util functions (unlike utils.py which is meant to be global)
# %% LIBRARY IMPORT
import numpy as np
import yaml, os, copy, math, pickle
from utils import Config
# %% PARAMETERS
base_model_folder = os.path.join('nns', 'models')
# %% DATA READ IN
def ... |
0a94dd931d905803ed15f8492d1f1fdf359553ae364d3d677be87bc342327013 | Python | 9,784 | 232 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# Modified by HQ-SAM team
# 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 torch
from torch import nn
from torch.nn import functional as F
from typing import List,... |
ae96df955c2a9011d8688f78026cd61754a21e4e00c769994b7a6d9f459c3e0e | Python | 9,785 | 179 | import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import cebra
def knn_decoder_function(embedding_train, label_train, embedding_test, label_test, arglist, K_num=1):
"""
Calculate temporal decoding accuracy for no-distractor trials (training and testing dataset).
Parameters:
- embedding_... |
28168cb818d167ab01957f96dfa9379e01e8c848cf4fddf4650a037adc929290 | Python | 9,786 | 303 | from __future__ import annotations
import ast
import re
# new: src/utils/data_loader_safe.py (or place near your plotting code)
# New: robust normalizer that never evaluates list-like NA in a boolean context
from ast import literal_eval
import numpy as np
import pandas as pd
import yaml
from pandas.api.types import i... |
6ff946cc6fc9b7a2f6bf18d6f38af33d258bf40fa88c1d5c2083bf174ee3eae6 | Python | 9,789 | 288 | from typing import Optional
import numpy as np
from anndata import AnnData
from GEASO.alignment.coarse_alignment import coarse_alignment
from GEASO.alignment.data_interpolate import interpolate_displacement_field
from GEASO.alignment.elastic_registration import ElasticRegistration
def _to_numpy_matrix(x):
if ha... |
7753a94a0d9a7442010bd67a294e936995e20b29c73d0882374bf3b1f964aad7 | Python | 9,790 | 188 | # Copyright (c) 2022, Kwanhyung Lee, AITRICS. All rights reserved.
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT ... |
5b797e85952d2ed8fcf7ec7b93379965e1bb5ce55f0db33e7c63366ef87c4f52 | Python | 9,792 | 212 | # Copyright (c) 2022, Kwanhyung Lee, Hyewon Jeong, Seyun Kim AITRICS. All rights reserved.
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed o... |
c16b9f8340e9970887863d26d8d08fb717fe1c202c081b1bd8c3f48925551ae5 | Python | 9,794 | 274 | import json
from collections.abc import Sequence
from copy import copy
from pathlib import Path
from typing import TYPE_CHECKING
from aislib.misc_utils import ensure_path_exists
from eir.experiment_io.io_utils import (
check_version,
dump_config_to_yaml,
save_dataclass,
)
from eir.experiment_io.output_obj... |
a9e3fbc91b14f888d6e076415698fa861e8cd7bdc4fcce6d994a674c1f91f577 | Python | 9,799 | 278 | from typing import List, Union, Dict, Tuple
import numpy as np
from napari.utils.notifications import show_info
from brainglobe_atlasapi import BrainGlobeAtlas
def get_bregma(atlas_id: str) -> List[int]:
"""
Definition of bregma coordinates for different atlases.
Parameters:
atlas_id (str): The ... |
91a0a5745ce85feac7de7b1f342f522f09e50245e0a830e98f85d7a6597301ec | Python | 9,800 | 305 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import argparse
import json
import os
import textwrap
import types
from abc import ABCMeta, abstractmethod
from collections.abc import Callable, Mapping, Sequence
from typing import Protocol
from attr.converters import to_bool
from cvat_sdk import C... |
eb4cba01d7a61827e4be47f2a922885a969a3a5380c49e0dae0a2769f51644fe | Python | 9,808 | 229 | from fastai.vision import *
def bbox_to_activ(bboxes, anchors, flatten=True):
"""Return the target of the model on `anchors` for the `bboxes`."""
if flatten:
# x and y offsets are normalized by radius
t_centers = (bboxes[..., :2] - anchors[..., :2]) / anchors[..., 2:]
# Radius is give... |
34ec58fa38ed689c9362dc4822522042dfc2df6c04c64c6bb958b23cd16f775d | Python | 9,810 | 242 | """Expose a configured local tool catalog only when an agent requests it."""
import json
import re
from typing import Annotated, NotRequired
from langchain.agents.middleware import AgentMiddleware, AgentState, hook_config
from langchain.agents.middleware.types import PrivateStateAttr
from langchain.tools import ToolR... |
dc9f3f7103c0b5afc6bcd1afcc24664b71c1330e5e784e04d0c8e5b688f85b1c | Python | 9,810 | 170 | import os
import subprocess
import nibabel as nib
import numpy as np
import json
from nipype import Node, Workflow
from nipype.interfaces.utility import IdentityInterface, Merge, Function
from .sepia_qsm.sepia_qsm_nipype import SepiaQSM, QSMRegister
from ..smri.fsl.fsl_anat_nipype import FSLANAT
from ..common.copy_to_... |
5999566e984a6bc8b325f2c779c61802f010366f448d16d415d5204589eacc5d | Python | 9,813 | 217 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Performs an operation on data per point (dpp) from input streamlines.
Although the input data always comes from the dpp, the output can be either
a dpp or a data_per_streamline (dps), depending on the chosen options.
Two modes of operation are supported: dpp and dps.
... |
de6346315b3ce6eac6dfe81accbb1673e573819566561dd4252bf8c34f7d3dea | Python | 9,815 | 237 | from typing import Tuple, Union, Optional
import tensorflow as tf
try:
import torch
from torch.nn import Parameter
except ImportError:
# if the user did not install pytorch, just do tensorflow stuff
pass
import numpy as np
from .config import TF_FLOAT, NP_FLOAT, TEST_SEED, T_FLOAT
from .helpers impo... |
a20dfe280186f8e3279b7eb11a6f7e42d1e649c77718fe2a8943e59414b43525 | Python | 9,820 | 219 | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 11 22:01:59 2016
@author: ajaver
"""
import numpy as np
import tables
import pandas as pd
import warnings
from tierpsy.helper.params import read_fps, read_microns_per_pixel
from tierpsy.helper.misc import print_flush, get_base_name
from tierpsy.analysis.stage_aligment.f... |
bfc983b10c7665b42e55f05788d4597902639358195939ee19302195b90b6de8 | Python | 9,823 | 228 | import os.path
import unittest
import tests.base_test
import tests.output_parser as output_parser
import tests.test_config
import tests.util
class Test(tests.base_test.BaseTest):
def setUp(self):
super().setUp()
self._test_base_dir = tests.test_config.TEST_BASE_DIR
self._test_dir = os.pa... |
d955966de6909681f7255c1b89e9b64b460676642eadea04d684fc8b9ac8bc7f | Python | 9,825 | 233 | # 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 numpy as np
import torch
from torch import nn
from typing import Any, Optional, Tuple, Type
from .common import L... |
16f69b34fc731ebf3756c56f9258fd5dab3a45755c24132cfe3f24bd8ff3b56f | Python | 9,828 | 287 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 22 01:45:25 2025
@author: Zhenis
"""
# -*- coding: utf-8 -*-
import pickle
import numpy as np
from scipy.signal import butter, filtfilt
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
import torch
from t... |
b3ab774799ef2b924b19003f1d85257fee1d0ecdfa68a6068895b9ef0e094d2f | Python | 9,829 | 308 | from copy import deepcopy
import pytest
import torch
from torch import nn
from eir.models import model_training_utils
from eir.models.input.array import models_cnn
from eir.models.input.array.models_cnn import ConvParamSuggestion
@pytest.fixture
def create_test_util_model():
class TestModel(nn.Module):
... |
1242e076f5228e45fb1b5594e40f6bb334adc73f383166e36e873f54bb9b2c35 | Python | 9,830 | 288 | # -------------------------------------------------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------------------------------------------------
import datetime
import numpy as np
import os
import pickle
import sys
i... |
28dae3347ce4abe4a7c8c858edd0ce665656c78d0dbd55b34b37f59e0ecf5938 | Python | 9,830 | 290 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 28 21:27:06 2024
@author: Administrator
"""
import os
import yaml
import sys
import PIL
import torch
#import torchvision
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import scipy.io as scio
import torch.nn.functional as F
fr... |
f86bcda356706492e06138d35af3308b315e20d6022d829d0e58f794f88b142e | Python | 9,830 | 292 | import json
import grpc
import typing
import asyncio
import logging
import traceback
import jsonpath_ng
import jsonpath_ng.ext
from . import thalamus_pb2
from . import thalamus_pb2_grpc
from . import util_pb2
from .config import ObservableCollection, ObservableDict, ObservableList
from .task_controller.util import cr... |
44c9e7d2478fe6f00bc216a5a07aa3ab5b1a51c2f9ea4255b97902b004894402 | Python | 9,832 | 289 | # -*- coding: utf-8 -*-
"""
Plots for autocorrelation analysis (experiment)
The purpose of the following script is to generate exemplary plots for the
autocorrelation analysis of ODC data. Data are averaged across hemispheres and
two separate sessions. The following plots are
produced:
1. cortical depth vs. fwhm (... |
25f168eb58aaf754b67a6e6619a4cdd3a2d1346fb7ea444cb2a631e67bd475af | Python | 9,833 | 306 | ########################################################################################
### Utility function for different purposes regarding the reading of simulation data ###
########################################################################################
### Copyright 2017-2021 Jannik Luboeinski
### l... |
93a4fc984b18613dbf45167244f93ebfa120aa529cff2536b1078f18e78bb3e0 | Python | 9,833 | 247 | import os
import re
from pathlib import Path
from typing import Tuple, List, Dict
import sys
class MarkdownProcessor:
def __init__(self):
self.processed_files = []
self.warnings = []
def remove_references(self, content: str) -> str:
"""Remove everything from the last occurrence of ... |
c243c0b027c199de5c06905f702f6e414d3029a9aec1dcf13f6d3604b6be34a6 | Python | 9,833 | 282 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
"""Find objects annotated twice: objects on the same frame that have the same
label, the same shape type, and exactly the same coordinates.
Duplicates appear when an import runs twice, when two annotators' job ranges
overlap, or after a merge. Shape... |
a4ec57f826cfc5eda395c08cffd9bfbc0880a82e7c444431f6a18a8d052860ae | Python | 9,835 | 279 | """
Tests for the warping module.
"""
import pytest
import numpy as np
from pathlib import Path
from unittest.mock import patch, MagicMock
import json
from stack_corr.warping import DendriticWarpingProcessor, warp_dendrites
class TestDendriticWarpingProcessor:
"""Test the DendriticWarpingProcessor class."""
... |
321ec628797f4572fc97978843a071ce5d5fcef5d6f8ccc82a675506c892dd32 | Python | 9,838 | 215 | import os
import sys
import pandas as pd
import anndata as ad
import numpy as np
import scipy
import scanpy as sc
import warnings
warnings.filterwarnings('ignore')
import random
from model.utils import *
from scipy.sparse import csr_matrix
from scipy.stats import lognorm
from model.data_downsample import downsample_mat... |
278d029de74522ab4a2352e15b52134841516c0fd788964bea5012acac141002 | Python | 9,841 | 270 | from typing import Optional, Tuple
import torch
import torch.nn.functional as F
from torch import Tensor
from torch_geometric.nn import SignedConv
from torch_geometric.utils import (
coalesce,
negative_sampling,
structured_negative_sampling,
)
class SignedGCN(torch.nn.Module):
r"""The signed graph c... |
fb1268b149822c43ed6f3960cf96ad8b624f397a8be76597f950ddb8dfd27373 | Python | 9,843 | 129 | from brainvoice.data.estimates_loader_utils import load_beta_estimates, load_estimate_labels
from brainvoice.spectrogram_utils import linearspectrogram, get_better_synth_hparams
import pathlib
import numpy as np
import os
from tqdm import tqdm
from scipy.signal import resample
import soundfile as sf
def waveform_to_... |
a7b8e388249ea17ac30b89adcb3d039abf7b01651ec4fbfe7d0955e694d4f8ba | Python | 9,845 | 263 | # -*- coding: utf-8 -*-
# @Author : LG
from PyQt5 import QtWidgets
from ISAT.widgets.polygon import OBB, Polygon
def snapshot_shape(shape):
"""Serialise one finished shape into an ``Object`` (scene coordinates).
``to_object()`` bakes the item offset into every point, so the snapshot
is a faithful scen... |
9ae511ee441fcdd95e9c82c2ea9db5db329eb095329836005446ff1e9b704e8f | Python | 9,849 | 266 | import os
import unittest
import SVMTK
import pytest
tests_dir = os.path.dirname(__file__)
def ellipsoid_function( x, y, z):
return x*x + 4.*y*y +4.*z*z-1.;
def torus_function(x,y,z):
return ((x**2+y**2)**0.5 - 1)**2 + z**2 -4
class Surface_Test(unittest.TestCase):
def test_surface_io(self):
... |
a8fae748cfce430bd4553162b4bfa61f9f9c77d050b39410f34d136883ba1347 | Python | 9,852 | 248 | # multi-stage residual BCR
import tensorflow as tf
from tensorflow.keras.layers import Input, Dense, Conv2D, AveragePooling2D, Reshape, Concatenate
from tensorflow.keras.layers import *
#from keras.layers.local import LocallyConnected2D
from tensorflow.keras.models import Model
def rdb_block(x_in, filters, k_size... |
aee31489357719956dd85793db22865607ba184bdc96d0bff5ca760ec766ba15 | Python | 9,852 | 247 | """Test pipeline Step 2 — neuronal activity / burst detection parity with MATLAB.
Run from the repo root::
uv run python python/test_pipeline_step2.py
Unlike ``test_pipeline_step1.py``, this test feeds Step 2 the *MATLAB reference
spike times* (not Python's own Step 1 output) before comparing against MATLAB's
``... |
8a08b3b46a9ce1feef1eb0718333a880cb4fb874465eec1535ef0e9bfa7a46bc | Python | 9,855 | 314 | # Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
#
# 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... |
cce72c42329506ce7f28349e3a8266b4e063feaceff9f9832022a933c777812e | Python | 9,856 | 211 | import logging
import os
from pathlib import Path
import numpy as np
import pandas as pd
import xarray as xr
from brainscore_core.supported_data_standards.brainio.fetch import StimulusSetLoader
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
from brainscore_core import Score
from brai... |
70b7c4ec31231e48e20a63c4437a4f164ad118ddbcab55e2f05324ac3b841da5 | Python | 9,857 | 229 | #!/usr/bin/env python
"""
Handles hardware timing for a setup. This is a setup that doesn't
use a camera for the time base, but instead uses another source
such as a counter on a DAQ card.
Note: In this case it is enforced that there are no master cameras.
Hazen 10/19
"""
from PyQt5 import QtCore
import storm_cont... |
ba1b9e42d15cb2338e41d6ef6e05845f7969c9a151c2e77b9c7847f1eb317926 | Python | 9,858 | 240 | import numpy as np
import pandas as pd
import hail as hl
from scipy.stats import chi2
from concurrent.futures import ThreadPoolExecutor
from heig.wgs.wgs2 import RVsumstats
from heig.wgs.coding import Coding
from heig.wgs.utils import *
"""
Computing variant-level associations
TODO:
1. support noncoding and w/o anno... |
99a3caa79bc4544f62d9f03afdb2b671e5d33e5d6e09ac701c056da925cbcf88 | Python | 9,865 | 339 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import os, sys
import nibabel as nib
import numpy as np
from dipy.io import read_bvals_bvecs
from dipy.core.gradients import gradient_table
import dipy.reconst.dti as dti
from dipy.reconst.dti import (design_matrix, decompose_tensor,
... |
bf3e1d26355c54a81eba8dc59bef0a29161cfa84c539f43cdd342848d6dff11c | Python | 9,865 | 199 | import matplotlib.pyplot as plt
import numpy as np
from matplotlib.animation import FuncAnimation
import json
import numpy as np
import os, cv2, glob, json, gc
import pandas as pd
import itertools
from itertools import chain
from moviepy.editor import VideoFileClip
import skvideo.io
from tqdm import tqdm
import circsta... |
6a17086d8525dc4d102636e4f2c6f3796301cdd74ef8415062f8fb0bf0b5e4e1 | Python | 9,868 | 305 | import copy
import os.path as op
from time import time
import dipy.tracking.streamlinespeed as dps
import numpy as np
from dipy.io.stateful_tractogram import Space, StatefulTractogram
from dipy.io.streamline import save_tractogram
from dipy.tracking import Streamlines
from dipy.tracking.distances import bundles_distan... |
365896e96fcfb1371216a50a65d0b286fa370a6279bb6e7302aa75eaa6b9e129 | Python | 9,869 | 265 | """
Generate images for the "Moments Matching with Scaling" How To tutorial.
Run from the project root with the fireants conda env, e.g.:
conda activate fireants
python docs/scripts/generate_moments_scaling_images.py
Uses the same test data as tests/test_moments_scaling.py.
Writes to docs/docs/assets/howto/:... |
e1afacbf13551bb800610bc2ec72e9e5124fd3490a3488341de0470d138c3360 | Python | 9,870 | 305 | import numpy as np
import math
import pandas as pd
import random
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
from mpl_toolkits.mplot3d import Axes3D
def xs(x, y, w):
if len(x) == len(y) == len(w):
num1 = 0
num2 = 0
for k in range(len(x)):
num1 += x[... |
458362dc8cc7ccca773e5083119a8409989a5c7def5a804ad857b5865aeb2675 | Python | 9,873 | 271 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 6 21:10:34 2025
@author: umit
"""
import os
import tempfile
import numpy as np
import librosa
from moviepy import AudioFileClip
from ..utils.io_helpers import check_outputfile
def extract_audio_features(video_path,
o... |
f06ee2c9c9927eeab54677ea69acb2ca5792c888734777693f6485fb200361fa | Python | 9,874 | 303 | """
This script is used to make plot for the angle bwetween actor and observer
outcome dimensions and the switch evidence direction.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import os
import numpy as np
import json
import matplotlib as mpl
import matplo... |
a255a039747560d0a5d256466850d269300e796f6d8f0236cad8865eb7af399c | Python | 9,875 | 304 | """
Simulate pulsatile g1 time series from ground truth waveforms.
This script generates g1 time series using MCX `.mch` files and a ground truth waveform.
It supports batch processing with multiple source-detector separations and acquisition frequencies,
parallel execution, and saving results as `.pkl` files.
Usage:... |
79b0b6f2b5f427466e58d1a96212413457d444afa3b481250624b69683b530a2 | Python | 9,876 | 338 | import os
import nibabel as nib
import numpy as np
import pyvista as pv
from nibabel.streamlines import load as load_tck
from skimage.measure import marching_cubes
class GlassBrainPlotter:
def __init__(
self,
t1_path,
mask_file=None,
brain_iso_value=120,
brain_opacity=0.10,... |
f312ade595bc07e5c70668c61a79f10a8fa58e40433a10fbb6cba75f7db48bb6 | Python | 9,877 | 255 | from qtpy.QtWidgets import (
QMessageBox,
QPushButton,
QSlider,
QVBoxLayout,
QWidget,
QGridLayout,
QLabel,
QGraphicsItemGroup,
)
from qtpy.QtCore import Qt, QSize
from qtpy.QtGui import QIcon
from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.view.GraphicViewers import Viewe... |
c0a3d8433ca79e6bd38129e39c8c2ded11ba4c886f0ab1ecb9a8b26d08e4fdc7 | Python | 9,884 | 304 | import os
import re
from pathlib import Path
from typing import Dict, List, Optional
import pandas as pd
class FreesurferStatsExtractorMixin:
# -----------------------------
# Helpers (shared by cross/long)
# -----------------------------
@staticmethod
def _safe_name(x: str) -> str:
x = st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.