sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
46286ff797d2f4b01286ebce2d7266b8fb58b32b60b376c9e69a3fe561375da6 | Python | 10,078 | 268 | # SMIntegration: Spatial Multi-omics Integration Platform
# ==============================================================================
#
# Purpose:
# Parses Stereo-seq data files (GEF format) and converts them into the
# SpatialData (Zarr) format. Supports both gene expression bins and
# registered images.... |
a04b6a6fccdbf49fbb0d2cf1f588e7893a26a5fe724cebac11fab8926ef22b0d | Python | 10,080 | 253 | # =====================================================================
# Title: engine.py
# Description: This file contains the engine class that handles the
# optimization of temporal mapping of SALSA.
#
# Date: 02.01.2023
#
# =================================================================... |
c585c5efb5374b4888a644310453e3188f5328c17e431d51b2abee65b5889c8d | Python | 10,080 | 357 | # -*- coding: utf-8 -*-
"""Different image manipulation tools."""
import os
import sys
import nibabel as nb
import numpy as np
from .. import execute_command
from ..io.filename import get_filename
from ..segmentation.vol import remove_bias_ants
__all__ = [
"estimate_t1w",
"mip",
"remove_nans",
"mult... |
ef6d5d7d8b61475f8ffd6d34a4b4d0dfe022363390650c040d16509c01f5f0a3 | Python | 10,081 | 198 | 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... |
c3693cef146617921096ba38361a9c6a958a83fac9c0dc4865922ce10c9ba809 | Python | 10,082 | 228 | from dlim.model import DLIM
from dlim.dataset import Data_model
from numpy import mean, newaxis
from torch import tensor, optim, rand, zeros, no_grad
from matplotlib.colors import TwoSlopeNorm
from torch import float32 as tfloat
from torch.nn import GaussianNLLLoss
from torch.utils.data import Dataset, DataLoader
impor... |
065c5a163624bdfc94dfab6517a920b0e9af0670ed11bf477961fe6343d6eef3 | Python | 10,085 | 305 | """
This script generates histogram of accumulation selectivity ('nback' refers to
number of consecutive unrewarded trials)
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from matplotlib_venn import venn2
import matplotlib as mpl
import matplotlib.pyplot as p... |
dcbf1cfbe8da726a1ca7497ef81b5c5001e40cc0adebc2e118a8188ea62e6209 | Python | 10,085 | 249 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Given ground-truth fibertubes and a tractogram obtained through fibertube
tracking, computes metrics about the quality of individual fiber
reconstruction.
Each streamline is associated with an "Termination fibertube segment", which is
the closest fibertube segment to... |
d799f61f22c1981f15e1d6930efa8281b51d5b8e19a9469d8aa711b0a604ad87 | Python | 10,098 | 220 | #Lucas Sancéré -
import json
import os
import yaml
from attrdictionary import AttrDict as attributedict
from histo_miner import tissue_analyser as analyser
from histo_miner.utils.misc import NpEncoder
script_dir = os.path.dirname(os.path.abspath(__file__))
#########################################################... |
ee6cb8f76ce44d6e5d14a19373b18a24c9b37977f9d8e58b138e277a03dd38ae | Python | 10,099 | 256 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Run group comparison statistics on metrics from tractometry
1) Separate the sample given a particular variable (group_by) into groups
2) Does Shapiro-Wilk test of normality for every sample
https://en.wikipedia.org/wiki/Shapiro%E2%80%93Wilk_test
3) Does Levene or Bar... |
5797886751f8cd2d67901a90a557cba28558d0ddf062e3b53ec7619da84ea225 | Python | 10,100 | 259 | # -*- coding: utf-8 -*-
"""
Inteface to Illastik pixel classification
This module allows to integrate ilastik pixel classification into the *ClearMap*
pipeline.
To train a classifier ilastik should be used:
*
Note:
Note that ilastik classification works in parallel, thus it is advised to
process the da... |
a68ae1c070377410d4d6ee26d5c08c2d70adec6f4d3e4598b6e7ab1aa46ddaf5 | Python | 10,100 | 298 | import os
import glob
import random
import monai
from os import makedirs
from os.path import join
from tqdm import tqdm
from time import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
from datetime import datetime
from segment_anyt... |
cde47ef3478733a18771c031d268155f736d5038055bfeea9eaf6cbbe0023bee | Python | 10,101 | 255 | """
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... |
c0a598f46f879c3456a768bd4ccd3a246785d2d813e40f67414c5a1d5d496ea7 | Python | 10,104 | 273 | from pathlib import Path
import argparse
import numpy as np
from imageio import imwrite
from PIL import Image
from starter_code.utils import load_case
# Constants
DEFAULT_KIDNEY_COLOR = [255, 0, 0]
DEFAULT_TUMOR_COLOR = [0, 0, 255]
DEFAULT_HU_MAX = 512
DEFAULT_HU_MIN = -512
DEFAULT_OVERLAY_ALPHA = 0.3
DEFAULT_PLANE... |
36718e83854d608117522cea35eae38c646a9d14c0d2121e7aac20487c1cd025 | Python | 10,106 | 234 | import warnings
warnings.filterwarnings("ignore", message="It is not recommended to directly access")
import torch
import torch.nn as nn
import torch.nn.functional as F
class ExplainableCrossAttention(nn.Module):
"""
Interpretable cross-attention that clearly distinguishes interactions between different types ... |
e1515a95b62896daabfeeca7cd226e12c5f629939eaa2e2f3689d55f56cbd864 | Python | 10,106 | 323 | from collections import defaultdict
from typing import Any, Callable, DefaultDict, Dict, List, Optional, Union
import numpy as np
import pyro # type: ignore
import torch
from numpy.typing import NDArray
from pyro.infer import SVI, Predictive, Trace_ELBO # type: ignore
from torch.cuda import empty_cache
from tqdm imp... |
b344d4d79ef26f01cc20e2e82c0b48d9d86453ba949eb8295c5dd506de00df5a | Python | 10,108 | 212 | """
PyVISAScope provides an interface to different scopes.
Copyright (C) 2016 Ye-Sheng Kuo <yesheng.kuo@gmail.com>
Copyright (C) 2019 Julius Zimmermann <julius.zimmermann@uni-rostock.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Publi... |
ba13628b51d3e2bd9f3c250b4cb38d3e3328ff7731a76984411092679582444c | Python | 10,110 | 239 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script to compute microstructure metrics using the DIVIDE method. In order to
operate, the script needs at leats two different types of b-tensor encodings.
Note that custom encodings are not yet supported, so that only the linear
tensor encoding (LTE, b_delta = 1), the... |
5673815a792f4d53779f937017ce7978fd12e0d3666eb12712ed54be6d58d56b | Python | 10,111 | 234 | import numpy as np
import pickle
from scipy.io import loadmat,savemat
from scipy import sparse
import sys
import argparse
import nibabel as nib
#workaround for deprecation warning
sys.modules['scipy.sparse.csr'] = sparse
#example:
#python chacoconn_to_nemosc.py --chacoconn mylesion_nemo_output_chacoconn_fs86subj_allr... |
8691c409b88ae03be8618cb022e21596b6b91808f343f4f0fff11c12f40eaeda | Python | 10,111 | 478 | # The ImpedanceFitter is a package to fit impedance spectra to
# equivalent-circuit models using open-source software.
#
# Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de
# Copyright (C) 2018, 2019, 2020 Julius Zimmermann,
# julius.zimmermann[AT]un... |
9678f821f5a10cf3993ea81b79d3693f321e16721bd473478fe5511ba8a6f578 | Python | 10,113 | 294 | """ Loss functions. """
import os
import sys
import torch
import numpy as np
from tools.lattice import Lattice
project_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if project_dir not in sys.path:
sys.path.append(project_dir)
try:
from auxiliary.ChamferDistancePytorch.chamfer3D import dist... |
437c427923a508d54f8b14b8d45a4ee1c93641deed40624f7cb04a2e67239d5d | Python | 10,117 | 205 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from collections import defaultdict
from typing import Any
from ultralytics.solutions.solutions import BaseSolution, SolutionAnnotator, SolutionResults
from ultralytics.utils.plotting import colors
class ObjectCo... |
67ee77625c73e4232a836474f49c59b9dadea1b549bba434a67ab1c6d5c418b0 | Python | 10,118 | 262 | import os
import yaml
import h5py
import sys
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.stats import kendalltau,pearsonr
import pandas as pd
pathpath,run1,run2,stag1,stag2,ncluststr,cmethod = sys.argv[1:]
stags = [stag1,stag2]
'''
run1 = 'runC00dMP3_brain'
run2 = 'runIBLP... |
1a97ca908c33222b9119a230ad1665af7cf4b2be8daef597fc852a32b76cab7b | Python | 10,119 | 342 | """
The CaImAn package installed in our pipeline Docker container is outdated and does not contain
some of the newer functions in caiman/utils/stats.py. So this file is copied over
from the CaImAn repository so that certain useful statistical functions can be used by the pipeline.
https://github.com/flatironinstitu... |
67cfe8f3a16b440c0e87442df6618dd35a5c9bc71d1c3658dfde3c45a1437eb6 | Python | 10,122 | 299 | '''
makedata_features
Extarce CNN features from images and save them in a BData file (hdf5).
This file is a part of GenericDecoding_demo.
'''
import csv
import os
import pickle
import re
import imghdr
from time import time
import caffe
import numpy as np
import pandas as pd
import PIL.Image
from scipy.misc import ... |
9846914ad41d3182d8e8bb0b85ea1360868a2083b4e21bbf5013c2ebc2e13e1f | Python | 10,124 | 214 | """
The :class:`~brainscore_vision.model_interface.BrainModel` interface is the central communication point
between benchmarks and models.
"""
from typing import List, Tuple, Union
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly, NeuroidAssembly
from brainscore_core.supporte... |
f1c54af8e6e6d36d4dfcfb2c54d333eba827916e1ec6658def65eb7df6f67080 | Python | 10,125 | 315 | #!/usr/bin/env python
"""
The various ChannelUI classes.
Hazen 04/17
"""
import os
from PyQt5 import QtCore, QtWidgets
def loadStyleSheet(name):
text = ""
with open(os.path.join(os.path.dirname(__file__), name)) as fp:
text += fp.read()
return text
class ChannelUI(QtWidgets.QFrame):
"... |
ab0ec16db1d7821ba283a3e7be1bc30ffb067d7ec2fa85baa4c7561c575d086a | Python | 10,127 | 315 | from pathlib import Path
import click
from stack_corr.operations import process_image
from stack_corr.definitions import InferParams, STACK_CORR_CONFIG
from stack_corr.logger import get_logger
from stack_corr.warping import warp_dendrites
from stack_corr.correction import correct_stack
from stack_corr.image import sa... |
9639a8ce6fb01d1f817a70f066049900971c31fa38821449181037c53ab4f617 | Python | 10,130 | 244 | """Skill routing and per-turn discovery shared by ChemGraph Deep Agents."""
import hashlib
import logging
import os
from collections.abc import Sequence
from pathlib import Path
from deepagents.backends import (
CompositeBackend,
FilesystemBackend,
StateBackend,
StoreBackend,
)
from deepagents.backend... |
c62fa3db3f5a8989d80383be4c34d1958f89b3d47e857deb70e6b137e2c54161 | Python | 10,132 | 299 | import logging
import immlib
import nibabel as nib
import numpy as np
from numba import get_num_threads
from AFQ.definitions.utils import Definition
from AFQ.nn.babyseg import run_babyseg
from AFQ.nn.brainchop import run_brainchop
from AFQ.nn.multiaxial import run_multiaxial
from AFQ.nn.synthseg import run_synthseg
f... |
fce9b802719acb731e115ae3813591a389c2b777720ff642dd6654060ec161b8 | Python | 10,132 | 220 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import ast
import contextlib
import json
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any
import torch
from ultralytics.utils import YAML
def _read_proto_map(file: Path, path: ... |
9f79539027c8dd6f1767e7e75d2bd286a107fd707e87fccd67c164590ba14196 | Python | 10,133 | 344 |
import os
import subprocess
import time
import sys
import pandas as pd
import shutil
import psutil
"""
Example commands:
conda activate tf-py38
cd /home/aleksandr/Desktop/WORK/OLINK_suicide_PSY_project/Data_preprocessing_analysis
/home/aleksandr/miniconda3/envs/tf-py38/bin/python PrepareCountsSTARprefSEP.py test_id.... |
d164cf2455207df7652cf4873850400e504dd7c44aba1e2f81432f26d9264249 | Python | 10,133 | 223 | import os
import time
import numpy as np
import Utils.config_stomach as CONFIG
from argparse import ArgumentParser
import torch
import torch.nn as nn
import torch.optim as optim
from NETU_classifier.Dataloader_train import ZSData
from Utils import utils
from Model.create_model import create_model
from tqdm import tqdm
... |
5811bdd8790066c980db0e0aaff3b419b9eafe8d709e5215efaa0b572472bd98 | Python | 10,134 | 295 | """Backend-agnostic XANES/FDMNES MCP server.
Uses :class:`~chemgraph.mcp.cg_fastmcp.CGFastMCP`. Tool functions are
plain computation -- the framework handles backend submission, future
resolution, and async job tracking.
The ensemble expander runs server-side and prepares per-structure
FDMNES input files in ``runs_di... |
a94bb15573f26a97d0dc8e385c21f365c549f15214ae43e7dccc3514e6691ec6 | Python | 10,134 | 223 | import os
import pandas as pd
import subprocess
import xml.etree.ElementTree as ET
class CAT12Pipeline:
def __init__(self, subject, session, output_path, matlab_path=None, **kwargs):
"""
CAT12 Segmentation Pipeline
Runs CAT12 (Computational Anatomy Toolbox 12) for SPM-based structural MRI
... |
7bf17f921e62e9f52079cdf95e423aac0aa7f48e7731c8930128542f2d31d73b | Python | 10,135 | 252 | """
Supplementary Information Figure S1: Statistical boundary determination for R1 and R2 parameters
2x2 histogram analysis establishing parameter boundaries for subsequent qMRI analyses:
- Top row (A): 3T R1 and R2 distributions from large cohort data (n=107 subjects)
- Bottom row (B): 9.4T R1 and R2 distributions fr... |
f0cdec6836cbaff298ffca4755d1f1dfac479426958f713f086f15442d2d4eff | Python | 10,135 | 315 | #!/usr/bin/env python
"""
The various ChannelUI classes.
Hazen 04/17
"""
import os
from PyQt5 import QtCore, QtWidgets
def loadStyleSheet(name):
text = ""
with open(os.path.join(os.path.dirname(__file__), name)) as fp:
text += fp.read()
return text
class ChannelUI(QtWidgets.QFrame):
"... |
01f4d3773fb36cb8b2f697769653126e9160267a9f9629eb3d63bbf2b3d6751f | Python | 10,137 | 271 | import json
import numpy as np
import tables
import os
import pandas as pd
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QPen
from PyQt5.QtWidgets import QApplication, QMessageBox
from tierpsy.gui.SWTrackerViewer_ui import Ui_SWTrackerViewer
from tierpsy.gui.TrackerViewerAux import TrackerViewerAuxGUI... |
27be8442e636c4ce836e83564e8096969a7431c510dee11f4763318dc60bfbe4 | Python | 10,137 | 262 | import os
import numpy as np
import pandas as pd
import torch
# os.environ['CUDA_VISIBLE_DEVICE'] = '5'
import math
from tqdm import tqdm
import argparse
from torch import nn
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score
from torch.utils.data import Dataset, DataLoad... |
0c454797538b12a863d75f8e1b41fc3132c0b51f0d5e6b956394b60540e2c1ad | Python | 10,141 | 252 | import numpy as np
import pandas as pd
import json
import os
import networkx as nx
import pickle as pkl
import jieba
from snownlp import SnowNLP
from collections import Counter
import matplotlib.pyplot as plt
import random
# path = r'E:\毕业论文\数据集\哇哈哈\2024.2-4 Wahaha.xlsx'
# path1 = r'E:\毕业论文\数据集\哇哈哈\Wahaha.xlsx'
# dat... |
8c1127f8c1d952ebf4307e5a6fdb7346b805d36c165bdaa7f8d3518966a4de1c | Python | 10,142 | 326 | ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the gradunwarp package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
import numpy as np
from collections import namedtu... |
3b32e28c4220bb4e9ea23e9dd2d389eb93b791bdbe317581aad887253568224d | Python | 10,146 | 296 | import tensorflow as tf
import numpy as np
import os
from sklearn.metrics import r2_score
from sklearn.decomposition import PCA as sk_PCA
from smt.surrogate_models import KRG
from tensorflow.keras import backend as K
def set_seed(seed: int = 42) -> None:
#random.seed(seed)
np.random.seed(seed)
tf.random.set_see... |
1014fb9d67181827ebd271a872bebf5db3eef480325b7a2ee8ea0e6c4d4270ba | Python | 10,147 | 278 |
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', 'sub-06', 'sub-07', 'sub-09', 'sub-10', 'sub-1... |
be6615e3a1f0f633ac99cd5e3cf2359898c87cdee02556654a8da057744bfbf2 | Python | 10,147 | 252 | import os
from time import time
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch
import torch.backends.cudnn as cudnn
from torch.utils.data import DataLoader
from dataset.kidney_dataset import KidneyData
from dataset import transforms
from net.ResUnet import ResUNet, init, StageNet
... |
13df248eb15ed38bc7022820243634f516784e337d384d0c5502c3cfab6719ec | Python | 10,149 | 286 | """
sc-fc
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import zscore, wilcoxon
from scipy.sparse.linalg import expm
import scipy.io as spio
import mat73
from ast import literal_eval
from sklearn.linear_model import LinearRegression
from scipy.spatial... |
82e3d196a8cbb981de30f679deaea92778f122b10c17dbf0d715f52c56db2186 | Python | 10,149 | 232 | import os
from copy import deepcopy
import numpy as np
import argparse
import innvestigate.utils as iutils
from keras.models import Model
from keras.preprocessing import image
from keras.utils import to_categorical
import keras
import tensorflow as tf
from numpy import average, dot, linalg
from utils import *
from lrp ... |
ea0816e30ce7fb775d4ef151224f6605e4c1e4cd877b4bd02759e52846030ae7 | Python | 10,152 | 198 | """
Algorithm: Static_IO
==============================
"""
# Windows users have to encapsulate the code into a main function to avoid multiprocessing errors.
# def main():
import pygpc
import copy
import numpy as np
import matplotlib
matplotlib.use("Qt5Agg")
import matplotlib.pyplot as plt
import pathlib
import h5py
f... |
3161b3885b3d2f10eebd9579f12730c2570c73657bdeb7d3b0f12bf052298839 | Python | 10,153 | 212 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Created on Wed Sep 13 17:14:31 2023
@author: rl05
'''
import sys
import argparse
import os
import os.path as op
import numpy as np
import pandas as pd
import time
import matplotlib.pyplot as plt
import mne
sys.path.append('/imaging/hauk/rl05/fake_diamond/scripts/an... |
3aee5397c620c753eb4e10a814334b5be66d3768dbfdd16b008056a282b1d920 | Python | 10,154 | 280 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
c094e4519b1e8ff57ea69b84ba585c7f58f815c1be453f27172c7ad2cbe07121 | Python | 10,155 | 277 | import numpy as np
import h5py
import yaml
import sys
import os
import matplotlib.pyplot as plt
import matplotlib as mpl
import shapely
from shapely.ops import polylabel
pathpath = 'PATHS/filepaths_carlen.yml'
myrun = 'runC00dMP3_brain'
layers = ['5','6']
with open(pathpath, 'r') as myfile: pathdict = yaml.safe_load... |
22a8f2b8328dfa153366d8c2bf50ab63b1cc5a0a25a0f6797c4a955c4abc41a3 | Python | 10,159 | 244 | import numpy as np
import math
import subprocess
import ast
import tensorflow as tf
from concurrent.futures import ThreadPoolExecutor
from typing import Any, Dict, List, Tuple, Optional
def _update_parameters(together_params: Any,
optimize_indices: List[int],
params: List... |
a69c0b3e2c3ce144d250e2aff426a7e83b27dd7fcf979ab7350124f72effdb8d | Python | 10,163 | 295 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
import numpy as np
from sklearn.neighbors import NearestNeighbors
from uac import utils
# Create the parser
my_parser = argparse.ArgumentParser(description="Calculation of new atrial coordinates")
# Add the arguments
my_parser.add_argument("targ... |
65b4fdb6449b4cd173017cbf0cfafcf64cefb07ac4feb4b57385a10753a2718a | Python | 10,168 | 270 | #!/usr/bin/env python3
"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Credits
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This script is a clone of the "prepare-for-rsem.py" script written by
Ian Sudbury, Tom Smith and other contributors to the UMI-tools package:... |
6052dd1cf20afe742a1bf107ec323df088451834c16df4e90689bb5eb5d5af36 | Python | 10,170 | 291 | import numpy as np
import pandas as pd
from anndata import AnnData
from joblib import Parallel, delayed
from tqdm.auto import tqdm
from itertools import combinations
import scipy
from scale.utils import extract_dist, is_ordered
def find_best_settings(adata: AnnData, cutoff=None, top_n=None, min_dist=None):
stabi... |
196392448f5d46bf87fdfa94fbde625b46c9aa9e91e377f60829f5181d15ec72 | Python | 10,171 | 347 | import os
import torch
import torch
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from torch_geometric.loader import DataLoader
from tier2_loader import collate_graphs
from insight import (
build_pred_graph,
decode_symbol,
prepare_positions,
build_mol_graph,
... |
5de53c32582d1ee4bbd37ddb926d700c84054aa9ce33c7cf3c546bfcffac4a65 | Python | 10,172 | 249 | # -*- coding: utf-8 -*-
# @Author : LG
import numpy as np
import torch
from typing import Optional, Tuple
from torch.nn import functional as F
from copy import deepcopy
import cv2
from .utils.transforms_med2d import Med2dTransforms
class Predictor:
def __init__(self, sam_model):
super().__init__()
... |
51d843d62648fee091b422889e14e694bc14a61e82bd4a5119a5772563d1575a | Python | 10,179 | 220 | # This file is part of connectome-manipulator.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Blue Brain Project/EPFL
"""Module for comparing connectomes based on connectivity features:
Structural comparison of two connectomes in terms of connection probability matrices for selected
pathways (including ... |
5d84ac0132d148f9549ab2a014b74cd9b021f68e1f9dad662af96d78a077ff60 | Python | 10,179 | 344 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 13 16:29:32 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... |
7496370319bf11f87cbe2774bd9d5aba873876a15e343b52098e2dbe75672014 | Python | 10,179 | 269 | import os
import numpy as np
import cv2
import torch
import yaml
import csv
import argparse
from argparse import Namespace
from monai.transforms import (
Compose,
ToTensord,
ScaleIntensityd,
AsDiscrete
)
from monai.networks.nets import UNet
from torchmetrics import Dice, JaccardIndex
from monai.metrics ... |
93288e31145704b9f7da4734b9477f47b090cf24363acb8f00a193946991da1d | Python | 10,182 | 283 | # -*- coding: utf-8 -*-
# @Author : LG
from PIL import Image
from segment_any.segment_any import SegAny
import cv2
import numpy as np
import os
from json import dump, load
from typing import List, Union
from pathlib import Path
from tqdm import tqdm
import warnings
class Object:
r"""A class to represent an anno... |
ecd40fe5907727fb75b14d6cd22d1f20bf2bd729690e648c33288a4985dedfa7 | Python | 10,186 | 197 | """Does feeding bior1.5 wavelet spikes into Tridesclous2 find smaller spikes
than lowering Tridesclous2's own threshold?
uv run python python/benchmark_hybrid_sorting.py --out local/spikesort_test/hybrid
Synthetic ground truth (``sorting_benchmark``) with a wide amplitude range,
so there are spikes near the noise... |
ed47f6e4c62bf0a75256cca109b785a3e0ecdba9aea7f9a7be09e959fb466e72 | Python | 10,186 | 259 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: gustav
@edited: caroline
"""
import os
import numpy as np
from utils.dataloader import mri_dset
from transforms.load_transform import load_transforms
import pandas as pd
import matplotlib.pyplot as plt
from model.model import ResNet3D
import time
import torch... |
9878b9087c0133fb6b3af94a457ef6748813bbeca0241d8c7b851a6860ec93bc | Python | 10,187 | 296 | # -*- coding: utf-8 -*-
import itertools
import warnings
from warnings import simplefilter
import bct
from dipy.utils.optpkg import optional_package
import numpy as np
from scipy.cluster import hierarchy
from scilpy.image.labels import get_data_as_labels
from scilpy.stats.matrix_stats import omega_sigma
from scilpy.t... |
db03b35f1323be5932161c97864dca43e1f5f29a7957a888a53152653b7e1975 | Python | 10,188 | 346 | """Reporting utilities for ChemGraph evaluation benchmarks.
Produces structured JSON summaries and human-readable Markdown tables
from LLM-as-judge benchmark results.
"""
import json
from pathlib import Path
from typing import Dict, List, Optional
from chemgraph.utils.logging_config import setup_logger
logger = set... |
6e3822eee088955ca6b28358c9ad58bb97f12a00c6ba00570e5e89c2bcd60fef | Python | 10,190 | 268 | import logging
from typing import Generator, Tuple, Any
from zigzag.classes.stages.Stage import Stage
from zigzag.classes.cost_model.cost_model import CostModelEvaluation
logger = logging.getLogger(__name__)
class MPIMaximalUtilizationStage(Stage):
"""
Class that keeps yields only the cost model evaluation t... |
27ce8d6bdd31acfad8f4ff2d8c6da24288b114b24ceb9fb4e8d0d64d3a52946e | Python | 10,191 | 207 | """Build the Li2026 (Triple-N) temporal neural assembly from the raw ScienceDB release.
Run this (and build_li2026_static.py, for the stimulus mapping) before
:mod:`package_li2026_temporal` (which uploads the output to S3).
Raw source -- Triple-N, ScienceDB doi:10.57760/sciencedb.33556::
<raw-root>/GoodUnit/GoodUni... |
ed41dfd9b1603fce6fd35e744826907cf353e7305f66ca018a972766112a749e | Python | 10,194 | 191 | import mat73
import argparse
import numpy as np
import cebra
from pathlib import Path
from stimulus_mode_functions.combine_all_trials_all_brain_regions import dataset_all_sessions, stimulus_sampled_population, ablate_all_regions_except_one
from stimulus_mode_functions.split_dataset import split_train_test_data
from sti... |
2e2d4cc783e61ad8ec7827efd574330414e8b95e95a8039b5f639ee4e5f3691d | Python | 10,200 | 295 | #!/usr/bin/env python3
import os
import numpy as np
from pathlib import Path
import laminar_tsnr_utils as ltu
from laminar_rs.surface_maps import plotSurfaceMap
# ----------------- Parameters -----------------
DATA_SET = "huppi" # or "kd"
SUBJECTS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, ... |
043720ad9f8c6c43b23168e3a3c6e088a1e6641b32f0979712ae908d2acd179a | Python | 10,202 | 319 | import sys
import yaml
import os
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
pathpath,myrun,ncluststr,cmethod = sys.argv[1:]
'''
myrun = 'runCrespZP_brain'
pathpath = 'PATHS/filepaths_carlen.yml'
ncluststr = '8'
cmethod = 'ward'
'''
signif_levels=np.array([0.05,0... |
5a218fb1fe97a8202f26477ffb71f421df080baae0b1fd57868fce2e441dad33 | Python | 10,204 | 284 | from typing import Optional
import torch
from torch import nn, Tensor
__all__ = ["BiTemperedLogisticLoss", "BinaryBiTemperedLogisticLoss"]
def log_t(u, t):
"""Compute log_t for `u'."""
if t == 1.0:
return u.log()
else:
return (u.pow(1.0 - t) - 1.0) / (1.0 - t)
def exp_t(u, t):
"""C... |
c02ce10efe8f4eb2890b359984d9f368af32d9ea61e6c391fa669ec1783c4011 | Python | 10,204 | 200 | 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... |
d971b3696d86fdd7669415eaaadf8719b0d70a0a40ec4528a8397d3a76b41078 | Python | 10,204 | 200 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 18 19:07:55 2021
@author: Yoshi
"""
import os
import shutil
import pandas as pd
from modulation_color_key_generator import *
from modulation_index_histogram import *
def modulation_index_analysis(path,threshold,
modulation_cell_flags,ton... |
fa0a35acf3b003f967b7d5afb1333d5e6be62f4bd0e6dd87f348c46f05641fdf | Python | 10,207 | 278 | from collections.abc import Iterator
from typing import Any
import django.db.models.deletion
from django.db import migrations, models
from cvat.apps.engine.utils import take_by
_BATCH_SIZE = 1000
_BASE_REQUIREMENT_ANNOTATION_TYPES = (
"tag",
"rectangle",
"skeleton",
"skeleton_keypoint",
"points"... |
4f504fc4832e1179f590ebddd2a49858895277b6372d442ef1dcb3d222661f3c | Python | 10,209 | 303 | #!/usr/bin/env python3
import os
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
from scipy.stats import spearmanr, linregress
from neuromaps.stats import compare_images
from neuromaps import images, nulls
from neuromaps.transforms import fsaverage_to_fsaverage
def ensure_single_darray(in_g... |
18f0d3f5d7587e7d4a2939e438e5347937ae45568b77969bec55cab0d2d8b68c | Python | 10,210 | 254 | # -*- coding: utf-8 -*-
"""
Percent signal change
This scripts calculates the percent signal change (psc) between two conditions
of a block design 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 blocks and baseline ... |
611ef03d27ce0a588699b83ba0549bf0432230005d31d37b5fbc80714bde8a31 | Python | 10,211 | 303 | """Test QtWidgets."""
import sys
from time import sleep
import pytest
from qtpy import (
PYQT5,
PYQT_VERSION,
PYSIDE2,
QtCore,
QtGui,
QtWidgets,
)
def test_qtextedit_functions(qtbot, pdf_writer):
"""Test functions mapping for QtWidgets.QTextEdit."""
assert QtWidgets.QTextEdit.setTab... |
91761d126d2915f5e4d281336edf33aa84ecfe72c972e71a4c9c96387aa2bab9 | Python | 10,211 | 295 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
import numpy as np
from sklearn.neighbors import NearestNeighbors
from uac import utils
# Create the parser
my_parser = argparse.ArgumentParser(description="Calculation of new atrial coordinates")
# Add the arguments
my_parser.add_argument("targ... |
c07b2620839e6b473d45c9b65e57aee84c4bf84b7a809fb188f8a75e612a0638 | Python | 10,213 | 294 | import scanpy as sc
import numpy as np
import pySingleCellNet as pySCN
import scanpy as sc
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse import issparse
from sklearn.decomposition import FastICA
import scanpy as sc
import numpy as np
import pandas as pd
from .utils import *
def train_rank_cl... |
f917cbfb42c18f6e62b0f9e4f835a8e79b6096d5bd70e77d3bfddc6a3841a6b3 | Python | 10,213 | 308 | from collections.abc import Sequence
from copy import deepcopy
from typing import TYPE_CHECKING, Any
import numpy as np
import pytest
from PIL import Image
from scipy.spatial.distance import cosine
from sklearn.metrics import mean_squared_error
from eir import train
from eir.train_utils.utils import seed_everything
f... |
761926ca0da9a079da805449a8739cd46909c29e7c69c87166f37856f05b3ac8 | Python | 10,215 | 274 | # This file is part of connectome-manipulator.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Blue Brain Project/EPFL
"""Module for building synaptic delay models"""
import os.path
import matplotlib.pyplot as plt
import numpy as np
import progressbar
from sklearn.linear_model import LinearRegression
f... |
ceec2c2cf1a77c502f365e83e2eabb480434d861f8453aab17618d2268010015 | Python | 10,216 | 270 | #!/usr/bin/env python
"""
The mosaic QGraphicsView. This is QGraphicsView in the mosaic
UI tab.
Hazen 10/18
Jeff 3/22
"""
import os
from PyQt5 import QtCore, QtGui, QtWidgets
#import storm_control.steve.qtMultifieldView as multiView
import storm_control.steve.coord as coord
import storm_control.steve.steveItems as st... |
31f8be1fd79b3f0e9cfccd099aeca80632d09e6b60f3bee03931f2970a1ad6d7 | Python | 10,218 | 252 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import argparse
from collections import defaultdict
from pathlib import Path
from typing import Any
import cv2
import numpy as np
from shapely.geometry import Polygon
from shapely.geometry.point import Point
from ... |
99a2591b93a53ed61497e312db482833a331f94e89b282439119e6c3f48578e6 | Python | 10,218 | 222 | """Step 3: functional connectivity (adjacency matrices), port of the
``generateAdjMs.m`` / ``adjM_thr_parallel.m`` portion of ``MEApipeline.m``.
Recordings are independent (each reads its own Step 1 spike ``.npz`` and writes
its own ``_adjM.npz``), so this step is a pure parallel map over recordings —
no cross-recordi... |
1c528db2721974d261242cb424b508f10e76cda8aa42f979dd6861ff71313878 | Python | 10,219 | 336 | from __future__ import annotations
import base64
import json
import os
import sys
from pathlib import Path
from typing import Final
import numpy as np
import pytest
from PySide6 import QtWidgets
from PySide6.QtCore import QTimer
from pytestqt.qtbot import QtBot
from labelme import _utils
from labelme._app import Mai... |
9046125ccde23b549759ff9c885ecc1e211884e124dd6af636895b2c94c5be72 | Python | 10,220 | 232 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 29 14:10:45 2021
@author: Yoshi
"""
import os
import shutil
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy import integrate
from PIL import ImageColor
def population_analysis(path,data,cell_flags,framerate_information,key,frequencies... |
2b4908bb8494cdd7ef27280a6c05960cca521bccdf674fcee0b1ff4bfd29a4c8 | Python | 10,221 | 263 | #!/usr/bin/env python
import os, numpy as np
from sklearn.linear_model import LinearRegression
from scipy.optimize import minimize
import trimesh, tempfile
from random import random
import src.pca_pycaster as pycaster
from numba import jit
# only for triangle difference regularization (compile cython code before):
# ... |
3fb084b64e9adc76e2724571490a73926f24ca46cd390cc906b034cd20fce0e2 | Python | 10,223 | 258 | import argparse
import logging
import os
import sys
import time
import numpy as np
import pandas as pd
from scipy.sparse import load_npz
# --- Function to load saved sparse k-mer results ---
# (Copied and slightly adapted from the main k-mer counting script)
logger = logging.getLogger(__name__)
def load_kmer_resu... |
56ea624e55afd0b62cfb5903adc67f993545d6eec461500764c1dc01f6c18fe0 | Python | 10,225 | 272 | """
Classes to support "quantum-DNA" files.
:Author: Bob Harris (rsharris@bx.psu.edu)
A quantum DNA sequence is a sequence of bytes, each representing a probability
distribution (vector) over A, C, G, T. The QdnaFile class encapsulates the
sequence of bytes, while the mapping from byte value to probability vector is... |
442bf2262051177c25bd9f72572c8238baacafeaaff576905cf26c79f755ccb8 | Python | 10,227 | 265 | '''
Created on Nov 7, 2022
@author: Yanay Rosen
'''
from collections import defaultdict
from typing import Dict, List, Optional, Tuple
import torch.utils.data as data
import torch
import numpy as np
import scanpy as sc
def data_to_torch_X(X):
if isinstance(X, sc.AnnData):
X = X.X
if not isinstance(... |
89ed80cdd1f434ca49484181cdcf61024d7ea7a97a3654aadb8970ba2823bc16 | Python | 10,230 | 304 | from __future__ import annotations
import json
from functools import partial
from pathlib import Path
from typing import Final
import pytest
from PySide6 import QtWidgets
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QMessageBox
from pytestqt.qtbot import QtBot
from ..conftest import close_or_pause
fro... |
37790a99ff75c2b4adf11d6227ddcfba862edaa160e9a224e179fe9596388a2e | Python | 10,231 | 258 | def align_conditions(Ya, Yb, info_a, info_b):
"""
Align two datasets based on shared conditions, align all conditions to the mean of shared conditions,
then average shared conditions and append unique conditions.
Args:
Ya (numpy array): Dataset A (subjects x conditions x voxels) or (conditions x vo... |
c3b826f1983b1513095b813fcab034f3f9baeef859480be728e4c99b675a6882 | Python | 10,236 | 238 | """Test the run-parameter summary shown in the report and the viewer.
Run from the repo root::
uv run python python/test_params_summary.py
``params.json`` is the authoritative record of how a result was produced, and is
unreadable as a flat object of ~140 keys in declaration order. The summary
groups it and mark... |
3e8c65488d94cdc30ec2cc94973e6f3e4ef1f263e6bd9f7bd90a3fedd845ae3c | Python | 10,239 | 263 | """
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... |
61d4a3e7d8436c37e9b88c9feaa2a1f71919cc8874f26d0f26c33028b29f3e3c | Python | 10,244 | 232 | import os
import cv2
import numpy as np
import torch
from PIL import Image
from torch.utils.data.dataset import Dataset
from utils import cvtColor, preprocess_input
import pdb
class DeeplabDataset(Dataset):
def __init__(self, annotation_lines, input_shape, num_classes, train, dataset_path):
super(Deeplab... |
c6fcc88ec9def0c06c21a09e07b97c1f7c74dc272a272f9fd9d7c4a619a90b39 | Python | 10,244 | 258 | """
All algorithms from the original skyline implementation are included below.
"""
import numpy as np
import pandas
import traceback
def tail_avg(timeseries, debug, debug_path):
"""
This is a utility function used to calculate the average of the last three
datapoints in the series as a measure, instead ... |
25df20fcc59008a6cbe3618e08763c7cf7d85bfbe13679686b9a7d8dc3b5a868 | Python | 10,249 | 265 | import os
import time
import copy
import argparse
import torch
import torchvision
from datetime import datetime
from torchvision import datasets, transforms, models
from torch.utils.data import DataLoader, random_split
import matplotlib.pyplot as plt
import seaborn as sns
from tensorboardX import SummaryWriter
import n... |
dcef5f99cb440823b7d39d732a41ee2d5751e4d949e8de376c247c66e0088278 | Python | 10,251 | 265 | """Step 3 diagnostic plots — probabilistic-thresholding stability check.
Port of ``significance_distribution_plots.m`` (the figure ``adjM_thr_checkreps.m``
saves as ``<recording><lag>msLagProbThreshCheck.png`` under
``3_EdgeThresholdingCheck``). Shows how the significance threshold stabilises as
the number of circular... |
752044128100bf9d603c9857ddde1af11b7897e6f408eb66e5c81acad7984406 | Python | 10,253 | 241 | from __future__ import annotations
import html
from collections.abc import Callable
import osam
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtWidgets
from .._ai_models import AI_TEXT_MODEL_OPTIONS
from .._ai_models import find_ai_assist_model_option
from .._model_manager import ModelMana... |
3e49dd90ec443d609936b70cca428d1b58df2ed0dfcdf1dd4b8307c9a908bbb9 | Python | 10,258 | 255 | """
DMC-BrainMap widget for padding .tif files to match atlas resolution.
2024 - FJ
"""
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.notificatio... |
6eadc30e86670afe92ddbceeb65eacc9b1b5e621b4f4af39d208c9f7ac3789bb | Python | 10,258 | 334 | '''
Reimplementations of rsa.math.* functions using torch.
'''
import torch
import numpy as np
from typing import Any, Union, Callable
def euclidean(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
'''
Compute N-d euclidean distances. Please always
supply features as the last dimension.
INPUTS:... |
7a23e8bc69fd4a318acee149ee0e0e8e5fdf36c0aa8f0ab1a3d8bb31e0a32f30 | Python | 10,258 | 253 | '''
Modified from https://raw.githubusercontent.com/pytorch/vision/v0.9.1/torchvision/models/shufflenetv2.py
BSD 3-Clause License
Copyright (c) Soumith Chintala 2016,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following condit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.