sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c101454136be8b68aefdbf2d235fb67f8c5d22815ed09ed8f014990fc9b79e07
Python
7,865
227
from ChipseqReport import * ########################################################################## ########################################################################## ########################################################################## ## ###############################################################...
1ccdbef9a73105e9fea567b82fa7266f7f8fca9138eac4b5ef6424b37f35c250
Python
7,871
247
import logging import os import socket import sys import matplotlib.pyplot as plt import pandas as pd import ptitprince as pt import seaborn as sns from configs.configs import get_config_dict from helpers.figures import get_palette def _plot_bar_graph_scores(config_dict: dict) -> None: plt.figure(figsize=config...
f4b9596912d7a0f6a726578a03cc51b6fa0515172010614beb29d95597103778
Python
7,872
233
import copy import filecmp import os import random import tempfile import time from pathlib import Path from unittest import TestCase import numpy as np import pandas import pytest import requests import chroma from chroma.data.system import System BASE_PATH = str(Path(chroma.__file__).parent.parent) CIF_TRAJECTORY ...
af0f75d9816d863af4f80989ff0f37bc57cd0e798add59ecdff8ad6281a81b6c
Python
7,873
198
import argparse from typing import List import math import numpy as np import pylsl import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui class Inlet: """Base class to represent a plottable inlet""" def __init__(self, info: pylsl.StreamInfo, plot_duration: int): # create an inlet and connect ...
9de440f183a4846713513beb319bd3af09d7da3eb46c6c064488eb740d62cd23
Python
7,882
194
from pathlib import Path from collections import Counter, OrderedDict, defaultdict import logging from hashlib import md5 from clldutils.misc import slug from clldutils.path import git_describe, read_text, write_text from pycldf import StructureDataset from csvw.dsv import reader from csvw import ForeignKey from pyglo...
c98098fe2bd6bccf3e1213481d78935f72e6c4b65ce00d0013dcbef1225b511d
Python
7,885
175
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function import os import pandas as pd import numpy as np from tqdm import tqdm from rdkit import Chem from...
570a7541885ef50bc3026d7c4b45a41064c79aa0797d58f7480a58e39bcbce55
Python
7,893
249
""" @author: Nick Anthony """ from __future__ import annotations import abc import json import typing from dataclasses import dataclass import numpy as np class _HookReg: """Stores deserialization hooks and combines them into `getHook`""" def __init__(self): self._hooks = [] def addHook(self, f...
6c0ae3cd6cc470d2a53ac740774c00adc3ba62a628e41753950126b6218fdfeb
Python
7,893
231
""" This script summarized DE results. """ import numpy as np import pandas as pd import session_info from pyhere import here from functools import lru_cache from scipy.stats import mannwhitneyu @lru_cache() def get_annotation(feature, tissue): """ Get the annotation file based on feature and tissue. """ ...
eca181de184a897840f270fc66893bd47ec90ab31b8e74be207cd96f10e19800
Python
7,895
155
#!/usr/bin/env python3 import sys import random import numpy as np import pandas as pd import seaborn as sns from scipy import stats import matplotlib.pyplot as plt plt.switch_backend('agg') from itertools import islice, cycle from plottify import autosize sns.set_context("paper", font_scale=1.4) sns.set_style("white...
f5bbe4d30d69f76c6bda3540f33a0b00ad27230b93ba903bca9feaede7dbbe65
Python
7,896
185
import glob import os import SimpleITK as sitk import numpy as np import argparse from medpy.metric import binary import GeodisTK from scipy import ndimage def dice(pred, label): if (pred.sum() + label.sum()) == 0: return 1 else: return 2. * np.logical_and(pred, label).sum() / (pred.sum() + la...
f9befa3b522d88daaf2228e43c4f253b38460c62a7e2e803ad66adb99c1ec075
Python
7,896
211
"""Tiny MCP servers the examples share, so each example stays about one idea. Nothing here is specific to LangChain — these are plain FastMCP servers. The `run_*` functions exist because a server reached over stdio or HTTP has to be started as its own process, and that entry point cannot be a lambda. """ from __futur...
5942e803bce01709e5f18c2263942168cf63f9c0aa6343691dafcdb4d85fcd67
Python
7,904
221
""" Authors: { Orestis D. Papagiannopoulos : orepap_a@hotmail.com Vasileios Pezoulas : bpezoulas@gmail.com Costas Papaloukas : papalouk@uoi.gr Dimitrios I. Fotiadis : fotiadis@uoi.gr } Institution ...
e33cef9d5ec43cbc757253c23fdba90f34cba2b0a24c90b10e1563127933dd92
Python
7,905
237
import pandas as pd import numpy as np import random import operator import itertools import sys from pathlib import Path import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import warnings warnings.filterwarnings("ignore", message="numpy.dtype size changed") warnings.filterwarnings("ignore", message="numpy.u...
13d527d6cbb04bfdc6037d555d9374451d7e1137265aa49f7e4a0a4b9f1174ef
Python
7,914
202
#!/usr/bin/env python3 import os import torch import hydra import logging import shutil from models import get_model from torchvision.transforms import Compose from torch_geometric.loader import DataLoader from ori_dataset import MD17_DFT, random_split, get_mask from torch_ema import ExponentialMovingAverage from tra...
f9a39ac7ee38d71c9c6f5e5b7be781abcca993bae10db1d72f9e26e678076349
Python
7,915
183
""" Make a summary table to check data sanity and quality for an individual subject. """ import argparse import data_analysis_utils as dana import json import matplotlib.pyplot as plt import numpy as np import os.path as op import plot_utils as plut SUMMARY_TABLE_WIDTH = 3.5 SUMMARY_TABLE_ROW_HEIGHT = 0.3 SUMMARY_TAB...
35f85e35e3c75232b60c8208cb9a1896f3a348b8e7a32d600d1473bce117f49f
Python
7,918
227
import torch import torch.nn as nn from h3xsemble.model.structure_module import AngleResnet, AngleResnet_backbone from h3xsemble.utils.residue_constants import ( restype_rigid_group_default_frame, restype_atom14_to_rigid_group, restype_atom14_mask, restype_atom14_rigid_group_positions, ) import h3xsembl...
6232a04804a950df718e532a4639446a6b137061510bde74f216190d92a4b932
Python
7,921
180
import os import numpy as np import brokenaxes import torch torch.set_printoptions(precision=4, sci_mode=False, threshold=5000) import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec plt.rc('savefig', format='pdf', bbox='tight') plt.rc('font', size=8) #plt.rc('legend', fontsize=8) from...
bf6b1dad16980434c9b5b923a421773dca8e2aa6d6b51b57e2d679975d29578c
Python
7,922
249
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -*- coding: utf-8 -*- # # Rallpack1 model # Author Iain Hepburn # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # import numpy as np import numpy.linalg as la import sys import os from mpi4py import MPI import...
aae874e68ea490fc7ed29b2e07e156f49b98dec83e384430f2e8ed7785483dbc
Python
7,924
199
# 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...
cbeead86c3e6aaaaf5b23fdb0c223c8c091dd5986052353c9bfd75cf2c27ccad
Python
7,927
189
"evaluate multi class tagger" import pyrootutils root = pyrootutils.setup_root(search_from=__file__, pythonpath=True) import copy import numpy as np import matplotlib.pyplot as plt from sklearn import metrics import torch as T from tqdm import tqdm import src.pipeline as pl import src.eval_utils as eval_utils import...
9a65f492d68d14db1dd1bae01d98224fab157038672f3da3a7fb7747711dd0d0
Python
7,929
193
import re import cv2 import numpy as np from scipy.spatial.distance import cdist, pdist, squareform import math def intersection(start1, end1, start2, end2): x1, y1, x2, y2, x3, y3, x4, y4 = *start1, *end1, *start2, *end2 d = np.linalg.det(np.array([[x1 - x2, x4 - x3], [y1 - y2, y4 - y3]])) p = np.linalg...
a5a570f903adf0901aa2d724a33b7ab320082166c200160977be8261095ee378
Python
7,929
255
from pprint import pprint import numpy as np import cv2 import albumentations as A from albumentations.pytorch import ToTensorV2 from albumentations import ImageOnlyTransform import torch from torch.utils.data import Dataset import com_image as ci import com_plot as cp class FixPatchBrightness(ImageOnlyTransform...
895fcfc518acc721d6340287fc2c66c0ee09ee0e7e779db3a054a80fad6638d1
Python
7,930
221
import torch import torch.nn as nn import torch.nn.functional as F from networks.attention import * from networks.efficient_encoder import get_encoder def initialize_decoder(module): for m in module.modules(): if isinstance(m, nn.Conv2d): nn.init.kaiming_uniform_(m.weight, mode="fan_in", non...
3d885aed8996b41bcf553f906e1f5d2036948bc3dfcd2db41b06d1f758619e44
Python
7,934
166
import random from feature_test import Compound from label import FaceLabel from itertools import combinations from OCC.Core.BRepAlgoAPI import BRepAlgoAPI_Cut, BRepAlgoAPI_Fuse from OCC.Display.SimpleGui import init_display from OCC.Core.TopLoc import TopLoc_Location from OCC.Core.STEPControl import STEPControl_Writer...
678db11b042b92f4076a8feb73f854e918354f9dead6394997b04771e4512a2e
Python
7,934
212
"""Data loaders for the de novo sequencing task.""" import functools import os from typing import List, Optional, Tuple import lightning.pytorch as pl import numpy as np import torch from depthcharge.data import AnnotatedSpectrumIndex from ..data.datasets import AnnotatedSpectrumDataset, SpectrumDataset class DeNov...
5e46e05c466c129a17796b74addee9558a8f8c4021a7538b8e37551d2a0aa841
Python
7,936
249
from typing import Tuple, List, Optional, Dict, Union, Iterable from rdkit import Chem from rdkit.Chem import Descriptors, Mol, MolFromSmiles import numpy as np from rdkit import RDLogger def molar_wt_fromSmiles(smiles: str) -> float: return Descriptors.MolWt(polymol_fom_smiles(smiles)) def calc_polymer_shares(...
949da1ce11342137f76738d4633d57bebfd9b226003da94f74c670926c0ad26c
Python
7,940
147
from typing import TYPE_CHECKING, Any import numpy as np import pandas as pd from pandas.api.types import is_string_dtype from skbase.utils.dependencies import _safe_import from sklearn.base import clone from pgmpy.parameterization._base import BaseParameter, _is_numeric, _plain from pgmpy.parameterization.adapters.s...
30ba6c7c5ba8ad9abeabb9740e472da04a67e01bd9ed18e7b2f3fd40db1199f6
Python
7,944
227
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys if '../../../embeddings' not in sys.path: sys.path.append('../../../embeddings') from seq2tensor import s2t import keras from keras.models import Sequential, Model from keras.layers import Den...
712432f84c98507d92a78dc3772e95f4b4a8ddc3f36dfe077afc52d25fd145d5
Python
7,948
153
#################################################################################### # # 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...
cfb4d71ad60e96f6bf3f44f21926c53ce6716d6a9ea8867b192603decaf8e64c
Python
7,964
246
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -*- coding: utf-8 -*- # # Rallpack1 model # Author Iain Hepburn # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # import steps.quiet from steps.geom import UNKNOWN_TET import steps.model as smodel import steps...
d48a09fd25d56df6ef84f5049641d5dee8f9cf7a226e2b01eb8ff322f2a67609
Python
7,968
174
## main module for parsing, processing and interacting with cellsdata/files of 1p-stim protocols (i.e. matlab .dat files that are used in PackIO) ## - 1pstim module - just copied straight from allopticalseizure version so far.. import os from datetime import time import numpy as np from matplotlib import pyplot as plt...
3ee34e4c8243d129c20dbfd385d87b5ed101d3486981e41bbce622c055144cfa
Python
7,975
267
# 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...
3a777713431cfe50c69a352819a08121d72758cbd33d997517941e433a7cf2e1
Python
7,977
222
""" Tests for the SMdRQA UI support modules. The ScriptRecorder and window_size_sensitivity tests run without any UI dependency; the app import smoke test is skipped unless streamlit and plotly are installed. """ import numpy as np import pytest from SMdRQA.RQA2 import RQA2 from SMdRQA.ui import ScriptRecorder, wind...
829a973fbc71d9cb7499d3378deb21a11dda4b9238cfb52776c1f94eb104f335
Python
7,977
163
import sys import warnings from time import time import torch from monai.data import set_track_meta from sklearn.metrics import confusion_matrix, roc_auc_score warnings.filterwarnings("ignore") from train_functions.metric_functions import calc_metrics def train_loop(outcome_label_name, max_epochs, train_loader, mod...
9602617ccf5219222bd75778525a0eea2acf0a2b11a35784ae4326645adcc4e1
Python
7,977
228
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Processing phase-difference (aka :abbr:`GRE (gradient-recalled echo)`) fieldmaps. .. _gre-fieldmaps: Workflows for processing :abbr:`GRE (gradient recalled echo)` fieldmaps ~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
a184cad760a49a8b87e6f49e95a1016aa3de9bdff53dcf17c643b9f974cb6ea7
Python
7,982
147
import os from tqdm import tqdm import torch import torch.nn as nn import numpy as np import random import time import argparse import math device = torch.device("cuda" if torch.cuda.is_available() else "cpu") def main(): torch.autograd.set_detect_anomaly(True) # parse arguments parser = argparse.Argume...
d3b16d6bbaf7cf8b79ae044784cecb862a79526142564b12edd309992114227a
Python
7,982
279
from tensorflow.keras import Model from tensorflow.keras.layers import (BatchNormalization, Conv3D, Dense, GlobalAveragePooling3D, GlobalMaxPooling3D, MaxPooling3D, Input) from explainability import LRP, LRPStrategy from explainability.layers im...
13468eeef84838aa428c3cc4c67078cba4762ca8cbfe33941cffc168650bf2e7
Python
7,983
198
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test force factories in forcefactories.py. """ # ==============================================================...
805feaa19d8e110afeb2ffadbd8b234c062ae099eddf7d6b9f488c154d84a48c
Python
7,984
233
from mimic3models import metrics from mimic3models import common_utils import threading import os import numpy as np import random def preprocess_chunk(data, ts, discretizer, normalizer=None): data = [discretizer.transform(X, end=t)[0] for (X, t) in zip(data, ts)] if normalizer is not None: data = [no...
595ab14f3b43bd6ca4a27b3d98f38cf3178e78eb9959bf720c2f23140846f3b1
Python
7,986
252
import warnings import tempfile import torch import numpy as np from rdkit import Chem from rdkit.Chem.rdForceFieldHelpers import UFFOptimizeMolecule, UFFHasAllMoleculeParams import openbabel import utils from constants import bonds1, bonds2, bonds3, margin1, margin2, margin3, \ bond_dict def get_bond_order(ato...
7905fddf573e85645e7731767a7ca93e92ff4f4d824ce03ec0ec49c338cd887b
Python
7,988
231
""" Create heatmaps for OMTscoring model across the WSI. Usage: create_heatmaps.py [options] [--help] [<args>...] create_heatmaps.py --version create_heatmaps.py (-h | --help) Options: -h --help Show this string. --version Show version. --input_dir=<string> Pa...
4fc710f6f96788fb59cb19fab8d64873d3d16e9e182f12a544d451c74c548cc7
Python
7,989
175
import torch.nn as nn import torch from einops import rearrange, repeat class Physics_Attention_Irregular_Mesh(nn.Module): ## for irregular meshes in 1D, 2D or 3D space def __init__(self, dim, heads=8, dim_head=64, dropout=0., slice_num=64): super().__init__() inner_dim = dim_head * heads ...
c58f4525acc95b8f39ad52bd5c5d2679e37ef60e5c667bad3bc8189c79b19114
Python
7,989
168
import torch.nn.functional as F import torch import pandas as pd import numpy as np import argparse # from utils.data_processing import load_data from node_embed.featurization import load_data_adv from torch_geometric.loader import DataLoader from sklearn.metrics import roc_auc_score, accuracy_score, f1_score...
5cbf227b9014918053e9ece365da1d71239eaceb41cc3aaee6defea1e397c3f5
Python
7,995
195
""" Read the phenotype-specific summary statistics (generally PLINK). Standard LDSC-like format (.sumstat) works. Required columns: - SNP ID: one of [ID, id, snp, SNP] - Sample size: one of [N, n] - Z-score: one of [Z, z] Reference: https://github.com/sriramlab/SUMRHE/blob/main/src/sumstats.py """ import...
243a47f220fffde209b10d49b01ea7b3cfc50e803bf9bf859e17b261ecc8d4d4
Python
7,998
212
from animalai.envs.raycastparser import RayCastParser import uuid from typing import NamedTuple, Dict, Optional, List from mlagents_envs.environment import UnityEnvironment from mlagents_envs.rpc_communicator import UnityTimeOutException from mlagents_envs.side_channel.raw_bytes_channel import RawBytesChannel from mlag...
ac09dc9fdd8bc7a0059bbcaac98fedb67be946fc6d9ed5239fca7018ff5836a8
Python
7,998
194
#!/usr/bin/env python3 #$ -cwd #$ -V #$ -N SFlex #$ -e /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/sf_flexibility/SFlex.err #$ -o /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/sf_flexibility/SFlex.out #$ -pe smp 12 #$ -jc short import os import sys import itertools import numpy as np impo...
b9691b364d250d81778ac16960b43db85ef6db1c68b980d59c5c85b86ee3134a
Python
8,000
211
"""Will test visualization functions.""" import pytest import numpy as np import pandas as pd import torch from torch.utils.data import TensorDataset, DataLoader from vulcanai.datasets import tabular_data_utils import os from copy import deepcopy from sklearn.datasets import load_digits from sklearn.metrics import con...
c2a40f0bec57f22af5d007170fa0eb068d60f1faa8f7f4a0bd62380dbcf139df
Python
8,000
297
import numpy as np import pytest from skbase.utils.dependencies import _check_soft_dependencies from pgmpy import config from pgmpy.factors.discrete import DiscreteFactor, TabularCPD from pgmpy.models import DiscreteBayesianNetwork, DiscreteMarkovNetwork from pgmpy.readwrite import UAIReader, UAIWriter @pytest.fixtu...
5209b29b48a9a128e7e65e61ee46ccaf328de6d06600a931f671d742384b8972
Python
8,001
163
import bisect import torch from .misc import _scaled_dot_product, _select_initial_step, _handle_unused_kwargs from .solvers import AdaptiveStepsizeODESolver from .rk_common import _RungeKuttaState, _ButcherTableau, _runge_kutta_step # Parameters from Tsitouras (2011). _TSITOURAS_TABLEAU = _ButcherTableau( alpha=[0...
50d6a47b8681699c27fb2b571ad9318201fb68daafeb05cd38591db332b5d15b
Python
8,006
192
import torch import torch.nn as nn from egnn.egnn_new_SE3 import EGNN, GNN # from egnn.egnn_new import EGNN, GNN from equivariant_diffusion.utils import remove_mean, remove_mean_with_mask import numpy as np import math class SinusoidalPosIdxEmb(torch.nn.Module): def __init__(self, dim): super().__init__() ...
df7701740a2a1b2949984cac375437af98694b56d15d3bc6be62abe8cd4e4dab
Python
8,006
251
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -*- coding: utf-8 -*- # # Rallpack1 model # Author Iain Hepburn # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # import numpy as np import numpy.linalg as la import sys import os from mpi4py import MPI import...
4a28d3b4950533abbb7c7ea2991b958727bf3541bee7cfddeed85a29b242f226
Python
8,009
211
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch import torch.nn.functional as F from torch_geometric.utils import scatter def lp_norm_weighted(input: torch.Tensor, weights: torch.Tensor, batch_idx: torch.Tensor, p: int): if p == 2: return scatter(src=input.sq...
b281001089a5c27f85bc4855c8dae04eb3bfc440a7036ccb6b6d90c5d4705ae2
Python
8,009
173
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 24 17:43:27 2020 @author: shni2598 """ from brian2.only import * import connection as cn #%% class two_areas: def __init__(self): self.neuron_model_e = cn.model_neu_syn_AD.neuron_e_AD self.neuron_model_e_adapt_tv ...
0b513988cdc406e9d7d7e6e863ae61fedf2e275bcc4e9b366d340dd502b5db3c
Python
8,019
171
# pylint: disable=E1101, E0401, E1102, W0621, W0221 import argparse import numpy as np import torch import torch.optim as optim from random import SystemRandom import models import utils parser = argparse.ArgumentParser() parser.add_argument('--niters', type=int, default=2000) parser.add_argument('--lr', type=float, ...
a60981b02f6a7d7b51cef9da9a661d09de3ccd31b3319a8d91dd61e2263c0123
Python
8,024
199
"""Training configuration dataclass for BERNN models.""" from dataclasses import dataclass from typing import Optional, Any @dataclass class TrainingConfig: """Configuration contract for BERNN holdout trainers. Core concepts - Layer depth is controlled by ``n_layers``. - ``layer1`` is the optional e...
8c9cda3ceecc751b3830f8d89648acf6fcbf33a21c92b7fbd62f749fea834c27
Python
8,031
224
import pytest from pgmpy.base import MAG # graph has been taken from the zhang 2008 paper (figure 1) @pytest.fixture def mag(): edges = [ ("A", "B", "<>"), ("C", "D", "<>"), ("A", "C", "<>"), ("B", "D", "<>"), ("A", "D", "->"), ("B", "C", "->"), ] roles = {...
deeda0c947cd11bcba3e9742aa6ab367f783ce0d8dbf91a76759a72346465fff
Python
8,036
259
#################################################################################### # # 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...
671b6ca7a99e5e9ff2262f7ebcccd2e5b31d6bdf9de0aff23e50d60c9331cba8
Python
8,037
238
import logging import time import json import argparse import contextlib import numpy as np from copy import deepcopy from pathlib import Path from tqdm.auto import tqdm import omegaconf import torch from lightning.pytorch import seed_everything from torch.utils.data import Subset from scdp.common.pyg import DataLoad...
8ac4e4c6cd7c002c0526b84d0da41e6a4703b98a7f43f86743ed5df77053fbfe
Python
8,044
83
from langchain_core.prompts.chat import ( ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, ) from langchain_core.prompts.prompt import PromptTemplate from langchain_classic.chains.prompt_selector import ( ConditionalPromptSelector, is_chat_model, ) question_prompt_templ...
6eae4cfc94985529f431c4f87852a849241a4c23f5f41d21f957d401c85bb3fe
Python
8,045
298
""" Tests of the 'Configuration' step """ import random from pathlib import Path import pytest from cwas.configuration import Configuration from cwas.env import Env import cwas.cli import sys @pytest.fixture(scope="module") def vep_mock(cwas_workspace: Path): return cwas_workspace / "vep" @pytest.fixture(scope...
f9f60792eb4c3521b9d5507b9ced3f0ea8e45f7210b33b82a890507071fa53ce
Python
8,046
223
import numpy as np def polyphase_decimate_causal(in_sig, dec_filter_h, dec_rate, init_cond=None): """ A causal polyphase FIR decimator with continuous block boundaries. Parameters ---------- in_sig : array-like Input signal (1D list or numpy array). dec_filter_h : array-like FI...
284cc80d4625f5c744e21914eda855cec2517119dd71448b9e4e2e8431097bcf
Python
8,048
216
# This extension template provides instructions to add new metrics to pgmpy. # # Please follow the following steps: # 1. Copy this file to `pgmpy/metrics` and rename the file as `your_metric_name.py` (e.g., `my_metric.py`). # Note: Do NOT start the filename with an underscore `_`, otherwise it won't be discovered. #...
cf7773b7391772c2ad685aa5b7c80c089b64f13b0c29ea6f01c99dcfeee88fae
Python
8,052
241
# -*- coding: utf-8 -*- """ Created on Mon Aug 24 15:16:53 2020 @author: nishe """ import numpy as np from scipy import signal from scipy import stats #%% def find_MI_cfc(sigPhase, sigAmp, optionMethod=1, optionSur=2): numSur = 200 ; numPhase = np.shape(sigPhase)[0] ; numAmp = np.shape(sigAmp)[0]...
cf83353e2ca0ea5eaec6fb664f69e218532b31dc6009d7e31a6a68b4c24ed21b
Python
8,056
161
import os import sys import re import types import itertools import matplotlib.pyplot as plt import numpy import scipy.stats import numpy.ma import Stats import Histogram from cgatReport.Tracker import * from cpgReport import * ########################################################################## class tssInte...
5c35481c4d05856c707e0c4aadf0e66277cf8fd4b392d8a0f5a0744a77f56fe6
Python
8,060
227
import numpy as np import torch import logging import os import urllib from os.path import join as join import urllib.request from qm9.data.prepare.process import process_xyz_files, process_xyz_gdb9 from qm9.data.prepare.utils import download_data, is_int, cleanup_file def download_dataset_qm9(datadir, dataname, s...
4e95cf3e4a28447774deae7dd2a13b98b27f9e57859df8c9c4045097f48605dd
Python
8,063
197
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
441fc5d7da3a78e76c8d4744a6b4fae66aea7bebee9a800289140a6deccdf0e0
Python
8,065
215
import torch from torch_geometric.loader import DataLoader import os import pickle from sklearn.model_selection import KFold import numpy as np import random from torch_geometric.nn import global_mean_pool, GATConv import torch.nn.functional as F import torch.nn as nn from torch import optim import datetime print("......
651fe5273580810328966ed4beb0d95aec33893c96ebc87d8e471b91d86182b1
Python
8,069
240
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is 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...
cd725696fb433c84a4ae9a49bafbd1861c4fea5cf1aca8d4996f4e0632b0bb0f
Python
8,072
215
"""Score network module.""" import torch import math from torch import nn from torch.nn import functional as F from data import utils as du from data import all_atom from model import ipa_pytorch import functools as fn Tensor = torch.Tensor def get_index_embedding(indices, embed_size, max_len=2056): """Creates s...
63ad76475513f346cc442d18a0d05693d67034754fd5dc24c15dc108cfd0c51f
Python
8,073
191
# 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...
065569527fd89dfefd04cf8ad9e5cbee26eb6f3d9938edcdbfb8effacecb03bc
Python
8,076
261
#################################################################################### # # 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...
7810cb03d36b7bc716a26720fb41a1585a74bd7e5de1c3f15ea5281255fbdc32
Python
8,078
212
import copy from os.path import splitext #from pdbx.reader import PdbxReader from pdbx.writer import PdbxWriter from pdbx.reader import * from sys import argv def parseOperationExpression(expression) : operations = [] stops = [ "," , "-" , ")" ] currentOp = "" i = 1 # Iterate ov...
cec54920ff7baaa22bc2e9e78a1db2c11054b8ec8022a56de9eca5893a4ff30c
Python
8,081
187
import argparse import time import json import random from collections import Counter from dataset import Mol3DDataset, SimpleTokenizer import argparse from utils import set_seed import numpy as np import wandb import os import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.nn import fun...
f44b7329a65cc7aae014d99d2a23a64f2de60e5d4750af266cef80189f5b9481
Python
8,081
210
import re from typing import Optional, Tuple import torch from torch import nn, Tensor from torch_scatter import scatter from torch_geometric.data import Data from . import output_modules import warnings import numpy as np import random from .visnet_block import ViSNetBlock def create_model(args): model_args = dic...
1293aca21b5175baae5b9008197a1c2f81ab50a7130e40d410cc34f4753426fe
Python
8,082
191
import logging import os import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder from helpers.data import normalize_array def load_human_connectome_project_data( data_file: str, scan_id: int, scan_length: int = 1200, verbose: bool = True ) -> (np.array, np.array): """ L...
7cd2ff5cd666daf79983f7d9665365fada7f1057bcc3cfd1b0ee5bda1e15167d
Python
8,082
205
# this script inference based on trained models # Mask-RCNN on detectron2: # the folder structure should be: # data/test (images) # pretrained: the pretrained model model_best.pth # Running: # module load Detectron2/0.3-fosscuda-2019b-Python-3.7.4-PyTorch-1.6.0 # import argparse import os import random import shu...
c2a20152ec5ee273dda9f35f836e4fdf7ed23742ff0c8a7ac88d4bfba2dcd40e
Python
8,085
221
from collections import OrderedDict import torch.nn as nn import torch.optim as optim from tqdm.notebook import tqdm from .build_pdists import get_all_pdists from ..models.losses import * from ..utils.utils import * def get_optimization_trajectory( frame_to_optimize, parent, reference, container, ...
46267f01ba377073f76630f921d81bd89097947cfb7f14060ff3f253bab95a2a
Python
8,086
272
# Import packages needs formatting import numpy as np import matplotlib.pyplot as plt import pandas as pd from os import listdir from os.path import isfile, join from collections import defaultdict import csv from SMdRQA.RP_maker import RP_computer from SMdRQA.Extract_from_RP import windowed_RP from SMdRQA.Extract_from...
0a9915e61fe2dc1f2b9942b8b5b8114f26b0da1f3fc5fda177f2b2e01e324043
Python
8,088
217
#!/usr/bin/env python #### Get command-line arguments import argparse arg_parser = argparse.ArgumentParser() arg_parser.add_argument("data_file", help="a list of data to perform inference on") arg_parser.add_argument("data_dir", help="directory containing the data files") arg_parser.add...
0f3d5b1ad44ff6715df685b5aeba9eed11f505ab57e17c564941248847be9ebe
Python
8,089
176
# 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...
b3d80379d4a604ce582dfa98358969a532906f16053309b3fd7c97ee149734b5
Python
8,089
225
""" Original Author: Haoqiang Fan """ import numpy as np import ctypes as ct import cv2 import sys import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) showsz = 800 mousex, mousey = 0.5, 0.5 zoom = 1.0 changed = True def onmouse(*args): global mousex, mousey, changed y = args[1] x = args[2] ...
b81466bf9b2435d5588e48ba824d5c1e84d673bc5f71e1aea074589f336f4a8b
Python
8,095
274
# 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...
e5c8f7a44179daf36a1b0b85524a5326544d1d7c5215b974d350d595cd39315c
Python
8,097
208
"""Chain for interacting with Elasticsearch Database.""" from __future__ import annotations from typing import TYPE_CHECKING, Any from langchain_core.callbacks import CallbackManagerForChainRun from langchain_core.language_models import BaseLanguageModel from langchain_core.output_parsers import BaseOutputParser, St...
e27f2c3b58705c06f82b84957b06c83cbcf89db2d2104c7160607254a88ba8f8
Python
8,100
247
""" Custom collections classes. """ __all__ = [ "ValidatedDict", "ValidatedList", ] from collections import abc class ValidatedList(list): """A list that runs custom converter and validators when new elements are added. Multiple converters and validators can be assigned to the list. These are...
4f4cd407f0466cd826be873f0b365163a901ea8a7bf8316bdaf58ef5303288c9
Python
8,109
258
########################################################################################### # Utilities # Authors: Ilyes Batatia, Gregor Simm and David Kovacs # This program is distributed under the MIT License (see MIT.md) ########################################################################################### imp...
c3d5c373f2523a342cbbd23756023c72be5d2258e903d5154364512de4963b72
Python
8,109
222
"""Fake Chat Model wrapper for testing purposes.""" import re from collections.abc import AsyncIterator, Iterator from typing import Any, cast from langchain_core.callbacks.manager import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import BaseCh...
7f9711f2fdc8913175cf315bbf3c0228e5c449a9cb789a7cf44a45229a80e4e3
Python
8,111
167
from scipy.integrate import solve_ivp import numpy as np import os import h5py from edNEGmodel.edNEGmodel_params import * from functions.initial_values import * from SALib.sample.saltelli import sample as ss from SALib.analyze.sobol import analyze as sa ''' Table 3: Factor Fixing analysis ''' # Define the problem se...
d369189f052aa740fa8d16b2b15496e6ad21eb2fb69ffe0428c91587717701bd
Python
8,113
173
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Description: : @Date : 2022/06/15 00:35:33 @Author : Zilan Yu @version : 1.0 ''' import pandas as pd import os clustered_root = "../clustered_datasets" root_filter_datasets = "../filter_datasets" filter_iedb_filepath = os.path.join(root_filter_da...
ab05f499265925ba910fbce630cbf077774312dd23e998aebaf05af166388e28
Python
8,116
257
''' medip_merge_intervals.py - merge differentially methylated regions ================================================================== :Tags: Python Purpose ------- This script takes the output of DESeq or EdgeR and merges adjacent intervals that show a similar expression change. Input is data like this:: co...
57eddc34d8d67aeb006da6f2c3f92da7f0f625cb1b72b672a4efc668c3df60ea
Python
8,122
164
#!/usr/bin/env python3 #$ -cwd #$ -V #$ -N m5_his_2c #$ -e /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/m5_his_ce.err #$ -o /cluster/uz_lab/cmives/TRP_channels/MDS/permeation_analysis/z_histogram/m5_his_ce.out #$ -pe smp 2 #$ -jc long import os import sys import time import numpy as np impor...
7268f6fd6e143f7f9334488b0a6b02e63f45654116e1d6fc5bd3ada1014d34b5
Python
8,122
211
import re from typing import Optional, Tuple import torch from torch import nn, Tensor from torch_scatter import scatter from torch_geometric.data import Data from . import output_modules import warnings import numpy as np import random from .visnet_block import ViSNetBlock def create_model(args): model_args = dic...
9c36335b5d9eff9700f2deb1d166a5e135f0e1f70967ebab91f469dc4a50efb1
Python
8,131
178
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 24 09:04:04 2022 @author: baran """ import pandas as pd import numpy as np from matplotlib import pyplot as plt from scipy import stats impedances = pd.read_csv('rat1_impedances.csv') phases = pd.read_csv('rat1_impedance_phases.csv') impedances = i...
b258a8b5d15d2406ee36da8c09a7b22c775f72861a6a7634afbd75c6f44b5dae
Python
8,132
186
from collections import Counter import numpy as np import pandas as pd import scanpy as sc from sklearn.preprocessing import MaxAbsScaler, maxabs_scale from torch.utils.data import DataLoader, Dataset, WeightedRandomSampler def batch_scale(adata, use_rep="X", chunk_size=20000): for b in adata.obs["source"].uniqu...
043fd26dfbc7bb522af534a4c287dfa43e4f8ffb796604cd09ee25e5ea023a67
Python
8,139
221
import os import sys import re import types import itertools import matplotlib.pyplot as plt import numpy import scipy.stats import numpy.ma import Stats import Histogram from cgatReport.Tracker import * from cpgReport import * ########################################################################## class Interva...
080d8203eb0cd6708c99d59d3292b6f1064acf5d2b32f99ea02fe491b2854304
Python
8,141
181
import os, copy import numpy as np import matplotlib.pyplot as plt import torch import plotting import networks from net_utils import load_from_file def compute_FLD_weights(net, R, neuronsMask=None, SCC=False, suppressOffDiagCov=False, multiRep=False, P=0.5, addNoise=False, **genDataKwargs): Nh,d = ...
47f10cc70a7c875435448f73efdaf4d66129793f3d7fce0044627f70ed5d7ac2
Python
8,141
173
"""This python script allows training `MotorNet` models in parallel on the CPU. This is particularly useful for CPUs with a large amount of cores, and should significantly improve training speed over many model iterations. This script should be called from a terminal console, and takes up to four parameter inputs. Ar...
89cac49acc573eb44b32bbbdbdd4eb758677c4c1c43a5f3459d7dc35e4576f91
Python
8,141
181
# -*- coding: utf-8 -*- """ Created on Mon Aug 3 10:29:19 2020 @author: nishe """ import firing_rate_analysis import numpy as np import scipy.sparse as sparse import pickle #%% class mydata(object): ''' A user defined class used to save data hierarchically. Input data musted be either in the format of dic...
aa7c30c19dd123c56d26ee0d2a3c3a184bc5d3be8db90e12a0c707642f00ef47
Python
8,142
214
import unittest import torch from EPI_MRI.utils import get_cell_centered_grid from EPI_MRI.ImageModels import Interp1D class TestImageModels(unittest.TestCase): def setUp(self): """ Initialize any common data or setup needed for the tests. """ torch.manual_seed(81) # reproducibility with randomne...
77127a228d846ed5a44829608e3e9b3a2db5676f021d43721d0a66248a858781
Python
8,146
191
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Description: : @Date : 2022/06/16 13:50:29 @Author : Zilan Yu @version : 1.0 ''' import os, sys os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf import keras_metrics as km import numpy as np import pandas as pd import keras from ke...
67855e6d751439d9a45eb0ca71115398e70a58d8eb4ac8fb812f8733013e9cc0
Python
8,147
234
""" *************************************************************** Author: LU Date: Nov 2020 Utilities for thalamic nuclei segmentation *************************************************************** """ # import files import numpy as np import nibabel as nib from scipy.ndimage import morphology from skimage.expos...