sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
df7f1be3697536414e991eb587c6d33f1b8c9c61f89f85b1a0b84d7bd2fe9675 | Python | 2,747 | 85 | """
This module contains functions for loading data for a session.
"""
import os
from ast import literal_eval
import json
import pandas as pd
import numpy as np
import hashlib
def findrootdir():
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
root_dir = os.path.join(root_dir, "data")
... |
6b98eb943025a33018d59c022c1212692cdbdc10098ff5e3d4ef11b651e01352 | Python | 2,749 | 85 | """
Support for scores in the `wiggle`_ file format used by the UCSC Genome
Browser.
The positions in the wiggle format are 1-relative, however,
the positions returned match the BED/interval format which is zero-based, half-open.
.. _wiggle: http://genome.ucsc.edu/goldenPath/help/wiggle.html
"""
def parse_header(li... |
1e4d392c2a5f0501e4e60d71588791607a56967740d1747b0d62794973c54d01 | Python | 2,750 | 82 | #!/usr/bin/env python
"""
Build an index file for a set of MAF alignment blocks.
If index_file is not provided maf_file.index is used.
usage: %prog maf_file index_file
-s, --species=a,b,c: only index the position of the block in the listed species
"""
import os.path
from io import TextIOWrapper
import bx.align... |
6cf5870a1d98161bb10da8416f64f23b72a191d159fce026afd40a1ff3239f4e | Python | 2,750 | 93 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import contextlib
import itertools
import os
from collections.abc import Generator, Sequence
from typing import IO, Any, BinaryIO, Literal, TextIO, overload
from cvat_sdk.core.exceptions import InvalidHostExceptio... |
7a6e2a5ba950347e74d4ac419a9cc81312f3f16db7b4ada031bd9973d64e3175 | Python | 2,750 | 92 | import numpy as np
import obspy
import pytest
import torch
from obspy import UTCDateTime
import seisbench.models as sbm
import seisbench.util as sbu
def _synthetic_zne_stream(
*, npts: int = 12_000, sampling_rate: float = 100.0
) -> obspy.Stream:
"""Long enough for EQCCTP/EQCCTS (6000-sample windows at 100 H... |
95d9ccd2897d697c658e0da0e98b6084bb7c688a6b2860043b010d3b64be469b | Python | 2,750 | 59 | #!/usr/bin/env python3
# Author: Francois Aguet
import pandas as pd
import numpy as np
import argparse
import gzip
import os
import qtl.io
parser = argparse.ArgumentParser(description='Combine GCT files')
parser.add_argument('input_files', nargs='+', help='List of GCT files, or file containing paths to GCTs.')
parser.... |
9ed3987aebabc0a12aa81e7d6c7628b88ae73507770a9b1480ebe05327110acf | Python | 2,750 | 88 | import logging
import numpy as np
import tensorflow as tf
log = logging.getLogger(__name__)
class simple_generator(tf.keras.utils.Sequence):
def __init__(self, X, Y, batch_size=32, shuffle=False, frac=1, dtype='float32'):
'Initialization'
log.info(f"Setting up simple generator, batch_size={... |
0264d3195364ab04b60b46647dc07fbfb53deac118b51d99c5dd8616c8eecb6c | Python | 2,751 | 80 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Martin J. Kuehn, Wadim Koslow, Daniel Abele
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exce... |
2734c85b430eb5d38b4c06721cc59927038237a051a0790f6369845812520bfa | Python | 2,751 | 82 | from brainscore_core import Metric
from brainscore_vision import load_metric, load_dataset
from brainscore_vision.benchmark_helpers.neural_common import NeuralBenchmark, average_repetition
import brainscore_vision.metrics.predictor_consistency
from brainscore_vision.metrics.predictor_consistency.ceiling import SplitHa... |
2f32061a04e7c3152aab511579eff90f3cb94cb18c175cbe885f91f7750a64dc | Python | 2,752 | 76 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Converts a Varian FDF file or directory to a nifti file.
If the procpar contains diffusion information, it will be saved as bval and
bvec in the same folder as the output file.
ex: scil_dwi_convert_FDF semsdw/b0_folder/ semsdw/dwi_folder/ \
dwi.nii.gz --bval d... |
ba1f209e5bd0f368d5a9792b3ae09bf56d4a589d19f497ccc6dc442eb4842d14 | Python | 2,752 | 86 | import torch
import torch.nn as nn
from einops import repeat, rearrange
NEG_INF = -1e-9
class PreNorm(nn.Module):
def __init__(self, dim, fn):
super().__init__()
self.norm = nn.LayerNorm(dim)
self.fn = fn
def forward(self, x, *args, **kwargs):
return self.fn(s... |
99d6082787338a6759e0593fbde60df91b773af86ffcf3166781159bddc20848 | Python | 2,753 | 76 | from bread.data import Features, Segmentation, Lineage
from math import sin, cos, sqrt, atan2
from typing import List
import torch
__all__ = ['extract_features', 'NUM_FEATURES', 'FEATURE_NAMES']
FEATURE_NAMES: List[str] = [
# bud features, idx 0..6
'bud_area', 'bud_r_equiv', 'bud_ecc', 'bud_maj_x', 'bud_maj_y', 'bu... |
b3dfcdfdb1b86f95d271669b3737b58571c25751c2c05604f33d37568718fcef | Python | 2,753 | 71 | #!/usr/bin/python3
#
import os
import sys
import argparse
import numpy as np
from uac import utils
# Create the parser
my_parser = argparse.ArgumentParser(description="Calculation of labels using laplace solves only")
# Add the arguments
my_parser.add_argument("target_path", metavar="path", type=str, help="Path for ... |
34f153f0ffd9cdfa4411074543b36bf3558370bd5bbd0a7e8ca96f7d01b3e4ee | Python | 2,754 | 74 | from itertools import product
import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
from sklearn.utils.multiclass import type_of_target
class TreatmentOutcomeStratifiedKFold(StratifiedKFold):
"""Creates stratified folds based on both the treatment assignment
and the out... |
b2cc26c1cd9cfc78ee00eb01a097b5e6d024e4251f8da10eec50911604857e91 | Python | 2,754 | 82 | import os
import numpy as np
import matplotlib.pyplot as plt
from data_loader import Dataset2hD, BrainDataset
from scipy.stats import norm
if __name__ == "__main__":
datafolder = "/home/fi5666wi/Brain_CT_MR_data/DL"
energies = [50, 70, 120]
#fig = plt.figure(0)
means = np.zeros((3,3))
for j, leve... |
cd58b0ae755ab00c8adb653da8cda3a1be99562d34d9f2d2e9ea3a8d1c044d62 | Python | 2,754 | 86 | #!/usr/bin/env python3
"""Update and sort the creators list of the zenodo record.
This script was originally developed by the nipreps developers.
For the full LICENSE and terms of use, see
https://github.com/nipreps/dmriprep/blob/master/LICENSE
"""
import json
import shutil
import subprocess as sp
import sys
from p... |
cd70ce74da9b9472a0e5113bffbb3b96a42c38275d7caf570d7fbe90021e1f5a | Python | 2,754 | 73 | from dataclasses import dataclass, field
from typing import Literal
SurvivalLossNames = Literal["NegativeLogLikelihood", "CoxPHLoss"]
@dataclass
class SurvivalOutputTypeConfig:
"""
Basic configuration for survival analysis output.
:param time_columns:
The names of the columns in the label file t... |
dd277d847a9147ee4a1d8a7e638e99107424fe8ac4f22928158f9b032c1bc7cc | Python | 2,756 | 89 | import numpy as np
from scipy.spatial import cKDTree
from scipy.optimize import minimize
def transform_to_ctf(pts, nas, lpa, rpa, mean_scalp=None, return_transform=False):
transform = get_transform(nas, lpa, rpa)
pts_ctf = apply_transform(transform, pts)
# to minimize error due to individual fiducial picki... |
5710da64c26da998943215b8625b2a81cc1e48fd0810ac3b997a05812c643ec8 | Python | 2,757 | 86 | from pathlib import Path
import numpy as np
import pytest
from napari_dmc_brainmap.segment.processing.presegmentation_tools import (
CellsSegmenter,
)
@pytest.mark.parametrize(
("fixture_name", "single_channel"),
[
("grayscale_uint16_tiff", True),
("grayscale_uint8_tiff", True),
... |
ee70b5063305cd9b3ed1ab817ca9e973b4f69e014ddd3861dc48be4025047c55 | Python | 2,757 | 78 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
import TwoD_fun
import brainpy.math as bm
from scipy import optimize
xlabel = ['Super-diffusion', 'Brownian-diffusion', 'Stationary']
color_list = ['#F18D00','#009FB9','#A3A3A3']
ticksize = 14
labelsize = 18
position_c... |
4de8364ce3aaeda17c42bbeaee6a2751339c1150f0b910a951e028ee966937a4 | Python | 2,758 | 69 | # import os
# import subprocess
# import shutil
# bids_root_path = '/mnt/f/UKBdata/data_NC'
# shivai_input_path = '/mnt/f/UKBdata/NC_SHIVA_INPUT'
# # 遍历所有第一层文件夹,筛选出以'sub'开头的文件夹
# for subject_dir in os.listdir(bids_root_path):
# #print(f'Processing directory: {subject_dir}')
# if subject_dir.startswith('sub-'... |
304811f02ba9b58f7ef4c261ecaca158719f05bbc8fdb5e75f1cf92cf82992ff | Python | 2,759 | 66 | import os
import sys
import argparse
import options
from model import *
from model.get_location import *
from model.neighbor_graph import *
parser = argparse.ArgumentParser()
parser.add_argument("--dataset", type=str, default='murine_cellline', help='The name of benchmarking datasets')
args = parser.parse_args()
def ... |
15a592f367de6483ea3a3ceb24c69064cedda8a8ab4c04651a3983f422dc8254 | Python | 2,760 | 76 | # COCO-17 keypoint definitions
# Standard COCO pose challenge format (17 body parts)
COCO_PART_NAMES = [
"nose", # 0
"left_eye", # 1
"right_eye", # 2
"left_ear", # 3
"right_ear", # 4
"left_shoulder", # 5
"right_shoulder", # 6
"left_elbow", # 7
"r... |
1613e81ce1354cda4c73d34a0992626cf15f4bf7228e470fba4b1103f655b94b | Python | 2,760 | 94 | from types import SimpleNamespace
import pytest
from brainles_preprocessing.modality import CenterModality, Modality
from brainles_preprocessing.preprocessor import AtlasCentricPreprocessor
# --- Dummy classes for testing ---
class DummyModality:
def __init__(self, name):
self.modality_name = name
cla... |
e702d3d9933b4b1846bab7f17d1af1ef37103af59d51dfaa7611b92cf935d568 | Python | 2,760 | 96 | import base64
from pathlib import Path
from typing import Any
import numpy as np
import pandas as pd
from eir.utils.logging import get_logger
logger = get_logger(name=__name__)
class StockDataManager:
def __init__(
self,
*,
csv_path: Path,
sequence_length: int = 64,
is_d... |
a50e7c960859edbe1b03f443f8164cdd1bb9f2d5e6ffa6576d3447c78c48a928 | Python | 2,761 | 86 | import torch
import numpy as np
from preprocess import get_dataloaders
from model import twoLayerMLP
from tqdm import tqdm
import sys
sys.path.append("..")
from utils.eval import evaluate_on_all_metrics
class Trainer:
def __init__(
self,
epochs=50,
batch_size=128,
hidden_dim=256,
... |
a8c14db7d2b0a7d09cb6224805d4e5a45f8e0662754173206e21e4abc23328ce | Python | 2,761 | 85 | import os.path
from io import StringIO
from string import Template
from numpy import (
ceil,
log2,
transpose,
where,
)
PAD = 2
# Colors from rgb.txt,
DNA_DEFAULT_COLORS = {
"A": "0.00 1.00 0.00", # green
"C": "0.00 0.00 1.00", # blue
"G": "1.00 0.65 0.00", # orange red
"T": "1.00 0... |
2e672d821d0791db805d1918315bb9e37ffc089363bf359ec78f07cafc0c15ff | Python | 2,763 | 74 | """Shows how to use the fit debugger to get a detailed report of fit steps."""
import matplotlib.pyplot as plt
from nems import Model, load_demo
from nems.tools.debug import debug_fitter, animated_debug
from nems.visualization.fitter import parameter_pca_table
train, test = load_demo(tutorial_subset=True) #First 5... |
e6c0e0a276fad6b550c53f42c934232a6cd4f0452fed90a9127ae754f30c043a | Python | 2,763 | 72 | from nipype.pipeline.engine.workflows import *
class NestedWorkflow(Workflow):
@property
def inputs(self):
"""Proxy inputs from the inputspec node to support Nipype-style input access"""
inputspec = self.get_node('inputspec')
if inputspec is None:
raise AttributeError("No ... |
3d4c53d0677d7812ea9caf4131448152a8627620626d8b93d8e3e382dec05e52 | Python | 2,764 | 54 | from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set
from brainscore_core.supported_data_standards.brainio.s3 import (
load_stimulus_set_from_s3, load_assembly_from_s3,
)
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
BIBTEX = """@ar... |
b30342275f73889a2ac7b6c7e19ea09b3210d57f73901558fb5658ebc58f931d | Python | 2,764 | 101 | """Custom Pygments styles for the Sphinx documentation."""
from pygments.style import Style
from pygments.token import (
Comment,
Error,
Generic,
Keyword,
Name,
Number,
Operator,
Punctuation,
String,
Token,
Whitespace,
)
class NerfstudioStyleLight(Style):
"""
A sty... |
7eee3604e2a28b4ceef73c8b4db21ae32f356b1899b620388439e5aa5619a89c | Python | 2,765 | 32 | from testsetclass import TestsetClass
class S22(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['08', '18b', '13a', '22a', '20', '18', '04a', '05a', '19a', '06b', '02b', '05', '06a', '11a', '03a', '17', '04', '01a', '22', '17b', '02a', '14a', '10b', '09', '14', '01', '21', '06... |
8b692d62fedf7639dd307bc48b523b4a1dcac8c5e2f39210ddb8016f995893bf | Python | 2,766 | 98 | import h5py
import os
import yaml
from matplotlib.patches import Rectangle
import matplotlib.pyplot as plt
import numpy as np
DIR = os.path.dirname(os.path.realpath(__file__))
HOME_DIR = DIR.rsplit('/', 1)[0].rsplit('/', 1)[0]
print('> HOME: ', HOME_DIR)
# %% load images
f = h5py.File(DIR + '/llr_regu.h5', 'r')
DWI... |
f442ea965cc965eb7e99453f06169298bd8b37bed26075ebded688fe3ffe5059 | Python | 2,766 | 69 | # This file is part of Mooney computational modeling project.
#
# Mooney computational modeling project is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
bbe900ecd556d8f50e747b919cf5db86adfe72e6e135b08fb7d5e9308268b966 | Python | 2,767 | 90 | 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 torchmetrics import Dice, JaccardIndex
from display_gui import load_gt_nii, load_nii
import os
def slice2img(slice):
# prediction
gm = slice[1, :, :]
... |
bcadf87cba3ab72f4f4f80ef2719cb40568e346da3fd9c0de0000133df970016 | Python | 2,767 | 80 | """Widget base classes.
These will rarely be used directly by end-users, instead see the "concrete" widgets
exported in :mod:`magicgui.widgets`.
All magicgui [Widget][magicgui.widgets.Widget] bases comprise a backend widget that
implements one of the widget protocols defined in
[`magicgui.widgets.protocols`](protocol... |
81de893ce32e6be30c829c85b06715eb9a84037b2e36ceed1d166151a15de6fc | Python | 2,768 | 91 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
ce1217c05cb48035bafaea5792d31cc7a548abd346d22477cfc1e9206cfb1d13 | Python | 2,768 | 92 | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
from unicore.data import (
NestedDictionaryDataset,
EpochShuffleDataset,
)
from uni... |
12915562aee068350600789d61252bf6a63537c6e66a35ecc2fdd5f4719268c3 | Python | 2,769 | 84 | import tensorflow as tf
import csv
import numpy as np
import SimpleITK as sitk
import matplotlib.pyplot as plt
from numpy import argmax
import pandas as pd
import tensorflow.keras.backend as K
from tensorflow.keras import initializers
from tensorflow.keras.callbacks import Callback
from tensorflow.keras.layers import A... |
1f9842090d759e0aea24e44aacc9d2edc656745a08d3cbc03a002c9ef0727509 | Python | 2,770 | 97 | # Kai Sandbrink
# 2022-08-23
# Baseline models for the torch version of the PeekTake task
# %% LIBRARY IMPORTS
import numpy as np
import random
# %% INITIALIZATIONS
modes = ['peek', 'take']
# %% RANDOM BASELINE
class RandomBaseline():
def __init__(self, n_arms = 2):
self.n_arms = n_arms
self.... |
16cbdecfbdbd4804084d6ed1049caed0f9f1914aede8e0264adc83f2cf5716c9 | Python | 2,771 | 77 | from model import BotRGCN
from Dataset import Twibot22
import torch
from torch import nn
from utils import accuracy,init_weights
from sklearn.metrics import f1_score
from sklearn.metrics import matthews_corrcoef
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics i... |
5bcc06e591fdd305c8022131d60b0f7f15d64e6d296903c81a38cac409d3bef4 | Python | 2,771 | 72 | import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
class StandardScaler():
"""Standardize data by removing the mean and scaling to
unit variance. This object can be used as a transform
in PyTorch data loaders.
Args:
mean (FloatTensor): The mean value for each feature ... |
1a8da37cbf32a55ff56e0b6f8e67d62fddecba9c22eccb7fbdc0a9b710dd7b6c | Python | 2,772 | 78 | from model import BotRGCN
from Dataset import Twibot22
import torch
from torch import nn
from utils import accuracy,init_weights
from sklearn.metrics import f1_score
from sklearn.metrics import matthews_corrcoef
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics i... |
80f977419005885a252928cdb1513cdf6c07bbe5d6894e1baacf5f006d7837d5 | Python | 2,772 | 82 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Maximilian Betz
#
# 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 with the Li... |
223628fb97cc5fb154035f3ffbf20cb3f92dc6ff2a0879b895b4e9f0a3ce21ef | Python | 2,773 | 78 | from model import BotRGCN
from Dataset import Twibot22
import torch
from torch import nn
from utils import accuracy,init_weights
from sklearn.metrics import f1_score
from sklearn.metrics import matthews_corrcoef
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics i... |
cd44a29dc99371d9f4fbffd61b2ef3cc407dd1dd2e87e532b2083b8d8be04b87 | Python | 2,774 | 86 | """Application entry point."""
import argparse
import sys
from PyQt6.QtWidgets import QApplication
from meanap.gui import theme
from meanap.gui.branding import logo_icon
from meanap.gui.main_window import MainWindow
from meanap.gui.modes import DEFAULT_MODE, MODES
from meanap.gui.versions_dialog import check_on_star... |
1ed599b2adbbeb7f89129eb2c97c4edecc5cf5c5aeef81e16a24a7323bc4df93 | Python | 2,775 | 88 | #!/usr/bin/env python
"""
This is used to check the raw events that come from the joystick.
Hazen 9/12
Jeff 9/12
"""
import pywinusb.hid as hid
class Gamepad310(object):
"""
Encapsulates the interface to a Logitech gamepad joystick.
"""
def __init__(self, **kwds):
"""
... |
3f980d6cab2dbbce99141819d1e060aeb46d2dab433278e7895e53c7900e7f34 | Python | 2,775 | 82 | from dtiplayground.dmri.common.tools.base import ExternalToolWrapper
class DTITractStat(ExternalToolWrapper):
def __init__(self,binary_path= None, **kwargs):
super().__init__(binary_path, **kwargs)
self.binary_path=None
if binary_path is not None:
self.binary_path=binary_path
... |
7b46bed217b97e5f69f17edd80b38319d18207709bd0cb7ccef8a11079ff5fbe | Python | 2,775 | 86 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" This script will harmonize a json file by adding missing keys and values
that differs between the different layers of the dictionary.
This is used only (for now) in Aggregate_All_* portion of tractometry-flow,
to counter the problem of missing bundles/metrics/lesions ... |
65d1e577d9ec5dd58b8f21cb81b64d5cc45d62df0a661c18e6a55739faa6ec91 | Python | 2,776 | 70 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import torch
from typing import List
def masks_to_boxes(masks: torch.Tensor, obj_ids: List[int]):
with torch.autograd.profiler.record_function("perflib: masks_to_boxes"):
# Sanity check based on callsite for replacement
asse... |
89f4c8fa7c407eefed839ca766da39e03c8df7790fec3ed61311854ea917807f | Python | 2,776 | 61 | """A module that contains unit tests for the :py:mod:`corelay.base` module."""
import pytest
from corelay.base import Param
class TestParam:
"""Contains unit tests for the :py:class:`~corelay.base.Param` class."""
@staticmethod
def test_instantiation() -> None:
"""Tests that the :py:class:`~cor... |
68dfb7c3d604b009fb62a314c9d11a672c966b67b2fc7db77fc94b94219c907b | Python | 2,777 | 77 | """
This is a legacy schema that is no longer used in the unified pipeline.
"""
import warnings
import datajoint as dj
import pipeline.utils.h5
from pipeline.utils import ROIGrabber
schema = dj.schema('pipeline_rf', locals())
from .. import utils
import numpy as np
import os
try:
import cv2
except:
warnings.... |
9d61424c9ff543d4beecdfc1b663c7eca6556abf0a76f56b9cbb9ace45ffe9ef | Python | 2,777 | 98 | import unittest
import warnings
from unittest.mock import patch
from rscvp.statistic.persistence_agg.main_topo_celltype import TopoCellTypePersistenceAgg
from rscvp.topology.main_cls import ClsTopoOptions
from rscvp.topology.main_cords import RoiCordOptions
from rscvp.topology.main_fov import FOVOptions
from rscvp.top... |
aa87b240879a833cc0c4088c521daa6ca099bbab1f5426400e73c3a674268588 | Python | 2,777 | 76 | """A local directory, presented as a :class:`~meanap.remote.base.RemoteStore`.
Exists so the pipeline has one code path rather than two. The important detail
is that :meth:`LocalStore.fetch` returns the *original* path instead of copying:
a local run must not duplicate gigabytes to satisfy an abstraction, and the
cach... |
71f7b998d608d73841dbcc4d21e2f52523740749eafada23ce5774befd93d6e9 | Python | 2,778 | 82 | #!/usr/bin/env python2.4
"""
Returns all positions of a maf with any pwm score > threshold
The positions are projected onto human coordinates
"""
import sys
from bx import intervals
from bx.align import maf as align_maf
from bx.pwm.pwm_score_maf import MafBlockScorer
from . import position_weight_matrix as pwmx
def... |
857796440ea325cf9317b27a45998fa11ec8b0de076343b37b5a2a807f0521a6 | Python | 2,778 | 85 | from abc import ABC
import requests
import seisbench.util as sbu
from . import MultiWaveformDataset, WaveformBenchmarkDataset
class EQSDenoiserBase(WaveformBenchmarkDataset, ABC):
"""
Base class with the functionality to download the EQSDenoiser datasets. As the original dataset is precompiled on
Zenodo ... |
fe23f76a0a8beeb192055be5f7b1e34e9f10a59c9ab32789e85dacf01f966e3a | Python | 2,778 | 87 | from typing import ClassVar, Literal, TYPE_CHECKING
from argclz import argument, union_type
if TYPE_CHECKING:
from rscvp.util.util_trials import TrialSelection # noqa: F401
__all__ = [
'CrossValidateType',
'ModelOptions',
'trial_cross_validate'
]
TRAIN_TEST_SPLIT_METHOD = Literal['odd', 'even', 'ra... |
fed2d7c3a44cb2afc83524fed44d3f64520851a2818d204e69fe6877fa5724eb | Python | 2,778 | 58 | from brainscore_vision import data_registry, load_stimulus_set
from brainscore_core.supported_data_standards.brainio.s3 import load_assembly_from_s3
from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly
BIBTEX = """@article{allen_massive_2022,
title = {A massive 7T fMRI dataset to... |
e0ca2b49f1cf2baaf540e15f5689e8ab943cd25c0e3db1a9108015e5c8d1e185 | Python | 2,779 | 71 | from __future__ import print_function, absolute_import
import os.path as osp
import glob
import re
from ..utils.data import BaseImageDataset
def _process_dir(dir_path, relabel=False):
img_paths = glob.glob(osp.join(dir_path, '*.jpg'))
pattern = re.compile(r'([-\d]+)_c(\d+)')
pid_container = set()
fo... |
89678f8680e45552f7702a5d7712e3057c363d8a99b62a54882ab0d5bfba9fd6 | Python | 2,780 | 86 | import optuna
import numpy as np
import pandas as pd
import json
import torch
from stg_PopPK.main_utils import objective, get_first_fold
from optuna.trial import TrialState
import argparse
import os
import joblib
from pathlib import Path
ROOT_PATH = Path(__file__).resolve().parent.parent
DATA_PATH = ROOT_PATH / "data... |
ae4c94bcb854dfb317ef88d9aad3f6be7e16229a9e46cccb44e61c5551eabd9c | Python | 2,780 | 66 | import matplotlib.pyplot as plt
import numpy as np
import nems
from nems import Model
from nems.layers import WeightChannels, FiniteImpulseResponse, DoubleExponential, RectifiedLinear
from nems import visualization
from nems.metrics import correlation
# More specific options for our model here. You will
# need Tenso... |
28678da8f3a0943b1b24119a70c583b89c78194b536712afc40415fe50c1224f | Python | 2,781 | 72 | """Make predictions on a dataset using Chemprop models trained on TDC ADMET data."""
from pathlib import Path
import pandas as pd
from tap import tapify
from admet_ai import ADMETModel
from admet_ai.constants import DEFAULT_DRUGBANK_PATH, DEFAULT_MODELS_DIR
from admet_ai.utils import load_and_preprocess_data
def a... |
73cb588867a52cde82306e362b832eef96f6389d616ff05c93f05e7f5e65ee84 | Python | 2,781 | 81 | # -*- coding: utf-8 -*-
# @Author: Jie Yang
# @Date: 2017-11-27 16:53:36
# @Last Modified by: Jie Yang, Contact: jieynlp@gmail.com
# @Last Modified time: 2019-01-09 21:39:10
"""
convert NER/Chunking tag schemes, i.e. BIO->BIOES, BIOES->BIO, IOB->BIO, IOB->BIOES
"""
from __future__ import print_function
i... |
41d181efaf435ba5dce18df957d14aa20163a4d60be0c65c1d204b6813aebd86 | Python | 2,783 | 81 | import numpy as np
import pandas as pd
import pytest
from mcmlnet.utils.load_configs import (
get_split_name,
label_is_organic,
load_config,
load_label_map,
)
class TestLoadConfig:
def test_load_config(self) -> None:
"""Test loading configuration file."""
cfg = load_config()
... |
4db8bf2ed950c8e3443ec3d10be34cd5ebfcc6c795aee853309a8a184b70087c | Python | 2,783 | 77 | from labdatatools.analysis import *
import argparse
class AnalysisWfield(BaseAnalysisPlugin):
def __init__(self,subject,
session = None,
datatypes = [''],
includes = [''],
excludes = default_excludes,
bwlimit = None,
... |
7e6852f68becc5379e90e9f5ee6349ff7cdbff6d096947e914d81a31db9ae518 | Python | 2,784 | 98 | # Kai Sandbrink
# 2023-02-01
# This script samples trajectories across test tau values for the specified models
# %% LIBRARY IMPORTS
import torch
import pandas as pd
import numpy as np
from utils import Config, get_timestamp
from utils_project import load_config_files
from test_case import test
import os, copy, pickl... |
c136bf4aba349a9eed17e4ce402818cee50cf0e5538ddfef6848113b76af74fc | Python | 2,785 | 83 | # Copyright (C) 2020-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import os
import cv2
import numpy as np
from model_loader import ModelLoader
from shared import to_cvat_mask
from skimage.measure import approximate_polygon, find_contours
MASK_THRESHOLD = 0.5
# Ref: htt... |
ce079f41be19a25857607275336073703a3fa116c66472821a1f6f53472a6023 | Python | 2,785 | 89 | # -*- coding: utf-8 -*-
import logging
import os
import sys
log_console = logging.StreamHandler(sys.stderr)
default_logger = logging.getLogger(__name__)
default_logger.setLevel(logging.DEBUG)
def setLogLevel(log_level):
default_logger.setLevel(log_level)
check_paddle_install = {'is_paddle_installed': False}
t... |
d6374319f0117a48ca291b6bfe63120fd089e97d09705ca5075a0a67fa3d13be | Python | 2,785 | 89 | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import os
import sys
import glob
from subprocess import Popen, PIPE
def run_autofp_on_pcr(pcr_path):
print("\nProcessing PCR file: {}".format(pcr_path))
curr_dir = os.getcwd()
pcr_abs_path = os.path.abspath(pcr_path)
autofp_dir = os.path.absp... |
993df8a7a33b3b7c9221b9361e88bd28c72bd11804b39a5e4f6c2ddd3c1b5f0c | Python | 2,787 | 109 | import torch
from PIL import Image
import numpy as np
from torch.utils.data import Dataset
import os
from torchvision import transforms
import pandas as pd
import rdkit
from rdkit import Chem
from rdkit import DataStructs
from rdkit.Chem.Descriptors import MolWt, ExactMolWt
import decimal
from numpy.linalg import norm
... |
c075f54014783862370c47ddb1e649f29030f78b90724faba6ebd5bd499a1e14 | Python | 2,787 | 83 | #!/usr/bin/env python3
# -*- coding: utf-8
"""
Script that runs Stereoscope on simulated data.
Created on 2020/02/03
@author romain_lopez
"""
import os
import click
import numpy as np
import scanpy as sc
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import anndata
import scvi
from scvi.e... |
ce83ec6fb0c441f98e42af239f1e8fb97996a56ad29ecb3a41448e6fd90b1ef3 | Python | 2,787 | 96 | from __future__ import annotations
import pytest
from PySide6 import QtGui
from PySide6.QtCore import Qt
from pytestqt.qtbot import QtBot
from labelme._widgets._unique_label_qlist_widget import UniqueLabelQListWidget
@pytest.fixture()
def widget(*, qtbot: QtBot) -> UniqueLabelQListWidget:
widget = UniqueLabelQL... |
8ba715df7c86bc22c37529e24d5158289bf53cb15192557d048218a6746a59a0 | Python | 2,788 | 82 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
"""Create an annotation task from images that already live in a registered
cloud storage.
Steps:
1. Create a task whose data is a list of object keys in the bucket.
2. Print the result.
3. Optionally delete it (--cleanup).
Register a bucket f... |
67fc27676fcf038f5536a544e8777f9e75aa165d3c4b95328ba842448960c170 | Python | 2,789 | 71 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import unittest
from pathlib import Path
from rest_framework import serializers
from cvat.apps.engine.serializers import CanonicalRelativePathValidator
from cvat.utils.paths import join_untrusted_path
class TestCanonicalRelativePathValidator(unit... |
b32e4a6102680f16d1bfe3ec2405d0ccf14c35caabbdd2858885b1a15a01194b | Python | 2,789 | 85 | # dataset settings
dataset_type = 'KITTIDataset'
data_root = 'data/kitti'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
crop_size= (352, 704)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='DepthLoadAnnotations'),
dict(type='LoadKITTICamIntr... |
1bbb4e64019bade0efc1f7e55bc9a255c3a1948fc0a677ca6d47e9a2c5afe3ac | Python | 2,790 | 67 | import os
import numpy as np
from pcntoolkit.util.utils import create_design_matrix
from pcntoolkit.normative import estimate
def fit_nm(df_features_tr, df_covariates_tr, df_features_te, df_covariates_te, params,
sites_tr=None, sites_te=None, suffix='estimate'):
""" Fit the normative modeling and save ... |
3c5403400c0bd1dfb3c8a072a2dc65a58831d069771bf946e63e2fc9d4f87715 | Python | 2,790 | 88 | # create_ml_inputs_from_config.py
import os
import sys
import re
def create_ml_inputs_files(count, base_file_path):
try:
with open(base_file_path, 'r') as f:
content = f.readlines()
model_line_idx = None
base_model_name = None
for i, line in enumerate(c... |
72f9f95e0d919e655bc61d85f8376241a0883d8fb84a3c8325cc9cf20099a2ce | Python | 2,790 | 45 | import torch
from torch_geometric.loader import NeighborLoader
from torch_geometric.data import Data, HeteroData
import sys
sys.path.append("..")
from utils.dataset import hetero_graph_vectorize, homo_graph_vectorize, homo_graph_vectorize_only_user, df_to_mask
def generate_homo_graph_loader_only_user(num_layers, num_n... |
b5eafba608f734d97774891507757e7120cb9683a57dea6dff48ea9d523c7047 | Python | 2,790 | 85 | # Copyright 2024 BDP Ecosystem Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
4cc1e9648b06af1d0523051b682a1e4847e14fb38a0b1d16d20ed417b05e675b | Python | 2,791 | 71 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 8 16:06:50 2023
@author: axthi
"""
# This example performs the main steps that are normally done inside smu.run
# Hopefully useful for debugging and development...
import sys
# NOTE: update this path to fit to your installation
path_to_utils = 'C:/Users/axthi/simnibsN/... |
61aa5442c1d5cbe830620720e6de9ed750f313a51c319d9826f0c583d27625bc | Python | 2,791 | 91 | import os
import numpy as np
import pandas as pd
from sklearn.linear_model import RidgeCV
import scipy.io as sio
splits_dir = r"/cbica/home/lihon/comp_space/ABCD_comp/dl_prediction/data_cog_pnc_cv"
# 5-fold cross-validation
data_id = ["fold0", "fold1", "fold2", "fold3", "fold4"]
data_dir = r"/cbica/home/lihon/comp_... |
ec9ee9a851e08b17e164743bc2f6ddbae7bc9a549d7c0a00ad17cff22e68d566 | Python | 2,791 | 106 | import sys
sys.path.append('../')
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR
from torch.nn import Linear, ReLU, CrossEntropyLoss, Sequential, Conv2d, MaxPool2d, Module, Softmax, BatchNorm2d, \
Dropout
from torch.optim i... |
ed33660fafa0365ee4741fb045841a47c4e1662ca297a14dfc40f34500f3e20d | Python | 2,791 | 63 | from typing import Any, List, Optional
import numpy as np
class StandardScaler:
"""A :class:`StandardScaler` normalizes the features of a dataset.
When it is fit on a dataset, the :class:`StandardScaler` learns the mean and standard deviation across the 0th axis.
When transforming a dataset, the :class:... |
0d77ecc400bc5e165d03ac9934c7b8291de1b89d262e903d5c92ef6de4678e51 | Python | 2,792 | 84 | import argparse
import numpy as np
import os
import yaml
from argparse import Namespace
from faster_bootstrap import get_dataset, seg_results, gen_results, statistics, save_as_csv
def get_args():
parser = argparse.ArgumentParser("argument for bootstrap")
parser.add_argument("--model", "-m", type=str, default=... |
1971ba51e1d0502f5483cb1a50954ae96034759c5431b7d8e837bcdfb57fcc07 | Python | 2,792 | 65 | import os
import importlib
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
import scipy.stats
import analyze_bhv as ab
importlib.reload(ab)
import train_enc_dec as ted
importlib.reload(ted)
plt.rcParams['font.family'] = 'Helvetica'
plt.rcParams['text.usetex'] = True
plt.rcParams['font.size'] = 2... |
2849ad50f8a5be755206e700daa69cb8e0872c46f13cef10619b54f5955ce25b | Python | 2,792 | 67 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import requests
import torch
import torch.nn as nn
import numpy as np
import yaml
from io import BytesIO
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activati... |
38b7b4900b1862224b76580dc096132035f9de5835b765ff4c24dac0fb5c5360 | Python | 2,793 | 71 | from typing import List, Optional, Union
import torch
from torch import Tensor
import torch_geometric.typing
from torch_geometric.utils.repeat import repeat
if torch_geometric.typing.WITH_TORCH_CLUSTER:
from torch_cluster import grid_cluster
else:
grid_cluster = None
def voxel_grid(
pos: Tensor,
si... |
48bff77eeaf3767679c08606343bdaac9ec605663538ce730ac54dd6798ae221 | Python | 2,793 | 89 | import os
from abc import abstractmethod
from auxiliary.turbopath import turbopath
import shutil
class RegistratorBase:
@abstractmethod
def get_registrator(self):
pass
@abstractmethod
def get_method_and_extension(self):
pass
def setUp(self):
self.registrator = self.get_r... |
2b6151314524a1225e2a65db1432030473d146cc8cd118f881e452d0820eedb5 | Python | 2,794 | 89 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
from typing import ClassVar
from django.conf import settings
from rest_framework import serializers
from cvat.apps.engine.models import (
DimensionType,
Project,
RequestTarget,
Task,
)
from cvat.a... |
9595f7075f7918ca61b90fd0378543bc78204d8c8f8ed5a021680847419d057d | Python | 2,794 | 51 | #!/usr/local/bin/python3
from pipeline import experiment, meso, fuse, pupil, treadmill, stack
from stimulus import stimulus
import time
import logging
import datajoint as dj
## database logging
logging.basicConfig(level=logging.ERROR)
logging.getLogger('datajoint.connection').setLevel(logging.DEBUG)
if hasattr(dj.con... |
b7e5d4ce5bf2c580335e01b05506bf715a23c55d670ccb8b71834e51e2a472fc | Python | 2,794 | 91 | import collections
import numpy as np
import polars as pl
from argclz import AbstractParser
from neuralib.plot import plot_figure
from neuralib.typing import PathLike
from neuralib.util.verbose import print_load
from rscvp.util.cli import CommonOptions, TreadmillOptions
from stimpyp import Session
__all__ = ['Sessio... |
44f0394665ca32c027f1a2285960feec1d2fb6475fd0cdbd25dfa8223ad7892e | Python | 2,795 | 86 | import mne
import os
import numpy as np
import pandas as pd
# ---------
# Constants
# ---------
T = 6498 # (ms)
LFP_COLS = [f"LFP_{k}" for k in range(T)]
POWER_COLS = [f"power_{k}" for k in range(T)]
BURST_COLS = [f"bursts_{k}" for k in range(T)]
CUTOFF = 6300
BASELINE = np.array([400, 600])
FREQ_BANDS = {
"beta":... |
7f913b939a148cdd4db977b008c05d9ce6ed1b1460733ef1133f5a373f05919f | Python | 2,795 | 83 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
import datetime
import shutil as sh
# external inputs
import numpy as np
def surface_flattening(file_ref, file_patch, path_output, cleanup=True):
"""Surface flattening.
Uses the FreeSurfer mris_flatten function to flatten a dense patch ... |
5683e7b32d05eb06939d84b35abc54a584200f086099bc6c9bc4616211014906 | Python | 2,796 | 86 |
"""
Polish manually edited MRI white & gray matter segmentations.
"""
import os
import nibabel as nb
import numpy as np
from scipy.ndimage import morphology, generate_binary_structure
from scipy.ndimage import gaussian_filter
# Set data path
DATADIR = '/Users/sebastiandresbach/data/s1Anfunco/Nifti/derivatives'
# ... |
582869c24fde0f786486b85a1d1fd35e0a10a45c70c649ccdf16732207413338 | Python | 2,797 | 75 | import functools
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
import torch
from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file
from timm.models import create_model
from brainscore_vis... |
cc4ad055de1c5ece385df135ee02f8704ebaf5174d9a46bd1d513b20043235bc | Python | 2,797 | 83 | """
This script comes from scikit-learn:
https://github.com/scikit-learn/scikit-learn/blob/master/doc/sphinxext/github_link.py
"""
from operator import attrgetter
import inspect
import subprocess
import os
import sys
from functools import partial
REVISION_CMD = 'git rev-parse --short HEAD'
def _get_git_revision():
... |
05bbf34ca88bdb19d99a6265a006ec45689c3261f241f17e7c865b3d0e9baa93 | Python | 2,798 | 79 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script simply finds the 3 closest angular neighbors of each direction
(per shell) and compute the voxel-wise correlation.
If the angles or correlations to neighbors are below the shell average (by
args.std_scale x STD) it will flag the volume as a potential outlie... |
21713ab796e8b1aa30de752d66a261249f773bb4f483649024e56cbba7a72aed | Python | 2,798 | 81 | import pytest
import numpy as np
from nems.preprocessing.normalization import minmax, undo_minmax
class TestMinmax:
def test_min_equal_max(self):
# pathological case, just don't want this to throw an error
x = np.zeros(shape=(10,))
y, _, _ = minmax(x)
def test_already_normalized(sel... |
53a18c0b8286bef4dbbe0de30664a0dba14289f5ff9b4d768f64836f5d711c66 | Python | 2,798 | 63 |
import torch
from tqdm import tqdm
import numpy as np
from transformers import pipeline, T5Tokenizer, T5EncoderModel
import os
os.environ['CUDA_VISIBLE_DEVICE'] = '1'
import json
each_user_tweets=json.load(open("src/twibot22_Botrgcn_feature/id_tweet.json",'r'))
pretrained_weights = 't5-small'
tokenizer = T5Tokenizer... |
7b0a31dbff39039f235defbb3fdd73d415467c3b708b91ed821bfc6c60628deb | Python | 2,798 | 63 |
import torch
from tqdm import tqdm
import numpy as np
from transformers import pipeline, T5Tokenizer, T5EncoderModel
import os
os.environ['CUDA_VISIBLE_DEVICE'] = '1'
import json
each_user_tweets=json.load(open("src/twibot22_Botrgcn_feature/id_tweet.json",'r'))
pretrained_weights = 't5-small'
tokenizer = T5Tokenizer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.