sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d980f5664cc8c84a15f04a1fb30776a4eb70410c7d8bd05c8d74d27c5841dee7
Python
2,761
58
from tensorflow.keras.layers import Activation, Add, AveragePooling2D, \ AveragePooling3D, BatchNormalization, \ Conv2D, Conv3D, Dense, Dropout, Flatten, \ GlobalAveragePooling2D, \ ...
2399e24f60cd513017808801a1ff91111d5f14b186e57271d9b8f1258db25ad2
Python
2,762
83
import warnings from langchain_core.globals import get_debug as core_get_debug from langchain_core.globals import get_verbose as core_get_verbose from langchain_core.globals import set_debug as core_set_debug from langchain_core.globals import set_verbose as core_set_verbose from langchain_classic.globals import get_...
916d6a9bee6904623f72a00ba97c4a5b3f26d8a4c4e5dfc7f49f23103f7ba89a
Python
2,763
69
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for detai...
b548c3c9b1bbcc9833888b2f6e27e7ab958ef9565daec9e348f7add9388e231d
Python
2,764
86
from __future__ import annotations import asyncio from collections.abc import AsyncIterator from typing import Any, Literal, cast from langchain_core.callbacks import AsyncCallbackHandler from langchain_core.outputs import LLMResult from typing_extensions import override # TODO: If used by two LLM runs in parallel t...
c9240513c98c52494c98c5c9f692dea6b21d515818801cec2b817f6a9cbed3ff
Python
2,764
74
import sys sys.path.append(".") import os import argparse import io import tarfile from crystallm import ( extract_space_group_symbol, replace_symmetry_operators, remove_atom_props_block, ) def postprocess(cif: str, fname: str) -> str: try: # replace the symmetry operators with the correct op...
dea6268d40f96d17c0c5f91ff4f1b2c099ecbbcb396001521c194658d60103e4
Python
2,768
102
""" 2023.08.30 author: femke.hurtak@epfl.ch Script for drawing subsets of the network, zooming in on clusters. """ import os import matplotlib.pyplot as plt import neuron_params import plot_params from loaddata import load_graph_and_matrices from draw_meta_network import load_communities from common import ( sel...
c78abd095fac243c58e9754ece82824de07e559dcf7c2b6c8307701baa3e00db
Python
2,769
71
#%% import os import gc import warnings from copy import deepcopy from time import time import re import numpy as np import pandas as pd from scipy.io import loadmat, savemat from load_intan_rhd_format import read_data, read_header # from utils.read_mda import readmda # from utils.write_mda import writemda16i from ut...
9e55308d668cf0b1c22e48168d2e9df40114655a270a60ebaef58beace5a138f
Python
2,770
90
import argparse import numpy as np def peak_det_simple(x, ff, flag=0, omit_close_peaks=0): """ peak_det_simple - Internal R-peak detector function Syntax: peaks, peak_indexes = peak_det_simple(x, ff, flag, omit_close_peaks) Inputs: x: Vector of input data ff: Approximate ECG be...
f7b5fa511100ae0bd35c51e0d883a610aa8ed3cb9528b6616faad5cf4b44c4c0
Python
2,770
62
import pandas as pd import numpy as np import re def get_id(x,gtf_data_new): # print(x) chr=x.split('_')[0] site=int(x.split('_')[-3].split('.')[0]) gtf=gtf_data_new.loc[(gtf_data_new['chr']==chr)&(gtf_data_new['strat']<=site)&(gtf_data_new['end']>=site),:] if len(set(gtf['strand']))>1: gtf...
20eb7034ead2fcffbd94e8a996657c731117c6d956e24a36d77c3f16960a53f2
Python
2,771
78
""" This module is an example of a barebones numpy reader plugin for napari. It implements the ``napari_get_reader`` hook specification, (to create a reader plugin) but your plugin may choose to implement any of the hook specifications offered by napari. see: https://napari.org/docs/dev/plugins/hook_specifications.htm...
c4f2acc67eb5d09a5dfde46948570099b8a5ee658493250de503fa68a5740e1c
Python
2,772
62
import pandas as pd import numpy as np import re def get_id(x,gtf_data_new): # print(x) chr=x.split('|')[0] site=int(x.split('|')[1].split('.')[0]) gtf=gtf_data_new.loc[(gtf_data_new['chr']==chr)&(gtf_data_new['strat']<=site)&(gtf_data_new['end']>=site),:] if len(set(gtf['strand']))>1: gtf=...
101608c969916888707f07bbd20700e284b546591dd1813dc48243baf1f42d2e
Python
2,774
54
"""Extract regional labels without changing annotations or surface coordinates.""" from pathlib import Path import nibabel as nib import numpy as np def read_regions(annotation): codes, table, names = nib.freesurfer.read_annot(str(annotation), orig_ids=True) if table.shape != (len(names), 5): raise V...
17ec038de91ecda076fb33854f8dddbffca5e9e1a10b91167c740971d847d3e6
Python
2,776
76
import logging from typing import Callable from tensorboardX import SummaryWriter import torch import torch.nn as nn from torch.optim import Optimizer from torch.optim import lr_scheduler as _LRScheduler from tqdm import tqdm from HMSA.args import TrainArgs from HMSA.data import MoleculeDataLoader from HMSA.models imp...
209634583d0a5c8391f73072e8b37070c6c67850981ba3e4e8d4a94e0070aa03
Python
2,776
78
import numpy as np import copy from random import shuffle from tqdm import trange def train_Clust3D(epochs, lr_0, t1, t2, neurons, n_neurons, MDC_data, neighbors, std_mean_all, correlation, ord, random_state): def masked_norm(a, b, ord=2): mask = ~np.isnan(a) & ~np.isnan(b) if not np.an...
4c0a64d0152ab7e2fb6ed603c103176b3cff8cf5d752156376860c523cc81af9
Python
2,777
99
# Copyright 2021 AlQuraishi Laboratory # Copyright 2021 DeepMind Technologies Limited # # 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 # # U...
bb1fa34166de4af096e3c05040e982d6fd3c199a7a03e9e9e1140ec857340fb9
Python
2,777
82
""" This script is used to plot GO analysis produced by GOATOOLS. It communicates with R, so rpy2 needs to be installed. """ import numpy as np import pandas as pd from glob import glob import session_info, re import rpy2.robjects as ro from rpy2.robjects import pandas2ri from rpy2.robjects.conversion import localconve...
d280c98ce174c0de4dd8f52920ec911ab182e1df526c30bb3efe1614498d9b8e
Python
2,777
92
import torch import torch.nn as nn class DistanceNetwork(nn.Module): def __init__(self, n_feat, p_drop=0.1): super(DistanceNetwork, self).__init__() # self.proj_symm = nn.Linear(n_feat, 37*2) self.proj_asymm = nn.Linear(n_feat, 37+19) self.reset_parameter() def...
763e8cde43b3765d74a8266ea3e4fd6387f198ba674f1164aade7bd9ac0a9c5d
Python
2,778
114
# -*- coding: UTF-8 -*- """ @Author: Xingyan Liu @File: _tmp_h5py.py @Date: 2021-08-03 @Project: CAME """ import os from pathlib import Path from typing import Union, Optional, List, Mapping import logging import numpy as np import h5py def save_hidden_states(data_list: list, path: Union[Path, str]): """ Save hid...
622df9d36303dadd43b6560c318a3342762511ebbdfc9392be5efe46c1a37dc5
Python
2,779
82
""" This script is used to plot GO analysis produced by GOATOOLS. It communicates with R, so rpy2 needs to be installed. """ import numpy as np import pandas as pd from glob import glob import session_info, re import rpy2.robjects as ro from rpy2.robjects import pandas2ri from rpy2.robjects.conversion import localconve...
585ef8b74ac7d3a8bb774a5b83b791380024f5615a994ac2d9d7a653148805e9
Python
2,782
71
import unittest from tests.test_utils import TestUtils from tests.test_ImageModels import TestImageModels from tests.test_Regularizers import TestRegularizers from tests.test_LinearOperators import TestLinearOperators from tests.test_Preconditioners import TestPreconditioners from tests.test_InitializationMethods impo...
6a9f8281e6ae27435f8fb33426b7c2029770653f0490a2df050384a28fdf68dd
Python
2,782
68
import logging import os import socket import sys import pandas as pd from configs.configs import get_config_dict from helpers.evaluation import leave_every_other_out_split, get_test_log_likelihood, get_test_location_estimated_covariance_structure from helpers.rockland import get_rockland_subjects, load_rockland_data...
224ed8aaff2ed75b88f71e4b40d8dae9d35bc461e7ee776cee97b5eac868e1a4
Python
2,783
91
import numpy as np import matplotlib.pyplot as plt import argparse import pickle from sklearn import preprocessing from sklearn.metrics import confusion_matrix from sklearn.metrics import accuracy_score from sklearn.ensemble import RandomForestClassifier """ - Classification: https://scikit-learn.org/stable/auto_exa...
aa50911a8335b829bc163ccd6f10da92f2971382e58d389c0eaae5aaa2e51b94
Python
2,783
62
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 6 16:08:39 2021 @author: Neil J Thomson """ import os import sys from pensa import * """ for the pdb visualisation, the trajectory needs to be fit to the first frame of the simulation so that the density and protein align with each other """ # #...
092c739d4e963190c6e1c8309210f50ea9c2087978fe2b7862540df3b805dd4f
Python
2,784
63
import pandas as pd import numpy as np import re def get_id(x,gtf_data_new): # print(x) chr=x.split('_')[0] site=int(x.split('_')[1].split('.')[0]) gtf=gtf_data_new.loc[(gtf_data_new['chr']==chr)&(gtf_data_new['strat']<=site)&(gtf_data_new['end']>=site),:] if len(set(gtf['strand']))>1: gtf=...
fff42ffb0d5b1826976dbbf869d1f895c212862d91708e637d069f64b28e3489
Python
2,785
67
"""Class registry for models, layers, optimizers, and schedulers. """ optimizer = { "adam": "torch.optim.Adam", "adamw": "torch.optim.AdamW", "rmsprop": "torch.optim.RMSprop", "sgd": "torch.optim.SGD", "lamb": "src.utils.optim.lamb.JITLamb", } scheduler = { "constant": "transformers.get_const...
21cd1b1d46766055770c525994ec3883b49512f5190c1fee91d8d0cd370037de
Python
2,787
86
import logging import torch from torch import nn from torch.nn import ModuleDict from torch.nn.init import xavier_normal_ from .base import Shifter logger = logging.getLogger(__name__) class MLP(Shifter): def __init__(self, input_features=2, hidden_channels=10, shift_layers=1, bias=True, **kwargs): """...
def146b75a37a912291b3b41ef9a6809201dd191e85abe56200c0125d270e841
Python
2,787
76
"""Functions for formatting text. """ import logging logger = logging.getLogger(__name__) def tag_seq_overlap(overlap_labels, target_seq): """Add tags around where a sequence overlaps a target. For example, if the target seq is 'ATCGAATTCCGG' and the overlap is the indices {1,2,5,6,7}, the output is ...
3f001fc859f40a589f0bd37c3492f65248e153f85405ddbabc96360cfa4f759e
Python
2,789
101
""" Tests for utility methods """ import os import pytest from openff.toolkit import unit def test_subclasses(): """Test that all subclasses (and descendents) are correctly identified by all_subclasses()""" from openff.toolkit.utils.utils import all_subclasses class Foo: pass class FooS...
8da47a767bc5d5d02b36c05a0e40ce8380040755937539104c00f5ff0ba9aaaf
Python
2,791
101
import pathlib study_name = "age-prediction-benchmark" bids_root = pathlib.Path( '/storage/store/data/camcan/BIDSsep/rest') deriv_root = pathlib.Path('/storage/store3/derivatives/camcan-bids/derivatives') subjects_dir = pathlib.Path('/storage/store/data/camcan-mne/freesurfer') source_info_path_update = {'proce...
22c401980257fe304ee3a7f62fdf50bbcaf6476cefee0366dbcd898359c1cad2
Python
2,794
81
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for d...
4903f474836371697f7cdeb63bae3bfae3a0ded7276e239242b7e5435801700f
Python
2,795
81
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for detai...
96b38251ec6608edc9cd21296d3ed4db972e054ccacbe3acc4d4d660351a1cb3
Python
2,795
84
# Copyright 2022 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
d97398ad41fbc3183c738da1be776cc3e95b340eee71682792a62fa6d32689a3
Python
2,797
83
import torch import pandas as pd from tqdm import tqdm from torch.utils.data import Dataset from torch_geometric.data import Data from utils import build_crystal_graph, build_crystal class MatDataset(Dataset): def __init__(self, data_path, prop_name=None, graph_method='crystalnn'): super().__init__() ...
e66e6be3d89dccaac017fa86ae7d04a0b85cab88ce7d0977d83e055f6d2d263a
Python
2,797
70
import os from pathlib import Path import PIL.Image from typing import List import click import numpy as np import torch from tqdm import tqdm import legacy import dnnlib from training.training_loop import save_image_grid from torch_utils import gen_utils from gen_images import parse_range @click.command() @click.opt...
1d19b7e97c39c173053616bd4cda762f032f946da81ee01c87d3ebdc1f826da7
Python
2,798
83
from pathlib import Path from rhe import run_genie, run_genie_mem, run_genie_multi_pheno REPO_BASE_DIR = Path(__file__).parent.parent EXAMPLE_DIR = REPO_BASE_DIR / 'example' def test_genie(): gen = EXAMPLE_DIR / 'test' phen = EXAMPLE_DIR / 'test.pheno' covar = EXAMPLE_DIR / 'test.cov' anno...
4a2308df638abe7fb05a194e5247e4b8ff524aab85a80f3a3fe33d435a8b8740
Python
2,798
74
from typing import Any from langchain_core._api import deprecated from langchain_core.language_models import BaseLanguageModel from langchain_core.messages import BaseMessage, get_buffer_string from typing_extensions import override from langchain_classic.memory.chat_memory import BaseChatMemory @deprecated( si...
dd718b1a08da945090d4ac1a5a2641a1c3b86ec09c4dc5adbee14ad125f7c4b0
Python
2,801
99
# Copyright 2021 AlQuraishi Laboratory # Copyright 2021 DeepMind Technologies Limited # # 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 # # U...
e674cd5564a375c3636ed9236dbb5a3c880114480bb00657c6a162272658e300
Python
2,801
81
# Copyright (c) 2021, NVIDIA CORPORATION. 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 applic...
121111d2143f306d3bceb8dc00b763a219326c8b14718cab26ce61ef53d41e40
Python
2,802
72
from logging import Logger from pathlib import Path from typing import List import re import numpy as np # needed in eval from ..data import (AnnotationTable, WorldlineTable) from ._utilities import default_args @default_args("_this, _now, *, _ACTIVE") def change_provenance(dataset: Path, annotations: AnnotationTab...
2ce102b8307a5cf66a6e28b8dd5789a6efdb0807f254371d432fec96504bee41
Python
2,802
104
''' MACS.py - Parser for MACS output ================================ :Tags: Python The :mod:`Pipeline` module contains various utility functions for parsing MACS output. API ---- ''' import collections import math import csv import cgatcore.csvutils as csvutils MacsPeak = collections.namedtuple( "MacsPeak"...
e5e201c509b09e71f5df04a8db29b051cd1389c4323012cc40cbfa8509d1958b
Python
2,802
86
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import torch import torch.nn as nn # Different encodings for the atom distance embeddings class GaussianSmearing(torch.nn.Module): def ...
65eba09efa74129429e33c260c22faf359716b14413ebbe5cbd27a04af77f940
Python
2,803
56
PREFIX = """Assistant is a large language model trained by OpenAI. Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text base...
d09b592266b736bb2c6ba755c96aa4660da2788e5b79584b1de9ba22b9af7b32
Python
2,804
64
import argparse from pathlib import Path from alpaca import ProvenanceGraph def add_suffix_to_gexf_file(source, suffix): return source.parent / (source.stem + f"_{suffix}.gexf") def main(source, output): source_path = Path(source).expanduser().absolute() output_path = Path(output).expanduser().absolute...
fa627573317b48da3d672a06444a7123be05dc7e945d9f47d465bfb12f9027e3
Python
2,806
89
""" orderfile_generator.py This script generates configuration files for the experiment. """ import random import pandas as pd import numpy as np def main(): num_trial_def = 100 # trials per session num_delay = 30 # perturbation trials num_conditions = 5 # number of conditions (including fammiliariza...
cf4b48afdf60c8079231f83ac7ca5055152a8cf23eff5b9aa2794559223a74a1
Python
2,807
92
import logging from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.language_models import BaseLLM from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts imp...
1b77a0ebd193b8dceabc6d9422b77f146a532ce9de3e9173ce2e55c145e163f4
Python
2,810
88
import numpy as np import pandas as pd import scanpy as sc from anndata import AnnData from prosstt.tree import Tree from prosstt import simulation from prosstt import count_model def df_from_rank_gene_groups(adata, drop_duplicates=True): '''Wraps results of sc.tl.rank_genes_groups in a df ''' assert '...
ff42bc4fbbeb6d1cd7c6447162b011780d08410c11ee365e311148822c0e89e4
Python
2,814
94
""" This script is used to reformat the count output from featureCount: i.e., combine count from different samples """ import pandas as pd import argparse def get_name_map(infile): """ Map bam files to their corresponding sample ids Arguments --------- infile: str the map from bam file to...
0fc7bc0aa5d8f7b3f367670cfd6a34f42a38cb4856ac28c02ba3299b43cf4e50
Python
2,819
101
#!/usr/bin/python import re,numpy as npy import sys,os #---------------------------------------------------------------------------------------------------------- # modify your stuff here if len(sys.argv)>3 : d=sys.argv[1] if not os.path.exists(d): sys.exit(" ERROR : the dx file provided does not exist . Breaking...
1319f6c208b4420677c48f08ac2bae1fb25734daeb3658cfbb4024e6ba52c080
Python
2,819
68
import argparse import textwrap #import argnet_lsaa as lsaa #import argnet_lsnt as lsnt #import argnet_ssaa as ssaa #import argnet_ssnt as ssnt import sys parser = argparse.ArgumentParser( prog='ARGNet', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent("""\ ARGNet: a deep nueral net...
e5307902d4068c9910eeb1d81b1133df8f489268fa8f53d49a9e180acf2e436e
Python
2,821
72
import trimesh import os import argparse # 导入 argparse 模块 import numpy as np # 导入 numpy 用于向量加法 # --- 参数解析 --- parser = argparse.ArgumentParser(description="将输入的 OBJ 网格文件按固定的向量平移并保存。") # 添加输入文件参数 parser.add_argument('--input_obj', required=True, type=str, help="需要平移的输入 OBJ 文件的完整路径。") # 添加输出文件参数 pa...
1bb2c96f5987c768f1a4c9fb5e361c977b35b0b01f10b4183e4ef9b6f29b1a52
Python
2,822
64
import os import gdown import torch GoogleDriveLink = 'https://drive.google.com/drive/folders/10ebqIWLrZ672A9bFg9wLe48F-nsz7za3' pretrained_model_parameters = { 'QH9Stable': { 'id': { 'name': 'QHNet-QH9-stable-id.pt', 'link': 'https://drive.google.com/file/d/115MOaWWr7JNP-SJ3IMaP3...
bd16a0272285fc53e59ce9bc25a3e810e336e82f52b96fcc1b3eca00cc4e5733
Python
2,823
61
import mne import os.path as op import numpy as np from config_FaceName import MEG_data_path,group_name,Ids,bids_root from mne.preprocessing import read_ica import pandas as pd from mne_bids import BIDSPath for subject_id in Ids: subject = group_name+"%02d" % subject_id print("processing subject: %s" % su...
70025260e5fcc02de58234f9cc3fcfa82b33d172e7f96c10d99c93b422611c1d
Python
2,824
95
"""Compatibility helpers for Pydantic v1/v2 with langsmith `Run` objects. !!! note The generic helpers (`pydantic_to_dict`, `pydantic_copy`) detect Pydanti version based on the langsmith `Run` model. They're intended for langsmith objects (`Run`, `Example`) which migrate together. For general Pydantic v1...
7fa2cf0cf5741f8d34a384aa87a84ce1505fbf4071150d96f70ac3492ab25646
Python
2,824
94
# Model based on convolutional layers, essentially reimplementing DeepSTARR in PyTorch from typing import Tuple, Any, Optional import os import pytorch_lightning as pl import torch from torch import nn from Bio import motifs import numpy as np class ConvolutionalClassificationModel(pl.LightningModule): def __init_...
482480bb70dc0b8221673a5c6df6c4fd2c461f717250f20c071ed63ee267eaef
Python
2,828
60
"""links the Facial Anthropometrics workspace's own batch measurement export to an existing cohort study, by mesh filename. mirrors api/results_bundle.py's own list_cohort_patients, which already joins a cohort's id-mapping file (file_name/file_path -> cohort_id - private identity fields, kept out of the shared cohort...
314d02dfe44f1760eb0c5f2ad2f931e08e08a0d114bfef01ef0db1e0146d6593
Python
2,830
87
import os import sys import time import numpy as np import torch import torch.nn as nn import torch.optim as optim from tqdm import tqdm import common.run_manager import glob import seq_des.util.canonicalize as canonicalize import pickle import seq_des.util.data as datasets from torch.utils import data import resourc...
8752a6a233c7bd11889f38ecb57cf603f250af4f94941a55d76f29f162c91647
Python
2,832
157
from neurogym.envs.collections import yang19 # DM1 to DM2 cur_1 = { 'name' : 'cur_1', 'config_files' : [ yang19.dm1(timing = {'fixation' : 300}), yang19.dm2(timing = {'fixation' : 300}), ], 'indicators': [ 0, 1, ] } # DM2 to DM1 cur_1R = { 'name' : 'cur_1R', ...
a93bffa43f7ec00f9b90dd9e24ea8704ae08722c70f11481157690374d29a6a0
Python
2,833
75
import tensorflow as tf import tensorflow_addons as tfa from dipgnn.utils.register import registers from dipgnn.utils.common_util import LinearWarmupExponentialDecay from abc import ABC, abstractmethod @registers.task.register("base_trainer") class BaseTrainer(ABC): """ Note: A significant portion o...
4a3eb0274246d84cb55b01754d0a17558c9e766e2a251eb91969edcdc374cbb8
Python
2,834
66
import pytest from skbase.lookup import all_objects from pgmpy.causal_discovery._base import BaseCausalDiscovery from pgmpy.causal_discovery.bivariate_scores import BaseBivariateScore from pgmpy.ci_tests import BaseCITest from pgmpy.metrics._base import BaseSupervisedMetric, BaseUnsupervisedMetric from pgmpy.registry ...
646a518e2bcaef8e0c94eeeea4ceed57c18af359495a65ef403d358570d2283b
Python
2,834
75
def inputs(input_data, neighbors, n_neurons, epochs, lr, t1, t2, depth, max_n_neurons, dim_red, neuron_init): """ Validate and process input parameters for the Clust3D pipeline. Returns: tuple: Processed (MDC_data, neighbors, n_neurons, epochs, lr_0, t1, t2, depth, max_n_neurons) """ ...
b7bec03701dfa443b65e59fd8436371adc4fb591bcfd6f38ae3c6fe3ab7a5412
Python
2,834
104
# 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...
777189fd83ce7c94f7a5299c2fb834dbe5f1c8681505076d3f7778928c28ff3a
Python
2,835
108
#!/usr/bin/env python import h5py import sys import pandas as pd import matplotlib.pyplot as plt from matplotlib.widgets import RadioButtons import sys W_JUST_HIT_ELEM = 1 def importOutput(filename: str): """ Import output h5 format and clean data """ # file will be closed when we exit from WITH sc...
dc0393617435f9b7ef9646ef76b2f422837d77b7d9107d2b97081e4529939021
Python
2,835
83
# Load in pre-trained model weights and evaluate its goodness (ECE, MCE, error) also saves logits. from __future__ import print_function import os.path import densenet import numpy as np import sklearn.metrics as metrics from keras.datasets import cifar10, cifar100 from keras.utils import np_utils from keras.prepro...
a7c93d622935390f2636415b61fee0c8fc21c2a3b0d944faebb99f57de08cf2d
Python
2,838
88
import warnings from collections import OrderedDict from typing import Dict import torch import torch.nn as nn from e3nn.util.jit import compile_mode import hienet._keys as KEY from hienet._const import AtomGraphDataType @compile_mode('script') class AtomGraphSequential(nn.Sequential): """ same as nn.Sequen...
dac334bbbd83a7e7d554d7f615fe821c4a8bdf7813e64e2162d41bc1562cf92b
Python
2,839
78
""" create torch's dataset for DrugComb """ import numpy as np import pandas as pd import pickle as pkl import torch import sklearn.feature_extraction as skfet import sklearn.preprocessing as skpre class DrugCombDataset: """ :param summary_data: drug combination data, headers=['tripl...
ec6ab1ea3e77f5b8ac83035f0c646c7219bcec996d476359472329a053ee2334
Python
2,839
68
# Prepare images and labels for validation # Copyright (c) 2021 Laurent Caplette import numpy as np import os, csv, h5py from PIL import Image np.random.seed() homedir = '' ### path of home directory nBlocks = 7 nTrialsInBlock = 50 nTrials = nBlocks * nTrialsInBlock f = h5py.File('vis_visgen_ultimatefinal.h5', 'r')...
aff22b9dca3da6aa66f97f6dad2f31ceee13ab85a4eb37f0a17d56108159fe8c
Python
2,840
115
"""=========================== Pipeline template =========================== .. Replace the documentation below with your own description of the pipeline's purpose Overview ======== This pipeline computes the word frequencies in the configuration files :file:``pipeline.yml` and :file:`conf.py`. Usage ===== See ...
b2dd500d5bd66885d225c8fe4983a8dea5f8e50758be24cf3e6c677989efc9d3
Python
2,840
86
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Description: : @Date : 2022/06/15 16:42:02 @Author : Zilan Yu @version : 1.0 ''' import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import SAGEConv, HeteroConv, Linear, TransformerConv, FiLMConv class Heter...
155271cdb6e22db1f27235cc2b8a25081f3f9fb63197a190c666e583df87aab3
Python
2,842
81
# Load in pre-trained model weights and evaluate its goodness (ECE, MCE, error) also saves logits. from __future__ import print_function import os.path import densenet import numpy as np import sklearn.metrics as metrics from keras.datasets import cifar10, cifar100 from keras.utils import np_utils from keras.prepro...
264b5c3a606369c58213b2608135498f61068b89193019965919e4a06c733fcf
Python
2,843
86
import argparse from dival import TaskTable from dival.measure import PSNR, SSIM from dliplib.utils import Params from dliplib.utils.data.datasets import CachedDataset from dliplib.utils.helper import select_hyper_best_parameters from dliplib.utils.helper import load_standard_dataset from dliplib.reconstructors impor...
5c6614f8e3024f77e85cbed95ee63564a422db42dd3e90048c08c37b5ceab709
Python
2,845
74
import sys import os import time import warnings from sklearn.exceptions import ConvergenceWarning import gc import psutil import numpy as np warnings.simplefilter(action='ignore', category=ConvergenceWarning) warnings.simplefilter(action='ignore', category=RuntimeWarning) warnings.simplefilter(action='error', cate...
4cb0b49bb56c3001217303f1c5715344e2ad91037114c3b1f600f96293261771
Python
2,846
82
import torch from torch.utils.data import Dataset, DataLoader from proto_net.utils.subs_to_list import subs_to_list from processing.constants import ALL_TRIAL_LIST import numpy as np ''' This function was taken from the github repo of prototypical network and was modified to fit the input data. If you are usin...
a8a3cdc4d66bea3ec8c298c5f383c00570891c835a3f3150192d8a14e050316e
Python
2,846
43
#TO BE UPDATED import numpy as np from NeuronModel import integrate_and_fire, poissonPop from NetworkModel import networkClass from WeightModel import weightClass, lebastard, spikeBased from InitFunctions import identity, dirac, dirac_sparse from Simulator.SimulatorClass import simulatorClass class simulatorLebastar...
e25448ab3b13d6e2c86565591932c8efb30498d33940de5ee67a3b8fbb59552f
Python
2,847
77
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import glob import os DESCRIPTION = 'Apply Eddy Warps to split data. Cornelius Eichner 2020' FSL_LOCAL = '/data/pt_02101_dMRI/software/fsl6/bin/' def buildArgsParser(): p = argparse.ArgumentParser(description=DESCRIPTION) p.add_argument('--spl...
fd76684dd0272151ceb43596b3c1311b86c116301a2e3efc7fb76b0af786acd6
Python
2,848
63
"""Indexed triangular mesh I/O and compatible STL loading.""" from pathlib import Path import os import numpy as np import trimesh def load_mesh(path, *, indexed=True): mesh = trimesh.load(str(path), process=False) if not isinstance(mesh, trimesh.Trimesh) or not len(mesh.faces): raise ValueError('Ex...
9f47c3e764860c263e4080f52eea5d3ca6be919ebebc02860c39dc2746190301
Python
2,849
80
# https://github.com/CuriousAI/mean-teacher/blob/546348ff863c998c26be4339021425df973b4a36/pytorch/mean_teacher/losses.py#L15 import torch from torch.nn import functional as F from torch.autograd import Variable from torch import nn def softmax_mse_loss(input_logits, target_logits): """Takes softmax on both sides ...
2c4c98268cbbb9dc32f6a894eb034f71d90d2c9c4a76b470d78bdd557ecf8203
Python
2,850
79
import argparse import chardet from rdkit import Chem import pickle import pubchempy as pcp import urllib.request, json def extract_ghs_from_pictograms(sec, hazard): for s in sec: if "Name" in s.keys(): if s["Name"] == "Pictogram(s)": for items in s["Value"]["StringWithMarkup"]:...
461c6587a9abb5957fdd117b1a4632e389575a70ff3c6832654e773b30d86531
Python
2,852
95
import threading import TriggerDevice import time class MultiChannelTriggerMonitor(): monitoring = threading.Event() def __init__(self, device, callback=None, *args): super().__init__() self.device = device self.callback = callback self.args = args def __del__(self): ...
26952d69a3347bf60f335aa2e173d04df71f9fa21faeb8757f7a07b3fac334cc
Python
2,853
82
""" Generate the barrel column positiosn from the annotation and flatmap. This file performs the following steps: 1. Generate the barrel columns based on barrels, with use of ConvexHull around the barrel and flattened positions to measure the distances. 2. Translate the positions into the symmetric hemisphere 3. Annot...
0d25ef3a45f63001b7d26203f9385b9c544e0b4a65c525323a2e917313941607
Python
2,854
117
"""=========================== Pipeline template =========================== .. Replace the documentation below with your own description of the pipeline's purpose Overview ======== This pipeline computes the word frequencies in the configuration files :file:``pipeline.yml` and :file:`conf.py`. Usage ===== See ...
144c3d9d5d815a4366f4f8f923991b5d2b7f971335107c0638c9652f6098d66f
Python
2,854
85
import sys import os from numpy import random from shutil import copyfile import logging logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.DEBUG) logger = logging.getLogger('train_test_split') def __create_files_list(src_dir): assert os.path.isdir(src_dir), f"{src_dir} is not exis...
5bbdfd1cdee35e86f6ee98c7e190baa44f23521e775db6cf3616b81ad693ee2a
Python
2,854
69
import os import numpy as np import random import csv from sklearn.model_selection import train_test_split from collections import Counter import pandas as pd def split_dataset(label_counts, val_split=.2): print(label_counts) train_indices, test_indices = [], [] for i in label_counts: shuffled_indi...
c49e39104a48dc98627c772c24485f1dd0b9162c1d621d2e976aedb5504b68d6
Python
2,854
89
import numpy as np import torch from torch import nn from torch.utils.data import TensorDataset import torch.nn.functional as F import sys; sys.path.append('/Users/danil/My') from dt_utils import Timer from data_utils import generate_recognition_data, data_to_tensor from neural_net_utils import Sigmoid, Cro...
5aa2531825807044bcd4c889757a5610fa82fa864db6eb2272f6345e925b2f9b
Python
2,856
87
import os import sys import time import numpy as np import torch import torch.nn as nn import torch.optim as optim from tqdm import tqdm import common.run_manager import glob import seq_des.util.canonicalize as canonicalize import pickle import seq_des.util.data as datasets from torch.utils import data import resourc...
73274d00473b44a476190a235c5fd177f1e7e03501a3298e47d2fead700076b9
Python
2,856
69
from langchain_core.agents import AgentAction, AgentFinish from langchain_classic.agents.output_parsers.xml import XMLAgentOutputParser def test_tool_usage() -> None: parser = XMLAgentOutputParser() # Test when final closing </tool_input> is included _input = """<tool>search</tool><tool_input>foo</tool_i...
c4a27684443b5a4e77137a34022c86826358313d2fa1420e4bc411da893105f1
Python
2,856
80
# third party modules import numpy as np # pnabind modules from pnabind.utils import clipOutliers from .laplacian_smoothing import laplacianSmoothing def wfn(dist, cutoff, offset=0, weight_method='inverse_distance', minw=0.5, maxw=1.0): if minw >= maxw: raise ValueError("minw must be < maxw!") # ...
063d15582cf81f5be28da5077dbe8f66bdeb89784109a62a5c645fc7d52be6cb
Python
2,858
83
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for d...
8c468d2eb021b1d2906530cb8ad53e2208eb004bc9858bf65163da34d0168c36
Python
2,858
86
from logging import Logger from pathlib import Path from typing import List from ..data import (get_channel_specific_slice_3D, Annotation, Worldline, AnnotationTable, WorldlineTable, get_nearby_max) from ._utilities import default_args @default_args("0.01, 0.08, 0.005, 0.04, False, _ACTIVE, *") d...
ebb96f33c46a37a6552ee4f7a0a5fd6c028513e388d50603c06d56804b8de25d
Python
2,858
77
#!/usr/bin/python3 import argparse import concurrent.futures import matplotlib.pyplot as plt import os import os.path import re import subprocess argp = argparse.ArgumentParser() argp.add_argument('--basisu', type=str, required=True) argp.add_argument('--graph', type=str, default="basisu.png") argp.add_argument('--et...
ac7f9984cec45d1e588bcd703c05b4cb4c34750d24bd4c3f1f197ccf56f4d2de
Python
2,859
77
from torchmetrics import Metric import torch class MinMax(Metric): def __init__(self): super().__init__() self.add_state("min", default=torch.tensor(torch.inf), dist_reduce_fx="min") self.add_state("max", default=torch.tensor(-torch.inf), dist_reduce_fx="max") def update(self,...
c644aa0db8eeed5152ff0e1a4bab14ec83cab09468bf3747f611cd380fbb0cd2
Python
2,859
83
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for detai...
e138b9d43afbc73d7d26ac6d6fc239082c25dcd92ddfe75d37eeb7f81c1002b5
Python
2,859
78
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch from torch import nn def batchmul2d(input, weights, emb): temp = input * emb.unsqueeze(1) out = torch.einsum("bixy,ioxy->boxy", temp, weights) return out class FreqLinear(nn.Module): def __init__(self, in_channel, ...
30d0bd4bfee241218a1c2aa98ffcf62ea24f658f7987fac8b7dbc2cde69950ff
Python
2,862
52
pdb_protein = { 'amino_acid_names': [ 'ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLU', 'GLN', 'GLY', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL'], 'NON_STANDARD_SUBSTITUTIONS': { '2AS':'ASP', '3AH':'HIS', '5HP':'GLU', 'ACL':'ARG', 'AGM':'ARG', 'AIB':'ALA', 'ALM...
f984b43acf3cd94f0d597edf9f955f0270f6114d7a4d70f103872324cc5370a1
Python
2,862
91
from __future__ import annotations import os from typing import Any from pgmpy.utils._warnings import _warn_external class BaseReader: """ Base class for all model file readers. Subclasses define the class attributes ``format_name`` and ``file_extensions``, load ``path`` or ``string`` in their cons...
2fa0c7d43cffb9cf34862f4ab35153ed46b858ae7e6e97dd7f01be4a2b312e18
Python
2,863
75
# -*- coding: utf-8 -*- """ Created on Fri Apr 24 16:46:26 2020 @author: gritti """ import os, glob, sys import PyQt5.QtWidgets from morgana.GUIs import inspection from morgana.DatasetTools.segmentation import io as ioSeg from morgana.DatasetTools import io as ioDT ###################################################...
95feb71ca34317c530de41d0427f06567220ba3e6d0ede47a46632023cf8bb25
Python
2,863
79
# This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it. import torch from e3nn.o3._irreps import Irreps from e3nn.util.jit import compile_mode from nequip.data import AtomicDataDict from nequip.nn import GraphModuleMixin, ScalarMLPFunction, with_edge_type...
11f083bc7fe55fa951a96b228e079b8a9134ae685125e7e0cd3678f32637fb21
Python
2,864
74
# This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it. import torch from nequip.data import AtomicDataDict from nequip.scripts._compile_utils import ( LMP_OUTPUTS, single_frame_batch_map_settings, register_compile_targets, ) PAIR_ALLEGRO_INPUT...
acba465be3601fa33ebc01663f7442b9c06ecd0ab31a7f855c657f0231e629b1
Python
2,866
73
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for d...
16aa1c2467c7b8854d33fd423529c5e1b1e686501aa87a9041680a4ab09c5a0e
Python
2,867
73
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for detai...
2d3a8c50eacd6be9a409912ae8dc5336714fb7da7b8137995f7ab673e6b940ec
Python
2,867
63
import pandas as pd ## MGI_GenePheno.rpt mgi_gene_pheno_df = pd.read_csv('MGI_GenePheno.rpt', sep='\t', header=None) mgi_gene_pheno_df.columns = ['Allelic Composition', 'Allele Symbol(s)', 'Allele ID(s)', 'Genetic Background', 'Mammalian Phenotype ID', 'PubMed ID (pipe-delimited)', 'MGI M...