sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
15bc8d9917d0cd2deba87f7116061914a0ec3e642bc4f782d8edfdee468b37bb | Python | 9,353 | 259 | """ Test whether the NestML implementation of SL-STDP synapse follows Python implementation. """
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import nest
from test_utils import generate_code, generate_regular_spike_train, generate_poisson_spike_train
sname = "minimal_SLSTDP_synapse"
nmodel =... |
d1a6657ad483c57b2d277fb79a90a26a6e18b6bf7b9360d7e2a5045517dc5750 | Python | 9,361 | 248 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import esm
import glob
import os
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
#####################################
# Pos. enc. for each representation #
#####################################
class Position... |
5e2c3eba99094baeca748eca5ce04f3d5c3af948d8460e60fba4e23bc0d30d6f | Python | 9,368 | 257 | from dataclasses import dataclass, field
from typing import Literal
import cuik_molmaker
import numpy as np
from rdkit import Chem
from rdkit.Chem import Mol
import torch
from torch import Tensor
from chemprop.data.molgraph import MolGraph
from chemprop.featurizers.base import Featurizer, GraphFeaturizer
from chempro... |
e27d42ed78f01621179a7d563986b7fbdc9e640d3ca127220aa7621c6389fd2e | Python | 9,377 | 226 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
import numpy as np
from typing import Dict, List, Optional
import fvcore.nn.weight_init as weight_init
import torch
import torch.nn as nn
from torch.nn import functional as F
from detectron2.layers import Conv2d, ShapeSpec, get_norm
from detectron2.mod... |
64448b10c2467b917e7798bce9c820dc6096d31d95d1c821edd75517b8261963 | Python | 9,383 | 265 | #!/usr/bin/python2
""" get frequency information for tokens in stories from Google Books """
from __future__ import print_function
import sys
import copy
import itertools as it
from collections import deque, namedtuple
import subprocess
import re
import nltk
import zs
#NGRAMS_LOCATION = "http://bolete.ucsd.edu/njsmit... |
5eca874f7fd9aecc1a3b6205d588f98f3ff5b01f80a2b69ca48c47c99cef91d3 | Python | 9,400 | 197 | """Reproduce the Extended Data Fig. 3 belief-update ("arrows") figure.
For each participant, draws an arrow from their average signed confidence
before the explanation to after the explanation, for the nearest-neighbour
task (panels a, b) and the prediction task (panels c, d), split by experts
(a, c) and non-experts (... |
d4748c3ccdb4c31108ca19aed16b13de5f105387ddfb146b8489d64c495871c1 | Python | 9,403 | 294 | #!/usr/bin/env python3
"""Computes network responses to progressive occlusion of a left-convex feature.
This script runs inference with a "sliding curtain" occluder that progressively
masks the afferent drive to L0 Poisson neurons, simulating partial occlusion
of a diagnostic boundary feature.
The occlusion is applie... |
5b4db8e6f3e1a57f91babb21bca19cdc2c948d955c91fae24d0543a94f34fd7d | Python | 9,409 | 160 | from typing import Union, List
import numpy as np
import torch
from acvl_utils.cropping_and_padding.bounding_boxes import insert_crop_into_image
from batchgenerators.utilities.file_and_folder_operations import load_json, save_pickle
from nnunetv2.configuration import default_num_processes
from nnunetv2.training.datal... |
3ca46a6b776a58d3b689aceca7d62363da727bf8001660a403333254383d13ba | Python | 9,420 | 255 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import click
from openfecli import OFECommandPlugin
from openfecli.parameters import (
COFACTORS,
MOL_DIR,
N_PROTOCOL_REPEATS,
NCORES,
OUTPUT_DIR,
OVERWRITE,
PRO... |
2016ea64318ad266e4635d35f4644f3da121357fa7115e70de679ab2c924a19d | Python | 9,432 | 285 | import numpy as np
import h5py
def h5_to_dict(group):
"""
Recursively load an HDF5 group into a dictionary.
Parameters
----------
group : h5py.Group
The HDF5 group to load.
Returns
-------
dict
A nested dictionary containing all datasets and groups within the HDF5 gro... |
695995b32e43166e9258d25db51b29fd45f6408f2e6208aed409a78414c03096 | Python | 9,440 | 268 | #!/usr/bin/env python3
#
# Copyright (c) 2022 10X Genomics, Inc. All rights reserved.
#
"""Functions for interacting with h5 tables."""
from __future__ import annotations
import csv
import os.path
from collections.abc import Generator, Iterable, Mapping
from contextlib import ExitStack
from typing import NamedTuple,... |
7fb39b42705cfd64e2d56a4fe89518d3cdb3e2da807903db35f96e00bb02207e | Python | 9,448 | 295 | """Cells are positions in space that can have properties and contain agents.
A cell represents a location that can:
- Have properties (like temperature or resources)
- Track and limit the agents it contains
- Connect to neighboring cells
- Provide neighborhood information
Cells form the foundation of the cell space s... |
1abb592caeef377d258f4db09564feb0c6c314b845902942d288b9f4beafda21 | Python | 9,454 | 287 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/gufe
import abc
import json
import re
from typing import Any
from gufe.tokenization import (
JSON_HANDLER,
from_dict,
get_all_gufe_objs,
key_decode_dependencies,
)
from .metadatast... |
c8e3f06b378e51361cb88891d1cac21626102a40b862caeac3904ab3591e09e3 | Python | 9,454 | 245 | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import os
from typing import Dict, List, Tuple
import torch
from torch import Tensor, nn
import detectron2.data.transforms as T
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from det... |
6c9326a58a157d3214f68679e3d890683a2cccb8b318b3f17868444293d7dda8 | Python | 9,464 | 285 | # This script is part of navis (http://www.github.com/navis-org/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... |
a2afa7dd737208ff058473d65a1ec1c4416325d24fba5659b9c42eed2b1dac6e | Python | 9,465 | 206 | #!/usr/bin/env python
# Copyright 2016-2023 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
ff3015585d35895e73489548174e683d186c24a64af1a20ea28f4113f19bfe9e | Python | 9,479 | 236 | # This script is part of navis (http://www.github.com/navis-org/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... |
4f06148d2943fb8e995e26e079e018a4325af5186be885f2c6aec99311d5794e | Python | 9,491 | 260 | #!/usr/bin/env python
#
# Copyright (c) 2018 10X Genomics, Inc. All rights reserved.
#
import os
import shutil
import subprocess
import martian
import cellranger.barcodes.utils as bc_utils
import cellranger.constants as cr_constants
import cellranger.matrix as cr_matrix
import tenkit.log_subprocess as tk_subproc
im... |
81f10ec72a55e00870d76dea47aa8df5828c8e7a5ce34e97ac91bbc63711aa49 | Python | 9,495 | 208 | import torch
import numpy as np
import scipy
import scanpy as sc
from ndreamer.single_cell_utils import split_and_cluster,multi_resolution_cluster
from torch.utils.data import DataLoader, TensorDataset,Dataset
def process_adata(adata, condition_key, control_name, input_dim, require_batch=False, batch_key=None... |
9d6a6f53cdedcb160f80d0b1acfff5d16f8e85ad3c18b69c335891d780f4fdb4 | Python | 9,515 | 289 | #
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
#
"""Data loading utilities which have limited dependencies on anything else."""
from __future__ import annotations
import json
import os
from cellranger import constants as cr_constants
from cellranger.spatial.pipeline_mode import PipelineMode, Product,... |
5612f7dda1f8f1f6af6d219c8342511bd879d9bb9428805bf8de8f5114fadb7c | Python | 9,521 | 231 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2020-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
... |
4627a7b824cd6ac2db7a271bb3d0f307d8c7df9497ba70d0042b0a0197178fcb | Python | 9,531 | 335 | # %%
from __future__ import annotations
from dataclasses import dataclass
import matplotlib.pyplot as plt
import mne
import numpy as np
from mne import BaseEpochs
from mne.decoding import cross_val_multiscore
from mne.decoding import Scaler
from mne.decoding import SlidingEstimator
from mne.decoding import Unsupervis... |
4c7a45b976a5866e0222596fc84b2a5f8e6324867027b96287a6fa5e40cdba72 | Python | 9,535 | 243 | #!/usr/bin/env python
#
# Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
#
"""Code to produce plotly histogram plots in the form of bar-plots."""
from __future__ import annotations
from math import ceil, floor, log10
from typing import NamedTuple
import numpy as np
from six import ensure_str
from cellr... |
e04df72a61727dc0601661ed96ac7a7e061d1735dc70bfdde90e035fb0ee5442 | Python | 9,536 | 195 | """Refit PV-specific XGBoost models and create held-out TreeSHAP summaries."""
from __future__ import annotations
import argparse
import importlib.metadata
import json
import platform
import sys
import time
from collections.abc import Callable, Mapping, Sequence
from pathlib import Path
from typing import Any
import... |
1226bcd0f2707b2ea4a916de43e17ff4bc34964fc930ad0b0d8d7030b04c923c | Python | 9,540 | 284 | from pathlib import Path
import click
import click_log
import pandas as pd
from anndata import concat as anndata_concat
from fcswrite import write_fcs
from ... import io
from ..._cli.utils import SteinbockCLIException, catch_exception, logger
from ..._steinbock import SteinbockException
from ..._steinbock import logg... |
8efd0ada739230fadab8057ede88ceac179274c2019fbab0ad0b90917a5ea3e2 | Python | 9,550 | 264 | # --- Python 标准库 ---
import os
import gc
import random
import warnings
# --- 第三方核心科学计算库 ---
import numpy as np
import pandas as pd
import scipy.stats
# --- 生物信息学与数据分析库 ---
import anndata as ad
import scanpy as sc
import seaborn as sns
import matplotlib.pyplot as plt
# --- 机器学习库 (Scikit-learn) ---
from sklearn.prepro... |
5dd19ed7536cc9095ab5d3ca4c09bde5283c0779207a1aa019c05565a2502dca | Python | 9,561 | 267 | # adopted from
# https://github.com/openai/improved-diffusion/blob/main/improved_diffusion/gaussian_diffusion.py
# and
# https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py
# and
# https://github.com/openai/gu... |
4b90193c28c66ed9a1292f2a06d6be7891d61df7f032bd7cd4cce422a1d98fa1 | Python | 9,567 | 292 | """
If you use this code, please cite one of the SynthSeg papers:
https://github.com/BBillot/SynthSeg/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 Lice... |
4968bfe7835db4290f82a4b3563a5dc7a8e1a98d205d30e0f798099c17b9c159 | Python | 9,582 | 238 | """Role co-membership / role-switching matrices over the HFB annotation table.
Quantifies how often a neuron that fills one circuit role (low-level **L**, high-level
**H**, binding **B**) *also* fills another role somewhere in its repertoire. All functions
operate on the ``hfb_annotations`` table (one row per signific... |
eb313746bda9edbe5de5548045b8b316af5a5425487f39a37ce9cb743ab3c123 | Python | 9,582 | 241 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
import io
import numpy as np
import os
from dataclasses import dataclass
from functools import reduce
from operator import mul
from typing import BinaryIO, Dict, Optional, Tuple
import torch
from detectron2.utils.comm import gather, get_rank
from detec... |
d551d5ee378fe03bbe76c072b50017ac4a0e62545492c5ef2217b9870faa7265 | Python | 9,589 | 240 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 19 11:51:13 2022
@authors: Joseph Vermeil, Anumita Jawahar
CortexPaths.py - state all the paths to folders and files used by CortExplore programs,
to be imported with "import CortexPaths as cp" and call the constants with "cp".my_path".
Joseph Vermeil, Anumita Jawahar, 2... |
6ca87a55a73e2d489057ec981872205d0151b3070a731e8ec63c94070c353aba | Python | 9,600 | 364 | # -*- coding: utf-8 -*-
"""Functions for fetching datasets (from the internet, if necessary)."""
from collections import namedtuple
import os
from pathlib import Path
try:
# nilearn 0.10.3
from nilearn.datasets._utils import fetch_files as _fetch_files
except ImportError:
from nilearn.datasets.utils impor... |
77e64612fea645ab1beace7b2b2d619631480cce3f40725a3cd624358a4156de | Python | 9,600 | 234 | # Copyright (c) Facebook, Inc. and its affiliates.
# Reference: https://github.com/bowenc0221/panoptic-deeplab/blob/master/segmentation/model/post_processing/instance_post_processing.py # noqa
from collections import Counter
import torch
import torch.nn.functional as F
def find_instance_center(center_heatmap, thres... |
f3538b762e2fe5a9b93e05e531ef190dc469c445952402fb88c757df39316036 | Python | 9,601 | 281 | # AUTOGENERATED! DO NOT EDIT! File to edit: 06b_seq_summaries_experimental.ipynb (unless otherwise specified).
__all__ = ['MCROSSpwm', 'KmerAffinities', 'KmerScorer', 'DimerWeightMatrix', 'DimerScorer', 'align_by_convolution',
'DimerSupplementedPWM', 'DimerSupplementedPWMScorer']
# Cell
import numpy
import... |
fc1606b14c0f93decba6af5efd6b074b8e3d1426e262e9b7b732a0cd7782aa1f | Python | 9,607 | 301 | """
Data loading and processing for experimental liquid crystal datasets.
Handles reading spreadsheet data, parsing SMILES strings, extracting
transition temperatures, and producing cleaned DataFrames ready for
featurisation.
"""
import logging
import re
from pathlib import Path
from typing import Optional
import num... |
947898d69f78bb2b9064db645eadb4a46bd3af02c3a71e406097e46617747c0c | Python | 9,614 | 253 | #!/usr/bin/env python
#
# Copyright (c) 2018 10X Genomics, Inc. All rights reserved
#
from __future__ import annotations
import csv
import itertools
import json
import os
from typing import TYPE_CHECKING
import martian
import numpy as np
import scipy.sparse as sp_sparse
from cellranger import cr_io
from cellranger.... |
d3c0903f70ba7174b70b8b2f2cc2d6da994349e8860d469c5e5b9afc8c4960ca | Python | 9,624 | 257 | import os
import pickle
import numpy as np
import pandas as pd
import nibabel as nib
from statsmodels.gam.api import BSplines
from neuroCombat.neuroCombat import make_design_matrix, adjust_data_final
import copy
def harmonizationApply(data, covars, model, return_stand_mean=False):
"""
Applies harmonization mod... |
304279e4215ef348784e98b39275f2898026287dea339e7e1af52299634a5de7 | Python | 9,640 | 259 | #!/usr/bin/env python3
"""
vepExtract.py
Read all VEP output files from a folder, build a gene x sample
non-synonymous mutation count table, write to CSV.
Usage:
python vepExtract.py <vep_folder> [--out counts.csv] [--mode nonsyn|genic|exonic]
python vepExtract.py /path/to/vep_files/
python vepExtract.py /... |
a91eebac0bbb8d38ddd06d638a71bcfc6e172374b0f45826482bd677aa67a530 | Python | 9,643 | 271 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
from __future__ import print_function
import argparse
import os
import sys
import numpy as np
import nibabel as nib
from calendar import month_name
from datetime import datetime
... |
335d8fb37d93d320ca397cfd51b765f54070209bff5c974ad5d51cd328840ed6 | Python | 9,645 | 283 | #%%
import joblib
from os.path import join
import numpy as np
import pandas as pd
import matplotlib as mpl
new_rc_params = {'text.usetex': False,
"svg.fonttype": 'none'
}
mpl.rcParams.update(new_rc_params)
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.patches import Rectangle
... |
0e12713f5fd514d0136c4a639f41a831ae875b879c9a8fce0b4f8b73878942a2 | Python | 9,660 | 265 | #!/usr/bin/env python
#
# Copyright (c) 2017 10X Genomics, Inc. All rights reserved.
#
"""Differential expression analysis for single-cell RNA-seq."""
from __future__ import annotations
import os
import sys
from typing import TYPE_CHECKING, Any
import numpy as np
import pandas as pd
import cellranger.analysis.clust... |
e3ba29bcec7438a86ec273b3c7764961e930fb96e28379255f48c600833cdf41 | Python | 9,671 | 275 | import os
import warnings
# Check if 'R_HOME' environment variable exists
if "R_HOME" not in os.environ:
os.environ["R_HOME"] = r"D:/opt/R/R-4.3.1"
print("R_HOME was not set. It has been set to:", os.environ["R_HOME"])
else:
print("R_HOME is already set to:", os.environ["R_HOME"])
import torch.utils.data
... |
5f55432badfd20bebb8df900a81bcc2c25f4739d4c0b58f521ddd61ac425ff19 | Python | 9,674 | 344 | """Tests for the shared machinery under `navis.interfaces.base`.
Deliberately network-free: `fetch_parallel` is handed plain callables, and the
optional-import tests use package names that cannot exist.
Note this module must stay free of doctests - pytest runs with
`--doctest-modules`.
"""
import threading
import p... |
02226845bd606db2b39db572f3bc646d5debeec1084b12c914c63302e4b75ddb | Python | 9,676 | 308 | #%%
import numpy as np
from lisc import Words, Counts
from lisc.plts.counts import plot_matrix
import matplotlib.pyplot as plt
import networkx as nx
import seaborn as sns
from lisc.plts.words import plot_years, plot_wordcloud
import joblib
import matplotlib as mpl
import joblib
import textwrap
import pandas as pd
new_... |
50389c03870206e380148a33e451f52db222078626dfb4ce2ed82427d26f7437 | Python | 9,684 | 266 | # --- Python 标准库 ---
import os
import gc
import random
import warnings
# --- 第三方核心科学计算库 ---
import numpy as np
import pandas as pd
import scipy.stats
# --- 生物信息学与数据分析库 ---
import anndata as ad
import scanpy as sc
import seaborn as sns
import matplotlib.pyplot as plt
# --- 机器学习库 (Scikit-learn) ---
from sklearn.prepro... |
bfb08215c8a28f96b6fe43061ca945ba77f7adb61f35b66cdca5f23bbb5b02c7 | Python | 9,686 | 240 | import torch
import torch.nn as nn
import numpy as np
import pandas as pd
import scanpy as sc
import anndata
import multiprocessing
from tqdm.notebook import tqdm
import random, sklearn.neighbors
import scipy.sparse as sp
from torch_geometric.data import Data
def process_data(adata):
df = adata.uns['Spatial_Net'].... |
aa0cc496e966eeb493bce0bead6fb53fb7d832f2c263fbe02e22fc5c514962a8 | Python | 9,687 | 226 | #!/usr/bin/env python
# Copyright 2017-2018 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
f89623241b4947985410ce182cbace7ce9094351728c2ea8c1498621cee4751a | Python | 9,709 | 327 | """
Wrappers for VTK algorithms and mappers.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
from vtk.util.vtkConstants import VTK_DOUBLE
from .base import BSVTKObjectWrapper, wrap_vtk
from .property import BSTextProperty
from .lookup_table import (BSLookupTable, BSLookupTableWithE... |
a1960ec8b4870665de7ce8fb61bef9ad673ab962ee7851fa6d9bce33e84dd35c | Python | 9,717 | 250 | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
import os
from fvcore.common.timer import Timer
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.structures import BoxMode
from detectron2.utils.file_io import PathManager
from .builtin_meta import _get_coco_instances_meta
fr... |
3a87fef34132664190cee5ab234f99d4715cd119bdcdd5db3d82d065ed47d877 | Python | 9,733 | 291 | # -*- coding: utf-8 -*-
#
# WORC documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 12 17:01:23 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in thishttps://stackoverflow.com/
# auto... |
0faeddc204938a8b98e17e1ca6cb8ef9940311ed76002fbbe70ad5697f5ab67b | Python | 9,744 | 206 | """
Meshes
======
<!-- difficulty: intermediate -->
Shade, outline and stack mesh neurons.
The mesh counterpart to the [skeleton tutorial](../tutorial_plotting_2d_00_skeletons). If you have
not read the [plotting overview](../1a_plotting_general/tutorial_plotting_00_intro) yet, start there;
for colors and palettes se... |
67755e7e55d3ecdf2542d35ae9a90805e2b216ae6e9b7fee3f69d192a36f0d80 | Python | 9,756 | 343 | import shutil
import sys
from pathlib import Path
import click
import click_log
import numpy as np
from ... import io
from ..._cli.utils import (
OrderedClickGroup,
SteinbockCLIException,
catch_exception,
logger,
)
from ..._env import use_ilastik_env
from ..._steinbock import SteinbockException
from .... |
251b7edd0baff8c2b9790cafbafe361310636c2122bbe92be61426b2d6767500 | Python | 9,765 | 222 | # Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center
# (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... |
7b4a5c51a3be624497e3546a5debc5791945837e97bf12d691255cd6f5fb00bc | Python | 9,774 | 320 | import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import eigh
from functools import reduce
import seaborn as sns
# Helper: Kronecker product
def kron(oplist):
return reduce(np.kron, oplist)
# ------------------
# Constants
# ------------------
gamma_e = 1.76086e8 # rad/(s·mT)
... |
1e75b5006b19882592bbb2070119421500098f8b6cd833c13596b36b32b14610 | Python | 9,779 | 288 | from enum import auto
from typing import Sequence
import numpy as np
from rdkit.Chem.rdchem import Atom, HybridizationType
from chemprop.featurizers.base import VectorFeaturizer
from chemprop.utils.utils import EnumMapping
class MultiHotAtomFeaturizer(VectorFeaturizer[Atom]):
"""A :class:`MultiHotAtomFeaturizer... |
a8271bb8c6dc4e88ba5a9f42aca59d0f6a55293710cfbb67dc1d14ad3f7d7082 | Python | 9,783 | 218 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2020-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
... |
0c35ad9879c33bdb6a23a4aaa80178c0df62e610b728dddb92ed56e7b771af7f | Python | 9,786 | 244 | '''Python implementation of multidimensional GRAPPA.'''
from collections import defaultdict
from time import time
import logging
import numpy as np
from skimage.util import view_as_windows
import concurrent.futures
from pygrappa.train_kernels import train_kernels
def mdgrappa(
kspace,
calib=None,
... |
fc02756b44f829a294d0127f5b1fb06044e57b20c79e2681cd80ae4ea14ab30a | Python | 9,797 | 260 | """
Automatic unit curation for ICMS recordings.
Adapted from batch_process/util/curate_util.py for use with the new
standalone pipeline. Removes stim artifacts and noise units using:
1) Global artifact check - units with large signals on ALL channels
2) ACG stim-locked check - units with autocorrelogram pea... |
f7a7669939f2badc79914964da611a7dce2101ea45c606f51859167331ed9db4 | Python | 9,805 | 231 | # Welcome to the tutorial of WORC: a Workflow for Optimal Radiomics
# Classification! It will provide you with basis knowledge and practical
# skills on how to run the WORC. For advanced topics and WORCflows, please see
# the other notebooks provided with this tutorial. For installation details,
# see the ReadMe.md pro... |
c57726ba70eb6ec119cd29b239fe5aaa85b482a71a84ed43a8cefa97fec1f38b | Python | 9,806 | 198 | """
If you use this code, please cite one of the SynthSeg papers:
https://github.com/BBillot/SynthSeg/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 Lice... |
5f671ff9fa622651e50a33d679b44cf468880b03abc75401a2a0f4cff579103b | Python | 9,809 | 257 | from argparse import ArgumentError, ArgumentParser, Namespace
import logging
from pathlib import Path
import sys
import numpy as np
import pandas as pd
import torch
from chemprop import data
from chemprop.cli.common import add_common_args, process_common_args, validate_common_args
from chemprop.cli.predict import fin... |
76447abdf39ca54a55bf48193e243b6449168d5ca3cda94be2c2928f6733def3 | Python | 9,818 | 229 | '''
Created on 19.10.2020
Author:
Michael Diedenhofen
Max Planck Institute for Metabolism Research, Cologne
Description:
Pre-requisits: stroke mask was defined at post stroke day 7 (P7)
Result: for all time points the peri-infarct mask is created aligned to the individual T2w MRI data
1. Time point P7: For each subj... |
598b862b8486e2a2a46a22e2d9ad0d55d4a73ad25f0240ba9832e45a5745f2af | Python | 9,822 | 217 | import glob
import os
from typing import Union
import tifffile
import torch.optim as optim
from torch.utils.data import DataLoader, random_split
from tqdm import tqdm
from .unet3d import UNet3D
from .losses import *
from .predict import Predict
from ..utils import init_weights, get_device
class Trainer:
"""
... |
97e773db4cf7d18ff033024e7ed298f60df1144bd0178d904ab37d358c7f8860 | Python | 9,832 | 231 | """
06_velocity_off_manifold.py
訓練済み DREG_DYN モデルから latent dynamics の on/off-manifold 不確実性を
定量し、結果を loom ファイルおよび UMAP プロットとして保存する。
前提: 00_get_inferred_data.py が実行済みで
downstream_analysis/result/anndata/ に以下が存在すること:
- adata_rna.loom (layers: spliced_count, unspliced_count, Ms, Mu;
var: est... |
20e495ce27167f02da0c9e56adbfe4a21a6f87aae848d10c6d80f552f15d79b2 | Python | 9,833 | 260 | import ast
from os import PathLike
from typing import Sequence
import numpy as np
import pandas as pd
from chemprop.data import MolAtomBondDatapoint
from chemprop.featurizers.molecule import MoleculeFeaturizerRegistry
from chemprop.utils import create_and_call_object, make_mol, parallel_execute
def build_MAB_data_f... |
fcde373577c371afaf20e501119d7201f73f34fb17bc3254e27754705dcb968e | Python | 9,840 | 296 | #python boltz2dock.py L:\promec\Animesh\boltz2\P23946.fasta DEPL DPEL DPLE DLEP DDPK ENDP DEP
#https://build.nvidia.com/mit/boltz2?snippet_tab=Try https://docs.api.nvidia.com/nim/reference/mit-boltz2
#$env:NVIDIA_API_KEY="your-api-key-here"
#python boltz2dock.py <protein_sequence> <peptide1> [peptide2 ...]
import async... |
117101ed457c4e1c7828103c2189e4e13eba0f27ace20a220cb2cceda6d240f9 | Python | 9,845 | 239 | # responses/unit_response.py
from .stim_condition_response_v2 import StimConditionResponse
import numpy as np
import batch_process.util.template_util as template_util
class UnitResponse:
def __init__(self, unit_id, spike_timestamps, session_responses):
# Reference to parent SessionResponses
... |
e53eba33067aa72300a78e547d1db013925485e189d07b18f657f5eed70f4550 | Python | 9,853 | 248 | import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import statsmodels.formula.api as smf
from statsmodels.stats.multitest import multipletests
plot_thresh = 0.1
scale_for_stat = 1000 # for optimiser gradient flow
def format_p_value(p):
"""Returns a LaTeX formatted string for p-values."""
... |
e4e91cefbf3d692fc8be809515a7cd7d837f659ed6f4a15bb444d6e1dbdade58 | Python | 9,856 | 256 | # This script is part of navis (http://www.github.com/navis-org/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... |
1ae65ec16b57f6a86d9a4b1a257e3cf09e8c134625efc268877dfd495c557fcd | Python | 9,863 | 207 | """
Dice Score Comparison for Brain Parcellation Maps
This script compares two brain parcellation images and calculates the Dice similarity coefficient for each label (region).
Features:
- Computes Dice score per anatomical label.
- Maps label numbers to region names using FreeSurfer and Desikan-Killiany label conve... |
25e47ca2a4e7257ac51be1f88f5c10ff1b77d6893620ad7b39d7e8c969e61bef | Python | 9,865 | 257 | from __future__ import annotations
import argparse
from collections.abc import Sequence
from pathlib import Path
from typing import Any, Final, cast
import attrs
from typing_extensions import override
from snakebids import bidsapp
from snakebids.plugins.base import PluginBase
from snakebids.types import OptionalFilt... |
9064b4da592a9a18c42efe1cbb1b23ce83f9d9feeee92c3e49cac5efa543545f | Python | 9,870 | 222 | from cluster_jobs.abstract_jobs.meta_job import Job
import mne
import numpy as np
import joblib
import yasa
from fooof.utils import interpolate_spectrum
from utils.cleaning_utils import run_potato
from utils.psd_utils import compute_spectra_ndsp, compute_spectra_mne, interpolate_line_freq
from utils.fooof_utils import... |
845c2009f9989fc68ea3ceb24f9ac7f3df4bdd55a6037226a02d0f88a8451f35 | Python | 9,877 | 231 | # Welcome to the tutorial of WORC: a Workflow for Optimal Radiomics
# Classification! It will provide you with basis knowledge and practical
# skills on how to run the WORC. For advanced topics and WORCflows, please see
# the other notebooks provided with this tutorial. For installation details,
# see the ReadMe.md pro... |
1443401487ceed76f49cab9e12184c8c87372a56bb9877d6402ab50cd506b289 | Python | 9,885 | 236 | '''This file contains functions that can be applied to plot the simulated signals and the results of the simulations'''
import matplotlib.pyplot as plt
import numpy as np
from ..snr import snr_func
from . import simulations
from matplotlib import gridspec
from matplotlib.ticker import LogLocator, LogFormatterSciNota... |
f5552113bf6135d8590d3d0d03a0f975f7c73e395089953d1dc26bce4b560a39 | Python | 9,886 | 284 | #!/usr/bin/env python3
"""Computes ranked information measures from hyperparameter sweep experiments.
This script takes inference results from hyperparameter sweep experiments and
computes stimulus-specific information measures, outputting serialised results
organised by hyperparameter value.
The swept hyperparameter... |
ef356d7da7c7d6a11d37f77cd90e70982390f44c48d3473515e3c0234df4a299 | Python | 9,892 | 226 | #python compareDIffExprDIANNmetrics.py DDAreport.parquet_Ms1_Area_pivot_all_metrics.csv reportDDA.parquet_Ms1_Area_pivot_all_metrics.csv
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from pathlib import Path
if len(sys.argv) != 3: sys.exit("USAGE: python compa... |
59cbfdb18472e1aef449dbc17679cc63baf27ba8bdb1e4406576c0f1bcfbd3df | Python | 9,893 | 317 | # This script is part of navis (http://www.github.com/navis-org/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... |
034c628dad86cc9d41c209e80fda2b07a9acea7ad1b3a9ab5e315ae45fa32f56 | Python | 9,898 | 243 | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Dict, Optional, Tuple
from taming.models.autoencoders import AutoencoderKL3DV5
from ldm.modules.distributions.distributions import DiagonalGaussianDistribution3D
class ContextualInputMerger(nn.Module):
"""Fuses multi-scale stat... |
2df916c544b11bc8a722fb18cae449730d2351e97a87aaa37293137f837f577b | Python | 9,905 | 280 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import collections
import copy
from importlib import resources
import gufe
import numpy as np
import openmm
import pytest
from openmm import Platform
from openmm import unit as ommunit
from ... |
6215a16af19874ecd1dc1aee0f13ffe734187dd181f971f43d08d7629c8681fa | Python | 9,905 | 230 | import copy
import openmm
import pytest
from openmm import app, unit
from openfe.protocols.openmm_rfe import _rfe_utils
from openfe.protocols.openmm_rfe._rfe_utils.relative import HybridTopologyFactory
from openfe.tests.protocols.openmm_rfe.helpers import _make_system_with_cmap
def test_cmap_system_no_dummy_pme_ene... |
85d9d052a5c7ac72353f6628ef467bb37d5a5194235058aa63c9447f91815e7b | Python | 9,906 | 267 | # Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
from typing import Callable, Dict, Optional, Tuple, Union
import fvcore.nn.weight_init as weight_init
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.config import configurable
from detectron2.layers import Con... |
86f76c90e62ce84494b23e0c18cbe5fc84f7adecb36a4da7e3465e4406e99976 | Python | 9,909 | 270 | """Classes for running parameter sweeps over scenarios."""
from __future__ import annotations
import traceback
from collections.abc import Iterable
from concurrent.futures import BrokenExecutor, as_completed
from typing import TYPE_CHECKING, Any
import pandas as pd
from mesa.experimental.scenarios.exceptions import... |
f1597965b8c2a7ae00093aa857ad9084855a803e992c3ccd1c828fb3dc185f1e | Python | 9,921 | 206 | ### the complete proposed variable selection procedure (SurvNet)
import tensorflow as tf
import numpy as np
import math
from variable_selection import VS
def FN(seed,
train_X,train_Y,val_X,val_Y,test_X,test_Y,
n_classes,n_hidden1,n_hidden2,
learning_rate,epochs,batch_size,num_batches,dropout,... |
26bff89c6ff0b301923d85e84b9fa1a5b76b0208509867f334ee062ca4ddc776 | Python | 9,922 | 326 | # %%
from __future__ import annotations
import os
import os.path as op
import sys
import joblib
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import mne
import numpy as np
from matplotlib import font_manager as fm
from matplotlib.gridspec import GridSpec
from scipy.stats import ttest_1samp
from tqdm impo... |
4126b59e792ef83ff3d66c328537a707d3b68a5d52c1324676e5b4e7d7254722 | Python | 9,929 | 222 | ###############################################
# ---------- Data Import Functions ---------- #
###############################################
import pandas as pd
import numpy as np
import networkx as nx
import time
import os
import random
# Load network from file as unweighted network
# params is generated by the l... |
96a0d3b3df4525554a3ac77e693c6c565195edef0611f1eccd2e7aa27c284f2c | Python | 9,931 | 297 | """ Created on Wed Jun 5 10:12:46 2024
@author: dcupolillo """
from __future__ import annotations
import numpy as np
import torch
from skimage.morphology import dilation, disk, remove_small_objects, erosion
from spyne.core.spines.analysis.timeseries.filters import modified_okada_filter
def _shift_to_zero(frame:... |
54c9913f3e3bb74b826e5055c406a8b73dfa58475d8453fb3c95f731c102816e | Python | 9,945 | 297 | #!/usr/bin/env python
# Copyright 2016-2024 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
e23826efc886744216723dbf11fdc16cadf8f9647043ecfc3f43db76a9eec005 | Python | 9,954 | 242 | # cell 方向に p, u, s を concat して解析
import os
import numpy as np
import pandas as pd
import umap
import matplotlib.pyplot as plt
import anndata as ad
import scanpy as sc
import scvelo as scv
import cellrank as cr
import scanpy.external as sce
from scipy.io import mmwrite, mmread
import statsmodels.api as sm
from sklearn.... |
6e92d06fcdcbe6b998f96c3a7e3833c927c4ac1595848d51b98db9c4ee9d04c8 | Python | 9,979 | 234 | """
SlotDeconv: Utility functions for evaluation and data handling.
JSD uses standard definition: JSD = (JS_distance)^2, NOT 0.5 * (JS_distance)^2
"""
import os
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.spatial.distance import jensenshannon
from sklearn.metrics import average_pr... |
467fe27dfab773b14068c569f7544cc5d8fe1c3b6d1e02f6b59522282e9e7e9c | Python | 9,980 | 255 | ## ipat.py
import numpy as np
import logging
from time import time
import os
import gc
from .mtypes import DatBasics
from .utils import saveImage
def find_acs(kspace : np.ndarray, ctrs : np.ndarray = None, coil_axis : int = -1):
'''Find the largest centered hyper-rectangle possible.
Parameters
-------... |
0180f19edbc19711717b30728e1e6215227a867f444705ec74fbe10608fb330d | Python | 9,991 | 359 | import numpy as np
def jaccard_similarity(list1, list2):
"""
Function to compute the jaccard similarity between two list of different sizes.
Parameters
----------
list1: array-like
First list of elements
list2: array-like
Second list of elements
Returns
-------
J... |
8a88fd0c184de88b24c643c52dd8d9361982e662315f0eab658b3e6e51b5ab7a | Python | 9,995 | 296 | import numpy as np
import pandas as pd
import pytest
from hsnn.analysis.png.base import PNG
from hsnn.analysis.png import refinery
from hsnn.analysis.png._utils import isconstrained
from hsnn.analysis.png.detection import _unique_pngs
# Helpers -----------------------------------------------------------------
def m... |
7eccaf947d0179c2f73a8bab6f3aa35631f88d2abca704a73741b6dd5c12c818 | Python | 10,005 | 255 | """Tests for `navis.nblast_knn`.
Unlike the other NBLAST functions this one has no built-in implementation - it
exists only in navis-fastcore, which is a hard requirement.
The parity tests below compare against a full `nblast_allbyall` with a
tolerance rather than asserting exact equality.
They currently *would* pas... |
7f611730f0ca997b972f9ced07a97962a03a549d332746584b6b58b874622874 | Python | 10,010 | 287 | from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
import subprocess
import time
# ---------------------------------------------------------------------
# Shared data containers
# ----------------------------... |
b1178c89f7be5640612f8b3e5cc3148204e5ac1eeabfacdaa65031344a168da0 | Python | 10,011 | 262 | """
Created on 10/08/2017
Modified on 04/23/2021
Updated on 02/19/2026
@author: Niklas Pallast and Markus Aswendt
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
#!/usr/bin/env python3
Two outputs:
1) Parental annotation (larger labels):
- Input pattern: **/*_AnnorsfMRI.nii.gz... |
f5e11d36bf7d936f8d466b3c678831490e3e9cdb961e61be32f1e051ddba2d50 | Python | 10,012 | 307 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import nipype.interfaces.fsl as fsl
import os, sys
import nibabel as nib
import numpy as np
import applyMICO
import nipype.interfaces.ants as ants
import subprocess
import shutil... |
315b7a0481b0a9ad20f6c891d924e09dcfe0a33b48b78936fe667fccf0f8605b | Python | 10,013 | 253 | """
Tutorial 2: Customizing and aligning gradients
=================================================
In this tutorial you’ll learn about the methods available within the
GradientMaps class. The flexible usage of this class allows for the
customization of gradient computation with different kernels and dimensionality
re... |
0a26821b566c87e9f66667180bde8b4210572c0d8f1a4ce13b809b59dfacc5f8 | Python | 10,014 | 303 |
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import os
import pandas as pd
import matplotlib.pyplot as plt... |
8e7d4e6e41bea4a74c102a1de56aa634e52a6f8031c8b419f71866e989e818fc | Python | 10,031 | 207 | import argparse
import multiprocessing
import os
import shutil
from copy import deepcopy
from typing import List, Union, Tuple
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import load_json, join, subfiles, \
maybe_mkdir_p, isdir, save_pickle, load_pickle, isfile, save_json
from nnu... |
0ec3c8ff6fb71e8b176c4474444ac8fdde5dda1ded5b749518d0aa3993e582bf | Python | 10,035 | 292 | """Generate comprehensive stats table (CSV) for all Figure 6 comparisons.
Covers:
- KL divergence (700ms and 120ms windows): PL e/l, NPL e/l, Early PL/NPL, Late PL/NPL
- Population coupling: PL e/l, NPL e/l, Early PL/NPL, Late PL/NPL
- Cluster permutation test results
"""
import sys
from pathlib import Path
sys.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.