sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
30c090236c7344ab1cbdb501c41a31164a4f60ee1dc708edd4ee5df3b0e671f3 | Python | 16,028 | 269 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 11 14:33:06 2020
@author: jacobb
"""
import json
import numpy as np
import torch
import copy
from scipy.sparse.csgraph import shortest_path
# Functions for generating data that TEM trains on: sequences of [state,observation,action] tuples
class Wo... |
190311d996f9964a9f4302a41f43bd25f3b482516270e148df16f491b9d4fc9b | Python | 16,034 | 355 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
import torch
import torch.nn.functional as F
from torch import nn
from ultralytics.nn.modules.head import Detect
from ultralytics.utils.torch_utils import copy_attr
from .tasks import loa... |
e6f13c1b1c91c56d440f8f9e9063f30b6676f42cce927cd87b0db7126016f144 | Python | 16,041 | 370 | import os
import os.path as op
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.gridspec import GridSpec
import matplotlib.image as mpimg
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
import seaborn as sns
from eelbrain... |
965eb3616ecc6431458b732f46ccbdb90c28c0cff09e866eb90bc8a42539b9b9 | Python | 16,043 | 455 | #!/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
tmp=MEGnet.__path__[0]
class_table_path = op.join(tmp, 'prep_inputs... |
62d36000c3ef5ed108cdbd2975e613eaed79b379c8ad8b985f3c15092d515b38 | Python | 16,048 | 497 | """Plotting functionality based on VTK."""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import os
import warnings
from collections import defaultdict
import numpy as np
from numpy.lib.stride_tricks import as_strided
from vtk import vtkCommand
import vtk.qt as vtk_qt
from enigmatoo... |
3df8d85587596b812f09ab7d181c5fc07d1f492a8c632e918a4445e138172836 | Python | 16,049 | 328 | import sys
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.optim.lr_scheduler import StepLR
import pyro
import pyro.distributions as dist
from pyro.nn import PyroModule, PyroSample
import torch.nn as ... |
b9b7291ff0651ed834fb6a8a301b52db54e9cd1225647a3f6aa693d4f695a3d9 | Python | 16,053 | 325 |
import pandas as pd
import numpy as np
from pathlib import Path
from typing import List, Dict, Union, Tuple
from bg_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 split_string... |
c677efc0fe66a17a22babb1af4aafe3767ce390dc8fd17d7d84780652065ecc0 | Python | 16,053 | 425 | import numpy as np
from scipy.signal import find_peaks, savgol_filter
def get_isin_threshold(spike_times: np.ndarray, n: int = 10) -> float:
"""Calculate the automatic ISIn threshold using Bakkum's method.
spike_times: 1D array of spike times in seconds.
n: The number of spikes to consider for ISI_N.... |
eb42c580625d24d7426e3d0be2563dabc001a28084d3b9055f03569a1260fb17 | Python | 16,057 | 396 | import copy
import warnings
from typing import Any, Dict, Optional
import torch
from torch.nn import Module, ModuleDict, ModuleList, Sequential
try:
from torch.fx import Graph, GraphModule, Node
except (ImportError, ModuleNotFoundError, AttributeError):
GraphModule, Graph, Node = 'GraphModule', 'Graph', 'Node... |
219a8116a649ee2ff3dc916933556ff5b8d7fede5cf73ae06b51ff46dd496254 | Python | 16,060 | 416 | import scanpy as sc
import pandas as pd
import numpy as np
import rpy2.robjects as robjects
from rpy2.robjects import pandas2ri, numpy2ri, Formula
from rpy2.robjects.packages import importr
from rpy2.robjects.conversion import localconverter
from statsmodels.stats.multitest import multipletests
from joblib import Paral... |
ff392b240021a37bb2d7f105e669bab81d638c155a1b00a8192e60f7a4f72c7a | Python | 16,068 | 378 | import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
# -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for DeepInteract (https://github.com/BioinfoMachineLearning/DeepInteract... |
2d5e6773b56f308d28ab3bfdee31622ebe29bca18feb7ebab94b270a9e3667e6 | Python | 16,069 | 314 | # # predict something from one multi-modal nifti images
# Tested with Python 3.7, Tensorflow 2.7
# @author : Philippe Boutinaud - Fealinx
# modified by Youjie Wang, 2025-01-09
import os
import subprocess
import nibabel as nib
import numpy as np
import gc
import time
from pathlib import Path
#import tensorflow as tf
f... |
2b74edc087d99006326a5da900cfd65a6fff55ebc934d594fe2529dbcb8275cb | Python | 16,072 | 447 | from __future__ import division
from __future__ import print_function
import math
import numpy as np
import csv
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function
from torch.nn import Linear
from torch_geometric.nn import GCNConv, GATConv, APPNP
from torch_geometri... |
aa35009677393482f0280be7f6f240f82607426c2a468883c6a8c5bbffac6c15 | Python | 16,072 | 427 | """End-to-end smoke tests for the Streamlit app using st.testing.
These run the real app script (navigation, first-run setup, chat page)
in-process without a browser. Provider credentials and config paths are
isolated so results do not depend on the developer's environment.
"""
from pathlib import Path
import pytest... |
1fec2583d86d93af1bebe910e4b170e6f495190f5513477b2b3c4118fc214ceb | Python | 16,073 | 384 | import argparse
import os
import time
import glob
from datetime import datetime
from data import load_data, extract_edge_indices, create_atom_features, prepare_data_for_training, get_base_feature_dimension
from models import GSR, GSRAlternative
from training import train_lipophilicity_model
from visualization.gif_gene... |
1fbe765f39b1e91221d5e3537cbb0ef92991d2df8c1e0e8cca97909df8d4efa2 | Python | 16,077 | 423 | import sys
import os
import pandas as pd
import numpy as np
import pyreadr
import torch
import glob
import functools
from sklearn.metrics import confusion_matrix
from torch_geometric.loader import DataLoader
import torch.nn.functional as F
from torch.nn import Linear
from torch_geometric.nn import GCNConv
from torch_ge... |
ae75db2a6d9f0441a67f632bc7c63ce754faa9ce88f15e93228460ffcb619dc2 | Python | 16,077 | 492 | import multiprocessing
from collections.abc import Callable
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING
import torch
import torch.multiprocessing
from eir.models.models_utils import log_model, prepare_example_batch_for_torchview
from eir.train_utils.accelerator import s... |
49789a424127b59a415bca03da02675c967aec3a32ce7ffd0aa8c765cbd9988e | Python | 16,079 | 480 | #! /usr/bin/env python
# Copyright 2018 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
"""
Use this script to evaluate ... |
b624bade86ea9cf7f8bceef99c7c1b7951caf6cc2095d998f6a52e62d25560c2 | Python | 16,081 | 431 | from collections import OrderedDict, namedtuple
from pprint import pformat
from .utils import gitlog, set_seed
from . import logger as log
import datajoint as dj
from .utils import set_seed
from .configs import NetworkConfig, Seed, TrainConfig
import torch
from neuro_data.static_images.configs import DataConfig
from ne... |
5d89fefd106cd955a213ea29ddf4d84b86990e6d0ab43be18c868dbb3dfdebb4 | Python | 16,087 | 450 | import logging
import os.path as op
from time import time
import immlib
import nibabel as nib
import numpy as np
import pandas as pd
import AFQ.utils.streamlines as aus
import AFQ.utils.volume as auv
from AFQ._fixes import gaussian_weights
from AFQ.recognition.recognize import recognize
from AFQ.tasks.decorators impo... |
9495df44439375c88337ccfc33fb568ebc4bf238b87e808a1fb56448238bcba2 | Python | 16,087 | 377 | import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
# -------------------------------------------------------------------------------------------------------------------------------------
# Following code adapted from Graph-Based Protein Design (https://github.com/jingraham/neurips19-... |
e6e78370b543cee80c3ec2275d9eda5931b57d4c9c6907de682da846c4bf1c3b | Python | 16,089 | 587 | from collections.abc import Callable, Sequence
from pathlib import Path
from typing import Literal
import torch.backends
import torch.cuda
from eir.setup.config_setup_modules.config_setup_utils import recursive_dict_inject
from tests.conftest import get_system_info
def get_test_base_global_init(
allow_cuda: boo... |
5e70026f67eb5fb1782c1995243103a3b3df9cb14f690e248adccb23de49c506 | Python | 16,092 | 415 | """Hermetic tests for the OCSR core helpers.
No network and no model loads: everything here runs from RDKit alone. Mirrors
``tests/test_docking_tools.py``, which is likewise hermetic by default.
Several of these pin behaviour that is silent when broken. Those are marked in the test
docstring with the consequence, bec... |
9251493920fcdd966ed43e6ac7863627ccbcd32de3fb96040a031a56d8768df9 | Python | 16,094 | 410 | #!/usr/bin/env python3
# general imports
import numpy as np
import sys
import matplotlib.pyplot as plt
from tqdm import tqdm
import time
# torch imports
import torch
import torch.nn as nn
# PyTorch TensorBoard support
from torch.utils.tensorboard import SummaryWriter
from datetime import datetime
# utils imports
fr... |
27e2241e3c6fa470a55551a2b8ee1e4da7875bde9812fbee52fd208690467a3d | Python | 16,095 | 389 | # -*- coding: utf-8 -*-
import itertools
import logging
import os
import numpy as np
from dipy.io.stateful_tractogram import StatefulTractogram
from dipy.tracking.streamlinespeed import length
from nibabel.streamlines import ArraySequence
from scilpy.io.hdf5 import construct_hdf5_group_from_streamlines
from scilpy.io... |
f8c86af90f4ce26c476628d1d2df292845c761f566ee2545b0eb7103506d8fd8 | Python | 16,097 | 519 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 19 11:42:52 2015
Test Transformation with Elastix - Points vs Data
Notes:
- Elastix provides transform T: fixed -> moving
- for alignment use fixed = data and moving = atlas / reference
- result.mdh in elastix directory is T^(-1) moving, i.e. has size of fixed image
- r... |
5300369974b65d9d99340b3acf208d4c46939e7a54283b1fb18caae17598d2a4 | Python | 16,106 | 424 | """Pytorch Densenet implementation w/ tweaks
This file is a copy of https://github.com/pytorch/vision 'densenet.py' (BSD-3-Clause) with
fixed kwargs passthrough and addition of dynamic global avg/max pool.
"""
import re
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional a... |
624802c294d755bb3861daab554c6fb576a76c84202bea45cd6bf252238b8a26 | Python | 16,116 | 406 | # Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import base64
from allauth.account.forms import default_token_generator
from allauth.account.models import EmailAddress
from allauth.account.utils import user_pk_to_url_str
from allauth.account.views import... |
51d17c24e7a1d1a43574da8ade8fd05808c76528f770ab00dff67b2eab14f961 | Python | 16,117 | 363 | import numpy as np
import pandas as pd
import json
import os
import networkx as nx
import pickle as pkl
from textblob import TextBlob
from collections import Counter
import matplotlib.pyplot as plt
import random
path = r'E:\毕业论文\数据集\美国大选1225\processed.csv'
'''情感抽取'''
# path2 = r'E:\毕业论文\数据集\美国大选1225\mgdx_st.txt'
# d... |
cb9cd51bdf1e21cd538ac04a416e1f18856b06a9693049a9c9566a9bfab4d9db | Python | 16,125 | 388 | #!/usr/bin/env python
import argparse
from platform import release
import sys
import ftplib
import re
import os
import gzip
import io
ercc_fasta=os.path.abspath(os.path.join(os.path.dirname(__file__), "ERCC92_polyAstrip.fa"))
# Prints to stderr
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)... |
fb6cc55b2fe7b49f94fa4eace63076cefa276b1b4b15472d484e6e76cd64d3d6 | Python | 16,125 | 428 | import numpy as np
import pytest
from nelpy import estimators as estimators
class TestRateMap:
"""Test the RateMap class."""
def test_ratemap_initialization(self):
"""Test RateMap initialization"""
rm = estimators.RateMap()
assert rm.connectivity == "continuous"
assert not rm... |
bfc4d8759d4c41e43dd7f628071d2ff5e3de2417c4e26e9d852d68c7ff6081e8 | Python | 16,142 | 409 | import hashlib
import json
import logging
import os
from functools import partial
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Iterable, Optional, Union
import torch
from torch.hub import HASH_REGEX, download_url_to_file, urlparse
try:
from torch.hub import get_dir
except Im... |
b41b16fc5de1ae53a9173a3f1ead1f238c1eb6b4efe8138ad11c44e06729c2d9 | Python | 16,159 | 451 | import pandas as pd
import numpy as np
from rdkit import Chem
from rdkit.Chem import rdMolDescriptors, AllChem, rdPartialCharges
import torch
from torch_geometric.data import Data
def load_data(csv_file, additional_features_files=None):
"""
Load data from CSV file and additional feature files.
Parame... |
04b60a1055e4b0a5b8056032ecdfaec82fd87ef87a659dd4d58bd28b4d7b3efa | Python | 16,166 | 518 | # Copyright (C) 2021-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
import hashlib
import io
import mimetypes
import os
import re
import struct
from collections.abc import Callable, Iterable, Sequence
from enum import Enum
from pathlib import Path, PurePath
from random import shuffle
from typing import IO, Li... |
ada8898aff01b8f988138185140faa9cd452826ce1946d8e4400c25af804b251 | Python | 16,166 | 481 | # 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.
#
### ### ### ### ###... |
b8c1305e21c8230ec34e3a6860abf495cda72230bd4fd04ba11000153a7f000b | Python | 16,166 | 262 | if __name__ == '__main__':
import argparse
import torch
from training_functions import train_model, test_model, seed_everything, ECGTrainer
from ecg_utils import get_dataloaders, load_label_mappings
from backbones import (
resnet1d18, resnet1d34, resnet1d50, resnet1d101, resnet1d152,
... |
b81680d72f9a72b026f657c16faf6991f021a4ad64375919c222636318d2bced | Python | 16,167 | 337 | #import base trainer so I can inherit from it
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
#import custom transform
# from batchgeneratorsv2.transforms.custom.missing_modality_transform import MissingModalityTransform
from batchgeneratorsv2.transforms.custom.missing_modality_transform_per_i... |
8fe5494ecb4edf02ab7f0e2c70d1d86d1198546a81ab0a228575ec03d8ea0cf2 | Python | 16,173 | 437 | import logging
import numpy as np
import pandas as pd
import scipy.linalg as lin
from itertools import chain, combinations
from numpy.linalg import multi_dot as mdot
import pyfocus as pf
__all__ = ["fine_map"]
def add_credible_set(df, credible_set=0.9):
"""
Compute the credible gene set and add it to the d... |
1f26ea4df6d31d996859f731bfb8929683041217dd295fd612cab1368f423392 | Python | 16,186 | 377 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute label image (Nifti) from bundle(s) and centroid(s).
Each voxel will have a label that represents its position along the bundle.
The number of labels will be the same as the centroid's number of points,
unless specified otherwise.
# Single bundle case
This s... |
8d491c06f92e4de637e423ceaa1292b79b7a05d9b727e91cd10615235ec2239e | Python | 16,187 | 397 | import torch.nn as nn
import torch
from torch import Tensor
from typing import List, Tuple, Optional
from bism.modules.convnext_block import Block2D, Block3D
from bism.modules.layer_norm import LayerNorm
from bism.modules.concat import ConcatConv2D, ConcatConv3D
from bism.modules.upsample_layer import UpSampleLayer3D,... |
4f15f6fa226edaffff1c84e044664a60bbd513703dc2928b4814f04da04e48a5 | Python | 16,190 | 431 |
###############################################################################
#################### Boilerplate ########################
###############################################################################
import pandas as pd
import matplotlib.pyplot as plt
import os
import matplotl... |
92dd03ee6607c9b75980f3951528dadcc4b645d7d17412e0f0fdce2ae96408aa | Python | 16,190 | 477 | """Plot results from TDC Leaderboard and TDC Single-Task and Multi-Task."""
from collections import defaultdict
from pathlib import Path
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
FIGSIZE = (14, 10)
matplotlib.rcParams["font.size"] = 18
plt.rcParams... |
8743e485cc61ff6ba4c4e8f7df432ac9f52f2e56bb62ab81e476b6da465b99d5 | Python | 16,193 | 449 | """
MNE Sample Data: Bilateral Beamformer
=====================================
This tutorial performs an 'OSL-style' source reconstruction of the publicly
available `MNE sample dataset
<https://mne.tools/stable/documentation/datasets.html#sample>`_, going from the
raw sensor recording to parcellated source-space time... |
b40e6be2d82bf006a58d368ed7c185d9c853572b87981141650ad2f8999d76c8 | Python | 16,195 | 426 | '''
List of default values and description of the tracker parameters.
'''
from tierpsy import DFLT_SPLITFOV_PARAMS_FILES
from .docs_analysis_points import valid_analysis_types, dlft_analysis_type
from .helper import repack_dflt_list
dflt_param_list = [
('analysis_type',
dlft_analysis_type,
'Fla... |
aa968e364521f16ea3afdd34bd9649ec970de11df23fb0ff509b78ea8f53b15e | Python | 16,205 | 464 | #!/usr/bin/env python
import sys
import importlib
import time
import itertools
import os
import pdb
import copy
import numpy as np
from scipy import io
from skimage.metrics import structural_similarity as ssim_func
from scipy.interpolate import RegularGridInterpolator as rgi
import cv2
import torch
import open3d as ... |
c57f42e9cdcae6858072333281e0ce771bf59b390ff1e3e275e7a1b0b683bbec | Python | 16,207 | 350 | from typing import Any, Callable, Iterator, List, Optional, Tuple, Union
import torch
from torch import Tensor
from torch_geometric.data import Data, FeatureStore, GraphStore, HeteroData
from torch_geometric.loader.base import DataLoaderIterator
from torch_geometric.loader.mixin import (
AffinityMixin,
LogMem... |
0e6fa318096dca1bbdbe37144bc5bbc202ec07679952202c792947f1140c7228 | Python | 16,214 | 459 | from math import pi
import numpy as np
import pytest
import nelpy as nel
from nelpy.core._analogsignalarray import (
AnalogSignalArray,
PositionArray,
RegularlySampledAnalogSignalArray,
)
def _reference_restrict_analog(data, abscissa_vals, intervals):
indices = np.column_stack(
(
... |
64d08c7d63f3f5437fa704e94df980724f3fedf0dff1e9802a48c1cb6e9c2f5a | Python | 16,214 | 314 | import multiprocessing
import queue
from torch.multiprocessing import Event, Process, Queue, Manager
from time import sleep
from typing import Union, List
import numpy as np
import torch
from batchgenerators.dataloading.data_loader import DataLoader
from nnunetv2.preprocessing.preprocessors.default_preprocessor impo... |
dbd16c078f247be47f8eabfd2ff086d08ae43fda8564983946983fd2a13f01ba | Python | 16,216 | 390 | import numpy as np
from numpy.linalg import inv,eig,eigh
import PcmPy as pcm
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
from numpy import sqrt
import os
from matplotlib import gridspec
import scipy.linalg as la
instr_code = 90 # Instruction condition code
def make_design_matrix_simple(re... |
48d52e83ab8ad15cd97402d7937acd2128383dc721b012bad133e7b2bf7fac8c | Python | 16,225 | 400 | """Tests for histo_miner.tissue_analyser.
Covers the functions that produce the published feature set: cell counting,
per-class counts inside the tumour mask, cell-to-cell distances, and the
`hvn_outputproperties` aggregation that assembles the final feature dictionary.
Two groups are skipped at the bottom:
* `cell... |
e730f22dce7224e0d78cdce907ec3dbe03377add0c7754da5f9a118843bc896a | Python | 16,236 | 485 | """
Classes/functions for building machine learning pipelines,
performing hyperparameter tuning, and evaluating model performance.
"""
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
from tqdm.auto import tqdm
from sklearn.base import clone
from sklearn.pipeline import Pipeline
from sklearn.... |
dc61e2aed427c46fd0c778f331ab0bb17e5d3af5ad98da904af2b4440628c207 | Python | 16,238 | 330 | import os
import re
import glob
import subprocess
import nibabel as nib
import numpy as np
import pandas as pd
from nipype.interfaces.freesurfer import ReconAll
from nipype import Node, Workflow
from nipype.interfaces.utility import IdentityInterface
from cvdproc.pipelines.multi.arts.arts_nipype import ARTSFast, ARTS... |
7a2b51848837c0419e2664574f62454bdac78973bbe5fdcb162c0bbc6f0fef09 | Python | 16,255 | 432 | # -*- coding: utf-8 -*-
"""
NNMF justification
"""
import scanpy as sc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
import warnings; warnings.simplefilter('ignore')
from scipy.stats import mstats, kstest, ttest_ind, fisher_exact
import csv
import math
from... |
29e283a05cfd678e15dab62c560e18259e34210ba319893caa22946acb9f79ac | Python | 16,260 | 469 | from collections.abc import Iterable, Sequence
from pathlib import Path
import pandas as pd
import pytest
from eir import train
from eir.train_utils.utils import seed_everything
from tests.conftest import should_skip_in_gha, should_skip_in_gha_macos
from tests.setup_tests.setup_modelling_test_data.setup_sequence_test... |
2bef898984f9d91068e99fa48d400ca8674656896bedcd29bd8706f333a5672e | Python | 16,261 | 337 | #This program reads in EPSP traces from plasticity experiments, both before and after plasticity induction
#extracts series resistance, membrane potential, PSP amplitude, for a single experiment
#input is data and exp# for a single experiment, for example "12-Jun-2014_SLH006", with traces in that subdirectory
#input ar... |
17cd21e8d5e5418ad6e7f1ddeaeccc477d003544bb39cd5632a63def2d2fbd9b | Python | 16,265 | 425 | import numpy as np
import pandas as pd
from pathlib import Path
from time import time
from tqdm import tqdm
import nltk
from nltk import word_tokenize
from collections import defaultdict
import torch
import torch.multiprocessing as mp
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--dataset", ... |
b0ab28e6f4483a36b9a611cc0de40c43b32e4a7aefd491abb62c3dd6f4a5abf4 | Python | 16,266 | 383 | #!/usr/bin/env python3
"""Generate a side-by-side MATLAB-vs-Python plot parity report for MEA-NAP.
Walks a MATLAB output tree and a Python output tree, pairs the plots each
pipeline produced (handling the two pipelines' different file/folder naming
conventions), and emits a single self-contained HTML report that shows... |
2022e5e8da45f2d39f4dcd61751f11aa6b4f566f66967a102772808db79c1cb8 | Python | 16,270 | 338 | """Usage printing uses counters only, with no additional model requests."""
import io
import gc
import weakref
from asyncio import CancelledError
import pytest
from rich.console import Console
from langchain_core.language_models.fake_chat_models import FakeMessagesListChatModel
from langgraph.graph import StateGraph,... |
36d3bcacf8d0bb9c5dd389bfb4ce909a6f5ef184e1e8c6ff2bf5d38f961076a6 | Python | 16,270 | 422 | #!/usr/bin/env python3
# general imports
import numpy as np
import sys
import matplotlib.pyplot as plt
from tqdm import tqdm
import time
# torch imports
import torch
import torch.nn as nn
# PyTorch TensorBoard support
from torch.utils.tensorboard import SummaryWriter
from datetime import datetime
# utils imports
fr... |
ea582d1339ca6db58a41ceeaf97a7a4f41699b2cfb2bccf6279b56a32b06c695 | Python | 16,275 | 420 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#!/usr/bin/env python
# coding: utf-8
"""
AGED Core Module
Main deconvolution pipeline with probabilistic initialization
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import pandas as pd
from typing import Tuple, Optional, D... |
af9f53d1db53eee53b31b107ba585e57f1ca585621c534f1d08bffe2c489b8c1 | Python | 16,278 | 391 | import sys
import torch.nn as nn
import torch
from torch import Tensor
import numpy as np
import torch.nn.functional as F
from torch.autograd import Variable
def get_arry(branch, inputlen, outputlen, replace=False):
mask = np.zeros([branch * outputlen, inputlen])
section_size = int(inputlen / branch)
# pri... |
ce972b086dcf2a91b07d8ed23bc78adab0a6de9edb34318b0c4c8e294de30697 | Python | 16,293 | 443 | # data_processing.py
import pandas as pd
import numpy as np
from rdkit import Chem
import scipy.sparse
def msp_to_dataframe_with_smiles(msp_file):
"""
Convert an MSP file with SMILES to a pandas DataFrame.
"""
data = {"smile": [], "Precursor": [], "Adduct": [], "spectra": []}
with open(msp_file, '... |
e7964ae60ec30accbe71a9a90e8076c114097ee62cccd78fd7c20519b63ebe46 | Python | 16,293 | 508 | # -*- coding: utf-8 -*-
"""Mask brain."""
import os
import shutil as sh
import nibabel as nb
import numpy as np
from scipy.ndimage import (
binary_dilation,
binary_erosion,
binary_fill_holes,
gaussian_filter,
)
from .. import execute_command
from ..io.filename import get_filename
from ..io.vol import... |
520006ad438b36d0272d9a3f542694884579db80a0893f8ba657c147776a019d | Python | 16,294 | 329 | import os.path
import unittest
import tests.base_test
import tests.output_parser as output_parser
import tests.test_config
import tests.util
class MutuallyExclusiveExonsNovelBaseTest(tests.base_test.BaseTest):
def setUp(self):
super().setUp()
self._test_base_dir = tests.test_config.TEST_BASE_DIR... |
0d746f68c3a72b300585ff321a0e913028766bf7be33abafd331c5c8614ba935 | Python | 16,296 | 366 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Kathrin Rack, Lena Ploetzke, Martin J. Kuehn
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exc... |
b232e1a7ecfbb342cb643dc826da7f9d2303c69254a3ce86f7edbb2bc2508cef | Python | 16,296 | 366 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Kathrin Rack, Lena Ploetzke, Martin J. Kuehn
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exc... |
64dd9b2aaa34609a114b02a3f2c1b1663a8a95611c7b5449374b7c867d0304d1 | Python | 16,297 | 528 | import io
import sys
import time
import zlib
import queue
import typing
import struct
import pathlib
import argparse
import threading
import traceback
import subprocess
import collections
from pprint import pprint
from multiprocessing.pool import ThreadPool, AsyncResult
from thalamus.thalamus_pb2 import StorageRecord,... |
9902f509ba2ca5792fcbacb25a538b9e5a2f0826a147f7548c7bae983ae28823 | Python | 16,306 | 511 | """
Cam-CAN: MEG Batch Processing
=============================
This tutorial shows how to process a large MEG dataset in batch using
osl-dynamics' parallel processing utilities. We use the
`Cam-CAN dataset <https://opendata.mrc-cbu.cam.ac.uk/projects/camcan/>`_
as an example.
The pipeline mirrors the single-session ... |
d037d7e38c1dd6183a1e3ce8b46e1d82dedf359462fb99f2c144cd22fcb28ecd | Python | 16,308 | 583 | """
Basic functions on surface meshes.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import warnings
from itertools import combinations
import scipy.sparse as ssp
from scipy.spatial.distance import cdist
from scipy.sparse import csgraph as csg
import numpy as np
from vtk import (... |
8acf0aa89420c33eb91c14c6adcf9c61c2c996ac8585554d08fb6f8b0751cfb7 | Python | 16,309 | 286 | """A module that contains the abstract base class for all processors, :py:class:`~corelay.processor.base.Processor`, as well as a basic processor,
:py:class:`~corelay.processor.base.FunctionProcessor`, which invokes a specified function. Furthermore, the module contains a function, which ensures
that a specified argume... |
3af062ab7139ff2e5c23d35fb90479bb06dc94e7eef0772ad3ca977934ef375d | Python | 16,312 | 401 | """Pure-Python OCSR helpers (no LangChain / MCP decorators).
Optical Chemical Structure Recognition: read a molecule's 2D structure diagram from
an image and return its SMILES. Used by the LangChain ``@tool`` wrappers in
:mod:`chemgraph.tools.ocsr_tools`.
Everything here is pure: image sniffing and loading, pulling a... |
623a7bf279d3b898aca10037890e6e31d9f942297ee87ca6a3fa85efc84573de | Python | 16,315 | 425 | # -*- coding: utf-8 -*-
# @Author : LG
import functools
import re
from PyQt5 import QtCore, QtWidgets
from ISAT.ui.anno_dock import Ui_Form
from ISAT.widgets.polygon import OBB, Polygon
class AnnosDockWidget(QtWidgets.QWidget, Ui_Form):
"""
Annotations dock widget.
Attributes:
mainwindow (ISA... |
739742283aa418a18a6262d850445af38fd7933677dfc46a8817ac2ea342fbf0 | Python | 16,318 | 301 | # Copyright 2020 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 of the License at
#
# http://w... |
0b748ff44546562b33ce48b5fa0a3d661990df8dabc537c58b8a959a4e5614d2 | Python | 16,329 | 405 | import os
import subprocess as sp
from unittest import mock, TestCase
from unittest.mock import call
from unittest.mock import ANY
import anndata
import numpy as np
import pandas as pd
import kb_python.utils as utils
from kb_python.config import UnsupportedOSError
from tests.mixins import TestMixin
@utils.restore_c... |
9e613968a8c47b367556eb999537a938eb27de2c8f19d3d58f8e7b4dc14bf77f | Python | 16,332 | 447 | import itertools
import numpy as np
from matplotlib.axes import Axes
from scipy.ndimage import gaussian_filter1d
from tqdm import tqdm
from typing import NamedTuple
from typing_extensions import Self
from argclz import AbstractParser, argument, int_tuple_type
from neuralib.io import csv_header
from neuralib.plot impor... |
b2afeb33953d683764d960285f6e6d8cf17501318ec63847445a0d1bb6d0873d | Python | 16,336 | 540 | """visualization.py."""
from collections.abc import Callable
from math import ceil
from typing import TypeAlias
import matplotlib.pyplot as plt
import numpy as np
import numpy.typing as npt
from matplotlib.figure import Figure
from PIL import Image
from splotch.dataclasses import SplotchInputData, SplotchResult
# r... |
ddc203cc1cc34aff02969a97e95e6dcca06ee5f04fdd81c6f55690792afc2fe0 | Python | 16,337 | 347 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy3 Experiment Builder (v2021.2.3),
on Juli 27, 2022, at 13:40
If you publish work using this script the most relevant publication is:
Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv... |
cdbb92ad6c74f46051dcb370e4d317be719219d848eab11a80cb24030c6b2065 | Python | 16,339 | 402 | ###########################################################################################################################
### Script to extract the time series of avalanches in cell assemblies and the whole population from spike raster data, ###
### and to compute the likelihoods of avalanche oc... |
a0a8466a9064c0092fe12a161bfa038037b401a6663c0855125847d5abb939ee | Python | 16,342 | 468 | from __future__ import annotations
import base64
import io
import json
import math
import os
import stat
import time
import typing
from dataclasses import dataclass
from pathlib import Path
from pathlib import PureWindowsPath
from typing import Any
from typing import Final
from typing import cast
import numpy as np
i... |
02527258dccb0a89a0fdf9032f5f48e982aadc60efee0cdd3792c3f4b0417f6f | Python | 16,343 | 402 | ###########################################################################################################################
### Script to extract the time series of avalanches in cell assemblies and the whole population from spike raster data, ###
### and to compute the likelihoods of avalanche oc... |
b770b8bbab42ffe1d1078c251e83d20a4de563b7d2dc62be325c8fbf5943ff80 | Python | 16,343 | 518 | from collections.abc import Sequence
from copy import deepcopy
from functools import partial
from pathlib import Path
import pandas as pd
from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save
from docs.doc_modules.serve_experiments_utils import copy_inputs, load_data_for_serve
from docs... |
923bc97e964ef89ef4c5b8f1605bb9b8010f268531f59233db07750ed5364b32 | Python | 16,344 | 372 | """Interactive stimulation-detection preview.
Python port of MATLAB's ``stimDetectionApp`` (driven by ``runStimDetectionApp.m``):
pick a raw recording + detection method + params, run detection, and inspect the
result before committing to a full pipeline run — a selected-channel voltage
trace with detected stim marked... |
88a2ca1756f0356c2df7f73fb278dc207270c65c87d6614067dd5ddfebd81ad4 | Python | 16,356 | 615 | # 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... |
d3ba3ce2c6610b1d67a6f5370f3fdd2999cd068df1feed73c0082aea9feb601e | Python | 16,360 | 385 | import pickle
import numpy as np
import sklearn.base
from matplotlib.figure import figaspect
from sklearn.linear_model import LogisticRegression
from sklearn.dummy import DummyClassifier
from dataclasses import dataclass
from sklearn.preprocessing import StandardScaler
from . import network
from tqdm import tqdm
from... |
78b5cfd1ebbd5e7c006d91321543d9732f499ea50d9be936fbf3ae4e51d5e7f1 | Python | 16,369 | 463 | # 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... |
e33325b033c39fcd6006cf6ad9a7f33fff29e0411db5f275ea5feb37e5441556 | Python | 16,373 | 418 | """Session driver for the checkpointed ChemGraph supervisor graph."""
from __future__ import annotations
import logging
import uuid
from collections.abc import Mapping
from dataclasses import dataclass, replace
from typing import Any, Literal
from langchain_core.messages import HumanMessage
from langgraph.errors imp... |
965dd58e9dee7c8a8315e41e41387d07a29a9075099e98273153a4805078c2e0 | Python | 16,375 | 394 | import numpy as np
from scipy.optimize import least_squares, differential_evolution
from dipy.reconst.base import ReconstModel
from dipy.reconst.multi_voxel import multi_voxel_fit
from dipy.utils.optpkg import optional_package
cvxpy, have_cvxpy, _ = optional_package("cvxpy")
class IvimModelVP(ReconstModel):
... |
d77d2e56a06b9f0ac91bbb4a2647b5ab4f2f52128167fbbaf5069521ee9f21a1 | Python | 16,376 | 331 | """
(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
... |
2da6c4e29ca68ca2040d89580e852f160890b2647ffc341f3f3ce6495c3a2d4f | Python | 16,379 | 376 | ######################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors:
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain... |
e5f4337203ebb68761426076395a9fe9f7358f0c3bb490d6bb1523474bfc4f39 | Python | 16,385 | 369 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from typing import Any
import torch
import torch.nn.functional as F
from torch import nn
from ultralytics.utils.loss import FocalLoss, VarifocalLoss
from ultralytics.utils.metrics import bbox_iou
from .ops import... |
1c92a726fd0c8e1ff0ce4806ea02da19fadb4de48c40e1a617d19747dcd0adf1 | Python | 16,394 | 329 | #
# fiberprofile/analysis/fiber_axis.py (from FiberProfileAnalysis/compute_fiber_axis.py)
#
# 1D curved-line axis of a fiber tract: the fiber points are binned by arc length, the coordinates are averaged
# within each bin, and the averaged points are written as a single polyline ordered by arc length with the bi... |
51c0989005b983bf823680238e414cdaae4e3bdd1465e56c5a8070c3a92c049e | Python | 16,399 | 338 | #Lucas Sancéré -
import glob
import itertools
import json
import os
import numpy as np
from scipy.io import loadmat
from skimage.measure import regionprops
from tqdm import tqdm
##### HOVERNET OUTPUT CONVERSIONS AND PROCESSING
def replacestring_json(file: str,
string2replace: str,
... |
0302631352a7bcfcbae89b0cf37e714c3e294a232747ef9767c23c055d0a7195 | Python | 16,408 | 361 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Implementation of the fibertube tracking environment using the
architecture of scil_local_tracking_dev.
Contrary to traditional white matter fiber tractography, fibertube
tractography does not rely on a discretized grid of fODFs or peaks. It
directly tracks and recon... |
3e8d5a4464a41a228110e145a0fd973f8947a8e84d7aa459a4a35049f3d9c64f | Python | 16,408 | 463 | from pathlib import Path
import pandas as pd
from tqdm import tqdm
from transformers import RobertaTokenizer, RobertaModel
import torch
import numpy as np
import os
from torch_geometric.data import Data, HeteroData
import json
from torch.utils.data import Dataset,DataLoader
class training_data(Dataset):
def __in... |
0b2703a7a4c0770302f75d567269f174a9b3acd152064bcbf6dadc7e8706c81e | Python | 16,412 | 319 | from nipype import Node, Workflow
from nipype.interfaces import fsl
from nipype.interfaces.base import CommandLineInputSpec, File, TraitedSpec, CommandLine
from nipype.interfaces.utility import IdentityInterface
from traits.api import Bool, Str, Either
import os
#####################################
# Synthmorph Nonli... |
7bc4b40c704a9eebfe632da10a03a941350b6e1d7576ae595b45818081d3f13a | Python | 16,417 | 352 | #!/usr/bin/env python
"""
split bam file into .shrt.bam and .long.bam
Created by Rongxin Fang
Modified by Armen Abnousi
"""
import sys
import pysam
import collections
from itertools import islice
from itertools import combinations
import pybedtools
import time
import os
import subprocess
import glob
import logger
de... |
fb8b880084a079fd42856c636e36513fdd009687484991a4ce48401f73044680 | Python | 16,419 | 371 | """Test that a run never silently overwrites an earlier one.
Run from the repo root::
uv run python python/test_output_collision.py
The default output folder name is today's date, so two runs in one day collide
without the user having done anything unusual — and the loss is total: figures,
CSVs and the express b... |
6321629f1b2bcf9910ee77e37e6ba74ad8e8f179650159f8eba5b877088f2b34 | Python | 16,420 | 507 | import argparse
import types
from collections import Counter
from collections.abc import Generator, Iterable, Mapping, Sequence
from copy import copy
from dataclasses import dataclass, field
from pathlib import Path
from typing import (
Any,
Literal,
)
import configargparse
import yaml
from eir.models.fusion.... |
6f82f389afe04437bcb5fb2129a33a1fbc02874a7c4034532249e58e048c01f5 | Python | 16,422 | 396 | """Deterministic end-to-end rebuild of the LAION-fMRI Brain-Score assemblies.
Given:
- a configured `laion-fmri` data directory (`laion-fmri config --data-dir <path>`)
- signed Data Use Agreement (`LAION_FMRI_REQUEST_ID` env var or
`laion-fmri request-access` cache)
This script reproduces every artifact the b... |
9e0b511f92a4f8e9c00fdadd31368f7db2118400b9446329dedd11a0b461447d | Python | 16,423 | 512 | from collections.abc import Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Union
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from aislib.misc_utils import ensure_path_exists
from sklearn.preprocessing import LabelEncoder
from eir.experiment_io.labe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.