sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
fa4b5944ef0232f5de51ac5bd1c75eaa103d2dce562e7602e4da28df65c8b8c1 | Python | 7,125 | 186 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class RScaling(nn.Module):
def __init__(self, in_planes, ratio):
super(RScaling, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.fc1 = nn.Conv2d(in_planes*2, in_planes // ratio, 1)
self.relu... |
6fa0278a897884be17f217191d8434d55a620274ac900b66ce1af7879cc1147e | Python | 7,127 | 171 | """Interpretability for the mango DMC KAN: symbolic equation (read off the SAME compact (3,) KAN family
as tahini), accuracy-vs-complexity, and learned response curves vs the linear PLS effect. Evaluated on the
held-out Season-4 external set. Writes to results_mango/paper/. Run: python -m kanfood.interpret_mango"""
imp... |
f31293608ba3997324e9fe5780694b3882f2ee43f3d0838c49c770dec29a5a24 | Python | 7,127 | 194 | import numpy as np
from mdt import CompositeModelTemplate
from mdt.lib.post_processing import NODDIMeasures
__author__ = 'Robbert Harms'
__date__ = "2015-06-22"
__maintainer__ = "Robbert Harms"
__email__ = "robbert@xkls.nl"
class NODDI(CompositeModelTemplate):
"""The NODDI Watson model"""
model_expression ... |
c907875b16caf83ef47a76f3710c9c050dbd08ae40ea80a3ef964af967b1406f | Python | 7,128 | 210 | """Build train/test molecule datasets from SMILES, optimize with xtb,
and cache the resulting geometries + total energies as JSON.
Focus: small C/H/O molecules with a mix of bond orders, plus isomer sets
that share the same molecular formula — those are the key validation case
for hierarchization (same atoms, differen... |
ff94a07be8d55b906873487a3ab8738da9ffd40a70d87c844cab31e53b819ae5 | Python | 7,129 | 171 | import requests
import argparse
import numpy as np
import pandas as pd
import json
import os
import scipy.sparse
##################### align gene symbol
def main_gene_selection(X_df, gene_list):
"""
Describe:
rebuild the input adata to unified gene symbol
"""
to_fill_columns = list(set(gene_li... |
3cc8a5805bff795ec2aa015eea30b09806d88421527686d21b2354f023b9e453 | Python | 7,130 | 181 | # Source code: https://github.com/zbmed-semtec/medline-preprocessing/blob/main/code/Evaluation/calculate_gain.py
# This file includes the modifications to the source code according to this project
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.a... |
710b6e53f0098689b7f78a52865bc2ad50925ba30e7830040fa8722bea930749 | Python | 7,130 | 192 | import pandas as pd
import numpy as np
from neuron import h
import simulator.model.saveClass as sc
import simulator.model.simulation as simulation
from simulator.model.ca1_model import CA1
from simulator.model.ca1_functions import init_activeCA1, addClustLocs, genRandomLocs, add_syns
from simulator.model.sim_functions... |
8d3373c2001de24349cb6be026a6b57203faf4ff9b4988b4aeade193a8833cfd | Python | 7,134 | 187 | """
Slave process logic to perform parameter sensitivity analysis on
8 sobol samples at a time. The index to the samples is passed as an
argument when the slave process is called.When the index is negative, the
nominal parameter set is used.
The focus of this logic is to determine the influence of the paramete... |
bfeece2231f367d4464aba361f4d83916595f7b3ce050dfe54fb322e7243552a | Python | 7,138 | 216 | from __future__ import annotations
from typing import TYPE_CHECKING
from poetry.mixology.assignment import Assignment
from poetry.mixology.set_relation import SetRelation
if TYPE_CHECKING:
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.package import Package
from poetr... |
adb3e2f85cab0c432b7ac193a07a32cc5b614b9de1b03ae48093fb011b6e36a0 | Python | 7,144 | 212 | from __future__ import annotations
import pathlib
import numpy as np
import pandas as pd
from . import annotation, constants
def to_map(
labelset: set,
map_background: bool = True,
background_label: str = constants.DEFAULT_BACKGROUND_LABEL,
) -> dict:
"""Convert set of labels to `dict`
mapping ... |
e745eb06b3772c52edf3f8c940368b1f5f817fed576395330f4c7513a5141381 | Python | 7,144 | 203 | import unittest
from tempfile import TemporaryDirectory
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
from GMXMMPBSA import make_top
from GMXMMPBSA.topology_preprocess import GromacsTopologyPreprocessor, comment_gromacs_cmap
class CommentGromacsCmapTest(unittest.TestCase)... |
fa6766769ac062c303011a2a6cef2a6e0fa5ca9a27807f29e919c957515657dd | Python | 7,145 | 248 | import os
import subprocess
import sys
from pathlib import Path
import torch
from transformers import (
AutoConfig,
AutoModel,
AutoModelForMaskedLM,
AutoModelForSequenceClassification,
AutoModelForTokenClassification,
AutoTokenizer,
)
from gpn import register_auto_classes
def test_importing_... |
fde2a2dc22c2325f830c5e8bdd1fe9bf37945e84128201cfdfd65f5d3bb3ee38 | Python | 7,146 | 224 | #!/usr/bin/env python3
"""
Simulate tree sequences and parameters for posterior analysis.
This script simulates data using msprime directly (without popgen-npe simulator classes)
and outputs:
1. A tree sequence file (.trees)
2. A parameters file (.yaml) compatible with plot-variable-popsize-posterior.py
Available mod... |
b051b0d87d25273dd57ed5e66235371900987136903609cba8166cfd0c667157 | Python | 7,147 | 210 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from argparse import Namespace
import os
import re
import unittest
from pathlib import Path
from tqdm import tqdm
from typing import List, Dic... |
80bf97418e863f26ed3f7f8e27516eb7ec12fe17a6e8092fb0187d9dcb7c75c1 | Python | 7,150 | 212 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
class GumbelVectorQuantizer(nn.Module):
def __init__(
self,
... |
2077cc15f11b7f92acd42f4dad51a6398112d76baf715fead36572f571cac46f | Python | 7,153 | 217 | import argparse
import collections
import copy
import csv
import json
import os
import numpy as np
import neuroglancer
import neuroglancer.cli
class State:
def __init__(self, path):
self.path = path
self.body_labels = {}
def load(self):
if os.path.exists(self.path):
with... |
e953ef04d9945a6fa34810e9b4d5deb2103cec518d4c9a5cfe3416f06a4d5e6c | Python | 7,153 | 176 | from __future__ import annotations
import os
import anndata
import numpy as np
import pytest
import torch
from torch.utils.data import Dataset
import scvi
from scvi import REGISTRY_KEYS
from tests.data.utils import generic_setup_adata_manager
def test_init():
adata = scvi.data.synthetic_iid()
manager = gen... |
6346da1ff33c41a64956ae290cab1f68f995efe34448065467d9f296f249cf94 | Python | 7,156 | 210 | from typing import Optional
import h5py
import numpy as np
import open_clip
import torch
import torchvision
from PIL import Image
from torchvision.transforms import InterpolationMode
from pytorchvideo.transforms import ShortSideScale, UniformTemporalSubsample
from torchvision.transforms._transforms_video import (Cente... |
67e588240c86be4c6f196e420ebcf74e0bb1ed1415416fc977dfbd5f9cae6498 | Python | 7,156 | 178 | from typing import Optional, Union, Any
from pydantic import BaseModel, Field, field_validator, model_validator
""" Pydantic models for the configuration files """
class DatasetConfig(BaseModel):
loader: str = Field(..., description="Name of the dataset loader")
image_dir: str = Field(..., description="Path ... |
8206af768bf4b1adb7722f99aa5f494c5a7a8a4ebffba912b316b6ae6d6d44a0 | Python | 7,159 | 178 | import logging
import pathlib
import pandas as pd
from ...common.converters import expanded_user_path, labelset_to_set
from .. import constants
from ..audio_dataset import prep_audio_dataset
from ..spectrogram_dataset.prep import prep_spectrogram_dataset
logger = logging.getLogger(__name__)
def get_or_make_source_... |
94e4634af1696a7e5e82b070990785705435c25ac0733267854b8470d8462eda | Python | 7,160 | 168 | import peer
import scipy as SP
import pylab as PL
import pdb
def simple_unsupervised_demo():
print "Simple PEER application. All default prior values are set explicitly as demonstration."
y = SP.loadtxt("data/expression.csv",delimiter=",")
K = 20
Nmax_iterations = 100
model = peer.PEER()
#... |
5883cd9d5fcc9bb05f755ae64d62849ed4dccd96f2e70fe27703959959dbf017 | Python | 7,162 | 199 | from mdt import LibraryFunctionTemplate
__author__ = 'Robbert Harms'
__date__ = '2018-05-02'
__maintainer__ = 'Robbert Harms'
__email__ = 'robbert@xkls.nl'
__licence__ = 'LGPL v3'
class NeumanCylinder(LibraryFunctionTemplate):
"""This function returns the displacement in the restricted signal attenuation, for ra... |
6b0f1a77d03baf7be6944964581afb1a67d28bce099703eb4893551f79d353eb | Python | 7,162 | 204 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from fairseq import checkpoint_uti... |
277a188d631865c458f360c0271cf4451a6aea7f8304d417b6f45774bd2b71b7 | Python | 7,167 | 221 | """Functional forms of input transforms."""
from __future__ import annotations
import numpy as np
import numpy.typing as npt
import torch
__all__ = [
"pad_to_window",
"standardize_spect",
"to_floattensor",
"to_longtensor",
"view_as_window_batch",
]
def standardize_spect(spect, mean_freqs, std_f... |
9dc701f8b03142540a2d712fa013f3ab8bd0a12bfac6731fdbef26ef31980c72 | Python | 7,170 | 189 | """
Slave process logic to perform parameter sensitivity analysis on
8 sobol samples at a time. The index to the samples is passed as an
argument when the slave process is called. When the index is negative, the
nominal parameter set is used.
The focus of this logic is to determine the influence of the paramet... |
a98dcf91b387d3f04975bfdf9e47d23d3d0505865fd9fe1829a1531804095197 | Python | 7,170 | 185 | #!/usr/bin/env python
"""Can this machine finish the run?
Reuses the earlier preflight's `encodings_agree_with_the_corpus` outright,
which matters more here: the token labels are placed against offsets from a
*re-tokenization*, so an encodings file that no longer reproduces what the
corpus reader produces puts every c... |
3dd1e38079f7b178bd937aa9ed7d088b2ef2b4bed078d59e10ae5b22b48e2b8b | Python | 7,171 | 181 | import numpy as np
import pytest
import vak.transforms
import vak.transforms.functional
import vak.common.validators
from vak.datapipes.frame_classification import Metadata
class TestFramesStandardizer:
@pytest.mark.parametrize(
'mean_freqs, std_freqs, non_zero_std',
[
(
... |
8c9b0bcc1bd0d52b8d2b7461da9486e2be11a03e427cc150be640614354fdd0d | Python | 7,173 | 199 | #!/usr/bin/env python
# Made by Paul Kiessling pakiessling@ukaachen.de
import os
import argparse
import tempfile
import shutil
from spatialdata_io import visium_hd
import pandas as pd
import scipy
import json
from pypdl import Downloader
LINKS = {
"https://cf.10xgenomics.com/samples/spatial-exp/3.0.0/Visium_HD_... |
47d67b374dc3930c02105e9ae8a4570925aec717c4ef307a71b1d2393ac0863a | Python | 7,174 | 223 | """
This module contains helper functions for the ´train´ subpackage.
"""
import sys
from typing import Tuple
import matplotlib.pyplot as plt
import numpy as np
import torch
def get_device(device_id):
# 获取可用的GPU数量
available_gpus = torch.cuda.device_count()
# 如果有可用的GPU且设定的device_id有效,使用该GPU
if torch... |
173d1ecbf2b53137288a75dec32b7192fa9a4aeb505be840bb2cfc6f39aac50f | Python | 7,177 | 195 | # Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors
import argparse
import yaml
from Simulator_calibration import (ForcefieldBuilder, SimulationBuilder, AmpConfigurator, SystemBuilder, PDBReader)
import openmm as mm
from openmm.unit import *
from openmm.app import ForceField
from openff.tool... |
77a0915ce94a72a17d55a9c92f2b6c2f1cf1fe5d959ffe83471c81f61ed7135b | Python | 7,181 | 222 | # Adopted from https://github.com/bioinformatics-sannio/ncrna-deep
"""Provides sequence to 2D representation conversion utilities."""
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
#from Bio.Alphabet import IUPAC
import numpy as np
import math
import itertools
from textwrap import w... |
dedb615f9e20ba7b2079e914039d70330dd5e4c734de2dc073c614eaff72bb83 | Python | 7,182 | 195 | #!/usr/bin/env python
# Author_and_contribution: Niklas Mueller-Boetticher; created template
# Author_and_contribution: Jieran Sun; Implemented visualization
import argparse
# TODO adjust description
parser = argparse.ArgumentParser(description="Visualization of preprocessing-QC")
parser.add_argument(
"-c", "--... |
6cd804545f80ad737c215339bd420f3e3e6d4d4ca47197a72dcd25b027d013f5 | Python | 7,183 | 198 | # Copyright 2023 BioMap (Beijing) Intelligence Technology Limited
import torch
import sys
import os
import numpy as np
import random
from pretrainmodels import select_model
import math
def next_16x(x):
return int(math.ceil(x / 16) * 16)
def seed_all(seed, cuda_deterministic=False):
random.seed(seed)
os.... |
5fe34d7cde6a193cf7e7ea5f8e55d79d86881f6e25f1f56821677d2ef1b3f1df | Python | 7,185 | 221 | """Cut the next d3text release: changelog section, commit, annotated tag, push.
git-cliff picks the version and renders `CHANGELOG.md`; this sequences the git
side around it. The tag is the version — `pdm-backend` reads it at build time
(`[tool.pdm.version] source = "scm"`) and `pyproject.toml` carries no number —
so ... |
668e9a999081691ec48607ffd08fce47f7c2a7a425ae127451c910b3147e97a8 | Python | 7,189 | 168 | import shutil
import pytest
import scvi
from tests.data.utils import generic_setup_adata_manager
def pytest_configure(config):
"""Docstring for pytest_configure."""
config.addinivalue_line("markers", "optional: mark test as optional.")
def pytest_collection_modifyitems(config, items):
"""Docstring for... |
63fb0fedea10f91adeac70dd0e2946416e2d43319c58b4553f05ab7fee41fdc6 | Python | 7,190 | 194 | """No class channel is allowed to go dead.
`test_pooling_default.py` pins the wiring, which is a different guarantee: a
correct, distinct, correctly-ordered pooling can still leave the bacteria and
strains channels predicting nothing. The pooled loss hides it — a channel that
never fires is near-optimal on the 75-83% ... |
d584564d9e0a684018036f869402d8851b2b9ff69ccf59731c67a00a8bf6398d | Python | 7,200 | 208 | """Reusable Qt panel for displaying a Matplotlib figure."""
from __future__ import annotations
import logging
from dataclasses import dataclass
from matplotlib.axes import Axes
from matplotlib.backends.backend_qt import NavigationToolbar2QT
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
from matplot... |
5c0466503f260c597f06df335f8412f616bd3ce245b2a5ad7e699e0ea5d58ab0 | Python | 7,202 | 204 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import logging
import os
import sy... |
adf999359c3a38774828e35036da4df338e8f32985cd7b588b7175cbe22f122f | Python | 7,202 | 185 | # created by DebarpanB
# date 26th August, 2022
import argparse, configparser
import numpy as np
import pandas as pd
import pickle
import os
import random
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble imp... |
f98e774376b28b1d16ca12a27e016f65b44577952e6aa9785993f4f223f19d9d | Python | 7,202 | 184 | #!/usr/bin/env python3
"""Validate the public API against external calculation and compact outputs.
The inputs are files or directories outside the checkout. Directories are
searched recursively for ``_GMXMMPBSA_info`` and
``COMPACT_MMXSA_RESULTS.mmxsa``. The runner exercises loading, public data
accessors, binding/... |
f2b5b1fa55d7de40a0f0de75792d45fc374d2fc820ede3f83cd2ba497a1b1f7b | Python | 7,212 | 168 | """Test OCE on the configurational benzene H/F dataset.
We split the 64 configs into train / test by substitution count and
report:
- isomer ordering within each fluorine count (the standard ortho/meta/para
test on di-F, the three tri-F isomers, etc.)
- equivariance: predictions for D6h-equivalent masks should match... |
11c91bc1c68cfdb913e2affb01261b55fb3b0c18773a45875e9c25cb330a4dcd | Python | 7,214 | 218 | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
f039815ad6a532c902140257e712da6b0036d1d494e3ecc06e412fb312c7897f | Python | 7,214 | 210 | import os
import zipfile
from functools import lru_cache
from pathlib import Path
from typing import Callable, Dict, Iterable, Literal, Optional
import omegaconf
import pandas as pd
import torch
from graphein.protein.tensor.data import Protein
from graphein.protein.tensor.dataloader import ProteinDataLoader
from logur... |
00297cd89b8619dae76d73480085067cee46d72efa779481c623bdac2e845ca6 | Python | 7,215 | 186 | from itertools import groupby
import mne
import numpy as np
import pandas as pd
from mne._fiff.pick import _picks_to_idx
def remove_BAD_segments(
raw: mne.io.Raw,
clip_range: tuple[float, float] = (-np.inf, np.inf),
interp: str | None = None,
match: str = 'BAD',
picks: str | list | np.ndarray ... |
2e4a1c72d93d0a847929cccc6b865cc1c7b5d1ada90d7f0930308c4fe43a7788 | Python | 7,219 | 265 | """
Utility functions for RAG-GNN.
"""
import numpy as np
from typing import Optional, Tuple
from sklearn.metrics import silhouette_score as sklearn_silhouette
def normalize_adjacency(adj_matrix: np.ndarray, add_self_loops: bool = True) -> np.ndarray:
"""
Compute normalized adjacency matrix for GCN-style con... |
2eff034e3e2e4e747f10ab2e43383c8f9be01d3e9e06cbd3bfcdd0f3c8c5b12c | Python | 7,223 | 136 | # Download reference data from http://ctg.cncr.nl/software/magma (for example g1000_eur)
# Then you can run the tool as follows:
# python make_ld_matrix.py --ref 2558411_ref.bim --bfile g1000_eur --ld_window_r2 0.1 --savemat ldmat_p1.mat
#
# Another example is for situation where you've already generated LD matrix b... |
3d87a3d5495dfe2ecd7c17e6da3d605f549f9dcaeb89fc5a51f44d48a73b9147 | Python | 7,224 | 200 | # -*- coding: UTF-8 -*-
"""
@Project: iDCF
@File : model.py
@IDE : PyCharm
@Author : hjguo
@Date : 2025/7/9 11:36
@Doc : iDCF model code, CustomizedLinear comes from:: https://github.com/uchida-takumi/CustomizedLinear/tree/master
"""
import torch
import torch.nn as nn
import math
class CustomizedLinearFunct... |
8cd052fe2a1ee45394bec6db58502a4afaab531ad526d4fbd7caa0cb0f1372e5 | Python | 7,225 | 201 | """
This file contains the necessary functions to run the text preprocessing
required for the hybrid approach.
Example
-------
To execute the script, you can run the following command:
$ python code/preprocessing/preprocess.py --input data/RELISH/RELISH_documents_20220628_ann_swr.tsv --output data/RELISH/RELISH_t... |
7e2d863b403d875d20d8cca65fafad35951a5086514cfa172a3967c6c5346e12 | Python | 7,226 | 173 | """
method_bank.py
--------------
Build the candidate method space (feature × classifier × DA × dist_type)
for one or more pipelines.
Mirrors generate_methodBank() from workers.R.
"""
from __future__ import annotations
import itertools
from typing import Optional
import pandas as pd
def generate_method_bank(
... |
2e78d47a1e2787cb4deb4b78eb3bdc3412679435b520908ead18c44982eb5c0a | Python | 7,232 | 200 | # Copyright 2023 BioMap (Beijing) Intelligence Technology Limited
import torch
import sys
import os
import numpy as np
import random
from .pretrainmodels import select_model
import math
import pandas as pd
def next_16x(x):
return int(math.ceil(x / 16) * 16)
def seed_all(seed, cuda_deterministic=False):
rand... |
8161bcad58c3a4373fd75f7cfab90fc9a332c934c43956c08aedc40856707eb5 | Python | 7,232 | 192 | #!/usr/bin/env python
"""Example of interactive visualization of synaptic partners.
To run this example, first download the synapse data for FIB-25 from the Janelia DVID server using this URL:
http://emdata.janelia.org/api/node/822524777d3048b8bd520043f90c1d28/.files/key/synapse.json
Then invoke this example script ... |
379e6cfb19b349dfc3b487acac67b07c37a8cad61470c77669c0ec8c4a428420 | Python | 7,242 | 217 | from pathlib import Path
from typing import Literal
import numpy as np
import pandas as pd
import plotly.express as px
import scanpy as sc
from scipy.spatial import KDTree
from gsMap.config import VisualizeConfig
def load_ldsc(ldsc_input_file):
ldsc = pd.read_csv(
ldsc_input_file,
compression="g... |
a37720eb3a5d2e1961ff5349c144a9d67ac6f22a630b1a05db797ea98e29af7a | Python | 7,244 | 210 | """Deprecated compatibility shims for :class:`pgmpy.causal_discovery.ExpertInLoop`
and :class:`pgmpy.causal_discovery.LLMPairwise`."""
from collections.abc import Callable, Hashable
import pandas as pd
from pgmpy.base import DAG
from pgmpy.causal_discovery import ExpertInLoop as _ExpertInLoop
from pgmpy.causal_disco... |
53bcd23ee3415525d8fd6b514fa5c65949f4bccf66b30b2f64d2df5a58d3b333 | Python | 7,249 | 195 | from __future__ import annotations
from collections.abc import Mapping
from itertools import cycle
from typing import TYPE_CHECKING
import torch
from torch.utils.data import DataLoader
from scvi import REGISTRY_KEYS
from scvi.module import Classifier
from scvi.train import AdversarialTrainingPlan
if TYPE_CHECKING:
... |
c51d934bcb3e63563fa5a3df8d66185ef48e6fb54b391a94dba96c2e174b428f | Python | 7,253 | 210 | import argparse
import logging
import os
import haiku as hk
import jax
import optax
from args import add_density_args
from oneqmc.convert_geo import load_molecules
from oneqmc.data import as_dict_stream, as_mol_conf_stream
from oneqmc.density_models.main import estimate_density
from oneqmc.density_models.score_matchi... |
375fea928e8fa301ebb16233f4d420223b12c93c501c77934b495f5dd3a193c5 | Python | 7,255 | 289 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 8 19:10:29 2025
@author: forel
"""
oss_params = {
"BrainRegion": {
"Center": {
"x[mm]": 8.04146971649281,
"y[mm]": -14.364058770144673,
"z[mm]": 0.9143724523894229
},
"Dimension": {
"x[mm]": 54.383297871632166... |
6bfa1c8be1453e89075c5fd36172a73e8b8a1716e584cbfe02120ec0cb33e1ed | Python | 7,260 | 191 | import matplotlib.pyplot as plt
import numpy as np
import scanpy as sc
import seaborn as sns
from anndata import AnnData
from matplotlib.collections import LineCollection
from scipy.cluster.hierarchy import dendrogram
from sklearn.cluster import AgglomerativeClustering
from .. import utils
from .._constants import Key... |
ba66dce498c4f66734b035992924042978022d98c86d11e15327b7a7e78aa46e | Python | 7,260 | 194 | import unittest
import sys
if "DEBUG" in sys.argv:
sys.path.insert(0, "..")
sys.path.insert(0, "../../")
sys.path.insert(0, ".")
sys.argv.remove("DEBUG")
import metax.WeightDBUtilities as WeightDBUtilities
class TestWeightDBUtilities(unittest.TestCase):
def testGeneEntry(self):
entry = W... |
645c7fe201bfaa8c65182719e53019960fef71059fa20b4693aa3a338cd37ae9 | Python | 7,262 | 186 | """
This is a python version of this function:
https://github.com/yeatmanlab/AFQ/blob/master/functions/AFQ_MultiCompCorrection.m
"""
import random
import numpy as np
import scipy.stats
def get_significant_areas(pvals, clusterFWE, alpha=0.05):
"""
Mark clusters of size clusterFWE of consecutive values smaller... |
0a07bb871950df0e8043fb79c6a6e45790928ac532c2fe65873d5a8e7bcfba29 | Python | 7,265 | 220 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 29 17:18:45 2025
@author: hanna
"""
import os
import pickle
import numpy as np
import pandas as pd
from tqdm import tqdm
import seaborn as sb
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from scipy import stats
"""Plott... |
18b86e4afb22e21396773a060097355dc42cf660e62fb98a6438f690c88126f9 | Python | 7,265 | 182 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.modules import TransformerDecoderLayer, TransformerEncoderLayer
from . import build_monotonic_attention
from typing import Dict... |
35ff96525929cc6ad60407db7c89d9386d39906cc476eaee58882452bf4d76e9 | Python | 7,271 | 299 | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from poetry.core.packages.package import Package
from poetry.console.commands.add import AddCommand
from poetry.console.commands.self.self_command import SelfCommand
from poetry.factory import Factory
from tests.console.commands.self.... |
48e6dec4176e10b1dff5b9e4fb4cddd8b9774957d2b26b3c5101e97bd7e4efa0 | Python | 7,274 | 231 | """
***This code is derived from xml_translate.py (coded by "Guillermo Rocamora Pérez") in hybrid_doc2vec model***
This file aims to generate a tsv file in form [MeSHID, [(PMID , tokenized tagged-terms)]] from the annotated XML files obtained from
[Whatizit](https://github.com/zbmed-semtec/whatizit-dictionary-ner).
E... |
947935e567ba14bb29db9f04ee03615491ea94d9c4085134aa9f22123487dbaa | Python | 7,275 | 200 | #!/usr/bin/env python3
"""
Create 3x3 panel plot with neural network posteriors and MSMC2 baseline.
This script reads:
1. Existing comparison-results.pkl files (neural network posteriors)
2. New baseline_results.pkl file (MSMC2 estimates)
And creates a unified panel plot showing all methods.
"""
import argparse
impo... |
c1fe7f449440d94be91f2a48947ba4df73388550fe09ea146a178eaf22fcc74f | Python | 7,280 | 203 | from os.path import join
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from analysis.vis_utils import get_data_trace, get_reactome_pathway_names
from plotly.offline import plot
from config_path import BASE_PATH
module_path = join(BASE_PATH, 'analysis/figure_3')
def get_node_colors(all_node_la... |
45138ca574fed0c1f22cabedd675c654f8552b712c4b7ba1054bbe3391398799 | Python | 7,282 | 168 | """Print a GO term's lower-level hierarchy."""
__copyright__ = "Copyright (C) 2016-present, DV Klopfenstein, H Tang. All rights reserved."
__author__ = "DV Klopfenstein"
import sys
import collections as cx
from goatools.godag.consts import NAMESPACE2GO
from goatools.gosubdag.go_paths import GoPaths
from goatools.rpt.... |
ad0d8b178ee5e4f27e6c8cd5875d77b4f96d2735e207309aaa10c3ef615c1804 | Python | 7,283 | 228 | """Shared fixtures for GUI tests.
Generates a small synthetic test environment with multiple bout files
(WAV + .rec + .not.mat) inside a ``bird_test/experiment_a/day_1`` tree
so that the GUI can start without touching real user data.
"""
import configparser
import os
import shutil
import textwrap
import matplotlib
im... |
eee44837ee0502884af86e1705259e409e571ed693f541f11a6eac47e84fd149 | Python | 7,289 | 192 | import os
import h5py
import shutil
import numpy as np
from types import SimpleNamespace
from itertools import combinations
from voluseg._steps.step4e import collect_blocks
from voluseg._tools.constants import hdf, dtype
from voluseg._tools.clean_signal import clean_signal
from voluseg._tools.evenly_parallelize import... |
6f1254d558ebf19a062a6357845aeaf74809577c9ef88f6d07301624bbb6fdb0 | Python | 7,290 | 192 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
5f466474b004bccf22327db74c1de9b5d056b8fdfef19b43aeb8c29a4bfe684e | Python | 7,292 | 223 | import argparse
import os.path
from argparse import ArgumentDefaultsHelpFormatter
import numpy as np
from utils import io_utils
from utils.model_utils import build_model, build_explainer
from utils.parser_utils import set_defaults_explain
from utils.train_utils import set_seed
def argparser():
parser = argparse... |
6e885fe1236b86189c1612117c54aca4d2a7ee7d66e9658828ee2120953bdb01 | Python | 7,294 | 211 | #!/usr/bin/env python3
"""
Test script to validate data augmentation implementation for HIPPIE.
Tests augmentation functionality with synthetic data and creates visualization plots.
"""
import numpy as np
import matplotlib.pyplot as plt
import torch
from pathlib import Path
from hippie.dataloading import MultiModalEp... |
a6187d5ccbc8e70df0f43c2124d0e625dc91a8ca77aeeeeb99797a0e29d3e427 | Python | 7,295 | 204 | docstring = """
Draw posterior samples for targets simulated under a particular regime ("target"),
using a models trained under another regime ("query").
"""
import os
import zarr
import torch
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import yaml
import argparse
import sys
import glob
im... |
d61efacdb5ed830f723c7ffeb0437759caded39c776fdb8e895c479cf8312c79 | Python | 7,302 | 187 | """TweetyNet model"""
from __future__ import annotations
import torch
from torch import nn
from ..nn.modules import Conv2dTF
class TweetyNet(nn.Module):
"""Neural network architecture
that assign labels to time bins
("frames") in spectrogram windows.
as described in
https://elifesciences.org/a... |
e2f15e060f42b012b695ab75359a7b41ae9d2ff65339a26140558e8176ced3f0 | Python | 7,302 | 227 | import logging
import numpy as np
import time
from fishspot.filter import white_tophat, apply_foreground_mask
from scipy.spatial import cKDTree
from scipy.stats.mstats import winsorize
from skimage.feature import blob_dog, blob_log
logger = logging.getLogger(__name__)
def blob_detection(
image,
min_blob_ra... |
faff6052e98fac0312f12837c14dcd2e1735ddb409397e4ae629985c407a30df | Python | 7,307 | 149 | #!/usr/bin/env python3
"""O canal de hibridação corrige o viés dos iodetos?
Protocolo do artigo: alvo `gap_reg` (gapadas sem misto_F), features / n_atomos,
CV agrupada por familia A/B, base wave15 como referencia.
TRES TESTES, em ordem:
1. NOS IODETOS (n~205) -- o regime onde o vies mora e onde o canal deve agir.
... |
616b6920059c95786ac5e049d47a0aae0c31c42b9c31bbbe14eeac2dd0e25879 | Python | 7,310 | 166 | from typing import Dict, List
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import LineCollection
import loompy
from cytograph.species import Species
from .colors import colorize
from .dendrogram import dendrogram
class Heatmap():
def __init__(self, genes: np.ndarray, attrs: Dict[... |
0034d439a83818195e81a50514a055ca5d9aef578819500cc8e4e97d65369eea | Python | 7,316 | 173 | # Authors: Christian O'Reilly <christian.oreilly@sc.edu>
# Scott Huberty <seh33@uw.edu>
#
# License: MIT
import numpy as np
from importlib.metadata import version
import warnings
from .config import ConfigMixin
class RejectionPolicy(ConfigMixin):
"""Class used to implement a rejection policy for a pipe... |
7d3a1c8e8e5ac485277146da219a162c900fd982d65fe867f8c394ed306a5ae7 | Python | 7,316 | 193 | """Class and functions for ``[vak.eval]`` table in configuration file."""
from __future__ import annotations
import pathlib
from attrs import converters, define, field, validators
from attrs.validators import instance_of
from ..common.converters import expanded_user_path
from .dataset import DatasetConfig
from .mod... |
eac039b72e249f852143f7a2410cd1328222b5fce5a5aaae4dd3a8ae6e03af52 | Python | 7,320 | 229 | """
This python script contains the code to compute the precision@N matrix for the
TREC and RELISH datasets.
author: Vishnu Vardhan Dadi
credits: [Leyla Jael Castro, Dietrich Rebholz-Schuhmann]
copyright: GENERAL PUBLIC LICENSE Version 3, 29 June 2007
"""
from multiprocessing import Pool
from typing import List
impo... |
4d967c836ce099e10999b65f8ce433cdc64501050648d1fab34ea112e127c271 | Python | 7,325 | 177 | import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['figure.dpi'] = 200
from mpl_toolkits.mplot3d import Axes3D
from pyevtk.hl import gridToVTK
def plotForceDisp(fdGraph,figHeight,figWidth):
filename = "Force-Displacement"
plt.figure(figsize=(figW... |
db52f55b4c7556d77d40eeec8920f00e77ef6d556a8c0a4ac2483ba8c859281b | Python | 7,327 | 218 | import numpy as np
from pgmpy.factors.base import BaseFactor
class LinearGaussianCPD(BaseFactor):
r"""
Defines a Linear Gaussian CPD.
The Linear Gaussian CPD makes the following assumptions [1]:
1) The variable is Gaussian/Normally distributed.
2) The mean of the variable depends on the ... |
705873719f8dc8c2d9cba21981ea16664d896e4582f5d027a175078f30d39cb3 | Python | 7,329 | 217 | """Gerador de FDF para a campanha SIESTA de perovskitas (produção).
Todos os parâmetros numéricos vêm de `config.json`, que é escrito pelos testes
de convergência em `tests/driver.py`. Nada aqui é chute: cada valor tem uma
justificativa registrada em tests/REPORT.md.
Duas decisões merecem destaque porque ambas foram ... |
7f62949363d59dc7cb1cb7e1217ec3966d5ee81b15b4ace91a95d7225e1131e9 | Python | 7,331 | 216 | import argparse
import os
import random
import time
from copy import deepcopy
import h5py
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torchdiffeq import odeint
from torch.utils.data import Dataset, DataLoader
learning_rate = 0.001
num_epochs = 500
device = torch.device("cpu... |
717a550b8964e3074ac29692a87d0e784eb3f7ea55413f07bfdef35aeac80727 | Python | 7,333 | 211 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import random
from collections import Counter
import torch
class EM:
"""
EM algorithm used to quantize the... |
f0adfa2171a91302e56dc7609bde5bc4c41bfba3fea8fc30bfbaeb9a8e0af313 | Python | 7,337 | 176 | """
Dataloaders
"""
import warnings
warnings.filterwarnings("ignore")
import sys
sys.path.append('../')
from typing import Dict, List, Optional, Tuple, Any
import torch
import numpy as np
import pickle
import torch.utils.data as data
class MultiDatasetSentences(data.Dataset):
def __init__(self, sorted_dataset_n... |
2ed0345a719756a81500803ac42885603ac63558799f541d5191a9f705be791f | Python | 7,338 | 147 | """R1-C7: KAN ablations + parameter-matched MLP, under the PAPER's pipeline.
Everything here uses paper2/loaders.py, the paper's group hold-out (seed 42, 30%), the paper's
per-food preprocessing and per-food tuned PLS compression, and stratified GroupKFold on the TRAIN
split. Preprocessing and PLS are refitted inside ... |
4bab48d38d878df451901e5e9c0085d54bcf6a439fd794ceaa95115d72611993 | Python | 7,339 | 192 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import ast
import logging
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
import soundfile as sf
import sys
import... |
8078320119017182ab16cd26f4183a1a3defab2a7a2ec0ca08e7f2659fb09ec6 | Python | 7,342 | 232 | from pathlib import Path
import tempfile
import shutil
import numpy as np
import pytest
from scipy.sparse import csr_matrix
from datasets import Dataset
from anndata import AnnData
from scgpt.tokenizer import GeneVocab
from scgpt.scbank import DataBank, DataTable, MetaInfo, Setting
tmp_dir = tempfile.gettempdir()
sa... |
8a230ba7ebc909bad9d0996cda43ee5ace3838e005e1dd9730dfa2d2fbd50c43 | Python | 7,343 | 190 | import os
import tempfile
import unittest
import zipfile
import medaka.export
import medaka.features
import medaka.labels
import medaka.models
class TestDictNesting(unittest.TestCase):
def test_001_expand_keys(self):
flat_dict = {"a.b.C": 0, "a.b.D": ["1a", "1b"], "B": 2}
expected = {'a': {'b': {... |
aff9e9df2129279b18299af49b976bc470f610637a14cc5db284eda427dc8ed4 | Python | 7,345 | 200 | """
Conditional point cloud diffusion model: denoising in the original point cloud space, conditioned on node-level latent variables
Inputs:
- X_t: noise-corrupted point cloud at time step t [Batch Size, N, F]
- t: time step embedding
- Z_nodes: node-level conditions [Batch Size, N, d_node]
Output: predicte... |
da5d64987b1ac560dc18b96adb8d9488576566ea1fb55b48862f5ad201bf25f9 | Python | 7,345 | 110 | from argschema import ArgSchema, ArgSchemaParser
from argschema.schemas import DefaultSchema
from argschema.fields import Nested, InputDir, String, Float, Dict, Int, NumpyArray
from ...common.schemas import EphysParams, Directories, CommonFiles
class KilosortParameters(DefaultSchema):
Nfilt = Int(required=False, de... |
8560ad374d83ecf54572118840e85fe1ae0049497027d9b9b702f6b22d38e749 | Python | 7,346 | 151 | #!/usr/bin/env python3
"""Duas coisas que um parecerista vai pedir: descritor externo e curva de aprendizado.
(1) MAGPIE. A linha de base do artigo e o proprio 1F (contagem elementar ponderada
por energias orbitais). Um revisor tem razao em perguntar se ela nao e um
espantalho. Magpie (Ward et al., npj Comput.... |
be5adbd2465480e29936bdd60b1011da3dfba1c4c813fa030429739b3ee9316e | Python | 7,350 | 199 | import logging
import numpy as np
from anndata import AnnData
from sklearn import metrics
from .._constants import Keys, Nums
log = logging.getLogger(__name__)
def mean_fide_score(
adatas: AnnData | list[AnnData], obs_key: str, slide_key: str | None = None, n_classes: int | None = None
) -> float:
"""Mean ... |
c044db582ee76d71bd4a4f7b73cccb5dc21275037ae6d9ac75c5f36d8dd252ba | Python | 7,350 | 215 | import pytest
from pgmpy.base import MAG
# graph has been taken from the zhang 2008 paper (figure 1)
@pytest.fixture
def mag():
edges = [
("A", "B", "<>"),
("C", "D", "<>"),
("A", "C", "<>"),
("B", "D", "<>"),
("A", "D", "->"),
("B", "C", "->"),
]
roles = {... |
ac137285dac61ef68b56b14515c94ad5d0d0b634ee62cc528ecc9a000e077e3d | Python | 7,351 | 131 | #!/usr/bin/env python3
"""Figure 7: STRING physical-interaction network and pathway enrichment.
Panel A distinguishes the 17 tiered candidates, the suggestive non-tier-1 gene
HLA-E, and canonical context genes. Panel B deliberately uses only the strict
17-gene tiered panel so that suggestive evidence is not folded in... |
d46c0641ff158b901549f278df9cb2a523b92684262d0faecfb4e28e400b8283 | Python | 7,354 | 135 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI/ControlWindow.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5.QtMultimediaWidgets import QCameraViewfinder
from pyqtgraph import PlotWidget
from PyQt5 import QtCore, Q... |
7c99943688a71b66b9e2d2e2d53a8c1728ad9812dd522b0201a2954992993cb0 | Python | 7,366 | 216 | """Measurement: should the embeddings store be LMDB or HDF5?
`hdf5plugin` ships the same Blosc2 codec `embeddings_store` drives directly, so
the comparison is made at identical codec settings on real activations, or it
measures the codec rather than the container. Three numbers decide it and they
do not agree: size is... |
ad37e0aeb47abdf18637c5a4c9e63b376956f9b9cf6853085d21c50ca98c30b9 | Python | 7,367 | 159 | import pandas as pd
import numpy as np
from preprocessor.utils.preprocess_axial import get_segment_iax, update_root_node
class AxialCurrentPreprocessor:
"""
Initializes the AxialCurrentPreprocessor class.
Initializes two primary DataFrames:
- axial_current: Stores calculated axial currents with a Mu... |
c33afee97a6c660b966b5ae33a6bdac882e948b611fb6b16ff2fe8d8fd5d471a | Python | 7,368 | 214 | #!/usr/bin/env python3
import argparse
from functools import partial
import nibabel as nib
import numpy as np
from aodf.filtering.aodf_filter import AsymmetricFilter
from scilpy.io.utils import get_sh_order_and_fullness
from aodf.filtering.utils import get_sf_range, add_sh_basis_arg, parse_sh_basis
from dipy.data impor... |
25ae10b07e75421d0f5cb0d08711ffbef932ef0044f53cea90d2041a3b0866ab | Python | 7,370 | 160 | import matplotlib.pyplot as plt
import numpy as np
import igraph as ig
import networkx as nx
import os
from tqdm import tqdm
from copy import deepcopy
from scipy.stats import sem
from scipy.stats import ttest_ind, ttest_1samp
def mnn_cut(arr, nn = 2):
"""
Cuts the edges of the graph in the input array by keepi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.