sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
88bf304b5db648738ee27f6700f7e2ff392a3c93d16428778e0b3827d3bd243c | Python | 1,053 | 25 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
dbf6144822709845f0501a67ed1f8948d12d321e4952174e8607ed59d0cc5ff2 | Python | 1,053 | 37 | from models import *
def get_network(network, depth, dataset):
if network == 'vgg':
return VGG(depth=depth, dataset=dataset)
elif network == 'resnet':
return resnet(depth=depth, dataset=dataset)
elif network == 'resnet_bottle':
return resnet_bottle(depth=depth, dataset=dataset)
... |
df31b7cf3817c71ca9a3c31ba091e3d3583d946b8f4df1821538681385e08b32 | Python | 1,053 | 32 | #!/usr/bin/env python3
"""Simple recipes for scanpy pre-processing."""
import numpy as np
import scanpy as sc
import logging
def recipe_preprocess(adata, min_cells=3, min_genes=100):
"""Simple scanpy recipe for single-cell preprocessing for examples"""
sc.pp.filter_genes(adata, min_cells=min_cells)
sc.pp.... |
2e4c97ff8527483407d2884af82ddaace67bb88272be667f62a7be11fd4c3d0d | Python | 1,057 | 31 | import torch
from transformers import GPT2Model, GPT2Config, GPT2LMHeadModel
from transformers import BartConfig, BartModel, BartForConditionalGeneration
from rouge import Rouge
import torch.nn as nn
class gpt2_generate(nn.Module):
def __init__(self, hps):
super(gpt2_generate, self).__init__()
sel... |
e7ede0049ea2f85c2e2b932b3005d69548a821e2c1cc6b4caa026e0a784164ec | Python | 1,058 | 22 | #! /usr/bin/env python
# usage: python _run-graphprot-h0.py <GraphProt.profile> <GraphProt.predictions> <test.fa>
import sys
with open(sys.argv[1]) as prof, open(sys.argv[2]) as pred, open(sys.argv[3]) as fa:
while True:
fa0=fa.readline().strip()
fa1=fa.readline().strip()
if (not fa0) or (n... |
eed94da2f2e8056fa0ceabed88b87fedf25ec849494991a956b9f2cbad33632c | Python | 1,058 | 22 | import torch
import torch.nn as nn
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
backwarp_tenGrid = {}
def warp(tenInput, tenFlow):
k = (str(tenFlow.device), str(tenFlow.size()))
if k not in backwarp_tenGrid:
tenHorizontal = torch.linspace(-1.0, 1.0, tenFlow.shape[3], device=d... |
f6168559158af298a8aceec47f9f61583544831414a5186320d01de9228ba68f | Python | 1,058 | 44 | import pathlib
import pytest
def pytest_generate_tests(metafunc):
# Run all tests both with and without speedups
metafunc.fixturenames.append('speedups')
metafunc.parametrize('speedups', [False, True])
@pytest.fixture(scope='session')
def cwd() -> pathlib.Path:
return pathlib.Path(__file__).parent
... |
70e5251f3914efc07474a618decd3af270d1417da60427a67d188a4f2c8a2522 | Python | 1,059 | 29 | import pickle
import argparse
import lib.dataset_config_parser.dataset_config_parser as dcp
from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Match cells between WN and nscenes with cosine similarity')
parser.ad... |
71fd5913146c86359e1dc0ebd0fc286180a8505c9ce824d3be5a43640a3373cf | Python | 1,059 | 44 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import argparse
import pysam
def label_mosaics(vcf, mosaics):
for record in vcf:
if record.id in mosaics.keys():
record.info['MOSAIC'] = mosaics[record.id]
yield record
def main():
parser = argparse.ArgumentParser(
... |
d21553f38344d8b09027aacbcda89a1b23fafb56a80ca3d02c177e368da1c7f9 | Python | 1,060 | 35 | import pandas as pd
from data_profiling import ProfileReport
from data_profiling.utils.cache import cache_file
if __name__ == "__main__":
file_name = cache_file(
"rdw.parquet",
"https://raw.githubusercontent.com/pandas-profiling/pandas-profiling-data/master/data/rdw.parquet",
)
d... |
ea913a0f1f6cb29abfb2dff6cc5ce75b6c4465b9f4790f4918683cc1ef53d18f | Python | 1,060 | 42 | from abc import ABC, abstractmethod
from typing import Any, Dict, Optional
class Renderable(ABC):
def __init__(
self,
content: Dict[str, Any],
name: Optional[str] = None,
anchor_id: Optional[str] = None,
classes: Optional[str] = None,
):
self.content = content
... |
63d34e138ac3133873458033c4e8f4597611b42c54d42e1d2b28368a20f46464 | Python | 1,061 | 37 | import abc
from typing import Callable
from ray.core.generated.events_base_event_pb2 import RayEvent
class PlatformEventProvider(abc.ABC):
"""
Base interface for all platform-specific event providers (e.g. Kubernetes).
"""
def __init__(self, callback: Callable[[RayEvent], None]):
"""
... |
59bd3a621637c213e174bcdc7faa75901bcecd1709b5f41e95210a664fc5e98e | Python | 1,063 | 20 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
63305eb4268a48ef7f908947a6d9191acec37346876fca15b128fadd28f4b1e6 | Python | 1,063 | 21 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
dfe3aa47f8b42d679e1a3eeb28154f81fb804d00e8ae5a55df1cc36a2199bea1 | Python | 1,064 | 36 | # -*- coding: utf-8 -*-
"""
This is the implementation of the model corresponding to the pre-print `Iso-orientation bias of layer 2/3 connections: the unifying mechanism of spontaneous, visually and optogenetically driven V1 dynamics`
Rózsa, T., Cagnol, R., Antolík, J. (2024).
https://www.biorxiv.org/ TODO: Update
"""
... |
6c3c5e97f6bedef1896ed34290848b6fb1ad4b5d91f256777664902b03777177 | Python | 1,065 | 35 | # default scope is mmdet
_base_ = [
'./base_editor/tienet_enhance_model.py',
'./base_detector/atss_r50_fpn_1x_rtts-coco.py'
]
model = dict(
_delete_=True,
type='lqit.DetectorWithEnhanceModel',
detector={{_base_.model}},
enhance_model={{_base_.enhance_model}},
train_mode='enhance',
pred_... |
96b45499484c6e317cb5234212f024e71f05b1740652a240752c05dcf7154fc3 | Python | 1,065 | 35 | # default scope is mmdet
_base_ = [
'./base_editor/tienet_enhance_model.py',
'./base_detector/tood_r50_fpn_1x_urpc-coco.py'
]
model = dict(
_delete_=True,
type='lqit.DetectorWithEnhanceModel',
detector={{_base_.model}},
enhance_model={{_base_.enhance_model}},
train_mode='enhance',
pred_... |
9acf2600b152c75c759b72db08bbc251e2fd0856510bda760334a3073d2ee511 | Python | 1,065 | 33 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from scipy.spatial import distance_matrix
from functools import lru_cache
from unicore.data import BaseWrapperDataset
class Distan... |
b88fd93e9d147819970ced42a5483d2b0eba7bea1682251fd6176bef4a73eb7c | Python | 1,065 | 35 | # default scope is mmdet
_base_ = [
'./base_editor/tienet_enhance_model.py',
'./base_detector/tood_r50_fpn_1x_rtts-coco.py'
]
model = dict(
_delete_=True,
type='lqit.DetectorWithEnhanceModel',
detector={{_base_.model}},
enhance_model={{_base_.enhance_model}},
train_mode='enhance',
pred_... |
c170999cfdd4a5e3e5c9e7fa93cb24ebf909be5292bdb2fada3799effbc0972f | Python | 1,065 | 32 | # Copyright 2023 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
fda0168ec0aab9e8364101b1c40847cab5bda1a1616b8e74382fc6393103072f | Python | 1,065 | 35 | # default scope is mmdet
_base_ = [
'./base_editor/tienet_enhance_model.py',
'./base_detector/atss_r50_fpn_1x_urpc-coco.py'
]
model = dict(
_delete_=True,
type='lqit.DetectorWithEnhanceModel',
detector={{_base_.model}},
enhance_model={{_base_.enhance_model}},
train_mode='enhance',
pred_... |
4a1fff7a153c1af8a46f9be97b18124fcf4eec75a8e40ab966f7f0682bf0f301 | Python | 1,066 | 26 | # plot penetration maps for each recording site
# except for CRD - didn't save stereotactic coords for him
import os
rdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
import sys
sys.path.append(rdir)
from settings import RESULTS_DIR
from helpers.plotting import penetration_map
import pandas as pd
impor... |
be4b3207cf035d83b2b09bb682b6e38b264b97b671f8270884837ef2ca4ae170 | Python | 1,066 | 32 | """
Time-series profiling example for USA AirQuality dataset
"""
import pandas as pd
from data_profiling import ProfileReport
from data_profiling.utils.cache import cache_file
from data_profiling.visualisation.plot import timeseries_heatmap
if __name__ == "__main__":
file_name = cache_file(
"pollutio... |
4abea2893c3e214d14a8f670c21ffd2a93bef78d13374c933f20d1962a4d65a8 | Python | 1,067 | 41 | # flake8: noqa: E402
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import warnings
from importlib.metadata import PackageNotFoundError, version
# TO... |
a2219ad3a78216f1b59396bb2b9f821b5ac89cf97194bef934df336f065d966c | Python | 1,067 | 30 | import sys
import os
sys.path.insert(0, "/srv/home/zgaleday/torch_pgn")
from torch_pgn.train.run_training import run_training
from torch_pgn.train.hyperopt import hyperopt
from torch_pgn.args import TrainArgs, HyperoptArgs
args = HyperoptArgs()
args.from_dict({'raw_pdb_path': 'vi',
'raw_mol_path': '/s... |
a6c1b431a5ad55da86993498f14e8fab6a405c33dddad5204064cff09414a982 | Python | 1,067 | 33 | import numpy as np
import k4a
if __name__ == '__main__':
# Open Device
device = k4a.Device.open()
# Start Cameras
device_config = k4a.DEVICE_CONFIG_BGRA32_1080P_NFOV_UNBINNED_FPS15
device.start_cameras(device_config)
# Get Calibration
calibration = device.get_calibration(
depth_mo... |
5cccc5f7291d32da938e794b5940c6a21ade97af7a73d7baefc20638b3780fb4 | Python | 1,069 | 20 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
13134ff8f0ea3d67844442780b244dbf17d5eefa375c40b72981fd31a9932295 | Python | 1,070 | 35 | # default scope is mmdet
_base_ = [
'./base_editor/tienet_enhance_model.py',
'./base_detector/retinanet_r50_fpn_1x_rtts-coco.py'
]
model = dict(
_delete_=True,
type='lqit.DetectorWithEnhanceModel',
detector={{_base_.model}},
enhance_model={{_base_.enhance_model}},
train_mode='enhance',
... |
933fc5bc3288f3f82fa3f40810e64b33255d297d7659355e2a02085460dea5f3 | Python | 1,070 | 35 | # default scope is mmdet
_base_ = [
'./base_editor/tienet_enhance_model.py',
'./base_detector/retinanet_r50_fpn_1x_urpc-coco.py'
]
model = dict(
_delete_=True,
type='lqit.DetectorWithEnhanceModel',
detector={{_base_.model}},
enhance_model={{_base_.enhance_model}},
train_mode='enhance',
... |
5639b9749559f157b070b741a42664429bb09f314aa4e83ee14ed4ab480d16eb | Python | 1,072 | 35 | # default scope is mmdet
_base_ = [
'./base_editor/tienet_enhance_model.py',
'./base_detector/faster-rcnn_r50_fpn_1x_urpc-coco.py'
]
model = dict(
_delete_=True,
type='lqit.DetectorWithEnhanceModel',
detector={{_base_.model}},
enhance_model={{_base_.enhance_model}},
train_mode='enhance',
... |
5e351e579e0047d1afa1c757a096fefd3e2a6b740847b7510ac4bbb5c2939e33 | Python | 1,072 | 33 | from typing import Tuple
from pyspark.sql import DataFrame
from data_profiling.config import Settings
from data_profiling.model.summary_algorithms import describe_supported
@describe_supported.register
def describe_supported_spark(
config: Settings, series: DataFrame, summary: dict
) -> Tuple[Settings, DataFram... |
73a3840d0b342a2d4f20d2adfc05d5c8307c4316d08e2d53e23e2a3874fc5f46 | Python | 1,072 | 20 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
f62120127263248b3452ff691e375c1d7011961955a341ad4f9953e8fcaa971c | Python | 1,072 | 35 | # default scope is mmdet
_base_ = [
'./base_editor/tienet_enhance_model.py',
'./base_detector/faster-rcnn_r50_fpn_1x_rtts-coco.py'
]
model = dict(
_delete_=True,
type='lqit.DetectorWithEnhanceModel',
detector={{_base_.model}},
enhance_model={{_base_.enhance_model}},
train_mode='enhance',
... |
1ec44190029a7b32e8b4e68c47992ca8286d5fd3a2c3e390fc1a38927845f556 | Python | 1,073 | 20 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
aa0edef94718e192af661b176190609fcabe5a525d442fa59fd56c363619c24e | Python | 1,073 | 39 | # Ultralytics YOLO 🚀, GPL-3.0 license
from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING
try:
from torch.utils.tensorboard import SummaryWriter
assert not TESTS_RUNNING # do not log pytest
except (ImportError, AssertionError):
SummaryWriter = None
writer = None # TensorBoard SummaryWriter instan... |
dbe2a7567276cd5b3df476994991e419cc4777bd979c2a1213c50007be6d1f27 | Python | 1,073 | 32 | #---------------------------------------------------------------------
# Author: Brandon S Coventry
# Date: 12/23/23
# Purpose: Just to help plot t-test comparison data
#---------------------------------------------------------------------
import numpy as np
import pickle as pl
import matplotlib.pyplot as plt
import pd... |
fc182a598254853e63983732cd3c37dfeb682b50d021a36f4db09282dd4c1528 | Python | 1,073 | 34 | """
Example for using the log_info() function on the chip and printing it in
python.
"""
from spinnaker2.configuration import PEConfig, ExperimentConfig, MemoryRegion, Experiment
from spinnaker2.coordinates import ByteAddr, WordAddr, PE
from spinnaker2.neuron_models.common import add_log_memory_region
from spinnaker2.h... |
0ae4e43961e4f2e5c462f1e41d740ae797f25871e49aa405f4396135803ed127 | Python | 1,074 | 21 | ##Rosetta and gromacs should be installed
import os
import numpy as np
os.system('python predict.py -i 1.pdb')
f = open(r'output/0_out.mol')
ligand = f.readlines()
f.close()
lig_coord = []
for ligand_atom in ligand[7:]:
if ligand_atom[0] == '@':
break
lig_coord.append(np.array(
[float(ligand_ato... |
9cb9d0b54aa97f1874ca3d7e3ee19c4e423e57a718c45b98f3c23037976e15be | Python | 1,075 | 36 | # Generated by Django 4.1.6 on 2023-07-17 21:29
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("infer", "0019_proteometask_completion_timestamp_and_more"),
]
operations = [
migrations.CreateModel(
... |
9d14111f545ba6c1cd26fabcdec6c388e0eeb838d207ca44e8493fdeed304177 | Python | 1,076 | 38 | import os
import shutil
import subprocess
from typing import List, Optional
import runfiles
def gen_extract(
zip_files: List[str],
clear_dir_first: Optional[List[str]] = None,
sub_dir: str = "python",
):
r = runfiles.Create()
_repo_name = "io_ray"
root_dir = os.environ.get("BUILD_WORKSPACE_D... |
9f9f40d2f27aa1a593e73ac45ee8c82dab6154d6856d6e305fbcc41c32b668a4 | Python | 1,076 | 28 | # Env var set by job manager to pass runtime env and metadata to subprocess
RAY_JOB_CONFIG_JSON_ENV_VAR = "RAY_JOB_CONFIG_JSON_ENV_VAR"
# The plugin config which should be loaded when ray cluster starts.
# It is a json formatted config,
# e.g. [{"class": "xxx.xxx.xxx_plugin", "priority": 10}].
RAY_RUNTIME_ENV_PLUGINS_... |
2964e20fb0b9e908c977ecc102478f874c4c1d1f2a1da28cd7f30f9a9fda3123 | Python | 1,077 | 21 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
52d850f05c503d418c742fe7e672b1a585aa61b951da1d8a57c7b7baa194df13 | Python | 1,077 | 33 | import torch
def conjugate_gradient(A_product_func, b, tol=1e-10, max_iter=10):
"""Conjugate Gradient (CG) method.
This function solves Ax=b for the vector x, where A is a real
positive-definite matrix and b is a real vector.
Args:
A_product_func (callable): Callable that returns the product... |
59a4fc5db830691ed2233d6ceb9b46cbbbd2b18b29c8bb6f11c155dd5ddfdab4 | Python | 1,078 | 41 | from Load_prediction import ddpred
from Para import parameter
import numpy as np
trainday = 30
zones = 'Multi'
modes='Cooling'
par = parameter()
par.para_load(zone=zones)
ddp = ddpred()
adj = np.array([[0, 1, 1, 1, 1],
[1, 0, 1, 0, 1],
[1, 1, 0, 1, 0],
[... |
8e0ff1064b264952acf55e73bfff8631188bb1d76a19f54733b13a9ec201ffa7 | Python | 1,078 | 34 | import numpy as np
from siapy.entities import SpectralImage
from siapy.transformations.image import (
random_crop,
random_mirror,
random_rotation,
rescale,
)
# Create a sample spectral image for demonstration
rng = np.random.default_rng(seed=42)
image_array = rng.random((100, 100, 10)) # height, widt... |
e0dde935a3827b656b928c473a816c83495f70188af1343299dcc359d2060c09 | Python | 1,078 | 37 | import os.path
from os.path import *
import unittest
import mock
from .. import util
@mock.patch.object(util, 'os')
class TestBuildDatafiles(unittest.TestCase):
def setUp(self):
# For os.walk
self.walk = [
['', ['dir1','dir2'], ['1.txt','2.txt']],
['dir1', [], ['3.txt','4.... |
118b71bcf1310c14c19a2fdf18584202243e548791caa6b0744906f69982f71a | Python | 1,079 | 34 | import tensorflow as tf
from projectmetis.python.models.model_def import ModelDef
class MelanomaFC(ModelDef):
def __init__(self, IMAGE_SIZE=[1024, 1024]):
self.IMAGE_SIZE = IMAGE_SIZE
def get_model(self):
base_model = tf.keras.applications.Xception(
input_shape=(*self.IMAGE_SIZE... |
31589eb9df6e272c78ac96c49b338c7797025f8a7f8520870593e971f3d1a42e | Python | 1,080 | 21 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
e22f1edbf0681365e16b409b5b5a8b1b512e8c08d97dacd08abf7a60b8c82bcf | Python | 1,081 | 34 | """Provide function for visualizing equilibrium sampling or NEQ switching results"""
import nglview as ng
from endstate_correction.constant import zinc_systems
import mdtraj as md
from openff.toolkit.topology import Molecule
def visualize_mol(
smiles: str,
traj_dir: str,
):
"""Inspect conformations genera... |
ac549b75eb8d055f195e52cd921349de3ade8f63f0f49584e0b93b7c03820684 | Python | 1,082 | 34 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
b6b1d14e33578e52573fcb970e7c88f2107998e6ee015a9424282ef00e255a2f | Python | 1,082 | 28 | from .base import BaseModelConfig
from optuna import Trial, Study
from argparse import ArgumentParser, Namespace
def _get_config_class(temp_args):
registry = BaseModelConfig.__subclasses__()
net_names = [net_type.model_name for net_type in registry]
if temp_args.model.lower() not in net_names:
r... |
7a9a530844109390e331d40ea930d82fa1aae13a0224e86583ad41945219accb | Python | 1,083 | 32 | import torch
from ..base import Transform, randperm
class Permute(Transform):
"""Split the signal into random segments and shuffle them, shared across leads.
Args:
n_patches: number of segments.
"""
def __init__(self, n_patches=10, p=1.0):
super().__init__(p)
if n_patches < ... |
e1fcf6eeb39eaf4ed0ab8645fb145b1861813eed09b853002e645d251d39cac1 | Python | 1,083 | 37 | _base_ = ['./atss_r50_dffpn_1x_rtts-coco_lr002.py']
model = dict(
_delete_=True,
type='lqit.EDFFNet',
detector={{_base_.model}},
edge_head=dict(
_scope_='lqit',
type='EdgeHead',
in_channels=256,
feat_channels=256,
num_convs=5,
loss_enhance=dict(type='L1Lo... |
6214645dab40e2f51c31ab55460e4f6316776f2b2eb735e790b07c30d41f09af | Python | 1,084 | 41 | from Load_prediction import ddpred
from Para import parameter
import numpy as np
trainday = 180
zones = 'Multi'
modes='Heating'
par = parameter()
par.para_load(zone=zones)
ddp = ddpred()
adj = np.array([[0, 1, 1, 1, 1],
[1, 0, 1, 0, 1],
[1, 1, 0, 1, 0],
... |
c10432a5241441b90b7b97178b5d0b8c7d3521016cb868733fb119b214147f23 | Python | 1,084 | 33 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
322b81ad8b64a3337ee67ed1e55399145d0347258ced4a11032f5ebe19c01402 | Python | 1,086 | 32 | import sys
sys.path.insert(1, '..')
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
... |
41c51328cf9a9f8c8fd0a7ba573f68c5cc155c32b29e95262d954dc86ccfe49f | Python | 1,086 | 32 | import pickle
import mdtraj as md
from openmm import unit
from openmm.app import CharmmPsfFile, CharmmCrdFile, PDBFile
def convert_pickle_to_dcd_file(
pickle_file_path: str,
path_to_psf: str,
path_to_crd: str,
dcd_output_path: str,
pdb_output_path: str,
):
"""Convert pickle file trajectory to ... |
785099b4edba9db7a987e901d80baad4f7f6deacd7f6514eca0f034f20f99398 | Python | 1,086 | 33 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
1117e9a2c9fac0ae6d79a5b26ea3299292f64408626c1b9b23b1f2b947382558 | Python | 1,087 | 34 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
2a1c69983a09791beedc62aa9d66db2a837c7f46799024b570a657c60c92ed6b | Python | 1,087 | 19 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This library is fre... |
49161d2cc2086ee7aa3385e6deada2a36881bd49b99f7d2488d5f6599dd3f54f | Python | 1,087 | 44 | import os
os.environ["RAY_DEDUP_LOGS"] = "0"
import ray
from concurrent.futures import ProcessPoolExecutor, as_completed
import multiprocessing
import numpy as np
@ray.remote
def generate_response(request):
print(request)
array = np.ones(100000)
return array
def process_response(response, idx):
pr... |
6126a5d445063721f608e00969f482f0f797141c420019ae6c9e4e88f17ed089 | Python | 1,087 | 33 | # euclidean distance
import os
# os for interaction with the system
import sys
# sys to script arguments (argv) this is for you to be able to run in your terminal
import numpy as np
# numpy to do basic maths renamed np
import pandas as pd
# Panda to manipulate csv matrices
#read the BCS coordinates file.csv
... |
1069c3204f363187c84e0a90d9e931268d436dd642e360e8d190d718afc94a59 | Python | 1,089 | 54 | # -*- coding: utf-8 -*-
import traceback
class ErrorObserver(object):
def __init__(self):
self.CallDataType = 'string0'
self.messages = set()
def __call__(self, obj, event, message):
if message not in self.messages:
print(message)
self.messages.add(message)
... |
3a8e52aaf80f368f9f740baf62315b569af22049a18e79437463747dff6b6417 | Python | 1,089 | 51 | # __anti_pattern_start__
import ray
ray.init()
global_var = 3
@ray.remote
class Actor:
def f(self):
return global_var + 3
actor = Actor.remote()
global_var = 4
# This returns 6, not 7. It is because the value change of global_var
# inside a driver is not reflected to the actor
# because they are runni... |
3aaf2ca2d333742e5068ff790972d7589e854af65a0cabf25cc8660b43c6f4ee | Python | 1,089 | 34 | import importlib
import importlib.metadata
def test_version_fallback_on_import_error(monkeypatch, speedups):
"""When importlib.metadata.version raises, __version__ falls back."""
# Monkeypatch version() to raise PackageNotFoundError
def _raise(name):
raise importlib.metadata.PackageNotFoundError(... |
762938fb15ad87a7c500526aad6b48616f9db7f9f8ec7e6224709f585e394486 | Python | 1,089 | 42 | """
test for the 'i_offset' parameter of the LIF neuron
"""
from spinnaker2 import snn, hardware, brian2_sim
def test_lif_neuron_i_offset():
params = {
"threshold":1.,
"alpha_decay":1.,
"i_offset":0.123,
"reset":"reset_by_subtraction",
}
pop1 = snn.P... |
9b81075147aac7f320a84b3b05463beb51c9123c30441f509a13c9f1be6add72 | Python | 1,089 | 35 | import os
from ci.ray_ci.windows_container import WORKDIR, WindowsContainer
class WindowsBuilderContainer(WindowsContainer):
def __init__(
self,
python_version: str,
upload: bool,
) -> None:
super().__init__(
"windowsbuild",
volumes=[
f"... |
9b822314a34f526799b8df9e3ae1aba8d9900ac4a8d60c80bb702d61080887f6 | Python | 1,089 | 42 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import pytest
import torch
from tests.core.models.uma.uma_nitro.nitro_test_utils import (
direct_h... |
c555ba14e5695f73343d78cd1edbe3e01fba4f8aaeb479eefd2fe64a15c40536 | Python | 1,089 | 40 | import os
import json
from typing import Optional
import boto3
from command_utils import collect_morphology, morphology_png_to_s3
from harness import step_fns_ecs_harness
s3 = boto3.client("s3")
def plot_original(token: Optional[str] = None):
reconstruction_id = os.environ["RECONSTRUCTION_ID"]
working_buck... |
e8197aa9aa9a65f29832e94b0effa6b443a260f8c7bcf93ac2fa08559a8339f5 | Python | 1,089 | 37 | # flake8: noqa
# __response_to_object_ref_example_start__
# File name: response_to_object_ref.py
import ray
from ray import serve
from ray.serve.handle import DeploymentHandle, DeploymentResponse
@ray.remote
def say_hi_task(inp: str):
return f"Ray task got message: '{inp}'"
@serve.deployment
class SayHi:
de... |
74c3031471d9c71812ca967d7b31ee5ec0a0b01b5fecfe18ecc7d6ba1131f441 | Python | 1,091 | 36 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
from .adsorbml_runner import AdsorbMLRunner
from .adsorption_runner import AdsorptionRunner
from .adsor... |
09f5a4d157e82f1d68517eaf4103cf3c31216b7c05c7d3fc98eb9583818a09b6 | Python | 1,092 | 24 | from .prism import *
import warnings
def get_fraction(bp, which_theta, state_or_type):
# assert isinstance(bp, BayesPrism)
assert isinstance(which_theta, str) and which_theta in ["first", "final"]
assert isinstance(state_or_type, str) and state_or_type in ["state", "type"]
if which_theta == "first" and... |
5aceaf8d400e2375bcc8dff0289856d7be1c2fd52fa9dd3ba7cdb49309cad416 | Python | 1,092 | 25 | ####################################################################################################
# Copyright (c) 2019, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is free softw... |
621ec1e6bb04591b9e94f9f10709cd1b3ef0a4dee5697943fe2f9582447d46ff | Python | 1,093 | 34 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
9d65c704bc21872b42a4bd227b3c9b8ddc4a0064cd133f718c321dfebf6b9728 | Python | 1,093 | 33 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
a6ae82f41c10e54846b4b9bd859afc10db891569d2d020dd6d6d95c8f1086a8d | Python | 1,093 | 41 | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 29 18:16:02 2021
@author: Nikhil
"""
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
import matplotlib as mpl
from matplotlib import ticker
import matplotlib.gridspec as gridspec
import matplotlib.patches as mpatches
from mpl_toolkits import... |
cf8eaafc08d0a68f540a9975473aab9c0c45964325af4bfe88828c300991a8f5 | Python | 1,093 | 33 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
fb28fac44fa8df9ed5af55e8bb8fa66f3af268e377ded2fb150d75b3a51c503e | Python | 1,093 | 35 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
d8130048ff94da514af7055f540fba934c525800a7e824edb1dbda537b293fee | Python | 1,094 | 35 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
dc05a9d90b38dabb5042ed9b793a0eded4302c72917f7e270f5828fcc8665034 | Python | 1,095 | 37 | '''
Animation for the double pole balancing problem.
'''
import os
import pickle
import matplotlib.animation as animation
import matplotlib.pyplot as plt
import examples.cart2pole.cart_two_pole_base as cart
fig = plt.figure(figsize=(8, 2.4))
ax = fig.add_subplot(1, 1, 1)
pole_length_1 = 1.0 / 2.0
pole_length_2 = 0... |
ff003de8b778c3d07caf153611a0e14da8d5a35c1d5467fab05664cd398284c8 | Python | 1,095 | 35 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
23f08d6905662f591110eb21fbbe0a9728a11b04823617e1abc2db488cc5bb2b | Python | 1,096 | 35 | """OmicVerse Skill Seeker
A lightweight CLI for working with OmicVerse-bundled Claude Agent skills.
Features:
- List discovered skills (title, slug, description)
- Validate SKILL.md frontmatter and required files
- Package skills into Claude-uploadable .zip files
This tool intentionally reuses the project SkillRegis... |
77ec3df5293c1a09ea4f4675798d9d960e395670efb899e0b9cabb8588c39125 | Python | 1,096 | 40 | """Domain research utilities for LLM models.
This submodule exposes high-level interfaces like :class:`ResearchManager`.
Deprecated: `omicverse.llm.dr` is deprecated and will be removed in a
future release. Please import from `omicverse.llm.domain_research` instead.
"""
from __future__ import annotations
import war... |
92896cab101143ea23653ef2255537890b62e35bc666992358b68def37d7bbfd | Python | 1,096 | 35 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
b1d4560a1cdd724dbbadb83709fd857a601b9d9eb2a117abce0e4dd31aa8878c | Python | 1,096 | 38 | import numpy as np
import pytest
from pfrl.explorers.additive_gaussian import AdditiveGaussian
@pytest.mark.parametrize("action_size", [1, 3])
@pytest.mark.parametrize("scale", [0, 0.1])
@pytest.mark.parametrize("low", [None, -0.4])
@pytest.mark.parametrize("high", [None, 0.4])
def test_additive_gaussian(action_size... |
651a4177c9eba35da454224f020afe160af089fbd5aceb458d2a1f3789f844cf | Python | 1,097 | 38 | import sys
from argschema import ArgSchemaParser
from neuron_morphology.swc_io import morphology_from_swc, morphology_to_swc
from neuron_morphology.transforms.affine_transformer._schemas import (
ApplyAffineSchema, OutputParameters)
from neuron_morphology.transforms.affine_transform import AffineTransform
def m... |
060108e22f2c254077e4ac3dd09f55f61cc44a22c1d1842c8ff26221f87a3c91 | Python | 1,098 | 31 | from dataclasses import dataclass
from typing import List, Optional, Union
import numpy as np
import torch
from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available
@dataclass
class TextToVideoSDPipelineOutput(BaseOutput):
"""
Output class for text to vid... |
4c8f5cab9f05105d1d1076511f116ec17816a305d6c42422ebb81ee07e7b968e | Python | 1,098 | 44 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import pandas as pd
from monty.serialization import loadfn
def load_json_to_df(
path: str,
in... |
78df882ef9abb0989e293be35a6167346523e73502b5de1e69786f6c6dff8106 | Python | 1,098 | 35 | import os
import bios
from algo import Client
def runWorkflow(external_client: Client = None, data_location: str = "data/synthetic"):
client = external_client
if client is None:
client = Client()
print("starting script")
# read config
config = bios.read(os.path.join(data_location, 'confi... |
9929f227c450fc7b3be22d788287fd73597062a8c45a93e95aa71443698cf1e3 | Python | 1,098 | 20 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
8f063955b89731d37bba67bb3d752f297677ca2b404cf07b151c1d1f5be72c8b | Python | 1,099 | 38 | # -*- coding: utf-8 -*-
"""
Project: Psychophysics_exps
Creator: Miao
Create time: 2020-12-30 21:58
IDE: PyCharm
Introduction:
"""
import math
def get_weighted_mean(distribution: list, weights: list) -> float:
"""
:param distribution: list of int or float to calculate the weighted mean
:param weights: we... |
7b20c7ce18f51eaa6777ed97bda48f6dba2b96276809dbaeaf342aae81abf70b | Python | 1,100 | 27 | import cPickle
import os
from pkg_resources import resource_filename
from scrape_valid_non_human_allele_names import valid_species_directories
DIRPATH = os.path.abspath(os.path.dirname(__file__))
human_allele_pickle_file = resource_filename('valid_allele_names', 'human_allele_names.p')
non_human_allele_pickle_filena... |
851b56bd1e9abae792f59d17a1c0a6a2e5e92a6ade5b8e13c01ede279ba2afb5 | Python | 1,100 | 32 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
b97b61a839b826f93a5b2d63ccff599337591a8ab76bd4d21db2f54ddb568a94 | Python | 1,100 | 29 | import streamlit as st
import subprocess
from logger_setup import logger
def execute_command(command: str) -> str:
"""Run a shell command and return its output."""
try:
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
logger.info(f"Executed command: {com... |
efd11c1d6ac6f8c93760a37f904a1458c8a397f80736f7a25364d893208be10a | Python | 1,101 | 20 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
35f0b65c205cdf729a6446ed8dcf24d3664d77249a71e02a005e102445b41537 | Python | 1,102 | 44 | import torch
import numpy as np
# Define performance metrics
def MSE(expr, expr_hat):
return np.mean(np.square(expr_hat - expr))
def MAE(expr, expr_hat):
return np.mean(np.abs(expr_hat - expr))
def RMSE(expr, expr_hat):
return np.sqrt(np.mean(np.square(expr_hat - expr)))
def MAPE(expr, expr_hat, thresho... |
475d7185b4d858567159b628f7685af8f453df51301238959451b7d0fc49b928 | Python | 1,102 | 35 | # Copyright 2021 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
5ded8b112a14fc87b2d9d5e19f8fadc326dc7bfe0522aae0e94c45eac8136c37 | Python | 1,102 | 37 | # 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 writing, software
# distributed under th... |
eaeb0ad4adf3cb346143f291493e584ab756e0f80f4ad00c86e551b1ea1105b8 | Python | 1,102 | 34 | import nibabel as nib
from os import path
def flip_axis(img_path,
axis=2,
out_path='flipped.nii.gz',
):
"""Flip along an axis, while avoiding axis inversion (e.g. left-right inversion to right-left).
Parameters
----------
img_path : str
Path to a NIfTI file.
axis : {0,1,2}, optional
Integer specifying one... |
b91b615c4850d6e6a6693a8188bb5ffcc950627f80707d34c54225985f975549 | Python | 1,103 | 22 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.