sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e20400f256f2125bdbb979908785258030b3babc2341ebc73d437399ace33919 | Python | 4,842 | 174 | from __future__ import print_function,division
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
class DenseBlock(nn.Module):
def __init__(self, nin, ng):
super(DenseBlock, self).__init__()
self.nin = nin
self.nout = nin + 3*ng
self.relu = nn.ReLU(in... |
a39458dcae2f66a7edb95eea1cdc5aa00ee76186f167a7fe68426368b1439888 | Python | 4,844 | 127 | import os
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from datasets.SequenceDatasets import dataset
from datasets.sequence_aug import *
from tqdm import tqdm
signal_size = 1024
# Case One
Case1 = ['helical 1',"helical 2","helical 3","helical 4","helical 5... |
66c4411ba648024bddfc34936cdfc8bf1857a73be78e22b28c25da3a457c2c96 | Python | 4,845 | 170 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : anatomy_core.py
# Author : Yufeng Liu
# Date : 2022-11-10
# Description :
#
#==================... |
0e90051a5a5e7c50346ed39f25d602b693c2bfb057e05abc206c47172e2125f3 | Python | 4,846 | 138 | # 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... |
3e3c51ea6156d001688db3326f4ac3fd6e9716340297c0446a8e72a318ae7ab2 | Python | 4,848 | 147 | # 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... |
a5311235d3472fa51c73f7310c272558651b00dceb675541423706134bab78ac | Python | 4,848 | 103 | import os
import time
from pandas import read_csv
from glob import glob
from Stage1_Code.designmat_regressors_define import create_design_mid, pull_regressors
from nilearn.glm.first_level import FirstLevelModel
from itertools import product
local = '/Users/michaeldemidenko'
proj_loc = f'{local}/Desktop/Academia/Stanfo... |
2923993f453e04c1b52d8508b70dd4474d9a054b26902cb1149073d7c389cb9e | Python | 4,851 | 106 | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Hang Zhang
## Email: zhanghang0704@gmail.com
## Copyright (c) 2020
##
## LICENSE file in the root directory of this source tree
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"""ResNeSt ablation stud... |
40ccebc880ae493146eac3219f94669610a0be0e17f84274e3423163687d7c96 | Python | 4,851 | 91 | supervised_learning = False
doc = dict(
__class__="""
Builds an Extended Isolation Forest model. Extended Isolation Forest generalizes its predecessor algorithm,
Isolation Forest. The original Isolation Forest algorithm suffers from bias due to tree branching. Extension of the
algorithm mitigates the bias by adj... |
6456d14820521dc87dc90bc95fe87d2aac597c6b016cb7e354590c41010ad5d0 | Python | 4,851 | 99 | """The foreground-init preview must segment exactly what the run segments.
``ForegroundInitPreview`` promises "preview == run" in its own docstring, but it pinned the
threshold kind to ``"triangle"`` as a literal while ``_foreground_scale_origin_init`` moved
its default to ``"auto"``. The failure direction is the ... |
8c0097bbe77c7bd4b7d02627deb8f25c3432f25584f3002fbe8818dfef009ad0 | Python | 4,851 | 110 | import torch
from torch.utils.data import Dataset, random_split, DataLoader
from typing import List, Any, Type
from pytorch_lightning import LightningDataModule
# local imports:
from ..shapes import Pixel, Orientation, Line
from ..colors import Color, White, RandomRed, RandomBlue, Grey
from ..stimuli import Stimulus
c... |
9d23b277659a0b7a924433a0a8c40c5f27ba6d42d2cd4885c847e80d3d1688d1 | Python | 4,851 | 153 | """Dock-layout regression tests for the CCF boundary editor.
These tests cover two UX guarantees:
1. The dock's horizontal scrollbar policy stays as
``Qt.ScrollBarPolicy.ScrollBarAlwaysOff`` - a horizontal scrollbar inside the dock
was confusing for users, and the dock content is engineered to fit
at ... |
df4cf34ae54b901a9f409317c515680afc42724ef94c9d71aeeb9de9f6ee90b6 | Python | 4,853 | 192 | from __future__ import annotations
import itertools
from typing import TYPE_CHECKING
from quacc.wflow_tools.customizers import strip_decorator
from quacc.wflow_tools.decorators import job
if TYPE_CHECKING:
from collections.abc import Callable
from typing import Any
@job
def partition(list_to_partition: lis... |
1afc92b3659915ab9dd53f502fd531ba44984b6796d25c2812d5eedd5a1a305d | Python | 4,855 | 109 | import numpy as np
from SparsePlace import SparsePlaceSpherical
class UniformField:
def __init__(self, unit_vec=np.array([0,0,1])):
self.unit_vec = unit_vec
def eval_voltage(self, x, y, z):
voltage = (self.unit_vec[0]*x+self.unit_vec[1]*y+self.unit_vec[2]*z)## a field of 1 mV/mm
retur... |
43d59f424a362f299cdef50d8ce06c07b439f268d36598976f75e2b8d2b2dd79 | Python | 4,855 | 110 | import torch
from torch.utils.data import Dataset, random_split, DataLoader
from typing import List, Any, Type
from pytorch_lightning import LightningDataModule
# local imports:
from ..old_shapes import Pixel, Orientation, Line
from ..colors import Color, White, RandomRed, RandomBlue, Grey
from ..stimuli import Stimulu... |
cded305e8e6425d9286ba8be30340aacf077e7a9c9b5ce2ac00383825a5d622c | Python | 4,856 | 175 | # -*- coding: utf-8 -*-
import seaborn as sns
def get_model_order():
return [
"node2vec",
"depthfirst-node2vec",
"deepwalk",
"line",
"torch-modularity",
"torch-laplacian-eigenmap",
"nonbacktracking",
"linearized-node2vec",
"adjspec",
... |
289e140c8c64631b2fa613dee050c8ee82519e5c8696f359ba8138517371c72d | Python | 4,858 | 116 | import os
import sys
import time
datadir = sys.argv[1] # should point to the directory where the fast5 & reds dir exist
# Python Script Paths
exedir = "../run_scripts/" # the path to HierarchyCall's test/run_scripts dir
bonito_script_path = exedir + "run_bonito.py "
minimap_script_path = exedir + "run_minimap.py "... |
6a8467f58c5a46cacddd535316842808fcf9604a40dfa907baeeea9c923e3170 | Python | 4,858 | 154 | #--------------- Libraries -------------------
import pandas as pd
from scnym.api import scnym_api
import anndata as ad
import sys
import scanpy as sc
import os
import random
# Set seed
random.seed(123456)
#def remove_batch(cell_id, batch):
# return cell_id.replace(f'-{batch}', '')
def remove_batch(cell_id, batch... |
1ef4ec35446defd752092a102304ea2427b995214e5f7ef66396aa5ccb01fe42 | Python | 4,859 | 106 | # 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... |
0b9219f211e222f9981ed78ebcf6e40788d69b385689b1bd2d3c402caa5dc28d | Python | 4,861 | 126 | import torch
import yaml
from basicsr.archs.rrdbnet_arch import RRDBNet
from basicsr.data.paired_image_dataset import PairedImageDataset
from basicsr.losses.losses import GANLoss, L1Loss, PerceptualLoss
from realesrgan.archs.discriminator_arch import UNetDiscriminatorSN
from realesrgan.models.realesrgan_model import R... |
2e1aba4956f6f05a2b822798e06962d3eef8956c9a5743e5df0a5e34c19f4012 | Python | 4,861 | 174 | import argparse
import matplotlib.pyplot as plt
import numpy as np
import numpy.matlib
import meep as mp
resolution = 60 # pixels/μm
dpml = 1.0 # PML thickness
dsub = 3.0 # substrate thickness
dpad = 3.0 # padding between grating and PML
wvl_min = 0.4 # min wavelength
wvl_max = 0.6 # max wavelength
fmin = 1 ... |
7b048a74dd99e2023e90c950da83fc772001d9b0586dfecc57af9b6993e9813c | Python | 4,861 | 168 | import argparse
import os
from cirrocumulus.envir import (
CIRRO_AUTH,
CIRRO_AUTH_CLIENT_ID,
CIRRO_AUTH_PROVIDER,
CIRRO_BRAND,
CIRRO_CELL_ONTOLOGY,
CIRRO_DATABASE,
CIRRO_DATABASE_CLASS,
CIRRO_DATASET_PROVIDERS,
CIRRO_DB_URI,
CIRRO_FOOTER,
CIRRO_JOB_RESULTS,
CIRRO_JOB_TYP... |
552deeb092115f09076c89f1441ea45cc22902eeb4b347417bbf9f504f7a75a8 | Python | 4,863 | 162 | #!/usr/bin/env python
#
# m6a_calling documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
9bd70d40b5a4a11ae9ece5013c5d68ea57473edd7ca1922f915ddd8e9651abed | Python | 4,863 | 130 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 15 12:43:56 2023
@author: felipe
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
file=np.load('heatmaps_spectrums.npz')
H=file['H']
KOP=file['KOP']
SD_KOP=file['SD_KOP']
Pxx=file['Pxx']
normPxx=Pxx/np.m... |
6e78259db64b73508bf8ddafc66577df3c91624efe3d3684e4faaa5222be8c77 | Python | 4,864 | 112 | import torch
from torch import nn
from torch.nn import functional as F
from torch_scatter import scatter_add
from torchdrug import core, utils
from torchdrug.layers import functional
from torchdrug.core import Registry as R
@R.register("models.NeuralLP")
class NeuralLogicProgramming(nn.Module, core.Configurable):
... |
6179a2ccc74f87ea8fe522957fa348d10dd32df326718f936d87c018c3646baa | Python | 4,866 | 145 | from pathlib import Path
import numpy as np
import pandas as pd
import pytest
import scanpy as sc
from mudata import MuData
from xarray import DataTree
import pertpy as pt
CWD = Path(__file__).parent.resolve()
sccoda = pt.tl.Sccoda()
@pytest.fixture
def adata():
cells = pt.ds.haber_2017_regions()
cells =... |
df385d37f09b1eed0470415dd8d7d4e385a56912216eb3ca2198e277bba48ede | Python | 4,866 | 130 | from dataclasses import dataclass
from math import ceil
from typing import TypeVar, cast
from .fxp_arithmetic import FxpArithmetic
from .fxp_params import (
ConvertableToFixedPointValues,
FxpParams,
)
T = TypeVar("T", bound=ConvertableToFixedPointValues)
@dataclass
class FxpConverter:
def __init__(self,... |
7a5ff13fb608ca04d009b94797fb65cbb53c1b50de52f620509182ac743b022e | Python | 4,867 | 135 | # -*- coding: utf-8 -*-
"""
Created on 8/8/18
based on pip_trains_unique.py
"""
import numpy as np
import scipy.signal as sig
# import expyfun.stimuli as stim
from expyfun.io import write_hdf5
import matplotlib.pyplot as plt
plt.ion()
# %%
def make_pabr_stim(opath, rate=40, n_minutes=0.5, do_pips=... |
229d87054233e666bb5a8f92fdae1723a9b6f8de2f0d181f271b72b55d775541 | Python | 4,868 | 166 | """
Filename globbing utility. Mostly a copy of `glob` from Python 3.5.
Changes include:
* `yield from` and PEP3102 `*` removed.
* Hidden files are not ignored.
"""
import os
import re
import fnmatch
__all__ = ["glob", "iglob", "escape"]
def glob(pathname, recursive=False):
"""Return a list of paths matching... |
a03172372a9435e28da334f226fc216210290ccf5fafa766f1cf6de9bcf8ba33 | Python | 4,868 | 145 | from dataclasses import dataclass
import math
import sys
import numpy as np
from numpy.linalg import norm
import optuna
@dataclass
class SAOptions:
max_iter: int = 10000
T0: float = 1.0
alpha: float = 2.0
patience: int = 50
def tsp_cost(vertices: np.ndarray, idxs: np.ndarray) -> float:
return n... |
12a0dd60793e309743e11d7c3f51f106afb3230c44456db63ea658c808ee109f | Python | 4,869 | 125 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from collections import OrderedDict
import bindings as bi
# Thrift reserved words. We can't use these as field names. :-(
thrift_reserved_words = set(["from", "type", "exception", "lambda", "required"])
class ThriftTypeTranslator(bi.TypeTranslator):
def __init__(... |
1bd8e528e107785c79eb7cfa117ec97a6c6725a2da83838eff15441ecf63c528 | Python | 4,869 | 107 | # -*- coding: utf-8 -*-
import sys
import time
import json
import random
import numpy as np
import sklearn
from itertools import product
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, average_precision_score, cohen_kappa_score, matthews_corrcoef
from sklearn.neighbors import KNe... |
5d171608ff01f145dc5b0f6f5009eacc24dc6b5ec202ef72fe6cbe267faa8272 | Python | 4,869 | 143 | """
Add `extra_repr` into DropPath implemented by timm
for displaying more info.
"""
import torch
import torch.nn as nn
from e3nn import o3
import torch.nn.functional as F
def drop_path(x, drop_prob: float = 0.0, training: bool = False):
"""Drop paths (Stochastic Depth) per sample (when applied in main... |
d108571881b399b3aa57831bcf587c673c9670d55e7d709c8f6db4d7c2977cd3 | Python | 4,869 | 142 | from itertools import chain
import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.por... |
aadeb40581f804d1b220e78527f16ce3f0598c2b79db176dd638fcbbc102c682 | Python | 4,870 | 132 | """Preparing the LEMON EEG data
[STEP 2] Source reconstruct preprocessed sensor space data
NOTE: This script was adapted from `lemon/chet22`.
"""
# Install dependencies
import os
import glob
import numpy as np
from sys import argv
from osl import source_recon, utils
from dask.distributed import Client
# Set hyperpar... |
babe09726395aa496b1280aeedcf6ec85e6138b0bd3d926db874c0b37e2d25d9 | Python | 4,870 | 187 | #!/usr/bin/env python
#******************************************
#
# SHARC Program Suite
#
# Copyright (c) 2023 University of Vienna
#
# This file is part of SHARC.
#
# SHARC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... |
eeea7100c0af179c7d081f5ed5cb094f8c2f89745be29ce91fb3a39c9abec477 | Python | 4,870 | 132 | # -*- coding: utf-8 -*-
r"""This file implements the atomic dipole (AD) dipole model.
Atomic vectorial property predictions from the network are interpreted as atomic dipoles.
The dipole moment is expressed as:
$$
\begin{aligned}
\mu = \sum_{i}{}^{3}\mathbb{P}_{i}
\end{aligned}
$$
This model fits the total dipole o... |
37f97663ddd8770522465d38c46c93b86b02b3bd3b59bc79d847561bf880ea3c | Python | 4,872 | 129 | # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/01_losses.ipynb.
# %% auto 0
__all__ = ['MMD_loss', 'OT_loss', 'Density_loss', 'Local_density_loss']
# %% ../nbs/01_losses.ipynb 3
import os, math, numpy as np
import torch
import torch.nn as nn
class MMD_loss(nn.Module):
'''
https://github.com/ZongxianLee/M... |
7fb40ecb82e42945e2472cad8b8a2bcc2257f59f2c63fb8ec8c6140030031ba8 | Python | 4,872 | 151 | """distutils.command.check
Implements the Distutils 'check' command.
"""
import contextlib
from ..core import Command
from ..errors import DistutilsSetupError
with contextlib.suppress(ImportError):
import docutils.utils
import docutils.parsers.rst
import docutils.frontend
import docutils.nodes
c... |
b6b32495fc300685bc5f10f554546eba550ce3c8410c9ec819c9e613b5463c2a | Python | 4,872 | 137 | import sys
from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, QHBoxLayout, QVBoxLayout, QLabel, QDoubleSpinBox, QSpinBox, QPushButton, QCheckBox, QDialog, QDialogButtonBox
from PyQt5.QtCore import Qt
class NL5SettingsDialog(QDialog):
def __init__(self, nl5):
super().__init__()
self.nl... |
dc862cd3f384811ec1fc373f0be02326932b9e825300419137e7b45d4fe6a934 | Python | 4,872 | 147 | # -*- coding: utf-8 -*-
"""
Created on 15 October 2023
@author: divyoj
"""
## importing libraries:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.animation import FuncAnimation
import os
# # note that this must be executed before 'import numba'
# os.environ[... |
c26cd6d37949ae09b839e9527275ff802b2939b6b2410d4f05b9aad76f3ca174 | Python | 4,873 | 134 | """
Created on 25/05/2020
:author: Chinchien Lin
:summary: Downsamples all files in the input folder by a given factor.
Then saves in the output folder.
"""
import os
import sys
import numpy as np
from src.commands.abstract_preprocessing_command import AbstractPreprocessingCommand
from src.utils... |
f1ac49d651e4f3a4f6b510ed1fd5cec4304916ffedda8bfd632c35994ca74cdf | Python | 4,873 | 147 | # Parameters
import argparse
# Create an ArgumentParser object
parser = argparse.ArgumentParser(description='Naive Bayes models for pseudobulk data')
# Add parameters to the parser
parser.add_argument('--inPath', type=str, help='Folder with the input data')
parser.add_argument('--resultsPath', type=str, help='Folder ... |
2103f9d83ec5520afcf5d2a692ccfc2b8833b53e5a300f6c1d69790d91088629 | Python | 4,875 | 127 | '''
Description:
Run our scNODE with different regularization coefficient (beta).
Author:
Jiaqi Zhang <jiaqi_zhang2@brown.edu>
'''
import torch
import numpy as np
from benchmark.BenchmarkUtils import loadSCData, tpSplitInd, tunedOurPars, splitBySpec
from optim.running import constructscNODEModel, scNODEPredic... |
da946948bdba066fb3e6ab0984a67c2c110bb758e5c08a10a072f94346a17218 | Python | 4,875 | 137 | import numpy as np
import torch
from medpy import metric
from scipy.ndimage import zoom
import torch.nn as nn
import SimpleITK as sitk
from torch.nn import functional as F
from torchvision import transforms
import time
import os
import glob
import json
import torch
import random
import torch.nn as nn
import numpy as n... |
f53dea8a2a2ec252e53379649db0b8ed5a2fbe91b60f50d87966b838d2883b2c | Python | 4,875 | 127 | #!/usr/bin/env python
#
# Copyright 2008, 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... |
46ce206c99c447dba2ae3045b0dd75b72948d295073834021cc01aa8c5b765b5 | Python | 4,877 | 172 | import warnings
from typing import Callable, Generic, TypeVar, overload
Tin = TypeVar("Tin")
Tout = TypeVar("Tout")
FN = TypeVar("FN", bound=Callable)
warnings.warn(
"function_utils module is deprecated, use function_dispatch module instead",
DeprecationWarning,
stacklevel=2,
)
class FunctionDecorator(G... |
4cb8955520fca65e433bba6e69af5f10ee062708722f0b670f7f15c3339ad194 | Python | 4,877 | 142 | from itertools import chain
import numpy as np
from elasticai.creator.file_generation.savable import Path
from elasticai.creator.file_generation.template import (
InProjectTemplate,
module_to_package,
)
from elasticai.creator.nn.integer.ram.design import Ram
from elasticai.creator.vhdl.auto_wire_protocols.por... |
5cc5fa542aebdd3161454379251199aed5f9adb48ca85924383df6ce74d8c4e2 | Python | 4,877 | 135 | from torch.utils.data import Dataset, DataLoader
import numpy as np
import pandas as pd
import os
# Define custom dataset
class BrainTumorDataset(Dataset):
def __init__(self, file_list=['Copy of virtual_biop(5000+5000).csv'], weight_display=False):
self.patient_id = []
self.continuous = []
... |
7851c77f1829144769e1c217bdb0fc16bc8c1d3c01e471e0955fd573fa532102 | Python | 4,877 | 118 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import itertools
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
from downward.reports.compare import ComparativeReport
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterP... |
e65a16f08cd6565ec503e3c4f7048dd4fd888566e72ec6b74b7b68751eb035f5 | Python | 4,879 | 156 | from __future__ import annotations
import re
from typing import Any
from wikibaseintegrator.models.basemodel import BaseModel
from wikibaseintegrator.wbi_enums import WikibaseSnakType
class Snaks(BaseModel):
def __init__(self) -> None:
self.snaks: dict[str, list[Snak]] = {}
def get(sel... |
bf18e84853a934fe91cc2c4d8133d64cd843ab7758634ceaf1f921bb25b7e204 | Python | 4,880 | 73 | #!/usr/bin/env python
from __future__ import division, print_function
import argparse
from topaz.extract import extract_particles
name = 'extract'
help = 'extract particles from segmented images or segment and extract in one step with a trained classifier'
def add_arguments(parser=None):
if parser is None:
... |
cd228870164953684de9614611de3a2ca936e4dce7ba0fc02b1c7884089dbc4f | Python | 4,882 | 126 | import os
import sys
import tempfile
import unittest
import mprof
class Test_function_labels(unittest.TestCase):
def test(self):
expected = {
"x.z": "z",
"x.y": "y",
"x.b": "x.b",
"f.a.b": "f.a.b",
"g.a.b": "g.a.b",
"g.a.c": "a.c",
... |
d0efb91b51feedadc887fafea860f952c581d7296fcf775b435997aa7f622278 | Python | 4,882 | 114 | """Tests for load_preview_array (downsampling + dims). Uses a tiny temp NIfTI."""
import numpy as np
import pytest
nib = pytest.importorskip("nibabel")
def _write_nii(tmp_path, arr):
p = tmp_path / "vol.nii.gz"
nib.save(nib.Nifti1Image(arr.astype(np.float32), np.eye(4)), str(p))
return str(p)... |
e57b800aad253b9942f840e8492d241d77a2246707e88e728da487dea3d98cbe | Python | 4,882 | 110 | #!/usr/bin/env python3
"""Generate model-selection SVGs using only the Python standard library.
Run from any directory: python docs/tools/generate_split_diagrams.py
All illustrations share a 1200 x 480 canvas and fixed-size sample marks.
The diagrams illustrate membership, not temporal order or default split ratios.
"... |
f1c6e2ef1625557714198d3397ca0580090bef16e64571261177014a601e160c | Python | 4,884 | 70 | """FLY_LIKE_AL.py 2026-09-29. Pre-registration: 04-NOTES/PREREG-2026-09-29g-FLY-LIKE-AL.md
M* = laboratory prior + fly ORN-synapse depression + excitatory-LN output x s. Test 1: real odours (Seki, AL cut-out),
s chosen by leave-one-odour-out. Test 2: at rest (Hallem resting rates, whole brain) at that s; flies 1-5 Hz... |
1565ad2a10c60874092e1cf5afd5667534caf383089e615db133e656c1528c77 | Python | 4,885 | 123 | """
This script compares fmriprep confounds.
Outputs: - Plot of correlations of confounds
- R2 maps between the different strategies and the original data
1. Plot the correlation between possible confounds
2. Run GLM with motion parameters (Friston)
3. Plot the before and after detren... |
533d4420020e4f80f17b2cc81ee49039f52693935040f1f48b73b9f5f1f4e171 | Python | 4,885 | 120 | from collections import deque
from collections.abc import Mapping, Sequence
import torch
from torchdrug import data
# from torch.utils.data import DataLoader
def graph_collate(batch):
"""
Convert any list of same nested container into a container of tensors.
For instances of :class:`data.Graph <torchdru... |
e309df2d876c1cd87d5ef00a3748666afeefd51bd57f1293d299c3366f4c3d21 | Python | 4,885 | 125 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: emma
"""
SEED=1
import os
os.environ['TF_DETERMINISTIC_OPS'] = '1'
import tensorflow as tf
tf.random.set_seed(SEED)
import random
random.seed(SEED)
import tensorflow as tf
import numpy as np
import pandas as pd
from tensorflow.keras.layers import Conv3D, MaxP... |
e5bafe63c35a81a4f8b8281a512f68eaf802377c9896006c9780c88c62e00a22 | Python | 4,885 | 181 | """Utility functions for dealing with dictionaries."""
from __future__ import annotations
from collections.abc import Mapping
from copy import deepcopy
from logging import getLogger
from typing import TYPE_CHECKING, overload
if TYPE_CHECKING:
from typing import Any
LOGGER = getLogger(__name__)
class Remove:
... |
fea19280ccc29c7c6737961a4e879d320f73c25cb94ee1452193d015d3b04a07 | Python | 4,885 | 54 | """DOMINANT_INPUTS.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02l-DOMINANT-INPUTS.md
Which single cells carry an outsized share of a population's input, across the whole brain, and how doubtful are their signs?
Both known keystones (v2LN30 onto uniglomerular PNs, APL onto Kenyon cells) are such cells. u... |
95b5cb74fb74efd0dce636e09a9e949e1ae13900937b9dd206d77c9b72e17f88 | Python | 4,887 | 153 | # This code AvgCagingPotential_fromSSF_2d_binary.py calculates the static structure factor(ssf) for a binary system in 2d and then the global mean field caging potential from it for a given area-fraction.
# Once you get the caging potential, the value at r=0 is the depth of the potential and by fitting the caging pote... |
ac8b4edc81bb97f73ccbc43f0bd7239e59505fa205732941fd9147cb935f68f4 | Python | 4,887 | 156 | #!/usr/bin/env python
#
# root_tissue_segmentation documentation build configuration file
#
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules t... |
ae88cd8363659cb749146097a54942fe3d9bd1a3ead82c6fd1e89d2ce73ce187 | Python | 4,888 | 123 | import logging
import unittest
from neurolib.models.multimodel import MultiModel
from neurolib.models.multimodel.builder.wilson_cowan import WilsonCowanNode
from neurolib.utils.collections import (
BACKWARD_REPLACE,
FORWARD_REPLACE,
_sanitize_keys,
flat_dict_to_nested,
flatten_nested_dict,
sani... |
eaa25f313421d3f33a41cd23c6ca414dfe46d5815aacd7a665f84f18e50ccf37 | Python | 4,888 | 114 | import data.ABIDEParser2 as Reader
import numpy as np
import torch
from utils.gcn_utils import preprocess_features
from sklearn.model_selection import StratifiedKFold
class dataloader():
def __init__(self):
self.pd_dict = {}
self.node_ftr_dim = 2000
self.num_classes = 2
def load_data(... |
aa6a380049627dcd1129b98b5cdf70997156cf04cbc9a6f21b841aca2e485e0f | Python | 4,890 | 117 | from __future__ import annotations
from typing import Any
from wikibaseintegrator.datatypes.basedatatype import BaseDataType
from wikibaseintegrator.wbi_config import config
from wikibaseintegrator.wbi_enums import WikibaseSnakType
from wikibaseintegrator.wbi_helpers import format_amount
class Quantity(Ba... |
6d2a903b518d5b6fb43a4ca6ad7b8d715ad8ada15325c3788688ec3db5c6ed62 | Python | 4,891 | 147 | # Node group ".Sample Atomic Attributes to Face Corner" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ a... |
0f0d455d5720b58e568b12cd20a38ba5d0bb84847170c10379cce5d692ae259b | Python | 4,892 | 180 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import colorcet as cc
from sklearn.decomposition import PCA
import matplotlib.patches as pa
PALETTE = sns.color_palette(cc.glasbey, n_colors=9)
FONTSZ = 35
FONT = 'Inter'
def analyze_family(
family: str,
df: pd.DataF... |
47781789a4329af2524530079434e772262b77af95872cad33f5eb190f42a4b8 | Python | 4,893 | 94 | # -*- coding: utf-8 -*-
import sys
import time
import json
import random
import numpy as np
import sklearn
from itertools import product
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, average_precision_score, cohen_kappa_score, matthews_corrcoef, roc_curve, precision_recall_curve... |
6d458343b5f39459cce28897f6a61854ba45be8f50cbea962ea679bc3e2f53ee | Python | 4,893 | 152 | import matplotlib.pyplot as plt
import numpy as np
# This script is used to plot the performance of RT-Sort assuming kilosort2 detections as ground truth. The performance
# is plotted as a function of the ith highest amplitude in the footprint of each detected unit.
# specify paths to stored data
DATA_PATHS_ME... |
6f791a301b2e5f40f860c81266ef816fca8c5afa1d479174ce4ef16bafe573ce | Python | 4,893 | 155 | #
# 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, copy, modify, merge,... |
fd985a5d13bcea010c4b36db906037a7a72fe6b0cd7406668ae95e82864abcb1 | Python | 4,893 | 133 | from collections import OrderedDict
from typing import cast
import torch
from elasticai.creator.arithmetic import (
FxpArithmetic,
FxpParams,
)
from elasticai.creator.base_modules.lstm import LSTM
from elasticai.creator.base_modules.lstm_cell import LSTMCell
from elasticai.creator.nn.design_creator_module imp... |
a500282dc1543ce34d9f1ad49f957e12167794a7a46649aba91d1cd80426c29f | Python | 4,894 | 130 | """The GUI must show which template slice a section is registered against.
Two gaps this pins:
* Auto-detect (DeepSlice) resolves the CCF index INSIDE the pipeline subprocess -
the GUI passes ``--auto_deepslice`` with no index and never learned what was
chosen. The run records the resolved value in ``regis... |
c34e2bba7a8c9fdd6c72eb218d85ce60140ac20f25b04197965344afea05e2b1 | Python | 4,894 | 129 | # 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... |
84ab7ed11d76049a892704f3751258cd6c625038a539014ed03c37fab3c4e079 | Python | 4,896 | 156 | from hippo import load_object, save_object, get_data_path
from hippo.agents.clone_agent import CloneAgent
from hippo.agents.replay_agent import ReplayAgent
from hippo.agents.hierarchical_agent import HierarchicalAgent
from hippo.agents.prefrontal_agent import (
PrefrontalCSCGModel,
PrefrontalFactorizedModel,
... |
bff610e41c44c42c56c7bd7a8998e65c1e4fa324784c6b4d262fe75a9a6e974b | Python | 4,896 | 148 | from __future__ import division
from cloudvolume import CloudVolume, Storage
from PIL import Image
import numpy as np
import math
import os
class IngestCATMAID():
def __init__(self, catmaid_dir, inlayer, outlayer,
tile_x=1024, tile_y=1024, z_offset=2266):
self.catmaid_dir = catmaid_dir
self.tile_x = ti... |
6662936bbee41143d74cfb9a7d2ef3c3a38c5e92a189118563f2d9946991dc57 | Python | 4,898 | 191 | """
Utility Functions for Data Processing and Command-Line Parsing
This script contains utility functions that are reused in different
data processing scripts. Specifically, it provides methods to parse
command-line inputs and handle the overwriting of default values.
Functions:
-----------
- `get_inputs`: Parses com... |
126e7c41a29c30d6c559b1024cfa67e1b9f13e5c17dfa1c45a61cce534bf192a | Python | 4,899 | 142 | """
Test run_median
"""
import time
import numpy as np
from median.filter_median import run_filter_median
from median.median import run_new_median
from median.utils.utils import run_classic_median
def test_runners():
"""multiple test"""
N = 100000
data = np.random.default_rng().standard_normal(N).astyp... |
367843b6b0ee850c9dd1b2d7164f783e5631bb9f7d00209bcf9e6a0861c5547d | Python | 4,901 | 158 | # 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... |
90925ec5a5e7d87d626a1d8ad91151e0174e43859742752e141eaf7c37ecd1b1 | Python | 4,901 | 183 | # IMPORTS
from argparse import ArgumentParser
import pytorch_lightning as pl
from pl_bolts.models.self_supervised.simclr.transforms import (
SimCLREvalDataTransform,
SimCLRTrainDataTransform
)
from pytorch_lightning.callbacks import ModelCheckpoint
from datamodules import ImagePairsDataModule
from models.s... |
ef42f664c378cc34d6c7bda0566cf9813023366bb982ac70b2ca7062dbb2da8b | Python | 4,902 | 129 | import os
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from datasets.SequenceDatasets import dataset
from datasets.sequence_aug import *
from tqdm import tqdm
signal_size = 1024
# Case One
Case1 = ['helical 1',"helical 2","helical 3","helical 4","helical 5... |
4716bb34b2374bb78d1746537c955c8da0a78f748a057b715c7c3880cce23b00 | Python | 4,903 | 131 | # 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... |
b68bb03a7e0853ee91228ae5f804862212cf51a5e25cce567d038a19e4cb8049 | Python | 4,903 | 101 | import numpy as np
from typing import List, Tuple, Dict
def format_region_channel_list(channel_list, region_list):
output = []
for region in region_list:
region_channel_index_list = []
for region_channel in region:
try:
channel_index = channel_list.index(region_cha... |
ed9b42b82242fb2c1d2bcdd842a98406d7b6bc10f3cf255f5c8c8f76c9a7eba8 | Python | 4,903 | 120 | # Contains the relevant functions needed to generate the isopotential plots
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.interpolate import griddata, Rbf
from matplotlib.ticker import MaxNLocator
import matplotlib as mpl
# Labels is a list of the names associated with the electro... |
72468840754dadee8fba25d971852aee872b33cb540ed75fb94d9424dff4a844 | Python | 4,905 | 111 | """The Laplacian solver tolerance has ONE default, shared by CLI, GUI and pipeline.
`rtol` is a relative *residual* tolerance, not a bound on the solution error; on
an ill-conditioned Laplacian the two diverge (1e-2 leaves up to ~0.3 voxel of
solver error in the deformation field). The default stays at 1e-2 for ru... |
d5ede968a0ccb1f75840142df74f138e0762aad43b5ede1794db578e663ac1d9 | Python | 4,905 | 153 | """
Created on 30/08/2019
Modified on 25/05/2020, Chinchien Lin
:author: Gonzalo D. Maso Talou, Chinchien Lin
"""
import os
import re
from abc import ABC, abstractmethod
class AbstractNameFilter(ABC):
"""
Abstract class for file name modifications.
"""
@abstractmethod
def filt... |
4dd88178a3af2d397606d376af79452acffa451443738ea13244c9e9c3169da4 | Python | 4,907 | 155 | # -*- coding: utf-8 -*-
from __future__ import annotations
from typing import List
import torch
import torch.nn as nn
class TokenDropout(nn.Module):
r"""
:class:`TokenDropout` seeks to randomly zero the vectors of some tokens with the probability of `p`.
Args:
p (float):
The probab... |
5bbb48e1c303a55af5219fb19d253ac815e859b502faa1de3ff73c436c7678ae | Python | 4,907 | 131 | # 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... |
636c0e550bbc5d9a440ff37dba0d9abac5f6c2dcd78a0ce3dbf264a123c84a04 | Python | 4,908 | 132 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the 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
import utils
class CLIPLoss(nn.Module):
def __ini... |
aa99dfc5af4cd4f6a88a4cac697ac8395977626956942c79fa15e93b6705e86c | Python | 4,909 | 111 | """Render a real recording through a model-free Qt worker and verify state identity."""
from __future__ import annotations
import argparse
import json
from pathlib import Path
import numpy as np
import shiboken6
from PIL import Image
from PySide6.QtCore import QObject, QSettings, QTimer, Slot
from PySide6.QtWidgets i... |
babdbb3fee6c9962b0aea54e9d8430068d0117a48848798e6c6e86682ddec673 | Python | 4,909 | 180 | from pathlib import Path
from fidnet import config
from fidnet.ca_detect.fidnet_2d_caDetect import direct_decouple as _ca_direct_decouple
from fidnet.con_decouple.fidnet_2d_conDecoup import direct_decouple as _con_decouple
from fidnet.ctcp_decouple.fidnet_2d_ctcpDecoup import direct_decouple as _ctcp_decouple
from fid... |
dacb9e46065d0e7af2669005919e8f1c3bf7f2d0c92eb771acf4e0a08320a839 | Python | 4,909 | 192 | from __future__ import annotations
import pytest
prefect = pytest.importorskip("prefect")
from quacc import change_settings, flow, job, subflow
def test_patch():
@job
def task1(val: float) -> dict:
return {"input": val, "result": val * 100}
@job
def task2(val: float) -> dict:
retur... |
3172875ce2f77a1ffeb6b4a893e2544e3011ff38e698a177ae34445400633fcb | Python | 4,910 | 156 | from __future__ import annotations
import os
import sys
from abc import ABC, abstractmethod
from pathlib import Path
if sys.version_info >= (3, 8): # pragma: no branch
from typing import Literal # pragma: no cover
class PlatformDirsABC(ABC):
"""
Abstract base class for platform directories.
"""
... |
36b4236943bd07cf0ff89b4e7f0c3704cb7dad29f54e2ad4e06eeed2eb7916b3 | Python | 4,911 | 139 | """distutils.pypirc
Provides the PyPIRCCommand class, the base class for the command classes
that uses .pypirc in the distutils.command package.
"""
import os
from configparser import RawConfigParser
from .cmd import Command
DEFAULT_PYPIRC = """\
[distutils]
index-servers =
pypi
[pypi]
username:%s
password:%s
"... |
8a995e1e84b99d2b6b0de90bc03497d6df6ff2a9777d13ced22de270945433ad | Python | 4,911 | 139 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.nn import init
from typing import Any, Optional, Dict
from models.model import Model
class MLP_Net(nn.Module):
"""
Baseline network
"""
@staticmethod
def weight_init(m):
... |
1a34b7f6c44455693ec4589e4266105228c6933e73bee13fa1bfe3edd0a4aade | Python | 4,912 | 170 | import numpy as np
from os.path import join
from moabb.datasets import (
Zhou2016,
BNCI2014004,
BNCI2014001,
MunichMI,
Weibo2014,
Cho2017,
)
from burst_analysis import TfBursts
from preprocess import (
load_sub,
apply_preprocessing,
Dreyer2023,
)
from help_funcs import load_exp_var... |
64ab85fc8ae35f3f5fac173b73494164806a8d8e1929ed32de0cc75b53d94875 | Python | 4,912 | 143 | import sys
from scipy.stats.stats import pearsonr
import matplotlib
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import matplotlib.mlab as mlab
sample_map = {
'Ost1-1':'A1054_01',
'Ost1-1pr2':'A1054_07',
'Ost2-2':'A1054_05',
'Ost3L41':... |
245029f38716021e9283762a097824d6583000141cf5268488ca4bc612e109f0 | Python | 4,913 | 100 | from cloudvolume import CloudVolume
import numpy as np
import pandas as pd
from random import randint
from os.path import expanduser, join
import tiffile
def get_xy_slice(cv):
o = cv.voxel_offset
s = cv.shape
return slice(o[0], o[0]+s[0]), slice(o[1], o[1]+s[1])
label_track_cv = CloudVolume('gs://neuroglancer/pink... |
c503701a508a4656f99d60c80e008f267652ca0ca606d88b76bf4b53b2330ad4 | Python | 4,913 | 109 | ###############################################################################
# This code generates the Supplementary Figure 9 of the paper "Longitudinal #
# single-subject neuroimaging study reveals effects of daily environmental, #
# physiological and lifestyle factors on functional brain connectivity" #
... |
a7bd874a07b465acfe046e58bde0294fc2ea6711feb2b928fc438a443bd24a20 | Python | 4,915 | 153 | # 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... |
a047816b33a8a08b7e8f8b41911529d8925d77b3579b61fab654f5b5a5b5db54 | Python | 4,917 | 138 | import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
import pandas as pd
class MaskedLinear(nn.Module):
def __init__(self, in_dim, out_dim, indices_mask):
"""
in_features: number of input features
out_features: number of output features
indices_mask: tensor used t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.