sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8546346374c903a5d95ea52ff6c88d075370889c6f6d479dfc9b530dfa9cde91 | Python | 30,709 | 738 | # 2022/2023 Josue Page Vizcaino pv.josue@gmail.com
import subprocess
import numpy as np
import torch, math, csv
import torch.nn.functional as F
import torch.nn as nn
from typing import Tuple
from tifffile import imsave
from tqdm import tqdm
import matplotlib.pyplot as plt
from XLFMDataset import *
def get_free_gpu():... |
f3230fc7bcb95e21120c8e6fa72518f5a0e9c278417f50738d98b6a33187f294 | Python | 30,709 | 806 | ##########################################################################
## ##
## Copyright (c) 2019 Philipp Lösel. All rights reserved. ##
## ##
## This file is par... |
582548e69f6ee3a74a0566fca1a3d3c025ece9787380dd0876968c2daaa1053b | Python | 30,722 | 812 | """L6 stage-1(b)/(c) exit gate: Selection algebra, producers, resolution.
Covers the design-memo obligations: operator closure + totality matrix over
the widened axes, the law table at BOTH denotation levels (family +
elements) including pinned NON-laws, reflected/mixin dispatch including the
exact METAPLAN flagship e... |
75e771d7736f16044bdfb4cabe92c4ae77d3d3a81571d944d70568132a4ff15f | Python | 30,726 | 919 | from functools import lru_cache
from typing import Generator
import numpy as np
from mirp._features.morph_3d_data import (
Data3DMesh, Data3DConvexHull, Data3DAxisAlignedBoundingBox, Data3DOrientedMinimumBoundingBox,
Data3DPrincipleComponents, Data3DSpatial, Data3DMinimumEnvelopingEllipsoid, Data3DVoxel
)
fro... |
47de0defdfee75ae261bd2daa59ca5323e335f70d321865512e6e758889b7228 | Python | 30,739 | 886 | """
=================================
Alternative features based on dedicated MEG dataset
=================================
This module is design to compute neuronal avalanches metrics on a MEG dataset
"""
# Authors: Pierpaolo Sorrentino, Marie-Constance Corsi
#
# License: BSD (3-clause)
import mne.time_frequency
from ... |
eb26f6c57d7f49e6690f4272dd7bf54556974f4c9212fb40740cb77c012f105e | Python | 30,762 | 819 | # SOURCE: vendored from https://github.com/YangLabHKUST/Portal @ 6bf61493
#
# Portal (Zhao, Cai, Zhang, Bao, Yang. 2022, "Adversarial domain translation networks
# for fast and accurate prediction of cellular responses to novel drugs", and the
# companion Portal single-cell atlas-integration paper). An adversarial doma... |
b873ebb7acdd39ac95b0cda27020c14d9e9a812be2571bdaf418e5822af148a2 | Python | 30,770 | 606 | """Module that contains a basic implementation of a convolutional motif kernel network (CMKN).
Authors:
Jonas C. Ditz: jonas.ditz@uni-tuebingen.de
"""
import torch
from torch import nn
from torch.optim.lr_scheduler import ReduceLROnPlateau
import torch.nn.functional as F
from timeit import default_timer as timer
... |
e1ce150da966f6276ef4ef9aa0690077edccda302d9f5429d05d5f10cf0643e7 | Python | 30,776 | 790 | import os
import numpy as np
import pytest
from absl.testing import parameterized
from keras.src import backend
from keras.src import layers
from keras.src import models
from keras.src import saving
from keras.src import testing
from keras.src import utils
from keras.src.callbacks.orbax_checkpoint import OrbaxCheckpo... |
7d87b7fa1ad41f6aca10be102c2c9363b39d3c1da00f120047b7ab0804d6a83b | Python | 30,780 | 721 | import glob
import matplotlib.pyplot as plt
import scipy.integrate as integrate
import numpy as np
import pickle
import random
def load_HILLS(hills_name="HILLS"):
"""Load 1-dimensional hills data (includes time, position_x, position_y, hills_parameters
Args:
hills_name (str, optional): Name of hills... |
d71482d959314e20058c603ba39a394641625c5afd64cf4d80f731cab7cfd308 | Python | 30,818 | 982 | """
Distribution database, registry and associated methods.
This modules provides classes and methods for managing and generating distributions.
"""
from __future__ import annotations
from typing import Any, Optional
import typing
import warnings
import numpy as np
import powerlaw
import scipy
from scipy.stats import... |
9c368f1920695949aae7adc75dfd91141708e476abf411d8df0346b7c9bc1a1f | Python | 30,858 | 765 | import os
import time
import numpy as np
import pandas as pd
import nibabel as nib
from os.path import join as pjoin
from sklearn.cluster import AgglomerativeClustering
from matplotlib import pyplot as plt
from magicbox.io.io import CiftiReader, GiftiReader, save2cifti
from magicbox.graph.triangular_mesh import get_n_r... |
51ce4358e95d86435bbefd84a9de02dc9588b6a66684da405df1ee3d869fded4 | Python | 30,866 | 922 | """
colors
=====
Functions that manipulate colors and arrays of colors.
-----
There are three basic types of color types: rgb, hex and tuple:
rgb - An rgb color is a string of the form 'rgb(a,b,c)' where a, b and c are
integers between 0 and 255 inclusive.
hex - A hex color is a string of the form '#xxxxxx' where e... |
26d356d8218b06c041cd1d3c775a268a90e2855bbb13e6e959f1e1504f40b638 | Python | 30,925 | 920 | """tinygrad backend capture tests."""
from __future__ import annotations
import json
import pickle
from pathlib import Path
from typing import Any
import numpy as np
import pytest
import torchlens as tl
from torchlens._io.bundle import _build_manifest, _write_payload_blob
from torchlens._io.payload_codec import get... |
cbe49995e1fa5e337e1c59af8be6457344ab3cb657344c4c5d9e7dba0ae7b82c | Python | 30,928 | 813 | """Round-25 container-reconstruction regression: SEC1 + F1/C1 + SEC2.
Three findings in the r24 non-invoking output-container rebuild
(``torchlens/ir/container.py``):
* SEC1 (HIGH, security): ``object.__setattr__`` HONORS data descriptors, so populating a
captured field/key whose name is a settable ``property`` (or... |
d5c10ffb15e8beb1139aa3de8a22d65d6dce3adf98eac1d0ecb304fe2b58c103 | Python | 30,943 | 875 | # Copyright 2020-2023 Ran Wang, Xupeng Chen
#
# 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 agreed to ... |
213149c6812b21c89dd12e1dc1352c0ac5d59dfbe91735add1da27e0c2d6455b | Python | 30,945 | 655 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""
Benchmark YOLO model formats for speed and accuracy.
Usage:
from ultralytics.utils.benchmarks import ProfileModels, benchmark
ProfileModels(['yolo26n.yaml', 'yolov8s.yaml']).run()
benchmark(model='yolo26n.pt', imgsz=160)
Format ... |
af9259d07fe1df6b194698c2f23090033511be0f9195cab8b4b073ffd5abc16a | Python | 30,992 | 767 | """Adversarial hardening matrix for the C1 merge engine.
Forgery, tamper, and outcome-gate tests split from ``test_merged_engine.py``
(same synthetic-rank-evidence substrate, imported from there): op-label
back-reference forgery, role-index validation, group-record forgery and
rank tamper, the c10d group-seq latch, un... |
6478372c228617503661894b166c4303b5077c1dec7a228cb1c9f24cc9869c66 | Python | 30,998 | 849 | r"""
Test AmP zero-variate predictions against Larvaworld simulations.
This module demonstrates the complete educational pipeline for validating DEB model
predictions and comparing to the generalized animal reference parameters:
1. Download/locate AmP parameter export and observed/predicted data
2. Load JSON and orga... |
2af31d4511f9b025160b7a5d88c4c992406dd983dde0c029835a820a1f05520b | Python | 31,013 | 848 | import os
import time
import platform
import pandas as pd
import numpy as np
import uuid
import warnings
import tzlocal
from apscheduler.schedulers.background import BackgroundScheduler
from eco2ai.tools.tools_gpu import GPU, all_available_gpu
from eco2ai.tools.tools_cpu import CPU, all_available_cpu
from eco2ai.tools... |
6c92b9c8e91187908b7a4fa966d0c24655728ab20554527e90d51bf9411aa1c9 | Python | 31,031 | 661 | """
NASNet Mobile
Thanks to Anastasiia (https://github.com/DagnyT) for the great help, support and motivation!
------------------------------------------------------------------------------------
Architecture | Top-1 Acc | Top-5 Acc | Multiply-Adds | Params (M)
------------------------------------------... |
9a41a534f62f56f2870fcf4148df32b650c96a1fe0ac0ccd3ba96067b790af27 | Python | 31,038 | 718 | # 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... |
8f4bb326e175d781def3cd72f3c66b0f22acb6e84bc8265194e7ae165a0756b4 | Python | 31,098 | 850 | """Unified high-level distribution APIs across backends."""
import collections
import contextlib
import math
import os
import re
import warnings
import numpy as np
from keras.src.api_export import keras_export
from keras.src.backend import KerasTensor
from keras.src.backend import distribution_lib
from keras.src.bac... |
90dc053bbbd9dff06ccce1f08fa0b9615b1ddc9ac29919d582ba9e1ea0cdcf58 | Python | 31,109 | 1,252 | """This tests the CLI functionality of training and predicting a regression model on a single molecule.
"""
import sys
import numpy as np
import pytest
from chemprop.cli.hpopt import NO_HYPEROPT, NO_OPTUNA, NO_RAY
from chemprop.cli.main import main
from chemprop.cli.utils.MAB_parsing import build_MAB_data_from_files
... |
f39550376e4c31377b7a62a6c91d1dcc5c312697f7f61f6abe801bf44095f7b2 | Python | 31,135 | 914 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2023 The NiPreps Developers <nipreps@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
52addf2ddae28d8e9b60102c503d83e5a6e7f8f30bf9e0eff32ffe5a10ac0c8d | Python | 31,175 | 857 | __credits__ = ["Andrea PIERRÉ"]
import math
from typing import TYPE_CHECKING, List, Optional
import numpy as np
import gym
from gym import error, spaces
from gym.error import DependencyNotInstalled
from gym.utils import EzPickle
try:
import Box2D
from Box2D.b2 import (
circleShape,
contactLi... |
14154bd524dd6efbdd2c0d9cda401384283390d8ed136211c57408738099ccd9 | Python | 31,197 | 919 | # --- 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 Realaxis(_BaseLayoutHierarchyType):
_parent_path_str = "layout.smith"
_... |
e8c30e088d55f8c802b63addc3332e0262b7f6198fd098692c33d680f9c59891 | Python | 31,207 | 478 | import os
import logging
import re
from collections import defaultdict
from math import pow, sqrt
import time
from statistics import mean, stdev
from pysam import FastaFile
from spoa import poa
from cpuinfo import get_cpu_info
from svim.SVIM_clustering import form_partitions, partition_and_cluster_candidates, calcula... |
3f88e2f54e63cb67ee0e87cc2f64115f450e8bdaa74c992c26a8f43af81ac102 | Python | 31,247 | 804 | # Copyright 2025 Google.
#
# 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 agreed to in writing, soft... |
58a591d13a6e3da01cb2010a559a4297cf0eca89180ac72c5f3fc73fccbacc74 | Python | 31,258 | 738 | """
Plots to visualize results from cell-cell colocalization based analyses, as well as cell-cell communication
inference-based analyses. Makes use of dotplot-generating functions
"""
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from matplotlib.collections import PolyCollection
from matplotlib.t... |
c70747a218a7b8c3ed913e30da03e21d10350fa5b5d2994e3386504e0ff56180 | Python | 31,262 | 750 | """C1 merge engine: gloo sims (single-process world + multi-rank spawn).
End-to-end pins for ``tl.merge_ranks`` / ``tl.merge_report`` / the
``merged-directory`` artifact over REAL rank cores: live merge, artifact
round-trip with full load rederivation, the tamper matrix, determinism,
loaded-vs-live parity, multi-rank ... |
9c7e1a3caf96db080ed22d52dcab8994f7e64381a06b5aa7f605eff62e8b21fc | Python | 31,287 | 1,115 | import pytest
from jinja2 import TemplateNotFound
import flask
def test_blueprint_specific_error_handling(app, client):
frontend = flask.Blueprint("frontend", __name__)
backend = flask.Blueprint("backend", __name__)
sideend = flask.Blueprint("sideend", __name__)
@frontend.errorhandler(403)
def f... |
253c21be2548b603a11d7cf1e5b0b49830c5abe89c1d75570e62bccfa4d201c3 | Python | 31,295 | 880 | from flask import Flask, request, jsonify, render_template, send_file, Response, make_response
import threading
from collections import defaultdict
from natsort import natsorted
import numbers
import re
import numpy as np
import math
# Our modules
import cohort
import data
import image
import correlation
import image_... |
2f074d6a1d83e532a9d3ea1cad41020d235b02e5641c50fdf7b1aa790151339c | Python | 31,296 | 713 | """Packaging-diet tests for lazy pandas and IPython imports."""
import importlib.util
import re
import subprocess
import sys
import zipfile
from pathlib import Path
from unittest.mock import patch
import pytest
import torch
from torch import nn
import torchlens as tl
class _TinyModel(nn.Module):
"""Small model... |
c994d1a2b8d2545985511942fcfa579d3ecc998c6bbdefa1bbfdc91c20b2f4db | Python | 31,300 | 648 | """
Query router agent that answers directly or hands off to specialists.
Uses pydantic-ai output functions to either:
- Answer general Galaxy questions directly (returns str)
- Hand off to error_analysis for job debugging
- Hand off to custom_tool for explicit tool creation requests
- Hand off to tool_recommendation ... |
cb525a782b291efe5af2244cbf4f82442a718238db576dd61446836e1f413f5c | Python | 31,349 | 686 | from time import sleep
from types import ModuleType
import pytest
from pytest_celery import CeleryTestSetup, CeleryTestWorker, RabbitMQTestBroker, RedisTestBroker
from pytest_docker_tools.wrappers.container import wait_for_callable
import celery
from celery import Celery
from celery.canvas import chain, group
from ce... |
55017ae77cc6a4a6275392b0e52889c9cdb3d81bc69eb7f64d415dcb08193970 | Python | 31,358 | 849 | """Tests for pyrosm.graph_simplify (issue #89): OSMnx-equivalent simplification."""
import sys
import numpy as np
import pandas as pd
import pytest
from geopandas import GeoDataFrame
from shapely.geometry import LineString, Point
# pandana's C extension expects 32-bit C longs on Windows, where NumPy 2 hands it 64-b... |
be0285ac299c8457f1f147fb9e141936330a51fd1fabdad0451810d55b109ad5 | Python | 31,358 | 679 | # 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... |
c42e0ec8d7c4f67da36ac87117fe9fb41fbd6cafb2bd5510fdd623ef4bf68bbd | Python | 31,366 | 726 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
from __future__ import absolute_import, division
from tqdm.auto import tqdm
import torch
import torch.nn.functional as F
from trainingUtils import MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd
from models import Decoder, SimpleEncoder,LocalDiscrimina... |
48008ead8401419472328f3516f4d1f5e5735c91c4f52e5785a665ad2058bade | Python | 31,390 | 960 | import numpy as np
from joblib import Parallel, delayed
from sklearn.base import (
BaseEstimator,
TransformerMixin,
is_classifier,
is_regressor
)
from sklearn.pipeline import Pipeline
from sklearn.metrics import accuracy_score, r2_score
from ..utils.mean import mean_covariance, mean_riemann
from ..util... |
b29dd92f2dfe74dfa73a1298d696ca1c2a3fbdb074909031bec91f482ffaa99a | Python | 31,402 | 935 | # coding=utf-8
# Copyright 2025 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... |
d96345f5353e75c6e8ee31d7e964f58ad7bbfef00097eb72aa827620631a4b00 | Python | 31,416 | 974 | from keras.src import backend
from keras.src import tree
from keras.src.api_export import keras_export
from keras.src.backend import KerasTensor
from keras.src.backend import any_symbolic_tensors
from keras.src.backend.common import standardize_dtype
from keras.src.ops.operation import Operation
from keras.src.ops.oper... |
538934cfe05713eb689d1f0f5f0b281ab2c1d2e9607f3065cba074834c99b33f | Python | 31,423 | 984 | """
usi_figs.py
This script contains functions defining USI figure panel analyses.
Authors: Colleen Gillon
Date: January, 2021
Note: this code uses python 3.7.
"""
from util import gen_util, logger_util
from sess_util import sess_gen_util, sess_ntuple_util
from analysis import usi_analys, misc_analys
from paper_fi... |
b9739cf201b0dd03f41d91a19da28773ee69bbcd7087dcb1e0e89d6ef5ca7835 | Python | 31,442 | 705 | # -*- coding: utf-8 -*-
"""
Created on Tue May 5 11:17:17 2020
@author: Caterina Brighi
"""
#%% Set working environments
import matplotlib.pyplot as plt
import matplotlib as mpl
import dicom2nifti
import SimpleITK as sitk
import numpy as np
import scipy.ndimage as ndimage
import pandas as pd
import... |
2c601b527df774793084e20e664dd765fac1a85d9b8fdbe07c37c2ae4050d5e9 | Python | 31,444 | 615 | import random
import datetime as dt
from pyoperant import panels
from pyoperant import utils
class Shaper(object):
"""
Run a shaping routine in the operant chamber that will teach an
to peck the center key to hear a stimulus, then peck one of the side keys for reward.
training sequence:
Block 1: H... |
89e9989d0092cd268a228ed4a1ea513846892eb8c888bbbba2e615faf1d40b9e | Python | 31,451 | 944 | """
DEB energetics wired into a larvaworld agent.
The physics lives in :mod:`~larvaworld.lib.model.deb.deb_equations`, which is a
transcription of the authoritative model tables. This module is the larvaworld-side
wrapper around it: parameter selection, the gut coupling, the hunger drive that
feeds the behavioural int... |
59f9da7796d6a4c4ed22e7a006babec9e4c96b1f2ce071c891b02e8fac4e09b7 | Python | 31,455 | 800 | """r69 B+D -- ONE scalar type-class classifier + ONE canonical mapping-key authority.
The r68 clusters B (scalar TYPE conflation -> false VERIFIED/ATTESTED) and D (exotic
mapping keys: NaN false-DIVERGED, numpy-key advertise-then-fail, enum-key admission)
share one root: four independent ``isinstance`` scalar dispatch... |
0c44a0c6babb818fc31534d0ca50bd5f715f1124f8ef3685198d5329bd8443c1 | Python | 31,460 | 820 | """Tigramite causal discovery for time series."""
# Author: Jakob Runge <jakob@jakob-runge.com>
#
# License: GNU General Public License v3.0
from __future__ import print_function
import json, warnings, os, pathlib
import numpy as np
import gc
import dcor
import torch
import gpytorch
from .LBFGS import FullBatchLBFGS
... |
46b86bf7364724a45d178b73aa81f987276a4751c5838e8300822b709274c48d | Python | 31,470 | 748 | """Import-time hygiene regression tests.
The measured import state is healthy -- TorchLens adds ~1.2 ms and exactly one
of its own modules (the package root) on top of torch after the P4 cold-start
laziness pass (2026-08-19), pulls no heavy third-party dependency, and is
warning-clean. This file is the TRIPWIRE for th... |
1a71e35fc6cf8c4abc2b0da58de2d670dc08456be621439fa41d43e1c54b773e | Python | 31,473 | 919 | import builtins
import numpy as np
import tensorflow as tf
from tensorflow.compiler.tf2xla.python.xla import dynamic_update_slice
from keras.src import tree
from keras.src.backend.common import KerasVariable
from keras.src.backend.common import global_state
from keras.src.backend.common import is_int_dtype
from keras... |
1284ca73aa57545d26342d570a1bb2c62746ebef9c972b9142a4cc23d7782cc3 | Python | 31,499 | 744 | """Provocation + reachability meta-gate over the frozen refusal vocabularies (R25-1).
Every existing lockstep gate checks SHAPE (doc row <-> declaration); none checked
REACHABILITY (a member with no raise site) or PROVOCATION (a code no test ever
asserts), which is exactly how dead members and unprovoked tripwires sur... |
a77a07ee5894148547ca8c9112f2b703d03fe93550e06370973c86de9f1753c8 | Python | 31,501 | 712 | import json
import re
from typing import (
Any,
cast,
get_args,
)
from urllib.parse import quote
from typing_extensions import TypedDict
from galaxy.exceptions import (
AuthenticationRequired,
MessageException,
ObjectNotFound,
)
from galaxy.files.models import (
AnyRemoteEntry,
Entry,
... |
e3a7ff9e899c0443bda22f18b4787cc794cc5410b8c86e539f2db26c0341b10e | Python | 31,518 | 658 | import torch
import torch.nn.functional as F
import math
import numpy as np
import pandas as pd
from sklearn.metrics import silhouette_score,confusion_matrix
from sklearn.decomposition import PCA
from scipy.stats import spearmanr
from models import Decoder
from evaluationUtils import r_square,get_cindex,pearson_r,pseud... |
4474e11a92c8311c50c165b94b974e366b8aa5b5b31d62ebc78a3038003e1394 | Python | 31,537 | 846 | from __future__ import annotations
import random
from pathlib import Path
from types import SimpleNamespace
import numpy as np
import pandas as pd
import pytest
from larvaworld.lib import reg, util
from larvaworld.lib.model import DefaultBrain
from larvaworld.lib.model import moduleDB as MD
from larvaworld.portal.mo... |
85f4b6a7a687a5e3a017aaac6779328e8f2818e02d32c5592fe6d52644baf6a8 | Python | 31,560 | 755 | #Cox-nnet v2.0
#This is a package for running the neural network extension of Cox regression (version 2).
#Classes:
# CoxRegression - the Cox regression output layer
# HiddenLayer - hidden layers between input and output, based on deeplearning.net/tutorial/code/mlp.py
# CoxMlp - container class for output lay... |
93cc453aa81939b4bdb2237b54da5cc373bae7911e8f2a4a4a507483f00b1392 | Python | 31,594 | 814 | """
Slice Class creation Courtesy of Timothé Boutelier.
"""
import os
import warnings
import datetime
import numpy as np
import pydicom
from pydicom._storage_sopclass_uids import SegmentationStorage, EnhancedMRImageStorage, \
EnhancedCTImageStorage, MRImageStorage
class Slice:
""" Base DICOM manipulation cla... |
da2370fe477c9d650627f0a9cced4136684a6956f5db80982c95b0ca67ca8e3a | Python | 31,597 | 873 | import sys
import csv
import math
import numpy as np
from scipy.stats import genpareto
#Checks if input is float
def IsFloat(i):
try:
float(i)
return True
except ValueError:
return False
#Checks if input is integer
def IsInt(i):
try:
int(i)
return True
except... |
e5b914f30579c108dd2dec8ba6922d90d45e4c7c5880b24aa6b9daafa632dd01 | Python | 31,620 | 782 | """C0 core pins: lifecycle ledger, pre-join lineage audit, recognizer, arming.
These are the single-process pins for the merge-ranks C0 evidence layer
(design-merge-ranks-c v5, sections 1.3 and 5.0/5.2). The multiprocess gloo
sims for boundary capture live in ``test_distributed_boundary_gloo.py``.
"""
from __future__... |
f56c481660ccbb9aec46152d0936a436ce54bdc28740a34b407ae2d7da3b01dc | Python | 31,622 | 907 | from abc import abstractmethod
import math
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
from .fp16_util import convert_module_to_f16, convert_module_to_f32
from .nn import (
checkpoint,
conv_nd,
linear,
avg_pool_nd,
zero_module,
normalization,
... |
0132d44d9643d9080ca4ab223faa1eb905905bcfe5ba307118c5fb9068a482f1 | Python | 31,623 | 736 | #%%
"""
==============================================================
Attempt to classify MEG data in the source space - neuronal avalanches vs classical approaches - classification on longer trials w/ SVM
===============================================================
"""
# Authors:
# Marie-Constance Corsi
# Pie... |
67c22cb6f9c6f37c388bc0097205938858f6909ec8e4d0937d9dee2cceac5a2c | Python | 31,632 | 1,039 | # ===============================
# OSM TAGS
# ===============================
# These configurations are used to specify which OSM tags are kept
# by default as columns in DataFrame. Follows more or less the
# OSM documentation and the tags mentioned on the Wiki:
# https://wiki.openstreetmap.org/wiki/Map_Features
# I... |
9c41cb450b439bdaa1510b9d41d6b62217a4eb854cf739452b3e85d1d9d1cee7 | Python | 31,673 | 733 | from __future__ import annotations
import inspect # Used to see what kwargs the functions need
import logging
import threading
import time
from collections import namedtuple
from typing import Any, Callable, Optional
from grpc import RpcError
import bream4.toolkit.procedure_components.command.keystore as keystore
f... |
99181f9e5d0c57e722a6625e255f5654c0a030326e1afe187ccd1151e37bb059 | Python | 31,739 | 668 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 21 15:12:24 2021
"""
import pickle
import importlib
import numpy as np
import pandas as pd
import scipy.linalg as la
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
import src.stats as stats
import src.preprocess_rep_geom_da... |
fd2dbf720469711fd28b61136137b20890d27aa48fd4bc8cacb7b184b71451a0 | Python | 31,743 | 782 | import numpy as np
import csv
import prob2020.python.utils as utils
from ..cython import cutils
import prob2020.python.mutation_context as mc
import prob2020.python.scores as scores
def deleterious_permutation(obs_del,
context_counts,
context_to_mut,
... |
230273c5030211e2025b11b68ec9d0e7f9a50bc8be91e1874071cfc4b6c03891 | Python | 31,782 | 707 | import numpy as np
from keras.src import backend
from keras.src.api_export import keras_export
from keras.src.layers.layer import Layer
from keras.src.layers.preprocessing.index_lookup import listify_tensors
from keras.src.layers.preprocessing.string_lookup import StringLookup
from keras.src.saving import serializatio... |
b4010da4f94ca7f8fe832a38ca26a86b9af37b2c72fc8d46fce0d6d9a110651b | Python | 31,799 | 827 | """
Galaxy Metadata
"""
import copy
import json
import logging
import os
import sys
import tempfile
import weakref
from collections import OrderedDict
from collections.abc import (
Iterator,
Mapping,
)
from os.path import abspath
from typing import (
Any,
TYPE_CHECKING,
Union,
)
from sqlalchemy im... |
a38793944976048497782ff4c1a1fbac5de1810d7fd749264aa2c56564c57198 | Python | 31,800 | 779 | """Round-6 whole-class immunizer: an admitted callable may not MEDIATE an allocation.
``_is_alloc_constructor_type`` refuses a REDUCE / NEWOBJ that constructs a torch storage,
a ``torch.Tensor`` subclass or a ``numpy.ndarray`` -- but it inspects the TYPE BEING
CONSTRUCTED. That makes it structurally BLIND to any allow... |
eb931c8761ff0ee89b11bb2305bbe57d738ad3183d53306d365d90e121ef9928 | Python | 31,816 | 894 | """Spatial filtering function."""
import warnings
import numpy as np
from scipy.linalg import eigh, inv
from sklearn.base import BaseEstimator, TransformerMixin
from . import estimation as est
from .geometry.ajd import ajd, ajd_pham
from .geometry.covariance import (
normalize,
get_nondiag_weight,
cov_est... |
762b5381a82a184be00dee4ebad616af220e71622955147a602e6fd98265d452 | Python | 31,839 | 717 | import time
import os
from tqdm import tqdm
import numpy as np
import pandas as pd
import torch
from torch.utils.data import DataLoader
# from torch_geometric.data import DataLoader, DataListLoader, Batch
from torch_geometric.nn import DataParallel
from sklearn import metrics
import torch.nn.functional as F
from torch.... |
0d00b496219492a600c36350d411e6471e26dcf6a6c279d8d9a1b9877593d859 | Python | 31,849 | 645 | # pylint: disable=not-callable
"""
Double Head Faster RCNN Model. https://arxiv.org/abs/1904.06493
title={Rethinking Classification and Localization for Object Detection}
author={Wu, Yue and Chen, Yinpeng and Yuan}
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition}
year={2020}
The... |
47fda5f703cf0b05c5cbc8f7d0fc467d2f577b5e754ca94fc145353eadf82532 | Python | 31,850 | 838 | # SOURCE: vendored from MLSpeech/DeepFormants @ shallow clone fetched for CV15
# SOURCE: vendored from lucascjysdl/deepfreight @ shallow clone fetched for CV15
# SOURCE: vendored from rajatsen91/deepglo @ shallow clone fetched for CV15
# SOURCE: vendored from scikit-mobility/DeepGravity @ shallow clone fetched for CV15... |
92c2a38d5da06593a230dbccdeb7e07e0328ba720b62843a56f99c14d3bafa10 | Python | 31,908 | 753 | import os
import time
import numpy as np
import pandas as pd
import pickle as pkl
import nibabel as nib
from os.path import join as pjoin
from scipy.stats import zscore
from scipy.spatial.distance import cdist
from sklearn.decomposition import PCA
from magicbox.io.io import CiftiReader, save2cifti
from magicbox.stats.o... |
d498c82973d2e6c443b09b49bad178f5d090743e11d8a62afb6f179c9de76031 | Python | 31,939 | 801 | # Copied from PyTorch Geometric source files. We needed to change what the
# forward function of the DimeNet class returns to allow other types of
# readouts
import os
import os.path as osp
from math import pi as PI
from math import sqrt
from typing import Callable, Union
import numpy as np
import torch
from torch.nn... |
326b930d3b5fce7b33086cd6143bbf8e755a6c86f7cafb2b8e680a248fddc9dd | Python | 31,943 | 828 | """Tests for framewise displacement calculation."""
import json
import os
import nibabel as nb
import numpy as np
import pandas as pd
import pytest
import yaml
from xcp_d.data import load as load_data
from xcp_d.interfaces import censoring
def test_generate_confounds(ds001419_data, tmp_path_factory):
"""Check ... |
29ee250446bb36755ec33c32d75974828ffaf2a9b9f4d738e9f4fc7da09eb5f6 | Python | 31,950 | 1,030 | from abc import ABC, abstractmethod
import h5py
import numpy as np
import torch
from torch.utils.data import DataLoader
import torch.nn as nn
import os
# from motifs import read_motifs, motifs_for
from utils import clip_datapoint, modify_sl, print_topl_statistics
class ResidualUnit(nn.Module):
"""
Residua... |
49d3b26d2f34cfcafaebbdab651a7648ca8edf0c955631c43c5b4cb56c0c4099 | Python | 31,953 | 706 | import os
import math
import itertools
import pytest
import torch
import torch.nn.functional as F
from torch._C import parse_schema
from einops import rearrange, repeat
try:
from flash_attn.layers.rotary import apply_rotary_emb
except ImportError:
apply_rotary_emb = None
from padding import pad_input, unpad_... |
59330c49fd62e528069db072291c8653d73470a1233b7550b92baa9a21100213 | Python | 31,959 | 721 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
from __future__ import absolute_import, division
from tqdm.auto import tqdm
import torch
import torch.nn.functional as F
from trainingUtils import MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd
from models import Decoder, SimpleEncoder,LocalDiscrimina... |
0b694c40cec08f795dc91ec910801dc850dcd090ef2d72be93a6a053c584a0a8 | Python | 31,977 | 873 | # SOURCE: vendored from snakeztc/NeuralDialog-LaRL @ master
# (latent_dialog/models_task.py::SysPerfectBD2Cat,
# latent_dialog/enc2dec/encoders.py, latent_dialog/enc2dec/decoders.py,
# latent_dialog/enc2dec/base_modules.py, latent_dialog/nn_lib.py,
# latent_dialog/base_models.py, latent_dialog/criterions.py)
#
# LaR... |
7e0f44f77e83688d4bcab04f1eab731c6fd6115cae5308a91c84a40fa3778cdc | Python | 32,007 | 831 | """
Support for installing and building the "wheel" binary package format.
"""
from __future__ import absolute_import
import collections
import compileall
import csv
import hashlib
import logging
import os.path
import re
import shutil
import stat
import sys
import warnings
from base64 import urlsafe_b64encode
from ema... |
0579ceaacaa3127ded844f679b4945e402aa554bcbb9f107aac7f63c52fccfb4 | Python | 32,009 | 694 | import os, sys
import shutil
import glob
import torch
import numpy as np
import copy
from itertools import groupby
from operator import itemgetter
import json
import re
import random
import matplotlib.pyplot as plt
import pandas as pd
from tqdm import tqdm
import random
import Bio
DEVICE = torch.device('cuda') if torch... |
e15e8d17498447ac7c9648009d70d95f11694385dd66e0b91637cc8abb31bead | Python | 32,019 | 910 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Workflows for post-processing BOLD data."""
import yaml
from nipype.interfaces import utility as niu
from nipype.pipeline import engine as pe
from niworkflows.engine.workflows import LiterateWorkflow as... |
c1b0080b500f6f946a0d566038ac75c642f0795de94f92d1aedc74908bc29013 | Python | 32,021 | 784 | #!/usr/bin/env python
import os
import sys
import pandas as pd
import numpy as np
import time
from sqlalchemy import create_engine
from itertools import repeat
import multiprocessing
import tqdm
import genes
import eqtls
def find_snps(
inter_df,
gene_info_df,
tissues,
output_dir,
... |
aaddf3030dba7b9809c4fefae3caab22d0f22b9ecf5050601d6646aefb611a49 | Python | 32,023 | 771 | # Copyright (c) 2025, Tri Dao.
import math
import operator
from typing import Optional, Tuple
from dataclasses import dataclass
import cutlass
import cutlass.cute as cute
from cutlass import Float32, Boolean
from quack import layout_utils
import flash_attn.cute.utils as utils
from quack.cute_dsl_utils import ParamsB... |
e6e17abf707368619f7062d0ebf4d557bedac432ece5b51a160d17929f66dd7f | Python | 32,023 | 764 | """Main-process collection.
Read the spilled shards back into the layer's node, way and relation records, their
member ways and the referenced node coordinates -- pulling only what the kept features
need off disk, and refining the worker's key-presence candidates by pyrosm's exact value
filter so peak memory stays bou... |
6529b44d5c9e2a5c910a1d2402db8fc1b1358d3fc9abc89f1d0389dc7f9f0fda | Python | 32,064 | 724 | import sys
import os
import math
import random
from copy import deepcopy
import numpy as np
import pandas as pd
from goatools import obo_parser
from goatools.rpt.rpt_lev_depth import RptLevDepth
import torch
from torch import nn
import torch.optim as optim
def CellGOModeling(GeneExpMatrix,CellTypeLabel,to... |
6f7df3495ffcdb8d1c4872ba1bcebb386aec1ca9e3196395b4eee3f0d2c25b8b | Python | 32,072 | 795 | import numpy as np
import cv2
import math
from enum import Enum
import score_behavior.tracking.geometry as geometry
from score_behavior.score_config import get_config_section
import logging
logger = logging.getLogger(__name__)
class AnimalPosition:
def __init__(self):
self.backbone = []
self.hea... |
47da29a0ce389709b40f528d604c4735bf2ca3e1d1fc73adcbb32cc9e2a572aa | Python | 32,074 | 830 | """
Manager and Serializers for Pages.
Pages are markup created and saved by users that can contain Galaxy objects
(such as datasets) and are often used to describe or present an analysis
from within Galaxy.
"""
import logging
import re
from collections.abc import Callable
from html.entities import name2codepoint
fro... |
e9c46862953fac53cdef2117331d079b8e8c990273247021389c91b187106e93 | Python | 32,083 | 833 | import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import numpy as np
def plot_img_and_mask(img, mask):
classes = mask.shape[2] if len(mask.shape) > 2 else 1
fig, ax = plt.subplots(1, classes + 1)
ax[0].set_title('Input image')
ax[0].imshow(img)
if classes > 1:
for i in ran... |
6ad2cc8dc3ae7717441b3266773eb9a3537e94fe852354162413d5c3ef4fd7ae | Python | 32,085 | 768 |
from cuteSV.cuteSV_Description import Generation_VCF_header
from math import log10
import numpy as np
import pysam
import logging
import pickle
import string
err = 0.1
prior = float(1/3)
Genotype = ["0/0", "0/1", "1/1"]
def log10sumexp(log10_probs):
# Normalization of Genotype likelihoods
m = max(log10_probs... |
1b896201f4d50333744d24144fe0a47042122788b32f266676b90945a3ee8ec9 | Python | 32,089 | 753 | # !/usr/bin/env python3
#-*-coding:utf-8-*-
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not... |
93c62810141aee00c189ee50ab225139e40f56ae196bb42c0bfe672e22ab6255 | Python | 32,108 | 614 | """
Job control via the DRMAA API / qstat and qacct.
Known to work on the UNIVA grid engine.
known bugs/problems:
- if a job runs longer than the time limits of the queue two things happen
1. at the soft limit (s_rt) SIGUSR1 is sent to the job
2. at the hard limit (h_rt) SIGKILL is sent to the job
The second... |
6469fe6188bd5a3e4bdbb467362a060ebf532d4e71ad198028699407919afd0d | Python | 32,109 | 799 | """Directpose based on resnet + FPN backbones"""
# pylint: disable=line-too-long, redefined-builtin, missing-class-docstring, unused-variable,unnecessary-pass,arguments-differ
# adpated from https://github.com/aim-uofa/AdelaiDet/blob/master/adet/modeling/backbone
import math
from abc import ABCMeta, abstractmethod
imp... |
bf34a8d37e753f0d6f265a8079550c5b0b6f311d12617ab1b2ac56ecd9b5434f | Python | 32,113 | 823 | import datetime
import json
import logging
import math
import os
import re
from concurrent.futures import (
as_completed,
ThreadPoolExecutor,
)
from typing import (
Any,
cast,
Literal,
)
from urllib.parse import quote
from typing_extensions import (
TypedDict,
)
log = logging.getLogger(__name_... |
e653e5776eaf87d929a7b3798f4308574777d7aa6b5565eb8b7ba889d8e1ace6 | Python | 32,116 | 870 | """
Unit tests for ethoscope_streaming module.
This module tests the Ethoscope streaming manager functionality including
connection sharing, multi-client streaming, frame broadcasting, and
resource cleanup.
"""
import errno
import pickle
import queue
import socket
import struct
import time
from threading import Threa... |
898c6665790bac99b98bc75746bb39c7ffa2708028321a8ec363b7589c09a671 | Python | 32,154 | 1,057 | """
Methods used in plotting
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Tuple
if TYPE_CHECKING:
from matplotlib.axes import Axes
from matplotlib.figure import Figure
import itertools
import os
import warnings
import matplotlib
matplotlib.us... |
2ef65672e7052a6188b75e67ddb91a255d2be358333ba6422b02b9d102c16710 | Python | 32,200 | 967 | """
Image classes
"""
import base64
import io
import json
import logging
import math
import struct
from collections.abc import Iterator
from typing import (
Any,
Literal,
)
import mrcfile
import numpy as np
import png
import pydicom
import tifffile
try:
import PIL
import PIL.Image
except ImportError:... |
24bb7880acbfa4c76ff774d59133627cb3e6a60fa234d7c04453c9e865349635 | Python | 32,203 | 750 | import copy
import warnings
import pydicom
import numpy as np
from typing import Generator
from mirp._data_import.mask_contour import ContourClass
from mirp.data_import.import_image import ImageFile
from mirp._data_import.dicom_file import MaskDicomFile
from mirp._masks.base_mask import BaseMask
from mirp._data_import... |
747586ba2fbd6a1c2ce337a89fb52e035dddb0df640a2ed26d34b0e2ca3113e9 | Python | 32,216 | 822 | # SPDX-License-Identifier: LGPL-2.1-or-later
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import numpy as np
import matplotlib as mpl
if os.environ.get('DISPLAY', '') == '':
print('no display found. Using non-interactive Agg backend')
mpl.use('Agg')
import matplotlib.pyplot as plt
from .utils import g... |
6d4be62326f2457df619572c712917bffeb684cb1f60685279f815c50fba71dc | Python | 32,232 | 742 | #%%
"""
==============================================================
Attempt to classify EEG data in the source space - neuronal avalanches vs classical approaches - classification on longer trials w/ SVM
===============================================================
"""
# Authors:
# Marie-Constance Corsi
# Pie... |
4299f474bc27826c142e4da7847a9311bcefa0efbdfe88984d5f696aef624104 | Python | 32,266 | 829 | """
Unit tests for Authentication API endpoints.
Tests login, logout, session management, and PIN change functionality.
"""
import unittest
from unittest.mock import Mock, patch
from ethoscope_node.api.auth_api import AuthAPI
def create_auth_mock():
"""Helper to create properly configured auth middleware mock.... |
3bb14e358fcd91d9b587eb69fa928dd470ad37deb29b685764f0dad3a1227e46 | Python | 32,275 | 877 | #!/usr/bin/env python
"""Doxygen XML to SWIG docstring converter.
Converts Doxygen generated XML files into a file containing docstrings
that can be used by SWIG-1.3.x. Note that you need to get SWIG
version > 1.3.23 or use Robin Dunn's docstring patch to be able to use
the resulting output.
Usage:
doxy2swig.py i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.