sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
102c7d3c62a48764979e60a403f90333c142ecf539b9772caf94d9394d368610
Python
2,180
56
import numpy as np import pytest import gym from gym.vector.sync_vector_env import SyncVectorEnv from tests.vector.utils import make_env ENV_ID = "CartPole-v1" NUM_ENVS = 3 ENV_STEPS = 50 SEED = 42 @pytest.mark.parametrize("asynchronous", [True, False]) def test_vector_env_info(asynchronous): env = gym.vector.m...
4d170ce5ed6d6fd1ad8eab5243ce6d81cae5b6817b944e967f177ea14f8b1275
Python
2,180
69
from keras.src import backend from keras.src.api_export import keras_export from keras.src.layers.merging.base_merge import Merge @keras_export("keras.layers.Minimum") class Minimum(Merge): """Computes elementwise minimum on a list of inputs. It takes as input a list of tensors, all of the same shape, an...
6ed08910a3884245f68f5f5bafec7be7ad7999ea5e73a30f29e0e0e94d216a46
Python
2,180
53
""" tool_audit_battery — Backward-compat shim. Historical diagnostic_*.py scripts in this testsuite import `_fit_lda`, `load_cohort`, and `_data_path` from a sibling `paper_disorder_angle/` testsuite via: TA_DIR = os.path.join(..., "paper_disorder_angle", "analyses") sys.path.insert(0, TA_DIR) from tool_a...
8f933238d6c90926f993eb47d78d5ce14b646b80cee478e72b3e40ef66a362db
Python
2,180
79
'''========================================================================= ' ' Copyright NumFOCUS ' ' 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.o...
d70ffe1ebd4f88603c72e57f42ec6707ce261652c43c20591905e918dd863ddb
Python
2,180
78
import json import logging import os import pwd import re from autouri import AutoURI from .dict_tool import merge_dict logger = logging.getLogger(__name__) RE_ILLEGAL_STR_LABEL_CHRS = r'[\:\?\*]' SUB_ILLEGAL_STR_LABEL_CHRS = '_' class CaperLabels: KEY_CAPER_STR_LABEL = 'caper-str-label' KEY_CAPER_USER =...
420db0e6d48f6858a560a67bab534aad4a13a2ed714a17c9d79dc166c91f965e
Python
2,182
69
from keras.src import backend from keras.src.api_export import keras_export from keras.src.layers.merging.base_merge import Merge @keras_export("keras.layers.Maximum") class Maximum(Merge): """Computes element-wise maximum on a list of inputs. It takes as input a list of tensors, all of the same shape, a...
7710d9ba8e6f225288ba63e5df7961cbef9857cb1a3c08458f83334d023d9c76
Python
2,182
65
# Purpose of this script is to write the functions that help facilitate # subsetting of the data depending on the users input import numpy def printOut(text, fileName="stdout.txt", close=True, file=None): """Prints to the specified file name. Used for debugging. If close is Fale, returns open file. """ ...
c83a314625d966d838da6e6f55f156b9f93c500959c4fe04538f41fcb3a53f20
Python
2,182
69
import pandas as pd import numpy as np from sklearn.metrics import log_loss, roc_auc_score, auc, precision_recall_curve, precision_score from tqdm import tqdm tqdm.pandas() from drug_interactions.utils.calc_metrics import calc_average_precision_k, calc_mrr def load_df(path, dataset_type=None): if dataset_type is ...
f1589e13d76f7ae271de915e2ecd6e19a12e3a5483cfca2419d7f15d1de9e47e
Python
2,182
85
import networkx as nx from pyvis.network import Network from matplotlib import pyplot as plt def visualize_scene_graph(relations, save_path, use_pyvis=True): objs = set() for rel in relations: objs.add(rel[0]) objs.add(rel[1]) G = nx.DiGraph() for obj in objs: G.add_node(obj) ...
8f06c3d9ad66fce550c7364963fbcd7ecc17d458256ef3741008f8bd8a44dea3
Python
2,183
56
###################################################### # This file prepares the DGSplicer data set for use # # in CMKN experiments. The script assumes that # # positive and negative sequences are provided in # # different files. # # ...
3adb0e37a27cbfd459bb56c84dff92786bd392b905ef5d42deedd1787ea16c00
Python
2,184
58
''' Example to generate a population of cells from input files''' import json import os import tns from tns import extract_input def get_log_data(mtype, number_of_cells, params, output_path): '''Creates log and returns it. If output_path saves the data in json ''' from tns.version import VERSION as...
53114272cf6ee538993758982e990d7a0ea5126a97bc9499033b1688d2991186
Python
2,184
68
import pickle import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init # from utils.modules.lightWeightNet import WeightNet from . import lapar_weightnet as LW def make_model(args, parent=False): return LAPAR_A(args) class ComponentDecConv(nn.Module): def __init__(self...
7eb672572f5884acd86264ad4e93c47796832df87490a59e867a174acf1e6f75
Python
2,184
68
import pickle import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init # from utils.modules.lightWeightNet import WeightNet from . import lapar_weightnet as LW def make_model(args, parent=False): return LAPAR_B(args) class ComponentDecConv(nn.Module): def __init__(self...
b4b38761d84ef85b3381553e34537a848233babca273f1a4a70af162f3d04c44
Python
2,184
57
import torch import torchvision.transforms as transforms from torch.utils.data import DataLoader import utils.data_transforms as data_transforms from utils.datasets import DiffusionDataset def batch_mean_and_sd(loader): cnt = 0 fst_moment = torch.empty(3) snd_moment = torch.empty(3) for images, _ in...
be85dc31ae56d14172de601c8204044fa349c303b2ab95d080a4dc99b602f975
Python
2,184
68
import pickle import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init # from utils.modules.lightWeightNet import WeightNet from . import lapar_weightnet as LW def make_model(args, parent=False): return LAPAR_C(args) class ComponentDecConv(nn.Module): def __init__(self...
2ac624bfb4fb8cce3e44c2a21598e86d2b244d122b7d0d292ca257fc89f06988
Python
2,185
58
# Copyright (c) 2024 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...
9f05afac36acf72f9a7e7c4d46b929a26db783d332ba197f004619999a4f6d35
Python
2,185
82
"""Morris-Lecar neuron, 1981. Morris and Lecar's barnacle muscle-fiber model integrates voltage and potassium activation with voltage-dependent calcium, potassium, and leak conductances. """ from __future__ import annotations import torch from torch import Tensor, nn class MorrisLecarNeuron(nn.Module): """Eule...
ab08344c5118dbd87a2ccb8301876e6b308446af1febc7b5b23bdfe4aae29431
Python
2,185
88
#!/usr/bin/env python3 """ Command-line client for the Ethoscope light daemon. Talks to ``ethoscope_light.service`` over its Unix control socket. Useful for diagnostics, manual override during maintenance, and scripts. Examples: ethoscope-light on ethoscope-light off ethoscope-light release ethoscope-...
b8afcab41e07af86ecae56748589892b66dce8321936f50d5a98086058f15005
Python
2,185
73
import os import subprocess import bbi from modular_splicing.dataset.datafile_object import SpliceAIDatafile import modular_splicing from modular_splicing.dataset.additional_data import DatafileReferencingAdditionalData PHYLO_P_DATA_WEB = "rsync://hgdownload.cse.ucsc.edu/goldenPath/hg19/phyloP100way/hg19.100way.ph...
e21a241f7fe8ee437c148b620df74b42eee54856740692147f35a29d5e5e4398
Python
2,185
71
"""The lightly.models.modules package provides reusable modules. This package contains reusable modules such as the NNmemoryBankModule which can be combined with any lightly model. """ # Copyright (c) 2021. Lightly AG and its affiliates. # All Rights Reserved from lightly.models.modules.heads import ( BarlowTwi...
21109732bf7cb31a14e5c55c31caee4f76d42d7115441e931db4071010a726b5
Python
2,186
79
#!/usr/bin/env python3 """ """ import pytest from caper.cromwell import Cromwell def pytest_addoption(parser): parser.addoption( '--ci-prefix', default='default_ci_prefix', help='Prefix for CI test.' ) parser.addoption( '--gcs-root', default='gs://encode-test-caper', help=...
a67895fdf22c5f398c68c544b6f14a858abdf583dbca1d90f2cbefdf2b598d2b
Python
2,186
83
""" Records describing a replay source and its prepared frames. """ from __future__ import annotations from dataclasses import dataclass, field from typing import Any, Literal import pandas as pd from larvaworld.portal.datasets.models import ( WorkspaceDatasetRecord, WorkspaceReplayDatasetRecord, ) Replay...
abedb471ddcb246322b2a4f12745faf8df999cd19f5af939e70d1fff4dfc8348
Python
2,186
65
import os import numpy as np from mirp._images.rtdose_image import RTDoseImage from mirp._masks.base_mask import BaseMask from mirp.extract_features_and_images import extract_features_and_images, extract_images CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) def test_basic_rtdose_feature_extraction(): ...
0d3c08aaaaf575e45daa45bdf35857d8c86142f2077599177fa8ed83e3f1cccb
Python
2,187
64
'''Tests for dataform''' import os import tempfile import unittest import numpy as np from bdpy.dataform.sparse import load_array, save_array class TestSparse(unittest.TestCase): def test_load_save_dense_array(self): payloads = [ [(10,), 'test_array_dense_ndim1.mat'], # ndim = 1 ...
4e6cae19e5dfb9e133cadf71922ea0899045593119c580de97cb34d6ad0c5026
Python
2,187
77
"""Update postgresql trigger to use clock_timestamp function NOTE: This migration will not be applied on SQLIte. Revision ID: a91ea1d97111 Revises: f070559879f1 Create Date: 2025-06-09 12:21:53.427419 """ from alembic import op from galaxy.model.migrations.util import _is_sqlite # revision identifiers, used by Al...
9e7307ced0c49854bda26bf2b69d177ce8448420a6fa5add812a6df9366d2cfa
Python
2,187
72
# 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...
2514cee0131bd7ab5b22dc54e75fe4baab84baddf6eeca064fa6d854ba72ad57
Python
2,188
61
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
4d57c7b9cd2aa9de06b00790ec229d18aa7aaa9e35106ed6a64cb694534c9b97
Python
2,188
65
"""Regression tests for the agent-index clamping of the annotated track plots. `track_annotated_data` defaults to plotting agents 3, 4, 5 and 6, which raised an IndexError on any dataset holding fewer than seven of them - including every short tutorial run and the `track` graphgroup built on top of it. """ import pyt...
85e0920936825ab442c963cdac9a965a539881863edb21701728e54f32f113ee
Python
2,189
67
import os import pytest from mirp._images.ct_image import CTImage from mirp._masks.base_mask import BaseMask from mirp.extract_features_and_images import extract_features_and_images, extract_images CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) @pytest.mark.ci def test_basic_ct_feature_extraction(): ...
8702de98ee9601ca01dc0eef9cde1f032efa5e7c79e7a4216640a39a0666749f
Python
2,189
73
import warnings import unittest import logging from pmsurv.models.exponential_model import ExponentialModel import tests.syntheticdata warnings.simplefilter("ignore") logger = logging.getLogger(__name__) class TestSamplers(unittest.TestCase): def get_data(): lam_ctrl = 1 lam_trt = 2.5 k ...
0108da62c04bbfe4de259a0b4d8fe9a2b4b62ca3d404aeb9806370ebe85308e4
Python
2,190
57
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
6150d9ab6ab85a36249155b4a7607b44ff3141487556044865441977c9a47ea2
Python
2,190
60
# generate a pipeline file for creating multiple sequences based on iterations, # when multiple solutions to TSP exist. # different solvestrs represent different preprocessing of the percent matches matrix. # based on the same loop structure in workflow.bash order-iter import argparse ## argparse parser = argpar...
bc5f962c23fb661255dc83ccf7e4073d9d9686423a1402c46c44a8e1a098bf5e
Python
2,190
75
import numpy as np from gym import utils from gym.envs.mujoco import MuJocoPyEnv from gym.spaces import Box class ReacherEnv(MuJocoPyEnv, utils.EzPickle): metadata = { "render_modes": [ "human", "rgb_array", "depth_array", ], "render_fps": 50, } ...
cee7a1acbe7b121a5830343b66855b26778066da743f95cc3a4748675efe8dd0
Python
2,190
76
import dataclasses import getpass import requests from codecarbon.core.api_client import ApiClient from codecarbon.external.logger import logger from codecarbon.output_methods.base_output import BaseOutput from codecarbon.output_methods.emissions_data import EmissionsData class HTTPOutput(BaseOutput): """ S...
239884967cb2125f89c8aec3fa4477691d963bccc35b028b842db62821b493ee
Python
2,191
54
#!/usr/bin/env python """Custom data types for simplifying data communication.""" import itertools import statistics from collections import namedtuple from typing import List, Union import numpy as np try: from mpi4py import MPI except ImportError: MPI = None StatBundle = namedtuple("StatBundle", ["numb_co...
376871e1d49906e4e85682dd5420079566e5a1f65779305002f9ba9a45f4ca29
Python
2,191
79
from torch_geometric.data import Data class Multi_Data(Data): """ A class for loading multiple datapoints from a pytorch geometric dataset ... Attributes ---------- h : list, tensor, array the features of each node in the graph edge_index : list, tensor, array defines the ...
bcceb3440d5f254bacedf89eae0edefb3fd3d15b53ea385f6658981f2e7e0185
Python
2,191
61
""" CREaTor Copyright (C) 2023 Microsoft Research This program 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 version. This program is distributed...
c9b2cafc1cb995d621d9dca04664238a0871d35a8c66e2861ca5975daae734bd
Python
2,191
60
import os import h5py import numpy as np import scanpy as sc from dca.api import dca from scbig.utils import read_data, setup_seed, louvain, calculate_metric for dataset in ['10X_PBMC','mouse_bladder_cell','mouse_ES_cell','human_kidney_counts','Adam','Human_pancreatic_islets','Macosko_mouse_retina']: print('----...
52b6903d5d62b3639ec609166cd08c36342588bd7988fe41ac72f3cfc496ce4f
Python
2,192
56
import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from models.mn.utils import collapse_dim class MultiHeadAttentionPooling(nn.Module): """Multi-Head Attention as used in PSLA paper (https://arxiv.org/pdf/2102.01243.pdf) """ def __init__(self, in_dim, out_dim, att...
732523bc05a5fc7d6ee75054bf5c276adaeca32dfbccb1930fb82fddf251242d
Python
2,192
80
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 24 16:04:35 2021 @author: fcheng """ import os import cv2 import numpy as np from eval.image_process import img_process, normalise_img def MakeRegressor(image_name, path_to_regressor, regressor, img_size, normalization=1, redness=None , ...
cbf149aef1f206700e2f8c5a426fa9fb5d986ca319d4dab30c2eed8fc5f04f05
Python
2,192
57
from typing import Union import gymnasium as gym from angorapy.common.postprocessors import StateNormalizer, RewardNormalizer, BasePostProcessor from angorapy.tasks.wrappers import TaskWrapper, PostProcessingWrapper from angorapy.utilities.core import env_extract_dims def make_task(env_name, reward_co...
b664cf21ab37d3e69cc0baabb56e5958d8c7d2db8e46ba001c19a582db7d774d
Python
2,194
89
import os import fire from .grab_sequence import grab_sequence from .create_datafile import create_datafile from .create_dataset import create_dataset def full_pipeline( *, ref_genome, splice_table, sequence_out, data_segments, data_dir, CL_max=10_000, SL=5000, ): grab_sequence( ...
7a71cb15f6c18537c84bbb954d0f3782d7631943bddcd074cca6b4729a5469b0
Python
2,195
82
""" Portal apps for inspecting and building models and environments. """ from __future__ import annotations from .model_inspector_app import _ModelInspectorController, model_inspector_app from .model_inspector_data import ( BASELINE_MODULES, DEFAULT_LIVE_PREVIEW_REPORTER_KEYS, LIVE_PREVIEW_REPORTER_KEYS, ...
07424e4efbb73ed084da1a04ee8ba434966b03010e354facab285fac0af591ff
Python
2,196
78
""" Math utils """ from math import sqrt import numpy as np from scipy.spatial import cKDTree # The smallest representable positive number such that 1.0 + eps != 1.0 # around 1e-7 for float32 EPS = np.finfo(np.float32).eps def norm(vector): """Returns the norm of the numpy array""" return sqrt(vector.dot(vec...
4bde031b241fbabcc94713502096d9e6438ffdf269c8f5f1fec414b7da0a341a
Python
2,196
89
import hvplot.pandas import numpy as np import pandas as pd import panel as pn from panel.template import DarkTheme import larvaworld.lib.model as model M = model.NeuralOscillator module_attrs = ["input", "activation", "output"] title = "Neural lateral oscillator" sidebar_width, sidebar_height = 400, 500 widget_kws =...
a045e63ae8cde0c4142fafe3ddf946d9825530bc9f15a91dc32f35054f91be2a
Python
2,196
87
''' load the RBNS data ''' import csv import re import h5py import urllib3 import urllib import gzip from io import StringIO import requests import numpy as np import time from utils_rbns import create_datapoints rbns_data = 'metadata_rbns.csv' encode_dir = 'encode/' data_dir = 'data/' protein_idx_map_txt = 'protein...
09eb0d3cfbe554ce47fa2eaa78e8733c94008d71d3edd8ae972e4cfb88886989
Python
2,197
79
""" Rendering and visualization on a pygame display """ from __future__ import annotations from typing import Any from importlib import import_module __all__: list[str] = [ "drawing", "rendering", "side_panel", # Commonly used symbols expected at package level (legacy surface) "ScreenOps", "...
6f6e81324ae24cedc4e620f471c5f9df77aa9d7c4ae61f4c03d864593eb79462
Python
2,197
65
"""Smoke tests for chord_unlock routing to quorum queues. Reproduces Celery Discussion #9742: when chord_unlock is routed to a quorum queue via topic exchange, it may not be consumed even if declared and bound. """ from __future__ import annotations import pytest from pytest_celery import RESULT_TIMEOUT, CeleryTestS...
9649da632e405898e2a8a7e181685012894df1ee020dee6294d0e90b995e9f0c
Python
2,197
68
# -*- coding: utf-8 -*- # tests for toy_graphs.py """ @author: Quentin Lutz <qlutz@enst.fr> @author: Nathan de Lara <nathan.delara@polytechnique.org> @author: Thomas Bonald <tbonald@enst.fr> """ import unittest from sknetwork.data.toy_graphs import * class TestToys(unittest.TestCase): def test_undirected(self):...
7611586f15a5b372440919724c46a6a6ba7fd8a7c5e83b62034ddf566fdb6fa6
Python
2,198
76
from .bulletin import Bulletin from bs4 import BeautifulSoup class Goa(Bulletin): def __init__(self, basedir): statename = 'GA' super().__init__(basedir, statename) def get_urls(self, url: str): try: html = self.get_url_html(url) except: prin...
1960cb4f69537077c1a5738900e90a647e14083d213721c7348b85e2f9086c04
Python
2,200
59
import spikeinterface.full as si import numpy as np from pathlib import Path import shutil import subprocess from probeinterface import ProbeGroup from probeinterface import write_prb, read_prb from scipy.io import savemat from sorting.readSGLX import readMeta def unlock_files(directory): # Find the process IDs us...
08b5115bb68d3f78d71a249fa1d22a77864081eedee8ad79b0046c2f148bb34d
Python
2,201
54
import glob import h5py import numpy as np import os import pandas as pd from sklearn import preprocessing import sys """ hi. this is going to read these in, you basically just need subjects: path to subjects! data_path: path to the actual features phenotypes: path to a csv with the to-be-predicted and the noise """ ...
d7ab879f3985f4e2e1c2b6a2a544f9d3a520529cef7083066c52ab749560525a
Python
2,201
57
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
3b92cc7dc531c61da85adeb612cf257a4a86366f5e0f533bd5a569d983826139
Python
2,202
65
import os.path as osp import torch import torch.nn.functional as F import torch_geometric.transforms as T from torch_geometric.datasets import Planetoid from torch_geometric.logging import init_wandb, log from torch_geometric.nn import GCNConv device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') cl...
6836c7e03d97bb26868ed4634cb4213730a501c2d974908a4873bcc5b6529850
Python
2,202
62
from pip._vendor.packaging.utils import canonicalize_name class FormatControl(object): """A helper class for controlling formats from which packages are installed. If a field is falsy, it isn't set. If it is {':all:'}, it should match all packages except those listed in the other field. Only one field can...
7852ac7d12574eb8c952cd49f09c39edfb83cc260983eaa1d6a567958284b755
Python
2,202
75
import attr import more_itertools from permacache import permacache, stable_hash import tqdm.auto as tqdm import numpy as np from .utils import second_half_of_spliceai_cached @attr.s class FullTable: values = attr.ib() indices = attr.ib() @indices.validator def check(self, _attribute, _value): ...
abd017add69914e46f0fcfc017ad51c3d07d79fd87d15f969036ddd82bcc7da2
Python
2,203
61
# Copyright (c) 2025, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri Dao. # SM120 (Blackwell GeForce / DGX Spark) forward pass. # # SM120 uses the same SM80-era MMA instructions (mma.sync.aligned.m16n8k16) but has # a smaller shared memory capacity (99 KB vs 163 KB on SM80). This module subc...
490118531111ad123e2a6487e070e7ae8243f74c63c9cf3cf71b2ff1fe49312d
Python
2,204
54
'''Script for running and analysing simulation experiments comprised of multiple simulation runs.''' # © Thomas Akam, 2023, released under the GPLv3 licence. import os from concurrent.futures import ProcessPoolExecutor import analysis as an import model as md # Run simulation and save data to disk. def run_experime...
91edf9822d8ce1fa68cf50ba482b617360a229ea6dd2c21fddb9836248502a8e
Python
2,204
80
from logging.config import fileConfig from alembic import context from sqlalchemy import engine_from_config, pool from carbonserver.config import settings # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # this will overwrite the ini-fil...
d706b9b83446579eb93d36a74319034c9feb67db75d1cca2db27affbbe713585
Python
2,204
93
from __future__ import annotations from typing import Any import hvplot.pandas import numpy as np import pandas as pd import panel as pn from panel.template import DarkTheme import larvaworld.lib.model as model __all__: list[str] = [ "lateral_oscillator_app", ] M = model.NeuralOscillator module_attrs = ["input"...
0c095d57089e99fb759fc8641ba55fc1eaa2cfe710571e4a450ed316eda42471
Python
2,206
77
# --- 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 = "choropleth.selected" ...
9ad5bdb0e917847abf2ba44042f4b0076b52b5eabac3be35dfe91a70a7407391
Python
2,206
48
import os import numpy as np import cv2 import argparse parser = argparse.ArgumentParser('create image pairs') parser.add_argument('--fold_A', dest='fold_A', help='input directory for image A', type=str, default='../dataset/50kshoes_edges') parser.add_argument('--fold_B', dest='fold_B', help='input directory for image...
e80c815c69e63dc1295719cc2ae4117dc76ee09df74a5b020a07898d1f437351
Python
2,206
79
import numpy as np from neuron import h, gui from neuron.units import ms # The tests "thread variables". Thread variables are how global variables in # THREADSAFE code are implemented if they're not read-only. The idea is that # each thread has it's own copy of the global, with zero synchronization. # # The test work...
3514f6be9c272309943faaa2215d8fb46602e2e69d3e7b37a7c5cf1ba3ab2ea2
Python
2,207
72
import easygui import threading from telnetlib import Telnet class DoCamera(threading.Thread): ''' to kind-of automatize the camera action... ''' def __init__(self, ip='20.100.0.201', port=6802): super(DoCamera, self).__init__() self._state='RECORDING' self.current_counter = 1 ...
7ded729c16ed42cccecd19c3ff77ef52df11dc0161caf8b0f0ef8c5dac70fbfa
Python
2,207
83
import numpy as np import matplotlib.pyplot as plt from library.Tempotron import Tempotron import time def demo(): # # Input patterns (X) and labels (Y) M = 700 N = 500 T = 500 num_iter = 2000 lr = 0.005 nsp = 3 assert N % 2 == 0 assert M % 2 == 0 minus_gpid1 = np.random.perm...
f7a9c9bc5d10dc38024f46e7c6bd2781dfdec4c335c006d7353d78b63d8b8c39
Python
2,207
90
import numpy as np from neuron import h, gui from neuron.units import ms # A test that demonstrates the behaviour of `net_move` and # `flag`. # # The `flag == 0` means that an external event was received. Therefore, we send # 2 external events at times `1.001` and `2.001`. External events increment the # counter `y`;...
7257dc6e1bced4eb02cfebcc707961fe1ca3a21fd9adb8bcf7d6bc4ed5913617
Python
2,208
71
from flask import send_file from flask_restplus import Namespace, Resource, reqparse from flask_login import login_required, current_user import datetime from ..util import query_util from database import ( ExportModel, DatasetModel, fix_ids ) api = Namespace('export', description='Export related operat...
392ad6134813d0070f2382ca9942fe0657e0e44af19e34b7778acf36703adff6
Python
2,209
57
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on March 2019 @author: Thomas Bonald <bonald@enst.fr> @author: Quentin Lutz <qlutz@enst.fr> """ import unittest from sknetwork.data import karate_club from sknetwork.hierarchy import Paris, cut_straight, cut_balanced, aggregate_dendrogram # noinspection PyM...
e8db8096899e03291c3661de2c47bb2c2ff22176a7154a590cea952f1f45cae7
Python
2,209
75
from __future__ import annotations import pytest from pytest_celery import CeleryBackendCluster, CeleryTestWorker, CeleryWorkerCluster from celery.canvas import Signature, chain from celery.result import AsyncResult from t.integration.tasks import StampOnReplace, identity from t.smoke.tests.stamping.tasks import wait...
38192c4db4194790e313429562e0e3601d536c757e124426f1e401c95c6a4ee4
Python
2,210
92
""" Abstract base class for cli job plugins. """ from abc import ( ABCMeta, abstractmethod, ) from enum import Enum from typing import TypeAlias try: from galaxy.model import Job job_states: TypeAlias = Job.states except ImportError: # Not in Galaxy, map Galaxy job states to Pulsar ones. clas...
9bae754dcb989d770cacb076d2e345fb896b5ca56d0be0e74a2ba16035c2a98b
Python
2,210
55
from .version import __version__ from . import models from . import datasets from .models.utils import pretrained_settings from .models.utils import model_names # to support pretrainedmodels.__dict__['nasnetalarge'] # but depreciated from .models.fbresnet import fbresnet152 from .models.cafferesnet import cafferesne...
f63a37ec0b417a2c86b08fce5326b1773793c9168fcec4b6e486f945934f3270
Python
2,210
67
""" A tool to backup incrementally one source to one destination directory. It copies files to the destination if and only if they are larger than in the destination """ from optparse import OptionParser import os import shutil import glob import time def copy_one_file(src, dst): src_size = os.stat(src).st_siz...
672dd564ab6ce2ff25b442337b1cd4e2a9b1022c7d8ef274d172804aa9be1617
Python
2,211
59
import os import pandas as pd from sklearn.preprocessing import MinMaxScaler import numpy as np def file_name(file_dir): for root, dirs, files in os.walk(file_dir): # print(root) # 当前目录路径 # print(dirs) # 当前路径下所有子目录 return files # 当 def casefile_clean(): file_list = file_name('/home...
1e713c0fbd9d30de669dc608b728b560fe02466b528ac8986b8402980b1856ee
Python
2,212
70
#!/usr/bin/env python """ Input: Molecular input file. Output: Physico-chemical properties are computed and stored as metadata in the sdf output file. Copyright 2012, Bjoern Gruening and Xavier Lucas """ import argparse import sys import cheminfolib import openbabel from openbabel import pybel openbabel.o...
58f35628b4c87f53b5fcb17c42ca329212f3e94e35626448a3772dcde4eabb2c
Python
2,212
74
import os from unittest.mock import patch import pytest from click.testing import CliRunner from celery.bin.celery import celery @pytest.fixture(autouse=True) def clean_os_environ(): # Celery modifies os.environ when given the CLI option --broker memory:// with patch.dict(os.environ, clear=True): yi...
69fd1620eb157899577ef79afa7f2ffc536398a7ccfe87f8632f93a3f9c33c56
Python
2,212
65
import tensorflow as tf import tensorflow_graphics as tfg def multi_point_euclidean_distance(a: tf.Tensor, b: tf.Tensor): """Calculate mean euclidean distance between flattened points in 3D euclidean space. Args: a (object): Tensor of shape (BATCH, FLATPOINTS); missing batch dimension will be ins...
bde1b3c26d3f140b0c7deed1a7c7009e203095dbf0f58e502c791b636befd792
Python
2,212
80
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["splicepoint_model_spec"] = dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepoint-model-donor-1", ) msp.architecture["motif_model_spec"]["motif_...
c739cf32d6c18aa5fb97c0f24a2cc4ccd3e7d8b93aa5361ddc45347cc7d9b5b5
Python
2,213
69
#!/usr/bin/env python import unittest import numpy as np from wyrm.types import Data from wyrm.processing import lda_train, lda_apply class TestLDA(unittest.TestCase): def test_correct_classlabels(self): """lda_train must throw an error if the class labels are not exactly [0, 1].""" data = np...
d8678f5efb9355ecaea78ae64a025b2be3e2a2fdc8cb5bb32d4d5b0842d894e7
Python
2,213
74
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict( type="ResidualStack", depth=3, ) msp.arch...
8b30b83aca1bdda512719f45e09002410842dafdf1f66a2f5014335c9928306f
Python
2,214
63
# -*- coding: utf-8 -*- import os import numpy as np import pandas as pd # Tanimoto def tanimoto(v1, v2): ab = np.dot(v1, v2) a_norm = np.dot(v1, v1) b_norm = np.dot(v2, v2) result = ab/(a_norm+b_norm-ab) return result def calc_tanimoto(ref_df, search_df): ref_vecs = ref_df.values tm...
479cf3b98d90492a34a0d0497114706369f49ab234e66c2922e5e8f036f663b7
Python
2,215
72
import sys import csv import powerlaw import simulatorutils import utils def GetPathlengths(simulations): PathlengthXYZ = [] pathlengthdata = utils.CalculateDistPerCellPerTimeStamp(simulations) for dataPoint in pathlengthdata: ID = dataPoint['track ID'] path_ = dataPoint['DistXYZ'] ...
4cc10f802341d487004cce1156e991229c3d22e96b3f6c28fd18a6d2fef67489
Python
2,215
55
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
f885634681197c9887e538bab3f3a1c39e396adf2dd9736caf142a4b31fa8c26
Python
2,215
76
""" # > Implementation of the classic paper by Zhou Wang et. al.: # - Image quality assessment: from error visibility to structural similarity # - https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=1284395 # > Maintainer: https://github.com/xahidbuffon """ from __future__ import division import numpy as np im...
4f908292f49c411a09f18f32b188fa4c3be8e0e9a9eda9f5a44a7906118097e1
Python
2,216
61
#!/usr/bin/env python3 '''Takes a bunch of types training files. First argument is what index the receptor starts on (ligand is assumed to be right after). Reads in the gninatypes files specified in these types files and writes out two monolithic receptor and ligand cache files for use with recmolcache and ligmolcac...
7070a7b702809f211fe8c386dcd40cf1418e1cbbad90b364dfaa42bf55523ac2
Python
2,216
75
import os import sys import argparse import matplotlib import matplotlib.image import numpy as np import tables sys.path.append("../../../") # Code adapted from Mineault et al. 2021 # This script builds the PVC1 dataset def derive_pvc1(args): root = f"{args.data_root}/crcns-pvc1" movie_info ...
fef6c8194987538e139c2ed04e7cbbfefc2317cf4078a2469ae62a1c490f2138
Python
2,216
72
# 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 pytorch_lightning as p...
55e482f99172072723ac98eadd6373c5144a9e2db12d35979a70290038c82b01
Python
2,217
50
"""Tests for spiketools.spatial.information""" from spiketools.spatial.information import * ################################################################################################### ################################################################################################### def test_compute_spatial_...
60c3c0861c31850e647047677ed8825c1f4e4df86593d8644b41ce7e6ca284ac
Python
2,217
61
''' train / test df for Jensen et al.'s model. ''' import pandas as pd from reaction_numbering import * def make_csv_friendly_labels(product_idxs): ''' The csv file doesn't like a list of an array. So we're transforming them into strings. ''' csv_friendly_label = '' for i in range(len(product_idxs...
c1be0a25ea1b987e4631cae0142c99f1e44d8c045d40a62ba2f0ba39009fbf6a
Python
2,217
62
import os from PIL import Image from torch.utils import data from torchvision import transforms class DefaultDataset(data.Dataset): def __init__(self, root, transform=None, return_path=False, test_list=None): if test_list is not None: with open(test_list, "r") as f: test_files...
c3aed9f4b0c47f1edf1c414d72f34c8cfa3f8baf2068947733446d7c8eb5b81e
Python
2,217
60
# 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...
10963fe314e2ffeab316ca99264827c0bb5ea1a91d929440733cdd30219e5ded
Python
2,218
72
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for Weisfeiler-Lehman""" import unittest import numpy as np from sknetwork.data import house, bow_tie, linear_graph from sknetwork.data.test_graphs import * from sknetwork.topology import color_weisfeiler_lehman, are_isomorphic class TestWLKernel(unittest.Test...
3f95df036a7d8e215411b59a500578549c51cec84d0338ae1b60b3bea92b088c
Python
2,218
67
# 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...
7c956a6fca9ac34e52d21b8ae96bf279bcdbb5b64f2574c0265b86ac018e6616
Python
2,218
78
from pathlib import Path from setuptools import find_packages from setuptools import setup this_directory = Path(__file__).parent long_description = (this_directory / "README.md").read_text() setup( name='angorapy', version='0.10.8', description='Build Goal-driven Models of the Sensorimotor Cortex with E...
7cab9ff13fb96d184149bc820e348930887bc4ede2f9c1d861e726c362a60741
Python
2,218
62
""" Author: Derek van Tilborg -- TU/e -- 09-06-2022 Script for bayesian optimization of model hyperparameters using 5-fold cross-validation. """ from MoleculeACE.models import RF, SVM, GBM, KNN, MLP, GCN, MPNN, AFP, GAT, CNN from MoleculeACE.models.optimize import BayesianOptimization from MoleculeACE.benchmark.con...
822b992a45fc788ff6315032df0c01bdc9a6983c523a8f24f5e033bb6400eaea
Python
2,218
72
#!/usr/bin/env python # coding: utf-8 import sys import re import numpy as np from .amira_header import AmiraHeader from .amira_data_stream import DataStreams, write_amira class AmiraFile(object): """Convenience class to handle Amira files This class aggregates user-level classes from the :py:mod:`ahds.hea...
815a7aafb5b890c93346aeca5c18b0a4f4d26ab2ca467bd1a700509aa8ead129
Python
2,219
69
"""IOU loss""" import torch from torch import nn class IOULoss(nn.Module): """ Intersetion Over Union (IoU) loss which supports three different IoU computations: * IoU * Linear IoU * gIoU """ def __init__(self, loc_loss_type='iou'): super(IOULoss, self).__init__() self...
6531800276bfec3ca8c5e6fc11f3ea5408528e16f06f29bfe233ddddabae22bf
Python
2,220
70
# -*- coding: utf-8 -*- import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt fontsize = 22 plt.style.use('seaborn-colorblind') plt.rcParams.update({'font.size': fontsize, 'font.family': 'sans-serif', 'font.sans-serif': ['Arial'], ...
e37d67f9287a3932dc357fcf4032ad628ac7658d1a728054d318b7599e25931b
Python
2,220
67
# -*- coding: utf-8 -*- import numpy as np import pickle as pkl import scipy.sparse as sp # from scipy.sparse.linalg.eigen.arpack import eigsh from scipy.sparse.linalg import eigsh import sys, os import torch import re import string import torch import torch.nn.functional as F from sklearn import preprocessing from skl...
f4946912d9605a4beaa78548a584e8b2764b90843ae54ea49abbb2771b702cb3
Python
2,220
77
"""Module level utilities for managing dependencies.""" from importlib import import_module from functools import wraps ################################################################################################### ##################################################################################################...
fa5cf62b8fccda0f8edb9737b984fbaeedc43023de4d64d97f14a5169365643d
Python
2,220
66
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: University of Zurich # Author: Rico Sennrich # script to allow batch-alignment of multiple files. No multiprocessing. # syntax: python batch_align directory source_suffix target_suffix translation_suffix # # example: given the directory batch-test with the files 0...