sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
aa309da9cb21e7adbbf4131e3e5c798917e46bd63fc4f7d7f259641491ffa8ab | Python | 27,913 | 832 | """
This module provides classes and functions for managing configurations in the larvaworld package.
It includes classes for configuration types and the unique reference type, as well as functions for resetting configurations.
"""
from __future__ import annotations
from typing import Any, Optional
import os
from con... |
06a4fc55348219d2c902387a581324091158add56874f7a8125581bc7e802330 | Python | 27,915 | 688 | # Copyright (c) 2023, Tri Dao.
# Inspired by https://github.com/NVIDIA/apex/blob/master/apex/fused_dense/fused_dense.py
# We make it work with pytorch amp and with bfloat16.
# The TensorParallel linear modules are inspired by https://github.com/NVIDIA/apex/blob/master/apex/transformer/tensor_parallel/layers.py
from fun... |
9ef965c4a71653f9c4257fe634b61749431d0c41dacab6c1de85f845a912f6c9 | Python | 27,921 | 592 | import numpy as np
import os
import sys
import time
import tensorflow as tf
import tensorflow.keras
from tensorflow.keras.models import Sequential
import random
import pandas as pd
#import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib
matplotlib.use('Agg') # Must be before importing mat... |
57e32b713d14d1cc33f1591c78428393c9de8472c684e578d60acee57b1bd8fe | Python | 27,925 | 657 | # pylint: disable=arguments-differ
"""Custom losses.
Losses are subclasses of gluon.loss.Loss which is a HybridBlock actually.
"""
from __future__ import absolute_import
from mxnet import gluon
from mxnet import nd
from mxnet.gluon.loss import Loss, _apply_weighting, _reshape_like
__all__ = ['FocalLoss', 'SSDMultiBoxL... |
590f2f992b14d015c34c2df2f1efcaeea7665279cd0009393a7c9d1c16838900 | Python | 27,933 | 835 | #!/usr/bin/env python
# Copyright 2018, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... |
f52c127d7681649d563830948e8f022cbdcaa10b051bd75c7b44eb69755f5b7d | Python | 27,935 | 708 | # adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/build.py
# pylint: disable=bad-continuation,bad-whitespace,pointless-string-statement,redefined-outer-name,wrong-import-order
import itertools
import random
import logging
import operator
import dill
import pickle
from pprint impo... |
bdd1a628bff4990da827a3cfa8ea518f0f8b3f7f64aea10acec2ee6cc4932858 | Python | 27,942 | 548 | """ResNeSt implemented in Gluon."""
# pylint: disable=arguments-differ,unused-argument,missing-docstring,line-too-long
from __future__ import division
import math
from mxnet.context import cpu
from mxnet.gluon import nn
from mxnet.gluon.block import HybridBlock
from mxnet.gluon.nn import BatchNorm
from ..nn.dropbloc... |
0b1254d238a338790beec30407354e94e935740e19e38758bd95fa2e3605c44f | Python | 27,951 | 374 | import numpy as np
from gym import utils
from gym.envs.mujoco import MujocoEnv
from gym.spaces import Box
DEFAULT_CAMERA_CONFIG = {
"trackbodyid": 1,
"distance": 4.0,
"lookat": np.array((0.0, 0.0, 2.0)),
"elevation": -20.0,
}
def mass_center(model, data):
mass = np.expand_dims(model.body_mass, a... |
c6abc677ff0169a5faea7ac57b5bd04e8d27772a6dd7294853d9e82536e230e8 | Python | 27,957 | 710 | # 3rd party
import torch
from torch.nn import functional as F
# NITorch
from nitorch.spatial import (affine_grid, grid_pull, identity_grid,
voxel_size, im_gradient, im_divergence,
grid_grad)
from nitorch.core._linalg_expm import _expm
from nitorch.core.optim imp... |
945a7d8024bdb501fadea767c54ca4ad25ccf5d1b84b13b9819eec6309d0eb2a | Python | 27,958 | 909 | """Platforms.
Utilities dealing with platform specifics: signals, daemonization,
users, groups, and so on.
"""
import atexit
import errno
import math
import numbers
import os
import platform as _platform
import signal as _signal
import sys
import warnings
from contextlib import contextmanager
from billiard.compat im... |
7efcce2057bee1dcc4e67a93dcd7ddbeeaf0dcee590fd3066a9d34167bd647e6 | Python | 27,960 | 614 | import os
import gc
import time
import math
import torch
import logging
import pandas as pd
from tqdm import tqdm
from torch.nn import CrossEntropyLoss
from torch.utils.data import TensorDataset
from torch.utils.data import DataLoader, RandomSampler
from irnlm.models.utils import save_checkpoint, format_time
from irn... |
1c2e0447945c670a279fbc70475a3ea754baa60202a71f3e59a5ca30f3b1de81 | Python | 27,970 | 727 | """
Functions to either scale single-cell data or normalize such that the row-wise sums are identical.
"""
import inspect
import math
import warnings
from typing import Dict, Iterable, Optional, Union
from ..configuration import SKM
try:
from typing import Literal
except ImportError:
from typing_extensions im... |
bc743ae92119e6af47357b99174a1253ab37c6e5c38d1ea13e5d2c60fd5f561a | Python | 27,981 | 723 | import numpy as np
import pytest
from keras.src import layers
from keras.src import models
from keras.src import testing
from keras.src.metrics import iou_metrics as metrics
from keras.src.ops import convert_to_tensor
class IoUTest(testing.TestCase):
def test_config(self):
obj = metrics.IoU(
... |
2535072714be3a8f1123d3dff125129e10b2584b489768c75e44e974498200e3 | Python | 27,984 | 684 | import os
import sys
import time
import traceback
import psutil
import math
import json
from threading import Thread, Event, Lock, current_thread
from typing import List, Optional, Union
import importlib.resources as pkg_resources
from carbontracker.emissions.intensity.fetcher import IntensityFetcher
from carbontracke... |
ea0413b48b3ef8c98bed4f218a1b843b73259e12067dc62d407247c8e9590516 | Python | 28,033 | 771 | # MIT License
# Copyright (c) 2018 Adrian Wolny (https://github.com/wolny/pytorch-3dunet)
# 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 t... |
04cf5f71870ce283af86e9e6abfa57dada68f04bffa63605db7aee3c8a1c967a | Python | 28,053 | 597 | import numpy as np
import os
import sys
import time
import tensorflow as tf
import tensorflow.keras
from tensorflow.keras.models import Sequential
import random
import pandas as pd
#import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib
matplotlib.use('Agg') # Must be before importing mat... |
33b9ad161babff9452dd7754df1e0e41c1b96928d14c3b27201f9031fbbcf401 | Python | 28,053 | 597 | import numpy as np
import os
import sys
import time
import tensorflow as tf
import tensorflow.keras
from tensorflow.keras.models import Sequential
import random
import pandas as pd
#import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib
matplotlib.use('Agg') # Must be before importing mat... |
63fc2657abf033dd59e2082e6976cabafb880e8ba4053aabed5cd6fb42d409cc | Python | 28,060 | 793 | import numpy as np
import sympy as sp
from scipy.integrate import solve_ivp
from numbalsoda import lsoda_sig, lsoda, dop853
from numba import njit, cfunc
import numba as nb
from .common import calculate_reversal_potential
class MarkovModel:
"""
A class describing a Markov Model of an ion channel
"""
... |
34844be94482dd7da7d501543a1d35298e93b77f6b4ac0ea9adcd0d659bc1985 | Python | 28,068 | 568 | """Path-faithfulness and state comparison helpers."""
from __future__ import annotations
from collections.abc import Iterable, Mapping, Sequence
from typing import TYPE_CHECKING, Any
import torch
from ._runnable_state import (
PreparedRunnableState,
runnable_tensor_byte_digest,
)
from .runnable import (
... |
c9437e47a4bb3e5f52a6de187bfc73a9c8fed88ea5498fa2cf362e0b7f70b4f2 | Python | 28,104 | 763 | # --- 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 = "scattermap"
_path_st... |
ec6cf3531ec53df21eafb156a65140388c779461d06bd9f8aa892f9c6f1b0d5c | Python | 28,107 | 641 | import torch as ch
import numpy as np
import torch.nn as nn
from torch.optim import SGD, lr_scheduler
from torchvision.utils import make_grid
from cox.utils import Parameters
from .tools import helpers
from .tools.helpers import AverageMeter, calc_fadein_eps, \
save_checkpoint, ckpt_at_epoch, has_attr
from .to... |
16380638e7464d0da59889006b85a142bd78b90052ccdb6219a542b5c05aa1ff | Python | 28,108 | 654 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Build a machine-readable reference library for the manuscript.
WHY THIS SCRIPT EXISTS
----------------------
`manuscript/references-verified.md` section C rule 4 mandates that, before
submission, the reference list be exported from a reference manager (Zotero /
EndNote... |
fd624cb634206b6048d94aef1d8ffbba9069a7cd12f9434b48a541273341eb9d | Python | 28,153 | 700 | """
UI for batch-processing and runs user-specified routine.
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 Lice... |
5a2ea9d74c148d6f803c86e15bacbfa39225b6a724de64b391e4d6b9abafcbf6 | Python | 28,169 | 581 | import argparse
import time
import torch
try:
import cudnn
except ImportError:
cudnn = None
from einops import rearrange
from flash_attn.cute.bench_utils import (
flops,
bandwidth_fwd_bytes,
bandwidth_bwd_bytes,
attention_ref,
cudnn_fwd_setup,
cudnn_bwd_setup,
)
try:
from flash_a... |
9ebbc20e505f688d5c1e6f683ffd41cba5f38bbb49aab23de603987e8eea6773 | Python | 28,183 | 915 | import math
import numpy as np
import random
import torch
from torch import nn
from torch.nn import functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return F.leaky_relu(input + bias, negative_slope) * scale
class FusedLeakyReLU(nn.Module):
def __init__(self, channel, n... |
396ca960aefaad5dd6b96c6169c8675dd16f1fc24283fe3f2988573048e065b2 | Python | 28,187 | 674 | import math
from keras.src import backend
from keras.src import constraints
from keras.src import initializers
from keras.src import regularizers
from keras.src.api_export import keras_export
from keras.src.backend.config import is_flash_attention_enabled
from keras.src.layers.activations.softmax import Softmax
from k... |
7f1cefde33325dacf7b0513daf86843dd226537268b6861f27a9d34243df25c6 | Python | 28,193 | 701 | ##########################################################################
## ##
## Copyright (c) 2019 Philipp Lösel. All rights reserved. ##
## ##
## This file is par... |
c24286ffa40e184b23462f84b8ba5cb96d95d5b5434a7640dabd8b64a9b23b71 | Python | 28,215 | 731 | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 3 15:18:38 2014
@author: Dan Denman and Josh Siegle
Loads .continuous, .events, and .spikes files saved from the Open Ephys GUI
Usage:
import OpenEphys
data = OpenEphys.load(pathToFile) # returns a dict with data, timestamps, etc.
"""
import os
import numpy as np... |
406da8c7cdc8f91c917908694f4a2f24131a714a4d3b06f69ce6476aebb7be01 | Python | 28,232 | 758 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Train a video classification model."""
import math
import pprint
import numpy as np
import slowfast.models.losses as losses
import slowfast.models.optimizer as optim
import slowfast.utils.checkpoint as cu
import slowfas... |
b22386ed9e4654cb22a974ec9ccf06120a21edef196f147b12776cb887513823 | Python | 28,264 | 815 | import logging
import os
import sys
import matplotlib
import numpy as np
from qtpy import QtCore, QtGui, QtWidgets
# from llspy.gui.img_window import Ui_Dialog
from .img_window import Ui_Dialog
matplotlib.use("Qt5Agg")
from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg as FigureCanvas,
)
from ma... |
1966365cabf3458fc85b48a76332e6ecbb0a3eca6f765a2c09e0f9894e1c5820 | Python | 28,279 | 864 | # -*- coding: utf-8 -*-
# @Author: gviejo
# @Date: 2022-04-04 21:32:10
# @Last Modified by: Guillaume Viejo
# @Last Modified time: 2023-09-18 10:28:42
"""Tests of nwb reading for `pynapple` package."""
import warnings
import numpy as np
import pandas as pd
import pynwb
import pytest
from pynwb.testing.mock.file ... |
eedf2c173c524a22d44879da9b7444a282742ae4318d368db713743d9937f6ef | Python | 28,281 | 575 | '''
Date: 08/09/22
@author: Kaan Karas & TMSi
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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.apac... |
c8afbc9d170dec33c17a48927fecba6ae1c4cd1a430efbd5c4b7c8985df5f09c | Python | 28,304 | 640 | """
"""
from typing import Optional
import torch.nn.functional as F
import torch
from torch.distributions import Normal
from src.layers.modeling_outputs import DockingPoseOutput
from src.layers.openfold.modeling_evoformer import TriAtten
from src.layers.modeling_layers import TransformerEncoderLayer
impo... |
913ce4726a75eb6ad8f993a87affa76209d3a65d2d13810c7507edc1446a6c20 | Python | 28,325 | 702 | from keras.src import activations
from keras.src import backend
from keras.src import constraints
from keras.src import initializers
from keras.src import ops
from keras.src import regularizers
from keras.src import tree
from keras.src.api_export import keras_export
from keras.src.layers.input_spec import InputSpec
fro... |
66c7a5988904857ab18ce327a7deef9e22496446a3439906e2b17cab715c13cf | Python | 28,329 | 727 | """
Block-sparsity utilities for FlexAttention
"""
from typing import Callable, NamedTuple, Tuple
import cutlass.cute as cute
import torch
from flash_attn.cute.cute_dsl_utils import get_broadcast_dims, to_cute_tensor
def ceildiv(a: int, b: int) -> int:
return (a + b - 1) // b
class BlockSparseTensors(NamedTu... |
d3fa602d34ea384b143843d39d6da52678ffbc2c97e6e4deb4b7fe76d9a9f38f | Python | 28,335 | 808 | # code adapted from https://github.com/aristoteleo/dynamo-release/blob/master/dynamo/configuration.py
import inspect
import logging
import os
import warnings
from functools import wraps
from typing import List, Optional, Tuple, Union
import colorcet
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy... |
6b78999533691185cabb375769c613bb85f500ba26425a1eddaffacb59c1ebc9 | Python | 28,337 | 644 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
import numpy as np
import os
import warnings
import shutil
import datetime
from importlib import import_module
from packaging import version
from tensorflow import __version__ as _v... |
abd362316aca4393420fe673b51d67215e419e7859b6a36c88f7c7ee68424215 | Python | 28,352 | 713 | #!/usr/bin/env python3
"""Push the manuscript's reference list into the author's Zotero library.
Why a script and not a one-off curl
-----------------------------------
The reference list is *derived* data: `refs_library.py` builds
`manuscript/references.json` from CrossRef, and the manuscript's numbering comes
from i... |
b7691b41137cc2ed9d128c74f18d45dd25e5acd1902734db0d028c0a339887a1 | Python | 28,360 | 636 | """Probability distributions used in Stochastic Policies."""
import abc
import math
from typing import Union, Tuple, List
import gymnasium as gym
import numpy as np
import scipy
import tensorflow as tf
from angorapy.agent.utils import extract_discrete_action_probabilities
from angorapy.common.const import EPSILON
fr... |
47da1e9d25ceff0df1a9b38352520ecb4ba509c01ca986f7206e168fce698746 | Python | 28,367 | 742 | """Tests for large graph rendering, rank layout, and RandomGraphModel."""
from __future__ import annotations
import os
import re
import warnings
from collections.abc import Iterator
from contextlib import contextmanager
from typing import Any
import pytest
import torch
from example_models import RandomGraphModel
fro... |
95531369b58a913d62e57763261590916218e248e263b41aaa7ffcb54de46f27 | Python | 28,390 | 683 | """AffineRANSACRegressor.py
Modified version of sklearn RANSAC heavily optimized for runtime and only
supporting regressions utilized by msemalign.
Copyright (C) 2018-2026 Max Planck Institute for Neurobiology of Behavior
This program is free software: you can redistribute it and/or modify it under
the terms of th... |
b6c8b24e89111106dc965605d91cf0c1ee86d3728466f5b1a67da84c80ba0072 | Python | 28,406 | 773 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Handling functional connectivity."""
import gc
import matplotlib.pyplot as plt
import nibabel as nb
import numpy as np
import pandas as pd
from nilearn.maskers import NiftiLabelsMasker
from nipype impo... |
243aa8d3b0a7f5ee5bc83d822af65b653480bcc4e6635e5083f8d55ad2fe45d3 | Python | 28,413 | 734 | __author__ = "quentin"
from collections import deque
from math import log10, pi, sqrt
import cv2
try:
CV_VERSION = int(cv2.__version__.split(".")[0])
except Exception:
CV_VERSION = 2
import logging
import numpy as np
from scipy import ndimage
from ethoscope.core.data_point import DataPoint
from ethoscope... |
2ca8b94d18686564e3d06a453b9a0c52eecc3c2708408a2832b1043c66cde5b5 | Python | 28,434 | 700 | # -*- coding: utf-8 -*-
import logging
from typing import Iterable
from dipy.core.sphere import HemiSphere, Sphere
from dipy.data import get_sphere
from dipy.direction import (DeterministicMaximumDirectionGetter,
ProbabilisticDirectionGetter, PTTDirectionGetter)
from dipy.direction.peaks im... |
9f8d4465589d69161c3508d4bd232cb8cb45aa66708a89cb3508936b54484681 | Python | 28,439 | 650 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Circular spline transformer for autoregressive normalizing flows.
"""
# ======================================... |
b999b6ac3efad111552078fb7e5f2bd5f62362db69699f9a57be96e9313695c0 | Python | 28,456 | 649 | """
Actions to be run at job completion (or output hda creation, as in the case of
immediate_actions listed below.
"""
import datetime
import re
from markupsafe import escape
from galaxy.model import (
DatasetInstance,
HistoryDatasetAssociation,
HistoryDatasetCollectionAssociation,
PostJobActionAssoc... |
14efd5cf4d8c7c187d90c2c797fa896e15ad6cca61617837db1d9c2f7805f331 | Python | 28,475 | 617 | from typing import Optional, Union
from torch_geometric.typing import Adj
import numpy as np
import pandas as pd
import networkx as nx
from tqdm import trange
# from tqdm.auto import tqdm
import math
from scanpy import AnnData
import torch
from torch import Tensor, nn
import torch.nn.functional as F
import torch_geo... |
92f591bf6c8167ee8f3a3390bbad26c009ef208b314ba39417eda4d7be2c92a1 | Python | 28,515 | 783 | """Extraction ARTIFACT v2: bounded manifest + append-only fsynced ledger (extract D1).
Layout: ``manifest.json`` (bounded header: schema/tool versions, status, the
run signature, per-key logical metadata, terminal totals, ledger digest) +
``ledger.jsonl`` (append-only, ONE fsynced line per shard: index, global row
ran... |
3eb0a20886ef9e1ba934484bccf576b433340d0aed3b79ec7f87463da6604018 | Python | 28,529 | 765 | """fp8 (``float8_*``) dtypes: real comparisons, not crashes and not exemptions.
fp8 tensors report ``dtype.is_floating_point == True`` while torch implements no
``isinf`` / ``isfinite`` / ``nan_to_num`` / ``allclose`` / reduction kernels for them.
Every TorchLens numeric path that branched on ``is_floating_point`` the... |
714e93327565e6e2bd3a930c76750d03c96fde03f5d0faafb6817104d379dc2e | Python | 28,529 | 682 | import abc
import builtins
import os
from datetime import (
datetime,
timezone,
)
from enum import Enum
from typing import (
Any,
ClassVar,
Generic,
TYPE_CHECKING,
)
from galaxy.exceptions import (
ConfigurationError,
ItemAccessibilityException,
RequestParameterInvalidException,
)
f... |
5cef8aa4ed172e9b20e013cdf28610c0e13cedee84b263d8d34ff1509fe594eb | Python | 28,530 | 764 | #!/usr/bin/env python3
"""
NEURON 3D RxD on SWC: Ca + CaM reaction-diffusion timecourses
Last updated: 18.9.2026
Authors: Laura Keto and Saana Seppälä
### Description
This script performs three-dimensional reaction-diffusion simulations in
realistic morphologies imported from SWC files using the NEURON RxD
framewor... |
5e16b8f887aefc6a5573ac9be3dc54ddd57af1cb3e85ff2e13c419e229d58e72 | Python | 28,565 | 907 | """Estimation of SPD matrices."""
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.covariance import shrunk_covariance
from sklearn.metrics.pairwise import pairwise_kernels
from .spatialfilters import Xdawn
from .utils.covariance import (covariances, covariances_EP, cospectrum,
... |
4d41e17b7ec24fa2d330ac72985460dbc7a9d330561bc9a9d62cb9ba5098593e | Python | 28,567 | 765 | """Plotly Offline
A module to use Plotly's graphing library with Python
without connecting to a public or private plotly enterprise
server.
"""
import os
import warnings
import pkgutil
from plotly.optional_imports import get_module
from plotly import tools
from ._plotlyjs_version import __plotlyjs_version__
__IMAGE... |
f6e45fad83125a5642c18bacedde8664df5e946f85a8726e3584039d71716aa6 | Python | 28,574 | 736 | import json
import dash_bootstrap_components as dbc
import numpy as np
import pandas as pd
import plotly.express as px
from dash import dash_table as dt
from dash import dcc, html
from codecarbon.viz.units import (
EmissionUnit,
extends_emissions_units,
get_emissions_unit,
)
class Components:
def __... |
f4ca0bdaec8ec540a42f25a42bf42bc2e0898012f798d6db273afc260de435f3 | Python | 28,575 | 768 | """
stim_analys.py
This script contains functions for stimulus comparison analysis.
Authors: Colleen Gillon
Date: January, 2021
Note: this code uses python 3.7.
"""
from sess_util import sess_ntuple_util
import numpy as np
import pandas as pd
from util import gen_util, math_util, rand_util
from analysis import m... |
d72edef9c623fdc0e6d626ef39a000aa6001016fcfae6a87cd871ccdb3d0eddd | Python | 28,580 | 856 | import numpy as np
import scipy
import brian2.only as br
from tqdm import tqdm
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import network
import analysis
import fig2
from functools import partial
from multiprocessing import Manager, Pool
import sys... |
cc1c23219f39d1b4f1fecf17fc0ba595697e930314bed86a11e2ed21deb3e8fc | Python | 28,588 | 799 | #!/usr/bin/env python3
import argparse
import json
import re
import sys
from pathlib import Path
from langchain_text_splitters import (
CharacterTextSplitter,
NLTKTextSplitter,
RecursiveCharacterTextSplitter,
SpacyTextSplitter,
TokenTextSplitter,
)
SEPARATOR_MAP = {
"paragraph_break": "\n\n",... |
c9b6fee03ac44c1a7667d4b8863af716dcc225860dbf9655f93e905e69b9f74c | Python | 28,601 | 844 | """Basic schema tests for the backend-neutral capture IR."""
from __future__ import annotations
import importlib
import subprocess
import sys
from dataclasses import FrozenInstanceError, fields, is_dataclass
from typing import get_type_hints
from unittest.mock import patch
import pytest
from torchlens.ir import (
... |
767571ab8b9ea839adb655a8e0c27459049f7da3b069753b5b3860f4ff30ba94 | Python | 28,604 | 630 | # Import libraries
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
input_annotation_file = 'data/pop_norms.csv'
df = pd.read_csv(input_annotation_file, header=0)
# CSA and TM correlations
from scipy.stats import pearsonr
#df=df[df["TMT PRED AVG"]<20]
#df=df[df["Slice labe... |
9ae17f4f999d27304131c0ede54003e2c5d4814dd8522aac484873c1e85993af | Python | 28,611 | 710 | """Oracle-independence probes: catch corruption the tautological pairs miss.
b9 R74/75-3: a large metadata-invariant class re-derives its expectation from
the SAME canonical CSR edge table the checked fields come from (both sides of
the ancestry recompute read ``_trace_core/relation_views.py``), so a corrupt
edge tabl... |
9f02aed45b75c20be3a87390650914ae75bcb3c6010c4a695baa649e8b0e8c76 | Python | 28,626 | 790 | import warnings
from keras.src import backend
from keras.src import initializers
from keras.src import ops
from keras.src.api_export import keras_export
from keras.src.metrics.metric import Metric
from keras.src.metrics.metrics_utils import confusion_matrix
class _IoUBase(Metric):
"""Computes the confusion matri... |
d39be75fcca62e45556e4adbef3a0f94a5a505a5c6e599165fca01e14dd5fbba | Python | 28,634 | 743 | """Regression tests for r18c bridge/compat adapter hardening.
Covers the depyf prepare_debug contract, tensor_layers explicit-site validation
(A3-14), the extractor/ILG .model unwrap gate (A3-15), dialz
default-method detection, the lovely non-mutating fallback (A3-17), the repeng /
steering contrastive-row contract, ... |
958cd7c9a476662254e3cfe6136e1f2bd530c075a30b30b7624274ec721403ad | Python | 28,637 | 759 | import pandas as pd
import Code_General_utility_spikes_pickling as util
import numpy as np
import matplotlib.pyplot as plt
import os
import scipy.stats as stats
_RES_DPI = 48
_SAVEDATA = False
_X_MARKER_SIZE = 50
_show_excluded = False
dt=0.1
dendrite_information = {}
ID_trunk = [0,1,2,3,4] # IDs of trunk dendrit... |
c65f7853af18d24bfdcee6d0e5f7d09afe3c3375c2fa28b551a920be00ce96e4 | Python | 28,642 | 428 | '''
K-Folding script
author: obanmarcos
'''
from mmap import ACCESS_READ
import os
import os, sys
from config import *
sys.path.append(where_am_i())
import wandb
import lightning as pl
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities a... |
6698e2d69e633fcad53ac198a02d1ab1101d5c21c9897c44f1339a4cdf2bf574 | Python | 28,654 | 772 | from io import StringIO
from os import path as opath
from codegen.datatypes import (
reindent_validator_description,
add_constructor_params,
add_docstring,
)
from codegen.utils import CAVEAT, write_source_py
import inflect
from plotly.basedatatypes import BaseFigure
def build_figure_py(
trace_node,
... |
a8063989f5b77f1b8543839c4f78f3ce28ad1832516c7e9e047db392b0b1f51b | Python | 28,660 | 428 | '''
K-Folding script
author: obanmarcos
'''
from mmap import ACCESS_READ
import os
import os, sys
from config import *
sys.path.append(where_am_i())
import wandb
import pytorch_lightning as pl
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_uti... |
75e635cd55c211a6c5c20f98f8ad963691626f2e97e7faf610a7539b04798c31 | Python | 28,671 | 588 | import os
import scipy.io.wavfile as wav
import h5py
import pickle
import random
import numpy as np
from shutil import copyfile
import glob
import scipy
try:
from scipy.misc import imread, imresize
except:
pass
from functools import partial
import resampy
from PIL import Image
import json
from analysis_script... |
0a549fca0483ea218cb39b7a470f5c280b20f5932abb33d64309fffe986f2aae | Python | 28,684 | 715 | # SOURCE: vendored from https://github.com/woven-planet/l5kit @ main
# (l5kit/l5kit/planning/vectorized/{open_loop_model,common,global_graph,local_graph}.py)
"""UrbanDriver: vectorized closed-loop-trained imitation planner for autonomous driving
(Scheel et al., "Urban Driver: Learning to Drive from Real-world Demonstra... |
d69e0c4c3bfe9de6c80021345e8936a90c61ada5bae47d5d8a7c10a98105300b | Python | 28,717 | 887 | """BrainDecoderToolbox2/BdPy data class.
This file is a part of BdPy.
API list
--------
- Data modification
- add
- update
- add_metadata
- rename_metadata
- set_metadatadescription
- Data access
- select
- get
- get_metadata
- show_metadata
- File I/O
- load
- save
"""
... |
8305d3d8d049511914dc2e23a19f2e7512f70ee827051836e2fb0c7be5589ebb | Python | 28,736 | 750 | """
Tests for the ground-truth DEB equations module.
The module under test is a transcription of Tables S1 (fluxes) and S2 (state
variable dynamics) of the Drosophila DEB model specification. These tests check
the transcription itself, the DEB invariants that follow from it, the embryo
solver, and agreement with the p... |
1713c7ec3fadde977a2747b00c0b116b57d4eea7be4a139a0e26b51cda19f812 | Python | 28,745 | 675 | """r53 hon_2: uninitialized-memory (``torch.empty`` family) value-source honesty.
The ``empty`` factory family (and a GROWING ``resize_``) produces bytes that are
not a function of the recorded computation, yet carried no nondeterministic-source
recognition (r52 finding): an escape was a silent nondeterministic VERIFI... |
db330bcd1df75eedd13c0bbdf25ea4a95f9903b6c4e7c7cbf9d00c343ca99234 | Python | 28,757 | 809 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
class Parcoords(_BaseTraceType):
_parent_path_str = ""
_path_str = "parcoords"
_valid_props =... |
2cc08b7a7076151b769964664f979758e61e6fca9604e41ca9feb395368a07a4 | Python | 28,765 | 679 | """Bounded user-action provenance graph for Galaxy histories.
For each selected top-level history item, resolves its producing
tool_request and that tool_request's declared inputs from the
submission payload, one hop out from the seed.
"""
import json
import logging
from typing import (
Literal,
)
from sqlalchem... |
3d83f9ad93cde52af437be54ef61e5854407ac6552c7133515dfbc339818fd86 | Python | 28,765 | 740 | import threading
from datetime import datetime
from pickle import dumps, loads
from unittest.mock import Mock
import pytest
from celery import states
from celery.backends.base import COMPRESSED_PAYLOAD_MAGIC
from celery.exceptions import ImproperlyConfigured
from celery.utils.objects import Bunch
CASSANDRA_MODULES =... |
cd90d354ca4e251a44cc67e77430452e64342c1eddfbf96e1528f4fe4a5aa066 | Python | 28,797 | 942 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 26 10:46:20 2023
@author: LABadmin
"""
from matplotlib import pyplot as plt
import random
import sklearn
import seaborn as sns
import scipy as sp
from matplotlib import rc
import matplotlib.ticker as mtick
import matplotlib as mpl
from scipy import signal
... |
012a7e286376747036662d390168392da95505cd8c4e0f6230687362e364a0e5 | Python | 28,807 | 511 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... |
0f2af9a4a20334c4d4feb8288a16f0613cb427b4772d156851cda103bbba5f2a | Python | 28,819 | 830 | 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... |
571cdf1bee345cd61224e70020c7bdfa54cf62fd5f2a0cbdb08b1cfda37d939d | Python | 28,836 | 651 | # -*- coding: utf-8 -*-
"""
Implementation of the paper:
- Susin, Eduarda, and Alain Destexhe. "Integration, coincidence detection and
resonance in networks of spiking neurons expressing gamma oscillations and
asynchronous states." PLoS computational biology 17.9 (2021): e1009416.
"""
import matplotlib.pyplot a... |
1b3c5041abbad9d9f1331f0f415edc588e7e6e73fb5aa9f1beb4fc2f56cfb7dd | Python | 28,841 | 897 | """Plotting functions."""
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
from gymnasium import Env, make # using ngym.make would lead to circular import
from matplotlib import animation
from natsort import natsorted
from neurogym import _SB3_INSTALLED
from neurogym.config.components.plo... |
03d201715a42985ad04b8d5a2b250e696517d6683a90d7086823b50bb7cb010d | Python | 28,845 | 446 | """
Parsing algorithm.
Copyright (C) 2021 Tham Cheng Yong
This file is part of NanoVar.
NanoVar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later ver... |
05493cdef828d68b7e63cb8cc431169e6ed903a44c83e54ed9a10f5c445f45b6 | Python | 28,876 | 750 | """L5 M1 pins: encoding-channel core + color_by.
Covers the design-memo 2.5 test list: channel resolution (both phases), the
prepass callable-once counting pin, conflict-matrix pins, legend content +
visibility rule, the collapse-plan-hash pin, the engine-resolution matrix,
the 2.3b rolled-aggregate allowlist color pi... |
ad1dd2ab48e18ae0a269f729ac07072f72c859a8914bb14feae97043fa7469db | Python | 28,904 | 755 | """
Library for loading datasets.
Current classes:
* ZebrafishDataset
author: obanmarcos
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pathlib
from PIL import Image
import re
import torch
import os
from tqdm import tqdm
from torch_radon import Radon
import pickle
from pathli... |
f4eb8d2115f60c2860b2ee8b42ba30bc34bcd405cab740c4fc6516a17c020dfa | Python | 28,927 | 788 | #!/usr/bin/env python3
import argparse as ap
import pandas as pd
import sqlite3
import numpy as np
import sys
import os, errno
import re
import json
import logging
import warnings
from collections import OrderedDict
__version__ = "0.6.1"
def parse_params(__version__):
p = ap.ArgumentParser(
prog=sys.argv[... |
c29950d714bd2063b9dd5b4fdaeb4f6961b31522178787a17a188e681cdf9ca8 | Python | 28,931 | 823 | from os import sep
import networkx as nx
import torch
from tqdm import tqdm
import csv
import pickle as pkl
import os
import numpy as np
from sklearn.metrics import average_precision_score
from analyse_how_to_agregate_attention_heads.analyse_attention_heads import (
get_weight_head_combi,
calc_prop_head,
)
fro... |
9f8609b8087d3d955c460378791a04f974a595fdd03fdf201eb4984f6ccf5ff9 | Python | 28,932 | 828 | __credits__ = ["Andrea PIERRÉ"]
import math
from typing import Optional, Union
import numpy as np
import gym
from gym import spaces
from gym.envs.box2d.car_dynamics import Car
from gym.error import DependencyNotInstalled, InvalidAction
from gym.utils import EzPickle
try:
import Box2D
from Box2D.b2 import co... |
b438780e6faa7f36232867eb4da5ca2a7a6a1738e555dbda3eb1d77c41f840b4 | Python | 28,935 | 564 | import scipy.io
import itertools
import numpy as np
import matplotlib.pyplot as plt
from sklearn import *
from sklearn.model_selection import *
from sklearn.metrics import *
import sys
import datetime
import resampy
import mne
import glob
import os
import seaborn as sns
import pandas as pd
import multipr... |
b00a7edfbeba2aacd24bfe9487cc0aded64e620325a8326b2aaff0b7390c6d3e | Python | 28,943 | 786 | """Test for distribution_lib.py."""
import os
from unittest import mock
import numpy as np
import pytest
import tensorflow as tf
from keras.src import backend
from keras.src import layers
from keras.src import testing
from keras.src.backend import distribution_lib as backend_dlib
from keras.src.distribution import d... |
a7fd2b16d4cb369ffdb06411bd02ae3d79520fe3c38145a0a5095e2fb3c43d78 | Python | 28,944 | 790 | #!/usr/bin/env python3
"""
MCell calcium diffusion analysis using STEPS-based geodesic binning
Last updated: 09.04.2026
Author: Laura Keto
Description
-----------
This script analyzes MCell calcium diffusion simulations by mapping particle
coordinates from MCell output files onto the same tetrahedral mesh used in
the... |
7fe08b0f25fcf37127ff49a06ac85c051110053a77838bd6198f4833ced0b0b0 | Python | 28,953 | 788 | # Copyright (c) 2021 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... |
a4cc15024c7bb2dd8163371d5ad528c5ef02b88d2859a782baae6913e29089c1 | Python | 28,957 | 786 | """Spatial filtering function."""
import warnings
import numpy as np
from scipy.linalg import eigh, inv
from sklearn.base import BaseEstimator, TransformerMixin
from .utils.covariance import _check_est, normalize, get_nondiag_weight
from .utils.mean import mean_covariance
from .utils.ajd import ajd_pham
from . import... |
2b4106c40aec892643a7322bc69033f51b5bef0796fec536306c2aea214604a3 | Python | 28,970 | 678 | #!/usr/bin/python
#-*-coding:utf-8-*-
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use... |
687b46c128a9e8b76784d313e0d387546b726d21b91c34ce2bbc0d94ad2c8658 | Python | 29,008 | 640 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import io
import shutil
import sys
import threading
import time
from contextlib import redirect_stderr, redirect_stdout
from itertools import product
from pathlib import Path
from types import SimpleNamespace
import pytest
import torch
from tests im... |
54d46b1ca64eb650687a8b5cbd142e30b342c447c3f3f49c79fb6812758e5459 | Python | 29,011 | 760 | #!/usr/bin/env python
"""
Unit tests for the Slack notification service.
"""
import datetime
import json
import time
from unittest.mock import MagicMock, Mock, call, patch
import pytest
from ethoscope_node.notifications.slack import SlackNotificationService
class TestSlackNotificationService:
"""Test cases fo... |
f7d53557788e41552a1f078e55155714f00295c94b9a9759558324bf4d512d21 | Python | 29,055 | 725 | from __future__ import division
from __future__ import print_function
from torch_geometric.data import Data
import matplotlib.pyplot as plt
import os
import glob
import time
import random
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
i... |
c460c11ae9c7859f349161097418757ce6255c18d6c8dcdcd25b094cb1b5bec1 | Python | 29,056 | 733 | """.. _lightly-lewm-tutorial-9:
Train a World Model and Plan with It
================================================
A world model predicts what an agent will see after it does an action. In this
tutorial, we train LeWM from
`LeWorldModel <https://arxiv.org/abs/2603.19312>`_ and use it to move an agent
to a goal.
L... |
080dfa49b4a09b80cd83d30a9f25e0edcd72008bc3c6f68089c2cf74e0a473f6 | Python | 29,085 | 767 | """The artifact compatibility LEDGER (ecosystem MEMO 3.1/3.2, build item B1).
One package-owned, dependency-light ledger drives runtime policy, generated
documentation, typed refusals and their remedies, migration planning, and CI.
Nothing loads, refuses, or claims by assertion: every row is backed by the
harvested go... |
bb7a5a7c3982631c8c6f6e28e98c438a9d66413df33782bd0968a3e3fe84288a | Python | 29,086 | 697 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Functions that handle saving and loading of checkpoints."""
import copy
import math
import os
import pickle
from collections import OrderedDict
import numpy as np
import slowfast.utils.distributed as du
import slowfast.... |
92141ae86d7ed43dd574e34122309f97c359fe3d1623a6a4a48f7bf1f4b56da7 | Python | 29,114 | 826 | import math
from abc import abstractmethod
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 (
SiLU,
checkpoint,
conv_nd,
linear,
avg_pool_nd,
zero_module,
normaliz... |
503cce9a2c4f6989caa06d04f7dc6f1328c935be4682ce86767ab0aa6cfd3d1d | Python | 29,138 | 944 | # License: GPL
# Copyright: Alexey Brazhe, 2008,2009
#import matplotlib as mpl
#mpl.use('WXAgg')
from pylab import *
import pylab as pl
import numpy as np
load = np.loadtxt
verbose = 1
def defined(obj):
return obj is not None
provided = defined
def best (scoref, lst):
n,winner = 0, lst[0]
for i, ite... |
ec1432cd2f1f80bfb61381cc61cb9fcfda1ec39051d1110b905a3c43c4bd8704 | Python | 29,148 | 733 | """Evaluation metrics."""
import numpy as np
import pdb
import time
import warnings
import os
import re
import copy
import itertools
from dcCustom.metrics.cindex_measure import cindex
from multiprocessing import Pool
from time import gmtime, strftime
from deepchem.utils.save import log
from sklearn.metrics import roc_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.