sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d2b1b4a8c7329b778da6050c676954fa41cc121c538906a3039042d606fc9540 | Python | 5,203 | 199 | from Purkinje_morpho_1 import Purkinje_Morpho_1
from Purkinje_morpho_1_number import number_ind_1
from neuron import h,gui
import numpy as np
import multiprocessing
import matplotlib.pyplot as plt
from toolbox_pc import *
import random as rnd
spines_on = 0 # This protocols works without spines for speed and sections ... |
0197628b629a39c7589d5e5fb2d221ed4efad8b3d39f5c6a74c1c166dd3d1a58 | Python | 5,204 | 108 | import torch
from torch.utils.data import DataLoader,TensorDataset
import pandas as pd
from modelClasses import *
from utilityFunctions import *
# torch.backends.cudnn.deterministic = True
# torch.backends.cudnn.benchmark = False
os.environ['CUDA_LAUNCH_BLOCKING'] = '1'
if __name__ == "__main__":
# which session... |
09f29242c04e29e69dab9114299af9fd11325f24c269e77c909ee61c8e4aeb4c | Python | 5,205 | 135 | import glob
import json
import logging
import os
# set gpu private
os.environ['TF_GPU_THREAD_MODE'] = 'gpu_private'
import tensorflow as tf
import numpy as np
import sys
# add base path to sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
from task2_regression.models.fcnn_env import FCNN, pear... |
b65da3acd6af7d2edd6d2b28669a7e60c5529b49f101d03a9e4dd5f2ff81e545 | Python | 5,209 | 131 | import sys
import requests
import cv2
import random
import time
import numpy as np
import cupy as cp
import tensorrt as trt
from PIL import Image
from collections import OrderedDict, namedtuple
from pathlib import Path
def letterbox(im, new_shape=(640, 640), color=(114, 114, 114), auto=True, scaleup=True, stride=32):... |
9a9d63290ffd7328d068fee229bedf59769ef1ceeb3518dc872e1891d527accd | Python | 5,210 | 135 | """
Created on Wed Jun 16 22:50:41 2021
@author: Mathieu Scheltienne
"""
import cv2
from ._visual import _Visual
from ... import logger
class Text(_Visual):
"""
Class to display a text.
Parameters
----------
text : str
The text to display.
fontFace : cv2 font
The font to us... |
6f46ab88abdaede568c941f8c44f4d48b402ea70a8f06b580e1e34d9258c0445 | Python | 5,213 | 133 | from typing import List, Literal
from pydantic.dataclasses import dataclass
from pydantic import Field
from rdkit.Chem import Mol
import numpy as np
import json
from .uru_ring_system_finder import get_rings, make_rings_generic
from ..component_results import ComponentResults
from reinvent_plugins.mol_cache import m... |
0c3fa335b7c3c0df322e353d262c1049e07a3dc93fac61fd8f51a8e100700e8e | Python | 5,214 | 134 | # Load the dataset
from torchvision import datasets, transforms
import numpy as np
from sklearn.linear_model import RidgeClassifier
import matplotlib.pyplot as plt
import matplotlib
from sklearn.metrics import ConfusionMatrixDisplay
import umap.umap_ as umap
# Transform PIL image into a tensor. The values are in the r... |
5084e6e469e88a8d525588f4c412737ea5e956c0bee7f88436913d442a115b33 | Python | 5,215 | 135 | import ast
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QCheckBox, QHBoxLayout, QLineEdit, QMessageBox, QWidget
from idtrackerai.GUI_tools import LabelRangeSlider
class TrackingIntervalsWidget(QWidget):
newValue = Signal(object)
def __init__(self, parent):
super().__init__()
se... |
42a37573cb5bf6a0712d6b788eeb803499b49d56916d362a5cbdcef5521516cb | Python | 5,220 | 138 | from typing import Optional
from rdkit.Chem.rdchem import Mol, BondType, RWMol
from rdkit.Chem.rdmolops import SanitizeMol, CombineMols
from reinvent.chemistry import conversions, tokens
from reinvent.chemistry.library_design import attachment_points
def join_scaffolds_and_decorations(
scaffold_smi: str, decora... |
64a748264b38fdee4304a3d692fe6b52077a738e4a8a3183fffa272e840708a2 | Python | 5,225 | 108 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
56cc3c9682691640bac8d2d71f90431c186de1e7f5350b7f5051dff119446420 | Python | 5,233 | 162 | import torch
import numpy as np
__author__ = "Zhijian Yang"
__copyright__ = "Copyright 2019-2020 The CBICA & SBIA Lab"
__credits__ = ["Zhijian Yang"]
__license__ = "See LICENSE file"
__version__ = "0.1.0"
__maintainer__ = "Zhijian Yang"
__email__ = "zhijianyang@outlook.com"
__status__ = "Development"
class Paired_dat... |
8e35d8dedb52608c4e4a14bb0943936910533a410f6d1272e08b78ec97f85489 | Python | 5,233 | 143 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
b45a609d740596c86f3deca5e26c7444ce769d31577916cacf37ba3323ceab3a | Python | 5,234 | 102 | """One publication curated in two chunk files (#390).
`CHUNK_DEDUP_KEY` contains `reference.id`, so a group of it spanning two chunk files is one paper
reporting one clone twice - and two rows of one paper are not two independent reports, which is the
whole basis for deduplicating within a chunk. The chunk is normally... |
dd1278993bad7b30fbccce6741397168357f139a48648bc1a85b811e98d1fba3 | Python | 5,234 | 145 | from __future__ import print_function
import numpy as np
from math import ceil, floor
def deriveSizeFromScale(img_shape, scale):
output_shape = []
for k in range(2):
output_shape.append(int(ceil(scale[k] * img_shape[k])))
return output_shape
def deriveScaleFromSize(img_shape_in, img_shape_out):
... |
dfdb0b69d4c5e7e91571104683f9061cc639b9543ed0ba9518450710e129e2b0 | Python | 5,234 | 121 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 12 15:25:17 2018
@author: ngritti
"""
from deeprest.rawDataClass import rawData
from deeprest.modelClass import modelRest
from deeprest.timeLapseClass import sampleTimeLapse
import time, glob, os, shutil, tqdm
from tifffile import imread, imsave
fro... |
6c53934c628572b43d5a93ef16d6a524aeb6377dfce6dc4f93e2b158778eeecd | Python | 5,235 | 158 | """Methods to select among potential models.
"""
import numpy as np
import scipy.stats
from sklearn.decomposition import PCA
__all__ = ['max_min_detector', 'n_components_to_explain_variance']
def _calc_bartlett_lawley_statistic(n, between_set_pc_cov, pX, pY, s):
"""Calculates the Bartlett-Lawley statistic.
... |
33868a4b21d155720cdb394ace1364c25286ebd63e6cde0275376a710335ee7a | Python | 5,242 | 148 | import os
import sys
import warnings
import numpy as np
import torch
import tqdm
from loguru import logger
from model_angelo.gnn.flood_fill import final_results_to_cif
from model_angelo.models.multi_gpu_wrapper import MultiGPUWrapper
from model_angelo.utils.gnn_inference_utils import (
init_empty_collate_results,... |
0795f46f28e616ae2bb894e12e1f81c03fad07a402b36d65692ca01beed53f6b | Python | 5,244 | 176 | from initializations import weight_variable_glorot
import tensorflow.compat.v1 as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
_LAYER_UIDS = {} # Global unique layer ID dictionary for layer name assignment
def get_layer_uid(layer_name = ''):
"""
Helper function, assigns unique layer IDs
"""
if laye... |
7681007b57ed2239f9d33ba9ab1749a99fd3219cc7d17f23f80c61ab06314758 | Python | 5,247 | 151 | import os, glob, tqdm
from skimage.io import imread, imsave
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib as mpl
import scipy.ndimage as ndi
from skimage.metrics import structural_similarity as ssim
from skimage.metrics import normalized_root_mse as nrmse
from skimage.fi... |
7564e68dfccf8c2bfeb556872f83ec769e3cc13b3a5358a23cd391b0a2553477 | Python | 5,249 | 117 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
5c815270c2d40f568b82416cf4e6ec14b7c99986bf7b39d5044d7918bc957538 | Python | 5,250 | 127 | import math
import numpy as np
def iterate_minibatches(inputs, targets, batch_size, shuffle=False):
"""
Generate a generator that return a batch of inputs and targets.
"""
assert len(inputs) == len(targets)
if shuffle:
indices = np.arange(len(inputs))
np.random.shuffle(indices)
... |
dcbd895baf14d25261090b4b153db451424ae9ca53d87c9c3a8a1522ec389836 | Python | 5,250 | 146 | # Copyright (C) 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""You may copy this file as the starting point of your own model."""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from typing import Iterator, Tuple
from openfl.utilit... |
e0688d923780f0be1a780f33079720426958efc9ab8003ecfd987d11096e3f74 | Python | 5,252 | 153 | #!/usr/bin/env python
import json
import sys
from typing import List, Tuple
def check_eddy_s2v(
eddy_s2v: bool,
slspec_txt: bool,
has_slice_timing: bool,
json_file: str,
) -> None:
"""Check if slice-to-volume correction can be performed"""
if eddy_s2v and not slspec_txt:
if not has_sli... |
27e62dbcbfffdd4140f1d55e3e89f7253565bdfc34f0495a8333aa9239ecb2fc | Python | 5,254 | 175 | import asyncio
import json
from live2p.start_live2p import start_live2p
import logging
from datetime import datetime
from glob import glob
from pathlib import Path
import multiprocessing
import websockets
import time
import threading
ip = 'localhost'
port = 6000
init_folder = 'e:/caiman_scratch/ori_20210209_seed'
data... |
6bca4b6ddd091afcd73cef90b0272de05a2f71fa51c6cf37aedecd30df872144 | Python | 5,254 | 172 | import os
import sys
import mne
import multiprocessing as mp
from neurodecode import logger
from neurodecode.triggers import TriggerDef
from neurodecode.gui.streams import redirect_stdout_to_queue
import neurodecode.utils.io as io
mne.set_log_level('ERROR')
os.environ['OMP_NUM_THREADS'] = '1' # actually improves perfo... |
071ac8cbe65f412ffc932d77a569f83f8bbf02eee7675d6586973c9b3bfaaf83 | Python | 5,255 | 142 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Custom Assigner module."""
import logging
from collections import defaultdict
from openfl.interface.aggregation_functions import WeightedAverage
logger = logging.getLogger(__name__)
class Assigner:
"""Custom assigner class.
... |
3f5c32e668aa97ff6458b892ba33935db0086c127994fb0845ba7313ae935b22 | Python | 5,255 | 171 | from typing import Union, Optional, List, Dict, Tuple, Any
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
def obtain_indexes_from_category_item(ser_cate : pd.Series,
ser_item : pd.Series
... |
d9cebcf00a4b2f91a6cddc6a32cff920785346073420efa9fb1d043a1df89c60 | Python | 5,255 | 158 | """Tests for nltools.io.h5 — HDF5 serialization utilities."""
import os
from pathlib import Path
import pytest
from nltools.io.h5 import _is_h5_path, _load_brain_data_h5, _to_h5
class TestIsH5Path:
"""Tests for _is_h5_path."""
@pytest.mark.parametrize(
"path,expected",
[
("data... |
e87ee36bf12ac61a29fbcf1190c37877778a5d28e0577576102bbde177e6de10 | Python | 5,259 | 169 | # Copyright (C) 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import torch
import torchvision
import numpy as np
import pathlib
import os
import matplotlib
import matplotlib.pyplot as plt
import PIL.Image as Image
import imagen as ig
import numbergen as ng
watermark_dir = "./files/watermark-datas... |
228f00c2979d122cb4c47a880fa7cb2cc0bc3fea681a90899052e175e538302b | Python | 5,261 | 173 | import os
from collections import namedtuple
from functools import lru_cache
from pathlib import Path
from typing import Union
import numpy as np
from neuron import h
from src.settings import STIM_ONSET, STIM_PULSE_DUR
pvParams = namedtuple("pvParams", "target_myelinated_L node_spacing node_length ais_L")
@lru_cach... |
cb6de68879fd9f4d25c5671a39d6122c7dc646ed7f2a56b4cedae8677a940638 | Python | 5,262 | 164 | import ase.io as aio
import numpy as np
import pytest
from ase import Atoms
from ase.build import molecule
from mace.cli.fine_tuning_select import (
FilteringType,
SelectionSettings,
SubselectType,
_filter_pretraining_data,
_load_descriptors,
_maybe_save_descriptors,
filter_atoms,
selec... |
0408afd67ff0a29e5cdfe89d6b2cc70f1a024e314fbbdd9706c84704297f29f7 | Python | 5,263 | 87 | """
This is the configuration file for pretraining.
We implemented two pretrain tasks: mask prediction and mask contrastive learning.
--- Mask prediction is just the same pretrain task used in original BERT paper, predicting the ids of masked tokens
--- Mask contrastive learning is our propsed pretraini... |
515f490f5877232e551e0c4aa9969f7cfdaf4ea5dce8838f56455a847c85de9a | Python | 5,263 | 137 | import glob
import json
import logging
import os
# set gpu private
os.environ['TF_GPU_THREAD_MODE'] = 'gpu_private'
import tensorflow as tf
import numpy as np
import sys
# add base path to sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
from task2_regression.models.eegnet_env import EEGNet, ... |
a9a4b845f8ec947f02fb69c6815d9cd86d77c030e2e4cf49dd5ab009891c0de1 | Python | 5,263 | 146 | """GNC backend: TORTOISE's CreateGradientNonlinearityBMatrix."""
from pathlib import Path
import nibabel as nib
import numpy as np
from lib.designer_input_utils import splitext_
from lib.utils import force_remove
def resolve_is_ge(scanner: str) -> bool:
"""Map -gnc_scanner to TORTOISE's GE/non-GE distinction (... |
0f09058b01d2ed3da9d8a474a048826dc581deb3de9c9b8381c5a97b27a04019 | Python | 5,264 | 199 | """
LSL wrapper functions for creating a server and a client.
"""
import time
import multiprocessing as mp
import xml.etree.ElementTree as ET
import pylsl
from ... import logger
def start_server(server_name, n_channels=1, channel_format='string',
nominal_srate=pylsl.IRREGULAR_RATE, stype='Markers',... |
ae63a2280328d5f832ed9649edde513d912766564e151eb51b3838934f3210d7 | Python | 5,266 | 122 | # Utility functions for uniprot database https://www.uniprot.org
from typing import List
from io import StringIO
from urllib import parse
from urllib.request import Request, urlopen
import requests
import pandas
from errors import UniprotNotFoundError, UniprotMultipleOutputError
# def get_uniprot_sequences(uniprot_i... |
b2d1666323b13286817624e09441f102efeb6f68c5200c66137a8e2f73fd34c3 | Python | 5,268 | 151 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from joblib import delayed, Parallel
import numpy as np
from sleeprnn.detection import metrics
from sleeprnn.common import constants
def fit_threshold(
feeder_dataset_list,
predicted_dataset_list,
... |
b4d9f55c76845c587d19197e53dd3f71513dafbeeae005f219d3cf17d3a5be39 | Python | 5,270 | 136 | """
Calculate the planarity each waves.
"""
import argparse
import os
import numpy as np
import neo
import pandas as pd
import matplotlib.pyplot as plt
import copy
import seaborn as sns
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import analogsignal_to_imagesequence
from utils.parse import none... |
9b78d26f7c19f8701d7ca28379fe9b58fcaa9cca8c3d6ba0f1d614c248dd2fd6 | Python | 5,271 | 111 | """
The Wilson-Cowan Neural Mass Model
================================
Here, we will introduce the Wilson-Cowan model, a popular neural mass model of the dynamic interactions between
2 populations: excitatory projection neurons (E), and inhibitory interneurons (I).
The model is of phenomenological nature, but captur... |
35a405d04e3e00fa6280b6ac054e3892ff8094eb8c3a5d9b2ca1556d77d296c4 | Python | 5,274 | 129 | # copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applic... |
a1ae1dcec98bfffa009487f6d078cc58d02418bf517135bee4efbf623e378e92 | Python | 5,274 | 98 |
from __future__ import absolute_import
from tensorflow.keras.applications import *
from tensorflow.keras.models import Model
from ops import freeze_model
import warnings
layer_cadidates = {
'VGG16': ('block1_conv2', 'block2_conv2', 'block3_conv3', 'block4_conv3', 'block5_conv3'),
'VGG19': ('blo... |
9bef83dc42defe001326c51692da028a0ca4e5fd8bae4bf9b222088bc5e03e7c | Python | 5,277 | 187 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Module with auxiliary CLI helper functions."""
import os
import re
from itertools import islice
from os import environ
from pathlib import Path
from sys import argv
from click import echo, style
from yaml import FullLoader, load
FX = ... |
c04a02645eaf189abe29e11f3fbde28a75e31dec0fd89734b8bf324752e7798c | Python | 5,278 | 158 | import torch
import torch.nn as nn
from torch import Tensor
import numpy as np
import timm
class FeatureExtractor(nn.Module):
def __init__(self, model_name, dropout=0.5, dim_spatial=None, pooling=(3, 3), pretrained=False, device="cuda"):
super().__init__()
self.d_model = {
... |
e336394095a3bd8e9048f8faa8e99e6b3daa6c8747ca414f70bb10bce5d55066 | Python | 5,278 | 141 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
import torch
import torch.nn.functional as F
from fairseq import metrics
from fairseq.c... |
3a60cd6dd35e0cdf68a6c95181f818f32d3d5d51369baa997d16b483400a51b3 | Python | 5,279 | 110 | # Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
from mpi4py import MPI
import numpy as np
from nest_elephant_tvb.transformation.communic... |
e002203a756b23d5d0e545fbac7f9cfbd9809dd400c8e4e6e76d078d9498041a | Python | 5,279 | 103 | import numpy as np
import pickle
from scipy import stats
if __name__=="__main__":
best_split_id = [2, 2, 2, 2] # correspoding to split index for S1, S1, S3, and S3
hcp_sessions_list = ['LR_S1', 'LR_S1', 'RL_S1', 'RL_S1'] # models S1, S1, S3, S3
test_session_list = ['REST1_LR', 'REST2_LR', 'REST1_RL', 'REST2_RL'... |
e46c01c1dcbfa35f978188db8577f70d94e4e950f6e7510ac07979fe81a4f3e8 | Python | 5,281 | 147 | # ==============================================================================
# Copyright 2025 Technical University of Denmark
# Author: Nikolas Borrel-Jensen
#
# All Rights Reserved.
#
# Licensed under the MIT License.
# ==============================================================================
from dataclasses... |
13ee5c082d8c65e1c26b19684fde28661c087d195b4b8f421b4bfb814537017c | Python | 5,282 | 123 | from omegaconf import OmegaConf
import numpy as np
import logging
import plasticity.trainer as trainer
from plasticity.utils import setup_platform, validate_config, setup_logging
def create_default_config():
"""Create and return the default configuration dictionary."""
# coeff_mask = np.zeros((3, 3, 3, 3))
... |
0a3621a07ee1ee3c8ead47cd1d86d7b8d4b182c6adee919e9e8bba215da03c25 | Python | 5,285 | 136 | """
Calculate the planarity each waves.
"""
import argparse
import os
import numpy as np
import neo
import pandas as pd
import matplotlib.pyplot as plt
import copy
import seaborn as sns
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import analogsignal_to_imagesequence
from utils.parse import none... |
92c702ed88ab98784cc4c57a03ffa6fe04ccc5f949f70ee1d359eb20483df7ab | Python | 5,285 | 128 | # Generated by Django 4.1.1 on 2022-10-10 13:14
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('celsus', '0005_alter_organism_created'),
]
operations = [
migrations.AddField(... |
d3deb3be1c6dfcb1d863143956c7cff856d62fb62ee65c826b3c871d9e9e09a8 | Python | 5,289 | 169 | import numpy as np
import renderapi
from scipy.sparse import csr_matrix
from .utils import AlignerTransformException
__all__ = ['AlignerAffineModel']
class AlignerAffineModel(renderapi.transform.AffineModel):
"""
Object for implementing full or half-size affine transforms
"""
def __init__(self, tra... |
e52b6b849deb8fd2abbc1385ad2894493bff3e7af84d1438e23e082d4a669b58 | Python | 5,289 | 155 | import json
from math import prod
from pathlib import Path
import click
import numpy as np
import SimpleITK as sitk
from monai.metrics import (
DiceMetric,
HausdorffDistanceMetric,
MeanIoU,
SurfaceDistanceMetric,
)
from torch import Tensor, tensor
from tqdm import tqdm
@click.command()
@click.option(... |
725406504d7a3caaed7576e407bc9df3f0776dc7735d83e2fdb304b5154f99f2 | Python | 5,291 | 147 | from chromadb.api.types import Embeddings, Documents, EmbeddingFunction, Space
from typing import List, Dict, Any, Optional
import os
import numpy as np
from chromadb.utils.embedding_functions.schemas import validate_config_schema
import warnings
class MorphEmbeddingFunction(EmbeddingFunction[Documents]):
def __i... |
e4227ba783ca9d5171380cc95b66bf89ef9a6845dfd6de3c8576d88442cf907c | Python | 5,291 | 108 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
from ._base_datamodule import NequIPDataModule
from omegaconf import ListConfig, DictConfig, OmegaConf
from typing import Union, List, Callable, Optional, Dict
class ASEDataModule(NequIPDataModule):
... |
31bb47a0d064d650370bce63d73746b8c08d3a8f70212003b39e7b40ec23a6fe | Python | 5,295 | 126 | import sys
from miscFuncs import *
vcfFileName1, vcfFileName2, repeatGffFileName, refFaFileName, qualThresh, sampSizePerc, outMaskedFaFileName = sys.argv[1:]
qualThresh = int(qualThresh)
sampSizePerc = float(sampSizePerc)
def writeFa(seqData, outFaFileName, upper=False):
with open(outFaFileName, "w") as outFaFile... |
b7136265e36a145ae5e08236268413dc63bbf0b58cd64fa0be4f2ebcd3c54398 | Python | 5,295 | 202 | from glob import glob
# GPU handling
import tensorflow as tf
import os
# Tensorflow 2.XX\n",
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = '0' # '0,1'
gpus = tf.config.experimental.list_physical_devices('GPU')
# print("Num GPUs Available: {len(gpus)}")
if gpus:
if float(... |
ca5c4779afa3b75578121a906691a3aa77bc5b197ee73ca4e2d8e9b8a655b30b | Python | 5,298 | 195 | """Helpers for estimators.
"""
import numpy as np
from scipy.stats import pearsonr
def _center_scale_Xs(*Xs, scale=True, ddof=1):
"""Center X, Y and scale if the scale parameter==True.
This function is essentially a copy of
:func:`sklearn.cross_decomposition.pls_._center_scale_xy`,
generalized to mo... |
296dbc7756b1e16147704442194d273ab90f4c3d0c938b3a6857f8007c10bec0 | Python | 5,300 | 155 | """
Plot distribution plots, CDF, and ramachandran plots for sampled proteins
Meant as a way to re-plot the sampled proteins after sampling has been done.
Assumes directory structure (e.g., contains sampled_angles folder)
Usage: python sample_potting_only.py <dirname_with_results>
"""
from glob import glob
import os,... |
3759c9b1d82545f9b8569bfc369d7b61733552ca609651cb73bbe51cc743481d | Python | 5,300 | 100 | # This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it.
import torch
import ase.data
from nequip.data import AtomicDataDict
from typing import List, Dict, Optional
class ChemicalSpeciesToAtomTypeMapper(torch.nn.Module):
"""Maps atomic numbers to atom... |
75db6d0a2b32c1f57d8c0ce070a18ea0c2be97d2e48e96bc3cbf324f222bba90 | Python | 5,300 | 120 | # Author: Youzhi Luo (yzluo@tamu.edu)
# Updated by: Anmol Anand (aanand@tamu.edu)
import torch
from torch.nn import Linear, Sequential, ReLU, BatchNorm1d as BN
from torch_geometric.nn import GINConv
from torch_scatter import scatter
from ..constants import *
class GEMBConv(torch.nn.Module):
def __init__(self, no... |
4a2680a07a9dde76cb80c58a7671e6314c15cc2571663cff5287ae58a689726c | Python | 5,301 | 147 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
from omegaconf import II
... |
73b0e364acaeb00f0adb9d1dde9cf0ace30f6dde602438d02f9498c60667427a | Python | 5,302 | 166 | from copy import deepcopy
import odl
import torch
from odl.contrib.torch import OperatorModule
from odl.tomo import fbp_op
from odl.operator.operator import OperatorRightScalarMult
from dival.reconstructors.standard_learned_reconstructor import (
StandardLearnedReconstructor)
from dival.reconstructors.networks.it... |
7f38bd8f06dbdbcaa1ddb3a8aeef827166cacd12f857c0b308f11ed02c3948e6 | Python | 5,302 | 92 | import numpy as np
from scipy import stats
if __name__ == "__main__":
best_split_id = [2, 2, 2, 2] # correspoding to split index for S1, S1, S3, and S3
hcp_sessions_list = ['LR_S1', 'LR_S1', 'RL_S1', 'RL_S1'] # models S1, S1, S3, S3
test_session_list = ['REST1_LR', 'REST2_LR', 'REST1_RL', 'REST2_RL'] # test S1... |
0b86497cae316190376c4575b0e3c98db2932977c276c9d68cae07699ccbf3c1 | Python | 5,304 | 153 | # -*- coding: utf-8 -*-
import os
import argparse
import logging
import glob
from runAndParseSlim import buildMutationPosMapping, removeMonomorphic, buildPositionsList, writeIntrogressedAlleles, addMutationsAndGenomesFromSample
import gzip
from mpi4py import MPI
def emitMsEntry(positions, segsites, haps, numReps, o... |
15b7e35b0884a6eaefc158e20588c68e229df37d54de84b1fcb51f0a079db5d4 | Python | 5,305 | 144 | #This code extracts a voxel count from each tablet at each timepoint, from which a disintegration rate constant can be approximated.
#This code can serve as a template for how to loop through the data
import numpy as np
import h5py
import getopt, sys
import csv
#Genereate dictionary with number of timepoints for each... |
9d5daf1b409739c79332a627ec41bbd36af3aa8ca03ebebaccb951316409a52a | Python | 5,305 | 147 | # Copyright 2016 Wojciech Zaremba
#
# 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 writ... |
6c1d158154aa1dca19e0e4ee30b03a9c150350203b2a112bb2ceb8d938c2f401 | Python | 5,307 | 137 | """
Calculate the planarity each waves.
"""
import argparse
from pathlib import Path
import os
import numpy as np
import neo
import pandas as pd
import matplotlib.pyplot as plt
import copy
import seaborn as sns
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import analogsignal_to_imagesequence
fro... |
d14671b0070aa5df7a36be5b8e13fd10219ea367f06f71a65afc3e83dc4a9725 | Python | 5,307 | 114 | import os
import pandas as pd
import warnings
import torch
from torch.utils.data import DataLoader,TensorDataset
from modelClasses import *
from utilityFunctions import *
#torch.backends.cudnn.deterministic = True
warnings.filterwarnings("ignore")
# torch.backends.cudnn.benchmark = True
# os.environ['CUDA_LAUNCH_BLOC... |
e561921645fd8dd01236d11d440fa20360eade05671cad3cb4d4c4f72b844a71 | Python | 5,307 | 147 | # coding: utf8
# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserve.
#
# 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 requ... |
6f6e27a3131288600114a80f99b95b8d602797aa81f4bb6323beda60bc113dc4 | Python | 5,309 | 129 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import time
import argparse
from pathlib import Path
import re
import shutil
from subprocess import check_call
from concurrent.futures import ProcessPoolExecutor
from tests.github.utils import create_collaborator, certify_aggr... |
99ff63c732972635db8a9d8761d4de06ca924d2177a1393e97e6d5114f85bdef | Python | 5,309 | 144 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.utils import degree, remove_self_loops, add_self_loops
class FeatureExpander(MessagePassing):
"""
"""
def __init__(self, degree=True, onehot_maxdeg=0, AK=1, centrality=... |
827c04617d76240339f4de551bfa92040e395a5bf99e3bae4ac32c83705c3f52 | Python | 5,316 | 137 | import glob
import json
import logging
import os
# set gpu private
os.environ['TF_GPU_THREAD_MODE'] = 'gpu_private'
import tensorflow as tf
import numpy as np
import sys
# add base path to sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
from task2_regression.models.happyquokka import happyqu... |
02d21662dabecae7c3d058518a25da5e90921d1ffb9f89fa5f9db23ce4b34037 | Python | 5,317 | 150 | """Unit tests for mace_mp argument handling that need no model download."""
import sys
import types
import pytest
from mace.calculators import foundations_models as fm
@pytest.fixture
def d3_kwargs(monkeypatch):
"""Run mace_mp(dispersion=True) offline, capturing the D3 kwargs."""
recorded = {}
class F... |
b7099c050e272c0d59c71684ff75a59dcf8d562488345efca159d231476a8d65 | Python | 5,317 | 157 | """Exercise lazy NWB catalog, header, and recording access from DANDI."""
from __future__ import annotations
import argparse
from collections.abc import Sequence
from dandi_dataset import DandiDataset
from dandi_transport import LindiNwbTransport
from sanpy.sanpyLogger import get_logger
logger = get_logger(__name__... |
947c62e513dd31bff68656ecac17897d652e9654b742b17ecfba07b9f542d589 | Python | 5,318 | 133 | """
DISCRIMINATOR
====================
This module is left barely untouched from Gabriel Guimaraes and
Benjamin Sanchez-Lengeling original implementation
(http://github.com/gablg1/ORGAN).
The code was initially borrowed from the following two sources:
https://github.com/dennybritz/cnn-text-classification-tf (... |
58477832d5b5f3deb1dcefc82217d4149bf0cd1a523f3b6e0e5bf6631ba51f1d | Python | 5,319 | 158 | """Coordinate-level atlas labeling.
Adapted from [atlasreader](https://github.com/miykael/atlasreader)
(BSD-3-Clause); please cite it when using these tools.
References:
Notter, M. P., Gale, D., Herholz, P., Markello, R., Notter-Bielser, M.-L., &
Whittingstall, K. (2019). AtlasReader: A Python package to gene... |
77ed75c4402491a8c04254e2d4d2b9e5345a47adb268980a984f0622501237ed | Python | 5,319 | 141 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Aggregator interface tests module."""
import pytest
from unittest import mock
from unittest import TestCase
from pathlib import Path
from openfl.interface.aggregator import start_, _generate_cert_request
from openfl.interface.aggregat... |
3abcc6b0e613e22d6223edd66a61b1c38ea08e90315a738c0803c60c052a91d8 | Python | 5,323 | 156 | """MACE-MDP calculator tests (from PR #1439), relocated to unit/: they build
models locally and monkeypatch downloads, so they need neither network nor
optional dependencies.
"""
from pathlib import Path
import numpy as np
import pytest
import torch
import torch.nn.functional as F
from ase import build
from e3nn impo... |
c95b5aabfccef3f08b2348266bcbc53aa608757457ab7852ea3d352b7402f0c4 | Python | 5,323 | 136 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
from typing import List, Dict, Any... |
71814ac3639e19a2295236b24f9e710531e615312d3f4f9b95c06d92797d7f76 | Python | 5,327 | 147 | import tensorflow as tf
tf.random.set_seed(1)
import random
random.seed(1)
import tensorflow as tf
import csv
import SimpleITK as sitk
import matplotlib.pyplot as plt
import numpy as np
from numpy import argmax
import pandas as pd
import tensorflow.keras.backend as K
from tensorflow.keras import initializer... |
3a8eefedfd1866dc943aeb6eb74a82711ebe55127164d9f683b00e0692c37daa | Python | 5,330 | 134 | ### Code adapted from MoFlow (under MIT License) https://github.com/calvin-zcx/moflow
import re
import numpy as np
from rdkit import Chem
ATOM_VALENCY = {6:4, 7:3, 8:2, 9:1, 15:3, 16:2, 17:1, 35:1, 53:1}
bond_decoder_m = {1: Chem.rdchem.BondType.SINGLE, 2: Chem.rdchem.BondType.DOUBLE, 3: Chem.rdchem.BondType.TRIPLE}... |
47ea9e3ff6157c3253ae4b601971614f921880e31417f8a75d32dc05a1fb28bc | Python | 5,331 | 137 | """
Calculate the planarity each waves.
"""
import argparse
from pathlib import Path
import os
import numpy as np
import neo
import pandas as pd
import matplotlib.pyplot as plt
import copy
import seaborn as sns
from utils.io_utils import load_neo, save_plot
from utils.neo_utils import analogsignal_to_imagesequence
fro... |
49c3d968e4c7f574f24bc52d8c125f36099c38b4349b17826241488cfb98445e | Python | 5,331 | 122 | import torch
import torch.nn as nn
class IterativeBlock(nn.Module):
def __init__(self, n_in=3, n_out=1, n_memory=5, n_layer=3, internal_ch=32,
kernel_size=3, batch_norm=True, prelu=False, lrelu_coeff=0.2):
super(IterativeBlock, self).__init__()
assert kernel_size % 2 == 1
... |
4643e999268763ce7d195089803a8f6aee08288e74ef3c5b8501d157c951bff5 | Python | 5,333 | 177 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 13 15:24:19 2020
@author: shah
"""
import tf_psnr
from tensorflow import keras
import pickle, os, numpy
import tensorflow as tf
import skimage
def GaussianFilter(size, sigma):
"""
This function defines the gaussian filzter w.r.t size ... |
837156c8e7590411f5e12bdeec1c7efb6b4d0c5d0337cf5cfe821e58f00f832b | Python | 5,333 | 121 | # -*- coding: utf-8 -*-
#
#
# PyRates software framework for flexible implementation of neural
# network models and simulations. See also:
# https://github.com/pyrates-neuroscience/PyRates
#
# Copyright (C) 2017-2018 the original authors (Richard Gast and
# Daniel Rose), the Max-Planck-Institute for Human Cognitive Bra... |
c0ae24c1a060659e32bf0ad31b2e71ed9f0cf6ea7d4259ff815baa43df1b4839 | Python | 5,341 | 162 | # script to sample from ESM-IF for particular mutated positions in antitoxin only
# based on the octameric complex structure.
import esm
import pickle
import numpy as np
import importlib
import pandas as pd
import time
import sys
import torch
models_dir = "models"
device = "cuda" if torch.cuda.is_available() else "c... |
2c98b044b6d1896c259ad01540f27eaebb21fab6433793a616540dfe62e0f750 | Python | 5,345 | 185 | import pytest
from typing import Final, List
from omegaconf import OmegaConf
DATASETS: Final[List[str]] = ["MPTrj", "OMat", "MatPES"]
CUTOFFS: Final[List[float]] = [
4.5,
5.0,
5.5,
6.0,
6.5,
7.0,
7.5,
8.0,
]
REQUIRED_KEYS: Final[List[str]] = [
"chemical_species",
"per_atom_ener... |
d9e5ce6f54d8671e9f34d156b5610bc53c7359125cb4aced7d116350bbdeee3e | Python | 5,345 | 131 | import os
import requests
from tensorflow import keras
from Humatch.utils import HEAVY_V_GENE_CLASSES, LIGHT_V_GENE_CLASSES, PAIRED_CLASSES
# cnn weights added to compiled env package_data
HUMATCH_CODE_DIR = os.path.dirname(os.path.abspath(__file__))
CNN_WEIGHTS_DIR = os.path.join(HUMATCH_CODE_DIR, "trained_models")
... |
5ea5303569e977056e91f76b5d4976e7240b4f85b8946cdd9228f1d55e3d50c6 | Python | 5,346 | 126 | """
Tests for inference utility functions.
Tests helper functions like _generate_sign_flips, _compute_pvalue,
and memory management utilities.
"""
import pytest
import numpy as np
import multiprocessing
from nltools.algorithms.inference.utils import _generate_sign_flips
from nltools.algorithms.validation import _com... |
9e9b1fbc76e1b8a4373778d7ed209811aa8f32af89ab9f770c0e552d7ab749f4 | Python | 5,348 | 153 | import jax
import jax.numpy as jnp
from functools import partial
import optax
import plasticity.model as model
import plasticity.data_loader as data_loader
import numpy as np
import jax.numpy as jnp
def behavior_ce_loss(decisions, logits):
"""
Functionality: Computes the mean of the element-wise cross entropy... |
bf2945329c067081e84be9b6693d309cd67e0d5481dfb5de88d0d064d634fec7 | Python | 5,349 | 144 | """This script constructs a DGL (Deep Graph Library) graph using the triple file "edge.csv," which
represents dependency syntactic relationships. The `buildHomo` function is used for homograph construction,
while the `buildHete` function is employed for heterograph construction."""
import os
import time
from fairseq.m... |
e89f58a8735bdd2fdca465ac73ed289ecab176b68fe70a79523da43e99df2cb1 | Python | 5,351 | 135 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torch import nn, Tensor
from typing import Optional, Tuple
from . import register_norm_fn
@register_norm_fn(name="batch_norm")
@register_norm_fn(name="batch_norm_2d")
class BatchNorm2d(nn.BatchNorm2d):
"... |
0498b7509400b9fd30176a976611f5ec24592441dba42841c7421a4ad9bdb45b | Python | 5,356 | 150 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
2819bb7816d908cd5c54b7ae94983da50ef9d8434090fb7b340457121df08325 | Python | 5,357 | 180 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Model CLI module."""
from logging import getLogger
from pathlib import Path
from typing import Union
from click import Path as ClickPath
from click import confirm, group, option, pass_context, style
from openfl.federated import Plan
f... |
4bb82062cfcf880a6b871a13634fcdf4e02a68eb2e4dd1e5535c46567bc181c8 | Python | 5,358 | 133 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from sklearn.model_selection import train_test_split
from sklearn.linear_model import RidgeClassifier
from sklearn.preprocessing import StandardScaler,LabelEncoder
from imblearn.over_sampling import SMOTENC
from sklearn.metrics imp... |
bfa4e764dc9c0077e06e08e4795b8acc020199bf3d215153763def0c6fc2366d | Python | 5,358 | 161 | # Copyright 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from metaflow import Flow
import logging
import numpy as np
from openfl.databases import TensorDB
from openfl.utilities import TensorKey
import tests.end_to_end.utils.exceptions as ex
log = logging.getLogger(__name__)
def validate_flow(f... |
de31a2704d20e93c20d63e4d5b63b08e4ec2768029bb31eda0d2bdb0b267446f | Python | 5,358 | 138 | """Canonical tail vocabulary across every p-value-producing entry point (v0.6.0).
The library standard: `tail: int | str = 2`, accepting `2 | 'two'` (two-tailed,
the default everywhere) and `1 | 'one'` (one-tailed in the test's canonical
positive direction — correlation/ISC/similarity > 0, mean > popmean,
group1 > gro... |
c901847b7c3389ad6d06740a3ac164b80d99591763dc0a8df79a42ac879834fb | Python | 5,363 | 165 | # -*- coding: utf-8 -*-
# OS stuff
import os
import sys
import warnings
from pathlib import Path
# Computational stuff
import numpy as np
import matplotlib as mplb
import matplotlib.pyplot as plt
# Other scripts and my stuff
script_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = Path(script_dir).parent... |
635a7969617ead3d69a310217c55b1def62fad2ea22cec49a6fa742d84272e82 | Python | 5,372 | 163 | import sqlite3
import weakref
from abc import ABC, abstractmethod
from typing import Any, Set
import threading
from overrides import override
from typing_extensions import Annotated
class Connection:
"""A threadpool connection that returns itself to the pool on close()"""
_pool: "Pool"
_db_file: str
... |
27ac97b80e845661c9456a287a5eaabf5ec3b5388f653e788074be79496e3a8a | Python | 5,376 | 170 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.