sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c63413f915bc2ecbb5235b72d4534f08c3e573e1f3f8654ffb15b102aec93a2c | Python | 6,530 | 196 | import fcn_megfmri
import numpy as np
import pandas as pd
import scipy.stats as stats
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
# get custom colormaps
cmap_seq, cmap_seq_r, megcmap, megcmap2, categ_cmap = fcn_megfmri.make_colormaps()
plt.rcParams['svg.fonttype'] = 'none'
... |
13e27abdd182b0008a16865145ea98dc1560a6006b5dc6285954a50620e9306e | Python | 6,532 | 210 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from pathlib import Path
from typing import Callable
from zipfile import ZipFile
import pytest
from cvat_sdk import Client
from cvat_sdk.api_client import models
from cvat_sdk.core.proxies.types import Location
from PIL import Image
from rest_api.u... |
3c6fdeadfaea3f2a9f56ebaeebb3cde3d6e4d1fa31a93026f5c747279df100ca | Python | 6,532 | 125 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from collections import deque
from math import sqrt
from typing import Any
from ultralytics.solutions.solutions import BaseSolution, SolutionAnnotator, SolutionResults
from ultralytics.utils.plotting import colors
class SpeedEstimator(BaseSolution)... |
cbf427f9d8e73718e9d4d7c5a2ed5741723fb726454802dfed945c15831268d3 | Python | 6,532 | 138 | """Per-subject assembly loader factories.
The LAION-fMRI release ships ten S3-stored ``.nc`` assemblies: 5 subjects ×
2 stim-pool families (shared 1,492 stim, persubject 6,204 stim incl. OOD).
Rather than
write ten near-identical lambdas in ``__init__.py``, we expose a factory that
takes a subject ID and returns a loa... |
77290484bfa3ab87ca01380146679150e4b2f563b2b6e1fb63085d20b27f9b42 | Python | 6,534 | 153 | """
Read sparse points from a text file.
The sparse points file makes it possible to load individual point data into the 3D space defined
the volume image.
The sparse points file may have one of two formats.
In both cases it's one row per data point.
There is no header that contains information on what the columns... |
bf28ad760389dc47049f12853cf6f5a90c591f9dad81ea0a67d51d85e89b73a9 | Python | 6,536 | 132 | import torch
from collections import OrderedDict
from torch import nn
import torchvision
import numpy as np
from .modules import RetinaBlock, VOneBlock, Identity
from .params import get_tuned_params, generate_gabor_param,\
get_retinal_noise_fano, get_v1_noise_fano, get_v1_k_exc
from .backends import get_resnet,... |
cdec405d583833748ddb636bb993979df1ed399ab3c5d372556d128a63a5440e | Python | 6,536 | 130 | import os
from importlib import import_module
from pathlib import Path
cell_graph_config = {
"cell_f_list": [
'fourier',
10,
False,
[
'area',
'r_equiv',
'r_maj',
'r_min',
'angel',
'ecc',
'maj_x',
... |
d89e1fd12740fc2d39b4022e358556c5825c6262fc0d07a55f0efe85d79fc07d | Python | 6,536 | 204 | import sys
import pandas as pd
import numpy as np
from skimage import io as skio
import getopt
#Usage
def prepare_alignment_image_usage():
print(""""
Usage : SEAM.py prepare_alignment_image -m <mask.txt>
-o <output.png>
-t <celltype.csv>
Sample... |
e5fe1d24983fc8e36c1cd9e9630a2f8e8352a642b105858e641bbd5400189a47 | Python | 6,538 | 161 | import os, sys
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import numpy as np
from scipy import ndimage
import unet.utils as utils
import unet.models as models
from unet.crf import dense_crf_inference
from unet.utils import parse_args_unet_predict, print_no_newline
def unet_predict(output_path,
lowb_file,
... |
f9072c27615310d31816f09b0b0b44443126630739096e6b84173dcbfc81922d | Python | 6,538 | 187 | from collections.abc import Sequence
from copy import deepcopy
from pathlib import Path
import aislib.misc_utils
import yaml
from eir.experiment_io.io_utils import strip_config
from eir.models.input.sequence.transformer_models import (
BasicTransformerFeatureExtractorModelConfig,
)
from eir.setup.config import (
... |
e0ab9a20a22f8b1c552138f9a45b1ee6e2e4573c67b3e6b3d5e6668f274bc076 | Python | 6,539 | 130 | import os
from importlib import import_module
from pathlib import Path
cell_graph_config = {
"cell_f_list": [
'fourier',
10,
False,
[
'area',
'r_equiv',
'r_maj',
'r_min',
'angel',
'ecc',
'maj_x',
... |
58f4addcd0b6697b5025d42faeb452321190f986fceff40f5a404089360eee02 | Python | 6,540 | 160 | # A script to visualize the ERF.
# 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]
# -----------------------------------------------------... |
9f0ad78d263c113672aec34e2fc4155757a291c4062a9297a86ce79800958bf8 | Python | 6,540 | 150 | '''
BrHCl
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for BrHCl:
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... |
77b6a1aa538a5591c4b6165f99feed1b53d29787e7b9db733482c7cdf5122b6a | Python | 6,541 | 165 | # 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 th... |
7cbc514ab8398b656bbd159c2ad2c4da3f62df446c74b18202b0aa7fcb057875 | Python | 6,541 | 169 | from collections import defaultdict
from itertools import groupby, product
import os
import numpy as np
import pandas as pd
from scipy.stats import linregress
from tqdm import tqdm
import mne
import lunapi as lp
proj = lp.proj()
proj.silence()
def get_spindle_so(luna_db_paths, ch_names, Fs):
"""
... |
ce68d5cea2518e26a2eb94f31ce7a8c0f00365bfc074e7bd36285105c83affae | Python | 6,541 | 196 | from __future__ import annotations
from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from .aihwkit_backend import AnalogConfig, make_inference_rpu_config, analog_conv2d_from_digital, analog_linear_from_digital, maybe_mo... |
dcc9d53c0bcb23ba0393ccb44438f157df658426c0209ad68a88fd7aa6bbbdd1 | Python | 6,541 | 196 | # Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from attr.converters import to_bool
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import transaction
from rest_framework import serializers
from cvat.apps.e... |
4a8e3458834dae284993e307221d35dcb19dc78df8ea8613669da34c2034a999 | Python | 6,543 | 200 | import os
import sys
from nipype.interfaces import niftyreg
node = niftyreg.RegF3D()
node.inputs.ref_file = os.path.abspath(sys.argv[1])
node.inputs.flo_file = os.path.abspath(sys.argv[2])
ouptut_res_file_path = os.path.abspath(sys.argv[3])
node.inputs.res_file = ouptut_res_file_path
output_cpp_file_path = ouptut_res_... |
d90bf0e3f05043d81bc67b0d5fbb9fc539b173142e90715856b954a5f297cfa0 | Python | 6,543 | 167 | #!python
import sys
import os
import traceback
import shutil
import socket
from pathlib import Path
import argparse
from argparse import RawTextHelpFormatter
import yaml
sys.path.append(Path(__file__).resolve().parent.parent.__str__()) ## this line is for development
import dtiplayground
import dtiplayground.dmri.co... |
14abb04d5940280007c5978acf1babec230166896c2f1e39bd5820b0bf9e67dc | Python | 6,544 | 181 | import argparse
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from ogb.linkproppred import PygLinkPropPredDataset, Evaluator
from logger import Logger
class LinkPredictor(torch.nn.Module):
def __init__(self, in_channels, hidden_channels, out_channels, num_layers,
... |
94e1b1940b35d2bf7ce82e05a31430cb19aeb42986f8f2a21a120d5123f6a88f | Python | 6,545 | 171 | import warnings
from typing import Dict, List, Optional
import torch
from torch import Tensor
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.nn.module_dict import ModuleDict
from torch_geometric.typing import EdgeType, NodeType
from torch_geometric.utils.hetero import check_add_self_loops
d... |
3e4b10ffd44fcca875f37e6198be122278ca107a2cd54d7bfd102a37ce9fdcb0 | Python | 6,546 | 177 | # =====================================================================
# Title: SalsaStage.py
# Description:
#
# Date: 02.01.2023
#
# =====================================================================
#
# Copyright (C) 2020 ETH Zurich and University of Bologna.
#
# Author: Victor Jung, E... |
a6c6a813502a3bff12cb798ab9d54e73a1fef8d6004cd05f276f5ce60125a310 | Python | 6,547 | 187 | import warnings
from pathlib import Path
import torch.nn
from abc import abstractmethod
from typing import Union, List
import flair
from flair.data import DataPoint
from flair.datasets import DataLoader
from flair.training_utils import Result
class Model(torch.nn.Module):
"""Abstract base class for all downst... |
0cafaf5751246909250f1d1af85ce23e774f88b3048fa3f0f81477af60bee0b9 | Python | 6,548 | 182 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
import shutil
import sys
import warnings
from setuptools import find_packages, setup
def readme():
with open('README.md', encoding='utf-8') as f:
content = f.read()
return content
version_file = 'depth/version.py'
def ... |
54855ce17a0fa144e56deed5118d93e3d8fc1d6980e882f14c2d3e8ee635f9f1 | Python | 6,548 | 189 |
from __future__ import division
import numpy.ma as ma
import numpy as np
import scipy as s
import scipy.special as special
# Import manually defined functions
from .variational_nodes import Constant_Variational_Node, Beta_Unobserved_Variational_Node
class ThetaW_Node(Beta_Unobserved_Variational_Node):
"""
Th... |
eb68be5fb64c9811be3ae201a68143075cf8086278f2b6113bf9ad41bb9bb537 | Python | 6,548 | 179 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import numpy as np
import torch
from transformers import AutoFeatureExtractor, CvtForImageClassification, CLIPVisionModel, CLIPProcessor, CLIPModel
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
fr... |
1dfada678d974e6a2641dc14093fef4a98d3c64b23dff1d5e375b1a776c9e4e1 | Python | 6,549 | 200 | import torch
import scanpy as sc
import numpy as np
from tqdm.auto import tqdm
from torch_geometric.utils import negative_sampling
from scale.model import GNN
from scale.utils import (
preprocess,
spatial_graph,
GraphAggregation,
seed_everything,
)
from scale.config import Config
def train(adata, cf... |
e6a6dd4a04667324f19ff20ba83fdb30560259b0e7e28376efa4a03153c1e71d | Python | 6,550 | 159 | import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt
import glob
import sys
import os
import re
import json
plt.rcParams["font.sans-serif"] = ["DejaVu Sans"] # Best available
plt.rcParams["font.family"] = "sans-serif"
plt.rcParams.update({
"font.size": 10,
"axes.titlesize": 10,
"axes.l... |
6f610ae20b94e8d7007df6848394ce307ad6cc81e0885cf734c08a24a9b2e4c3 | Python | 6,551 | 182 | import numpy as np
import os.path
import pandas as pd
import torch
from fuse.data import PipelineDefault, OpToTensor
from fuse.data.datasets.caching.samples_cacher import SamplesCacher
from fuse.data.datasets.dataset_default import DatasetDefault
from fuse.data.ops.op_base import OpBase
from fuse.data.ops.ops_aug_commo... |
39c275beeff91bd581381905166666d342efce9f864acf8ddee4542aec41108e | Python | 6,553 | 160 | import torch
import torch.nn.functional as F
from pykeops.torch import LazyTensor
# -------------------------------------------------------------------------------------------------------------------------------------
# Following code adapted from dMaSIF (https://github.com/FreyrS/dMaSIF):
# -------------------------... |
770e2997bc5c7463d7718ddc8694b969376b66788c242a364aa9cee70d418de4 | Python | 6,553 | 271 | import torch
import numpy as np
import pandas as pd
from datetime import datetime as dt
from dataset import fast_merge,df_to_mask
from tqdm import tqdm
dataset_names = [
'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-2017... |
1b59dc84e12c0c597a68881c8e9a857850d8ebc18c42f2975b74d2a494f2c504 | Python | 6,554 | 174 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compose a mosaic of screenshots of the given image volume slices along the
requested axis. The provided transparency mask (e.g. a brain mask volume) is
used to set the screenshot values outside the mask non-zero values to full
transparency. Additionally, if a labelmap ... |
aad02bc116f716185509cce9d3b05875b77c95f2a726ec1ff2492103520f1da8 | Python | 6,554 | 157 | import os
import numpy as np
from pcntoolkit.util.utils import create_design_matrix
from pcntoolkit.normative import predict
from pcntoolkit.normative_model.norm_utils import norm_init
import shutil
def transfer_nm(roi, df_adapt, df_te, pretrained_model_dir, params, set_name, suffix_TL, df_AD = None, dataset = 'OASI... |
3151eebbd566daa25c7a6cd2d2f2e84fa0fc6c204c163df941b7e537ca81dfe8 | Python | 6,555 | 168 | #%% Imports
import os
import pandas as pd
import pickle
from IPython.display import display
from config.config import settings
from pipelines import training_pipeline as main_runner
from pipelines import preliminary_analysis as prelim
from evaluation import figures, table4
#%%
# Define the tasks and data modes to ru... |
3aa60118d1a9f29aff4305bdc4e25e091836c29cf72767166c855705eb442ccc | Python | 6,555 | 199 | from langgraph.prebuilt import create_react_agent
from chemgraph.tools.local_model_loader import load_ollama_model
from chemgraph.tools.ASE_tools import (
run_ase,
molecule_name_to_smiles,
file_to_atomsdata,
smiles_to_atomsdata,
)
from chemgraph.tools.alcf_loader import load_alcf_model
from chemgraph.to... |
a3286c30b264c7480f8b797d5bf1c169c95d297618c66085120df64495515ed0 | Python | 6,555 | 149 | #This is the python program that reads in test pulse traces
#extracts baseline values, peak PSP, etc
#input is the full filename (including directory) of one of the traces, then python will find all the rest of the traces
#Outputs single file with each column containing a separate measure
#Can use Zbyszek's python prog... |
f49787646705270398b4006b7a6bef7da90d34dabbbe627b4778397c67c9ca0f | Python | 6,556 | 222 | from typing import Literal
import numpy as np
import pandas as pd
import polars as pl
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from rich.pretty import pprint
from neuralib.atlas.data import load_bg_structure_tree
from neuralib.atlas.typing import Source, Area
from ne... |
220835df65e9c18c2a2f330df6db9cc2219efc371ac20e5e2aa3421360b4df7a | Python | 6,560 | 156 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
from mmcv.cnn.bricks.transformer import POSITIONAL_ENCODING
from mmcv.runner import BaseModule
@POSITIONAL_ENCODING.register_module()
class SinePositionalEncoding(BaseModule):
"""Position encoding with sine and cosine ... |
3f5acc5912e83de8401008f03d7045b3a7d8c2da2bf25684fbb1c3a862839918 | Python | 6,562 | 194 | import logging
import argschema as ags
from neuron_morphology.transforms.pia_wm_streamlines.calculate_pia_wm_streamlines import (
run_streamlines,
)
from neuron_morphology.transforms.upright_angle.compute_angle import get_upright_angle
from neuron_morphology.transforms.affine_transform import (
rotation_from_an... |
653f8000747200d39e4f4eacfc3e8a63663fad50d4a868f8bda2b06d477c6eb8 | Python | 6,562 | 166 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute mean and std for each metric.
- Default: For the whole bundle. This is achieved by averaging the metric
values of all voxels occupied by the bundle.
- Option --per_point: For all streamlines points in the bundle for each metric
combination, along the bundl... |
a6fc6c358dabbc672f6613163408338a49c157ef4c998e6cf263f41b26e81575 | Python | 6,562 | 136 | import tkinter as tk
from tkinter import *
from PIL import Image, ImageTk
from tkinter import Button
import pandas as pd
from tkinter import filedialog
import cv2
import os
import numpy as np
import random
import glob
from tkinter import simpledialog
from MousePositionTracker import MousePositionTracker
fr... |
29a436137dd943070af03e142a68fa294c74d71fa4f8c982069f0c5cb978724b | Python | 6,564 | 173 | import sys
import yaml
import os
from glob import glob
import numpy as np
import h5py
import matplotlib.pyplot as plt
import pandas as pd
pathpath = 'PATHS/filepaths_carlen.yml'
myrun = 'runC00dMP3_brain'
with open(pathpath) as yfile: pathdict = yaml.safe_load(yfile)
rundict_path = pathdict['configs']['rundicts']... |
86e6ee3bd4d26abdbb77e65e2958ca1a97e19e21a38d91cf46e3fc43a2310ada | Python | 6,564 | 201 | import torch
from torch import nn
from chinn.layers import *
import torch.nn.functional as F
class ReLUMixin():
def _relu(self, inp):
leaky_alpha = 1. / 5.5
if self.guided and self.leaky:
return GuidedLeakyReLU(leaky_alpha)(inp)
elif self.guided:
return GuidedReLU()... |
8a04ff24ae2cdc29452ee157910898f119fc26986383645c91f673366b91df64 | Python | 6,564 | 186 | import os
import glob
from qtpy.QtWidgets import (
QVBoxLayout, QHBoxLayout,
QLabel, QLineEdit,
QSpinBox, QDoubleSpinBox,
QPushButton,
QGroupBox,
QFileDialog,
)
import napari
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import napari
import debcr
class ModelConfigsGroupBox(QGroupB... |
a113422e96800f04430394a8ceac4cc09343da970bf447798f36e27d15bba03a | Python | 6,565 | 171 | #!/usr/bin/env python3
"""
EEG Data Exploration and Analysis
Comprehensive analysis of EEG recordings (EDF) and artifact annotations (CSV)
to support preprocessing, model development, and data quality assessment.
Authors: Evans Nyanney, Parthasarathy D Thirumala, Shyam Visweswaran, Zhaohui Geng
Year: 2025
License: MI... |
a8dcf04f75a292bd221613dd9eb1bd53197c7d262071997bbeee5e5c29cdcdc4 | Python | 6,565 | 197 | # -----------------------------------------------------------------------------
# Copyright © 2014-2015 Colin Duquesnoy
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# ----------------------------------------------------------------------... |
344131b8c3cefcbc122a21a7d41cb6f6e4bfe2a693bdb964c237140d67e43112 | Python | 6,570 | 167 | import numpy as np
from sklearn.model_selection import train_test_split
import torch.utils.data as Data
import time
import GP_WAITER as gp
import shutil
import os
import torch
from torch import nn
import torch.optim as optim
import pandas as pd
from torch.utils.tensorboard import SummaryWriter
def transform(line_gen... |
a56d67301536aa8be966a03f27ed04744cabfa8f82c0548d9847276329dc59c9 | Python | 6,570 | 200 | # Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import math
from itertools import chain
import cv2
import datumaro as dm
import numpy as np
from pycocotools import mask as mask_utils
class RotatedBoxesToPolygons(dm.ItemTransform):
def _rotate_poin... |
da8330bc960eda228a1b13a34d9039b86aeccdd12df0ef152b986e7da5fa76a2 | Python | 6,574 | 146 | """
Skeleton normalization: rotate and scale keypoints to body-relative coordinates.
Ported from utils/processing.py (Chambers et al. 2020 pipeline).
Updated to use COCO-17 keypoint naming.
"""
import numpy as np
import pandas as pd
from kinescope.skeleton import NECK
# ────────────────────────────────────────────... |
e3aa5f154d104ec38769aedd51bd58e3b5567461633a750208c2c5088a27be65 | Python | 6,578 | 188 | from collections.abc import Sequence
from copy import deepcopy
from pathlib import Path
import aislib.misc_utils
import yaml
from eir.experiment_io.io_utils import strip_config
from eir.models.input.sequence.transformer_models import (
BasicTransformerFeatureExtractorModelConfig,
)
from eir.setup.config import (
... |
e48b4cb97a2dd4acaf4877f0a0aad5913ea7a3d7a856ecf90f7893bd3e9d2d8e | Python | 6,579 | 177 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
65c01228c3a7a0d377fd31b90b36e16874187817a59fa31c6a9e23e439b16daa | Python | 6,581 | 188 | import numpy as np
from typing import Final, Literal
from argclz import argument
from neuralib.plot import plot_figure
from neuralib.plot.tools import AxesExtendHelper
from neuralib.registration import CellularCoordinates
from neuralib.util.verbose import fprint, publish_annotation
from rscvp.statistic.core import Sta... |
e7c70f91229e721b091c942f71f5bfa2765130b9ed9c335db8c8ad5a39aa48ca | Python | 6,583 | 183 | """ PyTorch selectable adaptive pooling
Adaptive pooling with the ability to select the type of pooling from:
* 'avg' - Average pooling
* 'max' - Max pooling
* 'avgmax' - Sum of average and max pooling re-scaled by 0.5
* 'avgmaxc' - Concatenation of average and max pooling along feature dim, doubles fea... |
3147d320b771f0167d9631b900f0a0e7e9d28e83965125d881d76d4753327701 | Python | 6,584 | 158 | import pandas as pd
import json
# 电影
# path = r'C:\Users\YHR\Desktop\YHR\硕士\符号网络\数据\电影\ml-latest-small\ratings.csv'
# path1 = r'C:\Users\YHR\Desktop\YHR\硕士\符号网络\数据\电影\movie_net.txt'
# path2 = r'C:\Users\YHR\Desktop\YHR\硕士\符号网络\数据\电影\movie_nodes.txt'
# df = pd.read_csv(path)
# movie = list(set(list(df['movieId'])))
# ... |
b750ab097ef81d2ac7a0c5145e8395090eb52e5f5168148b8b3b84b11a0b645b | Python | 6,585 | 306 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Generate template from 'MB-KCc-STn' files
"""
import os
import pandas as pd
import numpy as np
import mbflim.utils as ut
import mbflim.parameters as par
import mbflim.image.image_processing as pro
import mbflim.image.image_set_processing as setpro
import mbflim.vis... |
891e8fd19bf431ff73e69dc532fe2965211b2f571b1e263a6b420587b17aec5f | Python | 6,587 | 186 | import json
from pathlib import Path
from argparse import ArgumentParser
import numpy as np
import pandas as pd
import xarray as xr
from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
import brainscore... |
bd44d859fe0295ad3fcc69e4ef620b135e1ac69844a530e070b84b9a2f6af850 | Python | 6,587 | 177 | """
Module for utility functions
Author: Bassel Arafat
"""
import torch as pt
import numpy as np
def center_matrix(X,axis =0):
"""Center the matrix by subtracting the mean.
Args:
X: matrix to center
axis: Axis along which to center the data
return:
X: Centered matrix
"""
if ... |
0a70d0c9824720cbe7dfbec3fbbbfadfdcdb0bf67ab20db97e809cb3926e301d | Python | 6,590 | 188 | # 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... |
bd0f4c2c3d40bd87d1398f99d9814e2785864342ef59f328e8324408341b5e85 | Python | 6,591 | 198 | from collections import defaultdict
from collections.abc import Callable
import torch
from torch.optim import AdamW, Muon
from torch.optim.optimizer import Optimizer
from eir.utils.logging import get_logger
logger = get_logger(name=__name__, tqdm_compatible=True)
class MuonAdamW(Optimizer):
def __init__(
... |
29468a3fc4aaf35f5e470abc0e983ed33a5c0d3eedc75d78ebf744d3e36a3bb9 | Python | 6,595 | 115 | import numpy as np
from typing import Optional, List
from .generic import MeshNumpyLayer, MeshPhases
from ..config import DEFAULT_BASIS
from ..meshmodel import RectangularMeshModel, TriangularMeshModel, PermutingRectangularMeshModel, ButterflyMeshModel
from ..helpers import grid_viz_permutation
class RMNumpy(MeshNum... |
92604e7a8a3d24ae1fec4a782d4db760ead7bfbfc6dc7d9762d09538548c3eed | Python | 6,595 | 179 | import hydra
import omegaconf
import torch
import pandas as pd
from omegaconf import ValueNode
from torch.utils.data import Dataset
import os
from torch_geometric.data import Data
import pickle
import numpy as np
from xrdsol.common.utils import PROJECT_ROOT
from xrdsol.common.data_utils import (
preprocess, prepro... |
d3475bb6fbf5cfce4eb8b23e426c28ed906bb988396a8c45fb9047b6a34c97a3 | Python | 6,595 | 209 | import torch
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNet', 'resnet50_ibn_a', 'resnet101_ibn_a']
model_urls = {
'ibn_resnet50a': './examples/pretrained/resnet50_ibn_a.pth.tar',
'ibn_resnet101a': './examples/pretrained/resnet101_ibn_a.pth.tar',
}
def conv3x... |
ecaa242e5ad65cb14885a75467695bbc711af7abcf8ef0862aa178700cb6528c | Python | 6,595 | 192 | # 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 th... |
82407d37498e35ea68103508f6f6e0d286194ac1606de4f019594ce0e50c78af | Python | 6,599 | 208 | # The ImpedanceFitter is a package to fit impedance spectra to
# equivalent-circuit models using open-source software.
#
# Copyright (C) 2021 Julius Zimmermann,
# julius.zimmermann[AT]uni-rostock.de
#
# This program is free software: you can redistribute it and/or modify
# ... |
8606136c86decd0484780996153dcb6d97b72565da51c04e4a9ef797d1589ed4 | Python | 6,599 | 146 | #!/usr/bin/env python
"""
HAL module for controlling a Prior stage and/or other
accessories that are connected to the Prior controller.
Hazen 06/17
"""
import math
from PyQt5 import QtCore
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.filterWheelModule as f... |
d369e3a9c3cf2e72e737fddade1530f437b9a7d6810e3ac92aa51b3a162e49c0 | Python | 6,599 | 146 | #!/usr/bin/env python
"""
HAL module for controlling a Prior stage and/or other
accessories that are connected to the Prior controller.
Hazen 06/17
"""
import math
from PyQt5 import QtCore
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.filterWheelModule as f... |
37b9cd8c1e2ccbcac5c0c7fad15d9af9e996779ff22031ff86072733ea17527d | Python | 6,602 | 216 | #!/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 old atrial coordinates for RA")
# Add the arguments
my_parser.add_argument("target_path", metavar="path", type=str, help="Path for the... |
413c7f22fa62bbcf252a86f548cc121494f0e23b59507040c2d4dbad9d1ea7e6 | Python | 6,602 | 219 | # Code adapted from: https://github.com/nipy/quickshear/blob/master/quickshear.py (23.10.2024)
# Minor adaptions in terms of parameters and return values
# Original Author': Copyright (c) 2011, Nakeisha Schimke. All rights reserved.
import argparse
import logging
#!/usr/bin/python
import sys
import nibabel as nb
imp... |
2651520c87b1c858ebd0dd3380fdf318b3beeee5af9cb9b5ad0d5430cdc1dc2c | Python | 6,603 | 193 | import base64
from collections.abc import Sequence
from io import BytesIO
from typing import TYPE_CHECKING, Any, Literal
import numpy as np
import numpy.typing as npt
import torch
from PIL import Image
from sklearn.preprocessing import StandardScaler
from eir.data_load.data_streaming.streaming_dataset_utils import (
... |
c3ebfd989e1f900b496b2c009d9c743c364420724130c24863a25867d3c2d69a | Python | 6,603 | 131 | #This program adds the two improper dihedrals in a cyclic peptide that were excluded during the process of creating a cyclic peptide topology with Gromacs according to lab protocol.
#It also adds one improper dihedral along each peptide bond in the cyclic peptide in order to help prevent cis bonds during the production... |
cc59f5f7139b81bb7d817e4818081b333e862f8812a531536a32c2cb6243aad9 | Python | 6,605 | 222 | #!/usr/bin/env python
"""
Handles remote control (via TCP/IP of the data collection program)
Jeffrey Moffitt
3/8/14
jeffmoffitt@gmail.com
Hazen 05/14
"""
import copy
import json
class TCPMessage(object):
"""
Contains the contents and status of a TCP message.
"""
_COUNTER = 0 # Track number of crea... |
61d9aa4be9a78b671ccd10bb2bd7903648da674199b614928e16055afb614565 | Python | 6,607 | 291 |
import torch
import numpy as np
import pandas as pd
from datetime import datetime as dt
from dataset import fast_merge,df_to_mask
from tqdm import tqdm
dataset_names = [
'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-201... |
9d92c5ce5ff7f1beeedb2323c3dcfd4c31242ac6fcb11bb8fab3a6330ae9083a | Python | 6,607 | 198 | # /------------------------------------------------------------------------------+
# | 8-FEB-2022 |
# | Copyright (c) Bone Imaging Laboratory |
# | All rights reserved ... |
4d0373d85f656740104f0e7938c2edce26430ebeb18a4cf484bf2316f9b9ab4a | Python | 6,608 | 147 | from tensorflow import keras
import tensorflow as tf
import archs
from utils import data_utils, train_utils, augment, argmanager
from utils.loss import multinomial_nll
import numpy as np
import random
import string
import math
import os
import json
def subsample_nonpeak_data(nonpeak_seqs, nonpeak_cts, peak_data_size,... |
0561fefea6bd00a67cc13eb2d82c20877ce0135f6227f30a3e93fa72400c1a6a | Python | 6,609 | 206 | # # from tkinter import *
# # from tkinter.filedialog import askopenfilename
# # from skimage.io import imread
# # from PIL import Image, ImageTk
# # import tkinter.simpledialog
# # from scipy import ndimage
# # root = Tk()
# # #setting up a tkinter canvas
# # # w = Canvas(root, width=1000, height=700)
# # w=Canvas(... |
1f85b4b9e1e4c28eddd5c76400242ad13d2459ff132e1c2553c0902857f18d94 | Python | 6,610 | 182 | # %% ### import modules
from pathlib import Path
import seaborn as sns
import pandas as pd
import numpy as np
import bap1b.figures as figures
# %% ### set paths
data_dir = Path(__file__).resolve().parents[1] / "data"
results_dir = Path(__file__).resolve().parents[1] / "results"
# %% ### load data
df = pd.read_excel(... |
735b034cecc725aad69d30a411caa5453b9a52c213a51014d4030c123346bbc0 | Python | 6,610 | 138 | import os
from pathlib import Path
import json
import numpy as np
import xarray as xr
import pandas as pd
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet
from brainscore_core.supported_data... |
828ceac18f91b5cc20c234e65eaadf957f3db94c07f96a8a6a858b9060900f59 | Python | 6,612 | 181 | import pdb
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import cv2
from .utils import build_montage, normalize
class ReLULayer(nn.Module):
'''
Drop in replacement for SineLayer but with ReLU non linearity
'''
... |
239c4f9b0c2fe696f65b4559760d4151bfe8b4dcc1e9f1e00d8c0173519a001b | Python | 6,613 | 213 | """Visualization utilities for pose clips and Pose-JEPA masking patterns.
Saves plots to artifacts/ for human review of:
- synthetic_pose_clip.png: stick figure frames from a normalized clip
- jepa_mask_pattern.png: same frames with masked joints highlighted in red
- pretrain_loss_curve.png: JEPA + TPC loss ov... |
559884082a3115a05e3c05fe58af78544bf4f634d38f68c894bf1ae28071d4ed | Python | 6,613 | 159 | """Ocular features from electrooculography (DD-Database, 128 Hz).
Two derivations of the LOC/ROC pair are used, because they carry different
information:
* ``blink`` = (LOC + ROC) / 2 -- horizontal saccades are anti phase and cancel,
leaving discrete blinks on a flat baseline.
* ``horiz`` = (LOC - ROC) / 2 -- the... |
3f7dbb24ddcb496c274f61b117ae8c1b8640f279f1e1c608a1331b40b135e57b | Python | 6,614 | 229 | # Build training data module
# Imports
import numpy as np
import pandas as pd
import numpy.typing as npt
from pathlib import Path
import joblib
import pickle
# FHI-Aims conversion
from modules.build_data.fhi_aims.run_qcalc import run_qcalc
from modules.build_data.fhi_aims.crosscheck_names import crosscheck_names
from... |
a189b8659a61b410e2271d2a13a32659e3a66e9d26e881e49b71f4e604ea931a | Python | 6,614 | 176 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch import nn
from torch.nn import functional as F
from typing import List, Tuple, Type
from .common... |
540428fc634e7ff989341df3ffab23b5155c62f70f2905ce26a325894cfc857f | Python | 6,619 | 207 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
NAME = "cloudstorages"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictReader(f)
... |
635b9b0d18b57fe44ac1a90f64237cd96a9d7e3e65b36a740562b171e62799e6 | Python | 6,620 | 179 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
import sys
# external inputs
import numpy as np
import nibabel as nb
from nibabel.freesurfer.io import read_geometry
from skimage import measure
from nighres.surface import probability_to_levelset
from nighres.laminar import volumetric_layering
# loc... |
98fb62e45d270f1cd854bd9831286a247a8236f7070fefb878ecfbc8d640cc66 | Python | 6,620 | 219 | from collections import OrderedDict
from collections.abc import Sequence
import pytest
import torch
from torch import nn
from eir.data_load.label_setup import al_label_dict
from eir.models.input.tabular import tabular as tab
from eir.models.input.tabular.tabular import (
al_emb_lookup_dict,
al_unique_embed_va... |
f8d5c73ff329b668586116102c21f70633635b85adec113512be7f170c762a3e | Python | 6,620 | 201 | #!/usr/bin/env python
# coding: utf-8
# # Regression of pH range using machine learning
# In[1]:
#libs
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn import linear_model
import pandas as pd
import numpy as np
import scikitplot as skplt
import matpl... |
0a436885408b59129a6d103ec23ba3a0ddb5ea3bf189d78870c84eab6cc95704 | Python | 6,621 | 215 | """Functions to perform statistical significance testing."""
from typing import Dict, Optional, Tuple
import numpy as np
from osl_dynamics.glm import DesignConfig, MaxStatPermutation
def evoked_response_max_stat_perm(
data: np.ndarray,
n_perm: int,
covariates: Optional[Dict[str, np.ndarray]] = None,
... |
e51134cdbdb2f1f91ba16b1e50f1ebb3767a3e49911e15176b2b5cc8993710b8 | Python | 6,621 | 220 | import scanpy as sc
import pandas as pd
import numpy as np
from tqdm.auto import tqdm
from joblib import Parallel, delayed
from sklearn.metrics import (
adjusted_rand_score,
adjusted_mutual_info_score,
normalized_mutual_info_score,
fowlkes_mallows_score,
homogeneity_score,
completeness_score,
)
... |
752cbd122349571f2bc0a30df75bbaf600d1fd974299efba3f54c1d497f02fce | Python | 6,622 | 175 | import torch
from torch import nn
from torch.nn import functional as F
from torch.nn import init
from .pooling import build_pooling_layer
class SeparableConv2d(nn.Module):
def __init__(self,in_channels,out_channels,kernel_size=1,stride=1,padding=0,groups =1, dilation=1,bias=False):
super(SeparableConv2d,se... |
ece865f4a211de588f2aaa8e610e37ac78738a5299ad148eadb647fa8ad8e310 | Python | 6,622 | 205 | """Generative models.
This subpackage contains all the models implemented in osl-dynamics. Each
model module (e.g. ``hmm.py``, ``dynemo.py``) defines a ``Config`` dataclass
and a ``Model`` class.
Code structure
--------------
The code is organised into three layers:
**1. Base layer** (``mod_base.py``)
- :py:class:... |
c98a9ec7f88a8824f4ab388859fe727f451be57daf6d3a448386096ffae414c2 | Python | 6,624 | 162 | """
This is the main page, that you have to run with "streamlit run" to launch the app locally.
Streamlit automatically create the tabs in the left sidebar from the .py files located in /pages
Here we just have the Welcome page, with a short description of the tabs, and some images
"""
# ========================
# 📦 I... |
b790cf8ec88d2975cbfceaef8387a8b5b7c09537cabfe4847ff5b52de3e88c48 | Python | 6,625 | 194 | """
NTU RGB+D 120 dataset loader: .skeleton files → normalized COCO-17 clips.
Directory layout expected:
ntu120/
└── nturgbd_skeletons_s001_to_s017/ (or any subdirectory structure)
├── S001C001P001R001A001.skeleton
├── S001C001P001R001A002.skeleton
└── ...
Each .skeleton file format ... |
2456d832dc604016701d0789189c3f98883ed250aff4e9e9cadca1350f5322b2 | Python | 6,627 | 226 | """
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... |
3bea88980f9dff90e81b55adf3556fd94dac43016b28f6be4eff580159014ad3 | Python | 6,629 | 117 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './designerFiles/loader_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.12.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_LoadPointDialog(object):
def setupUi(self, L... |
7e22878dec6f3ebc93952d307ff18f963f53c52432545ef86ba4a6d108cde5b1 | Python | 6,629 | 117 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './designerFiles/loader_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.12.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_LoadPointDialog(object):
def setupUi(self, L... |
a2ecaf484dd30afc1fbd553b5a14ae0114649b052d305fb20b5c4b5312b0f180 | Python | 6,631 | 218 | """CTF Rest Dataset: TDE-HMM for Dynamic Network Analysis.
In this script we train a Time-Delay Embedded Hidden Markov Model (TDE-HMM)
on 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 listed in the config are d... |
783371d9fb3d9da252bb8b05ec4345663491d77b65273960446f58b59aa76a76 | Python | 6,633 | 132 | import torch
from collections import OrderedDict
from torch import nn
import torchvision
import numpy as np
from .modules import RetinaBlock, VOneBlock, Identity
from .params import get_tuned_params, generate_gabor_param,\
get_retinal_noise_fano, get_v1_noise_fano, get_v1_k_exc
from .backends import get_resnet,... |
b6482fc36f3083df89a8721f06595f0b04c7ad92148aff39c9925c0ea8f3df3d | Python | 6,634 | 180 | from typing import Optional
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.nn import GRUCell, Linear, Parameter
from torch_geometric.nn import GATConv, MessagePassing, global_add_pool
from torch_geometric.nn.inits import glorot, zeros
from torch_geometric.typing import Adj, OptTensor... |
f3249ae923bbd2c0217bdd0f2eb27fc28f612cb9c8d85a7fa54b383d1a60693a | Python | 6,634 | 190 | import rootutils
rootutils.setup_root(__file__, indicator=".project-root", pythonpath=True)
import torch
import torch.nn as nn
from einops.layers.torch import Rearrange
from peft import LoraConfig, get_peft_model
from src.model.backbones.dinov2 import ConditionedDinov2
from dataclasses import dataclass
@dataclass... |
7a2c022218b3692ecb45053dadd2ac91da633b492f5c8fc8e944837a3f32293e | Python | 6,635 | 163 | # We reuse a fraction of code in http://bitbucket.org/omerlevy/hyperwords.
# Using the numpy and similarity matrix largely speed up the evaluation process,
# compared with evaluation scripts in word2vec and GloVe
import numpy as np
import argparse
import random
def read_vectors(path, topn): # read top n wo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.