sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5aa10e7d71401f5a3fcc30a48849e76c47e4fd3ecfa9f11655b46081bcb1bf01
Python
4,974
152
""" ==================================================================== Motor imagery classification ==================================================================== Classify motor imagery data with Riemannian geometry [1]_. """ from matplotlib import pyplot as plt from mne import Epochs, pick_types, events_from...
7f948b0fa6f384b0cf42748e39bae5361b777271bb09a6baba655ad3327373ba
Python
4,975
150
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Title(_BaseLayoutHierarchyType): _parent_path_str = "layout.xaxis" _pat...
addefc654a3a03c28bb58c98a092e95b0118d81fb57c33bab9aebbee04ecaf8a
Python
4,975
123
"""Adaptive-pool descriptor envelope containment regressions. The published ``UPPER_BOUND`` descriptor for adaptive pooling must CONTAIN the true adaptive bin geometry for every input/output ratio. The historical edge pair ``((r, -1), (r, +1))`` under-covered whenever ``r = in/out > 2`` (true bin end is ``ceil((o + 1)...
bea12f2d741007b8e2e281ac003eecbca5a68e4d1b2d94a45c52995409f69338
Python
4,975
150
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Title(_BaseLayoutHierarchyType): _parent_path_str = "layout.yaxis" _pat...
489a6cff876dfc3663a5fa0778cc16e776395f509d7051c235569016d471788f
Python
4,976
149
from ethoscope_node.utils.device_scanner import EthoscopeScanner from ethoscope_node.utils.mysql_backup import MySQLdbToSQlite, DBNotReadyError import os import logging import time import multiprocessing import traceback import urllib.request import json def receive_devices(server = "localhost"): ''' Interro...
6dc19a47817a53c712a812a7b3635edc49d58e3e2efc3f0d89b3a017eb5dc2fb
Python
4,976
148
import copy from typing import Any import numpy as np import pandas as pd from mirp._images.generic_image import GenericImage from mirp._imagefilters.generic import GenericFilter from mirp._imagefilters.utilities import SeparableFilterSet from mirp._images.transformed_image import TransformedImage from mirp.settings....
d2268ba0e555ceca1813d99e46308a5ad7e9cdd34bc7aaf1f7a53fa8c2d42d32
Python
4,977
160
import numbers import numpy as np import pyqtgraph as pg from .. import mask from .base import BaseShape, rotate_around_point class Rectangle(BaseShape): def __init__(self, x=40, y=30, a=33, b=22, phi=0, point_um=1): """Rectangle Parameters ---------- x, y: float ce...
86c8b50d6e6a91bbcc832eea8ff28e401f5918ce914e56f50db7102f2a3daf0d
Python
4,981
142
import argparse import numpy as np import torch from torchvision import datasets from torch import nn, optim, autograd from PIL import Image import create_oscn as co import time import collections from collections import Counter from torchvision.utils import save_image, make_grid mnist_train = datasets.MNIST('./data...
6461deb989f8089b5fb17e7eb15b4608d1314540cfe709acc8cb203232617f2b
Python
4,982
130
#!/usr/bin/python import os import sys import pandas as pd import numpy as np import ConfigParser import re def main(): ##### check arguments ##### if len(sys.argv)<2: sys.exit('ERROR: not enough arguments\nUSAGE ./magma.py <filedir>') filedir = sys.argv[1] if re.match(".+\/$", filedir) is None: filedir += '/...
d8ab0fc8ca9bd2736994d1e520ad9c234c60fcf9198aca11afec7b97c98a9a1b
Python
4,982
137
""" The re-implemented distributed sampler for the distributed training of GROVER. """ import math import time import torch from torch.utils.data.sampler import Sampler import torch.distributed as dist class DistributedSampler(Sampler): """Sampler that restricts data loading to a subset of the dataset. It is...
09e6842ff12edc81995ac63fa97119f16d4b8fd38c773232d9f84242f74e8ad6
Python
4,983
118
import sys import numpy as np sys.path.extend(["../TDNODE", "src"]) import torch from typing import Tuple import warnings import constants warnings.filterwarnings("ignore") def make_batch(batch: Tuple[Tuple[any]], device: str): """Collate function to process multiple patients at a time during training and eva...
3d20e2f1ff30cc348b45ca870143b8755c36f264469ab18588d4fdaf308b816e
Python
4,984
169
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Domain(_BaseTraceHierarchyType): _parent_path_str = "icicle" _path_str = ...
502c63ed21f351ce68c2f59e595a21b656c74c5382f9fd4324828414418c924e
Python
4,984
169
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Domain(_BaseTraceHierarchyType): _parent_path_str = "sankey" _path_str = ...
1b499dc91fc9ebf21bab9d856f653ae880edbb510913dfe1a9fc0c12e6fbecc7
Python
4,985
167
import os import copy from collections import defaultdict from main import main, run_all from src.datasets import ( test_datasets, test_convert_label_to_int, ) from src.config_test import ( config_test_trainer_vae_cmnist, config_test_trainer_vae_oscn, config_test_trainer_mmvae_cmnist_oscn, conf...
05f287a9a56f6c8eee14375e8ddb5af11459ec5eeb9fa4e1334bbddcc11aa9d9
Python
4,986
115
""" This script shows the training pipeline for k-fold training, without logging it via wandb. """ import tensorflow as tf import tensorflow.keras as keras import tensorflow_addons as tfa from sklearn.model_selection import StratifiedKFold from tf_spiking.helper import TrainingHistory from tf_spiking import DenseLIF, ...
1efc2a64b57b2de762da78048d5012cfb57605aff7fba32b8ba656907fafc55a
Python
4,986
143
from tdt import read_block import numpy as np import matplotlib.pyplot as plt import os import statistics def extract_name_streams(blocknames, tankdir, filenames, trimstart, trimend): for block in blocknames: full_path = os.path.join(tankdir, block) data = read_block(full_path) fields = list(data.streams.keys(...
4b38d970ec45ef3745513e3b66fda7ec03371fc9280f2b3fd0ea52fa7f6021f7
Python
4,986
136
import os from glob import glob from distutils.util import convert_path from distutils.command import sdist from setuptools.extern.six.moves import filter class sdist_add_defaults: """ Mix-in providing forward-compatibility for functionality as found in distutils on Python 3.7. Do not edit the code ...
e9b21f22d8dc2276cf290b2aa307ac6f7c7dc5cc932b85b9ced7f7c77381c8d2
Python
4,986
140
import torch.nn as nn from . import imdnblock as B import torch def make_model(args, parent=False): return IMDN(args) # For any upscale factors class IMDN_AS(nn.Module): def __init__(self, in_nc=3, nf=64, num_modules=6, out_nc=3, upscale=4): super(IMDN_AS, self).__init__() self.fea_conv = nn....
3780d3d1e0dab5806fe532b14414c7b65a7817f5fded70b0059b3e7498a642bd
Python
4,987
135
import os, json, datetime import logging users_keys = ['name', 'fullname', 'PIN', 'email', 'telephone', 'group', 'active', 'isAdmin', 'created'] incubators_keys = ['id', 'name', 'location', 'owner', 'description'] class EthoscopeConfiguration(object): ''' Handles the ethoscope configuration parameters D...
106220d6aa36a4c8c8d5cd001558bcc29e75243a5a5c2fac45771f1a24b83d9c
Python
4,988
157
import logging import re from collections.abc import Callable from typing import ( cast, ) from alembic import context from alembic.script import ScriptDirectory from alembic.script.base import Script from sqlalchemy import create_engine from sqlalchemy.exc import OperationalError from galaxy.model import Base fr...
47024b4a39356110b49429f335d3350ec5e4e09be296f6895f2255958d796287
Python
4,988
144
import os.path import numpy as np from mirp._data_import.generic_file import ImageFile, MaskFile class ImageNumpyFile(ImageFile): def __init__(self, **kwargs): super().__init__(**kwargs) def is_stackable(self, stack_images: str): """ Is the image potentially stackable? :para...
dce7f7d8cd96ffb6f96e3b266e6e7d5355a7f7ec35e92dca4a369ac78010a6d8
Python
4,988
134
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (leoxiaobin@gmail.com) # Modified by Bowen Cheng (bcheng9@illinois.edu) # ------------------------------------------------------------------------------ fro...
b4420203862eea05a351587052365b751d1f37ddee7fdedbed24bf2b741dcf5f
Python
4,989
125
"""Lane W051-HONESTY: the honesty fact block carries interventions and honest witness wording. AUD-HONESTY M5: ``tl.trace(m, x, intervene=...)`` zero-ablates a site while the capture settles ``complete``; ``to_agent_json()``, ``to_pandas().attrs``, the export preamble, and ``explain`` carried NO intervention fact, so ...
535474d138a44f02898d174bee0165aeae87e3328957f2c97671b11d7ec58dd2
Python
4,990
163
# -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.4.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- #...
be269a44962f547076c272ab0c98b3e2fde3a6ae993c4f182339a3b4e5ece106
Python
4,990
110
from model import * from utils import * import numpy as np from sklearn.model_selection import KFold import torch import os,sys import warnings warnings.filterwarnings("ignore") # trained_model protein length capacity should >= new protein length capacity # trained_model should have same embedding method with new dat...
9eba869448b8419e926a0e599049cace9b2e5c9689b29ea358c671cda68e441d
Python
4,991
119
import numpy as np from keras.src import backend from keras.src import ops from keras.src.api_export import keras_export from keras.src.backend.common import is_int_dtype from keras.src.backend.common import standardize_dtype @keras_export("keras.visualization.draw_segmentation_masks") def draw_segmentation_masks( ...
466ae0473fafb76da0c473e01370fac8491389646aa93ba9845e9106e0d0c237
Python
4,992
98
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
79b5eb7745e2c7f97c29fc1128c48240e22fbab9523dca2c45f53044d60226ad
Python
4,992
108
import glob import h5py import numpy as np import os import pandas as pd from sklearn.linear_model import RidgeCV from sklearn.model_selection import GroupKFold from sklearn.linear_model import LinearRegression from sklearn import preprocessing import sys from scipy.stats import pearsonr """ This script will run ridge...
9522579bdc819048878aab5593407a5e7607aa845c56cdf5b46149b0caf30c5e
Python
4,993
132
#!/usr/bin/env python # Retrieves data from external data source applications and stores in a dataset file. # Data source application parameters are temporarily stored in the dataset file. import os import sys from json import ( dumps, loads, ) from urllib.parse import ( urlencode, urlparse, ) from urll...
a6f2f35c422fee8d5c7bf88822164835e6281ed62c92dcd474b40f6becd7e0c9
Python
4,993
171
""" A set of methods to extract tissue networks from segmented ROIs """ import numpy as np import sknw from skimage.morphology import skeletonize, thin from tqdm import tqdm class TissueNetwork: """ Convert cell segmentation masks to tissue network """ def __init__(self, cell_interior_mask): ...
41c900f9c5fe165ccf7b082206a1bf6f4180d9a897690de355c79dab6d1e9123
Python
4,994
125
# Copyright (c) ByteDance, Inc. and its 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. # # This file is basically a copy of: https://github.com/facebookresearch/ConvNeXt/blob/06f7b05f922e21914916406141f50f82b4a...
4629e1fd4dcd8cff760be46507452be078dd586762e39eec7ab0fb77aa09ab90
Python
4,994
141
# This example requires the following dependencies to be installed: # pip install "lightly[timm]" # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import pytorch_lightni...
d1e9e853c99d4e13083d923ed3c7d708e7c565589b26fe7544edb17499b84d96
Python
4,996
101
import os from Bio.PDB import PDBParser import shutil from tqdm import tqdm import pandas as pd import numpy as np def drop_duplicate_entries(tmp): """Drop cases where mutation and ddG/dTm value is the same, but other info is different""" arr = np.empty(tmp.shape[0], dtype=object) # get unique entries by...
2c2fc2468b71f150fa3cff6e2d24ef3605ef613b9c7dc630fcee260a32f3d2ff
Python
4,997
118
""" Regression tests for ``face_rhythm.point_tracking.PointTracker``. Locks the fix for GitHub issue #80: when ``rois_masks=None`` and the ``BufferedVideoReader`` is in ``method_getitem='by_video'`` mode (the mode the standard demo/pipeline uses), ``PointTracker`` must build a full ``(H, W)`` ROI mask. Previously it i...
6c1347bf67e8c394d748901dbd145c02208528e23437484acdaecbe5b466ed33
Python
4,997
137
# %% [markdown] # # Sharding # (advanced:sharding)= # # [Sharding](https://zarr.dev/zeps/accepted/ZEP0002.html) is a technique in [Zarr](https://zarr.dev/) for bundling multiple chunks into a single storage unit. # In terms of storage, this can drastically reduce the number of files written, # and thus reduce the overh...
e08e22a96d5530dace3a190b318c12ee83bb609972e8648f045d8187437a64b0
Python
4,997
128
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 21 15:30:53 2020 @author: ml """ import os import numpy as np import pandas as pd from collections import defaultdict def feature_dataframe_inparcel(subjects, fname, tbi_dir, camcan_dir, bands, parc='aparc'): rows = [] for i, subject in...
8a0a5cc12f1b6bf51e3cfba64f33ac5839f8bd91c0ce793e1de65731b9df5f01
Python
4,998
191
""" Widgets for editing the larva groups placed in an experiment. """ from __future__ import annotations from typing import Any import param from larvaworld.lib import reg, util from larvaworld.lib.param.custom import ClassDict from .distribution_widget import build_distribution_widget from .widget_base import cla...
8d3c323e4c64277b79046cfc1464ba9cb5d0fe7b33d205d0160eb1acf6dfdd6e
Python
4,998
187
# Copyright (C) 2003, 2004, 2006 by Thomas Mailund <mailund@birc.au.dk> # # 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 2 of the License, or (at # your option) any later versio...
a3a9407a1cdbe6708898c061411ebde48384c487189d5fa8ae71bf0aefaa773c
Python
4,999
129
from __future__ import division import unittest import numpy as np np.random.seed(42) from wyrm.types import Data from wyrm.processing import calculate_csp class TestCalculateCSP(unittest.TestCase): EPOCHS = 50 SAMPLES = 100 SOURCES = 2 CHANNELS = 10 def setUp(self): # create a random...
a88c880f27df7ab977db2c722dcc5146a9b2ef4d2aa1de9b6c1b0aeff6a3f645
Python
4,999
141
# -*- coding: utf-8 -* import torch import pickle import time import numpy as np import random import copy from CGraph import to_direct, soe_from_triedges ROOT_DATA = '../data' def cal_cb(n, ca, c): b = ca - n c = c - ca a = np.cross(b, c) cb = -0.58273431*a + 0.56802827*b - 0.5406746...
7362ae3ceaf0fe398a98cd92f97c5c59c809ff3089762ced2d2b6ed0c4daf287
Python
5,000
123
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Continuous neural data (CND) format used for mTRF-Toolbox""" from pathlib import Path from typing import Optional, Sequence, Union import mne from mne.externals.pymatreader import read_mat import numpy from .._data_obj import Dataset, Factor, NDVar, Scalar, ...
8fb31747a6c99674f09b3f24f8479442e71142850ac7a9c993d39f3c8300977c
Python
5,000
133
from . import InvertibleModule from typing import Union import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class PermuteRandom(InvertibleModule): '''Constructs a random permutation, that stays fixed during training. Permutes along the first (channel-) dimension for multi-d...
0ba1d835ae67baf5d8acb46b035e0ac5e196cf75b16e578106551195e5a0a7f9
Python
5,001
143
""" Convenience class that lets singletask models fit on multitask data. """ from __future__ import division from __future__ import unicode_literals import os import sklearn import tempfile import numpy as np import shutil from deepchem.utils.save import log from deepchem.models import Model from deepchem.data import ...
23b1d4e2ac2eea80579da75ae0275eb89ab7442471bc71e679a7192cc3bc52b6
Python
5,001
163
import numpy as np import pandas as pd from nnunet.evaluation import metrics import SimpleITK as sitk import os import matplotlib.pyplot as plt from pylab import * import glob import scipy.stats def stars(p): if p < 0.0001: return "****" elif (p < 0.001): return "***" elif (p < 0.01): ...
57c46da12002dc386227a49d725e47eea200190b99d1f08d7f865529d6fb4138
Python
5,001
150
""" Mask R-CNN Visualization Functions Original Code: - Copyright (c) 2017 Matterport, Inc. - Written by Waleed Abdulla - Licensed under the MIT License (see LICENSE for details) - Source: https://github.com/matterport/Mask_RCNN Modifications: - Jason Landen, 2024 - I adjusted the display_instances function to suppor...
7dfaf8ee8bc6a0850eda030c4ab27058f3fa312ca4dff4b55ee4b4d8ac5132ee
Python
5,003
165
"""Abortable Tasks. Abortable tasks overview ========================= For long-running :class:`Task`'s, it can be desirable to support aborting during execution. Of course, these tasks should be built to support abortion specifically. The :class:`AbortableTask` serves as a base class for all :class:`Task` objects ...
8770400f84eacca214530e90416da82223ea71e99af44038edbd43dd331f039b
Python
5,003
120
""" Network Simulations =================== `RectiPy` provides basic support for numerical simulations of network dynamics. Neuron models of the RNN layer are governed by differential equation systems of the form .. math:: \\dot y = F(y, \\theta, t) With state-vector :math:`y`, parameter vector :math`\\theta`, ...
c20b627e41b29b359b67abcd9f18af168f2976377f51fe130bbe444ee939cae5
Python
5,003
146
import argparse import os import torch import wandb import schnetpack as spk from pathlib import Path from torch.optim import Adam from schnetpack import AtomsData from schnet_trainer import Trainer from schnetpack.train import CSVHook, ReduceLROnPlateauHook, EarlyStoppingHook from schnetpack.train.metrics import MeanA...
d314608524da2a40c20cc166b7a02c385dfa04045edf82bf119584572be55e9a
Python
5,003
127
"""Unit tests for larvaworld.lib.plot.ga (GA optimization-progress plotting).""" from __future__ import annotations import matplotlib.figure import pandas as pd import pytest from larvaworld.lib import reg from larvaworld.lib.plot.ga import ga_progress_plot @pytest.mark.fast class TestTurnerNoiseParamRegistration:...
57d7506d2fdb944796bbacdef22b7b52c43accb92982f4a8e7167e37f46eb422
Python
5,004
137
"""grind-r8 cluster 4.0.8: subprocess grandchildren, arm 2 (R40). ``PR_SET_PDEATHSIG`` protects only the DIRECT child: on a hard parent SIGKILL the session-leading child dies, but a plain non-detached grandchild (``sh -c 'sleep &'``, a forking dot plugin) survived with nothing left to kill its group (sol probe; the gr...
64303894061f3a9ae178294f0f7500deb0863502f53abb49a7882df79653c7c6
Python
5,004
160
"""No import runs while the RNG monitor window is armed on a process's first capture. An import inside the host-nondeterminism monitor window runs the ``sys.meta_path`` finders' ``find_spec`` frames, and the monitor's frame-reachable inventory walks those frames as roots. A large object graph behind a finder (pytest's...
04aa2b69f7b72a43a3fadb7e6c42f7f51ef8bb69e3bfeffbad11df45a8ebdd2b
Python
5,005
187
"""Remote Debugger. Introduction ============ This is a remote debugger for Celery tasks running in multiprocessing pool workers. Inspired by a lost post on dzone.com. Usage ----- .. code-block:: python from celery.contrib import rdb from celery import task @task() def add(x, y): result =...
2f7aa8f9389e08a48a2d3475f895c88cde095379f9d5e7272ce594b028dedae1
Python
5,005
120
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Caffe2 to PyTorch checkpoint name converting utility.""" import re def get_name_convert_func(): """ Get the function to convert Caffe2 layer names to PyTorch layer names. Returns: (func): function t...
8d6c2e47717602058989199cd57425993e8f5f9bee665b50e9a43a7ad703414b
Python
5,005
173
"""Tests for the internal fastlog predicate orchestrator.""" from __future__ import annotations import pytest import torch from torch import nn import torchlens as tl import torchlens._state as torchlens_state import torchlens.capture.projections as fastlog_state from torchlens.fastlog.exceptions import PredicateErr...
6fd02fffdf732df6187313f87f7d50402941608e8acca247b3be15b4d3e083db
Python
5,006
285
#!/usr/bin/env python '''Generate models for affinity predictions''' # variables: # non-linearity: ReLU, leaky, ELU, Sigmoid, TanH (PReLU not current ndim compat) # normalization: none, LRN, Batch # learning rate: 0.01, 0.001, 0.1 modelstart = '''layer { name: "data" type: "MolGridData" top: "data" top: "l...
acf52e5a68df96179f2e3bab927ea5ed129a1f3eba7d598614649015b6334d23
Python
5,006
143
import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces from neurogym.utils.ngym_random import TruncExp class PostDecisionWager(TrialEnv): """Post-decision wagering task assessing confidence. The agent first performs a perceptual discrimination task (see for more details ...
25ac844b254d5627d26143814d031ed6e33dc820dacb213e375b7df0318cfe14
Python
5,007
170
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Domain(_BaseLayoutHierarchyType): _parent_path_str = "layout.map" _path...
1dbc6d99e08db42f8ca61a9eaf4de80b2497fd176eb818a40ba36b1512cfa7cd
Python
5,008
157
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # For a full list of documentation options, see: # https://www.sphinx-doc.org/en/master/usage/configuration.html # # ---------------------------------------------------------------------------- import os from os.path import dirnam...
f5bea83e46faa77a7377e1d72251d802b56f58a18c5a1a2cd15df500faa2518a
Python
5,011
155
# -*- coding: utf-8 -*- from __future__ import print_function, division import mxnet as mx import numpy as np from mxnet import gluon, nd from mxnet.gluon import nn from mxnet.gluon.data.vision import transforms from networks import resnet18, resnet34, resnet50 import gluoncv as gcv gcv.utils.check_version('0.6.0') f...
9f688b47c7f532561e187b55da81710e95222fec322da420c120055fe60812fe
Python
5,012
148
import os import sys import imp from itertools import product, starmap import distutils.command.install_lib as orig class install_lib(orig.install_lib): """Don't add compiled flags to filenames of non-Python files""" def initialize_options(self): orig.install_lib.initialize_options(self) self...
4f651d33b849649bc26051a8e264b281dd84ba59a13b46ae8527bda49229ec14
Python
5,013
123
from __future__ import annotations from collections import defaultdict from typing import Optional import pandas as pd from bream4.toolkit.procedure_components.feature_manager import ChannelNotifierState class SaturationWatcher: """Used to watch and record when channels become saturated. Example: * Instan...
76c8f41049b73e024fdac74caa894af939fe5fb22ce35fe69a6d09080926cdc9
Python
5,013
170
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Domain(_BaseTraceHierarchyType): _parent_path_str = "parcats" _path_str =...
992675f6626488a4eae7a2429256432d54a66759e73b7d4e97229db10f8584d9
Python
5,013
170
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Domain(_BaseTraceHierarchyType): _parent_path_str = "treemap" _path_str =...
f4bcd73395909c5ec38cd1b5c4715f65baa19ad630474540b8f021b9964bc1ed
Python
5,013
120
"""Tests for collect_run_data.""" import os import pytest from bids.layout import BIDSLayout, parse_file_entities from niworkflows.utils.testing import generate_bids_skeleton import xcp_d.utils.bids as xbids from xcp_d.data import load as load_data # Pairs of runs in the sibling_runs skeleton whose names differ onl...
c8f7ecbcc1d2aac0ea4be1959d8c1811db16877a07935a77725dd78d61dbbd37
Python
5,014
126
import torch from torch import nn from einops import repeat, rearrange from survival_plus_x.models.vit import Transformer def patch_to_img_3d(batch_of_patches, patch_shape, n_patches_per_dim): """ Reconstruct a batch of 3D images from the patch representation. Params ------ batch_of...
5b6752ce85b9d0aaf1b7f4d89940566928b6c991ef61be36387cf861993e90b8
Python
5,015
138
from keras.src import backend from keras.src.api_export import keras_export from keras.src.optimizers import optimizer @keras_export(["keras.optimizers.Lion"]) class Lion(optimizer.Optimizer): """Optimizer that implements the Lion algorithm. The Lion optimizer is a stochastic-gradient-descent method that use...
c162c0bf5bcbbd9086843b6d67f7add09a4dee869f872ea89064ee8eed281076
Python
5,015
156
import sys sys.path.insert(1, '/u/home/r/ryo10244/Xiao_lab/dsRNA_pred/script/utils') import re import pysam import argparse as ap import pandas as pd import numpy as np from utils import * from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split, cross_val_scor...
33b8603eca87e83eb161204e2f713d96b4f477f736d8bf6c0d3af674239e3ecb
Python
5,016
134
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Configure Eelbrain""" import multiprocessing import os import sys from matplotlib.colors import to_rgb from ._utils import IS_OSX SUPPRESS_WARNINGS = True CONFIG = { 'n_workers': multiprocessing.cpu_count(), 'eelbrain': True, 'autorun': None, ...
2a28b768cf825d1478c7313d8b1fde72166c2f8415a612224643ec6f2c1e8b9b
Python
5,017
181
"""S2 capture-spine per-op overhead benchmark.""" from __future__ import annotations import argparse import json import statistics import time from pathlib import Path from typing import Any import torch from torch import nn import torchlens as tl from torchlens.fastlog import RecordContext class ThousandOpModel(...
88b03741d321e2be74e017ddf3a9d63aa6810cb22b9c4983750aedcaf8084ea7
Python
5,017
132
import copy from rdkit import Chem from rdkit.Chem import Mol from rdkit.Geometry.rdGeometry import Point3D from typing import List, Tuple try: from ccdc.molecule import Molecule except: print('CSD Python API not installed') class ConversionError(Exception) : pass # Mol is a RDKit molecule # Molecule is...
4618169be30bc6960f81cf5c677f80dd3a0df7d67380cf3e89ae050c1e7c9283
Python
5,018
134
from contextlib import contextmanager import os from os.path import dirname, abspath, join as pjoin import shutil from subprocess import check_call import sys from tempfile import mkdtemp from . import compat _in_proc_script = pjoin(dirname(abspath(__file__)), '_in_process.py') @contextmanager def tempdir(): td ...
27da1d543d5ec0d6c3b27f514d01f9442e86b064710737c91e52e37bf8e92aba
Python
5,019
115
#!/usr/bin/python3 import os import sys import argparse import pandas as pd version = "0.1.5" # converts count data to fpkm and tpm values # needs some mofifications before running .... # prepare data # print data frame def _print_df(mydf, outfile, index_label): mydf.to_csv(outfile, sep='\t', mode='w', header=Tr...
c8396cde5c7506caad6ff5551b6d29849b1c2f7aa865a3eb4ebab7b4967addcb
Python
5,020
152
# 05/24/2023 Fengyao Yan # This folder file create a deep learning model, train the model and validate the model # all the data res stored in the data folder in the root import os import pickle import random import pandas as pd import numpy as np import tensorflow as tf from scipy.stats import pearsonr from sklearn.p...
ae01f51460e6151ef747438fe138212bb3dd02a53ae77f2e2f7e90edc87db89a
Python
5,021
108
import glob import h5py import numpy as np import os import pandas as pd from sklearn.linear_model import RidgeCV from sklearn.model_selection import GroupKFold from sklearn.linear_model import LinearRegression from sklearn import preprocessing import sys from scipy.stats import pearsonr """ This script will run ridge...
af25fedad2993778097649d8881e8e5584ae9f8e134127eabee55f86d3d4b02c
Python
5,021
158
import pytest import inspect import rpy2.robjects as robjects rinterface = robjects.rinterface import array identical = rinterface.baseenv['identical'] Function = robjects.functions.Function def test_init_invalid(): with pytest.raises(ValueError): Function('a') def test_init_from_existing(): ri_f =...
b8386ec946450c05f2ad040dab13c8dcf1921225ac5f3a2e7bd94bdd98dc5043
Python
5,021
116
""" This script shows the training pipeline for k-fold training, without logging it via wandb. """ import tensorflow as tf import tensorflow.keras as keras import tensorflow_addons as tfa from sklearn.model_selection import StratifiedKFold from tf_spiking.helper import TrainingHistory from tf_spiking import DenseLIF, ...
fff162fae7b29b58afe5d34c33547a078aba0b03329a391401bd2cff47989bac
Python
5,021
116
""" This script shows the training pipeline for k-fold training, without logging it via wandb. """ import tensorflow as tf import tensorflow.keras as keras import tensorflow_addons as tfa from sklearn.model_selection import StratifiedKFold from tf_spiking.helper import TrainingHistory from tf_spiking import DenseLIF, ...
8e3379448dfaf7cdb8564dc2577a3e398e37916ee0ec7574db2f34879e0bf1a9
Python
5,022
166
from abc import ABC, abstractmethod import numpy as np import torch class SplicingMechanism(ABC): """ Represents a splicing mechanism. """ @abstractmethod def predict_motifs(self, rna): """ Predict the motifs on the given RNA sequence. Input: RNA sequence (N,), elements ...
ca15550cd46407024c2ee551c4d0f188b2ed647b34a3f21b72aabc8eb1bd3c54
Python
5,022
126
import numpy as np from absl.testing import parameterized from tensorflow import data as tf_data from keras.src import backend from keras.src import layers from keras.src import ops from keras.src import testing class RandomGrayscaleTest(testing.TestCase): def test_layer(self): self.run_layer_test( ...
41ddc478a128f9bc61532117e6d6493988022c533f2aaf837763e696bcaf65ba
Python
5,024
207
# coding=utf-8 # Copyright 2023 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...
8a6199843fa38a562acca822eecd1a0f1a814753bcbc9d8e84c9050fddbccf4e
Python
5,025
130
""" Functions for all atom design. """ import numpy as np from copy import deepcopy from utils.utils import multimer_collate_fn, tree_map, tree_flatten from helixfold.data import pipeline_aa_utils MSA_NAMES_0_DIM = [ 'aatype', 'between_segment_residues' ] MSA_NAMES_1_DIM = [ 'deletion_matrix_int', 'msa', 'te...
dd16b26182d3744f511635d925635461012f8f87b5fd431b3d6d382d101a30b6
Python
5,025
125
import unittest import pickle from os.path import join, abspath from cantera import Solution from spitfire import ChemicalMechanismSpec, CanteraLoadError class MechanismSpec(unittest.TestCase): def test_create_valid_mechanism_spec_from_xml(self): try: xml = abspath(join('tests', 'test_mechanis...
e5ca6ff38dc9ed983964c1022f6522e6cd2c6fd4625e3acae435e43d876a040b
Python
5,025
142
from collections import OrderedDict import numpy as np import pytest from gym.spaces import Dict, Tuple from gym.vector.utils.numpy_utils import concatenate, create_empty_array from gym.vector.utils.spaces import BaseGymSpaces from tests.vector.utils import spaces @pytest.mark.parametrize( "space", spaces, ids=...
e69a75a116a05c089c0574dd82cce319fc65fd931da284e7bf457d33914f87ea
Python
5,025
163
import numpy as np def encode_domains(X, y, domain): r"""Encode the domains of the matrices in the labels. We handle the possibility of having different domains for the datasets by extending the labels of the matrices and including this information to them. For instance, if we have a matrix X with cl...
3c5ec708c4317119481ee576ec982d79fbdd9b2271f6ae74ffb76337abab69b8
Python
5,027
155
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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 applica...
f77818d482e443b02ca07a758baf95d123bee96e1dbc998dacf974f43de2e1da
Python
5,027
150
#!/usr/bin/env python3 import numpy as np from scipy.spatial.distance import squareform """ Dec-16-2021 by Guo Jiahui and Ma Feilong This script contains functions to read RDMs and masks. All RDMs are in the vectorized upper triangle format, i.e., the output of `squareform`. For example, the vectorized upper triang...
5812e088c8fe6c9f80297849b9a6d17622b9959588cc68184e8f8b7686664a5c
Python
5,029
159
""" Top-level Galaxy job manager, moves jobs to handler(s) """ import logging from functools import partial from typing import ( TYPE_CHECKING, Union, ) from galaxy.exceptions import ( HandlerAssignmentError, ToolExecutionError, ) from galaxy.jobs import ( handler, NoopQueue, ) from galaxy.str...
93b4fd0b37984793d94abd0c8d256f16ceb3a5f9196a5f41ae5f31bbebcfa579
Python
5,029
197
"""Internal state. This is an internal module containing thread state like the ``current_app``, and ``current_task``. This module shouldn't be used directly. """ import os import sys import threading import weakref from celery.local import Proxy from celery.utils.threads import LocalStack __all__ = ( 'set_defa...
523c99ec8c5019fd6bdea0a82a8c2508dedb98e61e792641861c2b47e7bbb7c4
Python
5,030
170
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Domain(_BaseTraceHierarchyType): _parent_path_str = "sunburst" _path_str ...
18494e47502edf88dc7b6625bf1c560e4a0451cada22c10d538a02f3d3a1f1df
Python
5,031
119
#!/usr/bin/env python # -*- coding: ascii -*- __doc__ = """ This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9. See Copyright notice below Copyright (C) 2014 Ingo Fründ This code reproduces the analyses in the paper ...
327eb3fe5413379d411974633fbd8f68813abbbc59885d0fc412add8e873430f
Python
5,031
119
#!/usr/bin/env python # -*- coding: ascii -*- __doc__ = """ This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9. See Copyright notice below Copyright (C) 2014 Ingo Fründ This code reproduces the analyses in the paper ...
41802cd7099ccd75e9c82060c4e89a3b08e7fec05b7b3a4690842cc961eab8f4
Python
5,031
119
#!/usr/bin/env python # -*- coding: ascii -*- __doc__ = """ This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9. See Copyright notice below Copyright (C) 2014 Ingo Fründ This code reproduces the analyses in the paper ...
446b3036a69e6a8327a3e1cdb3fe72d10d0aa1f2c4f4fb3ad350e23a65882c8a
Python
5,031
119
#!/usr/bin/env python # -*- coding: ascii -*- __doc__ = """ This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9. See Copyright notice below Copyright (C) 2014 Ingo Fründ This code reproduces the analyses in the paper ...
4da28cab9e8edf0363a62212f8afb34ee3809101aecff41c9b1aeee0695a5771
Python
5,031
119
#!/usr/bin/env python # -*- coding: ascii -*- __doc__ = """ This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9. See Copyright notice below Copyright (C) 2014 Ingo Fründ This code reproduces the analyses in the paper ...
515cd5dd812914c0e5084069f2538f4d06fa9d4d2edcbb547fc3f02af1a2d926
Python
5,031
124
# General imports import os import glob import sys import torch import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import pytorch_lightning from tqdm.auto import tqdm # EUGENe imports and settings import eugene as eu from eugene import models, evaluate, settings from eugene.mo...
9792ff186e7fee37107b786d8047260e6eef07b5c4e229940f4fecc7510c6ccc
Python
5,031
119
#!/usr/bin/env python # -*- coding: ascii -*- __doc__ = """ This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9. See Copyright notice below Copyright (C) 2014 Ingo Fründ This code reproduces the analyses in the paper ...
c22e70a16af4b22c5ea7e1320a3b0932f63910f20300d56efaee3db6f8a99281
Python
5,031
119
#!/usr/bin/env python # -*- coding: ascii -*- __doc__ = """ This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9. See Copyright notice below Copyright (C) 2014 Ingo Fründ This code reproduces the analyses in the paper ...
14d248f00d6f9e3e301ef76ce5b1a8b5e9de54f6cdf6bb19aa369b26269c8008
Python
5,032
132
"""A09 agent stage-0 item 1: the composed lazy-payload honesty gate. Record-shaped AND memory-shaped acceptance (the agent memo P0's exact demand -- record-shaped tests alone are how the silent-None bug shipped): - ``.out`` on a lazily loaded trace materializes one sha-verified blob or raises typed ``PayloadUnavail...
566e024145a0863ca10f947ced7f213ab68f686bd34402990892cd2c4db5055f
Python
5,032
133
import os import sys from argparse import ArgumentParser import torch import torchvision.transforms as transforms from monai.networks.nets import UNet from torch.utils.data import DataLoader import utils.data_transforms as data_transforms from utils.datasets import DiffusionDataset from utils.epoch_cycle import run_c...
b5b3afd2b75252699b255faedbb471b0946f402add5150366c1cc9f292d6aba9
Python
5,032
120
#!/usr/bin/env python # -*- coding: ascii -*- __doc__ = """ This code was adapted from Fründ, Wichmann, Macke (2014): Quantifying the effect of inter-trial dependence on perceptual decisions. J Vis, 14(7): 9. See Copyright notice below Copyright (C) 2014 Ingo Fründ This code reproduces the analyses in the paper ...