sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
adacdbe2ec67c295c5552c1d5ea36567324dc0c15c5352a9e2ecf98ddc789adf
Python
5,611
166
from pathlib import Path from typing import TYPE_CHECKING import numpy as np from tests.setup_tests.setup_modelling_test_data.setup_targets_test_data import ( get_current_test_label_values, get_test_label_file_fieldnames, set_up_label_file_writing, set_up_label_line_dict, ) from tests.setup_tests.setu...
e4beb391fbab93b9241ad338fbe8348ada1ab7bd0019fb05f90fde87f3441391
Python
5,612
145
# 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 torch def get_fused_adam_class(): try: global unicore_fused_adam import importlib ...
cb16e0afdf73f9528ceab7d2e32cf63138c0c7442a4caab4538792f68d4ad56c
Python
5,615
153
import torch.nn as nn import numpy as np import torch from cvdproc.pipelines.external.qqnet.basics.utils_u_b import unetConv3d, unetUp3d class unet3d(nn.Module): def __init__(self, feature_scale = 2, n_classes = 5, is_deconv = True, in_channels = 9, is_batchnorm = Fal...
8d26141f76e62fc0f47bee05dc65b2b750cf8cbdc0a1d10cc5d06b11a01c8cba
Python
5,618
140
# wfield - tools to analyse widefield data - tools to match between different sessions # Copyright (C) 2020 Joao Couto - jpcouto@gmail.com # # This program 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, eit...
eb7ee818579338d7517870934b5da3fd96e394e283259725c4e039bffc131433
Python
5,620
160
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Compute summary statistics from multiple per-file metrics tables and export a single summary CSV. Assumptions - Each input file contains the same core columns as the original pipeline output: area, Donor_mean_intensity, Acceptor_mean_intensity, FRET_mean_inte...
fd0ab80f20f9918f3785890e792acb8754d683366ecd30a24eb0f17364e78a53
Python
5,625
157
# 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, ...
e29ff842b2488fadfc486d80c8a6f90f4bdb002498e51ecd738a7a5992608dc8
Python
5,626
125
import os from pathlib import Path import numpy as np import pytest import xarray as xr from pytest import approx from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_vision import benchmark_registry, load_benchmark, load_metric, load_model from brainscore_vision....
1880a2f623b54752b5a260794572779fbc25a2df7af3f88f6dafc53d90ec1c16
Python
5,627
175
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import csv import json import os import random import sys from itertools import product NAME = "lambda" def read_rules(name): rules = [] with open(os.path.join(sys.argv[1], f"{name}.csv")) as f: reader = csv.DictReader(f) f...
1e6282d0db9bc44f7890defe1838bb9bbef9f3bc3a318b2aabfbb19717a6df0b
Python
5,631
145
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to combine labels from multiple volumes. If there is overlap, it will overwrite them based on the input order. >>> scil_labels_combine out_labels.nii.gz --volume_ids animal_labels.nii 20 --volume_ids DKT_labels.nii.gz 44 53 ...
874c3a956c6b14a940056209ffb146038be25fb0773491b817f7421c26b3e10c
Python
5,633
119
""" @author: GM @edited: CD Age prediction of brain images convolutional neural networks. The script briefly: 1. Takes a single unprocessed T1-weighted native MRI image in .nii.gz or .nii format. 2. Uses FSL Flirt for a rigid registration (AC-PC alignment) and interpolation to 1x1x1mm3 voxel size. 3. ...
94016ea37c7ab99ec573bc3a65187a1aa2052916c2416b3103cd605319f6618c
Python
5,633
124
# -*- coding: utf-8 -*- """ Created on %(date)s @author: %(PV)s """ import pandas as pd import re # Opciones de pandas pd.options.display.max_columns = None pd.options.display.max_colwidth = None pd.options.display.max_rows = None # Función para extraer números def extraer_numeros(texto): match = re.match(r'^(\...
f570d11755739688d754979981f249e50ce8cde4b8f2cdff86f1c95543028b7e
Python
5,633
186
import cv2 from decord import VideoReader import numpy as np from PIL import Image as PILImage from typing import Tuple, Union from pathlib import Path from .base import Stimulus from .image import Image from brainscore_vision.model_helpers.activations.temporal.utils import batch_2d_resize EPS = 1e-9 def get_vide...
9d47a8b5504d072ea0221a4ed2a822b0f5187f2efe904700e109c4c947fc9729
Python
5,634
149
"""A module that contains processors for pair-wise distance metrics.""" import typing from typing import Annotated, Literal, TypeAlias, TypeGuard, get_args import numpy from scipy.spatial.distance import pdist, squareform from corelay.base import Param from corelay.processor.base import Processor class Distance(Pr...
29e44ffe16dbc07554ea4eb8ad7314d59e1c49d5916006f96b4f2a67637e1dc8
Python
5,635
126
import os from datetime import datetime import numpy as np header = [b'mrtrix tracks\n', b'count: 0000000000\n', b'datatype: Float32LE\n', b'file: . offset\n'] class Tck: def __init__(self, file_path): self.file_path = file_path self.parameters = {} self.header = [] self.length ...
4a4bda83ec7708f4de1dd7bd6b88ec0555f9d37ffa9fc7ee318d97157afb6096
Python
5,635
172
import pandas as pd import numpy as np import math import json import argparse from imblearn.over_sampling import SMOTE from imblearn.under_sampling import EditedNearestNeighbours from sklearn.metrics import roc_auc_score as auc from sklearn.ensemble import AdaBoostClassifier def get_accuracy(AL, y, verbose=1): ...
78eca6a438115566ed7dfd125f6b6448c342653a6d0f64078f5c81781c5416ed
Python
5,636
150
import argparse import logging import os import glob import os import os.path as osp import numpy as np import torch import torch.nn.functional as F from PIL import Image from torchvision import transforms from tqdm import tqdm from utils.data_loading import BasicDataset from unet import UNet from utils.utils import pl...
3a1174e38a32aab20cdd130eaeb7176e1efd17405e41a44b2abf1b220a29816d
Python
5,638
175
# This file is part of Zennit # Copyright (C) 2019-2021 Christopher J. Anders # # zennit/torchvision.py # # Zennit is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at...
7727a59dba4e18c7c7244ad2f91c9cd75c3f7c79a6ad5300c639b68468e73900
Python
5,638
166
import numpy as np import torch import pickle as pkl import os class MotionDataset(): """ Motion Dataset """ def __init__(self, partition, max_samples, delta_frame, data_dir, case='walk'): if case == 'walk': with open(os.path.join(data_dir, 'motion.pkl'), 'rb') as f: ...
96e9356236c9741ebf822e41515d6e5a03fbc3a2a28a29439d986ed5fa5d2174
Python
5,638
123
import seisbench.util from seisbench.data.base import WaveformBenchmarkDataset class OBS(WaveformBenchmarkDataset): """ OBS Benchmark Dataset of local events Default component order is 'Z12H'. You can easily omit one component like, e.g., hydrophone by explicitly passing parameter 'component_order="Z...
c961ed87933744f05a6e2dd33d84318323647b180addd65fae538e3145616cfe
Python
5,639
135
import math from functools import partial import torch import torch.nn as nn import torch.nn.functional as F import numpy as np def CE_Loss(inputs, target, cls_weights, num_classes=21): n, c, h, w = inputs.size() nt, ht, wt = target.size() if h != ht and w != wt: inputs = F.interpolate(inputs, si...
426c2100286853366c4e67770f26a4cf139049af7ef140cf08296b7da16a0060
Python
5,640
210
import logging import os.path as op import nibabel as nib import numpy as np from tqdm.auto import tqdm from AFQ.data.fetch import afq_home, fetch_multiaxial_models from AFQ.nn.utils import prepare_t1_for_nn, resample_output logger = logging.getLogger("AFQ") __all__ = ["run_multiaxial", "extract_brain_mask", "mult...
6e8fb449cf1b762a89d050f28db394e6d627d9a80619c8332a6a240e5aee6c51
Python
5,640
123
import numpy as np import GTF import pandas as pd import networkx as nx def gene_correction_map(): # read Gencode https://www.gencodegenes.org/human/ gencode = GTF.dataframe("../bronze/gencode.gtf") gencode = gencode[["gene_id", "gene_name", "gene_type"]].drop_duplicates().rename(columns={ "gene_...
e10e8ab1acfad73b3a3b91b7f6a8c5f0e8c3da72e4687fcddd353ca3a7e9431d
Python
5,640
196
# -*- coding: utf-8 -*- # @Author : LG """ Startup banner for ISAT. Prints a colored ASCII art logo with version and system information at startup. The letter colors match icons/ISAT_new_32.svg: I = red (#DB5C5C), S = gold (#F2C55C), A = green (#5FAD65), T = white """ import os import sys # ── Color support det...
ecbcb440cd7e069917c6446ed023809a5924a20c38c6211a100c074affa244b6
Python
5,640
121
import numpy as np def split_train_test_data(data, label, ratio, random_state=42): """ Split the data into training and test sets. Ensure that the data within individual trials remain intact. Parameters: - data: ndarray, shape (n_samples, cell_number). Calcium neural activity from no-d...
c4d73aa46165c03811303176a39cca946d11acc459ba47bc7e2f444f09760b78
Python
5,641
166
from unittest.mock import Mock, create_autospec, patch import numpy as np import pytest import torch from scipy.special import softmax from sklearn.preprocessing import StandardScaler from eir.models.output.sequence.sequence_output_modules import ( SequenceOutputModuleConfig as SeqOutputModuleConfig, ) from eir.s...
e696f04fde072573257da1a8d5a68222065640f8635440bddced61d50e942dce
Python
5,641
146
import os, glob, datetime import numpy as np import pandas as pd from scipy.stats import mode import mne from tqdm import tqdm import matplotlib.pyplot as plt data_paths = glob.glob('asdtdegidata-edf/ASD/*.edf') + glob.glob('asdtdegidata-edf/TD/*.edf') result_dir = 'sleep_stages' os.makedirs(result_dir, exist_ok=Tru...
6b3028856cb087a4083c981dae42927fae700fb9968254f7e557ee87f23a3efb
Python
5,642
151
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile import numpy as np import nibabel as nib from scilpy.io.streamlines import save_tractogram from dipy.io.stateful_tractogram import StatefulTractogram, Space, Origin tmp_dir = tempfile.TemporaryDirectory() def init_data(): streamlines = [[...
908a417179ae6ac80b49d5dbab5cb3f66f5d822bfe2d3fde0e93ac680a731a75
Python
5,644
181
# 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 math from typing import Tuple import torch import torch.nn as nn import torch.nn.functional as F from .sam2_utils...
5a9644447e8f685c25e3e8f2ce298d4247ca474e285cf5261ff1440576796e12
Python
5,645
153
import openslide from fastai.vision import * from fastai.data_block import * class SlideContainer: def __init__(self, file: Path, y, tumortype, level: int = 0, width: int = 256, height: int = 256, sample_func: callable = None): self.file = file self.slide = openslide.open_slide(s...
7cf50d93ca5a08f1144875a842d09c13e63c605de64c74d3334d1a6584bcf762
Python
5,645
151
# 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, sof...
881c4dedc46533bd7a71570d655542b2c9b7c7eec9d6f605471052a157a801de
Python
5,645
155
from src.wrappers.OsipiBase import OsipiBase import numpy as np import os from super_ivim_dc.train import train from pathlib import Path from super_ivim_dc.infer import infer_from_signal import warnings class Super_IVIM_DC(OsipiBase): """ Supervised deep learnt fitting algorithm by Moti Freiman and Noam Korng...
c7c1fecefe8c367c5013e120d4780df18c6cb6ca43736fe2fa206b16eeb8a1c8
Python
5,645
351
import os import numpy as np import matplotlib.pyplot as plt DIR = os.path.dirname(os.path.realpath(__file__)) train_loss = [ 1.011386 , 0.991767 , 0.984118 , 0.979690 , 0.976605 , 0.974293 , 0.972522 , 0.971151 , 0.970065 , 0.969218 , 0.968511 , 0.967941 , 0.96743...
2dd9a6e1e2860544f5793299aecd2754e81a79f08d9fa350baa3b3c6dcb60592
Python
5,646
172
import argparse import torch import torch.nn.functional as F import torch_geometric.transforms as T from torch_geometric.nn import GCNConv, SAGEConv from ogb.nodeproppred import PygNodePropPredDataset, Evaluator from logger import Logger class GCN(torch.nn.Module): def __init__(self, in_channels, hidden_chann...
65cc3be4136e6e6fe2cb2a07afae2fa8af2cba912e0cce735cd629799572e293
Python
5,646
172
import unittest import numpy as np from scipy.sparse import csr_matrix from numpy.testing import assert_array_equal def find_loc(num_list, target): l = 0 r = len(num_list) - 1 while l <= r: mid = (l + r) // 2 if num_list[mid] > target: r = mid - 1 else: l = ...
76532924817c9a1d89013f6d0d7b0aa5673ea17bccbed16111ae966359b4478c
Python
5,646
181
# 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 # ...
f0ccebc69fd5ea8fc1a5945a6be8477aa6e09ece3a01360a9b5c1cf3c3f2a31e
Python
5,648
234
import numpy as np import hipsternet.utils as util import hipsternet.constant as c import hipsternet.regularization as reg from hipsternet.im2col import * def fc_forward(X, W, b): out = X @ W + b cache = (W, X) return out, cache def fc_backward(dout, cache): W, h = cache dW = h.T @ dout db ...
3752ad3ed5aad2c84055b5f08dc14594a87a7091282686ed0e98b57cba6e06ea
Python
5,649
161
from typing import get_args import numpy as np from argclz import AbstractParser, argument from neuralib.plot import plot_figure from rscvp.spatial.main_cache_occ import ApplyPosBinCache from rscvp.util.cli.cli_output import DataOutput from rscvp.util.cli.cli_selection import SelectionOptions from rscvp.util.util_tri...
d8960c382e33411e14e74d86cd5cfdb9bf745a98a716e9a045b516b2893fa712
Python
5,650
121
import numpy as np def split_train_test_data(data, label, ratio, random_state=42): """ Split the data into training and test sets. Ensure that the data within individual trials remain intact. Parameters: - data: ndarray, shape (n_samples, cell_number). Calcium neural activity from no-d...
9fa94cdf62fa97edd6e97d6c9220762ae8d2579f4592d5bbc8edbedd27a8a030
Python
5,651
147
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to resample a dataset to match the resolution of another reference dataset or to the resolution specified as in argument. This script will reslice the volume to match the desired shape. To: - pad or crop the volume to match the desired shape, use sci...
9d1df2c6763debfb8408f77e5d5bc67d41bbe1b3c5f66ef5d21d3744e48b01af
Python
5,652
159
from dataclasses import dataclass from typing import TYPE_CHECKING, Literal import torch from torch import nn from eir.models.fusion.seq_out_fusion_attention import MetaSequenceFusion from eir.models.input.sequence.transformer_models import ( BasicTransformerFeatureExtractorModelConfig, parse_dim_feedforward,...
d61a53669e03fb8c673e4af98cdbe1f54ecedd0a0e136ad229b778c8a75924da
Python
5,652
158
import copy import numpy as np import pandas as pd from tqdm.auto import tqdm from scipy.spatial.distance import cdist, pdist import warnings from random import choice def get_random_point(feas_func, rng, com_step=0.1/9): while True: # Composition random generator xyz = rng.random(3) if su...
e970d02056d14f7485459bc9a8aca1dd836408bd544382d2bf4694f2ee958ccb
Python
5,652
128
from dipy.io.streamline import load_trk from fury.colormap import create_colormap from fury import actor, window, colormap as cmap import matplotlib.pyplot as plt import nibabel as nib import numpy as np from os.path import join as ospj import pandas as pd from scipy.ndimage import gaussian_filter, zoom ###########...
472e2aefb4ee7c5be0a82bfc1183a503955bc8ee1502af753670eef558604b0a
Python
5,653
146
# -*- coding: utf-8 -*- """ Finds the difference in point values between two files. Difference for all arrays in file calculated unless list of array names given by 'array_name' parameter A .vtk file with material id and differences between properties at idx """ import numpy as np import vtk from os.path import exis...
ee9259f0b21a912fd7ec7e0184ba378bd2510f41f52572cae77541c6dc5b5a4d
Python
5,653
157
# 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, ...
22d95eaefa213b264ddf3d48d40ecc885b850ada07e54d7547ae80e5f056fa87
Python
5,655
167
import os import re import sys import glob import json import numpy as np import os.path as op from os.path import join as ospj import matplotlib.pyplot as plt import nibabel as nib from dipy.io.image import load_nifti from dipy.io.streamline import load_trk from dipy.data import fetch_bundle_atlas_hcp842, get_bundle_a...
25f0ce61e327811e1ab09cb6dbf8dc375fe7e403c4e15468e76ca2d14533c9b3
Python
5,656
152
"""Do the confirmation buttons sit in the same place on every platform? Qt orders dialog buttons per platform: Windows and most Linux desktops put the affirmative button first, macOS puts it last and focuses the other one. So the "Reset all parameters to defaults?" dialog behind **New** offered Yes on the left on Linu...
154e5dec2d4337a982a6e133c86264b4f5d0c95b81bfaad401a9b0bf47d6486d
Python
5,658
146
"""Per-window signal-quality indices driving the reliability gate. Each index is in [0, 1] and is computed from the raw stream alone -- never from the label -- so it is available at inference time in a deployed system. """ from __future__ import annotations import numpy as np from .eda import EDA_MAX_US, EDA_MIN_US ...
291c3f00df00fee59838d3cc709daaadb7a796a2c8d2e3cae0c7920fad02c9d6
Python
5,658
167
"""Direct OpenAI endpoint and the shared OpenAI-compatible kwargs assembly. ``assemble_client_kwargs`` is the single place that reproduces the two parameter shapes the previous ``load_openai_model`` produced -- the ``base_url``-present shape (used by Argo, ALCF, vLLM, custom endpoints) and the plain OpenAI shape. Ever...
d086ee2ad20d53ebd3c7a41eadc83e5c2bb2bfb51fc835f891f823ab30246f6a
Python
5,658
125
from pathlib import Path import numpy as np from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_vision import load_metric, load_stimulus_set, load_dataset from brainscore_vision.benchmark_helpers.screen import place_on_screen from brainscore_vision.benchmarks imp...
15a5902b8f8609f4c23f7e2ec9e34d58a36117d2ac26e7ccb1e4872386f27be5
Python
5,659
173
"""resnet in pytorch [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun. Deep Residual Learning for Image Recognition https://arxiv.org/abs/1512.03385v1 """ import torch.nn as nn class BasicBlock(nn.Module): """Basic Block for resnet 18 and resnet 34 """ # BasicBlock and BottleNeck block ...
b7aff4d83a4eeb40a0fba83ceb03feb1a92fb7f9643c523f1ddebe8cd1aac2c9
Python
5,659
153
# fmt: off # flake8: noqa """Config.""" import argparse import os def parse_configs(): """Parse command line.""" default_eval_config = get_default_eval_config() default_eval_config["DISPLAY_LESS_PROGRESS"] = True default_dataset_config = get_default_dataset_config() default_metrics_config = {"MET...
a9cd83e3807b5813da244216e90b078d0c05e16d5a9337018fee8ae5cfdd87d5
Python
5,660
146
import h5py import os import numpy as np from tqdm import tqdm import torch from torch_geometric.data import InMemoryDataset, extract_tar from mlcg.utils import download_url from mlcg.data import AtomicData class QM7XDataset(InMemoryDataset): """Extractor for the QM7X dataset described in https://doi.org/10.1038...
1758b3759df402fe5a193ac4c1caa09e91bd6e018873794703269a2fe220efb6
Python
5,661
169
from __future__ import annotations from pathlib import Path import pytest from PySide6.QtWidgets import QMessageBox from pytestqt.qtbot import QtBot import labelme._app from ..conftest import close_or_pause from .conftest import MainWinFactory from .conftest import draw_and_commit_polygon from .conftest import show...
2a5dcefd8bb7cfc81c27204f5390708350f77be6752f35919a4b6a79b85cde10
Python
5,661
132
import torch import argparse import triton import triton.language as tl #code based on triton matmul example, modified for branched matmul with ReLU and sum over branches. @triton.jit def matmul_kernel_original( a_ptr, b_ptr, c_ptr, M, N, K, stride_am, stride_ak, stride_bk, stride_bn, ...
6ad4fb1ba7f824107e53151bd3c8bebd3ef514b7864becba59a382c98936acc1
Python
5,661
212
import os import tarfile import requests import pandas as pd from path import Path AUDIO_SR = 16000 AUDIO_LENGTH = 16000 LIBROSA_AUDIO_LENGTH = 22050 EPOCHS = 25 categories = { "stop": 0, "nine": 1, "off": 2, "four": 3, "right": 4, "eight": 5, "one": 6, "bird": 7, "dog": 8, "n...
f613384109beb4d851f8cefccd5e1d6559c723deed3e21463f840bd6fdb77e3c
Python
5,662
167
from pathlib import Path from typing import Final, Literal import numpy as np from argclz import try_int_type, argument from neuralib.plot import plot_figure from neuralib.util.verbose import publish_annotation, print_load, print_save from rscvp.spatial.main_cache_occ import PosBinActCache, ApplyPosBinCache from rscv...
255a3fa12ee7d125d6419dfe0912f66b3af1c512daa62db00460840e0d0f33cb
Python
5,663
199
SYSTEM_PROMPTS = { "code_generator": """You are an expert in electrochemical engineering and scientific computing. Your task is to generate clean, executable Python code for fuel cell and battery modeling. Generate code that: - Uses NumPy and SciPy for numerical operations - Follows physics constraints (dimensional...
7ef994327421b5b5391303a56562b578391c1a079a972cff91df6d28214a6c9a
Python
5,664
168
"""Data aggregation functionality.""" import numpy as np import torch from rich.progress import track from torch.utils.data import DataLoader from mcmlnet.experiments.data_loaders.utils import get_image_id, get_subject_id from mcmlnet.utils.load_configs import label_is_organic from mcmlnet.utils.logging import setup_...
7b37cc7ca535e086a5c3d60e6c5293aa7596684f3131f38724fd7740dc1f6503
Python
5,665
157
# -*- coding: utf-8 -*- # python standard library inputs import os import shutil as sh # external inputs import nibabel as nb from scipy.ndimage.morphology import binary_erosion from nipype.interfaces.fsl import BET from nipype.interfaces.freesurfer.preprocess import MRIConvert from nighres.registration import apply_...
ff712c39e37229068b9522f225b50cbee53939060f6e92903938e093b1d71fd7
Python
5,665
204
"""Temporary scoring functions. Needs a lot of work. DEPRECATED""" from itertools import groupby import numpy as np def scoreOrderND(hmm, state_sequences): """Compute order score with no adjacent duplicates in state sequences A score of 0 means there's only one state. """ scoresND = [] # scores w...
f679a0f55a1a30f808e61c320e5cf49efce6bac86ecc8c0392af34abebec9f69
Python
5,666
143
# 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...
5a32e5099b5a886476360330a6079c6069455e8a5b0facb30709fc469a02f094
Python
5,667
146
from dataclasses import dataclass from typing import Literal, Optional from Bio import SeqIO from utils import TaxaLevel, sample_valid_fragments import numpy as np import os TaxRank = Literal["superkingdom", "kingdom", "phylum", "class", "order", "family", "genus", "species"] class Fasta_DataLoader: ''' clas...
ad936d028dbaf9251b5de7d0b307a41d44ca1a82cd7c16e9c9dd0e18ba737adc
Python
5,668
154
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/6/3 15:23 # @Author : SONG-LE # @知乎 : https://www.zhihu.com/people/xiao-xue-sheng-ye-xiang-xie-shu ''' 封装画图的算法 ''' import matplotlib.pyplot as plt import numpy as np import os import scienceplots # 判断图片目录是否存在 fdir = r'E:\Projects\WMH_segmentation\derivatives...
c3feb12941278bef84cca8db21da2fb340a023670466cac87162f4d00c826eaa
Python
5,669
166
"""Defines functions for the DrugBank approved reference set.""" from collections import defaultdict from functools import lru_cache from pathlib import Path import pandas as pd from admet_ai.admet_info import get_admet_id_to_name from admet_ai.constants import ( DEFAULT_DRUGBANK_PATH, DRUGBANK_ATC_NAME_PREF...
e5dc772365499699f8f41cd7d2cbd8351dbfbf0ae3a6eeef97621b96772cc8ab
Python
5,669
182
import reprlib from collections import defaultdict from collections.abc import Callable, MutableMapping from functools import partial from inspect import signature from typing import ( TYPE_CHECKING, Any, ) import torch from adabelief_pytorch import AdaBelief from aislib.pytorch_modules import AdaHessian from ...
6449448aac3ad2ce97d790435a592b380702501a4817f83ed8284b586f06a1ab
Python
5,670
148
import os import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader, TensorDataset, random_split from sklearn.preprocessing import StandardScaler import numpy as np import pandas as pd import argparse from model_options import TransformerClassifier, load_compatible_state_dic...
62d31f206294f68fe36800cb89fd1096a82c2d42cea835449ff9169e7150c3aa
Python
5,671
129
# 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...
bdedd314fd1a834f913d73fadb64ffdac47d57f06685568ebfa036a88e6bf4e8
Python
5,673
177
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2022 The NiPreps Developers <nipreps@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
539d2acdeea591de0a164293ebc1ebab6d6e0de992a23ec52466801ab1abca6c
Python
5,674
155
import typing import functools import logging from ..config import * from ..qt import * from ..util import NodeSelector from ..task_controller.util import create_task_with_exc_handling from .. import thalamus_pb2 from .. import thalamus_pb2_grpc from ..observable_item_models import FlatObservableCollectionModel LOGGE...
e59fde77f82cf032517561758bdb442fd89b3b71185bcd89f0f787bd2d008554
Python
5,674
205
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GCNConv from torch_geometric.nn import GINConv from torch_geometric.nn import SAGEConv from parms_setting import settings args = settings() class Discriminator(nn.Module): def __init__(self, n_h): super(Disc...
07166ecac2b6543464abd795c083ec62dffac7802061862a06fad122976fcf16
Python
5,675
152
""" Classes and functions for fitting ivim model """ import numpy as np from scipy.optimize import curve_fit from dipy.reconst.base import ReconstModel from dipy.reconst.multi_voxel import multi_voxel_fit from dipy.utils.optpkg import optional_package from scipy.signal import unit_impulse class IvimModelsI...
3214318fab22d2dbb9313a25cadf8073fd839dd153373b330ad2a71a87ffb8ec
Python
5,676
198
from __future__ import annotations from collections.abc import Callable from typing import Final import numpy as np import osam import pytest from numpy.typing import NDArray from labelme._automation._osam_session import OsamSession _IMAGE: Final[NDArray[np.uint8]] = np.zeros((2, 3, 3), dtype=np.uint8) _POINTS: Fin...
2a03083f090582b283fe2a2bc6d989cf45767d84c7e84f8d80386998b0dca0ea
Python
5,677
141
"""Compare a spike-*sorted* run of MEA-NAP with a *detected* run of the same recordings: did making neurons the nodes change the network? uv run python python/compare_sorted_vs_detected.py <detected_root> <sorted_root> [--out fig.png] Writes one figure and prints one table: - **units per electrode** — how the no...
dede4dedce8ed45ed5eb0e6fc7882bb9fc8b58f17200273db3f1c6f19327f4b8
Python
5,681
175
import typing from pathlib import Path import pandas as pd import polars as pl from neuralib.typing import DataFrame from neuralib.util.verbose import fprint, print_load from rscvp.spatial.main_place_field import split_flatten_lter from rscvp.util.util_dataframe import check_null, to_numeric from rscvp.util.util_gspr...
fd013c22b44ba925f51717e97670557138e03dd86796e6655af3f4c5eade978e
Python
5,682
164
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import datetime from contextlib import suppress import rq from django.db.models import Min from cvat.apps.webhooks.exceptions import WebhookDeliveryError from .cache import clear_cache from .const import COMPRESSED_EVENT_SCOPES, MAX_EVENT_DURATION...
159a5a7a912170bb032938e1b9320518b26305179fd5597d3a11f43e50013d25
Python
5,683
157
import math import torch import numpy as np import random def gaussian_kernel( sigma: float, k: float=1, size:float=15, norm:bool=False ) -> torch.tensor: """Returns a 2D Gaussian kernel. :param k: height of the Gaussian :param sigma: standard deviation of the Gaussian :param siz...
de3d70755d7cb1213f558820734cb2545aff21b019a0e6e25b91be3b01102bbd
Python
5,683
231
import contextlib from dataclasses import asdict, dataclass from typing import TYPE_CHECKING, ClassVar from unittest.mock import Mock import psygnal import pytest from psygnal import SignalGroupDescriptor from magicgui.schema._guiclass import ( GuiBuilder, GuiClass, button, guiclass, is_guiclass, ...
499dcff8810541d535869292522c72ec996a53501f58b35ce81d0c8a779f903f
Python
5,684
168
import logging import lightning as pl import torch from rich.progress import track from mcmlnet.experiments.utils import ( load_model_configs, save_results_to_csv, validate_model_metadata_file, ) from mcmlnet.training.data_loading.sota_data_classes import SOTAPreprocessor from mcmlnet.training.models.base...
369ae796aff5b09dab6d2ee51db92b99be455c89d9f8399c8102efbb627de386
Python
5,685
143
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Download a project's task data incrementally: the SDK keeps a local cache and re-downloads only what the server has changed since the last run. ``cvat_sdk.datasets.TaskDataset`` stores each task under the client's cache directory. On every constr...
8a9bc0e3e7fa2dda4874b19572a353f6228738f89e62c5a176a8c74a70cefea9
Python
5,685
143
#!/usr/bin/env python """ qc_meshes.py ============ Report outlier subjects in a set of segmented head meshes, before building a basis from them. A single badly segmented or misaligned subject can dominate the PCA. In the bcas build one subject out of 180 was rotated 20 degrees out of the CTF frame and by itself carr...
c6332603ce41b2e69e5f01bc19564f698ee8081f2f8c7cd6f4785f590672a7f5
Python
5,685
140
import random import pandas as pd from datetime import datetime from sklearn.preprocessing import OneHotEncoder def ts_creator(seconds_list): time_data = [0] for second in seconds_list: time_data.append(second + time_data[-1]) seconds_list.append(0) return seconds_list def filter_function()...
d3608f0d954652b813625ded0c8e7cd62561074def2286556e8b26dd1bebb819
Python
5,685
145
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Dec 6 15:33:56 2019 function getNames now in a seperate file @author: kooij_k """ import pandas as pd import numpy as np #import doric as dr import h5py import inspect def getNames(info0): info_list = ['info'+ str(i) for i in range(100)] p =...
a3e3866c95e59a2b500e108a28cd91a869f358d98674b4506f7fdf8198d56ad3
Python
5,687
141
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Import annotations into an existing task straight from a registered cloud storage: the server pulls the file out of the bucket itself, nothing is uploaded from this machine. Handy when a model writes its predictions to a bucket, or when the annota...
bb1477e8a7ba245083ac15a142929cc9b1b7aa4b717fe1352adf38b713e8cd23
Python
5,688
144
# #!/usr/bin/env python # import os # import sys # sys.path.append(os.path.join(os.path.dirname(__file__), '..')) # # import click as ck # import pandas as pd # from Bio import SeqIO # from toolkit.extract_esm import extract_esm # # # @ck.command() # @ck.option('--data-root', '-dr', default='cafa_data', required=True, ...
c048a748beaed174b8773b983ec0a138acacb2514f9d31e22321fedb0bd1426a
Python
5,688
164
from pathlib import Path from typing import Tuple from unittest.mock import Mock, patch import numpy as np import pandas as pd from pytest import fixture from brainways.project.info_classes import ( MaskFileFormat, RegisteredPixelValues, SliceSelection, ) from brainways.ui.brainways_ui import BrainwaysUI ...
618b5a2c9859a0e0d1ad2582499241fecffcca45634cf131a0fbcbea6fd53cbb
Python
5,689
152
"""Tooltips that wrap, and look like the tutorial bubbles. Qt lays a plain-text tooltip out on a single line however long it is. The longest in this app rendered at 1468 px — most of a laptop screen, in a strip one line tall, usually overlapping the very control it describes. Anything worth explaining in a sentence wa...
bb08e385c2abf599a8d0960b93580468869d151d1f52716b4230b81a35ffd4c0
Python
5,689
130
"""Which OCSR models the tool can use, and which ones are actually installed. Two separate questions, and conflating them is how you end up shipping a default nobody can run: * Is a model *listed*? A registry entry means "offered", not "importable here". * Is it *installed*? That is :func:`chemgraph.tools.ocsr_ba...
294fd639f5fa6a99d932b2a9e9a271adf5e3a0eca8942258dbf99f35aa791f4f
Python
5,694
144
############################################################################# ### Recursively moves through directories and extracts parameters and the ### ### measures Q and MI from simulation data ### ############################################################################# ### Cop...
d438f4685b1311e2480bcdbafdb98fa7870b6679dee707e74b28a632773b277c
Python
5,694
157
""" Variational autoencoder system MB Vessies and RR van de Leur """ import torch from torch import nn from ecgxai.utils.exceptions import ModelOutputShapeMismatchException from ecgxai.systems.base_system import BaseSystem class VAE(BaseSystem): """ Basic VAE system """ def __init__( self, ...
5e62185c680077d325d29556cc6295f6ef617ee02f23a5170855aa96db706d8f
Python
5,695
180
import unittest import SVMTK import os tests_dir = os.path.dirname(__file__) class Domain_Test(unittest.TestCase): def test_unpack_mesh(self): domain = SVMTK.Domain(f"{tests_dir}/Data/cube.mesh") points = domain.get_points() cells = domain.get_cells() facets = domain.g...
94bbaf309007826212c40c341681bac0acd6167b89c42c1eafeaae18fc0ac6ad
Python
5,695
177
# 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 math from typing import List from unicore.optim.lr_scheduler import UnicoreLRScheduler, register_lr_sch...
dd1516610ba452599c5ffb6ac2d323ae13dc3f3434bb390356da8da42a56f9a5
Python
5,696
108
"""This scripts generates 3 examples for plain SR between LR synthetic T1 scans (input channel) and HR synthetic T1 scans (regression targets, or output channel). Therefore this script does not use real images as regerssion targets. Because we do straight SR, the input channel is generated directly by blurring/downsamp...
c39edc583333de6cabc5ea06660e367f1e712add661666ef72082996ebdb3b1f
Python
5,697
144
import os import os.path as osp from typing import Callable, Dict, List, Optional, Tuple import torch from torch import Tensor from torch_geometric.data import ( Data, InMemoryDataset, download_google_url, extract_zip, ) from torch_geometric.io import fs, read_txt_array from torch_geometric.utils impo...
dad2aec18cda894fa4c9023fcabea5e7e39536c8fdd5e37ae56e11ed6f78f773
Python
5,697
155
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Maximilian Betz # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Li...
e77a47bd911f713018bb12227783aa4d3f10c7c3f0543c9346cb27659baa37af
Python
5,698
144
############################################################################# ### Recursively moves through directories and extracts parameters and the ### ### measures Q and MI from simulation data ### ############################################################################# ### Cop...
5aa2e713c72540301fad9ff5d3b094a0df0c73e28fdd880dda44bfe2a89e9834
Python
5,699
118
import tensorflow as tf from src import TGCNN_layer class TGCNN_Model(tf.keras.Model): def __init__(self, num_filters=2, num_nodes=97, num_time_steps=100, filter_size=3, variable_gamma=True, exponential_scaling=True, dropout_rate = 0.2, lstm_units=16, fcl1_units = 128, LSTM_a...
d2fd1654ab749c82e5fc6c8dc707fbb5da6bd4487943774cbbe900c22dc76eb0
Python
5,699
163
#!/usr/bin/env python """Agent + MCP + Parsl demo on an HPC compute node. LLM agent on the compute node drives a local ``mace_mcp_hpc`` subprocess whose backend is ``parsl`` configured for Polaris, Aurora, or Crux. The agent uses ``run_mace_single`` to compute thermochemistry for each of the 5 molecules and reports a ...
6519895ab52e986c005a0b29577c61de8cee1b61fc8691e87e4086ed59412c93
Python
5,701
170
""" Weighted Least Squares (WLS) / Robust Linear Model (RLM) IVIM fitting. Author: Devguru Tiwari, IIIT Nagpur Date: 2026-03-01 Implements a segmented approach for IVIM parameter estimation: 1. Estimate D from high b-values using weighted/robust linear regression on log-signal 2. Estimate f from the intercept of the ...
67f656a89b1388f8eaba5b02486eb25bc806857acf18ca004e5075abb0db47e4
Python
5,703
171
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import csv import json import os import random import sys from itertools import product NAME = "organizations" def read_rules(name): rules = [] with open(os.path.join(sys.argv[1], f"{name}.csv")) as f: reader = csv.DictReader(f) ...
265c7747c59736ac574a2162dcb21dfbd1c307f79b8650a536b189cba6cd81b0
Python
5,704
158
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...