sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
221237e58013511bd80cd75813b8764a52ea4642acfe141e9b78033bc76bf3e6 | Python | 3,523 | 90 | #!/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=['atlas.zip'])
fetch_data(get_testing_fi... |
6d41481860c679be0a9b6f45817bf6756891ff61e34b47886b597eb4a9e467c8 | Python | 3,523 | 84 | from src.wrappers.OsipiBase import OsipiBase
from src.original.fitting.TF_reference.segmented_IVIMfit import segmented_IVIM_fit
import warnings
import numpy as np
class TF_reference_IVIMfit(OsipiBase):
"""
Bi-exponential fitting algorithm by IVIM Task force
"""
# I'm thinking that we define default at... |
8cb95526dcf7a9a41c8a31c096705a64b572c828373a272a5f1360390599c0ac | Python | 3,523 | 95 | from typing import List
import h5py
import os
from tqdm import tqdm
import torch
from torch_geometric.data import InMemoryDataset
# from mlcg.utils import download_url
from mlcg.data import AtomicData
class MBPolDataset(InMemoryDataset):
"""Extractor for the MBPol dataset described in https://doi.org/10.1038/s4... |
9cda4afcae20c0fef717c02e4c28159a566020260860d330443dd9285775c43a | Python | 3,524 | 92 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from argparse import ArgumentParser
from collections import defaultdict
import django_rq
from django.conf import settings
from django.core.management.base import BaseCommand
from rq.job import Job as RQJob
class Command(BaseCommand):
help = "S... |
0e3dd6d7a2d388c476b3dc46f9f7adf966aa10404dbb4a0e8850a33116ce72c1 | Python | 3,525 | 101 | import numpy as np
from matplotlib import pyplot as plt
def next2pow(x):
return 2**int(np.ceil(np.log(float(x))/np.log(2.0)))
def rolling_window(data,window_size,step):
num_steps=1+(len(data)-window_size)/step
begin=[n*step for n in range(num_steps)]
slice=np.zeros((num_steps,window_size))
for i,b... |
0378ad5d241fef6ec77ba2aa4165bbb9836b11d1d40b14ac78a8c06d38c3df6a | Python | 3,526 | 85 | import os
import numpy as np
alg_name = 'mlp_cs'
parallel_starts = 8
available_gpus = ['7,5', '5,7']
# args dict
args_dict = {'dataset': 'node_vessap_roi3_pb_minRadiusAvg',
'log_dir': '../tensorboard_logs',
'device': 1,
'num_layers': 3,
'hidden_channels': 512,
... |
a18663581172e3b11761fabdf50cb347c7f7fce36cc52708012ddd513daaa675 | Python | 3,526 | 86 | from __future__ import annotations
import argparse
from pathlib import Path
import numpy as np
import pandas as pd
from mobius.io import discover_subjects, read_csv, select_bipolar_row
from mobius.rgi import logit, compute_rgi_min
from mobius.stats import hedges_g, bootstrap_bca_mean
from mobius.plotting import save... |
fb92d26ba859f71b5a98a7624f110aaffa6921dbed9de074ed26f1af315bf8d7 | Python | 3,526 | 117 | # 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, software
# distributed under t... |
43d1b2505f5086fd6bced89609589e2e71a94aab413285379600083d2764f2f0 | Python | 3,527 | 107 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
# external inputs
import numpy as np
import nibabel as nb
import numpy.linalg as npl
from numpy.matlib import repmat
# local inputs
from ..utils.apply_affine_chunked import apply_affine_chunked
def get_scanner_transform(input_source, input_target, ... |
9a4d6dfda858ec6b128cf5d84d97b3477ccbc8496c8e4f348c2aac1940607edc | Python | 3,527 | 96 | import nibabel as nib
import numpy as np
import os
import subprocess
import nipype.interfaces.fsl as fsl # fsl
# Note: takes in the paths to the template and bold images and outputs the
# array of average intensity values for each brain region
def make_average_arr(bold_path, template_path, maxSegVal):
bold = nib... |
fcbece9866f65d62435fdc8c1e33aae944e85d421353b4f03f9286034a9117c2 | Python | 3,527 | 90 | import sys
from nipype import IdentityInterface, Function
from PUMI.engine import NestedWorkflow as Workflow
from PUMI.engine import NestedNode as Node
from nipype.interfaces import BIDSDataGrabber
from nipype.utils.filemanip import list_to_filename
from PUMI.pipelines.anat.segmentation import bet_fsl
from pipelines.mu... |
ba6c44aa26fa1cfe4b2d21b756e1526b156a286db2d21a7e6eba0b8f249e2904 | Python | 3,528 | 98 | from numba import jit
import numpy as np
from scipy.stats import spearmanr, pearsonr
#util functions for sampling
def categorical(p, n_samples):
size = list(p.shape[:-1])
size.insert(0, n_samples)
return (p.cumsum(-1) >= np.random.uniform(size=size)[..., None]).argmax(-1).T
@jit(nopython=True)
def get_me... |
e7d116b3d29d0dea096a3fdb1ac32160dd566b3bf200cd0c16e08c8e8a4f7789 | Python | 3,528 | 93 | import numpy as np
import pandas as pd
from scipy.stats import ttest_ind, mannwhitneyu
from collections import defaultdict
from tqdm import tqdm
from pingouin import partial_corr
df = pd.read_csv('features_spindles.csv.zip')
df2_asd = pd.read_excel('ASD-TD(egi-data).xlsx', sheet_name='ASD')
df2_td = pd.read_excel('A... |
0a953f187907ff67fd66b00dbc29cb969f33616259303cce42df8bc4311882e6 | Python | 3,529 | 101 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute a density map from a streamlines file. Can be binary.
This script correctly handles compressed streamlines.
To get only a map of the endpoints, use option --endpoints_only. To get a
separate map for the head and tail, see
>> scil_bundle_compute_endpoints_map
... |
8c46a19d9defd70b2e5fc3a4ecc8dd482c52cf1cce978c407283dbf548f942ea | Python | 3,529 | 114 | '''
HClOH
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for HClOH:
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... |
cb6492df8b8e78ea4d0f275dbc7a7f6cfb47caf8f85a1d0b3ceb2be28e1c5ee6 | Python | 3,529 | 94 | import torch
import torch.nn as nn
import torch.nn.functional as F
import skimage.io as skio
import numpy as np
import config
def get_dice(pred, organ_target):
'''
Tversky loss
:param pred: (B, C, 32, 256, 256)
:param organ_target: (B, C, 32, 256, 256)
'''
# the organ_target should... |
7ce54d3c3078e02a6b970d86f82069a963f33cb6d88f04a325920a5f8e805a7f | Python | 3,530 | 109 | import argparse
import h5py
import os
import torch
import yaml
import numpy as np
import sigpy as sp
from deepdwi import prep
from deepdwi.models import mri, prox
from deepdwi.models import autoencoder as ae
from deepdwi.recons import zsssl
from sigpy.mri import app
DIR = os.path.dirname(os.path.realpath(__file__))... |
53637c0a5eed5808de744bd5fc4eec8fc709139e601b01aeeffcaad4e30acb98 | Python | 3,532 | 78 | # ==============================================================================================================================
# Author: Lucas Berg
# ==============================================================================================================================
import os
import sys
import numpy as np
i... |
85253c07281ba2702e7e3ff1d7f207b287453e85d83758f1008dbb09dde3fa9a | Python | 3,532 | 122 | import torch.nn as nn
import torch.nn.functional as F
import torch
from .encoder import CSA
class DownAndUp(nn.Module):
def __init__(self,in_channels, out_channels):
super(DownAndUp, self).__init__()
temp = out_channels
self.conv1 = nn.Sequential(
nn.Conv2d(in_channels, temp, kern... |
40bffcb8f2a0d264adc751b3900b6dfc59ea582ed3a272556d814bd97d1cae44 | Python | 3,533 | 142 | #!/usr/bin/env python
# coding: utf-8
import sys
import os
import argparse
import logging
import csv
import gzip
from anndata._core.anndata import AnnData
import scanpy as sc
import pandas as pd
from tqdm import tqdm
from dna3bit import DNA3Bit
import hto_gex_mapper
numba_logger = logging.getLogger("numba")
numba_log... |
42dc1eb01a2db810cf495d7b9e19e56861dfd2bc285a5e267bb1b7236587aa50 | Python | 3,533 | 86 | import os
# add parent path
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=Fals... |
5ab31d17283570e492fcee60f3a19b7592c4dc0ebf649599a7c1a623f06a0a0f | Python | 3,533 | 121 | import os
import subprocess
import time
from collections.abc import Sequence
from pathlib import Path
from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save
from eir.setup.config_setup_modules.config_setup_utils import load_yaml_config
from eir.utils.logging import get_logger
logger = ge... |
f36ff1174b333470b6c838ab8b61fe243ae967ad5d9d70ab15b427ec22949087 | Python | 3,533 | 102 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
from abc import ABC, abstractmethod
from django.db import transaction
from cvat.apps.dataset_manager import data_model as cdm
from cvat.apps.dataset_manager.bindings import JobData
from cvat.apps.dataset_manager.... |
9a72917195ad3f70743f90b484eb11540dd92899cb1de100678bdbad0d828204 | Python | 3,535 | 102 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to filter streamlines based on their lengths.
See also:
- scil_tractogram_detect_loops
- scil_tractogram_filter_by_anatomy
(Filtering by length is its step1)
- scil_tractogram_filter_by_orientation
- scil_tractogram_filter_by_roi
"""
im... |
a834a0ebba170e75ce7852231fbb46f782e6d8ded54df076c2c997ae99b5bc34 | Python | 3,536 | 105 | from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from .config import use_fused_attn
from .mlp import Mlp
from .weight_init import trunc_normal_tf_
class AttentionPoolLatent(nn.Module):
""" Attention pooling w/ latent query
"""
fused_attn: torch.jit.Final[boo... |
c2dcbc36168e187d62d65070a6ba1a2576d74a756b90a5bf3a89dfd1a6244e41 | Python | 3,536 | 118 | #%%
import numpy as np
import matplotlib.pyplot as plt
import TwoD_gamma
import brainpy.math as bm
#set default ramndom seed for reproducibility
bm.random.seed(1)
#set backend to cpu
bm.set_platform('cpu')
labelsize = 18
ticksize = 14
center_trace, step, mean_fr = TwoD_gamma.get_trace(duration=3e4, sample_rate=20, T_... |
2b699cabfa6fb4b2180b9edcbab3c6138c4f9de8015cc4846b6fbc323eefc04f | Python | 3,537 | 80 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
9ffa65dafcefb7f9a32fbf815217d99657a41c0030d6c261ffc9e64e12aa549b | Python | 3,537 | 111 | from __future__ import annotations
from pathlib import Path
import pytest
# Skip when the optional 'academy' extra is absent; this module
# imports academy.exchange.* directly at top level.
pytest.importorskip("academy")
from academy.exchange.hybrid import HybridAgentRegistration
from academy.exchange.local import ... |
41d7c7d15d415b31f7ff201011cf93e9af701b4e1fc28336ebeef06985653d2d | Python | 3,541 | 52 | import numpy as np
from brainscore_vision import load_metric, load_ceiling, load_dataset
from brainscore_vision.benchmark_helpers.neural_common import NeuralBenchmark, average_repetition
from brainscore_vision.utils import LazyLoad
VISUAL_DEGREES = 8
NUMBER_OF_TRIALS = 33
BIBTEX = """@article {Rajalingham2020,
... |
613a7bb8eab6264a063f3473f3758ff27e5b16561298426916d1efa073a3eb44 | Python | 3,541 | 121 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import argparse
import textwrap
from cvat_sdk import Client, models
from .command_base import (
CommandGroup,
GenericCommand,
GenericCreateFromBackupCommand,
GenericDeleteCommand,
GenericDownloadBackupCommand,
GenericExportD... |
b0afee317777511f6b4ce58bc4292e258469b9874db90e645c851b18320de2a9 | Python | 3,541 | 80 | # -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'delete_behavior_dialog.ui'
##
## Created by: Qt User Interface Compiler version 6.4.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
####... |
fb22a5699c64d8a2a9c3bb7145a89cbf57ff809d0ec892d4504d5474a8bf85c8 | Python | 3,541 | 115 | import os
from types import SimpleNamespace
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
import pytest
pytest.importorskip("PySide6")
from PySide6.QtWidgets import QApplication, QCheckBox, QTabWidget, QWidget
from musclex.modules.ProjectionProcessor import ProcessingBox
from musclex.ui.ProjectionBoxTab im... |
49e88cb68accd64351bf4bcccc53ce8de7f9a45b8d9c0c36e5d534f6b2a91390 | Python | 3,542 | 109 | '''ShuffleNet in PyTorch.
See the paper "ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices" for more details.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class ShuffleBlock(nn.Module):
def __init__(self, groups):
super(ShuffleBlock, self).__init... |
617c3a85b760e5606d75e45453ee3c90f7eedea4bf0070ffafc6ed4424249290 | Python | 3,542 | 107 | '''DenseNet in PyTorch.'''
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Bottleneck(nn.Module):
def __init__(self, in_planes, growth_rate):
super(Bottleneck, self).__init__()
self.bn1 = nn.BatchNorm2d(in_planes)
self.conv1 = nn.Conv2d(in_planes, 4*gr... |
f1a87ea619fa65435614aa5ac11a82a13fb400067469212a30ef82ea63827a93 | Python | 3,542 | 81 | from .create_visualization import visualization
from .create_visualization import visualization_continue
from .create_visualization import visualization_continue_fastq
from .qiita_visualization import qiita_visualization
from .fastq_visualization import fastq_visualization
import os
# This function downloads the acc... |
2f8a553c7a624cacaeff04efe790823a4176cd661bae88427d0132af32ddaf78 | Python | 3,543 | 111 | #!/usr/bin/env python3
# -*- coding: utf-8
"""
Script that creates the groundtruth for simulating data from the lymph node pairs.
Created on 2020/02/11
@author romain_lopez
"""
import numpy as np
import scanpy as sc
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from numba import jit
impor... |
9888599bf250c0166ce4a2b5983c9be12a16544a454d16fae4a7031f8c79145a | Python | 3,543 | 112 | import numpy as np
import pandas as pd
import getopt
import sys
from skimage import io as skio
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib import colors
from slice_dataframe import format_colname
def heatmap_usage():
print("""
Usage : heatmap.py -i <input gem>
-o <o... |
0e3d347c9c1433dbaa4f4c8fa75323dbf0b563143e0f1f87d542626dbbe98cd3 | Python | 3,544 | 86 | from .pyqt_utils import *
class UnalignedImagesDialog(QDialog):
def __init__(self):
super().__init__()
self.setWindowTitle("Detection Settings")
self.initUI()
# self.setConnections()
def initUI(self):
self.mainLayout = QVBoxLayout()
self.setLayout(self.mainLayo... |
37e3ad94eaf3971ac1b13c7f8b89dd9b17f2b30a4554645ee4256cd78c0ab3c5 | Python | 3,545 | 90 | import torch
import torch.nn as nn
from torch_geometric.nn import GATConv, global_mean_pool
from torch_geometric.utils import add_self_loops
class GSRAlternative(nn.Module):
"""
Alternative Graph Structure-Recognition (GSR) model for molecular property prediction
using Graph Attention Networks (GAT).
... |
724cb3445a90902c6855b9834beee3eb4e0270b4702ed5cc4d7facf9f6dc096a | Python | 3,545 | 110 | import pandas as pd
import torch
from torch_geometric.data import Data
import os.path as osp
import numpy as np
from ogb.io.read_graph_raw import read_csv_graph_raw, read_csv_heterograph_raw, read_binary_graph_raw, read_binary_heterograph_raw
from tqdm import tqdm
def read_graph_pyg(raw_dir, add_inverse_edge = False, ... |
0748dda3488f8659ebdacff551942f2068f9b1b74699be60d29b73e8f5e6229b | Python | 3,546 | 109 | from typing import Dict, Any, Optional
import numpy as np
from pydantic import BaseModel, field_validator, ConfigDict, model_validator
class ResultsBlock(BaseModel):
ensembles_cant: int
timecourse: np.ndarray
neus_in_ens: np.ndarray
model_config = ConfigDict(
arbitrary_types_allowed=True
)... |
2701d76daf730b4ff0579ad2d9c91676998e0c575bac1db1211c98daff69b90e | Python | 3,546 | 126 | import pandas as pd
import numpy as np
import argparse
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.cluster import DBSCAN
from sklearn.neighbors import NearestNeighbors
import matplotlib.pyplot as plt
from sklearn.metrics import silhouette_score
# Load your CSV
df =... |
54300eb2441687dc45d159fe159748345fa82ac9d55535b1baac42a8c01e2570 | Python | 3,546 | 126 | import pandas as pd
import numpy as np
import argparse
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.cluster import DBSCAN
from sklearn.neighbors import NearestNeighbors
import matplotlib.pyplot as plt
from sklearn.metrics import silhouette_score
# Load your CSV
df =... |
584d10236dd200803fdbe71aeff7cc8eabd29436ee168c83c1fb0386ed02910f | Python | 3,546 | 126 | import pandas as pd
import numpy as np
import argparse
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.cluster import DBSCAN
from sklearn.neighbors import NearestNeighbors
import matplotlib.pyplot as plt
from sklearn.metrics import silhouette_score
# Load your CSV
df =... |
b6caddd5e5276c8bfd872812b508c28e540076b3867da459909a2959c9e4601b | Python | 3,546 | 85 |
RT_bc_file = "/net/shendure/vol1/home/cao1025/analysis_script/sci3/RT_384_bc.txt"
lig_bc_file = "/net/shendure/vol1/home/cao1025/analysis_script/sci3/ligation_384_bc.txt"
import itertools
from Levenshtein import distance
# for accept a list of characters ["A", "C", "G", "T"] and a length generate all permutations
de... |
d41dd58c36dfc6c37bb38a2dfab3cc68bf71c4e0f617966b33ec7dac83e243d8 | Python | 3,546 | 104 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Prints the raw header from the provided file or only the specified keys.
Supports trk, nii and mgz files.
By default, a simple summary view is shown. Use --all for a more complete
display.
"""
import argparse
import logging
import pprint
import nibabel as nib
from n... |
460ef351489ec731128a4f13f5d11204dd8cdbc6079f058fe36b760a52131e74 | Python | 3,547 | 127 | import pandas as pd
import numpy as np
import argparse
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.cluster import DBSCAN
from sklearn.neighbors import NearestNeighbors
import matplotlib.pyplot as plt
from sklearn.metrics import silhouette_score
# Load your CSV
df =... |
48f79db5ba393fb108547f4e855ea24ab18beeb53d61d3fdb1e55bb2b9675978 | Python | 3,547 | 117 | from pathlib import Path
import torch
from torch import nn
import eir.models.models_utils
from eir import train
from eir.models.fusion.fusion import al_fused_features
from eir.models.meta.meta import MetaModel
from eir.models.meta.meta_utils import FeatureExtractorProtocol
from eir.models.model_setup_modules.meta_set... |
9c5b951c92051b9fcaf1a6a69b4d3f44bed7a7b3eee1effec753390f0026d8e8 | Python | 3,547 | 103 | """"
utils for prun model
"""
from torch.nn import Conv2d
import torch.nn.utils.prune as prune
from torch.nn import Linear
import numpy as np
def flatten(el):
"""flatten the model ,get all the modules in the model
Args:
el (model): _description_
Returns:
[modules]: _description_
"""
... |
49ae6f6b50ea5668e27305744aa10464a3271b9d8fed94dbf64785ac03df9b4e | Python | 3,548 | 126 | import torch
from torch import Tensor, nn
from torch.nn import functional as F
class LayerScale(nn.Module):
def __init__(
self,
dim: int,
init_values: float = 1.0,
n_dims: int | None = None,
) -> None:
"""
Note: We use an init value of 1.0 here instead of the ge... |
650f1fb0cf4a579e727a26fd6355e06a6612362024317aabf0c23f96040d02df | Python | 3,548 | 130 | '''
Some auxiliary functions for statistics
'''
import numpy as np
from typing import Union, Any
def bootstrap(x: np.ndarray, N: int = 10000) -> np.ndarray:
'''
Obtain a bootstrapped view of `x`.
INPUTS:
x - Array to bootstrap
N - Number of bootstraps (default = 10000... |
ba132e5ab297814ecdfd4f32a58142f0232cf2708deca23e8dd6325eee16c095 | Python | 3,548 | 100 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Concatenate DWI, bval and bvecs together. File must be specified in matching
order. Default data type will be the same as the first input DWI.
"""
import argparse
import logging
from dipy.io.gradients import read_bvals_bvecs
from dipy.io.utils import is_header_compa... |
54daab1554875ccb260af1e543da20179ce1b4c00751be8d9edf7d40662471df | Python | 3,549 | 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.svm import LinearSVC
import rpy2.robjects as robjects
def run_SVM(DataPath, LabelsPath, CV_RDataPath, OutputDir, GeneOrderPath = "", NumGenes = 0):
'''
run baseline class... |
9bd0dfa972232cf4406c8a52bd1cb682bb27d3adc6336ac3fa09f90a2ebbad36 | Python | 3,549 | 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 NearestCentroid
import rpy2.robjects as robjects
def run_NMC(DataPath, LabelsPath, CV_RDataPath, OutputDir, GeneOrderPath = "", NumGenes = 0):
'''
run ba... |
47224d894525f361a67545f01cc0ada9aa15a149ce8618693bec6d6a2b2fe8cc | Python | 3,550 | 97 | """
Predicted concentration vs estimated concentrations
for the Mixed sequence with a given SNR
"""
import matplotlib.pyplot as plt
import numpy as np
import click
from common import compute_T1, compute_c
from mixed import compute_ir_signal, compute_se_signal, LOOKUP_TABLE, extract_mixed_t1
def generate_mixed_data(... |
a3b5c51a1b311b7efacddca0ac37a6cdaee2ee9ba6cdfdbea8ea7fa6a319f494 | Python | 3,550 | 63 | import numpy as np
import numpy.testing as npt
import pytest
import csv
import datetime
from src.wrappers.OsipiBase import OsipiBase
from utilities.data_simulation.GenerateData import GenerateData
#run using pytest <path_to_this_file> --saveFileName test_output.txt --SNR 50 100 200
#e.g. pytest -m slow tests/IVIMmode... |
aeb7ecdd2c294d537b72f97e03693c46343754684b9bcb48bc04263444e12e6e | Python | 3,550 | 92 | """
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... |
472cd27518309e25385ce1b9c544bad9f4ee39a6cf37fa5946e1f21fdc76f70f | Python | 3,551 | 109 | '''ShuffleNet in PyTorch.
See the paper "ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices" for more details.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class ShuffleBlock(nn.Module):
def __init__(self, groups):
super(ShuffleBlock, self).__init... |
cb794e17059250d7944fea7e95a692e2bf09ce75bfd3ffe37648a53d22f1b9d0 | Python | 3,551 | 75 | ##################################################################################################
### Script that averages over trials of Q and MI data, employing 'extractParamsQMIfromSpikes.py' #
##################################################################################################
### Copyright 2023 Jann... |
373f274295d6f9784faecc45630b290a2c3757475aa30c81a8ba8ffda86640a8 | Python | 3,552 | 83 | import os
import torch
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
import argparse
from model_options import TransformerClassifier, load_compatible_state_dict
parser = argparse.ArgumentParser(description="Run GERD inference")
transfer_group = parser.add_mutually_exclusive_gr... |
4e437f3874b441079ca16eef503464342f579ba8421bae80c493e3a8ce956c79 | Python | 3,552 | 105 | import nest
import os
import numpy as np
import pandas as pd
import scanpy as sc
from tqdm import tqdm
from sklearn.metrics import jaccard_score
from collections import defaultdict
import pickle
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib import rc
#... |
1ce8459b97f7605864456994161d92d95e19fcd024859179b512ff7228cdfcee | Python | 3,553 | 98 | """Translate csv files to gaussians"""
from pathlib import Path
import os
from deep_events.database.folder_benedict import get_dict
import tifffile
from ome_zarr.io import parse_url
from ome_zarr.reader import Reader
import pandas as pd
from deep_events.myfunctions import poi
import numpy as np
from deep_events.databa... |
f35d31efd9040c2cccdc1c3ac7ccff673c94eb630b5a77301d6a30e75b2cd251 | Python | 3,553 | 86 | import torch
from tqdm import tqdm
from dataset_tool import fast_merge
import numpy as np
from transformers import pipeline, T5Tokenizer, T5EncoderModel
import os
user,tweet=fast_merge(dataset="Twibot-20")
user_text=list(user['description'])
tweet_text = [text for text in tweet.text]
pretrained_weights = 't5-small'
... |
a46103c68b9e5752924968bcdfa859f552d707886ed672c3d4db690db81561d3 | Python | 3,554 | 116 | import torch
import torch.nn as nn
import numpy as np
import ase
from ase.io import read
# utils imports
from utils.plot_corr import plot_corr
from utils.neuralnets.FFNet import FFNet
from utils.distances import get_bond_length_ABCC
from utils.kernels import get_1D_kernels_k33
'''
Calculator for the atomic simulation ... |
98a45592504abefaa7cd089b5e95047b3a2a109184935d2ba6d3655c0270fac8 | Python | 3,555 | 85 | """Conservatively remove isolated zig-zags from a GIFTI cortical label map."""
from __future__ import annotations
import argparse
import copy
from pathlib import Path
import nibabel as nib
import numpy as np
from scipy.sparse import coo_matrix
def adjacency_from_faces(n_vertices: int, faces: np.ndarray):
rows ... |
9db46a8360f4b478a1f8790d0e8047a23a2c42934dd23952778dfd2ff21a5f35 | Python | 3,555 | 112 | """
This module contains functions for plotting results.
"""
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
import seaborn as sns
def beutify(ax, direction="left"):
# Make side and bottom spines more prominent by increasing their width
sns.set_theme(font_scale=0.8)
ax.spines... |
b4e1fceae569e88319ce77ed965508d29006d95873a7dc0d4e2e134fb4e6670e | Python | 3,555 | 109 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or
... |
05ee0d7540383b1e3646e986440247b798458765b654f78982032afb67e21cb9 | Python | 3,556 | 85 | #!/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=['tractograms.zip'])
tmp_dir = tempfile.... |
3814b96b466f1b021cab3e88feeb7dd1de6885eb2efaccec5e5b85a6f1642348 | Python | 3,557 | 109 | '''
NH3CN
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for NH3CN:
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... |
bbd6edff5d819060e8ae3b9fd08aa02a8db109e994203166c46966e35f68e50e | Python | 3,558 | 98 | """
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... |
e87a102274606e2a2556e40e850a4a23a4295c4daa02256267bb4827af332233 | Python | 3,558 | 109 | #! /usr/bin/env python
# Copyright 2014-2015 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
"""
Combines a set of raw l... |
243051b61a1fe2fcab94a32258cc9d1260c494e0baac795e7e2a8588b589c7bf | Python | 3,559 | 127 | from __future__ import annotations
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, overload
from ._widget import Widget
if TYPE_CHECKING:
from magicgui.widgets import protocols
from magicgui.widgets._concrete import Menu
class _SupportsMenus:
"""Mixin for widgets that suppor... |
ff7fba9a5af16c3fa4fcc98f3ecdf19dfdc8bd2e83c639d24d244bd23cbd4c6d | Python | 3,559 | 86 | import os
import numpy as np
alg_name = 'mlp'
parallel_starts = 16
available_gpus = ['0,7', '7,0']
# args dict
args_dict = {'dataset': 'node_vessap_roi3_pb_minRadiusAvg',
'log_dir': '../tensorboard_logs',
'device': 1,
'log_steps': 1,
'num_layers': 3,
'h... |
17d19253e55c0be0df1c7275e5e851a6c095290612af02fce3ee967f35789012 | Python | 3,560 | 95 | """
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... |
1ed5f937f7675d6fe515850e82c053be55628619db3d3821afe0815fe56ba116 | Python | 3,560 | 60 | from typing import Optional
from project.datasets.DIPS.dips_dgl_dataset import DIPSDGLDataset
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader
from project.utils.deepinteract_utils import dgl_picp_collate
# --------------------------------------------------------------------... |
229514a411b988ffa2b294919061492e2eeabf8c9a29f4a7213910a64aba7511 | Python | 3,560 | 94 | import os
import pandas as pd
import numpy as np
from moana.core import ExpMatrix
from moana.classify import CellTypeClassifier
import time as tm
import rpy2.robjects as robjects
def run_moana(DataPath, LabelsPath, ClassifierPath, OutputDir, GeneOrderPath = "", NumGenes = 0):
'''
run moana
Wrapp... |
49cd27019eeba2fa49701ce567b26ff52f8123616c3655bdc412784237efab1a | Python | 3,560 | 128 | ''' Fix EPS images that contain artifacts since Matlab 2014b
Usage: python fix_matlab_eps.py input-file output-file'''
import re
import os
import sys
import subprocess
import tempfile
def main():
ret = subprocess.call('/Applications/Inkscape.app/Contents/Resources/bin/inkscape-bin --version', shell=True)
... |
5152da8984c84ff62f24d9c844543f502c1017c6304e06a581bf3a4b708d19eb | Python | 3,560 | 82 | import os
import xml.etree.ElementTree as ET
import vtk
# Set the base directory containing all the folders
base_directory = "INSERT_PATH_HERE"
output_path = "INSERT_PATH_HERE"
# Loop through all folders in the base directory
for folder_name in os.listdir(base_directory):
folder_path = os.path.join(base_direc... |
7106a4f739c977c01e640ef26d2c4e08a399457512bab362504ce22d205322e6 | Python | 3,560 | 144 | """ Test plotting """
import pytest
import numpy as np
import vtk
try:
import panel as pn
except ImportError:
pn = None
try:
import IPython as ipy
except ImportError:
ipy = None
from brainspace.vtk_interface.pipeline import to_data
from brainspace.plotting.base import Plotter
from brainspace.plo... |
dfd6da0efb5e0a462f90cd3e8d387e70310e6859f344b703e5a848d102802092 | Python | 3,561 | 119 | """
Tests for `bx.bitset`.
"""
import unittest
import bx.bitset
class AbstractTests:
def assert_bits(self, bits, list):
assert bits.size == len(list), "Bitset size and verification list size do not match"
for i in range(bits.size):
self.assertEqual(bits[i], list[i])
def test_ove... |
d99b63939f23dd1cbc18c1432de2b8f63a7d4248729f45d31e9092d7919c1b37 | Python | 3,562 | 98 | '''Dual Path Networks in PyTorch.'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class Bottleneck(nn.Module):
def __init__(self, last_planes, in_planes, out_planes, dense_depth, stride, first_layer):
super(Bottleneck, self).__init__()
self.out_planes = out_planes
sel... |
557dc72c260894133d7f526a454bbec7661ff1ea53bc208e7a62b1a8999af273 | Python | 3,563 | 114 | """Trace writer for traditional ChemGraph CLI runs.
Bridges ChemGraph run events into the dashboard's on-disk schema
(`events.jsonl` + `status.json` + `manifest.json`), so the existing
``chemgraph dashboard`` browser UI can render a traditional ChemGraph run
without going through the Academy daemon path.
"""
from __f... |
3c93561e635f35931e3dbf2395fb20274d0add558cf82ef1581d7e61474499ac | Python | 3,564 | 75 | ##################################################################################################
### Script that averages over trials of Q and MI data, employing 'extractParamsQMIfromSpikes.py' #
##################################################################################################
### Copyright 2023 Jann... |
a074457d1a308baf0ade4757c790799ae95b1a5c247534796095d36c71ca2466 | Python | 3,564 | 98 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Computes the information from the input metrics for each cortical region
(corresponding to an atlas). If more than one metric are provided, statistics are
computed separately for each.
Hint: For instance, this script could be useful if you have a seed map from a
speci... |
21c13e78d3ec16abf0875c4b17092f99750b43417a3cd9c2dfc504c4501431a5 | Python | 3,565 | 90 | import numpy as np
import os
from .colorLogRemap import color_log_remap # Use relative import if the module is in the same package
from matplotlib.colors import ListedColormap
def relaxation_color_map(maptype, x, loLev, upLev):
"""
RelaxationColorMap: acts in two ways:
1. Generate a colormap to be used ... |
cb1d8c6a662f213a7bc522c7cd78c97827507a5198121d0b91b84d55fe91b0f2 | Python | 3,565 | 90 | """DUA-gated stimulus loading for LAION-fMRI.
The LAION-fMRI Data Use Agreement prohibits redistribution of the image bytes.
Users obtain stimuli locally via the upstream ``laion-fmri request-access``
(signs DUA) + ``laion-fmri download-stimuli`` CLI, then run
``data_packaging/get_local_stimuli.py`` to extract JPEGs a... |
0ba208c4e8aad540bf9de700d72803063968f1e150cb80ad36d7583617210225 | Python | 3,566 | 137 | #!/usr/bin/env python
"""
A test of the BufferedFunctionality class.
"""
import sys
import time
from PyQt5 import QtCore, QtWidgets
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
class TBWidgetBase(QtWidgets.QWidget):
processed = QtCore.pyqtSignal(str)
def __init__(self, ... |
c65ddd009d69cc9218ecc40a3fa1dd591481e8ec2ac81c4a1bf412884f29b23f | Python | 3,567 | 90 | import torch
import numpy as np
import config
class Metric():
def __init__(self, reduction = 'mean'):
self.reduciton = reduction
def set_input(self, y_true, y_pred):
'''
:param y_true:
torch.Tensor [b, 32, 256, 256]
:param y_pred:
torch.Tensor [b, 32, ... |
e798edc7273ecfa060f5d91d57224a31a929aa44e2efa60e7398653eaaccbcaf | Python | 3,567 | 94 | # -*- coding: utf-8 -*-
"""
Written by Guido Meijer
"""
from powerpixels import Pipeline
import os
from os.path import join, isdir
import numpy as np
from datetime import datetime
from pathlib import Path
if __name__ == "__main__":
# Initialize power pixels pipeline
pp = Pipeline()
# Searc... |
0470b74080f9c8443436b67f10b18108b38bc5b6996d6b2754db07615779e114 | Python | 3,568 | 45 | '''
Quick script to run encoding analysis over
all subjects in final task.
All options available to `subject_rerp_mt2.py` can
be passed to this script.
'''
import auxiliary as aux
import os, data
if __name__ == '__main__':
# meta options
start_from = aux.get_opt('from', cast = int, default = 0) # start... |
4a6f2bb7e56e08db7cbb24828cb1a6e29880ff5aa002510b2e54e9b982836ace | Python | 3,568 | 87 | """Create a display-oriented, smoothed version of the AAL subcortical mesh.
The source surface is retained unchanged. The output keeps the original
vertex labels and label table, so existing per-region plotting code continues
to work. Each labelled structure is processed independently: this preserves
the visual sepa... |
1ed84a856a052c879ca061aa276fa543fa4cf6eb7ef492a42e0ecd9374b08ab1 | Python | 3,569 | 111 | import yaml
import os
import argparse
from zigzag.classes.cacti.cacti_master.cacti_config_creator import CactiConfig
parser = argparse.ArgumentParser()
parser.add_argument('--mem_type')
parser.add_argument('--cache_size')
parser.add_argument('--IO_bus_width')
parser.add_argument('--ex_rd_port')
parser.add_argument('... |
fbf2e7f4a54d0f19bda553c80fdd429b5dddb3ffd1b3896d16932cb58eae6d4d | Python | 3,569 | 78 | # #!/usr/bin/env python
# encoding: utf-8
'''
@author: Yang Sui
@contact: yangsui@uw.edu
@ Prerequisite:
module load annotsv/3.4
AnnotSV -SvinputFile annotSV.input.bed -svtBEDcol 4 -candidateGenesFile /net/eichler/vol28/projects/autism_genome_assembly/nobackups/yangsui/annotSV/NDDgene.txt -promoterSize 500 -REreport... |
9539c424f8181559b038b17855282f5d9e314e9dd98f6902af626c38b3c962f6 | Python | 3,570 | 103 | from typing import List
import torch
import torch.nn.functional as F
from .dice import to_tensor
from torch import Tensor
from torch.nn.modules.loss import _Loss
from .functional import soft_jaccard_score
__all__ = ["JaccardLoss", "BINARY_MODE", "MULTICLASS_MODE", "MULTILABEL_MODE"]
BINARY_MODE = "binary"
MULTICLAS... |
9a0c458e3c118961375e7fb5bfde8f3cce5bebe56fe6104c720a167f121884af | Python | 3,570 | 121 | import pickle
import sklearn.ensemble
import sklearn.svm
import sklearn.linear_model
import xgboost
import imblearn
from sklearn.pipeline import make_pipeline
from sklearn.decomposition import PCA
import os
import src.samplers
class Model:
@classmethod
def create( cls, x, y, scale=False, sampler=None, dim_reduct... |
adb5f474856e2fa67f83dd6df7de1087c02e2b4b96e0608f2873a1702abe235b | Python | 3,570 | 86 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import jsonpickle
import numpy as np
import torch
from pysot_toolkit.bbox import get_axis_aligned_bbox
from pysot_toolkit.trackers.net_wrappers import NetWithBackbone
from pysot_toolkit.trackers.tracker import Tracker
class ModelHandler:
def __... |
d2321d100c5c31dad6824f0848af07229a34e5c9f1a77c9beba0580590dbc1f9 | Python | 3,570 | 138 | #!/usr/bin/env python
# coding: utf-8
import sys
import os
import argparse
import logging
import scanpy as sc
import pandas as pd
import numpy as np
import scipy.io
from dna3bit import DNA3Bit
numba_logger = logging.getLogger("numba")
numba_logger.setLevel(logging.WARNING)
logger = logging.getLogger("to_adata")
l... |
2ac2f909a7846578ab856816b98d989afdf465499c6e433dcb95c33b9ca73e9c | Python | 3,572 | 79 | # Copyright (c) DP Technology.
# 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.
from typing import List
from unicore.optim.lr_scheduler import UnicoreLRScheduler, register_lr_scheduler
@reg... |
5e04c42e25180ceb3d67994cac66ac67f635c4a65750b8005bd0ca01eb286009 | Python | 3,572 | 113 | import pytest
import torch
from rangemp.nn.scatter import scatter, scatter_softmax
from torch_geometric.utils import scatter as pyg_scatter
@pytest.mark.parametrize("compiled", [False, True])
@pytest.mark.parametrize(
"x_size, batch_size, dim, reduce_op",
[
([128, 32], 1, 1, "sum"),
([128, 32... |
d7b7a1db5816f1c20c315a48acad24953161d69451949aabd1f30ad8931eddcd | Python | 3,573 | 92 | import os
from unittest import mock, TestCase
import kb_python.dry.utils as utils
from kb_python.config import UnsupportedOSError
class TestUtils(TestCase):
def test_run_executable(self):
with mock.patch('kb_python.dry.utils.print') as p:
self.assertIsNone(utils.run_executable(['1', '2', 3])... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.