sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
4c38466e5235926127418a2624cdac2493a58e2ea94f520764b2afa6fbf74058
Python
16,858
434
""" The implementation is based on Keras DDPM implementation: https://keras.io/examples/generative/ddpm/ """ import os import numpy as np import keras from keras import ops from tsgm.types import Tensor as TensorLike from tsgm.backend import get_backend import typing as T class GaussianDiffusion: """ Gaussia...
945ea9cddbab9389d31cd3e4fc0ab33bca737bea92623857032174687c2e29fe
Python
16,879
420
## ## CPCantalapiedra 2019 import os from os.path import join as pjoin, isdir as pisdir, isfile as pisfile import shutil import subprocess from sys import stderr as sys_stderr from tempfile import mkdtemp, mkstemp import uuid from ...common import MMSEQS2, get_eggnog_mmseqs_db, ITYPE_CDS, ITYPE_PROTS, ITYPE_GENOME, I...
d69bca6971e3caa42940d0319db60468bf42224b4392f10efe76d8c3ca4fe80c
Python
16,908
418
# Copyright (c) OpenMMLab. All rights reserved. # Modified from https://github.com/MendelXu/SAN/blob/main/san/model/attn_helper.py # noqa: E501 # Copyright (c) 2023 MendelXu. # Licensed under the MIT License import warnings from typing import Optional import torch from mmcv.cnn.bricks.transformer import BaseTransfor...
5239723dc9268c39ad1e06861eeb9da91c8d4165061a10accbc6033064857c90
Python
16,931
459
# Author: Huaxu Yu # A module for data visualization. # imports import random import numpy as np import os import re from tqdm import tqdm import matplotlib.pyplot as plt import matplotlib.colors as mcolors import matplotlib.transforms as transforms from matplotlib.patches import Ellipse import matplotlib.font_manag...
6df631cc43e26db5a7491c1ee38a7c63c3dfe1273a4145161728df61fb4443f2
Python
16,934
362
"""TensorBoard callback for training visualization. This is the TF v1 version. A subset of the functionality also works with other backends. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np import warnings from .. import ba...
26db44ce85ca659b5b84aad1e57697cc0f3175ea50b700a5e6b84285f604d8cf
Python
16,946
415
#!/usr/bin/env python # # Utilities for labels # # Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE # TODO: for vert-disc: make it faster! currently the module display-voxel is very long # (esp. when ran on PAM50). We can find an alternative approach by sweeping th...
ca888b9ac50f202e1fac4042f3aa08716e199c3eccb68d03ea43715facb35e54
Python
16,961
319
import numpy as np import torch import torch.nn.functional as F import matplotlib.pyplot as plt from matplotlib import colors from matplotlib.patches import FancyArrowPatch def generateShapes(gridsize, radius, imagesize): """Generate a list of shapes by morphing circles into squares and blobs. Args: g...
0bae46403219f5189be4bbe10f0720592224c069a182402ca00a9c2538df0060
Python
16,967
377
import networkx as nx from networkx import connected_components import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button import time import numpy as np from copy import deepcopy from CybORG import CybORG from CybORG.Simulator.Scenarios.EnterpriseScenarioGenerator import SUBNET from CybORG.Simulato...
5a0839a8e346c3fd1d30ef5d8014a8df90cebcecf83a704b3e63eb3c5dbe1d23
Python
16,967
400
""""Simulated DBTL cycles""" from typing import Union, Optional, Tuple import jax.numpy as jnp import jax import numpy as np from jaxkineticmodel.load_sbml.sbml_model import SBMLModel from jaxkineticmodel.utils import get_logger import matplotlib.pyplot as plt import pandas as pd import scipy import sklearn import xg...
a92148bbd3551fd1267ac58197ec1e4a77d4c883970dd7701f0d40ad3b8da112
Python
16,973
393
import os import tqdm import torch import numpy as np import argparse import json import cv2 import scipy.io as sio import matplotlib.colors as mcolors import matplotlib.cm as cm from scipy.interpolate import interp1d from skimage import io from nns.model import ISOSNet from utils import fix_random_seeds from tools.vis...
93059ca6e6cebb7699dd32b0d4ddf89596bb6799924e98e046a06a6897e4b8c3
Python
16,986
430
# -*- coding: utf-8 -*- import json from django.db import connection from django.test import TestCase import catmaid.state as state from catmaid.tests.common import CatmaidTestCase class StateCheckingTest(CatmaidTestCase): """This tests various aspects of the back-end state checks""" # Work on regular test...
1530971064fff3726a612dea057b868e18e584432f849e07f7ec40b48dec9583
Python
16,992
483
# Copyright (c) Facebook, Inc. and its 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 types import torch import transformers import torch.nn.functional as F from torch import nn from torch.nn import Cro...
c5bf074e4ca8711bd20b522cefae986a58fd79c702bda5bed6684e9e17146c24
Python
17,004
403
# coding=utf-8 # Copyright 2021 The IDEA Authors. 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 a...
8b5f058f094e7aa66a8f09f504f638acad72d762cc11d3d5686cbcd5e05bc842
Python
17,007
478
#!/usr/bin/env python3 import multigrid multigrid.g_reuse_multigridop = False from multigrid import ( Multigrid, MultigridOp, MultigridDecomp, SparseOperator, get_shift_csr, ModNumpy, ModTensorflow, ModCupy, ) from multigrid_plot import plot_3d, plot_grid, plot_grid_matrix import numpy ...
76dcb0644f99205f571c334c22764a5a7166e7fa620f22ad211ef4ff667285c5
Python
17,008
511
import logging from collections import Counter from functools import partial from itertools import combinations from multiprocessing import Pool import numpy as np from rdkit import Chem from rdkit.Chem import Fragments as frag_func from tqdm import tqdm from .scoring_func import * def get_drug_chem(mol): qed_s...
9c60e275508a0427084d5ee2089d27dd0a86db40bf90c3b268e81c1cb8b5716c
Python
17,010
453
from __future__ import annotations import torch from torch import Tensor, nn from chgnet.model.functions import ( MLP, GatedMLP, aggregate, find_activation, find_normalization, ) class AtomConv(nn.Module): """A convolution Layer to update atom features.""" def __init__( self, ...
a715859c942212c6c6a57b0eb286902f56a37d298d7c71159514b7109d222d4a
Python
17,037
507
# -*- coding: utf-8 -*- """ Created on Jan 29 2024 @author: george.dickinson@gmail.com This program is a Python script developed to analyze the motion of intracellular Piezo1 proteins labeled with a fluorescent tag. It allows the user to load raw data from a series of image files and track the movement of individual ...
7f8916903e387526e5b921139b59e38c611300f752c14c85aa5deae4d5bbd932
Python
17,041
360
from pathlib import Path import shutil import tarfile import hydra from omegaconf import DictConfig import torch import torchaudio from functools import partial from tqdm import tqdm import urllib import numpy as np from datasets.audio_compress import LibriTTS test_clean_path = "https://openslr.elda.org/resources/...
af193bc430e966186271e5ae70f5ca690fd243aaac27af863edc583bbc037d2a
Python
17,057
413
import numpy as np import hickle as hkl from sklearn.preprocessing import normalize from sklearn.neighbors import KNeighborsRegressor from grid_cell.manifold_fitter import label_mesh from sklearn.metrics import r2_score import copy from global_setting import * def average_lattice_area(feamap): ''' input: f...
8018c97a90dc9488107ca5dc77a240ef28b226d3aa6ba7c0180dc7921bfac5d2
Python
17,064
322
#!/usr/bin/env python2.7 import os, sys os.environ["OMP_NUM_THREADS"] = "1" os.environ["OPENBLAS_NUM_THREADS"] = "1" os.environ["MKL_NUM_THREADS"] = "1" os.environ["VECLIB_MAXIMUM_THREADS"] = "1" os.environ["NUMEXPR_NUM_THREADS"] = "1" import argparse import shlex import shutil import glob import re import traceba...
4e8941f8a27fb05a7c05680eac3f01e8697e71c5cbc9b140163d0294de25bb0c
Python
17,069
389
import os import torch import torch.nn as nn import torch.nn.functional as F import logging import numpy as np from PIL import Image from diffusers.utils import make_image_grid from dataclasses import dataclass from tqdm.auto import tqdm from initialization import extract_material_parameter class Generator_ClsEmd_ligh...
9c3a2f0f70141605f7c4042d6a5bea974c50546bd7642a21f6adcbf6e49fda9c
Python
17,076
410
# /// script # requires-python = ">=3.10" # dependencies = [ # "matplotlib", # "numpy", # "scipy", # ] # /// """Generate SVG figures for the PSTH significance explanation page. The bootstrap and the consecutive-run filter mirror src/guppy/analysis/psth_significance.py, and the significance bar is drawn ins...
14f067348ee71064a24752b6b5ca19a580e2847e237fff53079397d33d4ac142
Python
17,083
444
import logging import os import nibabel as nib import numpy as np import pandas as pd from pyalfe.data_structure import PipelineDataDir, Tissue, Modality from pyalfe.roi import roi_dict from pyalfe.tasks import Task try: from radiomics import featureextractor except ImportError: featureextractor = None cla...
5f048281cd286cdbcd7b4441ee15db10d5c6220cc179b01265a400261b2b09ae
Python
17,089
470
# Copyright (c) 2021, EleutherAI # This file is based on code by the authors denoted below and has been modified from its original version. # # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complian...
29b0ff465051b399f5956a3d933748b9487a22f110d454a9143b63e2601e69b5
Python
17,096
414
# Copyright 2022 EleutherAI and The HuggingFace Inc. 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 r...
c7bd1076ee5ee2683428c8589f21f0194f1c75dd1c43824f77ea845dc8f69da6
Python
17,100
491
# Copyright DST Group. Licensed under the MIT license. import queue from threading import Thread, Event import warnings from typing import Any, Tuple, Union import gym import numpy as np import pygame from gym.utils import seeding from CybORG.Simulator.SimulationController import SimulationController from CybORG.Shar...
da7d0c7fab02dccec5557a04f5f8bcf55f79dbfab4e4a9b47bb0ce947bd6d2bd
Python
17,103
472
""" Training Agents for GNODEVAE This module implements agent classes that manage the training process for GNODEVAE models. Agents combine environment setup, model training, and evaluation metrics to provide a high-level interface for users. Key Classes: - BaseAgent: Base class with common training functionality - ag...
928dd2675496e95c595d8641dd283dc364e475b6d7c86c22f7989628adaf2f6c
Python
17,120
334
""" Core functions dealing with centerline extraction from 3D data Copyright (c) 2019 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ import os import logging import numpy as np from spinalcordtoolbox.image import Image, zeros_like, add_suffix, reorient_coordinates from spinalcordtool...
29c4a1c998f0d24fde4713855d755fa0386c355a641c6bac9f85928002ec1859
Python
17,122
406
""" Image slice extractors for generating QC reports Copyright (c) 2017 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ # TODO: Replace slice by spinalcordtoolbox.image.Slicer import os import logging import math import numpy as np from scipy.ndimage import center_of_mass from spina...
3d8cf2ec870962d8b84133e8368de258a96c57ece79a8832d10f761b67026c0d
Python
17,128
547
"""Tests for functions in data_utils.py. """ import os import time import sys import tarfile import threading import signal import shutil import zipfile from itertools import cycle import multiprocessing as mp import numpy as np import pytest import six from six.moves.urllib.parse import urljoin from six.moves.urllib.r...
8a2560f33641748f05be5209c3f875ce4f7555a9740ccd518a0bb6caecc40339
Python
17,135
470
import numpy as np import matplotlib.pyplot as plt import json import collections import pandas import seaborn as sns # súlyozott: # /home/tarluca/Modellke_story/Luca_modell_rework/Results_from_NSG/prep_and_run_model_rework_weight3_R0/nsg_csomag_model_rework/results_ca1_results/last.csv # nem súlyozott: # /home/tarlu...
4d5e68172884ffbde0fe298a8f7a5bf9b9f060a05db0834964c62f29fef920fe
Python
17,147
342
#!/usr/bin/env python3 """ # split runs with "fMRI trigger" e.g. binarize the values and identify start stop indices # ttl onsets # convert each event into trial number # do this based on two events: expect and actual # TODO: # * identify BIDS scheme for physio data # * flag files without ANISO # * flag files with l...
0c9be8e1c7e777b0e00a4944395bf8ff8bd7a684c5c955a6774808a8c993461b
Python
17,169
495
#!/usr/bin/env python from __future__ import print_function, division import numpy as np from rdkit import Chem from rdkit import rdBase from rdkit.Chem import AllChem from rdkit import DataStructs import rdkit.Chem.QED as QED import scripts.sascorer as sascorer import pickle import pandas as pd import tensorflow as ...
6a5f87f3d40515489fb0ae139890fa4278ed93df61eaca3c0461db4a89e8dadb
Python
17,183
450
# -*- encoding: utf-8 -*- ''' Copyright 2022 The International Digital Economy Academy (IDEA). CCNL 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.o...
9a07c25562559d2b3e712201363292f93b8c1f4d251bb0a5935bc6e7a4e9b2d6
Python
17,185
473
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals import re import inspect import os import shutil import six try: import pathlib except ImportError: import pathlib2 as pathlib import keras from keras import backend as K from keras.backend import numpy_back...
4eacfe3b0aa1a16f328c226110dcbff426ed9e1f2a30b153d604178d3a6ad37f
Python
17,194
495
#!/usr/bin/env python from __future__ import print_function, division import numpy as np from rdkit import Chem from rdkit import rdBase from rdkit.Chem import AllChem from rdkit import DataStructs import rdkit.Chem.QED as QED import scripts.sascorer as sascorer import pickle import pandas as pd import tensorflow as ...
89278e89c7d825512334ffe03c1bb50558c70b8176a8ed49fec61156a60f0d0a
Python
17,216
385
# Generated by Django 2.1.7 on 2019-02-18 16:37 from django.db import migrations forward = """ -- Obtain the foreign key constraint name in a particular column of a -- specific relation to a target relation. CREATE OR REPLACE FUNCTION get_fk_constraint_name(relname text, colname text, targetrelname text) ...
633b1f53c2f2b17a08e084272c384dff8c2ca9b95f2c02c82f50722002e4dfe1
Python
17,243
410
from typing import Any, Union import torch import torchaudio from auraloss.utils import apply_reduction from auraloss.perceptual import FIRFilter from auraloss.freq import SpectralConvergenceLoss, STFTMagnitudeLoss reduce_map = { 'mean': lambda x: torch.mean(x), 'sum': lambda x: torch.sum(x), 'none': lambda...
df9054b12aab31117d5fe5b52dd9f54afee2ec3e3efb0dfafcf1f946b19e649f
Python
17,247
478
from torch import nn import torch from torch_geometric.nn import global_max_pool, global_mean_pool from torch.nn import Module, Linear, MSELoss, ModuleList #BCEWithLogitsLoss from torch.nn.functional import relu #from torch import sigmoid from torch.utils.data import WeightedRandomSampler import pytorch_lightning as pl...
98ff70d389c840b8087f29312cc0b3b0d5551b212aeb49f84edb9e312f905c98
Python
17,264
524
from rest_framework import status from medperf.tests import MedPerfTest from parameterized import parameterized, parameterized_class class ResultsTest(MedPerfTest): def generic_setup(self): # setup users data_owner = "data_owner" model_owner = "model_owner" bmk_owner = "bmk_owner...
280f26a29e1a1a8172e645b1820402813376e494e6810bb20c04affe33384fe3
Python
17,312
643
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import glob import datalad.api as dl import pandas as pd from zoo_bids.functions import find_root path_project = find_root(project_name='zoo-bids') path_participants = os.path.join(path_project, 'participants.tsv') path_quest = os.path.join(path_project, 'input'...
569b649cdc5ce087360a35dbf9bf310fb3d60a7d6be5a2b6a37ea025f662f358
Python
17,333
551
import os from dash import Dash, html, dcc, dash_table import plotly.graph_objects as go import plotly.express as px import dash_bootstrap_components as dbc import pandas as pd from medperf import config from medperf.utils import sanitize_path from .get_data import get_data from .utils import get_reports_path from t...
a7e320c3e29092503ff267bf4d595008ee77eb1159c8a38766fe8024722f8d79
Python
17,352
496
"""Base layers for model.""" from typing import Tuple, Optional from torch import nn, Tensor import torch import math from .util_funcs import unsorted_segment_sum, coord2diff, coord2cross from .core import MLP class GCL(nn.Module): def __init__( self, node_nf: int = 8, hidden_nf: int = 2...
1d97a31c36423e6dc6f0119c2f91660cbfbb5b55e54bb4b89db5b6ce40176c68
Python
17,353
339
"""Generate stubbed testing data from the full testing_data directory. Run from the project root: python scripts/create_stubbed_testing_data.py Stub durations are hard-coded per session. For sessions with TTL events, the duration was chosen to capture at least 5 complete TTL pulses (rising and falling edges both ...
125b0dfeba718b865e54e92d8e8e02e626ce32d509d8dbf47e40df756a673c0e
Python
17,373
586
import os import csv import random from functools import partialmethod import torch import torch.nn.functional as F from torch.autograd import Variable import numpy as np from pandas import read_csv from sklearn.metrics import ( precision_recall_fscore_support, precision_recall_curve, roc_auc_score, bal...
6b63aa89c820871e7a6aef1177a0f9420428f869bf6015b656188b603b0fdfd0
Python
17,381
433
# Author: Hauxu Yu # A module to summarize the premade data processing workflows. # Import modules import os import multiprocessing import pickle from copy import deepcopy import pandas as pd import numpy as np from importlib.metadata import version from scipy.stats import zscore import time from .raw_data_utils imp...
509167eaf176e58fc6e5e1a6efb8f00e5214f384189b7f6a3ad022a6ce39d68d
Python
17,385
304
"""processingpipeline.py functions to aid in analyses done for (Fickling et al., 2025) author: Logan James Fickling github.com/LoganJF TODO: format_20min_exps_to_15mins isn't strictly necessary as a function as the variable length can be used instead TODO:cluster.py should have the sklearn clustering stuff instead "...
2c4d5447ee7d6f3819e386f2a184e1bd7399b456e926735b35a5a46ed862fadc
Python
17,400
408
"""Main alignment class""" import logging import time import typing as ty import warnings import numpy as np from .utilities import check_xy, convert_peak_values_to_index, generate_function, shift, time_loop METHODS = ["pchip", "zero", "slinear", "quadratic", "cubic", "linear"] LOGGER = logging.getLogger(__name__) ...
cae78d498c0014d3938b04bc6147fa712e78ab23ae66a365cf1e3bf52477718d
Python
17,402
530
# library path import os, sys # lib_path = os.path.abspath( # '/vol/biomedic/users/aa16914/software/SimpleITK/SimpleITK-build/SimpleITK-build/Wrapping/Python/') # sys.path.insert(1, lib_path) import SimpleITK as sitk import numpy as np import math as mt # ssim from scipy.ndimage import uniform_fil...
0f1fc30f74709c6ac98a75d45f8d87c618a99a6f5aab2277a1c8b173d0b4cad0
Python
17,405
423
"""Tests for NwbRecordingExtractor and its private helper functions.""" import numpy as np import pytest from pynwb import TimeSeries from guppy.extractors.nwb_recording_extractor import ( NwbRecordingExtractor, _core_events_split_column, _find_nwb_file, _parse_event_name, _read_ndx_event, _re...
64ddccd213c016249d19dbd4327791746b8d6282fe18250396a8b5c0cb536a7e
Python
17,407
317
"""NCATS GARD (Genetic and Rare Diseases) rare-disease registry data handler. GARD is a flat registry of rare-disease terms distributed by NCATS as a single CSV (UTF-8 with BOM, CRLF line endings) with four columns -- ``ID``, ``DisplayName``, ``Synonyms``, ``URL``: * ``ID`` -- a ``GARD:NNNNNNN`` CURIE (zero-padded to...
97124a3918036c86b860abc0edc4a28202a4e8fc05ec5bde516a5ddc0761d7cb
Python
17,414
444
# Third Party Imports import tensorflow try: # Third Party Imports from tensorflow.python.data.ops.readers import TFRecordDatasetV except: from tensorflow.python.data.ops.readers import TFRecordDatasetV1 as TFRecordDataset # Standard Library Imports import os from math import pi # Third Party Imports im...
db1be21067edc9796e0e6602de808f820de5aa93fcc15cf0e8f616da06e00c48
Python
17,421
403
import pymonetdb import uuid from prov.model import ProvDocument from prov.dot import prov_to_dot import os import sys import json import argparse import re def run(args_list=None): parser = argparse.ArgumentParser(description="Generate W3C document") group = parser.add_mutually_exclusive_group(required=True...
5f7ed98681f1d389a5ed2886577c08c053e559d6419bf42aeb57e1535ceac50e
Python
17,423
429
# -*- encoding: utf-8 -*- ''' Copyright 2022 The International Digital Economy Academy (IDEA). CCNL 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.o...
334ca739b0ed49d7e9617ac190af56d1e72ac6b323dae36982242a1527044a51
Python
17,434
383
#!/usr/bin/env python # # Apply transformations. This function is a wrapper for sct_WarpImageMultiTransform # # Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE # TODO: display message at the end # TODO: interpolation methods import sys import os import functools from t...
b4f9b2a53a3f41983ab07810bfa6eda885a0ebfc6e36a489acb78870d1dfbd57
Python
17,436
450
# Copyright (c) OpenMMLab. All rights reserved. import math import warnings import torch import torch.nn as nn import torch.utils.checkpoint as cp from mmcv.cnn import Conv2d, build_activation_layer, build_norm_layer from mmcv.cnn.bricks.drop import build_dropout from mmcv.cnn.bricks.transformer import MultiheadAttent...
8135649c8ef469f56b9391204074413ab08c8163eee887f1797f9ecd5b215d12
Python
17,438
431
import os,torch,json import datetime, warnings import tensorboardX import numpy as np import torch.nn as nn from utils.config import opt from model import ScaleDense from model.ranking_loss import rank_difference_loss from load_data import IMG_Folder,Integer_Multiple_Batch_Size from prediction_first_stage import test f...
e44183a907f094d3c1da93e9433f617158957cf0a928d26ae91b2f1c38cd1f29
Python
17,464
395
from pathlib import Path import numpy as np import pytest from guppy.analysis.io_utils import ( check_storeslistfile, check_TDT, decide_naming_convention, fetchCoords, find_files, get_control_and_signal_channel_names, get_coords, is_channel_label, is_continuous_label, is_covari...
f028c296f74a0edd07353b9b3da0f206d6fff03298f7e0fb9fd81060ba62af05
Python
17,479
438
#!/usr/bin/env python """ MetaWIBELE: check_install module Check the installation of MetaWIBELE package and dependent tools Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Softwar...
e85cce4d8852a0cae1033129b7d79feef78d8d485008c3d2ad6786cd08a9d6cd
Python
17,488
451
import os import numpy as np import copy import scipy from collections.abc import Iterable from . import warning from .geom import resample, apply_warp from .transform import Transformable, LinearTransform, Geometry, LIA class ArrayContainerTemplate: ''' Internal, abstract template responsible for handling ...
a0f4d7b508968a82337e484e915b5ea49df6d3a74114533e34fbd4de2bb1c869
Python
17,505
441
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # pyre-strict # pyre-ignore-all-errors[58] import typing import unittest import numpy as np import torch from fvcore.nn import ( sigmoid_focal_loss, sigmoid_focal_loss_jit, sigmoid_focal_loss_star, sigmoid_focal_loss_star_jit, ) ...
df5ed5731b7c2c146a074b52afac4e625c49fed7ac7d34737d302a1947c21b92
Python
17,599
503
# Interface with AWS # Author: David Young, 2018, 2020 """Connect MagellanMapper with AWS such as S3 and EC2. Attributes: """ import os from pprint import pprint import boto3 import boto3.session import botocore from boto3.exceptions import RetriesExceededError, S3UploadFailedError from botocore.exceptions import Cl...
8de8a1d99320aa53461f4ba06e03d788c8a08ce2b3cfcfa67e9fc125c14bcb4b
Python
17,623
482
import copy import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GCNConv, GATConv, global_mean_pool, global_max_pool, TAGConv from torch_geometric.nn import global_add_pool, SAGPooling, ASAPooling from torch_geometric.nn.aggr import AttentionalAggregatio...
46cf98a6b4b223770d89d5d3dbc4640fdf37743b23b7d5ffbe266b06199d1042
Python
17,640
432
import pandas as pd import numpy as np import zipfile import torch from functools import lru_cache import os def return_top(srs): concs,counts = np.unique(srs, return_counts = True) top_counts = counts.argsort().argsort() return (concs[top_counts <=4], ) class SynergyDataset(): def __init__(self, root ...
9e16b54520af5db42b8511c0648ff0f2fb847fa8f1205db0726fafe406dd2b43
Python
17,648
369
import numpy as np import pytest from guppy.analysis.timestamp_correction import ( applyCorrection_ttl, correct_timestamps, decide_naming_and_applyCorrection_ttl, pair_timeline_label, timestampCorrection, ) def test_apply_correction_ttl_tdt_mode_all_above_rec_start_subtracts_only_rec_start(): ...
acbf2b58187a28e25d7ef38c85852b3013377ab1614295afa12873e9f7f4a8c0
Python
17,670
421
## ## CPCantalapiedra 2020 import errno, os, shutil, psutil from sys import stderr import time from os.path import exists as pexists from os.path import join as pjoin from .utils import colorify from .common import silent_rm, sort_seeds_file, \ ITYPE_GENOME, ITYPE_META, ITYPE_PROTS, ITYPE_CDS, get_data_path from ...
3a7cbb841497ae9d75fba0606db71f44b6fa643c5881693cee634c66128d5e9b
Python
17,674
428
from pathlib import Path import struct import numpy as np from scipy.spatial.distance import cdist import torch as th from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler import time import pandas as pd import sys from torch_geometric.utils import remove_self_loops import torch from joblib import Par...
41d059ff002a6a19cdc9b9dbec97a5995cfc79fbb7670f5b60715bfba43737f5
Python
17,680
364
''' Loads pretrained VGAE and MLP models and tests them on a dataset. If num_epochs > 0, then the models are fine-tuned on the dataset. Authors: Hanna M. Tolle Date: 2025-01-04 License: BSD 3-Clause ''' import sys sys.path.append('graphTRIP/') from sacred import Experiment from experiments.ingredients.data_ingredien...
9d6293fade3836f1fae619b44b84719ada24565b6b1f478966523efecb3181f4
Python
17,698
384
import os, torch, random import numpy as np import pandas as pd from torch import nn import torch.nn.functional as F from sklearn.preprocessing import MinMaxScaler import matplotlib.pyplot as plt import argparse from sklearn.metrics import roc_curve, precision_recall_curve, auc from sklearn.metrics import roc_auc_score...
8449f4114b90fd2115614a920863b9115a5034e0764254a90d916d2ac9eb1ea4
Python
17,701
470
''' This script is adapted from the toolkit of below CVPR paper. If you find the functions in this script are helpful to you (for the challenge and beyond), please kindly cite the original paper: Riqiang Gao, Bin Lou, Zhoubing Xu, Dorin Comaniciu, and Ali Kamen. "Flexible-cm gan: Towards precise 3d dose prediction ...
4d431dbac6901122d7dca7d33440f04e7192bebe81bc590b3c750b5628cd5e7a
Python
17,706
460
"""Main module. Holds the `BayesianOptimization` class, which handles the maximization of a function over a specific target space. """ from __future__ import annotations import json from collections import deque from os import PathLike from pathlib import Path from typing import TYPE_CHECKING, Any from warnings impo...
f1c844db5f4567a7cd11d02718e44b224b3b938fcbe6d589f94c3a7a1b9a5134
Python
17,710
376
''' In order to get mouse move event when left mouse button is pressed, we need to override a few pyqtgraph classes. This is due to the fact that the GraphicsScene class only emits the position of the mouse without any information whether a button is pressed or not. Theoretically this could be a bit of resource hog, ho...
93a16f796fd250f5049a64242fb8cddd2a5ad9f53e950cd0924a7735bb102b80
Python
17,718
716
from __future__ import annotations import copy from datetime import datetime from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar from uuid import UUID from pydantic import BaseModel, ConfigDict, Field from zndraw.access import GroupRole, ShareAccess, Visibility def deep_merge(base: dict, override: dic...
33793d11cf6301de6926f2394e6eaaeae8cef21f7368789767cd543bdaa3354a
Python
17,772
609
from __future__ import annotations import csv import os from ast import literal_eval from itertools import zip_longest from pathlib import Path from typing import Any, Callable, Mapping, Optional, Sequence, Union import dateutil.parser import numpy as np import pandas as pd from omegaconf import OmegaConf from ..dat...
943888aaa558c3e63a545e75ed5739a5483ddb158e07c3f80a36d76ed36feebe
Python
17,777
423
import warnings from pytorch_lightning import LightningModule from fengshen.models import transformer_utils import torch import torch.utils.checkpoint from torch import nn import torch.nn.functional as F from dataclasses import dataclass from typing import Optional, Tuple from transformers.file_utils import * from t...
e6de9b973278db0663fbf9078911d3665b675722f461d8ba429d29077e092f9e
Python
17,794
496
import torch import logging import merlinth from merlinth.layers import ComplexConv2d, ComplexConv3d from merlinth.layers.complex_act import cReLU from merlinth.layers.module import ComplexModule def complex2real(z, channel_last=False, separate_echo_dim=False): stack_dim = -1 if channel_last else 1 if separat...
451fd121a0f9bf59afdb2dac08a46292611aeea119ed9ea86685e01aa27b2df6
Python
17,798
353
""" Model class """ import numpy as np import pandas as pd # Imports from the stroke_outcome package: from stroke_outcome.continuous_outcome import Continuous_outcome import stroke_outcome.outcome_utilities as outcome_utilities class Model(object): """ Model class Attributes ---------- scenario...
32ca97dfe7c07cf52e2a6132e4fae417db5a94a376662bef9c58b25fa169056c
Python
17,800
472
#!/usr/bin/env python """ MeteWIBELE: finalize characterization module 1) combine all functional and taxonomic annotations 2) format outputs Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation fi...
a77f2e023049db9daa5e7c2730c78fe0303b597f63fd7569bba7126c146b829c
Python
17,852
482
''' Unit test for the high level vds interface for eiger https://support.hdfgroup.org/HDF5/docNewFeatures/VDS/HDF5-VDS-requirements-use-cases-2014-12-10.pdf ''' import os import os.path as osp import shutil import tempfile import numpy as np from numpy.testing import assert_array_equal import pytest import h5py as h5...
6e5a046c05e5ed3ce2044bb585ba68fc3a557c5a47c8946689213557c769bbcb
Python
17,871
360
#!/usr/bin/env python # encoding: utf-8 # %% libraries _________________________________________________________________________________________ import argparse import datetime import glob import itertools import json import logging import os import sys from os.path import join from pathlib import Path from statistics...
275c0e36017e2ac0cecbc71739f5f24d99c27d0de27dbba2def8df69d277ab41
Python
17,906
405
# coding=utf-8 # Copyright 2022 EleutherAI The HuggingFace Inc. 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 #...
1515c14b3b57a90536b94b9a6d2ebe3838f65ac2a28e08ff76dc65482e27f15d
Python
17,920
448
import glob import yaml import torch import numpy as np import gc from sklearn.metrics import precision_recall_curve from data.t2star_loader import * from dl_utils.config_utils import import_module from projects.moco_t2star.utils import * from projects.line_detection_t2star.utils import process_kspace_linedet def gpu...
de674b0a646fc7c5713ec8f61b52c0888f827d14de8713455cb12aee303e7eb1
Python
17,929
412
################################################################## # Performing step 2 CytoCommunity in CRC simulation dataset # Reproducibility for Figure.3C ################################################################## import torch import torch.nn.functional as F from torch.nn import Linear from torch_geometric...
1356f229306c9ae347779b9afbd45f8af3876753215750edefeff09a2dfdb67f
Python
17,950
431
# -*- coding: utf-8 -*- from collections import defaultdict import numpy as np import networkx as nx from typing import Any, Dict, DefaultDict, List, Set from catmaid.models import (ClassInstance, ClassInstanceClassInstance, Relation, Review, Treenode, TreenodeConnector, TreenodeClassInstance ) class Neuron...
75ff296b8ae29b646a6f5f7f56fe69e7c44d9b190e6b314b609b327653c4b28e
Python
17,970
381
# Generate events files for task-narratives # This script reads raw behavior data files from d_beh for task-narratives, extracts time stamps and design information, and stores them in new *events.tsv files accompanying BOLD files. # For more information, please see README.md and the associated paper (Jung et al., 202...
6a6535fc1065d463db735b9d3a92373eb784ab74d0d6d9bc46c3ad783b9cae20
Python
17,972
476
import torch import torch.nn as nn import torch.nn.functional as F from einops import rearrange import pdb def conv3x3(in_planes, out_planes, stride=1): return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) def conv1x1(in_planes, out_planes, stride=1): return nn.Conv2d(...
6ea49de3d683a64250c14117679983b2df9d113e83e811e58c823d6da26883a1
Python
17,980
534
""" 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. --- This code borrows heavily from the DimeNet implementation as part of pytorch-geometric: https://github.com/rusty1s/pytorch_geometric. Licens...
834624aa3944779a90b3db441fb8d9d6bb871902a990c12f3ffd99c6ad083ed6
Python
17,987
561
"""Shared functions and other definitions.""" import collections from cwl_utils.types import ( CWLDirectoryType, CWLFileType, CWLObjectType, CWLOutputType, is_directory, is_file, is_file_or_directory, ) try: import fcntl except ImportError: # Guard against `from .utils import ...`...
52db618bbab8764958d37b9755acd1806c9fde01ee70bde13da40ff2bcaa516d
Python
18,021
528
import os import pickle import copy import pandas as pd import numpy as np import torch from torch.utils.data import DataLoader from Bio.PDB.PDBParser import PDBParser from Bio.PDB.Polypeptide import one_to_index, index_to_one from tqdm.auto import tqdm from rde.utils.protein.constants import num_chi_angles from rde.u...
483833d133493dc9ec40d0b3f6c83247952af89ff77f54678519cee78b0d21ff
Python
18,032
459
""" Information Resource (InfoRes) utilities """ import re from typing import Optional, Tuple, Callable, Dict, List, Any from kgx.utils.kgx_utils import knowledge_provenance_properties, column_types from kgx.error_detection import ErrorType, MessageLevel from kgx.config import get_logger log = get_logger() class In...
fe1e8e571ae904ad032514a2d3b80f7a2db3d5f857c90e683bb930a8274696c0
Python
18,045
493
import argparse import math import os import random import shutil import time import warnings import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim import torch.utils.data import torch.utils.data.distributed import torchvision.models as m...
aac52f1e93122a27819694c52fd8e831cea3f2b6e24d41c38f98e21751d058e6
Python
18,054
466
# -*- coding: utf-8 -*- from collections import defaultdict import json from typing import Any, DefaultDict, List, Optional, Union from django.db import connection from django.http import HttpRequest, Http404, JsonResponse, HttpResponse from django.shortcuts import get_object_or_404 from rest_framework.decorators i...
d877ed7913dffddc6ad8cb1ea4b070c33099a133dd85e5333b52ecd7b70ee21b
Python
18,059
397
#-*- coding: utf-8 -*- #setting############################################## n_jobs=16 #並列処理の数 t_n_jobs=16 PARAMETER_DIR='/Volumes/Siena/CP/parameter' #n_jobs=40 #並列処理の数 #t_n_jobs='cuda' #PARAMETER_DIR='/home/takeiyuuichi/Dropbox (MEG)/CP/parameter' set_environment='main' SET_EVENTID=[2,3] event_id = dict(control=2...
20034f2bfcbdcb841b19a4a5e66dad911fe3d5c8401c8717268ea666b753b7c9
Python
18,062
447
from typing import Tuple from unittest import result import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import seaborn as sns from lmfit.models import PowerLawModel from sklearn import linear_model from uncertainties import ufloat, unumpy from uncertainties.umath import * import lmfit from...
c31e9d7bca36c585da3de69e51917120c41af2f684b4ceaee8623ce844df950c
Python
18,084
376
#! /usr/bin/env python3 # ################################################################ # Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the # LICENSE file in the root directory of this ...
03141259f6f47f1e10ac5767fcc2e88a36334f487c49f3fdb25920a97e956c06
Python
18,085
418
from typing import Union import sympy as sp import libsbml import jax.numpy as jnp import numpy as np import pandas as pd import re import collections import os from jaxkineticmodel.utils import get_logger from jaxkineticmodel.load_sbml.jax_kinetic_model import NeuralODE from jaxkineticmodel.load_sbml.sympy_converter ...
04f93c39c088483405529d3782b5397b654bf171d74026249756c2755a50657a
Python
18,088
499
import inspect import time from dataclasses import dataclass import jax import optax from jaxkineticmodel.load_sbml.sbml_model import SBMLModel from scipy.stats import qmc import logging from jaxkineticmodel.building_models import JaxKineticModelBuild as jkm import numpy as np import jax.numpy as jnp import equinox im...
13ae41cf5b070112710a16386c7b6cbb74563fd0dda01e0d9f75908b0520960d
Python
18,094
367
#!/usr/bin/env python # encoding: utf-8 # %% libraries _________________________________________________________________________________________ import argparse import datetime import glob import itertools import json import logging import os import sys from os.path import join from pathlib import Path from statistics...
a98c548429ccf6717491f2c52dab574850c8a2f62652d96978a464b40b6d2fb9
Python
18,126
504
import enum import logging from dataclasses import dataclass from typing import Mapping import ase import torch import torch.nn.functional as F from simgen.calculators import MaceSimilarityCalculator from torch import nn from torch_scatter import scatter_logsumexp, scatter_max, scatter_sum from tqdm import tqdm from ...
21f8a545569ee56224a21a73b6f1491479929fd1f37cc1187458a7e61bf3b5a0
Python
18,128
546
""" Module to define base classes. """ import sys import traceback from abc import ABC, abstractmethod from datetime import timedelta from os import makedirs from os.path import exists as pexists, join as pjoin from pathlib import Path from shutil import copyfile from timeit import default_timer as timer import num...