sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
0701340f1748ea51f192304e940e97efbd3c12b0be6bf1a146fa61056e3a6868 | Python | 12,093 | 264 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import types
from pathlib import Path
from typing import Any
import torch
from torch import nn
from ultralytics.nn.modules import Detect
from ultralytics.utils import LOGGER
from ultralytics.utils.checks import ch... |
1d8dbd38fc6bdf4c4df12fae151cbd759b210a7ca13c92633ad4c46996d39034 | Python | 12,094 | 400 | __all__ = ["decode_and_plot_events1D", "plot_cum_error_dist", "plot_posteriors"]
# import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
try:
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
except ImportError:
from mpl_toolkits.axes_grid.inset_locator import inset_axes
# c... |
3720f1b1a207db2b3c2dafc663edb7ec7d33a7149a4c688edafd51315fbc6bd7 | Python | 12,099 | 367 | '''
Modified from https://raw.githubusercontent.com/jeonsworld/ViT-pytorch/main/models/modeling.py
MIT License
Copyright (c) 2020 jeonsworld
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software witho... |
ca354c7a873eba9472f3c228c7867701b664da59d47b6cceeb711354cca6cf60 | Python | 12,102 | 373 | import shutil
from dataclasses import replace
from pathlib import Path
from typing import Tuple
from unittest.mock import MagicMock, Mock, patch
import numpy as np
import pandas as pd
import pytest
from pytest import fixture
from brainways.pipeline.brainways_params import BrainwaysParams
from brainways.project.brainw... |
19a8a82dd1ad63acc54d5fc31161c494cccb749a2f0eda86f24b5b36e71deb4b | Python | 12,109 | 299 | #该程序的作用是一个完整的Python脚本,将最优的Lasso值代入LASSO回归分析
#通过LASSO得到的特征量为18个,然后通过随机森林选择18个特征变量
# 然后通过VIF分析两者的交集特征,总共得出有11个特征量
# 并画出Lasso的各个特征系数分布,画出随机森林的各个特征的重要程度排序
#程序编写于2025年8月30日,编写者:龙诗科
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.linear_model import Lasso
fr... |
ebf82040e00500a493305310e7dc4ae552eea22b585a0afa8faf38569ee2e131 | Python | 12,113 | 259 | import numpy as np
import pandas as pd
from itertools import combinations
from sklearn.svm import SVC
from sklearn.model_selection import cross_val_score, cross_val_predict
from sklearn.metrics import accuracy_score
from scipy.stats import ttest_1samp
import pickle
from utils.const import (SUBJECTS, LABEL_NAMES)
class... |
3734c9da2b1739eca1f132bdd78f03424b90de098397e7d62c7d687ebb118ce0 | Python | 12,115 | 346 | # -*- coding: utf-8 -*-
"""
Example script to set up the parameters for the image processing pipeline
"""
# import modules:
import ClearMap.Analysis.Statistics as stat
import ClearMap.Analysis.Label as lbl
import ClearMap.IO.IO as io
import ClearMap.Alignment.Resampling as rsp
import numpy, os
# Base Directory, usua... |
e85cc29cd16adcaa2a26a0c05921a62d72810ead19bf359022549d1ffb9bb64d | Python | 12,116 | 243 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 9 14:55:24 2024
@author: rl05
"""
import sys
import os
import os.path as op
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import argparse
sys.path.append('/imaging/hauk/rl05/f... |
f15bec9a51bd75d872697407ea741a8a5d15782c6cca2bcbc4607df4b581b4f3 | Python | 12,120 | 301 | # SPDX-License-Identifier: MIT
# Copyright (c) 2018-2025 GeTang
# Author: Ge Tang
#%%
from __future__ import annotations
import sys
import os
from pathlib import Path
import platform
import subprocess
import logging
import argparse
import shlex
import time
import shutil
import re
#%% Optional imports; fail fast with... |
74cda6fa9b041daf5d27daec751608b1a99d550c4a804808c3ca938c3ca41357 | Python | 12,122 | 318 | # This code is derived from the gammatone toolkit, licensed under the 3-clause
# BSD license: https://github.com/detly/gammatone/blob/master/COPYING
"""Renders spectrograms which use gammatone filterbanks."""
from __future__ import division
import numpy as np
from .filters import (
make_erb_filters, centre_freqs... |
e82c0dc93ab9f5f0a6a41f764b1dd72cc262eb92055fc67ef1ba2b4dfe9cac3d | Python | 12,131 | 345 | """
Visual Preprocessing Pipeline for AVPENet.
Implements Algorithm 2 from the paper:
Stage 1: Face detection (MTCNN)
Stage 2: Landmark detection (68 points)
Stage 3: Face alignment (rotation + crop)
Output: Aligned face image ∈ R^{224 × 224 × 3}
Landmarks L ∈ R^{68 × 2}
"""
from __future__ impor... |
ac820fd20370158bb6a4477d6ed0d9aff29b80c49f662daa43fb83064a7107f9 | Python | 12,145 | 389 | from pathlib import Path
import logging
from typing import Literal, Iterable, ClassVar, TypeVar, Any, Final
from typing_extensions import Self
from argclz import argument
from neuralib.io import mkdir_version
from neuralib.util.utils import uglob, joinn
from rscvp.util.io import IOConfig, get_io_config, DATA_SRC_TYPE... |
479a198dca733940df802311a6cbc17b8c3184ddeacc255ea775957f4f7a0b06 | Python | 12,148 | 277 | # 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 numpy as np
import torch
from .modeling import Sam
from typing import Optional, Tuple
from .utils.transforms imp... |
b918f423fdd50b180c24784f2474242790daa8e2ff6a0608e30d691f30965928 | Python | 12,154 | 407 | import json
import textwrap
from collections.abc import Sequence
from functools import partial
from pathlib import Path
from typing import Literal
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from docs.doc_modules.experiments import (
AutoDocExperimentInfo,
get_... |
b77dc273d5eff5d6baa9c38a75912979d8744b173bf7676c90a81b6a1d981f9d | Python | 12,160 | 336 | """
Collection of data augmentation methods, wraps around the augmentation functions
defined in data_augmentation.py to allow for easy instantiation and application
of augmentations to input and output data in a training loop.
"""
from abc import ABC, abstractmethod
import torch
from hydra.utils import instantiate
fr... |
5d54feb64abf135fbc5166b9bb4029d71ed08bf13435cff207b21b96b85b67ce | Python | 12,161 | 310 |
from __future__ import absolute_import
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Dense, Dropout, Conv2D, LayerNormalization
from tensorflow.keras.activations import softmax
from models.keras_vision_transformer.util_layers import drop_path
def window_partition(x, window_size):
... |
dc18e06fbf46db42b5ee54c1bd7a1b8cc95b15fce923851e50113ab495382d35 | Python | 12,172 | 265 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# A master control class to implemented a series of automated flow protocols
# using a daisy chained valve system (and eventually syringe pumps)
# ----------------------------------------------------------------... |
a3e0f46c09b8a1368ca6586c17d8473738ef95ce8adc406a9ad338addc660d70 | Python | 12,174 | 333 | import pandas as pd
from kipoiseq import Interval
from conftest import junction_file, fasta_file, junction_psi5_file, \
junction_psi3_file, multi_vcf
from mmsplice.junction_dataloader import JunctionPSI5VCFDataloader, \
JunctionPSI3VCFDataloader, JunctionPSI5Dataset, JunctionPSI3Dataset
from mmsplice.utils imp... |
cc6719a366a1fe2051ce1137e3d12f35c7c0b1f8f940fc4d5d6c1e12e59efee5 | Python | 12,177 | 327 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import io
from contextlib import ExitStack
from logging import Logger
import packaging.version as pv
import pytest
from cvat_sdk import Client, models
from cvat_sdk.core.client import AccessTokenCredentials, Config, PasswordCredentials, make_client
... |
195b17f809b7ef5fa05d3e34ec9d776361e5b02446623677eed9aecce9c3041d | Python | 12,179 | 233 | # Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center
# (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... |
31cc9967e5a924be780ff549dc16223ee9b165e0dd3e1615fc961eec1e5dda0e | Python | 12,181 | 381 | #!/usr/bin/env python
# author: Jannes Spangenberg
# github: https://github.com/JannesSP
# website: https://jannessp.github.io
import multiprocessing as mp
import pysam
import read5_ont
import signal
import sys
import zstandard as zstd
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
from ... |
69b447a6df66ff61bf1e0417739907e964d972ab2e082b1d01364de891ad14af | Python | 12,181 | 237 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import json
import random
import time
from pathlib import Path
from threading import Thread
from urllib.request import Request, urlopen
from ultralytics import SETTINGS, __version__
from ultralytics.cfg import MODES, TASKS
from ultralytics.utils impo... |
26afe5533767d07a5143e906bc36ec97e9b6ed5f38171535ba2849bc00ff7650 | Python | 12,185 | 390 | """
Module to generate visualisations of data
at command line interface.
Requires ffmpeg writer to write gif files
"""
import argparse
import os
from typing import List
import matplotlib.animation as animation
import matplotlib.pyplot as plt
import numpy as np
import numpy.matlib
from deepreg import log
from deepreg... |
2f7e5b23516962f4f9a6ad0039dbfbbcb8b26ed52835743058c40f3dcf4ef3ea | Python | 12,185 | 391 | # Copyright 2024 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
e8a6828ca714c1034dfaf3f5c362a38740da2b4a4c5250443a35b65aa728cf52 | Python | 12,193 | 360 | #!/usr/bin/env python
"""
This module handles:
1. The images that Steve displays.
2. Loading images from the disk.
Hazen 10/18
"""
import numpy
import os
import pickle
import warnings
from PyQt5 import QtCore, QtGui, QtWidgets
import storm_control.steve.coord as coord
import storm_control.steve.mosaicDialog as mosai... |
4d96adeb3be09d7b887d88eecf37528ae34394507eaeda7c48c211642d6a307a | Python | 12,194 | 303 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Evaluate pairwise similarity measures of bundles.
All tractograms must be in the same space (aligned to one reference).
Our bundle tractometry analysis scripts
---------------------------------------
- scil_bundle_pairwise_comparison:
- can compare any pair (any c... |
15039531cc10305db400c91d0fd9399057b8ee9d23b0c7694eee55fbbea1eea5 | Python | 12,202 | 289 | # @file: predict_ddG.py
""" Predict the ddG of mutation
This script computes the energetic cost of single point
mutations in membrane proteins. To account for the conformational
change, we repack side chains within 8 Angstroms of the host site.
This script generates data for Test 7.
Authors:
Rebecca Alford <ralf... |
5b6cb9b401f64a5f91a396f5c419d6265bcdba891e0fedb52fff53ca0b948748 | Python | 12,202 | 238 | import dtiplayground.dmri.preprocessing as prep
from dtiplayground.dmri.common import measure_time
import dtiplayground.dmri.common.tools as tools
from dtiplayground.dmri.common.dwi import DWI
import yaml
from pathlib import Path
import copy
import numpy as np
import dipy.reconst.dti as dti
from dipy.core.gradients i... |
c8f20d264733fcb0b39fdfd892f5ebbeaaf4629bb6103fd3d242c34f639362e5 | Python | 12,204 | 369 | # Copyright (C) 2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import operator
from abc import ABCMeta, abstractmethod
from collections.abc import Sequence
from functools import cached_property, reduce
from pathlib import Path
from typing... |
ebdf53a1a0b27c7babf58543fc65ecf1218fb102399f8148a6dc2f4620b6775f | Python | 12,204 | 239 | import os.path
import sys
import glob
#design = 'debug'
#design = 'chr2122'
#design = 'chrALL'
design = 'real'
if design == 'debug':
bfile21= '/space/gwas-syn1/1/data/GWAS/UKBioBank/projects/mostest_ukb/UKB26502_QCed_230519_maf0p005_chr21_debug';
bfile2122 = '/space/gwas-syn1/1/data/GWAS/UKBioBank/projects/m... |
c561fe5f158e87c51ba20b9b787bd9d2f4ea76f61600518b8b47248244939e1b | Python | 12,208 | 323 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import unittest
from typing import cast
import datumaro as dm
import numpy as np
from cvat.apps.quality_control.backends.datumaro.matching import (
AttributeMatchingResult,
Comparator,
DistanceCompara... |
d250c822c13b23f9421dc68c8eaa91e9ebacfb4865f609a8742515873339638b | Python | 12,208 | 278 | # 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 numpy as np
import torch
from .modeling import Sam
from typing import Optional, Tuple
from .utils.transforms imp... |
051609a6b2a81389549501709ac6d2c04bbaff9560d3217682654d2b79ed4787 | Python | 12,212 | 236 | from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, roc_auc_score
from layer import RGTLayer
import pytorch_lightning as pl
from torch import nn
import torch
from Dataset import BotDataset
from torch.utils.data import DataLoader
import argparse
from torch.optim.lr_scheduler import Cosin... |
47e7e323e03eafb5aa95ff3ef788d9573af23a6627006f5d0d740f8b6d3f9f7a | Python | 12,212 | 236 | from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, roc_auc_score
from layer import RGTLayer
import pytorch_lightning as pl
from torch import nn
import torch
from Dataset import BotDataset
from torch.utils.data import DataLoader
import argparse
from torch.optim.lr_scheduler import Cosin... |
366937c62750031830a07dc20e5ecdf89a7d075ddfd598e7929e1642c5896b39 | Python | 12,214 | 298 | # BAMboozle.py - de-identify sequencing data
# Author: Christoph Ziegenhain / christoph.ziegenhain@ki.se
# Last update: 11-01-2021
import os
import pysam
import argparse
import multiprocessing as mp
import itertools
def makeBAMheader(args, v):
bam = pysam.AlignmentFile(args.bam, 'rb')
hdr = bam.header.to_dict... |
a4aaf8581818919cd9bbf6cb9863376a5a06aec46c1d61a21d530d384601f1e9 | Python | 12,218 | 281 | #! /usr/bin/env python
"""Accept a mesh refinement iteration as the new working surface.
`refine_mesh.py` writes a numbered set of intermediate surfaces
(`{basename}_refined_iter{N}.*`) plus a handful of diagnostic plots and a few
summary files. This script "commits" one of those iterations: it backs up the
original ... |
9a5ef7006e3455ef0e3186aa121684d89a680782d5b3551a4907a3f5711644ef | Python | 12,221 | 322 | # Imports
import sys
import os
import pandas as pd
import numpy as np
import random
import matplotlib.pyplot as plt
from scipy.integrate import odeint, solve_ivp
from lmfit import minimize, Parameter, Parameters, report_fit
from model_functions_loco_Hab1 import *
from pathlib import Path
########## DATA LOAD ########... |
becc53c167128e33e712d3967a10d4df56df7eb8851faf18037c1c1f1ce7e542 | Python | 12,222 | 305 | # -*- coding: utf-8 -*-
"""
MPM <-> MP2RAGE registration
The purpose of the following script is to compute the deformation field for the
registration between MPM and MP2RAGE T1-maps. The script consists of the
following steps:
1. make folder structure
2. scale PD-map (MPM)
3. skullstrip MP2RAGE and MPM
... |
631fc12d4d0dc42a2843582060cad912b2c51aee45cd3b8c467b60b2ba352feb | Python | 12,225 | 326 | # 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.
from collections import defaultdict
import torch
from unicore import optim
from unicore import utils
from .dy... |
8bd4d2827a83c6cc0b4271e98a6e74fca7d6438749b431eec898994ac4346395 | Python | 12,225 | 365 | """Configuration models for ChemGraph evaluation benchmarks."""
from pathlib import Path
from typing import Any, Dict, List, Optional
import toml
from pydantic import BaseModel, Field, field_validator, model_validator
from chemgraph.utils.config_utils import (
flatten_config,
get_argo_user_from_flat_config,
... |
d8f47196c0829f755eb1d88ddadb2f1f25f03c44b6bab4e36ae57c56010678a2 | Python | 12,226 | 500 | #!/usr/bin/env python3
import os
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
from matplotlib.colors import to_rgba
from scipy.ndimage import binary_erosion, generate_binary_structure
# ============================================================
# USER INPUTS
# ==========================... |
20b3123a9f97786eb085dab7aa4caf6f21de1026d76f95ebe2c5e5ecdced608e | Python | 12,230 | 269 | #!/usr/bin/python
# ----------------------------------------------------------------------------------------
# A master control class to implemented a series of automated flow protocols
# using a daisy chained valve system and peristaltic or syringe pumps
# --------------------------------------------------------------... |
2e9456de15dafd47ee77917479e13d770ff8ea202cfce3901a61c0ad0f99d457 | Python | 12,234 | 262 | import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
from labdatatools.analysis import *
import argparse
class AnalysisSpikeinterface(BaseAnalysisPlugin):
def __init__(self,subject,
session = None,
datatypes = [''],
includes = ['... |
76d76189f929cddd5f32c024de37dff933585f7e0e106a43b7808717757debed | Python | 12,235 | 282 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 8 12:36:39 2023
@author: rl05
"""
import os
import os.path as op
import shutil
import numpy as np
import pandas as pd
from glob import glob
from scipy.stats import binom
import matplotlib.pyplot as plt
import seaborn as sns
import mne
from mne.... |
a4059a9b15c9d1d2ec9a1f09e9ec8fd4bcd6df8963aa952d66ff4cf1aa05f837 | Python | 12,241 | 311 | import math
from typing import Optional
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.nn import Parameter
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.nn.conv.gcn_conv import gcn_norm
from torch_geometric.nn.inits import kaiming_uniform, uniform
from torch... |
721abf4182cd43f1d6836f45af89bf76c3915baf5c448cb0c1d1f985f2d083d0 | Python | 12,243 | 409 | from __future__ import annotations
from pathlib import Path
from typing import Final
import pytest
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QMessageBox
from pytestqt.qtbot import QtBot
from labelme._app import MainWindow
from labelme._widgets._canvas import Canvas
from ..conftest import close_or_... |
1dbeabb3b6007502a5e984efa7d44fd0c709599b0e2403db19c53bd93e95450b | Python | 12,244 | 385 | import nibabel as nib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.animation as animation
import cv2
import gc
import matplotlib.animation as animation
from pylab import *
def normalize(ar):
#rescales all values in given np.array to the interval [-infty,1] or (if... |
d752fcbc124ee92faec60b63de984b4d21fbbfb14e902d48d084ec280850649e | Python | 12,246 | 274 | import numpy as np
from sklearn.model_selection import StratifiedKFold, KFold, train_test_split, GridSearchCV, cross_val_score
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn.metrics import balanced_accuracy_score, confusion_matrix, ConfusionMatrixDisplay, make_scorer... |
2df7a01ae4b6ca3882b68a11bf821057b3ab98b323520aacae1890a75712f3c8 | Python | 12,248 | 284 | import os
import cv2
import pickle
import scipy
from lib_alban.utils_analyse import *
import math
import argparse
def predicted_chromaticity(imList, dataset, max_pxl = 255):
'''
Function that loads full images and extracts the ref and match patches, predicted and GT, as well as their corresponding labels... |
7a9167364b4c325cda06784e19d2ce62e8818e01a6e2687cbbdba5136eb1f858 | Python | 12,248 | 421 | # Created by: Marc Canela
import math
import pickle as pkl
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from skimage import draw, feature, filters, measure, morphology
from tqdm import tqdm
from cellrake.utils im... |
4fa917ffae8e297d5d7543745218544117d9749faca4f897843641ad7907be01 | Python | 12,249 | 303 | import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
from typing import List, Union, Tuple, Optional
from functools import partial
from bism.modules.upsample_layer import UpSampleLayer2D, UpSampleLayer3D
from bism.modules.concat import ConcatConv2D, ConcatConv3D
from bism.modules... |
85ba88b8ca590c4cd915aab6b73bc0a07e4a8ddcd7170c8291bbdcb4dddd2a6a | Python | 12,249 | 305 | import os
import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa
from datetime import datetime
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input
from tensorflow.keras.layers import Conv2D, Conv1D
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers... |
f2dba447147bbdaa0fb41aba0c14fe53a9fda24a1d0339b718e4f30c800eb867 | Python | 12,250 | 347 | from configparser import SafeConfigParser
from nipype.pipeline.engine.nodes import Node
import nipype.interfaces.utility as utility
from nipype.interfaces import BIDSDataGrabber
from nipype.interfaces.io import DataSink
from nipype import Function
from nipype.utils.filemanip import list_to_filename
from PUMI import glo... |
1d6a4276b869cd9531e6adc439cdf5bbfc3deb406bab18ae212723274bbba854 | Python | 12,253 | 301 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import argparse
import os
import cv2
import numpy as np
import onnxruntime as ort
import requests
import yaml
def download_file(url: str, local_path: str) -> str:
"""Download a file from a URL to a local path... |
85be9c3695d601ab26b995ca21ba9649efad7e9f2e0029a1d14a79da60c0d5ab | Python | 12,253 | 287 | import numpy as np
import matplotlib.pyplot as plt
import yaml
import sys
import os
import h5py
import matplotlib as mpl
import pandas as pd
from sklearn.metrics.pairwise import cosine_similarity
from scipy.spatial.distance import pdist
import scipy.cluster.hierarchy as hac
pathpath = 'PATHS/filepaths_IBLTuning.yml'#... |
9cf25df654e38c351533f0a63a0336e02c0d0f559bd02f6c30b605639b2e6c93 | Python | 12,254 | 225 | import mat73
import argparse
import numpy as np
import cebra
from stimulus_mode_functions.combine_all_trials_all_brain_regions import dataset_all_sessions, stimulus_sampled_population
from stimulus_mode_functions.split_dataset import split_train_test_data, k_fold_split_data
from stimulus_mode_functions.model import ce... |
79a792fcd4cdb1475b5f5605c5c9f1691bd135c2705450d0cfc8e1c1251cd757 | Python | 12,255 | 238 | #!/usr/bin/env python
"""
Camera control specialized for a Hamamatsu camera.
Hazen 09/15
"""
from PyQt5 import QtCore
import storm_control.sc_hardware.hamamatsu.hamamatsu_camera as hcam
import storm_control.sc_library.parameters as params
import storm_control.hal4000.camera.cameraControl as cameraControl
... |
d204e074fd41f9c260088eb6b5b8aa4b9e67cfdb21d46fea18d758501062d643 | Python | 12,255 | 378 | import matplotlib.pyplot as plt
import numpy as np
import simple_mri as sm
import skimage
def slice_volume(volume, orientation, idx):
tail_dims = list(range(3, volume.ndim))
if orientation == "sagittal":
slice_ = np.s_[idx]
elif orientation == "coronal":
slice_ = np.s_[:, idx]
elif ori... |
f13d324edfe184565ae74a02b2e901c391d0319a30be3898405769f9eb09a675 | Python | 12,257 | 399 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... |
cbbf11c8879c93956c973980cae95587441429a48deed3d8ba60f6c319aefb14 | Python | 12,258 | 337 | #!/usr/bin/env python
"""
The parameters editor dialog box.
Hazen 4/17
"""
import os
from PyQt5 import QtCore, QtGui, QtWidgets
import storm_control.sc_library.parameters as params
import storm_control.hal4000.halLib.halMessageBox as halMessageBox
import storm_control.hal4000.qtdesigner.params_editor_ui as paramsE... |
67f89a89e36c1903c72deacd35c2bc7bbc1fbab64009d4ec7dd31c070efe9809 | Python | 12,263 | 337 | #!/usr/bin/env python
"""
The parameters editor dialog box.
Hazen 4/17
"""
import os
from PyQt5 import QtCore, QtGui, QtWidgets
import storm_control.sc_library.parameters as params
import storm_control.hal4000.halLib.halMessageBox as halMessageBox
import storm_control.hal4000.qtdesigner.params_editor_ui as paramsE... |
b55802521a0b310d5fedd2f4a63508b7c91823b6479ad32417eb9df34ce50e98 | Python | 12,274 | 273 | """
Static: Amplitude Envelope Correlation (AEC) Analysis
=====================================================
In this tutorial we will perform static AEC analysis on source space MEG data. This tutorial covers:
1. Getting the data
2. Calculating AEC networks
"""
#%%
# Getting the data
# ^^^^^^^^^^^^^^^^
# We will ... |
0172fc24ee3b80123092d7e29301a02e613e3a443fb4a100ba134fda53a5d675 | Python | 12,276 | 336 | import math
from typing import Dict, List, Optional, Tuple, Union
from torch import Tensor
from torch_geometric.nn.aggr.base import Aggregation
from torch_geometric.nn.aggr.basic import (
MaxAggregation,
MeanAggregation,
MinAggregation,
MulAggregation,
StdAggregation,
SumAggregation,
VarAg... |
e6bb78645dcf8ac9adb5d4e042252a388e56ea5a24fdec94d8042b4064702326 | Python | 12,276 | 367 | from __future__ import annotations
import inspect
import os
import sys
import time
import types
from collections.abc import Callable
from functools import wraps
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Union,
get_args,
get_origin,
overload,
)
from docstring_parser impo... |
6341c933be75c883bbf32da5b87dd3b2c700a05b840ecefe1699234e14895c09 | Python | 12,277 | 178 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 2 16:31:37 2024
@author: brainmappers
"""
import os
import nibabel as nib
import math
import numpy as np
def wb_metric_resample_to_164k(subjects_dir,subject,hemi,surface,mesh):
input_file = os.path.join(subjects_dir, subject,'MNINonLinear','... |
9fe01023926bfcf298af52c5dd78001d9a9a782e868f1bad8c161c1d728564de | Python | 12,279 | 322 | # Imports
import sys
import os
import pandas as pd
import numpy as np
import random
from scipy.integrate import odeint, solve_ivp
from lmfit import minimize, Parameter, Parameters, report_fit
from model_functions_loco_Hab6 import *
import matplotlib.pyplot as plt
from pathlib import Path
########## DATA LOAD ########... |
7c75802bc18de1ce7f5ccc0f37bd07440cf2c77dede9ea9c4e395abf12fc8903 | Python | 12,280 | 375 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
20ec2415a3ba254c36257d77f70e58f282eff5ca760a09764cc1f6daddb7a738 | Python | 12,283 | 306 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Kathrin Rack, Wadim Koslow
#
# 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 ... |
94d6b6145a55b33422c7a1f24becd0284471adfd257daae2fe37a68c9c60544d | Python | 12,287 | 375 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
549518322f9459050454d2f53a9c51452e30b4afa980f9fb236f8f7141aa33da | Python | 12,288 | 302 | from .transform import *
import os
import os.path as osp
import numpy as np
import torch
from torch.utils.data import Dataset
import cv2
import matplotlib.pyplot as plt
import albumentations as albu
import matplotlib.patches as mpatches
from PIL import Image, ImageOps
import random
CLASSES = ('background', 'building'... |
35459971daa27a3795062dc168a0aaeee5fa8b94c926c8e69d79f40d2a548c5a | Python | 12,289 | 223 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import math
from contextlib import ExitStack
from pathlib import Path
import numpy as np
import torch
from ultralytics.utils import LOGGER
from .base import BaseBackend
class HailoBackend(BaseBackend):
"""H... |
5a0674bfc270439d502375bb1db110e5b9006fba00e5f6b2fd0fbc18aa299d98 | Python | 12,293 | 258 | # 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,
# W... |
77a90e2115ef395adaf564bc26a56330830db47c3ad4a61f41073c777902bc55 | Python | 12,295 | 361 | """
This module contain functions to load session data for the TDR analysis.
"""
import json
import numpy as np
import os
import pandas as pd
from pyTdr.tdrUpdateBehavior import update_behavior
from pyTdr.tdrGetTaskVars import add_task_vars
from pyTdr.tdrUtils import load_config
from utils.get_session_info import load... |
a045142cebae53ff94af9144fa108cd413904c27f085d58dc4ade2e83343c93a | Python | 12,298 | 255 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import math
import random
from copy import copy
from typing import Any
import numpy as np
import torch
from torch import nn
from ultralytics.data import build_dataloader, build_yolo_dataset
from ultralytics.engine... |
3af8d2e1de67d5936825afe64d29a41f37853d43c97267bea5a5aaa5db2804ff | Python | 12,303 | 275 | # wfield - tools to analyse widefield data - decomposition
# Copyright (C) 2020 Joao Couto - jpcouto@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... |
47ea7b360db62965ffba923032b4ee3ebc7a3e232940bb53140cad2318e900f9 | Python | 12,309 | 362 | from __future__ import annotations
import argparse
import dataclasses
import json
import os
import shutil
import socket
import subprocess
import sys
import time
from pathlib import Path
from typing import Any
from chemgraph.academy.campaigns import campaign_launch_defaults
from chemgraph.academy.campaigns import reso... |
45eb0010c423651ad74509fe97d28450bb3ece041718cac79990739fd802545b | Python | 12,314 | 356 | import enum
import json
import logging
from ..qt import *
from ..task_controller.util import create_task_with_exc_handling
from .. import thalamus_pb2
LOGGER = logging.getLogger(__name__)
VIEW_ROTATIONS = {
'0': 0,
'90': 90,
'180': 180,
'270': 270,
0: 0,
90: 90,
180: 180,
270: 270,
}
class Edge(enum.... |
80df735a4ceeee1d9ea4839d65957214f47c90789765a675b8df9b95226ff2c6 | Python | 12,319 | 306 | """
gene expression
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import spearmanr
from scipy.io import savemat
from statsmodels.stats.multitest import multipletests
from abagen.mouse import (get_unionization_from_gene,
fetch_allenref_genes,
... |
563f2ccf42a7d0ae7610c4517432c372c7bfe24233d24f4bb4d0d811db5c6a34 | Python | 12,320 | 302 | import numpy as np
import pytest
from anndata import AnnData
from scipy.sparse import csr_matrix
from scpca.utils.data import (
_get_gene_idx,
_get_model_design,
_get_rna_counts,
_validate_sign,
_validate_states,
state_diff,
state_loadings,
)
def test_get_rna_counts(test_sparse_anndata):
... |
c406834b1d4c7c15eb2d690fab6c577046ff32ec3084027fa880059df74de645 | Python | 12,324 | 327 | import os
from datetime import datetime
import logging
from tqdm import tqdm
import numpy as np
import pandas as pd
from itertools import groupby
from scipy.signal import detrend
from scipy.stats import mode
from scipy.interpolate import interp1d
from mne.time_frequency import psd_array_multitaper
from iso_analysis.io ... |
f5845db78ec8650e6e44029e67d25f4ef45450fb74fee8eae094dcb2969e5ead | Python | 12,325 | 322 | import warnings
from pkg_resources import resource_filename
from tqdm import tqdm
import numpy as np
import pandas as pd
from tensorflow.keras.models import load_model
from pathlib import Path
import pathlib
# import concise
from mmsplice.utils import logit, predict_deltaLogitPsi, \
predict_pathogenicity, predict_s... |
1dd37d7f08668112e1c800d91cb2207e4a708d5598e826965cfcb9cc678fb290 | Python | 12,327 | 287 | # -*- coding: utf-8 -*-
"""
OD index
This scripts calculates a defined ocular dominance (OD) index for a session
consisting of several runs. From the condition file which has to be in the SPM
compatible *.mat format, time points for both experimental conditions are
extracted. Condition time points can be converted to ... |
55d22345b5a4a95e4189582eedb2403c35a44d656bc042e8cd4f8d8362c82bc3 | Python | 12,332 | 258 | #!/usr/bin/env python3
# -*- coding: utf-8
"""
Script that evaluates model on simulated data.
Created on 2020/02/03
@author romain_lopez
"""
import os
import click
import numpy as np
from utils import get_mean_normal, find_location_index_cell_type, metrics_vector, discrete_histogram
import scanpy as sc
import matpl... |
b2781aaf53a5e1796ae0ec628c5c15b39b1658cc3deba67d4a8a5aae5ed05a4d | Python | 12,332 | 265 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""MuSGD optimizer combining Muon orthogonalized updates with SGD momentum."""
from __future__ import annotations
import torch
from torch import optim
def zeropower_via_newtonschulz5(G: torch.Tensor, eps: float = 1e-7) -> torch.Tensor:
"""Compu... |
12886f9db6fbcb2fcc1149f2e66d0c8a235a4280f0d528ed85a7d1107b628e63 | Python | 12,336 | 382 | from collections.abc import Sequence
from functools import partial
from pathlib import Path
from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save
from docs.doc_modules.serve_experiments_utils import load_data_for_serve
from docs.doc_modules.serving_experiments import (
AutoDocServing... |
540d2aa9295490d78ab40fdec7f74337ec1ac45371af6d0333bbc601bee623f8 | Python | 12,341 | 385 | import logging
import numpy as np
import torch
import torch.nn as nn
from unicore import utils
from unicore.models import (
BaseUnicoreModel,
register_model,
register_model_architecture,
)
from .layers import (
AtomFeature,
EdgeFeature,
SE3InvariantKernel,
MovementPredictionHead,
Energ... |
a6d55a43f7c98ad2b4eb43a8611ca8fd5baa3901c67caf04e7d6e6905210e269 | Python | 12,342 | 290 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Render clusters sequentially to either accept or reject them based on
visual inspection. Useful for cleaning bundles for RBx, BST or for figures.
The VTK window does not handle well opacity of streamlines, this is a
normal rendering behavior.
Often ... |
acaacc90ce55e61e5151d2cdba68b62ed37f4003a7b2fda10149fe1e35bf3b3b | Python | 12,344 | 370 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Dict
class MSATEdgeEncoder(nn.Module):
def __init__(self, edge_dim=6, num_heads=8, hidden_dim=64):
super().__init__()
self.mlp = nn.Sequential(
nn.Linear(edge_dim,... |
9aae774dfe593d3e8d4c4f29823b697e00a0317399092b498bf8ac50f946bc74 | Python | 12,347 | 328 | # -*- coding: utf-8 -*-
# @Author : LG
import os
from PIL import Image
import numpy as np
import tqdm
from ISAT.formats.isat import ISAT
class YOLO(ISAT):
"""
YOLO format
YOLO use txt to save annotations. Every line container a annotation.
format: class_index, x1, y1, x2, y2, x3, y3, ....
Fo... |
14d5dfb09194be8649b1ecdf453344c54f492006aeca0121bbb82f109c22df98 | Python | 12,352 | 357 | import pandas as pd
import torch
import numpy as np
import pandas as pd
from glob import glob
from tqdm import tqdm
import os
import random
from torch_geometric.utils import to_undirected, remove_isolated_nodes, remove_self_loops, train_test_split_edges, negative_sampling
import multiprocessing
from itertools import pr... |
49ae21d19f1b641519b1b43a2351f7446dd8682950725fba99be0699d8e90f38 | Python | 12,355 | 400 | from __future__ import annotations
from collections.abc import Callable
import numpy as np
import pytest
from labelme._automation import Detection
from labelme._automation import shapes_from_detections
from labelme._automation._suppression import match_detections_to_existing_shapes
from labelme._automation._suppress... |
a25ee00fbd2c7c75808c0a5c3009b35630ee9abb895690d338c69d4a356cb3b9 | Python | 12,355 | 360 | import pandas as pd
import torch
import numpy as np
import pandas as pd
from glob import glob
from tqdm import tqdm
import os
import random
from torch_geometric.utils import to_undirected, remove_isolated_nodes, remove_self_loops, train_test_split_edges, negative_sampling
import multiprocessing
from itertools import pr... |
5571b1fe5509cb1d2a6231d6618b782ee8199925b30ea3442dda31156a0ffe5f | Python | 12,359 | 304 | from typing import Dict, Tuple, List
from zigzag.classes.hardware.architecture.memory_instance import MemoryInstance
from zigzag.classes.hardware.architecture.operational_array import OperationalArray
from math import prod
import numpy as np
class MemoryPort:
port_id_counter = 0
def __init__(
self,
... |
de2fb697b6e417b36a12ef36fe4101f87b6b45d02403f77ddb2504ca7fec7b73 | Python | 12,359 | 295 | import torch
import os
import argparse
import datetime
import numpy as np
import random
from torch.utils.data import DataLoader
from tqdm import tqdm
import pandas as pd
from brainCT.networks.unets import UNet, UNet3d_AG, UNet_PlusPlus4
from monai.transforms import (
Compose,
ToTensord,
RandAffined,
Sc... |
365138a806342021e8f298eb00d2a383b42598f24fe3b929180803ba90dccf54 | Python | 12,361 | 334 | from nipype.interfaces.base import (
traits,
TraitedSpec,
CommandLineInputSpec,
CommandLine,
File
)
import os
def filter_labels(in_file, include_superlist, fixed_id=None, map_pairs_list=None):
"""filters-out labels not in the include-superset. Merges labels within superset. Transforms label-id... |
7e4dc67dfef7658c2abd11534b0f9ce683d2b57e7b1efeaad16db28e07a63787 | Python | 12,361 | 410 | import base64
import json
import os
from collections.abc import Sequence
from functools import partial
from pathlib import Path
from shutil import copytree
import numpy as np
from PIL import Image
from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save
from docs.doc_modules.f_image_output... |
2386421f327f8c23a1d65861a03725a3e4f8950f65e9f2836eb5b0f3df4c2a1f | Python | 12,363 | 393 | #!/usr/bin/env python
#
# make_movie.py:
# create QuickTime and MPEG movies for cytosim
#
# Copyright F. Nedelec, 2007 - 2020
#
# To make MP4 Quicktime movies, you need to install ffmpeg:
# http://www.ffmpeg.org
# via Macports: sudo port install ffmpeg
# via Brew: brew install ffmpeg
#
# To make PNG Quicktime movies, y... |
d97da1303a832ad6b0fd1cc04e6202f3f6d81db46caf318019fa5223e9801362 | Python | 12,363 | 205 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'storm3-misc.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjec... |
adb3d1131ee1f34c9f548ea4b88955411f324273e085fa67c6faa927f81ce1c5 | Python | 12,367 | 361 | #!/usr/bin/env python3
"""
RDM Correlation Matrix Aggregation and Analysis
This script reads all rdm_correlation_matrix.csv files from semantic analysis results,
computes average RDM matrices, and performs t-tests for statistical significance.
Visualization follows the same style as the original semantic analysis code... |
eac113cd039b56c58992e217978672a48d471ba7b991a4702219e0c53d4df2a4 | Python | 12,369 | 329 | import torch
import torch.nn as nn
import timm
from torch.nn import BatchNorm2d
from torch.nn import Module, Conv2d, Parameter
def conv3otherRelu(in_planes, out_planes, kernel_size=None, stride=None, padding=None):
# 3x3 convolution with padding and relu
if kernel_size is None:
kernel_size = 3
ass... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.