sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
141c589f0c01a69ffe1a1d67c5627c03a10350f804950c7513710b747f2f4e5f
Python
3,624
106
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import textwrap from drf_spectacular.utils import OpenApiResponse, extend_schema, extend_schema_view from rest_framework import mixins, viewsets from rest_framework.decorators import action from rest_framework.permissions import SAFE_METHODS from re...
a645bd9a3a544216486d31b86e7dd712310689442107d950200093bfce295f5f
Python
3,624
105
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- import ...
e3973c9023ec43622a1e738c0e622bf95dab5f92b83ee2e303dce51bbf4a9498
Python
3,624
98
import numpy as np import pandas as pd import torch import unittest from causallib.contrib.hemm import HEMM from causallib.contrib.hemm.hemm_utilities import genSplits, returnIndices, getMeanandStd from causallib.contrib.hemm.hemm_outcome_models import genMLPModule, genLinearModule, BalancedNet from causallib.contrib....
ed7969f300257d813246312fc73d0a6255f3c39915584d12c7d35e9b28b92098
Python
3,624
107
import os from nilearn.maskers import NiftiMasker from nilearn.interfaces.fmriprep import load_confounds from nilearn.maskers import NiftiLabelsMasker import sys import numpy as np ex_sid = sys.argv[1] # 1. Resolve input files for the subject ID # Use environment variable to avoid personal paths; set BIDS_ROOT acco...
d7210182f07d7efdb95b2b9eb012940437b41865f83608ac2075b6e4d3019255
Python
3,625
96
import torch from batchgeneratorsv2.helpers.scalar_type import RandomScalar, sample_scalar from batchgeneratorsv2.transforms.base.basic_transform import ImageOnlyTransform import numpy as np class BGContrast(): def __init__(self, contrast_range): self.contrast_range = contrast_range def sample_contr...
df2c620ca10a55072d0b48f8e22ce11cecc80ec12e3367e91443b03694008f31
Python
3,625
100
from __future__ import annotations from collections.abc import Callable from typing import Final import PIL.Image import PIL.ImageEnhance import PIL.ImageStat from PySide6 import QtWidgets from PySide6.QtCore import Qt from PySide6.QtGui import QImage _NEUTRAL: Final = 100 class BrightnessContrastDialog(QtWidgets....
3ef57c6fb1bffa4145f52cf7d8df833dd834fb645f7046515fe20ac701f129c6
Python
3,626
75
import json import os import numpy as np import shutil import skimage.io as skio def generate_training_data(im_path, lbl_path, crop_save_path, patch_size, overlap=0.5,): im_save_path = os.path.join(crop_save_path, 'imagesTr') lbl_save_path = os.path.join(crop_save_path, 'labelsTr') im = skio.imread(im_path...
4b401b2c6ec779c8344581554efdefff585cd1bd092c79cc22a4408341381c94
Python
3,626
67
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'area_namer.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_area_namer(object): def setupUi(self, area_namer): area_...
e002d8e8cfa25e210e79595d0953f8ea2ea18a8e2fd1dcecd72084be7a7fdc79
Python
3,627
133
import numpy as np MU_A = 0.1 # in cm-1 MU_SP = 9 # in cm-1 N_IN = 1.4 WAVELENGTH = 1064 # in nm def dcs_g1( t: float, adb: float, mu_a: float = MU_A, # in cm-1 mu_sp: float = MU_SP, # in cm-1 rho: float = 1, # in cm n_in: float = N_IN, wavelength: float = WAVELENGTH, # in nm ): ...
44a889e621c3c3d15e0c864a8f808eb867857bd6058a695e8397b50794d08eb2
Python
3,629
86
import torch from tqdm import tqdm from dataset_tool import fast_merge import numpy as np from transformers import pipeline, T5Tokenizer, T5EncoderModel import os user,tweet=fast_merge(dataset="Twibot-20") user_text=list(user['description']) tweet_text = [text for text in tweet.text] pretrained_weights = 't5-small' ...
b6a933934546fdbee1df78a2d807e220ca1a6d40b4ea0b0f5a5c03afb63a7438
Python
3,629
139
import numpy as np from scipy.constants import epsilon_0 as e0 import impedancefitter as ifit from impedancefitter.double_shell import eps_cell_double_shell from impedancefitter.single_shell import eps_cell_single_shell from impedancefitter.suspensionmodels import bh_eps_model, bhcubic_eps_model, eps_sus_MW em = 10.0...
2485d5d6b10a76017575d97b16fbdb2aaa7a149ba6527da7413d6a3ed23266c4
Python
3,630
97
""" Script: Prepare Incomplete-Modality Inference Set for nnUNet Segmentation Description: This script prepares a validation subset for segmentation experiments under missing-modality conditions. It performs the following steps: 1. Reads the validation subject IDs from `splits_final.json`. You can use your own list ...
71a5a89d36322305b3283e0108b79086e8a0a3c0fd547dde4385bb2d9d60b955
Python
3,630
150
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved """ An awesome colormap for really neat visualizations. Copied from Detectron, and removed gray colors. """ import random import numpy as np __all__ = ["colormap", "random_color", "random_colors"] # A list of 25 bright and sharp colors for s...
fd186e6317b919d9251d5295871297282dec4181443f4c1b6201a769dffe7b9f
Python
3,630
46
from brainscore_vision import model_registry from .helpers.helpers import CORnetCommitment, _build_time_mappings from .model import get_model, TIME_MAPPINGS, get_layers model_registry['ReAlnet01_ALL'] = lambda: CORnetCommitment(identifier='ReAlnet01_ALL', activations_model=get_model('ReAlnet01_ALL'), ...
12a740fbb27e296aa6a71a5a183f678148c820664c07b869b8c3e0f088a2952e
Python
3,631
116
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING, Any, ClassVar, Generic, Protocol, TypeVar import cvat_sdk.auto_annotation as cvataa import cvat_sdk.datasets as cvatds from cvat_sdk import Cl...
df86f8b7ec5a47bce2cf74a1c42b851ea145eacb32565fdc976e2cde612655ae
Python
3,631
106
""" Example demonstrating the size-preserving warping functionality. This example shows how to use the new preserve_cell_sizes parameter to maintain relative size differences between cells during warping. """ from stack_corr.warping import warp_dendrites # Example usage: Preserve cell sizes (recommended) def exampl...
4802735df28d5c0658f743184f8f48e50125f2c936ea1a85e6b693478bb64a76
Python
3,633
102
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Merge multiple json files into a single one. Typically used during the tractometry pipeline. Without option it will simply merge all entries at the top level, the top level must not have any conflicting keys. --keep_separate option will add a parent for each file, its...
4e022f12254db4aaa598aa01561542bc29709cb886db7874fdd31939a3c9c21e
Python
3,636
110
#!/usr/bin/python # ## @file # # A dialog that enables the user to enter the mosaic settings # when loading older movies without a corresponding .xml file # off-line. # # Hazen 07/15 # import sys from PyQt5 import QtCore, QtGui, QtWidgets import storm_control.steve.qtdesigner.mosaic_dialog_ui as mosaic_...
a7b9a648992b8e9e761fdef11bcdbd6d5a926b25520ef0c1b170fabc797d6e46
Python
3,636
84
#!/usr/bin/env python # author: Jannes Spangenberg # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace import pysam import sys def parse() -> Namespace: parser = ArgumentParser( formatter_class=ArgumentDe...
e3ccc9c00714fc071103d564319252d3ef5973ed1855a2c526d34200cf1ea789
Python
3,637
123
import nibabel as nib import numpy as np import pandas as pd import pytest from pyment.data import NiftiDataset def make_mgh(path: str, shape: tuple, value: float = 1.0) -> None: data = np.full(shape, value, dtype=np.float32) nib.save(nib.MGHImage(data, affine=np.eye(4)), path) @pytest.fixture def images_f...
c40e6e4b6563f44416832029d56d7e85ff0bf6898732d4cac52f733edc66c4c5
Python
3,639
88
import nibabel as nib from scipy import sparse import sys import argparse import numpy as np import pickle def argument_parse(argv): parser=argparse.ArgumentParser(description='Convert a parcellated chacovol output to NIFTI') parser.add_argument('--in','-i',action='store',dest='infile',help='input chacov...
17fecf6df6301f95ceddfdc7478819c9757c23e95a3a2e5fed03bea8581abeaf
Python
3,640
93
import torch import torch.utils import torch.utils.data import torchvision import torchvision.transforms as transforms import glob import os # CIFAR10 train mean_cifar10_train = [x / 255 for x in [125.30691805, 122.95039414, 113.86538318]] std_cifar10_train = [x / 255 for x in [62.99321928, 62.08870764, 66.70489964]] ...
1e714313cc85729f2d14d79fb093b232d47607c8eba9bdfc84e0d9c2b76302cd
Python
3,641
110
# 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...
7d4f63b79454bcac6a81d4dca859491af380af8a42cc26c6a894d23fa37786f6
Python
3,641
99
""" All algorithms from the original skyline implementation are included below. """ import numpy as np import scipy from scipy.stats import t as scipy_stats_t import statsmodels.api as sm import traceback def tail_avg(timeseries, debug, debug_path): """ This is a utility function used to calculate the averag...
41659b48e2d40bd8089014b67085f7ab630cbde418d197946fd8759e80443213
Python
3,642
134
"""Example entry point for the Waven analysis pipeline. Run the GUI: python example.py Run the batch RF pipeline: python example.py --run Create wavelets/Gabor libraries explicitly: python example.py --run --create-gabor --wavelets --model """ from __future__ import annotations import argparse import os...
4f5637797153d14b0dc6b47ff438c0869b982702ff4b0d932d6507bbe4a8f91d
Python
3,642
118
""" Module to define general nodes in a Bayesian network All nodes have two main attributes: - dim: dimensionality of the node - markov_blanket: the markov blanket of the node """ import scipy as s import numpy as np class Node(object): """General class for a node in a Bayesian network PARAMETERS ----...
8e137763d90bea928faeb083f1b65111419b6a5319a681c3343d1ac8ab72066b
Python
3,642
118
# 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 torch import torch.nn as nn import torch.nn.functional as F from typing import Type class MLPBlock(nn.Module): ...
2d9905a926cf09fc8ee40ad24cabc55272f0f15a8ea245f9ba3569a2b3d6a36b
Python
3,643
11
# setup global variable for HVG251 model # # batch_size = 64 # CSV_HEADER=['1500002C15Rik', '2610044O15Rik8', 'AA467197', 'AW112010', 'AY036118', 'Acp5', 'Actb', 'Actg1', 'Adgre1', 'Aif1', 'Apoe', 'Apol7c', 'Areg', 'Arfgef1', 'Atf3', 'Atox1', 'Bcl2a1b', 'Bhlhe40', 'Birc5', 'Bmp2', 'Bst2', 'C3', 'C3ar1', 'C5ar1', 'C7300...
5eaba7e38cbf6d7181791784d3c1b42ca204fa8c1cb2d29faf5f8627bc37673e
Python
3,643
113
import os, sys import numpy as np import scipy.ndimage def gen_s2s(gen, batch_size=1): while True: X = next(gen) fixed = X[0] moving = X[1] # Downsample input for deep supervision fix_down_2 = scipy.ndimage.interpolation.zoom(fixed, (1,0....
ad85e7a112d48ac43bff6a576876b7c1f070e8e1a11d05b2103fcdecb44fdd80
Python
3,643
95
import numpy as np import torch import torch.nn.functional as F import torch.nn as nn from torch import Tensor from .soft_ce import SoftCrossEntropyLoss from .joint_loss import JointLoss from .dice import DiceLoss class EdgeLoss(nn.Module): def __init__(self, ignore_index=255, edge_factor=1.0): super(Edge...
11ec2cd0459de06e643664874c3a06b375e0ccbd012823694489393cdab2c7a7
Python
3,645
85
import csv # Function to read data from the excel file in a specific format def get_kymo(input_file_name, head_distances={}): kymo = {} with open(input_file_name, 'r') as file: csvreader = csv.reader(file) index = -1 for row in csvreader: if index == -1: for...
99feb3bb16246c84aebb63ce8e72ec6fceea49d49e08bcb98a36ac594afe786b
Python
3,646
115
''' HOBr ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for HOBr: 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...
304c90b33d098e95eb03a97b8b64d83a2af56b7ee2568c1759be6ffeb1cb02e1
Python
3,648
139
""" Random Forest Regression with 10-Fold Cross-Validation and Statistical Significance Testing This script evaluates EEG-based cognitive workload estimation using Random Forest Regression with 10-fold cross-validation, as described in: "Estimating Cognitive Workload in Robot-Assisted Surgery Using Time and Frequency...
5f93803c9f9f19a50c72c026be27d0fc89da7b3fe4072066cb66e1472e81bc58
Python
3,648
101
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Compute a binary mask based on a global SF threshold. The script masks voxels where the maximum SF amplitude is below either a relative factor or an absolute threshold (or both). When fODFs are evaluated on a sphere (SF), the amplitude of the lobes corresponds to the...
ae11af87d9a0952556057fbadefca1625951b2f79d21c991e046767ce0efdc36
Python
3,648
102
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Wrapper for SyNb0 available in Dipy, to run it on a single subject. Requires Skull-Strip b0 and t1w images as input, the script will normalize the t1w's WM to 110, co-register both images, then register it to the appropriate template, run SyNb0 and then transform the r...
92e40381879552575e34ad682e9c93a9c128c9a2737fba99d9f4e613862916b7
Python
3,649
84
#!/usr/bin/env python # author: Jannes Spangenberg # e-mail: jannes.spangenberg@uni-jena.de # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace import pysam def parse() -> Namespace: parser = ArgumentParser( ...
1344f421ce3ca1076f3b2c920a8f0192800c2ba623d4b4b883f2df6906750b6c
Python
3,651
89
#This program reads in all IF/IV data and creates SAS output. #No possibility of using the parameter file to select or create subsets #edit this to calculate IRneg and IRpos same as in MURI #Also, calculate IFmax and IFhalfmax import os print os.getcwd() #this is subdir for output data, relative to ~sarah subdir...
4a702fda22de3390eff86a1afa2303acba60410c25ae3fc595fbffd017c0a828
Python
3,651
99
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
6e1a6bcde51964d26aa914f43cc63d704ecc6c183547ea6ae761fea841de63b5
Python
3,651
113
""" TanH Scheduler TanH schedule with warmup, cycle/restarts, noise. Hacked together by / Copyright 2021 Ross Wightman """ import logging import math import numpy as np import torch from typing import List from .scheduler import Scheduler _logger = logging.getLogger(__name__) class TanhLRScheduler(Scheduler): ...
e0880954ea83f85df4582ad63fd6819baa02a629ce940792de23ad683608cc14
Python
3,651
105
import nibabel as nib import numpy as np import numpy.testing as npt import scipy.ndimage as ndim from dipy.align.imwarp import DiffeomorphicMap from dipy.io.stateful_tractogram import Space from dipy.io.streamline import StatefulTractogram import AFQ.data.fetch as afd import AFQ.utils.volume as afv SHAPE = (40, 40, ...
00db612d5bfc69697b51b67b39afd8930191408eca34dc9f98f32b92ce379842
Python
3,652
125
import glob import os import re from pathlib import Path import requests script_dir = os.path.dirname(os.path.abspath(__file__)) def get_parent_path(): """Get current directory path minus the last folder.""" return os.path.dirname(os.getcwd()) def replace_in_file(path, old, new): with open(path, 'r', ...
41e179f3e1d3e881913880edecee9e1822d8316beba9d52a797e3ed4a4e01dcc
Python
3,653
85
"""About ChemGraph page.""" import streamlit as st from ui.branding import LOGO_IMAGES, first_existing_asset def render() -> None: """Render the About ChemGraph page.""" logo_image = first_existing_asset(LOGO_IMAGES) if logo_image: st.image(logo_image, width=320) st.header("About ChemGra...
1693d5fd0d7bcfe021f2d9447a0a6e4307e962478882c3e51d4f87064098928f
Python
3,654
84
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path from typing import Any import torch from ultralytics.utils import LOGGER def torch2openvino( model: torch.nn.Module, im: torch.Tensor | list[torch.Tensor] | tuple[torch.Tensor, ....
7b785317b8e8986d45139162b15ddb364d791b19c354f16a741b041b3e43bbd2
Python
3,654
99
from __future__ import annotations from collections.abc import Callable from PySide6 import QtCore from PySide6 import QtGui from PySide6 import QtWidgets from .._utils._qt import new_icon class EmptyStateWidget(QtWidgets.QWidget): def __init__( self, *, on_open_image: Callable[[], None...
ecf1f5f928abdb9f2c71a2dc4e478e56318e9ea8575664f3fd1e21e884cd23af
Python
3,655
77
import os import sys import ultraimport Cath = ultraimport('../dataset_src/cath_imem_2nd.py','Cath_imem') # from dataset_src.cath_imem_2nd import Cath_imem as Cath import os.path as osp import pathlib from typing import Any, Sequence import torch import torch.nn.functional as F from tqdm import tqdm import numpy as ...
a03cdf1cbbf87cc96e921e5497854a69d2a9cd38402524959892d4475d393ee0
Python
3,657
90
import torch import numpy as np import config class Metric(): def __init__(self, reduction = 'mean'): self.reduciton = reduction def set_input(self, y_true, y_pred): ''' :param y_true: torch.Tensor [b, 32, 256, 256] :param y_pred: torch.Te...
20afcb738903e068c1403e09338c85db8729b7680e9e8e6337153f222cfdaead
Python
3,659
115
from dataclasses import dataclass from typing import TYPE_CHECKING, Literal import torch from torch import nn from eir.models.input.array.array_models import al_pre_normalization from eir.models.input.array.models_locally_connected import LCLModel, LCLModelConfig from eir.models.layers.projection_layers import get_1d...
2a0ea650535b006f9c7dff221bb8c14bf79edb7e1f99b511a19d3ba20eef73a3
Python
3,659
127
""" Support for parsing phylogenetic tree's in newick format. TODO: Tree/Edge should be a generic data structure, not newick specific. """ from functools import total_ordering from pyparsing import ( alphas, CaselessLiteral, Combine, delimitedList, Forward, nums, Optional, QuotedStrin...
b7b7d07911c8e2a101fe23cb0ba29a054ece33de922fbb650a3f5d003a9f22c9
Python
3,659
91
# FetMRQC: Quality control for fetal brain MRI # # Copyright 2023 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/lice...
fd049d620d00ba5ce62eb9caa5bcacca5734384a22d5cb1b456c922e5110e7bc
Python
3,659
109
from torch_geometric.nn import GCNConv import torch import torch.nn as nn ALPHA = 2. def uniform_init(params_list): for param in params_list: nn.init.uniform_(param) class Hist(torch.autograd.Function): @staticmethod def forward(ctx, c, bin_centers, hist_l, hist_r, n_bins): ctx.save_for_...
f2e7cadcc73cfd0d47a4122f9131bdb1ea0f9fc0ba83f0a562bfec6966cec1e6
Python
3,660
117
"""Compute physicochemical properties using RDKit.""" import pandas as pd from rdkit import Chem from rdkit.Chem.Crippen import MolLogP from rdkit.Chem.Descriptors import MolWt from rdkit.Chem.FilterCatalog import FilterCatalog, FilterCatalogParams from rdkit.Chem.QED import qed from rdkit.Chem.rdMolDescriptors import...
adec6aa6799aa6c6a4c32b31cdcef5452910fd0447716cd1300273a55cafab4a
Python
3,661
91
#%% set environment import numpy as np import matplotlib.pyplot as plt from os import makedirs from os.path import join from tqdm import tqdm from skimage import transform import torch from segment_anything import sam_model_registry, SamPredictor import glob import os import argparse def show_mask(mask, ax, random_co...
fedb053cee63c2e156d138b2218c300241148f688f1b97ce4128375b201cff02
Python
3,662
124
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import pickle from copy import deepcopy from cvat_sdk import models from deepdiff import DeepDiff def test_models_do_not_change_input_values(): # Nested containers may be modified during the model input data parsing. # This can lead to sub...
1a9aef0d0ed379cfa93d0c34b846f3ffc31a79c278d370eca6449cd1078d3a48
Python
3,663
90
from src.wrappers.OsipiBase import OsipiBase from super_ivim_dc.source.Classsic_ivim_fit import fit_least_squares_lm import numpy as np class TCML_TechnionIIT_lsqlm(OsipiBase): """ TCML_TechnionIIT_lsqlm fitting algorithm by Angeleene Ang, Moti Freiman and Noam Korngut, TechnionIIT """ # I'm thinking ...
e7c22b7135afc835607d48c456e7215654e43122d66062c5d043a8dc3106c678
Python
3,663
122
import torch from lightning import Fabric from eir.setup.config import Configs from eir.utils.logging import get_logger logger = get_logger(name=__name__) def setup_accelerator(configs: Configs) -> Fabric: gc = configs.global_config original_hardware = gc.accelerator.hardware if torch.cuda.is_availabl...
6c7245cad2e457c97e7a02702ef26a93131f336351a3b27e8370f9b6b2af1dc1
Python
3,664
106
import nilearn import nilearn.plotting import scipy import nilearn.image import numpy as np import pickle import fire import matplotlib.colors as colors import matplotlib.pyplot as plt task = "category" base = "../bids_dataset/derivatives" fmriprep_path = f"{base}/fmriprep/" nilearn_path = f"{base}/nilearn/" cmap=["...
f2668a32325eca1c7057d91277031bf2e04ed0374fb6c18c11c2b80425dca0c9
Python
3,665
118
''' C2O2 ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for C2O2: 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...
acc405e078f7ecdd985f5905e8285fc4cafa7c7cf9b20da93f1a91ef8911c992
Python
3,666
75
#!/usr/bin/env python """ threshold_search.py · 逐标签网格阈值搜索 (目标 = MCC) ──────────────────────────────────────────────────────── """ from __future__ import annotations import argparse, json, numpy as np, torch from pathlib import Path from torch.utils.data import DataLoader from sklearn.metrics import matthews_corrcoef as...
c5e163e309b2f82daefe705de68da31fcf097a286ff1c4c02243b2572959339b
Python
3,666
95
import sys import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt plt.switch_backend('agg') import umap import umap.plot import seaborn as sns import os matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 matplotlib.rcParams['svg.fonttype'] = 'none' plt.rc...
b4de0d5e3d4065af88265ad4d007886e9bcd3506701dab39500a98e2f7a6ca08
Python
3,667
47
import matplotlib.pyplot as plt from src.ionisation import * if __name__ == "__main__": """ Equation for systematic error removal E_actual (in eV) = 0.397 + 0.731 * E_vert (in eV) for wB97X-D4 Biliverdin | Calculated energies | Energies after systematic error ...
baf787f4bc8f31ef23d1f692473f1dc89b7a07e079754062664fded60a47147d
Python
3,667
102
from __future__ import annotations from ._core import model as _model def init(weights_path: str = None, input_size: int = 128, ckpt_name: str = "ckpt-*"): """ Initialize a model with optional weights restoration from a checkpoint. Builds and compiles a model with the specified input size. If a valid ...
e9a387d80717dfbd3fe26b246e010109fb1361fc2d491e5bd3ffdb077bdb2899
Python
3,667
118
''' CH2O2 ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for CH2O2: 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 a...
a6f0a82c098367df8da31442231409a3a2916240331433f004d1fcff6b6e9839
Python
3,668
124
from __future__ import annotations from typing import Final import pytest from PySide6.QtCore import Qt from pytestqt.qtbot import QtBot from labelme._app import MainWindow from ..conftest import close_or_pause from .conftest import select_shape # 2011_000003.json lays its shapes out roughly as # # amber_kite ...
8940723229ff36396acd2c127efdf1141951278cf7c8b3a5e47beb261e275523
Python
3,669
118
''' CH2O ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for CH2O: 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...
94ef31ed8bcdd712d6a3d8c484aed1638255761a96d68a1d516df1b6b167088b
Python
3,669
83
""" (C) Copyright 2019 IBM Corp. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
1578fca5a92f07afe765fb68bf45f62a21d988ab8a4cf55e3aa83d7b7fdc7b3f
Python
3,670
125
"""Wakeman-Henson: Source Reconstruction.""" from glob import glob from pathlib import Path import numpy as np import matplotlib matplotlib.use("Agg") import mne from osl_dynamics.meeg import parallel, parcellation, rhino, source_recon from osl_dynamics.utils.filenames import OSLFilenames # -----------------------...
63e12a7555d7e484a2c5cbe76a8a13f9bfcaa5aa8f3a9589467e2b9855e3d4c4
Python
3,670
110
import os import anndata import numpy as np import pandas as pd import scanpy as sc import scipy import seaborn as sns MESA_TARGET_RANGE = 100.0 def _require_columns(df, required, name): missing = [col for col in required if col not in df.columns] if missing: raise ValueError(f"{name} is missing re...
85165c93c578b5854a72efcdd778cb9abdafe535671b666d4eeb0f54f50f2b3e
Python
3,670
88
"""Tests that every surface_generation setting actually reaches the meshing step. `ultrafine` was documented in config_template.yml and present in DEFAULTS for several releases while being silently ignored, because nothing carried it from the config to the meshing subprocess. These tests close that gap: no pymeshlab n...
3e9fff4a06eb4ac04703741f9a520c0df5f2a7f3763d22d622abaa430637cff0
Python
3,672
88
import sys from torch.utils.data import DataLoader from geoseg.datasets.segpc import SegPCDataset from geoseg.models.MixerUnet import reparameterize_model from geoseg.losses import * from geoseg.datasets.isic2018_dataset import ISIC_Dataset from geoseg.models.MixerUnet import ConvMixer_UNET_down from geoseg.models.Mixe...
1db81bcad9876ff4b85551654185651dee3b17157778bf8710d80160c6a95bac
Python
3,673
100
# -*- coding: utf-8 -*- import logging import os import warnings # Disable tensorflow warnings with warnings.catch_warnings(): os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' warnings.simplefilter("ignore") from dipy.nn.tf.synb0 import Synb0 import numpy as np from dipy.align.imaffine import AffineMap from dipy....
71e0fd66600b3cbcaab245670d2658bf0c3b7e8bb29fff552fec37121e873857
Python
3,674
125
"""Shared helpers for the scripts/smoke/* test scripts. A tiny PASS/FAIL reporter so every script has the same output shape and exit code semantics. No external dependencies beyond the stdlib. """ from __future__ import annotations import sys import time import traceback from contextlib import contextmanager from pa...
adf99c25c012195089adb14b2e8050a8f0921cf7293838bbedace86ae987a596
Python
3,674
95
from dataclasses import replace from aicsimageio.types import PhysicalPixelSizes from pytest import fixture from pytestqt.qtbot import QtBot from qtpy.QtWidgets import QCheckBox from brainways.project.brainways_project import BrainwaysProject from brainways.project.info_classes import SliceInfo from brainways.ui.util...
494a7e2f0871a2d2ee78b2ee6007f65b725c80e9d95b13b59e6dac67c1d2b5eb
Python
3,675
24
import argparse """ python src/generate_experiment_files_and_scripts_cmds.py --experiment_names dataset_unified_balanced_speakers_conv_bn_linear_z128 dataset_unified_balanced_speakers_conv_bn_linear_z256 dataset_unified_balanced_speakers_conv_bn_linear_z512 dataset_unified_balanced_speakers_conv_bn_linear_z1024 d...
d49d3c7abae2881b37ccb71408802ba7a19ed214b72187c7bb9c5fd0809c3b79
Python
3,675
101
''' in this script, I will read into the sam file and the barcode file, and then count the reads number per barcode ''' import sys import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages def samfile_barcode_count(sam_file, barcode_file): #ge...
bdf586b026e2e9011315ba1e69d28e3b3d15b661fb051940d9e39ecaa83faf58
Python
3,677
85
#!/usr/bin/env python # author: Jannes Spangenberg # e-mail: jannes.spangenberg@uni-jena.de # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace import pysam import sys def parse() -> Namespace: parser = ArgumentP...
d5271929e4444b0fc53198ee0e7051d23ffff6b51a85248aa378e26218ef3e67
Python
3,677
81
# HD-BET brain extraction (https://github.com/MIC-DKFZ/HD-BET, Apache-2.0), run through its hd-bet command so that its # dependencies (nnunetv2, SimpleITK) can live in a separate Python environment. # # Isensee F, Schell M, Pflueger I, et al. Automated brain extraction of multisequence MRI using artificial neural...
352a9a6b7bf4e6b327893e14e6e0182f6a79198a322570c338d55d02f2310afc
Python
3,678
124
import torch import torch.nn as nn import torch.nn.functional as F class LowRankCrossAttention(nn.Module): """ 低秩投影的交叉注意力机制 通过分解投影矩阵降低参数复杂度 """ def __init__(self, dim=1024, heads=8, attn_bottleneck=256): super().__init__() self.dim = dim self.heads = heads self.att...
3054aa728ef378b6fddba49e8465bf5c24fe585d73182b3b7acadc71e82cc4c8
Python
3,679
107
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to reshape a volume to match the resolution of another reference volume or to the resolution specified as in argument. The resulting volume will be centered in world space with respect to the reference volume or the specified resolution. This script will pad or...
435ef6a38fd9e1f4e1d018eb67eb7e0ed40d9b483105d2c3cedc298a6031ea7c
Python
3,679
102
import onnx from zigzag.classes.io.onnx.parser import Parser from zigzag.classes.io.onnx.utils import get_node_input_output_dimension_shapes from zigzag.classes.workload.layer_node import LayerNode import logging logger = logging.getLogger(__name__) class MatMulParser(Parser): """Parses an ONNX MatMul operator...
ccd9d48136272270a4f23419588da9f75777f2e03c0ab2abbfed07fbe168f609
Python
3,679
121
import tkinter as tk from tkinter import messagebox import os, argparse def Input_2D(Spec_dirc,P3_dirc): text = f"""Format = Pipe # define the Spectrum path Spec_dirc = {Spec_dirc} # path to save the P3 processed spectrum P3_dirc = {P3_dirc} # define the network path Dirc_2D = Path_to_Trained/Probability_2D/US ...
ab76929c55eb79e98c65ec8107c468c8d0bd6e2961ca3d05b823370d28f6875a
Python
3,680
122
""" Read COCO-17 pose CSVs into the canonical kinescope DataFrame format. Compatible with sam3d-video-pose output and any other tool that produces COCO-17 keypoints in CSV form. """ from pathlib import Path from typing import Union import numpy as np import pandas as pd from kinescope.skeleton import COCO_PART_NAME...
ad8d0b6154c85732d6fea0b50d554a5d0f00567e81ed240a5e85288c77704a26
Python
3,680
131
import random from tqdm import tqdm import torch from torch.utils.data import DataLoader from models.text_encoder import BertTextEncoder from models.hdc_mlp import HDCMLPEncoder from data.oct_dataset import OCTDataset from loss.la_loss import la_loss DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cp...
2be32c697fc2c5c5199ec985b9fbfde9b0a30f771417ae07ae827e64f17d32d2
Python
3,681
90
import os import numpy as np alg_name = 'node2vec' parallel_starts = 16 available_gpus = ['0,8', '8,0'] # args dict args_dict = {'dataset': 'node_vessap_roi3_pb_minRadiusAvg', 'log_dir': '../tensorboard_logs', 'device': 1, 'embedding_dim': 128, 'walk_length': 40, ...
a0e3906575c5077578c1e1c0f712ed6f31dc440542cba10182695a6208b7d31e
Python
3,681
68
from nipype import Node, Workflow from nipype.interfaces import fsl from nipype.interfaces.base import CommandLineInputSpec, File, TraitedSpec, CommandLine, InputMultiPath from nipype.interfaces.utility import IdentityInterface from traits.api import Bool, Str, List import os # Usage: # $0 \ # --t1w <T1w image> ...
1ef246a4f925ee2e6941c1ddc7ee69c1e3d9e31cdec47c0cb4275b64547cfe93
Python
3,683
96
# Copyright (C) 2020-2022 Intel Corporation # # SPDX-License-Identifier: MIT import os import numpy as np from model_loader import ModelLoader class FaceDetectorHandler: def __init__(self): base_dir = os.path.abspath( os.environ.get( "DETECTOR_MODEL_PATH", "/opt/nuclio/open_mo...
df6fb9ab7b5c87c19a9cfaef9b40d4046d774ef962e33599f595cd7f805feef0
Python
3,683
107
#!/usr/bin/env python """ Custom parameter types for illumination. Hazen 04/17 """ import ast import storm_control.sc_library.halExceptions as halExceptions import storm_control.sc_library.parameters as params #import storm_control.hal4000.illumination.buttonEditor as buttonEditor class IlluminationParameterExcep...
45519e704c452a2483d704c20abec78c5d5c39725cd1d441d74dc918e658126b
Python
3,684
117
import tensorflow as tf import keras.backend as K import numpy as np class NCC(): """ local (over window) normalized cross correlation """ def __init__(self, win=9, eps=1e-5): self.win = win self.eps = eps def ncc(self, I, J): # get dimension of volume # assumes I...
3fcdcf9ff3608cf5fd179fbea3b33cb61699298184a1806e8e2918fb787fc232
Python
3,686
95
from __future__ import annotations import os import tempfile from pathlib import Path import onnxruntime # noqa: F401 # load DLLs before PySide6 on Windows from PySide6 import QtCore from PySide6 import QtGui from PySide6 import QtWidgets import labelme from labelme import __appname__ from labelme import _locale f...
9770644998b048b5d4be71218bdae6afbcdb71773d532420f6f8da385d577efe
Python
3,688
96
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to compute the SH coefficient directly on the raw DWI signal. """ import argparse import logging from dipy.core.gradients import gradient_table from dipy.io.gradients import read_bvals_bvecs import nibabel as nib import numpy as np from scilpy.gradients.bvec...
1246c045452ed435fff3971920dc97db531be7810a32c6079492c6c5ec663359
Python
3,689
123
from __future__ import annotations import functools from pathlib import Path import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file from brainscore_vision.model_helpers.activations.pytorch impo...
3f652c0da749b062c64338fafe279350894a38b7d56bc79f61c76f4c3ab438c7
Python
3,689
94
from pkg_resources import resource_filename from tensorflow.keras.models import load_model from mmsplice.layers import SplineWeight1D from mmsplice.utils import encodeDNA from mmsplice.exon_dataloader import SeqSpliter import numpy as np _MODELS = ['models/mtsplice'+str(i)+'.h5' for i in range(8)] _MODELS_DEEP = ['mod...
60d2a56f16f1f687728d820fd7077dd2c48aafbf00e6f70759f9eb1bf756ec4e
Python
3,689
90
# Copyright (c) 2022, Kwanhyung Lee, AITRICS. 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 ...
b64f10afe470b04cce5988be935de95bfa13a62c0accbd933bd51b6c43af3a8e
Python
3,689
94
from typing import List import numpy as np from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_core import Metric, Score # controls how many half-splits are averaged together to get human delta. HUMAN_SPLITS = 100 class BakerAccuracyDelta(Metric): def __in...
2e2cf0113732b8cf4415f499770f0a2ab89963d0d0bfa1deaf6dd24c715b3c70
Python
3,690
86
import torch import torch.nn as nn import spikingjelly.activation_based.layer as layer from copy import deepcopy from spikingjelly.activation_based import neuron, surrogate import torch.cuda.nvtx as nvtx from conf import global_settings as conf_set class Spikingjelly_VGG(nn.Module): def __init__(self, features, nu...
6bcbae28aa8ecc23da48a7a4116d78375119192c28cac6c5551313a47cfca0b4
Python
3,690
111
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import numpy as np import nibabel as nb from nibabel.freesurfer.io import write_geometry from nighres.surface import levelset_to_mesh from cortex.polyutils import Surface # local inputs from ..io.affine import read_vox2ras_tkr from ...
9227f0a741b283606d38cb9c1e51a83e49e543a9bd4933874866328f7c5cd220
Python
3,690
118
import math from typing import TYPE_CHECKING, Literal import torch from torch import nn from eir.models.layers.attention_layers import TransformerBlock from eir.models.meta.meta_utils import ( al_fusion_modules, al_input_modules, al_output_modules, run_meta_forward, ) from eir.utils.logging import get...
bb6db970c19b77f6c6695fbba361fbc7868a3c8f1f1da6332253efe2042bd089
Python
3,691
110
import pickle from typing import Literal import numpy as np from matplotlib.axes import Axes from rich.pretty import pprint from argclz import as_argument, argument from neuralib.plot import plot_figure from neuralib.util.verbose import publish_annotation from rscvp.statistic._var import VIS_DIR_HEADERS from rscvp.st...
16dba63ef2be9ae9295ac5636a48659fa775da6639e36badf4195f22314b51e8
Python
3,693
116
#!/usr/bin/env python class DNA3Bit(object): """ Compact 3-bit encoding scheme for sequence data. """ @staticmethod def bits_per_base(): return 3 # TODO: The sam reader needs to be fixed so text files are read as text not binary str2bindict = {65: 0b100, 67: 0b110, 71: 0b101, 84: 0b01...
608f65a29d3f3be667e077c0ee3c213d6cd9c4959a49e822ce1cd4089e5fcac8
Python
3,693
95
"""OCSR graph: read a molecule's structure diagram and return its SMILES. Reuses the single-agent graph setup, changing only the default tool list and the default system prompt so the agent is focused on reading structure images. Keeping the OCSR tools in their own graph, instead of adding them to the single-agent def...
2ee166be8e61086c70a619f67dde186135b51e70f867ca56c28bda366fdde127
Python
3,694
127
"""LangChain ``@tool`` wrappers for XANES/FDMNES functions. Each tool delegates to the pure-Python implementation in :mod:`chemgraph.tools.xanes_core`. """ from __future__ import annotations from pathlib import Path from langchain_core.tools import tool from chemgraph.schemas.xanes_schema import xanes_input_schema...