sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
dcdadd269ea32ee15fe34311f0f17b165412217269cdb224d4d2f9d006396ae9
Python
4,604
148
from datetime import datetime, timedelta from typing import List, Optional, Union import dateutil.relativedelta from dependency_injector.wiring import Provide, inject from fastapi import APIRouter, Depends, Header from starlette import status from carbonserver.api.errors import EmptyResultException from carbonserver....
4df02892d4f8156adace464f9607de3935fa7b71bf79ba7da888ee2d19100bc9
Python
4,605
183
#!/usr/bin/env python3 import codecs import os import re import setuptools NAME = 'celery' # -*- Extras -*- EXTENSIONS = ( 'arangodb', 'auth', 'azureblockblob', 'brotli', 'cassandra', 'consul', 'cosmosdbsql', 'couchbase', 'couchdb', 'django', 'dynamodb', 'elasticsearc...
7ef46df370b150d3eb94b38ae07cf9b01c35ad01b104b8a9258d4070669fe5be
Python
4,605
102
import glob import h5py import numpy as np import os import pandas as pd from sklearn.linear_model import RidgeCV from sklearn.model_selection import GroupKFold from sklearn.linear_model import LinearRegression from sklearn import preprocessing import sys from scipy.stats import pearsonr """ This script will run ridge...
db43e529b67badfadc281922d2ee4c165dc55345e68b46a1ae20872048591fc5
Python
4,605
101
from keras.src import initializers from keras.src import ops from keras.src.quantizers.geometry import EinsumProjectionGeometry from keras.src.quantizers.modes.common import apply_bias_activation from keras.src.quantizers.quantization_config import TernaryQuantizationConfig from keras.src.quantizers.quantized_weight im...
e3dfb219c7b99e455703a7319bac0856a06460318fa9a381d4480f09c2274d47
Python
4,605
114
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
1cb0a48fc35d08cb1d41b3a9b619508c5f05a6d2485f7bee466aa59c15579e78
Python
4,606
129
import os import numpy as np import pandas as pd import torch from tqdm import tqdm from typing import Tuple from torch import Tensor from torch.utils.data import Dataset from e3fp.fingerprint.generate import fprints_dict_from_mol from e3fp.fingerprint.db import FingerprintDatabase, concat from e3fp.fingerprint.fprint...
bc17d0bb6ab7a7bd806c1dfd56c7f169c67471a80a757063c2e4382aac5497f8
Python
4,606
155
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Functions for generating the executive summary.""" import numpy as np from nipype import logging LOGGER = logging.getLogger('nipype.utils') def plot_gii(mesh, coord, color, slicer, view, max_distance...
5a92de74d9208f75fa85494bcc12b576ccda6f7852ac784440e13e5326cf60a6
Python
4,608
138
# 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...
b5216a22aa9733ffcb992ec659af77a93e55a39abadb545f4fd1832801fd600e
Python
4,608
165
from tempfile import TemporaryDirectory import numpy as np import polars as pl import pandas as pd import seqpro as sp import xarray as xr from pytest import fixture import seqdata as sd import zarr def read_fasta(file_path): """ Reads a FASTA file and returns a dictionary of sequences. Parameters: ...
817b2d7c62a5310eadc50f980da168a576baa490641160bebc34925cf2249e3f
Python
4,609
142
from keras.src import backend from keras.src.api_export import keras_export from keras.src.optimizers import optimizer @keras_export("keras.optimizers.SGD") class SGD(optimizer.Optimizer): """Gradient descent (with momentum) optimizer. Update rule for parameter `w` with gradient `g` when `momentum` is 0: ...
d74acce7997466c1694d8ad1a11081b09feb46f2bf082a057ac64d908376e67a
Python
4,609
130
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 ops from keras.src import testing class FlattenTest(testing.TestCase): @parameterized.named_parameters( [ {"tes...
58f3ae65b55fd0d92598b6f05afc4fdb6d87bf3124391cec0063b142e165f711
Python
4,610
156
"""Coordinate Attention for efficient mobile networks. Paper: Coordinate Attention for Efficient Mobile Network Design. Hou, Zhou, and Feng, CVPR 2021. Coordinate attention factorizes global pooling into height-wise and width-wise 1D encodings. The two encodings share a bottleneck transform, then produce direction-a...
6fcd99d3d93c1dc42a94d44149172c960018b128995df139e57be2a1ed33aa1a
Python
4,610
131
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import torch import torchvisi...
ce05491080eab071249fff66be184fbdac00c5a835cf486e980c0a0e89429772
Python
4,610
165
"""Functions for generating synthetic data.""" from collections.abc import Callable from typing import Literal, cast import dask.array as da import numpy as np import zarr from skimage import data from skimage.filters import threshold_otsu from skimage.measure import label from skimage.segmentation import clear_borde...
212147ddeba9a5991c381381b0cffad6dedf18d1ca83cece82a0dabbfad357f3
Python
4,615
119
from unittest.mock import patch import pytest from sqlalchemy.exc import OperationalError from sqlalchemy.orm import Session from celery.exceptions import BackendStoreError @pytest.fixture def db_retry_app(celery_app, tmp_path): """Fixture to set up a Celery app with a database backend and retry configs.""" ...
333b188d7c17cd141b2ef4283da6465c0277f9e6d5be13635926cf6647f3aaee
Python
4,615
139
# 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...
1215889a99acaea6577ec83b14e8e151d4e931adae12621e4e84ba3821d1a356
Python
4,616
129
import warnings import numpy as np from neurogym.envs.registration import make from neurogym.wrappers.noise import Noise from neurogym.wrappers.pass_action import PassAction from neurogym.wrappers.pass_reward import PassReward from neurogym.wrappers.reaction_time import ReactionTime # TODO: No tests exist for wrappe...
215911853fc15ba04de634f1668f5050e6841f229501959a7b168371604b31ec
Python
4,616
171
"""Featurizers to use with the preprocessors""" from collections import defaultdict import rdkit from rdkit.Chem import AllChem # nfp features copied to remove dependence on nfp if these are updated def get_ring_size(obj, max_size=12): if not obj.IsInRing(): return 0 else: for i in range(max_...
7111b4fcb7b29b930eb1d558f15c84b13033c6d98b0f9a3abfd959f0d05dd9ce
Python
4,616
145
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Line(_BaseTraceHierarchyType): _parent_path_str = "ohlc.decreasing" _path...
a1f27b0838cd96f6c4a730e71870393ecc2adee7011b4552fac27dca3d8dfe35
Python
4,616
145
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Line(_BaseTraceHierarchyType): _parent_path_str = "ohlc.increasing" _path...
45bfdc1d7b9022868aabd7f0ca3ec5356b6e9237f37e73896f3d67914a4557c9
Python
4,617
121
"""Tests for documentation-plan structural link checks.""" from __future__ import annotations from scripts.check_plan_link_consistency import find_invalid_s2_6_citations def _v33_like_plan(citation_range: str) -> list[str]: """Build a plan fixture whose §2.6 table matches v33 line placement. Parameters ...
68dc4b36997c49cfa3dc85ad4bf7e9e73cba1c282ae5ce62dd22e8b8225828d3
Python
4,617
126
#Autor: Carlos Alberto Hernández Nava #ASVspoof2017 spectrograms MFCC 1D import cv2, sys, os, gc import librosa import numpy as np import pandas as pd import seaborn as sns import openpyxl as pxl import tensorflow as tf from tensorflow import keras import IPython.display as ipd from numpy.random import randn from pand...
a58dffb28c363c6416073c1ee5bb85193d9413462ccd8fe26a2ea4b58fc8f373
Python
4,617
158
"""Recommender model.""" from __future__ import print_function import sys import numpy as np import theano.tensor as T from theano import function, shared __author__ = "Gianluca Corrado" __copyright__ = "Copyright 2016, Gianluca Corrado" __license__ = "MIT" __maintainer__ = "Gianluca Corrado" __email__ = "gianluca.c...
c9d00477aca43abc3cf0b8997a7097d8fd7f9aa88c22f47842726451cc2782dc
Python
4,617
127
"""Branch coverage for feature modules and the graph-export prep (#272). Uses the real bundled PBF data and derives malformed inputs from it (dropping a column / using a no-data bbox) to exercise the validation / no-data / warning branches that the happy-path tests don't reach. """ import pytest from geopandas import...
f86a5de3af0173929512e1ecdde7cf24e3e8605ad84e89abfceb3ab9ac1f820c
Python
4,617
141
# import torch.nn.functional as F from dataclasses import dataclass, field import torch import torch.nn as nn # from dgl.nn import GCN2Conv, GraphConv @dataclass class Args: dataname: str gpu: int = 0 epochs: int = 1000 lr1: float = 1e-3 wd1: float = 0.0 lambd: float = 1e-3 n_layers: int...
3c6161e92d3f7175d7e179bf2a832000bfa1416d390fe639f40373ba0612297a
Python
4,618
136
"""Behavioral tests for debug cost ranking, byte model, compile counting, and audits.""" from __future__ import annotations from collections.abc import Iterator import pytest import torch from torch import nn pd = pytest.importorskip("pandas") import torchlens as tl # noqa: E402 from torchlens.debug import audit_...
8956d93572ae23578b8dc4fbb6728f90c32f75a0cd22c075ba767ebcd4743393
Python
4,618
164
""" Kullback-Leibler Importance Estimation Procedure (KLIEP). """ from numbers import Number from numpy import arange, asarray, inf, log, mean, ones from numpy.random import choice, permutation from .RuLSIF import compute_kernel_Gaussian from .density_ratio import DensityRatio, KernelInfo def KLIEP(x, y, sigma="au...
dcec43ced2e483cb134ebe780d10160ab702d46463522ba11796b73e3b2a8409
Python
4,618
157
import argparse import json import warnings import pandas as pd from galaxy_ml.model_persist import load_model_from_h5 from galaxy_ml.utils import clean_params, get_scoring, read_columns from scipy.io import mmread from sklearn.metrics._scorer import _check_multimetric_scoring def _get_X_y(params, infile1, infile2):...
777d19b7e1eb90d00279698199f2054978ac0e06e81b1c8b9e85165fc0a36c23
Python
4,619
114
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
8a5c7205cc8e2d4b4b04a6564050e04a96427e85ca60c232acbc4bf9701e940b
Python
4,619
110
import torch from torch import nn class PairwiseDistances(nn.Module): """ Layer for computing the pairwise distance matrix. Matrix is quadratic and symmetric with entries d_ij = r_i - r_j. All possible atom pairs are considered. This Layer is particularly used in the nn module. Returns: ...
18f53e0312cb34c17eb7e7092b4cc8228c6ab9493d551e5e7e7d5a96d2a1d096
Python
4,620
171
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Perform Hypermutation analysis based on Hypermut v2.0 @author: Ce Gao """ import re import logging from Bio import SeqIO from scipy.stats import fisher_exact # pylint: disable=C0103 # Invalid constant name logger = logging.getLogger('pipe.hypermut') def get_pos(p...
4bd9cc0a7b62be74c86cbe36b3da9809d968409d99f94c5af6ab203250ddb192
Python
4,620
160
# --- 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 Bounds(_BaseLayoutHierarchyType): _parent_path_str = "layout.map" _path...
63091cda15367b4c6ca29ff70fa53e2f667b5b32e825246bd01acf227fbc87b1
Python
4,620
138
from abc import abstractmethod import torch from torch import Tensor, nn from chemprop.nn.hparams import HasHParams from chemprop.utils import ClassRegistry __all__ = [ "Aggregation", "AggregationRegistry", "MeanAggregation", "SumAggregation", "NormAggregation", "AttentiveAggregation", ] cl...
cc0aa6d264ca1db43d8699ea3cf869eafcf9480f62d12d5baf8b096eb4074632
Python
4,620
134
"""Regression coverage for fast-pass output population.""" from __future__ import annotations import torch from torch import nn import torchlens as tl class _SelectiveSaveModel(nn.Module): """Small stable graph with an explicit output node.""" def __init__(self) -> None: """Initialize deterministi...
00ba2ab28d403b60d0eea341d4ec14c4c65eb0338d5e075d49bbe4c8863f28ee
Python
4,621
144
# --- 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 Transition(_BaseLayoutHierarchyType): _parent_path_str = "layout" _path...
779fdb6643967e60e3561f9ef27d1da823d75a11d97ae95487bbecc2e0d980c2
Python
4,621
145
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Line(_BaseTraceHierarchyType): _parent_path_str = "funnel.connector" _pat...
11086069b3b3a050b07b2f8fb65349f8b4ffe03556acffbe0d0dec786085dc73
Python
4,623
147
import os from types import SimpleNamespace import h5py import numpy as np import torch import torch.nn as nn from modular_splicing.models.motif_models.types import motif_model_types from modular_splicing.motif_names import get_motif_names from modular_splicing.utils.construct import construct import modular_splicin...
290fc3c7df7e78720975f11e76af611e7fa9652f68f0cb1e49d5c0213c252d44
Python
4,623
116
from contextlib import AbstractContextManager from typing import List from uuid import uuid4 from click import UUID from dependency_injector.providers import Callable from fastapi import HTTPException from carbonserver.api.domain.emissions import Emissions from carbonserver.api.infra.database import sql_models from c...
423930641a69e6809d17656b7a1defe4ca3b1ba89c8e9152c45f603c890d1437
Python
4,624
145
# --- 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 Line(_BaseLayoutHierarchyType): _parent_path_str = "layout.selection" _...
482aa76f01484328c720fd4fcde9831ace45d501c0d13d2cd41384a0b6e4741f
Python
4,625
97
import torch import copy import utility import data import model import loss from option import args from trainer import Trainer from torchinfo import summary from thop import profile, clever_format torch.manual_seed(args.seed) checkpoint = utility.checkpoint(args) def main(): global model if args.data_test...
516ef380840af51a8a924d46d727f75c883128fc2e1fb50cb31a1df0622e8b15
Python
4,625
125
# SOURCE: vendored from yael-vinker/SceneSketch @ master # https://github.com/yael-vinker/SceneSketch # https://raw.githubusercontent.com/yael-vinker/SceneSketch/master/models/painter_params.py # # Vinker et al. 2023 (ICCV) "CLIPascene: Scene Sketching with Different # Types and Levels of Abstraction" -- the official r...
520b8fb1b2792bb3f0f9fe7db4d00b33e72ebf00d2d1dc57cf5ff466563ae73a
Python
4,625
99
# MNIST-SVHN multi-modal model specification import os import torch import torch.distributions as dist import torch.nn as nn import torch.nn.functional as F from numpy import sqrt, prod from torch.utils.data import DataLoader from torchnet.dataset import TensorDataset, ResampleDataset from torchvision.utils import sav...
aff7a87def1855a0e8f9a81bf6e444a732468bcf2f0e472d1a1bcd0ee824a0d0
Python
4,625
122
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import copy import pytorch_l...
f78059d0f8c88968a80afb2fa41bc05ec20783342d03a717e7ff09d481e7058c
Python
4,625
126
import io from matplotlib.figure import Figure from matplotlib.backends.backend_qt5agg import ( FigureCanvasQTAgg as FigureCanvas) import nanite.fit as nfit import numpy as np from PyQt5.QtWidgets import QApplication from PyQt5 import QtCore from .. import units from ..head import custom_widgets class MPLEDel...
73691e6e84c00a924c1480aba9dda4f476d3194c4d8cd5999fa197374ad719ee
Python
4,626
127
from typing import List, Tuple import torch from pytorch_lightning import LightningModule from torch import Tensor from torch.nn import Identity from torchvision.models import resnet50 from lightly.loss.vicreg_loss import VICRegLoss from lightly.models.modules.heads import VICRegProjectionHead from lightly.models.uti...
34f4b6ae8a2f91c776a3c39e10d353c2aa55ee2eecccfe7346fbc193f087b5c1
Python
4,628
170
import logging import os from typing import Callable, Dict import gc import numpy as np import pandas as pd import torch import torch.nn as nn def _list_available_layers( model: nn.Module, key_word = None ) -> list: """List the available layers in a model Parameters ---------- model : tor...
c9800c72b4556e41df1dd7cdf821a5f40e0b457b6128472a26e1d207e04a4acd
Python
4,630
145
#!/usr/bin/env python3 """ PIN Migration Utility for Ethoscope Node Migrates existing plaintext PINs to secure hashed format using bcrypt. This utility should be run before enabling the new authentication system. Usage: python migrate_user_pins.py --help python migrate_user_pins.py --dry-run python migrat...
0bf4961683271abf6eeaeae142d224fda405f14e3ab32f02028842489c38e897
Python
4,631
156
""" Plot stimulus weights as a function of lags """ import matplotlib import matplotlib.pylab as pl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns matplotlib.rcParams["pdf.fonttype"] = 42 sns.set( style="ticks", font="Helvetica", font_scale=1, rc={ ...
28a34733c6444bd2abea8d4085018a7dc44d416d18544f699b588d5d7024d62e
Python
4,631
95
import sys import os # setting path sys.path.append('../TM2_segmentation') import numpy as np import pandas as pd import nibabel as nib from skimage.transform import resize, rescale from scipy.ndimage import zoom from settings import target_size_unet, scaling_factor import matplotlib.pyplot as plt from scripts.prep...
5d7f3b9c3b0ed1bf26ee0984f2bf7c7a6ac387cb66fe9361a3ff9539d3b872a3
Python
4,631
129
#################################################################################################### # Translated from matlab: # Original script by Boris Bernhardt and modified by Casey Paquola # Translated to python by Jessica Royer # # geoDistMapper Compute geodesic distance between parcel centroids and all other...
77c6038d84dad86d43bad62ef98b957f5e52fc39faa0a9fcf87cc44687abb0b0
Python
4,631
102
# Copyright (c) 2023, Tri Dao. import math import json import re from pathlib import Path from collections import OrderedDict import torch import torch.nn.functional as F from einops import rearrange from transformers import GPT2Config, AutoConfig, PretrainedConfig def remap_state_dict_hf_btlm(state_dict, config)...
d5654afbd2f9c163479f146b527a59489fed1442ef407519b2beaf914780a335
Python
4,631
110
""" Leaky Integrator Rate Neuron Model ================================== The `leaky integrator <https://en.wikipedia.org/wiki/Leaky_integrator>`_ (LI) is a standard model for neuronal dynamics. It has been used for spiking as well as rate neuron models. Here, we introduce a rate-coupled LI neuron model. It has a sing...
043f911e3482615ff089cdd90193b7e780f356b576b8841930fdb31d193f5ae0
Python
4,632
136
import subprocess import sys import time import argparse import os import shutil from datetime import datetime import sys from PyQt5.QtWidgets import QApplication, QWidget, QTextEdit, QPushButton, QVBoxLayout, QHBoxLayout, QFileDialog from PyQt5.QtGui import QPalette, QColor from PyQt5.QtCore import Qt # i...
7dbe2969306bcee56769aba67b2ce1ac0404fd8b683b89f7535d4feb79d06983
Python
4,632
142
#!/usr/bin/env python3 """Refuse a push whose outgoing commits ADD an internal-notes path. This repo is PUBLIC. The ``no-internal-notes`` pre-commit hook blocks ``git add`` of a private path, but it is deliberately scoped to the commit stage: at pre-push the same path matcher would also fire on DELETIONS of those path...
02a5a4451be499752f811ec7a46ee774817f8100a3992ab2efdf2c1699b86d7c
Python
4,635
140
# import graph_tool as gt # from graph_tool.centrality import pagerank from interpretability.utils import ( get_attentions_map_simple, get_weight_head_combi, set_hook_to_get_attention_map, load_sequences, load_model_and_vocab, ) from tqdm import tqdm import numpy as np from analyse_how_to_agregate_a...
09acc26b6dc0b1d0114914c841d73ff5fb8c3be3dbb01acef440f433aab24951
Python
4,635
123
import pandas as pd from sklearn.utils import shuffle def binarize_data(df): num_cols = list(df.select_dtypes(exclude=['O']).columns) df.loc[:,num_cols] = (df.loc[:,num_cols] > 0.0).astype(int) return df def customized_cv_index(train): young_1 = train.loc[train.target==0, ].animal.unique()[0] youn...
2bdac709e5de175fcf15ee5f912ecced78a6fd65b252bd068883a3f75530c607
Python
4,635
116
""" org_drug_times.py Finds drug application times from Open Ephys Message_Center-904.0 dir. Return drug times from metadata dict for select drug applications. """ import pathlib import os import math import pandas as pd import numpy as np #########################################################################...
38836d5e50d814d65592378b0a7817ab09e79760d1bf63d9888645c1354bf370
Python
4,636
145
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Line(_BaseTraceHierarchyType): _parent_path_str = "waterfall.connector" _...
58d9cdf644201093ebeecff3e51ea002a8f022c6810b14839b53de17c9a17b5d
Python
4,636
128
import pytest from rpy2.robjects import packages from rpy2.robjects import rl from rpy2.robjects.vectors import StrVector try: from rpy2.robjects.lib import dplyr has_dplyr = True msg = '' except packages.PackageNotInstalledError as error: has_dplyr = False msg = str(error) datasets = packages.imp...
8e80635fa9db2c4122be4409ceae114b8d49e1f42c9670d80aabdd6aa9180205
Python
4,636
146
# ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test objects and function of the ``tfep.nn`` package. """ # ==========================================================================...
a57ab6042f46c376e705a0010f66bdbd7a1ff3e005b89fe8414dfc2327b54d4f
Python
4,636
126
from collections import OrderedDict from bmlab.session import Session, get_valid_source, get_session_file_path, \ BmlabInvalidFileError, is_session_file from bmlab.controllers import EvaluationController import h5py import numpy as np import errno from ..util import hashfile, hashobj def load_h5(path): """L...
1cdd60ab93b4bc68546d03ae445400042dd5c3eadea75d9472f8ad7742a73b3b
Python
4,637
141
from dolfin import * from rm_basis_L2 import rigid_motions set_log_level(10) def elastic_stress(u, E, nu): "Define the standard linear elastic constitutive equation." d = u.geometric_dimension() I = Identity(d) mu = E/(2.0*((1.0 + nu))) lmbda = nu*E/((1.0-2.0*nu)*(1.0+nu)) s = 2*mu*sym(grad(u)) ...
391b008980e945b3a608ae18eab08c6268bb6ce0982b1a4448fe4ae719a96890
Python
4,637
116
#!/usr/bin/env python """ Extract sequences from a GFF3 file. This works for examlpe with the GlimmerHMM GFF3 output format: #gff-version 3 #sequence-region Glarea 1 38755942 Glarea GlimmerHMM mRNA 1017 1644 . - . ID=Glarea.path1.gene1;Name=Glarea.path1.gene1 Glarea GlimmerHMM CDS 1017 1126 . - 2 ID=Glarea.cds1.1;Par...
b5df10407c17ebc51fa559d48fe8eb9f7f5f06dfbd400feca319628413a85017
Python
4,638
116
import sys import torch import numpy as np from torch.autograd import Variable class DataBasicLoader(object): def __init__(self, args): self.cuda = args.cuda self.P = args.window # 20 self.h = args.horizon # 1 self.d = 0 self.add_his_day = False self.rawdat = np.load...
45542d34a002eb892d75fb3575636ac76e09eb8f9bc549eabdb047c1c6fd2c8b
Python
4,639
253
def check_index(crm_file): from pprint import pprint as pp o_crm = open(crm_file) chr_dic = {} first_line = True chr_count = 0 for line in o_crm: split_line = line.strip().split('\t') start= int(split_line[1]) chr = split_line[0] try: chr_dic[chr]....
1106abe88fbf94032b2ebfcc33bf1179dc5c451befe99275463b3e7c39903325
Python
4,640
119
"""A09 agent stage-0 item 4: the analytics WIRE PATH runs without pandas. Four of the six ready-made debug analytics returned DataFrames, so any agent/MCP consumer of ``pip install torchlens[mcp]`` served tools that ImportError'd unless the pandas extra happened to be present. The fix is a pandas-free rows core per an...
9e8442829e3dd2056487a7865e64e97fc7298042779710ac5883d1136e343192
Python
4,640
139
""" Usage example for models defined in models.py. Change the variable 'network_name' to evaluate the other networks. By default SonoNet32 is evaluated. The example images used for this script are from the test set from experiment III-A in "Real-Time Detection and Localisation of Fetal Standard Scan Planes in 2D Free...
e22bf88ebbe981b00b280c6a4214a9ecfb3bdc09d544ce380d3e504edb63f988
Python
4,642
145
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Title(_BaseLayoutHierarchyType): _parent_path_str = "layout.legend" _pa...
2e7ab61cb50fbeef1dfe2f1ed527b701ade923bdf2cabf7123b27410737c3fa2
Python
4,643
105
""" core.feature_spec — Canonical feature pool definitions. The classifier consumes 17 features in a fixed order: - 4D state-geometry channels (`CHANNELS_4D`): I_A, org, I_M, rel_alpha (I_R retired from the production pool — see "I_R retirement" below.) - 10 established / candidate EEG-AD markers (`FEAT...
5d646b9e5e66f5b1847a22de1ce2984ba3d9d4d178bfbca7542bb0aae3fb85cc
Python
4,643
127
# 05/23/2023 Fengyao Yan # construct a deep learning model and train the model for tissue deconvolution. import os import pickle import pandas as pd import numpy as np import random import tensorflow as tf from scipy.stats import pearsonr from sklearn.preprocessing import MinMaxScaler from sklearn.utils import shuffle...
856632ce31e554361472707ed1e9cef4ea562dc7207160c6591db24439abbace
Python
4,643
113
#!/home/ubuntu/miniconda2/bin/python from __future__ import division import sys import glob, os, gc import uuid import os.path import csv import numpy as np from time import time from subprocess import (call, Popen, PIPE) from itertools import product import shutil import re import pickle from boto3.session import Ses...
96f9dd5b67377796f458d5bbb20dadcf5bf34c351b1c2b32a3598bf19ddccce0
Python
4,643
137
# coding=utf-8 # Copyright 2022 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...
b532cbd9c86502b27af0817663a1881d035ccfbab5230c3dbc4d49a66dc48448
Python
4,643
142
"""L5 M6 pins: rendering L1's ``Layer.shape_summary`` (across-pass shape row). The data is L1's (memo 1.2: ONE field, slate-7.3 semantics, rendered VERBATIM); L5 renders it as one plain-text row directly after the title row on rolled multi-pass nodes whose passes vary in shape, escaped by the S5 choke point like every...
51ded72ae4acbf852c2de5a3b0db69479219ee81478a18398b4a8978cdea4612
Python
4,644
133
"""Utility scripts for pydeface.""" import os import shutil import sys from pkg_resources import resource_filename, Requirement import tempfile import numpy as np from nipype.interfaces import fsl from nibabel import load, Nifti1Image def initial_checks(template=None, facemask=None): """Initial sanity checks."""...
b8af805a3f5b657a1cde3b5dd9137992121093477f97b8f13cc9cffa6751b126
Python
4,645
130
from keras.src.backend.config import backend if backend() == "torch": # When using the torch backend, # torch needs to be imported first, otherwise it will segfault # upon import. import torch from keras.src.api_export import keras_export from keras.src.backend.common.dtypes import result_type from ke...
33886f8e15e518c81cbf1d2b7272a68e1d11750412274171c944d530e4ffb40a
Python
4,647
102
import numpy as np from os.path import exists, join, basename from ovseg.utils import io from os import environ, sep, listdir import pickle from ovseg.data.utils import split_scans_random_uniform, split_scans_by_patient_id from ovseg.data.Dataset import Dataset class DataBase(): def __init__(self, val_fold, prep...
bce8782da275bbf7bbabb7c7cedbac7d4a1d733cbc885d1a3fb3169c47861d97
Python
4,647
117
import os from argparse import ArgumentParser from pytorch_lightning import Trainer, seed_everything from pl_bolts.models.self_supervised.ssl_finetuner import SSLFineTuner from pl_bolts.models.self_supervised.swav.swav_module_cifar import SwAV from pl_bolts.models.self_supervised.swav.transforms import SwAVFinetuneTr...
52dd95c1edf27719f7664649d8bd4bc5130a739f8c998b5d27f6509a3b02c0c6
Python
4,648
103
import tensorflow.keras.backend as K from tensorflow.keras.layers import Conv1D, Conv3D, BatchNormalization, Activation, Lambda, Dense, Input, Cropping1D, add from tensorflow.keras.models import Model from Configurations import CNN from Utilities.common_packages import np ''' Keras part: https://stats.stackexchange.co...
61e1378fb07417a3d7352f8a924ec8cab3e761b8e50480d09b74e920da370d2d
Python
4,648
143
import pandas as pd import numpy as np import scipy.stats as st import yaml import os from sklearn.preprocessing import StandardScaler import scipy as sp # def load_datasets(dataset_file): # datasets = defaultdict(dict) # # with h5py.File(dataset_file, 'r') as fp: # for ds in fp: # for arra...
a67607f1f4d0d55796b8ecf88d35726ccfc131cda7f2d4eaf4a64a055caf59b4
Python
4,648
122
import mne from mne.channels.layout import _find_topomap_coords from mne.io.pick import _pick_data_channels, pick_info from mne.viz.topomap import _GridData import numpy as np import collections import functools class memoized(object): '''Decorator. Caches a function's return value each time it is called. If c...
b2362525af4975b900ba9a4a55ede3535f9e550c0f86d34b642ecdba6e92a356
Python
4,648
134
"""Persistence honesty: the intervention-spec door validates, gates, and keeps edge addresses. WT1 A-IV item 20 (lane A08): the intervention-spec load door silently discarded ``FireRecord.edge_address``; ``save_intervention`` had no settled- outcome gate; and ``spec.json`` deserialized with no structural validation (a...
eac3ecdfdd7a330978142c67d762bbf078ace5038ad1f3067e50e58922284d75
Python
4,648
151
""" Interactive dashboard to inspect any model configuration available """ from __future__ import annotations from typing import Any import holoviews as hv import pandas as pd import panel as pn from holoviews.streams import Buffer from panel.template import DarkTheme from larvaworld.lib import reg from larvaworld....
66409cb87e222a13eb1f3912ffb03859ead5d659d3a431a2d750b31e035a1b65
Python
4,649
135
# This example requires the following dependencies to be installed: # pip install "lightly[timm]" # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import pytorch_lightni...
edba88dd5bbab725625d97a7ec3909a022e85358449aee90ca819453c86750fd
Python
4,649
98
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
ef5d0e018a7bf801e5b31b4dcaf030ded8044d28aff914d0aa53675bd27a46f5
Python
4,649
152
"""Bounding Box Utils""" from __future__ import annotations # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved class BoundingBox: """Class which unifies different bounding box formats. Attributes: x0: x0 coordinate (normalized to [0, 1]) y0: y...
3f1ce9cc557a9f42cc26f2ecb5c9effd43fb76c109f24eeec7f65a43471618d6
Python
4,650
144
"""server.py model server example Usage: server.py test [options] server.py [options] Options: -p --port=<port> The port number to communicate over [default: 5795] -h --host=<host> The host name to communicate over [default: localhost] -s --socket=<socket> A socket file to use, instead o...
d538c955d6c385007836c8ca9a638fde3b23e525402846f193f88f943d932e5f
Python
4,650
109
# 2022/2023 Josue Page Vizcaino pv.josue@gmail.com """ This script processes XLFM data by deconvolving the images and saving the resulting volumes to disk. It takes in several command line arguments, including the path to the data folder, the path to the PSF file, and the indices of the images to use. It also takes in ...
92df23d6e60e236892a439ecef352c5f93530bd4a5c28f5078188cc6f0531f48
Python
4,651
116
"""F16 B3: the ported truncation protocol (treescope memo section 4). Pinned regressions from the memo's test plan: port equivalence against upstream on the measured shapes AND a non-default ``doubling_bonus`` (dropping the fifth parameter silently changes which cells are visible); truncation-budget provenance (OUR 4,...
28f1c1a0fc66f5c620f0848249679fff3f4bf3244c36e230cd70d8adc0d0ed8d
Python
4,652
147
"""Tests for built-in MLP/FFN recipe behavior.""" from __future__ import annotations import pytest import torch from torch import nn import torchlens as tl from torchlens import trace as trace_fn class FFN(nn.Module): """Tiny transformers-4.57+ DistilBERT FFN block (lin1/lin2 children). transformers >= 4....
bfaf2780ccdf5c56f356ef65c4e519ed46649f094275a690e6182d97545fc956
Python
4,652
141
import unittest from modular_splicing.evaluation.evaluation_criterion import MultiEvaluationCriterion from modular_splicing.dataset.generic_dataset import dataset_types from modular_splicing.evaluation.run_evaluation import evaluate_model_on_data from modular_splicing.models_for_testing.list import AM, FM from modular...
345fea6ba360e7bf5d2da50855c16e94a736c9c28c9c8a5531f655d065a08876
Python
4,653
129
#!/usr/bin/env python """ Tool for playing (and augmenting) single samples or samples from Sample Databases (SDB files) and DeepSpeech CSV files Use "python3 play.py -h" for help """ import os import sys import random import argparse from deepspeech_training.util.audio import get_loadable_audio_type_from_extension, A...
e1b41cfb694fa16d01cc3c6cc7149e07f2ca756905302c416510e4515142775b
Python
4,653
101
"""5. Getting Started with Pre-trained SlowFast Models on Kinetcis400 ===================================================================== `Kinetics400 <https://deepmind.com/research/open-source/kinetics>`_ is an action recognition dataset of realistic action videos, collected from YouTube. With 306,245 short trimme...
44b83a04d51cfdc8af4fc0f0277e261634723be5c1210f5a6401141df59bd0a8
Python
4,654
145
from typing import Optional, Tuple import torch from pytorch_lightning import LightningModule from torch.nn import functional as F from torchmetrics import Accuracy from pl_bolts.models.self_supervised import SSLEvaluator class SSLFineTuner(LightningModule): """Finetunes a self-supervised learning backbone usin...
274d22a1434140289eaadc74b6e0b083faf6eae7305012351be2586e35e42c7a
Python
4,655
142
from .MarkovModel import MarkovModel import sympy as sp import numba as nb from numba import njit, cfunc import numpy as np import numbalsoda from numbalsoda import lsoda, lsoda_sig # Simplest Artefact model containing cell capacitance class ArtefactModel(): def __init__(self, channel_model, C_m=20e-3, R_s=30): ...
cef4f99aafcc1aba13821117984ff12ccaf519db11fd5380ecde4efe3be1f09b
Python
4,655
136
# -*- coding: utf-8 -*- import os import glob from re import search from Bio.SeqIO import parse from numpy.lib.function_base import select import pandas as pd import argparse from utils import remove_files, clean_len_exaa from preprocess import run_preprocess from generate_interlayer_vec import run_generate from calcu...
9eb0fbae58d7660a40221174fd3f5e056d538f57e5e068cd0fd103f825b06ece
Python
4,656
139
# 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...
f3f4f7124a34e899565a075ad1143df5ab223c484570f6264ccf75bd51d42c10
Python
4,656
115
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (leoxiaobin@gmail.com) # Modified by Bowen Cheng (bcheng9@illinois.edu) # ------------------------------------------------------------------------------ fro...
2025b1f413aa2f6f230d0abdb88083cf8c29e042a66edd695ed1f28bba0daca9
Python
4,662
112
from model.SLD.encoder import Encoder from model.SLD.IC_encoder import ICNet from model.SLD.reducer import Reducer from model.SLD.ode_func import ODEFunc from prodict import Prodict import torch import torch.nn as nn from torchdiffeq import odeint_adjoint as odeint class TDNODE(nn.Module): def __init__( s...
5a12386c50994110671b2af98ef06ebb9ab0d9253ab29407ad5582643917a8ee
Python
4,662
134
""" This part of the code was originally published by mahmoodlab and adapted for this project. https://github.com/mahmoodlab/CLAM Lu, M.Y., Williamson, D.F.K., Chen, T.Y. et al. Data-efficient and weakly supervised computational pathology on whole-slide images. Nat Biomed Eng 5, 555–570 (2021). https://doi.org/10.1038...
b73abcbda2c9eb6ab10936317f258c12c9cad3d47dcbdd31bd23acb1eaa79311
Python
4,663
125
# %% ''' Extracts regions based on SPM results. Saves ROI masks and a list of centroids. Looks at con_0006 ('threat reversal') and con_0007 ('safety reversal') specifically. Be mindful that this script needs 'supervision', e.g., to hand label each ROI which may change depending on the exact parameters (namely cluste...