sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a8d5220845a3bb64e417eb6896d7ca834b359e8c928973ad9fceb4c4563d5e1d | Python | 4,216 | 115 | import numpy as np
import pandas as pd
import numba
from typing import Optional, Tuple
import logging
import ot
@numba.njit
def euclid_dist(t1: np.ndarray, t2: np.ndarray) -> float:
"""Calculate Euclidean distance between two points."""
sum_sq = 0
for i in range(t1.shape[0]):
sum_sq += (t1[i] - t2... |
94ba79a20268e4a61e51ff8012b29149517b4f165968e26d37efdc15efd7ca6d | Python | 4,217 | 129 | import glob
import os
import nilearn
import scipy
import copy
import itertools
import pandas as pd
from joblib import Parallel, delayed, cpu_count
from scipy import ndimage
from nilearn import plotting
from nilearn.glm.thresholding import threshold_stats_img
import numpy as np
import gc
from nilearn.image import n... |
f95509e8a3b978fc096deb94586330308f83fbd3f159947ffd0ee3f583b7d496 | Python | 4,217 | 103 | import numpy as np
from scipy import stats
from utils import Recorder, Q_nak
from mitochondria import Mito
import matplotlib.pyplot as plt
from figure_properties import *
# This version was used to test the long simulation protocol for 2Hz (let it run after spikes)
dt = 0.01
def generate_spiketrain(rate, duration)... |
ef5255413456154815312782375895bf6eaf2e191ce3933c496694ce30269860 | Python | 4,218 | 145 |
import re
import numpy as np
import fasttext
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import json
from tqdm import tqdm
import os
dataset_name='Twibot-22'
id_include=(np.load(dataset_name+'/id_include.npy',allow_pickle=True))
if not os.path.exists(da... |
6ea397b8a182468125534540553a74551d2f0e16de38b334c16de86e67479cc1 | Python | 4,219 | 144 | import datetime
import logging
import time
from pathlib import Path
from typing import Union
import hydra
import numpy as np
import pandas as pd
from omegaconf import OmegaConf
from .wrappers import AbstractAssociator
logger = logging.getLogger("benchmark")
@hydra.main(version_base=None, config_path="../configs", ... |
6dc98688dde7e606cf186220f4ea0927029d61932c716c44fa5baa868f861f96 | Python | 4,222 | 110 | __author__ = 'Martin Aryee'
# source /apps/lab/aryee/pyenv/versions/venv-2.7.6/bin/activate
# python consolidate.py /data/ngscid-research/testing/CTCTCTACACTGATGG.sorted.fastq tmp.fastq 15 0.9
import HTSeq
import sys
import os
import logging
#fastq_file = '/data/ngscid-research/testing/CTCTCTACACTGATGG.sorted.fastq'... |
929acd1ba7124ecb19a4b9826ba826dbdaee3fbe7bee655f571056a28cddc68f | Python | 4,222 | 126 | """ALCF inference endpoints (Sophia default, Minerva, Metis).
Owns cluster URL selection, ``alcf:`` prefix stripping, and the
``ALCF_ACCESS_TOKEN`` credential. Logic moved verbatim from the previous
``models/alcf_endpoints.py``.
"""
from __future__ import annotations
from chemgraph.models.endpoints.base import (
... |
905908276fd3715f9bfa015c2c2d2c611981a8c1dcb1ec1a59a65531b269381e | Python | 4,223 | 122 | """Tests for the timm 0.4.12 compatibility shim.
The shim exists so MolNexTR and MolScribe can share ChemGraph's environment instead
of each needing their own. These tests cover the parts that do not require the
models themselves: the import paths it restores, and the two functions it
reimplements. Loading MolNexTR or... |
31efe82f521271586918f71bdc0fdf08acfdd90ea6f6e6e518530283c17cbf58 | Python | 4,224 | 143 | import subprocess
from pathlib import Path
import mkdocs_gen_files
import psygnal
from magicgui import widgets
from magicgui.backends import _ipynb, _qtpy
MAKE_IMAGES = True
BACKENDS = {"qt": _qtpy.widgets, "ipynb": _ipynb.widgets}
WIDGETS_PATH = Path("api/widgets")
IMAGES_PATH = Path("images")
WIDGET_PAGE = """
# {... |
78db06d5c7e63600f7d68eb573045d8e4de5b4b357327a1c825e458f2c7e28f3 | Python | 4,224 | 138 | import torch
import torch.nn as nn
import torchvision
import numpy as np
class Squeeze_Excite(nn.Module):
def __init__(self,channel,reduction):
super().__init__()
self.avgpool = nn.AdaptiveAvgPool2d(1)
self.fc = nn.Sequential(
nn.Linear(channel, channel // reduct... |
83cad9be6e8dcbd8e8a4f05f4dc54d0fad3e75f54c1e30e0689bb5f2581f3962 | Python | 4,224 | 143 | """CTF Rest Dataset: TDE-HMM Burst Detection Pipeline.
In this script we train a Time-Delay Embedded Hidden Markov Model (TDE-HMM)
on a single channel (region) of source reconstructed resting-state MEG data.
The examples/toolbox_paper/ctf_rest/get_data.py script can be used
to download the training data.
Functions l... |
0a77f0871d227fdb36b64dd424212a1ad9389eb6f4390e31a35306d8eb1e4fca | Python | 4,226 | 134 | # coding=utf-8
"""
Tests for deepreg/model/backbone/u_net.py
"""
from typing import Tuple
import pytest
import tensorflow as tf
from deepreg.model.backbone.u_net import UNet
class TestUNet:
"""
Test the backbone.u_net.UNet class
"""
@pytest.mark.parametrize(
"depth,encode_num_channels,deco... |
da915dbddda64a01f60ecf3c18e85b7d207f7ffa9034342790c44427531f7092 | Python | 4,226 | 96 | """Register each run to one reference run.
NOTE: Only use this nonlinear step if the linear registration is not good
enough.
NOTE2: Due to whole brain and upsampled data (0.175 mm iso.), executing this
scripts might need around 200 GB of RAM.
"""
import os
import subprocess
import numpy as np
import nibabel as nb
#... |
dcfe3e9552103f95e2f4d6f8bcd0aec298fc05d3975348dae12325fc499cd48e | Python | 4,228 | 157 | #!/usr/bin/env python
"""
Application to convert AXT file to LAV file. Reads an AXT file from standard
input and writes a LAV file to standard out; some statistics are written to
standard error.
usage: %prog primary_spec secondary_spec [--silent] < axt_file > lav_file
Each spec is of the form seq_file[:species_name]... |
0c6934fb5328d0707decac7c23c84836eb21fd5492d1220a8b826d9888804471 | Python | 4,229 | 106 | # Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs (https://arxiv.org/abs/2203.06717)
# Github source: https://github.com/DingXiaoH/RepLKNet-pytorch
# Licensed under The MIT License [see LICENSE for details]
# Based on ConvNeXt, timm, DINO and DeiT code bases
# https://github.com/facebookresearc... |
169d1898896c24ffdbb4ddf8424ee456826e430f6e163a3f708f6caa7fd2e262 | Python | 4,229 | 122 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
"""Some utilities for RLE encoding that doesn't require downloading the masks to the cpu"""
import numpy as np
import torch
from pycocotools import mask as mask_util
@torch.no_grad()
def rle_encode(orig_mask, return_areas=False):
"""Encode... |
625a1c380abfb3ad049bd39478d7bb28fa57ae9d7bcc193af161ac17964b0c0d | Python | 4,229 | 121 | # Copyright (c) OpenMMLab. All rights reserved.
import random
import warnings
import numpy as np
import torch
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import build_optimizer, build_runner
from depth.core import DistEvalHook, EvalHook
from depth.datasets import build_dataloa... |
0c64174ad28d88fa78881bedc7b695a287d67144ae54a107746e5650bda8349b | Python | 4,230 | 113 | import inspect
from dataclasses import fields, is_dataclass
from importlib import import_module
from typing import Any, Dict
from torch_geometric.config_store import (
class_from_dataclass,
dataclass_from_class,
)
from torch_geometric.isinstance import is_torch_instance
class ConfigMixin:
r"""Enables a c... |
3663b4f92b8df9eb954bebbad8d1ac78ffbdc0ecde2c68264d45c40e6b9ad295 | Python | 4,230 | 153 | """FastMCP server exposing general chemistry tools.
The ``run_ase`` tool delegates to :func:`chemgraph.tools.ase_core.run_ase_core`
so that the simulation logic lives in a single place.
"""
from __future__ import annotations
from typing import Literal
from mcp.server.fastmcp import FastMCP
from chemgraph.tools.ase... |
51c46e3320eee4e95c5ea654569ca06eb34c5879c7fa686b0bb610d0cf8e2e22 | Python | 4,230 | 164 | import pytest
from psygnal import EmitLoopError
from magicgui import magic_factory
from magicgui.type_map._magicgui import MagicFactory
from magicgui.widgets import ComboBox, FunctionGui, Slider
def test_magic_factory():
"""Test basic magic_factory behavior."""
@magic_factory(call_button=True)
def facto... |
a8d359661d8ed4f2f29d3c29acc9fcbf4c1637b47c156d57a2490b2d8c0b76a3 | Python | 4,230 | 155 | import nibabel as nb
import numpy as np
from argparse import ArgumentParser
import matplotlib
from matplotlib import pyplot as plt
import os
from math import floor
def dice_roi(input_dir, output_dir, atlas1, atlas2, verbose=True):
"""Calculates the dice coefficient for every ROI combination from atlas1 and atlas2... |
510ab34ff916349cf555a81a428c3cc7610ad6a77376b99bdeed779970424c2d | Python | 4,231 | 105 | # Copyright (c) 2020, Soohwan Kim. 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 applicable la... |
553a49b1788939e294fade63cfb7c699e5bdcf6c20f2fc6b00f7c544e1910285 | Python | 4,232 | 162 | import numpy as np
import SimpleITK as sitk
import torch
import cv2
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import vtk
def make_ax(grid=False):
fig = plt.figure()
ax = plt.axes(projection='3d')
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_zlabel("z")
ax.grid(grid... |
67720c54f8e0a32ccc701215173b58eb24dace59669bcd4cacad642c5574fbc1 | Python | 4,232 | 132 | import json
import csv
import os
import string
import numpy as np
from tqdm import tqdm
dataset_name='Twibot-22'
dataset_path='/data2/whr/czl/TwiBot22-baselines/datasets'+'/'+dataset_name
file0='user.json'
file1='label.csv'
file3='split.csv'
if not os.path.exists(dataset_name):
os.mkdir(dataset_name)
with open(dat... |
abef7fbde1706b3c1202af4db215d135c584fb69f4c0c351df85fa09648360ef | Python | 4,232 | 88 | import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly
import pandas as pd
'''
Experiment Information:
https://arxiv.org/pdf/1706.06969.pdf
- 7 subjects
- 800 trials ... |
e56983487696fd763af2f04b103212d40c9d9ef911fc8572183a48de2d5d3707 | Python | 4,232 | 109 | from snakemake.io import expand
from drop import utils
class ExportCounts:
COUNT_TYPE_MAP = {
"geneCounts": "aberrantExpression",
"splicingCounts": "aberrantSplicing",
}
def __init__(
self,
dict_,
outputRoot,
sampleAnnotation,
ge... |
e1344290d7ad8f9e9c869ad2d350c0a9b70f53858b2d3d29cc56ab59408b9b57 | Python | 4,234 | 131 | import warnings
from pathlib import Path
import nibabel
import numpy as np
import pandas as pd
import scipy
import tqdm
from loguru import logger
from scipy.optimize import OptimizeWarning
def f(t, a, b, c):
return a * t ** (b) * np.exp(-t / c)
@np.errstate(divide="raise", invalid="raise", over="raise")
def cu... |
0250797566ccc0dae8271a119e374e0e680439064867c4787124e1d6cf9a4d33 | Python | 4,235 | 101 | import sys
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from geoseg.models.MixerUnet import reparameterize_model
from geoseg.losses import *
from geoseg.datasets.cvc_clinic import CVC_Dataset
#from geoseg.models.MixerUnet import ConvMixer_UNET_down
from geoseg.m... |
554d0e5ab1b2a2a39e5c1df11718349bcb172ba29452c35fbbdcba262cf8e847 | Python | 4,235 | 89 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/media/lg/disk2/PycharmProjects/ISAT_with_segment_anything/ISAT/ui/shortcut_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.10
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit th... |
45cd65cb02f425ad590cc7398f0c1badda6aa386397f6f1c184184ca9020f6ed | Python | 4,236 | 119 | import random
import biotite
import numpy as np
import torch.utils.data as data
from typing import List
from biotite.structure.residues import get_residues
from biotite.sequence import ProteinSequence
from biotite.structure.io import pdbx, pdb
from biotite.structure import filter_backbone
from biotite.structure import ... |
6dd765982691d6057a8d0505c44e8b58d7b2e97e5300806d14d8146622b51baa | Python | 4,236 | 124 | '''
N2O2
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for N2O2:
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... |
87da182505eb87f831de5410ba143eede2c1509e595701cbb6927c4afdd12a1d | Python | 4,236 | 92 | import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly
import pandas as pd
'''
Experiment Information:
https://arxiv.org/pdf/1706.06969.pdf
- 4 subjects
- 1280 images... |
93b2550676b08950b464fcebb78264afa2eb16ca59c713e85291f563d75f4b3e | Python | 4,237 | 115 | import os
from sys import argv
from pathlib import Path
import time as tm
import pandas as pd
import warnings
warnings.filterwarnings("ignore")
import tensorflow as tf
tf.logging.set_verbosity(0)
import Cell_BLAST as cb
import numpy as np
from numpy import genfromtxt as gft
import rpy2.robjects as robje... |
aadefccb1050db4d0654d8c62ba03f000751349750dc4fc71c0d1e0be2aefc7b | Python | 4,238 | 136 | #!/usr/bin/env python
"""
Base class / functionality for an (illumination) amplitude control device.
Hazen 04/17
"""
from PyQt5 import QtCore
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
class AmplitudeMixin(object):
... |
12ddce270795481c6a19bb364cd85b185d31d5e07ee848caaa71e76caa285cbe | Python | 4,239 | 113 | # -*- coding: utf-8 -*-
"""
Template to run the processing pipeline
"""
#load the parameters:
execfile('/home/mtllab/Programs/ClearMap0.5/ClearMap/Scripts/parameter_file_Ilastik_template.py')
#resampling operations:
#######################
#resampling for the correction of stage movements during the acquisition betw... |
2c8c107fd6a77d2c04236eb5f176717d2a77c2d26ddd7fd8c9db2b33ae744a39 | Python | 4,239 | 128 | import json
import argparse
from chemgraph.tools.ase_tools import run_ase
from chemgraph.tools.cheminformatics_tools import smiles_to_atomsdata, molecule_name_to_smiles
from chemgraph.models.ase_input import ASEInputSchema
import datetime
import subprocess
def get_manual_workflow_result(
reaction: dict,
prop:... |
0642f694bf8db10dbdf407474ff48ab19e068d4134b5fc9040467a596ce85241 | Python | 4,240 | 145 | import torch
import pandas as pd
from datasets import Dataset, DatasetDict, ClassLabel, load_dataset
from transformers import Wav2Vec2ForSequenceClassification, Wav2Vec2FeatureExtractor, TrainingArguments, Trainer
from sklearn.metrics import accuracy_score, roc_auc_score
import numpy as np
import torchaudio
from Straif... |
309a4d9f86d4b17d59f4f7d58a73c8999b6be2b93fab043f076ec1f57af563dd | Python | 4,240 | 138 | # -*- coding: utf-8 -*-
from dipy.io.stateful_tractogram import StatefulTractogram, Space, Origin
import nibabel as nib
import numpy as np
from scilpy.segment.streamlines import streamlines_in_mask, \
filter_grid_roi_both_ends, filter_grid_roi, filter_ellipsoid, filter_cuboid
# Preparing SFT for all tests here.
# ... |
45f1538c534d4f9f32b8f3d8db522f2cdd179f138bfdfc73ab9158718d74c68f | Python | 4,240 | 127 | import json
import argparse
from chemgraph.tools.ase_tools import run_ase
from chemgraph.tools.cheminformatics_tools import smiles_to_atomsdata, molecule_name_to_smiles
from chemgraph.models.ase_input import ASEInputSchema
import datetime
import subprocess
def get_manual_workflow_result(
reaction: dict,
prop:... |
e3b59acfe10ed22b7b9b401e35757aa733ca75431dabda89de55e0279ccba764 | Python | 4,240 | 122 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 16 21:37:18 2023
@author: rl05
Set up MNE-BIDS format and convert dicoms to nift for each subject
"""
# import sys
import os
import os.path as op
from glob import glob
from mne import set_log_level, find_events, pick_events
from mne.io import rea... |
094ad77a8ac69e718dfa379bb2e86e038351897599bbdd94c17391d786ae8462 | Python | 4,241 | 137 | """Types used internally in magicgui."""
from __future__ import annotations
from collections.abc import Callable, Iterable
from enum import Enum, EnumMeta
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, Union
from typing_extensions import TypedDict
if TYPE_CHECKING:
from magicgui.widget... |
d9644467ae8c30a2f610618fbf3c85536ae31f093397ef98123b30b585204197 | Python | 4,242 | 133 | from collections.abc import Sequence
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Union
from eir.data_load.label_setup import (
Labels,
TabularFileInfo,
set_up_train_and_valid_tabular_data,
)
from eir.experiment_io.io_utils import get_run_folder_from_model_pa... |
11956de9c75bab933d8252b279cedb542567f70d26a1fd907557d6ebb0de6d5e | Python | 4,244 | 131 | import argparse
import torch
import torch.nn.functional as F
from ogb.nodeproppred import PygNodePropPredDataset, Evaluator
from logger import Logger
class MLP(torch.nn.Module):
def __init__(self, in_channels, hidden_channels, out_channels, num_layers,
dropout):
super(MLP, self).__init... |
58503960e026f914a5b40c61b57a9702f6519acb3d55fbd86cc5a3db74a33c9b | Python | 4,244 | 131 | import os
import sys
import numpy as np
import nibabel as nib
import argparse
from termcolor import colored
try:
from keras.models import load_model
#from tensorflow.keras.models import load_model
except Exception as e:
print(e)
print('-' * 100)
print(colored("""ERROR: Failed to initialize tensor... |
8a3da2737aef037f0e6278c57996a642577505cb37755bc8a805eba2621ea163 | Python | 4,244 | 113 | '''
Collects data from exemplar task and outputs
it to:
./data/preprocessed/beh/all_mt2.csv
OPTIONS:
None
EXAMPLE USAGE:
python beh_preprocess_mt2.py
'''
import numpy as np
import pandas as pd
import mne, os, sys, copy
import auxiliary as aux
import data, rsa
import gzip, pickle, time
import warnings
im... |
a5db659f80ce721e79fffffd1cf5150515af4b6a380f49012ab0eee96cb4cde7 | Python | 4,245 | 92 | import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly
import pandas as pd
'''
Experiment Information:
https://arxiv.org/pdf/1706.06969.pdf
- 4 subjects
- 1280 images... |
479cba1feca532b37cc18be26459d5e97a6c640ccfc248ea242ddfcbe971244d | Python | 4,246 | 162 | """Functions for DCE processing.
Created 15 October 2021
@authors: Laura Bell
@institution: Barrow Neurological Institute
Translated from jupyter notebook DSCpipeline.ipynb by Michael Thrippleton
Functions:
estimate_delta_R1
signal_to_conc
tofts_model
fit_tofts
"""
import numpy as np
from scipy.opti... |
1e64173d0c46e9ee53f2464fe0133ef72b89df336fac80fc14e3e2266656f966 | Python | 4,247 | 103 | """Parity test (Phase 3): reservoir matrices + shuffle observed trial proportion.
Validates the deterministic outputs against MATLAB:
- FiringRateMatrix / latencyMatrix (Reservoir Computing Metrics/*.mat)
- trialProp_obs (shuffleResults_pattern_1.mat)
The shuffle null itself is RNG-divergent (structural checks onl... |
af4ecfdf0f4a3bd0ffb1073e2892e11486443e4d44ef430e57ddae88fb9055d6 | Python | 4,247 | 105 | from Bio import ExPASy
from Bio import SeqIO
import numpy as np
import matplotlib.pyplot as plt
import csv
from matplotlib.backends.backend_pdf import PdfPages
def main(UPID_list_fname, abundance_fname, cutoff, output_fname):
AA_LETTERS = sorted("ACEDGFIHKMLNQPSRTWVY")
# list all proteins in ecoli by uni... |
7d225bfc644ab8738f22a486b6cb52d067a3e7fe10a72b7dd84dc33674ea489d | Python | 4,248 | 119 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import os
from collections.abc import Callable, Container, Mapping
import torch
import torch.utils.data
import torchvision.datasets
import cvat_sdk.core
import cvat_sdk.models as models
from cvat_sdk.datasets.caching import UpdatePolicy, make_cache... |
dd501ca92bec2b7738e1b82a793fbecfcf698cfba56219b541ad2c1618dcf021 | Python | 4,249 | 114 | import models
import torch
import cv2
import numpy as np
import os
from lib_alban.utils_analyse import load_and_process, load_and_process_exr, load_and_process_illusions
def gamma_corr(im):
im = im/255
im = im**(1/2)
im = (im * 255).astype(np.uint8)
return im
def inv_gamma(im):
im = im/255
im ... |
f2e2ddcf5c460c9afdbba23b2fa1b88638181530f9081d4276b815ff5fa176e8 | Python | 4,249 | 127 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Residual Attention Network module
@author: GM
@edited: CD
"""
import torch.nn as nn
class ResidualNet3D(nn.Module):
def __init__(self, z=1,width_f=1):
super(ResidualNet3D, self).__init__()
# number of output filters from each block
... |
33e1cbd9b1d7e4d7abf61be6612d56e52cd980ae43b01fa44c3852b8d0112579 | Python | 4,250 | 147 | import numpy as np
import pytest
from brainscore_vision import load_stimulus_set, load_dataset
from brainscore_vision.benchmarks.malania2007.benchmark import DATASETS
@pytest.mark.private_access
class TestAssemblies:
# test the number of subjects:
@pytest.mark.parametrize('identifier, num_subjects', [
... |
546d5ed5e23ce054d09e40127a1363e83ff32340b8ef4cc258517033b0fe1dd7 | Python | 4,250 | 152 | import unittest
import warnings
from pathlib import Path
from unittest.mock import patch
from rscvp.model.bayes_decoding.main_decode_analysis import DecodeAnalysisOptions
from rscvp.selection.main_cls_summary import ClsCellTypeOptions
from rscvp.util.cli.cli_sql_view import DatabaseViewOptions
from rscvp.util.io impor... |
883e8080bc7ff04e863e8436922f0e21eec6c68acb8e79a1c907ccd89041b7e8 | Python | 4,251 | 84 |
import numpy as np
import xarray
from marques_utils import gen_sample
from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly
from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly
ASSEMBLY_NAME = 'movshon.Cavanaugh2002a'
SIZE_STIM_NAME = 'Marques2020... |
f471252cd2db21181c3954556c57157ccc1f46c7a63c069115e25d833daa5a64 | Python | 4,251 | 145 | # flake8: noqa
from .base_transform import BaseTransform
from .compose import Compose, ComposeFilters
from .to_device import ToDevice
from .to_sparse_tensor import ToSparseTensor
from .constant import Constant
from .normalize_features import NormalizeFeatures
from .svd_feature_reduction import SVDFeatureReduction
from... |
28fd3f72d701184bcd6df60f28f55e8862ec3edd5b65980997f5dbbfc6427dd3 | Python | 4,252 | 92 | import numpy as np
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly
import pandas as pd
'''
Experiment Information:
https://arxiv.org/pdf/1706.06969.pdf
- 4 subjects
- 1280 images... |
878780f5f4de328c242e7842dd17eb20f8d1b43d1595faed8c07455a331bcd89 | Python | 4,252 | 103 | #############################################################################
# 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... |
f41ffcb90fd03f93aaa2b3852b4489b028e61608eb8c500e5ca677b4d0a0f3af | Python | 4,252 | 118 | import sys
import pkg_resources
import argparse
from pathlib import Path
from subprocess import check_call
import torch
from torchvision.models.vgg import vgg19
from skimage.measure import shannon_entropy
from pytorch_msssim import SSIM, MS_SSIM
from utils import *
from metrics import *
def parse_args():
'''Us... |
37245627a36d0768adec56541558c5de54fc8407955161b4d74a97a42c06fddb | Python | 4,255 | 101 | # 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... |
8f64e61aafbd92d8be47601e765492b722b84590ba8bd07857ed9128e7007eba | Python | 4,255 | 130 | import numpy as np
import pytest
from brainscore_vision import load_stimulus_set, load_dataset
@pytest.mark.private_access
@pytest.mark.parametrize('assembly_identifier', [
'BMD2024.texture_1',
'BMD2024.texture_2',
'BMD2024.dotted_1',
'BMD2024.dotted_2',
])
def test_existence(assembly_identifier):
... |
1f9d50836cc7c094b3848cf5be8befa4f43aae99a6a9ba85161f9145d5affcd6 | Python | 4,257 | 110 | import user_features as uf
import csv
import ijson
import pandas as pd
import time
import sys
import os
def get_user_vector(user):
user_vector = {
"id": uf.get_user_id(user),
"profile_description": uf.has_description(user),
"profile_location": uf.has_location(user),
"profile_url": ... |
f6421290b066d8e1ea9d983def4c390431c8679a73c58faabf67dd6bee34cecf | Python | 4,258 | 125 | '''PNASNet in PyTorch.
Paper: Progressive Neural Architecture Search
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
class SepConv(nn.Module):
'''Separable Convolution.'''
def __init__(self, in_planes, out_planes, kernel_size, stride):
super(SepConv, self).__init__()
se... |
5b5959a0538ee8527f5a1a48b33b11237a65a18b803dc2e8113939f852a06ead | Python | 4,259 | 105 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 17 12:06:44 2023
@author: gligorov
"""
import tensorflow as tf
import numpy as np
from Model import create_model, find_optimal_parameters
from Data_processing import generate_all_permutations, keep_features
from utils import plot_history, show_classification_res... |
8b14d7295434099c1758f7116db3b2135cfed6175dc762292a93b5f808da512c | Python | 4,259 | 170 | #!/usr/bin/env python
import sys
import argparse
import pandas as pd
import numpy as np
import yaml
import csv
import gzip
import logging
from dna3bit import DNA3Bit
from tqdm import tqdm
import hto_gex_mapper
logger = logging.getLogger("combine")
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s... |
75a74ad50e39c0866a92ea4564dfb86e1e081bfb21562e08554645069a42a413 | Python | 4,260 | 103 | # gym Version: 0.26.2
import random
import gym
import numpy as np
import torch
import torch.nn as nn
from agent import Agent
env = gym.make('CartPole-v1', render_mode='human')
s = env.reset()[0]
EPSILON_DECAY = 100000
EPSILON_START = 1.0
EPSILON_END = 0.02
TARGET_UPDATE_FRQUENCY = 10
n_episodes = 5... |
d5ee1bcf367846f855cfde234ced32bf15d8abb0275e7d1074773b9fccd81edf | Python | 4,260 | 109 | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 4 15:52:33 2022
@author: Delinte Nicolas
An example python script using the main methods and outputs of UNRAVEL. A
tractogram of the middle anterior section of the corpus callosum is used as
tractography input.
"""
import os
import numpy as np
import nibabel as nib
im... |
d740dd6f3b817358ecdaaf46f5fcdc3958abf709fb5ba68221dbc25da3da7823 | Python | 4,260 | 118 | import numpy as np
from matplotlib.axes import Axes
from scipy.interpolate import interp1d
from argclz import AbstractParser, argument
from neuralib.locomotion import CircularPosition
from neuralib.plot import plot_figure
from neuralib.util.verbose import publish_annotation
from rscvp.util.cli import TreadmillOptions
... |
c8b32d3864878c79be3ffbdf6d3def588bb64df076d8f813e518237413486994 | Python | 4,261 | 130 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
import numpy as np
import nibabel as nib
from scilpy.io.streamlines import save_tractogram
from dipy.io.stateful_tractogram import StatefulTractogram, Space, Origin
tmp_dir = tempfile.TemporaryDirectory()
def init_data():
streamlines = [[... |
5731e3058d5a5b5c900265806d98279fd720c329c360ee0430440e8e8c9948f2 | Python | 4,262 | 97 | import numpy as np
import brainscore_vision
from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly
from brainscore_vision import load_dataset, load_metric
from brainscore_vision.benchmark_helpers.screen import place_on_screen
from brainscore_vision.benchmarks import BenchmarkBase
fr... |
6a38b542f062f2f1c29b07a3a1b3e38a92af8a38545deb35a1d5dcfccaf30717 | Python | 4,262 | 163 | #!/usr/bin/env python
#
# scan.py executes a given command sequentially or in parallel, in specified directories
#
# Copyright F. Nedelec and S. Dmitrieff; 2007--2022
"""
Execute specified command in given directories, sequentially or in parallel,
using independent threads.
Syntax:
scan.py command [-][... |
7ba6fdac48cc3a0461b05eb4068dff41764645f9c8f0616908bf7b8d7877e4f7 | Python | 4,262 | 134 | """
Access to files containing sequence data in 'twobit' format.
"""
from collections.abc import Mapping
from struct import (
calcsize,
unpack,
)
from typing import BinaryIO
from . import _twobit # type: ignore[attr-defined]
TWOBIT_MAGIC_NUMBER = 0x1A412743
TWOBIT_MAGIC_NUMBER_SWAP = 0x4327411A
TWOBIT_MAGIC... |
29b6c917188fe55c0bed5ad69f1ebd7b17e92dac36c8d35ed4712f9c8a01a220 | Python | 4,263 | 87 | ##################################################################################################
### Script that averages over trials of Q and MI data, employing 'extractParamsQMIfromSpikes.py' #
##################################################################################################
### Copyright 2023 Jan... |
846a9e25a3422d0586cb8cd206d82badc6a104a99ba03842822993fac739d329 | Python | 4,263 | 131 | import h5py
import os
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Rectangle
DIR = os.path.dirname(os.path.realpath(__file__))
HOME_DIR = DIR.rsplit('/', 1)[0]
HOME_DIR = HOME_DIR.rsplit('/', 1)[0]
print('> HOME: ', HOME_DIR)
DATA_DIR = HOME_DIR + '/data/'
print('> DATA: ', DAT... |
d452ea0ac9b260ceb8b0311bdfb4733b9f837f9df38e08831685d03fc93b1b49 | Python | 4,264 | 136 | # This script will import Cytosim's filaments into Blender
# It must be run from within Blender, and will read "actin####.txt" files
# to generate a collection of Icosahedral-meshes
#
# The input files should be generated by Cytosim's tool "cymart"
# and copied to a local blender directory called 'cymart'
#
# Authors: ... |
48ee5b9114f0397dd2abb23ffbcf605332b85a3f6369ea5ce0315f559c95520e | Python | 4,265 | 105 | # -*- coding: utf-8 -*-
"""
Bold correction of VASO data
This scripts corrects a vaso time series for bold contamination. First, both
time series are upsampled and the vaso time series is shifted by one time step.
BOLD correction is performed by dividing both time series. In the end,
unrealistic vaso values are remove... |
84e4584e3b9d7f4c3b1a5caebde1f1a08f4f35b96423e4044bb5ee7b8921929e | Python | 4,265 | 120 | import os, glob, datetime
import numpy as np
from scipy.stats import mode
import mne
from tqdm import tqdm
import matplotlib.pyplot as plt
data_paths = glob.glob('asdtdegidata-edf/ASD/*.edf') + glob.glob('asdtdegidata-edf/TD/*.edf')
result_dir = 'artifacts'
os.makedirs(result_dir, exist_ok=True)
result_dir_asd = os.... |
bf9a66b8c79257946f5bcbab9e0040dfa68433a79c0c5e05da62e08dc01771ec | Python | 4,266 | 107 | from src.wrappers.OsipiBase import OsipiBase
import warnings
import numpy as np
import matlab.engine
class OJ_GU_segMATLAB(OsipiBase):
"""
Bi-exponential fitting algorithm by Oscar Jalnefjord, University of Gothenburg
"""
# I'm thinking that we define default attributes for each submission like this
... |
fa97d50a19da3de7543aaa99c934d0e6144b84edf898bdd9d71e6849c6076758 | Python | 4,266 | 131 | # src/utils/post_rules.py
"""
医疗结果后处理规则库
====================
对模型原始输出(pred_class, pred_reg)应用临床规则:
1. 双眼对称:如果一侧手术被预测,且对侧未被预测,则镜像对侧预测,并同步剂量。
2. R&R 互斥:在同一只眼上,内直肌“缩短”(s)与“后徙”(c)术式不可同时单独出现;
若两者皆被预测,则保留剂量更大的术式,另一术式清零。
3. 同步回归:任何被清零的分类标签,其对应的回归剂量也应置 0。
接口
----
apply_rules(pred_class, pred_reg) -> (adj_cl... |
2f3a3e1257ba0b77d2895a40932b5e778c64e052294525b7df1e0d3b8f306510 | Python | 4,267 | 249 | import numpy as np
from impedancefitter.double_shell import double_shell_model, eps_cell_double_shell
from impedancefitter.double_shell_ellipsoid import (
double_shell_ellipsoid_model,
eps_cell_double_shell_ellipsoid,
)
# for double_shell_model
c0 = 1.0
em = 10.0
km = 1e-6
kcp = 0.5
ecp = 60
kmed = 0.1
eme... |
c40882dbc0206b6a808719463965d814674fd49ea046567bdf9a5daa73cb9ab7 | Python | 4,268 | 137 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
from matplotlib.ticker import LogLocator, NullFormatter
plt.rcParams.update({
'font.family': 'sans-serif',
'font.sans-serif': 'Arial',
'xtick.labelsize': 6... |
ff693ba9e95f997d4378462ade8b442cdb7e39828d2d03e56af09668401f8eb0 | Python | 4,268 | 113 | import h5py
import os
import numpy as np
from tqdm import tqdm
import torch
from torch_geometric.data import InMemoryDataset
from mlcg.utils import download_url
from mlcg.data import AtomicData
class AQMBASEDataset(InMemoryDataset):
"""General base extractor for the AQM dataset described in https://doi.org/10.10... |
adcbc6ed120ef477f1f5314c7a44dea42c8dc9ea3e63a437f266b352ae3d32dd | Python | 4,269 | 109 | from typing import List, Optional
from brainglobe_atlasapi.structure_class import StructuresDict
from qtpy.QtCore import QModelIndex, QSortFilterProxyModel, Qt
from qtpy.QtWidgets import (
QAbstractItemView,
QDialog,
QDialogButtonBox,
QLineEdit,
QTreeView,
QVBoxLayout,
QWidget,
)
from brai... |
b57e03a6f0d82bdd3a9ead9eb3429dfe223a609ff02bcfac78a7b59aaef5d474 | Python | 4,269 | 119 | '''
F2H
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for F2H:
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 g... |
66b41b3fcdd487df563c5d34ddd1eb4bb93d6d14a2821a3e1b34063a45cfbc92 | Python | 4,271 | 138 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 13 21:23:50 2023
@author: jstout
"""
import pandas as pd
import MEGnet
from os import path as op
import os
import glob
from scipy.io import loadmat
import numpy as np
import copy
import pickle
from MEGnet.megnet_utilities import fGetStartTimesOver... |
6c22e0df55c1173dbde4e4d58cb38f5e70916e3cf679e057558405c6071280ba | Python | 4,272 | 111 | import torch
import torch.nn as nn
import torch.nn.functional as F
class SegNet3D(nn.Module):
def __init__(self, input_channels, num_classes):
super(SegNet3D, self).__init__()
# Encoder layers
self.enc1 = nn.Sequential(
nn.Conv3d(input_channels, 64, kernel_size=3, padding=1),
... |
9d78fccba1f27135481682ad5b95fd44cf179d15ad6bb2f00757d3a7c705aed0 | Python | 4,273 | 135 | from inspect import Parameter, signature
from pathlib import Path
import numpy as np
from brainglobe_atlasapi import BrainGlobeAtlas
from brainglobe_atlasapi.core import Atlas
from brainglobe_atlasapi.list_atlases import get_all_atlases_lastversions
from brainglobe_atlasapi.structure_class import StructuresDict
from b... |
de7da344356504c4d0e105aad31343c1707daeb5a886572755c3af02594e84a8 | Python | 4,273 | 123 | import sys
import yaml
import os
import h5py
import pandas as pd
from scipy.stats import scoreatpercentile as sap
import numpy as np
reftag = '__all'
pathpath = 'PATHS/filepaths_carlen.yml'
runset = 'wwresp'
#runset = 'wwspont'
if runset == 'wwspont':
spec = 'dur3'
tsel = 'prestim'
timeselsubfolder = 'ti... |
e8a03f03a6eafb4c17fe1593e96950b521d7ba5568fe23d41ae711235f955f66 | Python | 4,273 | 99 | import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import pandas as pd
from sklearn.model_selection import train_test_split
from utils.fingerprint import Fingerprint
from utils.chem import gen_standardize_smiles, get_skeleton
from utils.cluster import Mol_Encoder, unsupervised_clusterin... |
e10c9555baa57925a947f89fe7102404e990ec287295a296c8a642f09b898174 | Python | 4,275 | 122 | #!/usr/bin/env python3
"""
data_load.py
------------
Load custom PyG graphs (.pt) from a directory and create 5-fold splits.
- Only supports 5-fold CV (as per paper).
- No TU datasets.
- No hardcoded paths.
Returns:
splits: List[Tuple[Subset, Subset, List[Data]]]
Each item is (train_set, val_set, test_set)... |
193ab8d54b2b97a8060849564364981f8bfce2839df2cd89f8dd949474a0823f | Python | 4,276 | 91 | import typing
from collections.abc import Mapping, Sequence
from concurrent.futures import Future
from magicgui._util import safe_issubclass
class TestSafeIsSubclass:
def test_basic(self):
assert safe_issubclass(int, int)
assert safe_issubclass(int, object)
def test_generic_base(self):
... |
dbfe87fabd7e70fafb5a87a3c2c107f2318b298cdbaf0aa8bab7abd6e06eec3b | Python | 4,276 | 151 | from email.policy import default
import json
from tqdm import tqdm
import numpy as np
import os
import numpy as np
dataset_name='Twibot-22'
dataset_path=dataset_name+'/'
if not os.path.exists(dataset_name):
os.mkdir(dataset_name)
def Lev_distance(A,B):
#A = "fafasa"
#B = "faftreassa"
dp = np.arra... |
e292e38f022e0b252d2ab600c1f1c5432c98e821f384b97c1d4321d1334631ab | Python | 4,276 | 70 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'qt_valve.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_QtValveControlWidget(object):
def setupUi(self, QtValveControlWidget)... |
bf0b708be5fb9bb29b396f9a98bb71f7ca00915ee616dfbf3dfef50be3dc20bd | Python | 4,278 | 135 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
from collections.abc import Callable, Mapping
from . import models
class _CheckboxAttributeValueValidator:
def __init__(self, values: list[str]) -> None:
pass
def __call__(self, value: str) -> b... |
4de43e0faa31f9f1d3661be9e47512ec0dff23589b0e887c9c74685c320275cc | Python | 4,279 | 115 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import datetime
import json
from rest_framework import serializers
from .const import USER_ACTIVITY_SCOPE
class EventSerializer(serializers.Serializer):
scope = serializers.CharField(required=True)
obj_name = serializers.CharField(require... |
99a37187ae0195940841445912d7e85b1213764c0a13fc9e8f35f4dcd35ac920 | Python | 4,279 | 118 | import torch
import re
import my_setup
from data_processing.tokenization import MASK_TOKEN
def prepare_sequence(seq):
if my_setup.EXTRACT_RANDOMISATION:
new_seq = seq if len(seq) <= 14 else extract_randomisation(seq)
elif my_setup.EXTRACT_CONSTRUCT:
new_seq = seq if len(seq) <= 70 else extrac... |
1b733102acf2554a4a55aa91de665920323027bf30d2124e521c757ab8e3f9dd | Python | 4,280 | 120 | import pandas as pd
import numpy as np
import starfile as sf
from scipy import spatial
from sys import argv
from glob import glob
import subprocess
from pycurv import TriangleGraph, io
from graph_tool import load_graph
PATCHSIZE = 7.5
# PATCHTYPE = "high"
NPATCHES = 50
PIXSIZE = 6.65
def get_patches(csv, patchsize... |
b8f1183a3c2852788bb4c84630316866040c7cf9f48523bbf102ff9afdadfb9e | Python | 4,280 | 120 | import sys
import cebra
import os
import tempfile
import torch
import pandas as pd
import numpy as np
import pickle as pkl
import matplotlib
import cebra.models
import cebra.models
import cebra.data
from cebra.models.model import _OffsetModel, ConvolutionalModelMixin
from torch import nn
from scipy import stats
from ce... |
ca9721b9c176217e2b17e3c190890357b66be552cee47a31bd9d99e79933f885 | Python | 4,280 | 124 | # Generated by Django 4.2.21 on 2025-07-07 09:30
import django.db.models.deletion
from django.db import connection, migrations, models
from django.db.models import F, OuterRef, Subquery
def set_attributeval_job_id(apps, schema_editor):
LabeledImage = apps.get_model("engine", "LabeledImage")
LabeledShape = ap... |
5361a2b6e6e47324b8d5bb92533c2d8dff381fe09252107299e82d3533816cb1 | Python | 4,282 | 95 | import torch.nn as nn
from torchvision.models.mobilenetv3 import InvertedResidualConfig, InvertedResidual, _mobilenet_v3_conf
from typing import Any, Callable, List, Optional, Sequence
from functools import partial
try:
from torchvision.ops.misc import Conv2dNormActivation as ConvBNActivation
except ImportError:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.