sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7b7d3ab6c08cae03bf2ad6b1b2982d80f9bbd60abbd7596a76ab7da1fdcf90f5
Python
2,962
73
#!/usr/bin/env python # -*- coding: utf-8 -*- """Initialization of LFPykit This program 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) any later version. This...
4c18b28c310818e886d2990d13fc30310eb2c1a493f741cb827db36ec3d21b70
Python
2,963
62
##################################################################################################################### # Clone FastSurfer repo git clone -q https://github.com/deep-mi/fastsurfer.git cd fastsurfer export FASTSURFER_HOME=$PWD # Install python dependencies python3 -m pip install --user --trusted-host pypi....
5f139c3656856ba8fb8956d77297b40200fbda306f945c5e82295a9a77eda1c1
Python
2,963
107
# -*- coding: utf-8 -*- import numpy as np import h5py from matplotlib import pyplot as plt """ Created on Wed Sep 13 14:36:22 2023 @author: alex """ # %% def transformnet(stim_trans,net0,n): net0i = np.int(net0*n+1) net0i[net0i>stim_trans.shape[2]]=stim_trans.shape[2] net0t = np.zeros...
657449f7b3541bfa11c06def61440002e591aa1670a0f5543ecbb61e9e0f5a9b
Python
2,963
84
import torch import torch.nn.functional as F from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.integer.quant_utils import ( AsymmetricSignedQParams, GlobalMinMaxObserver, SimQuant, ) from elasticai.creator.nn.integer.relu.design import ReLU as ReLU...
e46196a89865cfcd96782731dc448b2e66951035a56649c7d93fb057bcd74b44
Python
2,963
97
# -*- coding: utf-8 -*- """ Created on Tue Apr 13 18:51:40 2021 @author: divyoj """ import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import numpy as np import seaborn as sns sns.set_style("whitegrid") start=10; stop=10; step=1 def calculate_delta...
e75c4f568081cf2cfce6c8dda700a004041464aa723c6648e1a63461ecd0756d
Python
2,963
64
#!/usr/bin/env python ## this script creates dataframes from the full similarity matrices for each movie and parcel ## and saves them to a new CSV file ## The dataframes contain the correlation values for each pair of subjects. import pandas as pd from pathlib import Path # Define the range for nodes num_nodes = 210 ...
7d6e296199fa39c1fa543b6b8103f8f1360b5564303e59ad1a70f4c183b03b72
Python
2,964
73
import pandas as pd import os from cuppa.constants import MOCK_DATA_DIR from cuppa.classifier.cuppa_classifier import CuppaClassifier from cuppa.classifier.cuppa_prediction import CuppaPrediction, CuppaPredSummary from cuppa.performance.performance_stats import PerformanceStats from cuppa.visualization.visualization i...
9622b209a1a5f69330f7df61c7ea1515ed1c63b228d246505ef1f1133dcf210e
Python
2,964
100
# pylint: disable=too-many-function-args, invalid-name """ BSNIP ICA dataset loading script""" import numpy as np import pandas as pd from omegaconf import DictConfig from src.settings import DATA_ROOT def load_data( cfg: DictConfig, dataset_path: str = DATA_ROOT.joinpath("bsnip/BSNIP_data.npz"), indice...
1d44a9f1751cd742fe9a4f18e882943f55462099eb81b8cd19f314ffd73721a7
Python
2,965
87
from __future__ import print_function,division import sys import os import numpy as np import pandas as pd import topaz.utils.star as star name = 'coordinates_to_star' help = 'convert coordinates table to .star file format' def add_arguments(parser): parser.add_argument('file', help='path to input coordinates ...
50a292769188552c49d14f87b85ca4c03576d2a1406a3f1202241cb919af7357
Python
2,965
68
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch def flatten_graph(node_embeddings, edge_embeddings, edge_index): """ Flattens the graph into a batch size one (with dis...
5cbb28658c2860acb1bb1264d79de714864549fe23f4b675d57d1d5f73e00813
Python
2,965
103
import h5py import numpy as np import torch from torch.utils.data import DataLoader, TensorDataset import torch.nn as nn import torch.optim as optim import torch import torch.nn.functional as F from torch.optim import Adam class VAE(nn.Module): def __init__(self, latent_dim=30): super(VAE, self).__init__(...
e3f775c5ecb058aede0e80534a11ddb747208af437a717094f62dd02bac7269e
Python
2,966
86
import torch import torch.nn as nn import torchvision.transforms as transforms from torch.utils.data import DataLoader, Dataset import nibabel as nib import os import numpy as np # Define the 3D AlexNet model class AlexNet3DADClassify(nn.Module): def __init__(self, num_classes=2): super(AlexNet3DADClassify...
8ca229ff7a178409498151407e59ffe8abbfb215f1c21da81f6098c91b52b0cc
Python
2,967
65
#!/usr/bin/env python ## this script creates dataframes from the similarity matrices ## (upper triangle) for each movie and parcel ## and saves them to a new CSV file ## The dataframes contain the correlation values for each pair of subjects. import pandas as pd from pathlib import Path # Define the range for nodes ...
ee47dea2e8f285b2b7cab6703f737e85effa6a2d938d144de26bf89bc95dbb50
Python
2,967
83
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
7f8146cf146d0f668781e819535f7f7edf30da67adada0867ac3a766df159fd0
Python
2,968
99
"""Calibration utilities for photoreceptor isomerization rates. Port of calcIsomPerWatt.m and IsomerizationConverting.m """ from pathlib import Path import numpy as np # Physical constants _PLANCK = 6.62607004e-34 # m^2*kg/s _SPEED_OF_LIGHT = 299792458 # m/s # Data directory _DATA_DIR = Path(__file__).parent / ...
b80c5c0c90bb87accf641f146d213d7643b255aacb0fbb285f55df845ba4272e
Python
2,968
108
"""Command-line tool functionality. Parses arguments and determines which tool should be called. """ import sys import argparse from abc import ABC, abstractmethod from typing import Dict import importlib # New tools should be added to this list. TOOL_NAME_LIST = [ 'preprocess', 'train', 'denoise' ] ...
c40fb9157b44ba239691adf34c9f0bd0e0e066af555664bdfadd3562d491b219
Python
2,968
98
"""Calculate and save number of trials for all recordings.""" from __future__ import annotations import csv import pathlib from typing import Annotated import mne import mne_bids import numpy as np import pandas as pd import pte from pytask import Product import motor_intention.project_constants as constants OUT_DI...
4d2f3cb0259fc5cf0be6bae9fb308db3350215974187231b0b76b424a16647a3
Python
2,969
77
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
1d3aca110f1dd7adae25a5aa67777edd4449571b4ea516c9fbcd9b9f9253227d
Python
2,970
70
import argparse import os import pandas as pd from constants import SCORE_COLUMNS from tabulate import tabulate _BASE_DIR = './results/lukas-final/' _ML_PREDICTIONS_ROOT = _BASE_DIR + 'final-aug_01/rey-multilabel-classifier/' _RG_PREDICTIONS_ROOT = _BASE_DIR + 'final-reg_01/rey-regressor-v2/' _PRED_CSV_PATTERN = '{...
4e7a14e7c907f69ebd24ac9b43ffdef55c5f2df106358ee05a397be9a01b6e53
Python
2,972
112
import os import numpy as np import torch import pickle import scipy.io as sio def mkdir(d): """only works on *nix system""" if not os.path.isdir(d) and not os.path.exists(d): os.system('mkdir -p {}'.format(d)) def _get_suffix(filename): """a.jpg -> jpg""" pos = filename.rfind('.') if po...
76a7763917e7875a7516bcf6b327754f50d8bd633cdb8a004bd315d1304b46c3
Python
2,973
73
# -*- coding: utf-8 -*- r""" This package implements the louvain algorithm in ``C++`` and exposes it to python. It relies on ``(python-)igraph`` for it to function. Besides the relative flexibility of the implementation, it also scales well, and can be run on graphs of millions of nodes (as long as they can fit in mem...
94312e178353de447ff68c1ad891258cc7bafd12b1dd9f52ccf246bf3348e726
Python
2,973
110
import yaml import numpy as np def load_config(config_path: str) -> dict: """ Load configuration from YAML file. """ with open(config_path, 'r') as file: return yaml.safe_load(file) def cluster_signal( signal_array: np.ndarray, channel_list: list, cluster_list: list ) -> np.n...
c6101287d97f0a65240a9427c494acfc012d109df93281c64f8aeb51ba099683
Python
2,973
51
#!/usr/bin/env python #Likelihood calculaiton model import pysam from SCanSNP.VCFUtils import * from SCanSNP.GenUtils import * def ComputeLikelihood(vcf,GenotypesDF,Counts,DiffOnlyIndex): ''' The ComputeLikelihood function calculates and sum up Altscores and Refscores of the possible mixed genotypes for every locu...
2423f14fd7b7e5e1dcf93a7ca9a13c554be0388268e3c5196fdbbe128228c2d3
Python
2,975
71
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # 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...
479eb2fc3bd94f15a8426b8f2fc002ac68f3b3644a33c33a7ea6738660b3bb3e
Python
2,975
80
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
6b5b0c7186d9ae5ef76cac0b035e0a9729fdb8e0c8ba330001f001e127560a52
Python
2,975
104
import numpy as np from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA from sklearn.pipeline import make_pipeline from mne.decoding import CSP from help_funcs import load_exp_variables from classification_pipelines import classify_feature # ----- # # Selection of classification hyperparamete...
0b29d539fe0365d35330733ada505649c1e752a76a45c3d5b25f022de8a8300a
Python
2,976
64
#!/usr/bin/env python ## this script creates dataframes from the full similarity matrices for each movie and parcel ## and saves them to a new CSV file ## The dataframes contain the distance values for each pair of subjects. import pandas as pd from pathlib import Path # Define the range for nodes num_nodes = 210 # 2...
1d70195c92d903280e51dd603e06b2a89b9f184b0931e60bd29f0bd175ff33dd
Python
2,976
99
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm from common_setup import IssueConfig, IssueExperiment SUITE_SAT14 = [ 'barman-sat14-strips', 'cavediving-sat14-adl', 'childsnack-sat14-strips', 'citycar-sat14-adl', 'floortile-sat14-st...
6df910ad9ba8ad9633d1b66cc5dce699f2e094dd20065cbe4a3c40fd3de4400b
Python
2,976
99
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm from common_setup import IssueConfig, IssueExperiment SUITE_AGL14 = [ 'barman-agl14-strips', 'cavediving-agl14-adl', 'childsnack-agl14-strips', 'citycar-agl14-adl', 'floortile-agl14-st...
ccea062e6bc2af8be6d9d082a6622ff5a351941481f4bd4e1874cc71da5a82be
Python
2,976
99
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm from common_setup import IssueConfig, IssueExperiment SUITE_MCO14 = [ 'barman-mco14-strips', 'cavediving-mco14-adl', 'childsnack-mco14-strips', 'citycar-mco14-adl', 'floortile-mco14-st...
feab3e55fbc8aa52b473cbf6be790affdc8d3318e221ca19a4732d3968a668a5
Python
2,976
72
import lightning.pytorch as pl import pandas as pd from torch.utils.data import DataLoader from dataset import TrainSeqDatasetProb, TestSeqDatasetProb from training_config import TrainingConfig class SeqDataModule(pl.LightningDataModule): def __init__(self, val_fold: int, test_...
227af4a621d137bbec7f22a46ddab91b167b0d4f0c1f370efd2b1f07c8d9bcb6
Python
2,978
92
# # Copyright Bradley Lowekamp # # 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.txt # # Unless required by applicable law or agreed ...
4514cffaed05ab9ddaf85b7c7d01ed879d8abf8f7554caf7b3c7fe4d0ce2305e
Python
2,978
70
from ..region_1020 import (FRONTAL_REGION_LIST, GENERAL_REGION_LIST, HEMISPHERE_REGION_LIST) from ..standard_1020 import STANDARD_1020_CHANNEL_LOCATION_DICT from ..utils import (format_adj_matrix_from_adj_list, format_adj_matrix_from_standard, format_...
4ee520df8677547a44d03bdfe18e7f264f22e3ae1a040b62bce1fbde094013c5
Python
2,978
73
import torch import torch.optim import torch.utils.data import torch.nn.parallel from core.train import * from core.test import * from utils import * from core.network import get_model from loss import get_criterion from datasets import get_dataloader def main_worker(args): args.logger = initialize_logger(args) ...
81f0d4ab17f141af0fb175b25d60ddd138fd893e41bdc85aed61d73333dedea0
Python
2,978
99
import torch import numpy as np import scipy.sparse as sp from torch.nn import functional as F def identity_mapping(x): return x activation_map = { 'relu' : F.relu, 'leaky' : F.leaky_relu, 'selu' : F.selu, 'sigmoid' : F.sigmoid, 'tanh' : F.tanh, 'none' : identity_mapping } ...
a4ec17e2e0b20e30b3c54786d1881e77ff5d99e7607eaf9ad70900ac01a49493
Python
2,978
98
from typing import Optional import jax.numpy as jnp from netket.operator import AbstractOperator, ContinuousOperator from netket.utils.types import DType from netket.utils.numbers import is_scalar from netket.vqs import VariationalState, FullSumState from netket.stats import Stats from tre_tvmc.driver.infidelity_psi....
ff1e9c5b26a34c7e021b66fa87366f76198065db48b4e8c3c89083a6f5653c2d
Python
2,979
91
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
bbe2c765db9fbbcde5a549502e8dd9bdb9a31d6d4b04768ca98c53d8d800dea5
Python
2,980
65
#!/usr/bin/env python ## this script creates dataframes from the similarity matrices ## (upper triangle) for each movie and parcel ## and saves them to a new CSV file ## The dataframes contain the distance values for each pair of subjects. import pandas as pd from pathlib import Path # Define the range for nodes num...
0c15c82331bddb9aa499c7be77ab8a8bd0ffa5a1356a210e9020b9664a434b60
Python
2,981
47
"""posthoc_histamine_2026-09-30.py (POST HOC, descriptive). SIGNCHECK flagged the lamina on 30 Sept as "a prediction to test". Known answer: fly photoreceptors release histamine, which opens chloride channels on their targets (Hardie 1989; Gengs et al. 2002) — an inhibitory synapse. The transmitter classifier has six c...
ab7dda92c6f0fd0a24cd95c690a72847344c6c70adf3e776f2b4ed9e156e61e9
Python
2,981
78
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from downward.reports.compare import ComparativeReport from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue717...
ec89ec630af35c2f97cd4a0b212bd116f37828a570dac78e0e4f80bb348a24e1
Python
2,981
85
#!/usr/bin/env python3 ## this script creates dataframes from the full similarity matrices for each movie and parcel ## and saves them to a new CSV file ## The dataframes contain the correlation values for each pair of subjects. import pandas as pd from pathlib import Path # ------------------------------------------...
4839970d2467c8213cfca2d1f222270a12c9a88c56519cef65e0c23eaa864960
Python
2,982
94
from torch import Generator from torch.utils.data import DataLoader from pathlib import Path import pandas as pd from ..prixfixe import DataProcessor from .utils import BHI_preprocess_data, BHI_preprocess_df, BHIDataloaderWrapper from .dataset import BHISeqDatasetProb """ 230406 BHIDataProcessor added - Target standa...
8c8339981f74ad542c154ff3ef0891b69eceeb9384ef58af7b410ea2872fa51d
Python
2,982
73
##this script takes in output from targetP, WPS and localiser and gives a list of proteins predicted to go to organelles import os import pandas as pd def process_targetp(file_path): df = pd.read_csv(file_path, sep="\t", comment='#', header=None, skiprows=2, usecols=range(7)) df.columns = ["ID", "Prediction",...
4010315e64cba98ba89bc44e1d2eaefe06c2247c1e0a67b34929610707a4c092
Python
2,983
90
#!/usr/bin/env python import os from deephe3 import testResultAnalyzer prompt = ''' ------------------------------------------------ # ============================================ # # Analyzing Tool for DeepH-E3 Test Result # # ============================================ # Type in the numbers to choose an act...
e80b8396342dbdff3d0d3354c9633b937a1494ffe5abbd0d53e20d28ab5e3816
Python
2,983
82
""" Pygments ~~~~~~~~ Pygments is a syntax highlighting package written in Python. It is a generic syntax highlighter for general use in all kinds of software such as forum systems, wikis or other applications that need to prettify source code. Highlights are: * a wide range of common lan...
0bd9bedb6e9aa9e9e0dab8186a2fdb678348e48f1532df6aa2e7c6698a675eae
Python
2,984
110
import numpy as np import pandas as pd from numba import njit from sklearn import preprocessing @njit(debug=False) def get_row(v, row, n): """Extract a single row from a condensed distance matrix.""" values = np.zeros(n, dtype=v.dtype) for j in range(n): if row == j: continue ...
1adf1c1db5580af9e31287f470c0c69bde36a0df08b7ea8c7c5da7b79b4be9f7
Python
2,985
93
"""Tests for the _TerminalJobMixin heartbeat / watchdog logic.""" import os import sys import time PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") impor...
4164b965c15b19091e30fe4a7e695d564a15e7e92b914f118aba888832673c83
Python
2,985
83
""" Agent: Implementation of the forgetting model """ import numpy as np from scipy.stats import beta from random import choices from en_utilities import safe_div class Agent: """ This class definition specifies the properties of the object that implements the forgetting model """ def __init__(self, agent_v...
7a1d4bdab0d461be7f71572e9e69bb57c93fd9d9aa5c5ed5dbce176423b0f203
Python
2,985
72
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
7e767936f90a52f95f09ed970df79d00d849c70e1ad55f44f21caca27c4b8f8b
Python
2,985
65
# # MIT License # # Copyright (c) 2022 GT4SD team # # 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,...
0469fb29e74fc1697b8d57cdfb8bb28b7f30457976102000c555f05febb9b120
Python
2,987
85
""" https://github.com/MIPT-Oulu/Collagen/blob/master/collagen/modelzoo/segmentation/decoders/_unet.py """ import torch.nn.functional as F from torch import nn import torch from model_utils.modules import Module from model_utils.modules import ConvBlock class DecoderBlock(Module): def __init__(self, inp_channel...
0b3a74fdb0e0d71145eee0c9ebbd8b2811b64816303060eeaa3c774615c1161b
Python
2,987
80
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
20c8a611bf226b57928eb7a1d6f9214746fd4e30c5ea6b49ef95d536bf3d02a2
Python
2,987
76
from pathlib import Path from typing import Any, cast import torch from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.sequential.design_builder import SequentialDesignBuilder from elasticai.creator.vhdl.design.design import Design from .design import Sequenti...
6bbc076e03a375924bd4195e2387caac429d125220503aded52a75e1f79da92c
Python
2,987
90
################################################################################ # Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md # # All rights reserved....
b8da0ca78754329c5d996162acd4325d93e916fd3eed1b477cc172d4098f017f
Python
2,987
66
# Ultralytics YOLO 🚀, AGPL-3.0 license import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = " " import torch from ultralytics.yolo.engine.results import Results from ultralytics.yolo.utils import DEFAULT_CFG, ROOT, ops from ultralytics.yolo.v8.detect.predict import DetectionPr...
243d1951fa38d6c99e4fa796c854ca3cebdaa83d4bb70e0d22e034f66413ff5a
Python
2,988
88
from __future__ import print_function import os import numpy as np import tensorflow as tf import tflite_runtime.interpreter as tflite from tensorflow.python.platform import gfile # import pandas as pd BOTTLENECK_TENSOR_NAME = 'pool_3/_reshape:0' JPEG_DATA_TENSOR_NAME = 'DecodeJpeg/contents:0' RESIZED_INPUT_TENSOR_NAM...
555bf80e9169b33e1fcdbee2eae2743d34344b32eba2bcbffd6c6aef84a61520
Python
2,988
107
""" Core recipes for EMT. NOTE: This set of minimal recipes is mainly for demonstration purposes. """ from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.emt import EMT from quacc import job from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize if TYPE_C...
643cced25c5022339b5c0528f9ac98a10d5c5f3568a6174ba7296b5b2974df93
Python
2,988
56
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later ''' Compute simplex counts of the full and E-E subgraphs of the original and manipulated connectomes. Author(s): Daniela Egas S. Last update: 11.2023 ''' import scipy.sparse as sp import pandas as pd import con...
942c1c340a689a479ffc74c6a1cea0dec9d833566d5fa62f6b3130e2c6a830be
Python
2,990
86
from __future__ import annotations import re from typing import Any from wikibaseintegrator.datatypes.basedatatype import BaseDataType from wikibaseintegrator.wbi_config import config from wikibaseintegrator.wbi_enums import WikibaseSnakType class Lexeme(BaseDataType): """ Implements the Wikibas...
b73e9517bb995f96ebb154eac0b4806851f294dfdb009470c231d875527e0087
Python
2,990
56
from sklearn.linear_model import LinearRegression #from ..tools import regression import numpy as np def multregconn(activity_matrix, target_ts=None, parcelstoexclude_bytarget=None): """ activity_matrix: Activity matrix should be nodes X time target_ts: Optional, used when only a single tar...
e7e26e41c9de78d86f02ae9e28d036df3dcde110026c1742c42a21ee48d66e38
Python
2,990
67
options = dict( ) doc = dict( __class__=""" Builds a Decision Tree (DT) on a preprocessed dataset. """ ) examples = dict( categorical_encoding=""" >>> import h2o >>> from h2o.estimators import H2ODecisionTreeEstimator >>> h2o.init() >>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-pu...
5b4689eb48de1cf677a7c8800aaa844a3c443db89cc308c0bf0f7890d159f8dd
Python
2,991
81
import torch import torch.nn as nn from torch.nn import init import math from ..utils import _to_triple, _triple_same, _pair_same class _ACSConv(nn.Module): """ Base class for ACS Convolution Basically the same with _ConvNd in torch.nn. Warnings: The kernel size should be the same in the thr...
09ddbcfb44876ac83fe3277e5039695de9ac6f03e7d4ce93a8cdbe929f66a206
Python
2,992
79
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
4455f5eededf40bcdd75103e6b17bc5881f26d7a3734c38a333581a798cca358
Python
2,992
100
from . import base from . import functional as F from ..base.modules import Activation class IoU(base.Metric): __name__ = "iou_score" def __init__(self, eps=1e-7, threshold=0.5, activation=None, ignore_channels=None, **kwargs): super().__init__(**kwargs) self.eps = eps self.threshold ...
5079914b879acc19457f6ea1e05445a6a72e15d147bd2e8d192aa02a68fabfb6
Python
2,992
156
import unittest from parameterized import parameterized from HyDGL.element_look_up_table import ElementLookUpTable class TestElementLookUpTable(unittest.TestCase): @parameterized.expand([ [ 15, 'P' ], [ 86, 'Rn' ], ]) def...
65e0d3cb6320b845ca3367166a1e8878322b4580ae773d6e2985317f1cddc7e3
Python
2,992
67
"""Regression test: the registration result viewer must load a custom-atlas annotation in ANY supported format, not just NIfTI. A custom 2D atlas can supply its annotation as the per-slice TIFFs written by the coronal TIFF exporter. The viewer used ``load_nii_pir`` (nibabel only), which raised ``ImageFileError: C...
6de321a26079eea828d3e7d3af731acc951b0464f1eb7c3b442305f2f22949c6
Python
2,992
103
from random import randint import cocotb import pytest from cocotb.clock import Clock from cocotb.triggers import RisingEdge from elasticai.creator.arithmetic import int_arithmetic, int_converter from elasticai.creator.testing import CocotbTestFixture, eai_testbench from elasticai.creator_plugins.bram.utils import lo...
d17c1b00a16b2dbd8a75cea0d28801d9e99803419cbd35d0e53f94c8921f3545
Python
2,992
104
# Node-group asset "Outline Mask" (ShaderNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING fr...
575f0c897294cc1bb3262018901f737fa1dac8e56a5d91d3ebea2cf7e929d6c7
Python
2,995
76
extensions = dict( extra_params=[('verbose', 'FALSE')], set_required_params=""" parms$training_frame <- training_frame args <- .verify_dataxy(training_frame, x, y, autoencoder) if( !missing(offset_column) && !is.null(offset_column)) args$x_ignore <- args$x_ignore[!( offset_column == args$x_ignore )] if( !missi...
1b2d8225a6cc4f6b4f9975c17990a21842b79748c976af6de4b0e7d1e5ee9cb4
Python
2,996
83
# -*- coding: utf-8 -*- """ Created on Thu Oct 21 11:54:57 2021 @author: CY """ import torch from torch import nn import torch.nn.functional as F import copy class ProjectorHead(nn.Module): def __init__(self, in_channels: int, hidden_size: int, out_size: int): super().__init__() ...
30fe6530cea147c18f701a44b06af68b96ea1fd66e6f6484679aeef45b77fabb
Python
2,996
103
from __future__ import annotations from types import SimpleNamespace import pytest from quacc import job from quacc.wflow_tools.customizers import customize_jobs, update_parameters def test_customize_jobs(): def add(a, b=1): return a + b def mult(a, b=2): return a * b jobs = customize...
497fb3d7808b89a3485e2e056b5d2ef895d07df9f172807422e2fa9dbe65366f
Python
2,996
73
"""The char_set and code_point keys travel from the error call onto the issue dictionary.""" import unittest from hed.errors.error_reporter import ISSUE_DETAIL_KEYS, ErrorHandler from hed.errors.error_types import ValidationErrors class TestIssueDetailKeys(unittest.TestCase): def test_string_level_error_carries...
9ef6a7d03f2ce21f0a32f9a0e1f9e50170cc73942e7c28780f3d311a4a9cf776
Python
2,996
95
## # \file MotionSimulator.py # \brief Abstract class to define interface for motion simulator # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date September 2017 # # Import libraries import os import numpy as np import SimpleITK as sitk from abc import ABCMeta, abstractmethod import pysitk.p...
ef9fd340725a85bdd1e6a67ec4a242af2e37b32a618cd048a576e6ca950791a8
Python
2,996
63
from src.models.other_models.resnet import * from src.models.other_models.resnetV2 import resnet18V2 from src.models.other_models.shallow_cnn import * from src.models.rey_regressor import * from src.models.other_models.efficientnet import * from typing import * import torch.nn as nn def get_architecture(arch: str, ...
28f1b95afa1326a8c009c0845afd28adc331d85cb549462bf1ad9534f2226507
Python
2,997
117
import matplotlib.pyplot as plt import numpy as np import meep as mp resolution = 40 # pixels/μm Si = mp.Medium(index=3.45) dpml = 1.0 pml_layers = [mp.PML(dpml)] sx = 5 sy = 3 cell = mp.Vector3(sx + 2 * dpml, sy + 2 * dpml, 0) a = 1.0 # waveguide width/height k_point = mp.Vector3(z=0.5) def parallel_wavegui...
b8502783983868b0d68def243478e1ef3e7b3d7e3f8766a718715dfaef43b126
Python
2,998
101
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
d7c6ee734b8dae3539c265b2253481b04c802b5958585770325f9c785c550e1b
Python
2,999
117
"""Protocol definitions for HDL abstraction. This module defines the protocols (interfaces) that all HDL implementations must follow. Using Protocol classes allows for structural subtyping (duck typing with type checking). """ from abc import abstractmethod from collections.abc import Iterator from typing import Any,...
0706f1fea26b8368a6fde7746ff310199e40698105c3449fd47267bd0ee1deeb
Python
3,000
96
# Utilities for MRI postprocessing # # Copyright (C) 2014 David S. Smith # # This program 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 2 of the License, or # (at your option) any later ver...
939c56065fd8dcea1ad9c72ba6feea712dd9df11bdc80d7be3e3bdcc62d143bd
Python
3,000
98
from __future__ import annotations import json from typing import Any from wikibaseintegrator.models.basemodel import BaseModel from wikibaseintegrator.models.claims import Claims from wikibaseintegrator.models.language_values import LanguageValues from wikibaseintegrator.wbi_enums import ActionIfExists ...
3f1243d2cff9370a95a39bd49080849944b7d829d9e15c1b6e3387e8b30cbfa3
Python
3,001
93
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
bd740790c02afa3314cade80287d3c82cf7495c64a2bd18de93c66cee3fc0aef
Python
3,001
103
import sys from os.path import expanduser, join, isfile import threading from tornado import web, ioloop, httpserver from sockjs.tornado import SockJSConnection, SockJSRouter import json from collections import OrderedDict import numpy as np clients = set() n_messages = 0 def read_points(fn): if isfile(fn): ...
ca190c70ae5b5f4501c9bf7edd1411a2a4c0168367cfd334cd0a26316dd4388d
Python
3,001
81
"""Constants used for the""" from hed.schema.hed_schema_constants import HedSectionKey # These are only currently used by the XML reader/writer, but that may change. XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance" NO_NAMESPACE_XSD_KEY = f"{{{XSI_NAMESPACE}}}noNamespaceSchemaLocation" NAMESPACE_XSD_KEY = f...
08e39e4a8c6e5e441505366c4465a0d17e0ccbc2329151a039cb139581c40836
Python
3,002
88
"""Implements a Gaussian mixture model, in which parameters are fit using gradient descent. This example runs on 2-dimensional data, but the model works on arbitrarily-high dimension.""" import matplotlib.pyplot as plt from data import make_pinwheel from scipy.optimize import minimize import autograd.numpy as np imp...
f7ff31838a537724c7bd593845191c1c181d49ef3fddcfca20b8d4170900e606
Python
3,003
82
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
fceac232e380f1e76f722876a3cd3497365bf8761d98a9941110a808df6ca6a8
Python
3,003
108
import itertools as it import warnings import autograd.numpy as np import autograd.numpy.random as npr from autograd import grad, value_and_grad from autograd.test_util import check_grads rs = npr.RandomState(0) def arg_pairs(): scalar = 2.0 vector = rs.randn(4) mat = rs.randn(3, 4) mat2 = rs.randn(...
8c37bcdf3da4787ea20fb6c5c4c5ba4ce9c1d3e737617b1e39a80d08ba77f257
Python
3,007
118
#!/usr/bin/env python #****************************************** # # SHARC Program Suite # # Copyright (c) 2023 University of Vienna # # This file is part of SHARC. # # SHARC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by #...
b4a3f8aa1521c6ee35b5c565044675f71a84c2d7e416cd4c639aed3ada726e4d
Python
3,007
58
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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 # # ht...
19e3f33a911d00757a2650c2c5f1ccb203baa29969336d01d966a629a538925c
Python
3,008
94
import os import random from time import time import pandas as pd import numpy as np import networkx as nx import argparse import pickle import math from utils.utils import * from utils.graph_creation import * from utils.motif_counts import * from utils.visualization import * import graph_tool.all as gt sns.set_conte...
129eecb04fb1ec1d6820871cf1bc70182cfb4dd304af2674b4e8085732b1e2bc
Python
3,009
46
# -*- coding: utf-8 -*- import argparse from supar import CRFDependencyParser from supar.cmds.run import init def main(): parser = argparse.ArgumentParser(description='Create first-order CRF Dependency Parser.') parser.set_defaults(Parser=CRFDependencyParser) parser.add_argument('--mbr', action='store_t...
b9fd60ac3e28d510e405926c922c71a3a6218058be54218a1f0bfb873c2461b5
Python
3,009
74
# -*- coding: utf-8 -*- import argparse import sys def parse_args(): argparser = argparse.ArgumentParser() argparser.add_argument( "domain", help="path to domain pddl file") argparser.add_argument( "task", help="path to task pddl file") argparser.add_argument( "--relaxed", des...
d9a16a4683415bca65d4253eaab2ef208dc8d3a8c772309982db841a981cceb2
Python
3,009
110
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
0a547b30bf2ece43968a194901877b7131ada5aee45e9ccad2fefe31a954e502
Python
3,010
107
from dataclasses import dataclass import torch from torch.nn.parameter import Parameter from elasticai.creator.base_modules.linear import Linear, MathOperations from elasticai.creator.base_modules.math_operations_torch import TorchMathOperations from tests.tensor_test_case import TensorTestCase def tensor(data: lis...
9e24ab58e3b739f50ae016166d5ab2ddafca0b3a5379982417f986a932030d39
Python
3,010
88
from __future__ import annotations import re from typing import Any from wikibaseintegrator.datatypes.basedatatype import BaseDataType from wikibaseintegrator.wbi_config import config from wikibaseintegrator.wbi_enums import WikibaseSnakType class Sense(BaseDataType): """ Implements the Wikibase...
f154b4a5a2ef2f86f32ab10e45448be58fb69d3d66ac96f3b359da93b9cfdd4b
Python
3,010
80
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") from utilities.script_func import init, post, ScikitFeat_pre import pickle import logging logging.info("") def main(): import Models.models as Models import Models.model_func as Model_Fu...
99eb8f14848db74768667d7706b39bfe3ce73f954b01ee8720b134738f8dcc48
Python
3,011
105
# Node-group asset "Slice Edge Instances" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_C...
9c67b84a1546b176f7a910fb87731dfecd15a6813978d3badf11542d68ee258e
Python
3,014
92
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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...
a6713d3082cd19db9338d7291877e14d812b2733f3b965a8a255ece50a7d6c07
Python
3,014
95
from __future__ import annotations from typing import TYPE_CHECKING import jax.numpy as jnp from flax import linen as nn if TYPE_CHECKING: import jax import jaxlib class FlaxEncoder(nn.Module): n_latent: int = 10 n_layers: int = 2 n_hidden: int = 800 dropout_rate: float = 0.1 latent_dis...
c17883c48e418a7052c15fadefe7f4f6d46232087b3eb5f554b3cd1b148714e3
Python
3,014
46
# -*- coding: utf-8 -*- import argparse from supar import CRF2oDependencyParser from supar.cmds.run import init def main(): parser = argparse.ArgumentParser(description='Create second-order CRF Dependency Parser.') parser.set_defaults(Parser=CRF2oDependencyParser) parser.add_argument('--mbr', action='st...
0b3b3619e3ba436eda31778b61b2e7a2e290109f541c1ed88dd67080d84a5efd
Python
3,016
76
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
0d19528a68364c859cfbd427099f74c83014d6c85f12548f57bb36aa5ae5ff9e
Python
3,016
76
# # MIT License # # Copyright (c) 2022 GT4SD team # # 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,...