sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
141c06429f839137f4cfa5bfb7875bc9432b6dcd10e80cdf0ae89853459ae5d1 | Python | 4,285 | 120 | # 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.
"""isort:skip_file"""
import argparse
import importlib
import os
from .distributed_unicore_model import Distri... |
1ad8cc49cd34742a59b7cef7ca033bb530dd115d19173e93eb509b1b09245751 | Python | 4,285 | 100 |
from pathlib import Path
import cv2 as cv
from tkinter.filedialog import askdirectory
import numpy as np
from scipy.interpolate import interp1d
# Constants
TANK_PATH = Path(askdirectory())
# Find the path to the video
vidlist = []
vidlist.extend([i for i in TANK_PATH.glob('*.mkv')])
vidlist.extend([i for i in TANK_PA... |
5c98f1594091e57b3854240bc384106e7a79b5a06f0074f4ccf999b207fe80be | Python | 4,285 | 57 | '''
Quick script to run encoding analysis over
all subjects in learning task.
All options available to `subject_rerp_mt1.py` can
be passed to this script.
NOTE: Running these analyses with `s_bsl=llm` (default)
requires that w2v2 activations have been extracted, pro-
jected and evaluated. Please see:
`audio_w2v2... |
769d4e11d4d5c3566495000ceef580f8689b7f6b59ea780bf51ee124078f79bd | Python | 4,286 | 128 | # This file is part of connectome-manipulator.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Blue Brain Project/EPFL
"""A module implementing several executor wrappers"""
from concurrent.futures import ProcessPoolExecutor
from contextlib import contextmanager
from datetime import datetime, timedelta
fr... |
f4dd27f64e4d5c020b6258d3be28a388b192e252e170d1c486c62168409394bb | Python | 4,286 | 90 | from curvature_calculation import from_ply_workflow, new_workflow, extract_curvatures_after_new_workflow
import time
from sys import argv
import mrcfile
files = [("Treated", "TF1_IMM"), # Gotta rerun this bad boy
("TgGSK","GE1_ER"),
("TgGSK","GE2_OMM"),
("TgGSK","GF2_IMM"),
("TgGSK","GT2_ER"),
("TgGSK","GT3_OM... |
4725ee579288fd0895964088a58cf68c8551efe8e7140465a1946ca41491bf28 | Python | 4,287 | 145 | import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
import pandas as pd
import os
from sklearn.preprocessing import MinMaxScaler, StandardScaler
import csv
import time
# Define 1-compartment ODEs
def PK(t, y, ke):
dydt = [-ke * y[0]]
return dydt
for cor in [0.0, -0.1, -0... |
2c90900aa8271e5f52c6dbef35e70866badeaf820efb71baa8015887c003362e | Python | 4,289 | 107 | from pathlib import Path
import numpy as np
import pytest
from numpy.random.mtrand import RandomState
from pytest import approx
from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly, DataAssembly
from brainscore_vision import load_benchmark
from brainscore_vision.benchmark_helpers im... |
8a1777baedce1f45a3437c44401c77765f7b1dc476128330a15afee994688cbd | Python | 4,290 | 105 | from __future__ import annotations
import numpy as np, pandas as pd, torch
from pathlib import Path
from sklearn.preprocessing import StandardScaler
from torch.utils.data import Dataset
from typing import List, Optional, Tuple
# --------------------------- #
# helper: winsorize by IQR
# --------------------------- #
d... |
3ffab8499e274e13f2be7a48518bd82a5a695d978ae00b06a3c55f6f46e30601 | Python | 4,291 | 108 | import sys
import os.path as op
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
sys.path.append('/imaging/hauk/rl05/fake_diamond/scripts/preprocessing')
sys.path.append('/imaging/hauk/rl05/fake_diamond/scripts/analysis/neural/decoding')
import config
from plot_decoding import read_decoding_scor... |
41b6ab329ce504f365e6ec9212a830af7c9c7a4d721c1bec8d28010a0473a748 | Python | 4,291 | 117 | import os
import yaml
import torch
import random
import models
import argparse
import numpy as np
import torch.nn as nn
from utils.utils import *
from scipy.io import loadmat
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
from torch.utils.tensorboard import SummaryWriter
... |
64498a924d7aed3227d8b4338ea762c4b3fe33f000770ce1927fa4c2688a6164 | Python | 4,291 | 136 | """Explore ChemGraph's tool and worker-agent registries.
The default run needs no model or provider credentials. It lists registered
entries, checks optional runtime requirements, resolves a small tool set, and
invokes the calculator directly.
Pass ``--model`` (with that provider configured) to also construct
``singl... |
64fe3d98a16f975738e233a48c0ee5f02ef1b95e7536fb3c5402e0464aa9c227 | Python | 4,291 | 143 | import argparse
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
from loguru import logger
here: Path = Path(__file__).parent
def _setup_logging() -> None:
logger.remove(0)
logger.level("INFO", color="<dim><white>")
logger.add(
sys.stderr,
level="INFO",... |
a9336b3c4f488d6bf1edf9b2d8e025887dfab5081b4af9becbceae959e6669db | Python | 4,291 | 93 | import numpy as np
import sys
import pandas as pd
import glob
import pickle
import os
print (os.getcwd())
from matplotlib import pyplot
import pop_spike_utilities as psu
import GrpPlotUtil2 as grp_utl
from GrpAvgPopSpikeClass2 import GrpPopSpike as gps
def read_data(grp_avg):
DATAS = []
PARAMS = pd.DataFram... |
adf14fdef249201c639dcc55c233dc8d643a610f88132af98ae19247f1d49488 | Python | 4,293 | 127 | import os,csv,re
import pandas as pd
import numpy as np
import scanpy as sc
import math
import numba
@numba.njit("f4(f4[:], f4[:])")
def euclid_dist(t1,t2):
sum=0
for i in range(t1.shape[0]):
sum+=(t1[i]-t2[i])**2
return np.sqrt(sum)
@numba.njit("f4[:,:](f4[:,:])", parallel=True, nogil=True)
def pairwise_distanc... |
66caf13015c48ed3894c0a3b3d4f05ea4d29fc0fb97e1878b7ab5d99696bed7e | Python | 4,295 | 146 | import pytest
import torch
import torch.nn as nn
from eir.models.tensor_broker.projection_modules.grouped_linear import (
GroupedDownProjectionLayer,
GroupedDownProjectionLayerFactorized,
GroupedUpProjectionLayer,
_calculate_factorized_shape,
_get_retracted_shape,
append_dims,
get_pre_dim_m... |
f1bc187801ecdb9c4c18324717dd81178b916041aa2a3c16f42b1aed78b5537a | Python | 4,297 | 136 | #!/usr/bin/env python
"""
'Tile' the blocks of a maf file over each of a set of intervals. The
highest scoring block that covers any part of a region will be used, and
pieces not covered by any block filled with "-" or optionally "*". The list
of species to tile is specified by `tree` (either a tree or just a comma
se... |
156ded4cc270ebad30e5bc8e01eb5626efc16602048df329eab2338620dc0220 | Python | 4,298 | 112 | import torch
from typing import Sequence, Union, Tuple
def Sinkhorn(
a: torch.Tensor,
b: torch.Tensor,
C: torch.Tensor,
*,
epsilon: Union[torch.Tensor, float] = 1,
tolerance: float = 1e-9,
max_iter: int = 100,
requires_gradient: bool = True,
DEBUG: bool = False,
normalise: bool ... |
3c02085717c8836bb68989f70d83cd6053fb4eb1ffa61c20dbb185135edac79c | Python | 4,298 | 126 | from dataclasses import dataclass
from pathlib import Path
import numpy as np
from eir.data_load.label_setup import get_file_path_iterator
from eir.setup.input_setup_modules.common import DataDimensions
from eir.setup.input_setup_modules.setup_array import (
ArrayNormalizationStats,
get_array_normalization_va... |
7e5f00484f2a817a7ad08564404588495a70173a12b63edb6990f060e07691da | Python | 4,298 | 105 | #!/usr/bin/python
"""
HAL module for Lumencor laser control.
Hazen 04/17 Bogdan 03/19
"""
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.amplitudeModule as amplitudeModule
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModul... |
1c9a5cee5059c3f7280e1f92e9d8a4e4d9cd64e33bbc36c0e5a4ea2dbfc8c4ca | Python | 4,299 | 115 | # -*- coding: utf-8 -*-
"""
Template to run the processing pipeline
"""
#load the parameters:
execfile('/home/yourname/experiment/parameter_file_sampleID.py')
#resampling operations:
#######################
#resampling for the correction of stage movements during the acquisition between channels:
resampleData(**Corr... |
3358f138233a35216c702fbad061911801e2a2c2d436615e81a4dbab8e60e28b | Python | 4,300 | 112 | from loguru import logger
import numpy as np
from sklearn.metrics import confusion_matrix
import torch
import torchvision.models as models
from tqdm import tqdm
from model.kidney_classifier import ImageClassifier
def final_test(classifier_net, device, dataset, compute_cm: bool = True, verbose: bool = False):
num... |
dc3ab9ddcbd6358802a4f9a4b6a50cc702f0f10937486a1c9ac19f882a6ce043 | Python | 4,301 | 117 | import os
import numpy as np
import yaml
try:
from importlib.resources import files
tmp = files('encore.gui')
except (TypeError, ImportError): # Python < 3.10
from importlib_resources import files
from encore.utils.parameters_validators import validate_binary_matrix
NEEDED_DATA_TEMPLATE = {
'data_neur... |
98997628493772a8e641f1eb3fd47aabfa5f8e33824328c5ec1b45516b84bebe | Python | 4,302 | 128 | import os
import shutil
import numpy as np
import nibabel as nib
from nipype.interfaces.base import (
CommandLine,
CommandLineInputSpec,
TraitedSpec,
File,
traits,
)
class ANTsResampleDWIInputSpec(CommandLineInputSpec):
dimension = traits.Int(4, usedefault=True, position=0, argstr="%d")
i... |
077e3604700246eda9106831fdb323fc5843ccd39e7b17aaa70a41c6933888af | Python | 4,303 | 116 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import os
import types
from collections.abc import Callable, Mapping
import torchvision.datasets
import cvat_sdk.core
from cvat_sdk.datasets.caching import UpdatePolicy, make_cache_manager
from cvat_sdk.datasets.task_dataset import TaskDataset
from... |
db5a8cd009a2ec9081a7e89d187d67d74bee228805ba9afebdb57281d4c94406 | Python | 4,305 | 136 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Henrik Zunker
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
3ec309761f25d517f73ce6c222cc4349dce3b8714334aa43ad3b7664c6c9173f | Python | 4,306 | 99 | from typing import Union, List
from pathlib import Path
from brainscore_vision.model_helpers.activations.temporal.inputs import Video, Stimulus
from ..base import TemporalInferencer
MS_ROUNDING_DIGITS = 3
class TemporalContextInferencerBase(TemporalInferencer):
"""Inferencer base that computes the temporal cont... |
b2e3bcd6cca7e9fa0c805d5ab4c7c2f40d43db983e0f6e0a9151c9ec802a27a5 | Python | 4,307 | 131 | #!/usr/bin/env python
# Copyright 2017 Calico LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
78bd6bd68ba25fdd1957493c1919062bc1a8753a2736e4e86df57743c3c56a6c | Python | 4,308 | 120 | import sys
import cebra
import os
import tempfile
import torch
import pandas as pd
import numpy as np
import pickle as pkl
import matplotlib
import cebra.models
import cebra.models
import cebra.data
from cebra.models.model import _OffsetModel, ConvolutionalModelMixin
from torch import nn
from scipy import stats
from ce... |
68dd362657c0edc29616e8f883449208d14b2b4756d1605022ef086489f8b4ae | Python | 4,310 | 116 | # encoding=utf-8
from __future__ import absolute_import
import os
import jieba
import jieba.posseg
from operator import itemgetter
_get_module_path = lambda path: os.path.normpath(os.path.join(os.getcwd(),
os.path.dirname(__file__), path))
_get_abs_path = jieba._get_abs... |
861d71627bb0b13437798d447cf252181b5e1758ca2f443740959ef10dc2ba08 | Python | 4,310 | 143 | # coding: utf-8
# (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 agre... |
921fe52bdc76350de868ad5945c9489dc6f4b008866724f7190d757026eeac89 | Python | 4,310 | 98 | import os
import shutil
import subprocess
import nibabel as nib
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import re
from nipype import Node, Workflow
from nipype.interfaces.utility import IdentityInterface, Merge
from nipype.interfaces.base import (CommandLine, traits, TraitedSpec,
... |
2aab5eb1a7177e1131a17a6a9f3b67bb1fc1816cb2eb3ba9e48df79c6b13aa03 | Python | 4,312 | 83 | #This program adds the two improper dihedrals in a cyclic peptide that were excluded during the process of creating a cyclic peptide topology with Gromacs according to lab protocol.
#To use this program, do: python --gro [.gro file] --ori [Topology_without_Imp.top] --out [Topology_with_imp.top]
#If not specified the pr... |
b651f1db1e7f0d131315784503aae95108bb87906979d300875219a4d22aa8b5 | Python | 4,312 | 108 | import keras.backend as K
import tensorflow as tf
class WL2Loss(object):
def __init__(self, target_value, n_labels, background_weight=1e-4, **kwargs):
self.target_value = target_value
self.n_labels = n_labels
self.background_weight = background_weight
def loss(self, gt, pred):
... |
7425b8647155393f69ca366183153638046c373cb76c1c6f33ebd0eff72a5d38 | Python | 4,313 | 153 | import os
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import pytest
pytest.importorskip("PySide6")
pytest.importorskip("pyFAI")
from PySide6.QtWidgets import QApplication
from musclex.CalibrationSettings.CalibrationSettings import (
CUSTOM_MAR_165_2X2,
CalibrationSettings,
_find_mar_165_base_... |
5e441bb5f32b4b369c97c5ae3beab8ddd5882c9e6677a5d6cbfaf6a587740a98 | Python | 4,314 | 117 | import numpy as np
from sklearn.preprocessing import LabelEncoder
from joblib import Parallel, delayed
from sklearn.model_selection import train_test_split
from sklearn.metrics import f1_score
from xgboost import XGBClassifier
from tqdm import tqdm
import os
import pickle
from pstimutils import PertStimDataS... |
dbd81d93163f68d4f3288c20d62706263512c8f22296e7746ba4a7fc088dff7f | Python | 4,314 | 149 | """Example script for training DIVE on HMM simulated data.
- Should achieve a dice score of ~0.99.
"""
print("Importing packages")
import os
import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from osl_dynamics import data, simulation
from osl_dynamics.inference import metrics, m... |
0417d852176883edc24136b732058211acfcefdb0d9c912441817f4cdb2aa763 | Python | 4,315 | 112 | import os
import os.path as osp
import shutil
from ogb.utils import smiles2graph
from ogb.utils.torch_util import replace_numpy_with_torchtensor
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
from torch_geometric.data impor... |
0f16c20b16a7515b344d99c4d5a1dce3f1601ec4e2c07b774047cb3ce7b46ea6 | Python | 4,315 | 124 | import numpy as np
from brainCT.train_utils.data_loader import BrainDataset, SimpleBrainDataset
from prettytable import PrettyTable
from monai.data import DataLoader
from monai.transforms import (
Compose,
ToTensord,
ScaleIntensityd,
)
def get_tabular():
def get_xy(im):
inds = np.where(im == ... |
bb29ec4351b43c181e32a12350c70f3858d7be5d7ef862458a462fa9679fb504 | Python | 4,315 | 123 | # Code (c) by Paula T. Kuokkanen
#
# Code is licensed under a
# Creative Commons Attribution 4.0 International License.
#
# You should have received a copy of the license along with this
# work. If not, see <https://creativecommons.org/licenses/by/4.0/>.
#
# Code for figures 6-9 in the manuscript 'Inhibitory inputs t... |
098f66831845208588be088a07b5541e0e9f232f4bb289e17af5103de56e250e | Python | 4,316 | 129 | from __future__ import annotations
import pytest
from chemgraph.models.alcf_endpoints import _normalize_alcf_model, load_alcf_model
from chemgraph.models.supported_models import (
ALCF_DEFAULT_BASE_URL,
ALCF_METIS_BASE_URL,
ALCF_MINERVA_BASE_URL,
supported_alcf_metis_models,
supported_alcf_minerva... |
8281de63634fe37b23e8063aef36185d95650db58a6a2d55a7e15c565a112300 | Python | 4,316 | 123 | import os
import argschema as ags
import cloudfiles
import numpy as np
import pandas as pd
from skeleton_keys import cloudfields
from skeleton_keys.io import (fix_local_cloudpath, load_default_layer_template,
load_swc_as_dataframe, read_bytes,
read_json_file... |
8d0de8d4d8998bc9a10ede31e0a7936e3537d4b5b48c518f3b4cca3c32f9eb55 | Python | 4,316 | 114 | #############################################################################
# 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... |
bbf4c43e5d28b5c497eeab17835f9a169c2eb277cc857ce67e538381a01d975c | Python | 4,317 | 145 | """
lr_f.py
-----------------------
This script trains a simple **Linear Regression (LR)** model as a baseline
for genotype–phenotype prediction tasks.
It supports different datasets such as:
- "harry"
- "elife"
- "protein_inter"
The LR model provides a benchmark for evaluating the performance of
more co... |
117516381b6fc7ade8248b89a7f5019591d4d56cffa267fe67664a84a58b9939 | Python | 4,318 | 115 | #remember that need to down sample to equal instance
from gensim.models.keyedvectors import KeyedVectors
import argparse
import random
import numpy as np
from sklearn import linear_model ... |
68599cde5cec228891ce822e310c99207a231b3ad120286480864dacab82eb46 | Python | 4,319 | 142 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
c7f0be690a9ad784f9f103a384823b70b8e449ed73ae4130fdf9c445fe8fd048 | Python | 4,320 | 100 | #! /usr/bin/env python
"""Step two of the pipeline for surface morphometrics
Take a VTP style mesh generatead through the screen and perform curvature analysis using AVV.
Citation: Barad BA, Medina M et al. Quantifying organellar ultrastructure in cryo-electron tomography using a surface morphometrics pipeline. J Cell... |
0c43e4dd77312bc48c59d5ef6a0a71f8219f5a09e91553283e77c6870faa3b55 | Python | 4,321 | 129 | #!/usr/bin/python
#
## @file
#
# This file contains hardware classes that interface a
# Gooch and Housego AOTF to HAL.
#
# Hazen 06/14
#
import storm_control.sc_hardware.baseClasses.illuminationHardware as illuminationHardware
import storm_control.sc_hardware.goochAndHousego.AOTF as AOTF
## GoochHousegoAOTF
#
# Gooc... |
fe19091dbb43a2168dbbc539b6b94ee3c4ec952eeaf77a69483d0375d9499c74 | Python | 4,321 | 111 | """Package the Triple-N (Li et al. 2026) macaque Neuropixels static assembly + stimulus
set for Brain-Score S3 storage.
Source artifacts (built + validated locally, see tasks/todo.md):
/Volumes/Hagibis/triple-n/build/Li2026_static_assembly.nc presentation x neuroid x time_bin
/Volumes/Hagibis/triple-n/build/Li20... |
7f659c850f772b791ceb9fbb1f2bd21ef82d63f69e5cbff4324047ade053e56f | Python | 4,322 | 203 | import re
def get_user_id(user):
return user['id']
def get_username(user):
return user['username']
def get_screen_name(user):
return user['name']
def has_description(user):
des = user['description']
if des is None:
return False
else:
return True
def has_location(user):
... |
d79fcf83abfa84aa52792c751845569468eb68572a5ef5e2e35fc0b552ec7d84 | Python | 4,323 | 149 | import unittest
import pandas as pd
import numpy as np
from pandas.testing import assert_series_equal
from numpy.testing import assert_array_equal
from heig.herigc import CommonSNPs
class toy_GWAS:
def __init__(self, snpinfo):
self.snpinfo = snpinfo
class toy_LDmatrix:
def __init__(self, ldinfo):
... |
672be892c93d16b2e8e94fc626db9e7193c5706f9bde9e523dfa6d457beb2f07 | Python | 4,325 | 106 | """Tests for xyz2ply.xyz_to_ply (the Screened Poisson meshing step; needs pymeshlab)."""
import os
import tempfile
import numpy as np
import pytest
pytest.importorskip("pymeshlab", reason="pymeshlab is conda-only and not installed in CI")
from surface_morphometrics import xyz2ply # noqa: E402 (after the skip guard... |
7e8fdadf281cf5a4a18bea601d9d1da217116f50b609be22f8090e2fd4140893 | Python | 4,325 | 88 | import torch
import train
from models import PartialDeepSeaModel
import numpy as np
import time
def compute_one_side(data, edges, model: PartialDeepSeaModel, feature_size, f_mat, rc_mat, evaluation=False, level=3):
def get_counts(x_in, count_mat):
'''curr_outputs = model.get_conv_activations(x, level).da... |
a8662c28d4fd5056852d16cfece0f58e3da87ecbacf91d474a3dbff7b7e8aa74 | Python | 4,325 | 149 | """
Shared model-function backbone used by all variants.
Each variant module calls ``build_model_functions(gaussian_eval, voigt_eval)``
which returns a ``(layerlineModel, layerlineModelGMM)`` pair with the
provided leaf implementations closed over. This avoids duplicating the
loop / dispatch logic while keeping each ... |
af42c923e5026120d9ac401e8fc94dd8e7832710447b2f6d03a14187cb99c87e | Python | 4,325 | 116 | import os
import pkgutil
from copy import deepcopy
from torch import nn as nn
from timm.layers import Conv2dSame, BatchNormAct2d, Linear
__all__ = ['extract_layer', 'set_layer', 'adapt_model_from_string', 'adapt_model_from_file']
def extract_layer(model, layer):
layer = layer.split('.')
module = model
... |
cd329906c5d47e7886c453622f0a05b97543ecc1a20a76689a0bec9d8b80c349 | Python | 4,325 | 119 | from abc import abstractmethod
import torch, torch.optim, torch.nn as nn
import pytorch_lightning as pl
import torchmetrics
__all__ = ['LineageClassifierDeep', 'LineageClassifierLogistic']
class LineageClassifierNN(pl.LightningModule):
def __init__(self):
super().__init__()
def configure_optimizers(self):
opti... |
f843eb9e40ca321bad104c2416d91f62dc400f1644b1cba8ce219aa622761ec6 | Python | 4,325 | 115 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Patrick Lenz
#
# 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 Licen... |
4c8b3a21143f19f97b96a170f44cc9a3d0ef4dcac9936e6613523569e0aa3d90 | Python | 4,326 | 93 | '''Merge results of analysis_FeaturePrediction.py'''
from __future__ import print_function
import os
import pickle
import numpy as np
import pandas as pd
import bdpy
from bdpy.stats import corrcoef
import god_config as config
# Main #################################################################
def main():
... |
a0464bece9f737c79bda807a30745f68beb418475da5abfc42c4879dc2313705 | Python | 4,327 | 121 | from typing import Any, List
import torch
from pytorch_lightning import LightningModule
from torchmetrics import MaxMetric
from torchmetrics.classification.accuracy import Accuracy
from {{cookiecutter.project_slug}}.models.components.simple_dense_net import SimpleDenseNet
class MNISTLitModule(LightningModule):
"... |
194d2a74a17c87c50aca4c5efd4810aeaad30785b3d49c8558e2be23cd53890c | Python | 4,328 | 123 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.signals import post_delete, post_save, pre_save
from django.dispatch import receiver
from cvat.apps.access_tokens.models import AccessToken
from cvat.apps.engine.models impo... |
57b70f5cd12c57d61d8c5d5da2018ca9d8e2136c63495d787810d2edea619e07 | Python | 4,329 | 93 | from qtpy.QtWidgets import QWidget, QHBoxLayout, QLabel, QPushButton
from qtpy.QtGui import QColor
from qtpy.QtCore import Qt
class TreRow(QWidget):
def __init__(self, measurementPage):
super().__init__()
self.measurementPage = measurementPage
# create horizontal layout
self.row_hbo... |
44756ba4f25adde409a989519d8a7c37013ca48f2385eecf38fd4dce5a6ea44e | Python | 4,330 | 129 | import os
from copy import deepcopy
import numpy as np
import argparse
import innvestigate.utils as iutils
from keras.models import Model
from keras.preprocessing import image
from keras.utils import to_categorical
import keras
import tensorflow as tf
from numpy import average, dot, linalg
from utils import *
from lrp ... |
1256c3f9d6924419f8087f739689b7711e9f50e8a52e84aee50ea048fe52b00b | Python | 4,331 | 93 | from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QPushButton
from PyQt5.QtGui import QColor
from PyQt5.QtCore import Qt
class TreRow(QWidget):
def __init__(self, measurementPage):
super().__init__()
self.measurementPage = measurementPage
# create horizontal layout
self.row_... |
3ea2eef843dd933560475d6caadb6b658297e17aee1e846294646b250d552b70 | Python | 4,331 | 114 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import inspect
from functools import wraps
from typing import Callable, TypeVar, Union
import torch
import torch.nn as nn
import torch.utils.checkpoint as checkpoint
from torch.utils._pytree import tree_map_only
# Type variables for better type... |
053745ce30dca719fe843220b50ec3bdc77b4cfdcf747b2755741ddd88d85990 | Python | 4,332 | 132 | import json
import pathlib
from typing import Dict, Sequence
from mergedeep import merge
from napari.utils.notifications import show_info
def load_params(input_path: pathlib.Path) -> Dict:
"""
Load the `params.json` file from the specified input path.
Parameters:
input_path (pathlib.Path): Path t... |
bd167d7a58dccec0cf5fe4810e219c9b539a4a75d1983333f5d678a9f4092920 | Python | 4,334 | 121 | import numpy as np
from neuron_morphology.transforms.affine_transform import (
rotation_from_angle, affine_from_transform_translation, affine_from_translation, AffineTransform)
def upright_corrected_morph(
morphology,
upright_angle,
slice_angle,
flip_status,
shrink_factor):
""" Rotate morp... |
5aa8640479d8e686b0aabdd9ac4339e62b3d5e0b2c133a9cbbc342d7e21fb656 | Python | 4,335 | 109 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
import datetime
import shutil
# external inputs
from nipype.interfaces.freesurfer import MRIsExpand, MRIsInflate, Curvature
def shift_white(path, sub, w_shift=-0.5):
"""Shift white.
This function shifts the white matter surface inwards (if ... |
11fa5b809f13518ebdebf24b33915c6593455c0276771811664559ff1d535422 | Python | 4,336 | 100 | from train_gtex import *
from datasets import CustomDataModule, CustomDistributedSampler
def load_trainer_multi_gpu(config):
metric_logger,early_stopper,checkpoint_callback = load_callbacks(config)
trainer = Trainer(
max_epochs = config.max_epochs,
precision = config.precision,
accumula... |
51883b0d6aee349d90b510893ea2accc7cd5fc31e7249018300d38ce4bef740d | Python | 4,336 | 140 | # -*- coding: utf-8 -*-
"""Gradient nonlinearity correction."""
import os
import shutil as sh
import nibabel as nb
import numpy as np
from .. import execute_command
from ..io.filename import get_filename
from ..registration.cmap import generate_coordinate_mapping
from ..registration.fsl import apply_warp, combine_wa... |
3d7347b47cd7a9dea5013aa186f2e059f437d7bf758fc8c205684f5326f7d593 | Python | 4,337 | 110 | """ROC curves for ep10 linear probe — per task and per model."""
import json
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
from pathlib import Path
PREDS = Path("results/probe_full_ep10/predictions.json")
OUT = Path("results/probe_full_ep10")
p = json.load(open(PREDS)... |
7e7f722677a4244db11ad57de94d100731e72a47435a9eedca2bd989e7a02659 | Python | 4,338 | 183 | #!/usr/bin/env python3
import struct
import array
import sys
import subprocess
import signal
import os
import numpy as np
from optparse import OptionParser
import gzip
###############################################################################
# Helper function to run commands, handle return values and print to... |
25d21c79f0d8e7693c238e5011cc17cad5a3fe273f315d4b84b6500ef24eb183 | Python | 4,342 | 129 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute a density map for each connection from a hdf5 file.
Typically use after scil_tractogram_segment_connections_from_labels in
order to obtain the average density map of each connection to allow the use
of --similarity in scil_connectivity_compute_matrices.
This s... |
66a491c40af2397412bd055cbc38e849632d2d88f5772c3a7ae45ec56701bb94 | Python | 4,343 | 139 | from mpi4py import MPI
# import mpi4py
# mpiexec -n 3 -f machinefile_mp python3 main_mpi.py
from zigzag.classes.stages import *
import argparse
import re
# Parse the workload and accelerator arguments
parser = argparse.ArgumentParser(description="Setup zigzag-v2 inputs")
parser.add_argument('--model', metavar='path',... |
6ec4a45cebb0780808acdce7e37b0dd9478786528ccf86bf3ba5db70f4664495 | Python | 4,344 | 133 | import argparse
import json
import os
import nibabel as nib
from src.wrappers.OsipiBase import OsipiBase
import numpy as np
from tqdm import tqdm
def read_nifti_file(input_file):
"""
For reading the 4d nifti image
"""
nifti_img = nib.load(input_file)
return nifti_img.get_fdata(), nifti_img.header
... |
26032f3bb94efd6b05dbc17cc133a3690793b84fa062c4ee2afc210c0314601f | Python | 4,345 | 125 | import pandas as pd
import zipfile
import os
from joblib import Parallel, delayed
from scipy._lib._bunch import _make_tuple_bunch
import numpy as np
import math
from scipy.stats import weightedtau
import gc
SignificanceResult = _make_tuple_bunch('SignificanceResult', ['statistic', 'pvalue'], [])
class MakeDirs(obje... |
43a83057f497e4b0e4b1bd3e892d223eb6019a58558b566f77b12b4ba352fc07 | Python | 4,345 | 127 | import numpy as np
import pytest
from brainscore_vision import load_stimulus_set, load_dataset
@pytest.mark.private_access
@pytest.mark.parametrize('assembly_identifier', [
'Lonnqvist2024_inlab-instructions',
'Lonnqvist2024_inlab-no-instructions',
'Lonnqvist2024_online-no-instructions'
])
def test_existe... |
b65569587d37390d33ef60d65363ed3003bb8f0e9f2b5dd821e057f3ee8b9bce | Python | 4,347 | 123 | """Converts the CIFAR-10 dataset into the correct HDF5 format that is required by ViRelAy."""
# pylint: disable=duplicate-code
import argparse
import json
import typing
import h5py
import numpy
from torchvision.datasets import CIFAR10
def create_dataset(dataset_file_path: str, samples_shape: tuple[int, ...], numbe... |
b43d2392bd162b865cc20a801c5a775ed91a7045fea4d2b082f9106fd1a1d8dc | Python | 4,348 | 113 | from utils import load_segmentation
import numpy as np
import nibabel as nib
import glob
import re
def evaluate(file_gt, predictions, object=None):
# Handle case of softmax output
if len(predictions.shape) == 4:
predictions = np.argmax(predictions, axis=-1)
# Check predictions for type and dimen... |
2190c61a65382a398f7e011e04820650172e9f5fa5d33d827cfeac08e2145738 | Python | 4,349 | 114 | """
This script is used to modify the task variable of the data.
"""
import pathlib
import pandas as pd
from utils.LoadSession import findrootdir
from ast import literal_eval
import numpy as np
def load_bhv(date):
root_dir = findrootdir()
bhv_path = (
pathlib.Path(root_dir)
/ "social_O_L"
... |
6bdb118e5006bead221dceed3ab3a3c76d3925276503dab4590a3422f799daaf | Python | 4,350 | 120 | """Optimized Evolutionary Algorithm - AnalogNAS."""
import random
from analogainas.search_spaces.sample import random_sample
class EAOptimizer:
"""
Evolutionary Algorithm with optimized mutations and robustness constraint.
The NAS problem is cast to:
Max Acc(arch)
s.t nb_param... |
ea9c72cd31a9595ab82a0f1e117eb18abc415121ff84ab9d3189f2506de86c7a | Python | 4,352 | 155 | # FetMRQC_SR: Quality control for fetal brain MRI
#
# Copyright 2025 Medical Image Analysis Laboratory (MIAL)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... |
06591dd0ac063f9d1cd37aa00cd3575e4a563688a9ed5b6623f59a56daa201b8 | Python | 4,353 | 77 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# *************************************************************************** #
# Copyright © 2022, UChicago Argonne, LLC #
# All Rights Reserved #
# Softwar... |
18538d72d86e43084e6669e39c0829d229e96efd6d4f1f3ab7dd3f1709463a00 | Python | 4,355 | 127 | """Compute the fMRI response distance (in MDS space) between the different image
classes.
Parameters
----------
subjects : list
List of the used NSD subjects.
zscore : int
Whether to z-score [1] or not [0] the fMRI responses of each vertex across
the trials of each session.
ncsnr_threshold : float
Lower bound ncsn... |
56f799f148f7ec189077acd4a0f6464ae77b27e883ea0da72d80d87ba7d07b65 | Python | 4,355 | 112 | # TODO add typing and docs
from typing import Optional
import contextlib
import os
from picsl_greedy import Greedy3D
from brainles_preprocessing.registration.registrator import Registrator
from brainles_preprocessing.utils import check_and_add_suffix
class GreedyRegistrator(Registrator):
def __init__(
s... |
9853acf19974f93ec5dde966edee131b04025f64bc958c836df53867e8ec9918 | Python | 4,357 | 148 | import os
import numpy as np
import pandas as pd
import datetime as dt
import sklearn.metrics as mt
from pathlib import Path
from tqdm import tqdm
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from s... |
63b209f901a1f3fd3df84701b830e09332ce5287bb3710debaf833c24335e128 | Python | 4,358 | 131 | import brainpy as bp
import brainpy.math as bm
import numpy as np
import matplotlib.pyplot as plt
from cann import CANN1D
import scipy
#set default ramndom seed for reproducibility
np.random.seed(0)
#set backend to cpu
bm.set_platform('cpu')
#build and run the network
cann = CANN1D(tau=3, tau_v=144., num=128, mbar=153... |
c0013f51995a5cf591cd75b93e8b6c00f33083b7a2abe17db939f1300d8e7803 | Python | 4,358 | 143 | # This file is part of Mooney computational modeling project.
#
# Mooney computational modeling project is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
f55aec74490c671815fe4ab0215aa610d9a35111e394f0fffe1265c8a4787606 | Python | 4,358 | 122 | # 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... |
118e335111858c8b78a580e2c7700c1dca16b71adeed2f56ace0ac2f815529e3 | Python | 4,359 | 119 | from brainvoice.configuration.configuration import Configuration
from brainvoice.visualization import plot_spectrogram_on_axis, save_borderless, gen_spectrogram_cmap
import numpy as np
import os
import torch
import argparse
import shutil
import re
import glob
import matplotlib.pyplot as plt
from torch.autog... |
d38dbdfdfe17495f4db32b49379094b1a164700fc406045ae8c4eeada4527e50 | Python | 4,359 | 121 | import mne
import numpy as np
import rsatoolbox
import pandas as pd
import copy
import scipy.stats
import matplotlib.pyplot as plt
from joblib import Parallel, delayed
import matplotlib
font = {'family' : 'calibri', 'size' : 9}
plt.rcParams['svg.fonttype'] = 'none'
matplotlib.rc('font', **font)
def pretty_plot(ax... |
361d32c6102072f604025eb11fcdce4a9a0d53eb2eda94e3d60c1e7755937efd | Python | 4,361 | 89 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import torch
import torch.nn.functional as F
from ultralytics.engine.predictor import BasePredictor
from ultralytics.engine.results import Results
from ultralytics.utils import DEFAULT_CFG, ops
class SemanticSegm... |
fb9bb9fc67509d3d0be2830e00a1c7a8bf922008bed2bd0a4d285ce45371d567 | Python | 4,361 | 118 | """
Adopted from AllenNLP:
https://github.com/allenai/allennlp/blob/v0.7.0/allennlp/models/archival.py
Helper functions for archiving models and restoring archived models.
"""
from typing import NamedTuple, Dict, Any
import json
import logging
import os
import tempfile
import tarfile
import shutil
from stog.utils... |
fc6268b515733908c773bda9ae9cf6eb1e92ebcccbf3a3656aaf025f165e3417 | Python | 4,361 | 107 |
import torch
import numpy as np
from scipy.stats import pearsonr
from scipy.spatial.distance import cosine, euclidean
from scipy.linalg import eigh
from dlim.dataset import Data_model
class spectral_init():
"""
Utility class for spectral initialization of gene embeddings.
This class provides methods t... |
46d6605189cfe4dafe7504498a59108c03fac44808078557bd7791ed0fac37a8 | Python | 4,363 | 142 | """FastSurfer-organized dataset for SFCN inference."""
from __future__ import annotations
import logging
import os
from typing import Any, Callable
import numpy as np
import pandas as pd
import tensorflow as tf
from numpy.typing import ArrayLike
from pyment.loaders.mgh import load_mgh
from .dataset import Dataset
... |
78cfa2e5dea22bf8dc9098ab3879d0b788ef5733e3fdfe3640eb35673c7bb55f | Python | 4,363 | 142 | import glob
import logging
import os
import warnings
import h5py
import numpy as np
import pandas as pd
import plotly.express as px
import torch
from sklearn.metrics import accuracy_score, auc, f1_score, precision_score, recall_score, roc_curve
from sklearn.model_selection import train_test_split, KFold
from deeprank... |
c85147b3f976d5cff10aa0e53ccce1476b3a70a69b1c4ea923edc27109185fe6 | Python | 4,363 | 125 | '''
Script to preprocess audio data in several ways:
In any case, this will compute gammatone spectro-
grams over all audio data (at a desired sampling
frequency `fs`). Depending on the method, it will
then either compute the speech envelope or simply
the full spectrum (`method`).
Note that this relies on `gammatone` ... |
dca29409ff5f287f12c39019d500587c837e54c5b3b7c16c531612eda5fc4225 | Python | 4,363 | 116 | import unittest
import logging
import numpy as np
import scipy.stats as stats
from batchglm.api.models.numpy.glm_nb import Simulator
import diffxpy.api as de
class TestSingleExternalLibs(unittest.TestCase):
def _prepare_data(self, n_cells: int = 2000, n_genes: int = 100):
"""
:param n_cells: Nu... |
f6d2bab014eff7b67247e4900cda42ee835cd9cad26f347722eea6d90e3aea8c | Python | 4,363 | 115 | import nibabel as nib
import numpy as np
from scipy import ndimage
import sys
import csv
import os
import glob
def count_nonzero_voxels_in_atlas(atlas_data, image_path):
# Load the second NIfTI image
image_img = nib.load(image_path)
image_data = image_img.get_fdata()
# Extract connected components for... |
fd6a0cd89b8b9d58e3e85e9c4b57df14f12a767541d9aef316e58df285a08c85 | Python | 4,363 | 97 | import os
from pathlib import Path
import pickle
import numpy as np
import xarray as xr
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
from brainscore_core.supported_data_standards.brainio... |
b47ad7cb5a7cd5d4b2b234347411427475e5d9d013cc7d4fc9530448c4f94a71 | Python | 4,366 | 95 | from torch_geometric.nn import GCNConv
from sklearn.neighbors import kneighbors_graph
# define the number of neighbors (six for visium)
n_neighbors = 6
# define the simcomen class
class simcomen(torch.nn.Module):
# define initialization function
def __init__(self, input_dim, output_dim, n_neighbors, seed=0):
... |
42aaafc2ea69826efa3eabf90b8f6d433af96faa19901afc30699d17dd0ecce3 | Python | 4,367 | 139 | from typing import Tuple, List, Optional
from torch import Tensor
def get_total_num_crops(
image_shape: Tensor, crop_size: List[int], overlap: Optional[Tuple[int]]
) -> int:
total = 0
for i, size in enumerate(crop_size):
crop_size[i] = (
crop_size[i] if crop_size[i] < image_shape[i +... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.