sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fbe72599f9b9eee9c8bde9adac6dcf50b63075341ab61d849ea05089929256cd | Python | 3,959 | 131 | from ._alt_delta import alt_delta
from ._alt_gamma import alt_gamma
from ._bandit2arm_delta import bandit2arm_delta
from ._bandit4arm2_kalman_filter import bandit4arm2_kalman_filter
from ._bandit4arm_2par_lapse import bandit4arm_2par_lapse
from ._bandit4arm_4par import bandit4arm_4par
from ._bandit4arm_lapse import ban... |
7aab8b67981abf7e5b3613ac30635d3c22eaf457220834ddb3dda026c1f51ae7 | Python | 3,963 | 128 | """
##############################################################################
#
# Select exon representative subset according to n.o.
# transcripts that contain them.
#
# AUTHOR: Maciej_Bak
# AFFILIATION: University_of_Basel
# AFFILIATION: Swiss_Institute_of_Bioinformatics
# CONTACT: wsciekly.maciek@gm... |
023b7df2205ec50fb14491936d0450570b0f4593e444027f3be92c5db30c617c | Python | 3,965 | 123 | """
Utility functions to calculate the top node of the PID lattice in large(-ish)
systems, without having to compute all other nodes. Implements Williams &
Beer's I_min and Barrett's MMI.
Pedro Mediano, Jun 2021
"""
import numpy as np
import dit
from dit.pid.measures.imin import s_i
def imin_syn(d, get_MI = False):
... |
b0db3ef4df335043deafa44c48db165952fd671eb4cd50df3a537ad50aedd529 | Python | 3,967 | 112 | """`LLMResult` class."""
from __future__ import annotations
from copy import deepcopy
from typing import Any, Literal
from pydantic import BaseModel
from langchain_core.outputs.chat_generation import ChatGeneration, ChatGenerationChunk
from langchain_core.outputs.generation import Generation, GenerationChunk
from l... |
3ac93ca691221f4f93a163f6464ff68fdc12efcecc2faeec6d0f0cec4e431f37 | Python | 3,968 | 129 | """
Write TIP3P-FB parameters into a SMIRNOFF force field. Based on
https://github.com/pandegroup/tip3p-tip4p-fb/blob/master/OpenMM/tip3p-fb/tip3p-fb.xml
Ion Lennard-Jones parameters from $AMBERHOME/dat/leap/parm/frcmod.ionslm_126_fb3
"""
from pathlib import Path
import pandas
from openff.toolkit.typing.engines.smirn... |
6fb216bb8058f010ebc982f25690313acf38f951c6bfdd2cc23f313fddf5b0e2 | Python | 3,968 | 79 | import argparse
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
def get_parser(... |
7bf9bc6b28b816087ff55cb3b9be449ccddeb786ccd52b76840c7c4e4d12225f | Python | 3,968 | 88 | # Copyright (c) MONAI Consortium
# 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, so... |
0105a165332ce502cfb518e37f1f7b18f56f7a4fe44768c9214326fe8c1c9b43 | Python | 3,969 | 122 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 9 15:39:17 2021
@author: athanasiadis
"""
import itertools
import numpy as np
def shuffle(dimensions):
"""
shuffle
______________________
This is a function that generated permutations shuffling the order of the dimensi... |
4a0fdf246736b457bf58cc3f727cb1024e79b93330b7a46d6facc2b937d07735 | Python | 3,969 | 109 | import os
from collections import OrderedDict
import torch
import torch.nn as nn
from rdkit import Chem
from rdkit.Chem import AllChem
from core.network.utils import global_mean_pool_with_mask
from utils.geometric_graph import ATOM_ENCODER
from utils.utils import custom_load_pretrained_dict
from torch_geometric.data ... |
8380689f431e53bb391ffc596cf6d7a6555786c960c6f2012b707cc37e866b2c | Python | 3,969 | 98 | import gzip
import logging
import os
import shutil
import socket
from configs.configs import get_config_dict
if __name__ == "__main__":
# Copy and MNI denoised functionals
# Script to take the output from FSL preprocessing pipeline and save
# MNI-space versions in a dedicated directory for further anal... |
caa245f59b6ddb21c6b2b1673da2c6cedbe5834eb96806db374e880f7e41a52e | Python | 3,969 | 128 | import json
import math
from pgmpy.factors.continuous import LinearGaussianCPD
from pgmpy.models import LinearGaussianBayesianNetwork
from pgmpy.readwrite._base import BaseReader, BaseWriter
class LGBNJSONReader(BaseReader):
"""
Reads a Linear Gaussian Bayesian Network from the bnlearn-compatible JSON format... |
68cdcdd57b8e96b11d429d2f4c1d5e765924f8f0af79e97ea5ccfba7516d14ec | Python | 3,970 | 105 | from typing import TYPE_CHECKING
from pgmpy.base._base import _CoreGraph
if TYPE_CHECKING:
from pgmpy.base import DAG
class ADMG(_CoreGraph):
"""
A class representing an Acyclic Directed Mixed Graph (ADMG).
An ADMG allows directed (``"->"``) and bidirected (``"<>"``) edges, where a bidirected edge ... |
efc40b127ee851bc88ca3add8ee28484ae692194c382545a90370b1f99bd2577 | Python | 3,971 | 77 | import tensorflow as tf
from mol_graph_direct_useScores import max_nb
from nn import *
def rcnn_wl_last(graph_inputs, hidden_size, depth, training=True):
input_atom, input_bond, atom_graph, bond_graph, num_nbs = graph_inputs
atom_features = tf.nn.relu(linearND(input_atom, hidden_size, "atom_embedding", init_bi... |
2c455de2b4d34756443f8225bdb30a88f99a632611a8b8546e68276ab2e01214 | Python | 3,972 | 129 | # 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... |
f602c3c123331451bc23b919358c3fec1cd3c14b6f0642452321e65b314e380d | Python | 3,972 | 113 | #!/usr/bin/env python3
"""
Plot NMF genome scores as a heatmap annotated with group labels.
Usage:
python scripts/plot_nmf_heatmap.py \
--scores <nmf_scores.tsv> \
--metadata <groups.tsv> \
--output <output.png>
pixi run nmf_heatmap --scores ... --metadata ... --output ...
"""
import ... |
3bd863cea51f3c2c94452d08233802ecc5005953d732778d429f807908182a61 | Python | 3,974 | 118 | """Check that optional extras stay in sync with required dependencies.
When a package appears in both [project.dependencies] and
[project.optional-dependencies], we ensure their version constraints match.
This prevents silent version drift (e.g. bumping a required dep but
forgetting the corresponding extra).
"""
impo... |
6c1aa657e162cfc83daeda9d766efa89ba00be6cdcf726ef559999e3723da13b | Python | 3,974 | 95 | from ldscore import PartitionedLDScore
from flex_summ_h2 import FLEX
import argparse
import sys
parser = argparse.ArgumentParser(description='FLEX-summ-h2 (stochastic SE only)')
# --- FLEX run inputs ---
parser.add_argument("--pheno", type=str, default=None,
help="Path to phenotype-specific summar... |
26f1d901143c4fd69e71ed8362564995749fc41c0daf9ea39711f49d0b5a87ce | Python | 3,976 | 136 | from pydantic import BaseModel, ConfigDict
from typing import Any, Optional, Dict, List
from pdearena.utils.constants import Paths
import math
import os
class Config(BaseModel):
model_config = ConfigDict(extra="forbid")
# model + data
time_history: int
time_future: int
time_gap: int
... |
d02d2cb090e49ea24a973c4bfc37037c136529f0f9d400d125005b5e56e889d1 | Python | 3,976 | 96 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Interfaces to generate speciality reportlets."""
import numpy as np
from nilearn.image import threshold_img, load_img
from niworkflows import NIWORKFLOWS_LOG
from niworkflows.viz.utils import cuts_from_b... |
e21ea25293e9d34504840f8bbcbe6c308c172e63c9e8b09287c446cdd501cf62 | Python | 3,976 | 156 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 11 14:25:10 2019
@author: Shulan
list of unit and default parameters:
time: ms
voltage: mV
current: uA/cm^2
capacitance: uf/cm^2
conducrance: mS/cm^2
Cm = 1 uF/cm^2
Vna = 115mV
Vk = -12mV
Vl = 10.613mV
gna_bar = 120mS/cm^2
gk_... |
7624cf738ba4a8405273fb55a60fad1df9a14a59c79f762ba3dad2cfb49c0706 | Python | 3,977 | 86 | import gc
import os
import numpy as np
import pandas as pd
from keras import backend as K
import keras
import random
import tensorflow as tf
from keras.models import Sequential,load_model
from keras.layers import Dense, Dropout, Activation, Conv1D, Input
from keras import regularizers
from scipy.stats import pearsonr
... |
ebed5d03e8bdaeba0676c9ab7e3c9dec89a3e94eaca883c2e890c1bcd3ddc3b6 | Python | 3,978 | 130 | #!/bin/env python3
import voxcell as vc
import numpy as np
import sys
vd = vc.VoxelData.load_nrrd(sys.argv[1])
fmap = np.full(list(vd.raw.shape)+[2],-1)
dat = np.loadtxt(sys.argv[2],dtype = np.float64)
w = dat[:,[0,1,2]]
w = np.uint16(w)
w = tuple(w.T)
find_max = False
use_float = False
scale = 0
perc_usage = 0.... |
7a090ce6433eb4159b7e1a62584d19d94620fe6a3fcdcf3aba77e854f37ab706 | Python | 3,981 | 101 | import logging
import os
from fcest.helpers.array_operations import get_all_lower_triangular_indices_tuples
import numpy as np
import pandas as pd
from helpers.array_operations import reconstruct_symmetric_summary_measure_matrix_from_tril
from helpers.icc import compute_icc_scores_pingouin
from helpers.i2c2 import co... |
90a8937cd93ed4841fa5c442556bf439cfc4e36170acf65dca83bd7cb8774483 | Python | 3,981 | 90 | # coding=utf-8
# This file borrowed from Swin-UNet: https://github.com/HuCaoFighting/Swin-Unet
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import logging
import math
from os.path import join as pjoin
import torch
import torch.nn as nn
impor... |
326c2df5ea46365b6f8e1bbeab4634672db2c3035bf0051cbfd9ab04ae5d888e | Python | 3,982 | 144 | ########################################################################
# Stochastic second-order irreversible reaction: [A]0=[B]0
# RESTORE
# AIMS: to verify checkpointing and restoring of the well-mixed stochastic
# solver 'Wmdirect' in the context of the Second-Order Irreversible
# Reaction model (see validatio... |
286f69666157e05f9153646f7ed6d5e3deddb9c35a31e349ad0f943444038be3 | Python | 3,985 | 106 | import os
import socket
import sys
from helpers.inference import run_adam_svwp, run_adam_vwp
from fcest.models.wishart_process import VariationalWishartProcess, SparseVariationalWishartProcess
import gpflow
from gpflow.ci_utils import ci_niter
from configs.configs import get_config_dict
from helpers.evaluation import... |
c7cbd33707115314d8dca6c89ecdfa9f19db8690ba694b2c896734b013af1725 | Python | 3,987 | 139 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 4 14:33:28 2021
@author: athanasiadis
"""
import numpy as np
import pickle
def loader(mainpath,dataname):
"""
loader
______________________
This is a function that loads and prepares the desired dataset
for the permutat... |
596f3b8119956ff41e0157582fabdffd0c9419db39e111b4bb95bd70126cd7c0 | Python | 3,988 | 107 | # Copyright 2024 Eelke Spaak, Donders Institute.
# See https://github.com/Spaak/rift-phase-and-visibility for readme/license.
# Belongs with:
# Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension
# to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscience,... |
2cd92a9399803a7975534b10363a9805f472270d0796de8741f0f2aae10440e6 | Python | 3,989 | 97 | import logging
import os
import socket
import sys
import pandas as pd
from configs.configs import get_config_dict
from helpers.data import load_data
from helpers.evaluation import leave_every_other_out_split, get_tvfc_estimates
if __name__ == "__main__":
data_set_name = sys.argv[1] # 'd2', 'd3d', or 'd{%d}s... |
feb6c632b0b79c7e48038b8c48626a598e5a7da06256c6d55f84b8757263a367 | Python | 3,989 | 128 | # Adapted from OpenFold
# 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/l... |
53c5cc391078ae8a4d0edb35a39ab0356af9ec00361d68197883db7b5d12a035 | Python | 3,990 | 95 | # coding=utf-8
import numpy as np
import torch
import torch.nn.functional as F
import torch.autograd as autograd
from alg.algs.ERM import ERM
class RSC(ERM):
def __init__(self, args):
super(RSC, self).__init__(args)
self.drop_f = (1 - args.rsc_f_drop_factor) * 100
self.drop_b = (1 - args.... |
90b10d1257f78ec4c9589861d4c94d4be2a4757dd82ad3d58d70949eed9e01b9 | Python | 3,991 | 113 | # Copyright (c) MONAI Consortium
# 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, so... |
16b8f0dd00b90820e3894540ef03ff800646944a652ca133c8d72e523afb5f38 | Python | 3,992 | 84 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
from scipy.ndimage import zoom
# heap map size 46, 55, 46, MRI size 181, 217, 181
# thus increase the size of heatmap by 4 times to show in the ImageGrid with the same scale
def resize(mri):
x, y = m... |
d4db367c7c10d313517744c9f4576139a36ce84ff36ad93ad3de7f8c03a4be42 | Python | 3,993 | 104 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
### split 10x single-cell bam file by barcode (CB tag)
import sys
import os
import logging
import pysam
import argparse
FORMAT = '%(levelname)s %(asctime)-15s %(name)-20s %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)
logger = logging.getLogger(__nam... |
46c23fb2a65296b98cbc2eae5dccce027390986cc1407fb7f3fdbb9bae1cb0b3 | Python | 3,994 | 109 | import os
import numpy as np
from pathlib import Path
from eeg_utils import EEGLoader, EEGDownSegmenter, clean_subcortex_signal
from utils import parse_arguments, load_config
import mne
mne.set_log_level('WARNING')
def subcortex_pipeline(raw_dir: str, out_dir: str, file_extension: str, subjects_list: list, config: d... |
b80cf0f84faa538380c1e56fdf6cd72e6197abe235fd4ec1cbf724e8bd63c3c1 | Python | 3,994 | 110 | #!/usr/local/bin/env python
#=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
Test combinations of custom integrators and testsystems to make sure there ar... |
e5cb5f520eef663cd82ca20978735fd30123bda02b204d2b68a6ce4077455701 | Python | 3,994 | 103 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this sof... |
8c22a6f01c49d4f0e1440cb135b8a37e6bba6a94fe9d8d9ece3bd8bf897658bb | Python | 3,995 | 112 | #############################################################################
#
#Updated by: Yiqin Wang
#
##############################################################################
import sys, os
import numpy
sites = {}
coverage = {}
mtdna_len = 16569
probe_set = ["A%d"% i for i in xrange(1,13)]
probe_set = probe... |
e96b3a16eb849da954848facfc6cba22469f2dae9e311c3d77ac3ff903dd2c12 | Python | 3,995 | 106 | import os
import copy
import argparse
import pandas as pd
import torch
import torch.nn as nn
import torch.utils.tensorboard
from torch.utils.data import DataLoader, Dataset
from Bio import BiopythonDeprecationWarning
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore", BiopythonDeprecatio... |
707caeff1c2e793bb5e53a662d3077c7728657f8931842768429f0939baded0e | Python | 3,996 | 79 | STRUCTURED_FORMAT_INSTRUCTIONS = """The output should be a markdown code snippet formatted in the following schema, including the leading and trailing "```json" and "```":
```json
{{
{format}
}}
```""" # noqa: E501
STRUCTURED_FORMAT_SIMPLE_INSTRUCTIONS = """
```json
{{
{format}
}}
```"""
PYDANTIC_FORMAT_INSTRUCTIO... |
09098bc1d01649a5b0fa5f52497051e2e105acafe755a4d75fc4583f9de0449c | Python | 3,997 | 101 | import os, sys
import argparse
import subprocess as sp
import pandas as pd
from shutil import which
import logging
FORMAT = '%(levelname)s %(asctime)-15s %(name)-20s %(message)s'
logging.basicConfig(level=logging.DEBUG, format=FORMAT)
logger = logging.getLogger("hetSNP")
def parse_args(args):
description = "Extr... |
5adb8f277c1f5030f86aa94363e547d165ccd787e568764d6183267e66cbc6c7 | Python | 3,998 | 131 | import logging
import os
import socket
import sys
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from configs.configs import get_config_dict
from helpers.data import reorder_ica_components
from helpers.hcp import load_human_connectome_project_data, get_human_connectome_project_subjects
def... |
d8cdc21e2d7ffa3efaaabf08957f6e07f91589146a0c548d0110fcb2482c43c4 | Python | 3,999 | 144 | ########################################################################
# Stochastic second-order irreversible reaction: [A]0=[B]0
# RESTORE
# AIMS: to verify checkpointing and restoring of the well-mixed stochastic
# solver 'Wmdirect' in the context of the Second-Order Irreversible
# Reaction model (see validatio... |
01444b3c3a77f8d321d686b7f3a6bc22d22e5100447ca96da7fa6371eadda763 | Python | 4,000 | 105 | import numpy as numx
import pydeep.rbm.model as MODEL
import pydeep.rbm.trainer as TRAINER
import pydeep.rbm.estimator as ESTIMATOR
import pydeep.misc.visualization as VISUALIZATION
import pydeep.misc.io as IO
import pydeep.misc.toyproblems as TOY
import pydeep.misc.numpyextension as npExt
import mkl
import scipy.io a... |
9f09a28b756a2c58c4a930690df92d84ff1081f130fc7ade1b615ae8ccfe4aea | Python | 4,000 | 124 | # Copyright Generate Biomedicines, 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 to ... |
2d596252341453fc8474b915ce865d8284c5a155f74a5d4dbd767833cd58986d | Python | 4,003 | 127 | ###########################################################################################
# From MACE
###########################################################################################
import collections
import torch
from e3nn import o3
_TP = collections.namedtuple("_TP", "op, args")
_INPUT = collections.n... |
f46497ad2ffb70dc41d3e5a79cba5219a067853a5f12b98742835fe8c6b40162 | Python | 4,004 | 137 | """
:AUTHORS: Martin M. Müller
:ORGANIZATION: Department of Neurobiology, Bielefeld University
:CONTACT: martin.mueller@uni-bielefeld.de
:SINCE: Mon Nov 29 14:15:52 2021
"""
from utilities import mle_models as models
from utilities import mle_utils as utils
import numpy as np
def create_probability_map_uniform(x, y):... |
53b885217d9c3ca4406914b9c01e03e11c0b7c338ee645dde6b00a83a00f3ca5 | Python | 4,005 | 85 | """ Module for Functional Enrichment Analysis.
This OmicScope module is totally dedicated to Functional Enrichment
Analysis of Omics Experiment.
In this workflow we used GSEApy algorithm to
get two main analysis: Over-Representation Analysis and Gene-Set Enrichment
Analysis. For both cases, GSEApy runs the analysis a... |
bc86db3254b44e22ed12c3e5c6af158ddb441e475387df4b7ce3b49292c3338d | Python | 4,010 | 82 | # Copyright (c) 2008-2026 the MRtrix3 contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Covered Software is provided under this License on an "as is"
#... |
dd14a503373752838151d121de2a870142a02dc7d826cc749e1a0a7c652fe413 | Python | 4,010 | 122 | import argparse
from argparse import Namespace
from pathlib import Path
import warnings
import torch
import pytorch_lightning as pl
import yaml
import numpy as np
from lightning_modules import LigandPocketDDPM
def merge_args_and_yaml(args, config_dict):
arg_dict = args.__dict__
for key, value in config_dict... |
1938657bb8b9c6035de60a1356eb28c5357c42e3c7612ea5d326ca3344a33621 | Python | 4,012 | 116 | import torch
import torch.nn as nn
import numpy as np
class Skip(nn.Module):
def __init__(self, in_ch, out_ch, skip_channels=(4, 4, 4, 4), channels=(8, 16, 32, 64)):
super(Skip, self).__init__()
self.scales = len(channels)
assert(len(channels) == len(skip_channels))
self.down = nn... |
b1919a162bddce5fc0362fc99847f89ec6fe08f6b9fd9852f1ca3e22faa6ae18 | Python | 4,012 | 153 | import numpy as np
import getpass
import os
import torch
# Folders
def create_folders(args):
try:
os.makedirs('outputs')
except OSError:
pass
try:
os.makedirs('outputs/' + args.exp_name)
except OSError:
pass
# Model checkpoints
def save_model(model, path):
torch.s... |
cb56df0a36772ecd5018c7711e5f17ddb0dc47530e06516b87b0f65b8a101b72 | Python | 4,012 | 122 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import uuid
from pathlib import Path
import main as classification
import submitit
def parse... |
59425d1d1ce8b6205205d6a3a7fe4bb268a1fa590aae090237b966d6e94a8c55 | Python | 4,013 | 101 | # Copyright 2024 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
8ca511697698b4717009d33cc742e5e6c462b0d713c9abcce8be9d9fb11d0459 | Python | 4,013 | 134 | import matplotlib.pyplot as plt
import numpy as np
from sklearn import metrics
import datetime
def current_time():
return datetime.datetime.now().strftime("%Y-%m-%d_%H.%M.%S")
def colorful(s, font_color, mode_status):
color_list = [
'black', 'red', 'green', 'yellow', 'blue', 'purple', 'cyan', 'white... |
8fd9aa0e9b16e3e43e659b88363577711423be82fb4d39349ad13f9f41431a8d | Python | 4,013 | 119 | #!/usr/bin/env python
from Bio.PDB import PDBParser, NeighborSearch
from Bio.SeqUtils import seq1
import argparse
import os
import re
import json
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("structure_files")
arg_parser.add_argument("structure_path")
arg_parser.add_argument("regexes_file")
arg_pars... |
087d75de13a21ce0b9494b8eb7d0d9812d1bf633cc0b7cbe7fd7e872efc94b51 | Python | 4,018 | 119 | ########################################################################
# Stochastic degradation-diffusion process.
# AIMS: to verify if zero order reactions are inserted correctly to the SSA
# after bugfix https://github.com/CNS-OIST/HBP_STEPS/pull/146
# Note:
# 1. This is not validated against analytical result, ... |
90663581f3a95cdf6230a4e292592d953d633c20288eee4827078f0064b82575 | Python | 4,018 | 106 | import logging
import os
import socket
import sys
from fcest.models.sliding_windows import SlidingWindows
import pandas as pd
from configs.configs import get_config_dict
from helpers.evaluation import leave_every_other_out_split
from helpers.hcp import get_human_connectome_project_subjects, load_human_connectome_proj... |
28849927afbd9ad7f872c78c8201b1fdf4b079bf8fd8012d85989423b9be4e91 | Python | 4,019 | 65 | import mne
import numpy as np
import pandas as pd
import os.path as op
from config_FaceName import MEG_data_path,group_name,Ids,delay,bids_root,stimuli_list
from mne_bids import BIDSPath
for subject_id in Ids:
subject = group_name+"%02d" % subject_id
print("processing subject: %s" % subject)
fname... |
9976e7be944c093f606f7823fcd9ba52076df022a105eabe1b80075630cebc96 | Python | 4,020 | 114 | import numpy as np
import pandas as pd
from scipy import stats
from ._base import BaseCITest, _CITestResult
class Pearsonr(BaseCITest):
r"""
Partial Correlation test for conditional independence.
If :math:`Z = \emptyset`, compute Pearson's correlation coefficient :math:`r_{XY}` and its two-sided p-value... |
9305ede4c3e84b33f148ad21e7c8d6c6c0c461f452a15cc170df85f09fd59902 | Python | 4,021 | 148 | from typing import Any
import pytest
from langchain_core.callbacks.manager import (
AsyncCallbackManagerForRetrieverRun,
CallbackManagerForRetrieverRun,
)
from langchain_core.documents import Document
from langchain_core.structured_query import (
Comparator,
Comparison,
Operation,
Operator,
... |
7755eac44191da72043135756c5ae503f0d7ee7b46e0a469f3a0bbc7390cb03c | Python | 4,023 | 150 | from __future__ import print_function
import argparse
import os
from time import time as t
import ANNarchy
import numpy as np
import pandas as pd
plots_path = os.path.join("..", "..", "figures")
benchmark_path = os.path.join("..", "..", "benchmark")
if not os.path.isdir(benchmark_path):
os.makedirs(benchmark_pat... |
f3517339a460b80d090d6b6f8a1f743431b6ba346ce0b496f663b7cf31999c32 | Python | 4,023 | 101 | import argparse
from sincfold._version import __version__
def parser():
parser = argparse.ArgumentParser(
prog="sincFold",
description="sincFold: An end-to-end method for RNA secondary structure prediction based on deep learning",
epilog="webserver link | https://github.com/sinc-lab/sinc... |
60b14e8bad77332b2a5420e7a4b802c8c43a59805cd303cf03ec1b5743afb2f2 | Python | 4,025 | 94 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 17 15:12:18 2020
@author: shni2598
"""
from brian2.only import *
import connection as cn
#%%
class one_area:
def __init__(self):
self.neuron_model_e = cn.model_neu_syn_AD.neuron_e_AD
self.neuron_model_e_adapt_tv ... |
cd98e3dc4f3a3229a182169fe343be79941fbd9f6015075dd42a31b55606ef49 | Python | 4,025 | 97 | import pandas as pd
import polyfingerprints as pfp
import os
from tkinter import Tk, filedialog
import numpy as np
import datetime
import pickle
from math import isnan
from parameters import RunParameters as Pm
def default_export_path():
date_and_time = str(datetime.date.today()) + " " + datetime.datetime.now().s... |
5793cc7b9113298056e03e3273cb0c566d3f7d0fe31a7cf6d530b764312b4e6e | Python | 4,027 | 99 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Apply the estimated fieldmap to perform susceptibility-derived distortion correction."""
from nipype.pipeline import engine as pe
from nipype.interfaces import utility as niu
from niworkflows.engine.work... |
78bc79568aab2b99bb7d89fd3320a8e0a132ad2026d7340bc94367bf010c239b | Python | 4,027 | 132 | import torch
import torch.nn as nn
import torch.nn.functional as F
from core.loss import loss_register
from core.loss.base.atom_loss_combinator import AtomLossCombinator
from core.loss.utils import loss_dict_remake_wrapper
@loss_register
class PlainContrastiveLoss(nn.Module):
def __init__(self, cfg):
sup... |
e3dc373eb325649e201b9b7f1d5d398c5489b54412e165249e4b13d598a174ee | Python | 4,028 | 113 | # Representational similarity analysis of Nishida et al. (2021) data and our data
# Copyright (c) 2021 Laurent Caplette
import numpy as np
import h5py, csv, json, pickle
from nltk.corpus import wordnet as wn
from scipy.stats import spearmanr
from scipy.stats import rankdata
from scipy.spatial.distance import squarefor... |
228e66f42935bea74e99e861b74b73bca73cf521c88558a350a7c10487f752ab | Python | 4,029 | 98 | from torch.utils.data import Dataset
import pandas as pd
import torch
from pathlib import Path
import numpy as np
device = "cuda:0" if torch.cuda.is_available() else "cpu"
smi_char = {'<MASK>': 0,'C': 1, ')': 2, '(': 3, 'c': 4, 'O': 5, ']': 6, '[': 7,
'@': 8, '1': 9, '=': 10, 'H': 11, 'N': 12, '... |
a378181583f2adc00d10c755a68969230cab6d33ade27dbf088369bf1f0bf018 | Python | 4,031 | 109 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for d... |
8e778aaf39085d6114287ac46d76900b0f0b3687b28eef5688a1de145e91ed3c | Python | 4,032 | 109 | ####################################################################################
#
# STEPS - STochastic Engine for Pathway Simulation
# Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan.
# Copyright (C) 2003-2006 University of Antwerp, Belgium.
#
# See the file AUTHORS for detai... |
4dcc0b2b7b272b451fe5e5892e5514838d858f1c007c27fed15aea34e29ce9cf | Python | 4,034 | 116 | import json
from json import JSONDecodeError
from langchain_core.agents import AgentAction, AgentActionMessageLog, AgentFinish
from langchain_core.exceptions import OutputParserException
from langchain_core.messages import (
AIMessage,
BaseMessage,
ToolCall,
)
from langchain_core.outputs import ChatGenerat... |
271a736aeafc6a9571fe41d3d3675957ab79d04df7912a23608a6d11bf7365cf | Python | 4,035 | 119 | ########################################################################
# Stochastic degradation-diffusion process.
# AIMS: to verify if zero order reactions are inserted correctly to the SSA
# after bugfix https://github.com/CNS-OIST/HBP_STEPS/pull/146
# Note:
# 1. This is not validated against analytical result, ... |
43aff492343e4b7d660556d492f936c150e946ac8e2fbffe69c9451dd2ecefa3 | Python | 4,035 | 98 | """Experiment with different models."""
from __future__ import annotations
from collections.abc import Sequence
from langchain_core.language_models.llms import BaseLLM
from langchain_core.prompts.prompt import PromptTemplate
from langchain_core.utils.input import get_color_mapping, print_text
from langchain_classic... |
aef59f435bfead0139083dbcbc7b698223ec8c08ae5ff8e5a9d55970243ee29b | Python | 4,037 | 114 | import unittest
import steps.interface
from steps.model import *
from steps.geom import *
from steps.rng import *
from steps.sim import *
from steps.saving import *
import numpy
import math
import time
import os
import mpi4py.MPI as MPI
class TestTetWeighting(unittest.TestCase):
def setUp(self):
# S... |
4a4a76989b5395c7ceab39067708e392b6e8dea22715e97ca45420a93a677f23 | Python | 4,038 | 153 | import numpy as np
import getpass
import os
import torch
# Folders
def create_folders(args):
try:
os.makedirs('../diffusion/outputs')
except OSError:
pass
try:
os.makedirs('../diffusion/outputs/' + args.exp_name)
except OSError:
pass
# Model checkpoints
def save_model... |
75f0319063f9aae181d8330cc37003b58162e1ed92e3fdb423e0fb7a53142c4e | Python | 4,038 | 123 | #!/usr/bin/env python3
"""Build a fixed 10% QM9 train + 10% test split for ablation studies.
Reads the official ``datasplits.json`` (train / validation / test), writes:
ablation/data/datasplits_ablation_10pct.json
with:
- train: 10% of official train (seeded shuffle)
- validation: official validation (50) for ... |
6047bb89bbbec57c18e8b78cbf14d329ef42f408a73f8a3c43f6a3ee487cf48e | Python | 4,039 | 122 | '''
***************************************************************
Author: LU
Date: Nov 2020
Description:
Class for native contrast segmentation framework.
Uses an MPRAGE (CSF-nulled T1-weighted volume) to
predict thalamic nuclei + thalamus.
CNN is trained on ground truth generated by THOMAS algorit... |
5090d1e6f20f795436deaf5abbd704f4c629a02dd72940ae61f28b9ca940f873 | Python | 4,042 | 126 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
import pydata_sphinx_theme
# -- Path setup ----------------------------------------------------... |
fe439010530357c65601aa87ed8f141f4c4c7b31d0b6c702d29a3e3d041372d0 | Python | 4,042 | 120 | #!/bin/env python
'''run.py - wrapper around command line
====================================
Purpose
-------
This script is a generic wrapper for tools with a command line
interface. The wrapper records execution times and logs successfull
completion of the command.
Usage
-----
For example, typing::
python ... |
4867c27a76b5116d66f132c372022062204a7b157be5d07839bea57e2ec5a618 | Python | 4,043 | 157 | # Copyright 2023 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
d8c8799c174a71f61d12fdf732263480e7e10cfcca1a9a1e95cbea3630f863c1 | Python | 4,046 | 103 | """
This script examines the Spearman correlation of effect sizes
between brain regions.
"""
import session_info
import pandas as pd
from functools import lru_cache
from scipy.stats import spearmanr
from rpy2.robjects.packages import importr
from rpy2.robjects import r, globalenv, pandas2ri
@lru_cache()
def get_de(fea... |
63272bf8d63c170df7a8530ac83d26b7c7ec106ec1f597692999687ecc313d65 | Python | 4,048 | 125 | import re
import glob
from cgatReport.Tracker import *
from cgatReport.Utils import PARAMS as P
import pipelineTracks
# get from config file
UCSC_DATABASE = "hg19"
ENSEMBL_DATABASE = "Homo_sapiens"
RX_ENSEMBL_GENE = re.compile("ENSG")
RX_ENSEMBL_TRANSCRIPT = re.compile("ENST")
REFERENCE = "refcoding"
##############... |
b0325b8838b6b8bb0b8360cd4d123cc8ffdaf0d676dc4852df5a438b79e47798 | Python | 4,050 | 85 | import sys
import torch
import argparse
from utils import *
from model import MutSpace
from torch.utils.data import DataLoader
from tqdm import tqdm
import json
import numpy as np
def save_settings():
'''
Save parameters into a json file
'''
torch.manual_seed(config.seed)
torch.cuda.manual_seed(co... |
2859f6bbefb039a768e1507c6c44e9520c49e9eceaa16568b18803839b4c19b8 | Python | 4,051 | 125 | import sys
sys.path.append(".")
import argparse
import gzip
from tqdm import tqdm
import multiprocessing as mp
from queue import Empty
from crystallm import (
semisymmetrize_cif,
replace_data_formula_with_nonreduced_formula,
add_atomic_props_block,
round_numbers,
extract_formula_units,
)
try:
... |
a60ee3399b1674244e53366cd262fed24128cfcf15a91708fb3f8a1772814b5a | Python | 4,051 | 119 | #!/usr/bin/python
# GK September 2023
# Scripts for running methyl decoupling DNNs
#
# note in methyl_decoup_funcs model paths need to be set
# requires nmrpipe to be installed to work
import os
from fidnet.methyl import methyl_decoup_funcs
def write_initial(input, outfile, com_file, min_1H, max_1H, p0):
with ... |
9c97a06d404e3e3e3024bcb1727cdf58ca4d5ec89cb7ac510bbc761c6fd96b07 | Python | 4,056 | 105 | import os
import albumentations as A
import numpy as np
import pandas as pd
from albumentations.pytorch import ToTensorV2
from rdkit.Chem import AllChem
from dataset.utils.loader import mol_to_graph_data_obj_simple, mol_to_graph_data_obj_asAtomNum
def process_graph(molecule_smiles, model_name='graph_transformer'):
... |
f5df36acfd474af6a590e55b8f0a0005b02b6b103e99f828ba34ebddedefe9a0 | Python | 4,056 | 99 | import pandas as pd
from pgmpy.causal_discovery._base import BaseOrderDiscovery
class VarSort(BaseOrderDiscovery):
r"""Causal discovery by sorting marginal variances and regressing on predecessors.
Sort variables by increasing marginal variance to obtain an estimated causal order, exploiting the varsortabil... |
89f5ac2a5490408197033af7dc6a1e8573a814e50a7efc117be89e9c498c0c72 | Python | 4,058 | 64 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... |
b1ebe84ab6f16a50ddfa99a0125289982b94d3a9e322839e643d4ccffd4b5656 | Python | 4,058 | 144 | import seaborn as sns
# from axolotl import utils
from dreye.api.utils import signif
def scalebar(
ax, xsize=None, ysize=None, xunits=None, yunits=None,
xleft=-0.01, ybottom=-0.01, bottom=False, right=True,
left=False, top=True, ylim=None, xlim=None,
infer_sizes=False, offset=None,
yformat=False,... |
76f3d6777ed75c93ffda3ff4fc9032853b84f4667b8381333562d1a28aba4abc | Python | 4,059 | 120 | import os
import numpy as np
from pathlib import Path
from eeg_utils import EEGLoader, EEGDownSegmenter
from utils import parse_arguments, load_config
import mne
mne.set_log_level('WARNING')
def abr_pipeline(raw_dir: str, out_dir: str, file_extension: str, default_subjects: list, config: dict) -> None:
""" Appli... |
a04765e636e75927893525fb39ec1e28166644f2df53aaa10eea790c9a525779 | Python | 4,059 | 87 | """ Statistic Module comprises all statistical tests performed
by OmicScope for differential expression analysis.
Returns:
DataFrame: DataFrame with recommended statistical
analysis performed
"""
import os
from copy import copy
import numpy as np
import pandas as pd
def imported_stat(self, stat... |
ab0e294447c9a509fbf1e180f283164f0b6ab02f0da7e025b2a3d26490141f95 | Python | 4,060 | 129 | """
overwrite_checkpoint.py: overwrite existing key and value in ZephIR checkpoint.
Usage:
overwrite_checkpoint.py -h | --help
overwrite_checkpoint.py -v | --version
overwrite_checkpoint.py --dataset=<dataset> --key=<key> --value=<value> [options]
Options:
-h --help show this message an... |
c709bae95c4ba990a3a3cc48884a8a4182fda8db9d892f7016a2020ad17f5a4d | Python | 4,062 | 106 | """
2023.08.30
author: femke.hurtak@epfl.ch
Script to refer to the neurons used in the experiments.
"""
from loaddata import get_rootids_from_name
import plot_params
# Reference DNs in our work
def make_dict_special_neurons(name, database_name, color=plot_params.DARKBLUE):
"""
Define a dictionary of special ... |
d23a8703bb1c83090bfea6b9d3a9f0bd654e21ea2ee1fe95648879b7bea059b9 | Python | 4,062 | 103 | # Copyright (c) MONAI Consortium
# 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, so... |
3f79b6a09409f03db397d2adafdbe09aebd88e8566a570a0378fc393b39230b9 | Python | 4,065 | 106 | from pensa.features import \
read_protein_backbone_torsions, \
read_protein_sidechain_torsions, \
read_nucleicacid_backbone_torsions, \
read_nucleicacid_pseudotorsions
# Location of the data used in the tests
test_data_path = './tests/test_data'
# Simulation A (MOR-apo)
root_dir_a = test_data_path + '... |
0858facf3f620916c82003d7dbd7552604404c08f405bc8f29ca0df52d9b15b7 | Python | 4,068 | 90 | # Sconda conda activate abc; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/gene_expression_class_concordance
# python rna_replicates_concordance.py
import pandas as pd
import numpy as np
from sklearn.metrics import cohen_kappa_score
import os
import seaborn as sns
import matplotlib.... |
0a95a823924b57d454c43d86bb2f8c418e51604440382c430e8e50d6a5701102 | Python | 4,070 | 123 | import pytest
from langchain_classic.evaluation.parsing.json_distance import JsonEditDistanceEvaluator
@pytest.fixture
def json_distance_evaluator() -> JsonEditDistanceEvaluator:
return JsonEditDistanceEvaluator()
@pytest.mark.requires("rapidfuzz")
def test_json_distance_evaluator_requires_input(
json_dist... |
80c83012536ef0b900cf68181cc6d284d5eba0a16e35cb5be97c93b89d2353bd | Python | 4,073 | 107 | import math
from glob import glob
import h5py
import nibabel as nib
import numpy as np
import SimpleITK as sitk
import torch
import torch.nn.functional as F
from medpy import metric
from tqdm import tqdm
def test_single_case(net, image, stride_xy, stride_z, patch_size, num_classes=1):
w, h, d = image.shape
... |
c3e2e8a6882dd3c8dc612ffeaf3355c499821c3e9926b66a81747830701e4215 | Python | 4,073 | 94 | from collections import defaultdict
import copy
import numpy as np
def check_unique_assignments(assn):
res_counts = defaultdict(int) # check for repeated residues
for res_ids in assn.values():
for res_id in res_ids:
res_counts[res_id] += 1
assert all([v == 1 for v in res_counts.values... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.