sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
33a596cc46fad25fb13318529776c2fa2d916dfb4d7001d47993aa7d20c4f359 | Python | 7,965 | 232 | from __future__ import annotations
import math
from typing import Final
import numpy as np
import pytest
from PySide6.QtCore import QPointF
from PySide6.QtCore import Qt
from pytestqt.qtbot import QtBot
from labelme._app import MainWindow
from labelme._widgets._canvas import Canvas
from ..conftest import close_or_p... |
6f10e9deeceeb827b151f90be8ac18d12c1c74acb7bb5d91b3c223b4228d6c30 | Python | 7,965 | 265 | """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
... |
7f04074c3566f931caaccd30ea682629784212dc64ebffde9ab50cab532e5943 | Python | 7,967 | 239 | import typing
import functools
from ..config import *
from ..qt import *
from ..task_controller.util import create_task_with_exc_handling
from .. import thalamus_pb2
from .. import thalamus_pb2_grpc
class Delegate(QItemDelegate):
def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QModelInd... |
4cc1154d9e081625bf04a7ea955e743e452d94cbbb999de390a1f8bffc05eb50 | Python | 7,968 | 248 | import numpy as np
import hipsternet.utils as util
import hipsternet.constant as c
import copy
from sklearn.utils import shuffle as skshuffle
def get_minibatch(X, y, minibatch_size, shuffle=True):
minibatches = []
if shuffle:
X, y = skshuffle(X, y)
for i in range(0, X.shape[0], minibatch_size):
... |
d74cffad2aeca061a3315b36b83b843820152b014ec10255e9daa6a54445fa83 | Python | 7,968 | 206 | """ AFMmeasurements_changingsettings_onesetting-manypositions.py
This script iterates over a list of positions, changing the measurement settings after a set number of measurements, like
"load settings 1" --> "go to position 1 and measure" --> "go to position 2 and measure" --> "go to position 3 and measure" -->
"load ... |
3f6cd45c44b38d7a856c84ab69c0df54ad9683552a2fb25c84750b3948b7f55b | Python | 7,969 | 254 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
random.seed(42)
NAME = "jobs"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictRead... |
9bcc3f7eacb2a5d0f158796d67d6e1439c68503eb13f13cefa468f96fd1860e9 | Python | 7,969 | 243 | """
Tests for deepreg/model/loss/image.py in
pytest style.
Notes: The format of inputs to the function dissimilarity_fn
in image.py should be better converted into tf tensor type beforehand.
"""
from test.unit.util import is_equal_tf
from typing import Tuple
import numpy as np
import pytest
import tensorflow as tf
i... |
d90138aa26704f59d97e022ed0f4aa885120d07fd5361858cb9c5ba4e8031227 | Python | 7,970 | 220 | import os
import numpy as np
import pandas as pd
import torch
# os.environ['CUDA_VISIBLE_DEVICE'] = '1'
import math
from tqdm import tqdm
from torch import nn
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score
from torch.utils.data import Dataset, DataLoader
from pathlib ... |
a24a50782d22f977b60d9907a35621b000350518787428cbe09ff8ef433234d8 | Python | 7,971 | 265 | """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... |
32fc0343330bf29f2dc5f708adf4d311dce8658efdf018e1005a088c73e02287 | Python | 7,973 | 231 | # Modified from:
# https://github.com/nipreps/synthstrip/blob/main/nipreps/synthstrip/cli.py
# Original copyright (c) 2024, NiPreps developers
# Licensed under the Apache License, Version 2.0
# Changes made by the BrainLesion Preprocessing team (2025)
from pathlib import Path
from typing import Optional, Union, cast
... |
70a6f0b051e96210b42766cc684d550ff8ce8340f67d2f09bf31241c602e2d95 | Python | 7,973 | 220 | import sys, os, subprocess, argparse, time
import numpy as np
import util, slurm
def task(cmd, jobnum=False, timeout=None, run=True):
print(cmd)
if run:
result = subprocess.run(cmd, timeout=300, capture_output=True, encoding='utf-8', shell=True)
print(result.stdout)
if jobnum:
... |
5d4059c5141c682b443ad995a6a79d2bc952cd8bfde8fb6cb4828c435afc21bd | Python | 7,974 | 160 | # 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... |
ff0be20dfa2c16253dc59e1e5aa4b9a7097702c815e359ad10c7212997989aba | Python | 7,974 | 234 | """Use Phikon-v2 to extract latent features from whole slide images."""
from __future__ import annotations
import argparse
from pathlib import Path
from typing import Callable, List, Optional, Sequence, Tuple, Union
import h5py
import numpy as np
import openslide
from PIL import Image
import torch
from torch.utils.d... |
7f1c65c44108067605b5cbe5ee01dcff5912e2dc10c0f2a7d1e49c5ea3b378c9 | Python | 7,975 | 169 | import sys
import pandas as pd
import scipy.stats
import matplotlib.pylab as plt
import numpy as np
import itertools
from statsmodels.stats.anova import AnovaRM
import pingouin as pg
from statsmodels.stats.multicomp import pairwise_tukeyhsd
plt.rcParams['font.family'] = 'Helvetica'
plt.rcParams['text.usetex'] = True
pl... |
a4ab06b233765c6cb9a6400a7ccc3318a25b924d27140f3472180d120e6c3c93 | Python | 7,976 | 221 | # -*- coding: utf-8 -*-
from itertools import combinations
import logging
import scipy.stats
def verify_normality(data, alpha=0.05):
"""
Parameters
----------
data: array_like
Array of sample data to test normality on.
Should be of 1 dimension.
alpha: float
Type 1 error o... |
8384d4f094b6c81c39143fc8919ed538b94cd995783d149aa8313cbaf8558cd4 | Python | 7,977 | 255 | #!/usr/bin/env python
"""
Ludl stage communication.
Hazen 02/14
Edited 5/15 to add Z piezo and TCP/IP protocol
George Emanuel 5/15
"""
import http.client
import sys
import storm_control.sc_library.parameters as params
class Ludl(object):
def __init__(self, **kwds):
super().__init__(**kwds)
sel... |
29fb9ca89856acd19de3c888fc163c774abe9ea53f7fd3814aa54fa7393093cd | Python | 7,978 | 221 | import os
import numpy as np
import pandas as pd
import torch
os.environ['CUDA_VISIBLE_DEVICE'] = '1'
import math
from tqdm import tqdm
from torch import nn
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score
from torch.utils.data import Dataset, DataLoader
from pathlib im... |
c4d574d20dd45bc37a283077d1f68c0eae4c51eb9c37685713d7673d2347012b | Python | 7,978 | 221 | import os
import numpy as np
import pandas as pd
import torch
os.environ['CUDA_VISIBLE_DEVICE'] = '1'
import math
from tqdm import tqdm
from torch import nn
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score
from torch.utils.data import Dataset, DataLoader
from pathlib im... |
a36e41b81a883cff25396d72137f20bb6616bb238a8ec43d40ec2cd440acaed3 | Python | 7,984 | 232 | import h5py
import sys
import yaml
import os
import numpy as np
from matplotlib import ticker
import matplotlib as mpl
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import cosine_similarity
import git
import scipy.cluster.hierarchy as hac
from scipy.spatial.distance import pdist
pathpath,myrun,nclusts... |
da6177756559090cdb9732e40cc91f1f6ae83618ecb9da85826d1263565ef09d | Python | 7,987 | 242 | """ Loss functions. """
import os
import sys
import torch
import numpy as np
from lib_3d_OT.ottools.lattice import Lattice
project_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if project_dir not in sys.path:
sys.path.append(project_dir)
from lib_3d_OT.ottools.utils import iterate_in_chunks
d... |
434582bea1315ae12be3db0fbbabea8f867e6da598c93b988ea0172598ad0c67 | Python | 7,988 | 222 | import os
import os.path as osp
import shutil
from ogb.utils import smiles2graph
from ogb.utils.url import decide_download, download_url, extract_zip
import pandas as pd
import numpy as np
from tqdm import tqdm
import torch
class PCQM4MDataset(object):
def __init__(self, root = 'dataset', smiles2graph = smiles2gra... |
5605327c97cf7e6c14262c9bdb53e67266e453d0f171360982f9ac2c3b4b3c57 | Python | 7,989 | 249 | ###########################################################################################
### Script to extract the mean correlation between neuronal subpopulations of a network ###
### from spike raster data ###
############################################... |
72698d648a637855aea3324cc9c8111d21c7ba3cd38b2aae9c5b8980854566b9 | Python | 7,990 | 178 | import scipy as s
import numpy.linalg as linalg
import scipy.stats as stats
from .basic_distributions import Distribution
from mofapy2.core.utils import *
# TODO : remove a loop
class MultivariateGaussian(Distribution):
"""
Class to define multivariate Gaussian distribution.
This class can store:
- i... |
d61fe6bf2e7c6040713c9cffd1edd0d8d3e09eeaca1268d9ba011ea4b08f506a | Python | 7,991 | 222 | """
eqsettings.json <-> EquatorWindow widget bindings.
These declarative tables drive EquatorWindow.loadSettings(). They are
the inverse of EquatorWindow.getSettings() / EQ_FittingTab.getFittingSettings()
-- if you add a key in either, add it in the right table here.
The whole module is Qt-free on purpose so unit tes... |
13edf222ef0ce81cdeee2abfde54bdf70756b09dcf4c8655fdb6f3eab5a17c0e | Python | 7,992 | 239 | from typing import TYPE_CHECKING
import numpy as np
import torch
from eir.models.model_training_utils import predict_on_batch
from eir.serve_modules.serve_experiment_io import ServeExperiment
from eir.setup.schema_modules.output_schemas_array import ArrayOutputTypeConfig
from eir.setup.schema_modules.output_schemas_i... |
06930c38c37b3ca67fa93d1b0094fb5492d4690347d63065d13e4796b1e69e69 | Python | 7,993 | 249 | ###########################################################################################
### Script to extract the mean correlation between neuronal subpopulations of a network ###
### from spike raster data ###
############################################... |
22fd4dbb9197aa42ef0eeacdc6c27cbf048d986bc281d4571fcffd1af966b51a | Python | 7,993 | 247 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import io
from logging import Logger
from pathlib import Path
import pytest
from cvat_sdk import Client
from cvat_sdk.api_client import exceptions, models
from cvat_sdk.core.proxies.tasks import ResourceType, Task
from shared.utils.config import ma... |
16e55f9aef8ec36a50053aea066b5430b8719e4f3f03032b92774bdc12f065b7 | Python | 7,994 | 214 | import os
import sys
import pprint
import pickle
import pandas as pd
import torch
from torchdrug import core
from torchdrug.utils import comm
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from biopathnet import dataset, layer, model, task, util
def solver_load(checkpoint, load_optimizer=True):
... |
5d747e2dcbcb5799f1e60d032a894adf1ef658c2c3f4409a758a6158af5cb178 | Python | 7,994 | 201 | """
(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
... |
79519227abe7f5f2509d203f2d2171a63ae424cff13cb792148fdaea9ecec331 | Python | 7,994 | 207 | # Imports for data simulation and mathematical operations
from torch.utils.data import Dataset
from torch import tensor, rand, cdist, randn, exp as texp
from numpy.random import normal, uniform, seed
from numpy import linspace, arange, meshgrid, array, exp, sin, concatenate, cos
from numpy import pi as npi, power
from ... |
8fdab4209fcafedb7b1490c4116c30ba384ee096e8844be3917f50cdc20994f8 | Python | 7,995 | 198 | ###############################################################################################
### Reads out Q and MI values (mean and standard deviation) from data files and plots them, ###
### individually for 10s- and 8h-recall. ###
################################... |
e9742738b448bc608370e060d94e7138bb8e02ce23b091207a04233627bd4b23 | Python | 7,996 | 221 | import os
import numpy as np
import pandas as pd
import torch
os.environ['CUDA_VISIBLE_DEVICE'] = '1'
import math
from tqdm import tqdm
from torch import nn
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score
from torch.utils.data import Dataset, DataLoader
from pathlib im... |
fd79e64e4bc501f5dbe5d619f96c659a7262e626d73a50c88c5c477f8a2acbe8 | Python | 7,996 | 218 | import os
import numpy as np
import pandas as pd
import torch
# os.environ['CUDA_VISIBLE_DEVICE'] = '3'
import math
from tqdm import tqdm
from torch import nn
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score
from torch.utils.data import Dataset, DataLoader
from pathlib ... |
3cdfb5065025ff82ef4d6cd3489c9c06014ed48663cdd68c833c0ef5925f8ac8 | Python | 7,998 | 159 | import logging
from result_caching import store_xarray, store
from tqdm import tqdm
from brainscore_vision.metrics import Score
from brainscore_vision.model_helpers.activations.pca import LayerPCA
from brainscore_vision.model_helpers.brain_transformation import TemporalAligned
from brainscore_vision.model_helpers.uti... |
bc6fad75c7eb853ada924936cc17e181aa6815539f5223a3ce1d483824c8ac4e | Python | 7,999 | 235 | """ Test null models """
import pytest
import numpy as np
from scipy.spatial.distance import pdist, squareform
from tempfile import gettempdir
from os.path import join, exists
import vtk
from brainspace.vtk_interface import wrap_vtk
from brainspace.vtk_interface.pipeline import to_data
from brainspace.mesh import me... |
ce2307bb23a3e42ea3b25cbccb39ee1657b312bb7993fc811639bdb938f5483a | Python | 7,999 | 234 | """
Helper functions for running and training the SignalingModel.
"""
import os
import time
from typing import List
import torch
import numpy as np
def set_seeds(seed: int=888):
"""Sets random seeds for torch operations.
Parameters
----------
seed : int, optional
seed value, by default 888
... |
11cc1ef4f13ca090666f1adc2bbe1c77a8399a5adab6357f767b4ca4c9b63a7d | Python | 8,001 | 197 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: GM
@edited: CD
"""
import numpy as np
import pandas as pd
import os
import nipype.interfaces.fsl as fsl
from shutil import copyfile
from sklearn.metrics import mean_squared_error, mean_absolute_error
#%%
class StoreOutput(object):
"""accumulate outputs an... |
3aabe145d3535ce7389fc864128e8171e660b0c5badd251107dbe8d8eaf66446 | Python | 8,002 | 240 | """Use UNI to extract latent features from whole slide images."""
from __future__ import annotations
import argparse
from pathlib import Path
from typing import Callable, List, Optional, Sequence, Tuple, Union
import h5py
import numpy as np
import openslide
import torch
from PIL import Image
from torch.utils.data imp... |
99f0c9698be5e75aa3ea8997072df2dc77d10256c7f2efd4cc4d7060e064577d | Python | 8,003 | 247 | # cec2017.simple
# Author: Duncan Tilley
# Simple function definitions, f1 to f10
from . import basic
from . import transforms
import numpy as np
def f1(x, rotation=None, shift=None):
"""
Shifted and Rotated Bent Cigar Function
Args:
x (array): Input vector of dimension 2, 10, 20, 30, 50 or 100... |
118de5cb7f9f8a065f8866ee9a34f0290039c533dc8bf0c89d3c0acff9b73476 | Python | 8,004 | 209 | import os
import re
from contextlib import redirect_stdout
import io
import numpy as np
from sklearn.preprocessing import LabelEncoder
from scipy.spatial.distance import cdist
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from sklearn.model_selection import StratifiedKFo... |
eb35037e8b0f8aa2a494144585931a9a3caa3a3886be339805164219d9c9b02a | Python | 8,005 | 204 | # Common helper functions shared across the entire workflow
def provided(samplelist, condition):
"""
Determines if optional rules should run. If an empty list is provided to rule all,
snakemake will not try to generate that set of target files. If a given condition
is not met (i.e. False) then it will n... |
1dacc221e609112ee4e9ef65f9a7e7d5a0af4b4ca621f835e641bbd1b7d0649d | Python | 8,007 | 279 | from __future__ import annotations
import os
import sys
from pathlib import Path
import pytest
from langchain_mcp_adapters.client import MultiServerMCPClient
# Skip when the optional 'academy' extra is absent; mcp_supervisor
# imports httpx (also in the extra) at module level.
pytest.importorskip("academy")
from ch... |
744cc18bb6229131cd804eb064a408876c862f8473fdab64c704c9e87ed7378a | Python | 8,007 | 223 | import os
from datetime import datetime
from typing import Optional, Tuple, Union
import matplotlib.pyplot as plt
import nibabel as nib
import numpy as np
import pandas as pd
import tensorflow as tf
import deepreg.loss.label as label_loss
from deepreg import log
from deepreg.dataset.load import get_data_loader
from d... |
ec1342e220d0a4e312da5b62620dd712bc4bcb650b49b93d85e29ad53581c480 | Python | 8,007 | 268 | from __future__ import annotations
import json
from functools import partial
from pathlib import Path
from typing import Final
import pytest
from PySide6.QtCore import QPointF
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QMessageBox
from pytestqt.qtbot import QtBot
from labelme._app import MainWindow
... |
4e3a7673af5bf6d11fbadc01fb080b71147fb4b993feff0a10658451e3165f8e | Python | 8,008 | 208 | import os
import os.path as osp
import pandas
from tqdm import tqdm
import ijson
import json
from datetime import datetime
import numpy as np
from gensim.models import word2vec
from nltk import tokenize
dataset = 'cresci-2015'
if not osp.exists('tmp/{}'.format(dataset)):
os.makedirs('tmp/{}'.format(dataset))
prop... |
ec4c5f849e41762c4abc215e01034746d0a90743267f73f306450a99a3269530 | Python | 8,009 | 232 | #!/usr/bin/env python3
"""
Validate the ScipyAnalyticJacAdapter against LmfitTRFNumpyAdapter (L1 reference)
on all captured real cases in real_cases/.
For each case the script reports:
- Speed: median elapsed time (5 reps each)
- Convergence: success/fail flags for both adapters
- Parameter agreement: max |Δp_i|... |
2c42b2e4d89cd9908810b265bee82dbc0b75dbb2873f6f6de7caf66ba6067cc1 | Python | 8,011 | 190 | #!/usr/bin/env python
# coding:UTF-8
import os
import argparse
import numpy as np
import seaborn as sns
import scanpy as sc
import matplotlib.pyplot as plt
from scanpy import logging as logg
import anndata as ad
from anndata import AnnData
from typing import Optional, Sequence
from data_processing._constant import Pos... |
96b4bec941eadd0483c505f83cca8d32c8029032536ff993c8b64333be2fe6a3 | Python | 8,011 | 275 | # 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.
#
### ### ### ### ###... |
b3e5ec7d3f93bcffae354c7abb1c20fc6d1a3a956ec7121c6c2b45ea4a7e43de | Python | 8,012 | 225 | # -*- coding: utf-8 -*-
import os
import subprocess
import sys
import time
import threading
def list_macro_input_files(macro_inputs_dir, pattern=None):
if pattern:
import fnmatch
files = [f for f in os.listdir(macro_inputs_dir) if f.lower().endswith('.txt') and fnmatch.fnmatch(f, pattern)]
... |
764ed4072eba4bafa21a4525a8c6a56c786090f77f38101dd29a3111a8188ddc | Python | 8,013 | 194 | import glob
import os
import numpy as np
import cv2
import multiprocessing.pool as mpp
import multiprocessing as mp
import time
import argparse
import torch
import albumentations as albu
import random
def seed_everything(seed):
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed... |
a238070bcbc7f98182d3c202ccd48bc7e475527debf557794d9964c16bf531f6 | Python | 8,013 | 253 | import re
import Levenshtein
import json
import numpy as np
import datetime
import ijson
path = '../czl/TwiBot22-baselines/datasets/Twibot-22/'
uid_to_info = {}
user_node = json.load(open(path+'user.json'))
for i in range(len(user_node)):
uid_to_info[user_node[i]['id']] = user_node[i]
label_dic = {'human':0, 'bot... |
3cd3bf6c9ebc5249cbe88423c9134bf14ecfaf40bc90f0c445e935e4329647df | Python | 8,016 | 277 | from dataclasses import dataclass
from functools import partial
from typing import (
TYPE_CHECKING,
Literal,
Protocol,
TypeGuard,
Union,
)
import torch
from torch import Tensor, nn
from eir.models.input.array.models_cnn import CNNModel, CNNModelConfig
from eir.models.input.array.models_locally_con... |
6b0c8137a65f75f8044846dcb4460912fa59ba30e1c8d46a251119ae390e1922 | Python | 8,017 | 132 | import json
import numpy as np
from copy import deepcopy
from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.model.calculation import fitGeoTrans, mapPointTransform
from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.view.TreRow import TreRow
class MeasurementHandler:
def __init__(self, mea... |
b7f56d47a7306414228238248666116636f19ad4cc94f2cecdd1e10080363af6 | Python | 8,017 | 275 | import json
from collections.abc import Callable
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING
import numpy as np
import torch
from aislib.misc_utils import ensure_path_exists
from matplotlib import pyplot as plt
from sklearn.decomposition import PCA
from sklearn.manifold ... |
8a1b7222b29df04b935c10bf55342efbdeccc5b244f8fb8fef8acfbb8261169f | Python | 8,018 | 232 | """Reusable Streamlit widgets for provider credentials.
Shared between the Configuration page and the first-run setup on the
main page so both render identical flows (notably the ALCF Globus
login, which needs two steps and state carried across reruns).
"""
from __future__ import annotations
import os
import stream... |
586a2e85f44306acaa74d08e34a0969ef5c8e0f86b4153bd346873c4cea2cd75 | Python | 8,019 | 319 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
import numpy as np
from sklearn.neighbors import NearestNeighbors
from uac.element import Element
from uac import utils
# Create the parser
my_parser = argparse.ArgumentParser(description="UAC fibre mapping")
# Add the arguments
my_parser.add_ar... |
a9e8db627ffb927b6197f10944749fff803c56990513013c49388a0c8fd5c608 | Python | 8,019 | 181 | from gziplength import GzipLengthCalc
from concurrent.futures import ProcessPoolExecutor
import pandas as pd
import gzip
import argparse
import numpy as np
import concurrent.futures
from dataloader import Fasta_DataLoader
from utils import TaxaLevel
clen = lambda data: len(gzip.compress(data))
NCD = lambda c1, c2, c... |
ac193f373e6cb2c04f2d921a2876eaced85d9277afcfea84760d7f90d0565c7c | Python | 8,019 | 214 | from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Callable
from typing import (
TYPE_CHECKING,
Any,
Generic,
TypeVar,
cast,
get_args,
)
from psygnal import Signal
from magicgui._util import is_union
from magicgui.types import Undefined, _Undefi... |
df60d9ce40af2f5a795b3bdcf2531ab98e7f8d14c87fed231aa5a059bcdd3b62 | Python | 8,022 | 175 | """Test the labels and y-axis ranges of the group-comparison violins.
Run from the repo root::
uv run python python/test_comparison_axes.py
MATLAB's ``plotHalfViolinByX.m`` draws every comparison violin on the metric's
feasible range (``Params.networkLevelNetMetCustomBounds``): density on [0, 1],
node degree fro... |
e28b19859d54a93569abb27f802d42ad9021f13c1de6de761214ceab2b7ce8da | Python | 8,022 | 208 | """Host skill collections outside the Deep Agent workspace."""
import asyncio
import pytest
from deepagents.backends import CompositeBackend, LocalShellBackend, StateBackend
from langchain_core.messages import AIMessage, HumanMessage
from pydantic import Field
from chemgraph.graphs.deep_agent import _normalize_backe... |
78fa6ca243bf1edbeaafd9b4eb04bf30f58f31a197107d76a0519149acce7975 | Python | 8,023 | 167 | import numpy as np
from result_caching import store
from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly
from brainscore_vision import load_dataset, load_metric
from brainscore_vision.benchmark_helpers.properties_common import PropertiesBenchmark, _assert_grating_activations
from brains... |
b8daec37084ab85717667f2c574c0d67f6afc2e69abfcf71a10f22194fa8604d | Python | 8,025 | 218 | import os
import numpy as np
import pandas as pd
import torch
os.environ['CUDA_VISIBLE_DEVICE'] = '1'
import math
from tqdm import tqdm
from torch import nn
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score
from torch.utils.data import Dataset, DataLoader
from pathlib im... |
21ffe31603ece3b68b1584408c1bdbf329ab991265f3b0003585e591c8ba6366 | Python | 8,031 | 182 | ##### HEBART2023_FMRI LOCAL STIMULI PACKAGING #####
# In order to run the Hebart2023_fmri benchmark locally, you need to obtain the stimuli yourself due to licensing rules.
# Only the neural data can be downloaded from the public S3 bucket.
# This file packages the stimuli into Brain-Score format and saves them at the ... |
772c86f15e46fd174e39e5707c375e1c7f8e077990213a5f16c02bf5a8d63300 | Python | 8,031 | 164 | import argparse
import utils
import plotting
import keras
from keras.models import load_model, Model
from os.path import join
import numpy as np
import gc
'''
get the average of the predictions from all MPRAnn models in an ensemble
applies trained ensemble models to test set
if --eval flag set, evaluates prediction pe... |
6a64b8fa864ea29f684c6316c130d52e66103acef943e4197582656a24a7f5d7 | Python | 8,034 | 155 | from brainvoice.data.spectrogram_dataset import SpectrogramDataset
from brainvoice.data.datasplit import DataSplit
from brainvoice.data.standard_scaler import StandardScaler
from brainvoice.data.minmax_scaler import MinMaxScaler
import os
import torch
import pickle
class SpectrogramStream(object):
"""
Subset... |
7aca3e1665f600b362fc3b3c5c3d176f36286424d6741b5e0b51276c8dd12876 | Python | 8,034 | 217 | """Compare the CSV outputs of the MATLAB and Python MEA-NAP test-pipeline runs.
Aligns each pair of CSVs on their key columns, then reports per-column
agreement (max absolute / relative difference, correlation) plus any columns
present in only one of the two runs.
uv run python parityRun/compare_parity.py
"""
fr... |
f49d5743b7802d9aca0f3eda86d9d6f5756f51e05fc9f26ad7bf6cb4a71339a9 | Python | 8,034 | 219 | #!/usr/bin/env python
"""
A QGraphicsScene and a QGraphicsItem customized for displaying
data from a camera.
Hazen 3/17.
"""
from PyQt5 import QtCore, QtGui, QtWidgets
import numpy
import storm_control.hal4000.halLib.c_image_manipulation_c as c_image
class QtCameraGraphicsItem(QtWidgets.QGraphicsItem):
"""
... |
376a051001c3129b17b91811b6abc7f3c23c81122293d8449cef7c5fa97c313f | Python | 8,035 | 193 | from time import time
from typing import Union, List, Tuple, Callable
import numpy as np
import torch
from fft_conv_pytorch import fft_conv
from batchgeneratorsv2.helpers.scalar_type import RandomScalar, sample_scalar
from batchgeneratorsv2.transforms.base.basic_transform import ImageOnlyTransform
from skimage.morpho... |
fcb4085ee8b7014b9d7cf153b2f2eca015eb44790d5a9f66fc666f78137112f1 | Python | 8,036 | 248 | """
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... |
29f135728ca22bedaccc94e524eca4b4af2ef3332c7dab4032d4a5b52df9d6b3 | Python | 8,037 | 260 | import numpy as np
import matplotlib.pyplot as plt
from transforms3d.euler import euler2mat
from mpl_toolkits.mplot3d import Axes3D
class Joint:
def __init__(self, name, direction, length, axis, dof, limits):
"""
Definition of basic joint. The joint also contains the information of the
bone betwee... |
1e6835e3cbacbfd941f051c5b06718de676f40f7bf6d71b7c0416f1efd88a3ba | Python | 8,038 | 235 | from langgraph.graph import StateGraph, START, END
from langchain_core.messages import ToolMessage
import json
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.memory import MemorySaver
from chemgraph.tools.graspa_tools import run_graspa
from chemgraph.models.agent_response import ResponseFormatter
fro... |
c2fc5d3a71c4f671fc813c786d7d90300c85d9de7ce1cfbd7589abfdc7a81ef4 | Python | 8,038 | 285 | """This module contains abscissa and ordinate objects for core nelpy objects."""
__all__ = [
"Abscissa",
"Ordinate",
"AnalogSignalArrayAbscissa",
"AnalogSignalArrayOrdinate",
"TemporalAbscissa",
]
from numpy import inf
from .. import core, formatters
class Abscissa:
"""
An abscissa (x-a... |
ba390913b44b5907fb45ac455d54dcbda305f71e76bdad90be5675b6213f3bd0 | Python | 8,041 | 192 | # -*- coding: utf-8 -*-
# @Author : LG
import torch
from PyQt5 import QtCore, QtGui, QtWidgets
from ISAT.ui.setting_dialog import Ui_Dialog
from ISAT.configs import polydp_epsilon_factor_dict
class SettingDialog(QtWidgets.QDialog, Ui_Dialog):
"""Software settings dialog (self-contained).
Loads its widget... |
97cb4c082beaabcf4f52c339b02164f0c95df68c385c67ecf39aa11447780e77 | Python | 8,042 | 215 | """
qfsettings.json <-> QuadrantFoldingGUI widget bindings.
These declarative tables drive QuadrantFoldingGUI.loadSettings(). They
are the inverse of QuadrantFoldingGUI.getFlags() -- if you add a key
in one, add it in the other.
The whole module is Qt-free on purpose so unit tests (which assert
the bindings stay in s... |
9711d9494533bad67ebce88a9ff6498aa8b3383d307be29dddf78da167b1b3d6 | Python | 8,043 | 197 | """
Statistical feature extraction from kinematic timeseries.
Ported from utils/kinematics.py (Chambers et al. 2020 pipeline).
"""
import numpy as np
import pandas as pd
import scipy.stats
from kinescope._vendor import circstat as CS
# ──────────────────────────────────────────────────────────────────────────────
... |
eee23c5380b8c881a12edeb9b469798ce1d33ff856f0f1598bf63c2fe0e46a89 | Python | 8,043 | 203 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script to compute the Constant Solid Angle (CSA) or Analytical Q-ball model,
the generalized fractional anisotropy (GFA) and the peaks of the model.
By default, will output all possible files, using default names. Specific names
can be specified using the file flags sp... |
c3e0738efc1b39f63866654ac1d8961a5d1e60ec947a6a0432a4c916e7724e94 | Python | 8,044 | 208 | # Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs (https://arxiv.org/abs/2203.06717)
# Github source: https://github.com/DingXiaoH/RepLKNet-pytorch
# Licensed under The MIT License [see LICENSE for details]
# Based on ConvNeXt, timm, DINO and DeiT code bases
# https://github.com/facebookresearc... |
4012cbf0817e456d6103dff4aad770d69effd1e8020697c8303c952916d7fe3b | Python | 8,045 | 254 | # -*- coding: utf-8 -*-
"""TODO"""
import abc
from enum import Enum
import core.core_global as core
from core.core_definitions import (SimulationDelayTooSmallException, simulation_min_distributed_size,
simulation_mindelay)
from core.logger import LogMessageType
from core.euler_trace... |
0af99fcf6c74d58fcfc2904989c31cf6d07dc11c86d2fcfc74e5488964d2631d | Python | 8,046 | 220 | """
Test case for moments registration with and without scaling.
This test verifies that when fixed and moving images have different scales,
using perform_scaling=True with moments=2 results in better alignment (lower loss)
than without scaling compensation.
"""
import pytest
import torch
from pathlib import Path
imp... |
192e7fdd0e290ce357501e5a24ed2c4d6389927fbc001a240884c80173436bb8 | Python | 8,049 | 218 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from collections import OrderedDict
from datetime import datetime, timedelta, timezone
from typing import Any, cast
import attrs
import cvat_sdk.auto_annotation as cvataa
import PIL.Image
from .agent_driver import (
AgentFunctionDriver,
Bad... |
701ec81be890f23800a64d2b12c9dc6edfed2d6b991cc2e215e8f77934ab6a22 | Python | 8,050 | 256 | """Chase/avoid task with predators, prey and an occluder.
The predators (red circles) chase the agent. The agent receives reward for
catching prey (yellow circles), which disappear upon capture. There is an
occluder (gray rectangle) in the arena.
"""
import collections
import numpy as np
import os
from moog import a... |
4d09de9105cf6749b73249cc5269734e2d523696fb7069b6d1a29eb96ace4f78 | Python | 8,052 | 242 | # Sourced from https://github.com/fwillett/speechBCI/blob/main/NeuralDecoder/neuralDecoder/utils/lmDecoderUtils.py
import os
import lm_decoder
import numpy as np
import time
def lm_decode(decoder, logits, returnNBest=False, rescore=False,
blankPenalty=0.0,
logPriors=None):
assert len(l... |
b09db95634fbecd66ad48c0edadaacd0fb73cb44993fd2e57f00d7f360ea0945 | Python | 8,053 | 263 | import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from src.llm_orchestrator import SelfCorrectingAgent
from src.rag import ChromaManager
def demo_pemfc_closed_loop():
print("\n" + "="*80)
print("DEMO 1: PEMFC Polarization Curve Fitting - Closed Loop Self-Correction")
print... |
dc7b3b9b27d7f4e2bdce760112723d79a771c5cc9ffb90d807a5d30bd9a7b4e2 | Python | 8,053 | 241 | """
This is ported from Matlab code from the original TDR codebase.
"""
import numpy as np
import re
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
from utils.roc_selectivity import calculate_selectivity
def perform_regression(data, regressors, ... |
573213229543fa25c23bd4cf402b156a1a6fd474a6a0d14c8fdf094e8f40eddf | Python | 8,055 | 214 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 4 10:45:29 2018
@author: avelinojaver
"""
from tierpsy.features.tierpsy_features.summary_stats import get_n_worms_estimate
import random
import math
import pdb
import tables,json
fold_args_dflt = {'n_folds' : 5,
'frac_worms_to_kee... |
2d3f2ab3415a02a9477fd906f53a7b3f58b1f9167450474285249bd2e3992a1a | Python | 8,056 | 254 | """
tensorflow/keras plot utilities for the neuron project
If you use this code, please cite
Dalca AV, Guttag J, Sabuncu MR
Anatomical Priors in Convolutional Networks for Unsupervised Biomedical Segmentation,
CVPR 2018
Contact: adalca [at] csail [dot] mit [dot] edu
License: GPLv3
"""
# third party
import numpy as... |
a1eed68c4605da48a9f674c12686eb1a8c0796a07860ef6009c3c5fc78384726 | Python | 8,058 | 163 | # Copyright DMIS Lab. BioBERT Authors. http://dmis.korea.ac.kr
#
# 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 appl... |
fca391b649580ab18ef5c84a54614d84777a71470ab501525b1df0df6c37f7ad | Python | 8,058 | 195 | import wbuild
import drop
from pathlib import Path
from shutil import copy2, rmtree
from distutils.dir_util import copy_tree, remove_tree
import subprocess
import click
import click_log
import logging
import os
import filecmp as fc
wbuildPath = Path(wbuild.__file__).parent / ".wBuild"
logger = logging.getLogger(__name... |
30e0fde87fbf3cffdd4f4732d6893d5bf6ee7ccad48cb3dc39a83dc0a494c877 | Python | 8,059 | 199 | """
Calculate the contribution of magnetic susceptibility to R2a anisotropy
- Compare R2a for all three datasets (3T LC, 3T SC, 9T SC) with and without epsilon0 as free parameter
- Calculate the relative contribution of susceptibility to the R2a
- Save the results in a CSV file
Author: florian.birk@tuebingen.mpg.de
""... |
ca238b5d6acaa40ba7bcee650ab6697872263dd69b1ebc082b27779ae67cbc5b | Python | 8,059 | 215 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import KC_population_calcium_rate_model_functions as mdl
# Functions related to fitting the rate model to data
def simulate_KD_model(t, starr, params, inpscale, dt, n_units, noise=None, n_str=0):
"""
Simulate the KD model with the given parame... |
301257c29b18c6d210d78d083d978c3293899869857ad06832430f07311248e2 | Python | 8,060 | 285 | # The ImpedanceFitter is a package to fit impedance spectra to
# equivalent-circuit models using open-source software.
#
# Copyright (C) 2023 Julius Zimmermann,
# julius.zimmermann[AT]uni-rostock.de
#
# This program is free software: you can redistribute it and/or modify
# ... |
9534294af850c3a6755c3a5a1ba9b2b068c5b79a11166c8547652944e2632f58 | Python | 8,060 | 179 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Shared helpers for operating on lists of track objects across trackers.
These functions are intentionally generic: they only touch attributes that every track
implementation exposes (`track_id`, `frame_id`, `start_frame`, `xyxy`, `mean`, `covarianc... |
e6f323d98f64a4a228659bc243523c9612abd7b4dec298d534735b9212f2687c | Python | 8,063 | 236 | import torch.nn as nn
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/resnet34-333f7e... |
d7d5aa1bee983d6039e349c7f7c6100f3577d1a0d4676ed4525e8ce7fae54d3f | Python | 8,064 | 226 | import os
import numpy as np
import imageio
import h5py
import glob
from nicety.conf import get_conf, dotdict_to_dict
from tqdm import tqdm
from fiberpipeline.utils import preprocess_vol
import cv2
from joblib import Parallel, delayed
from omegaconf import OmegaConf
import tempfile
from connectomics.utils.system imp... |
9ecb4e84e77d5dac929d8596b31ad1e8bab3bcd873fccc289e269f01753cf62f | Python | 8,065 | 225 | from __future__ import annotations
import copy
import numpy as np
from typing import Any, TYPE_CHECKING
if TYPE_CHECKING:
import h5py
class FixedDASWindow:
"""
A simple windower that returns fixed windows.
In addition, the windower rewrites all annotations to point to the correct samples after wind... |
bbfaca402a73fc192ebf508cddcfe7e26d9cf7c0c3c734839bfba98f8bdbf165 | Python | 8,065 | 138 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'spotcounter.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObj... |
4b947ed8b0b7ab929106149fd600cd719fdc4debf2b568df1c0aa6b35c71d375 | Python | 8,066 | 180 | import pymc as pm
import matplotlib.pyplot as plt
import arviz as az
import numpy as np
import torch
from val import load_reg
from tqdm import tqdm
from matplotlib import rc
from matplotlib.ticker import MaxNLocator
font = {'size' : 12}
rc('font', **font)
def replace_values(arr_batch, val0, val1, val2):
# En... |
de20ea9c5d1046468daf436eff20b0239b01895328be4df3937411fd35ad7968 | Python | 8,066 | 187 | '''
BrH2
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for BrH2:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
U: diabatic potential energy matrix
UG: gradient of diabatic potential energy matrix
This is listed at the end... |
266a14fe48358164a7729765e42937aed1a59052a89ab2e6b808e4d5dc11f152 | Python | 8,070 | 178 | import logging
import unittest
import numpy as np
import scipy.stats as stats
import diffxpy.api as de
class TestStats(unittest.TestCase):
def test_lrt(self, df: int = 3, n: int = 1000):
"""
Test if de.stats.likelihood_ratio_test() generates a uniform p-value distribution
if it is gi... |
022819d08e8bde3607664c42462ec201e78760f39c71d624f1d9445b4c2085be | Python | 8,071 | 201 | # -*- coding: utf-8 -*-
"""
EPI <-> EPI
The purpose of the following script is to compute the deformation field for the
registration between different epi time series. The script consists of the
following steps:
1. set output folder structure
2. n4 correction epi
3. clean ana (remove ceiling and normalise)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.