sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
023a18e4ddd702978d69f19f240260d61bc661f5e868d215b2df6ceaad9310e3
Python
2,675
47
import sciunit from sciunit import Capability import multiprocessing class ProvidesRecordingLocationsOnTrunk(sciunit.Capability): """ Indicates that the model provides a list of locations on the trunk (primary apical dendrite) to be tested""" def find_trunk_locations(self,distances, tolerance, trunk_origin)...
809e4e2c841c7ec8a7a8ff638ba926cb6c33b430057835ff76039b768bf09c64
Python
2,677
69
import torch import numpy as np from torch.utils.data import Dataset, DataLoader from torch.utils.data.sampler import WeightedRandomSampler class DRODataset(Dataset): def __init__(self, dataset, process_item_fn, n_groups, n_classes, group_str_fn): self.dataset = dataset self.process_item = ...
ecf48c771731721fa8942fe57f5d5028363253fcd7a2ce0801ff177943667b7f
Python
2,677
72
# Generated by Django 2.1.9 on 2019-06-13 18:47 from django.db import migrations forward = """ CREATE OR REPLACE FUNCTION on_edit_treenode_connector_update_edges() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF OLD.treenode_id IS DISTINCT FROM NEW.treenode_id OR OLD.connector_id IS DISTINCT FRO...
f82d54138ebf00ec455ad539b41bffbb932a547d85a0394d88d0301f337a0c2b
Python
2,678
88
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sep 1, 2023 @author: Claire Cooper """ from RipNetClaire import RipNetClaire from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report from tensorflow.keras.optimizers import Adam from tensorflow.keras.regulari...
c3228dd280da52a59ca6d3c2e8cbc7bcf7c0185765151098560a233c66783d8e
Python
2,680
88
import scanpy as sc import numpy as np import scib import warnings warnings.simplefilter(action='ignore', category=FutureWarning) def get_adata_rand_batch(pca=False, neighbors=False): """ Download paul15 dataset and preprocess for data integration pipeline """ adata = sc.datasets.paul15() adata.o...
caae064d46596dd1fa961428f4f7ef39ee312cfdcdd928861e784af213a0685d
Python
2,680
102
import os import pandas as pd from utils import get_collaborator_cn def __modify_df(df): # gandlf convention: labels columns could be "target", "label", "mask" # subject id column is subjectid. data columns are Channel_0. # Others could be scalars. # TODO labels_columns = ["target", "label", "mask"] ...
d28162b8444f7a2b9ccff23e5ab74821f30c3d253f6fbaed771ae8ed23fb013b
Python
2,680
89
import inspect import time import os from statistics import mean, stdev from typing import Any from rich import print from CybORG import CybORG from CybORG.Agents import SleepAgent, EnterpriseGreenAgent, FiniteStateRedAgent from CybORG.Simulator.Scenarios import EnterpriseScenarioGenerator from CybORG.Agents.Wrappers...
78d00bcd95c8d1b3012eac7714833c38d79ce23843f33997c3541205e934600c
Python
2,685
71
"""Atlas-related ("register") tasks for MagellanMapper""" import os import re from typing import Optional, Sequence from magmap.io import export_regions from magmap.settings import config from magmap.stats import vols _logger = config.logger.getChild(__name__) def build_labels_diff_images(paths: Optional[Sequence[...
d0e59bda510469d95f2e8b45a6a9e88f771c7ac44bd1e11a59c79b2a0322ceb1
Python
2,686
57
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
04cf0edf57ad51f6bef3af76c02afeee381de3553bae4bf5573eb14610eceb52
Python
2,688
86
import torch import torch.nn as nn class GraphConvLayer(nn.Module): def __init__(self,n_vars): super(GraphConvLayer, self).__init__() self.W = nn.Parameter(torch.ones((n_vars,1)),requires_grad=True) self.b = nn.Parameter(torch.ones(n_vars,1),requires_grad=True) nn.init.xavier_normal_(self.W.data) nn.ini...
ebfaf449ad02b4f0705230b6c915bb8dab8127ab4d835d6af7d3e23209138cee
Python
2,690
66
import numpy as np import matplotlib.pyplot as plt import os from grid_cell.grid_cell_processor import Grid_Cell_Processor from grid_cell.ploter import scatter_torus_ploter from grid_cell.manifold_fitter import GP_Fitter, Avg_Fitter, label_mesh from grid_cell.gkr import GKR_Fitter from sklearn.decomposition import PCA ...
7fe1c64261becbabeb48e1ef3a00c9a1a6bbdbe077e175d52e39e2979172a39e
Python
2,691
58
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
8040a72bff051155cec6f516f52f1686b5c376bfd6ff9d3c77985c9a0b891640
Python
2,691
82
import os import argparse import sys import re import pandas as pd def create_csv(predictions, labels): """A function that creates a ./data.csv file from input folders.""" # labels labels_dict = {} pattern = r".*(\d{5}-\d{3})$" for folder in os.listdir(labels): reg = re.match(pattern, fol...
ff165b7730d9b96ecc7675a72a3a76c929bbb0042c0bb44acfb6180a0ec183b8
Python
2,691
102
# tests/test_init.py """Tests for public API exports.""" def test_public_api_exports(): """All public API should be importable from the main package.""" from zndraw_joblib import ( Category, # Models Job, JobManager, # Router router, ) assert router is ...
6bd4edcaf9b92906a6b1a951af0d1d9439ed5d7986500107da59e9e9913d58a0
Python
2,693
81
"""Functions to create neuroml simulation""" """ Copyright (c) 2016-2022, EPFL/Blue Brain Project This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as p...
96ac2922baf96244d8f324d18a800dadda3548e38f0a43ced05e109e3b64661b
Python
2,693
74
import h5py import json import numpy as np import pandas as pd from sklearn.mixture import GaussianMixture from experiment import * if __name__ == "__main__": for species in expt.species_names: print(species) # Params params = get_params(species) n_gauss_mix = params["n_gauss_m...
602d174228b44b9c752a36e0907db7d7b6df616092f80c33489593d26023ab4b
Python
2,694
60
import torch from nnunet_mednext.network_architecture.generic_UNet import Generic_UNet from nnunet_mednext.network_architecture.initialization import InitWeights_He from nnunet_mednext.training.network_training.nnUNet_variants.data_augmentation.nnUNetTrainerV2_insaneDA import \ nnUNetTrainerV2_insaneDA from nnunet_...
d8b4150bba3f0d3da9ce98312a84579c4f1ea3c35141bb8c9d1fcb0ae3f05b6c
Python
2,694
89
"""Tests for zndraw.io — unified file reading.""" from __future__ import annotations from collections.abc import Iterator from typing import TYPE_CHECKING import ase import pytest if TYPE_CHECKING: from pathlib import Path from zndraw.io import open_frames @pytest.fixture def xyz_file(tmp_path: Path) -> Path...
04eb15b4519a60a51b671742d67065b12b5b1490ca4353de66996a3bcfcffe0c
Python
2,695
77
import torch import numpy as np from ..models.constants import ConsensusInitializationMode from ..models.losses import GeometricLoss from ..utils.utils_new import frc, fourier_loss from tqdm import tqdm def optimize_epoch( encoder: torch.nn.Module, decoder: torch.nn.Module, inverse_model: torch.nn.Mod...
02434a77412b4ddccfb18edd6f9ce8f88105cb5814b5a02a4ca9b0210657fe1a
Python
2,696
75
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 23 12:22:09 2024 @author: max Map T1w/T2w ratio on parcels in DK atlas """ import numpy as np import pandas as pd from neuromaps.datasets import fetch_annotation from neuromaps import transforms import nibabel as nib # Choose annotation ['myelin',...
57303cf6be835e865782cb0358e5238a8666ae00607a3d31356dd8ae4b204f01
Python
2,696
81
from django.http import Http404 from rest_framework.generics import GenericAPIView from rest_framework.response import Response from rest_framework import status from drf_spectacular.utils import extend_schema from .models import Model from .serializers import ModelSerializer, ModelDetailSerializer from .permissions i...
6534f67054cb75b733e21e1b713181bb53083b5a7b5b0a5b76b9a10d18f15956
Python
2,700
77
from django.http import Http404 from rest_framework.generics import GenericAPIView from rest_framework.response import Response from rest_framework import status from .models import Aggregator from .serializers import AggregatorSerializer from training.serializers import ReadTrainingExperimentSerializer from drf_spect...
9af8b617cfff835b91f745f3b7e40715c13ef8e56232edf4cedf8ee2aa739c2d
Python
2,701
67
#!/usr/bin/env python3 """Public-safe static regression checks for CICADA roadmap item 1B.""" from pathlib import Path ROOT = Path(__file__).resolve().parents[2] def main(): qc3 = (ROOT / "basescripts" / "CICADA_3_QC.m").read_text() file_qc = (ROOT / "helper_functions" / "CICADA_fileQC.m").read_text() g...
b8f6ffba8a42320f83fedf7b9fafaf416a39b4f433558febec6fc3802d16f602
Python
2,701
93
"""Bundle HDF5 DLLs into an h5py wheel on Windows This is meant to do something like auditwheel on Linux & delocate on Mac, but h5py-specific. """ from base64 import urlsafe_b64encode from contextlib import contextmanager from glob import glob import hashlib import os import os.path as osp import shutil import sys imp...
f5ed341b998602ba833a449cc472ce1498fedd518cbba0a0bb0f8ec9c865df21
Python
2,702
96
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 3 12:48:13 2021 @author: Andrei Istudor andrei.istudor@gmail.com """ import numpy as np import pandas as pd import torch from random import randint, random from EthoCNN import EthoCNN from DataReaderAV import DataReaderAV from sklearn.metrics...
0ecb6d73fa3e643762540546543ede4266a20fed7be1762895774a24ef4e9b38
Python
2,704
67
#!/bin/python # arrange import truster import os import gzip raw_path = "/Volumes/MyPassport/trusTEr/test/raw/" lunarc = "config_files/lunarc_config.json" modules = "config_files/software_modules.json" test = truster.Experiment("test", lunarc, modules) test.register_samples_from_path(raw_path) merge_samples_outdir =...
c95deb6a5b7ffb1e70d99dca01163e5be14e5b519ee6f733d2d298f9ce4a4abf
Python
2,704
81
''' Date: 2022-07-20 15:36:44 LastEditors: yuhhong LastEditTime: 2022-11-11 23:29:18 ''' import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import numpy as np import random def get_lr(optimizer): for param_group in optimizer.param_groups: return param_grou...
7e102b7034df4797aab00908aa35484855c3b275ffc46da38ade792d6c0ba9cd
Python
2,705
68
# An Pytorch implementation of the pafnucy model # The original model was in outdated TensorFlow 1.x. import torch import torch.nn as nn from collections import OrderedDict class PafnucyNetwork(nn.Module): """ Pytorch implementation of the Pafnucy model. Original paper: Stepniewska-Dziubinska, M.M., Zielenki...
057ffa38b5dce10b146d2bd3551888b7758b7a313eedabcd591849f3e713301e
Python
2,706
98
#!/usr/bin/env python import sys, os, signal import string, re signal.signal(signal.SIGPIPE, signal.SIG_DFL) use_message = ''' ''' osx_mode = False if sys.platform == 'darwin': osx_mode = True def make_cat_cmd(gzmode, read_dir_base, read_dir, fq_name, num_read): cmd = [] if gzmode: if osx_mode: ...
72faa34d68c6c8a8d4fbf0c21d222e03ebc8587ae21a4e801eea0da13f9ec56c
Python
2,706
67
# -*- encoding: utf-8 -*- ''' Copyright 2022 The International Digital Economy Academy (IDEA). CCNL 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.o...
8c42afdbf9a444caa4fdf322111bbfd64c9efdc07262d9c3b80b6f54cc9754d5
Python
2,706
101
__doc__= """ This script filter the output of Kallisto, taking into account only protein #coding RNA. Input files: txtfile_1: name of the txt file with the all the Ensembl transcript ID passing the filters (this file is the output of removes_3UTR_5UTR_from_GTF.py) ...
9f9823585807b660ed4ad747c2c8c38efd161ad3d88afe194233c8b038abe460
Python
2,707
99
from __future__ import annotations from typing import Annotated import typer from zndraw.schemas import ( BookmarkCreateRequest, BookmarkResponse, BookmarksResponse, StatusResponse, ) from .connection import ( PasswordOpt, RoomOpt, TokenOpt, UrlOpt, UserOpt, cli_error_handler...
3bc817377139bfc2342fbdb08fe006cb7547cca3247657a43214ba9202a4c892
Python
2,708
71
import pandas as pd import numpy as np import cv2 from behavior_analysis.io import TrackingInterface from experiment import * from skimage.transform import AffineTransform, warp from skimage.exposure import rescale_intensity from matplotlib import pyplot as plt if __name__ == "__main__": examples = {"o_latipes"...
de84490711a935254c3f712ba65254107a80097508c9e9ba04a95fbb39c038ca
Python
2,709
86
import pytest try: import torch except ImportError as exc: # absent, or installed but unusable pytest.skip(f"torch is unavailable: {exc}", allow_module_level=True) from nearl.models.model_atom3d import Atom3DNetwork from nearl.models.model_deeprank import DeepRankNetwork from nearl.models.model_gnina import ...
aa7b3c19b0f50e37d6c0798bf65c107fc4162667f61c78ec2109ade577f68928
Python
2,710
88
from calendar import c import numpy as np import pandas as pd import scipy from cogmodels.base import CogModel2ABT_BWQ, CogParam from cogmodels.utils import Probswitch_2ABT class WSLS(CogModel2ABT_BWQ): """ Win-stay-lose-shift model can be derived as a RLCF model with high beta, and alpha=1. But here...
c62502ec8dbf9d96b4c9e20218636c9f4554f9e2c4b35965c215fa90c3147c46
Python
2,710
82
import os import torch os.environ['TORCH'] = torch.__version__ print(torch.__version__) import numpy as np import pandas as pd from scipy import stats import matplotlib.pyplot as plt import seaborn as sns import json, os, sys import sklearn from scipy.stats import pearsonr from sklearn.metrics import r2_score from to...
4eebf2bf6d7c919335d18e1726d50a9ee09ac4ef1e70d24c8693681aa785c90d
Python
2,714
92
import os from setuptools import setup from setuptools import find_packages # Function to read version from __version__.py def get_version(): with open(os.path.join(os.path.dirname(__file__), 'tsgm/version.py')) as f: exec(f.read()) return locals()['__version__'] name = "tsgm" version = get_version(...
6c801834542e5863bd26cb16d32fe45083390ecb2a580deb34d265d85912b4ac
Python
2,714
88
import shutil baseFileName = './shellScripts/sparse099_10class_' baseSimTag = 'sparse099_10class_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_...
9a39319ffbb4fda3639f1ddaa8705edcfc4b6d663494f3e72fc7fd159c732a9a
Python
2,714
87
"""Core in-memory similarity scoring for tandem mass spectra.""" from __future__ import annotations from typing import Optional import numpy as np from .utils import _as_spectrum, align_fragments def dot_product_similarity( query_spectrum: np.ndarray, library_spectrum: np.ndarray, mz_tol: float, q...
39683f6341f08866084dece63faf9d10ab520eb4539b867d1c514d3b9131bae4
Python
2,715
66
import numpy as np from grid_cell.persistent_homology import Is_Torus from grid_cell.manifold_fitter import GP_Fitter, Avg_Fitter import matplotlib.pyplot as plt import os from sklearn import datasets from global_setting import * #################### Hyperparameters #################### mouse_name = 'R' day = 'day1' m...
f19e4544f59ff2a5cb5ac12ad09beb3a68f7b13ded678f9951ca1303caadba95
Python
2,717
77
# coding=utf-8 # Copyright 2021 The IDEA 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 a...
280a68c2ae61863e93458aac802cbb550de79c7cd7bd8ed80db5876b1f1f7aee
Python
2,718
105
import pytest import numpy as np from keras import layers import sklearn.metrics.pairwise import tsgm @pytest.mark.parametrize("model_type", [ tsgm.models.architectures.zoo["cvae_conv5"], ]) def test_zoo_cvae(model_type): seq_len = 10 feat_dim = 2 latent_dim = 1 output_dim = 1 arch = m...
e534553becef8b53037d94f88c3d4ba4094b18c6454f92cd08a6c58e4b94e08d
Python
2,721
53
import pandas as pd from functools import reduce embedding = 'ESM' # Specify the embedding type 'ESM' or 'ProtTrans' # Original sequence for comparison original_sequence = "MGLSDGEWQLVLNVWGKVEADIPGHGQEVLIRLFKGHPETLEKFDKFKHLKSEDEMKASEDLKKHGATVLTALGGILKKKGHHEAEIKPLAQSHATKHKIPVKYLEFISECIIQVLQSKHPGDFGADAQGAMNKALELFRKDMAS...
35ae39ee4761fbb65884f38d7d694e9959249c879c5224b4dc8cafc4fa14de94
Python
2,723
78
# Generated by Django 2.1.9 on 2019-06-26 00:42 from django.db import migrations forward = """ CREATE FUNCTION refresh_skeleton_summary_table_selectively(skeleton_ids bigint[]) RETURNS void LANGUAGE plpgsql AS $$ BEGIN -- Cable length, nodes, creation info, edition info WITH filtered_...
3dc2b121b4826232ff42b6de087c3cf8c1d60c1c4e9440c6fd41ef3f8681b8a6
Python
2,723
103
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Implements a portion of the selection operat...
b60a3ff75d34be12ae44adce3b27214a4e38c291a7061ed300a9c78379e50bf3
Python
2,723
50
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
e180e712eb3aec8c9258ee742b36ddef7a77a85bec91187334a2214045259233
Python
2,723
50
# pytest unit tests for sct_extract_metric import numpy as np import pytest import logging from spinalcordtoolbox.scripts import sct_extract_metric from spinalcordtoolbox.utils.sys import sct_test_path logger = logging.getLogger(__name__) @pytest.mark.sct_testing def test_sct_extract_metric_against_groundtruth():...
2473690c928edaee5a2f92c05083caf1022003252f6ab18b15d26a8458a57830
Python
2,725
92
import numpy as np import pandas as pd import cupy as cp from .conv import * from .core import iSeq from .sig import * from .wtx import * def open_csv(filepath, n_null=100, random_seed=None): np.random.seed(random_seed) x = pd.read_csv(filepath, header=None).values[:, :-100] t, n_cell = x.shape x /= ...
30945f83fab5246bf71b997a679ba7a97c4292adb0fae580abff4fbb010885d9
Python
2,725
102
import numpy as np import pathlib import pytest import jax import jax.numpy as jnp from ase.io import read from jax_md import space from jax_md import quantity from so3lr import to_jax_md from so3lr import So3lrPotential from so3lr import So3lrCalculator @pytest.mark.parametrize('name', ['atat', 'dha', 'bb']) def te...
b60600f2c75c3c3011ce7d8da2fbe7a9a270888e4ee0e412301549bd1ea8af9e
Python
2,726
64
from ipaddress import IPv4Network from CybORG.Shared import Observation from CybORG.Simulator.Actions.Action import RemoteAction from CybORG.Simulator.Actions.Action import lo_subnet, lo from CybORG.Simulator.State import State class Pingsweep(RemoteAction): """ Concrete action that simulates a pingsweep, re...
2a0459237eec8a3f5c394e51f70294c19f186aa2081b687d7d13cf83107a80ed
Python
2,727
82
import os import django import kombu import logging from celery import Celery from celery.signals import setup_logging, worker_process_init from django.conf import settings # Set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') logger = lo...
751a0b5aa33c4a96578297b5a4ca0839eff7c6d17d2ea40f1f6880ff147dde9b
Python
2,728
71
import requests import langid import streamlit as st from translate import baiduTranslatorMedical from translate import baiduTranslator langid.set_languages(['en', 'zh']) lang_dic = {'zh': 'en', 'en': 'zh'} st.set_page_config( page_title="余元医疗问答", page_icon=":shark:", # layout="wide", initial_sidebar...
2b7f1cf09410297ca6deadbf2646440aa3ec37860ee06bc5a38f44afd8818aff
Python
2,729
90
import tempfile import numpy as np import pytest from keras.datasets import boston_housing from keras.datasets import imdb from keras.datasets import reuters @pytest.fixture def fake_downloaded_boston_path(monkeypatch): num_rows = 100 num_cols = 10 rng = np.random.RandomState(123) x = rng.randint(1...
65182eb322f74b6c824d9372a1cf6d0a36ae328bf0a5b92d7a1fe57c203f7187
Python
2,731
73
baseFileName = './shellScripts/sparse100_10class_' baseSimTag = 'sparse100_10class_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse=-1, ...
8d4002b5f332f8d58a6f6f1a47a9c0362ecf7edb1738b691360da60e0d11e040
Python
2,731
73
baseFileName = './shellScripts/sparse050_10class_' baseSimTag = 'sparse050_10class_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse=-1, ...
d5f8e9273fc5cb9f0be4f541bea6b0d49d10bb396d6e7d68cdd3a67438af694f
Python
2,731
73
baseFileName = './shellScripts/sparse080_10class_' baseSimTag = 'sparse080_10class_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse=-1, ...
da614090820082770a4f85c6d4efcd803eee946e770bedfc80e7e1a107af6c1f
Python
2,731
71
from medperf.utils import ( generate_tmp_path, tmp_path_for_cc_asset_key, secure_write_to_file, get_file_hash, remove_path, ) from medperf.encryption import SymmetricEncryption from medperf.asset_management.gcp_utils import ( GCPAssetConfig, upload_from_file_object_to_gcs, ) from medperf.ass...
4a727a416d35686964c88126dc0395bc029ce35d07d49bd955226ea2bfe053f2
Python
2,732
73
baseFileName = './shellScripts/sparse095_10class_' baseSimTag = 'sparse095_10class_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse=-1, ...
8316234d0adb90665af03affd40ca45824a020c2947c69fbd215ddfe2f08744f
Python
2,733
89
from pathlib import Path import yaml yml_path = 'config.yml' class Conf: def __init__(self): self.bm_values = BmValues() self.gf_values = GfValues() self.peak = PeakSettings() self.heatmap = HeatmapSettings() self.quiver = QuiverSettings() self.session = SessionSe...
07690c0903a5ce6457f006ec5a72dba9b33476d5ca52e43ac3f2ba4134fd9143
Python
2,735
91
import os import sys import platform import subprocess as sp def run(command, silent=False, background=False, executable='/bin/bash', logfile=None): '''Runs a shell command and returns the exit code. Note: A command run in the background will always return `None`. Args: command: Command t...
9b95ee5502e79486241e319a627e85975a56ed93f63cdc581219417625bb908c
Python
2,735
74
from CybORG.Shared import Observation from .Monitor import Monitor from CybORG.Simulator.Actions import Action from CybORG.Simulator.Actions.ConcreteActions.StopProcess import StopProcess from CybORG.Shared.Session import VelociraptorServer from CybORG.Simulator.State import State class Remove(Action): """ Remo...
b21883ec5fc80da97df1c2d6ccb3e7e432daaedd48950ea3fcc9958206c81208
Python
2,735
79
from provdbconnector import ProvDb from provdbconnector import Neo4jAdapter from prov.tests.examples import primer_example import os # create the api NEO4J_USER = os.environ.get('NEO4J_USERNAME', 'neo4j') NEO4J_PASS = os.environ.get('NEO4J_PASSWORD', 'neo4jneo4j') NEO4J_HOST = os.environ.get('NEO4J_HOST', 'localhost'...
a20785a1732f1dd9eace7b04462da5021366599d00e6f8fb781eb6cad1d8b8a0
Python
2,736
63
"""Convert ALBERT checkpoint.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert # from models.transformers.modeling_albert_bright import AlbertCon...
8e77dd8e9d804309fe92205979bb91eceb8530f43d8e4c2e0fb10ad3281f158c
Python
2,737
70
from dfa_lib_python.transformation import Transformation from dfa_lib_python.set import Set from dfa_lib_python.set_type import SetType from dfa_lib_python.attribute import Attribute from dfa_lib_python.attribute_type import AttributeType def test_get_sets_pass(): attributes = [Attribute("att1", AttributeType.TEX...
fde4a88feeb5f4dbe6321c8085b96c2cc65bcbdc7b664d1f5fb3c6391e7b2ff3
Python
2,737
75
import torch import torch.nn as nn import torch.nn.functional as F from utils import extend_dimensions class NormalEmbedding(nn.Module): def __init__(self, input_dim, emb_dim): super(NormalEmbedding, self).__init__() self.input_dim = input_dim self.emb_dim = emb_dim self...
6a140de3801ba7fee0ece4abf1522e3c34fe3bb7a665296ec26ebb1506feabd1
Python
2,738
80
from typing import List, Type from medperf.entities.interface import Entity from medperf.exceptions import InvalidArgumentError from tabulate import tabulate from medperf import config from medperf.account_management import get_medperf_user_data class EntityList: @staticmethod def run( entity_class: ...
539622f05d2d96ffc34010ba9c0c734c1888c3347e8b993cf406f60886fffcbe
Python
2,739
74
#!/usr/bin/env python # -*- encoding: utf-8 -*- from langchain.llms.base import LLM from typing import Any, List, Mapping, Optional, Dict, Union, Tuple from pydantic import Field from llm.self_llm import Self_LLM import json import requests from langchain.callbacks.manager import CallbackManagerForLLMRun # 调用文心 API 的工具...
b071a9c9747f5864f1f8de0e508aa5eeecb5735d1cb1d5d792cb3a63b9412c49
Python
2,739
79
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import ConvModule from mmengine.model.weight_init import xavier_init from mmseg.registry import MODELS from ..utils import resize @MODELS.register_module() class MultiLevelNeck(nn.Module): """MultiLevelNeck. A neck structure...
14f58160f8fe720a59c0c567db5512559aa81351457f6e8e6dd7fcca7eee1e0d
Python
2,740
102
#!/usr/bin/env python # -*- coding: utf-8 -*- # If you have a terminal that is not part_of any skeleton, this script # will try to find the right skeleton via its treenode and update with # that. # You may need to install psycopg2, e.g. with: # sudo apt-get install python-psycopg2 # Requires the file .catmaid-db t...
e5786fa4747fb0174e44b96fb5acbbd179ea073e71f39b4d895c5ec3c9b9b617
Python
2,740
87
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp from collections import OrderedDict import mmengine import torch from mmengine.runner import CheckpointLoader def convert_swin(ckpt): new_ckpt = OrderedDict() def correct_unfold_reduction_order(x): out_channel, in_...
58e3cdca4fd35b19bc725a09b8c87ca5b16c26f3b8cac8cd415eef536f1e8208
Python
2,745
90
from pysisyphus.constants import AU2EV, BOHR2ANG from ReactBench.Calculators._utils import compute_hessian from ReactBench.MLIP.leftnet.oa_reactdiff.trainer.calculator import LeftNetCalculator, mols_to_batch # get leftnet calculator for run_pygsm.py def get_leftnet_calculator(device="cpu", use_autograd=True): ...
5e16aebbcaf14a19cc5cbc6a0f96f95362c6800da4232958f7633906ee26500d
Python
2,745
97
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging import os import random import numpy as np import pytest import torch from ase.io import read from ocpmodels.common.registry...
1d5f59b5b819bfa5ce94c038d641652d2e436eb00f4d3eecb6a1952ca9993d30
Python
2,748
82
# -*- coding: utf-8 -*- # Generated by Django 1.11.8 on 2017-12-16 00:24 import django.core.validators from django.db import migrations, models forward_history = """ SELECT disable_history_tracking_for_table('catmaid_sampler'::regclass, get_history_table_name('catmaid_sampler'::regclass)); SELECT ...
3cd5a1e8db8c7eeaab760ebb8999021c644da2a5918445f7359d0b0fd2e6aac1
Python
2,748
70
import os import shutil import subprocess import warnings from typing import ClassVar from setuptools import Extension, find_packages, setup from setuptools.command.build_ext import build_ext as _build_ext SRC_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "src") # build_ext (unlike the old "install...
41b6c214b05884e70cef9655260d5f9d5aee45fb9bb88520228bd3b13f54190b
Python
2,751
88
import json from tqdm import tqdm import os import jieba.analyse import argparse label2desc={'1':'可以','0':'不能'} def load_data(file_path,is_training=False): with open(file_path, 'r', encoding='utf8') as f: lines = f.readlines() result=[] for line in tqdm(lines): data = json.lo...
e440a427a6ebb9682a47dc1c4376adcd3b4f81f6f50ab7438fc8826c2eb3d64a
Python
2,751
67
import numpy as np import pandas as pd import re def retrieve_convergence_results(results_dir, file_list): # file_list loss_dfs = {} params_dfs = {} norms_dfs = {} for file in file_list: if "losses" in file: loss_data = pd.read_csv(results_dir + file, index_col=0) ...
061bed2fa555f0191cb121be01b89844a6efd987fd13ca47a02bf423b8b6f15d
Python
2,752
74
# Copyright (c) 2016 Salle, Alexandre <atsalle@inf.ufrgs.br> # Author: Salle, Alexandre <atsalle@inf.ufrgs.br> # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including...
298aa6ae9df6026d59706e5f001191554f434c57f51b205993c77f7dc1edc45d
Python
2,752
72
import numpy as np import matplotlib.pyplot as plt import os import hickle as hkl from grid_cell.speed_partition_processor import Speed_Partition_Processor from sklearn.linear_model import MultiTaskLassoCV, RidgeCV from sklearn.model_selection import train_test_split, GridSearchCV, RandomizedSearchCV from sklearn.neigh...
479008f9e42d84c4cff0f03353a055d661974b144125511e1989f01921e6f5e6
Python
2,752
86
"""Tests for FrameStorage provider metadata (frame count, mount, room isolation).""" import uuid import pytest from zndraw.storage import FrameStorage @pytest.fixture def room() -> str: """Unique room ID per test.""" return uuid.uuid4().hex @pytest.mark.asyncio async def test_has_mount_false_by_default( ...
3ab21113c5ab720410a61406b0c0e58d3d6f02e671a3b9fabed35710e84fb6bb
Python
2,754
91
"""Box geometry for ZnDraw.""" from pydantic import Field from .base import ( BaseGeometry, ColorProp, InteractionSettings, PositionProp, RotationProp, ScaleProp, Size3DProp, ) class Box(BaseGeometry): """Box/cuboid geometry with customizable dimensions. Boxes are defined by a c...
707c8340b25900cd48d1b689849101589e92bee6d2b0aaff1074864137fa89cf
Python
2,754
59
"""One-off script: stub the PhAT Sample2 Neurophotometrics session. Unlike create_stubbed_testing_data.py, this does NOT read from testing_data/ — the source is third-party sample data from the Donaldson Lab's PhAT toolkit (MIT licensed), cloned locally, and this script is intended to be run once to produce the commit...
92ab728504842452db100476b74f44e336b27aca581d7e0e9472c11d99284d5b
Python
2,754
71
import torch from torch.utils.data import Dataset import numpy as np class NoisyDataset(Dataset): def __init__(self, x1, x2, td, noise = 0.0): self.x1 = x1 self.x2 = x2 self.td = td self.noise = noise self.indexer = len(x1) def __getitem__(self, idx): return se...
834f1dbf01f0317c238142ee797acce21a0c482610e2fb3fd307b7a3c60f20ca
Python
2,755
91
import torch import torch.nn as nn class Fire_Block(nn.Module): def __init__(self, in_channels, sequeeze_channels): super(Fire_Block, self).__init__() self.squeeze = nn.Sequential( nn.Conv3d(in_channels, sequeeze_channels, kernel_size=1), nn.ReLU(inplace=True), ) self.expand1 = nn.Sequent...
5ad9fd0e4e228ab1fb41c98b5ed40d1d6d4fa2ddb94571b2507a2b0605824bb6
Python
2,758
91
import json from dataclasses import dataclass import ase import numpy as np from znframe import Frame def atoms_from_json(atoms_json: dict) -> ase.Atoms: try: return Frame.from_dict(atoms_json).to_atoms() except Exception as e: print(f"Failed to convert atoms from json: {e}. Returning empty a...
94feb27c5630df6f4d2f0cf62925a4214ba72618fbf8bb39f73939507f0cfcad
Python
2,758
67
# ###### run DeepST # cd ~/DATA/luomeng/STEREO/DeepST # ls data | grep 200.h5ad | xargs -I {} -P 5 ~/miniconda3/envs/deepst/bin/python DeepST.py {} import os import sys import datetime print(f"{sys.argv[1]} start at {datetime.datetime.now()}", flush=True) fileName = '/media/desk16/lwx/Epilepsy/upload/A01895D1/h5ad/A...
28248b40b6f7ca6a261de5fcf36dfa569b04b660b58a0628ccfcff8d5b4b8a56
Python
2,759
97
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import os import random import numpy as np import pytest import torch from ase.io import read from ocpmodels.common.registry import registr...
f6c10d88e30c5594c1d10447030eacaad61a09151ca4eb8353c5c836028b6675
Python
2,759
60
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
1a4a2b4ec010d6f1b44e91e450cb8a01e4bf13f610644681dd2110662b3310d3
Python
2,761
110
"""Unit tests for the Room namespace data model.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest import pytest_asyncio from sqlalchemy.exc import IntegrityError from zndraw.access import Visibility from zndraw.models import Group, Room from zndraw_auth import User if TYPE_CHECK...
47747c4ca59e00c022fc1686a5a26768a09096f0acbbaf56c7aad0365552e9d1
Python
2,761
60
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
e4bb07c0682797ca7e6d74713ec43cbe344b52a0a34fdb391c6ee3f17cd0bc35
Python
2,762
84
import pytest import random from CybORG import CybORG from CybORG.Agents.Wrappers import BlueEnterpriseWrapper from CybORG.Simulator.Scenarios import EnterpriseScenarioGenerator from CybORG.Agents import SleepAgent, RandomSelectRedAgent, EnterpriseGreenAgent, FiniteStateRedAgent, cc4BlueRandomAgent @pytest.fixture(p...
2f1e105ecbbc5ff3f357458f7c34f9d7a01e25c91ff949da31bd22819ae4994f
Python
2,763
76
from typing import Union from pandas._typing import FilePath, WriteBuffer class SoccerTrackMixin(object): def save_dataframe( self, path_or_buf: Union[FilePath, WriteBuffer[bytes], WriteBuffer[str]], ) -> None: """Save a dataframe to a file. Args: df (pd.DataFrame...
82840b23b9c2ffd54d93eb6fd17ee94275fd69499cdb2d22183afc698d49c467
Python
2,763
94
"""Regression: pyclient ZnDraw refreshes cached_length on FramesInvalidate (finding #3). Stand up a real server via ``server_factory``, register an admin user, create a room, and spawn a ``ZnDraw`` client pointed at that room's composed address. A second authenticated HTTP request appends a frame. The first client's `...
0d2daf75a2955fac270164b82ca86facd1e5a3c7029163139859e055b2900c59
Python
2,764
96
from tests.common import * import pathlib import json METHODS = { "mnn": {"output_type": "full"}, "scanorama": {"output_type": ["embed", "full"]}, "seurat": {"output_type": ["embed", "full"], "R": True}, "trvae": {"output_type": ["embed", "full"], "no_scale": True}, "scgen": {"output_type": ["full"...
6b0e412536c74df68f7a6768a62c5763473f9726eaf1dc1206ab712502133834
Python
2,764
87
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp from collections import OrderedDict import mmengine import torch from mmengine.runner import CheckpointLoader def convert_twins(args, ckpt): new_ckpt = OrderedDict() for k, v in list(ckpt.items()): new_v = v ...
c4f2f8f9ef80fd15fedc72b421e10bc3cb83aa07202eac7dac41faaeae945333
Python
2,767
67
import torch import torch.nn as nn import torch.nn.functional as F class FeedForwardNetwork(nn.Module): def __init__(self, input_size, hidden_size, output_size, dropout_rate=0): super(FeedForwardNetwork, self).__init__() self.dropout_rate = dropout_rate self.linear1 = nn.Linear(inpu...
f86d98da8239b04e44044db08d3c399d1158be27cb9739695e9ca252ea765407
Python
2,769
74
baseFileName = './shellScripts/sparse099_10class_' baseSimTag = 'sparse099_10class_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse=-1, ...
5d729dd33573c0768db774eeb517635f122576d330a34801a0ef74b3e6ac6a68
Python
2,770
98
"""Tests for CLI admin commands (users list, users login).""" from __future__ import annotations import json from unittest.mock import MagicMock, patch import pytest from typer.testing import CliRunner from zndraw.cli_agent import app from zndraw.cli_agent.connection import Connection from zndraw.state_file import ...
8453a1659f1130f00fe33f20d49bdebaefca80407ac9c9ddb4f9eba76740705e
Python
2,772
98
import operator def _acgt_table(): """ Return a translation table that maps A, C, G, T characters to the lower four bits of a byte. Other characters (including possibly IUPAC characters) are mapped to the most significant bit (0x80). Lowercase versions are also translated, and U is treated the sa...
0bbde2addac9ab66d7c8d06c9819c1be1a7e5da54709c40d52b5071ecbc6a33d
Python
2,773
71
# import cProfile, pstats # pr = cProfile.Profile() # pr.enable() # test the performance of methods depending on the number of datapoints import numpy as np import matplotlib.pyplot as plt import hickle as hkl import os from grid_cell.sphere_manifold import Circle_Manifold, get_circle_mesh from grid_cell.ori_tuning_ma...
1963970111c4594ad2a0acc2c26718cb209ff45b8dee9f24754f29df049474f5
Python
2,774
69
"""Context-Aware Implicit Neural Representations to Compress Earth Systems Model Data DEVELOPED AT: Department of Chemical Engineering University of Utah, Salt Lake City, Utah 84112, USA DIRECTOR: Prof. Salah A Faroughi DEVELOPED BY: ...