sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
996077422e27b1c3ab29619f108eef28a30c730e7712b0dbcf8bb2d2a006562b | Python | 6,963 | 167 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Kathrin Rack, Wadim Koslow
#
# 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 ... |
dc4df28ec0313672598ed2d37538d3d1f27b520b9a7443acb96df6d84be4de3b | Python | 6,963 | 139 | # -*- coding: utf-8 -*-
# __init__.py
import pandas, numpy, math, multiprocessing
from scipy.stats import chisquare
from scipy.spatial import distance
from functools import partial
def chi_square_test(dot, dc, dots):
#define a function to find p-value
dc = dc/6
xinde = dot[1]
yinde = dot[2... |
42517888869486e68d1c495b919060d70be860376c20e42f6edb565ae1fa2de4 | Python | 6,964 | 193 | import time
import argparse
import torch
import numpy as np
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torch.nn import ModuleList, Linear, BatchNorm1d, Identity
from ogb.lsc import MAG240MDataset, MAG240MEvaluator
from root import ROOT
class MLP(torch.nn.Module):
def __init__(s... |
ef755356c86ee2bb1c897433aaba8dbe14a3e0cd7c683181d58bfc85d3588c50 | Python | 6,965 | 152 | # Copyright (c) 2022, Joohyung Lee. All rights reserved.
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES... |
8c372ac51f8d42fb1f6d70f9d5de7e1f892860d31bc6431d4fe6cee0799df563 | Python | 6,968 | 170 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import zlib
from functools import cached_property
from pathlib import Path
class GitRepo:
"""Represent a local Git repository and expose branch, commit, and remote metadata.
This class discovers the repos... |
92927adf11c73fcffb8c75a9bd9059430bde83915215088624543ac85ab22f9e | Python | 6,968 | 208 | import nibabel as nib
import numpy as np
import time
from scipy.sparse import csc_matrix
from scipy.io import loadmat, savemat
import sys
#########################
def convert_tracks_to_sparse(tckfile,weightfile,lengthfile,niifile,outfile):
starttime=time.time()
img = nib.load(niifile)
volxfm=img.affine
... |
2d53c10403e441d93b61ff0a629f00a9ccaf1213db132f0f6fbcf6c1f0c7cce2 | Python | 6,969 | 209 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
c632869e0a43edb8615336592f56bc088525fe146e655befebadc1874a9474f6 | Python | 6,970 | 209 | import logging
import dipy.tracking.utils as dtu
import nibabel as nib
import numpy as np
import scipy.ndimage as ndim
from dipy.io.utils import create_nifti_header, get_reference_info
from dipy.tracking.streamline import select_random_set_of_streamlines
from scipy.ndimage import distance_transform_edt
from scipy.spat... |
1e8714902348371bd244757475047bce9791889406fca924f3fc30d801cad998 | Python | 6,973 | 182 | """ DropBlock, DropPath
PyTorch implementations of DropBlock and DropPath (Stochastic Depth) regularization layers.
Papers:
DropBlock: A regularization method for convolutional networks (https://arxiv.org/abs/1810.12890)
Deep Networks with Stochastic Depth (https://arxiv.org/abs/1603.09382)
Code:
DropBlock impl ins... |
0f9ab13a31e8131f5ec5682ffc36a2f4859675bd1aff33c0bb4a4dc706614c11 | Python | 6,976 | 227 | import inspect
import json
import re
from pathlib import Path
import requests
from transformers import AutoConfig, PretrainedConfig
from eir.setup.setup_utils import get_all_hf_model_names
UPDATE_HF_DOCS = False
CACHE_FILE = "docs/source/_static/sequence_model_overview_cache.json"
def run_all():
output_file = ... |
b86ff62c3bf563cfcf527b2e1a110c8be7cb83297cca302da1dd58735701c24c | Python | 6,976 | 142 | """
(C) Copyright 2021 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... |
be9441a14d46c545a675fb9ce18c18002cbd8498387d0355ca06b6746cb347d0 | Python | 6,977 | 192 | from collections.abc import Sequence
from typing import TYPE_CHECKING, Literal, NewType, cast
import torch
from torch import nn
from eir.models.fusion import (
fusion_attention,
fusion_default,
fusion_identity,
fusion_mgmoe,
)
from eir.models.fusion.fusion_default import al_features, default_fuse_feat... |
361f817be8bc333709884d90ffda950fb889e4dd70dc823b9a57219353759865 | Python | 6,979 | 203 | import reprlib
import typing
from collections import OrderedDict
from collections.abc import Sequence
from copy import deepcopy
from pathlib import Path
from typing import Any
import torch
from eir.models.model_setup_modules.meta_setup import al_meta_model
from eir.utils.logging import get_logger
logger = get_logger... |
8c55c680a1f0c2873756f66fcc4c877c19ec3b1aae2a8bd214593c5f96602867 | Python | 6,979 | 196 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os
import shutil
import warnings
import mmcv
import torch
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import (get_dist_info, init_dist, load_checkpoint,
wrap_fp16_model)
from mmcv.ut... |
bde953886857b391b34d68c57fc2a6b2a2b335f2fc22eadde1b8970a100e866f | Python | 6,982 | 170 | import pdb
import math
import numpy as np
import torch
import torch.nn as nn
from .utils import build_montage, normalize
class SineLayer(nn.Module):
'''
See paper sec. 3.2, final paragraph, and supplement Sec. 1.5 for
discussion of omega_0.
If is_first=True, omega_0 i... |
00d7b08d69363ae54781253b1270eb70d5cf8f854a5e4258fa9fa468f284510e | Python | 6,986 | 207 | from sys import stdout
from logging import info
from datetime import datetime
from abc import ABCMeta, abstractmethod
from keras.callbacks import Callback
from evaluation import per_type_summary, conll_summary, is_iob_tagging
from util import unique
from defaults import defaults
class LtlCallback(Callback):
"""... |
e1a026eaca90b1b5bc34697e04ea92da8cdafe47214d14582d6485035411f7e2 | Python | 6,987 | 169 | import sys
import os
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.optim as optim
from torch.nn import functional as F
import random
from sklearn import metrics
from model import *
inpt = "mock_genomes.npy" #input genotype file in nu... |
f3222cdcfd52e16d919eb4d2f5038cba5ea58d5928712d99273ea5d8233a7320 | Python | 6,989 | 184 | """Using for merged ab-ig graph
"""
import warnings
warnings.filterwarnings("ignore")
import os, time
from argparse import ArgumentParser
import uuid
import torch
import torch.distributed as dist
import torch.multiprocessing as tp
from torch.nn.parallel import DistributedDataParallel as DDP
import torch.multiprocessi... |
9032ee3152403105fb07bd57566c6dbd715e91642e0c00113eb3d993f522af41 | Python | 6,992 | 212 | #!/usr/bin/env python3
"""
Example usage of the EBM predictor with schema validation.
This script demonstrates how to:
1. Extract schema from a trained model
2. Use the predictor with automatic validation
3. Handle validation results
"""
import sys
from pathlib import Path
import pandas as pd
# Add src to path
sys.... |
d3c387e85c7ab4c2c20370195ffb85a7d21dc3a377733b26a4eb21fdfb50dd36 | Python | 6,992 | 182 | # 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.
from typing import Optional, Tuple, Type
import torch
from torch import nn
from ..position_encoding import PositionEmbed... |
e59db9aa1997ccf45fffeca230e4814a4094c9257b474e095afbda6191d5aee3 | Python | 6,992 | 210 | import torch
from collections import Counter
import numpy as np
import torch
class ASTNodeEncoder(torch.nn.Module):
'''
Input:
x: default node feature. the first and second column represents node type and node attributes.
depth: The depth of the node in the AST.
Output:
... |
e9fb0a139eff3b9d8478ddc042e9d80fa80377395939ba67ff62f24a8784b7f5 | Python | 6,993 | 200 | #!/usr/bin/env python3
"""Run SHAP and LIME 10x for an ElasticNet (L1) LogisticRegressionCV model.
This script is designed to be **GitHub-runnable** on the bundled toy dataset.
Protocol (per run/seed):
- Fit LogisticRegressionCV with elastic-net penalty (saga)
- Compute top-K global features by:
- SHAP: mean(|SHAP|... |
5cdc0b87c2f4b253802d604c6d99d2b2f9f11e6e19bc2d7b06c113f546ccbfa8 | Python | 6,995 | 234 | import torch
from eir.train_utils.adversarial import (
AdversarialDisentanglementModule,
gradient_reversal,
)
def test_gradient_reversal_layer():
x = torch.randn(4, 10, requires_grad=True)
y = gradient_reversal(x)
assert torch.allclose(y, x)
assert y.requires_grad
loss = y.sum()
lo... |
a2e04cdece072592c527cca1512876b5195304e0b7f2b8210dd919758893663a | Python | 6,995 | 224 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import json
import os
from pathlib import Path
import platformdirs
import pytest
from cvat_sdk.core.auth import (
AuthStore,
AuthStoreError,
ProfileEntry,
get_auth_store_path,
)
from cvat_sdk.core.utils import is_posix
def test_aut... |
07965e3d342b09dde0399da0ac7ea44bbe04f343707ee2adcf1a36a06ed87a89 | Python | 6,996 | 170 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 15:03:58 2020
@author: jacobb
"""
import torch
import numpy as np
import os
import datetime
import logging
def inv_var_weight(mus, sigmas):
'''
Accepts lists batches of row vectors of means and standard deviations, with batches along di... |
ccddc44ea746b472c0ae9f6113c2fc26d0773a13bf1daaec8f68df5aa7a0bce7 | Python | 6,997 | 219 | import os
import re
from pathlib import Path
import nibabel as nib
import numpy as np
import pandas as pd
# =========================
# Paths
# =========================
odi_4d_path = Path(r"/mnt/e/Neuroimage/workdir/TBSS_GBSS/ODI/all_ODI_skeletonised_GBSS.nii.gz")
odi_dir = Path(r"/mnt/e/Neuroimage/workdir/TBSS_GBSS... |
e8dc1f26926cab6527c42256a839f4c4bdca6f9992ff46c4303ea49c7f38ec83 | Python | 6,998 | 177 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 2 21:46:46 2025
@author: rl05
Plot Supplementary Figure - composition effects in all tested ROIs
"""
import os
import os.path as op
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as patc... |
b4316ee5379f35302c3ba36a50bec3ec65ff10ab23edd2cbdd8a5ac63142a426 | Python | 7,000 | 190 | import hashlib
from os.path import isfile, dirname, basename, isdir, join, splitext, islink, abspath
from os import remove, makedirs, rmdir, unlink, symlink, cpu_count
from shutil import copy2
from concurrent.futures import ThreadPoolExecutor
from warnings import warn
import pytorch_lightning as pl
from .util import co... |
970c991bfd773543cf52fe176a9299433583d581d86f6145a0ab150667999d6d | Python | 7,001 | 156 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
2c05d75abeb4193795319033234d6d50a08493d097d2d3331fe97ccf508d4498 | Python | 7,004 | 145 | # Generic Libraries
import os
import numpy as np
import time
# Scientific Libraries
from scipy import fft
from skimage import metrics
def recon_k2image(k_space_in):
# TODO: add comments
image_space_out = fft.ifftshift(fft.ifftn(fft.ifftshift(k_space_in, axes=[0, 1, 2]), axes=[0, 1, 2]), axes=[0, 1, 2])
re... |
036f0a1c3a5e4a34071c228f7ad982670a7dce07ec3bd2576067585b73b2d65a | Python | 7,005 | 206 | """
This script makes behavior plots for the paper, for the single player monkey task.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from ut... |
b3325ab9631080490c1b94f9330b2992c9cea6de2543233a6ad2a5a18aee3938 | Python | 7,005 | 177 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 2 21:46:46 2025
@author: rl05
Plot Supplementary Figure - denotation effects in all tested ROIs
"""
import os
import os.path as op
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as patch... |
49f7acc91d0c8f241440413cc7a9b53c6b21b774016bbf7b5c60d349929017f0 | Python | 7,006 | 143 | """
PyVISAScope provides an interface to different scopes.
Copyright (C) 2016 Ye-Sheng Kuo <yesheng.kuo@gmail.com>
Copyright (C) 2019 Julius Zimmermann <julius.zimmermann@uni-rostock.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Publi... |
6588de54397267364c1d40035df0f1dd5c74aef752fa52c20457a7341bd186b8 | Python | 7,006 | 163 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Transform a tractogram using an affine/rigid transformation and nonlinear
deformation (optional).
For more information on how to use the registration script, follow this link:
https://scilpy.readthedocs.io/en/latest/documentation/tractogram_registration.html
Applying... |
efc1207cb7cbeb79be3e9c2fadf8f087b964a45fbe6eb2f96b21236d375b2ec3 | Python | 7,007 | 186 | # pylint: disable=relative-beyond-top-level
import os
import numpy as np
import nibabel as nib
from scipy import ndimage
import psutil
from joblib import Parallel, delayed
def change_spacing_of_affine(affine, zoom=0.5):
new_affine = np.copy(affine)
for i in range(3):
new_affine[i, i] /= zoom
ret... |
bcf4bdd826dfd122f624835b6676331fc3c8d0d6342a95004f17f2f764562275 | Python | 7,008 | 179 | """
Script to use a GTF and expression matrix with ENSG to liftover gene symbols
"""
import argparse
import gzip
import re
import sys
from statistics import mean
def update_gtf_dict(gtf_dict, in_text, tx_type, tx_desc, id_find, name_find):
"""
Update ensg - sym ID dictionary on gene entries only
"""
... |
e0b93e652241d42b15ce907a6de96c41207deef08adf2e90dd083dc68b17e504 | Python | 7,009 | 226 | # Credit to https://github.com/JDAI-CV/fast-reid/blob/master/fastreid/layers/pooling.py
from abc import ABC
import torch
import torch.nn.functional as F
from torch import nn
__all__ = [
"GeneralizedMeanPoolingPFpn",
"GeneralizedMeanPoolingList",
"GeneralizedMeanPoolingP",
"AdaptiveAvgMaxPool2d",
"... |
441490b8df70896fb000fae11c9f4c92066023c614ee4b2cef270586841dd1c4 | Python | 7,010 | 247 |
import os
import subprocess
import time
import sys
import pandas as pd
import shutil
import psutil
"""
Example commands:
conda activate tf-py38
cd /home/aleksandr/Desktop/WORK/OLINK_suicide_PSY_project/Data_preprocessing_analysis
/home/aleksandr/miniconda3/envs/tf-py38/bin/python PrepareCountsSTAR.py test_id.txt PAI... |
4fbcef70058cc3757410b9d68faa4d3c79d8383f02c7439d89d059c07b149a1d | Python | 7,010 | 181 | """
Main manuscript - Figure 2: 2D plots of orientation-dependent qMRI
2D plots of R1, R2, AI values against fiber-to-field angle for different FA binning
for the large cohort 3T and small cohort 9.4T datasets.
Author: florian.birk@tuebingen.mpg.de
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
fro... |
72ba8ef2e40dcf5c02d493a7e29ad2b3c88e1aff4bb8b2b77597ff29457db541 | Python | 7,010 | 172 | import os
import os.path as osp
from typing import Callable, List, Optional
import numpy as np
import torch
from torch_geometric.data import (
Data,
InMemoryDataset,
download_google_url,
extract_zip,
)
from torch_geometric.io import read_txt_array
from torch_geometric.utils import coalesce, cumsum
c... |
1f18c31e61f956381c563e6cbed154e04d073e7ae8740d19296236665bb5f5f8 | Python | 7,015 | 183 | """A dropdown has to be wide enough for the options it is listing.
Run from the repo root::
uv run python python/test_gui_combo_popup.py
Qt opens a combo box's popup at the width of the *box*. The box is sized by the
form around it, and the popup does not draw its rows the way the box does — it
adds a check-mark... |
3b5a8efeba073945a5e661f6a0a03d680892427f2af5dd4dade204e4b70fe29c | Python | 7,015 | 186 | import os
import shutil
from nipype.interfaces.base import CommandLineInputSpec, File, TraitedSpec, CommandLine, BaseInterfaceInputSpec, BaseInterface
from traits.api import Str, Int, Directory
import subprocess
from ....bids_data.rename_bids_file import rename_bids_file
#########################
# recon-all-clinical.... |
7d0133d0bb6583a51cbc60a5ebb16b2776879bb49b15d33e64b13fdc4504802c | Python | 7,017 | 127 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'storm2-misc.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_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjec... |
90db3b4b2e64fb654ca9424d338672ed62826ddbe00cac34daba193f4467f888 | Python | 7,019 | 154 | import argparse
import utils # shap is imported by utils, must be imported before keras
import keras
from keras.models import load_model
import gc
import os
import numpy as np
import h5py
import pandas as pd
from tensorflow import Variable
import pandas as pd
from os.path import join
from plotting import plot_logos
''... |
93498ea4e7df7d29c4967fb2d27360e39454251f389b0bdfd314cdb3065886af | Python | 7,019 | 319 |
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-20... |
9460a09100cca8032d4f2cde6bcf6f3579c968a96168cffe4f970cac92417b00 | Python | 7,019 | 117 | import logging
import os
import random
from pathlib import Path
import atom3.pair as pa
import click
import pandas as pd
from tqdm import tqdm
from project.utils.deepinteract_constants import RESIDUE_COUNT_LIMIT, KNN, \
EXCLUDED_COMPLEX_PAIR_FILENAMES
# ----------------------------------------------------------... |
02f2931980ebf5dab94e0a92d0bf4806d0c3bc5d0455e2849ebcf54ab76e13fb | Python | 7,021 | 209 | """
Evaluation Metrics for AVPENet.
Implements all metrics from the paper:
- MAE (primary metric)
- RMSE
- PCC (Pearson correlation coefficient)
- ICC (intraclass correlation coefficient)
- Accuracy, F1, Kappa (3-class discretised)
Reference: Section "Evaluation Metrics".
"""
from __future__ i... |
2ad0bcf6cca98f2e481557b18172f9732715a580885c1185137b61c18fe8c932 | Python | 7,024 | 213 | # 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, sof... |
99632b9946f92b37a129dbab65610899e238e210f202e031aac9b3170d201c2d | Python | 7,026 | 201 | """
This script plots the angle between a switch evidence dimension computed at
outcome time and subsequent time points. The angle over time plot shows the
rotation dynamics of the switch evidence.
"""
import json
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
imp... |
9f63ea3ca01c384e477fbd06e2ded32aa346ad63a827c6e0f88e5bdfecdc99cc | Python | 7,029 | 158 | import sys
import importlib
import n_choice_markov as mdp
importlib.reload(mdp)
import train_it_mdp as sv
importlib.reload(sv)
import pandas as pd
import numpy as np
import scipy.optimize
from tqdm import tqdm
from tqdm.contrib import tenumerate
import itertools
def out_llik(dfs, alpha=.5, beta=1, gamma=0, init_q=.5, ... |
0be9e62019dbacb45aeb3d21a55f460e16df1af1dacce39f008fe9ad6c8951a8 | Python | 7,032 | 192 | from typing import Union
import numpy as np
# noinspection Assert
def simple_decoder(rate_map: np.ndarray,
spike_count: np.ndarray,
binsize: Union[float, np.ndarray] = 1.0,
alpha=1.0,
baseline=0.1,
prior: np.ndarray = None... |
c729e2beea8b5fbbace16fbfe2ceb258440db1c1ca439246ce07ca971a55c4af | Python | 7,032 | 162 | import os
from pathlib import Path
import logging
import numpy as np
import xarray as xr
import pandas as pd
import tables
from PIL import Image
from brainscore_core.supported_data_standards.brainio.s3 import sha1_hash
from brainscore_core.supported_data_standards.brainio.assemblies import NeuronRecordingAssembly
fr... |
97944a27b84089121267f0f79c1b082eaa4ff376c7428fc0d9e81b75c9962c3b | Python | 7,034 | 168 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
"""Create a task with a ground truth validation set (a "gold set") and upload
the ground truth annotations into it.
The validation frames are moved into a separate ground truth job, which the
annotators never see. Quality reports compare the annotat... |
c6c9ca4fa70c5abd62ccf66f9a4526063d1b52161d2f4193f58ba42cd79857a0 | Python | 7,036 | 158 | """Run ROICaT over a pre-registered chain.
Everything here is a settled parameter choice rather than a default, and each
one has a measurement behind it.
**Both registration steps are disabled.** ``fit_geometric`` is pinned at
(0, 0) by the stripe artifact anyway, but ``fit_nonrigid`` is *not* idle -- it
applies real... |
0b77dc1e6a632cda9c9b899dc665615cd561fd1ff253c33ecc9e30334dd5c026 | Python | 7,037 | 191 | # Source: https://github.com/neuraloperator/neuraloperator/blob/main/neuralop/layers/integral_transform.py
import torch
from torch import nn
import torch.nn.functional as F
from .mlp import MLPLinear
from .segment_csr import segment_csr
class IntegralTransform(nn.Module):
"""Integral Kernel Transform (GNO)
... |
6db6481059d5532a29817dd75661022ce8ff640a2395047af979c5a9d878d8b3 | Python | 7,037 | 178 | from sklearn.metrics import roc_auc_score
import pandas as pd
import os
import numpy as np
try:
import torch
except ImportError:
torch = None
### Evaluator for node property prediction
class Evaluator:
def __init__(self, name):
self.name = name
meta_info = pd.read_csv(os.path.join(os.path... |
8e4bc475854cf47140a8645923df18fbe3b436e6ea047639033479056fe2ea84 | Python | 7,037 | 189 | #! /usr/bin/env python
"""Validate that a config.yml and its input folders are set up consistently.
Run this before the pipeline to catch the common setup mistakes up front:
* ``seg_dir`` exists and holds segmentation MRCs (an error if not),
* ``tomo_dir`` exists (a *warning* only -- tomograms are needed for dens... |
a6462b551c38e049bd3f01b51a2ea3c1c3b9c6af41f1da95f358e6164eb75ef8 | Python | 7,039 | 220 | from typing import TYPE_CHECKING, Any, Literal
import torch
from torch import nn
from eir.models.layers.mlp_layers import MLPResidualBlock
from eir.models.tensor_broker.tensor_broker_projection_layers import (
get_projection_layer,
)
from eir.utils.logging import get_logger
if TYPE_CHECKING:
pass
logger = g... |
53a5eb36d03a24b370c446eee6b74f18f99fb5609ae266c7110f813c8bbc7bd6 | Python | 7,044 | 223 | # Copyright 2014-2015 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
"""
This contains the objects to store and manipu... |
fc8baa420843f205a81dbb1206d40ed2836c12466cc02d3505eee4370f7b35cf | Python | 7,046 | 203 | from __future__ import annotations
import math
import os
from collections.abc import Callable
from collections.abc import Sequence
from typing import Final
import numpy as np
import numpy.typing as npt
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtSvg
from PySide6 import QtWidgets
_ICONS... |
9d7f2a9481f300e0f8a1a4f6132a3a6a559e13022c787326e29527b8d4d0404d | Python | 7,047 | 235 | # Copyright 2017 Calico LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
3a0e8e3da2d9beb66c29ef10c421d2831b0dcd86e9072a5c269c2e5349b7a449 | Python | 7,048 | 124 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/media/lg/disk2/PycharmProjects/ISAT_with_segment_anything/ISAT/ui/about_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 this ... |
61905cb1b1659b81d502dfe3d252cadb0c260b2d7fd03d33a3cd86b576cdd7cf | Python | 7,049 | 173 | # -*- coding: utf-8 -*-
# @Author : LG
import functools
from fuzzywuzzy import process
from PyQt5 import QtCore, QtGui, QtWidgets
from ISAT.ui.category_dock import Ui_Form
class CategoriesDockWidget(QtWidgets.QWidget, Ui_Form):
def __init__(self, mainwindow):
super(CategoriesDockWidget, self).__init__... |
a74eb921ccbccd4cd2aeb17db9fb3505e26ad8bf56de005c18f37a4f2f130758 | Python | 7,049 | 182 | import pandas as pd
import statsmodels.api as sm
import statsmodels.stats.multitest as smt
import numpy as np
from sklearn import datasets, linear_model
from sklearn.linear_model import LinearRegression
from scipy import stats
def sc_statTab(expDat, dThresh=0):
geneNames=expDat.columns.values
muAll=s... |
aef914170182d4ec152e2de450b0f46a5c4d8a4a3ade035f54ca462b8c38b668 | Python | 7,050 | 207 | import os.path
import unittest
import tests.base_test
import tests.output_parser as output_parser
import tests.test_config
import tests.util
class AllowClippingBaseTest(tests.base_test.BaseTest):
def setUp(self):
super().setUp()
self._test_base_dir = tests.test_config.TEST_BASE_DIR
self.... |
6f9940dcdaecae8cc25189c60783d75e64a987e5058274293e02cb52a5dc75e5 | Python | 7,051 | 241 | # Copyright 2014-2015 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import copy
import datetime
import pandas
import ... |
cc7ceb806d573bbeeb22cb6f8e575be819e8b6663016c9544b1fb62dc5ac5484 | Python | 7,052 | 206 | # 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, sof... |
ce91f9f29d4ecb9d351aa0304111b464f336bf8739265047cc589f4be39e5721 | Python | 7,054 | 192 | from __future__ import absolute_import
from torch import nn
from torch.nn import functional as F
from torch.nn import init
import torchvision
import torch
from .pooling import build_pooling_layer
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
class SeparableConv2d(nn.M... |
28c8f7430ca4d8e3d038d484b7cfe656c77a54f441e32ea6962362e5df121d72 | Python | 7,056 | 222 | # The ImpedanceFitter is a package to fit impedance spectra to
# equivalent-circuit models using open-source software.
#
# Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de
# Copyright (C) 2018, 2019 Julius Zimmermann,
# julius.zimmermann[AT]uni-rost... |
b1463e520a8116cb7523d28d705d54ae40710953f36ef6d299a79802b42f0404 | Python | 7,058 | 202 | from os import path
import nipype.interfaces.fsl as fsl
from nipype import Function, JoinNode, MapNode, Node, Workflow
from nipype.algorithms import confounds as ni_confounds
from nipype.interfaces.io import DataSink
from nipype.interfaces.utility import IdentityInterface
from niworkflows.interfaces.confounds import N... |
a1347853bcadd4ec6b4bb2b4c28b49fe3054598f9618367551c7c7a72f21a630 | Python | 7,059 | 165 | from typing import Generator, Any, Tuple
from zigzag.classes.stages.Stage import Stage
from zigzag.classes.cost_model.cost_model import CostModelEvaluation
import os
import pickle
import json
import numpy as np
import logging
logger = logging.getLogger(__name__)
class CompleteSaveStage(Stage):
"""
Class tha... |
070c597cf0886b78957b9950e1fed90c5998f0c6591066cf1864050ad3eb5ff3 | Python | 7,060 | 205 | import os
import numpy as np
import pandas as pd
import torch
import math
from tqdm import tqdm
from torch import nn
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score
from torch.utils.data import Dataset, DataLoader
from pathlib import Path
device = torch.device('cuda' ... |
6d2a72dbe0017e744bdd859b6f977b10e92e27bfdddf1c46869a7fb039356b52 | Python | 7,060 | 125 | import numpy as np
from brainscore_vision.benchmark_helpers import bound_score
from brainscore_vision.benchmarks import BenchmarkBase
from brainscore_vision.benchmark_helpers.screen import place_on_screen
from brainscore_vision.metrics import Score
from brainscore_vision.model_interface import BrainModel
from brainsco... |
f57b036da37e7089a931ff5fb7e38e293ee1820b5398ef3315cd78dc87c16b40 | Python | 7,062 | 149 | """ This file contains the function to create the main csv file to access all separately stored training data files.
The function create_complete_triples() searches through the existing folders that contain radargrams, labels and
wind parameters/metadata.
It performs a matching of timestamps as a unique identifier and ... |
0282a1a440faa9bad18d4466615c444ef30bd7fcff61a429a2b32191456c7537 | Python | 7,063 | 198 | """
stability_simulated.py
-----------------------
This script trains multiple DLIM (Deep Latent Interaction Model) instances
on simulated datasets with and without spectral regularization.
It evaluates model performance in terms of validation MSE and Pearson correlation
and generates comparative plots for analysis... |
039d152027776fde445b101e91e4064a973b263be4c5c313acf20ec450e9c46b | Python | 7,064 | 172 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from .attention import AttentionLayers
class GraphNeuralNetwork(nn.Module):
"""Graph Neural Network with attention mechanisms for spatial transcriptomics."""
def __init__(self, hidden_dims_c: list,... |
9af3b7bbc69967f8a041b514d572065edad652ab697375018397624552b013d6 | Python | 7,064 | 228 | """
This module contains shared functions for DKPN that are required in seisbench.models and seisbench.generate.
It exists to avoid cross-imports between models and generate.
"""
from __future__ import annotations
import numpy as np
from obspy.signal.filter import bandpass
from scipy.signal import lfilter
_DKPN_ANNO... |
fb7692118ecea447a03dfffd8f1722e7bb8285f875446f1d662bff9e367634b4 | Python | 7,064 | 166 | """Which calcium measure(s) a CAT-NAP run analyses, and what to call each one.
``Params.twop_activity`` names one measure of neuronal activity — detected
calcium events (``peaks``), the denoised fluorescence trace (``denoised F``),
raw fluorescence (``F``), or suite2p's own spike estimate (``spks``). Every
adjacency m... |
9224df81a0c958a3062bd8b70f68850c6626c18af06178bea845cad0acc02bba | Python | 7,065 | 99 | from nipype.interfaces.base import (CommandLine, CommandLineInputSpec, traits, TraitedSpec,
BaseInterface, BaseInterfaceInputSpec, File)
from nipype.interfaces.matlab import MatlabCommand
import re
import os
import shlex
import subprocess
from traits.api import Directory, Str, List, ... |
a42b133050f6525059160128896077815e8a93c15bdd238c12e8ae736335e627 | Python | 7,066 | 204 | import numpy as np
import pandas as pd
import json
import os
import networkx as nx
import pickle as pkl
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
import matplotlib.colors as col
from matplotlib import cm
from sklearn import metrics
from sklearn.preprocessing im... |
a091cd5111dbb8d075c7fc7f17052272492ca9995e5210512b40886292d7d14b | Python | 7,070 | 202 | #!/usr/bin/env python3
"""
Usage: ./prepare.py filepath --sheet_name
Author: Mei Wu, https://github.com/projectoriented
"""
import os.path
import sys
import logging
import argparse
import pandas as pd
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth... |
056bed855cbb9a06b5db51ca913b5e00b93bcb0f730c3c6f31b41e59ee93deb7 | Python | 7,071 | 252 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
349635d471090f5e9701056efe9acf57d7c306c10ec1bebd650498010200b6fa | Python | 7,071 | 177 | import os
import numpy as np
import cv2
import torch
import yaml
import pandas as pd
from argparse import Namespace
from monai.transforms import (
Compose,
ToTensord,
ScaleIntensityd,
AsDiscrete
)
from monai.networks.nets import UNet
from torchmetrics import Dice, JaccardIndex
from monai.metrics import ... |
869084d677eeabad2a1af29d4e02dfa57c3c469f45a55a85cb2a938a7b2776ed | Python | 7,071 | 252 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
89a85af0880ee94689ea6f8a913aa10c8ffadfd389995bc8f62aa8469b9b4a02 | Python | 7,071 | 252 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
e936d07a255618f6b49ded1f7f01b50ab59b0993e04f8961a1c514d606efc681 | Python | 7,071 | 224 | from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
import yaml
from eir.setup import schemas
from eir.setup.input_setup_modules.common import (
DataDimensions,
get_data_dimension_from_data_source,
)
... |
ec413a940a0f95d50b1f4856a472f7ad511b2808ef4955925ceff12aff2cb119 | Python | 7,071 | 163 | #!/usr/bin/env python
"""
Handles a single camera.
Notes:
1. There is one of these per camera.
2. The name of the camera is the name of the module.
Responsibilities:
1. Operate the camera.
2. Return the camera configuration when requested. This includes
things like the camera maximum value, whether it ... |
119b758f918d7b21f0b51848ef7ffcddc2cfb00d228d64d9bd9ef297a24356c2 | Python | 7,073 | 186 | # 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... |
4b8bf0e9be23e85176c184cae605588860fe8b07a4d80c93164aafffe391ea44 | Python | 7,073 | 252 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
35e9f4df62a919b27992ef99b6ad38c81ee701c5c31765540f57109c03bf95f5 | Python | 7,075 | 199 | import re
import json
import pandas as pd
import numpy as np
from tqdm import tqdm
import argparse
import networkx as nx
import ijson
from datetime import datetime
MONTH_DICT = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
CURRENT_TIME = dat... |
ed2ec228416b1066b2093f4e762275cdeafd683300696b7e8eb4fab117bc49f8 | Python | 7,075 | 252 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
eee72197bbd0632dcef8da0fc46cc5df1043c6c8470d32cd37661b75ab4c72f6 | Python | 7,075 | 252 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015-2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PA... |
86de4ecdf34b12d8cce17fbcdcd03c683d4f81ae7ab7df6e2d91a65aa2fff27c | Python | 7,077 | 123 | from brainvoice.spectrogram_utils import linearspectrogram, get_better_synth_hparams
from brainvoice.visualization import gen_spectrogram_cmap, plot_spectrogram_on_axis, save_borderless
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
import matplotlib.pyplot as plt
im... |
becc7d3ebb50533bdeb772f8977d6eab493d976cb41f390abc153948974e60b5 | Python | 7,078 | 181 | from pathlib import Path
from typing import Literal
import numpy as np
from argclz import AbstractParser, as_argument, argument
from argclz.dispatch import Dispatch, dispatch
from neuralib.atlas.ccf.dataframe import RoiSubregionDataFrame
from neuralib.plot import dotplot
from neuralib.plot import plot_figure
from neu... |
3cf9f091cfb3e2134839cc6606a71cebb7333c0aa6dbefae967d07ad71407d08 | Python | 7,079 | 254 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICUL... |
45184ef4a9c818792230d0c26cd24062e5340796047b8a26223711d5c42c5e31 | Python | 7,079 | 254 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICUL... |
5e90e2857d079d308fea5306b31c5d7dbd47b3a5cb7900f700094d08ddae664c | Python | 7,079 | 254 | #!/usr/bin/env python
"""Python script to run cell model"""
"""
/* Copyright (c) 2015 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICUL... |
36d62341d5b249af8890e6cf98a4422d1f07b9822df0b9a992fcbecbc19218f2 | Python | 7,081 | 176 | """DD-Database access layer.
Garces Correa et al., "Drivers Drowsiness Database: A collection of
physiological signals during the use of a driving simulator", Zenodo record
8284057 (CC0). Ten volunteers, two 2-hour trials each, 40 hours total.
<root>/<SUBJ>_<TRIAL>.edf 7 channels @ 128 Hz
<root>/... |
c2b177d05070d3cec72d29110b1524450b68318047cdf86fcabdea57d5b31a63 | Python | 7,082 | 226 | import os
import random
import warnings
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import LSTM, GRU, SimpleRNN
from tensorflow.keras.layers import Input
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers impo... |
f49418f9770e3e34d9904d5fe8bf26767d6ce88af7a1623b21f45a1ee4593e9a | Python | 7,082 | 138 | import matplotlib.pyplot as plt
import optuna
import os
import numpy as np
from nested.optimize_utils import OptimizationHistory, OptimizationReport, normalize_dynamic, clean_axes
from nested.utils import param_array_to_dict, param_dict_to_array, read_from_yaml
from optuna.importance import PedAnovaImportanceEvaluator,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.