sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
47f05b8fa37813c63c5c365a21314b4450887245a8c3b20785b6a32627e62b21 | Python | 1,535 | 47 | #!/usr/bin/env python
"""
HAL module for emulating an AOTF.
Hazen 04/17
"""
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.amplitudeModule as amplitudeModule
import storm_control.sc_library.parameters as params
class NoneAOTFFunctionality(amplitudeModule.Amp... |
617d57bc10865270dca0132acf24a73a33f989d7022e4ad1cfda9a4662b48737 | Python | 1,535 | 49 | from typing import Any
import numpy as np
import pandas as pd
import pyocto
from .base import AbstractAssociator
class PyOctoAssociator(AbstractAssociator):
def __init__(self, config: dict[str, Any], **kwargs):
self.associator = pyocto.OctoAssociator(**config)
super().__init__(**kwargs)
d... |
a404b75aa19bf09de963c4a2bf2a960c1d9984ca0cf13ca4d8e9561dbc2f13eb | Python | 1,535 | 98 | import base64
import numpy as np
import requests
input_array = np.array(
[
31,
32,
31,
30,
31,
31,
31,
31,
31,
30,
31,
31,
32,
33,
32,
32,
33,
33,
33,
34,... |
c6091b77e4174a1a3ed7de8f5b02c3d2cedd1195f0a7f7e9a08245c3da7928c8 | Python | 1,536 | 37 | """# napari forward reference demo
Example of using a ForwardRef to avoid importing a module that provides a widget.
In this example, one might want to create a widget that takes as an argument a napari
Image layer, and returns an Image. In order to avoid needing to import napari (and
therefore depending directly on... |
455f62f3db50ea710813f519881459930be913c3b55a34703c5a71ce6857a9c7 | Python | 1,539 | 42 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
from scilpy import SCILPY_HOME
from scilpy.io.fetcher import fetch_data, get_testing_files_dict
# If they already exist, this only takes 5 seconds (check md5sum)
fetch_data(get_testing_files_dict(), keys=['processing.zip'])
tmp_dir = tempfile.T... |
a32c77c11cbb47b22e31cd692e276d5099e821ac3ce403897698f71bc7637cc0 | Python | 1,539 | 39 |
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
def process_and_scale(input_path, output_path):
# Read the CSV file into a DataFrame
df = pd.read_csv(input_path, sep='\t')
# Extract the first, third, and fifth columns
selected_columns = df.iloc[:, [0, 2, 4]]
#selected_columns ... |
188ca18f6ba4fa94106e623cbad24a65acce9d00cd242ab545276252c6e2c3bc | Python | 1,540 | 39 | #!/usr/bin/env python3
# imports
import argparse
from ase import Atoms
from ase.visualize import view
from ase.io import read, write
from ase.calculators.mopac import MOPAC
from ase.optimize import *
from ase import units
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
from ase.md.langevin import ... |
e872fef3646210ab5caf2a94d6d8a1fd87567274432314f98bf4df6bb7b906c1 | Python | 1,540 | 43 | #!/usr/bin/env python
import sys
import getopt
import mappy as mp
def main(argv):
opts, args = getopt.getopt(argv[1:], "x:n:m:k:w:r:cdM")
if len(args) < 2:
print("Usage: minimap2.py [options] <ref.fa>|<ref.mmi> <query.fq>")
print("Options:")
print(" -x STR preset: sr, map-pb, map-ont, asm5, asm10 or spl... |
ec030afe194f53b11e43e1abdd47e823184ea45e7e19fb7f83831b3e3c0f4cb5 | Python | 1,541 | 42 | """
D-LIM (Direct Latent Interpretable Model): An interpretable neural network for
mapping genotype to fitness.
D-LIM employs a constrained latent space to map genes to single-value
dimensions, enabling the extrapolation to new genotypes and capturing the
non-linearity in genetic data. Its design facilitates a deeper... |
916b7afef80c4e38d08f1d682b6995f7686bc05adfc0e326e43e2595f2796adf | Python | 1,542 | 56 | #!/usr/bin/env python3
"""
Usage: ./autism-utils.py sample_info.tab --which_one sample_summary
"""
import argparse
import sys
from datetime import date
import pandas as pd
CURRENT_DATE = date.today().strftime('%Y%m%d')
def get_parser():
"""Get parser"""
parser = argparse.ArgumentParser(
formatter_cl... |
d2a647d0247fc3cc45ba225eb6ac86c7324592251a0651a2716a548b1a87fa5f | Python | 1,542 | 36 | import pyvisa as visa
import pyvisascope
import multitimer
import time
import yaml
import logging
visa.log_to_screen('INFO')
logger = logging.getLogger('pyvisa')
log2file = logging.FileHandler('experiment.log')
logger.addHandler(log2file)
def main():
# enter here the ID of your device. On windows, VISA you c... |
eb738806c7a866913c0bd754c8ecbdbfd99c91bb1ccaa3441a0f3b60a82d08b6 | Python | 1,542 | 47 | import networkx as nx
from zigzag.classes.workload.layer_node import LayerNode
from typing import Dict, Any
from networkx import DiGraph
class ONNXWorkload(DiGraph):
def __init__(self, **attr):
"""
Collect all the algorithmic workload information here.
:param workload: user-defined worklo... |
2982f39f3163722d539eed858bd5a20b5144a62a196a248677324aa8141c9398 | Python | 1,543 | 55 | import argparse
import os.path
import torch
import torch.multiprocessing as mp
import torch.nn as nn
from skoots.config import get_cfg_defaults
from skoots.lib.mp_utils import find_free_port
from skoots.lib.utils import cfg_to_bism_model
from skoots.train.engine import train
torch.set_float32_matmul_precision("high"... |
b63655e5932bfe647dedfe2697af0db644b1daa1273088d0e6e4eb32c08b69d4 | Python | 1,543 | 34 | #
# fiberprofile/analysis
#
# Fiber profile analysis tools (from the FiberProfileAnalysis scripts), available as dmrifiberprofile commands:
# flip-tensor reflect the tensor frame of a DTI along axes
# detect-tensor-flip find the flip of the tensor frame that orients a DTI correctly
# parametrize-f... |
54eef6d6151e464c4dfa1dd0532520ab26199ab20e9fad431307ca940996a2ff | Python | 1,544 | 58 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import sys
import os
sys.path.insert(0, os.path.abspath("../.."))
# -- Project information -----------------------... |
28cb429d60c64fc6ced9b110334e86f1d495fa02bc6e55467c6365de7e66623d | Python | 1,545 | 23 | from testsetclass import TestsetClass
class NBPRC(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['K_H', 'BH3PH3', 'K_F', 'H2', 'BCl3', 'BF3', 'BH3', 'ch', 'PH3', 'nh2-bh2', 'nh-bh', 'nh3-bh3', 'K_Cl', 'PMe3', 'cbut', 'bz', 'BF3PMe3', 'nh3', 'BCl3PMe3']
self.exp_values... |
47f5548f0fab5d289b88f0c54e21acdc4224934665120a5b9a8a36996209ae7a | Python | 1,545 | 63 | #!/usr/bin/env python
"""
Read a MAF from standard input and print the score of each block. It can
optionally recalculate each score using the hox70 matrix, and normalize the
score by the number of columns in the alignment.
TODO: Should be able to read an arbitrary scoring matrix.
usage: %prog [options]
-r, --rec... |
7a6e90801917c773e59b4243eff047666bd746742cda0e86224eed1ac303d954 | Python | 1,545 | 50 | from langchain_openai import ChatOpenAI
from chemgraph.models.supported_models import supported_alcf_models
def load_alcf_model(model_name: str, base_url: str, api_key: str = None) -> ChatOpenAI:
"""
Load an models from ALCF inference endpoints (https://github.com/argonne-lcf/inference-endpoints).
Parame... |
f62009a3bf1d7b066ff2c87ddc429b664cef54b546c59377cbf4683bc2f1e7ba | Python | 1,545 | 48 | from collections.abc import Sequence
from dataclasses import dataclass, field
from typing import Literal
al_cat_loss_names = Literal["CrossEntropyLoss", "BCEWithLogitsLoss"]
al_con_loss_names = Literal[
"MSELoss",
"L1Loss",
"SmoothL1Loss",
"PoissonNLLLoss",
"HuberLoss",
]
@dataclass
class Tabular... |
0fccb631725bae9334db7bb30b428a348b4b1b505cc81e97b799547a83683792 | Python | 1,546 | 47 | import argparse
from os.path import join
# import pickle
# import keras
# from keras.optimizers import Adam
# from keras.callbacks import EarlyStopping, ReduceLROnPlateau
import utils
# from model_zoo import DeepSTARR
# import plotting
# import pandas as pd
# import yaml
import numpy as np
'''
train an ensemble of Dee... |
811f5faf1df00d2970e8b1fd7639f3bb7478313cc101f8624a7e6f0d274f15c5 | Python | 1,546 | 58 | # Copyright (c) DP Technology.
# 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.
"""
Base classes for various unicore models.
"""
import logging
import torch
import torch.nn as nn
logger = l... |
58edbe5ef490b286d7c16fedd09562fd8db255bb476638f8590eb9357958f5ac | Python | 1,547 | 45 | #!/usr/local/bin/python3
from kubernetes import client,config
import time
import datajoint as dj
config.load_incluster_config()
v1 = client.CoreV1Api()
experiment = dj.create_virtual_module('experiment', 'pipeline_experiment')
treadmill = dj.create_virtual_module('treadmill', 'pipeline_treadmill')
pupil = dj.create_... |
a327c1c5e6c59ddc42f0c9f879fa31e9a8c3ffc24051f819b0940b301013b9d3 | Python | 1,547 | 48 | #!/usr/bin/env python3
"""
EDF Channel Inspection Utility
Inspects a sample of EDF files to report channel names, counts, and sampling rates.
Authors: Evans Nyanney, Parthasarathy D Thirumala, Shyam Visweswaran, Zhaohui Geng
Year: 2025
License: MIT
"""
import os
import glob
from typing import List
import mne
def ... |
cb62faa67af5604d2e6caf1485a51941840fdda64a46c50aa63c05dcebd3b96c | Python | 1,547 | 71 | """Dual estimation.
In this script we estimate subject-specific means and covariances
given the group-level model.
"""
#%% Run ID and output directories
import os
from sys import argv
# We get the run ID from the command line arguments
if len(argv) != 2:
print("Please pass a run id, e.g. python 4_dual_estimatio... |
e8befe1d03f5b378e57c44c6e253f2735c6693a84a4386025f7083a914128d2b | Python | 1,547 | 45 | import nibabel as nib
import numpy as np
# 读取 lh.white.gii(网格数据)
gii_mesh = nib.load("E:/Neuroimage/lh.white.gii") # 仅包含顶点和面
# 读取 lh.thickness.gii(包含顶点值)
gii_thickness = nib.load("E:/Neuroimage/lh.thickness.gii")
# 提取数据
vertices = gii_mesh.darrays[0].data # 顶点坐标
faces = gii_mesh.darrays[1].data # 面索引
thickness_va... |
0a88c36fc7a08f7ac9a57d11bdb25b48336cd3c966789e07be101e3d3101a6b3 | Python | 1,548 | 40 | import numpy as np
from numpy.random import RandomState
from pytest import approx
from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly
from brainscore_vision import load_metric
def _make_data(random_seed=1, n=300, m=10):
rnd = RandomState(random_seed)
return DataAssembly(rnd.u... |
1479e78e3080c0fb07e8f776915a433b1b33e228e44ccd45f092d813171925ca | Python | 1,548 | 52 | import numpy as np
import torch
import torchio
from torchio.transforms import Transform
class NormalizeSignals(Transform):
def __init__(self, xval_threshold, **kwargs):
self.xval_threshold = xval_threshold
super().__init__(**kwargs)
def apply_transform(self, subject):
"""
nor... |
5d265db127f6924478fdc469e3227e6dfc12a569864adde7235f15a71d4ff32c | Python | 1,548 | 53 | import os
os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"] = "0.5"
os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"] = "false"
import jax
import jax.numpy as jnp
from jax.scipy.stats import norm
import matplotlib.pyplot as plt
import argparse
import json
import numpy as np
import matplotlib.pyplot as plt
import jax.numpy as ... |
93f25ae818de53cd0db8bc721d5cdb0b72b9e0ae24592fd25a79da58b7d7720b | Python | 1,548 | 45 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from typing import Type
class MLPBlock(nn.Module):
def __init__(
self,
... |
2d8b999a619ab28562579d4e9a90443d18f4803c731d9aca80803235a11bf759 | Python | 1,549 | 65 | import csv
import numpy as np
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(self, val, n=1):
self.v... |
67d3f90c4f68471b0471dfc4bcc840a919b0ff6cf72168ca137d5277d814b66b | Python | 1,551 | 54 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
29ac35b647fe873d8b92566deaeb50ed69f7a7501f87190e1e44d0b5cecfac7d | Python | 1,552 | 45 | import numpy as np
import matplotlib.pyplot as plt
import spams
import cv2
import utils
from vahadane import vahadane
from sklearn.manifold import TSNE
from glob import glob
import os
SOURCE_PATH = '/data15/data15_5/Public/Datasets/stomach/fake_stomach_patch_20x_cancer/*'
TARGET_PATH = './data/target_20x.jpeg'
RESULT_... |
f37ce50896378c4dccce62a7182644adec6efd75d8b6bdcca67af0b914bf85bf | Python | 1,552 | 37 | import pickle
from typing import Generator, Any, Tuple
from zigzag.classes.stages.Stage import Stage
from zigzag.classes.cost_model.cost_model import CostModelEvaluation
import os
class DumpStage(Stage):
"""
Class that passes through all results yielded by substages, but dumps the results as a pickled list to... |
f66eea0bdb405332a28c55e6af8138e2fe65246a99d1b74ac1a8fb3c930833f1 | Python | 1,552 | 47 | import torch
import torch.nn as nn
import torch.nn.functional as F
class FLASHEncoder(nn.Module):
"""
Simplified FLASH-style HDC encoder.
- Learns a generator network that maps fixed noise vectors to rows
of the encoding matrix W in R^{D x in_dim}.
- Encodes input features x in R^{in_dim} into hy... |
f67aba8d3d3e28aea98fb90704b7752d45183fdf20d25c8a64c1934777cff7ce | Python | 1,552 | 48 | """Example code for plotting connectivity maps based on a correlation matrix.
In this example we use the inferred state/mode covariance matrices to
calculate the state/mode correlation matrices.
In this script we use an HMM fit, but this can be easily substituted for
a DyNeMo fit.
"""
import os
import numpy as np
f... |
f9afa09f386a3b40968373b8c8781e7c2c259252ba4669bea5bed48c66f48336 | Python | 1,553 | 38 | import os, glob
import pandas as pd
#from pyedflib.highlevel import read_edf_header
import mne
from tqdm import tqdm
td_paths = glob.glob('/data/haoqisun/Autistm-sleep-Kong/asdtdegidata-edf/TD/*.edf')
asd_paths = glob.glob('/data/haoqisun/Autistm-sleep-Kong/asdtdegidata-edf/ASD/*.edf')
td_paths = [x for x in td_paths... |
3c8eb6ac90dc1c42f3924fcfcfc4fc41b6543ac6d320dfaa495d916953b9a837 | Python | 1,554 | 52 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 3 23:17:43 2019
@author: Yoshi
"""
import csv
import numpy as np
from background_calculator import *
def dfof_converter(path,raw_data,framerate_information):
# Defines path to key folder
key_path = f"{path}/Data/Key"
# Reads frame key
frame... |
78584f3c51438ec43f4d1f24a74b4faa3305be013ee2f9d634d623a813abd4c0 | Python | 1,554 | 46 | #!/usr/bin/env python
"""
Uses a NI counter functionality to create a pulse delay.
Hazen 06/17
"""
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
class PulseDelay(hardwareModule.HardwareModule):
def __init__(self, modu... |
de7412162d66c44d549cb41bbdd3a2877419b2eeefec657d41db798fcc2fddd9 | Python | 1,554 | 43 | import os
import sys
import torch
from model.Ouroboros import Ouroboros
import pandas as pd
if __name__ == '__main__':
# check GPU
print('CUDA available:', torch.cuda.is_available()) # Should be True
print('CUDA capability:', torch.cuda.get_arch_list())
print('GPU number:', torch.cuda.device_count())... |
0bc33f649b85b95ebf6fc346b0a7de6da846cc34a41fa13fcd0ac152469e4e9d | Python | 1,555 | 59 | #!/usr/bin/env python
"""
Read scores in "wiggle" format from `score_file` and intervals in "bed" format
from `interval_file` and print all scores overlapping intervals.
TODO: Support binned array format scores also.
usage: %prog score_file interval_file [out_file]
"""
import sys
import bx.wiggle
from bx import mi... |
63910a07a8c87809eb4fe4bb1953532f28e7e0d08a773354c34753122b4584ac | Python | 1,555 | 74 | #! /usr/bin/env python
# aponteeduardo@gmail.com
# copyright (C) 2017
''''
'''
def parametrization(family, parametric, model):
class_name = 'Parameters{0:s}{1:s}'.format(family.title(),
parametric.title())
parent_name = 'Parameters{0:s}'.format(family.title())
raw_string = '''
class {0... |
78b3e82bfeddfdaf9fb89cb3cccc123ec6182d5b5b52669f2d8e9e8318cf3546 | Python | 1,555 | 43 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
# Insert sys.path modification and mock code here
sys.path.insert(0, os.path.abspath('metaprivB... |
958981df7dd9e934aefc789c9981a018b3c8b4f6055dae717411bbbce4604505 | Python | 1,556 | 50 | from __future__ import absolute_import
import os
import os.path as osp
from torch.utils.data import DataLoader, Dataset
import numpy as np
import random
import math
from PIL import Image
from skimage.io import imread
class Preprocessor(Dataset):
def __init__(self, dataset, root=None, transform=None):
sup... |
d69b74a766fa8d44e2f4dcf945872afe7d253f1855b8a0a3ed9a0815ba9093fa | Python | 1,556 | 31 | import numpy as np
from pfcmap.python.utils import stimfuncs as sfn
stimplotfns = {
'AudStim_10kHz': lambda timestamps,ax: [ax.axvspan(timestamp, timestamp + 0.2, **{'color': 'k', 'alpha': 1, 'lw': 0}) \
for timestamp in timestamps],\
'Optogenetics': lambda timesta... |
3070eb8524b8a4a9b767de83b9c68888e77e85308828ddc9322775192ec75966 | Python | 1,557 | 43 | # Copyright (C) 2019-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import shutil
from datumaro.components.dataset import Dataset, StreamDataset
from cvat.apps.dataset_manager.bindings import (
GetCVATDataExtractor,
detect_dataset,
import_dm_annotations,
)
fro... |
bda80ba144b867e6bedd55221eac672e4a38dc910fd6e6fd3fe4c444780dab98 | Python | 1,557 | 55 | #!/usr/bin/env python
import argparse
import sys
from pathlib import Path
import imgviz
import matplotlib.pyplot as plt
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
import utils # noqa: E402 # examples/utils.py, vendored alongside this script
def main() -> None:
parser = argparse.ArgumentP... |
d1c42ddf90efb2cca375b556e038dcb9eddae7194b20d203a76ad66685420c06 | Python | 1,557 | 58 | #!/usr/bin/env python
"""
Read a maf file and print the regions covered to a set of bed files (one for
each sequence source referenced in the maf). Only blocks with a positive
percent identity are written out.
TODO: Can this be generalized to be made more useful?
usage: %prog bed_outfile_prefix < maf
"""
import sys... |
f79432b77c94b3f096e7205a8ffc5d18eafe0625671f519d543054093421901b | Python | 1,557 | 39 | from pathlib import Path
import pytest
from pytest import approx
from brainscore_vision.benchmark_helpers.test_helper import StandardizedTests, PrecomputedTests
from brainscore_core.supported_data_standards.brainio import s3
standardized_tests = StandardizedTests()
precomputed_test = PrecomputedTests()
@pytest.mar... |
0282914923f1d344e7ed9d1e2034c2aa56c0168f010a07b7af31a5ae230953f4 | Python | 1,558 | 36 |
# model.py - Self-supervised ResNet-50 (SwAV) implementation
from brainscore_vision.model_helpers.check_submission import check_models
import functools
import torch
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
231ca572b481423eae5204be31ddb15ea741a295022135d86e50b9169a2936ac | Python | 1,558 | 47 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# STATEMENT OF CHANGES: This file is derived from sources licensed under the Apache-2.0 terms,
# and this file has been changed.
# The original file this work derives from is found at:
# https://github.co... |
7973dc61b2e915bec4d65fe0d634724b0aaa5b3ed17fbe071c70fbe92b75a3c8 | Python | 1,558 | 43 | from distances import CosineSimilarity
from utils import common_functions as c_f
from utils import loss_and_miner_utils as lmu
from losses.generic_pair_loss import GenericPairLoss
class MultiSimilarityLoss(GenericPairLoss):
"""
modified from https://github.com/MalongTech/research-ms-loss/
Args:
al... |
dc75df558c912d9666252374e4dcccab654d11685ae1744310df7aacd9bfb609 | Python | 1,559 | 59 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from pathlib import Path
import pytest
from cvat_sdk.api_client import models
from cvat_sdk.core.proxies.tasks import Task
@pytest.mark.parametrize("target_type", ["task", "job"])
@pytest.mark.parametrize(
("import_mode", "expected_shape_count... |
385aa4398baf946d80a8f8481bcd5b185453441218b53581b3e853ef90f383aa | Python | 1,560 | 51 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
class Biaffine(nn.Module):
def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True, diagonal=False):
super(Biaffine, self).__init__()
self.n_in = n_in
self.n_out = n_out
self.bias_x = bias_x
self.bias_y = bias... |
8ba3971f4bcc7bf78201a27e91bf5826bb242b6f1593aea48326f75596cef665 | Python | 1,560 | 49 | import os
import numpy as np
import pandas as pd
import scanpy as sc
import anndata as ad
os.chdir("/data/wuqinhua/phase/covid19/datasets")
folder_path = './pre_data/8_Ren_2021/pbmc1'
samples = [dir_name for dir_name in os.listdir(folder_path) if os.path.isdir(os.path.join(folder_path, dir_name))]
print(samples)
al... |
958ca4a0147e30c9fa619e409c6d7369100c7a66fb32576b22d3cd880646f68c | Python | 1,560 | 25 | """System prompt for the molecular docking agent."""
molecular_docking_prompt = """You are a molecular docking assistant. You help users estimate
how strongly a small-molecule candidate binds a receptor (target) and obtain its best pose.
Available tools:
- `run_docking`: dock a candidate into a receptor with AutoDock... |
a537d1e51f18b9f181998545932e5ade58aa325eaf581e184365fb78168800ca | Python | 1,560 | 53 | import os
from glob import glob
from PIL import Image
import torch
from torch.utils.data import Dataset
from torchvision import transforms
CLASS_TO_IDX = {
"AMD": 0, # AMD (Drusen + CNV)
"DME": 1,
"NORMAL": 2,
}
class OCTDataset(Dataset):
def __init__(self, root_dir, split="train", img_size=224, ... |
f14fdec1dfcccead2bf9274067143d051127dd6d9a891e3902f5d2b70d1ac877 | Python | 1,560 | 40 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import tempfile
from scilpy import SCILPY_HOME
from scilpy.io.fetcher import fetch_data, get_testing_files_dict
# If they already exist, this only takes 5 seconds (check md5sum)
fetch_data(get_testing_files_dict(), keys=['processing.zip'])
tmp_dir = tempfile.T... |
3593c86b21980750441e2f8aeb800fba9d76c985059e091be9ff33b6250730ec | Python | 1,561 | 27 | from testsetclass import TestsetClass
class SCONF(TestsetClass):
def __init__(self):
self.weak = 1.0
self.molecules = ['G1', 'C1', 'G3', 'C9', 'C14', 'C13', 'C5', 'C11', 'C6', 'C2', 'C8', 'C15', 'C12', 'C10', 'C4', 'C7', 'G2', 'C3', 'G4']
self.exp_values = {'0': 0.86, '1': 2.28, '2': 3.08,... |
7d81f789a3bc4f917f71d4fa74581f8ac8f3b17a616e5f284aa913c70d451e83 | Python | 1,561 | 50 | import os
import argparse
import sys
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--filedir', required=True, help="Path to input directory.")
args = parser.parse_args()
return args
def make_indexfile(filedir, infile, locus_n):
try:
outfile = open(f"{filedi... |
e1451cefd7f2f5865e5c7b3a83379f96c4dfa1c8adb1fbb6970b8fb65ba741d1 | Python | 1,562 | 67 | import os
from pathlib import Path
import requests
script_dir = os.path.dirname(os.path.abspath(__file__))
def download_from_zenodo(url: str, output_path: str):
response = requests.get(url)
response.raise_for_status()
with open(output_path, 'wb') as f:
f.write(response.content)
print(f"Do... |
f40388bfe72f5cdedba19354df96610cd5b2c7df1c1497d9afd4339aeb68d15f | Python | 1,562 | 48 | from typing import Optional
import torch.nn.functional as F
from torch import nn, Tensor
__all__ = ["SoftBCEWithLogitsLoss"]
class SoftBCEWithLogitsLoss(nn.Module):
"""
Drop-in replacement for nn.BCEWithLogitsLoss with few additions:
- Support of ignore_index value
- Support of label smoothing
"... |
048cef546f2e36f1fb24bc9de1981e45982a523830066f342cbae1c529d0c541 | Python | 1,563 | 44 | import matplotlib.pyplot as plt
import pygpc
import numpy as np
import pathlib
import os
import h5py
import matplotlib
matplotlib.use("Qt5Agg")
from helper_functions import __file__
MODULE_BASE = pathlib.Path(__file__).parent.parent
if __name__ == '__main__':
# time axis
t = np.linspace(0.01, 99.81, 500)
... |
72cda5c2913446957dd9661921452d0efd3219b4791a7d72cce544f5a7c784fd | Python | 1,563 | 53 | import numpy as np
import re
class Chan(object):
def __init__(self,recid,channum,task):
self.recid = recid
self.chan = channum
self.task = task
self.id = '%s__%i'%(recid,channum)
def set_feature(self,featurename,featureval):
setattr(self,featurename,featureval)
de... |
8eddfc65168b823d61850a1db7a2a2cefe0c97c55052788e58ebc1e797276219 | Python | 1,564 | 52 | #!/usr/bin/python3
#
import os
import sys
import argparse
from uac import utils
# Create the parser
my_parser = argparse.ArgumentParser(description="Writes mesh file of volumetric UAC")
# Add the arguments
my_parser.add_argument("target_path", metavar="path", type=str, help="Path for the volumetric mesh")
my_parser.... |
933b880b9007fda613e61e12064e6453bbfe2f8c7ae318b907b61ba1cbf1b13b | Python | 1,564 | 47 | import math
from analognasbench.data import AnalogNASBench, DriftMeasurement
def brute_force_best_architecture(metric='analog_drift_86400'):
"""
Searches exhaustively through all architectures in the AnalogNASBench
to find the one with the highest value of the given metric.
:param metric: The metr... |
a1ff7edf9d6bfaf7d93112936ebdb30c875c139a2da6892cbddd06d03fa966b0 | Python | 1,564 | 45 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import shutil
from contextlib import suppress
from django.core.management.base import BaseCommand
from django.utils import timezone
from cvat.apps.engine.models import Job, Project, Task
class Command(BaseCommand):
help = "Cleanup outdated ex... |
aeeb6973dcd158c299690a5c7e771fb5245595bb01b93a856bf5ac694a61c213 | Python | 1,566 | 56 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides Qt3DRender classes ... |
2d76e6714b6e244bfd8944f6c477b165d1b5c20dbcd2ef8230a16e4f9419ea8e | Python | 1,567 | 40 | from brainvoice.configuration.configuration_instantiator import ConfigurationInstantiator
from brainvoice.configuration.configuration_parser import ConfigurationParser
from brainvoice.configuration.configuration_linker import ConfigurationLinker
class Configuration(ConfigurationInstantiator):
"""
Class respon... |
688581a1a6c50b2e31cfa9b9ebe1b1d5874649e6767bb5bcc7a5d6a118597962 | Python | 1,567 | 64 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
# Add /scripts to path. Used for Furo theme and to generate images
this_path = os.path.split(os.path.abspath(__file__))[0]
script_path = this_path + "/scripts"
sys.path.append(script_path)
html_static_path = ["static"]
html_css_files = ["htmldiag.css... |
b910e1b91dea784fed9e1741ed7f023bcb8f382178fd8728f8ba4b14b4d1ba25 | Python | 1,567 | 49 | from PIL import Image
from numpy import average, dot, linalg
# 对图片进行统一化处理
def get_thum(image, size=(299, 299), greyscale=False):
# 利用image对图像大小重新设置, Image.ANTIALIAS为高质量的
image = image.resize(size, Image.ANTIALIAS)
if greyscale:
# 将图片转换为L模式,其为灰度图,其每个像素用8个bit表示
image = image.convert('L')
r... |
e643e52a8ba5cfcb2e1d811a57e9cc1c7715b598413e748d6d497edaca6aeb68 | Python | 1,567 | 44 |
import sys
import torch
import logging
import multiprocessing
from datetime import datetime
import test
import parser
import commons
from cosplace_model import cosplace_network
from datasets.test_dataset import TestDataset
torch.backends.cudnn.benchmark = True # Provides a speedup
args = parser.parse_arguments(is_... |
f3322d80485590b521d577f120eca48160a488db623f719701ee4063b8b602d0 | Python | 1,567 | 73 | # -*- coding: utf-8 -*-
"""
Generate 1D pattern
This script creates a one-dimensional sinusoidal or rectangular pattern.
"""
# external inputs
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import correlate
from numpy.fft import fft
# local inputs
from fmri_tools.simulation.pattern import patt... |
fecc7f9130f4bf3b68c36277b540b7acb1af7c59770f809f188aa283f30b06f2 | Python | 1,567 | 46 | from __future__ import annotations
from pathlib import Path
import numpy as np
from pytestqt.qtbot import QtBot
from labelme._app import MainWindow
from labelme._label_file import read_label_file
from labelme._save_request import write_save_request
from labelme._shape import Shape
def test_save_request_owns_mutabl... |
29039b822375a9157938d003234238f34e95fa1824f732efe9112381872bdc3c | Python | 1,568 | 37 | import os
from typing import Generator, Any, Tuple
from zigzag.classes.stages.Stage import Stage
from zigzag.classes.cost_model.cost_model import CostModelEvaluation
from zigzag.visualization.results.plot_cme import (
bar_plot_cost_model_evaluations_breakdown,
)
class PlotTemporalMappingsStage(Stage):
"""
... |
4cb52a64fc217e08ff6c1bb16d90fecf9f0fdfa457c3710acb2f274af9d77b6d | Python | 1,568 | 60 | """ test/imputation/ts/test_moving_window.py """
import pytest
import numpy as np
import impyute as impy
from impyute.ops.testing import return_na_check
#pylint:disable=missing-docstring, redefined-outer-name
@pytest.mark.parametrize(
'pos1,pos2,expected',
[
(2, 0, 11.5),
(2, 2, 12),
(... |
7fa541021d77efe0e7a36c5b809a1fd35189b5ff493f2e73441f283ce55d464f | Python | 1,568 | 54 | #!/usr/bin/env python
"""
Filter each block in a maf file. Can filter blocks for a minimum number of
components (rows), a minimum length in columns, or an arbitrary python
expression (which will be evaluated for each block with the variable 'm'
containing that block).
usage: %prog [options] < maf > maf
--componen... |
84349197ef404f15038e1a127702e73ae5b4ed83f5a1ce45815a4468df6783d9 | Python | 1,568 | 61 | """
Functions that find and define paths for handling plugins and preferences
"""
import os
def getHomeDir():
"""
Return the user's home directory as a string. Should work on both Windows and Linux
See: http://stackoverflow.com/questions/10644183/how-to-store-variables-preferences-in-python-for-later-use
... |
e751199c047c0d9f4557614ed3429e05f48174adb50bb75f39c06c76e7f9d7af | Python | 1,568 | 68 | # Default descriptors settings
# Consult https://singroup.github.io/dscribe/latest/tutorials/tutorials.html
# for details on how to fill the settings
# Special parameters not present in the website above:
# site_size: size of the hypothetical adsorption size
DEFAULT_CM_SETTINGS = {}
DEFAULT_CUTCM_SETTINGS = {"site_... |
29a09f284f47e2781fbfbde4b58dc9acbbcb56a8d17b5678e650a0e0d6710c76 | Python | 1,569 | 47 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
import torch
from ultralytics.utils import LOGGER
from ultralytics.utils.checks import check_executorch_requirements
from .base import BaseBackend
class ExecuTorchBackend(BaseBackend):
... |
679df7406a3a0cd37c28838904b25e311397f3cf1abfff0f11dc648d475ed4e4 | Python | 1,570 | 60 | #!/usr/bin/env python
"""
The filmRequest object.
Hazen 04/17
"""
class FilmRequest(object):
def __init__(self,
basename = None,
directory = None,
frames = 0,
overwrite = False,
tcp_request = False,
**kwds):
... |
130517b248e6098e1a2448cc1e23ef852da2506fa053d0f2c562ac7fc6315d53 | Python | 1,571 | 47 | '''Helper functions for various tests.'''
from itertools import product
import numpy as np
import torch
from zennit.types import BatchNorm
def prodict(**kwargs):
'''Create a dictionary with values which are the cartesian product of the input keyword arguments.'''
return [dict(zip(kwargs, val)) for val in pr... |
13442a834dea112337c429ba8a7d735cbb5de9bde9715202cb54f935c9fdeff0 | Python | 1,571 | 49 | import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, matthews_corrcoef, auc, roc_curve
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from sklearn.mo... |
2ae736dc21fe70d3cd94f1f45a5f6cff3247035c3fcbcc59713c68b83cd851f6 | Python | 1,571 | 66 | #
## this program joins two files based on the column
#
### import necessary libraries
import re,os,sys,logging,time,datetime;
### checking out the number of arguments
if (len(sys.argv)<6):
print('Not enough arguments!!');
print ('It takes at least 5 arguments.');
print ('Usage:\n\tProgramName inFile_1 inFile_... |
177175193e7cab5af60c7774df0d7e525ba300bc76f005821cd7f4695083c8e5 | Python | 1,572 | 52 | from collections import OrderedDict
import numpy as np
from brainscore_vision.model_helpers.activations.core import ActivationsExtractorHelper
from .descriptor import GaborEntropyConfig, MeanAbsFoveatedGaborExtractor
MODEL_IDENTIFIER = 'gabor_filter_mean_abs_4x4_v2'
LAYER_NAME = 'gabor_mean_abs_foveated32_48_64'
... |
200258fbd36291f45a13708193ab191ebfe8354e0de14710ea47d7b112c603d6 | Python | 1,573 | 49 | """Test QtPrintSupport."""
import pytest
from qtpy import PYQT5, PYQT_VERSION, QtPrintSupport
def test_qtprintsupport():
"""Test the qtpy.QtPrintSupport namespace"""
assert QtPrintSupport.QAbstractPrintDialog is not None
assert QtPrintSupport.QPageSetupDialog is not None
assert QtPrintSupport.QPrint... |
736f3744c4d2fa06c13bceab31b3398d0d77c6d805e9a4618f94c8889e98910a | Python | 1,574 | 42 | # Copyright 2015 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
"""
Adaptive Resonance Theory detector - Open Source E... |
8ee11f8241bac3bac12c492896d3221fd0c38a731a0fd0f5813706d1ac4fa79c | Python | 1,574 | 58 | #! /usr/bin/env python
# Copyright 2014 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import os
import argparse
from... |
6d05c3ba87b4b3098fe920f9441e5aff39fd21e0b0de4554daaef0b3a14b66d3 | Python | 1,575 | 44 | import os
from django.db import migrations
from cvat.apps.engine.log import get_migration_logger
def delete_or_rename_wrong_labels(apps, schema_editor):
migration_name = os.path.splitext(os.path.basename(__file__))[0]
with get_migration_logger(migration_name) as log:
log.info("\nDeleting skeleton La... |
76fd72f8dad5306b6d77d35447a1a27585c22fcd0970d081e6076e04ef56813a | Python | 1,575 | 56 | import unittest
import os, sys
import numpy as np
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
from heig.wgs.mt import remove_variants_inplace
class Test_remove_variants(unittest.TestCase):
de... |
feb3ad230650cd7ed9654f9b2eabb6e8e3b8b1c2ed4d6dbcc8c7ff8272af5aeb | Python | 1,575 | 58 | import numpy as np
import osqp
from dipy.reconst.mcsd import MSDeconvFit, MultiShellDeconvModel
from scipy.sparse import csr_matrix
from tqdm.auto import tqdm
__all__ = ["MultiShellDeconvModel"]
def _fit(self, data, mask=None):
"""
Use OSQP to fit the multi-shell spherical deconvolution model.
"""
og... |
05de5bca05db94b66bc6eee991f974a27f3b1fb7063536e5835854f787c171cb | Python | 1,576 | 73 | import re
"""
Module to infer data type from string or convert a string to a data type.
"""
def dataTypeFromString(string):
"""
Returns the data type which string appears to be: int, float, or str
"""
#if all integers return int
if re.match('^[0-9]+$',string) != None :
return int
#if all integers with on... |
3414770c5332a2c534c734a31180d529df91625c3546320458a4f9f507e97fab | Python | 1,576 | 51 | """Helper functions for YASA (e.g. logger)"""
import logging
LOGGING_TYPES = dict(
DEBUG=logging.DEBUG,
INFO=logging.INFO,
WARNING=logging.WARNING,
ERROR=logging.ERROR,
CRITICAL=logging.CRITICAL,
)
def set_log_level(verbose=None):
"""Convenience function for setting the logging level.
T... |
ba688349a9e27d33f33cc8cda78bde2f5819dce6121b50481733ead7b264a0a4 | Python | 1,576 | 61 | from pathlib import Path
from typing import Callable
import numpy as np
import pytest
import scipy.io
from brainways.project.info_classes import MaskFileFormat
from brainways.utils.export import export_mask
@pytest.mark.parametrize(
"values",
[
np.array([[1, 2], [3, 4]]),
np.array([[[1, 2, 3... |
c040b55eec01738ae3ec6cfe73f53c2820ceb1f35a8695e7ef3d4d269c8f7355 | Python | 1,576 | 52 | #!/usr/bin/env python3
import argparse
import numpy as np
from ase import Atoms
from ase.io import read, write
from ase.optimize import *
from KerNNCalculator.KerNNCalculator import *
'''
Script to calculate the potential energy of a structure.
Usage: python predic_mol.py -i structure.xyz
'''
#parse command line argu... |
7649bc5e7540275b115b08817aa84664833209177305291ee11b3f762982e379 | Python | 1,577 | 47 | # In 2D examples, in_inbr information is calculated while loading the data.
# However, since this calculation is considerably time-consuming in 3D,
# this information is calculated beforehand using this script.
import torch
import numpy as np
import glob
import os
from timeit import default_timer
def create_grid(min... |
8093efbc9f4860980c73680a6f0d22b18383dff1459ee3dc69eab23d0fb9dbfa | Python | 1,577 | 57 | # -*- coding: utf-8 -*-
"""Hemodynamic response function."""
import numpy as np
from scipy.stats import gamma
__all__ = ["hrf_spm"]
def hrf_spm(TR, p=(6, 16, 1, 1, 6, 0, 32)):
"""An implementation of spm_hrf.m from the SPM distribution. The code is taken from
[1]_.
Parameters
----------
TR : fl... |
9be27c1e48977eb9685c664d1d7998e3eccb8e3a7c8fb5204d8ffa1c54ee4cc7 | Python | 1,577 | 66 | #!/usr/bin/env python3
import arbor as A
from arbor import units as U
import numpy as np
import matplotlib.pylab as plt
import seaborn as sns
T = 100 * U.ms
dt = 0.05 * U.ms
class recipe(A.recipe):
def __init__(self):
A.recipe.__init__(self)
self.weight = 10
def num_cells(self):
ret... |
dbb4af398b09e0e46ee934643224b1a38f728915b5d3886758eecb3d22e98029 | Python | 1,577 | 48 | """
September 2020 by Oliver Gurney-Champion & Misha Kaandorp
oliver.gurney.champion@gmail.com / o.j.gurney-champion@amsterdamumc.nl
https://www.github.com/ochampion
Code is uploaded as part of our publication in MRM (Kaandorp et al. Improved unsupervised physics-informed deep learning for intravoxel-incoherent motion... |
8f2eaac5f5fb9252420d7b826efd2a469bab37bca8f2a3e626ce8066649e2a26 | Python | 1,578 | 63 | # Kai Sandbrink
# 2023-02-01
# This script samples trajectories across test tau values for the specified models
# %% LIBRARY IMPORTS
import torch
import pandas as pd
import numpy as np
from utils import Config, get_timestamp
from utils_project import load_config_files
from test_case import test
import os, copy, pickl... |
ed890657d9910652c4f15b3c2d8d5ec9522401ce81365aadf66a49e7a215a085 | Python | 1,578 | 49 | # -*- coding: utf-8 -*-
"""
Created on Thu May 28 11:28:32 2020
@author: Yoshi
"""
import numpy as np
import scipy.stats as stats
import math
def correlation_calculator(data):
# Creates a blank numpy array to store correlation coefficients in
correlation_coefficients = np.zeros((data.shape[0],data.sha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.