sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
4f130386d1fd84b1d57415bfe7e5303d0d9f2ca0b4b7a43bc3370b710a3ecf9b | Python | 6,907 | 112 | """LATERAL_EXCITATION.py 2026-10-01. Pre-registration: 04-NOTES/PREREG-2026-10-01e-LATERAL-EXCITATION.md
Olsen, Bhandawat & Wilson (2007): PNs of a glomerulus whose receptor neurons are silenced still respond to odours, and input
to one receptor type depolarizes the PNs of the other glomeruli. Do the sign fix (D, F4) a... |
607ab5a4c9513d9d19f916802ab7a24cf76643db467cb4877173731da85f066e | Python | 6,907 | 152 | import torch
from torch.utils.data import Dataset, random_split, DataLoader
from typing import Any, List, Type
from pytorch_lightning import LightningDataModule
# local imports
from ..colors import Color, RandomRed, RandomBlue, Grey
from ..old_shapes import Pixel, Orientation, Rectangle
from ..textures import Texture
f... |
36e95d9c0d48a8c299e759613e379ceac447b35f952fcc87ecc3b66cecf9b320 | Python | 6,908 | 208 | from abc import abstractmethod
import pytest
from elasticai.creator_plugins.lutron_filter import DataGraph, reorder
from elasticai.creator_plugins.lutron_filter.rules import _ir
from elasticai.creator_plugins.lutron_filter.rules._reorder import (
_make_constraint,
_pattern_graph,
)
from elasticai.creator.grap... |
d01fe1ded25a93fd0ab662481c4f252894e3d2e36dc3b461cfbbaf02f343ebf9 | Python | 6,908 | 200 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
40e51a9eb09e065acb850cb3341cf347eedff219854ea6153b4f15db253507ed | Python | 6,909 | 212 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 26 11:55:28 2020
@author: hannekevandijk
"""
#%% 1
from BCD_gitprojects.preprocessing_beta.io import FilepathFinder
from BCD_gitprojects.preprocessing_beta.interprocessing import interdataset as intds
import numpy as np
import pickle5 as pickle
impo... |
4a3544758520399d30b1f58741326dc44ba4362d8fc9b8ccfb2d2fadb00cf042 | Python | 6,909 | 203 | import argparse
import os
import anndata
import cirrocumulus
from cirrocumulus.anndata_dataset import AnndataDataset
from cirrocumulus.envir import (
CIRRO_AUTH,
CIRRO_CELL_ONTOLOGY,
CIRRO_COMPRESS,
CIRRO_DATABASE,
CIRRO_JOB_RESULTS,
CIRRO_JOB_TYPE,
)
from cirrocumulus.io_util import SPATIAL_H... |
520a8d0b8e4ded4cbe543bcdb744a1ed2815cd6acd326d58af20f5899d4e70b1 | Python | 6,910 | 195 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use... |
2365a78709a43e6d497316eb1eb34718464f5d69d833899ca669f041a6fe160f | Python | 6,911 | 202 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
3fe5908d24a2784dfc0d78cc0dad6de171e728943989d11a293d0fc97c26f0a4 | Python | 6,911 | 181 | from __future__ import annotations
import os
import sys
from configparser import ConfigParser
from pathlib import Path
from .api import PlatformDirsABC
if sys.platform.startswith("linux"): # pragma: no branch # no op check, only to please the type checker
from os import getuid
else:
def getuid() -> int:
... |
3b8927a2dd8f29be97bb79bc45f812689c150fb6537e35fa958b79171e288ff5 | Python | 6,912 | 230 | from __future__ import annotations
import argparse
import cuppa.visualization.visualization
from cuppa.constants import DEFAULT_FUSION_OVERRIDES_PATH
class DEFAULT_RUNNER_ARGS:
output_prefix: str = None
compress_tsv_files: bool = False
min_samples_with_rna: int = 5
excl_classes: str | list[str] = ... |
d5ed8350211b32524327c4fcb5b2f3cebe3900411a0f3401c0304840f2a21350 | Python | 6,912 | 186 | # -*- coding: utf-8 -*-
#
# Convert between MNE and Syncopy data structures.
#
import numpy as np
import syncopy as spy
from syncopy.shared.parsers import data_parser
from syncopy.shared.errors import SPYValueError, SPYTypeError
__all__ = [
"raw_adata_to_mne_raw",
"raw_mne_to_adata",
"tldata_to_mne_epoch... |
d6065623d5cbcaacbe245686c3e4ae6fe5017310c27360bc871756a6db761c02 | Python | 6,912 | 187 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
ff3d3576784922d7ef39415c80b8b60253c86968633e1b956f17a0f570982885 | Python | 6,912 | 187 | # Functions to run simulations for PSO
from neuron import h
h.load_file("stdrun.hoc")
import numpy as np
import cell_esser
from net_esser import net_esser
#########################################
# Defines and launches a TMS simulation #
#########################################
def sim_tms_singlepuls... |
e11b68f7e83ebe411bbff594156752e89ce37916b661240cc4543e8432df8c88 | Python | 6,916 | 190 | import tensorflow as tf
import sys
sys.path.append("../utils")
from utils import layers
def build(
model_name: str = "new_BioNML_CrossAtt_v2",
sequence_length: int = 150,
motif_size: int = 512,
kmer_size: int = 1024, # use 5mer
motif_length_max: int = 30,
kmer_length_max: int = 5,
motif_... |
2cdb624e9a92929d52d12fa389038a7de40792219508eab4938e47e10d3b8498 | Python | 6,923 | 183 | rest_api_version = 99
supervised_learning = False
def class_extensions():
@property
def aggregated_frame(self):
if (self._model_json is not None
and self._model_json.get("output", {}).get("output_frame", {}).get("name") is not None):
out_frame_name = self._model_json["outpu... |
1656cd6dea2a085fe87f030012d90ce16a7b00d48c352fd11a6927b5e617c31a | Python | 6,930 | 203 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
ff8cbf48af9fd0ed636e76c96caae42f077237e66c48861f693223169c28ab68 | Python | 6,930 | 187 | import math
import torch
import torch.nn as nn
from torch.nn import functional as F
import numpy as np
from scipy.linalg import block_diag
from torch.autograd import Function
from layers.graphsage_layer import GraphSageLayer, DenseGraphSage
def masked_softmax(matrix, mask, dim=-1, memory_efficient=True,
... |
11ea41c48f7b8fbc126770264444d8c954e647d3684dab35e6f73ca68a715538 | Python | 6,931 | 237 | """ PEP 610 """
import json
import re
import urllib.parse
from typing import Any, Dict, Iterable, Optional, Type, TypeVar, Union
__all__ = [
"DirectUrl",
"DirectUrlValidationError",
"DirInfo",
"ArchiveInfo",
"VcsInfo",
]
T = TypeVar("T")
DIRECT_URL_METADATA_NAME = "direct_url.json"
ENV_VAR_RE = r... |
2ed26457bd09b21fca8e96bc1f1847b77cb476df46aa8f7ea9b471a10f83ed55 | Python | 6,932 | 80 | """posthoc_law_attack_2026-10-02.py — POST HOC checks asked for by the review panel on the inequality (2 Oct, late night).
(1) the simpler rival: synapses onto uPNs counted only for cells that fire (binary weights), with its own two breaking values;
(2) each test's own best threshold, and BANC's; (3) a logistic fit of ... |
a73e027de097d1743bdd87d02a030080578455d09c9965b896b430697f617b29 | Python | 6,932 | 162 | """The half-brain crop for a plain 2-D custom pair.
A 2-D run against a CCF SECTION already crops along the shipped plane
(``ccf_index is not None`` -> ``plane_for_atlas``). A plain 2-D custom pair -
the user's own section against their own template - had no plane available at
all, so ``halve_and_pad`` fell back ... |
62ce71439757e1191db890ba79f10e7d568e45c77e60584f2ff945db0c46341c | Python | 6,933 | 167 | from __future__ import print_function
import sys
sys.path.extend([
'pddlstream',
'ss-pybullet',
#'pddlstream/examples',
#'pddlstream/examples/pybullet/utils',
])
import argparse
import numpy as np
#np.set_printoptions(precision=3, threshold=3, edgeitems=1, suppress=True) #, linewidth=1000)
from cont... |
6ce85909039b0a0bcef3cee5390317563ea2d7d92d670eb7c879f63c751b8ad2 | Python | 6,933 | 205 | # count.py
from collections import Counter, defaultdict
import numpy as np
import pandas as pd
from umi_tools import UMIClusterer
from umi_tools import __version__ as umi_tools_version
from fba.levenshtein import rev_compl
from fba.utils import get_logger, open_by_suffix
logger = get_logger(logger_name=__name__)
... |
a428df2411578d07b7e3e1bf5129fcf0a89c6b1a17cfa4c82d41dd0233f6ed2c | Python | 6,933 | 160 | import torch
import numpy as np
import schnetpack as spk
class MeanSquaredError(spk.metrics.MeanSquaredError):
def __init__(self, target, model_output=None, bias_correction=None,
name=None, element_wise=False):
name = 'MSE_' + target if name is None else name
super(MeanSquaredEr... |
fdca43c1d498e4afb90e5d7855129df9d76c15ec73305f82592f6680d57addc1 | Python | 6,933 | 160 | import os
import argparse
import datetime
import pathlib
from torch.utils.data import ConcatDataset
from source.dataset_collection import DeepVIDv2Dataset
from source.network_collection import DeepVIDv2
from source.worker_collection import DeepVIDv2Worker
from source.utils import JsonSaver
def get_parser(parent=No... |
5477a0cd24f02f7a076c43295d8f8d23a920cdc508e489e659066036fef62071 | Python | 6,935 | 144 | import warnings
warnings.filterwarnings("ignore")
warnings.filterwarnings("ignore", category=UserWarning,
message="A NumPy version >=1.18.5 and <1.25.0 is required for this version of SciPy*")
import os
import argparse
import numpy as np
import pandas as pd
from glob import glob
from itertools i... |
8f7c468c9627e7ac10e4c4c5c89668bd335ca8995d6878431b7ce94d7a6033c4 | Python | 6,935 | 161 | """
DeepLabCut2.0 Toolbox (deeplabcut.org)
copyright A. & M. Mathis Labs
https://github.com/AlexEMG/DeepLabCut
Please see AUTHORS for contributors.
https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
Licensed under GNU Lesser General Public License v3.0
"""
import wx
import os,sys,pydoc
import deeplabcut
media... |
c5c86289abb2345f74ffb01a504d1d6b2b2bba3d48d9765b3356079fe1b6d4fb | Python | 6,935 | 160 | #!/bin/usr/python3
# Use example: python predict_medicalnet.py /home/melanie/sMRI_ASD/data/train1/BIDS_data_brain /home/melanie/sMRI_ASD/net2/MedicalNet/train1_models_lr_1e-3_resnet50_new_preproc_from_10ep/model_42_epochs.pth /home/melanie/sMRI_ASD/net2/MedicalNet/train1_models_lr_1e-3_resnet50_new_preproc_from_10ep/p... |
aa767ea8df8d62dae708c9a15695bcfe2b833d0d29ac4c8c9e4ae1865dc3ffeb | Python | 6,936 | 202 | """Preprocessing for raw eye-position traces.
The detector assumes clean position data; this module is responsible for
producing it. Each step is a separate function so callers can compose
their own pipeline.
Order of operations recommended for the published datasets:
1. mark_blinks — flag samples where ... |
b3c4161fb9ffe594acd493585eabca0c36eff7365a9bb5250fc155c8fd1b6838 | Python | 6,938 | 200 | """
From an input particles STAR file, makes a copy that indexes the subvolumes with noise added on background
(Original subvolumes are not modified)
Input: - A STAR with particles
- Mask to set foreground (True) and background (False) in the reference space
Output: - A mirrores STAR fil... |
9025af69ea471a498baa9df4b9f5f154ecb0d0574a89520c5dd71f84695e4293 | Python | 6,939 | 178 | from __future__ import annotations
from dataclasses import InitVar, dataclass, field
import numpy as np
from SurvivalEVAL.nonparametric_estimator.util import (
_compute_event_counts,
infer_survival_probabilities,
)
@dataclass
class CopulaGraphic:
"""
Estimate survival with a copula model for depend... |
22977498204e2a3ad5ae35a1e4217ba20d8603020ae48e67b1d5962caf831bea | Python | 6,940 | 153 | '''
Script that generates ML tables.
NOTE: It's very important that the ML table that you use lines up with the PLECs.
So each line number in the ML table should correspond to the line number in the PLECs .npy file.
This is incorporated in the ML-table generation script. Therefore, generate the ML-table after the PL... |
4d4886fdd3b4bc30abc93aaf94bb74b1e9b11bed474c523448d1baedf5c16a24 | Python | 6,940 | 149 | import numpy as np
import pickle
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter,ScalarFormatter
import matplotlib as mpl
from matplotlib.lines import Line2D
'''
Adapted from code written by Guadalupe Garcia
'''
from scipy.integrate import odeint
def mito_ode_calc(timeSpan, geoParam,... |
baf23daa574d81e63faea2d245ad0fddbc48a2fa64956df133d192a643e9d8e9 | Python | 6,943 | 169 | """Tests for the single-image registration tab's session memory.
Two layers:
1. The pure persistence helper (``session_state.py``) - Qt-free round-trip,
and graceful handling of a missing / corrupt cache.
2. A light Qt wiring check that constructing ``RegistrationTab`` ignores
saved registration st... |
e564e8a6ce60f5d95dbc28e44100d426fe8052c24d141ac61b315cb2e146096e | Python | 6,943 | 186 | import torch
import torch.nn as nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import MathOperations
from elasticai.creator.nn.integer.MPQ.addition.design import Addition as AdditionDesign
from elasticai.creator.nn.integer.quant_u... |
a0092f8ee5ae060e4e47df7f8b18f6fc196e47fdfa9d08335bff66008387f8ea | Python | 6,945 | 254 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
9284c0eebbae032c20d0c3b9cef895ac36752600bc4132923af7a7000d6dd23c | Python | 6,946 | 161 | from scipy.spatial.kdtree import KDTree
from heapq import heappush, heappop
from collections import namedtuple
from .utils import INF, elapsed_time
from .rrt_connect import direct_path
from .smoothing import smooth_path
import random
import time
import numpy as np
Node = namedtuple('Node', ['g', 'parent'])
unit_cost_... |
e661cf31cf4833791bcf94e08e72e70b5d432585588bb034f5585154f967e493 | Python | 6,946 | 154 | import inspect
from typing import Any, Callable, Dict, Optional, Text, Union, Iterable
import numpy as np
import tensorflow.experimental.numpy as tnp
import tensorflow as tf
#tnp.experimental_enable_numpy_behavior(prefer_float32=True)
from tensorflow.keras import layers as kl
def cos_w_warmup(current_step,
... |
1ee05d69a75c87e7125c5361802057a94feffd9b7bcd0e1f9a9f0f0af3887d9d | Python | 6,948 | 208 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
503f77f298cf9c8e2f3928c28209ed06e3b5d6961162747c32d818de33ba6c05 | Python | 6,950 | 190 | # Copyright (C) 2019 Computational Science Lab, UPF <http://www.compscience.org/>
# Copying and distribution is allowed under AGPLv3 license
import sys
sys.path.append(r'/home/jmwang/WorkSpace/GENiPPI/')
from gPPMol.nets import EncoderCNN, DecoderRNN, generator, discriminator, GNN_Model
from gPPMol.gene import *
from... |
7e79b7ed90d12f25e9724ac52f96af9a302d968c6e5f04caac345e0577c47c60 | Python | 6,950 | 244 | """This module contains classes of graphoelements.
These graphoelements can be generated by the package "detect".
"""
from copy import deepcopy
from csv import reader, writer
from numpy import empty, asarray, sum, mean
from .datatype import Data
class Graphoelement:
"""Class containing all the events of one ty... |
dfd4f0747fe26aef3c5fcc147f02f5cf24f7d1b3a088e312b1371cdeca49a6a7 | Python | 6,950 | 189 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use... |
08e08102f200fc10e2900833537d3d0e32ce3f8681297a6c48c237a559a5408e | Python | 6,951 | 206 | """
Utilities module
"""
# Copyright (C) 2021 Blue Brain Project, EPFL
#
# 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 the License, or
# (at your option) any later versio... |
d1565a012eb8fef7570a9fbeceefee73938ca330bd8566171093d86f332d9aa1 | Python | 6,951 | 217 | """Core recipes for FHI-aims."""
from __future__ import annotations
from typing import TYPE_CHECKING, Literal
from quacc import job
from quacc.atoms.core import check_is_metal
from quacc.recipes.aims._base import run_and_summarize
if TYPE_CHECKING:
from typing import Any
from ase.atoms import Atoms
fr... |
6f74abf7aec48be0bca4b4832ee6a6d35c48ed0b4a6586e9fc43d0d387879073 | Python | 6,952 | 241 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
703457a4e25ef2a307797e1511781653eadedb0cdcbf45a79cca3fdd9be74524 | Python | 6,953 | 168 | import functools
import math
import torch
from torch import nn
from torch.nn import functional as F
from torch.utils import checkpoint
from torch_scatter import scatter_mean, scatter_add, scatter_max, scatter_min, scatter_sum
from torch_cluster import knn, nearest
from torchdrug import core, data, layers, utils
from t... |
d4880548e6ffab2ab62b35ce188a6eac1bf68b650511707b1d7e63ad33cef5c4 | Python | 6,954 | 175 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""
This implementation is based on
https://github.com/rwightman/pytorch-image-models/blob/master/timm/data/random_erasing.py
pulished under an Apache License 2.0.
COMMENT FROM ORIGINAL:
Originally inspired by impl at https://github.com/zhunzhong0... |
1a7f3f171a84cbae3bc0e013c093a50cfe6aadb5f0b1e92a534b8876e01c95c9 | Python | 6,956 | 132 | # coding=utf-8
# Copyright 2021- NVIDIA Corporation and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... |
bb0089337e3e8ea385d9ecd6a2bccb99e1462c47fb3b4e4e1fdac45fb0237ffd | Python | 6,956 | 211 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Tong He and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
"""
import os
import time
import random
import argparse
import numpy as np
from pathlib import PurePath
import torch
import torch.utils.data
import torch.nn as ... |
c8f72419230c3072ea7cdf7f6c118f57ccd4f7ba863a43b030a425c792723cfe | Python | 6,956 | 198 | from neuron import h, gui
from neuron.units import ms, mV, µm
import neuron, matplotlib
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.colors import LinearSegmentedColormap, ListedColormap
from matplotlib.font_manager import FontProperties
import numpy as np
from mpl_toolkits.mplot3d import a... |
f84de4ac6100399bd7b47831e4c11b261a2f994afc4e82dfe90cd567fdfa61fb | Python | 6,956 | 170 | import argparse
import os
from pynv import Client
import pandas as pd
class NewClient(Client):
def update_image(self, image_id, file, **data):
files = {'file': open(file, 'rb')}
return self.request(
'patch',
f'images/{image_id}',
data=data,
files=fil... |
4a084e6e15de356484b720307e901cde8580c23bd2e95d8cd12c542a61710693 | Python | 6,957 | 168 | import tensorflow as tf
from pinn import get_network
from pinn.utils import pi_named
from pinn.models.base import export_model, get_train_op, MetricsCollector
from pinn.utils import count_atoms
r'''
The atomic charge (AC) quadrupole model constructs the quadrupole moment from
atomic charge predictions.
Quadrupol... |
fe1866a4422293022ede6e8a3fe1c1a7409a46682936d5b5da04d11675e3b10f | Python | 6,957 | 199 | #
# ACME's logging facilities
#
# Copyright © 2020-2025 Ernst Strüngmann Institute (ESI) for Neuroscience
# in Cooperation with Max Planck Society
# Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Builtin/3rd party package imports
import warning... |
7d54f368e1afa64a4e91396ed0aceeba668eeb31275f1ab094720b13b2fa6093 | Python | 6,958 | 191 | # !/usr/local/biotools/python/3.4.3/bin/python3
__author__ = "Naresh Prodduturi"
__email__ = "prodduturi.naresh@mayo.edu"
__status__ = "Dev"
import openslide
import tensorflow as tf
import os
import argparse
import sys
import pwd
import time
import subprocess
import re
import shutil
import glob
import numpy as np
from... |
195f2ab14ad0aea4c222a4b247ca23a985676bfd5239b283cccb66e6783c85c2 | Python | 6,959 | 211 | # 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
#
# ht... |
801ec56ba5f7b4e92ec932d9e6dc119c1b24de9acfb40fbbf6b0200c28621dca | Python | 6,959 | 133 | import seaborn as sns
import numpy as np
from matplotlib import gridspec
import matplotlib.pyplot as plt
cmap = plt.colormaps["tab10"]
inner_colors = cmap([1, 2, 3, 4, 5, 6,7,8])
plt.figure(figsize=(12, 8), dpi=500)
plt.rcParams.update({'font.family': 'Arial','font.size': 12, 'font.weight': 'normal'})
type = '2class'
#... |
a395cf94717b27a21730b178e3587d8dc41ad46fb0a8029fbd9ac065a63ee973 | Python | 6,959 | 209 | import numpy as np
import sys
import struct
def printBytesHex(data,
startIndex=0,
count=None,
column=None,
dataType='uint8',
byteorder=sys.byteorder):
"""按16进制字符串打印bytes
Args:
data: bytes
... |
0a90c8f98a21f4ae24d7888c168ac0d3cb953c6126be9e70eacdca91a8f361d2 | Python | 6,960 | 187 | import numpy as np
import pandas as pd
from abc import ABC
try:
from pykdtree.kdtree import KDTree
except ImportError:
from scipy.spatial import cKDTree as KDTree
from ..utils import printv
class GroundTruthModel(ABC):
pass
class PotentialConnectivityModel(GroundTruthModel):
"""Model using potent... |
4fa6f1e547bae3a3e089e8f48850ca154812020737daba233c59cf49cee4ff6c | Python | 6,962 | 151 | from scipy.io import loadmat
from scipy.stats import special_ortho_group
from ase import Atoms
from hotpp.layer import *
from hotpp.model import MiaoNet
from hotpp.utils import setup_seed, multi_outer_product, EnvPara
from hotpp.data import AtomsData
from torch_geometric.data import Batch
import unittest
import numpy a... |
b0d8a3ca7b305dd259813fbe6a1689e3471cc512c2d3a319a7004670d54cc8ca | Python | 6,963 | 124 | # 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
#
# ht... |
c7bf26b39eb664ef132578a4f328630ab5b9890c4724c1a98afea12c5d0f11bb | Python | 6,965 | 165 | """Compute the negative and positive affect per day based on the EMA answers.
The script also stores relevant information about menstruation and weight.
The input should be done in the following order:
Parameters
----------
file : str
path where the EMA answers file is stored
save... |
d1ba3ff974b2e530ebb62399835905aaa1233577d2b882ae4856932668ab6b10 | Python | 6,966 | 203 | # Paths
def set_path():
path = '/local/mbontono/data/' # absolute path of the data folder
return path
# Sets of variables
import os
import numpy as np
def get_hyperparameters(name, model_name):
if model_name == "LR_L1_penalty":
if name in ["ttg-breast", "BRCA-pam", "BRCA", "KIRC"]:
... |
0a9ba3efb25b959ecc1a32ec64fc75361554dc656e179834dc5e007077770e63 | Python | 6,969 | 188 | """
Created on Tue May 2 17:32:22 2023
@author: trianaa1
This script visualize the preprocessed heart and respiration rate from the BIOPAC
"""
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
from matplotlib.colors import ListedColormap, BoundaryNor... |
7f72a26365bc0b2cb6a8821e5c1d470138ffe3e0042de4b30cea908c6c5c6a91 | Python | 6,970 | 174 | """Riemannian adam optimizer geoopt implementation (https://github.com/geoopt/)."""
import torch.optim
from manifolds import Euclidean, ManifoldParameter
# in order not to create it at each iteration
_default_manifold = Euclidean()
class OptimMixin(object):
def __init__(self, *args, stabilize=None, **kwargs):
... |
441df1f2324653b6b1f062560fbb3ab53f8b740b12d95ef4c41a60e27d0447bf | Python | 6,973 | 149 | import dsmil as mil
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
import torchvision.models as models
import torchvision.transforms.functional as VF
from torchvision import transforms
import sys, argparse, os, glob
import pandas as pd
import numpy as np
from PIL import Image
from collecti... |
8d7e0e12005a606fbf8100d2fec3f5ab3106ae5371941d4e17f160912fe82fd6 | Python | 6,978 | 92 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from lab.reports import Attribute, geometric_mean
from downward.reports.absolute import AbsoluteReport
from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_r... |
225db74d2178ea83272702ec93e7b06e7364ec20dbadfb86658e19e1c68f0acb | Python | 6,979 | 210 | import torch
import torch.nn as nn
import numpy as np
from torchvision import transforms as T
import scipy.io as sio
# All data parameters import
from utils.params import ParamsPack
param_pack = ParamsPack()
from backbone_nets import resnet_backbone
from backbone_nets import mobilenetv1_backbone
from backbone_nets im... |
86a65b8b7851890df348cbc38d65ecb16696a2866dd36055eeae6ed8bca974db | Python | 6,980 | 199 | """Linear and Laplace-based image warping.
Ports of:
utils/image_warping.m
utils/Laplace_warping.m
solveLaplace.cpp (the Laplace boundary-value solver, in Python)
"""
from __future__ import annotations
from typing import Tuple
import numpy as np
from scipy import sparse
from scipy.i... |
23e6f644d3e34c83b27aa44a9199eca4ef80be0a20169b52455f6808ab19a043 | Python | 6,981 | 193 | import torch
from torch import nn
from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule
from elasticai.creator.nn.integer.math_operations import MathOperations
from elasticai.creator.nn.integer.matrixmulti.design import (
MatrixMulti as MatrixMultiDesign,
)
from elasticai.creator.nn.in... |
6f15137b59d75922b1807f8c501f1cbca1107fb449285c6f0fbcd9b2c0ccce26 | Python | 6,981 | 160 | #!/usr/bin/env python
# coding: utf-8
import pandas as pd, matplotlib.pyplot as plt, numpy as np, os
import seaborn as sns
from scipy.stats import spearmanr, pearsonr
plt.style.use('tableau-colorblind10')
color = {'donor' + str(k): '' for k in range(1,7)}
for c, k in zip(plt.rcParams['axes.prop_cycle'].by_key()['co... |
a8054f306a76e09b459b9c1a05da08ba0f89830f991e3c4ee80def687fe78672 | Python | 6,983 | 167 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'loading_window_design_new.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 i... |
04917ee083ed548f3c41e518871a91e97ec3c8a8c859eb2e2cf515893eca4087 | Python | 6,984 | 150 | import numpy as np
import pandas as pd
import scanpy as sc
import scanorama
from time import time
import anndata as ad
import harmonypy as hm
import scipy.sparse
import scanpy.external as sce
from memory_profiler import memory_usage
#from util.utils_B import set_seed
#from memory_profiler import profile
# # 1. Running... |
83c2efec11bd43a37072509fde0073c85453bc21c872cf6ef9b4e133e670f8f4 | Python | 6,984 | 208 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
9f4ecfa3727b9b99f307986a60f126baad7bb74d7571a12415d092a418ca47d2 | Python | 6,985 | 253 | # -*- coding: utf-8 -*-
#
# Test shared tools.
#
import pytest
import numpy as np
import json
import copy
import syncopy as spy
from syncopy.shared.tools import SerializableDict
from syncopy.shared.errors import SPYError
class TestTools:
def test_structdict_shallow_copy(self):
"""Test for fix of issue ... |
b038b99a60a436af0618b71edbf843fb11b58cf9cda7d0995ffc48b2172fe27a | Python | 6,985 | 188 | """
author: Felix Plasser
version: 1.0
description: package for rotating and superimposing NewtonX trajectories
"""
import os, sys
try:
import numpy
except ImportError:
print('numpy package not installed')
sys.exit()
try:
from openbabel import openbabel
except ImportError:
prin... |
49386711b6a05442d2750ab871da00432669f4b4d92ebba1ca27a94f62e0e258 | Python | 6,986 | 192 | import torch
import copy
import abc
import numpy as np
from ..utils import EnvPara
from torch.utils.data import Dataset, Sampler
from ase.neighborlist import neighbor_list
from typing import Optional, List, Iterator
__all__ = ["AtomsDataset", "atoms_collate_fn", "MaxNodeSampler", "MaxEdgeSampler"]
# TODO: offset and ... |
9d3f78b28b754a7ffac40e84258908306e858b3bfe6928b3e8e815f8c4ac1623 | Python | 6,986 | 270 | """Utility functions for dealing with Atoms."""
from __future__ import annotations
import hashlib
import logging
from copy import deepcopy
from typing import TYPE_CHECKING
import numpy as np
from ase.filters import Filter
from ase.io.jsonio import encode
from pymatgen.io.ase import AseAtomsAdaptor
if TYPE_CHECKING:... |
4fabd3b071ba35f4d1fe69b8808593f44bfc657a5c9ce36533b98c21fbac5d8f | Python | 6,987 | 204 | """
Bonito Model template
"""
import numpy as np
from bonito.nn import Permute, layers
import torch
from torch.nn.functional import log_softmax, ctc_loss
from torch.nn import Module, ModuleList, Sequential, Conv1d, BatchNorm1d, Dropout
from fast_ctc_decode import beam_search, viterbi_search
class Model(Module):
... |
a4cac636fbabdefdc2c9d31d969a7be22eb06de570da3c292c8c551713bcd178 | Python | 6,988 | 188 | #!/usr/bin/python3
import os
import matplotlib
matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
from osgeo import gdal
from tensorflow.math import confusion_matrix
def onehot_decode(onehot, colormap, nr_bands=3, enhance_colours=True):
"""Decode onehot mask labels to an eye-readable imag... |
958a88fbcf811fa72005feea5d6cebbe115314d30d1640eb83a58b12c3e578a6 | Python | 6,989 | 222 | from __future__ import annotations
import numpy as np
import pandas as pd
from typing import Literal
from pprint import pformat
from functools import cached_property
from cuppa.classifier.cuppa_prediction import CuppaPredSummary
from cuppa.logger import LoggerMixin
from cuppa.misc.utils import as_categorical
class C... |
b93267187bb1ff3b257aedb289ca4a8538991b908bd98f6c5e3e41260abc0411 | Python | 6,989 | 194 | # Copyright (c) OpenBII
# Copyright (c) Lynxi Technologies Co., Ltd. All rights reserved.
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import copy
import os
import os.path as osp
import time
import warnings
os.environ['CUDA_VISIBLE_DEVICES'] = '0,1,2,3'
import mmcv
import torch
from mmcv import Co... |
f26b16e70291d41f01205fa36bd98abccde887261c5359583f9163b4269fef1e | Python | 6,990 | 152 | """
KNOWN_NT_TRAINING_EXCLUDED.py - written 2026-09-17.
CLOSING THE CIRCULARITY QUESTION INSTEAD OF DECLARING IT UNCLOSABLE.
RESULT-2026-09-17b says the classifier's training list cannot be checked because the six
ground-truth files in Eckstein's Zenodo record are 0 bytes. That was true of those files and
false... |
3a88bd80126785b2dac1320e66362b0c061268ec1fca87a120bbe913bcb1c173 | Python | 6,997 | 137 | import argparse
import os
import h5py
import glob
import csv
import time
from datetime import datetime
import numpy as np
from skimage import measure
from scipy.ndimage import measurements
from plantsegtools.utils import H5_FORMATS
try:
import ray
except ImportWarning:
pass
def parse():
parser = argparse... |
39324726b5eb1c7c19611d917fca78adf16629b90444e1955bdc3fe4d3b480a4 | Python | 6,998 | 284 | # -*- coding: utf-8 -*-
import numpy as np
import tempfile
import pytest
import tensorflow as tf
from pinn.io import load_numpy, sparse_batch
from shutil import rmtree
def _get_dipole_data():
from ase.build import molecule
water = molecule('H2O')
q_O = -0.8476
q_H = abs(q_O)/2
q = np.array([[q_O, ... |
c6df5985ffe3b0a5c76e9658c6b2f1cf0eb2c60ed8bd2e8dfac63451fd0b9d4a | Python | 6,998 | 233 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
3ede9fbdc953251d8728f732f0367489283f6519167f4717758cff76b0cf3a77 | Python | 7,000 | 220 | r"""Test the ability of openbabel to roundtrip various properties
(protonation, hybridization, aromaticity...) through various file formats
(sdf,pdb,mol2).
On Windows or Linux, you can run these tests at the commandline
in the build folder with:
"C:\Program Files\CMake 2.6\bin\ctest.exe" -C CTestTestfile.cmake
... |
6fa34814da4312d377a74a6cb0c3bea9f3265bb88dc6317d0d61bb43921e98bb | Python | 7,000 | 199 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..initializer import create_initializer
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, in_channels, out_channels, stride):
super().__init__()
self.conv1 = nn.Conv2d(
in_channels,
o... |
077b4c1b2ea7ddc09d632e099591154d0eb9a4d5cd3f06a26d285135ea0ac62b | Python | 7,002 | 211 | import sys
from pathlib import Path
import argparse
here = Path(__file__).parent.absolute()
def dendritic_spine_example(parser: argparse.ArgumentParser):
sys.path.insert(0, (here / ".." / "dendritic-spine-example").as_posix())
import dendritic_spine_args
dendritic_spine_args.add_run_dendritic_spine_arg... |
74213c6d80632a8e0eb8bbf3a33fce2caeda792fd3f19dbba0712615303afde6 | Python | 7,002 | 244 | import matplotlib.pyplot as plt
import numpy as np
import meep as mp
resolution = 50 # pixels/μm
dpml = 1.0 # PML thickness
dsub = 2.0 # substrate thickness
dpad = 2.0 # padding between grating and PML
lcen = 0.5 # center wavelength
fcen = 1 / lcen # center frequency
df = 0.2 * fcen # frequency width
focal_... |
ae206da8d780a08d3b2a5f518e10fcd65aa3098b7bc7e3f8795047e597168a77 | Python | 7,002 | 222 | def configs_optimal_core():
return {
# A*
"astar_blind": [
"--search",
"astar(blind)"],
"astar_h2": [
"--search",
"astar(hm(2))"],
"astar_ipdb": [
"--search",
"astar(ipdb)"],
"astar_lmcount_lm_merged_rhw_... |
522ca0d33c6d3ac46b7ee52363fc5e04a37f634e22ec9a49bc3b78cd6b4b9c7d | Python | 7,008 | 136 | import argparse
import glob
import os
import time
from datetime import datetime
import numpy as np
from plantsegtools.meshes.meshes import seg2mesh, seg2mesh_ray
from plantsegtools.meshes.vtkutils import CreateMeshVTK, create_ply
from plantsegtools.utils import TIFF_FORMATS, H5_FORMATS, get_largest_object
def parse... |
ccf0b0ca93acf4b506830791ea3b9a4771325c8e247f1c6c95ec9b0fa0e6888b | Python | 7,008 | 192 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# 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 applicab... |
5f55f8784f5d32aea7d4b60c8175747fe9b205a5e8694f91fddb96e0b6edf367 | Python | 7,009 | 214 | """
Computes statistics about class distribution by groups in a STAR file
Input: - STAR file
Output: - Several figures for analyzing class distribution by gropus
"""
__author__ = 'Antonio Martinez-Sanchez'
###### Global variables
import pyseg as ps
GROUP_COL, CLASS_COL, MICRO_COL = '_rlnGroupNumbe... |
b337c6cf6464c9bc2c33fff591c884ab3664e10ce25f4c049698c422febc88c5 | Python | 7,009 | 180 | """Franklin-Paxinos (Chon 2019 / BrainGlobe kim_mouse) annotation variant.
The ~50 MB BrainGlobe download is not exercised here; these cover the
deterministic parts - the correlation-based orientation search, the ontology CSV
+ label remap, the registry/config wiring, and the consistency-check scoping so
the FP a... |
38770b7e3a889c32168fbda3c050cc352e0c59b07a8cd5021c2a7987c129ed80 | Python | 7,010 | 186 | """Implementation of CLI view command."""
import matplotlib as mpl
import matplotlib.pyplot as plt
from cycler import cycler
from treem.io import SWC
from treem.morph import DGram, Morph
from treem.utils.plot import plot_neuron, plot_points, plot_section, plot_tree
_colors = ('crimson', 'dodgerblue', 'darkgrey', 'ro... |
4161c0f16f7ca9aa97ce8d379497c6bee9089bcec4f7fb3a055111cf56aa2a42 | Python | 7,010 | 174 | import json
import numpy as np
import pytest
from sleeplab_format.extractor import config, cli
from sleeplab_format import reader
def test_extract_preprocess(ds_dir, tmp_path, example_extractor_config_path):
orig_ds = reader.read_dataset(ds_dir)
dst_dir = tmp_path / 'extracted_datasets'
cfg = config... |
fe2f44452073bb3952af57e34d2910b216892939891e24084683bb032f5d0cd6 | Python | 7,010 | 201 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
from torch.optim import Adam
from collections import deque, namedtuple
import copy
from .replay_memory import ReplayMemory
from .replay_memory import HerReplayMemory
from .gaussianpoli... |
13690b0fe9c3c46fecf2ddfe19312969746b5840f7cc81ab0b4d1fea79fd2b4b | Python | 7,011 | 216 | __author__ = "Zoe Wefers"
__credits__ = ["Ryan Huang"]
__version__ = "1.0.0"
__maintainer__ = "Zoe Wefers"
__email__ = "zoe.wefers@mail.mcgill.ca"
"""Purpose: Performs all the image cleaning, smoothing, processing etc to generate prints for every annoated cellular compartment
and skeletons for every dendrite.""... |
e2c04078906af7f97c52b873a682a436c6adda18b717155f152e30e883358694 | Python | 7,011 | 209 | """Finetune the model on predicting FNAT"""
import warnings
from Bio import BiopythonDeprecationWarning
# with warnings.catch_warnings():
# warnings.simplefilter("ignore", BiopythonDeprecationWarning)
import torch
import torch.utils as utils
import torch.nn as nn
from eudockscore.equiformer_v2_resi.model_v2_new im... |
aa7270193e3d6b3e87cd7e80da6680394472a0591a49b5d7850772d8a0f5a8ea | Python | 7,012 | 166 | from typing import Any, Optional, Dict
import numpy as np
from models.kan_layers import KAN, FastKANConv2DLayer, FastKANConv3DLayer
from models.model import Model
import torch
import torch.optim as optim
import torch.nn as nn
from torch.nn import init
import torch.nn.functional as F
class Luo3DCNN_KAN_Net(nn.Module... |
04b7a2811eccc90675753ef671dea9006b051f710243506aff026bcdb7ac928b | Python | 7,014 | 236 | """Calculate and save earliest decoding times."""
from __future__ import annotations
import pathlib
import time
from collections.abc import Sequence
from typing import Annotated, Literal
import numpy as np
import pte
import pte_decode
from joblib import Parallel, delayed
from pytask import Product
import motor_inten... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.