sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
e87069db781ebea6f2edc4406309c9903949f9bd047e42f925395f2c2604ffe2 | Python | 7,675 | 191 | #!/usr/bin/env python
"""Smoke test for GlobusTransferManager (+ optional MCP integration).
Exercises the production transfer layer from the laptop. Exits 0 on
success, nonzero on any failure.
Prereqs (env vars)
------------------
- GLOBUS_TRANSFER_SOURCE_ENDPOINT_ID -- local Globus collection UUID
- GLOBUS_TRA... |
8afde4540a9b8629b96306364501d75f1eb602ee543a9fb84afccecb065881b8 | Python | 7,677 | 258 | # Written by Yixiao Ge
import time
import faiss
import numpy as np
import torch
import torch.nn.functional as F
from .faiss_utils import (
index_init_cpu,
index_init_gpu,
search_index_pytorch,
search_raw_array_pytorch,
)
__all__ = [
"build_dist",
"compute_jaccard_distance",
"compute_eucl... |
17473f2dbb08db4b9f0e88f7739bd33c0977a7033b4edeae73162698f54403ea | Python | 7,678 | 200 |
from brainscore_vision.model_helpers.check_submission import check_models
import functools
import numpy as np
import torch
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from PIL import Image
from torch import nn
import pytorch_lightning as pl
import torchvision.models as models
import ... |
51bc98491fbfae1cfce4531b70d596b5eacb18a40d737f8c9cd38b745c9fc49f | Python | 7,678 | 185 | """Surfacing the per-recording acquisition rate of a CAT-NAP run.
CAT-NAP reads each recording's frame rate out of its own ``ops.npy`` and
ignores the GUI's sampling-rate field — which is what MATLAB does too
(``suite2pToAdjm.m`` assigns ``Params.fs`` from the file). The consequence is
that a batch has no single sampl... |
8672c39435c35e737037d6693f4276768b5dfc01edef496192bf8e7dc5f5bf61 | Python | 7,678 | 200 |
from brainscore_vision.model_helpers.check_submission import check_models
import functools
import numpy as np
import torch
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from PIL import Image
from torch import nn
import pytorch_lightning as pl
import torchvision.models as models
import ... |
b2dc6c734833351fdeff8de446619a2bb67317b26a2fa381d428889e7bf89acf | Python | 7,678 | 200 |
from brainscore_vision.model_helpers.check_submission import check_models
import functools
import numpy as np
import torch
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from PIL import Image
from torch import nn
import pytorch_lightning as pl
import torchvision.models as models
import ... |
9000f53f6275d3c4131f5f22bbb9e8056e9f466be95fe34fcf81f453dbe3ff1d | Python | 7,679 | 179 | """Round-trip integration tests for the brainscore_core submission DB contract.
These tests catch schema mismatches between what wrapper benchmarks produce in
``score.attrs`` and what ``brainscore_core.submission.database.update_score``
expects when recording to the leaderboard DB. Every issue we've hit serially
(miss... |
62f4bed88d11adb3205d03b457ad4504f3df8b0f9099d515b0b7254d447abcda | Python | 7,680 | 206 | import os
import sys
import random
import subprocess
try:
import resource
except ImportError:
# resource doesn't exist on Windows systems
resource = None
import numpy
import torch
from torch import cuda
from stog.utils import logging
from stog.utils.logging import TeeLogger
from stog.utils.tqdm import Tqd... |
86d7a84bee6ee39fc7c1909c239714b383dfb91e2ffee95da808bfbd0f90c636 | Python | 7,684 | 221 | """Plot the MDS univariate and multivariate NSD-synthetic fMRI responses
analsyes.
Parameters
----------
subjects : list
List with all used NSD subject.
rois : list
List with all used NSD ROIs.
zscore : int
Whether to z-score [1] or not [0] the fMRI responses of each vertex across
the trials of each session.
ncsnr... |
92f0acc229c058799bb27003a2a7c4dc41403cbc1ac52fb36d5c563aca44ca8c | Python | 7,685 | 205 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import base64
import os
from typing import Any, Optional
from openai import OpenAI
def get_image_base64_and_mime(image_path):
"""Convert image file to base64 string and get MIME type"""
try:
# Get MIME type based on file extens... |
4f2f5763cd0c3e2696bc5df73ecc4e5cbbf729aabb8fc624b61d9cbdd9a62b4c | Python | 7,686 | 203 | # """
# @misc{chitlangia2021epileptic,
# author = {Chitlangia, Sharad},
# title = {Epileptic Seizure Detection using Deep Learning},
# year = {2021},
# publisher = {GitHub},
# journal = {GitHub repository},
# howpublished = {\url{https://github.com/Sharad24/Epileptic-Seizure-Detection/}},
# }
# """
# impor... |
9fdb754cf05aa19b1bec9cd589d97c925f31d6fb656a553b5ebe27a90fc7b06f | Python | 7,687 | 61 | from testsetclass import TestsetClass
class MB1643(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['03', '04', '32', '35', 'S2', '34', '33', '05', 'P2', '02', 'H2', 'MgH2', 'LiH', 'BH3', 'O2', 'F2', 'NaH', '20', '18', '27', '11', '29', '16', '42', '28', '17', '10', '19', '26',... |
b94b2ce964749b5f5a00739cbb6b569d1d6b7ffd0f638519727d113b91ada03f | Python | 7,687 | 196 | import scipy.io as spio
import numpy as np
import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def loadmat(filename):
data = spio.loadmat(filename, struct_as_record=False, squeeze_me=True)
return _check_keys(data)
def _check_keys(dict):
for key in dict:
if isinstan... |
197d823826f05fe13198c745313cb053e37312d0ca244a6e3b4b7bde3da38da7 | Python | 7,688 | 285 | import torch
from torch.utils.data import Dataset
from torch_geometric.data import Batch
from torch_geometric.loader import DataLoader
from graphs import (
chem2dataset,
pred2dataset
)
from params import (
load_params,
load_tier1_model
)
from utils import (
device,
set... |
70242b8f2b3cfb9dfd57d79995bdab2004570f620abea71d57ed838a813912d2 | Python | 7,688 | 248 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 22 21:36:36 2023
@author: Gilsoon Park, PhD
USC Stevens Neuroimaging and Informatics Institute
Keck School of Medicine of USC
University of Southern California
2025 Zonal Ave.
Los Angeles, CA 90033
Email: gp_446@usc.edu
"""
import tensorflow as tf... |
66d48704c41fd25839cb96644336857851c373987b250cfc9d3055991f0f12d3 | Python | 7,690 | 212 | # -*- coding: utf-8 -*-
#
# kvclient.py
#
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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.o... |
8c49325a440a0738d86cd8162a8c7d7be93ac9be2e87b8cccc6fc2adb5a376c3 | Python | 7,690 | 210 | import argparse
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torch_geometric.utils import negative_sampling
from ogb.linkproppred import PygLinkPropPredDataset, Evaluator
from logger import Logger
class LinkPredictor(torch.nn.Module):
def __init__(self, in_channels,... |
7b89459b46681425d2fc2b2500ed51965526f2724ee597e59d12033cb89a999d | Python | 7,692 | 224 | """
Analytical Jacobian helpers for GMM and standard Gaussian models.
For a Gaussian peak contributing ``G_i`` to the residual vector:
G_i(x) = A_i / (σ_i √2π) × exp(-0.5 z_i²), z_i = (x - c_i) / σ_i
c_i = centerX + p_i (GMM / standard)
Partial derivatives of the **model** (not the negative re... |
e9f97a2e3d1872c5c4dbcd09c9fa9a93650d8195034f7436aee5079acbc23c2d | Python | 7,692 | 203 | #!/usr/bin/env python
"""Self-contained helpers for reading the labelme JSON annotation format.
labelme is an application, not a Python library: the supported way to consume
its output is to read the JSON format yourself, the way a PyTorch ``Dataset``
reads whatever format its data lives in. This module is the worked ... |
c633a4bee6a4e5498d9d741dc28fce1f54c1576f0c2914312d9b3bd2e28c9910 | Python | 7,693 | 210 | import json
import pytest
from langchain_core.messages import AIMessage
from rich.console import Console
from chemgraph.agent.main_session import MainAgentTurnResult
from chemgraph.cli.formatting import (
_content_text, action_review_summary, build_action_review, console,
format_action_review, format_response... |
735f15172b74cd874db9138d7e3d12f8e5d85c9380e65489e1bd2f8021b478ca | Python | 7,695 | 247 | """
Variant: numba-vectorized (L4 — @njit batch kernel)
Combines two optimisations:
1. **Batch accumulation** (same as ``model_numpy_vectorized``):
peak parameters are collected first, then all Gaussian peaks are
evaluated together rather than one call per peak.
2. **Numba JIT compilation**: the inner ``(K, N... |
e03ec98704fbafa31e71e515552bdd51ed80ccdf625ef75289e6b5db112fd327 | Python | 7,695 | 221 | import copy
import numpy as np
import pytest
import seisbench.generate as sbg
@pytest.mark.parametrize("strategy", ["fail", "pad", "move", "variable"])
@pytest.mark.parametrize(
"ps0", [(-10, 5), (-10, 20), (5, 20), (10, 600), (610, 20), (-10, 620)]
)
@pytest.mark.parametrize(
"ps1", [(-10, 5), (-10, 20), (5... |
ec8ae221457f03c5ad673fb64974f5ba0ba1af8914ed66b0e86f9a7744413024 | Python | 7,697 | 202 | import os
import tkinter as tk
from tkinter import filedialog, messagebox, simpledialog
import numpy as np
from pathlib import Path
import torch
import torch.nn as nn
import cv2
import matplotlib.pyplot as plt
import torchvision.models as models
# Define device
device = torch.device('cuda' if torch.cuda.is... |
4beed4acba8485080464a8e454a760370500e6d7cfd3ebc9f9269718c37201f8 | Python | 7,702 | 203 | from typing import Final, Literal
import numpy as np
from scipy.stats import sem
from argclz import try_int_type, argument
from argclz.dispatch import Dispatch, dispatch
from neuralib.plot import plot_figure, grid_subplots
from neuralib.typing import flatten_arraylike
from neuralib.util.verbose import publish_annotat... |
76fd910083a20bcb4a39fe911e52e1659ea447ec51d51e06cfb3bc7921da3150 | Python | 7,704 | 201 | """Subprocess worker functions used by :class:`ImageAlignmentWidget`.
These functions live at module top-level (no class scope, no closures) so that
``concurrent.futures.ProcessPoolExecutor`` can pickle them across the
process boundary. They are deliberately self-contained: every dependency is
imported lazily inside t... |
414cf0093eda93a568505a0a04fd2baed004a12af926cdc464fc2696c11f28a4 | Python | 7,711 | 204 | #!/usr/bin/env python3
"""Feature selection utilities (public, GitHub-runnable).
This module replaces earlier internal-only code that depended on private project
modules (settings/helper_functions/ml_models). The goal is to keep feature
selection **executable** in a public repo.
Supported methods:
- mutual_informatio... |
b88686ea6090c0d476c5342b1f9e674c1680f15ac255f94b8407b3f6e3bfb9b5 | Python | 7,713 | 276 | from copy import deepcopy
from typing import TYPE_CHECKING
from unittest.mock import create_autospec
import pytest
import torch
from eir.setup.input_setup_modules.torchtext_port.vocab import Vocab
from eir.train_utils.evaluation_modules.evaluation_handlers_utils import decode_tokens
from eir.train_utils.evaluation_mo... |
dbcc0a60350ef816a9972ccc09d9b387e564217029e3c09bb2a7ba13c7c091bc | Python | 7,719 | 231 | # -*- coding: utf-8 -*-
"""
Spatial cross-correlation of the signal intensities in functional time series
This scripts intends to identify corrupted volumes and runs in a set of
functional time series to get a quantifiable and reproducible exclusion
criterion (cf. Marquardt et al. 2017; Bergmann et al. 2019). Referenc... |
76b66c5b77a7a7167c5510de084ca67f8abb031ea38014c08bee0b7bb187babf | Python | 7,721 | 215 | import pathlib
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras import backend
from functions import *
#make a simple model
#rejected
def build_modelA():
model = ker... |
780be899b56481f005a8e2bf984688ce40300e6906f0ffdef3d05137a02738df | Python | 7,723 | 164 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from collections import OrderedDict, namedtuple
from pathlib import Path
import numpy as np
import torch
from ultralytics.utils import IS_JETSON, LOGGER, PYTHON_VERSION
from ultralytics.utils.checks import check_r... |
7b3eaffa675decf3b4cc146ea8613978e171e05164dd95e2c55f64c8a8f8a81c | Python | 7,723 | 222 | import json
import argparse
from chemgraph.tools.ase_tools import run_ase
from chemgraph.tools.cheminformatics_tools import smiles_to_atomsdata
from chemgraph.models.ase_input import ASEInputSchema
import datetime
import subprocess
def get_atomsdata_from_smiles(smiles: str) -> dict:
"""Return a workflow of conver... |
a6c6321074da0300e1197bd08c8d16b2c40493cfef61bb78d9386b16f21e499a | Python | 7,723 | 172 | from src.wrappers.OsipiBase import OsipiBase
from src.original.fitting.OGC_AmsterdamUMC.LSQ_fitting import flat_neg_log_prior, fit_bayesian, empirical_neg_log_prior, fit_segmented, fit_bayesian_array, fit_segmented_array
import warnings
import numpy as np
class OGC_AmsterdamUMC_Bayesian_biexp(OsipiBase):
"""
B... |
02a4b47bc2f782441b6396b2cc5c00efa6be397f76a9bbfbb56f159fb5d41cca | Python | 7,725 | 245 | """ Video reading and writing interfaces for different formats. """
import os
import cv2
import numpy as np
import attr
import multiprocessing
import imageio
import time
from typing import List, Dict, Tuple, Text
@attr.s(auto_attribs=True, eq=False, order=False)
class MediaVideo:
"""
Video data stored in trad... |
e79dd59fbf4ed3f1f9b978f771e63d6865d9f6be6f37fdb5fe4141e7c208cd92 | Python | 7,725 | 249 | from collections.abc import Callable, Sequence
from copy import deepcopy
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Any, Union
import torch
from torch.utils.data._utils.collate import default_collate
from eir.data_load.data_preparation_modules.imputation import (
... |
165954ae93525963236d9be45c31890583c1c96f9507bf9cbf66a8ea6ce0dad5 | Python | 7,726 | 292 | #!/usr/bin/env python
'''
Miscellaneous utilities that are extremely helpful but cannot be clubbed
into other modules.
'''
# Scientific computing
import numpy as np
import scipy as sp
import scipy.linalg as lin
import scipy.ndimage as ndim
from scipy import io
from scipy.sparse.linalg import svds
from scipy i... |
7b6f8b7a4e7cf08c358598311ce490de3ae6506989b5dbf4e4a34dbc5fc88060 | Python | 7,726 | 244 | """
Literature models.
Author: florian.birk@tuebingen.mpg.de
"""
import numpy as np
from scipy.optimize import curve_fit
def suscept(x, a, b, c):
"""
Knight paper model (susceptibility)
Parameters:
- x: fiber-to-field angle in degrees
- a, b, c: fitting parameters
Returns:
- Predicted R... |
41b4a2c5905a5f526be7f5ac3ec11707b21490e8c0dc64a7aa53a8bb59ff784b | Python | 7,728 | 124 | planner_prompt = """
You are the **Lead Scientific Supervisor** for a parallel workflow.
Your goal is to coordinate a pipeline: Execution -> Analysis.
Supported adsorbates are H2O, CO2, and N2, one gas per ensemble. Preserve the
requested gas and keep different gases in separate result sets and analyses.
### STATE TRA... |
ed00dc965dab09101c5107648e4e751dec3e316d7480b7ec3217b3ccf164db55 | Python | 7,729 | 236 | """
Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch)
@author: tstandley
Adapted by cadene
Creates an Xception Model as defined in:
Francois Chollet
Xception: Deep Learning with Depthwise Separable Convolutions
https://arxiv.org/pdf/1610.02357.pdf
This weights ported from the Ke... |
ee3fbeb53a974dab371c87ce1b0a0953e00850fceb850ba6e9c985953e4f61f8 | Python | 7,729 | 229 | import copy
import h5py
import os
import pickle
import torch
import yaml
from deepdwi.models import bloch
from deepdwi.models import autoencoder as ae
from deepdwi.recons import linsub
import matplotlib.pyplot as plt
import numpy as np
import torch.utils.data as data
DIR = os.path.dirname(os.path.realpath(__file__))... |
f170a75a4db701ab8a58761f7abe4270a2a0d556570691e90b1fafa5774b7cc7 | Python | 7,729 | 246 | #!/usr/bin/env python3
"""
Library Layout Manager for FLYNC Pipeline
Manages per-sample library layout (paired-end vs single-end) detection and storage.
Supports three modes:
1. Global setting (fastq_paired: true/false in config)
2. Mapping file (sample_id -> layout mapping)
3. Auto-detection (from SRA metadata or fil... |
acb102489295982d4a498c95720773a85aa5c37c2226f5de37df403c3ed1fe66 | Python | 7,735 | 200 | import sys
import numpy as np
import nibabel as nib
import nibabel.processing
from scipy.ndimage import map_coordinates
def transform_image(target_img_path, moving_img_path, img_out_path, dtype=np.float32):
"""
Resamples moving_img to the grid of target_img (like 'mrtransform -template x' but results in
... |
5fa7aa3a1003a6cb9cde7bba80e2f3dbbfb0ab9f18400fe90ad7af6f23484d38 | Python | 7,736 | 239 | """
The overall network structure of ResUNet is based on VNet and the modifications are as follows:
Replace the original 555 convolution kernel with 333
Added dropout except the first and last block
Removed the last 16x downsampled stage of the encoder section
"""
import torch
import numpy as np
import torch.nn as nn
i... |
1bb85b621f11d8f9bf2d5ec79db3c3ed121b04dbc4aa5792c42a58ba0dd5954c | Python | 7,737 | 232 | from pathlib import Path
from unittest.mock import Mock, create_autospec, patch
import pytest
import torch
from eir.serve_modules.serve_input_setup import (
ServeBatch,
_impute_missing_tabular_values,
_setup_tabular_input_for_serve,
general_pre_process,
general_pre_process_raw_inputs,
general_... |
c7937f04e694fc0bc695b1b39f61021609e94c685873f03c0d8292353921bd81 | Python | 7,738 | 179 | # -*- coding: utf-8 -*-
#
# test_schedules.py
import unittest
import arbor as A
from arbor import units as U
import numpy as np
"""
all tests for schedules (regular, explicit, poisson)
"""
class TestRegularSchedule(unittest.TestCase):
def test_none_ctor_regular_schedule(self):
rs = A.regular_schedule(t... |
4ca91b1f8ef45d1ce40e2014ed08f070c3eb95ef851802308b1fd09f28246b96 | Python | 7,739 | 224 | """Downsample the image features with PCA.
Parameters
----------
subject : int
Number of the used NSD subject.
train_test_session_control : int
If '1', use the train and test splits consist of image conditions from
non-overlapping fMRI scan sessions.
model : str
Name of deep neural network model used to extract th... |
9e854da76866ad5b4cb297b841baea8ae8d322e695d8b195884e245b0c16012b | Python | 7,740 | 240 | #!/usr/bin/env python
from sputils import *
from pstimutils import *
nargs=len(sys.argv)
prmsd={'name': 'defaultrun', 'verbose':0, 'figfile': '', 'ymin': 0, 'ymax': None, 'xmin': None, 'xmax': None, 'title': '', 'nextstim': 0, 'yerr': 'std', 'usefilt': 0}
oargs=parse_arguments_dict(prmsd, sys.argv)
figfile = prmsd... |
b06f42c5aee00b8c0e670e1132323febaed44f9ed989dae95899eb2f7cdcb918 | Python | 7,740 | 180 | import os
import json
import csv
"""
This functions sets the necessary values in the TF_CONFIG environment variable. It contains information on the
cluster architectures, i.e, which workers are allocated for the job, and the worker for the current task. This has
been specifically been developed for using ... |
b084f4f9f9f1468df63b07aa85da1bda3888f9747d534f8007fd2e24c2b7a285 | Python | 7,742 | 202 | """Generates a ViRelAy project file from a database file, an attribution file, an analysis file, and a label map file."""
import argparse
from os.path import dirname, relpath
import h5py
import yaml
def make_project(
dataset_file_path: str,
attribution_file_path: str,
analysis_file_path: str,
label_... |
2e9b9c5ab9b398115c6face75f89a8e90582f42884163bce05e1318a11f4a70d | Python | 7,743 | 204 | # 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.
import logging
import math
from collections.abc import Collection
from typing import List
import torch
import ... |
e945f4b1de5fbab5b57cbdccbb19adde6482618e6dc2d2d8601c321a4f6d9926 | Python | 7,744 | 217 | from functools import cached_property
from typing import Final
import numpy as np
import polars as pl
from scipy.ndimage import gaussian_filter1d
from typing_extensions import Self
from argclz import AbstractParser, argument, copy_argument
from neuralib.persistence import *
from neuralib.persistence.cli_persistence i... |
f82f30f22b0f191e03677d86ae7753f521832c00a6e415fcdacab10ac275e53e | Python | 7,744 | 195 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import asyncio
import json
import threading
from functools import partial
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
import cv2
import numpy as np
import pytest
from ultralytics.data.converter import convert_ndjson_to_yolo... |
db6b3ccea379ecb96ea106105e5bddc3e1f8098d9f9792a76b55e2e0ad06829c | Python | 7,745 | 186 | import numpy as np
import torch
from scipy import signal
import os
from config import Config
class DataGenerator:
def __init__(self, config):
self.config = config
self.lambda_wave = config.v / config.f
def generate_noise(self, noise_type, length, power=1.0):
"""生成不同... |
b64728bdbeffb9db80c0ebdbc61ea7aadff1cdedf3d7a2f8fcc32f190f498519 | Python | 7,746 | 281 | import os
from typing import Any, Dict, List, Optional, Tuple
import nbformat
import numpy as np
import plotly.graph_objects as go
from jinja2 import Template
from nbconvert import HTMLExporter
from nbconvert.preprocessors import ExecutePreprocessor
from . import __version__
from .config import PACKAGE_PATH
from .dry... |
56e791226349961d56bd159cb125e5892c3c465c65cd696ed96485b3f5506897 | Python | 7,749 | 219 | from typing import List, Optional
import torch
from torch import Tensor
from torch_geometric.nn.nlp.llm import BOS, LLM, MAX_NEW_TOKENS
from torch_geometric.utils import scatter
class GRetriever(torch.nn.Module):
r"""The G-Retriever model from the `"G-Retriever: Retrieval-Augmented
Generation for Textual Gr... |
a603a9e3c9017c2fa1f6e625d4d9b77296264f1701def09ef00b714ecfd1612c | Python | 7,752 | 171 | #!/usr/bin/env python3
"""Stage 4 -- publication figures.
Every figure is drawn from the stage-2/3 outputs, so nothing here can plot a
number that was not measured. Figures are written at 600 dpi in both PDF
(vector, for the manuscript) and PNG (for review copies).
"""
from __future__ import annotations
import argpar... |
c600f828f3b974ae69aebd69a7f563db1d28adea13f7226db0f01d3c8add57eb | Python | 7,756 | 216 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from collections import defaultdict
from collections.abc import Callable
from typing import TypedDict
from cvat.apps.engine.models import Job, LabeledTrack, ShapeType
from cvat.apps.engine.utils import defaultdict_to_regular
from .util import linea... |
ce49b2edf3df7ef82fa39a3df49ed4e3c431a8e5628c4cebf1595e6372d87e95 | Python | 7,756 | 246 | import hotspot
import numpy as np
from scipy.interpolate import splrep, splev
from scipy.spatial.distance import pdist, squareform
import scanpy as sc
import pandas as pd
from sklearn.mixture import GaussianMixture
#build the 2D colormap
import cmap2d
tri_coords = [[-1,-1], [-1,1], [1, 0]]
tri_colors = [(1,0,0), (0,... |
4c6b107424bd0a86f5b7c0577069f0c9dec6d366853a79c1034c54986100698d | Python | 7,757 | 234 | """
Copyright 1999 Illinois Institute of Technology
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publis... |
61ae658de39588fd17593981c84304f598370d2a99a61beb49394038373ad866 | Python | 7,759 | 172 | # Copyright (c) 2022, Kwanhyung Lee. 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 WARRANTI... |
9cd547a7c018f211541ed7a7d3c790aee9b031d465351d4068aac3d7e8eeb778 | Python | 7,760 | 202 | # -*- coding: utf-8 -*-
import logging
import os
import tempfile
from dipy.io.stateful_tractogram import Space, StatefulTractogram, Origin
import nibabel as nib
import numpy as np
from numpy.testing import (assert_array_equal,
assert_equal)
from scilpy.segment.tractogram_from_roi import (_... |
97898a33199b266a0891af1b2c080bc7c05c619b3eed8703d4a7f3f902e53a30 | Python | 7,762 | 228 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
import numpy as np
from sklearn.neighbors import NearestNeighbors
from uac import utils
import uac.vars as var
# Create the parser
my_parser = argparse.ArgumentParser(description="UAC fibre mapping")
# Add the arguments
my_parser.add_argument("t... |
18fa219fbe59952a02580ff0f9ce49cd507ea6bbc0ad3630fd17661fdc8d4758 | Python | 7,764 | 138 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\PycharmProjects\ISAT_with_segment_anything\ISAT\ui\annotation_data_tools.ui'
#
# Created by: PyQt5 UI code generator 5.15.11
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file... |
5f31889ff5e2df6c7118edc2092bc6e0094f8c3d058335effa201279e475bab9 | Python | 7,765 | 219 | from typing import Any, Literal, Optional, Union
from pydantic import BaseModel, Field, model_validator
from chemgraph.schemas.atomsdata import AtomsData
class WorkerTask(BaseModel):
"""
Represents a task assigned to an executor agent for performing tool-based computations.
Attributes:
task_inde... |
a7934622b1b6f79b524ea76cbc8a96813c73f82fdae14d7129c4806101041469 | Python | 7,766 | 252 | from __future__ import annotations
import base64
import io
import json
from pathlib import Path
from typing import TypedDict
from PIL import Image
from PIL import ImageDraw
class _FixtureShape(TypedDict):
label: str
points: list[list[float]]
group_id: None
description: str
shape_type: str
fl... |
592bca2f0a6ffc83eb30e0eaaa4530521acec1a4ebe49902816db2a002d44212 | Python | 7,768 | 259 | import json
import subprocess
from collections.abc import Sequence
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_experiments import (
AutoDocServing... |
d5114f5d1a0fefb0dbe825233089d091bbf7ec2bb7f5dd700fa23e6e6c0135e5 | Python | 7,768 | 238 | # -----------------------------------------------------------------------------
# Copyright © 2014-2015 Colin Duquesnoy
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# ----------------------------------------------------------------------... |
8077f7556081a358b9e3dee945dbd4f3f0c1ce3b71cd5e696756c1d68d6bd479 | Python | 7,770 | 231 | # 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, ... |
1993a1cf3b11b9da138d16dbbbb60c192ca700a8e2556598d925657cd2391ddd | Python | 7,771 | 210 | import numpy as np
from matplotlib.axes import Axes
from matplotlib.colors import TwoSlopeNorm
from tqdm import tqdm
from typing_extensions import Self
from argclz import AbstractParser, argument, float_tuple_type
from neuralib.persistence import persistence, ETLConcatable, validate_concat_etl_persistence
from neurali... |
75155170d4ba4342ffebeb87d06da3710c1489a290e0c0b466613cb28df62119 | Python | 7,772 | 228 | from functools import partial
from typing import TYPE_CHECKING
import torch
from eir.models.input.array.models_locally_connected import FlattenFunc, LCLModel
from eir.models.model_setup_modules.output_model_setup_modules import al_output_modules
from eir.models.output.array.array_output_modules import (
ArrayOutp... |
6c6b1c52af4642b8b40ecbf2386d54f4d69e1285a387304897ab4ebbca5a55b0 | Python | 7,773 | 178 | #!/usr/bin/env python3
"""
chemembed_per_spectrum.py — run ChemEmbed PER SCAN (not merged per feature).
Mirrors the SIRIUS per-spectrum logic: instead of ChemEmbed's default behaviour
(merge_spectra_by_feature collapses every scan of a feature into one spectrum),
this runs ChemEmbed on the combined per-scan MGF produc... |
ca4f233a89269a815241d6b31c558d8a28ee0060be7882dd546292a59ad6ad46 | Python | 7,776 | 174 | # /------------------------------------------------------------------------------+
# | 19-JUL-2022 |
# | Copyright (c) Bone Imaging Laboratory |
# | All rights reserved ... |
11df47fdb6f7aa6f6affeb82e87b14c1cda10f8046bfbbcf6ec42abfad107f9e | Python | 7,777 | 155 | """Stimulation (MEA-Stim) settings panel.
Binds the stim analysis parameters to :class:`meanap.params.Params`. When
"Stimulation mode" is enabled, the pipeline runs the stim analysis after step 4
(see ``meanap.pipeline.stim_step``). Detection methods and defaults mirror the
ported ``meanap.stim`` subsystem (``python/M... |
6a75a4df7c866947213735c938b5db284e1ab72bae312dfc39ff16d019727300 | Python | 7,779 | 86 | from testsetclass import TestsetClass
class BH76(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['hcn', 'n2', 'N2H2', 'hfch3ts', 'NH3', 'hclhts', 'fch3clcomp2', 'hf2ts', 'RKT09', 'f', 'ch3cl', 'fch3fcomp', 'RKT06', 'c2h4', 'RKT04', 'RKT21', 'RKT05', 'hn2ts', 'RKT17', 'RKT03', ... |
488bbfc814fddc05570616f8f1a223e77887a4c4127e82b8ad208d6c55291fe0 | Python | 7,784 | 180 | import os
import skimage.io as skio
from skimage.morphology import label
from napari_simpleitk_image_processing import label_statistics
import pandas as pd
import time
import numpy as np
from tqdm import tqdm
from natsort import natsorted
import glob
import parameter_search.helper as helper
from postprocessor import r... |
bd72d120b19f5297f78b491c731ba205556736d515077d093346eda3a87a492c | Python | 7,785 | 199 | import numpy as np
import pandas as pd
from scipy.stats import pearsonr
import json
import time
import os
def load_data():
"""
Load CATS and THINGS vector data (full version)
"""
print("Loading data (full version)...")
# Use full version CSV files
shared_vec_path = 'SharedVec'
cats_fil... |
56ba62447934382ae7061bd3a9c3a96bd1ea6e8e162a056e2ef49984c497576b | Python | 7,786 | 189 | #!/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... |
4c95c3096a893bcbed7db2c4f2fa2546dd7443febf02bd5c9c9436d7ecc6f1c2 | Python | 7,788 | 164 |
import pathlib
import h5py
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
import numpy as np
from helper_functions.get_dendritic_current import STEADY_STATE_CURRENT
from helper_functions import __file__
from helper_functions.plotting_lib import round_sig_decimal
MODULE_BASE = pathlib.Path(_... |
8336a8161530700447c9ffd5842c0b499cf9409843a96ec5a790a2eef9d3e88c | Python | 7,789 | 249 | from typing import Optional
import numpy as np
from ..config import NP_COMPLEX
class PairwiseUnitary:
"""Pairwise unitary
This can be considered also a two-port unitary linear optical component
(e.g. unitary scattering matrix for waveguide modal interaction).
This unitary matrix :math:`U_2` has th... |
69b6d3fd270e20907f8646588b7c8e3c8d6d7f672d4b50220bfc37d6489b0b13 | Python | 7,790 | 219 | import nibabel as nb
import numpy as np
import os
from nibabel.filebasedimages import ImageFileError
from scipy.io import loadmat
from scipy.stats import zscore
from scipy.signal import butter, sosfiltfilt
def butter_bandpass(lowcut, highcut, fs, order=5):
# create butterworth bandpass filter based on lowcut ... |
9c8c8e78ac6b39ad2493d7e25df3a743a9746750c6d985f0d96f0fc198c6aaa6 | Python | 7,790 | 185 | import pandas as pd
import shutil, os
import numpy as np
import os.path as osp
from ogb.utils.url import decide_download, download_url, extract_zip
from ogb.io.read_graph_raw import read_csv_graph_raw, read_binary_graph_raw
import torch
class GraphPropPredDataset(object):
def __init__(self, name, root = 'dataset',... |
dd5359f6023127d8e764a0558fa4416ca2965baed881487616b0b8c942e656d9 | Python | 7,790 | 260 | from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
import requests
from brainles_preprocessing.utils.zenodo import (
ZenodoException,
ZenodoRecord,
fetch_atlases,
fetch_synthstrip,
)
# ---- Fixtures ----
@pytest.fixture(autouse=True)
def clear_zenodo_cache():
"""E... |
9b34e40c61f1a60b6f8dafdd59db85616f4abf30759e09d706e69925b085a3a4 | Python | 7,795 | 213 | """
Generate images for the "2D Affine Registration via Subspace (Contour) Matching" How To tutorial.
Run from the project root with the fireants conda env, e.g.:
conda activate fireants
python docs/scripts/generate_subspaceaffine_images.py
Uses real histology images and masks from the assets folder.
Writes ... |
77f2f399ad5fb2e18bf1599bfc62542ce38a31b6e51758efd85dc44349756b42 | Python | 7,798 | 192 | import os
import subprocess
import nibabel as nib
import numpy as np
from nipype import Node, Workflow, MapNode
from nipype.interfaces.utility import IdentityInterface, Merge
from cvdproc.pipelines.smri.hipsta.hipsta_nipype import Hipsta, HipstaDocker
from ...bids_data.rename_bids_file import rename_bids_file
class ... |
a01e43b79ba3f366061f8fa8d92223c7e30298d4e1e0c1691bbd301ef7533a1c | Python | 7,799 | 168 | from torchmetrics.detection.mean_ap import MeanAveragePrecision
import json
from torch import Tensor
import pandas as pd
from evalutils.scorers import score_detection
import os
import yaml
import numpy as np
from typing import Dict
class MIDOG2021Evaluation():
def __init__(self,path):
self._predictio... |
ca91e25b2db9606dd823c8bccf94722b798f9cc6b721d47de80e6e3e5da2d72e | Python | 7,801 | 163 |
import os
import torch
import random
import logging
import numpy as np
from PIL import Image
from PIL import ImageFile
import torchvision.transforms as T
from collections import defaultdict
import datasets.dataset_utils as dataset_utils
ImageFile.LOAD_TRUNCATED_IMAGES = True
class TrainDataset(torch.utils.data.Da... |
e4cdb994571bf89cf0237a04b17ee0b53a0186beb09f700d64450954394beeb6 | Python | 7,802 | 232 | # -*- coding: utf-8 -*-
"""
Routines to run iDISCO alignment and cell detection
Created on Fri Jun 19 12:20:18 2015
@author: ckirst
"""
#import os
from iDISCO.Parameter import *
from iDISCO.IO import IO as io
import iDISCO.ImageProcessing.SpotDetection
try:
import iDISCO.ImageProcessing.IlastikClassification
... |
8f5d7b416125bd41b077e510f5c55a43c046d5d049af4cfe76f149d986a01caf | Python | 7,803 | 204 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
import sys
from collections import Counter
# external inputs
import numpy as np
import nibabel as nb
from nibabel.freesurfer.io import read_geometry
from skimage import measure
from nighres.surface import probability_to_levelset
from scipy.ndimage.mor... |
94c22d3307f9ebe8c8ce025a98cc617f0a0a46299f1d60f25c898ab1f2a0d795 | Python | 7,803 | 270 | # Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import json
from copy import deepcopy
from http import HTTPStatus
import pytest
from cvat_sdk.api_client.api_client import ApiClient, Endpoint
from deepdiff import DeepDiff
from shared.utils.config import... |
036efce51fbe45ed97540b98f712ea4d4dd986d5582a1d17f20f6b6f722f68fe | Python | 7,805 | 161 | from curses import meta
import os
import pickle
import random
import numpy as np
import pandas as pd
from tqdm import tqdm
from glob import glob
import torch
from torch.utils.data import Dataset
from copy import deepcopy
from .psy_util import generate_fbank, get_individual_samples_torchaudio, cut_pad_sam... |
7b78795b9e42b5364dc0ba7433383b030c23abd1e11efd4ade566c1a22ebe9af | Python | 7,805 | 209 | import numpy as np
import pickle
From Functions import load_result
# Majority Voting
def MV():
layers = model_layers
Cmodels = class_name
prc=0.05
shap_type = 'ch' # none,ch
mode= 'Gradient' # Gradient, Deep, Grad-CAM
Method = 'Euclidean' # Euclidean , Static
count=0
path="Results/All_Outputs/Mode... |
905f8e560f4529ae2917f6fbef14a406b0e555c940b09e37491ac394fed1f290 | Python | 7,805 | 208 | #!/usr/bin/env python
import os
import re
import shutil
import glob
import sys
def extract_rwp_from_report(report_path):
try:
with open(report_path, 'r') as f:
content = f.read()
lines = content.splitlines()
if re.search(r'CNN_ML.*?\bNA\b|\bN/A\b', content, re.IGNORE... |
f6bac0133b58c32ab275d326c464da6ff8b2c4bd70314a2bc68a6d1894f6a8e0 | Python | 7,805 | 207 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from collections.abc import Sequence
from typing import Any, cast
import cvat_sdk.auto_annotation as cvataa
import cvat_sdk.datasets as cvatds
import PIL.Image
from cvat_sdk import models
from cvat_sdk.auto_annotation.driver import (
_Annotation... |
a28adf1aefef2886f0474c56e68ef4e885787bcf140e715274bf6875dd843d50 | Python | 7,806 | 216 | import argparse
import os
import os.path as osp
import time
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.metrics import f1_score
import pandas
import json
import torch_geometric.transforms as T
from tqdm import tqdm
import spacy
import re
import ijson
from vaderSentiment.vaderSentiment i... |
57d1dea800757d58bad8a3ecd1ab8350c17d90b2402cbff63a2ea461873d27fb | Python | 7,807 | 222 | import re
from pathlib import Path
from typing import Optional
import click
import dolfin as df
import numpy as np
import panta_rhei as pr
import skimage
import tqdm
import simple_mri as sm
from panta_rhei import FenicsStorage, fenicsstorage2xdmf
from simple_mri import load_mri
from loguru import logger
from gmri2fem... |
a2ddec333b6d17b61db7f2f16959d6578bca3c2fc370710b272160743d4aa564 | Python | 7,813 | 239 | # Hua Sun
# 2025-07-14
# v2.5
import argparse
import pandas as pd
import os
import re
import subprocess
# collect input arguments
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--sample', type=str, default='sample', help='sample name')
parser.add_argument('-b', '--barcode', type=str, default='', hel... |
99ebc89fa6874073a7429201ce218781dd8cb39eb5d3fcc4707a857d9112f0bb | Python | 7,817 | 234 | """
Copyright 1999 Illinois Institute of Technology
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publis... |
b9f6f941eff6e438593c0e16e5ec2d584012043c762b71afef8b37b9644c6080 | Python | 7,823 | 61 | from testsetclass import TestsetClass
class FH51(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['CO2', 'methanol', 'C2H5CO2CH3', 'NH3', 'C4H9ONO', 'butanediol', 'C3H7CO2H', 'HCl', 'HCON_C2H5_2', 'propylfuran', 'C2H5CCNCHCH3', 'diethylamine', 'propylthiophene', 'OS_C2H5_2', 'H... |
df2e546bf58b5734fef12d6fe6636a919e4deb88bc2ec72ee069d4d8e0a04566 | Python | 7,824 | 207 | """Detect peaks in data based on their amplitude and other features."""
from __future__ import division, print_function
import warnings
import numpy as np
__author__ = "Marcos Duarte, https://github.com/demotu"
__version__ = "1.0.6"
__license__ = "MIT"
def detect_peaks(x, mph=None, mpd=1, threshold=0, edge='rising... |
df2d10995734e410cb43d83dd74723c968cbb4321c3d46149d7f63dda3cdd872 | Python | 7,825 | 207 | # -*- coding: utf-8 -*-
"""Motion correction of fMRI time series using afni and optional application to
different echoes in ME-fMRI projects."""
import uuid
import shutil
from pathlib import Path
from joblib import Parallel, delayed
import numpy as np
import nibabel as nb
import matplotlib.pyplot as plt
from ..registr... |
712a6d2b3ad1ef6440ea6a5d7422a504194fc230db5c41f198062efebdc5ff97 | Python | 7,826 | 233 | # 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, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.