sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
ed298c4996ef166a83108d937139718333dfb60ee3d4ea9ea85c2695442f0ef7 | Python | 17,785 | 247 | # -*- coding: utf-8 -*-
import time
import random
import os
from tqdm import tqdm, trange
import logging
from loguru import logger
# 配置日志
logging.basicConfig(level=logging.INFO)
logger.add("simulated_model.log", rotation="500 MB")
class SimulatedNERModel:
"""
"""
def __init__(self):
self.model_n... |
712329adc539cc8b89fcd4a11a1644bbfb73f8cd857667c52fc90bb71630ef93 | Python | 17,803 | 469 | """Tools for debugging complex routines like model fitting."""
from pathlib import Path
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.gridspec import GridSpec
import numpy as np
from nems.visualization import (
prediction_vs_target, iteration_vs_error,... |
e5628c82285b9f947eda0cefa024ec14f8e376969c0e6e871e389daccc8c179c | Python | 17,803 | 504 | """
A convinient function to wrap all necessary processed in Sprod. Minimal data processing is required.
A 'Counts.txt' and a 'Spot_metadata.csv' is required to run this script.
Also, if the input folder contains a image tif file, it will be used as the input matching
image for feature extraction. Both files have rows ... |
fdb209653907aa7767eb65c201be81146010afce97ae9f4067364af031b56bd4 | Python | 17,805 | 591 | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from typing import Dict, Tuple, Optional, List
from dataclasses import dataclass
from collections import deque
import random
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as TF
import sys
sys... |
d1bea6de54bd0d8dc0d5afa2354d500b5121f78efbfb9ffca339843d66c33fe9 | Python | 17,810 | 399 | # reference_utils.py
import pandas as pd
import numpy as np
from math import nan
from rdkit import Chem
from rdkit.Chem import rdMolDescriptors
from rdkit import DataStructs
from numpy.linalg import norm
PROTON_MASS = 1.007276 # Da
# `Precursormz` is stored as round(ExactMolWt +/- PROTON_MASS, 3... |
611400ee509a37c087688a490a15aed117ec30ae785619d0e88b03ecb76abae5 | Python | 17,815 | 561 | """
Wrappers for VTK data objects.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import warnings
import numpy as np
from vtk.numpy_interface import dataset_adapter as dsa
from vtk.util.vtkConstants import (VTK_ID_TYPE, VTK_POLY_VERTEX, VTK_POLY_LINE,
... |
35a85a8d4108b85f7b57fe5b8aa83b060fd41d12a0d5d025978c8bb891d63a85 | Python | 17,817 | 310 | """
If you use this code, please the SynthSR paper in:
https://github.com/BBillot/SynthSR/blob/master/bibtex.bib
Copyright 2020 Benjamin Billot
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:... |
1770fa90f9c29524b4fe28e32c1ce53fd75e36c4647f794b44a87b23a04c1aca | Python | 17,818 | 464 | import sys
sys.path.insert(0, '../')
sys.path.insert(0, '../../')
sys.path.insert(0, '../../../')
sys.path.insert(0, '../../../../ogb')
import os
os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1
os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1
os.environ["MKL_NUM_THREADS"] = "2" # ... |
37b9e8c71101814e370c77665235cf559f88133fdc30d83834578837243a7bc3 | Python | 17,824 | 482 | from pathlib import Path
from prettytable import PrettyTable
import torch
import torch.nn as nn
from torch_scatter import scatter_softmax, scatter_sum
from torch_geometric.data import Data, Batch
from .dihedral import DihedralFeatures
from .EGNN import EGNNLayer
from .pooling import AttentionPooling, AddPooling
from ... |
45b221763108c13296b4199446e3d3acef3db4c84c6a07e662e5814fc238ac98 | Python | 17,830 | 395 | from argparse import ArgumentParser
import numpy as np
from tqdm.auto import tqdm
import os
from pathlib import Path
from collections import defaultdict
import json
from typing import Union
# do not import mat73 NOT HERE -> CAUSES RuntimeError: NetCDF: HDF error if imported before core modules
from brainscore_core.su... |
b817c6f14da2ea3052416b222cf33425b07e39fc77d063eea3015cbdd30cc4df | Python | 17,832 | 535 | from __future__ import annotations
from collections.abc import Generator
from typing import Final
import numpy as np
import pytest
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtWidgets
from PySide6.QtCore import QPointF
from PySide6.QtCore import Qt
from pytestqt.qtbot import QtBot
from ... |
6d98685fec1110838f6e7fe27c6bf012dcf87f0e2f702dda7f8da706c3335945 | Python | 17,834 | 413 | import scanpy as sc
import pandas as pd
import numpy as np
import scipy
import os
from anndata import AnnData,read_csv,read_text,read_mtx
from scipy.sparse import issparse
import random
import torch
from . SpaGCN import SpaGCN
from . calculate_adj import calculate_adj_matrix
def prefilter_cells(adata,min_counts=None,ma... |
0b7fd97589619edae2e540ca855485a9021a01a50f5e0cbd6667e07e284f19da | Python | 17,835 | 472 | # 该程序的作用是一个完整的Python脚本,以LightGBM来构建急性胰腺炎的预测模型
# 并进行SHAP分析,其中读取training_set_eng.xlsx进行训练模型,训练集进行了SMOTE过采样
# 读取testing_set_eng.xlsx进行测试集,读取整个原始数据data_V7.0.xlsx来进行SHAP分析
# 同时这些excel表格数据,都需要进行反转
# 程序编写于2025年8月26日,编写者:龙诗科
# 修改:使用指定文件路径和自动反转目标变量编码
# 新增:详细的单特征PDP图和交互PDP等高线图
# 新增:SHAP瀑布图
# 新增:加入了保存模型的功能
import pandas ... |
a9e0a6d2ff1c80c6a127fbd662a147e38dd21888f2df1712eb21d0c52ee83f29 | Python | 17,835 | 459 | import pandas as pd
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import seaborn as sns
from itertools import combinations
import math
from piflib.pif_calculator import compute_cigs
import io
import os
# Ensure rpy2 uses ABI mode on platforms where API mo... |
fc64f4edb16bbae1751706de06ec255167eee972827a192d2be670fdfa1a6c93 | Python | 17,835 | 483 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 2 16:33:34 2015
@author: ajaver
"""
from pathlib import Path
import json
import multiprocessing as mp
import os
from functools import partial
import cv2
import numpy as np
import skimage.filters as skf
import skimage.morphology as skm
import tables
from tierpsy.analysi... |
4c8dc3c6ec7ea9f49d82b5903f6c89181bda03904ced80d0dd382ef931023024 | Python | 17,837 | 633 | import representation
from representation import Segment
############# iexpr (label_morph)
iexpr_directional_loc = {"type": "locset", "value": [(0, 1.0)]}
iexpr_dist_dis = {
"type": "region",
"value": [(1, 0.0, 1.0), (2, 0.0, 1.0), (3, 0.0, 1.0), (4, 0.0, 1.0)],
}
iexpr_prox_dis = {"type": "region", "value": ... |
6250a35a5cbce6075b52e5d08d313f3840ad220b176df509930156080903d381 | Python | 17,838 | 507 | # coding=utf-8
"""
Module to perform predictions on data using
command line interface.
"""
import argparse
import os
import shutil
from typing import Dict, List, Tuple, Union
import numpy as np
import tensorflow as tf
import deepreg.config.parser as config_parser
import deepreg.model.layer_util as layer_util
import... |
59c80d4c98bd41ed33a03630549523dbe63501ad3bf79ca9921684ec20ac1642 | Python | 17,843 | 468 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Agatha Schmidt, 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 complian... |
02a7da95fc43688ca27806d88f84e0906b183c9ccca9e21300ab37f9cbbd865d | Python | 17,846 | 525 | from itertools import combinations
from unittest.mock import patch
import numpy as np
import pytest
import torch
from hypothesis import given, settings
from hypothesis.strategies import floats, integers, lists
from torch.nn import functional as F
from eir.data_load import data_augmentation
from eir.train_utils.criter... |
61b21d90486163d04507468bea431602649af203fc44c71711058c696c3489d7 | Python | 17,846 | 372 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 30 14:35:30 2020
@author: jacobb
"""
# Functions for plotting training and results of TEM
# Standard library imports
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
def plot_weights(models, params = None, steps = None... |
cb355b4eae64f72569a126454a3eb32c6d3710798971940aebc5fadc4cd40a9a | Python | 17,846 | 413 | """Script to generate all the plots and statistics for the joint
analysis in the bilayer thickness paper."""
__author__ = "Benjamin Barad"
__email__ = "benjamin.barad@gmail.com"
__license__ = "GPLv3"
import os
import pickle
import numpy as np
import time
import matplotlib.pyplot as plt
from sklearn.linear_model impo... |
a90813c0dd9195eb2072ef0305b663163a9a924f00c847113f757b494acf8d1e | Python | 17,847 | 505 | import torch
import torch.nn as nn
import torch.nn.functional as F
# Model for RM-ResNet
thresh = 0.5 # neuronal threshold
lens = 0.5 # hyper-parameters of approximate function
decay = 0.25 # decay constants
num_classes = 100
time_window = 4
# device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")... |
9547f147b8b9ce9969632620c5446beac2b585e947cd7fb1ddfe20dfbeecef30 | Python | 17,850 | 467 | # -*- coding: utf-8 -*-
# =============================================================================
# This code is released for the publication:
#
# "A Transparent AI Assurance and Benchmarking Framework for EEG Seizure
# Detection on TUSZ Seeded with a Reproducible Gradient-Boosting Ensemble"
#
# License:
# ... |
ce9a2753e1413fdd1fdf17f86da7518471bf691c2db6f60c7bf69ecb188c19e1 | Python | 17,854 | 513 | from matplotlib import pyplot as plt
from matplotlib import patches
from matplotlib.image import AxesImage
import matplotlib.animation as animation
import matplotlib.patheffects as path_effects
from matplotlib.axes import SubplotBase
import numpy as np
import seaborn as sbn
from torch import Tensor, squeeze, as_tensor
... |
420bc51d4dd3d15332fc66bb52a5e1426b87161b30b741713cdbe10439530def | Python | 17,867 | 379 | # fmt: off
# flake8: noqa
import csv
import io
import os
import traceback
import zipfile
from abc import ABC, abstractmethod
from copy import deepcopy
import numpy as np
from .. import _timing
from ..utils import TrackEvalException
class _BaseDataset(ABC):
@abstractmethod
def __init__(self):
self.t... |
aa4b3894072c398296c044381a7b14b61155feeb3ae86c1c41376f499ad33fba | Python | 17,868 | 434 | import math
import os
from PySide6.QtCore import Qt
from PySide6.QtGui import QBrush, QColor, QFont
from PySide6.QtWidgets import (
QAbstractItemView,
QHeaderView,
QSizePolicy,
QStyledItemDelegate,
QStyleOptionViewItem,
QTableWidget,
QTableWidgetItem,
)
def axial_angle_difference(angle, r... |
8dc693e4c0e66d6c83bfaec22f530edd6859d5e5160d25f86db1b25ee91f08fa | Python | 17,869 | 483 | import sys
import json
import os
from os.path import splitext, join, exists, dirname
import traceback
import collections
import fabio
import multiprocessing
import csv
from datetime import datetime
import pandas as pd
from PIL import Image
from musclex import __version__
try:
from ..utils.file_manager import *
... |
40e42daae5cc8a9693c6bd82b60409e9605a49b004828796ff2dd96061c7a7c4 | Python | 17,871 | 584 | from collections.abc import Sequence
from functools import partial
from pathlib import Path
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save
from docs.doc_modules.serve_experiments_utils import load_data_for_... |
5dcb4299aebe7b3e0354990199601cd81ff64aaecb07964ee6d3c72358fba16a | Python | 17,882 | 525 | from itertools import combinations
from unittest.mock import patch
import numpy as np
import pytest
import torch
from hypothesis import given, settings
from hypothesis.strategies import floats, integers, lists
from torch.nn import functional as F
from eir.data_load import data_augmentation
from eir.train_utils.criter... |
e6e15d721d26a1af24f26d702df4ab70cff1193d5fbb269b24e82d3409ba72ee | Python | 17,886 | 368 | # data/dataset.py
import os
import torch
from torch.utils.data import Dataset
import nibabel as nib
import numpy as np
import pandas as pd
import scipy.ndimage
from scipy.ndimage import rotate
try:
from monai.transforms import (
Compose, RandFlipd, RandRotate90d, RandScaleIntensityd,
R... |
c138ca81a9d613e7a884e92405b11c38cb3379f60edab2a6da2520dcb77c76d5 | Python | 17,908 | 509 | # Originally written by Nick Cullen
# Extended and currently maintained by JP Fortin
from __future__ import absolute_import, print_function
import pandas as pd
import numpy as np
import numpy.linalg as la
import math
import copy
def neuroCombat(dat,
covars,
batch_col,
categorical_cols=... |
e5d69aaa127362aee16d80407ae174ea55c23bb034b4f8a91db25530532ff8d9 | Python | 17,909 | 355 | """ Dataset reader that wraps TFDS datasets
Wraps many (most?) TFDS image-classification datasets
from https://github.com/tensorflow/datasets
https://www.tensorflow.org/datasets/catalog/overview#image_classification
Hacked together by / Copyright 2020 Ross Wightman
"""
import math
import os
import sys
from typing imp... |
3d90d16c36ffda0be2a4ee4f2e34f6bf9b7deeb5f2f9e9bbfc71d59e477543b9 | Python | 17,910 | 451 | # This file is part of connectome-manipulator.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Blue Brain Project/EPFL
import os
import numpy as np
import pandas as pd
import pytest
from bluepysnap.morph import MorphHelper
from bluepysnap import Circuit
from libsonata import Selection
import neurom as n... |
0337f7ccabc3402bccb5a1d389e913be260a5a870dcfda2ec538084b593363f2 | Python | 17,912 | 536 | import json
from argparse import Namespace
from collections.abc import Callable, Iterable, Sequence
from copy import copy
from dataclasses import dataclass
from pathlib import Path
from typing import Literal
import numpy as np
import polars as pl
from aislib.misc_utils import ensure_path_exists
from lightning.fabric i... |
0d107c81d6828802594fb492ca1f728521bccd593a5622712125ad902ed10a2c | Python | 17,918 | 507 | #!/usr/bin/python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
#... |
367fd0d7eb9310ebffa007a4913e2fe0a2d6be498c452f9c8fbbad27b5d3558b | Python | 17,923 | 379 | # flake8: noqa
import csv
import io
import os
import traceback
import zipfile
from abc import ABC, abstractmethod
from copy import deepcopy
import numpy as np
from .. import _timing
from ..utils import TrackEvalException
class _BaseDataset(ABC):
@abstractmethod
def __init__(self):
self.tracker_list... |
2c084f7f0373e01eebd53a333429f8762b52984869eb2b88c3bc677bef29db63 | Python | 17,929 | 458 | """Anna Devor inspired center surround analysis"""
import nibabel as nb
import numpy as np
import subprocess
import os
import glob
from nilearn import signal
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
subs = ['sub-16']
subs = ['sub-14', 'sub-15', 'sub-17', 'sub-18']
subs = ['sub-05', '... |
eb5b20ad9a7932745dcb225433d3253909a6e77be4f45b33909424c7fb6dc81c | Python | 17,946 | 443 | import torch
from torch import nn
from torch import Tensor
from torch.nn import functional as F
from torchvision.models.detection import backbone_utils
from torchvision.models._utils import IntermediateLayerGetter
from torchvision.ops import feature_pyramid_network
from torchvision.ops.feature_pyramid_network import Ex... |
2ae23f2f813907ede52be79e5f532f6d6d21f615de55679c642bd08095574d02 | Python | 17,951 | 517 | """
(C) Copyright 2021 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
dis... |
2d10dcc4974746e590198844afc59d977b7cdfd95625fb1aa03bc225eda387f6 | Python | 17,953 | 332 | # IdentifyOffTargetSiteSequences.py
# Shengdar Tsai (stsai4@mgh.harvard.edu)
# A program to identify Cas9 off-target sites from molecular indexed GUIDE-Seq data
#
# 2014.08.22 Add feature to distinguish between reads that originate between one primer versus another
# 2014.09.12 Add feature to get min/max positions for... |
4913f09049ca6d093859ccaf4f8a977499398b81d9968cfbace47fe3e92376e7 | Python | 17,958 | 355 | # Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs (https://arxiv.org/abs/2203.06717)
# Github source: https://github.com/DingXiaoH/RepLKNet-pytorch
# Licensed under The MIT License [see LICENSE for details]
# Based on ConvNeXt, timm, DINO and DeiT code bases
# https://github.com/facebookresearc... |
c1ae2ee754a257cf164a3076ebdbceb21729ffed6f4b1541d1c2e397a078f562 | Python | 17,959 | 460 | """
Copyright 1999 Illinois Institute of Technology
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 without restriction, including
without limitation the rights to use, copy, modify, merge, publis... |
3708cd24a07789261e7d195d511fc6d1b114b32889135a66ed870ac66d353aa5 | Python | 17,961 | 475 | # Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder.
#
# This file is part of Slamdunk.
#
# Slamdunk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your o... |
efa17ed6052c0e77767b6a8c0fb6a50be07500c36c1ae5486f143b01ea9b4028 | Python | 17,961 | 515 | import os
import logging
import numpy as np
import pandas as pd
try:
import allensdk.internal.core.lims_utilities as lu
except ImportError:
logging.warning('no lims internal installed')
from functools import partial
from neuron_morphology.marker import read_marker_file
from neuron_morphology.snap_polygons.types... |
8dce18a68370d46caa7c5a6fc34d932eeea22389e159932482f6ebca2c1e37a3 | Python | 17,969 | 334 | #%%
%reload_ext autoreload
%autoreload 2
import os
from itertools import permutations, product
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import f_stats
import f_plotting
#%% initialize param... |
b9a97907d1618324b5002b1e5850ca3d5aef7366319b022aa4fcfc71ca14f2b0 | Python | 17,972 | 537 | from collections.abc import Callable, Generator, Iterable, Sequence
from copy import copy, deepcopy
from difflib import get_close_matches
from enum import Enum
from typing import (
TYPE_CHECKING,
Any,
Literal,
Optional,
TypedDict,
)
import torch
from torch import nn
from torch.nn import Module
from... |
b9ff8954bef8ff77ae3850ac2a6baa73871ba0e9c5e2aeb319135deb86ef5581 | Python | 17,973 | 565 | """Pure-Python XANES/FDMNES helpers (no LangChain / MCP decorators).
Contains all core workflow functions for FDMNES input generation,
execution, result parsing, Materials Project data fetching, and plotting.
Used by the LangChain ``@tool`` wrappers in :mod:`xanes_tools` and the
MCP wrappers in :mod:`chemgraph.mcp.xan... |
160e50f93239a857f8100099a56a64e4f3738dd7ebdf4c35cabe1e59496adc72 | Python | 17,981 | 394 | """Persisting CAT-NAP's step-2 products so a later run can resume at step 4.
``MEApipeline.m`` appends ``adjMs`` (and the activity data it was derived from)
to each recording's ``ExperimentMatFiles/<rec>_<folder>.mat`` at the end of
step 2 — that append is what lets ``Params.priorAnalysis = 1`` +
``Params.startAnalysi... |
cceaac6d194e68c1702250f76765ed54bf49548ac132b694a813dc101b41d21f | Python | 17,994 | 269 | ##############################################################################################
### Script to average data from the same columns in data files stored in different folders ###
##############################################################################################
### Copyright 2017-2021 Jannik Lub... |
0cf643c06d5ee5f9376f7994d41c9631f749d741343d4a753827f56e8b81579b | Python | 18,007 | 516 | """
Classes that represent alignments between multiple sequences.
"""
import random
import weakref
from bx.misc.readlengths import read_lengths_file
# DNA reverse complement table
# DNA_COMP = " - " \
# " TVGH CD M KN YSA BWXR tvgh cd... |
9a72fcf830a5eacc29ce97e8cdf5e8f0f87f2c2e3618cf80807c2ed6771e8629 | Python | 18,013 | 527 | # 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 datetime
import io
import logging
import os
import pickle
import random
import socket
import struct
impo... |
08e882cc2b377aa4808af71500040721fad00cc3bc2ad3f8df7e2e60e9c45bcf | Python | 18,016 | 523 | import logging
from itertools import combinations
import numpy as np
import pandas as pd
from factor_analyzer import FactorAnalyzer
from scipy.stats import rankdata, zscore, norm
from sklearn.decomposition import PCA, FastICA
from statsmodels.stats.multitest import multipletests
from tqdm.auto import tqdm
logging.bas... |
9625c32794c6988b499348b6f1fba042e277e5f4da4e96e1a2cf2bb7eeca2fa5 | Python | 18,027 | 578 | import numpy as np
import hipsternet.loss as loss_fun
import hipsternet.layer as l
import hipsternet.regularization as reg
import hipsternet.utils as util
class NeuralNet(object):
loss_funs = dict(
cross_ent=loss_fun.cross_entropy,
hinge=loss_fun.hinge_loss,
squared=loss_fun.squared_loss,... |
813668f0e849499f24fc7bab388f1599aceea924a4c6b0ddc9e497be39ac3670 | Python | 18,031 | 430 | """
Copyright 1999 Illinois Institute of Technology
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 without restriction, including
without limitation the rights to use, copy, modify, merge, publis... |
1fd25e0f4778168b5ae51431ed2b920a15b5590a6044fec3d2349511973aa2f3 | Python | 18,034 | 475 | import sys
import os
import pandas as pd
import pyreadr
import glob
import functools
import torch_geometric.transforms as T
import random
from torch_geometric.data import InMemoryDataset, Data
from typing import Any, Dict, Optional
import torch
from torch.nn import (
BatchNorm1d,
Embedding,
Linear,
Mod... |
f00b06b013d5a255bb34359575af829cacbd15e88f7ae927abe4a0fdb2edf14a | Python | 18,040 | 483 | """Cross-platform single-instance support for the X-Ray Viewer.
Qt maps ``QLocalServer`` to Unix-domain sockets on Unix and named pipes on
Windows. Keeping the transport here avoids platform-specific process probing
and also gives callers a way to tell whether the existing viewer is responsive.
"""
from __future__ i... |
c36f4ace58fd9c450545b87a461ca5323edc3fbbe12ef87604ac569084efe65c | Python | 18,046 | 533 | try:
import cv2
except ImportError:
print('cv2 import failed, yuv video unavailable')
import sys
import grpc
import json
import numpy
import typing
import asyncio
import logging
import argparse
import datetime
import traceback
import functools
from .thread import ThalamusThread
from .util import MeteredUpdater, I... |
7f35ff545cd624ee2eb235d84afb6284d546c881ec5b40bcffdb410bc99b8aeb | Python | 18,051 | 453 | import os
import time
import glob
import argparse
import os.path as osp
from tqdm import tqdm
from typing import Optional, List, NamedTuple
import numpy as np
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import ModuleList, Sequential, Linear, BatchNorm1d, ReLU, Dropout
from torc... |
9c477fd45ee29b3a41b2ec844bb4b2af5c792787f573e947c06528494672bde8 | Python | 18,060 | 512 | """
Module containing utilities for layer inputs
"""
import itertools
from typing import List, Tuple, Union
import numpy as np
import tensorflow as tf
def get_reference_grid(grid_size: Union[Tuple[int, ...], List[int]]) -> tf.Tensor:
"""
Generate a 3D grid with given size.
Reference:
- volshape_to_... |
24f26a15db6aca89798ebc262eb5ef961b89ca32b022eab8a104f735797d6cde | Python | 18,063 | 542 | """
Monte Carlo data generation script for inverse functional imaging.
This script generates reflectance datasets for functional spectral imaging
with constant SaO2 across layers, as in standard simulations. It supports
various sampling strategies and can be run on cluster environments.
References:
- https://link.spr... |
e670f2379e35a6d8f344575be50449d66d3a92863175b1211c4d533de1780fc0 | Python | 18,077 | 492 | """Tests for mcmlnet.utils.convenience module."""
import os
import warnings
from collections.abc import Iterator
from typing import ClassVar
from unittest.mock import Mock
import lightning as pl
import numpy as np
import pytest
import torch
from omegaconf import DictConfig
from mcmlnet.training.data_loading.preproce... |
f44f4779cf1cd1755bd542222e31cc55efc4bafdda7513c565ddf590e1720207 | Python | 18,077 | 503 | import os
import gzip
from typing import Dict, List, Optional, Union
from Bio import SeqIO
import pandas as pd
import numpy as np
from typing_extensions import Literal
from .utils import make_directory, get_bustools_binary_path, run_executable, get_bustools_version
from .count import kallisto_bus, bustools_capture,... |
81d6fb4252bf9f34ac375b3ccb8b22102c0a7a4fe03f2be6508bb346afaa6f0d | Python | 18,081 | 599 | #!/usr/bin/env python3
"""Serial coarse-to-fine symmetry search for MuscleX calibration refinement."""
from __future__ import annotations
import math
import time
import cv2
import numpy as np
try:
from musclex.utils.fold_symmetry import _compute_fold_symmetry
except Exception:
from utils import _compute_fold... |
0bf91153b55ef3001ce4f81fb3f0b3a9ad30c5ab3f986413ac8913d25b177fa3 | Python | 18,084 | 416 | import torch
import dgl
import torch.nn.functional as F
from torch import nn
from e3nn import o3
from e3nn.nn import BatchNorm
from torch_scatter import scatter
class GaussianSmearing(torch.nn.Module):
# used to embed the edge distances
def __init__(self, start=0.0, stop=5.0, num_gaussians=50):
supe... |
ee13187f9ea51bda11135f099cfc24d9c4255ac23b36f05f4e32320e80850902 | Python | 18,084 | 378 | # -*- coding: utf-8 -*-
#
# test_multiple_connections.py
import unittest
import types
import numpy as np
import arbor as A
from arbor import units as U
from .. import fixtures
if A.config()["mpi"]:
from mpi4py import MPI
"""
Tests for multiple connections onto the same postsynaptic label and for one
connection ... |
8bc095f7537e5ec7c6849be1c64bb18bebe3286778f4ae248431ddda6d14b1a2 | Python | 18,095 | 532 | import os
import glob
import json
import torch
import random
import time
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
class ASKIVIT_V1(Dataset):
"""
Alternative loader for ASKIVIT V1.3 dataset. Gets label not from json file,
but from... |
73ca3587203d51dcb3d3996722285384013c97b2773b0d847a78d6b4f00b0786 | Python | 18,096 | 429 | """Aggregator wrappers + assembly utilities for multi-subject / k-fold benchmarks.
These helpers came out of the LAION-fMRI plugin (introduced 2026-05) but are
intentionally written without any LAION-specific assumptions so any benchmark
with the same shape — multiple subjects with disjoint voxels, or k-fold CV
over a... |
04b8681c0cf8332811fb92ffb8a25c450d242f55082b3195ae2090cfbf4521f4 | Python | 18,100 | 394 | import glob
import re
import os
import numpy as np
import pandas as pd
import nibabel as nib
from nilearn.image import concat_imgs
from nilearn.image import resample_to_img
from utils.const import SUBJECTS, SUBJECT_IDS, ALL_DEGREES, LABELS
class PrepareData:
"""
Imports the processed data (z-scores), prepares... |
cd68b5252f32b8b8f1ace30e19070d4d2ad447e03f1e268cd0f6516d09c7209c | Python | 18,106 | 438 | # encoding: utf8
"""
PyTorch implementation of the HMAX model of human vision. For more information
about HMAX, check:
http://maxlab.neuro.georgetown.edu/hmax.html
The S and C units of the HMAX model can almost be mapped directly onto
TorchVision's Conv2d and MaxPool2d layers, where channels are used to store the
f... |
18a32989dd0851bf6da0bfa63d9413ef77bde622c1689f04caa9bcfc8ef01fae | Python | 18,112 | 474 | #!/usr/bin/env python
from sputils import *
from pstimutils import *
from runavalutils import evaluate_prediction_noob
from mlutils import Klasifajer, split_train_test
from sklearn.preprocessing import LabelEncoder
nargs=len(sys.argv)
if nargs<2:
print('Usage: '+sys.argv[0]+' datafile')
sys.exit(0)
prmsd={'na... |
cd18940c634b972f1da0c48cb2c2b1f88e5350905f0da71269533b61bbbf676b | Python | 18,113 | 446 | """Build and edit the batch spreadsheet without leaving the GUI.
The spreadsheet is the one input a run cannot recover from being wrong: a name
that doesn't match its data folder is not an error, it is a recording silently
missing from the results. Retyping folder names into Excel is exactly how that
happens, so the C... |
f668cda2f1aedbb572e6134df7c50637b18faf2a70df9a0cbd6b4668991c54be | Python | 18,123 | 522 | """
Feature Importance and Statistical Analysis Module
Author: [Your Name]
Date: 2025
Description: Comprehensive feature analysis including Random Forest, statistical testing, and clustering
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.ensemble import Ra... |
cffc6a89e523d262d26241be19abb049eaef8616f9e0cd5db535158f9d507e84 | Python | 18,125 | 417 | # alg_name = 'mlp'
import os
os.environ["OMP_NUM_THREADS"] = "2" # export OMP_NUM_THREADS=1
os.environ["OPENBLAS_NUM_THREADS"] = "2" # export OPENBLAS_NUM_THREADS=1
os.environ["MKL_NUM_THREADS"] = "2" # export MKL_NUM_THREADS=1
os.environ["VECLIB_MAXIMUM_THREADS"] = "2" # export VECLIB_MAXIMUM_THREADS=1
os.enviro... |
3deb3f1350dd7f957c87133d310da81f3003c4b3227c904c1b210785bf24e4f0 | Python | 18,130 | 329 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 7th of August
# analysis of fat eating bouts
Average delta F/F during onset and offset of eating bout
This script is based upon the running analysis scripts
#adds on 28 okt 2024
Add show eating on DIO 2/4
Pulses to bout is redefined. If any of the 3 numbe... |
a5f589bc7a0e976d2397b21e96ac6a2c8ac16197b5c1ea180372d4324fbe97f4 | Python | 18,131 | 373 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Analyze bundles at the fixel level using peaks and bundles (.trk). If the
bundles files are named as {bundle_name}.trk, simply use the --in_bundles
argument without --in_bundles_names. If it is not the case or you want other
names to be saved, please use --in_bundles_n... |
dc6927615ec40a470148f84b83657230a7029fbf841e0a9914a009a45ee6506a | Python | 18,140 | 410 | """
DMC-BrainMap widget for stitching .tif files.
2024 - FJ, XC
"""
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QPushButton, QWidget, QVBoxLayout, QMessageBox, QProgressBar
from napari import Viewer
from napari.qt.threading import thread_worker
from napari.utils.notifications import show_info
from magic... |
73037219205c24961fad42bfc680c0513fcfd36a28dcc581a2b94e7e77b47e71 | Python | 18,141 | 410 | import datajoint as dj
import numpy as np
from itertools import product
import torch
from torch import nn
from tqdm import tqdm
from torch.utils.data import Dataset, DataLoader
import featurevis
from featurevis import models
from featurevis import ops
from featurevis import utils
from staticnet_analyses import base
fro... |
39c081bbd55e4986145302fecdbad4b47e415f96e7ef5c27848636ae402955ce | Python | 18,144 | 386 |
import pandas as pd
import numpy as np
from pathlib import Path
from typing import List, Dict, Union, Tuple
from brainglobe_atlasapi import BrainGlobeAtlas
from napari.utils.notifications import show_info
from napari_dmc_brainmap.utils.path_utils import get_info
from napari_dmc_brainmap.utils.general_utils import spli... |
05a0914e7c3de4e22f88821212ef8f9ab491ee921c545901fa43da4ca74bfe06 | Python | 18,147 | 525 | from scipy.io import savemat, loadmat
import os, sys, platform
import h5py, json, pickle
import tifffile as tiff
import SimpleITK as sitk
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
class DataManager:
def __init__(self, hostname=None, data_group=None, data_name=None, use_scratch_Q... |
9c299dae0937cbacede37bf533b8a4942800dabfa2997d4c45da5adae4234765 | Python | 18,158 | 423 | import sys, gzip, threading, pandas as pd, argparse, os
from collections import defaultdict
# SOURCE: https://www.tutorialspoint.com/python3/python_multithreading.htm
class myThread(threading.Thread):
# featureStrings = {key: str() for key in range(1, 3)} # 5)}
printInit = 0
def __init__(
self,
... |
bc69ea9891139a429222d1fb333062dd9f36f4035437d160e2538a8e8fa6c1b5 | Python | 18,159 | 428 | # /------------------------------------------------------------------------------+
# | 14-JUL-2023 |
# | Copyright (c) Bone Imaging Laboratory |
# | All rights reserved ... |
098f17822708e1d04736469e46e9657c2534090bbf28853fc0d1aa6073e0f80b | Python | 18,162 | 447 | """Degree/strength-preserving network randomization, ports of
``randmio_und_signed.m``, ``null_model_und_sign.m``, ``randmio_und_v2.m``
and ``latmio_und_v2.m`` (BCT / ``Functions/CC_PL_SW/``). The signed variants
are used by ``participation_coef_norm`` to normalize the participation
coefficient; ``randmio_und_v2``/``la... |
517bcf3ddf105d1df8291d62d59b60f330feff7b7be3db0ad08a8ccec89ffede | Python | 18,166 | 502 | """
Defining ROI masks for all digits. This is done in several steps:
- Select voxels from activation map based on threshold. Here, we chose half the
maximum z-score as cut-off
- Propagate active voxels across cortical depth using LayNii's UVD filter
- Remove floating bits that might occur in the process
- Combine ROI... |
b76c8219eef607be9939394094e3d81d43db20b0e5b765ca8c9ad4da0acd1e2a | Python | 18,170 | 443 | """Test that step-5 results reach the HTML report and the bundle viewer.
Run from the repo root::
uv run python python/test_stats_report.py
The statistics step writes both tables and figures into ``5_StatsAndML/``. A
bundle carries only the tables — every figure there is a pure function of the
CSVs beside it — s... |
f113330bcc14ed45255036b40be3137226ebb233fbef1d6bd77e7c38714ee70c | Python | 18,173 | 580 | import numpy as np
import threading
import concurrent.futures
from scipy.stats import chi2
from numba import njit
from tqdm import tqdm
from heig import sumstats
import heig.input.dataset as ds
@njit()
def compute_ztz_inv_batch(
ldr_beta_batch, ldr_z_batch, ldr_var_batch, n, n_ldrs
):
"""
Computing (Z'Z)^... |
1e185af7fa3fc934f75a34f3eae7674b47883dd159ac36c5940e5e184f07d60e | Python | 18,177 | 510 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from torchvision.models.densenet import _DenseLayer, _DenseBlock, _Transition
from torchvision.models import densenet
from collections import OrderedDict
from torch.hub import load_state_dict_from_url
import numpy as np
from ..u... |
b16cce772760a2eca7b48626cf865cdc807c2781d33f6bd1a8f61c5cb62e1b97 | Python | 18,185 | 373 | """
(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
... |
b1f2354a477702d470ef4798a61b4a91949043fc2b4858972e6cf848d87fcc28 | Python | 18,189 | 456 | """Tests for Deep Agent action-review cards and the chat approval flow."""
import queue
from contextlib import nullcontext
from types import SimpleNamespace
import pytest
from ui import review_cards
from ui._pages import main_interface as main_ui
def _review(actions, allowed=("approve", "reject")):
names = {a[... |
ad95d1f65cad008d282d3b83be3013ac6e159f09ab20d458501f6b185920c0ed | Python | 18,202 | 477 | #!/usr/bin/env python
"""
HAL interface to National Instruments cards.
Hazen 04/17
"""
import numpy
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.daqModule as daqModule
import storm_control.sc_hardware.nationalInstruments.nicontrol as nicontrol
import stor... |
31bc20cfade95f44d86811cdc53233ca19f5c9b56f0546fb991a7df7925cce1b | Python | 18,213 | 523 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 12 16:03:30 2023
@author: jstout
"""
import pandas as pd
import MEGnet
from os import path as op
import os
import glob
from scipy.io import loadmat
import numpy as np
import copy
import pickle
def get_subjid(dirname):
tmp = op.basename(dirnam... |
6a150308a2cee7a1a7fa4839d91a6803e4bceb64a703b6cff4d6898ac7abe52f | Python | 18,215 | 313 | import datetime
import os
import time
import h5py
import signal
import argparse
import numpy as np
import psutil
import pathlib
# from memory_profiler import profile
from neuron_interface.neurosim.cells import L23_PC_cADpyr, L4_LBC_dNAC, L4_LBC_cSTUT, L4_LBC_cACint, L4_NBC_dNAC,\
... |
d25078d3d62621d51dfec9d0f0b3cfb4c0f2bd88427111841fbc03d755e834a7 | Python | 18,231 | 506 | from pathlib import Path
from typing import TYPE_CHECKING
from magicgui.widgets import ComboBox, request_values
from qtpy.QtWidgets import QLabel, QMessageBox, QPushButton, QVBoxLayout, QWidget
from brainways.project.info_classes import (
ExcelMode,
MaskFileFormat,
RegisteredPixelValues,
SliceSelectio... |
add99ce5879fabaa79f3767ec557326103aeed82b6752e8bebbf9dceedb4c7e4 | Python | 18,233 | 429 | # Kai Sandbrink
# 2023-02-14
# This script analyzes the mistrained model
# %% LIBRARY IMPORTS
import torch
import numpy as np
import os, copy
import pickle
import matplotlib.pyplot as plt
from utils import Config, plot_learning_curve, get_timestamp
from ObserveBetEfficacyTask import ObserveBetEfficacyTask
from PeekTa... |
200aa76a6cda0e3862b159d63067787752a81426c32e177e4b9b9aa0fc88c3f3 | Python | 18,241 | 544 | from .trainer import *
from flair.list_data import ListCorpus
import math
import random
import pdb
import copy
from flair.datasets import CoupleDataset
def get_corpus_lengths(train_data):
return [len(corpus) for corpus in train_data]
def get_corpus_iterations(train_data, batch_size):
corpus_lengths=get_corpus_length... |
15acb9fdd4c91b52914685d470f7994dd0c9a5dd3762323792ae7c4b3c697601 | Python | 18,243 | 357 | # Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs (https://arxiv.org/abs/2203.06717)
# Github source: https://github.com/DingXiaoH/RepLKNet-pytorch
# Licensed under The MIT License [see LICENSE for details]
# Based on ConvNeXt, timm, DINO and DeiT code bases
# https://github.com/facebookresearc... |
b2b1b5211d0f1d86f84a1ba8a5912eb3947ba0706b7abf976903a6e35ac9abb4 | Python | 18,245 | 590 | import h5py
import pandas as pd
import numpy as np
from tqdm import tqdm
import heig.input.genotype as gt
import heig.input.dataset as ds
from heig.utils import find_loc
class LDmatrix:
def __init__(self, ld_prefix):
"""
Loading an existing LD matrix
Parameters:
------------
... |
1e0a8c3b4a7bf12c2e388761e817f82b139d5fd9652133b3a9258c6809b9769b | Python | 18,248 | 419 | """
DMC-BrainMap widget for preprocessing of .tif files.
2024 - FJ
"""
import os
import platform
from pathlib import Path
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QPushButton, QWidget, QVBoxLayout, QMessageBox, QProgressBar
from superqt import QCollapsible
from joblib import Parallel, del... |
7e681b424233a7f6c565cd08454c47f1fc96002211f7669130dd824bf2b01fc8 | Python | 18,248 | 467 | import os
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
import torch
import networkx as nx
import plotnine as p9
from plotnine.stats.stat_summary import mean_cl_boot
import sys
lem_bas_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "LEMBAS"))
if lem_bas_dir not in sys.path:
... |
ae775145ae9073630233ed9f6da262350921a79fa8b19674aa39be388d5ccf3a | Python | 18,250 | 378 | import os
from pathlib import Path
import nibabel as nib
from nibabel.streamlines.array_sequence import ArraySequence
from typing import Union, Tuple
import numpy as np
import torch
import torch.nn as nn
import time
from tqdm import tqdm
from .utils.pypi_package_helper import load_model_and_args_local_or_online, get_m... |
4f463e00023e903491aaf7b3b16f8c31d994d63928a399f654bd1d36c56ba47a | Python | 18,258 | 525 | from __future__ import annotations
from pathlib import Path
import attrs
import numpy as np
import polars as pl
import random
from typing import Literal, ClassVar
from argclz import argument, try_int_type
from neuralib.util.verbose import fprint
from stimpyp import Session
from .cli_io import CELLULAR_IO
from .cli_s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.