sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c0a2ebc14617a69f13dee7a2c32b4179952e8e8c20c2d2ca3d3f29c862c6bdaa
Python
5,004
124
import re import nibabel as nib from lib.qc import QCResult from lib.qc_report import QCReport, fig_to_png, legend from lib.qc_srcsink import DEFAULT_THRESHOLDS, plot_loop, plot_surfaces from lib.surface import TERMINAL_NAMES from lib.utils import setup_logger log_file = snakemake.log[0] if snakemake.log else None lo...
010a6282ac6c48c523617d46b3ebd0581cb5de9910d3546129b6a46c49af76b5
Python
5,006
132
# Copyright (c) 2017-present, Facebook, Inc. # # 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...
53b39d41dc9d09226c4ba5995af6fcba226a6456ca93fbe3470fe533a290700a
Python
5,007
151
"""An example of training a REINFORCE agent against OpenAI Gym envs. This script is an example of training a REINFORCE agent against OpenAI Gym envs. Both discrete and continuous action spaces are supported. To solve CartPole-v0, run: python train_reinforce_gym.py To solve InvertedPendulum-v1, run: python tr...
6b330efe53f5f5980f0743ecfdf2db7a78cd12d20add9b179c536de87540a8e8
Python
5,007
109
import numpy import os, glob import pickle import h5py PATH = "../../data" if __name__ == "__main__": # # Resolution, Bleach, Squirrel # directories = [ # "20210618-145645_optim_1params_3objectives_degree4", # "20210619-071126_optim_1params_3objectives_degree4", # "20210621-095150_op...
f59ef41e54a5b7f27e9033f4b66e929bc41686a0b941f745d72aa9e33c7828e7
Python
5,007
102
from typing import Dict import numpy as np from basis_functions.time_basis_functions import make_cosine_bump_family, trim_basis_by_cond_index, basis_shift_forward, \ backshift_n_samples, trim_basis_reduce_condition_number from lib.dataset_specific_hyperparams.glm_hyperparameters import GLMModelHyperparameters d...
b09e4ef61196c99ce31c5c797c5e008a7714926d0fa0dbba718dfa7362ab0583
Python
5,008
112
from abc import ABC, abstractmethod import networkx as nx import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm import os import os.path as osp import multiprocessing class PGDataset(ABC): """Generic class for loading datasets. It has all of the methods required to write the dataset in order ...
0b92695adf1f3c56b0e01f719d5d63c10814668f431f8e3a178ef85bf4958ab3
Python
5,010
147
# Copyright 2023 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, ...
322b46149b0c15a32ea25426698bc6d0c008263deab88fd613f219fe322786d7
Python
5,010
173
from exputils.misc.attrdict import AttrDict, combine_dicts import exputils as eu import os import copy # TODO: Feature - tensorbord output # TODO: Featrue - allow to log sub values, for example: agent.epsilon class Logger: """ Configuration: numpy_log_mode: String that defines how numpy data ...
4fc09534bde8e7f80eda6e7cc681b935a8528a85eb52c41277cb55fa8a3aa107
Python
5,010
134
import os import shutil import argparse import subprocess from argparse import RawTextHelpFormatter def get_parser(): parser = argparse.ArgumentParser( description='Convert BIDS datastructure to nnU-Netv2 datastructure.', formatter_class=RawTextHelpFormatter, prog=os.path.basename(__file__...
6d1428e8a8563b3fa54c6245b23ef88347ee712c66997fb9f6cbc1dbf581f6bb
Python
5,010
155
import cv2 import numpy as np import os def show_cam_on_image(img: np.ndarray, mask: np.ndarray, use_rgb: bool = False, colormap: int = cv2.COLORMAP_JET) -> np.ndarray: """ This function overlays the cam mask on the image as an heatmap. By defau...
0a7c801441135b2bc71879eaf10258b140d0de2388c2601907c7700444a96dd4
Python
5,012
128
# -*- coding: utf-8 -*- """ Creating probabilitic activation maps from Neurosynth data Created on Wed Aug 2 13:41:55 2023 @author: JoshB - Downloads neurosynth data (version 7 - can be modified) and converts into NiMARE dataset using individual terms (can be modified to topics) - Conducts coordinate-based ...
18cb3910bcd91c3fa2e904ce0f1a76054389700808e4444000b4f5d4510fa980
Python
5,012
104
import argparse import projectmetis.proto.metis_pb2 as metis_pb2 from projectmetis.python.learner.learner import Learner from projectmetis.python.learner.learner_servicer import LearnerServicer from projectmetis.python.utils.proto_messages_factory import MetisProtoMessages from projectmetis.python.logging.metis_logg...
dc7a3020a7a094bb6c8af3a58ee4f96cc04ad827e456bb79c07c3cef9294cd66
Python
5,013
161
import numpy as np import cv2 as cv import torch from torch import nn import skimage from scipy.ndimage import uniform_filter def impute_missing(x, mask, radius=3, method='ns'): method_dict = { 'telea': cv.INPAINT_TELEA, 'ns': cv.INPAINT_NS} method = method_dict[method] x = x.cop...
a0a208c0641dec10e7f44a3b0935f8122f1bafa766bcceb2e588bbb66f86f117
Python
5,016
153
#!/usr/bin/env python3 """ nii_deface.py — mask+crop a 3D NIfTI with an MNI-space face mask Usage: python nii_deface.py /path/to/img.nii.gz Requirements: - antspyx, nibabel, numpy - The files "MNI152_T1_2mm.nii.gz" and "mniMask.nii.gz" must be in the same folder as this script (used as moving image and ma...
e2176ac3050bc80339b4dd9347e9cf4d077b232acdb8934bc8d3331acb9aeccb
Python
5,016
158
import torch import numpy as np import scanpy as sc from scipy import sparse from torch.utils.data import Dataset, DataLoader class MetaQDataset(Dataset): def __init__(self, x_list, sf_list, raw_list): super().__init__() self.x_list = x_list self.sf_list = sf_list self.raw_list = r...
55a9a71ee89d9bde632bbe7b3a2bb192e0137d99eb83ae320b37217871b30ebb
Python
5,018
140
import torch from datetime import datetime from torch.optim import AdamW from transformers import get_linear_schedule_with_warmup from torch.utils.data import DataLoader, RandomSampler, SequentialSampler from agent.classifiers.evaluation.evaluation_mgmt import get_evaluation_measures, get_f1_measure from agent.class...
525cc02e2607bd5ca7672899f7f2c9484fc720762a2c487cd1b90957addd9bb5
Python
5,019
174
import os import tempfile import pytest from pfrl.replay_buffers import PersistentEpisodicReplayBuffer @pytest.mark.parametrize("capacity", [None, 100]) class TestEpisodicReplayBuffer(object): def setup_method(self, method): self.tempdir = tempfile.TemporaryDirectory() def teardown_method(self, met...
9323f7cbe6482a838418e231e48e5043b08b618e547687cfa542fadb82926e3a
Python
5,020
128
#################################################################################################### # Copyright (c) 2020 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
e95a1d24acd12d80ba8c937733a21335e95d0f6bdb4047dae1efa330dfbfc676
Python
5,020
157
from typing import List from dataclasses import dataclass, asdict import itertools import logging import pandas as pd @dataclass class DataColumns: protein_col: str = "pdb_code" chain_col: str = "chain_id" pos_col: str = "position" wtAA_col: str = "wtAA" mutAA_col: str = "mutAA" from_col: str...
cbe44c848881c9e5bf0717825241aab45f25b70fe098357e52ff263b954dea30
Python
5,021
91
# coding: utf-8 """ # # SCRIPT: IDENTIFY THE FMRI-BASED REACTIVATION ONSETS ONSETS IN REST # # PROJECT: FMRIREPLAY # # WRITTEN BY QI HUANG 2022 # # CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY """ # In[1]: import relevant packages import os import warnings ...
2d8f926bcc69062b3171edef8ecfc8915364b157ace5000eba7cbde5a9ec1a04
Python
5,022
152
#!/usr/bin/env python # import from __future__ import print_function ## batteries import os import sys import gzip import bz2 import argparse import logging import csv import urllib.request import codecs from collections import OrderedDict ## package from bin import __version__ import gtdb2td # argparse desc = 'Conver...
4111646abd69fe2e2ea12d3b5f1cd75f109aa69578f5b3bf1f7615c6adf1cf99
Python
5,022
124
from sklearn.datasets import make_blobs from sklearn.model_selection import train_test_split from reval.best_nclust_cv import FindBestClustCV from sklearn.neighbors import KNeighborsClassifier from sklearn.cluster import AgglomerativeClustering from sklearn.metrics import zero_one_loss, adjusted_mutual_info_score from ...
86fc97890c8192177f306c69a9bccc6a757ddb91f3857460b0c3eb1047a953da
Python
5,022
158
import pandas as pd import pytest from data_profiling import ProfileReport # Enhanced fixture with more diverse data types @pytest.fixture def sample_categorical_data(): return pd.DataFrame( { "dummy_cat": [ "Amadeou_plus", "Amadeou_plus", "Beta...
d760eb6bba458cdd5c2120c35f5be4792704869985df44ed1134f5360ed33154
Python
5,022
64
import json,numpy as np import matplotlib; matplotlib.use("Agg"); import matplotlib.pyplot as plt plt.rcParams.update({"font.family":"DejaVu Serif","font.size":8.5}) def cm(ax,C,labs,title): C=np.array(C); ax.imshow(C/C.sum(1,keepdims=True),cmap="Blues",vmin=0,vmax=1) for i in range(C.shape[0]): for j i...
99493e1aa0c049d03489b0de55dc7cbc7645385241114e47a5fd8eae9f096cd3
Python
5,023
175
from pathlib import Path from typing import Literal import math import pickle import json import matplotlib.pyplot as plt import argparse import logging import pandas as pd import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from timm.utils import ModelEma from timm.loss import Label...
9c53b31fd2fe82414657897b0bf201fbf59bf9d506f96335e1b72a26cec7dd91
Python
5,025
180
from __future__ import annotations from abc import ABCMeta, abstractmethod from pathlib import Path from typing import TYPE_CHECKING #from cytoolz import memoize from .ctdb import CisTargetDatabase from .datatypes import RegionOrGeneIDs if TYPE_CHECKING: import pandas as pd from .genesig import GeneSignatu...
87d7dbec01bb5926086a51eb251203891e48a34e30decfa2b7ba982cd6cfde70
Python
5,027
135
r"""Cross-reference metabolite names ↔ HMDB / KEGG / ChEBI / LipidMaps IDs. The lookup is **online-first**, cached forever: 1. :func:`map_ids` calls :func:`omicverse.metabol.fetch_hmdb_from_name` per name, which hits the PubChem REST API (synonym-aware) and pulls HMDB / KEGG / ChEBI IDs from the cross-reference...
4e701f3186d284ef920afdeecc0c514adad4461e33247ae4ece4c2a46865f376
Python
5,030
176
import matplotlib.pyplot as plt import pandas as pd import seaborn as sns def plot_assignment_entropy( ad, title="Entropy of Metacell Assignment", save_as=None, show=True, bins=None, figsize=(5, 5), ): """Plot the distribution of assignment entropy over all cells. Each cell is assigne...
93dde08bddc3c13888f0b941f472e07238e328a53987796c663f9055d54f1e8b
Python
5,030
134
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Python version: 3.10.9 pandas version: 1.5.0 numpy version: 1.23.3 seaborn version: 0.11.0 matplotlib version: 3.6.3 pingouin version: 0.5.3 ptitprince version: 0.2.6 scipy version: 1.11.4 """ #%% Import Modules import pandas as pd import glob import seaborn as sns i...
ace18a0ebffa424e0aeb6eec514f2b95afe25444aaa532b12ada3f235f12bc1e
Python
5,030
152
"""Correlations between variables.""" from typing import Optional import pandas as pd import pyspark from packaging import version from pyspark.ml.feature import VectorAssembler from pyspark.ml.stat import Correlation from pyspark.sql import DataFrame from pyspark.sql.functions import PandasUDFType, lit, pandas_udf fr...
cfde2c1cd23901e4bb3bd99c2122fcc3ea134699bba76544f8fb3ad9d9e2e593
Python
5,030
131
import torch from torch import nn from ..utils import create_norm import math def select_pe_encoder(pe): if pe in ['sin', 'sinu', 'sinusoidal']: return Sinusoidal2dPE elif pe in ['learnable', 'bin']: return Learnable2dPE elif pe in ['naive', 'mlp']: return NaivePE elif pe in ['l...
ea789ac7f7ed58f1aebe36dc9abac11bc49a8af538883b28e9a2f7c9ee0c2a93
Python
5,030
136
r"""RNA secondary structure & thermodynamics (ViennaRNA). RNA folding controls translation (RBS accessibility), riboswitches, sRNA regulation and sgRNA activity. Thin, well-typed wrappers over ViennaRNA: * :func:`rna_fold` — minimum-free-energy structure (dot-bracket) + ΔG. * :func:`rna_accessibility` — opening ener...
2349153829e8d0839b53a533e411ababd94a80ab8ff9fcbff9217320f3925754
Python
5,032
155
import os import sys import cv2 import torch import numpy as np import matplotlib.pyplot as plt from matplotlib.image import imread from gimpformats.gimpXcfDocument import GimpDocument #from datasets import SkullUSDataset from utils import load_xcf, makeDict from metrics import hull, concave_hull, convex_hull #from d...
67a3c4dcc8490b74b43edf831da37edbb39a49427a69c8550b456adc94237d9f
Python
5,035
151
import tensorflow as tf from tensorflow.keras import backend as K import os, sys import h5py import matplotlib.pyplot as plt from utils import * import gc sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import matplotlib.pyplot as plt; plt.rcdefaults() from tqdm import tqdm import warnin...
80f3645c63e240b31d79bb01ca219ffbf6464d5ded405724ec826cd1a4fca324
Python
5,035
106
import os import click import torch import itertools import numpy as np import pandas as pd from Bio import SeqIO from scripts.model import SPIRED_Fitness_Union from scripts.utils_train_valid import getDataTest amino_acid_list = list("ARNDCQEGHILKMFPSTWYV") amino_acid_dict = {} for index, value in enumerat...
9b7d7b60601cddfed0b6d8614dfe267814fcbd6d34eb8d83a1ffd17d3ce07f18
Python
5,035
161
import sys from itertools import groupby import pandas as pd import numpy as np window_size = 15 max_seq_len = 100 factorDict ={ "A":[-0.59,-1.30,-0.73,1.57,-0.15], "C":[-1.34,0.47,-0.86,-1.02,-0.26], "D":[1.05,0.30,-3.66,-0.26,-3.24], "E":[1.36,-1.45,1.48,0.11,-0.84], "F":[-1.01,-0.59,1.89,-0.40,0.41], "G":[-0.38,1...
bc3d547b98beb054c81689aabc0a9476582c2f8cef56ea33a158e04f4716602d
Python
5,035
148
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
18419c576b4a85089c411450719de35b54853f7745f6c014bca2448a8c4e0125
Python
5,036
151
import abc import logging import os from typing import List, Literal, Union import mdtraj from mdtraj.core.trajectory import Trajectory as mdtraj_trajectory from mdtraj.reporters import HDF5Reporter from openmm import Integrator, LangevinIntegrator, OpenMMException from openmm import unit from openmm.app import ( ...
3d739297434c03fd17fa328fe5dc82bbf68ed29f218691767e89187840bfbbed
Python
5,037
132
import torch import torch.distributed as dist import torch.multiprocessing as mp import argparse import os, glob from sklearn.model_selection import train_test_split from torch_geometric.loader import DataLoader import socket from src import AseReadDatasetAttr from src import TrainerFineTuneClassification from equifor...
4f61cf2f7f8c6a695395d8b4ebc72fc27d6382062a5113e4325f755f435b446f
Python
5,037
134
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 19 12:36:50 2022 @author: sam """ import pickle import numpy as np import matplotlib.pyplot as plt plt.rcParams['svg.fonttype']='none' def evaluate_fit(model,synapse_mask_fun,syn_fractions, n_genes,n_neuron,folder): #check if...
e6bb466071138d9bb4b08c5d7a1aa40dba1559fbb7462a01b76eca71d1fe080f
Python
5,042
183
# built-in dependencies from typing import Any, List, Union # project dependencies from deepface.commons import package_utils, weight_utils from deepface.models.FacialRecognition import FacialRecognition from deepface.commons.logger import Logger logger = Logger() # pylint: disable=unsubscriptable-object # -------...
0e0b71278ae4fe8f0d5e209cb40be10a0f56d602eec725ebae29fa2a93d77344
Python
5,043
142
import matplotlib.pyplot as plt import math label = "Phospho (STY)" class Precursor: def __init__(self, precursor: str, qvalue: float, is_human: bool, is_phospho: bool): self.precursor = precursor self.qvalue = qvalue self.is_human = is_human self.is_phospho = is_phosph...
473f18ecea4b21a717458c3b68ab592e18343579fcd192df2d9b856c87a3ec82
Python
5,044
177
# import torch # import torch.nn as nn # from pathlib import Path # from sinabs.activation import ActivationFunction, MembraneSubtract # MODELS_FOLDER = Path(__file__).resolve().parent / "models" # def build_model(): # from sinabs.from_torch import from_model # layers = [ # nn.Conv2d(2, 8, kernel_si...
118d6ebce9e7afb1b52099d7677b9f2bb54633b3d3cc1145223ea525212fa67e
Python
5,048
198
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import json import os import torch model_params_subdir = "ModelParameters" optimizer_params_subdir = "OptimizerParameters" latent_codes_subdir = "LatentCodes" logs_filename = "Logs.pth" reconstructions_subdir = "Reconstructions" reconstruc...
dbd09e8f9ce1d39275e4a3af0f06749c1625544ada63441041925e4c7158a935
Python
5,048
142
"""Various utility functions.""" import numpy as np import scipy.sparse as sp import torch from typing import Union def l2_reg_loss(model, scale=1e-5): """Get L2 loss for model weights.""" loss = 0.0 for w in model.get_weights(): loss += w.pow(2.).sum() return loss * scale def to_sparse_ten...
67bb7b4737e44f936c757b277e2e2a485c0f7f0ccf1c9b5c016aaad2cda92f79
Python
5,049
167
import subprocess import samtools import filehandle import logging log = logging.getLogger(__name__) def samtobam( sam, outbam ): ''' Use samtools to convert a sam file to a bam file outbam will be overwritten if it already exists @sam - file path or file object(even pipe) of sam file inp...
9445ef4befd609c5698ded788686a3246d99e23956b3452c203dc8a964e73b2b
Python
5,049
109
# Copyright 2023 The HuggingFace Team. 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 applicabl...
70d1d2b47faf248e24af43283053d58e68ae8a38161433b0c4db8095703c95a6
Python
5,050
131
""" The code for the research presented in the paper titled "Enabling inverse design of plasmon-based nonlinear square resonators with deep neural networks." This code corresponds to the article's forward Deep Neural Network (DNN) section. Please cite the paper in any publication using this code. """ import ma...
5ffe64334aee8ecc56eefecb190af651ae425ce39a2b035e10e88d6a78f64620
Python
5,052
113
import os import torch import anndata as ad from ..model import OmicsFormer from abc import ABC, abstractmethod from typing import List, Union from .experimental import symbol_to_ensembl import json import warnings import scanpy as sc def load_pretrain( pretrain_prefix: str, overwrite_config: dict = No...
dc6d96f9e04c381acfe381476f3afb291cfa466c97c13ea3c19e3552517e1924
Python
5,058
140
import pandas as pd import numpy as np import re def moca(df): """ computes domain scores for moca. run this before applying uds conversion. """ # naming df['MOCANAMI'] = df[['LION', 'RHINO', 'CAMEL']].sum(axis = 1) # memory registration df['MOCAREGI'] = df[['IMMT1W1', 'IMMT1W2', ...
073cd78d33f931bc31047ea7ec2addac22fb1d2f39502c12bb0788f950c027a1
Python
5,059
149
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
31aabb6a38fc960e0cdf05a3bf4256de86c5287a9cebcae95d884af789b9c481
Python
5,060
172
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
8053dc6f63ab2f643be34d6df3ae07563123d77f644d4fecc68364033b08b3ef
Python
5,062
130
from abc import ABCMeta, abstractmethod from typing import List, Tuple, Union import torch import torch.nn as nn from mmengine.model import BaseModule from mmengine.utils import is_list_of from torch import Tensor from lqit.common.structures import SampleList from lqit.registry import MODELS from lqit.utils import Op...
a66288e0d1667012c9833bd351adc900926660e78212a97991b9649184b8cf58
Python
5,064
132
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ====================================================================== # DEFINE FUNCTION: FUNCTION TO GET THE SUBJECT-SPECIFIC INFORMATION # ====================================================================== def get_subject_info(events, confounds): """ FUNC...
c9d2284b0ff89b82bb8bea8553772cdfc0687669faf45f567a2a930c1af4a644
Python
5,069
188
""" implementing "two networks with merging outputs" in https://github.com/synsense/sinabs/issues/181 """ import torch import torch.nn as nn from sinabs.activation.surrogate_gradient_fn import PeriodicExponential from sinabs.layers import IAFSqueeze, Merge, SumPool2d class SNN(nn.Module): def __init__(self, bat...
482455009549d6e862561cdbfc15164e1a3e1bcbd5a8d9fb1f7aceb1c8a41941
Python
5,070
136
#------------------------------------------------------------------------------ # Libraries #------------------------------------------------------------------------------ import torch import torch.nn as nn import torchsummary import os, warnings, sys from .flops_counter import add_flops_counting_methods, flops_to_s...
9cf6f7926a789cea04917ed0e37c03cda3367adb9fa33bd6afdf8b6dc16ceb5a
Python
5,072
143
# %% this script creates formatted data for figures. import pickle from importlib import reload from matplotlib.lines import Line2D from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.preprocessing import StandardScaler import umap import create_new_target_data as cnd import matplotlib i...
84b5e631984607e981cb53be71009aad28e001aa4eb9e9a98191d6bc7b9393c6
Python
5,073
173
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import glob import logging import numpy as np import os import random import torch import torch.utils.data import deep_sdf.workspace as ws def get_instance_filenames(data_source, split): npzfiles = [] for dataset in split: ...
41c090b5d30ad0c43aca6705711e47ea9c1791b95ad7971e3d6daf08dbce3906
Python
5,075
153
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Data classes for the AIHW Composer API.""" from dataclasses import dataclass, field from datetime import datetime from enum import Enum from typing import An...
8518bbcb32a6e48369832d54deaa2db36a1384aebd9b62e3928e50a5d85c5cc8
Python
5,076
130
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import torch from fairchem.core.datasets.atomic_data import AtomicData, atomicdata_list_to_batch cla...
8d886c376f7c1612d11743a75768681fbe58b9d08227e3eeb6be996ec0bce690
Python
5,077
142
import json import numpy as np import pandas as pd from sklearn.cluster import KMeans from pathlib import Path def get_window_boundary(df, make_plots: bool = False, figures_dir: Path = Path('figures')) -> np.ndarray: """ Get time boundaries for each response type. The dataframe `df` contains the two largest ...
ece5d505e1b3bad3919075a6f75f5928935dcd843bd99df72e68a52515939b04
Python
5,077
148
from typing import Callable, List, Optional, Sequence, Tuple, Union import torch __all__ = ["box_to_seg", "seg_to_box", "instance_to_semantic", "pop_keys", "filter_keys"] def box_to_seg( boxes: Sequence[Sequence[int]], shape: Optional[Sequence[int]] = None, dtype: Optional[Union[torch.dtype, str]] = Non...
31b82ccf190dc4d2af0b491933817540508c0baa7b6e238390cd72d28968d512
Python
5,078
128
######################################################## ######### Philipp R. Steen ######### ######### Jungmann Lab ######### ######### Max Planck Institute of Biochemistry ######### ######### Ludwig Maximilian University ######### ######### 2024 ...
85491cb4fbe0b09b2696932cbb685bd5c17647feee1fb59aa06675bea92284cc
Python
5,078
145
#Imports relevant modules. import os import numpy as np import csv #Defines the pipline ID. This will need to be updated. pipeline = '4' #Defines the filepath containing all output files. data_folder = '/<directory root>/Sustainability_Output' #Full path removed for purpose of public sharing. #Defines the path of ea...
9b5d52f08b876608e947173ca74419160b27647ae7eceac7dbb1ba95690d68bd
Python
5,080
159
import matplotlib as mpl mpl.use('Agg') import matplotlib.colors as mcolors import matplotlib.cm as cm from matplotlib.colors import ListedColormap import matplotlib.pyplot as plt plt.rcParams['font.family'] = 'serif' plt.rcParams['font.serif'] = ['Times New Roman'] + plt.rcParams['font.serif'] plt.rcParams.update({'fo...
43f1e90fe68a0278d5f8178c7af571ff9ea15229383f3dc5d02f039cea680fc9
Python
5,081
188
# flake8: noqa # __class_api_checkpointing_start__ import os import torch from torch import nn from ray import tune class MyTrainableClass(tune.Trainable): def setup(self, config): self.model = nn.Sequential( nn.Linear(config.get("input_size", 32), 32), nn.ReLU(), nn.Linear(32, 10) )...
59d96a5c23c41f26d7c8146caafe3f80243087fed40a4f26e79013e61d9f4fa4
Python
5,081
191
import os import torch from tqdm import tqdm import numpy as np import pdb import pickle import matplotlib.pyplot as plt from latent_time_stepping.datasets.AE_dataset import AEDataset from latent_time_stepping.oracle import ObjectStorageClientWrapper from latent_time_stepping.preprocessor import Preprocessor from lat...
7c0a22ab25914f294cc603e1054258fe9e26c73db75d11dfc5881f4d755b1d0f
Python
5,081
166
# Copyright (c) 2017-present, Facebook, Inc. # # 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...
916bc622e452958e772c5ab4048a62ed799fe0d8221fdb387367046a5bbfc510
Python
5,081
124
import argparse import scipy.io as scio import os import time import datetime from skimage import io from DWonder.MN.utils import list2contours, Joint_Mask_List_Simple_Merge_Mask, Joint_Mask_List_Mul, Joint_Mask_List_Simple from DWonder.MN.utils import listAddcontours_Laplacian_pytorch, list2contours, listAddcontours_...
52ba14c045a018fc5a9c452c6edb1d386247c1c465395fbb704d3673a65641d6
Python
5,083
125
import torch import torch.nn as nn import copy from .so3 import SO3_Embedding from .radial_function import RadialFunction class EdgeDegreeEmbedding(torch.nn.Module): """ Args: sphere_channels (int): Number of spherical channels lmax_list (list:int): List of ...
61df246b5b3169a059713d96f259f62bc73508653b7a88c2181d3cdb1cbed1d0
Python
5,083
106
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import pickle import pandas as pd import numpy as np import pcntoolkit as ptk from pcntoolkit.dataio.fileio import load as ptkload from pcntoolkit.dataio.fileio import save as ptksave from pcntoolkit.normative import predict, evaluate from pcntoolkit.util.utils ...
a040bc11c37f876c9792734126397c4790621297a7c8fe483922175f67800d6a
Python
5,083
160
# stdlib dependencies from typing import Any, List, Union # 3rd party dependencies import numpy as np from numpy.typing import NDArray import cv2 import torch from torch import nn, Tensor # project dependencies from deepface.commons import weight_utils from deepface.models.demography.DemographyUtils import EMOTION_LA...
cff82e0612859f3ef54691bad0193e8c4b6c20402f76127546e5c8644586cd92
Python
5,090
156
"""Convert a V3 model to V4. See checkpoints/README.md for usage.""" from tqdm.auto import tqdm import hydra import torch import numpy as np from pathlib import Path import pytorch_lightning as pl import matplotlib.pyplot as plt from torch.nn.modules import module import torch.nn.functional as F from torch.distributio...
50b6ed72ab2a4c05c2b47a69dd947184c44e08266e8a5e4912d32490b2c4adcb
Python
5,092
138
#!/usr/bin/env python """ Compare the QC metrics of two HippUnfold runs (e.g. before and after a change to the workflow) as a self-contained HTML report. python hippunfold/workflow/scripts/qc_compare_runs.py BEFORE_DIR AFTER_DIR \ --qc surface --labels main new -o comparison.html Each *_desc-<qc>_qcmetric...
38968feb45a1a603471498db6b99f4efa0d90424e9ee9445b6ba26144ed83e3a
Python
5,094
140
import tensorflow as tf from utils.nn import linearND, linear from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph from models import * import math, sys, random from optparse import OptionParser import threading parser = OptionParser() parser.add_option("-t", "--train", dest="train_path") p...
da73c0f2ec8716a4825234248de8d20f478ed659a1ea00dfdff91bbe3de47655
Python
5,094
182
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch_scatter import scatter from .utils import pyg_softmax class MultiHeadAttention2Layer(nn.Module): def __init__(self, gamma, in_dim, out_dim, num_heads, use_bias): super().__init__() self.out_dim = ou...
206ff1f5395e7b82cb76087173e6d5e090d84203fc52258ffce611fb690cb019
Python
5,096
152
# Copyright (C) 2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from enum import StrEnum from django.conf import settings from rest_framework.exceptions import ValidationError from cvat.apps.engine.models import Project from cvat.apps.engine.permissions import ProjectPermi...
58d888d5f342e5c735cd04f9995fbcbfde0bae88d3a0b2b8ad8fb522f7a35367
Python
5,097
175
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. Creates LMDB files with extracted graph features from provided *.extxyz files for the S2EF task. """ from __future__ import annotations impor...
b35cf16f2c5c540173ddae3b9b568e1c9548a83f3430e35cbf1c83fb31a9b375
Python
5,098
169
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
ce3bf460f86e3b091006389542039125f0308be0f4790b2c3942eca4ef9e8d26
Python
5,098
112
# -*- coding: utf-8 -*- """Rolling shutter diffuserCam forward model with neural-space time model. This module contains the forward models for rolling shutter diffuserCam and rolling shutter diffuserCam with space-time modeling. The loss functions used for the rolling shutter diffuserCam reconstruction are also provid...
3a5fdf3fb5e12345c4d8307ac49ffb5d7ce125d1c35171e7b242a17352c03be9
Python
5,100
139
import copy import random import unittest import torch from rising.transforms import AbstractTransform from rising.transforms.compose import Compose, DropoutCompose, OneOf, _TransformWrapper from rising.transforms.spatial import Mirror class TestCompose(unittest.TestCase): def setUp(self) -> None: self....
52d4ffb91d2775bf89069365803a993806d0d8b56fa1dd3605db1f29c1f2a4c4
Python
5,101
131
import numpy as np import struct from spinnaker2.neuron_models.application import BaseApplication from spinnaker2.configuration import PEConfig from spinnaker2.neuron_models.common import (add_log_memory_region, collect_routing_targets, format_routing_targets) from spinnaker2.coordinates import ByteAddr, align...
bcd208a1763e126263946fcbffbd6479260c18b60e9b96d2cb5ce27d44077460
Python
5,101
156
#------------------------------------------------------------------------------ # Libraries #------------------------------------------------------------------------------ import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from .base_model import BaseModel from .Res...
1d5c6cb45b1c1814f2fc88e5b835b3ae11d9afc310ba749c83e93a724db737f2
Python
5,102
147
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. Add `extra_repr` into DropPath implemented by timm for displaying more info. """ from __future__ import annotations import torch import torch...
7f5f6bce5a04cf6608c2063e0b5802d82124d46fd74811368bd501b57ccc62de
Python
5,103
162
"""load annotations from the SeizeIT dataset https://doi.org/10.48804/P5Q0OJ to a Annotations object.""" import math import os import re from pathlib import Path import pandas as pd import pyedflib from ..annotations import Annotation, Annotations, EventType, SeizureType from ..eeg import Eeg def _loadSeizures( ...
3f2f33daedc05ab18b8c9027c01f62d4b05d672f9247d5f2a2f278bd595d0d14
Python
5,107
122
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function import numpy as np import joblib import os from .data import DataHub from .models import NNModel ...
34fb12fff811685d736a61c4e555820aff4a02e77d27b49f10b85d0deb0b2f50
Python
5,109
119
# coding: utf-8 import os import sys import unittest from queue import Queue from unittest.mock import patch import pytest # noqa from ray._private.test_utils import load_test_config from ray.autoscaler.tags import TAG_RAY_NODE_KIND from ray.autoscaler.v2.instance_manager.config import AutoscalingConfig from ray.aut...
f8de6e3e3056847611705708e7b5b28051d6fadcd83dca40dd27d0e9eba242f8
Python
5,109
163
r""" Training functions with different strategy """ from math import ceil from typing import List, Optional, Union import torch import torch.nn.functional as F from .loss import feature_reconstruct_loss def train_GAN(wdiscriminator:torch.nn.Module, optimizer_d:torch.optim.Optimizer, ...
79f0dfdca144e1a31c3a95997dd7d60e77f29bb1428b58cfc7db824b8be43ff9
Python
5,110
160
#!/usr/bin/env python # coding: utf-8 """Run Braille inference on SpiNNaker2.""" import os from itertools import islice import matplotlib.pyplot as plt import numpy as np import torch from spinnaker2 import brian2_sim, hardware, s2_nir from torch.utils.data import DataLoader import nir seed = 42 os.environ["PYTHONH...
2eb046d75cab2416e91d55c8f9de289d3bac580a11e3bdf7689b8a601b8e8bd4
Python
5,111
148
import tensorflow as tf import DECIMER.Efficient_Net_encoder as Efficient_Net_encoder import DECIMER.Transformer_decoder as Transformer_decoder TARGET_DTYPE = tf.float32 class Config: """Configuration class.""" def __init__( self, ): self.encoder_config = {} self.transformer_con...
074dc591d9c7b80a9b1b013ebd1141f8b5882f162b1c848bc1dc86f820ee34f6
Python
5,112
88
import pandas as pd from itertools import product def Both_signif_pairs(): exp_signif_list = pd.read_csv('~/Downstream_analysis/Regulators/Lung.m6A_peak_RBP.m6A2me.signif.list', sep = '\t', header = None) out_signif_list = pd.read_csv('~/Downstream_analysis/Regulators/Lung.DNAme_TF.m6A2me.signif.list', sep = '...
7d6a33dd21eb8a6c6ec7a376a0e7b3556af2fda5d17586d2581d83bfcf7cc910
Python
5,112
160
'''test our simple memory mechanism on meta scene vectors ''' import os import pickle import itertools import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from tqdm import tqdm from copy import deepcopy from scipy.spatial import distance_matrix from sklearn.metrics import adjust...
517618a0d8ae000149d5fff7d57b720c6420958d9b3675ec1397b9a865083775
Python
5,113
104
import shutil import getpass from os import path from samri.pipelines import glm from samri.fetch.local import prepare_abi_connectivity_maps def abi_connectivity_map(identifier, exclude_experiments=[], keep_work=False, mask='/usr/share/mouse-brain-templates/dsurqec_200micron_mask.nii', prepare_root='/var/tmp/{user...
9627938699ea3c79dbe1fcb4ec9240a53e2f7b56d40d50838fa77c31edad0af3
Python
5,113
135
from __future__ import annotations """ Unified Skill Builder for OmicVerse. Given a JSON config (validated by config_validator), this module gathers content from documentation, GitHub, and PDFs into a skill directory with SKILL.md and reference markdown files. Security: validates output paths and sanitizes generated...
7f3ad49475517827493cc14f9485dfb74f4f51fb718a69ebd7fca89e6a7ccaee
Python
5,116
145
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
8141da94d1239c26ab0c4a0da7496f03e123bf84c496af2250488cc078c8131f
Python
5,116
161
#!/usr/bin/env python # Sample usage: # python env-setup.py --version 1.5 --apt-packages libomp5 import argparse import collections from datetime import datetime import os import platform import re import requests import subprocess import threading import sys VersionConfig = collections.namedtuple('VersionConfig', ...
df8ddfe21b789a9d6b78b96b564cd7c473b4a54c459e4d0ccb9867f2a8c7b469
Python
5,116
142
#Train import comet_ml import glob import geopandas as gpd import os import numpy as np from src import main from src import data from src import start_cluster from src.models import multi_stage from src import visualize from src import metrics import subprocess import sys from pytorch_lightning import Trainer from pyt...
78398f733817284ba09196f838a10758c1b9d66f17aa527f0bb4f0814408e5a1
Python
5,117
109
import os import json import torch import numpy as np import pandas as pd from Bio import SeqIO from biopandas.pdb import PandasPdb int2AA = {0:'GLY', 1:'ALA', 2:'CYS', 3:'GLU', 4:'ASP', 5:'PHE', 6:'ILE', 7:'HIS', 8:'LYS', 9:'MET', 10:'LEU', 11:'ASN', 12:'GLN', 13:'PRO', 14:'SER', 15:'ARG', 16:'THR', ...
906b03e367a8c538c5d60201fb3762f1ff4b0b1d8b8bbbd87a88b1d0d6f7f2a5
Python
5,118
122
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
10e7673d3b4d9be1f791745e88cacaccdb63253799f218fc69a4eb273af5b7a5
Python
5,120
146
"""Per-sample normalization for proteomics AnnData. ``ov.protein.normalize(adata, method=...)`` is the unified dispatcher that picks between median centering, quantile normalization, and a ``log2-only`` no-op (for already-normalised inputs like Olink NPX). """ from __future__ import annotations from typing import Opt...