sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
45592cd56b6a934f5852bdecc8789f39466fdafc8dae00cb562f83d8050df444
Python
3,760
99
# 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...
83691980befd60e7f80dd695b31181818030e040345b457b82736eedcaeac755
Python
3,760
92
"""The capture-door inventory lint (lane F40c, XS; foldA MEMO s5 item 8). The one-door law (trace-verb verdict section 1): ``tl.trace`` is the ONLY public live-capture door to a ``Trace``. This lint enumerates every root callable whose return type mentions ``Trace`` (classes count by name) and asserts the set equals t...
8f06d43d9eadb8d14f1fc49de238a0dd180976e91604ea1870c34be691315e98
Python
3,760
125
from typing import Optional import numpy as np from numpy.testing import assert_almost_equal import gym from gym.wrappers.normalize import NormalizeObservation, NormalizeReward class DummyRewardEnv(gym.Env): metadata = {} def __init__(self, return_reward_idx=0): self.action_space = gym.spaces.Discr...
7c6bf2e82c1cc1e7c7651ebeab995220cec5948dd3fe224cb29c974df9832acc
Python
3,761
111
import numpy as np from src.data.BoolQReader import BoolQReader from src.data.CBReader import CBReader from src.data.RTEReader import RTEReader from src.data.MultiRCReader import MultiRCReader from src.data.WiCReader import WiCReader from src.data.COPAReader import COPAReader from src.data.RecordReader import RecordR...
7cd218f671b57cc0afd6a414755f4b99e70befe82240279a8c5fea0355bd68e6
Python
3,761
116
import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor class MACLLoss(nn.Module): """Implementation of the Model-Aware Contrastive Loss (MACL) from the paper: This implementation follows the MACL[0] paper. - [0] Model-Aware Contrastive Learning: Towards Escaping the ...
3a4472ab8fb431b9028ab2209dd989e3818e22620225b787785c8662af3d61ee
Python
3,762
100
import subprocess import unittest from unittest import skipIf from time import sleep from unittest.mock import patch from io import StringIO import sys from carbontracker import cli import os def mock_password_input(prompt): # Simulate password entry based on the prompt if "Password:" in prompt: return...
78b4e399d0b06659359df507e7160475c4d4ac22ab1dea480cdae73033e88b89
Python
3,762
156
import subprocess import pytest import sys import os import textwrap import rpy2.rinterface as ri ri.initr() def floatEqual(x, y, epsilon=0.00000001): return abs(x - y) < epsilon def test_int(): sexp = ri.IntSexpVector([1, ]) isInteger = ri.globalenv.find("is.integer") assert isInteger(sexp)[0] d...
965a1de9b3c019ebf54655f2cce3dcf6fdeb59e71bbe7696b176ea9ac08d1bcd
Python
3,762
99
import math import torch import torch.nn as nn import torch.distributions as D class RepresentationLayer(torch.nn.Module): ''' Implements a representation layer, that accumulates pytorch gradients. Representations are vectors in nrep-dimensional real space. By default they will be initialized as a ten...
26976a8d6c0b3e651afb9c3af50fe83b1ea903ce91162e61975a76aea5328edf
Python
3,763
117
# --- 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 Spaceframe(_BaseTraceHierarchyType): _parent_path_str = "volume" _path_st...
37d1fd3ce4382548588b1d2af67b867f0d7a72dd2d99748ee43b5fcc5c3f76e2
Python
3,763
116
# --- 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 Marker(_BaseTraceHierarchyType): _parent_path_str = "bar.unselected" _pat...
e1c84a9371b087750bd248615ee11efea3e197ef94a1f151dca57e3ce3da3d00
Python
3,766
100
import warnings from unittest import mock import numpy as np from keras.src import backend from keras.src import callbacks from keras.src import layers from keras.src import testing from keras.src.models import Sequential from keras.src.utils import numerical_utils try: import requests except ImportError: re...
2d5f9fd109d67d4652dd1a7aca957075e3363f38ccef2728d94825760a9ff6d6
Python
3,767
87
# pylint: disable=arguments-differ,line-too-long,missing-docstring,missing-module-docstring import math import random # code adapted from: # https://github.com/kakaobrain/fast-autoaugment # https://github.com/rpmcruz/autoaugment class EfficientNetRandomCrop: # pylint: disable=misplaced-comparison-constant def ...
7cf60eb8aa6bef4f67071ea22ec0dbb50ffa72adb3bc0fc1868b686b3ad38ae5
Python
3,768
112
#!/usr/bin/env python3 """ File: check_results.py Created: 2022/04/01 Last Changed: Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directory of this source tree. """ # S...
8155126cac734196fc0e7ecd64e91c87cdf2d8c45f838ac1538c1a5445b63769
Python
3,768
125
import numpy as np import torch import plotly.graph_objects as go from e3nn.io import SphericalTensor def plot_orbitals(traces, traces_species, title_str, show_fig=False): traces = [go.Surface(**d) for d in traces] fig = go.Figure(data= (traces)) fig.update_traces(showscale=False) if show_fig: fig.sho...
42f839609a0d868587505866f61c52f97098cbf675c4195f016aa5c7a29e2bd9
Python
3,769
113
# --- 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 Marker(_BaseTraceHierarchyType): _parent_path_str = "waterfall.increasing" ...
ae5db2d420d7d8931e907ddde9ac6f33b33015dd7357e13a6a71422bf3c34699
Python
3,769
113
# --- 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 Marker(_BaseTraceHierarchyType): _parent_path_str = "waterfall.decreasing" ...
29dd20f0897777ed017e690ef1ef2a9cf55cacc1d9ed13c844322499ff876084
Python
3,771
126
#!/usr/bin/env python """ That tools tries so solve a simply mapping problem in the easiest and propably dirtiest way ever. In galaxy we need often so called mapping of identifiers, e.g. EC-2-GO, UniProt-2-PDB, UniProt-2-PDB and so on. Normally such mapping files are available in a tab-separated format. AIM: Write a m...
5148039b39b472877cb87fbea7035dee045c06203d233fdc2eddab8971f63db6
Python
3,771
131
# --- 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 Caps(_BaseTraceHierarchyType): _parent_path_str = "volume" _path_str = "v...
860233382ccd00b1dbccf9c7f8c8b99ea4d6082d6bae4e8cd1f9cbf96d4fcc29
Python
3,772
106
import re from modular_splicing.dataset.datapoint_extractor import DatapointExtractor from modular_splicing.dataset.generic_dataset import GenericDataset, dataset_types from modular_splicing.utils.construct import construct from modular_splicing.utils.mulitple_contexts import MultipleContexts from modular_splicing.util...
954a8b55f4f940810b606ecd49f2c8e0a982ee5fb9cf6f2a8528d6a7d94602a8
Python
3,772
136
__author__ = "Yasunobu OKAMURA" __copyright__ = "Copyright (c) 2012 Y.Okamura" __license__ = "GPL v3+" import xml.parsers.expat import networkx as nx class XGMMLParserHelper(object): """""" def __init__(self, graph=nx.DiGraph()): """ Arguments: - `graph`: Network X graph object ...
976cadaee4eff4f14868a29329060314ceb0f801074c9226c69d3eaa959c60ab
Python
3,772
126
from typing import ( Callable, List, Optional, Tuple, Iterable, Union, ) from pysam.libcutils import _pysam_dispatch class SamtoolsError(Exception): '''exception raised in case of an error incurred in the samtools library.''' def __init__(self, value): self.value = value ...
378ec8fc01b9831cb8576f82cadeeb4ef88600ef83dafe77d69ad0e072a3a6e6
Python
3,773
85
""" Ethoscope is a platform developed at `Gilestro lab <http://lab.gilest.ro/>`_. It provide an integrated set of tools to acquire behavioural data on small animals and build feed back modules to interact with them in real time. A description of the whole system is available on its `website <http://gilestrolab.github.i...
49a93c20b59b9977276f3a2ce144f08ab1ecfdf22e9a6674e4120834f756b6a3
Python
3,773
115
"""Reproducing angles.""" import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces, tasktools class AngleReproduction(TrialEnv): """Angle reproduction. The agent has to reproduce to two angles separated by a constant delay. """ metadata = { # noqa: RUF012 ...
93ccce152fd1ea944beefe344b6c071fd51ca4d8e59e456e3415921cedab2966
Python
3,773
126
"""Worker Pidbox (remote control).""" import socket import threading from kombu.common import ignore_errors from kombu.utils.encoding import safe_str from celery.utils.collections import AttributeDict from celery.utils.functional import pass1 from celery.utils.log import get_logger from . import control __all__ = (...
e132deedcf3d8cf1d53a24db01d2b620c5bddf74ef20f7b2ada894c9bdf3b4a7
Python
3,773
153
import numpy as np import torch import sklearn from sklearn.ensemble import RandomForestClassifier from train_utils import * # Step 1: Read and preprocess data # f = open('large_dataset/protein_19.txt') f = open('protein_dataset/protein_19.txt') vals = [line.strip().split(', ') for line in f] f.close() def convert...
2464cab151fa7a911b01ac05122fa6d406adb04b4a1a4b50e6204153d0e8e58f
Python
3,774
98
import torch.nn as nn import torch import math import numpy as np import torch.nn.functional as F from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): def __init__(self, in_features, out_features, residual=False, variant=False): super(GraphConvolution, self).__init__() self...
42f7716cca0d2c65a4d062e5a046b9a09bb89d7f08094419832643cb8ee6b0e8
Python
3,774
112
""" Code related to detection and measurement of action potentials (APs) """ import warnings import logging import numpy as np import pyabf import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"....
1c86956d6fe64f2fa66ff20662810fc7b2da413190188b5d66f2189e0235888b
Python
3,775
111
# Linear-circular regression # # Method published in Kempter, R., Leibold, C., Buzsáki, G., Diba, K., & Schmidt, R. (2012). # Quantifying circular – linear associations : Hippocampal phase precession. 207, 113–124. # https://doi.org/10.1016/j.jneumeth.2012.03.007 # # This python script is first implemented by Dr. Dusti...
3608cb547ea55d201d3da239a8a82912e9513dd12e6ec2eb3fae13d25e235961
Python
3,775
104
"""Shared receptive-field rule-registry isolation for the RF test suite. Every ``tests/test_rf_*.py`` file needs the same process-global hygiene: the RF rule registry (``torchlens.receptive_field._rules._RF_RULES``) and its cache-invalidation epoch (``_RF_RULES_EPOCH``) must be snapshotted before a test mutates them a...
47c8822d857311e8c6483e0fc25fadfa244894d2b8451c30ed0679eba405b959
Python
3,775
124
# coding: utf-8 '''Tests for ml''' import unittest import numpy as np from bdpy.ml.crossvalidation import cvindex_groupwise, make_cvindex, make_cvindex_generator class TestCVIndexGroupwise(unittest.TestCase): def test_cvindex_groupwise(self): # Test data x = np.array([ 1, 1, 1, ...
29c46b1f38dc4be05a55087ff8dc1dc3d1f69ae3a85f7d63c9a6940c9500ae1d
Python
3,776
257
""" Sequential color scales are appropriate for most continuous data, but in some cases it \ can be helpful to use a `plotly.colors.diverging` or \ `plotly.colors.cyclical` scale instead. The color scales in this module are \ mostly meant to be passed in as the `color_continuous_scale` argument to various functions. ""...
4ad08689210c011f1f487874482d402444e799917c1306f1124df8c65baa89c6
Python
3,776
72
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
8c017dd5ccb90bba03a0a625b6a252fbec0901f2879c9a3b49ef22a6631e1758
Python
3,776
92
# main code to wrap up all the steps from data fetching to curation import pandas as pd from MoleculeACE.benchmark.const import WORKING_DIR def main(chembl_targetid='CHEMBL2047', bar=True, endpoints=["EC50"], assign_class=True, thr_class=100, working_dir: str = WORKING_DIR, rm_high_std=True): from benchm...
ca4c843ee5409b35a4e1d6156ac8242a8c86bd5ddd7b4a5ab674c5aa6904ef89
Python
3,776
103
import json import logging import os import tempfile import time import unittest from codecarbon.emissions_tracker import ( EmissionsTracker, OfflineEmissionsTracker, track_emissions, ) from codecarbon.output import LoggerOutput def heavy_computation(run_time_secs: int = 3): end_time: float = ( ...
a111dd334e7c71ed02df7939dfe7a778c5cc1491090b72f862c6268fe427f66c
Python
3,777
107
"""Base segmentation dataset""" import random import numpy as np from PIL import Image, ImageOps, ImageFilter import mxnet as mx from mxnet import cpu import mxnet.ndarray as F from .base import VisionDataset __all__ = ['ms_batchify_fn', 'SegmentationDataset'] class SegmentationDataset(VisionDataset): """Segmenta...
4dc47942d688066954da5e11b1deef51b53469145872f1b9911e628afe217b41
Python
3,778
120
"""W051-EXTRACT: default collation of (input, label)-shaped items teaches (audit 3.13). Tuple items, ``TensorDataset`` rows, and ``DataLoader`` batches default-collate to one positional input per element and used to die inside the model with a raw ``TypeError``; when ``forward`` cannot bind that many positionals the e...
cc972f1a477dd13258a1720d1fb006a1b1aa616cc4cbf580935b490475c5ce0b
Python
3,779
108
"""Extract segmentation performance""" import os from os.path import join as opj import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from scripts.utils.constants import CSV_ORG_OVERVIEW from scripts.utils.metrics import get_dice class SegmentationPerformanceExtractor(): """Extracts perform...
fa7f66ba03f5abea02804838c01b8f83d24d990581f9ee5a877eebe445b111f3
Python
3,779
114
"""Schema audit tests for intervention Phase 1 fields.""" from __future__ import annotations from typing import Any import torch import torchlens as tl from torchlens._trace_state import TraceState from torchlens.constants import LAYER_PASS_LOG_FIELD_ORDER, MODEL_LOG_FIELD_ORDER from torchlens.data_classes.op impor...
2e0bf1a08e6d1a865ba998e4bae324b74be93d6f5f2fd598a2807e9dc80c3779
Python
3,781
144
""" Useful functions that don't deserve a CLI. If they do, they belong in utils.py. """ import numpy as np import pandas as pd import pkg_resources import os # ### Math functions ### def running_avg(x): """ Given a 2D numpy array, calculate a running average of each of the columns. That is, the ijth e...
5273c3d59204dd8e4275804596adc39f42340782c3d3c8757fae71aee06273c8
Python
3,782
97
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 14 21:03:49 2021 @author: fcheng """ import numpy as np from itertools import product def CalSimilarityIndex(image, maskinfo): """ calculate similarity index for image, given two masks Output: Index - a float number, positive if...
f789b3625adb35dd1a69a67315ffc8f082acfdd8a74fb28539457829b4a54a58
Python
3,783
87
# 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...
78841f4583b5a153afd45e2c52d3432922e66ed57ddbcdf9e17df076ca07a6f2
Python
3,784
100
import h5py import numpy as np from Desert import * from Land import * pi = math.acos(-1.0) dtr = pi / 180.0 confdnc_l = np.zeros([32, 32]) cmin21_list = np.zeros([32, 32]) cmin22_list = np.zeros([32, 32]) cmin31_list = np.zeros([32, 32]) cmin32_list = np.zeros([32, 32]) def read_hdf5_file(file_name, size): f =...
9d0a07c77e103d6e9738f900a4aed8812db3cb59fd3cd7fb9d8e12bf19eeed63
Python
3,784
119
import os import pickle import tqdm.auto as tqdm import h5py import numpy as np import torch from modular_splicing.models.modules.lssi_in_model import BothLSSIModels from modular_splicing.utils.arrays import Sparse from modular_splicing.utils.run_batched import run_batched from modular_splicing.utils.io import load...
428189eeb706b15bf866830c125f37dfadc13e50c0fe521a8a0b19b76e4e8e13
Python
3,785
92
# FAITHFUL PORT of RTH-tools/crispron @ master (original framework: TensorFlow 2 / Keras, # bin/DeepCRISPRon_train.py) # # CRISPRon predicts Cas9 on-target editing efficiency from a 30-mer (4-base one-hot, # length 30) plus a scalar deltaG (binding free energy) side input. The real repo ships # only trained `tf.keras` ...
537428682eb03d983da93ba32b97d9dc19e34f3ed41d969b9dacd8a5cc0cf8ed
Python
3,785
130
import numpy as np import torch from numpy.random import default_rng import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from tqdm import tqdm import multiprocessing from multiprocessing import Pool, freeze_support, current_process, RLock from functools import partial import pathlib from causal_o...
7399d54ce30fbb1a16a509e7492a0908dfd97572a8607897d4805a29acde19dd
Python
3,785
102
# ------------------------------------------------------------------------------------- # Code to perform parallel processing # From https://github.com/ThomasAkam/Two-step_ACC/blob/4a0c5ad6a40b84721af972a11d9952e4e305f7e5/analysis_code/two_step/Two_step/parallel_processing.py#L4 # -----------------------------------...
a43521ef0d95e677c6b7a37ef506a4234136fd15782940b80364414be0c7a6f9
Python
3,785
147
""" Validation used in tkinter Entry widgets. SimplyFire - Customizable analysis of electrophysiology data Copyright (C) 2022 Megumi Mori This program comes with ABSOLUTELY NO WARRANTY This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as publishe...
cdc2483cdbb45708c15d83a7552c6c8957d1395a7b9437a9fc245151de3e7871
Python
3,785
103
""" Gregory Way 2017 PanCancer Classifier scripts/map_mutation_class.py Merge per sample classifier scores with mutation types present in each sample Usage: Run in command line: python scripts/map_mutation_class.py with required command arguments: --scores string indicating the location of all sample p...
0f86a31cc4ce203bc0462c43e70e825b3e092d1f7a2142ff493b08785235a016
Python
3,786
129
import pandas as pd import numpy as np import torch import torch.nn as nn from torch.utils.data import Dataset, DataLoader from torchvision import datasets import torchvision.transforms as transforms import random import os import umap import anndata import scanpy as sc from torch.autograd import Variable import h5py i...
0effcb6797ce7389a467f70bf78a6c721a4e7a2daf29ea96e11fadbaf4acaa67
Python
3,787
132
"""PP-PicoDet compact mobile object detector. Yu et al., 2021, "PP-PicoDet: A Better Real-Time Object Detector on Mobile Devices". PicoDet uses an ESNet-style lightweight backbone, CSP-PAN neck, anchor-free detection, and a GFL/quality focal style head. This compact random-init reconstruction keeps those inference c...
223a31d42d2d2063a62b6bd324eebf46f82d9cea758d19c8cb967a51337679cc
Python
3,787
131
import json import os import zipfile _this_dir = os.path.dirname(os.path.abspath(__file__)) _opencc_rootdir = os.path.abspath(os.path.join(_this_dir, '..', '..')) _testcases_path = os.path.join(_opencc_rootdir, 'test', 'testcases', 'testcases.json') _TEXT_ZIP_CONFIG = """{ "name": "Python Resource Zip Test", "seg...
8101fc97149685e1826cea4bd9c171fed287b70cbe146950128190378bbf91c8
Python
3,787
131
model = dict( type='FPSiam', lamda=0.5, backbone=dict( type='ResNet', depth=50, in_channels=3, out_indices=[1, 2, 3, 4], norm_cfg=dict(type='SyncBN'), zero_init_residual=True, init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')), ...
598246d1537d65b6cc59fa61936de6ace103ab812b3c9b0c788daa4f5f3e6ec7
Python
3,788
90
"""Plots for the event model object. Notes ----- This file contains plotting functions that take as input an event model object. """ from itertools import cycle from specparam.modutils.errors import NoModelError from specparam.modutils.dependencies import safe_import, check_dependency from specparam.utils.properties...
9ff4c3657f074bbcbdf8a01df6b7fd403c4310e74dd34ddfef69fbf915bae4bd
Python
3,788
116
# --- 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 Marker(_BaseTraceHierarchyType): _parent_path_str = "barpolar.unselected" ...
9ef776fc504fdefd0c44f2673919a9b002d1d9dc17855fc2d0bdca031dff654e
Python
3,789
112
import seaborn as sns from matplotlib import pyplot as plt from collections import OrderedDict from sklearn.metrics import roc_curve, auc, roc_auc_score, brier_score_loss, precision_recall_curve, f1_score, precision_score, recall_score from math import sqrt def plot_box_kde(df, dep, y): fig,axs = pl...
c0d28f2759817c270141f2162701d2ba4829c21106aeae3bb39500d255d84a9a
Python
3,789
126
import os import numpy as np from binary_motif_model import ( load_model as load_motif_model, ) from map_protein_name import ( get_map_protein, get_rbns_name_psam_idx_map, ) import splice_point_identifier from utils import prod import torch RBNS_MOTIFS_DIRECTORY = os.path.join( os.path.dirname(__...
ca36e010e37575c97b029e882ec79c02b602c3d3feb39c073e96167d72f107ef
Python
3,789
134
# --- 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 Title(_BaseTraceHierarchyType): _parent_path_str = "indicator" _path_str ...
9cdeb0715d03c3fac38933677f545b6991e0e4f3a86d4037bffc33f07da290c1
Python
3,790
82
""" Read PyTorch model from .pth.tar checkpoint. Code from: https://github.com/rgeirhos/texture-vs-shape/blob/master/models/load_pretrained_models.py Accessed 02.03.2020 ## Architecture modified by jfeather for metamer code compatability## """ import os import torch from torch.utils import model_zoo from .resnet imp...
eae6884effd20e080a64725aeda6310efae1c612a0af843a1a8c716fd52fa324
Python
3,790
86
from typing import Optional from uuid import UUID from carbonserver.api.errors import AuthenticationError from carbonserver.api.infra.repositories.repository_emissions import ( SqlAlchemyRepository as EmissionRepository, ) from carbonserver.api.infra.repositories.repository_experiments import ( SqlAlchemyRepos...
eb8115544ed824e94a1647107d007436ba173726925d6d5ca75256cb651d2865
Python
3,791
93
import numpy as np import pandas as pd import pickle import argparse import logging from time import sleep parser = argparse.ArgumentParser() parser.add_argument('-f', "--file", default='data/example_df.csv', type=str, help='csv file including 77 variables ...
0b1d652126a75f23001150ba20214c7b7bcee7b34ff3b9047090ac3ab4d3854b
Python
3,792
113
import numpy as np import torch from torch import nn from neurogym.wrappers.components.modules import LayerProbeBase class ActivationProbe: def __init__( self, module: nn.Module, steps: int | None = None, name: str | None = None, populations: set[str] | None = None, ):...
7141b320e8dadec766102f5711bb8d0c87932df00378a457a12f3904537f5c96
Python
3,792
146
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Miscellaneous file manipulation functions.""" import os.path as op import numpy as np from nipype import logging from nipype.utils.misc import is_container fmlogger = logging.getLogger('nipype.utils')...
081ee89837de1ee7e0f73d3913f509d6b9cc6279985ceb24a228074f1b9ad9a7
Python
3,793
121
import numpy as np from numpy.random import default_rng import pathlib from mpi4py import MPI from causal_optoconnectics.tools import conditional_probability, joint_probability, roll_pad from causal_optoconnectics.generator import ( construct_connectivity_filters, construct_connectivity_matrix, simulate, ...
187922065b773e32fe029fbf25f20c4a307764e6bef7c5d98e2c8ca38fe906f3
Python
3,793
153
import os import yaml import pickle import inspect import datetime import contextlib import joblib from rich.console import Console from rich.progress import ( BarColumn, MofNCompleteColumn, Progress, SpinnerColumn, TaskProgressColumn, TextColumn, TimeElapsedColumn, TimeRemainingColumn,...
2d529032a3c5abc8539831eb2479403a3203b6e6a207954236f9c576d02bc9d4
Python
3,793
128
from pathlib import Path from typing import Literal import pandas as pd from hobj.data.download import resolve_data_root # %% def load_human_behavior( experiment: Literal["highvar", "oneshot"] = "highvar", cachedir: Path | None = None, ) -> pd.DataFrame: """Load trial-level human behavior for one of the...
b46dfd5f401a96ac2c1a118ca494b6f94bfe6010587c6ff64cb113e9d33c46a0
Python
3,793
116
# --- 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 Marker(_BaseTraceHierarchyType): _parent_path_str = "histogram.unselected" ...
3b56e4b509516827980ca5f6365d3fea7cd0f669edd1bcd842b48402ac7fda1a
Python
3,794
44
from .base_options import BaseOptions class TrainOptions(BaseOptions): """This class includes training options. It also includes shared options defined in BaseOptions. """ def initialize(self, parser): parser = BaseOptions.initialize(self, parser) # visdom and HTML visualization para...
c2cdca6ceb036dcc32d96ff5d1ea10c3e9347334ae38be5ed3e2018dcdee0f56
Python
3,794
111
import datetime from typing import TYPE_CHECKING import numpy as np import requests from carbontracker import exceptions from carbontracker.emissions.intensity.fetcher import IntensityFetch, IntensityFetcher if TYPE_CHECKING: from carbontracker.loggerutil import Logger API_URL = "https://api.carbonintensity.org...
cb57244aa6bcb472ac04a3c0605d43c16a61627d397f0fef8ffe683e25d704de
Python
3,794
116
"""Portable I/O primitives for TorchLens model logs (declared re-export FACADE). The ``torchlens._io`` package implements TorchLens' portable save/load path: it scrubs a ``Trace`` into metadata plus tensor blobs, writes directory bundles backed by ``safetensors``, and rehydrates those bundles into eager or lazy model ...
e5706c411c7c2dd7926404ee2f8a9865023fe9059217e488ee2311be75b78a15
Python
3,794
83
import sys # setting path sys.path.append('../TM2_segmentation') import os import numpy as np import nibabel as nib import itk import pandas as pd import tarfile from scripts.preprocess_utils import find_file_in_path # load metadata file input_annotation_file = 'data/csv_files/calgary.csv' df = pd.read_csv(inp...
f0f284ae415db3c2920d91d1b5873704f85ce7c466dadfa3d525565b35fafb63
Python
3,795
105
"""Persistence honesty: save levels may not silently override explicit include flags. WT1 A-IV item 19 (lane A08): ``level="executable_with_callables"`` used to silently force ``include_saved_args=True`` / ``include_rng_states=True`` over an EXPLICIT ``False`` -- shipping raw input tensors against an explicit opt-out....
07a43fee186d858b621921bcbe2cd0a875b07c04607962c30d5cbd0bfd431cc5
Python
3,796
180
# Copied from # https://github.com/plotly/plotly.js/blob/master/src/components/colorscale/scales.js # NOTE: these differ slightly from plotly.colors.PLOTLY_SCALES from Plotly.js because # those ones don't have perfectly evenly spaced steps ... # not sure when this skew was introduced, possibly as early as Plotly.py v4...
73a75d02afde8bbbdd982c76309b5bdfb7e8c41d712895e33dda8129cda3e955
Python
3,796
132
import os.path as opath import json import _plotly_utils.basevalidators from codegen.utils import PlotlyNode, TraceNode def get_validator_params(node: PlotlyNode, store: dict): """ Get params for the validator instance for the supplied node and add them to the store. Parameters ---------- no...
78a860b506e3262c0e26b486d7f59d71ad9db258ee86ff1bb30dcd9dfc82e236
Python
3,796
101
""" Author: Bruno De Santi, PhD Affiliation: Multi-modality Medical Imaging Lab (M3I Lab), University of Twente, Enschede, The Netherlands Date: 20/09/2023 Description: Collection of visualizing techniques used in MUVINN-reg Paper/Project Title: Automated three-dimensional image registration for longitudinal photoaco...
aa570491e7a76a292a2d08b521148c006ee180e1bf1b85c74314ec2dd7c7d09e
Python
3,796
115
"""Multi-Sensory Integration.""" import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces # TODO: This is not finished yet. Need to compare with original paper # TODO: In this current implementation, the two stimuli always point to the # same direction, check original class MultiSens...
aaf458f852346c70971b8aadfa92e60a59d25c8a6b566575f15700644e8b3e22
Python
3,796
98
# Copyright 2017 The TensorFlow Authors 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/LICENSE-2.0 # # Unless required by applicab...
b23f3639b34d3dfa157147f0c903724ed2f63af570075334fb1f1b696ed99cda
Python
3,796
152
import pytest from pyrosm import get_data import sys def get_source_url(name): name = name.lower() from pyrosm.data import sources for source, available in sources.available.items(): if source == "cities": available = [src.lower() for src in available] if name in available: ...
40020ca452bf6b212126f211559de11f6dc55a529ab49ae4c2798af7078c9c83
Python
3,797
114
from array_api_compat import array_namespace as get_namespace, device as xpd import numpy as np import pytest from conftest import approx, assert_array_equal from pyriemann.geometry.ajd import ajd, ajd_pham, jade, rjd, uwedge @pytest.mark.parametrize("kind", ["sym", "spd"]) @pytest.mark.parametrize( "method, alg...
551286a7119d5f62c9e8ba5435d20607bccf6a8b236773f37ab76f446c467003
Python
3,797
100
import numpy as np from keras.src import backend from keras.src import ops from keras.src import testing from keras.src.optimizers.rmsprop import RMSprop class RMSpropTest(testing.TestCase): def test_config(self): optimizer = RMSprop( learning_rate=0.5, rho=0.8, moment...
569847797374344605aa86bdad0893852b114902f97d1507e350374048768379
Python
3,797
107
from argparse import ArgumentParser import torch from pytorch_lightning import LightningModule, Trainer from torch.nn import functional as F from torch.utils.data import DataLoader, random_split from pl_bolts.datasets import MNIST from pl_bolts.utils import _TORCHVISION_AVAILABLE from pl_bolts.utils.warnings import w...
cbcabfb46559524b6a6d68ac764f63eec315bbe78096155385d100cf9f852e4d
Python
3,798
120
import torch import tqdm from modular_splicing.utils.io import load_model from modular_splicing.motif_names import get_motif_names from modular_splicing.utils.io import save_model from .rbns_data import RBNSData, MotifModelBasedClassifer # TODO document how to get this data data_path = "../data/500k_binary_rbns_dat...
b912eb3b69797eb56e7a9604ed18ca67919351627c19905b53961ad6d0a56ee8
Python
3,800
115
from collections.abc import Callable, Mapping from types import MappingProxyType from typing import Any, Literal import numpy as np import scanpy from anndata import AnnData from numpy.random import RandomState _Method = Literal["umap", "gauss"] _MetricFn = Callable[[np.ndarray, np.ndarray], float] # from sklearn.met...
ec5295e221bf26559793ebee09548ca11b39e8a0bee8eed91506e5008dd9031e
Python
3,800
114
# Copyright (c) 2022 PaddlePaddle Authors. 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/LICENSE-2.0 # # Unless required by app...
8d2c7c4bd7e9e06f8fb6819a8ac36548d9e337c62e0b9e16f665913f56bb1f8e
Python
3,801
120
"""Tests for bdpy.recon.torch.modules.encoder.""" import unittest import torch import torch.nn as nn from bdpy.dl.torch.domain.image_domain import Zero2OneImageDomain from bdpy.recon.torch.modules import encoder as encoder_module class MLP(nn.Module): """A simple MLP.""" def __init__(self): super(...
bbaba842903e51272674e19eb002321ef9a95b9581dcca3fd8a1557b743c998b
Python
3,801
94
#!/usr/bin/env python """ convert fastqsolexa file to separated sequence and quality files. assume each sequence and quality score are contained in one line the order should be: 1st line: @title_of_seq 2nd line: nucleotides 3rd line: +title_of_qualityscore (might be skipped) 4th line: quality scores (in three forms: a...
02aee1c4717c9483f196165252af84a4a3cf8c5b712e1418f5dba5f8058101e9
Python
3,802
112
from __future__ import division import unittest import numpy as np from wyrm.processing import apply_spatial_filter from wyrm.processing import swapaxes from wyrm.types import Data SAMPLES = 1000 CHANS = 3 EPOS = 5 class TestApplySpatialFilter(unittest.TestCase): def setUp(self): data = np.random.ra...
083644e7c71a8eaa11d9c6802fdd0d2aea6affc6c2ae8eccebf7066a8d9a8bdf
Python
3,802
126
import logging from threading import local from typing import ( Optional, TYPE_CHECKING, ) from galaxy import model from galaxy.model import ( mapper_registry, setup_global_object_store_for_models, ) from galaxy.model.base import SharedModelMapping from galaxy.model.orm.engine_factory import build_engi...
c01bd9dfa5f0069de699b46c9ab373ea135bd1ac80ed7eae9a95a0b5df530664
Python
3,802
117
# --- 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 Line(_BaseTraceHierarchyType): _parent_path_str = "icicle.marker" _path_s...
507a6d59405c9a6b4418f7d70f9f83e6e6fedc6ee5408158351d4e43fd9b403a
Python
3,803
114
import os import pytest from mirp import extract_features_and_images from mirp._images.generic_image import GenericImage from mirp._images.mr_image import MRImage from mirp._masks.base_mask import BaseMask CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) @pytest.mark.ci def test_intensity_scaling(): dat...
91b8b594c0f9f2bdf6c0c62f40be0fbe6b0d4770b9d1069ac20f52f58545e119
Python
3,803
131
""" utils.py: Useful utility functions. """ __author__ = "Louis Kang" __date__ = "2023/03/07" __license__ = "GPLv3" __reference__ = "To be determined" import os, sys import time import itertools import numpy as np import torch import matplotlib.pyplot as plt # Detecting if code is run from a Jupyter noteboo...
910a91bb5d6d84062b48776ac593736cb2eeda82dd7988dc4eb5918669664f1e
Python
3,804
120
import os import shutil import time import unittest from pandas import read_csv from codecarbon import EmissionsTracker OUTPUT_DIR = "test_task_data" def heavy_computation(run_time_secs: float = 3): end_time: float = ( time.perf_counter() + run_time_secs ) # Run for `run_time_secs` seconds whi...
2386ff666b21cedcfdf576dee34337d9df0b8708333d3fa3e03f157f997738d0
Python
3,805
120
import copy import torch import torch.nn as nn from modular_splicing.utils.construct import construct from modular_splicing.models.motif_models.types import motif_model_types class AlternateDonorSeparatingMotifModel(nn.Module): motif_model_dict = True _input_is_dictionary = True def __init__( ...
6dc7eab127e5bce089540e8ac01927fd7733dce3b542aaab56b3b154a64246d8
Python
3,805
99
"""Public named-sibling receptive-field extension tests.""" from __future__ import annotations from collections.abc import Iterator import pytest import torch from support.rf_isolation import preserved_rf_registry from torch import nn import torchlens as tl from torchlens.receptive_field import ReceptiveFieldDirect...
c358140bfbebbd3f446ba1e2100c7907b29a7ed2199d1dd4e4fe3f46fe397570
Python
3,806
109
import logging from uuid import UUID import jwt from fastapi import HTTPException from carbonserver.api.infra.repositories.repository_organizations import ( SqlAlchemyRepository as OrganizationRepository, ) from carbonserver.api.infra.repositories.repository_projects import ( SqlAlchemyRepository as ProjectRe...
e2ff34d6d7346ace3a3e68f3bca28f2e82f8fc05f258473c21a21347206435cb
Python
3,806
120
""" eFEL setup """ """ Copyright (c) 2015, EPFL/Blue Brain Project This file is part of eFEL <https://github.com/BlueBrain/eFEL> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published by the Free Software Foundatio...
5ed6a5b726410dbaeea53dc518207f5dd08c2037c7b7647a6a1fa637e5193036
Python
3,807
114
# Copyright (c) 2022 PaddlePaddle Authors. 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/LICENSE-2.0 # # Unless required by app...
ad3b31e40c2b15e26618d7a185a70928b1d35f538175fb4005441ad97e56207c
Python
3,807
117
# --- 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 Line(_BaseTraceHierarchyType): _parent_path_str = "treemap.marker" _path_...
234e7bbef85fb6cb95d4aa0b04b2ee0063c2f601fbf92b4678f0028682be7d04
Python
3,808
131
"""Geodesics for SPD/HPD matrices.""" from .base import sqrtm, invsqrtm, powm, logm, expm def geodesic_euclid(A, B, alpha=0.5): r"""Euclidean geodesic between matrices. The matrix at position :math:`\alpha` on the Euclidean geodesic between two matrices :math:`\mathbf{A}` and :math:`\mathbf{B}` is: ...
ab4173105c62f58ebefd50440f6039352798c4862eaec3e94db3b576b70d5f95
Python
3,808
107
import os import random import torch from torch.utils.data.dataloader import DataLoader # from torchsummary import summary from hn_cnn.cnn import MODELS from hn_cnn.constants import * from hn_cnn.data_augmentation import get_training_augmentation, TRANSFORM_TO_TENSOR from hn_cnn.fit import predict from hn_cnn.parse_d...
1ef639c9f0d9220c7df74bd99f57d394d5196fc265e9524d553a6360baeec319
Python
3,810
91
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 # International License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://creativecommo...