sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1e06989c1ea04d7e8a5d0440ac82d01c273eae025b1fd5506cfa8fddb7cb5e75 | Python | 3,574 | 118 | # coding: utf-8
# (C) Copyright 2019 IBM Corp.
#
# 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 agre... |
8b6969d81a4bb5bd6425a3b80e107dc4018b547aa1b6099b74dac777a1b04811 | Python | 3,574 | 114 | import unittest
import numpy as np
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal
def make_sparse_banded(matrix, bandwidth):
if not isinstance(matrix, csr_matrix):
raise ValueError("Input matrix must be a csr_matrix.")
row, col = matrix.nonzero() # both are np.array... |
76c41e8479d6d566339aa5e6b1aec4e1b877b19036a4a869409b2b184fc557df | Python | 3,575 | 115 | import argparse
import numpy as np
import stanza
def bpe_tokens_to_words(bpe_tokens, bpe_suffix="@@"):
"""
Convert subword-nmt BPE tokens to word strings, and return sub2word mapping.
Example: ["Hel@@","lo","world"] -> words ["Hello","world"], sub2word [0,0,1]
"""
words = []
sub2word = []
... |
c4af2e87eceb2a097c9f6f6e3ecd3ef0ee299d3d89b97f7a0404c86efa15cdab | Python | 3,575 | 134 | """Example script for demonstrating DyNeStE's ability to learn long-range dependependcies.
- An HSMM is simulated.
- The output of this script will vary slightly due to random sampling.
"""
print("Setting up")
import os
from osl_dynamics import data, simulation
from osl_dynamics.inference import tf_ops, modes, metric... |
ceaf3a5eab0c4a2dac732a61c3bfd5f4b7b47e1f21bee66cf74e0f9554a7b6c1 | Python | 3,576 | 104 | import os
import numpy as np
import yaml
import sys
pathpath = 'PATHS/filepaths_IBLTuning.yml'#
myrun = 'runIBLTuning_utypeP'
layers_allowed = ['5','6']
#roi_file = 'IBLflatmap_PFC_ntesselated_obeyRegions_res200.h5'
nshuff = 2000
signif_levels = np.array([0.05,0.01,0.001])
tuning_attr_names = ['stimTuned','choiceT... |
170c15c97ab5bf3479485a92b9e933da332e6bcfd39701fe63f29f2ed681b3d4 | Python | 3,578 | 95 | """
This module is used to define classes for statistical distributions
Each 'Distribution' class can store an arbitrary number of distributions of the same type, this is specified in the 'dim' argument
A 'Distribution' class has two main types of attributes: parameters and expectations. Both have to be defined when ... |
4520dec09219fdcfe4de97abee595623a4417b48d2d742d11c770eb989528fa3 | Python | 3,578 | 103 | import matplotlib.pyplot as plt
import numpy as np
from argclz import AbstractParser, argument
from neuralib.plot import plot_figure
from neuralib.plot.psth import peri_onset_1d, plot_peri_onset_1d
from neuralib.util.verbose import publish_annotation
from rscvp.util.cli import TreadmillOptions
from stimpyp import Rigl... |
567d352e4c515afdc4bd4ef5a78502f5a4ecddb07c9f015ff30d2d31e18f27e5 | Python | 3,578 | 97 | import json
from chemgraph.agent.llm_agent import ChemGraph
from chemgraph.utils.get_workflow_from_llm import get_workflow_from_state
import argparse
import datetime
def get_query(
reaction: dict,
query_name: str = "enthalpy",
temperature: float = 298,
pressure: float = 101325,
method: str = "mace... |
de3bc1b3950d57403c09d0a96cd4b446072e2af90935ced0c9d9ada03a5598a1 | Python | 3,578 | 102 | import os
from sys import argv
from pathlib import Path
import numpy as np
import pandas as pd
import time as tm
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import rpy2.robjects as robjects
def run_LDA(DataPath, LabelsPath, CV_RDataPath, OutputDir, GeneOrderPath = "", NumGenes = 0... |
4f9c0212fb105c6e87a712270ba11fdabf8c3875c6b86c305b64d037ee48d435 | Python | 3,579 | 86 | import os
import numpy as np
alg_name = 'gnn_sage'
parallel_starts = 16
available_gpus = ['3,0', '0,3']
# args dict
args_dict = {'dataset': 'node_vessap_roi3_pb_minRadiusAvg',
'log_dir': '../tensorboard_logs',
'device': 1,
'log_steps': 1,
'num_layers': 3,
... |
7d00ac368ddd73f97f58ddcf5129ebf16acae4704ef6635bc63d97cb06cc0a49 | Python | 3,579 | 94 | import itertools as it
import logging
import pyfocus
__all__ = ["check_valid_snp", "check_valid_alleles", "flip_alleles"]
# Base-handling code is from LDSC...
# complementary bases
COMPLEMENT = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
# bases
BASES = COMPLEMENT.keys()
# true iff strand ambiguous
STRAND_AMBIGUOUS = {... |
3ce2a3924116f508697792e2b52faf90bfee35457b5e9cee5cffe9d6da332e5d | Python | 3,580 | 118 | import os
import glob
import re
import numpy as np
import pandas as pd
import shutil
import pickle
import subprocess
import pcntoolkit.dataio.fileio as fileio
#################################### FUNCTIONS ################################
def calibration_descriptives(x):
""" Function to calculate the skewness, k... |
5727cca8829d0ec2712a1e5777620a511dd13479088711d71e9b56d88cc2faa3 | Python | 3,581 | 109 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Vicky
usage: python generateSummaryFiles.py metric_summary
"""
import glob, xlsxwriter, csv, sys, ntpath, os
from shutil import copyfile
metricsPath = 'finalreport/'
summaryPath = 'finalreport/summaries/'
def main(arg1='metric_summary'):
createMetrics... |
8dd8de99158a5bd6fdef4a660a2ca564b2a012ccc28a5f00967171aa92c3fb69 | Python | 3,581 | 96 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute the RISH (Rotationally Invariant Spherical Harmonics) features of an SH
signal [1].
Each RISH feature map is the total energy of its associated order.
Mathematically, it is the sum of the squared SH coefficients of the SH order.
This script supports both symm... |
f92bdb504e59978d736db5ea6a3f484ac20b48100fd8156659c762acb518511b | Python | 3,581 | 94 | #!/usr/bin/env python
# Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder.
#
# This file is part of Slamdunk.
#
# Slamdunk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
... |
54a3bed9b2686cdd15b4db4c56059493b31308025536817f5790f57ed4f696af | Python | 3,582 | 98 | import numpy as np
import torch
from torch import nn
class ChenNet(nn.Module):
"""
Network from here: https://pubs.rsna.org/doi/10.1148/radiol.211860
init: He
epochs: 50
bs: 16
optimizer: adam
dropout: 0.5
lr: 0.001 at start then decaying
stopping = EarlyStopping(patience=30)
... |
82da09fdddfc8a3ea82c4033ba07ecd8afeea59e21a03c63689f24b633552b1f | Python | 3,582 | 93 | #!/usr/bin/env python3
"""
06-methly-summary-tsv2jsonl.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Convert methylation summary TSV table to JSONL
"""
__author__ = ('Eric Wafula (wafulae@chop.edu)')
__version__ = '2.0'
__date__ = '22 OCtober 2022'
import os
import sys
import csv
import git
import gzip
import json
import arg... |
29e9414df2445d8caa12279c9a832b8f7a4309d1e0fedfab33a7caa751df5dc5 | Python | 3,583 | 91 | """Submission/CI validation that a benchmark reports usable uncertainty.
The gate is deliberately lenient during transition: a score may report ``error = nan``
*if* it declares ``error_nan_reason``. New benchmarks should additionally preserve the
disaggregated ``raw`` values so true split-half reliability stays comput... |
f7cd35b3618e37ce25218fecab63287abe3dfaa748dfcd2784eb1b5bee5e4cde | Python | 3,583 | 102 | import os
from sys import argv
from pathlib import Path
import numpy as np
import pandas as pd
import time as tm
from sklearn.ensemble import RandomForestClassifier
import rpy2.robjects as robjects
def run_RF(DataPath, LabelsPath, CV_RDataPath, OutputDir, GeneOrderPath = "", NumGenes = 0):
'''
r... |
2b78536ca1c5e81054adafc91e8f6fa7c43f6b3c677374faf08fc5a3dd20229b | Python | 3,585 | 96 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Crop a volume using a given or an automatically computed bounding box. If a
previously computed bounding box file is given, the cropping will be applied
and the affine fixed accordingly.
Warning: This works well on masked images (like with FSL-Bet) volumes since
it's ... |
9444537dd4b63df014445219c935e9aaaefab8d6c843a37ea049c6007e82e042 | Python | 3,586 | 110 | '''
C2H6H
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for C2H6H:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy a... |
9b49fe3dbde9945d9c348d94d927254bca8ac1382115e4cf2808d03a0a5d9965 | Python | 3,586 | 68 | import os
import shutil
from nipype.interfaces.base import CommandLineInputSpec, File, TraitedSpec, CommandLine, BaseInterfaceInputSpec, BaseInterface
from traits.api import Str, Int, Directory, Bool, Either
# usage: mri_synthstrip [-h] -i FILE [-o FILE] [-m FILE] [-d FILE] [-g] [-b BORDER] [-t THREADS] [--no-csf]
# ... |
e86864cbc208f963513a696626d8e4eff9fd14bbf102894bcb9dabf044ab1d3a | Python | 3,586 | 102 | import os
from sys import argv
from pathlib import Path
import numpy as np
import pandas as pd
import time as tm
from sklearn.neighbors import KNeighborsClassifier
import rpy2.robjects as robjects
def run_kNN9(DataPath, LabelsPath, CV_RDataPath, OutputDir, GeneOrderPath = "", NumGenes = 0):
'''
... |
f880074375f014247ffade31231a9434968aa6d4808ee43bb66e2280635333bf | Python | 3,586 | 73 | #!/usr/bin/env python
import warnings
warnings.filterwarnings("always")
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
from PAINTeR import global_vars
import PAINTeR.connectivity as conn
######################################... |
1529925883718bde8f3454f3e897fc4886e037cb1e6414347f62f151e015c08c | Python | 3,588 | 115 | '''
CH3OH
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for CH3OH:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy a... |
37cf12472b34f23521a94c28294b1e3509d73a738e42fdc2f5bed4b00c9a4a70 | Python | 3,588 | 111 | from typing import Final
import numpy as np
import seaborn as sns
from argclz import as_argument, argument
from neuralib.plot import plot_figure
from neuralib.util.verbose import publish_annotation
from rscvp.statistic._var import VIS_HEADERS
from rscvp.statistic.core import StatPipeline
from rscvp.util.cli.cli_stati... |
a6eac3ee54dd24bc31bf02cceb9059dd757e7727b8cb83476f050fdf5a7aee8c | Python | 3,588 | 116 | '''
C2H7
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for C2H7:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy and... |
a7a5e761dd0d89bad3c1f6c596093b44d1ed84aef6b05505b631409a93371ad7 | Python | 3,589 | 77 | import os
import shutil
from nipype.interfaces.base import CommandLineInputSpec, File, TraitedSpec, CommandLine, BaseInterfaceInputSpec, BaseInterface
from traits.api import Str, Int, Directory, Bool, Either, Float, List
import traits
from cvdproc.config.paths import get_package_path
class MRIvol2surfInputSpec(Comman... |
fb45db397211841699cfe5766de6d66cfa0fea0efb2288a6c734b419d2de32a2 | Python | 3,589 | 100 | # -*- coding: utf-8 -*-
"""
Bold correction of VASO data
This scripts corrects a vaso time series for bold contamination. First, both
time series are upsampled to a common time grid. BOLD correction is performed by
dividing both time series. In the end, unrealistic vaso values are removed. The
script needs an installa... |
2980c5e29954f971403414c4eef2ad96db2a8d10cf430c272052612b1eb21363 | Python | 3,590 | 97 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
from enum import StrEnum
from typing import TYPE_CHECKING
from django.conf import settings
from rq.job import Job as RQJob
from cvat.apps.engine.types import ExtendedRequest
from cvat.apps.iam.permissions import ... |
c990287fa7efc02d3c8f3229a267a470b60e3e217f6fa43c34a35f053dd1e462 | Python | 3,590 | 86 | import os
import numpy as np
alg_name = 'mlp_cs_node2vec'
parallel_starts = 16
available_gpus = ['2,1', '1,2']
# args dict
args_dict = {'dataset': 'node_vessap_roi3_pb_minRadiusAvg',
'log_dir': '../tensorboard_logs',
'device': 1,
'num_layers': 3,
'hidden_channels': ... |
08cd383757742986473ac8df746b3504b54fda8d90a042d50fa7b5e56fabfd4d | Python | 3,591 | 98 | from collections.abc import Sequence
from dataclasses import dataclass
from typing import Literal
al_broker_projection_types = Literal[
"lcl",
"lcl_residual",
"lcl+mlp_residual",
"mlp_residual",
"linear",
"grouped_linear",
"pool",
"cnn",
"interpolate",
]
al_broker_fusion_types = Li... |
57d98527700e606733bbd1e51a04812f7d5708692f8d0eb68c9898b87a676072 | Python | 3,591 | 112 | from io import BytesIO
from bx_extras.lrucache import LRUCache
DEFAULT_CACHE_SIZE = 10
DEFAULT_BLOCK_SIZE = 1024 * 1024 * 2
class FileCache:
"""
Wrapper for a file that cache blocks of data in memory.
**NOTE:** this is currently an incomplete file-like object, it only
supports seek, tell, and readl... |
a3634c3dc3fb499f2fd7a785121da9eaa7973bc0c0cfb85830b57b0c2c00c5b5 | Python | 3,591 | 118 | import torch
import torch.nn.functional as F
import numpy as np
import math
class NCC:
def __init__(self, win=9):
self.win = win
def loss(self, y_true, y_pred):
Ii = y_true
Ji = y_pred
# get dimension of volume
ndims = len(list(Ii.size())) - 2
assert ndims in... |
a6152e1d2ec9410499163a3a9502e5e49ab858e7302cf5e46f722f62b95fe1a3 | Python | 3,591 | 111 | """
Created on 2025.04.25
Updated on 2026.02.17
Author: Lina Jeantin
Extract analysis results from the results dict in a dataframe for plots, linear mixed models & classifiers.
Requirements:
results: dict containing the results of spectral and complexity analysis (see get_complexity_results.py)
Organi... |
d439deea1d31f0604e005aab92fb657f18bcc6e4a1de92a233f4052269cf23f3 | Python | 3,592 | 108 | # Copyright 2024 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, ... |
23ee021f22f3cc43a2a0622f1625c63f6f564c15ade097df6de2e889a34570d2 | Python | 3,593 | 121 | # Copyright 2017 Calico 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... |
c7f038fa38c095f6cc7e33382db8cecd7325f32a7f4cc5240598a4e8cace5dc1 | Python | 3,593 | 80 | import os
import numpy as np
import yaml
import argparse
from preprocess.pair_generation import load_data
if __name__=='__main__':
parser = argparse.ArgumentParser(description="Generate random pairs of DNase regions")
parser.add_argument("name", help="The prefix of the dataset. For example k562_polr2a.")
p... |
d34a0d03e794d0ccc5e01d072fa434575a2e4e4d64029c06d207c416d1ad935a | Python | 3,593 | 102 | import os
from sys import argv
from pathlib import Path
import numpy as np
import pandas as pd
import time as tm
from sklearn.neighbors import KNeighborsClassifier
import rpy2.robjects as robjects
def run_kNN50(DataPath, LabelsPath, CV_RDataPath, OutputDir, GeneOrderPath = "", NumGenes = 0):
'''
... |
7eee47568ae9630fc7fd025020c4ee34f80179afe0a7619e362625a33f7ec076 | Python | 3,594 | 112 | #!/usr/bin/env python
"""Direct GlobusComputeBackend demo: thermo screen on a remote HPC endpoint.
Submits 5 MACE ``driver="thermo"`` jobs to a Globus Compute endpoint
(Polaris/Aurora/etc.) and gathers results back to the laptop. The
structures are embedded inline (``inline=True``) so the workers don't
need to read an... |
2aaba972ca67c638fc1aa7c867cb8ff1bc14f9e2b67a6f302dd5915c909808db | Python | 3,595 | 65 | import pytest
import numpy as np
from brainscore_vision import load_dataset, load_stimulus_set
class TestAssemblyProperties:
@pytest.mark.parametrize('assembly', ['Gifford2022_train', 'Gifford2022_test'])
def test_assembly_existence(self, assembly):
assert load_dataset(assembly) is not None
@pytes... |
a5a737ac50cf6ec901af77f50254116f090d2f7fbc4c5173e82099e110c5cb2d | Python | 3,595 | 83 | import os
from labdatatools.analysis import *
import argparse
class AnalysisSpks(BaseAnalysisPlugin):
def __init__(self,subject,
session = None,
datatypes = [''],
includes = [''],
excludes = default_excludes,
bwlimit = None,
... |
39b4e63608ea774f985b50ca590c8a4729ce905f0c0702473c09e5ce7cd3ad8c | Python | 3,596 | 103 | from __future__ import annotations
from collections.abc import Callable
from typing import TYPE_CHECKING
from psygnal import Signal, SignalInstance
from magicgui.types import Undefined, _Undefined
from ._value_widget import BaseValueWidget, ValueWidget
if TYPE_CHECKING:
from typing_extensions import Unpack
... |
f086f0f682d6f2fd3f4da68351c403ec43183b07ff6b9f415c1a7ccc6a02be8c | Python | 3,597 | 102 | import matplotlib.pyplot as plt
import numpy as np
from sklearn.mixture import GaussianMixture
def draw_tracks(kymo, name, worms_count, kymographs_count, tracks_count, save_name=""):
figure, ax = plt.subplots(figsize=(7, 4))
for track in kymo.keys():
plt.plot(np.array(kymo[track]['y'])-np.array(kymo[tr... |
d2acea6e9b238a6081a2ff65b8c2238e6dab14d66f6ae46d3fc56e669f7f7eea | Python | 3,598 | 81 | import gc
import pandas as pd
import os
import argparse
import torch
import lightning.pytorch as pl
from torch.utils.data import DataLoader
from datasets import EvalAcrossGeneDataset
from ism_performer import load_model,get_ckpt
def main():
parser = argparse.ArgumentParser(description="For evaluation of performer... |
6e7e34f9eca0f710e84d93ca28c07234a7777a688fc40acc06f7369dea78b3eb | Python | 3,599 | 86 | """
Compute the intersection of two sets of genomic intervals, either base-by-base
or at the interval level. The returned GenomicIntervalReader will be in
the order of the first set of intervals passed in, with the corresponding
additional fields.
"""
from bx.intervals.io import (
BitsetSafeReaderWrapper,
Geno... |
82092784d8ab2e85890feba221b7b8796ab8e4e7b34bf1d4e05d078ec9ad487e | Python | 3,599 | 121 | #!/usr/bin/env python3
# tifffile/tiff2fsspec.py
# Copyright (c) Christoph Gohlke
# SPDX-License-Identifier: BSD-3-Clause
"""Write fsspec ReferenceFileSystem for TIFF file."""
from __future__ import annotations
import argparse
import contextlib
import json
import sys
from typing import Any
try:
from .tifffile ... |
96635ea2099c1ee02936bf6039b037975b92e433252334ea75b490befe24e516 | Python | 3,599 | 85 | import os
import glob
import numpy as np
import skimage.io as skio
import torch
from torch.utils.data import Dataset
import random
from natsort import natsorted
import json
class KidneyData(Dataset):
def __init__(self, root='data/', mode='train', separation='90_10', fold=0, all_zero_involved=False, tran... |
a9e3b4ed413df4ede3d47f0c319b44caac8583a8abe10dbbb954f1d7ac8bb29c | Python | 3,599 | 107 | """Unified loader for HPC-specific Parsl configurations.
This consolidates the ``load_parsl_config()`` function that was
previously duplicated across ``graspa_mcp_parsl.py`` and
``xanes_mcp_parsl.py``.
"""
from __future__ import annotations
import logging
import os
logger = logging.getLogger(__name__)
def resolve... |
05ff7dde405b9b119d6bd84e1b0254aef25d3c7ee1b9dc21197e78b5fa39c6cf | Python | 3,600 | 135 | """Example script for demonstrating DyNeMo's ability to learn long-range dependependcies.
- An HSMM is simulated.
- The output of this script will vary slightly due to random sampling.
"""
print("Setting up")
import os
from osl_dynamics import data, simulation
from osl_dynamics.inference import tf_ops, modes, metrics... |
070ec75b3f6089f3201b266548781036268379a7c4265985b3e89ea4dfe4f2c3 | Python | 3,601 | 110 | """Clamped dataset data loading functionality."""
import os
from pathlib import Path
import pandas as pd
from htc import DatasetImage
from htc.models.data.DataSpecification import DataSpecification
from htc.utils.Config import Config
from torch.utils.data import DataLoader
from mcmlnet.experiments.data_loaders.confi... |
48f2ad89c8610553cce5f4c6b8d1eac2b5e5ff758c65ddf23e51e574eefcd882 | Python | 3,601 | 101 | #!/usr/bin/env python
"""
Read a table dump in the UCSC gene table format and print a tab separated
list of intervals corresponding to requested features of each gene.
usage: ucsc_gene_table_to_intervals.py [options] < gene_table.txt
options:
-h, --help show this help message and exit
-rREGION, --regi... |
9e25ae23cdf95c1bffb2e35658068b81b7cb337fed91459da8f2181f110d8f14 | Python | 3,601 | 88 | # -*- coding: utf-8 -*-
import logging
import os
from dipy.io.stateful_tractogram import StatefulTractogram
from dipy.io.streamline import load_tractogram
import numpy as np
from scilpy import SCILPY_HOME
from scilpy.io.fetcher import fetch_data, get_testing_files_dict
from scilpy.tractanalysis.streamlines_metrics im... |
7d92352b95acb75fd3a8d4015fde7f09b157ccb940eda83a536db9be26c17173 | Python | 3,602 | 73 | import pandas as pd
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
import scipy.stats as stats
import h5py
import sys
if __name__ == '__main__':
if len(sys.argv) <= 2:
print('Usage: process_results_ext.py <bim> <fname> [<out>], where')
print(' bim - path to bim file (re... |
89db6e64c81d3fbb6232e5b1fd5fe48998779aad0e7468cb852fbb2b8098d230 | Python | 3,602 | 111 | """
Classes to support FASTA files.
:Author: Bob Harris (rsharris@bx.psu.edu)
A FASTA file contains multiple sequences. Each sequence is usually DNA.
A typical FASTA file::
>mule
TAATACCCCGGATATATGTCCTCACATAGTTCGAGGTCGAGAAAAATGAC
TTCCCACCAAGTGGACTCAGCTCGAGTAAACGCCAACGATACGTCCATTA
GGTGTGTGCCgcaactagtcgg... |
b7575e3e1f64fda31b8285b052eb292d2c238aeed3b36a586ff07aa8d6645624 | Python | 3,602 | 114 | import torch
import torch.nn as nn
from torch_geometric.nn import MessagePassing
from torch_geometric.utils import scatter
class EGNNConv(MessagePassing):
r"""
Equivariant Graph Convolutional Layer from `E(n) Equivariant Graph Neural Networks <https://arxiv.org/abs/2102.09844>`.
Parameters
-------... |
3320a86885757ebd2078b03dd58e8b82868d4bcca9c2b08794771abf71648934 | Python | 3,603 | 46 | from testsetclass import TestsetClass
class BSR36(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['h10', 'c2h6', 'h11', 'r14', 'r13', 'h2', 'h5', 'r12', 'r15', 'h4', 'h3', 'c1', 'r7', 'r9', 'r8', 'r1', 'r6', 'h13', 'h14', 'ch4', 'h15', 'h12', 'h6', 'h1', 'h8', 'r10', 'h9', 'h7... |
bb9af08b9eb01583a4b5b9a5f636970ac00280ffaaf19881db7422012efbc40b | Python | 3,603 | 106 | """
Load unpaired data.
Supported formats: h5 and Nifti.
Image data can be labeled or unlabeled.
"""
import random
from typing import List, Tuple, Union
from deepreg.dataset.loader.interface import (
AbstractUnpairedDataLoader,
GeneratorDataLoader,
)
from deepreg.dataset.util import check_difference_between_tw... |
e9298710121f83313cdc63072bf64c233f8bd38efc1c9dda8704600d9f4225b9 | Python | 3,603 | 111 | """ Plateau Scheduler
Adapts PyTorch plateau scheduler and allows application of noise, warmup.
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
from typing import List
from .scheduler import Scheduler
class PlateauLRScheduler(Scheduler):
"""Decay the LR by a factor every time the validation ... |
01516827d91ebc0dd3b5c9b9e59f23e4f0c248f755a9f0f6f460bcb28737374f | Python | 3,604 | 110 | import abc
import datetime
from typing import Any, TypeVar, Generic
import polars as pl
from rich.pretty import pprint
from argclz import argument
from neuralib.tools.gspread import WorkPageName
from neuralib.util.verbose import fprint
from rscvp.util.database import RSCDatabase
from rscvp.util.util_dataframe import ... |
2623381cf39c25dbfe32cfede06ba4faa18d18d2e6fd9c568576eca02d616a7e | Python | 3,604 | 91 | import h5py
import numpy as np
import tensorflow as tf
from tensorflow import keras
from degu import DEGU, uncertainty_logvar, standard_train_fun, eval_regression
def DeepSTARR(input_shape, output_shape):
"DeepSTARR model from deAlmeida et al. Nat Genetics (2022)"
inputs = keras.layers.Input(shape=input_shape... |
5766abf03052a1a5e2d93c5b82b280346f7a331ff125809798914d263cd15105 | Python | 3,604 | 95 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
"""Add labels, optionally with selectable attributes, to an existing project.
Steps:
1. Retrieve the project and read the labels it already has; the requested
labels that already exist are skipped, so the script is safe to re-run.
2. Attach... |
73e5047e968086c36c20aff92f5eacc79399edb8f9b0241c58d51c2785f52ea3 | Python | 3,604 | 95 | from .utils import *
import subprocess as sub
LABDATA_UGE_FOLDER = pjoin(os.path.expanduser('~'),'labdatatools','uge') #TODO: get this from preferences file
def has_uge():
proc = sub.Popen('qstat', shell=True, stdout=sub.PIPE, stderr = sub.PIPE)
out,err = proc.communicate()
if len(err):
return... |
7d79970733c64f828e3309d643be64e0f5751f7b03f63209c8605581152e2396 | Python | 3,604 | 104 | # Split Brain manually at orbital plane and calculate Dice
import SimpleITK as sitk
import numpy as np
import torch
import cv2
import tkinter as tk
from tkinter import messagebox
from PIL import Image, ImageTk
from torchvision.utils import make_grid
import torchvision
import matplotlib.pyplot as plt
from mpl_toolki... |
1989c319c828e9e0663a27389893bc41e8595c1b92675872ec8b0f884254f071 | Python | 3,605 | 106 | """
Tests for `bx.align.score`.
"""
import unittest
from io import StringIO
from numpy import (
allclose,
array,
cumsum,
)
import bx.align.maf
import bx.align.score
aligns = [
(
"CCACTAGTTTTTAAATAATCTACTATCAAATAAAAGATTTGTTAATAATAAATTTTAAATCATTAACACTT",
"CCATTTGGGTTCAAAAATTGATCTATCA--... |
531851194710d5c11cda8736a912783e9062c223bec93477101cf9234e49355e | Python | 3,606 | 102 | """
Prepare and run first level GLM in FSL FEAT.
Assumes template files for each type of run.
"""
import os
import subprocess
import glob
import nibabel as nb
import time
import numpy as np
# Set some folder names
ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti'
subs = ['sub-12', 'sub-14', 'sub-15', 'sub-16'... |
92334b6549e9b761c2a2806068eda6e192d091ee1c68a3b1e2f385ff960184bd | Python | 3,606 | 68 | #word_level_align.py
#first aligns a dataset to the words vectors and collapses other modalities (by taking average of them for the duration of the word). After this operation every modality will have the same frequency (same as word vectors). Then the code aligns based on opinion labels (note that collapse does not ha... |
e67abfd3a2a18486a8bc3ec8b54edfe5d443c46efd6049b5719471e6eb8249e9 | Python | 3,606 | 92 | import torch
import torch.nn as nn
import models.snn_type as snn_type
from conf import global_settings as conf_set
import torch.cuda.nvtx as nvtx
class SNN_VGG(nn.Module):
def __init__(self, features, num_classes=1000, init_weights=False):
super(SNN_VGG, self).__init__()
self.features = features
... |
a06739b1f8b61def403671bdef1ca5179ed13c9d5738a655fab635860c111b6b | Python | 3,607 | 87 | import os
import numpy as np
alg_name = 'sign'
parallel_starts = 16
available_gpus = ['0,3', '3,0']
# args dict
args_dict = {'dataset': 'node_vessap_roi3_pb_minRadiusAvg',
'log_dir': '../tensorboard_logs',
'device': 1,
'log_steps': 1,
'num_layers': 3,
'... |
fb78bcc6ed4e13e101966267f84b826671e3176b284871a700ab531b5d839be7 | Python | 3,607 | 68 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'reorder_stack.ui'
#
# Created by: PyQt5 UI code generator 5.7.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_reorderStack(object):
def setupUi(self, reorderStack):
... |
c8d2f7ed803b761f70b93989ec980213a65ba6412202b7f914e91d25ba9fbad0 | Python | 3,608 | 107 | import torch
import torch.nn as nn
import torch.nn.functional as F
class DoubleConv(nn.Module):
"""(convolution => [BN] => ReLU) * 2"""
def __init__(self, in_channels, out_channels, mid_channels=None):
super().__init__()
if not mid_channels:
mid_channels = out_channels
sel... |
e03b9c3445dcd2628650e32a7fa3d889159686a3784744e2302933aec8d866e5 | Python | 3,608 | 102 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import os
import seaborn as sns
# --- CONFIGURATION ---
file_path = 'INSERT_PATH_HERE'
output_dir = 'INSERT_PATH_HERE'
# Make sure output directory exists
os.makedirs(output_dir, exist_ok=True)
# Define brain regions and their names
brain_region... |
452254ba8e6125f2be46e4865f3ca13da60853404541417966e10efc7d72ab82 | Python | 3,609 | 98 | """Test the functions in yasa/staging.py."""
import unittest
from unittest.mock import MagicMock
import matplotlib.pyplot as plt
import mne
import numpy as np
import pandas as pd
from yasa.fetchers import fetch_sample
from yasa.hypno import Hypnogram
from yasa.staging import SleepStaging
###########################... |
f342f106a381b9f42f09f756c07441ed8d97d7bbe0d526146c839f80c0dcddbf | Python | 3,610 | 98 | import os
import argparse
import torch
import numpy as np
from tqdm import tqdm
from joblib import Parallel, delayed
from scipy.sparse import coo_matrix
from MDAnalysisData import datasets
import MDAnalysis
from MDAnalysis.analysis import distances
def compute_ele(ts, index, cutoff):
edge = coo_matrix(distances.... |
5120305c04103257745c22a823c46a70cb2dd0146acc3f6a8fd7704035c10243 | Python | 3,611 | 78 | from drop import utils
from .Submodules import Submodule
class RVC(Submodule):
def __init__(self, config, sampleAnnotation, processedDataDir, processedResultsDir,workDir,genome):
super().__init__(config, sampleAnnotation, processedDataDir, processedResultsDir,workDir)
self.CONFIG_KEYS = [
... |
6753a88d1005472ebab9df5e5f9faca57060890472e1c9bd000502c9f7141f95 | Python | 3,611 | 106 | import os, json, sys, shutil
sys.path.insert( 0, os.path.join( os.sep, 'usr', 'share', 'gkg', 'python' ) )
from CopyFileDirectoryRm import *
def runDwImportAndQspace( Dir,
subject,
verbose ):
if ( verbose == True ):
#--------------------... |
78fa62537a10acfc687d028a608e79a8bba2809884b0970f47950dd8feb8714a | Python | 3,611 | 96 | #!/usr/bin/env python3
import argparse
import numpy as np
from ase import Atoms
from ase.io import read, write
from ase.optimize import *
from HessKerNNCalculator.KerNNCalculator import *
'''
This optimization script needs the hessian and uses that information
to scale the gradients such that the optimization is alway... |
5526d259f5f8eed0984234e6ac05eb766fe2508338ab13748cedec059a768d41 | Python | 3,612 | 119 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
from collections.abc import Mapping
from copy import deepcopy
from typing import Any
from cvat.apps.quality_control.attribute_comparators import (
DEFAULT_ATTRIBUTE_COMPARATOR,
AttributeComparisonRule,
)
... |
7cff7ba9f39352824d41432a4e32c2b3e632e4fe6e5c669103189e9440b28bcc | Python | 3,612 | 104 | import nilearn
import nilearn.regions
import nilearn.reporting
import itertools
import plotly
from scipy import ndimage
import fire
import sys
sys.path.insert(0,'..')
import pickle
from nilearn import plotting
from nilearn import surface
from nilearn.glm.thresholding import threshold_stats_img
import numpy as np
... |
bfd428d9fd2fc83977ec9282f66fc8b3991ef5d9b05231a217314e9a928d16f1 | Python | 3,613 | 122 | from dataclasses import dataclass
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from eir.setup import schemas
from eir.setup.input_setup_modules.common import (
DataDimensions,
get_data_dimension_from_data_source,
)
from eir.utils.logging import get_logger
logger... |
23846d215d40dc76abb2c8f57bacf526380a87e9bb13278647b147a7dc3b7497 | Python | 3,614 | 101 | # coding: utf-8
"""Comparison of `binary` and `xentropy` objectives.
BLUF: The `xentropy` objective does logistic regression and generalizes
to the case where labels are probabilistic (i.e. numbers between 0 and 1).
Details: Both `binary` and `xentropy` minimize the log loss and use
`boost_from_average = TRUE` by def... |
7051f7bb273a3f7f8f32216e8af7473d24b3d6fe630e44fa365aa2d5d08996c9 | Python | 3,615 | 88 | import sys
from torch.utils.data import DataLoader
from geoseg.models.MixerUnet import reparameterize_model
from geoseg.losses import *
from geoseg.datasets.isic2018_dataset import ISIC_Dataset
from geoseg.models.MixerUnet import ConvMixer_UNET_down
from geoseg.models.MixerUnetcopy import Rep_UNET_down
from catalyst im... |
7d2a1ca7cc31e975dff2d575ba9fb2f999907b5bb337466bf0c51100d3d77a19 | Python | 3,615 | 105 | import pytest
import numpy as np
from nems import Model
from nems.models.dataset import DataSet
from nems.layers import Layer
output_tests = [
None,
'str',
['list1'],
['list2', 'list3'],
]
class PassThrough(Layer):
def evaluate(self, input):
out = np.array([[f'from {self.name}']])
... |
0e294ba5ba915130caaa38fc33bf1dae80706e45bf7fcd6c830f8e74276bf9e2 | Python | 3,616 | 118 | import torch.nn as nn
import torch.nn.functional as F
import torch
from ResNet import ResNet
from ResNet import Bottleneck
def CSA(pretrained=False, root='~/.encoding/models', **kwargs):
model = ResNet(Bottleneck, [2, 2, 2, 2],
radix=2, groups=1, bottleneck_width=64,
... |
7586b7481d34261561be3dc20fcbcd58b8550bea38f44319f38ae43e2b7f2d4e | Python | 3,616 | 87 | import os
import numpy as np
alg_name = 'gnn'
parallel_starts = 16
available_gpus = ['0,3', '3,0']
# args dict
args_dict = {'dataset': 'node_vessap_roi3_pb_minRadiusAvg',
'log_dir': '../tensorboard_logs',
'device': 1,
'log_steps': 1,
'num_layers': 3,
'h... |
b6d76cc8cd1c19ecc7cdaa02cf7e2b9a15a1c87586a842bb35f49583f0b5fb24 | Python | 3,616 | 70 | import gc
import pandas as pd
import os
import argparse
import torch
import lightning.pytorch as pl
from torch.utils.data import DataLoader
from datasets import EvalAcrossGeneDataset
from eval_enformer_gtex import *
def main():
parser = argparse.ArgumentParser(description="For For evaluation of enformer's ability ... |
bda3a8d3074ab5e6c67b2e2eff033c4a3dc062a8095f57b8c6387328dac730a7 | Python | 3,616 | 105 | # =====================================================================
# Title: state.py
# Description: This file contains the state class that represents a
# state of SALSA's makrov chain.
#
# Date: 02.01.2023
#
# =====================================================================
#
# Co... |
f0c16ddf25271e57592dd3528d552cedfb29738b37db229fe6cc3e05e261324b | Python | 3,616 | 98 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Manuel Heger, Henrik Zunker
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... |
f7b7f6450c69af22a842f37ecbf4d623580fa4eb0c7493dafdb64873c7affcf3 | Python | 3,616 | 101 | """ Functions related to basic dMRI pulse sequences with trapezoidal gradient pulses. """
import os
import numpy as np
import numpy.typing as npt
from ivim.constants import y
from ivim.io.base import read_bval, write_cval
# String contants
MONOPOLAR = 'monopolar'
BIPOLAR = 'bipolar'
# Functions
def calc_b(G: npt.N... |
905d2098805740286d2c711e6d3eb400d35ac3303289cd1d729afffa7e34be9d | Python | 3,617 | 96 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
from scilpy import SCILPY_HOME
from scilpy.io.fetcher import fetch_data, get_testing_files_dict
# If they already exist, this only takes 5 seconds (check md5sum)
fetch_data(get_testing_files_dict(), keys=['bundles.zip'])
tmp_dir = tempfile.Temp... |
647d7d2452b3a81c597bd556114e1b0c239eaecdcda8a9a2eddc7a9817befde7 | Python | 3,619 | 117 | # Copyright 2017 Calico 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, s... |
e5ba399a2069f1007453ab4d486ef699d9e8df4438e3f4f8932440dd06efe328 | Python | 3,619 | 117 |
"""
Comparison of pleiotropy with paper: Systematic Anlaysis of Pleiotropy in C. elegans
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.cluster.hierarchy import dendrogram
from matplotlib import cm
import seaborn as sns
from scipy.stats import pearsonr
from sk... |
4bc6636ee14c8aa1ed6d310052cb44d45bd2cb117cc115fa4f634dab94eff22b | Python | 3,620 | 101 | #!/usr/bin/env python3
"""Supplementary Figure S7:
R2 vs diffusion coefficient at θ=90° from SpinWalk simulations.
Author: florian.birk@tuebingen.mpg.de
"""
import sys
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
sys.path.append(str(Path(__file__).parent.parent))
... |
9c7354d3479f2e623ad282d2d485c7dc8991ac6e48769f22ad10aa1186b64ad7 | Python | 3,620 | 109 | """
Doing LayNii stuff like:
- layerification
- Defining perimeter
- Flattening
"""
import subprocess
from skimage.measure import label
import nibabel as nb
import numpy as np
# Set data path
DATADIR = '/Users/sebastiandresbach/data/s1Anfunco/Nifti/derivatives'
DATADIR = "/Volumes/sDresBackUp/s1Anfunco/Nifti/deriva... |
a1fc4764db78091006bc0391ba3e0fa4a12f73ea0dd7d62438f28f604478c03c | Python | 3,620 | 99 | """CAT-NAP figures.
Port of ``Functions/twoPhoton/plot2ptraces.m`` — the per-unit raw/denoised
trace figures saved during a run (the interactive GUI preview in
``gui/panels/catnap.py`` is separate). The spatial network plots reuse the
shared step-4 renderer via its ``coords_override`` path (see
``pipeline/plotting_ste... |
06eed561655714909c1a112a51ae198fbc86faf90ee3e769df80f00786e9d66b | Python | 3,621 | 110 | """Local model endpoint health-check utilities."""
from typing import Any, Dict, Optional
from urllib.error import HTTPError, URLError
from urllib.parse import ParseResult, urlparse, urlunparse
from urllib.request import HTTPRedirectHandler, Request, build_opener
import streamlit as st
def _is_local_address(hostnam... |
c60b4da6a66c30f111b1a5c4974808332bbf18b7a7ca820a99891c16812c5e4e | Python | 3,621 | 136 | #!/usr/bin/env python
"""
The core functionality for a QPD, QPD/Camera or z stage.
Hazen 04/17
"""
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
class LockFunctionalityMixin(object):
"""
Combine this with either a HardwareFunctionality or a
BufferedFunctionality depending... |
7d64f482a2935d967d1568783a39cfb9711bf61c2fdc5636f714db59966ee523 | Python | 3,622 | 105 | from __future__ import annotations
from typing import TYPE_CHECKING
import napari
import napari.layers
import numpy as np
from PyQt5.QtWidgets import QApplication
from brainways.pipeline.brainways_params import BrainwaysParams
from brainways.pipeline.brainways_pipeline import PipelineStep
from brainways.ui.controlle... |
f27fd09b9225af5ce4bb36b1f0e900bf28bce4b4042c6ba6cf63cb01f1b47183 | Python | 3,622 | 104 | """
Copyright 1999 Illinois Institute of Technology
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publis... |
3a9bbf3f792d1641fb73b092b3eeec1ad2807835310d29aa77fb255b274d8f09 | Python | 3,623 | 99 | from brainvoice.utils import get_instance
from brainvoice.modules.utils import View
import torch
import torch.nn as nn
import math
class ConvolutionalEncoder(nn.Module):
def __init__(self, conv_kernel_sizes, conv_strides, conv_paddings, block_activations, conv_in_channels,
conv_out_channels, use_batch_n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.