sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
efd6af8c5c4e659583518274390dbbd670b239f657d949d4b0c52b66e95588b9 | Python | 7,839 | 219 | """
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.
Utilities to interface OCP models/trainers with the Atomic Simulation
Environment (ASE)
"""
import copy
import logging
from typing import Dict,... |
fd57c684f24bb5c8391381a73dc5147f5c094dffb6cd11d7f493d90cffddb2d2 | Python | 7,842 | 179 | from csbdeep.internals.train import RollingSequence
from tensorflow.keras.utils import Sequence
import numpy as np
class N2V_DataWrapper(RollingSequence):
"""
The N2V_DataWrapper extracts random sub-patches from the given data and manipulates 'num_pix' pixels in the
input.
Parameters
----------
... |
6354f4c9ddab2b2b24ca85e5fdd832ba3c66606e73e89520e21574133d9809e1 | Python | 7,843 | 205 | import numpy as np
from neuralpredictors.measures.np_functions import corr, fev
class Metrics:
def __init__(self, responses, trial_idx, image_ids, neuron_ids):
"""
Computes performance metrics of neural response predictions.
Args:
responses (np.array): Recorded neural response... |
dd9fc55aea80eedfffb561242fab925fcb6314bdc4537083540bb6ab5b174ce9 | Python | 7,847 | 204 | """Unit tests for src/datahandlers/efo.py (EFOgraph)."""
import io
import pyoxigraph
import pytest
from src.categories import DISEASE
from src.datahandlers.efo import EFOgraph
from src.prefixes import EFO, MP
from tests.datahandlers.conftest import RDFS_NS, SKOS_NS, lit, make_graph_from_store, nn, quad
_EFO_NS = "h... |
fbc062d5b677a0adaf9967691ee4404f823b956edbb01f9e15416beab56bf98f | Python | 7,850 | 169 | import torch
from tqdm import tqdm # for displaying progress bar
import os
import numpy as np
# from data import CallFriend, read_config
import models
import pandas as pd
from glob import glob
from copy import deepcopy
import sys
# import matplotlib as mpl
# mpl.use('Agg')
# import matplotlib.pyplot as plt
... |
2b1ba36ac1630b0e911da33b9a8a7f141807262dfb5b201f1eaba64123cde3b9 | Python | 7,851 | 240 | # Copyright (c) OpenMMLab. All rights reserved.
"""CLIP tokenizer.
Copied from https://github.com/openai/CLIP. Originally MIT License, Copyright
(c) 2021 OpenAI.
"""
import gzip
import html
import os
from functools import lru_cache
from typing import List, Union
import ftfy
import regex as re
import torch
os.environ... |
37bd2b658379dcd967f06a81e3af806ceeb94b94fd52279bc064443aac1d39f5 | Python | 7,851 | 143 | # 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
#
# http://w... |
39059bb7cff4c3ada7d9bf5c57e7ac383f8a88a250a3133f36b057a81bfa37f2 | Python | 7,853 | 196 | # # measure the localling decoding performance on different data. Run generate_processed_exp_data.py first
import numpy as np
import matplotlib.pyplot as plt
import grid_cell.torus_geometry as tg
from scipy.stats import norm
from grid_cell.gkr import GKR_Fitter
from grid_cell.linear_regression import fit_a_line, output... |
312ee5e6dbf9174ebd815c6b30be1533fdda81e34696f8f452a5bcde52efe330 | Python | 7,858 | 199 | import csv
import json
from pathlib import Path
import random
import shutil
from typing import List
def copy_subject(
subject_dir: Path,
output_dir_data: Path,
output_dir_labels: Path,
subject_alias: str = None,
):
subj_id = subject_dir.name
if subject_alias is None:
subject_alias = su... |
e5ed11e520960199d0b5f4ef539f73ce8ac0058ff46935eb7796fa25190a4d07 | Python | 7,863 | 195 | # 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
#
# http://w... |
48a2b7f77bac183dc65650be58d38d300ebfab2ebf70a62b49c43ebc7fc45d5a | Python | 7,864 | 148 | #!/usr/bin/env python3
# created by Daiki Sato and updated on 2025/3/20
# python3 5_2_1_simulation_single.py 600 0
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import pandas as pd
import math
import sys
import os
args = sys.argv
num_agents = 1 # Number... |
e244fd7580390792afa4ffae5226489e7dbb22e8ba7fbd978579d105abf8259d | Python | 7,864 | 231 | #!/usr/bin/env python
"""
MetaWIBELE: summary_all_annotation module
Summary functional and taxonomic annotations
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 "Software"), to dea... |
11b92604e0176229aee856909953ede0825d906de800640f600c17de07e31172 | Python | 7,865 | 287 | #!/usr/bin/env python3
#
# Figure 5: Linear correlations
#
import sys
import numpy as np
import matplotlib.pyplot as plt
import base
# Exclude ooocytes
nooocytes = True
qand = 'and cell != "Oocyte"' if nooocytes else ''
#
# Create figure
#
print('Creating figure')
fig = plt.figure(figsize=(9, 10)) # Two colu... |
b312cb9520e70cd95c29c8c81c0b2c2bc5dab9f480078cfa6230874d26431355 | Python | 7,865 | 295 | import os
import re
from io import StringIO
from pathlib import Path
import pytest
import cwltool.process
from cwltool.main import main
from .util import get_data, get_main_output, needs_docker
@needs_docker
def test_missing_enable_ext() -> None:
"""Require that --enable-ext is provided."""
error_code, _, ... |
4a493c305c6075c01e9fa3317eb70f1a5f70f5d706ed6581863c779843ca9622 | Python | 7,867 | 174 | import argparse
from torch import optim
from MATE import *
from utils import *
import warnings
import random
from tqdm import tqdm
from torch_geometric.data import Data
warnings.filterwarnings("ignore")
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str, default='cora')
parser.add_argument('-... |
68f435078533627ee42c7b299dbec6a6d69abed3e417e1fe3e6d3ebca1b8c27b | Python | 7,867 | 249 | '''DNN Feature decoding - decoders test (prediction) script'''
from __future__ import print_function
from itertools import product
import os
import shutil
from time import time
import argparse
import bdpy
from bdpy.dataform import load_array, save_array
from bdpy.distcomp import DistComp
from bdpy.ml import ModelTe... |
a1972023f64dc37d94135434c314c9e7f1eacfa75edc79325a4dc3da52dd47fb | Python | 7,868 | 185 | """Unit tests for src/model/concords.py.
Sections:
- ``# --- find_overused_xref_targets ---`` checks the overuse detection that backs
``babel-overused-xrefs`` and mirrors ``remove_overused_xrefs``'s 2+ subject rule.
- ``# --- load_mrconso_labels ---`` checks the MRCONSO fallback used to label the
classification v... |
9219225e686a2b7efa444e676840427852f13fbf6f27f94609c1579dbf27797a | Python | 7,875 | 227 | #!/usr/bin/env python
"""
MetaWIBELE: denovo_TM_SP module
Summary the de-novo prediction set by combining Phobius/SignalP/TMHMM
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 "Sof... |
3d5dab02aaef91d520e542ac509451fd4488315725e0c2d866a4d998b59c988d | Python | 7,879 | 207 | # Visualization handler
"""TraitsUI handler for Visualization class."""
from enum import Enum, auto
import pathlib
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from PyQt5 import QtWidgets, QtGui
from traits.trait_base import traits_home
from traitsui.api import Handler
from magmap.gui import even... |
535105b3ec537462881cf90160666c2855e9826c4ab403ebbff8aa8c74f52b9e | Python | 7,881 | 168 | import numpy as np
import tensorflow as tf
import time
import datetime
import os
import sys
import h5py
from pathlib import Path
import evidential_deep_learning as edl
from .util import normalize, gallery
class Evidential:
def __init__(self, model, opts, dataset="", learning_rate=1e-3, lam=0.0, epsilon=1e-2, maxi... |
e3a314f634148a877d6e8d1993a4c8fedfac2769a54d03edfad55431412c5257 | Python | 7,882 | 148 | #!/usr/bin/env python3
# created by Daiki Sato and updated on 2025/3/20
# python3 5_2_2_simulation_groupsinglemove.py 100 0
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import pandas as pd
import math
import sys
import os
args = sys.argv
num_agents = 6 ... |
3f1d3a6f4ebe2daca73c028b728376bd649b81031cd4ceec772945a7ea91c7a7 | Python | 7,885 | 189 | from pytorch_lightning import LightningDataModule
from typing import Optional
from torch.utils.data import DataLoader, DistributedSampler
from fengshen.models.megatron import mpu
def get_consume_samples(data_model: LightningDataModule) -> int:
if hasattr(data_model.trainer.lightning_module, 'consumed_samples'):
... |
f8ec12fefc5af6566e966e50bc8f59c6d556b02c6d80cf17c8138fa345fa505c | Python | 7,885 | 254 | """Tests for Step REST API endpoints."""
import pytest
from helpers import (
MockSioServer,
auth_header,
create_test_room,
create_test_user_in_db,
make_raw_frame,
)
from httpx import AsyncClient
from sqlalchemy.ext.asyncio import AsyncSession
from zndraw.schemas import StepResponse, StepUpdateResp... |
de64c06d60594dbd83efb24a9b002bc06bf0c65accdd221a9db396ff5d38f2d3 | Python | 7,888 | 228 | # -*- coding: utf-8 -*-
import nibabel as nib
import numpy as np
import os
import pandas as pd
def stats_mean_median(column_names, filenames):
"""
Compute mean and median values in an image where voxels are higher than 0.
Parameters
----------
column_names : array of strings
Name of the ... |
35adaf43eef327b015e6d746341c56ac8f4e947662f616bdaf4274905884aeb3 | Python | 7,893 | 148 | #!/usr/bin/env python3
# created by Daiki Sato and updated on 2025/3/20
# python3 5_2_3_simulation_groupsocialcontagion.py 100 0.1
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import pandas as pd
import math
import sys
import os
args = sys.argv
num_agents = 6 ... |
5c0a399e847202294c6bc4fd933bb23fcf1dc3a0dc31550e130217fda17030de | Python | 7,894 | 173 | # Copyright (c) 2021, EleutherAI
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
d33e51093baad1e0987b4c66c660371e62f78a373c5c42b04a40fdf7f11aac3b | Python | 7,894 | 244 | import torch
import numpy as np
import merlinth
class SSIM:
"""
Structural Similarity Index (SSIM) loss function.
Parameters
----------
select_echo : bool
Flag to select whether to calculate SSIM for multi-echo or
single-echo data.
mask_image : bool, optional
Flag indi... |
77c133c712bdf16caa3f5eb584154477be5e9a9ba1337fe80db3285d7b8e999d | Python | 7,900 | 207 | ##################################################################
# Selecting TrimNN motif representations
# Reproducibility for Figure.3B
##################################################################
import pandas as pd
import numpy as np
import re
import os
import ast
from scipy.spatial import Delaunay
from it... |
dc7eec2388d46f3d7378805e4b38ad19404cb49a082cd33d8a2299971a85f175 | Python | 7,900 | 253 | """
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.
"""
from typing import Optional
import torch
from torch_scatter import scatter
from torch_scatter.utils import broadcast
from ocpmodels.common ... |
4e6f1b366bbf6477e6500be7523cae9970bf09caa54767148acb70dc46d2e702 | Python | 7,903 | 193 | import os
import torch
import argparse
from pytorch_lightning import (
LightningModule,
Trainer,
)
from pytorch_lightning.callbacks import (
LearningRateMonitor,
)
from fengshen.data.universal_datamodule import UniversalDataModule
from fengshen.models.model_utils import (
add_module_args,
configure_... |
2e3e85959472ef63e0bafcf394673d37bda404169685bcb71b65e1e620d0e5cc | Python | 7,905 | 195 | """
Created on Wed Sep 23 18:33:22 2020
@author: mheinzinger
(and a little bit daniel)
"""
import argparse
import time
from pathlib import Path
import torch
from transformers import T5EncoderModel, T5Tokenizer
import numpy as np
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
print("Using de... |
71492fceeeb8ac96151e621bc3886fee6b1a9935b01d6692b3ef74751c69eba8 | Python | 7,913 | 240 | from copy import deepcopy
from multiprocessing.pool import Pool
from batchgenerators.utilities.file_and_folder_operations import *
from medpy import metric
import SimpleITK as sitk
import numpy as np
from nnunet_mednext.configuration import default_num_threads
from nnunet_mednext.postprocessing.consolidate_postprocess... |
8ae126881d312ed15e28164ff45ea6b9072240a8cc601a5d5690317f6a93ba4a | Python | 7,913 | 217 | import ase
import numpy as np
import pytest
import torch
from mace.tools import AtomicNumberTable
from simgen.atoms_cleanup import (
get_higest_energy_unswapped_idx,
get_swapping_candidates,
relax_elements,
relax_hydrogens,
remove_isolated_atoms_fixed_cutoff,
remove_isolated_atoms_using_covalen... |
b91958334cf6c874c482e78d3ead6abb2480f45c021cd159a3c9d2bb9872f09b | Python | 7,914 | 332 | # from global_parameters import MOL_SPLIT_START, MAX_FREE, MAX_ATOMS, MAX_FRAGMENTS
from rdkit import Chem
import numpy as np
# Main module for handleing the interactions with molecules
# GLOBAL PARAMETERS
# Fragmenting and building the encoding
MOL_SPLIT_START = 70
MAX_ATOMS = 12
MAX_FREE = 3
MAX_FRAGMENTS = 12
# Si... |
4d5d8d4ca3e1f5fc05dd041b17c89d12e734b93d2db3ca20948c51d7aa2d81eb | Python | 7,916 | 222 | import xtal
import numpy as np
import sys
import random
import argparse
import os
from scipy.ndimage import gaussian_filter
import matplotlib.pyplot as plt
from PIL import Image
import copy
import glob
from multiprocessing import Pool
from functools import partial
# Parse input arguments
parser = argparse.ArgumentPars... |
2cfa7a0db921cc7fdc99af9c38a2ddb11572afcbf7bee7a900a0f5e289194e36 | Python | 7,921 | 235 | import itertools
import os, sys, ast
import time
from training import optimize
import numpy as np
import torch
import Images as imgs
import networks
import matplotlib.pyplot as plt
import plots
from torch.utils.tensorboard import SummaryWriter
import inspect
def parse_arguments(HP):
dir_path = insp... |
4705ce337300e944b7df38ade4532bf31b6dab11affea3d05e1af1e422886909 | Python | 7,922 | 231 | # Copyright DST Group. Licensed under the MIT license.
import sys
import logging
import os.path as osp
class CybORGLogger:
"""A logger class for CybORG.
It has two main functions:
1. acts as a wrapper for the Python logger class
2. provides a base class with useful logging function that other classes... |
8914b73a7b990b1d4fa91ed1064ffc3138a5acd4bf2b192b8b7c5be7b15fed1b | Python | 7,927 | 223 | from __future__ import annotations
import itertools
from collections.abc import Sequence
import torch
from torch import Tensor, nn
def aggregate(data: Tensor, owners: Tensor, *, average=True, num_owner=None) -> Tensor:
"""Aggregate rows in data by specifying the owners.
Args:
data (Tensor): data te... |
e02099de6cde241a1811165705fe09c0572092e892c786b99a5d89ab09addefa | Python | 7,928 | 229 | # This module is to parse the sam/bam file with the pysam tool,
# which can be found at: http://pysam.readthedocs.org
import sys
import pysam
import numpy
global CACHE_CHROM
global CACHE_SAMFILE
CACHE_CHROM = None
CACHE_SAMFILE = None
def check_pysam_chrom(samFile, chrom=None):
"""Chech if samFile is a file nam... |
fd60713f51c45c73a43af1f902394f2c88161c3a4ab67e8d61558b08e52b31db | Python | 7,928 | 249 | """
Experimental support for distributed training with external memory
==================================================================
.. versionadded:: 3.0.0
See :doc:`the tutorial </tutorials/external_memory>` for more details. To run the
example, following packages in addition to XGBoost native dependencies... |
224df6f70a019d9d6caa6101c4262c6e90a44257ad0fe8b9759b21bcf79c98a5 | Python | 7,931 | 195 | """
compendia_per_file_reports.py - Generate reports for the individual files in the compendia directory.
"""
import itertools
import json
import logging
import os
from collections import defaultdict
from datetime import datetime
def get_datetime_as_string():
"""
Returns the current date and time as a string... |
3f4cb63b632d64ce6add10f362304ea1a00918320c21e560baf570a3a1b44d1b | Python | 7,942 | 210 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
df7ce2d1ccde17c6c0d4df66ff31834b11b106abe6b14c267792d3735069e6c0 | Python | 7,948 | 228 | #!/usr/bin/env python
# coding: utf-8
import os.path as op
import random
import time
import matplotlib.pyplot as plt
import numpy
import sklearn
import torch
import torch.nn.functional as nn_func
from sklearn import preprocessing
from sklearn.metrics import adjusted_rand_score
from torch.nn import Linear
from torch_g... |
ca688df3d4cfe3da66606d99142b4681abbbd12bc5b4af83b738a92b55b43b5c | Python | 7,952 | 178 | import json
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from guppy.analysis.io_utils import write_hdf5
from guppy.analysis.standard_io import (
read_binned_covariates_from_hdf5,
read_binned_metrics_from_hdf5,
read_covariate_correlations_from_hdf5,
write_binned_metrics... |
16105be552fc566aa6226088f5e730fc092833f2a05fae9b1a4e53f272af7840 | Python | 7,955 | 236 | """
Helpers to train with 16-bit precision.
"""
import numpy as np
import torch as th
import torch.nn as nn
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
from . import logger
INITIAL_LOG_LOSS_SCALE = 20.0
def convert_module_to_f16(ll):
"""
Convert primitive modules to float16.
... |
e53525e411e49fa6899c8c1cb0636fb9107d62204ac22de2f39cab36dd148847 | Python | 7,957 | 223 | # This module is to process fasta files and some utils.
# download bigWigSummary binary file:
# http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/bigWigSummary
import pysam
import itertools
import subprocess
import numpy as np
class FastaFile:
"""docstring for FastaFile"""
def __init__(self, fasta_file):... |
19541a2857143b735450225d5d02862a7bfa0b41e55a1b912f0618c64f272f05 | Python | 7,966 | 279 | """Unified database schema definitions for eggNOG databases.
This module defines the SQLite table schemas shared between eggnog-mapper
and eggnog-website. The unified schema allows:
- eggnog-builder to create a single database with all tables
- Mapper release builds to drop website-only tables
- Both mapper and websi... |
458160e389114a5fbfbfd53e3a24b0ddf90341b095abd11f7af51de88e434bb9 | Python | 7,966 | 290 | import pytest
import base64
from medperf.exceptions import CleanExit, InvalidCertificateError
from medperf.commands.mlcube.grant_access import GrantAccess
from medperf.tests.mocks.certificate import TestCertificate
from medperf.tests.mocks.ca import TestCA
from medperf.tests.mocks.encrypted_key import TestEncryptedKey
... |
b86e5ca19aa7ab901119b9bd8133a6e14337413f118369734d4a27bc2b1d96df | Python | 7,966 | 249 | from skimage.registration import optical_flow_tvl1, optical_flow_ilk
from skimage.transform import warp
import numpy as np
def apply_deformation(slice1, v, u):
nr, nc = slice1.shape
row_coords, col_coords = np.meshgrid(np.arange(nr), np.arange(nc), indexing="ij")
slice1_warp = warp(slice1, np.array([row_c... |
bf17fd852b9e2cbb8ce2cc219ee22fc1f26fd54eb449e09dafdc1d31d10fdaba | Python | 7,969 | 207 | # Copyright (c) OpenMMLab. All rights reserved.
import json
import warnings
from mmengine.dist import get_dist_info
from mmengine.logging import print_log
from mmengine.optim import DefaultOptimWrapperConstructor
from mmseg.registry import OPTIM_WRAPPER_CONSTRUCTORS
def get_layer_id_for_convnext(var_name, max_layer... |
40fa1d9663756038b7df7a286b220b6b298f37267fc20bb2ad939e4d4a4c76b8 | Python | 7,970 | 167 | #!/usr/bin/env python2.7
import sys, os
import argparse
import shutil
import warnings
from itertools import cycle
from collections import defaultdict
from collections import Counter
import numpy as np
import scipy
import scipy.cluster
import scipy.cluster.hierarchy as hier
from Utils import *
def parse_args(args)... |
b46993e27ebc0ca7ddd5fbd8cca03b62e1c10e3b328c67bd5e12442b47b271f3 | Python | 7,971 | 215 | from __future__ import annotations
import os
import re
import warnings
from typing import TYPE_CHECKING
from monty.io import zopen
from monty.os.path import zpath
from pymatgen.io.vasp.outputs import Oszicar, Vasprun
from chgnet.utils import write_json
if TYPE_CHECKING:
from pymatgen.core import Structure
def... |
6e4e4b4893b90bdd583d0d7a27cf6ac6aca53f7cf3f3e672ab6d5652319db2c7 | Python | 7,976 | 269 | from rest_framework import status
from medperf.tests import MedPerfTest
from parameterized import parameterized, parameterized_class
class MlCubeTest(MedPerfTest):
def generic_setup(self):
# setup users
mlcube_owner = "mlcube_owner"
self.create_user(mlcube_owner)
# setup globals... |
c4a4cee6bc707c75542de68f29a9ce0b495e5ad0009807bd2c0e726295de1700 | Python | 7,977 | 200 | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
from typing import List, Tuple
from mmengine.model import BaseModel
from mmengine.structures import PixelData
from torch import Tensor
from mmseg.structures import SegDataSample
from mmseg.utils import (ForwardResults, OptConfigTy... |
2866a67eb2e40f2d0b23cb0e1d40885ad206cd837780686f8f77bcef3117ea86 | Python | 7,982 | 240 | #!/usr/bin/env python3
# @Author: ChangXu
# @E-mail: xuchang0214@163.com
# @Last Modified by: ChangXu
# @Last Modified time: 2021-04-22 08:42:54 23:22:34
# -*- coding: utf-8 -*-
import os
import time
import torch
import math
import numpy as np
import pandas as pd
import scanpy as sc
from sklearn.metr... |
16c402cd1e3e8fd93b675c36809155fc12370c59f1a6883ed7af92f45b677c26 | Python | 7,983 | 244 | #!/usr/bin/env python3
"""
Functional numeric regression for CICADA Smoothing_Retention configuration.
This uses a PRIVATE technical fixture/reference at runtime but contains no
participant-derived data itself.
It verifies that the constants currently present in
basescripts/CICADA_1_MasksandICAs.sh reproduce:
1. H... |
822cee8e38814c68aa0ede243367327d222ac8530a26e6f95be0bd39f8851d06 | Python | 7,986 | 233 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 26 15:26:31 2022
@author: A0067501
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils_nets import padsize, get_activation, UpBlock, ConvBlock, UpBlock2D, ConvBlock2D, Upsample
class UNet(torch.nn.Module):
"""
U-net model introduc... |
948ef088652da0eb75d3dcd07a9d543f231985686722a98c69da5929448938c6 | Python | 7,986 | 183 | ## The following code contains work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105.
## Additionally, we waive copyright and related rights in the utilized code worldwide through the CC0 1.0 Universal public domain dedication.
from ipaddress import IPv4Address
from... |
3694cfe6a5c369e74f7a0d548d0ac77da1e9c55745d7f800feb0802c2b47fc89 | Python | 7,987 | 230 | #!/usr/bin/env python
# coding: utf-8
import os.path as op
import random
import time
import matplotlib.pyplot as plt
import numpy
import sklearn
import torch
import torch.nn.functional as nn_func
from sklearn import preprocessing
from sklearn.metrics import adjusted_rand_score
from torch.nn import Linear
from torch_g... |
f3b6321353e5ebdeba4551eafb15f96c897cf40ac574b6708f724b436721f122 | Python | 7,995 | 239 | import numpy as np
import numpy.ma as ma
from tqdm import tqdm
from ..internals.N2V_DataWrapper import N2V_DataWrapper as dw
def get_subpatch(patch, coord, local_sub_patch_radius, crop_patch=True):
crop_neg, crop_pos = 0, 0
if crop_patch:
start = np.array(coord) - local_sub_patch_radius
end = ... |
262dd0c59c098a57854ab0d98dd57eb2decbf9f841eccd33d8fcfa1b8b8291a0 | Python | 7,996 | 212 | """util.py utility 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
"""
import numpy as np
import pandas as pd
__all__ = ['formatter_throwawa... |
2a60bb5eeccffad22f6015b890c337dbb99778874f0af9d73cba032a3555f26a | Python | 7,997 | 177 | import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
from grid_cell.util import get_line
import matplotlib.gridspec as gridspec
import os
from global_setting import *
#################### Hyperparameters ####################
mouse_name = 'R'
day = 'day1'
module = '2'
session = 'open_field_1'
... |
b75e26195790c19696d7e9ab0a58029e73decaa5e1589dd6679eaf97324fc727 | Python | 7,997 | 198 | from __future__ import annotations
import os
from typing import TYPE_CHECKING, Any
import torch
from torch import Tensor
if TYPE_CHECKING:
from typing_extensions import Self
TORCH_DTYPE = torch.float32
class CrystalGraph:
"""A data class for crystal graph."""
def __init__(
self,
atomi... |
392dccd64c51136d7eb0dbe4547618da7098b0857dffeb6150f026d4b95461c8 | Python | 7,999 | 232 | import numpy as np
import pandas as pd
import os
import sys
from glob import glob
from tqdm import tqdm
import mne
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as stats
from statsmodels.stats.multitest import multipletests
import statsmodels.api as sm
from statsmodels.formula.api import ols
... |
c88dd5f73b62fc1987c6ce5cf7f6ea1afcf1b7496b02cab8f970cbf9198909b1 | Python | 8,001 | 187 | """This module downloads files from the internet. It provides a set of
functions to download common files that are necessary for workflow executions
and are not on the MedPerf server. An example of such files is model weights
of a Model MLCube.
This module takes care of validating the integrity of the downloaded file
... |
44688e72e6b78afe45946f370c97e0c6c8e3a334a5eaf9956a0bf07647b636fd | Python | 8,003 | 187 | """
Utils for COVID-19 graph time series dataset:
The dataset is based on data from The New York Times, based on reports from state and local health agencies [1].
It was adapted to graphs in [2].
[1] The New York Times. (2021). Coronavirus (Covid-19) Data in the United States. Retrieved [Insert Date Here], from https:... |
e685ac0408d4dcbb1c3cc484ca5ced04c3c84b1c0e8746f2416e1ac7bf22e857 | Python | 8,017 | 199 | #!/usr/bin/env python3
import os
import sys
import errno
import argparse
def parse_args(args=None):
Description = "Reformat nf-core/chipseq-style samplesheet file and check its contents."
Epilog = "Example usage: python check_samplesheet.py <FILE_IN> <FILE_OUT>"
parser = argparse.ArgumentParser(descript... |
52c072d23da0d22aba51aa2e8c048e76e65bbd2313986a328aef4a2d06ac1cd5 | Python | 8,020 | 213 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# pyre-strict
# pyre-ignore-all-errors[2,6,16]
import itertools
import logging
from typing import Any, Dict, Iterable, List, Optional, Tuple, Type
import torch
import tqdm
from torch import nn
# pyre-fixme[9]: BN_MODULE_TYPES has type `Tuple[T... |
8a0d098c5cf0f302f7fae1a2e1c3dbc9f6a5310cced25f5568fdfa8b0f0222f9 | Python | 8,020 | 156 | from torch.utils.data.dataset import Dataset
from PIL import Image
import torchvision
import torchvision.transforms.functional as TF
import os
import torch
import torch.nn.functional as F
import fnmatch
import numpy as np
import random
from utils import randrot, randfilp
from natsort import natsorted
cl... |
b9865f4c246e1f69f860c630ebc7da5e2d3353948c58e5b4e664ccd2e6419864 | Python | 8,020 | 250 |
from skimage.registration import optical_flow_tvl1, optical_flow_ilk
from skimage.transform import warp
import numpy as np
def apply_deformation(slice1, v, u):
nr, nc = slice1.shape
row_coords, col_coords = np.meshgrid(np.arange(nr), np.arange(nc),
indexing='ij')
slic... |
0de6ad4e174d8091b3be672454cf680e8d4c5aa71a5aba0c95d8943b9225109d | Python | 8,026 | 220 | from pyhealth.datasets import MIMIC3Dataset, MIMIC4Dataset
# from graphcare_.task_fn import drug_recommendation_fn, drug_recommendation_mimic4_fn, mortality_prediction_mimic3_fn, readmission_prediction_mimic3_fn, length_of_stay_prediction_mimic3_fn, length_of_stay_prediction_mimic4_fn, mortality_prediction_mimic4_fn, r... |
c3acfcef3302daf94b6c63d61085ac84dd201a43898df75d527ab2fcad729d81 | Python | 8,026 | 137 | import numpy
import msprime
import math
import collections
def PNG_A_ND( params, inds, length=1e6, recombination_rate=1e-8, mutation_rate=1.25e-8, replicates=300):
"""
This is the Papuan population is a sister group of East Asians.
:param params: all the parameters necessary for this model in a list or arra... |
c0daca2602ae113abe03b29cd6e425f1806e54421f5f63b6eadb77a1c468dae3 | Python | 8,028 | 188 | import os
import shutil
import argparse
import torch
import torch.utils.tensorboard
from torch.nn.utils import clip_grad_norm_
from torch.utils.data import DataLoader
from tqdm.auto import tqdm
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
from rde.utils.misc import BlackHole, inf... |
a87727d8a6a74ed263e04ba53f0ef2744eeca5225787bcd6514046f634ee217e | Python | 8,029 | 244 | import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras.layers import Input
from keras import regularizers
from keras.utils.test_utils import layer_test
from keras.layers import normalization
from keras.models import Sequential, Model
from keras import backend as K
input_1 = np.arange(10... |
bdf61d6b99e0cac1da7f77faab5368f98192ee44a0dd912e1ac279185fbd8d57 | Python | 8,029 | 176 | from PyQt5 import QtWidgets, QtCore, QtGui
import time
class ExportDialog(QtWidgets.QDialog):
"""
Dialog that lets the user select Objects and Features to export. Also,
the user can set where to save the export and how to name it.
"""
def __init__(self, parent, data_manager, already_u... |
258be77ec2c72029e66a37d5fe0dc25c3d9e47b9875d2c7b80da939fadf5a3ce | Python | 8,033 | 191 | import pandas as pd
import numpy as np
from scipy.special import expit, logit
def logsumexp_dim0(A):
"""
Computes the logsumexp of the numpy array 'A' along axis 0, while avoiding numerical underflow.
Arguments:
- A, (d,N) numpy array
Returns:
- (N) numpy array, the logs... |
db96181a40051cb0f3dc400d1d7f06ed1e5f614478bbdd9a11cfbd55e277f55c | Python | 8,037 | 202 | # Copyright (c) OpenMMLab. All rights reserved.
from typing import Union
import torch
import torch.nn as nn
from mmseg.registry import MODELS
from .utils import weight_reduce_loss
def _expand_onehot_labels_dice(pred: torch.Tensor,
target: torch.Tensor) -> torch.Tensor:
"""Expand o... |
0d1270bcf85d4fe07eab0f2b3af9cb1f0fa896091ac71dfb6c99261d5da6feb8 | Python | 8,044 | 233 | #!/usr/bin/env python
# coding: utf-8
import os.path as op
import random
import time
import matplotlib.pyplot as plt
import numpy
import sklearn
import torch
import torch.nn.functional as nn_func
from sklearn import preprocessing
from sklearn.metrics import adjusted_rand_score
from torch.nn import Linear
from torch_g... |
139988eb1bbe0023f86c006e94450d9cfe730caae562ec51220ec148534f63c1 | Python | 8,047 | 206 | """Other util functions."""
# Copyright (c) 2022 EPFL-BBP, All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN... |
6dc7a7700cce3482add436105c32192184bb8bd64da67a8bb721543dc0dd0eac | Python | 8,047 | 226 | import math
import dgl
import dgl.function as fn
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl.nn.functional import edge_softmax
class HGTLayer(nn.Module):
def __init__(
self,
in_dim,
out_dim,
node_dict,
edge_dict,
n_heads,
dr... |
166b3b855291bc3f4dd4584e82d8c38e366460e136219f399fb2fcc2856cd0bf | Python | 8,049 | 244 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# pyre-strict
import math
import time
import typing
import unittest
import numpy as np
from fvcore.common.config import CfgNode
from fvcore.common.history_buffer import HistoryBuffer
from fvcore.common.registry import Registry
from fvcore.common... |
e596a9575388b7b224a4882afab3d116e778cc4e622d61e567f1c02902cf2472 | Python | 8,050 | 193 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def declust_marker_boxplot(sc_adata, sc_marker_gene, gene_index, celltype_col='celltype_major'):
"""
Create a boxplot showing the expression of a specific marker gene across different cell types.
Parameters:
sc_adata (anndat... |
400b34b8e1ad8374a7931d2df2ba3a8a578728daae86436bd7f75c16ea30cfc1 | Python | 8,052 | 218 | import logging
import shutil
from pathlib import Path
import numpy as np
import pandas as pd
from scipy import signal as ss
from scipy.optimize import curve_fit
from .io_utils import (
read_hdf5,
recording_site_from_channel_label,
write_hdf5,
)
from ..utils.stores_list import write_stores_list
logger = l... |
c75b641da4af41ac5a8fe88765cf81a98c1a43e213e78cfe1a81cc99ab975435 | Python | 8,052 | 149 | #!/usr/bin/env python3
# created by Daiki Sato and updated on 2025/3/20
# python3 5_1_1_grid_simulation_group.py 100 0 0.01 0
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import pandas as pd
import math
import sys
import os
args = sys.argv
num_agents = 6 ... |
fbbec3aa4dddbbefb20cf2e55766b01e534a8de1bf63e9940176891305a12627 | Python | 8,055 | 225 | ## BRIE-Beta model
import time
import numpy as np
from scipy. special import betaln
from scipy.sparse import issparse
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow.math import digamma, polygamma
from tensorflow_probability import distributions as tfd
# def Binomial_constant_ln(X_a, X_... |
e72462dc7aa8a4428c6b30ccac7d58fb654fedbc990d2c33e6a7fcfaf79c5f7c | Python | 8,057 | 231 | # Copyright (c) OpenMMLab. All rights reserved.
from abc import abstractmethod
from typing import Union
import torch
import torch.nn.functional as F
from mmengine.structures import InstanceData
from torch import Tensor
from mmseg.registry import TASK_UTILS
class BaseMatchCost:
"""Base match cost class.
Arg... |
afe72e9fc47d8919e9c6946e73720dc0f7cd1ee03a3304055098e9a7b457fd8b | Python | 8,060 | 254 | """Tests for Selection Groups REST API endpoints."""
import json
import pytest
from helpers import (
MockSioServer,
auth_header,
create_test_room,
create_test_user_in_db,
)
from httpx import AsyncClient
from sqlalchemy.ext.asyncio import AsyncSession
from zndraw.exceptions import SelectionGroupNotFou... |
fc485ea942958bd34baaa26073895d4fd5451f5c2f04c5cda9c6a7f3817f6ec2 | Python | 8,070 | 202 | import os
import glob
import math
import multiprocessing as mp
import torch
import torch.nn.functional as F
import torch.nn as nn
from dynamic_network_architectures.architectures.unet import PlainConvUNet, ResidualEncoderUNet
from dynamic_network_architectures.building_blocks.helper import get_matching_instancenorm, ... |
25350428f61b2700c20f4e07dbf798d418be36af516b7499dac26ed39cd6efa7 | Python | 8,074 | 242 | """Tests for CLI login (device-code) flow."""
from datetime import UTC, datetime, timedelta
from unittest.mock import patch
import pytest
from httpx import AsyncClient
from zndraw_auth import TokenResponse, UserCreate
@pytest.mark.asyncio
async def test_create_cli_login_challenge(client: AsyncClient) -> None:
... |
3f312fd84b54f5c590bd16cfd1d9e2bb5870d99a67260f58092c5e60e7a648e8 | Python | 8,076 | 270 | import logging
import os
import sys
import time
from builtins import print as __builtinprint
from datetime import datetime
from inspect import stack as __call_stack
from typing import ClassVar, Optional
__version__ = "0.1.0"
CONFIG = {
"tempfolder": "/tmp/",
"clear": True,
"verbose": False,
"usegpu": ... |
c467f94c517f7d818bd4d2359099cc37111724fc82cee6219ab175b35a7193fa | Python | 8,080 | 149 | import gzip
import logging
import tarfile
from src.babel_utils import pull_via_ftp
from src.prefixes import NCBITAXON
def pull_ncbitaxon():
pull_via_ftp(
"ftp.ncbi.nlm.nih.gov",
"/pub/taxonomy",
"taxdump.tar.gz",
decompress_data=True,
outfilename=f"{NCBITAXON}/taxdump.tar"... |
2dca368dd3b53fa4efd39ff0d668e40213fc04682802240b3e3b454c2809d0e1 | Python | 8,089 | 177 | # MagellanMapper unit testing for libmag
"""Unit testing for the MagellanMapper libmag module.
"""
import unittest
import numpy as np
from magmap.io import libmag
class TestLibmag(unittest.TestCase):
def test_pad_seq(self):
seq = ["a", "b", "c"]
self.assertSequenceEqual(libmag.pad_seq(list... |
5a0b5b8793bfeb07b062be5b8f3862e54e883d787b65f6be8a89acdbe6188a96 | Python | 8,089 | 229 | _base_ = [
'../_base_/default_runtime.py', '../_base_/datasets/ade20k_640x640.py'
]
pretrained = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/swin/swin_base_patch4_window12_384_20220317-55b0104a.pth' # noqa
crop_size = (640, 640)
data_preprocessor = dict(
type='SegDataPreProcessor',
mean=... |
3aeda3b601af19a7087276bb46039adf6d4a1cabf6dbb9a193d44555103d3cc0 | Python | 8,091 | 245 | from medperf.exceptions import InvalidArgumentError
from medperf.tests.mocks.report import TestTestReport
from medperf.tests.mocks.cube import TestCube
import pytest
from medperf.commands.compatibility_test.run import CompatibilityTestExecution
from .params_cases import (
INVALID_EXAMPLES,
DATA_FROM_PREPARED_E... |
a963b7bb924e4385e480b9b6b749126608f44600329455a548789afccdabf402 | Python | 8,094 | 233 | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
import unittest as ut
from h5py import h5p, h5f, ve... |
a327f1615b25961fc2481a47506a96e9c8aa0590db92788a60524e54056cf025 | Python | 8,096 | 188 | import argparse
import os
from bamUtil import getAlignedReads, readstoIdx
from seqUtil import fetchSize
def reverseSigLenList(sigLenList):
'''
reverse 3'-[5, 12, 20]-5' to 5'-[8, 15, 20]-3'
'''
sigLenList = sigLenList[::-1]
newlist = []
current = 0
for i in range(len(sigLenList)-... |
9f978ef98fa2254b8e018fdfe719fd01491453c7e0bb8cc39e551b834f78f66d | Python | 8,097 | 165 | # Jason Keller
# Feb 2021
# =============================================================================
# Program to output cameras to screen until Ctrl-C is pressed, based on
# capture program (see for details)
# =============================================================================
import PySpin, t... |
33ae01c74ccf916f97ac08bc2525dcac8404720d60ac5de4d2b6803533c2ad1b | Python | 8,109 | 242 | """
This script computes and saves regression for STRF
model.
It uses the TRF class to compute the regression
and saves the results in a CSV file.
It also allows for the option to save the
parameters of the regression model.
Args:
dataset_name: str ['ucsf', 'ucdavis'], -d
lag: int, default=200, --lag
bin_... |
44861050a5fa5927ff66c983e553378857d1113184793b81df8dcd16d7c100dc | Python | 8,109 | 201 | import os,torch,warnings
import numpy as np
import torch.nn as nn
import matplotlib.pyplot as plt
from utils.config import opt
from load_data import IMG_Folder,Integer_Multiple_Batch_Size
from model import ScaleDense,Second_stage_ScaleDense
from scipy.stats import pearsonr,spearmanr
from sklearn.metrics import ... |
154f0e87251fda6ae4cb0043b97b8368d4beede2f1582c2190d1a1518363ca49 | Python | 8,110 | 174 | from src import *
import optuna
import argparse
import re
parser = argparse.ArgumentParser(description="Run inference on triplets")
parser.add_argument(
"--setting",
type=str,
required=False,
default = "synergy_discovery",
help="The partition strategy you want to use."
)
parser.add_argument(
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.