sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
76022e5ed085ba4b2d6346fe227c69514ab3d1ff146a4671f33ce5bea40346d7 | Python | 5,198 | 157 | """Downsample the image features with PCA, for all NSD-core images seen by a
subject.
Parameters
----------
subject : int
Number of the used NSD subject.
model : str
Name of deep neural network model used to extract the image features.
Available options are 'alexnet', 'resnet50', 'moco', and 'vit_b_32'.
layer : str... |
97687f7559c7b6ac980c0b31d116757b243031bac03bea77e04048937c9c517d | Python | 5,200 | 177 | #!/usr/bin/env python
'''
This file randomly assigns weights for each transcript, and gets the transcript statistics by a given transcript annotation file (BED File).
USAGE
genexplvprofile.py {OPTIONS} <BED-File|->
OPTIONS
-h/--help\tPrint this message
-e/--lognormal\tmu,sigma Specify the mean and variance of... |
4f4e723f2f920b663a97957e3e8a9c33a256a0d69123aea931daf7c3a8d5d6b5 | Python | 5,201 | 166 | from PUMI.engine import FuncPipeline, NestedNode as Node, QcPipeline
from PUMI.pipelines.multimodal.image_manipulation import vol2png, pick_volume
@FuncPipeline(inputspec_fields=['wm_mask', 'ventricle_mask'],
outputspec_fields=['out_file'])
def anat_noise_roi(wf, **kwargs):
"""
Creates an anato... |
86fee80a8c91d71ad6bf97bd5d8e1ce154f11413a43b0c6fd212b4c5864cec0e | Python | 5,202 | 129 | """
Numpy-native skeleton normalization for pretraining data loaders.
Replicates normalise_skeletons() from processing/normalization.py but operates
directly on (T, 17, 2) numpy arrays without requiring a pandas DataFrame.
Used by amass_loader, ntu_loader, fbx_loader, coco_loader, and the linear probe.
Normalization... |
1db9c959b2856944c713a1719b777d6531929e775b19b06cc4a7b0eeb0735061 | Python | 5,204 | 170 | import torch
import torch.nn.functional as F
from unicore.modules import softmax_dropout
def gen_attn_mask(mask, neg_inf):
assert neg_inf < -1e4
attn_mask = torch.zeros_like(mask)
attn_mask[mask == 0] = neg_inf
return attn_mask
def normal_softmax(a, mask, bias):
return F.softmax(a + mask + bias,... |
59f0b0213f6d7e0bf10fc1c0cf2a159ded47401c267ff767f5e32aabdccd3486 | Python | 5,204 | 124 | # copy dependencies from transformers/optimization.py
import math
import warnings
from typing import Callable, Iterable, Tuple, Union, List
import torch
from torch import nn
from torch.optim import Optimizer
class AdamW(Optimizer):
"""
Implements Adam algorithm with weight decay fix as introduced in [Decoupl... |
5683df8af584dd63bb91fbe30e320e607647d1e25f20d889f4a545d124ed4753 | Python | 5,205 | 147 | import os
import json
import ijson
import pandas as pd
import numpy as np
import argparse
from sklearn.cluster import KMeans, DBSCAN
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, roc_auc_score
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--dataset'... |
2b4930669f9f12a3a23942bcc3a9e9c20d8bcf1e4216baf93fb8a0eddc19ffef | Python | 5,206 | 158 | # Copyright (C) 2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from enum import StrEnum
from django.conf import settings
from rest_framework.exceptions import ValidationError
from cvat.apps.engine.models import Project
from cvat.apps.engine.permissions import ProjectPermi... |
0afca340ddad899a87078f29dfe1b2cc60ed6614def048b90222c5d7a157402d | Python | 5,208 | 175 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
c09a5a8b0dd19add24d10a2e719c2772e70a528b0c78b2263c8e0e01258566dc | Python | 5,208 | 152 | import warnings
from functools import partial
from pathlib import Path
from typing import Optional
import click
import numpy as np
import scipy
import skimage
import tqdm
from scipy.optimize import OptimizeWarning
from simple_mri import SimpleMRI, load_mri, save_mri
from gmri2fem.utils import mri_facemask, nan_filter... |
eb033c713643b60e06ab105a07cad085c7bde903c2e849a2341690490849eb09 | Python | 5,208 | 165 | import datetime
from pathlib import Path
from typing import Optional
ROOT_DIR = Path(__file__).resolve().parents[1]
FIREANTS_PYPROJECT = ROOT_DIR / "pyproject.toml"
FUSEDOPS_PYPROJECT = ROOT_DIR / "fused_ops" / "pyproject.toml"
CHANGELOG = ROOT_DIR / "CHANGELOG.md"
def read_text(path: Path) -> str:
return path.r... |
295b1298262c3d1e4082d2bb11fba1cf254217c2ec2c5c66944eef48761c1acb | Python | 5,209 | 153 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
import shutil as sh
# external inputs
import numpy as np
import nibabel as nb
from nipype.interfaces.fsl import ConvertWarp, Merge
from nipype.interfaces.fsl.maths import MeanImage
from nipype.interfaces.fsl.preprocess import ApplyWarp
# local inputs... |
d5de2ae5d607b0c4a3910059a3c7ca639505c906c7993d1ff80212458ff91334 | Python | 5,209 | 130 | import json
import numpy as np
import matplotlib.pyplot as plt
with open('results/tables/ablation_results.json', 'r') as f:
data = json.load(f)
results = data['results']
configs = [r['config'] for r in results]
rmse_values = [r['rmse_mV'] for r in results]
violations = [r['constraint_violation_%'] for r in resul... |
5f43ad654e98c9a66e1f8ebf7185c4178be023174e157c2c889f8cfa36c0e9b8 | Python | 5,210 | 179 | #####
# ogo_fe_pistoia_tabulate.py
#
# This script collects all the FE Pistoia results from the specified directory.
#
#####
#
# Andrew Michalski
# University of Calgary
# Biomedical Engineering Graduate Program
# September 6, 2019
# Modified to Py3: March 25, 2020
#####
script_version = 1.0
##
# Import the required ... |
858cf6cab51eba2faf8bc6b716aa09d740b62c36c8d02811718cdcda1175714f | Python | 5,210 | 139 | """Utilities to compute SCOS speckle contrast.
Credit: matlab code https://github.com/PeterSLee40/ML2-BuckleyLab/tree/master/SCOSand2Layer
as useful resource.
"""
import numpy as np
from scipy.interpolate import interp1d
from mc_analysis.fitting.correlation_metrics import get_cw_metrics
def compute_speckle_contras... |
d1ca0fab5fb536b2ec368ed5db45921da5047a3c8683d2601cfc474ec0eb2558 | Python | 5,210 | 128 | if __name__ == '__main__':
import argparse
from pathlib import Path
import logging
logging.basicConfig()
logger = logging.getLogger('trainer')
logger.setLevel(logging.INFO)
parser = argparse.ArgumentParser('bread.algo.lineage.nn.train', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argumen... |
c83641cadde9c94e2b9ba80aedebe9c494d73a92731d5a43f4d5fc762c1e791b | Python | 5,211 | 143 | """Time and size a full ephys run against the same run in express mode.
Run from the repo root::
uv run python python/benchmark_express.py --out /path/for/outputs
Runs the Test Pipeline dataset (``local/testBurstDetection``) through steps 1-4
twice — once producing every figure, once producing only the data plus... |
bd5d36f1a3c0e635a4715e95adc6be256cdaf4173f36f33191f8aec132a3fd98 | Python | 5,212 | 155 | """Local execution backend using ``concurrent.futures.ProcessPoolExecutor``.
Ideal for development, testing, and single-node runs where no HPC
workflow manager is needed. Requires zero external dependencies beyond
the Python standard library.
"""
from __future__ import annotations
import logging
import os
import su... |
fe44f47a29a5f06c71908789f575120a15bb653ce39e677b81dc19c0ca9b91dd | Python | 5,212 | 171 | #!/usr/bin/env python
"""
Generic Coherent Cube laser control (via RS-232)
Hazen 7/10
"""
import traceback
import storm_control.sc_hardware.serial.RS232 as RS232
class Cube(RS232.RS232):
"""
This class controls a Coherent cube laser using RS-232 communication.
"""
def __init__(self, **k... |
0d965dddf1a4a95f1161dddaa85c2f23833345a6660c84db42afdba5b01fe38f | Python | 5,213 | 125 | import argparse
import utils
import keras
from keras.models import Model
import tensorflow as tf
from os.path import join
import numpy as np
import gc
import yaml
from model_zoo import ResidualBind_heteroscedastic
'''
calculate standard deviation of ensemble predictions for train/test/val data
for ResidualBind models... |
40dc2e155c316c0e055b5e048637796c0d6e1be04e4ebe9a420afb759eee1ac7 | Python | 5,214 | 127 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CVPR2017 paper:Zhong Z, Zheng L, Cao D, et al. Re-ranking Person Re-identification with k-reciprocal Encoding[J]. 2017.
url:http://openaccess.thecvf.com/content_cvpr_2017/papers/Zhong_Re-Ranking_Person_Re-Identification_CVPR_2017_paper.pdf
Matlab version: https://githu... |
5835b645c7f3863190317394cc53722d37073b8c46388b308b85123619aab280 | Python | 5,215 | 121 | from nipype.interfaces import utility
from PUMI.engine import FuncPipeline, NestedNode as Node, QcPipeline
from PUMI.pipelines.multimodal.image_manipulation import timecourse2png
from PUMI.utils import get_indx, scrub_image, above_threshold
@QcPipeline(inputspec_fields=['scrubbed_image'],
outputspec_fiel... |
74197a59ff57df6127506bf3e47694de92117bb17dc195cfac7d2f204ce78839 | Python | 5,215 | 161 | """Tests for mcmlnet.training.data_loading.data_module and datasets modules."""
from unittest.mock import Mock, patch
import pytest
import torch
from mcmlnet.training.data_loading.data_module import DataModule
class TestDataModule:
"""Test cases for DataModule class."""
def setup_method(self) -> None:
... |
682467c7988d5b4e6938730fd43b282e196812fda8556cc09955d553d03ad030 | Python | 5,216 | 87 | from eval_enformer_gtex import *
from ism_performer import get_all_gtex_snps, tss_centered_sequences
torch.use_deterministic_algorithms(True)
def parse_tissues_to_train(tissues_to_train):
tissues_to_train = [str(tissue) for tissue in tissues_to_train.split(',')]
for tissue in tissues_to_train:
assert t... |
a592107feff8ef5b7a28d04f6ae86ca9c57ce15633150ff49cf234099ce38ba9 | Python | 5,216 | 161 | from functools import cached_property
from pathlib import Path
from typing import Literal
import numpy as np
import polars as pl
import seaborn as sns
from matplotlib.axes import Axes
from argclz import AbstractParser, argument
from argclz.dispatch import Dispatch, dispatch
from neuralib.plot import plot_figure
from ... |
ec69d49c1ddd513c40a06b88f8e02ff3e61e61a1d258dc8df21fab6fb2a381b3 | Python | 5,217 | 129 | #!/usr/bin/env python3
"""
Optuna TPE 超参数优化 — 分类模型(多组合记录版,修复 AUC 计算)
---------------------------------
功能:
1. 基于给定超参数在 10 折 StratifiedKFold 中训练分类模型,并记录平均 AUC。
2. 持续搜索,收集 **5** 组满足 AUC ≥ 阈值的超参数组合,并在每找到一组时立即保存到 JSON。
3. 最终生成包含 5 组配置的 JSON 文件。
用法:
$ python -m src.tuning.optuna_classification --n-trials 100 --threshold 0.9... |
018057bad3278e0810b583ec06a0d4e1d1bda186d84aaf7dff2427c25e0c6e9a | Python | 5,218 | 141 | import networkx as nx
import numpy as np
import pandas as pd
from networkx import Graph
from scipy.stats import t
from statsmodels.sandbox.stats.multicomp import multipletests
def correlation_matrix_to_network_graph(corr: pd.DataFrame) -> nx.Graph:
corr_graph = nx.from_numpy_array(corr.values)
corr_graph.remo... |
ada7ec8c35ec68c1097b179c43abe23f64301e2e9488c9e93668d87992177b47 | Python | 5,218 | 137 | import os
import numpy as np
import argparse
import subprocess
import psutil
import re
def kill_process_tree(pid, including_parent=True):
try:
parent = psutil.Process(pid)
children = parent.children(recursive=True)
for child in children:
child.kill()
psutil.wait_procs(... |
39fd54df11c5c3265ec7f37b4431a1c00ca47fb60db11374ba1f89dc0e294790 | Python | 5,220 | 135 | 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... |
00ce682ba18ff0d6e88a6a3090934afc0693a98a8424283334a504ba9430a701 | Python | 5,221 | 90 | import numpy as np
import pandas as pd
import os
from tqdm import tqdm
def load_brain_data(sub_name, rois, contrast_name, stimulus_category='train', root_path='data/BrainVoice_16-11-23'):
beta_estimates = list()
loaded_rois = list()
if type(rois) == str:
rois = [rois]
for roi in roi... |
b6434cccd03eb1f733e0bff1eb6482207de4ce0bbadeca4f0f395b01a63f6888 | Python | 5,222 | 139 | import numpy as np
from src import utils
import tensorflow as tf
from sklearn.metrics import f1_score, accuracy_score, confusion_matrix, precision_score, roc_auc_score, recall_score
def convert_logits_to_probs(logits, y_true):
"""
Convert logits to probabilities and true predictions.
"""
logits = tf.s... |
75d3f65e0ab5bb83e369729a4a58fc20366d128dd89ba330cd6f364093875083 | Python | 5,223 | 141 | """single_agent_iri: single-agent LangGraph bound to ALCF IRI tools.
Same shape as graphs/graspa_agent.py -- one LLM node, one ToolNode,
route-tools edge. Two tool sets are shipped:
ALCF_IRI_FLAT_TOOLS (43 direct wrappers, default -- higher judge score)
ALCF_IRI_CATEGORY_TOOLS (7 category tools + discovery, s... |
f41bd75ea86bf1a35b2c7621346aa4e765e82ac6c07c6113987903558c820534 | Python | 5,226 | 102 | from nipype.interfaces.base import (CommandLine, CommandLineInputSpec, traits, TraitedSpec,
BaseInterface, BaseInterfaceInputSpec, File)
from nipype.interfaces.matlab import MatlabCommand
import re
import os
import shlex
import subprocess
from traits.api import Directory, Str, List, ... |
78672a541b5f97681d28023c1c79765df69cf5afc0e172ab1a3b661b620f0016 | Python | 5,227 | 114 | import subprocess
import os
import time
import numpy as np
import argparse
import tqdm
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Train many SATURN runs.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--run', help='run file path'... |
7add98685bb591ffa8e8483d5e9a871a9fc2aafebc0e77566c4f3c5491ce48f4 | Python | 5,227 | 145 | from typing import NamedTuple, Optional, Tuple
import torch
import torch.nn.functional as F
from torch import Tensor
from torch_geometric.utils import (
dense_to_sparse,
one_hot,
to_dense_adj,
to_scipy_sparse_matrix,
)
class UnpoolInfo(NamedTuple):
edge_index: Tensor
cluster: Tensor
batc... |
d423e8daf39ca00d43c614c76432f5229646e9f168d9a2abddeebaba279800a7 | Python | 5,227 | 152 | from typing import Any
import pytest
import torch
from eir import train
from eir.data_load.data_preparation_modules import imputation
from eir.setup.config import Configs
from eir.target_setup.target_label_setup import gather_all_ids_from_output_configs
from tests.setup_tests.fixtures_create_data import TestDataConfi... |
f173eb37ee4db1f1f3c5323f7899d824026e18476aa7f7141f296a06dfd8f727 | Python | 5,227 | 152 | from typing import Any
import pytest
import torch
from eir import train
from eir.data_load.data_preparation_modules import imputation
from eir.setup.config import Configs
from eir.target_setup.target_label_setup import gather_all_ids_from_output_configs
from tests.setup_tests.fixtures_create_data import TestDataConfi... |
a432260a604bc80fc5464d78af17ddfea70cfc9d93c91812683312993f3d1f9f | Python | 5,228 | 181 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import io
import json
from pathlib import Path
from typing import TYPE_CHECKING
from cvat_sdk.api_client import apis, models
from cvat_sdk.core.helpers import get_paginated_collection
from cvat_sdk.core.progress i... |
c54071ef190e52a2aeb19d7c1ab4537c2a91739370eff4cf5bc5d35fdb41c55c | Python | 5,228 | 177 | """
Embedding alignment using procrustes analysis.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import numpy as np
from sklearn.base import BaseEstimator
def procrustes(source, target, center=False, scale=False):
"""Align `source` to `target` using procrustes analysis.
... |
3dee52a03993dd95e23702ac1513b7a3bc6df260bb5bb123a1dd311860b079e7 | Python | 5,229 | 120 | import os
import skimage.io as skio
from skimage.morphology import label
from napari_simpleitk_image_processing import label_statistics
import pandas as pd
import time
import numpy as np
from tqdm import tqdm
from natsort import natsorted
import glob
import parameter_search.helper as helper
from postprocessor import r... |
7084e2da2ae5a25fbcbc36a17bce1ce33996a0c5c09d7008e605d75be82d4159 | Python | 5,229 | 150 | import json
from monty.json import MontyDecoder
from scipy.constants import h, c, e
import numpy as np
# suppose this is after raw fitting
from scipy.interpolate import interp1d
class InstanceData:
def __init__(self, chemsys, photon_e, log_q, sample_xrd, comp_dict):
self.chemsys = sorted(chemsys)
... |
0a96ca4819a0e6cb8bf6599777542e262d246eaee60c7253f1e9a4c9d68ec731 | Python | 5,230 | 119 | import numpy as np
def classBalancedSplit(patIdsPerPatient, outcomePerPatient, train_val_ratio):
patIds = list(dict.fromkeys(patIdsPerPatient))
patIdCount = np.asarray([patIdsPerPatient.count(f) for f in patIds])
idxs = np.arange(len(patIds))
np.random.shuffle(idxs)
patIdsShuffled = [patIds[i] for i in idxs]... |
5f7533df17f3a181e76f81bfa8991b90031ed7ae762a17a1e8bddcdb7d0ab7cd | Python | 5,230 | 137 | #############################################################################
# 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... |
03b52beeafa161de0079b3e6bd515c04bd2762822cac0ea0983db81aeae5850d | Python | 5,231 | 132 | import json
from matplotlib import colors as mcolors
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import matplotlib
from neuromaps.datasets import fetch_fslr
from neuromaps.images import construct_shape_gii, load_gifti, load_data
from neuromaps import images
from neuromaps.parce... |
17784050e8a2755ff459b914fbdb27dd27e90e19f88b6e374b73ab3260fd55c6 | Python | 5,231 | 128 | #!/usr/bin/env python3
"""
Runs benchmark sets specified in JSON files.
Example:
# Runs a test set specified in simple.json and
# record this run under id "test".
run.py -t simple.json -i test
# runs same test using another bowtie binaries from
# directory bowtie-devel.
run.py -t ... |
8810506ef03ffa19b6eb3a933d76b09fc5b45cf5ebd7689ec83b511a78817456 | Python | 5,231 | 108 | import numpy as np
import pytest
from brainscore_vision import benchmark_registry, load_benchmark
REGIONS = ['V1', 'V2', 'V4', 'IT']
METRICS = ['ridgecv', 'pls']
IDENTIFIERS = [f'Li2026.{r}-{m}' for r in REGIONS for m in METRICS]
@pytest.mark.parametrize('identifier', IDENTIFIERS)
def test_registered(identifier):
... |
13c3af4a70d959d7d1d8042272e0305b2ac8e2c7f64083dc5945f518206257f3 | Python | 5,232 | 99 | import numpy as np
import pytest
from pytest import approx
from sklearn.datasets import make_regression
from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly
from brainscore_vision import load_metric
from sklearn.linear_model import RidgeCV
from .metric import pls_regression, linear_... |
7686a8405328d198b09239a466aa20b30a37a7ac0046c9f41a83fde786f1bddb | Python | 5,232 | 136 | from __future__ import print_function, absolute_import
import argparse
import os.path as osp
import random
import numpy as np
import sys
import os
import torch
from torch.utils.data import DataLoader
import pandas as pd # Import pandas
print('We are here: ', os.getcwd())
sys.path.append('/home/lhuang37/repos/VisQ-Sear... |
eb6eb51fcfe6b4023962e6e0e7038dd57adcd0c905796e5ee9ae9e7bc1aa62f1 | Python | 5,232 | 23 | # 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/l... |
a1b4ad2cf1b1020183ebf482925ca52d6d7740941f2bd63182ccff03c8da5cf0 | Python | 5,233 | 99 | import torch
import argparse
import h5py
import numpy as np
import xgboost as xgb
from sklearn.externals import joblib
from chinn.models import PartialDeepSeaModel
from chinn import train
def get_args():
parser = argparse.ArgumentParser('Perform prediction using data generated by data_preparation.py')
parser.... |
48ffbed48697ac75a38c6807ef220f78ef386f9340c27eb9cc7c5a4e2775d7da | Python | 5,234 | 143 | import math
from typing import List, Optional, Union
import torch
from torch import Tensor
from torch_geometric.experimental import disable_dynamic_shapes
from torch_geometric.nn.aggr import Aggregation
from torch_geometric.nn.aggr.utils import MultiheadAttentionBlock
from torch_geometric.nn.encoding import Positiona... |
2b6c56741296e73cdfcc2071a52cabe9a55be54a21ddce2d0e21b558869d4088 | Python | 5,236 | 165 | import os
import os.path as op
import nibabel as nib
import numpy as np
from dipy.core.gradients import gradient_table, unique_bvals_magnitude
from dipy.reconst import csdeconv as csd
from dipy.reconst import shm
import AFQ.utils.models as ut
# Monkey patch fixed spherical harmonics for conda from
# DIPY dev:
from A... |
7c5b07a80fa266958cc4bfea24e65e6b5008f860802e67f2b5fab95ff5d08a4e | Python | 5,236 | 145 | import collections
from typing import Final
import numpy as np
import pandas as pd
import polars as pl
from argclz import AbstractParser, try_int_type, as_argument
from neuralib.plot import dotplot
from neuralib.plot import plot_figure
from neuralib.util.verbose import fprint
from rscvp.statistic._var import VIS_SFTF... |
a6540273b489f16ac43f976aca3a024e7de82cdb1129f1465dd5345f0a817d81 | Python | 5,236 | 147 | #!/usr/bin/env python
"""
Debugging decorators & logging.
Hazen 01/14
"""
import functools
import logging
import logging.handlers
from PyQt5 import QtCore
a_logger = False
logging_mutex = QtCore.QMutex()
def objectToString(a_object, a_name, a_attrs):
a_string = "<" + a_name
for a_attr in ... |
ef5a3e0ffeb9734520762ce6eaf4680879c96e29f904ec40c8d2ad4d19d76db6 | Python | 5,236 | 115 | #
# common/age_table.py
#
# Ages of a cohort from a participants / sessions table (CSV or TSV), for the steps that pick something age
# appropriate when the session name does not carry the age itself (a cohort with sessions named 'ses-V02', ...):
#
# dmrifiberprofile qc-registration --age-csv / --age-column... |
6f92dc78eea5d40524302d149b0d04955a1d7d83eb2da735557dd467f7aac8d0 | Python | 5,237 | 136 | import os
import os.path as osp
import sys
sys.path.insert(0, '../')
sys.path.insert(0, '../../')
sys.path.insert(0, '../../ogb')
import torch
import numpy as np
import pandas as pd
import scipy
import argparse
import networkx as nx
import torch_geometric.transforms as T
from pytorch_dataset.node_dataset import NodeVe... |
ebd72c7fc876f945ffb78e00badc8c3441941f3f19e2921d50b794dd13e18e85 | Python | 5,238 | 150 | # -*- coding: utf-8 -*-
# Author: Yadi Zhou
import sys
import random
import numpy as np
import numpy.ma as ma
import networkx as nx
"""
Examples:
python network_proximity.py example/Asthma.txt example/SARS2-DEG_lung.txt 1000 11096
python network_proximity.py DRUG example/SARS2-DEG.txt 1000 1024
"""
class DrugTarget... |
1b50f0a4d0bf4300a9cdeadf8747eb478a86846c35bddeed92c932e4aafdbd8c | Python | 5,240 | 142 | import torch
from torch import nn
from torch.nn import functional as F
class _NonLocalBlockND(nn.Module):
def __init__(self, in_channels, inter_channels=None, dimension=1, sub_sample=True, bn_layer=True):
"""
:param in_channels:
:param inter_channels:
:param dimension:
:par... |
c9358eae0f1e4d2d98aa19f928b3ca586cb1408d2d9b721b6b78ff8d188df5d9 | Python | 5,240 | 145 | # flake8: noqa
from abc import ABC, abstractmethod
import numpy as np
from .. import _timing
from ..utils import TrackEvalException
class _BaseMetric(ABC):
@abstractmethod
def __init__(self):
self.plottable = False
self.integer_fields = []
self.float_fields = []
self.array_l... |
3a56d1a6401a8241b1e325e3dbc27a3094bb9614b3ec0611f73ea81e55336fa6 | Python | 5,241 | 155 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# The basic I/O class for a Gibson peristaltic pump
# ----------------------------------------------------------------------------------------
# George Emanuel with modifications by Jeff Moffitt
# 11/16/15
# jef... |
a50eda86e1a628bb97965865f5c3d6b5e3ba578d6a7064a5b392da99b89455da | Python | 5,241 | 140 | import json
import ijson
from argparse import ArgumentParser
import os
import os.path as osp
from datetime import datetime
import numpy as np
import pandas as pd
from tqdm import tqdm
parser = ArgumentParser()
parser.add_argument('--dataset', type=str)
args = parser.parse_args()
dataset = args.dataset
assert dataset... |
11f9b9a6551431ce99a32c295ee5eaeb9a7deb1b211b18d9951caae688523353 | Python | 5,243 | 145 | import pytest
import numpy as np
import SimpleITK as sitk
import torch
import logging
from fireants.io.image import BatchedImages, Image
from fireants.io.imagemask import apply_mask_to_image, generate_image_mask_allones
from fireants.registration.greedy import GreedyRegistration
logger = logging.getLogger(__name__)
l... |
eceddc67180654f7bc5c9f2a4566bf37067c64dcef87311082388e3616381431 | Python | 5,243 | 114 | # Copyright (c) 2023 Khaleelulla Khan Nazeer, Anand Subramoney, Mark Schöne, David Kappel
#
# 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
#... |
2cfbeb8b56e2a9c61bb523bd6320a7ed3bd3bd3fbac6332b95e5ac167b043873 | Python | 5,246 | 157 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Performs an operation on a list of matrices. The supported operations are
listed below.
Some operations such as multiplication or addition accept float value as
parameters instead of matrices.
> scil_connectivity_math multiplication mat.npy 10 mult_10.npy
"""
import ... |
73c01fa187d767aa6b017b85f6732cc1b47ff10d6a4f69262dff17942784ef21 | Python | 5,247 | 163 | import os
import shutil
import subprocess
import pytest
from deepreg import log
logger = log.get(__name__)
def remove_files(name):
dir_name = os.path.join("demos", name)
# remove zip files
files = os.listdir(dir_name)
for file in files:
if file.endswith(".zip"):
os.remove(os.pa... |
d36b646b3a20e5d2afd17b6095ba6c9eb504aa6eb7b044a8fc17a8bccdcf25c3 | Python | 5,247 | 162 | import nibabel as nib
import numpy as np
# import scipy as sc
from scipy.ndimage import gaussian_filter
def smooth_image(dwiname, csfname=None, outname="dwism.nii", width=1.25, size=5):
"""Smooths a DWI dataset
Parameters
----------
dwiname : str
Filename of image to be smoothed
csfname ... |
eb46a209a38d346801819e1f016212b7cfbc95b457814de14bc0411c911ec726 | Python | 5,247 | 134 | # -*- coding: utf-8 -*-
"""
Converts point data into voxel image data for visulaization and analysis
"""
#:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City
#:license: GNU, see LICENSE.txt for details.
import numpy
import math
import pyximport;
pyximport.install(setup_args={"incl... |
dbf8556c20e7c841fd8ded079a9408a28728675363d6ea55d961df7d64a7363a | Python | 5,248 | 163 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
NAME = "server"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictReader(f)
f... |
c71b58f5dc71485590ab68122426b2e642b0ca257aa878db29e886d7bfbf9dbd | Python | 5,249 | 162 | """
This script converts the output from predict_DANNCE into a predescribed
structured data format, with meta data, that can be used easily by our
downstream analysis pipeline
Usage:
python path_to_file/makeStructuredDataNoMocap.py path_to_prediction_file path_to_skeleton_file path_to_label3d_file
"""
import numpy as... |
5c42d10aaac13d85f2794c0689654806df3200a9563a035e1acd43d685e160f9 | Python | 5,250 | 147 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Visualize 2-dimensional Bingham volume slice loaded from disk. The volume is
assumed to be saved from scil_fodf_to_bingham.
Given an image of Bingham coefficients, this script displays a slice in a
given orientation.
Note. The interactive visualization is not verifie... |
e32f95f3f3273b3352693b72169a285885427740611f51a1487b60e733f9e4a6 | Python | 5,251 | 133 | import copy
import pickle
import numpy as np
import pandas as pd
import fire
from joblib import Parallel, delayed
import sys
sys.path.insert(0,'..')
import contrasts
import nilearn
import nilearn.image
from nilearn.interfaces.bids import get_bids_files
def process_roi(roi, mask_name, mask, all_betas, nruns, tmaps,... |
87ac1a37f05f4b932f49aaa1bea0f9adba611a06678e8cde1084ed7a9e82fea4 | Python | 5,252 | 192 | """Miscellaneous support plots for nelpy
'palplot' Copyright (c) 2012-2016, Michael L. Waskom
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from .. import core
from . import utils # import plotting/utils
__all__ = ["palplot", "stripplot", "veva_scatter"]
def palplot(pal, size=1)... |
5de597e457afa38d1c05c94f1f17b2af1dcf082fa49da324177d7cd1133316df | Python | 5,253 | 127 | import copy
import math
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import scipy as sc
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
import sys, os
sys.path.append('../')
from characteristic_functions import charac... |
5e61cfbfe0b529c61e762c24f6f27517bd78028a5ee2b32a9c4d7a9fe58f6791 | Python | 5,254 | 171 | #!/usr/bin/env python3
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import argparse
import os.path as osp
import re
import sys
from glob import glob
from inflection import underscore
from ruamel.yaml import YAML
def collect_operations(schema):
endpoints = schema.get("paths", {})
op... |
65a56101099dd92da30028f55cf26ddc2595f0706ea9472e4cbcb67e05dd9791 | Python | 5,254 | 140 | # -*- coding: utf-8 -*-
import numpy as np
from scilpy.gradients.bvec_bval_tools import (
check_b0_threshold, check_shells_frf, identify_shells, is_normalized_bvecs,
flip_gradient_axis, find_flip_swap_from_order, normalize_bvecs,
round_bvals_to_shell, str_to_axis_index, swap_gradient_axis)
bvecs = np.asar... |
8c66d0aa7b47840b7073fff9efba65915510c61854ba6fcf4a8f3c070b7a3790 | Python | 5,254 | 155 | import itertools
from enum import Enum
from pathlib import Path
import click
import numpy as np
import scipy
import simple_mri as sm
import skimage
import tqdm
from simple_mri import SimpleMRI, assert_same_space, load_mri, save_mri
from gmri2fem.utils import apply_affine
class DTYPE(Enum):
BINARY = np.uint8
... |
8f5f84bc7d14cec4796773ec2b53cddbc178de1777b6503ea8264a384cd3ae24 | Python | 5,256 | 157 | # Source: https://github.com/neuraloperator/neuraloperator/blob/main/neuralop/data/transforms/normalizers.py
import torch
from .base_transforms import Transform
from deepcardio.neuralop_core.utils import count_tensor_params
class RangeNormalizer(Transform):
"""
RangeNormalizer scales data to a specified rang... |
9fb558623e576b2a859ac06a97f85c2c4c249e05b730c01d3b9535d20758d465 | Python | 5,257 | 136 | '''
I2H
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for I2H:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy and g... |
9b1e52a25e386b087c3a7eb8b7b689b2af2687cd8552424b3a09985f22c09f87 | Python | 5,259 | 131 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script can be used to remove loops in two types of streamline datasets:
- Whole brain: For this type, the script removes streamlines if they
make a loop with an angle of more than 360 degrees. It's possible to change
this angle with the --angle option. ... |
754c72c01fb7e10bd06b5d789cc5881cd77acaa5386a89a1bd75a9696f5ee022 | Python | 5,264 | 214 | import coolpuppy
from coolpuppy.lib import io
from matplotlib.colors import LogNorm, LinearSegmentedColormap
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from coolpuppy import plotpup
import pandas as pd
from matplotlib import gridspec
base_cmap = plt.get_cmap('RdBu_r')
colors = base_cmap(n... |
087da2d0010b3c7a74819b35813864fd0064e784dd2e8b9a8c7dc910e08d2fda | Python | 5,265 | 132 | """Recording truncation: keep the first or the last ``trunc_length`` seconds.
Run from the repo root::
uv run python python/test_truncation.py
``Params.trunc_rec`` / ``trunc_length`` were carried over from MATLAB and shown
on the Data tab, but no Python step ever read them — every run analysed the
whole recordin... |
fb9748c43d4cdca5b3d4fcf90ee3a1157ec2609bffa74cdc86f557b993b5e210 | Python | 5,265 | 165 | # -*- coding: utf-8 -*-
# @Author : LG
import os
from json import dump, load
import tqdm
from ISAT.formats.isat import ISAT
class LABELME(ISAT):
"""
LABELME format
Attributes:
keep_crowd (bool): keep the crowded objects
"""
def __init__(self):
self.keep_crowd = True
def ... |
7c2bafe614eed3224f5284cc678f470dd1deaf47f0b6dafd946dd6f8bf50d773 | Python | 5,266 | 132 | # 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 collections.abc import Collection
from typing import List
from unicore.optim.lr_scheduler imp... |
e9a6ef8771a1b2bc3e9d3a0f2bea3eb5a5c1d990326e9c9b3368ae2e209a9ed9 | Python | 5,266 | 209 | """
Utility functions for vtk wrappers.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import re
import string
from collections import defaultdict
import numpy as np
from vtk.util.vtkConstants import VTK_BIT, VTK_STRING
# VTK_UNICODE_STRING has been removed since VTK 9.2.
# See:... |
0044a27a524754e9b141c6712bdad5afa118db77e406c218f6a7118e01f05711 | Python | 5,267 | 134 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import warnings
from .compose import Compose
from ..builder import PIPELINES
@PIPELINES.register_module()
class MultiScaleFlipAug(object):
"""Test-time augmentation with multiple scales and flipping.
An example configuration is as followed:
.. ... |
504d5cc817e1ff22ed10c4006a1e8fa94e69ddd51ea056e5640690695c51382a | Python | 5,267 | 135 | # laminar_rs/reliability.py
from __future__ import annotations
from typing import Dict
import numpy as np
from scipy.signal import resample
import matplotlib.pyplot as plt
from tqdm import tqdm
from .config import LaminarConfig
from .io_utils import group_files_by_layer, group_files_by_run, load_and_concat_layer
def... |
dacf9760f2225ea2072d1e84c8aeb19dccecd77ebc1c95d81f80e207746b1a18 | Python | 5,267 | 137 | import glob
import os
import re
import string
import numpy as np
import pandas as pd
import xarray as xr
import mkgu
import mkgu.assemblies
from mkgu.knownfile import KnownFile as kf
def align_debug():
v2_base_path = "/braintree/data2/active/users/jjpr/mkgu_packaging/crcns/v2-1"
nc_files = sorted(glob.glob(o... |
0c54a8ae02662d349296c7384e2a4129972bf2261c4339f502477afa60e55bf1 | Python | 5,268 | 159 | # %%
# imports
import numpy as np
import torch
from torch import nn
# %%
# Instantiate class for translated Zhou et al 2022 fly ANN
# for ONE unit:
# the first dimension is (flattened) pixel weights
# comes in as 144, aka 12x12
# the second dimension is cardinal direction: R, L, U, D in that order
# If the RF for ea... |
c0484da2b75d4daa54d601733056cfe55f7c5c103953e9912c79d9e6a9cc1460 | Python | 5,268 | 258 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Generate template from 'MB-KCc-STn' files
"""
import os
import numpy as np
import glob
import mbflim.utils as ut
import mbflim.parameters as par
import mbflim.image.image_set_processing as setpro
import mbflim.visualization as vis
#%% Parameters
# Hemisphere
SEL_... |
21db6cade624825fbbc744276e03092e15a3291a12fd9fc551991f0192e0223a | Python | 5,272 | 86 | import os
from nipype.interfaces.base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec, BaseInterface, BaseInterfaceInputSpec, File)
from traits.api import Directory, Str, List, Bool, Enum, Int, Float, TraitError
from nipype.utils.filemanip import split_filename
from nipype.interfaces.base import isdefine... |
3fbf941de7b1eccad101760a0b6753e97bc84828ae112dcbff78ac600cef6d0e | Python | 5,272 | 125 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script is designed to compare and help visualize differences between two
tractograms. This can be especially useful in studies where multiple
tractograms from different algorithms or parameters need to be compared.
A similar script (scil_bundle_pairwise_compariso... |
f820d645817eb2f8a5e66aae0130a720ec0a5c9e509b5928c869d7ef9fd2adbf | Python | 5,272 | 74 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, MODEL_CONFIGS
model_registry["blur25_convnext_large_mlp:clip_laion2b_augreg_ft_in1k_384"] = lambda: ModelCommitment(
identifier="blur25_convnext_large_mlp:clip... |
a9fced1ea61ad33f8f122b7125c10ea14796b5ef71baed415e81ebd0278d1c9d | Python | 5,273 | 157 | # -*- coding: utf-8 -*-
"""
Correction methods for multiple comparison tests
"""
#:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City
#:license: GNU, see LICENSE.txt for details.
import numpy
import scipy
import scipy.interpolate
def correctPValues(pvalues, method = 'BH'... |
0618449f187b955daee864abcacba5b5617af2228d494d6a842dd933d9f93963 | Python | 5,274 | 171 | # Build dataset (join features and property)
# Imports
import numpy as np
import numpy.typing as npt
import pandas as pd
from sklearn.model_selection import train_test_split
# Shorthand for npt.NDArray[float]
F_ARR = npt.NDArray[float]
def remove_positive_energy_rows(
prop_file: str, feat_file: str, csym_file:... |
1f2f880ff7dfa4fc50d75eb848d5f376ac7f1c0607d0e7454afbea43acde6f33 | Python | 5,275 | 163 |
######################################################
## Template script to train a MOFA+ model in Python ##
######################################################
from mofapy2.run.entry_point import entry_point
import pandas as pd
import io
import requests # to download the online data
###############
## Load data... |
9e338a163faf312b36bbfbda7e69de47d13922ec3fb900f213a9e96b78f8bbce | Python | 5,275 | 124 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
"""Register a project- or organization-scoped webhook, send a test ping, and
verify the ping shows up in the webhook's recorded deliveries.
The server signs every delivery with the webhook secret (HMAC-SHA256 in the
'X-Signature-256' header), so the... |
f62f88bf649e40399d1ca2e53d9b5d26c2afea531ecbd5ddc0fd03327db3c124 | Python | 5,275 | 74 | from testsetclass import TestsetClass
class BUT14DIOL(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['B44', 'B43', 'B26', 'B19', 'B21', 'B17', 'B28', 'B10', 'B42', 'B45', 'B11', 'B16', 'B29', 'B20', 'B27', 'B18', 'B5', 'B2', 'B3', 'B4', 'B34', 'B33', 'B58', 'B60', 'B56', 'B51... |
a1be1b23e80982094e1f7c92f0c95c5bee0bc603a0369cf805e5180af6cabede | Python | 5,276 | 159 | import collections
import functools
import asyncio
import random
import bisect
import typing
import bisect
import grpc
import pdb
from ..qt import *
from ..config import *
from ..task_controller.util import create_task_with_exc_handling
from .. import thalamus_pb2
from .. import thalamus_pb2_grpc
from ..observable_it... |
fac22e24da6e442330ffec31295373f279f4e3b2bd8824af4adae78410acf056 | Python | 5,276 | 121 | # -*- coding: utf-8 -*-
"""Upload_Colab.ipynb
Automatically generated by Colab.
Original file is located at
https://colab.research.google.com/drive/172SUraO2MvenCudwPLg1CuWitZH_J-ws
"""
from google.colab import drive
drive.mount('/content/drive')
import io
import torch
import torch.nn.functional as F
from torch... |
f2f302e760eb5ea993b5110b22273a4e37a5ab14f2d9a6ae31c345329fa80369 | Python | 5,277 | 143 | import numpy as np
import sys
import argparse
import pickle
from scipy.io import savemat
from scipy import sparse
import nibabel as nib
def argument_parser(argv):
parser=argparse.ArgumentParser(description='Convert NeMo pairwise allref to chacovol mean')
parser.add_argument('-allref',action='store',dest='allre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.