sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e0916583a72c14064a18d94d16448579e5c30ab46c11d95d58f0cce23ae6dedf | Python | 1,014 | 27 | # These imports determine whether or not a user has the required dependencies
# to launch the optional dashboard API server.
# If any of these imports fail, the dashboard API server will not be launched.
# Please add important dashboard-api dependencies to this list.
import aiohttp # noqa: F401
import aiohttp.web # ... |
389dec235ac2c976b5d18ca2dfc215ccf648f459046f2cb58bc7305ef3349a7d | Python | 1,016 | 18 | ####################################################################################################
# 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... |
3a3e909e0d1c36e13c1681d886267e1adff48eb88798a0a2905106002ddc52a4 | Python | 1,016 | 46 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import argparse
import pandas as pd
def explode(df, idx_cols, list_col):
"""
Explode a column of lists into one row per list element
"""
df = df.set_index(idx_cols)
df[list_col] = df[list_col].str.split(',')
df = df[list_col].apply(pd... |
f1910ceaf528e56003946b2701fb7c8a996b9dab4d9621c7ba40f503015f563f | Python | 1,016 | 28 |
def train_predict(
train_reference, test_bulk, num, scale,
ot_weight,celltype_key='CellType', device=None,
batch_size=128, epochs=30):
from .simulation import generate_simulated_data
from sklearn.preprocessing import MinMaxScaler
from .deconvolution import mian
## Sampling Training ... |
4f4931a23c0831ef33984eb4d811b087357374cdd9e3fa2353b097cb48778812 | Python | 1,017 | 33 | from pathlib import Path
#from tqdm import tqdm
import os
#from kilosort.utils import download_probes
from kilosort import run_kilosort
def RunKS4(bin_file,probe_file):
print('Starting KS4 now')
bin_file = Path(bin_file)
print(bin_file)
# Path management
scratch_dir = Path(os.path.dirname(bin_file))
... |
5f692f8e4900d8b699e0c51557db90b0396b8b7365ee9f01e75a21eb2dcbe5af | Python | 1,017 | 40 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import argparse
import sys
import pysam
def main():
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('vcf')
parser.add_argument('homozygotes', type=arg... |
659e0cddc22ca374a0adb252e58a0b74bb516d6b847a27ddab490b648052b9b0 | Python | 1,017 | 34 | """
Comparison report example for HCC dataset
"""
import pandas as pd
from sklearn.impute import SimpleImputer
from data_profiling import ProfileReport
if __name__ == "__main__":
# Load the dataset
df = pd.read_csv("hcc.csv")
# Produce profile report
original_report = ProfileReport(df, title="Or... |
7ea2198e6e0620c0807de6bf61cf8fa625d9e3a390b393d0730a8c65c0267f2c | Python | 1,017 | 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 program is fre... |
9c0b2f9cd87c62de587b3d68820d90f764f4229b85c980d29ff6ff8d88993513 | Python | 1,017 | 18 | ####################################################################################################
# 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... |
9d9849b6a84db9356db86c0956db57977291db849dcfa7036eeb066a59c3a32e | Python | 1,018 | 28 | import torch.nn as nn
from argparse import Namespace, ArgumentParser
from .base import BaseModelConfig
from optuna import Trial
from monai.networks.nets import SegResNetVAE
class SegResNetVAEConfig(BaseModelConfig):
model_name = "segresnetvae"
def setup_search_space(self, trial: Trial, args: Namespace) -> N... |
e3adb5102c05e60c281b258fa7cb506a77e1b17e0131784f9d4e6d29c753def4 | Python | 1,018 | 18 | ####################################################################################################
# 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... |
e8ed46e89c5858e054d65ac8a651f223d7ed76149c4ba395e98826aef2e033c5 | Python | 1,018 | 18 | ####################################################################################################
# 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... |
0e0a80a260e77e88c66466ba40f443759b976aeeca460dd57c8427638de617d2 | Python | 1,019 | 27 | from glob import glob
import sys
out_file_path = "Cross_Validation_Results_CNN.tsv"
with open(out_file_path, "w") as out_file:
out_file.write("iteration\tfold\timage_type\talgorithm\tauroc\tauprc\n")
for metrics_file_path in sorted(glob(f"CNN_Metrics/model_*/iteration_*/fold_*/metrics.tsv")):
parts =... |
6acc63fd544c3a537b320b134bfcdb61907918fa8d2fe308fa756ea6d9bbccfd | Python | 1,019 | 33 | import torch
from spikingjelly.clock_driven.surrogate import SurrogateFunctionBase, heaviside
class rectangle(torch.autograd.Function):
@staticmethod
def forward(ctx, x, vth):
if x.requires_grad:
ctx.save_for_backward(x)
ctx.vth = vth
return heaviside(x)
@staticmeth... |
72eb3bc32a8b70a46c42b0db99322d6b8887005efaf71718c9c0f9c4be090437 | Python | 1,019 | 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 program is fre... |
21cdba406ae940931927b87a65bb2c996e7c4aa0e44fdc96ff4ea18d7af4999f | Python | 1,020 | 36 | #!/usr/bin/env python
# coding: utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
from Actor1 import init_weights
class Actor(nn.Module):
def __init__(self, OBS_DIM, ACTION_DIM, TARGET_DIM, RNN_SIZE, FC_SIZE, RNN):
super().__init__()
self.OBS_DIM = OBS_DIM
self.ACTI... |
37d6be4a0444cef3e5db7209f17b2b0bcec55afcb9e19fec0de60372b154897d | Python | 1,020 | 18 | ####################################################################################################
# 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... |
7014ddf557ff33f5fc72ef700ca107d646797f04c71c0230c4c33708c605d4dc | Python | 1,020 | 38 | '''
Apply transformation to MP2RAGE uni images.
'''
import ants
import os
import glob
DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti'
SUBS = ['sub-05']
for sub in SUBS:
# Find uni images in all sessions
images = sorted(glob.glob(f'{DATADIR}/derivatives/{sub}/ses-*/anat/upsample/... |
7160e407e2fa26e20e8d9fb77d976c1b922fb2a5e8feef68d58d285ca0e6525a | Python | 1,020 | 38 | # __local_dev_start__
# Filename: local_dev.py
from starlette.requests import Request
from ray import serve
from ray.serve.handle import DeploymentHandle, DeploymentResponse
@serve.deployment
class Doubler:
def double(self, s: str):
return s + " " + s
@serve.deployment
class HelloDeployment:
def __... |
7b6fdeaeb14342df7d7b0d2ffa128e0bb349b19fc48fece83379d204b7bef4da | Python | 1,020 | 38 | from unittest import TestCase
from shapely.geometry.polygon import Polygon
import numpy as np
import neuron_morphology.snap_polygons.types as typ
class TestTypeUtils(TestCase):
def test_ensure_polygon(self):
obt = typ.ensure_polygon("0,0,1,0,1,1,0,1,0,0")
assert np.allclose(
list(ob... |
0df62cd76140348bed51788c3f4c011b347ab509539398b374ebf3727e91073a | Python | 1,021 | 18 | ####################################################################################################
# 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... |
16e9953b96b89061e8f628dea8e3ced1a99202ec08b868257a193f7d5a3e1f6c | Python | 1,021 | 18 | ####################################################################################################
# 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... |
ac6e766410324d856af3ca8dbd15f46ecb623a5086cfa98e1e92e44a3d3d35f4 | Python | 1,021 | 18 | ####################################################################################################
# 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... |
bdeefbe505a19decdd8cff20a1a6fb4f56c2fb32c065757b2855ce0de531f6b2 | Python | 1,021 | 18 | ####################################################################################################
# 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... |
be3350f6b53679766df0bb7982c71f6acab28efad488ec81d5df635392cdea08 | Python | 1,021 | 18 | ####################################################################################################
# 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... |
c73a6356df6d3e99590f7c9169a6034869a7f4f5498ebc3d3d752e5d3bd6d757 | Python | 1,021 | 18 | ####################################################################################################
# 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... |
f94939c6f6104c4ef05181feaffbd535838e915b5ba5587fb3fcbf7289c6578a | Python | 1,021 | 35 | # -*- 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
"""
... |
4b0b89069da28fbe5e6bbf59c726dc3dfbded832c14e90c5e92026db79361d78 | Python | 1,022 | 13 | thresholds = {
"VGG-Face": {"cosine": 0.68, "euclidean": 1.17, "euclidean_l2": 1.17, "angular": 0.39},
"Facenet": {"cosine": 0.40, "euclidean": 10, "euclidean_l2": 0.80, "angular": 0.33},
"Facenet512": {"cosine": 0.30, "euclidean": 23.56, "euclidean_l2": 1.04, "angular": 0.35},
"ArcFace": {"cosine": 0.6... |
65b1585489c2e677d6d9d934f544a28a37ba5514eca13b3ab86b3d6cb2ba1ece | Python | 1,022 | 29 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="reval",
version="0.1.0",
author="Isotta Landi",
author_email="landi.isotta@gmail.com",
description="Relative clustering validation to select best number of clusters",
long_description=... |
bb5f6e86b0ce2ad9dac279ca4f615fc88d31bb7f75bf3ce5dbcd71d5d59965bd | Python | 1,022 | 31 | # 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... |
e04b98381866a5ba15691793d21e134383bdf1c6acae7da885240332ada1e1e9 | Python | 1,022 | 18 | ####################################################################################################
# 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... |
f4c4ec15ccaa1454c41114d7f0ae3328b6b0b3e41d415bb0f634448cdd74a933 | Python | 1,022 | 37 | from __future__ import annotations
"""Vendored gsMap integration core for OmicVerse."""
from ._config import (
CauchyCombinationConfig,
DiagnosisConfig,
FindLatentRepresentationsConfig,
GenerateLdscoreConfig,
LatentToGeneConfig,
ReportConfig,
SpatialLdscConfig,
)
from .cauchy_combination i... |
1d4c3724c0256830f92a9da9f59d6c1dd1f0531d43bfff29ca1bec76328d87db | Python | 1,023 | 18 | ####################################################################################################
# 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... |
375392f68928fb39ccac593632f2c2c3ca0367f87409d0051b332212443f1525 | Python | 1,023 | 32 | #test dead
from src.models import dead
from src.predict import predict_crowns
from pytorch_lightning import Trainer
import torch
import numpy as np
def test_fit(config):
trainer = Trainer(fast_dev_run=True)
m = dead.AliveDead(config=config)
trainer.fit(m)
assert True
def test_validate(config):
tra... |
3d5d248e394c8b04f7101a61e01cfa49504e62342110cc3c68c1cc03624a1588 | Python | 1,023 | 18 | ####################################################################################################
# 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... |
8cd540bf155c9d451972237e3e27db60633db62b42589f2b68ce839e56ff0c5f | Python | 1,023 | 36 | import gradio as gr
from transformers import pipeline
import requests
# __doc_code_begin__
generator1 = pipeline("text-generation", model="gpt2")
generator2 = pipeline("text-generation", model="distilgpt2")
def model1(text):
generated_list = generator1(text, do_sample=True, min_length=20, max_length=100)
gen... |
e43b8077f8e326388a44a32c8d526f8a2972f412e96c78304946714257303778 | Python | 1,023 | 18 | ####################################################################################################
# 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... |
f68d509c7a2d865e4352e8f086c05c72dc13bc025f715631113a8a0a64b31abb | Python | 1,023 | 32 | import os
import sys
from DECIMER import predict_SMILES
def main():
"""This script runs Decimer on every image in a given directory (first
argument) and saves the results in a text file with a given ID (second
argument)."""
im_path = sys.argv[1]
save_ID = sys.argv[2]
# Don't start from begin... |
2e73919ee47042caae008137d76455a654204be3bc4970820804929d4b996044 | Python | 1,025 | 44 | import os
from ij import IJ
from ij import ImagePlus
from ij.plugin.frame import RoiManager
genotype = "WT"
st_pattern = "TBS"
hemisphere = "mask_L"
structure = "ACAd"
structure_path = "./quantification/"+genotype+"/"+st_pattern + "/"+ hemisphere+"/"+structure
dir_list = []
for root, dirs, files in os.walk (structure_... |
6182ec10e305f98d2057ccb22499249f10dca143600ed64d8a0167eb6d6eb097 | Python | 1,025 | 33 | import nibabel as nib
import numpy as np
from scipy.spatial import cKDTree
# --- Load NIfTI files ---
binary_img = nib.load(snakemake.input.gm)
label_img = nib.load(snakemake.input.subfields)
binary_data = binary_img.get_fdata().astype(np.uint8)
label_data = label_img.get_fdata().astype(np.uint8)
# --- Get voxel coo... |
3403766e090e1e9a0c24cba0ef05c9a69979a3af62e4c56dc8c809a736d5dc3e | Python | 1,026 | 18 | ####################################################################################################
# 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... |
423b63431d19a805b0de0c5e791b353cdae1ccd34852580866ef7f34163ddaee | Python | 1,026 | 33 | import usb.core
def reset_usb(
products=[
"a2A1920-160umBAS",
"Azure Kinect 4K Camera",
"Azure Kinect Depth Camera",
"Azure Kinect Microphone Array",
],
verbose=False,
):
devs = usb.core.find(find_all=True)
# Iterate over the devices and save their details if the m... |
971e61fcafd34b886063e01f8d6d57a11dbbd2905564dbf8788dc77eef5932f9 | Python | 1,026 | 35 | # -*- 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
"""
... |
f339288fb401488753de522a17f00404690603ccf9d42a44a411af63a34d3eda | Python | 1,026 | 30 | r"""
NoCD evaluation metrics for community detection.
This module provides comprehensive evaluation metrics for assessing the quality
of community detection results in single-cell data. It includes both supervised
metrics (when ground truth is available) and unsupervised metrics (intrinsic
quality measures).
Supervis... |
4aa989b2d3bc0ca4c6ba637d213de4753bedfeb59d9d53f1ce0ba1bdb9819b22 | Python | 1,027 | 18 | ####################################################################################################
# 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... |
7bdc9400b61f357e2d59223c5a02f58a6a6845ccbb3477bf4050faf9e391cc60 | Python | 1,027 | 38 | """
basic test that routing to spike_receiver population works
"""
import os
from spinnaker2 import hardware, snn
def test_routing_with_spike_receiver():
n_stim = 10
n_nrns = 20
stim = snn.Population(
n_stim, "spike_list", params={0: [1, 2, 3], 5: [20, 30]}, name="stim"
)
pop1 = snn.Popul... |
d62b02d96054d4c397bb9a4bee79b110f08a2e9fd63bb396e2cbccf0f8bfe7f2 | Python | 1,027 | 31 | """
OmicVerse Registry MCP Server.
Exposes ``@register_function`` entries as MCP tools, auto-generated from
the global registry.
"""
from __future__ import annotations
from typing import List, Optional
__all__ = ["build_default_manifest", "build_mcp_server", "get_manifest"]
def build_default_manifest(phase: str =... |
2c9008933c48a68a3d0e64facf5a4f3352c8bf6c4141f63131cc7874a494c6c5 | Python | 1,029 | 40 | """Calculate volume and surface area of perimeter chunk"""
import numpy as np
import nibabel as nb
import pandas as pd
import glob
SUBS = ['sub-05', 'sub-06', 'sub-07', 'sub-08', 'sub-09']
subList = []
voxelCount = []
voxelVolume = []
for sub in SUBS:
anatFolder = f'/Users/sebastiandresbach/data/neurovascular... |
1e958d81298513cb6eb5e1a4959d2d7a6ced4b572a3e51873af189da6440bc3a | Python | 1,030 | 42 | import torch
import torch.nn as nn
# from SPLAM import *
import numpy as np
import warnings
import platform
warnings.filterwarnings("ignore")
def main():
#############################
# Global variable definition
#############################
EPOCH_NUM = 20
BATCH_SIZE = 100
N_WORKERS = 1
... |
178821d341c1295a299d18d2e200a050a45162795701458715cf5a1a9407f441 | Python | 1,031 | 23 | #Imports relevant modules
import os
import shutil
#Defines the pipline ID as a variable. WIll need to be updated.
pipeline = '0'
#Defines input and output folders.
in_dir = '/<directory root>/Group_Level/Pipeline_{}/.gfeat/'.format(pipeline) #Full path removed for purpose of public sharing.
out_dir = '/<directory roo... |
7d81b30c72bab331af0c3371897f4b0dbbbd46f8df701d737970d524cfdf154e | Python | 1,031 | 39 | import os
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-o", type=str, help="outdir where symlinks will be stores ")
parser.add_argument("--cs_d", type=str, help="cluster_score dictionary")
parser.add_argument("--bp_d", type=str, help="bin_path dictionary")
parser.add_argument("... |
b08ed452974c0a13bfb42c29395a0a97de39f73dc5dfc39914e38f54c70b2689 | Python | 1,031 | 34 | def chr_name_convert():
f_chrs = open("../../Dataset/Refseq_2_UCSU_chromosome_names.tsv", "r")
lines = f_chrs.read().splitlines()
chrs = {}
for line in lines:
eles = line.split("\t")
chrs[eles[0]] = eles[1]
return chrs
# store a list of paralogs here:
paralogs = []
with open("show_c... |
0cdf92d4df609ca1e5c6f476de5c0749208a58a095223807fa9f7cd8630c2402 | Python | 1,032 | 27 | import logging
from datetime import datetime
from agent.classifiers.tree_classifiers_df import tree_classifier
from agent.classifiers.data.wrappers.count_features_fd_dataset_dev import get_raw_dataframes
from agent.data.entities.config import DEV_LABEL
logging.basicConfig(format='%(levelname)s : %(message)s', level=... |
1d883e062f9e2fc1f7418de597dd505b42cb463b1c18cb3f24b439213ce8b940 | Python | 1,032 | 33 | from dataclasses import Field, MISSING, _FIELDS, _FIELD, _FIELD_INITVAR # type: ignore
from typing import Type, Any, TypeVar, List
from .data import Data
from .types import is_optional
T = TypeVar("T", bound=Any)
class DefaultValueNotFoundError(Exception):
pass
def get_default_value_for_field(field: Field) -... |
9d9d6f5bf3f83f76086ec5037a0efd94e251cbf938a052409230f611ceb0b300 | Python | 1,032 | 36 | import logging
import fnmatch
import os
import time
from datetime import datetime
from agent.data.entities.config import ROOT_LOGGER_ID, METAMAP_INPUT_PATH
from agent.data.sql.sql_mgmt import get_connection
from agent.nlp.metamap_mgmt import parse_and_update_annotate_sentences, update_common_terms
logging.basicConfi... |
f85171efa0401254a85190d7638a5ba2cdbd649f02e69568b8fcb94e8e6071ea | Python | 1,032 | 24 | from ...utils import (
OptionalDependencyNotAvailable,
is_torch_available,
is_transformers_available,
is_transformers_version,
)
try:
if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")):
raise OptionalDependencyNotAvailable()
except Opt... |
499dd7f1ab2a7ab1657f3ba52fb3d5ab0850548d33277ccbf62cbf6ae392cb5b | Python | 1,033 | 41 | import exputils as eu
import dill
import os
from glob import glob
DILL_FILE_EXTENSION = 'dill'
def save_dill(obj, file_path):
if not file_path.endswith('.' + DILL_FILE_EXTENSION):
file_path += '.' + DILL_FILE_EXTENSION
eu.io.makedirs_for_file(file_path)
with open(file_path, 'wb') as fh:
... |
e4404b1748396055a69262dc0e2da5999a5f096309568d2c405b21a823f37624 | Python | 1,033 | 33 | import argparse
import torch
import yaml
from pytorch3dunet.unet3d import utils
logger = utils.get_logger('ConfigLoader')
def load_config():
parser = argparse.ArgumentParser(description='UNet3D')
parser.add_argument('--config', type=str, help='Path to the YAML config file', required=True)
args = parser... |
ede39edebda086f10ac50fc9e489aee5d9ef343c57a3f50d2f821f583be78bad | Python | 1,033 | 30 | # Copyright 2026 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
5b71879ea9b71edb2b06b6065d1c538f623276dc41278da1e9b1d43cc7c440e9 | Python | 1,034 | 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 program is fre... |
1764f1dec0e766fd2acfdaa5b2ed8f653f75c0c8e0b6fd1f875abe797f9c6cca | Python | 1,035 | 26 | #!/usr/bin/env python3
"""Utility functions for getting / managing GO enrichments for modules."""
import logging
# For GO annotations (needs connection):
def get_goterms(obj, graph_id, attr="leiden", organism="hsapiens",
sources=["GO:CC", "GO:BP", "GO:MF",
"REAC", "WP", "KEGG",... |
4244b3ec3647a74c6f40f362fbf296062e4aab5a8eb32f73522f9af54d13b693 | Python | 1,035 | 32 | """
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 logging
from typing import TYPE_CHECKING
from .scale_factor import ScaleFactor
if TYPE_CHECKIN... |
adb285b56a7324dafae31991dd5518f46f3a0749091774932abeb83db4ba9fd2 | Python | 1,035 | 30 | # -*- coding: utf-8 -*-
# @Time :2024/6/6 10:51
# @Author :MENGLong Li
# @File :SubmitInpFile.py
# @Software:PyCharm
from abaqus import *
from abaqusConstants import *
import os
num_group = 4 # 内部节点个数为1-4个
num_index = 1000 # 每个节点随机生成1000个运算案例
os.chdir(r"F:\\MaterialsMachineLearning\\abaqus\\Job-BJX-3\\") #... |
d69d1660935f4aeb4c9f305b4f0ebf9db6cff85eaf7d853c5f53d926658fe2ac | Python | 1,035 | 37 | r"""``ov.epi.data`` — prebuilt reference genomes.
Re-exports epione's :class:`~epione.core.genome.Genome` instances. Access
a genome to lazily download (and cache) its FASTA + Gencode annotation via
pooch on first use::
g = ov.epi.data.hg38
g.fasta() # downloads GRCh38 FASTA on first call
g.annotat... |
f58348e896d0ef5487fa4e2b4881cddd44e82c39fa223f161388116d67149784 | Python | 1,035 | 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 program is fre... |
2dd05f748571239f97ea7c11dda36c7c028fcea90194a652641fcec4b8563205 | Python | 1,036 | 48 | # __serve_example_begin__
import time
from ray import serve
from ray.serve.handle import DeploymentHandle
@serve.deployment
class LightLoad:
async def __call__(self) -> str:
start = time.time()
while time.time() - start < 0.1:
pass
return "light"
@serve.deployment
class Hea... |
33afacdd62a8c2f90f489a7fc35dce6fd454bfb1972813d6ed5ce197c39d110f | Python | 1,036 | 30 | import argparse
import pickle
def parse_argument():
parser = argparse.ArgumentParser()
parser.add_argument('--ensg2tss', help='Input ensg2tss file.', required=True)
parser.add_argument('--fragment-size', type=int, required=True)
parser.add_argument('-o', '--output', required=True)
return parser.par... |
5c3424320ea805f570f4744bb8b1d0318aef5ab9190ea453879fea7a1ae4fa1f | Python | 1,036 | 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... |
abe03c5c15466a5d9fb0bbce8d9e5f6d03ab99711d26fcb945e1dfa30b3c67b8 | Python | 1,036 | 40 | """
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 textwrap
import hydra
from fairchem.core.scripts.sweep_inference_benchmark import load_config
... |
a2c42d9118b2e87d6d0d095d09277d590e8923413a19d1b347c64c181e6362b2 | Python | 1,037 | 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 program is fre... |
50199b7b1d3a898aff63001e9b19b7207b60d6624aec528723bbb9441dd4a655 | Python | 1,038 | 40 | # chr17:45309498-46903773 (about 1.5Mb) refer to alternative contig in the UCSC genome browser
# bcftools view bcftools view 17.reheader.vcf.gz -r chr17:45309498-46903773 -Oz -o h1.vcf.gz
import re
import gzip
import pandas as pd
from io import StringIO
df_s = ""
for i in gzip.open("./h1.vcf.gz"):
i = i.decode()... |
8e69806c927c82275f1cad8785fe18008212026ddb8bf5c2666fabd0ba077e87 | Python | 1,038 | 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 program is fre... |
5aa66069cc8bca8464fcd4d171d6b0f4b4c3437002d1bf8b0cea208784fe2c46 | Python | 1,039 | 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... |
79913ef414d11f2e6a452070c92a499633df8b6063742d4d19ba18f3d0325464 | Python | 1,039 | 30 | import tempfile
from .util import *
from .antibody_epitope_prediction import AntibodyEpitopePrediction
def predict(method_name=None, swissprot=None, sequences=None, window_size=None):
'''for all methods of bcell predictions'''
filename = None
if sequences:
# check if input is a list
assert... |
8193916cb04bbb328ffc79ce14bb0326e100d6fcccd42709d1d54c444e96aa41 | Python | 1,039 | 37 | """Interactive clarification utilities.
The :class:`Clarifier` class assists in refining project scope by generating
follow-up questions. Each question is returned with a prefix from
:class:`MessageStandards` to keep messaging consistent across the
codebase.
"""
from __future__ import annotations
from typing import ... |
8f74a41809fb0c9ecc16d32bed0b7e4917523be630836105a4d1a7ee1f33fa90 | Python | 1,039 | 30 | """Merge completed Experanto chunk exports for one trial."""
import argparse
import json
from pathlib import Path
from mozaik.meta_workflow.experanto_export import merge_experanto_trial
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("trial", type=int)
parser.add_argument("--results-dir", r... |
d3e5f2ee2d0a829efc0535a20f566e4875fb30744917f46c6fc305e463fc849b | Python | 1,040 | 35 | import importlib
from typing import Any
import pandas as pd
from data_profiling.config import Settings
from data_profiling.model.pandas.dataframe_pandas import pandas_preprocess
spec = importlib.util.find_spec("pyspark")
if spec is None:
from typing import TypeVar
sparkDataFrame = TypeVar("sparkDataFrame")
... |
230e3f50a63769e6b21ba93bab576159f44972a0defd7b3104a5b01877f4ef70 | Python | 1,041 | 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... |
35448e1487cea244c6163338682b0f4e585915b127f1b810ad6d0ca2f99753f9 | Python | 1,041 | 32 | import numpy as np
import pytest
from scipy import stats
import pylab
class TestCriticalityAnalysis:
@classmethod
def setup_class(cls):
from mozaik.analysis.elephant_dependent import CriticalityAnalysis
global CriticalityAnalysis
def gen_powerlaw_distr(self, ca, a, b):
x = np.lin... |
509a868ca64d5a4eaa7138c2ebff36d12dbbb33563f4befdb38709ebdb0edfda | Python | 1,041 | 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 program is fre... |
904889f7d69f4e8ba583280f4485a590d139deddce64629eec1824c9adf64ec0 | Python | 1,041 | 38 | import pytest
from ray.air.execution.resources.request import ResourceRequest
def test_request_same():
"""Test that resource requests are the same if they share the same properties."""
assert ResourceRequest([{"CPU": 1}]) == ResourceRequest([{"CPU": 1}])
# multiple bundles work
assert ResourceReque... |
6a16bff07b1fffdd228b7ae69afe0dfd036cfc229c65401a9784ed49f73004a9 | Python | 1,042 | 30 | # checking over the command line params
import os
def check_params(args):
# avoid overwriting saved weights or other output files
if args.train == True:
if os.path.exists(args.out + "/mapNN_" + str(args.seed) + "_model.hdf5"):
print("saved model with specified output name already exists (... |
229f4abe31b54d4ce4e87b468297a6c686cdbf6fee9f763348cb689875bbcd12 | Python | 1,043 | 41 | import torch
import cebra.dynamics.linear as linear_dynamics
def test_linear_dynamics():
latent_dim = 5
model = linear_dynamics.Linear(latent_dim=latent_dim, bias=True)
assert model.weight.shape == (latent_dim, latent_dim)
assert model.bias.shape == (latent_dim,)
x = torch.randn(10, latent_dim)... |
77fd11449c44c306f6d513af6c0389a144d688a1586ed2fe3f7a4e718c0f7a57 | Python | 1,043 | 44 | #!/usr/bin/env python
from distutils.core import setup
from setuptools import find_packages
from glob import glob
import os
setup(
name="sv_utils",
version="1.0.0",
description="Utility and machine-learning scripts for processing structural variant data",
author="Ted Brookings",
author_email="tb... |
b23c6958ec29584e06a0bf10ef812b8d23312d0270f22089f7f5fd4d16558dd9 | Python | 1,043 | 30 | """This file is injected for all doctest targets in the repo by default."""
import doctest
import pytest
import ray
# `# doctest: +SKIP_EXAMPLE` on any line of a docstring's `>>>` examples skips that
# whole docstring. Use it for render-only examples that can't run in CI, such as
# ones that need TPUs or an external... |
d0e16e01804c7f2c6f5eead197acc896ccec4cad9679ac76c2f861cc81328822 | Python | 1,043 | 45 | import os
import h5py
import torch
import torch.nn as nn
import torchvision
import torch.nn.functional as F
import pdb
import cv2
import random
import numpy as np
import matplotlib.pyplot as plt
import torchvision.transforms as transforms
import scipy.io as scio
from torch.utils.data import Dataset
from P... |
687c4bebff17a73b21e9f6b3a438077e648c7c3f9d3e7e1961e89d51ea62fd0f | Python | 1,044 | 27 | from siapy.optimizers.parameters import (
CategoricalParameter,
FloatParameter,
IntParameter,
TrialParameters,
)
# Define individual parameters
n_estimators_param = IntParameter(name="n_estimators", low=10, high=200, step=10)
learning_rate_param = FloatParameter(name="learning_rate", low=0.01, high=0.3... |
866ece78abfc578dda34860d7652b58aa4f685585abc7f7b0ff1f83f8dbafc96 | Python | 1,044 | 27 | from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="fsub_extractor",
packages=find_packages(),
version="0.0.1",
description="Software that functionally segments white matter connections to generate task-specific subcomponents of ... |
ddb573a379b1c7f9442c537bc5a263e97914b495c0355b25ba8c727594968fe8 | Python | 1,044 | 33 | from data_profiling import ProfileReport
def test_set_variable():
r = ProfileReport(pool_size=3)
assert r.config.pool_size == 3
assert r.config.html.minify_html
r.config.pool_size = 1
assert r.config.pool_size == 1
r.config.html.minify_html = False
assert not r.config.html.minify... |
9a9539fcea82fa9d82ad2f364c810c3969411c3fd74803234d8633cc58c2c1dc | Python | 1,045 | 35 | #!/usr/bin/env python3.7
"""Generate a heatmap of activation thresholds.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing instructions.
The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent.
No... |
5896f80c200ba0271ffe3508359ca9883d6828b7bcc0792201a5e8ba4382b115 | Python | 1,047 | 39 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Random-forest adjudication of metrics supporting putative SV calls.
"""
import argparse
import sys
import pandas as pd
from svtk.adjudicate import adjudicate_SV
def main(argv):
parser = argparse.ArgumentParser(
description=__doc__,
prog='svtk a... |
b33333e68b5484a82bcc21b663047d9cd6a5dad58164535c0c730a07e3845396 | Python | 1,047 | 31 | from typing import Optional
from jaxtyping import Key
import jax
import jax.numpy as jnp
from .modules import NoGradLayer
from ..symmetry import Symmetry, TransND
from ..global_defs import get_lattice, get_params_dtype
class ReshapeConv(NoGradLayer):
def __call__(self, x: jax.Array, *, key: Optional[Key] = None) ... |
28abf12b188f85d51765f4207e919121c1917b5431c43473826da9722443d68b | Python | 1,048 | 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 program is fre... |
30682f4a996616e7ca991691ddfd48d785d43cddd48554727fdf07e498344cb0 | Python | 1,049 | 44 | import os
import traceback
import json
from typing import Callable, Optional, Dict
import boto3
step_fns = boto3.client("stepfunctions")
def step_fns_ecs_harness(
callback: Callable[[Optional[str]], Dict]
):
"""Utilty for running a python function and reporting results back via
AWS task token inte... |
b0c69a679e3c18356334192022d1255f7b1290303ea61034e2cf8f9ec6668032 | Python | 1,049 | 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... |
8612288b6afc766aa1016b148871a582f483836ffd8d230878ed88a73f455421 | Python | 1,050 | 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... |
cf36c57e1144ed62ad2ff25c7d54407e6bbacd9fd2095cf02afe5b9dc0f0d9b6 | Python | 1,050 | 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 program is fre... |
b996077b0f09eac9246fd3c7ca3247c6faea694b3f4acd4fdb952d20ebf4bad8 | Python | 1,051 | 37 | import io
import os
import re
from setuptools import find_packages
from setuptools import setup
def read(filename):
filename = os.path.join(os.path.dirname(__file__), filename)
text_type = type(u"")
with io.open(filename, mode="r", encoding='utf-8') as fd:
return re.sub(text_type(r':[a-z]+:`~?(.*... |
01a4c1532b48dae4eef458d4b05b51c367254c9243ecd0b87d2c66205f7f20e4 | Python | 1,052 | 19 | ####################################################################################################
# Copyright (c) 2020 - 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... |
15b772f89d8226ee89c9d57873e031ad1c4ea97b87b2ccb000a9ef9403b1ed69 | Python | 1,053 | 27 | import torch
from ..utils import loss_and_miner_utils as lmu
from ..distances.base_distance import BaseDistance
class LpDistance(BaseDistance):
def __init__(self, **kwargs):
super().__init__(**kwargs)
assert not self.is_inverted
def compute_mat(self, query_emb, ref_emb):
dtype, devic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.