sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
11b8b9080de20a77f08634f7548bfcf584607ee14e95e6e01bbae54f5ea9f547
Python
3,428
83
import hdbscan import numpy from voxel_maps import coordinates_to_image from ..tree_helpers import region_map_to_dict from scipy.spatial.distance import pdist, squareform def extract_gradients(fm0, fm1, annotations, hierarchy_root): """Compute connectivity gradients of one region and plot them onto its anatomical...
325c6aedada12580ff42ca477fb6746b3583675f5014b1a14d4f8ac0001c2af3
Python
3,428
76
import csv import os import argparse import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import torch from read_deep.rt import rt_deep from importlib import import_module import yaml #%% def main(): parser = argparse.ArgumentParser(description="you should add those parameter") ...
5ce9dd98459f8975a6c2e95bc7e61d70fbd09baad438a5a1b8480b20b370161d
Python
3,428
115
"""Tests for the specparam.data.utils.""" import numpy as np from specparam.data.utils import * ################################################################################################### ################################################################################################### def test_get_model_p...
e02c75b6b4a8efa4ef652847a2f14553ce0b7c54c2ca51328988b8121e51d9da
Python
3,428
93
# -*- coding: utf-8 -*- import os import sys import pandas as pd import numpy as np data_dir = '/scratch/n/tbi-meg/v/processed' outdir = '/scratch/n/tbi-meg/v/zmap-data' decim_freqs = 8 parc = 'aparc_sub' labels_dir = f'/scratch/n/tbi-meg/v/labels_{parc}' def main(cohorts=None, window=True, data_type='zmap'): ...
7ca0ec9362bb200edff1d7c43da07679a4ab28eafbfaa0753b6119f9d0cdd57f
Python
3,429
108
# 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 complian...
85d9a0a4edb0face6ea31917b5e1b08be449a57d9d0ca8a6173e05f21ed58667
Python
3,429
105
import torch from modular_splicing.dataset.for_model import reformat_argument_for_model def get_loss(*, m, xy, evaluation_criterion): """ Get the loss for the given model on the given batch. Arguments --------- m: torch.nn.Module The model being trained. xy: dict The batch of...
b05861f19a85b28fb3f55212495d5aacd7b53a949877a68a69353c1b33403dd9
Python
3,429
74
""" 本脚本用于对单个口袋和多个小分子(smiles或带初始构象的mol文件)进行对接, """ import argparse import os import multiprocessing as mp import torch from src.utils.docking_inference_utils import docking, read_ligands from src.utils.docking_utils import extract_carsidock_pocket, read_pocket from src.utils.utils import get_abs_path, get_carsi...
b48bbc32c457cb7ffe1f8e567251c94de6ac26a2fcc77a8d9f682bee7f0bac1e
Python
3,429
143
"""Build network""" from posixpath import split def get_file_paths(control_file): """ :param control_file: :return control_dic: parses control_file into a dictionary providing the code access to all the paths it needs to run control file format is @\tkey=path key is used as a dictionary ...
68dc78bc8d8cb1ae586381656c4d1b2c26c7da1f0a2b383cf6f48b04962f0c6c
Python
3,430
111
# Copyright 2022 Deepfold Team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
72ee8d1937dc9db28a1b3ada4c7bc3135ea2e7a39fab9c8ac306fadd897255c3
Python
3,430
112
import torch import torch.nn as nn from .entire_model_types import entire_model_types from modular_splicing.utils.construct import construct class SeparateDownstreams(nn.Module): """ Have several different downstreams and only one motif model. Each downstream corresponds to a different output. The...
96a524a24267d72c8ec720c66bc6d53322f5a84ec6e7b57d871da83ad3bd922e
Python
3,430
124
from typing import List from monty.serialization import loadfn, dumpfn import logging import os from pymatgen.core.structure import Molecule from pymatgen.io.ase import AseAtomsAdaptor from pymatgen.io.qchem.inputs import QCInput import ase.io as ase_io from ase.neb import NEB from instance_mongodb import instan...
47c1a657938298a9fcffbf01c41081d2a4eb91a9d3f48ea2e7573927c5870543
Python
3,431
100
import os import sysconfig from pysam.libchtslib import * import pysam.libchtslib as libchtslib from pysam.libcsamtools import * from pysam.libcbcftools import * from pysam.libcutils import * import pysam.libcutils as libcutils import pysam.libcfaidx as libcfaidx from pysam.libcfaidx import * import pysam.libctabix as...
977dd955385e3e2f29d39e101903a6b8a8ffa89fb6cac639285085b6d12e9c61
Python
3,431
93
import random import numpy as np import torch import time import math from copy import deepcopy, copy def seed_all(seed=0): print("* Setting all random seeds to ",seed,'*') random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(see...
52b104f34a44c4662b157ba64615ee49b982cb7d305200df499f69e68b3a8cc2
Python
3,432
90
"""Tests for the About portal popup content and UI component.""" from __future__ import annotations from larvaworld.portal.about import build_about_content from larvaworld.portal.panel_components import build_template_header def _find_by_css_class(root: object, css_class: str) -> object | None: """Depth-first s...
7991d82f7a2f02e1facea449569c9f8c9e204d62ca8e2c8525932aa3e4713898
Python
3,432
106
# --- 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 Unselected(_BaseTraceHierarchyType): _parent_path_str = "scattercarpet" _...
d3f994fcb0aa3c3b479275eaa1c74adc99e3b7139080e3ffbf7fd0496ac58b80
Python
3,433
89
'''Skript to generate Dataset from folders adapted code from https://stanford.edu/~shervine/blog/keras-how-to-generate-data-on-the-fly.html''' import numpy as np import tensorflow.keras import cv2 import random from datetime import datetime from keras.utils import to_categorical from sklearn.preprocessing import Label...
322c511f2bcd152fbc73f6cda445a0f607d2434035405041e2ede13fde0130b2
Python
3,435
81
# Convert the DICOM scans to NIFTI, identify the RT structures and # prints the FSL commands to re-orient and apply the masks. import csv import os from dcmrtstruct2nii import dcmrtstruct2nii, list_rt_structs FSL_DIR = "FSLDIR" if __name__ == '__main__': # Temporary folder to save the NIFTIs temporary_folde...
34eeb10ecc313dc5d0973dec77779cad6ced8769408787e26a2ec5bd6f0a585e
Python
3,435
91
"""A wrapper for filtering dictionary observations by their keys.""" import copy from typing import Sequence import gym from gym import spaces class FilterObservation(gym.ObservationWrapper): """Filter Dict observation space by the keys. Example: >>> import gym >>> env = gym.wrappers.Transfo...
815876aedd03304b37a2d901d2f7839c0212ced99bf4b35be4ba4573d837ac3c
Python
3,437
97
import pandas as pd from scipy.stats import pearsonr,spearmanr import seaborn as sns import matplotlib.pyplot as plt from utils import setup_fonts,parse_config,build_output_dir import re def parse_entry(entry): if any([c == ' ' for c in entry]): return None else: return entry[0], float(entry[1]...
d090fc9c1987b1d27e44577e0c2c19ee65bfe0344a9a00716ba55e9584c48b12
Python
3,438
109
# --- 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.slider" ...
1d2fb219cbab68de0743ef1f2808a589e9d9ef576475756b92ac51baa9266c29
Python
3,439
164
import pytest import math import rpy2.rinterface as ri ri.initr() def test_r_to_NAInteger(): na_int = ri.NA_Integer r_na_int = ri.evalr("NA_integer_")[0] assert r_na_int is na_int def test_NAInteger_repr(): na = ri.NA_Integer assert repr(na) == 'NA_integer_' def test_NAInteger_str(): na =...
3d4e8e43e8a9913513eeb8b28669d4991d2868ee66e2f82222426232ac9704f3
Python
3,439
111
""" API consistency tests for LarvaDataset and related classes. Pure import/identity checks - NO I/O, NO dependencies. FASTEST tests in the suite (~50ms total runtime). """ import importlib import pytest @pytest.mark.fast def test_larvadataset_alias_identity(): """ Verify LarvaDataset is the s...
32a45ab4e1be5fd6ac787c606623d8cdd0e3edb96b49b8fb4a88a347127551fe
Python
3,440
66
"""C.1: пилот на жизнеспособность знакового слоя и пластичности. Стоимость метки и хеббовское обучение меняют физику мира — до всего остального проверяем, что мир не рушится (STAGE3_DESIGN §10.1, граница провала 6). Четыре условия × 5 seed × 15000 тиков: базовый | только знаки | только пластичность | знаки+пластично...
c5d81d5828baddaf5447d8793cfda251f79ab50e438640e4e5da727b26b92e8f
Python
3,440
113
import pytest import random from larvaworld.lib.model import SpaceDict from larvaworld.lib.util import AttrDict @pytest.fixture def space_dict(): return SpaceDict( base_model="explorer", space_mkeys=["interference", "crawler"], Pmutation=0.1, Cmutation=0.1, init_mode="rando...
00007e589341857c3b7e45f266308b79a643f6867b3c981a86ec36edd95db3f3
Python
3,441
119
from __future__ import annotations import os import pytest from pytest_celery import RABBITMQ_PORTS, CeleryBrokerCluster, RabbitMQContainer, RabbitMQTestBroker, defaults from pytest_docker_tools import build, container, fxtr from celery import Celery from t.smoke.workers.dev import SmokeWorkerContainer ############...
8a89d1934b8efeae246563ca60c11b231c6099aa2e4d1b3816dc67d59358e0bc
Python
3,441
113
from typing import Tuple import numpy as np import torch import torch.nn as nn dev = torch.device('cuda:0') class MultipleOptimizer: def __init__(self, *op): self.optimizers = op def zero_grad(self): for op in self.optimizers: op.zero_grad() def step(self): for op in ...
8fabe8408a65a8f16f786a37e2ca67c69d31c9a98758a676908e79201d4cfdfc
Python
3,441
96
import requests import os import tempfile from zipfile import ZipFile class NeuroMorphoAPI: def __init__(self, base_url="https://neuromorpho.org/xyz2swc/"): self.base_url = base_url self.foldername = None requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += 'HIGH:!DH:!aNULL' def co...
271ef2ec0c4326b31effb34a92532e7158b3cc8dd94300517d442e09402a8210
Python
3,443
156
#TimesVector # #Created by Inuk Jung on 2016-08-3. #Copyright (c) 2016 Inuk Jung. All rights reserved. # #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 you...
6e22e83f121554cede0593b079f526526365f1391a74bd0cf7b28b29c05e16eb
Python
3,443
96
# %% [markdown] # # Adding transformations to multiscale images # # Adding transformations to individual multiscale images is a way to enrich the metadata associated with the image. # This can be useful to inform implementations on how to view or interpret the image data, # i.e. if an image is supposed to be viewed wit...
a0696196cc5552a2cb07800af27b04ec9e82919db0d2c4e1313a34a43ffca356
Python
3,444
97
"""AUD-CODE 4.2 regression: check_plan multiplicity and index bounds. The multiplicity check was ``len(labels) > 0``: a selector fanning ONE declared replacement out over many sites read ``multiplicity_ok``, and a pass-qualified ``label:k`` outside ``1..num_passes`` surfaced only as the resolver's opaque "matched 0 si...
47bb57f7dd7ca6b90b49019fc6d0e1784be3b5bbcb7c28c0b72a65ec05ad284a
Python
3,445
106
# --- 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 Unselected(_BaseTraceHierarchyType): _parent_path_str = "scatterpolargl" ...
76f4140f0094eb86881d28b51672fa79183fcfb1b7a6b6754cb206ac814b3d64
Python
3,445
106
# --- 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 Unselected(_BaseTraceHierarchyType): _parent_path_str = "scatterternary" ...
e43d3655c12951a90e0560fbf02667fae8070c4da20631f93137b575897fbc29
Python
3,445
117
from pathlib import Path import numpy as np import torch import matplotlib.pyplot as plt import scipy from tqdm import tqdm from scipy import interpolate import hdf5plugin import h5py #os.environ['CUDA_VISIBLE_DEVICES'] = '0'#, 1, 2, 3, 4, 5, 6, 7' import sys #sys.path.append("/grand/hp-ptycho/anakha/S26-beamtime/scr...
63e9ea1b04f9ee45c320bdc44b7183afdbeb972f26c99529ff0b9d98c77687d7
Python
3,446
85
import abc import os import json import gzip import urllib.request import wget from src.cfg import * class MorphologySource(abc.ABC): @abc.abstractmethod def fetch_morphology(self, experiment_id, mode): """Fetch morphology data.""" pass class NeuroinformaticsSource(MorphologySource): def _...
78939cc3cae646ee30d722efc57c9d6a8ff91cef1ca60b6afef1615ee6a94a69
Python
3,446
81
"""Exceptions raised by pyrosm. - :class:`PBFException`: the base class of the two errors about a PBF file's content below. - :class:`InvalidOSMFileError`: a file is not a readable OSM PBF file (a :class:`PBFException`). - :class:`PBFNotImplemented`: a PBF file requires a feature pyrosm does not support (a :class:...
7b3c71ce1d14b812ffd144718cd002a1710a30f2b74141bee5d5e2c5bc3f47ac
Python
3,446
94
import numpy as np from brian2.only import * import deepdish as dd from readout import load_results out_fname = 'suppression.TA{TA}.h5' def get_bspikes(res, episode): b = np.zeros(np.asarray(res['raw_dynamics']['v'].shape)[[0,2,3]], bool) for itrial, (i, spike_t) in enumerate(zip(*[res['raw_spikes'][episode...
cf5d385af451d0054c680c95ab6af65f1225f79b9024cbd4af2e7231408b01c8
Python
3,446
84
import matplotlib.pyplot as plt import numpy as np def setup_figure(xlabel,ylabel, fontsize = 15, fontname = "Helvetica", grid = False,**kwargs): plt.xlabel(xlabel,fontsize = fontsize,fontname = fontname) plt.xticks(fontsize=fontsize,fontname = fontname) p...
245fd08fdb31323c62b6eba9177e1be4c602a3644fc904732af2dd6583d5b8ab
Python
3,447
83
# all with inverse! # quartiles ✔ # half of head (front/ back / left right) ✔ # poca dots - multiple rotations/spacings? # singular dot (whole head) # multiple dots (less than whole head) # center of mass (position, x y) # rings (different sized?) ✔ # gradients (different directions) # make a kernel per electrode - nah...
abca4b32062add7099aec571e4f5d238aa01d603e763245b3adb6da53e302f9d
Python
3,448
95
#!/usr/bin/env python import glob import os import tarfile import pandas from deepspeech_training.util.importers import get_importers_parser COLUMNNAMES = ["wav_filename", "wav_filesize", "transcript"] def extract(archive_path, target_dir): print("Extracting {} into {}...".format(archive_path, target_dir)) ...
9cfe30f770e378133177aa014ea4513e0ab9d8dc295ed78d605a4b9b8c080102
Python
3,449
110
# --- 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 = "bar.selected" _path_...
419e35ccd7177e1f22804ed5f9e34a1d6b8eb584c0d169e06c9583731987f303
Python
3,450
98
from bioseq2seq.utils.logging import logger from bioseq2seq.transforms import register_transform from .transform import Transform from bioseq2seq.utils.alignment import subword_map_by_joiner, subword_map_by_spacer import re from collections import defaultdict @register_transform(name='filterfeats') class FilterFeatsT...
b29325878dd5f97acf508ce66e6cee2aad27bd7f56f23c46d0583ec9531dfbbd
Python
3,450
120
import numpy as np import pandas as pd from statistic import classification_analysis import pickle from collections import OrderedDict num_dict=OrderedDict({'435':25,'412':24,'474':20,'501':20}) from torch import tensor from sklearn.metrics import roc_curve from sklearn.metrics import matthews_corrcoef def conclued_s...
c114c0b197f8450489219bce1dd6726c88e748d7bbd66496eef7e05e1eb68494
Python
3,450
101
# coding=utf-8 # Copyright 2024 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...
2cff39703bd7f1f85add1f3c286561fae1c805e5899832be825c9b0278bc7c52
Python
3,451
123
import numpy as np import torch from numpy.random import default_rng import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from tqdm import tqdm import multiprocessing from multiprocessing import Pool, freeze_support, current_process, RLock from functools import partial import pathlib from causal_o...
571f8372ff7731f5c728ea5a8f7480578b16760e82638e7d2d58707cf08b4e34
Python
3,451
113
import argparse import os import subprocess import sys def _filter_pythonpath(repo_root: str) -> str: excluded = { os.path.normcase(os.path.abspath(repo_root)), os.path.normcase(os.path.abspath(os.path.join(repo_root, 'python'))), } entries = [] for entry in os.environ.get('PYTHONPATH'...
0c82564ff5d1d57d21c715199e85f28389021b7a5caa620f10974a8901ea38e3
Python
3,452
111
# -*- coding: utf-8 -*- """ Created on Fri Dec 9 13:31:18 2022 @author: longzheng """ import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.optim import Adam from oil.utils.utils import LoaderTo, islice, cosLr, FixedNumpySeed from oil.tuning.args import argupdated_config from oil.tuni...
df8cd0dc5f918e94367e96bc7640f3807137860185c60df176fa2e035f552e3d
Python
3,452
89
from __future__ import division import unittest import numpy as np from numpy.random import randn np.random.seed(42) from wyrm.types import Data from wyrm.processing import append, swapaxes, calculate_cca, apply_spatial_filter class TestCalculateCCA(unittest.TestCase): SAMPLES = 1000 CHANNELS_X = 10 C...
19877eb5189cfd09d1d9d43d1a3e9fe84ac6065c9835ff03f6d2b5c2683ff6c8
Python
3,453
95
"""NSActivityOptions https://developer.apple.com/library/content/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/PrioritizeWorkAtTheAppLevel.html License ------- Incorporates code from `appnope <https://github.com/minrk/appnope>`_ under 2-clause BSD, copyright (c) 2013, Min Ragan-Kelley All righ...
3bdafa366b320e189df2d6d10a0d036be251cc5195ca9a25b6890937b407280d
Python
3,453
79
from __future__ import annotations import logging from collections.abc import Iterator from itertools import chain, cycle, repeat class InternalStateInformation(object): """ This object is a supportive internal state object designed to hold state information that can be shared between other features runn...
2162f6a40bbed810b7866f3169975945cc2ef0a2fae8f7e391c1262c2c103e08
Python
3,454
122
import torch from inspect import signature from torch_geometric.loader import DataLoader from torch.nn import functional as F def construct_model_name(dataset_name: str, debug: bool = False) -> str: """Construct the model name based on the config filename and the debug flag.""" model_name = dataset_nam...
31552c6058787c5055d01ad3ce68e6d877421fa37691a00baafa191e68f8254c
Python
3,454
112
# --- 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 = "quiver.marker" _path_s...
def7fd3141995abed6b29720905ab4d80b415ea53775e9a7d61e95686fda49a0
Python
3,454
96
# %% [markdown] # # How to handle delayed writing # # Writing large images can take a while, because ome-zarr-py computes the # multiscale pyramid and writes every chunk to storage. # Under the hood, this is done with [dask](https://docs.dask.org). # # By default (`compute=True`), # {py:func}`ome_zarr.classes.image.OME...
1deb77365d81d9b2e9b31aca44871025f117097726f6019c194a0abba571ec21
Python
3,455
162
""" Tests to make sure the plot module isn't busted """ import eugene as eu import pytest from pathlib import Path HERE = Path(__file__).parent eu.settings.logging_dir = f"{HERE}/_logs" @pytest.fixture def model(): """ model """ model = eu.models.DeepBind(input_len=100, output_dim=1) return model...
3710541cfb2541ad7ac0c2417a9ef533d949deff04675171eafa34af6e9a7be8
Python
3,455
99
import numpy as np import scaffoldgraph as sg import networkx as nx import os from rdkit.Chem import Draw from rdkit import Chem from utils import get_mol import matplotlib.pyplot as plt import random import argparse def filter_sca(sca): mol = Chem.MolFromSmiles(sca) if mol == None: return None ...
5eea84d383f17e8b723d4300bf8e45bfb56ef42362f1fbf92e82887792f06947
Python
3,455
89
import tempfile import unittest from pathlib import Path import numpy as np from PIL import Image from torch.utils.data import DataLoader from bdpy.dl.torch.dataset import ImageDataset # Use non-square images (H=4, W=6, C=3) to fully discriminate every axis. # A square image (H=W) cannot distinguish (3, H, H) from (...
e3132f027c906912cfb277da5448927104c764c1c24a19952bda3881537c5298
Python
3,455
100
""" Copyright (c) 2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE...
05669ee5115b9831d3d4a6ecbff375dd5e6f8316cec11b5e31a0cfd17021b9a8
Python
3,456
110
from typing import Any, Callable, Optional, Union from pl_bolts.datamodules.vision_datamodule import VisionDataModule from pl_bolts.utils import _TORCHVISION_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _TORCHVISION_AVAILABLE: from torchvision import transforms as transform_lib from torch...
679b78a8dc43799023aac280574c446d78b81b1c1587d4f1f5391171591b357d
Python
3,456
97
def plot_confusion_matrix(cm, target_names, title='Confusion matrix', cmap=None, normalize=True, plot_text=True, plot=True, grid=True, ...
10361ecbdc8c03fa8c9ce84d79bbef67bcb573959b4b1a29f9d587771acce1e2
Python
3,457
86
"""Prepare a coded analysis table and a private HCP ID crosswalk. Supply an HCP-ID-labelled derived table to create study IDs and a local ID crosswalk. """ import argparse import csv import math import os import secrets from pathlib import Path ROOT = Path(__file__).resolve().parents[1] STAGED_PATH = ROOT / "data/l...
40188af74908ade66951eef8cd92eeb7b2aa5c610a7f98a43f6fb4af8191bdfc
Python
3,457
120
import os import random as python_random import numpy as np import tensorflow as tf import tensorflow_datasets as tfds from tensorflow.keras.layers import Activation from tensorflow.keras.layers import Conv2D from tensorflow.keras.layers import Dense from tensorflow.keras.layers import Flatten from tensorflow.keras.la...
57b33a2178214acb79ca8ff0bcc8d213ed7b123ebe61778c21f530af47aec7b9
Python
3,457
118
# -*- coding: utf-8 -*- """ Created on Tue Aug 18 14:29:28 2020 @author: amberxtli """ from typing import Dict import os import csv import pickle import numpy as np from rdkit import Chem from rdkit.Chem import SaltRemover from argparse import ArgumentParser from rdkit import Chem, DataStructs from rdki...
eb9eefe712554b2b3125d95acbc26cf039a50f092dba75f52c952dd2c96c27f4
Python
3,457
114
# Reports distances of ligands to reference points. An example input for the points is: # # 5.655 1.497 18.223 # 1.494 -8.367 18.574 # 13.034 6.306 25.232 # # Data can be space or tab separated but must contain 3 and only 3 numbers for the x, y and z coordinates # # That would encode 3 points. # Each record in ...
33b9b31485e82fc56f5a8bc78edbbfde1b44143b8ddf45a1d147a1f94f00d8f8
Python
3,459
110
from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Callable import numpy as np import torch from torch import nn @dataclass class LayerProbeBase: layer: nn.Module hook: Callable popul...
7265c8e4a7a9d220b93042399a7a736c084ba61b036134f6f142e971d0607b70
Python
3,459
101
from prodict import Prodict import sys sys.path.append("src") from args import args from predict import plot_predictions from src.analysis.explore_encodings import explore_encondings from src.analysis.arm import plot_performance_by_arm from src.analysis.bootstrap import perform_bootstrap from src.analysis.encodings...
b3379eb414494831a77ee94bd02d8fac37b36d776b7213801a9fa08c2c5588e1
Python
3,460
100
import zipfile as zf import scanpy as sc from anndata import AnnData from .._settings import settings def visium_sge( sample_id="V1_Breast_Cancer_Block_A_Section_1", *, include_hires_tiff: bool = False, ) -> AnnData: """Processed Visium Spatial Gene Expression data from 10x Genomics' database. ...
bcbc72824a970fae873e2a9121bc89d2e1b5f1352e0e8c54b3d620e7c52dfb21
Python
3,460
105
import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import keras from utils import c1 tf.config.experimental.enable_tensor_float_32_execution(False) def calc_rho_nDFT(model, profiles, T=1.0, plot=False, maxiter=10000): """ Calculate the density profile with neural DFT using a standard...
db768a90993e736cd4ac33fde0ee83af3351670dccef25efd640afc672213880
Python
3,460
115
#!/usr/bin/env python # Greg Von Kuster """ Calculate correlations between numeric columns in a tab delim file. usage: %prog infile output.txt columns method """ import sys # from rpy import * import rpy2.robjects as robjects r = robjects.r def stop_err(msg): sys.stderr.write(msg) sys.exit() def main(): ...
71c82dcc2d0a8c7befc44d59a6491bc0dee975982ab1d4ad4933c70f0202fcfa
Python
3,461
107
from time import time, sleep import multiprocessing import flywheel import datetime import csv from pathlib import Path import pandas as pd now = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M") fw = flywheel.Client() qsiprep = fw.lookup('gears/qsiprep-fw-hpc') proj = fw.projects.find_first("label=PNC_CS_810336") an...
dad85c945a4137773d27c35a91d4926d5a2ac6f09f849b347a9dad2c927bb9f3
Python
3,461
88
import math import torch from torch import nn # from util.misc import NestedTensor class PositionEmbeddingSine(nn.Module): """ This is a more standard version of the position embedding, very similar to the one used by the Attention is all you need paper, generalized to work on images. """ def __i...
367903420bd2493b0453890b610528568fca47b5d004aedd6a3bac68f2f5b1c4
Python
3,464
94
import os import pickle from Configurations import config as cfg from Utilities.common_packages import np, tf from nn_model.modelgenerator import tf_model, OnEpochEndCallback, modeltracker from tensorflow.keras.callbacks import ModelCheckpoint, CSVLogger from tensorflow.keras.optimizers import Adam from tensorflow.ker...
becd0c97830f842282e832983621ee24da56480b4b085e7b5932bbdcb59828af
Python
3,464
112
import warnings import captum.attr import torch from ..utils.model import FunctionToModel from ..utils.generator import TensorGenerator def get_occlusion(x, model, window_shape=(None, 5, 5), stride=(None, 5, 5)): """ x must have shape (sample, c, h, w). window_shape and stride have always 3 elements. Oc...
494a198d30056591e0df543383b157abee31d93e685a791e135a429766f1c906
Python
3,466
105
""" Implementation of the "Converging squares" algorithm """ import numpy as np ## a square is a list of slices def _child_slices(sl, step=1): "split a slice into two overlapping smaller slices" return [slice(sl.start+step,sl.stop), slice(sl.start,sl.stop-step)] def _child_squares(square, st...
7c88177ed9fcdf45a3aea955af4278fb8692d9e09da4f7c93275d83c0c2400ce
Python
3,466
88
from model import * from utils import * import numpy as np from sklearn.model_selection import KFold import torch import os,sys import warnings warnings.filterwarnings("ignore") dataset = ['toy_cls','BindingDB_cls','DrugAI','CYP_cls'][int(sys.argv[1])] TRAIN_BATCH_SIZE =32 TEST_BATCH_SIZE = 256 LR = 0.0001 NUM_EPOCHS...
d90ca04ae5b09154b5dd2dae9ee6990741a907029e2d82979b8213ac2d291835
Python
3,466
123
from abc import ABC, abstractmethod class SparseLayer(ABC): """ Base class for sparse layers. This class uses the term `sparsity` to refer to the fraction of outputs that are zero, i.e., correctly. In other places, the term `sparsity` is used to refer to the fraction of inputs that are no...
247a43caad2a3570a9f2179f63e84b23489709de2f30db91299b0ff546299ce7
Python
3,467
91
""" ## Prerequisites Install OpenVINO and PyTorch CPU versions : uv pip install -U openvino uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu ### Linux support for Intel® Neural Processing Unit (Intel® NPU) Chaeck if drivers are installed and the NPU is available: `sudo dmesg | grep ...
e10cae2885f162de9d50c1ae1a78a7a21682207fa30067fcf849109854d0931f
Python
3,467
92
""" Author: Bruno De Santi, PhD Affiliation: Multi-modality Medical Imaging Lab (M3I Lab), University of Twente, Enschede, The Netherlands Date: 20/09/2023 Description: Deformation field regularization functions Acknowledge: The code was adapted from 1) J. M. Wolterink, J. C. Zwienenberg, and C. Brune, “Implicit Neu...
57fa0bf09d8d85400227741242b0eb460dd1bce9c5a65da76c6ad5410b0cb087
Python
3,468
125
import os import asyncio import websockets import sys import json import IPython.display import webbrowser from time import sleep class Viewer: wsport=9000; url=''; def __init__(self,port=None): super().__init__(); if (port!=None): Viewer.wsport=port; Viewer.url...
8f05a13f018ca85055760a549767a43b5e540704984b40ba823251664b5eaf88
Python
3,468
107
import paddle from paddle import nn import paddle.nn.functional as F from utils import _norm_no_nan import pgl import pgl.math as math class GVP(nn.Layer): ''' Paddle version of the GVP proposed by https://github.com/drorlab/gvp-pytorch ''' def __init__(self, in_dims, out_dims, h_dim=None, activatio...
abd4eca5325d78ca7b5aa9602459c8c59b3af3f4fcf5a3f5d565cea60841037d
Python
3,468
103
"""Custom and derived deformable convolution""" # pylint: disable=missing-function-docstring,bad-continuation import torch from torch import nn from torch.nn.modules.utils import _pair from torchvision.ops import deform_conv2d __all__ = ['DeformConvWithChangeableStride'] class _NewEmptyTensorOp(torch.autograd.Functi...
c23266271979bb3ef71700eb80718caa4ce3dfbac79b17b87383c3a7c544d451
Python
3,468
94
""" Database Writers for Ethoscope Experiment Data Storage This module provides various classes for storing experimental tracking data from the Ethoscope behavioral monitoring system. The classes support multiple database backends (MySQL/MariaDB, SQLite) and different output formats (database tables, numpy arrays). C...
df96d68cbe0991ee55bfb38f4766c01729a717430c8c4a43058689dbbba16bd3
Python
3,468
106
from keras.src.activations.activations import celu from keras.src.activations.activations import elu from keras.src.activations.activations import exponential from keras.src.activations.activations import gelu from keras.src.activations.activations import glu from keras.src.activations.activations import hard_shrink fr...
2a9ec428be593bb59cd32605f0e917d8859c60bbe4700354e2ddbfafb359a71b
Python
3,469
99
# 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...
39d270a0369617899e1702f58938a44162c61633139a233ef2687bd2f8d6ff4e
Python
3,469
101
"""Benchmark records never carry the machine's hostname or local paths. Benchmark results and baselines are committed to a public repository. The writers record a neutral host label (``TORCHLENS_BENCH_HOST_LABEL``, default ``"benchmark-host"``) and spell the checkout as ``<repo>``; these tests pin that, and pin that n...
94d7f24b9bf48006f8c80dc63bd95d0470c999a520ed70900b9e221839465ed9
Python
3,469
108
# Copyright 2020 The HuggingFace Team. 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 applicabl...
f39ae45b0c6200f798d8a412c23328d20fd93fe88b5ac3a535a8c4ec13139d53
Python
3,469
133
import jax import jax.numpy as jnp import jax.scipy as jsp from keras.src.backend import config from keras.src.backend.common import dtypes from keras.src.backend.common import standardize_dtype from keras.src.backend.jax.ops.core import cast from keras.src.backend.jax.ops.core import convert_to_tensor def cholesky(...
f8fd3375a7059524a760993c0f94626c8a665a8b6a47a102e1c790c1dcfbde0b
Python
3,469
111
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """Implement Smart tags classes: SmartTagEndTag, SmartTagDuration.""" from . import read_tags_source from .. import read_manager from ..signal import read_data_source from ..signal import read...
0a6550379721696f9ac80b1471cbf426522db92340331bee41dc301c3ebc8689
Python
3,470
85
#!/usr/bin/env python3 """Fit Platt on training-in-sample scores under the deployment LDA, apply unchanged to figshare. Report Brier/ECE on held-out figshare.""" from __future__ import annotations import os, sys, json import numpy as np HERE = os.path.dirname(os.path.abspath(__file__)) OUT_DIR = os.path.join(os.path.d...
4a9af155a4ff52782d4cc1246b22e94a0d255420b92f09b30db58d6f4725924d
Python
3,470
92
from typing import Any, Dict, Iterable, Optional from torch.optim import Optimizer def update_param_groups( optimizer: Optimizer, default_update: Optional[Dict[str, Any]] = None, updates: Optional[Iterable[Dict[str, Any]]] = None, ) -> None: """Update the values in the param groups of the optimizer. ...
583cd8ad4a1c97adaf265213971e1e40b870e84fb0978605738bdfb7c5516b4e
Python
3,471
99
import os import sys import pandas as pd import anndata as ad from pyprojroot import here import re proj_root = str(here()) sys.path.insert(0, os.path.join(proj_root, "package/python")) from myanndata import grouped_obs_mean, get_barcode2group from utils import set_file_logger # * configs resource_dir = f"{proj_root...
8be86efe8d9460cefb6fb635923a875883408761f2dcdf04758fc09206fbd711
Python
3,471
110
# --- 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 = "indicator.gauge.threshold"...
8d54dad17429151e8488171aa96e04e098d371efedd6d16729168885a20f952f
Python
3,471
101
from __future__ import absolute_import import logging import os from pip._vendor.six.moves import configparser from pip._internal.download import path_to_url from pip._internal.utils.misc import display_path, make_vcs_requirement_url from pip._internal.utils.temp_dir import TempDirectory from pip._internal.vcs impor...
c4610747f795f0346b41920f937aada85803d9cc0e16c9d931423b4f7b311207
Python
3,471
92
from typing import Optional, Tuple, Union import numpy as np import pyvista as pv from anndata import AnnData from pandas.core.frame import DataFrame from pyvista import PolyData try: from typing import Literal except ImportError: from typing_extensions import Literal from ..utilities import add_model_labels...
e382eef9a2fa3ac6b824a1522cbb7da11225f491809e7fe5be172f0175fa3860
Python
3,471
106
import numbers import pkg_resources from afmformats import meta from nanite import model import numpy as np from PyQt5 import uic, QtWidgets from .. import units class TabInfo(QtWidgets.QWidget): def __init__(self, *args, **kwargs): super(TabInfo, self).__init__(*args, **kwargs) path_ui = pkg_re...
291dee87bab9591bb5b4f371aa86972a651f3655c15247daed944397ea4c81d2
Python
3,472
127
import numpy as np from .utils import get_trial_length from .array_utils import split_array def concat_trials(trial_data, signal, trial_indices=None): """ Concatenate signal from different trials in time Parameters ---------- trial_data : pd.DataFrame data in trial_data format signal...
c7825ec349a5e2ae9446e1f0f2045a0bfdac10fe495898e5954440387b77149b
Python
3,472
89
""" Author: Bruno De Santi, PhD Affiliation: Multi-modality Medical Imaging Lab (M3I Lab), University of Twente, Enschede, The Netherlands Date: 20/09/2023 Description: "trilinear" or "nearest" interpolation used in MUVINN-reg Acknowledge: The code was adapted from J. M. Wolterink, J. C. Zwienenberg, and C. Brune, “...
d4df670bff0147e8d3a0a4a7ecfdfabd627e356e17447dd91d3f73e5045c4efa
Python
3,472
89
# Copyright (c) ByteDance, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn from typing import List from timm.models.registry import register_model class YourCon...
f1f108f6c6731ece0344c29e387c1298fa084ab71c1878638b63ac0b81aa9ac3
Python
3,473
100
import numpy as np import matplotlib.pyplot as plt import pickle import sklearn.metrics as metrics from cycler import cycler from statistic import classification_analysis from collections import OrderedDict from torch import tensor num_dict=OrderedDict({'435':25,'412':24,'474':20,'501':20}) def case_out(num_dict,resu...
1482929fec81d392c0db634bb5467f112e0cf20e085ca8e5b637b0efe31130b5
Python
3,474
84
""" Leaky Integrate-and-Fire Spiking Neuron Model ============================================= The `leaky integrate-and-fire <https://en.wikipedia.org/wiki/Biological_neuron_model#Leaky_integrate-and-fire>`_ (LIF) neuron model is the most commonly used spiking neuron model. It has a single state-variable :math:`v_i`,...
67fcba8239db2bf06b04739cf8f4543b712f1c35940b103fbc94c41e49fc77d2
Python
3,474
84
""" Leaky Integrate-and-Fire Spiking Neuron Model ============================================= The `leaky integrate-and-fire <https://en.wikipedia.org/wiki/Biological_neuron_model#Leaky_integrate-and-fire>`_ (LIF) neuron model is the most commonly used spiking neuron model. It has a single state-variable :math:`v_i`,...
6dc2c8d0d679fbefe53e3c10997d638e04c40bab204c6bb084f0346ddb9b0ed1
Python
3,474
110
# --- 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 = "barpolar.selected" _...