sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cd3110681e0164201f3d6c303da6bc6985d7529093f6af71f3494f816f63eec0
Python
7,812
244
"""Fixtures for the CircleCI tests.""" import os import pytest def pytest_addoption(parser): """Collect pytest parameters for running tests.""" parser.addoption( '--working_dir', action='store', default=( '/app/.pixi/envs/xcp-d/lib/python3.12/site-packages/xcp_d/xcp_d/tes...
a0dbd9861ba1f044fb35af1e053ed8d73981528c161deef89f28cdab3e8a0d18
Python
7,815
285
#!/usr/bin/env python # Created on: August 2, 2013 __author__ = "Sven Kreiss, Kyle Cranmer" __version__ = "0.1" import optparse parser = optparse.OptionParser(version=__version__) parser.add_option("-c", "--interpcode", dest="interpcode", default=4, type="int", help="InterpCode to be investigated.") parser.add_op...
a6217d1bd65c5f6af137df1bc2d636b433089739fc404809f592a4ec63f0d69d
Python
7,815
187
#!/usr/bin/env python3 """ File: compare_correlating_genes.py Created: 2022/04/28 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 tr...
0be0abb7a972757ede345483e9c5711e57efced503c97b0cddd2d701c22f0a90
Python
7,816
243
# --- 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 Symbol(_BaseLayoutHierarchyType): _parent_path_str = "layout.map.layer" ...
8f3f2b7be1e3af7e9d2bd46b5128af05502a9203e2b05ea9eb824879f32770d3
Python
7,817
187
import os import pyaudio import wave import logging from pyoperant.interfaces import base_ from pyoperant import InterfaceError class PyAudioInterface(base_.BaseInterface): """Class which holds information about an audio device assign a simple callback function that will execute on each frame presentation...
bda3d6b9cad91328c62de1fc284bd76a550a5b2140ca1664ee8ef6fb00e932d7
Python
7,818
242
"""Parameters for model and training Details were shown in the tail of this file. Additionally, refer to the source code of MMVAE in the original paper. """ from src.utils import DotDict epochs = 50 experiment_name = 'final-results' id_vae_cmnist = 'vae_cmnist' id_vae_oscn = 'vae_oscn' id_mmvae_cmnist_oscn = 'mmvae_...
d21aac4600782b80db49115102e4c246e90d764003bfa61c9a10e368b19d130a
Python
7,821
200
import os import sys from pathlib import Path from platform import python_version import gc import inspect from copy import deepcopy import dill # Custom modules tr = '' # absolute path to upper working dir import src from src.models.fastbinary import * from src.visualization.visualize import multi_lab...
cc7a4cc97f0b3dc8e355c4520ff4026d1819094bebcc97514c81f16a3171afb6
Python
7,827
146
""" Hopf Bifurcation and Limit Cycle Continuation ============================================= Here, we will demonstrate how to perform branch switching at an `Andronov-Hopf bifurcation <http://www.scholarpedia.org/article/Andronov-Hopf_bifurcation>`_ and continue a branch of periodic solutions. As an example model,...
2b091b7879587a379263e233d724d3e153c76e23d08507c70c2f2fb620feb11f
Python
7,829
209
# pylint: disable=arguments-differ """VGG atrous network for object detection.""" from __future__ import division import os import mxnet as mx from mxnet import gluon from mxnet.gluon import nn from mxnet.initializer import Xavier __all__ = ['VGGAtrousExtractor', 'get_vgg_atrous_extractor', 'vgg16_atrous_300', ...
a57415f1b0e1038583c9a0f04a9c405322e86e5bd1dd76354409f1fb466e062b
Python
7,829
256
#!/usr/bin/env python # /files/some/path/stats/json from __future__ import print_function import requests import json import datetime import pandas as pd import numpy as np import cartopy.crs as ccrs import cartopy.feature as cf import cartopy.io.shapereader as shpreader import matplotlib.pyplot as plt import ...
ac582e6258a53d20b43ad2aa533de3ce53df0a405cd4ccba8b784b65b3b8dbad
Python
7,829
202
#!/usr/bin/python3 """ https://vict0rs.ch/2018/05/24/sample-multilabel-dataset/ """ def index_split(group_size, ratio): # return index list in the group/class, test samples is selected with equal distance # test if ratio is 0.25, 0.2, then this works, train = [] test = [] gap = int(1.0 / (1-ratio...
e25387805fba6e24c15604dedbe15df532fc011bc4eb3d9a36a084b9b40f3024
Python
7,829
242
# adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/catalog.py # pylint: disable=no-else-raise import copy import logging import types from typing import List __all__ = ["DatasetCatalog", "MetadataCatalog", "Metadata"] class DatasetCatalog(object): """ A catalog that sto...
fd43041081fae0491970133870d0d92a023319f988de8f66bba843eb08cf479f
Python
7,829
261
#!/usr/bin/env python import sys import numpy # from rpy import * import rpy2.robjects as robjects from rpy2.robjects.packages import importr r = robjects.r grdevices = importr("grDevices") def stop_err(msg): sys.stderr.write(msg) sys.exit() infile = sys.argv[1] x_cols = sys.argv[2].split(",") y_cols = s...
73c8cf8d6aef784407a84c09c12998a4d5b07cb117e87aa9fbd51011db450907
Python
7,832
232
"""Celery Command Line Interface.""" import os import pathlib import sys import traceback from importlib.metadata import entry_points import click import click.exceptions from click_didyoumean import DYMGroup from click_plugins import with_plugins from celery import VERSION_BANNER from celery.app.utils import find_ap...
7e7b7fd27a7c60b316f036273cd94e7ad157924c312c1b02125ff4c0b396a6e1
Python
7,835
249
""" ca_spikes.py Class for calcium imaging spike loading and analysis using calcium traces from caiman. Code by Daniel Reumann, edited by Michael Zabolocki. """ import os import pandas as pd import numpy as np import pickle as pkl from scipy import signal from ..utils import (save_df) from ..plots import (plot_cat...
cc92cf9413abc26ee600d0bb544808ad612d101d6795d97fc17d1f43c7cf0488
Python
7,836
171
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # 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...
4a9575ab42ff76bcb241e3290862b15a4a9e1a55be76d116821825c3ded4a27e
Python
7,839
227
"""Global attention modules (Luong / Bahdanau)""" import torch import torch.nn as nn import torch.nn.functional as F from bioseq2seq.modules.sparse_activations import sparsemax from bioseq2seq.utils.misc import aeq, sequence_mask # This class is mainly used by decoder.py for RNNs but also # by the CNN / transformer d...
c8c69ba729a6a93947d3b90ab8e2308dd949126d900159d9f61091a8b20e0012
Python
7,839
203
"""Use StarDist for cell identification and labeling. https://github.com/stardist/stardist [Schmidt18]_ and [Weigert20]_ """ import math from typing import Optional, Union import cv2 import numpy as np from anndata import AnnData from csbdeep.data import Normalizer, PercentileNormalizer from skimage import measure t...
103ae10e161991f27889625d40b7f83ab46a5d01b0af86abbb84fc0b8eb6f672
Python
7,840
167
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """ .. _exa-cluster-based-mu: Cluster-based permutation t-test ================================ .. currentmodule:: eelbrain This example show a cluster-based permutation test for a simple design (two conditions). The example uses simulated data meant to vaguel...
a8839c20f19f3f2aa0f1e37c750ed1048e30c600c6f81c251f3415bf0388d551
Python
7,846
233
from typing import Any from mirp._data_import.dicom_file import ImageDicomFile from mirp._data_import.utilities import get_pydicom_meta_tag class ImageDicomFileMR(ImageDicomFile): def __init__(self, **kwargs): super().__init__(**kwargs) def is_stackable(self, stack_images: str): return True ...
5585328237731554ab8b5f646e029899758ea6fafc608e259e344f8b61f0fb77
Python
7,848
190
# model from ast import Global import torch import torch.nn as nn import torch.nn.functional as F import torch_geometric as tg import torch_scatter import e3nn from e3nn import o3 from typing import Dict, Union # crystal structure data from ase import Atom, Atoms from ase.neighborlist import neighbor_list from ase.vis...
f65ae5f1a896f261635873af3f96afeba1c7c967bfac23a9bb19f8ea130bcc2d
Python
7,849
218
"""Regression tests for r20i: IR live-record lane cleanup + state hygiene. Covers hardening findings on ``torchlens/ir``: * N8 -- ``LiveIndex.append`` left a stale parent edge (and double-listed the label) when a raw label was re-seen at the append boundary. * N9 -- ``CaptureEvents.release_runtime_sidecars`` reta...
0245ee115b3cd062db976048f1a0b69379470f6bd45d0c1555584fc92d7054ef
Python
7,851
202
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This script merges one sample across lanes. # # This script will *only* be useful if you have the same multiplexed sample loaded into multiple lanes of a flowcell. # # This concatenates the same index's pared-end files (L*_R*_* .fastq.gz) across multiple # lanes into on...
185e44157e113e2304c55de56a620756426393214601e1cc5b1a51c9561e0b26
Python
7,852
238
# -*- coding: utf-8 -*- """ Reproduce the results of the``spytorch`` tutorial 2 & 3: - https://github.com/surrogate-gradient-learning/spytorch/blob/master/notebooks/SpyTorchTutorial2.ipynb - https://github.com/surrogate-gradient-learning/spytorch/blob/master/notebooks/SpyTorchTutorial3.ipynb """ import brainpy_data...
22163b480fec7060e12fb71f239a77b6bc85fb61053abfaae1442271dad3e2cc
Python
7,854
246
"""api module. Functions to access the STRING API""" import pandas as pd import io import requests def build_request_url(method, output_format='tsv'): """Create url to query the string database Allows us to create stubs for querying the string api with various methods Parameters ---------- metho...
23cc8127525ee717b1f0414cf95ae57a4b4b012232f49433779b68d29ce84762
Python
7,854
231
#!/usr/bin/env python3 """ File: no_ieqtls_per_sample_plot.py Created: 2021/10/22 Last Changed: 2021/10/25 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 thi...
2930183232144683125550bb21b01ef232523b1c568f2d84dfba15e806fede91
Python
7,854
137
# -*- coding: utf-8 -*- import os import yaml import argparse import numpy as np from utils import check_folder, read_yaml, save_yaml, write, get_subject_name, get_output_name, aggregate_cv, create_maps, fetch_masker, fetch_data, get_nscans from utils import get_splitter_information, get_compression_information, get_d...
0b00d2ba47c59baba129a085a945966e50c82d2602fa0306111b727ba60d0365
Python
7,856
238
"""Save-dtype routing: explicit, routed, disclosed (extract D11 + item 9). ``dtype=`` is global or per-key; ``None`` preserves the captured dtype. The cast runs AFTER pool and postprocess transforms, BEFORE the CPU-contiguous snapshot. Captured, requested, stored, and conversion facts are manifested. bf16 and both fp...
10575bd44b00abb98763e478560668e2267ffa7006bead84a6a3b815fa1d42ad
Python
7,856
197
"""Removed public methods and attributes raise a typed redirect naming the replacement. The 2026-10-01 shim removal deleted the alias members outright (remove-and- rename, no alias), and lane F12 deleted ``VisualizationTheme.legend_items``. A lookup of any of them must raise ``FacadeTeachingError`` (code ``facade_redi...
c09724eac406488acc6b78445d8cd777630e198d5b1f5c9b9682213790823a9d
Python
7,856
228
import sys import cv2 import numpy as np import json from functools import partial import pandas as pd import matplotlib.pyplot as plt # Script used to annotate the position of GFP+ cells (teto-Olfr17 expressing cells) relative to a curve drawn on the most basal side of the MOE # the curve passes through each of the 5...
919de0d82f8bbcbfb58415d23ef47a78bf4de7ad1560208e2fdebf23860eb594
Python
7,857
195
"""Peak-pair instrumentation oracles (F20, brainpipe memo D-7 + build 3). The measured peak is a PAIR (live allocation, resident high-water) with the backend named -- CUDA and CPU instrumentation measure different physical quantities. The sweep-scale instrument defect (the shipped peak property reads 0 for every captu...
43265fc68ec1c386b9262adb349bb7e8561a63cc4ee055aee4cc703d02130345
Python
7,859
258
""" This module holds some process function of pynapple that can be called with numba or pynajax as backend If pynajax is installed and `nap.nap_config.backend` is set to `jax`, the module will call the functions within pynajax. Otherwise the module will call the functions within `_jitted_functions.py`. """ import n...
c129cf328036de38e8cfe0fa1aacc815a48bf81e1e4e98527b89552f1312b20a
Python
7,859
224
"""Tests for bdpy.recon.torch.task.inversion""" from __future__ import annotations import unittest from unittest.mock import patch, call import copy import torch import torch.nn as nn import torch.optim as optim from bdpy.recon.torch.task import inversion as inversion_module from bdpy.task import callback as callbac...
5a88472a68c18c84959a281d0a42219dda897b592596eb2d640fc2336a347914
Python
7,860
224
import numpy as np import pytest from tigramite.graphs import Graphs def make_empty_tsg_graph(N=3, tau_max=1): """Create an empty time-series DMG of shape (N, N, tau_max+1, tau_max+1).""" g = np.zeros((N, N, tau_max + 1, tau_max + 1), dtype="<U3") g[:] = "" return g def test_no_path(): """If ther...
cfef25b0d690b08749fe9b7298b325e000d4df16c0a09a431a1dbcfba05602bd
Python
7,860
190
"""Implementation of Atari 2600 Preprocessing following the guidelines of Machado et al., 2018.""" import numpy as np import gym from gym.spaces import Box try: import cv2 except ImportError: cv2 = None class AtariPreprocessing(gym.Wrapper): """Atari 2600 preprocessing wrapper. This class follows t...
f26985a9dbcb6351b4a8ce07015be841b9342ce885f85bee12f1e1f53f2c52ee
Python
7,861
254
""" Base classes for all simulation agents. Defines the minimal agent interface, its placement in space and its registration with the simulation model. """ from __future__ import annotations from typing import Any from ...param import ( ClassAttr, MobilePoint, MobileVector, OrientedPoint, Radiall...
55d18c4e9f0dd414d6f15a2a887b1f7adea389fad21b303b9ccdd11cc09c67c6
Python
7,863
211
"""The edit x product matrix (compo memo stratum 1; F36 wave A). ``do()`` against every product/lifecycle state: the push engine serves live intervention-ready forks and refuses everything else -- each refusal cell pins its stable code (or its LEDGERED codeless state: the intervention-error fields-clobber class locks ...
66905cfe09683706c8dd74905a88c88bad8c925fb88a4354cf4217c06fe03bee
Python
7,864
134
import os import re import numpy as np import matplotlib.pyplot as plt import matplotlib.cbook as cbook import sys sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells') from analysis.utils_analysis import time_decode_lin_reg, sort_resp, plot_sorted_averaged_resp from analysis.utils_int_discrim import single_cell_...
78b8dfc7695f1af434ffb9f8554926784c79953fb0c857764de7e5582be5b706
Python
7,864
201
"""GPU accelerated tree explanations""" import numpy as np import shap from packaging.version import parse as _parse_version from shap.explainers._tree import ( TreeExplainer, _xgboost_cat_unsupported, feature_perturbation_codes, output_transform_codes, ) from shap.utils import assert_import, record_im...
d6393521a22f68af2718849c6d8f58204863c0867a82df59aa2870a7cfa3693d
Python
7,864
167
import pylustrator pylustrator.start() import os import matplotlib.pyplot as plt import numpy as np import pandas as pd datasets = ["mnist", "fashion_mnist", "letter_mnist", "mnist_with_brightness_offset", "fashion_mnist_with_brightness_offset", "cifar10"] plt_idx = 1 color_pairs = [('purple', 'brown'), ('olive', '...
17bc8088427068aa069e4f30ba9119111ab3ad4ad3e2d7c3ef3f862e622552b4
Python
7,866
269
import copy from permacache import permacache, stable_hash, drop_if_equal import numpy as np import tqdm.auto as tqdm from modular_splicing.dataset.datafile_object import SpliceAIDatafile from modular_splicing.dataset.dataset_aligner import DatasetAligner from modular_splicing.example_figure.run_models import comput...
e82da666ee5ce4a5f81dcbd76ce049402747497309c0f7b0ce33ccd1b3940f30
Python
7,869
196
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license import asyncio import json import threading from functools import partial from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer import cv2 import numpy as np import pytest from ultralytics.data.converter import convert_ndjson_to_yolo...
22d3c9081ca23bcb9f8e0cb20cc2fb71c617d339161c68f52e032f75b6717cb9
Python
7,873
261
"""Tests for single-module focus visualization.""" from __future__ import annotations from pathlib import Path from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens.data_classes.layer import Layer def _render_dot(log: tl.Trace, tmp_path: Path, **kwargs: Any) ...
840f9daa2e066137c47bfbbddcebc52d747ac959aaed8590f6f1a74ca634f257
Python
7,875
183
""" 3D reaction-diffusion simulations with NEURON 8.2.6: cylinder Last updated 18.9.2026 Author: Saana Seppälä   ### Description   This script performs reaction-diffusion simulations of calcium and calmodulin (CaM) in an idealized cylindrical geometry using the NEURON RxD framework. The model combines molecular diffusi...
6fb682e0b9c23fafce0de55494e72de2c20ef74f8fdaf76d6318d0b0f7b2ea43
Python
7,879
260
""""Utility functions for working with data and data objects.""" import numpy as np ################################################################################################### ################################################################################################### def _get_field_ind(modes, compone...
80d493d4ffdaeb5c3d9f801fbf2eb166648a23d84ceefea0255ff78f0f001ab8
Python
7,882
212
from keras.src import backend from keras.src.api_export import keras_export from keras.src.optimizers import optimizer @keras_export(["keras.optimizers.ScheduleFreeAdamW"]) class ScheduleFreeAdamW(optimizer.Optimizer): """Optimizer that implements the Schedule-Free AdamW algorithm. Schedule-Free learning is ...
6c6a3a8d9c42e12fd451d3b1be23637ac6c77fe8080c25d90ade09bf6587a1cc
Python
7,883
276
import numpy as np import torch from scipy.stats import rv_discrete, bernoulli from typing import Union # helper functions ################## def retrieve_from_dict(keys: list, data: dict) -> dict: """Remove dictionary entries and collect them in a new dictionary. Parameters ---------- keys ...
549601256f9f8d623725fa815be166ed5a5e69a1c695c9b33e7b0b7b14469482
Python
7,884
207
""" This script takes LD matrices and simulates summary statistics for multiple populations. Requires 2 populations, can take up to 4. """ import argparse from contextlib import ExitStack import numpy as np import scipy.stats as stats import os class Main(): def __init__(self): self.ld = [] self.ld_matrices...
703c1c398d39eefa7bfe45b8ee7237eb79a8ff8e5b68401b57c79e3e7be622d0
Python
7,886
207
import numpy as np import networkx as nx import pandas as pd import matplotlib.pyplot as plt import matplotlib.colors as colors import numpy as np from scipy.stats import pearsonr from irf import irf_utils from irf.ensemble import RandomForestRegressorWithWeights import matplotlib.cm as cmx from sklearn.linear_model im...
41872b8a2edcd6b1965dfc73cfca6e40cb912fea5a60d8edde24f34e9a26e8e2
Python
7,887
243
import re import pandas as pd import io import camelot import pdfminer from pdfminer.high_level import extract_text, extract_pages from pdfminer.layout import LTFigure, LTImage from utils.table_extractor import TexTract class Karnataka(object): def __init__(self, report_fpath): self.report_fpath = repor...
5445f294b69791969bd52e923aa1a6db336e82b42889e26a4fd65d9b44f1687b
Python
7,888
204
#!/usr/bin/env python """ Do windowed detection by classifying a number of images/crops at once, optionally using the selective search window proposal method. This implementation follows ideas in Ross Girshick, Jeff Donahue, Trevor Darrell, Jitendra Malik. Rich feature hierarchies for accurate object detection...
85821249e07c8bf75b6a27f6c97177c5ae6a1f4b6519f66208ba5496b1501830
Python
7,888
288
import pandas as pd import polars as pl import pytest from seqpro._coords import ( _SCHEMAS, CoordSchema, _resolve_schema, detect_schema, set_schema, ) def test_coordschema_fields(): s = CoordSchema("chrom", "chromStart", "chromEnd", zero_based=True, strand="strand") assert s.chrom == "chr...
247c35af50ccfab01a8e5e2a9a5aebbef021ecd7f91c390378d5191134691838
Python
7,892
153
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.transmembrane as transmembrane import plus.data.dataset as dataset import plus.model.plus_rnn as plus_...
c820289a0c77d479d69f32299f64f29d46f1c256e7b85204d14d6e7fdb924fa7
Python
7,892
189
"""Shared inputs, oracle, tolerances, and backend selection checks for the SM100 SwapAB decode tests.""" import math from typing import NamedTuple import pytest import torch from flash_attn.cute import interface from flash_attn.cute.config import FwdConfig from flash_attn.cute.testing import attention_ref, check_ten...
bd7434b6221a65cc43b2e8dfed3d7bf181ba62a58770f6ffe4f3a8fb8aaa9fc8
Python
7,895
265
import ast import re import struct from decimal import Decimal from pprint import pprint import pytest from celery.utils.saferepr import saferepr D_NUMBERS = { b'integer': 1, b'float': 1.3, b'decimal': Decimal('1.3'), b'long': 4, b'complex': complex(13.3), } D_INT_KEYS = {v: k for k, v in D_NUMBE...
0b94c4907edf2b555ba84e9557e1d1d078ed65e4825b978fe1e97f8a83c21902
Python
7,896
188
from brian2 import defaultclock, NeuronGroup, Synapses, mV, TimedArray, StateMonitor, PopulationRateMonitor, \ SpikeMonitor, second, Network, nS, volt, siemens, ms, Hz import numpy as np import pickle import os def run_net(tr, run_path): print('Running the network...') netw_objects = [] # todo chang...
1bc77233da5d6cfa1b24c42a8ad36f6ab1bd8e341605f5770d1d57d3c36d1ccc
Python
7,896
207
""" This script takes LD matrices and simulates summary statistics for multiple populations. Requires 2 populations, can take up to 4. """ import argparse from contextlib import ExitStack import numpy as np import scipy.stats as stats import os class Main(): def __init__(self): self.ld = [] self.ld_matrices...
10d8780c1cdaf3b00a95d01f123b26a1ae80004e9fb74ffaf7ca50d4d2fef9a8
Python
7,898
181
# Torch imports import pytorch_lightning as pl from pytorch_lightning import seed_everything from pytorch_lightning import loggers as pl_loggers import torchvision.transforms as transforms from pl_bolts.datamodules import CIFAR10DataModule, STL10DataModule, ImagenetDataModule from pl_bolts.callbacks.printing import Pr...
120f95930ab36ffca70da1938a1372314448e2f225dfa0268bd38c72946a6fdf
Python
7,899
159
######################################################### # Test suite for testing the utility functions for # # convolutional oligo kernel networks. # # # # Author: Jonas Ditz # # Contact: ditz@informatik.uni...
8a29d2aa74c20118f4ad937682b23c518a3b09af53e75d931460fd34e5e2dfc3
Python
7,899
235
#!/usr/bin/python # # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
d095fe91887d1cf2728286031110655e048150bd4c1c41d17c0f401bd2008651
Python
7,899
269
""" Rendering of simulation preview frames. Runs a short simulation and captures its frames, so a configuration can be previewed before the full run is launched. """ from __future__ import annotations from math import isfinite, nan from typing import Any from larvaworld.portal.canvas_widgets.environment_models impo...
6422ffa99c32c1d9f86960ffb5f8c2e948821935167e62735f0273e036a0da2a
Python
7,900
151
""" Builds lookup tables using ldpop to use in other pyrho commands. This is a thin wrapper for ldpop that computes a two-locus likelihood lookup table and stores the resulting table in hdf format. Run on the command line with pyrho make_table -h or --help to see a list of options and their description. """ from __fu...
4bcb62e9b835a403578c057216eccceca25d4cfb63b57bbc5cd231d13bdf5bc4
Python
7,902
196
try: from pyscf import gto from pyscf.dft.numint import eval_ao except ImportError: raise ImportError("You need to install pyscf to use this module") import numpy as np import numpy.typing as npt import pandas as pd from ase.data import chemical_symbols class OrthoCoeffMatrixToGridQuantities: def _...
505552f6859ed7b54c0bf989fd0b27c836fc88cbd02b6ce8c919fad6dd418c42
Python
7,902
163
""" The script edit from finc_multi_small_exon.R in the original codes Find the possible missed small exons, with the threshold: small_exon_size <= 100 and abs(delta_ratio) <= 0.5. Each realign region will be output as a dict object with the following essential key values: read_i(query_i), read_ith_intron(query_it...
667e529b8365b2262ffe365d7ac259dea2026db0f8d57530849e7000f8035f70
Python
7,904
212
# Copyright 2021 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
b130ddc5b6de1dbc2fa23397e98605e6e3b472e2d4852c85a980a35912286398
Python
7,907
218
import uuid from sqlalchemy import Boolean, Column, DateTime, Float, ForeignKey, Integer, String from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import relationship from carbonserver.database.database import Base class Emission(Base): __tablename__ = "emissions" id = Column(UUID(as_uuid=...
c1ed8eee0394dcf496fb93bc68e295095cfcb758e83e4c3a464e3d7220b187d4
Python
7,908
206
# This is try to code spatial suppression motion task import numpy as np from scipy.interpolate import interp1d from neurogym.core import TrialEnv from neurogym.utils import spaces class SpatialSuppressMotion(TrialEnv): """Spatial suppression motion task. This task is useful to study center-surround inter...
dd3c66a734f018c68af297702112d66e90554a9b3f85acd8c3c8910123ee6f7c
Python
7,908
245
""" Demonstrate how to calculate Cm from a ramp protocol. INPUT: model_vc_ramp.abf is from Patch-1U Model Cell (33 pF +/- 10%) OUTPUT: model_vc_ramp as a capacitance of 30.88 +/- 0.20 pF 171116sh_0014 as a capacitance of 202.32 +/- 11.49 pF 2018_08_23_0009 as a capacitance of 170.90 +/- 13.54 pF """ ...
a446616503e829052ea567c0cfab98cf99dd8e077e8c45fad9a00883a3e39f2f
Python
7,909
245
import os os.environ['DTORROOT'] = '/DATA/forLishan/randomddd' #os.environ["CUDA_VISIBLE_DEVICES"] = "0" from dtor.utilities.utils_stats import stats_from_results,roc_and_auc from sklearn.metrics import roc_curve, auc import numpy as np import argparse import torch from dtor.utilities.utils import set_plt_config from d...
d6826f40dfb79bfebb806380bd32b3160fc0f623ebc96bb54568f53d8fcd6bd5
Python
7,909
180
import itertools import json import os import numpy as np import pandas as pd import seaborn as sns import statsmodels.stats.api as sms from matplotlib import pyplot as plt from angorapy.common.const import PATH_TO_EXPERIMENTS, QUALITATIVE_COLOR_PALETTE # experiment_ids = [['1674343261520188', '1674308148646663', '1...
24a903b6b39a431ef98695fe73d5310e06c4cc2ad8a6318ff4c4d9599d49476e
Python
7,912
190
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
38ce95da705713a0c7049d74855c14aac7608b1600f720cadf8f0a537f5c595c
Python
7,912
209
"""F29: registry, envelope, canonical serializer, budgets, continuation. The one-core/three-transports law (agent memo 3.1) plus the budget and truncation discipline (3.8) and the envelope/determinism contract (3.9). """ from __future__ import annotations import json import math from pathlib import Path import pyte...
4f3f67da657aeeeaf2026fb77c60dfc4721aece9a35a9f33877f2b352be30026
Python
7,912
207
#!/usr/bin/env python # pylint: disable=protected-access, unused-variable, locally-disabled, len-as-condition """Lint helper to generate lint summary of source. Copyright by Contributors """ from __future__ import print_function import argparse import codecs import sys import re import os import cpplint from cpplint i...
fbca191a0309d4d6c438000e0663181242a0e4988f8c84b3f557ec31e8b608ff
Python
7,912
212
from typing import List import numpy import numpy as np import tensorflow as tf class Sensation(dict): """Wrapper for state representations. Designed for sensory readings, but non-sensory data can be encapsulated too. The convention is to refer to any non-sensory data as proprioception, following the intuiti...
daa81331ddb5a869540853033b6b9fe4cc9a310fc99cb72e7c7a989cb7e5896f
Python
7,913
202
""" Do-it """ import pandas as pd import sys sys.path.append("..") from config import fname, subjects, events_id DOIT_CONFIG = dict(verbosity=2, sort='definition') #subjects = get_var("subjects") #subjects = [int(s) for s in subjects.split()] coil_order = pd.read_csv(fname.coil_order) def task_order(): """S...
dbae414786ac7593605dfbebf78cc1676b86cef2598f5e3d00fb104308866fd6
Python
7,913
195
"""Typed refusal for unhashable fact path/position COMPONENTS (r77 L1). Round-76 (hon1 + free-roam, cross-lab) found the r75 L1 lane one nesting level shy: ``_fact_path_tuple`` validated only the CONTAINER type, so a foreign artifact whose ``path``/``position`` was a well-formed sequence carrying a nested list / mappi...
292b3e50d1a4c18cdcb51038e6dde8a471672cb16ae9e25399847ad302eb23e0
Python
7,914
271
import argparse import csv import logging import os from glob import glob from os.path import splitext from os import listdir import cv2 from PIL import Image from torchvision import transforms from scipy import ndimage from lib.datasets.bonemask_dataset import BoneMaskDataset from lib.models.EffUNet import EffUNet f...
756cbcf37759973edac27056ec3e53a2963d74331536f4e79ced8b625213f851
Python
7,914
196
"""Anti-recurrence tests for cert10 buffer-surfacing blockers. Two independent bugs, same theme (registered buffers not surfaced correctly): 1. ``BlobRef`` leak on load (torchlens/_io/rehydrate.py): after any default eager ``tl.load()`` of a bundle with registered buffers, ``Buffer. initial_value`` returned a r...
066c0fbdb6ab2bc3bec20397b0e4ae43ad480f3554eec79f78b4373e34577364
Python
7,916
194
import warnings from matplotlib.figure import Figure import matplotlib.gridspec as gridspec from matplotlib.backends.backend_qt5agg import ( FigureCanvasQTAgg as FigureCanvas) import numpy as np from .. import units from ..head import custom_widgets class MPLIndentation(object): def __init__(self): ...
00be2bbd6e3e6312ce06216452a397150184cc3b8977ba8b8890365e89e64936
Python
7,918
159
import sys import os # setting path sys.path.append('../TM2_segmentation') from scipy.ndimage.filters import gaussian_filter from densenet_regression import DenseNet from skimage.transform import resize,rescale import SimpleITK as sitk import numpy as np import pandas as pd import tensorflow as tf import glob, os, ...
ec9506d8b543548fb09f761a281beef292e8dd9539f2a6e763a4236684c15c1a
Python
7,918
156
import torch from torch.nn import functional as func from .base_model import BaseModel from . import networks class FALModel(BaseModel): """ This class implements the pix2pix model, for learning a mapping from input images to output images given paired data. The model training requires '--dataset_mode aligne...
1ad87798ba5ad1fbd00e3d9b41afb176839771a43b8ad5f7b4ec319369cb38ae
Python
7,919
224
"""THE named calibration script for the transforms fidelity baselines (memo B10). Regenerates ``tests/transforms_corpus/baselines.json`` from the vendored fixture corpus under the SHIPPED SRP algorithm (never a prototype): O14 admissibility on the real resnet50 layer4 basis, per-cell L2-distortion percentiles + RDM fi...
90cb5826cf1152035a4462c8f52ffe3799d775da5fc5abaf2d793fa78e247d3a
Python
7,919
183
"""W051-TRACK / AUD-CODE 2.14b: AMP ``unscaled`` truth is OBSERVED, never asserted. ``unscaled="yes"`` used to be stamped whenever ``scaler.get_scale()`` merely worked at the boundary. A plain ``optimizer.step()`` after ``scaler.scale(loss).backward()`` never unscales, so the emitted gradient statistics carried the x1...
b3aecb6c1cb06ea557353035323188d4ee9d6022abe74325c2bf38ff0cc0bffd
Python
7,919
312
"""Compact Kolmogorov-Arnold Network classics. This module implements dependency-free KAN targets using learnable univariate edge functions represented by triangular spline bases. Variants include pykan aliases, MultKAN multiplication nodes, convolutional KAN, and KAN-Mixer. """ from __future__ import annotations i...
7607ab1e3d56490b2120a5200bfd6a3f82145fb99c7a14e8eeb8a8f19bce90ce
Python
7,920
210
""" Shared model and mapping code between Galaxy and Tool Shed, trying to generalize to generic database connections. """ import logging import os import threading from contextvars import ContextVar from inspect import ( getmembers, isclass, ) from types import ModuleType from typing import ( TYPE_CHECKING...
0d2306498036b2ad9cdb7b989595e042489798b81fc3a25cccf66200c83781c4
Python
7,921
228
# %% import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import pingouin as pg import sys sys.path.insert(0, '..') # import my own code from functions.data_helpers import get_phenotype, get_computer, get_mean_fd # parameters _, proj_dir = get_computer() subj_list = list(np.lo...
1f7c121d2250f38e01bef6573ff30a39af09e0df06683993750c349d657f4ea5
Python
7,922
212
# 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...
24cec86a11e2f9deb1cd23bab08d498124389953294c43f4378e4be42b428032
Python
7,922
246
import os import time import argparse import random from datetime import datetime from tqdm import tqdm import numpy as np import paddle paddle.disable_static() import paddle.optimizer as optim import paddle.nn.functional as F from paddle.nn import BCEWithLogitsLoss from dataset import GoTermDataset, GoTermDataLoade...
6225548acf7a78928f91590858bd3346417dc5296be387f3ccee67b275baf8ce
Python
7,923
221
from unittest import TestCase, mock import datetime from carbontracker.emissions.intensity.fetchers import carbonintensitygb from carbontracker import exceptions class TestCarbonIntensityGB(TestCase): def setUp(self): self.logger = mock.MagicMock() self.fetcher = carbonintensitygb.CarbonIntensityG...
3b1074248bc106074d46d3d41c230f6772c329edebb910f1dbd0a097755851b5
Python
7,924
175
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
5b569075867435159548b8fb042d7f70eec06e4beafaea1cefa0d20149c190e2
Python
7,925
236
import nfp from nfp.frameworks import tf assert tf, "Tensorflow 2.x required for GraphLayers" tf_layers = tf.keras.layers register_keras_serializable = tf.keras.utils.register_keras_serializable @register_keras_serializable(package="nfp") class GraphLayer(tf_layers.Layer): """Base class for all GNN layers""" ...
8fdc8a7b059072c2309d300c6abeff421ed6923255bfab5d558015f53c07fed5
Python
7,925
262
import pytest import pandas as pd import numpy as np import os from jinja2 import Template import json import itertools import nway.utils as utils import nway.pairwise_matching as pairwise TEST_FILE_DIR = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'test_files') @pytest.fixture(scope='f...
57f6905937de6c6611bc16f74977585ccb9cee519d3c4d8e97cd16c200cb5f51
Python
7,926
244
# -*- coding: utf-8 -*- # # controller_validation documentation build configuration file, created by # sphinx-quickstart. # # 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. # # All configuration...
35d57a21189c0a76e92fac3f7a9629c7ae3149145ecf29f14505e1659c3d4903
Python
7,928
198
#!/usr/bin/env python3 """ Dx BR — 10,000-permutation null distribution on the in-pool §3.1 / §4.5 LDA-target perm test (AUC, LOO BA, LOCO BA). Closes the v0.73 review carry-over (Gemini's catch): the paper currently reports *p ≤ 0.002* reflecting the *n*=500 perm floor (1/501). Bumping to *n*=10,000 tightens this to...
8185d503d06ae2e978ee73bb7fa8396feb6ac65b3c651dc7296bde16d2d985d1
Python
7,931
199
import matplotlib matplotlib.use('Agg') import argparse, time, logging import numpy as np import mxnet as mx from mxnet import gluon, nd from mxnet import autograd as ag from mxnet.gluon import nn from mxnet.gluon.data.vision import transforms import gluoncv as gcv gcv.utils.check_version('0.6.0') from gluoncv.mode...
5f87f67bb96126e3f886750ec084340e4c451b55086f8819e96b7859d246f7b5
Python
7,932
273
import pytest import tensorflow as tf from psychrnn.backend.models.basic import Basic from psychrnn.backend.models.lstm import LSTM from psychrnn.tasks.match_to_category import MatchToCategory from psychrnn.backend.simulation import BasicSimulator, LSTMSimulator import numpy as np import random # clears tf graph after...
35a56305773a5e1f882a13926e17870077b9ecc99c669b2f98d6e8b90272ca43
Python
7,935
198
"""F02 row gate: the causal-scrubbing expressibility row (edits memo B1, offline analog). The flagship gallery row scaled to the R0 fixture discipline: a REAL config-built GPT-2 (the sprint's zero-network realism fixture -- the same 2-layer/64-dim `GPT2LMHeadModel` the R0 gate runs), >=6 population examples over 2 pro...
b0aa101ce59493a396c815ca53735332dae03a30d37b68d14d849d44ea97ed7b
Python
7,935
225
import tempfile import unittest from pathlib import Path from compile_to_inline_config import compile_config class CompileToInlineConfigTest(unittest.TestCase): def test_group_dict_preserves_structure_and_match_policy(self): with tempfile.TemporaryDirectory() as temp_dir: root = Path(temp_dir...
b6c45e95a40a32739bc38c16152b2a68d1df697fc9492c2b49b24d9cd3dce6c5
Python
7,937
248
from collections import OrderedDict import numpy as np from ..geometry import shapes as gshapes from ..util import equal_states from .layer import StructureLayer class StructureComposite: def __init__(self): self.layers = [] def __contains__(self, sl): if isinstance(sl, str): t...
6af29e7d41b0466eb75ae738e178e0d61e9954b907231f7fef6bf6b69aaf27ed
Python
7,939
250
"""Behavioral tests for slice-kind (gather/scatter/all_to_all) witness derivation. ``derive_merge``'s identity-kind witness comparison is covered by ``test_merged_engine.py``; these pin the group-rank-indexed slice pairings: gather roots against member contributions, scatter roots against member destinations, and the ...