sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e85bb10f97c0df9211f92588f998ed5d1e11104f2007846b4947acbd87650a08 | Python | 4,576 | 131 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 6 11:43:39 2017
@author: agiovann
"""
from builtins import zip
from builtins import str
from builtins import map
from builtins import range
from past.utils import old_div
import copy
import cv2
import glob
from ipyparallel import Client
import lo... |
66848f1c32132bb46263907f70fd611046add5f14c183993d33db518f030c0c1 | Python | 4,577 | 132 | # coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# 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 ag... |
dd0970491d89a86032cb393cb266f123f5989df207df58ecdbf7c9f119fc032b | Python | 4,577 | 141 | """Study-design helpers for ``ov.protein`` — sample-size / power
calculation and contrast-matrix construction, wrapping :mod:`pymsstats`.
"""
from __future__ import annotations
from typing import Optional, Sequence, Union
import numpy as np
import pandas as pd
from .._registry import register_function
@register_fu... |
11c78ff500a68d2864a72e05c30c613e6bf27bd74c9d73a20c2793a9bbaa651d | Python | 4,579 | 114 | ####################################################################################################
# Copyright (c) 2020, 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... |
21b8316271fa48a871648ef6ceea8b07eae13362bcef975d43871b87784ac7ea | Python | 4,579 | 162 | def test_specksim_conv_layer():
import numpy as np
import samna
weight_shape = (2, 2, 3, 3)
event = samna.specksim.events.Spike(0, 2, 2, 10) # channel # y # x # timestamp
events = [event]
conv_weights = np.ones(shape=weight_shape).tolist()
conv_layer = samna.specksim.Convolution2d(
... |
154775bf55249c54858753a2a814ab34e761d0f60f5e287ffbc20b2e649dd37e | Python | 4,580 | 179 | """Contains a simple utility for representing a "growable" 2D rectangle
"""
from typing import Callable
import numpy as np
from neuron_morphology.snap_polygons.types import TransformType
class BoundingBox:
""" Represents the bounds of a set of 2D objects
Parameters
----------
vorigin, horigin : the... |
197293ac87b2f51b204b4e620751113d0a96528d586150f6192e6175d4c9018f | Python | 4,580 | 140 | # 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... |
224ec0d6715e9c3efe6248a430bc90332d9a6574cf1cd166bb769ba9093d6db5 | Python | 4,580 | 92 | import pandas as pd
import os, logging
from misc.abb_med_disease import gen_abb_med_disease
from misc.save_files import read_pickle, read_DocTermDict
def gen_summary_text_wrapper(config: dict):
disease = False
for med in [True, False]:
for abb in [True, False]:
abb_med = gen_abb_med_disea... |
4edc3eb546cd1738165d49315a014c11fe8f80d3e543d95184ff851b44475da9 | Python | 4,580 | 92 | ####################################################################################################
# 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... |
7590665192acab4139f7fdf3471d9a7a8a6aa91517ff48ab577dbc73b09ac427 | Python | 4,580 | 120 | import json
import logging
from abc import ABC, abstractmethod
from typing import Any, Dict, List
from ray._common.logging_constants import (
LOGGER_FLATTEN_KEYS,
LOGRECORD_STANDARD_ATTRS,
LogKey,
)
from ray._private.log import INTERNAL_TIMESTAMP_LOG_KEY
from ray._private.ray_constants import LOGGER_FORMAT... |
7ae4f85c99e83386c4d98e90d00531e3304ccc8f35e6265086c04a7550021573 | Python | 4,580 | 118 | """
Generate mask by comparing local variance and global variance
"""
import numpy as np
import logging
def maxmask(tomo, side=5,percentile=60):
from scipy.ndimage.filters import maximum_filter
# print('maximum_filter')
filtered = maximum_filter(-tomo, 2*side+1, mode='reflect')
out = filtered ... |
40f960a66eaf5a42dad3c6d7ff85252c35428487691da68ed6584c0f8513102d | Python | 4,581 | 126 | #!/usr/bin/env python3
import argparse
import glob
import sys
import numpy as np
import matplotlib.pyplot as plt
import pysam
import math
import pandas
import haplotagging_stats
import os
import collections
def parse_args(args = None):
parser = argparse.ArgumentParser("Plots information from haplotagging_stats ts... |
5dfc4d5b3a3de29436b5b133c23f835f05678ce0ccf448de194e0270210761d4 | Python | 4,581 | 113 | ####################################################################################################
# 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... |
c692980fc1ccc3a0d6d44ca0404cdebdb5a5856411b031c68d0971ac20a781f8 | Python | 4,581 | 95 | import logging
from datetime import datetime
from agent.classifiers.utils.device_mgmt import get_gradient_accumulation_steps
from agent.classifiers.transformer_classifier import transformer_classifier
from agent.classifiers.data.wrappers.transformer_text_fd_dataset_dev import get_datasets as get_fd_datasets_dev
from ... |
d628257502884d04cde5fa3dbedf4b9afadc9c43515768e3a7371dc825bedfbd | Python | 4,585 | 131 | # coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# 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 ag... |
e5e677bafc55be2dc3b6622720f51639441c4b1f30fda50b7cf27132ad984221 | Python | 4,585 | 117 | import numpy as np
import scanpy as sc
import scvelo as scv
import anndata as ad
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import spearmanr, pearsonr, sem
from scipy.interpolate import griddata
from scipy.stats import gaussian_kde
def scatter_stream(adata, gene, cluster_key = None, save=Fal... |
9269abc9a261943920659b8fc25da88c3c64fa90d1acc39495a2e018418e5d37 | Python | 4,586 | 137 | """Web server that runs on local/private clusters to coordinate and manage
different clusters for multiple users. It receives node provider function calls
through HTTP requests from remote CoordinatorSenderNodeProvider and runs them
locally in LocalNodeProvider. To start the webserver the user runs:
`python coordinator... |
1b1834fc55a5cf00d1b41eff8315fffb270201bda4a5f08e4080f498d97c2158 | Python | 4,587 | 123 | """Joblib store backends for xarray objects using h5 via netcdf.
Info: Rationale
Joblib is powerful for caching. It pickles objects into a directory. Pickling
xarray objects however, which have their own storage solutions, seems inefficient.
This module provides custom store backends for joblib that use h5... |
ef67e40413901cf1fb1486f4d9365d47c98b44a2af17be5d9f43ee0351de8ac4 | Python | 4,587 | 126 | #!/bin/python
#------------------- Description & Notes --------------------#
#------------------- Dependencies ---------------------------#
# Standard library imports
import argparse
import logging
from pathlib import Path
# External imports
from pyspark.sql import SparkSession
# Internal imports
from synsor impor... |
a6df20bce17aea38190e153c86bd36830d8b13e64ad4a92958df6da2df38da44 | Python | 4,588 | 103 | import numpy as np
import cv2
# @profile
def threshold_frame(frame, thred_inten, target_area=None, unmasked=None):
''' Threshold an image to a binary mask with a single connected region,
so that the area was equal to the target_area.
If simple thresholding gave multiple disjoint regions,
... |
34e0f0cbdf950271f18055ce48420e838f3a6b983eb57175abc6fca2eaa49ecd | Python | 4,590 | 124 | import math, torch
import numpy as np
from ..base import Transform, as_range, randint, uniform
from .mask import MaskTransform
LEADS = ("I", "II", "III", "aVR", "aVL", "aVF", "V1", "V2", "V3", "V4", "V5", "V6")
INDEPENDENT = (0, 1, 6, 7, 8, 9, 10, 11)
# Kors regression matrix: I, II, V1-V6 -> X, Y, Z vectorcardiogra... |
b779d8b4f9d74aafeab533b7dacf35433ca5f3a50d31b302e666bbf78f3451b5 | Python | 4,590 | 116 | ####################################################################################################
# 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... |
fb8cba79236a4a05f1e5574cfc1e11b69a640933b2bac5ea3e79295fe93cb0cf | Python | 4,590 | 118 | from dataclasses import dataclass
from typing import Dict, List, Tuple, Union
import torch
from ray import cloudpickle as pickle
import pyarrow as pa
# (dtype, shape, offset)
FEATURE_TYPE = Tuple[torch.dtype, torch.Size, int]
TORCH_BYTE_ELEMENT_TYPE = torch.uint8
def _create_binary_array_from_buffer(buffer: bytes) ->... |
cb9b5983f06c8da0c7552f7e26492ff7673099256076c05adf7e7a855bdb788a | Python | 4,591 | 126 | #!/usr/bin/env python
######################################################
#
# Sample QC evaluation for the GATK SV pipeline
# written by Mark Walker (markw@broadinstitute.org)
#
######################################################
import pandas as pd
import svqc.constants as const
# Tests whether numbers are on... |
a9b1f2b11da146c4b41a5432e115760d2c19975955497e93acfc2e9bdd9e32b3 | Python | 4,593 | 137 | from PIL import Image
import numpy as np
from ctypes import *
import ctypes
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import cv2
import time
import pdb
import scipy
import scipy.ndimage
import matplotlib.pyplot as plt
from Datasets import *
from tensorboardX import Summar... |
9bb50d47a00d223729cd77c488fb8f17a322dbf8309de5ee54c712512a4cb391 | Python | 4,594 | 133 |
import torch
import numpy as np
from datetime import datetime
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
from torch import nn
from sklearn.utils.class_weight import compute_class_weight
from agent.classifiers.evaluation.evaluation_mgmt import get_evaluation_measures, get_f1_measure
fro... |
12b95fb55944e59f427b88b944c8d39e7c58a7fc9bc573a40766a609c2edf5e0 | Python | 4,595 | 107 | """UMA checkpoint compatibility shim.
Classifies a loaded checkpoint by UMA generation (from ``model_id``, falling back
to ``backbone.model_version`` for legacy 1.1) and fixes up its ``model_config``
in place at load time (in ``load_inference_model``, before instantiation):
* **UMA 1.1** ships without a ``model_id`` ... |
e68b69738e5d9ecdce7c96c416fb2522ec0c35ead1101fbd4c6379ff09d67843 | Python | 4,597 | 131 | from __future__ import annotations
import json
from json import JSONEncoder
from FeatureCloud.app.engine.app import app, App
from bottle import Bottle, abort, request
from bottle_cors_plugin import cors_plugin
from algo import getGraphs, Client
from states import local_model, global_model, callback_fn_terminal_state... |
1601664fe6c981cadc9089f63a4f0d97ed6f0f418cafdeb6e8c5eb1bb628e846 | Python | 4,599 | 118 | import os
import shutil
import tarfile
from urllib.request import urlretrieve
import numpy as np
from batchgenerators.dataloading.data_loader import DataLoader
from batchgenerators.dataloading.dataset import Dataset
from batchgenerators.utilities.file_and_folder_operations import join
def unpickle(file):
'''
... |
c9c27bae570101dfa5ab91820d9adc34f795fbb7f3b6ddeecb8dd7841b532872 | Python | 4,599 | 152 | from typing import Callable
import torch
def alif_forward_single(
input_data: torch.Tensor,
alpha_mem: torch.Tensor,
alpha_adapt: torch.Tensor,
alpha_syn: torch.Tensor,
adapt_scale: float,
state: dict,
spike_fn: Callable,
reset_fn: Callable,
surrogate_grad_fn: Callable,
min_v_... |
e04b98efeb29abe69b669a6a8992c4eddce7b270e58787270289a3f32305e297 | Python | 4,599 | 118 | import os
import torchaudio
from torchaudio.transforms import Resample
from transformers import ASTFeatureExtractor
from EAV_datasplit import *
from Transformer_torch import Transformer_Audio
class DataLoadAudio:
def __init__(self, subject='all', parent_directory=r'C:\Users\minho.lee\Dropbox\Datasets\EAV', targe... |
0c7e3176ea4f461402a63ff77adea0d407c5fe781a7891a085971f3b5f00d79f | Python | 4,600 | 161 | import os
import time
import json
import logging
import torch
from pprint import pprint
from easydict import EasyDict as edict
def get_logger(name, logpath, filepath, package_files=[],
displaying=True, saving=True):
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
log_path =... |
ea36b625f6a64c5054cdd8d7f0b088bf9ce310e4f31bc9af82fa71b813dec496 | Python | 4,600 | 109 | from typing import Tuple
import torch
def _time_model_prox_project_variables(
coupling_w: torch.Tensor,
feedback_w: torch.Tensor,
timecourse_w: torch.Tensor,
bias: torch.Tensor,
coupling_aux: torch.Tensor) \
-> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tens... |
c8540753ce8376faf314b7e44dbc99674fcf58aae39e9d3cb38e9d0fec1ffedc | Python | 4,601 | 118 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
4b33889757121376ab3770861e13076104cdd052b082624ea3a01cb7732b58a7 | Python | 4,602 | 129 | #!/usr/bin/python
"""Functions for plotting gene-gene graphs."""
import logging
import numpy as np
import igraph
from adjustText import adjust_text
from matplotlib import pyplot as plt
# Set a standard visual style:
standard_visual_style = {}
standard_visual_style["vertex_size"] = 10
standard_visual_style["vertex_c... |
43f9f3b3f902825e083648caa5b427879e4815b141fdc722826dc4080d4ba7c9 | Python | 4,603 | 97 | import os
import SimpleITK as sitk
import torchvision.transforms as transforms
from model import *
from monai.transforms import NormalizeIntensity, Resize
import argparse
import numpy as np
def list_of_strings(arg):
return arg.split(',')
parser = argparse.ArgumentParser()
parser.add_argument('--base_liver', typ... |
aa203e6d87dd3407d5d991bcd39020e71f3905f9547047db125850e7746e5d0f | Python | 4,603 | 114 | """
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.
Original source: https://github.com/janosh/matbench-discovery/blob/main/matbench_discovery/energy.py
MIT License
Copyright (c) 2022 Janosh Ri... |
ae937b940f1543e37881c84ccc4a79bbe6c9eb08ae0edb11649efbbbded1acc0 | Python | 4,603 | 110 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import unittest
from types import SimpleNamespace
from unittest.mock import Mock, patch
from django.utils.functional import SimpleLazyObject
from rest_framework import serializers
from rest_framework.exceptions import NotFound, PermissionDenied
fro... |
de0f5d58c332c178d5baf3912fea3e87286ae9f7d53fdd1e173ecbd9cc8082bb | Python | 4,606 | 101 | import tensorflow as tf
from tensorflow.keras.optimizers import Optimizer
from tensorflow.python.framework import ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import state_ops
class FedProx(Optimizer):
"""Implementation of Perturbed ... |
580e8b02b8864ae776834d2ee7316c98983ddac5d0a3b6e250d26114d0bee4b1 | Python | 4,607 | 119 | import torch
from torch import nn
import Med3D_resnet
def generate_model(opt):
is_MultiRes = False
assert opt.model in [
'resnet'
]
if opt.model == 'resnet':
assert opt.model_depth in [10, 18, 34, 50, 101, 152, 200]
if is_MultiRes == True:
model = Med3D_resnet.mul... |
3ccb1a4fe6e8cfc05ee3fb2d47599555b35185169aad64fd53481edb85027873 | Python | 4,610 | 123 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
After genotyping, identifies CNV variants over a size threshold without depth support but with PESR evidence and changes
them to BNDs. This task is ordinarily accomplished by Module 3 but in some cases (ie the single sample pipeline) that is skipped.
"""
import argpar... |
733f45e8254b349ac51128e0715ee1f30477fde792a7a27109b0e3b8470ce328 | Python | 4,610 | 113 | #!/usr/bin/env python
# -*- coding: utf-8
# Compute distance between intervertebral discs and the PMJ along the centerline
#
# For usage, type: python get_distance_pmj_dics -h
#
# The script requires the SCT conda environment to be activated (because we import the SCT's Image class):
# source ${SCT_DIR}/python/etc/... |
e90d87cde6901df2d47ce28eb1afa244f7fef026c5b23b652253220a974ccd4c | Python | 4,613 | 107 | """
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 random
from fairchem.core.common.safe_pickle import safe_pickle_load
class Reaction:
"""
... |
9e49bdfc411613dbd0656b19b5a2187c8c9e1b36437ca4ab4d0977867e3fdfac | Python | 4,614 | 135 | # Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
# and Applied Computer Vision Lab, Helmholtz Imaging Platform
#
# 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 L... |
cc5ea1b21850e8b7b6dc855c3d3d809e0be52e4edc79b23696f5ef74ce7a187c | Python | 4,614 | 133 | ####-------------------------------- Imports --------------------------- ######
import pytest
import numpy as np
from helper.array_helper import find_szr_idx, merge_close, match_szrs_idx, chunk_array
####------------------------------- Fixtures --------------------------- ######
def create_bin_array(length, index):
... |
f1c0492e979f2cfdc1e4d604975db65310e572f5338dc83cc35193478924e24f | Python | 4,614 | 114 | # -*- coding: utf-8 -*-
####################################################################################################
# Copyright (c) 2020, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# Th... |
af79e6c4e2b6ae87c608a47882aa15c3e1a8ac0239b32e0e375c643b72d6298f | Python | 4,615 | 132 | ####################################################################################################
# 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... |
e302d9e170b273b14eda431511901dd8af5425bbff3dd90ffaf6915322765ccd | Python | 4,615 | 50 | from emp import *
import matplotlib; matplotlib.use("Agg"); import matplotlib.pyplot as plt
plt.rcParams.update({"font.family":"DejaVu Serif","font.size":8.5})
D=load_wt(); Y=counts(D.t_court.values,D.defbehav.values); N=len(D)
mc=json.load(open("emp_modelcomp.json")); ex=json.load(open("emp_extra.json")); B=json.load(... |
2bf624dc8b3b0c3c00acaede3d709dba6af9bced0f7d0485d5339b4303d2ddd9 | Python | 4,616 | 115 | from loguru import logger
import os
import sys
import json
from deltasplice.constant import CL, EL, Fapath
from pyfasta import Fasta
SavePath = "data/autism_exome"
def parse_line(line, i):
line = line.replace("\n", "").split("\t")
Name, _, Chr, Strand, Ts, Te, Js, Je = line # the data should be in 1-base
... |
7572a0b8c297720efe9a47102a4a922f3b736ba9ca7059d4feb288700ccf2c09 | Python | 4,619 | 158 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# 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
#
# U... |
22050940a7a1c3d23c43e8bbde496cfb5148970d44e3cf3acfc529418a40338f | Python | 4,621 | 80 | class Config_Finetuning(object):
"""
Configuration class for fine-tuning machine learning models.
This class is designed to initialize and store configuration parameters
needed for the fine-tuning of machine learning models. It includes parameters
specific to the data, pretrained models, and fine-t... |
89e1d675695ca3d904758b7fe393563244984eb02eadb4c8c3268ca609feaf21 | Python | 4,622 | 102 | import matplotlib.pyplot as plt
import numpy as np
import os
from utils import parseparam
import pandas as pd
def parse_acc(df):
logfilename = f"{datadir}/test.out"
f = open(logfilename, "r")
traccs, teaccs = {}, {}
for line in f:
words = line.split(' ')
for wordidx, word in enumerate(w... |
2b59fa4fca83b4bc910247ea73ef67e1a51b5131eb3700f4fa22ae01be1a5796 | Python | 4,623 | 136 | #!/usr/bin/env python3
from __future__ import print_function
import argparse
import os
import subprocess
from multithread import *
INPUT="input"
OUTPUT="output"
SEGMENT="segment"
PIECE="piece"
def parse_args():
parser = argparse.ArgumentParser("Extracts BAM segments")
parser.add_argument('--input', '-i', des... |
acd646fa0ce6a9f489fd3ae8efe2fe919fdef27aa6021a8490760683b56b8e41 | Python | 4,625 | 169 | ##Ratings for SRNDNA
from psychopy import visual, core, event, gui, data, logging
import csv
import datetime
import random
import numpy
import os
import sys
#parameters
useFullScreen = True
useDualScreen=1
DEBUG = False
frame_rate=1
responseKeys=('1','2','3','z','enter','escape')
#subject ID
subjDlg=gui.Dlg(title=... |
e2741842f37ffadd2492d1e944eb08c38dd28ac34da15201051f7c3fd5162f59 | Python | 4,625 | 137 | import base64
import json
import sys
import pytest
import ray
from ray._private.test_utils import (
wait_for_condition,
wait_for_dashboard_agent_available,
)
from ray.dashboard.tests.conftest import * # noqa
_ACTOR_EVENT_PORT = 12346
@pytest.fixture(scope="session")
def httpserver_listen_address():
re... |
f7a44e3f78747086d57a5d31f1a42bfcda7ebff13a91d89951f71ec6cf4dc6bb | Python | 4,626 | 140 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 14 13:47:39 2022
@author: pbolan
"""
import numpy as np
import glob
from os import path
import nibabel as nib
import matplotlib.pyplot as plt
from utility_functions import get_evaluation_paths, image_threshold_percentage, get_plot_dir, imshow_mont... |
344ceb5cf2e021c8e067490143dfb694b5b25fe9bcebabb28487309a6a9ca68d | Python | 4,628 | 112 | import torch
import pandas as pd
from loss import spearman_loss
from metrics import spearman_corr
def convert_batch_data(data, batch_size, seed):
for name in data.index.unique():
remainder = len(data.loc[name]) % batch_size
if remainder != 0:
data = pd.concat((data, data.loc[name].... |
67c165931d3992b002cddea2231aa27418d13dac05ed9138a9c995bcc57d0414 | Python | 4,628 | 135 | from dataclasses import dataclass
import torch
import torch.nn as nn
# import torch.nn.functional as F
from dataclasses import dataclass, field
#from dgl.nn import GCN2Conv, GraphConv
@dataclass
class Args:
dataname : str
gpu : int = 0
epochs : int = 1000
lr1 : float = 1e-3
wd1 : float = 0.0
la... |
acb738c924fe0dfbf0c2355ece2ef1b6c1db319357d0a504b8e105b788fbe529 | Python | 4,629 | 159 | # Copyright 2021 AlQuraishi Laboratory
# Copyright 2021 DeepMind Technologies Limited
#
# 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
#
# U... |
cf753f834996d2291f121469d66695a3d116c6fdd36c7ae4af7e47698065c2af | Python | 4,629 | 111 | ####################################################################################################
# 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... |
f929395f390b31e4584c2d3cddf53a74a5c544705ceaaf78c1c1b33fc71c620f | Python | 4,629 | 149 | # TODO
# - camera specific code (e.g. setting ain for basler) doesn't need to be in this file
# define the base camera
import numpy as np
import struct
def get_camera(
brand="flir",
serial=None,
exposure_time=2000,
gain=12,
trigger="arduino",
readout_mode="Fast",
roi=None,
**kwargs
)... |
ec1c9d84cfeef9a3f6d890086b4630298fc133790a4a9f195276f85e98a1c72c | Python | 4,630 | 122 | """Cross-species preprocessing (ortholog alignment + standard prep).
Extracted so the ortholog *preparation* — map every species onto the reference
species' one-to-one orthologs, keep the shared genes, concatenate, and run the
usual normalize → log → HVG → scale → PCA — is reusable on its own, independent
of which int... |
08ef94b6adb58abc164bdf2d5aa346a9381888a3de4e43af7340e4b392c77f7b | Python | 4,632 | 153 | from typing import List, Optional
from mmengine.structures import BaseDataElement, InstanceData, PixelData
class DataSample(BaseDataElement):
"""A data structure interface of LQIT. They are used as interfaces between
different components.
The attributes in ``DataSample`` are divided into several parts:
... |
3c42b2e89ee34cd33dc3faee4f762a93179c2e0452e5273ba3573dcec73cb545 | Python | 4,634 | 138 | """
Adapter for stateless (non-AnnData) functions.
Handles tools like ``ov.utils.read`` that take scalar / path arguments and
return JSON-serializable data, DataFrames, or new AnnData objects.
"""
from __future__ import annotations
import json
from typing import Any
from .base import BaseAdapter
from ..session_stor... |
71ce8fe0506408000c5690b5f9a261b942b0bdb8fe6b980d6c840cd5c7ce6770 | Python | 4,636 | 178 | from typing import List
import click
from ci.ray_ci.anyscale_docker_container import AnyscaleDockerContainer
from ci.ray_ci.builder_container import BuilderContainer
from ci.ray_ci.configs import (
ARCHITECTURE,
BUILD_TYPES,
DEFAULT_PYTHON_VERSION,
PYTHON_VERSIONS,
)
from ci.ray_ci.container import _D... |
5988f64214a6dcd96011029c90e17efbae97ea06cf4669750a616dddc7687ffa | Python | 4,637 | 138 | """AgentContext protocol — type-only contract for extracted ovagent modules.
All extracted modules (PromptBuilder, AnalysisExecutor, ToolRuntime,
SubagentController, TurnController, CodegenPipeline) depend on this
protocol instead of importing the concrete ``OmicVerseAgent`` class.
This breaks the circular import betw... |
0d1f9bbed32b5f9ed0d28d3897410acdca485023e525d2673d3f9f76b196d08b | Python | 4,638 | 122 | #! /usr/bin/env python3
import inspect
import torch
from ..utils import common_functions as c_f
from ..utils.module_with_records_and_reducer import ModuleWithRecordsReducerAndDistance
from ..losses.mixins import EmbeddingRegularizerMixin
class BaseMetricLossFunction(
EmbeddingRegularizerMixin, ModuleWithRecord... |
2fc1af66ffe9110c6f0c3ba8637c87c18a72016b83443e4219471c2ea55013da | Python | 4,638 | 122 | from PIL import Image
import numpy as np
from ctypes import *
import ctypes
import copy
import os
import cv2
import time
import pdb
import PySpin
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from skimage import measure
def calibrate_M(img_cal, M_size = 200):
img_cal ... |
9e4679cd685a37add8d8bb4a963b9822df0e1d344b82d01f975fc3426c8fc77a | Python | 4,641 | 128 | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class EPE(nn.Module):
def __init__(self):
super(EPE, self).__init__()
def forward(self, flow, gt, loss_mask)... |
de0602fd47fbb712ea600bb9a0cdfc799c17bb3b34689d10fc0317fc548c1d6e | Python | 4,641 | 191 | import pdb
from discontinuous_galerkin.base.base_model import BaseModel
import numpy as np
class AdvectionEquation(BaseModel):
"""Advection equation model class."""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.model_params = {
'advection_velocity': 0.5*np.pi,
... |
78e83b2ba69249ec3609c78d8bf7203860e45adf81e3e2e385d118e1b36f0c93 | Python | 4,642 | 112 | ####################################################################################################
# Copyright (c) 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 free softw... |
7cc3e9cb7c8a4aff98244bb75660a77a391400d1f9b3c434b68679c219a607e0 | Python | 4,644 | 135 | """
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 os
import warnings
from typing import TYPE_CHECKING, Any
import numpy as np
from fairchem.data.... |
7fd3b1468adb23b3a7e6afb676af0bde402d12373902b9869c21a2384f661a18 | Python | 4,644 | 155 | from typing import Literal
from ray.core.generated.common_pb2 import (
ErrorType,
Language,
TaskStatus,
TaskType,
WorkerExitType,
WorkerType,
)
from ray.core.generated.gcs_pb2 import (
ActorTableData,
GcsNodeInfo,
PlacementGroupTableData,
)
ACTOR_STATUS = [
"DEPENDENCIES_UNREAD... |
6ab788c9ac7cb9e8ab22c3ac14664887cea361043a368e476efd160e212497e1 | Python | 4,645 | 169 | # flake8: noqa
# __custom_metadata_start__
import multiprocessing.shared_memory as shm
import pickle
from dataclasses import dataclass
from typing import Any, Dict, List, Optional
import numpy
import ray
from ray.experimental import (
CommunicatorMetadata,
TensorTransportManager,
TensorTransportMetadata,... |
7c41f58eb0f19c8773fa7e5e8b7ee0998b2edfb15d74a5ec3c9efdf4d9dc9f5a | Python | 4,645 | 83 | """ Fonctions utiles pour l'affichage """
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
##################################################
def draw_trials(axes: plt.axes, times: np.ndarray, trials: list[list[str | int]]):
"""
Affiche une bande colorée pour chaque trial : ve... |
2ae9b0cc025a1e051a6df11a7dcc491047e2e167b9d0eba339ec2b07dff3089f | Python | 4,646 | 98 | ########################################################
######### Philipp R. Steen #########
######### Jungmann Lab #########
######### Max Planck Institute of Biochemistry #########
######### Ludwig Maximilian University #########
######### 2024-2026 ... |
394b792b3e2cc711a9d7570ad2e601cf9d57b5f37d08df5f3253a1d5a141d79c | Python | 4,647 | 143 | # built-in dependencies
import os
import importlib.util
from typing import Optional
# package dependencies
from deepface.commons.logger import Logger
logger = Logger()
# deepface can run on tensorflow, pytorch or onnxruntime. this module decides which one of
# them will be used, and it must not import any of them - ... |
869245fb70d5442a1bb5da913996d10bf4934c0cb7e53bb48c63ee53fb9045ad | Python | 4,647 | 120 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from lib5c.util.plotting import plotter
@plotter
def plot_distance_bias(ob, bins, bin_labels=None, idx='disp', threshold=0.05,
colors=None, labels=None, xlabel='distance range',
... |
7f832e40c80aff8cc51d202955c06efbf078f6d829fc8a0a607e449c799415b8 | Python | 4,648 | 140 | """Investigate attention task performance."""
import numpy as np
import glob
import pandas as pd
import re
import seaborn as sns
import matplotlib.pyplot as plt
# Define ROOT dir
ROOT = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti'
# define subjects to work on
subs = ['sub-05', 'sub-06', 'sub-07', '... |
f2dfed1422dfc60244a7d351f895b66e5d9e86fc549ab1cf2953f9de36ec114f | Python | 4,649 | 137 | """
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 dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Literal
from fairchem.demo.ocp... |
5dba58a2b6c508ffc70df45acaaa14e3494bd8d60557b3fd5acee18c37039c8d | Python | 4,654 | 118 | import logging
from typing import Callable
from tensorboardX import SummaryWriter
import torch
import torch.nn as nn
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
from tqdm import tqdm
from GR_pKa.args import TrainArgs
from GR_pKa.data import MoleculeDataLoader, MoleculeDataset
f... |
0fe42125f915f30aaabeface90b9159463565dd1a5de0bfcccc4f8ca2e0b9fe7 | Python | 4,655 | 124 | import numpy as np
def parseparam(paramfilename) :
# Parse parameter file and return dict of parameter name and value #
pardtype = {"verbosity" : int,
"seed" : int,
"Hin": int,
"Min": int,
"Hhid": int,
"Mhid": int,
... |
801c2b8d9dbbf1787951fb9fecc99d9cda170e67f623c134c56332e055053022 | Python | 4,655 | 150 | import operator
import re
import os
from glob import glob
# Functions for reading and writing files
def read_from_file(file_name):
"""
Function for reading text files
"""
f = open(file_name, 'r')
text = f.read()
f.close()
return text
def write_to_file(text, file_name, writeoption='w'):
... |
a2c15430d4b7f3be898df993b8a88fddf2aa75b8f25dba6b0551881b1912584f | Python | 4,655 | 81 | import ast
import functools
import http.server
import io
import os
import pathlib
import threading
import numpy as np
import pandas as pd
import pytest
BASE_DIR = pathlib.Path(__file__).resolve().parent.parent
# A site built by packaging/build_web.py; the Pages workflow builds one and runs this before it deploys
SITE ... |
c3e4d6741cf05f8ff112635fc3334252767988a22ddd6858bd1d8bf58a9e7b1d | Python | 4,658 | 100 | #!/usr/bin/env python3
import os
import sys
import torch
import numpy as np
import argparse
from aptnn.committee import CommitteeAPTNN
from... |
1419f63e884ea5ffea7c836d92434435855c1be180537405255ee4e5dc989cb2 | Python | 4,661 | 114 | ####################################################################################################
# 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... |
ff2d29f773cab3242f36b914d634442bbb8dbbb7ca64b3da68e24a9770688591 | Python | 4,661 | 140 | import os
import subprocess
import sys
import tempfile
from unittest import mock
import pytest
from ci.ray_ci.automation.pypi_lib import (
_get_pypi_token,
_get_pypi_url,
upload_wheels_to_pypi,
)
@pytest.mark.parametrize(
"pypi_env, expected_url",
[
("test", "https://test.pypi.org/legacy... |
90a0b59a93335ac61d7ba2e4f843dab4e53c31ace06dacd3a67a21cfa09e44cd | Python | 4,665 | 142 | """Helper classes to manage pytorch data."""
import itertools
import warnings
from typing import Any, Callable, Protocol, Sequence, Union
import numpy as np
import numpy.typing as npt
import torch
from torch.utils.data import Dataset
__author__ = "Marko van Treeck"
__copyright__ = "Copyright 2022, Kather Lab"
__lice... |
b88b383a08126681b50f9b93511e080a3a9455c2ca77899fd4a175cbea1863da | Python | 4,665 | 149 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
c7393616d67c66b09e73047a2f744c39852adca026e68b81766d0acc08a53dca | Python | 4,667 | 130 | '''
Example for visualizing an individual.
'''
import os
import pickle
import matplotlib as mpl
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from matplotlib.colors import Normalize
path = os.path.join(os.path.dirname(__file__), 'examples/xor/results_xor_0')
# path = os.path.join(os.path.d... |
0c69eea5c23d080f5ad6b753eee07c9286f15b56bb615bf333c9a2c433b16a42 | Python | 4,668 | 87 | import argparse
import projectmetis.proto.metis_pb2 as metis_pb2
from projectmetis.python.logging.metis_logger import MetisLogger
from projectmetis.python.utils.proto_messages_factory import MetisProtoMessages, ModelProtoMessages
from pybind.controller.controller_instance import ControllerInstance
if __name__ == "__... |
b4b3d96f198df41abfb2e8675ed70c2d132ab8cfbb098b92b0de28425e68c644 | Python | 4,670 | 127 | # Copyright (c) 2017-present, Facebook, Inc.
#
# 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... |
3490b78d593816c4e767d51994ae6ec230fcd1b47c3178037fb56087f5966700 | Python | 4,672 | 143 | import warnings
from pathlib import Path
from typing import TYPE_CHECKING, Optional, Union
if TYPE_CHECKING:
from data_profiling.profile_report import ProfileReport
from data_profiling.config import Settings
from data_profiling.model import BaseDescription
from data_profiling.report.presentation.core import Root
... |
878669891cc4baad0b9f73bbbd5d2b74bb02623f338152fad62d7e797a2ee7fd | Python | 4,672 | 158 | import time
import numpy as np
from discontinuous_galerkin.base.base_model import BaseModel
from discontinuous_galerkin.polynomials.jacobi_polynomials import JacobiP
from discontinuous_galerkin.start_up_routines.start_up_1D import StartUp1D
import matplotlib.pyplot as plt
import pdb
class PipeflowEquations(BaseModel):... |
91d32a592ca31277ea476ce03eca97543f4a3fa94fd431e53526c130ab1c8edb | Python | 4,672 | 109 | from dataclasses import dataclass
from typing import Optional, Tuple
import torch
from torch import nn
from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel
from transformers.utils import ModelOutput
@dataclass
class TransformationModelOutput(ModelOutput):
"""
Base class for text... |
b12527a52450f78b398c99eb36f23b29a151112b81705e533473bd900eb1c6c9 | Python | 4,673 | 118 | from loguru import logger
import os
import sys
import json
from deltasplice.constant import CL, EL, Fapath
from pyfasta import Fasta
SavePath = "data/autism_genome"
def parse_line(line, i):
line = line.replace("\n", "").split("\t")
Name, _, Chr, Strand, Ts, Te, Js, Je = line # the data should be in 1-base... |
833351db964929c03ce2fa6537d0c018e40869ac0da23a02cc779805dfe4f28f | Python | 4,675 | 146 | import importlib
import warnings
from typing import Any, Callable, Dict, Optional, Sized
import pandas as pd
from data_profiling.config import Settings
class MissingDataBackend:
"""Helper class to select and cache the appropriate missing-data backend (Pandas or Spark)."""
def __init__(self, df: Sized):
... |
f972819743b6de8dce124899c1cabaedcc714ca916e06cf34681ee095e232da7 | Python | 4,675 | 149 | """Currently this script tests `pfrl.wrappers.atari_wrappers.FrameStack`
only."""
from unittest import mock
import gym
import gym.spaces
import numpy as np
import pytest
from pfrl.wrappers.atari_wrappers import FrameStack, LazyFrames, ScaledFloatFrame
@pytest.mark.parametrize("dtype", [np.uint8, np.float32])
@pyt... |
2597edcb03f38e9dc54c57727af53c38605ea8b47758add78536259b65be2b04 | Python | 4,676 | 129 | # coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# 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 ag... |
de94fb06b7cdf7551b7b7bd06d1469883047f03b23ba50fcb143cbbab13b342a | Python | 4,676 | 110 | # import the main libraries required for the preprocessing
import mne
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import mne_connectivity
import os
import pickle
# import homemade function
from technical_validation_utils import (parula_map, scaling, interp, subjects)
mne.set_log_lev... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.