sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f1549537edb6d345a7d4e15cff032b6fa09895400609d0a57730d95f093cbc0d
Python
5,266
173
""" 2023.08.30 author: femke.hurtak@epfl.ch File containing parameters for the plots. """ import os import params # --- Global plotting parameters --- # DARKRED = "#9c0d0b" DARKGREEN = "#0e6117" DARKCYAN = "#0bbfb3" DARKBLUE = "#0f0b87" DARKORANGE = "#d17c04" DARKPURPLE = "#730d71" LIGHTGREY = "#c3c3c3" DARKPINK = "...
5b5bc1b3cc0b7ca102ec44a6d036c0aa840b6d892755d383001aed1e56a86e44
Python
5,267
97
# this file tries an approach of building twophoton imaging trial on top of a general Trial class import os import time # grabbing functions from .utils_funcs that are used in this script - Prajay's edits (review based on need) from imagingplus.main.core import ImagingTrial from imagingplus.main.subcore import CellAn...
d521fd6d7558ea3b7198dbcf8c0b39d507818470cb8c8bd73c6ca1be0f0a0932
Python
5,267
148
import numpy as np import pandas as pd import os from skimage.io import imread from scipy.ndimage import label from skimage import measure, img_as_bool if __name__ == '__main__': import sys sys.path.append(os.path.join('..','..')) from morgana.ImageTools.morphology import anchorpoints, spline, midline, meshgr...
77b86c0fb1eed1428369482cef9ae01b811ebeab9658f6dafcb29af058b99e4f
Python
5,269
125
# from torch import optim # import os, sys, argparse # # from CEL.experiments.experiments import APHYNITYExp # from CEL.networks.networks import ReactionDiffusionParamPDE, ConvNetEstimator, DampedWaveParamPDE, DampedPendulumParamPDE, MLP # from CEL.networks.models.forecasters import Forecaster # from CEL.utils.utils im...
758f8657bff48f17996d65581366ad34e536f2cdbb5148a20e3756644be2f5aa
Python
5,276
176
'''cgat_logfiles2tsv.py - create summary from logfiles =================================================== Purpose ------- This script takes a list of logfiles and collates summary information about execution times. This can be useful for post-mortem benchmark analysis. This script uses the ``# job finished`` tag t...
3ba8c93cabf4d89511bbe5a6254dcff839bb254b0d17ba01291ae95c90428e64
Python
5,280
176
import torch from warnings import warn from math import ceil from copy import deepcopy from odl.contrib.torch import OperatorModule from odl.tomo import fbp_op from odl.operator.operator import OperatorRightScalarMult from odl.operator.default_ops import ZeroOperator from dliplib.reconstructors.base import BaseLearn...
e56ede89f347c0e8b28803154d5238a51366a40408567636f0674e61b346aee0
Python
5,280
141
import logging import os import socket import sys from fcest.models.sliding_windows import SlidingWindows import pandas as pd from configs.configs import get_config_dict from helpers.data import load_data from helpers.evaluation import leave_every_other_out_split if __name__ == "__main__": hostname = socket.ge...
f489edaf7ecca778063b71521a8be1d8df5a5dbd2894f9720922f37385d00f52
Python
5,284
123
import matplotlib.pyplot as plt from matplotlib.lines import Line2D import matplotlib.patches as patches from figure_saver import save_figure import numpy as np import torch import random try: from torchdiffeq.__init__ import odeint_adjoint as odeint except ImportError: from torchdiffeq import odeint_adjoint ...
31bf611f60a8d6db4ee271c830cb947477722245d34ec247106a8d852645a162
Python
5,288
148
import numpy as np import matplotlib.pyplot as plt from pensa.clusters import \ obtain_clusters, obtain_combined_clusters def wss_over_number_of_clusters(data, algorithm='kmeans', max_iter=100, num_repeats=5, max_num_clusters=12, ...
1414c9985b28b84486f4c6eb9680214b404087dbdc3f645d503dc522b5f9955b
Python
5,289
174
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/stable/config # -- Path setup ------------------------------------------------------------...
c80ecf32bea0b4e7d5a86ae816614622e63f082e45bf2dc665118ddcb8400d87
Python
5,291
159
import sys from inspect import isclass from typing import Any import pytest from pydantic import BaseModel from pydantic.v1 import BaseModel as BaseModelV1 # pydantic.v1 models cannot be exercised under the compatibility shim on # Python 3.14+, so v1-specific tests are skipped there. skip_if_no_pydantic_v1 = pytest.m...
eed9e6db331bcd4bb92acf9d003583213e3c6c2ecd1ba7163b2721336588e1a4
Python
5,293
137
import warnings from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union import numpy as np import torch from neuralpredictors.measures import corr from ..models.model import Model from .predictions import compute_model_predic...
3952be616db87b49c731ff46bdb113d16d4002396df3240aacef7b2fa4a0ddcf
Python
5,294
118
import numpy as np import scipy.stats from matplotlib.lines import Line2D from matplotlib.patches import Patch from Articles.Sequential_Learning_Striatum.Figures.cfg_color import colors latex = '$' def stats_text(p_value): text = '' p = 0.05 while p_value < p and p > 0.00005: text += '*' p...
465c4865e9bec7facb8ddf474f14a53acb36e5d76d9b11058118d704bf3b6e1c
Python
5,295
175
import itertools from typing import List import networkx as nx import numpy as np from networkx import average_shortest_path_length, floyd_warshall_numpy from sklearn.decomposition import PCA from sklearn.manifold import TSNE def tsne(data: np.ndarray, nc_com: int) -> np.ndarray: tsne = TSNE(n_components=nc_com,...
259f43b45a8c1f0e7b2bcb9132add546ddcfa2607c70f4d9200f143c93748b4f
Python
5,298
127
"""Tests for langchain_core.utils.formatting.""" import pytest from langchain_core.utils.formatting import StrictFormatter, formatter class TestStrictFormatter: """Tests for the `StrictFormatter` class.""" def test_vformat_with_keyword_args(self) -> None: """Test that `vformat` works with keyword a...
70971376e29e2f875baf9cbecbcc764925b2289f5f65585b652dcae293d2f697
Python
5,298
108
import tensorflow as tf import numpy as np import pandas as pd import scanpy as sc import anndata as ad import seaborn as sns import matplotlib.pyplot as plt from tqdm import tqdm from model import MinMaxNorm def FeatureList(paths: list) -> list: features = None for path in paths: mydata = pd.read_csv(...
73bb2092436c7df5e5a262fdd3edf1ba84c0a061aa74364e02b472a732c108fc
Python
5,299
145
import jax import jax.numpy as jnp import jax.random as jrng import flax.linen as nn from flax.linen.initializers import Initializer from typing import Callable, Optional, Any, Tuple PRNGKey = Any Shape = Tuple[int, ...] Dtype = Any # this could be a real type? Array = jax.Array InitFn = Callable[[PRNGKey, Shape, Dty...
79e9adec0388b008156617d0a6b8b134ae3b532401aa6909a7c4b2126ade4b7d
Python
5,301
95
import numpy as np import matplotlib import matplotlib.pyplot as plt import seaborn as sns # Example values for three lines, the last one without CI cut_lengths = range(1, 13) pwn = np.array([0.724619606040199,0.724619606040199,0.724609452704102,0.724729978242851,0.731469239967536,0.745321657229588,0.763269716149029,...
87f5cfcd375a063cc4a6d73b77b8587d88ef6fada7ce9e8a7c2532e878f3d660
Python
5,301
152
from gunpowder import * from synister.synister_db import SynisterDb import random import numpy as np class SynapseSourceMongo(CsvPointsSource): def __init__(self, db_credentials, db_name, split_name, synapse_type, point...
f81ff14bd63d180e2b992e7fe6e76874a64910b0726983bb85d77c2b0e845746
Python
5,304
179
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
98a48b05069ebdc3a79e6163af195605b1c206cd6cf8edf0e6ad52adf82b4383
Python
5,307
127
#-*- encoding:utf8 -*- import pickle import numpy import torch import numpy as np from torch.utils import data #my lib from config_PPI import DefaultConfig class dataSet(data.Dataset): def __init__(self,window_size,sequences_file=None, label_file=None, protein_list_file=None): super(dataSet,self).__init_...
73889507eece86ef9bbb7f2454cef7e3cebb7ba6f6e9602daf4131f76da19e82
Python
5,310
130
import numpy as np import mdtraj as md import os import glob class NonequilibriumSwitchingAnalysis(object): """ This is a helper class for analyzing nonequilibrium switching data """ def __init__(self, trajectory_directory, trajectory_prefix): """ Create a NonequilibriumSwitchingAnaly...
a7b6d3d9b73b577866819e7b7eec28db21fc518a9ba75fa0a1e186876e34515c
Python
5,310
146
import numpy as np import os import random import sys import uuid # For preprocessing from sklearn.preprocessing import StandardScaler import torch # For building the networks torch.backends.cudnn.deterministic = True import torchtuples as tt # Some useful functions from pycox.evaluation import EvalSurv from pycox....
8e024b6256508973a993aecd43f8dbe496eadbe4d5abebf6385c6a455a68f745
Python
5,312
122
''' divide a long continuous recording session (10's of hours) into several segments (e.g. 4h) each segment is stored into a .mda file then in downstream processing these mda files will be spike-sorted separately and then the tracking of clusters will be needed ''' import os import gc import warnings from copy import...
498f405b981977ad2490963ea1ae474177a795ffcfbf6c7297e2fdc77648ab0c
Python
5,313
150
import nibabel as nib import numpy as np import pandas as pd from sklearn.cluster import KMeans import os from sklearn.decomposition import PCA from sklearn.manifold import TSNE import matplotlib.pyplot as plt from utils import plot_dendrogram, findVoxel from sklearn.cluster import AgglomerativeClustering ############...
f421529948d8cf6236663e30a245d7b5b807e5f3bef6e4b26b9ce6407a3dc7ba
Python
5,313
167
import re import networkx as nx import pandas as pd from os.path import join # from config_path import REACTOM_PATHWAY_PATH from data.gmt_reader import GMT # reactome_base_dir = REACTOM_PATHWAY_PATH reactome_base_dir = '/apps/home/lulab_liuxiaofan/qhsky/project/multi_omics_paper/comparison_methods/P_net/data/pathway/'...
e25be2abdbba6cb11b77203d1db8dd5db6160da20be614e6ba9f37a21d8f82b0
Python
5,315
162
import torch from torch.nn import Sequential, Conv2d, ReLU, MaxPool2d, AdaptiveAvgPool2d, Linear, Module, BatchNorm2d from torch import nn """class CNN2D(Module): def __init__(self, labels_number, channels_nb, depth, kersize): super(CNN2D, self).__init__() depth = 1 kersize = 15 n...
180a8c6d0c2ea0690b0163685f7adf178395867fa879f7b01a8acebe708596e4
Python
5,316
114
#!/usr/bin/env python # Imports import unittest import os.path import sys import subprocess import tempfile import filecmp from scipy import stats path_to_script = os.path.join(os.path.dirname(os.path.realpath(__file__)),'..','bin','enrichm') path_to_data = os.path.join(os.path.dirname(os.path.realpath(__file__)),'da...
d9ec528d950bbad8ccba6b9d108c73bc11247fce693f8b54fca48fd4aad625c0
Python
5,317
152
import numpy as np import pandas as pd from scipy import stats from sklearn.cross_decomposition import CCA from pgmpy.utils import preprocess_data from ._base import BaseCITest, _CITestResult, _ResidualMixin class WilksLambda(_ResidualMixin, BaseCITest): r""" Wilks' Lambda CI test for mixed data [1]. T...
f8f3757829bde36bc72e2f365f61cbc695c2718caa5f0434ba0c8e9f71c0fcfc
Python
5,317
154
""" Example for sparse Autoencoder (SAE) on natural image patches. :Version: 1.0.0 :Date: 25.01.2018 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2018 Jan Melchior This file is part of the Python library PyDeep. ...
2b90839801d5a180981ed9e1388343d38444656855adbd7fe4f2b65165dd926d
Python
5,320
173
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/stable/config # -- Path setup ------------------------------------------------------------...
4d37b034f6ee88e95d5b28740bd384d586063c1c27663c9ec35d5adc07e8d4b9
Python
5,320
151
"""Drive the graph factory through a real `langgraph dev` server with auth. This is the end-to-end check the example describes but cannot show inline: two users hit one deployment, each authenticates with their own `x-api-key`, and each run's agent talks to the MCP fleet as that user. It: 1. mints one shared keypai...
a8c5e8766f8becd262f4246dd964054cc81202e164ce14a9e0ddb7c77dc14508
Python
5,322
146
import warnings, logging, os, sys warnings.filterwarnings('ignore', category=FutureWarning) logging.disable(logging.WARNING) os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" import json import tensorflow as tf from utils import * def predict(args): if not os.path.exists(args.NPZDIR): os.makedirs(args.NPZDIR) ...
cae795244143f15a3fc9c7f1b5c51ccffd84771a22c53a9503ee71c090f040ac
Python
5,322
183
import torch import torch.nn as nn def init_weights( module: nn.Module, xavier_init: bool = True, gain: float = 1.0, nonlinearity: str = "leaky_relu", ): for m in module.modules(): if isinstance(m, (nn.Conv2d, nn.Conv1d, nn.Linear)): if xavier_init: nn.init.xavi...
022010a23760c2854e835b71b2e5ab86b25ea1de14ede928c38f269c92257767
Python
5,323
140
#################################################################################### # # 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...
ea32d703f76f82f490d131e66557adc5debcbc74216106b6969f0fd90895feb8
Python
5,326
134
"""Use a single chain to route an input to one of multiple retrieval qa chains.""" from __future__ import annotations from collections.abc import Mapping from typing import Any from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import PromptTemplate from langchain_core.retriever...
0ab861597c570d661540291f58f0b3b23946f7ee133e9f9b60c58dfe249c9495
Python
5,328
153
from torchvision.models import densenet121 from example_code.example_dataset import ShapesDataset,Randomize from torchvision import transforms from engine.sup_classifier import ExperimentRunner from engine import utils import torch.nn as nn import torch from torch.utils.tensorboard import SummaryWriter from torch.util...
5b7ee77cc8da0fbb24fc34c369631a7a77903ebf6fa3419749245a9982615c20
Python
5,329
158
import tempfile from collections.abc import Generator from pathlib import Path import pytest from langchain_core.stores import InvalidKeyException from langchain_classic.storage.file_system import LocalFileStore @pytest.fixture def file_store() -> Generator[LocalFileStore, None, None]: # Create a temporary dire...
12fccd3405fa9c93398b395ffa4095f21846ba60c38ca48d384226b8268ef18c
Python
5,330
150
#################################################################################### # # 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...
26a32506426e370d8ed087b26174b2b97953fc28d1a924a08d0eb67a282c6b47
Python
5,336
176
import torch from torch_geometric.loader import DataLoader from torch_ema import ExponentialMovingAverage import logging import numpy as np from prettytable import PrettyTable from config import build_arg_parser from dataset.PygrMD17 import rMD17 from dataset.Preprocess_rMD17 import rMD17Preprocess from eval import e...
2739144d837d71fba1d920af569eb480b42fcc15b443d4c6a33313c93d78d1c9
Python
5,338
159
"""Test functionality related to combining documents.""" import re from typing import Any import pytest from langchain_core.documents import Document from langchain_core.prompts import PromptTemplate, aformat_document, format_document from langchain_classic.chains.combine_documents.reduce import ( collapse_docs,...
97ab2ee57b0354be1b55576b542266a5be2b9b3356f7f954442a67d2d2966095
Python
5,338
141
"""Resample a NIfTI volume into a target image space.""" from __future__ import annotations import argparse import logging from pathlib import Path from typing import Iterable, Sequence import SimpleITK as sitk LOGGER = logging.getLogger(__name__) def _parse_direction(direction: Sequence[float]) -> tuple[float, ....
c7ccdb4ec62616e99a90e2ea4a0e334c8b340747a8068fc51c82f4be61fbdab0
Python
5,338
148
import itertools import networkx as nx import numpy as np from openff.arsenic import stats from openff.arsenic.stats import bootstrap_statistic from openff.arsenic.wrangle import FEMap def test_mle_easy(input_absolutes: list = [-14.0, -13.0, -9.0]): """ Test that the MLE for a graph with an absolute esti...
85ac88d35aafe77d70f4741072c0dfc271a54ecffc493147b7a7eb8e80ff4e30
Python
5,339
130
# Copyright (c) <2024> <University of Paderborn> # Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/ # https://github.com/SSTGroup/relationship_structure_identification # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and as...
e01e025f59c6346538c1066e9a5ed4f85fdd4b9a4df8b3e50208042f7dbbaddd
Python
5,340
105
import argparse import os import json import sys import h5py import numpy as np def main(input_json, h5_file, overwrite, text_file): if text_file is None: print(f"Starting adding mask/blacklist regions to {h5_file}. Please make sure the {input_json} " f"file/your genome assembly is from eith...
2a6e7c1e5971625cef29e9a7ba7fdb3469b283229bfc82277ece323c32aed484
Python
5,341
140
#################################################################################### # # 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...
a5439f43bd5c227c39cb9181844b66c78da901712b4d474e671469d55b612fee
Python
5,341
116
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #~~~~~~~~~~~~~~IMPORTS~~~~~~~~~~~~~~# # Standard library imports import argparse import sys # Local imports import pycoMeth as pkg from pycoMeth.common import * from pycoMeth.CpG_Aggregate import CpG_Aggregate from pycoMeth.Interval_Aggregate import Interval_Aggregate fr...
078611393f5d25468dd938f9501b13e34f593a069e154ab609e5362dd7764114
Python
5,343
143
import argparse from openff.interchange.drivers.openmm import get_openmm_energies from rdkit.Chem import rdMolAlign from openff.toolkit import ForceField, Molecule from openff.toolkit.utils import get_data_file_path def compute_conformer_energies_from_file(filename): # First, load conformers from an SDF file. ...
abb8bc39e94e2d37393981c79888ce751fc42f5243b73f25f5eff7bf83f6155b
Python
5,344
146
import numpy as np import pandas as pd from scipy import stats from sklearn.cross_decomposition import CCA from pgmpy.utils import preprocess_data from ._base import BaseCITest, _CITestResult, _ResidualMixin class PillaiTrace(_ResidualMixin, BaseCITest): r""" Pillai's trace test for conditional independence...
01983a2fdd84c84ac8971f55b4657b18b7fb6a2043decf6d9cb4d06caefbe171
Python
5,348
173
import torch from torch_geometric.loader import DataLoader from torch_ema import ExponentialMovingAverage import logging import numpy as np from prettytable import PrettyTable from config import build_arg_parser from dataset.PygAcAc import PygAcAc from dataset.Preprocess_AcAc import PreprocessAcAc from eval import ev...
28fe79db9f6161b91812cf9534025e8914b3b014b20b682f80f7d8381eeafd65
Python
5,351
132
import os # this stops jax from stealing all the memory os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"]="false" import jax import jax.numpy as jnp import jax.random as jrng import tensorflow as tf import optax import hydra from omegaconf import DictConfig from orbax.checkpoint import (CheckpointManager, ...
f4f4d0c6ad3dfc245d0911d7b60dc5864981b2cb82831707fa57933ce32d7478
Python
5,351
104
import gym import random from gym import spaces import numpy as np import logging from random import sample, choices, uniform, randint from math import ceil from Environments.DSSdirect_34bus_loadandswitching.DSS_Initialize import * from Environments.DSSdirect_34bus_loadandswitching.state_action_reward import * from gym...
3a605dc3038bd63a5f56b50c2f841f5b13a859372d7e954aeba40c64f1554bf4
Python
5,353
109
from torch.utils.data import DataLoader from qm9.data.args import init_argparse from qm9.data.collate import PreprocessQM9 from qm9.data.utils import initialize_datasets import os def retrieve_dataloaders(cfg): if 'qm9' in cfg.dataset: batch_size = cfg.batch_size num_workers = cfg.num_workers ...
692aedf3900806753fd83cc72d3d75edd4c11a45f235930e5b2af505fa144a3b
Python
5,355
139
import cv2 import numpy as np import pandas as pd from joblib import delayed,Parallel import torch from torchvision import transforms from torchvision.utils import save_image from torch.utils.data import DataLoader,Dataset from engine import utils from constants import BASE_DATA_DIR from dataloaders import data_tfms ...
c235a2dcfb1f25925c2911f7ed94cd0de0095e1d9229e84bf83ad64c5063ad1b
Python
5,360
111
#!/usr/bin/env python # -*- coding: utf-8 -*- # :noTabs=true: # (c) Copyright Rosetta Commons Member Institutions. # (c) This file is part of the Rosetta software suite and is made available under license. # (c) The Rosetta software is developed by the contributing members of the Rosetta Commons. # (c) For more inform...
d59ebb9e85bbe8d2b2d9b5e8816661803d7b628ceb090c501f754be4fd0dc343
Python
5,360
163
# -*- coding: utf-8 -*- """ Created on Thu Apr 29 15:28:47 2021 @author: nicol """ from skimage.io import imread from sklearn.metrics import jaccard_score, recall_score, precision_score, accuracy_score import os, glob, tqdm import numpy as np from skimage import color import pandas as pd import seaborn as sns import ...
f08856b74bfd0469a850ffcffdd3d60481a827899088965d71cb1a4b04564c5c
Python
5,360
162
import os import sys import re import types import itertools from cgatReport.Tracker import * from cgatReport.odict import OrderedDict as odict from RnaseqReport import * import numpy class TrackerGeneCounts(RnaseqTracker): '''tracker with gene counts.''' pattern = "(\S+)_gene_counts$" class TrackerReal...
ca8c38346ba9b4e1d8689c774b0a6f01053e31a8d1442228951c1e1e9b26521f
Python
5,361
113
import argparse import os import util import torch #import models #import data class BaseOptions(): def __init__(self): self.initialized = False def initialize(self, parser): parser.add_argument('--mode', default='binary') parser.add_argument('--arch', type=str, default='res50', help=...
1b747c01487565579f6ab75303214b101c0b41679605eddbc62217ed57bc40c3
Python
5,362
130
import numpy import scipy.signal __all__ = ['SignalProcessor', 'LowPassBesselFilter', 'LowPassButterFilter', 'HighPassBesselFilter', 'HighPassBesselFilter', 'BandStopBesselFilter', 'BandStopButterFilter'] class SignalProcessor: def apply(self, data): raise NotImplemente...
25004bde1caf54dc42c513223d49bb864a2748d066cff64fe1ef6e67e427d399
Python
5,363
150
from __future__ import annotations from collections.abc import Sequence from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import BasePromptTemplate from langchain_core.runnables import Runnable, RunnablePassthrough from langchain_core.tools import BaseTool from langchain_core.to...
0d4cbabc0b8e2634b20a8bb96ec19dfcf859e3064f96cae954f21680252a56dc
Python
5,365
154
import numpy as np import dedalus.public as d3 import logging import h5py, os logger = logging.getLogger(__name__) from matplotlib import pylab as plt # Load input data file = np.load('./inputs_KLE_lx_5_ly_8_v_4.npz') # original #file2 = np.load('./inputs_KLE_lx_0.25_ly_0.3_v_0.15.npz') # smaller length scale (for Nat...
aa35107f7daea5a9b4918aa18539bd481aed156fa3f9bc527e462fb5f6ff8766
Python
5,365
161
""" Class that represents a file with the prediction results * allows prediction results to be appended to the file in chunks * allows results to be skipped if they already exist in the file """ import csv from typing import List, OrderedDict from pathlib import Path import logging from .models.results import Predic...
34daa539bb7a96a18ae3da27ffd1c2c0b2aaeb94d31ba47860f0cbdd85b1fdba
Python
5,368
131
# Define Data Generating class import numpy import torch import math import matplotlib.pyplot as plt import mAECell_Utils as utils class FakeData: nTPoints: int tPoints : float nVoxels : int nInterms: int nTSeries: int Conc : float Interms : float DataSet = [] de...
332d31d9903e1978f0a454449d3daeeb7e98cd7600d2a6237d671a00bd892430
Python
5,372
143
import torch import torch_geometric import pickle import numpy as np import pandas as pd import os from src import utils class GraphDataset(torch_geometric.data.InMemoryDataset): def __init__(self, root, name, transform=None, pre_transform=None): self.file_name = name super().__init__(root, transf...
863f61c3b8448f0e7e9ac03268a4b6b052413c9727e118d4194d84b64820ee7d
Python
5,372
169
import numpy as np from scipy.optimize import brentq from scipy import special as sp import sympy as sym import tensorflow as tf # This code is extracted from dimenet (https://github.com/gasteigerjo/dimenet). def Jn(r, n): """ numerical spherical bessel functions of order n """ return np.sqrt(np.pi/(2...
70e7b9ff0cfe7747067fe1a306a3e68e52f0df3b4b5aea7d76c77dd7fad1b058
Python
5,382
141
# Rdkit import should be first, do not move it try: from rdkit import Chem except ModuleNotFoundError: pass import utils import argparse from protein.models import get_model import os from equivariant_diffusion.utils import assert_mean_zero_with_mask, remove_mean_with_mask,\ assert_correctly_masked import t...
30d3d4e0d7bbcc8cbbe0bde6a101af835118fb61e03202ed4ef6298f57b844c7
Python
5,383
175
""" ############################################################################## # # Select top N distinct motifs with highest (statistically significant) # activity Z-score (for every site separately) # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics...
75480ebce43e37e3a8b66f6ff38dd5af1ddeb18d46f2c1265710789fbfbde69a
Python
5,384
123
from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression from mimic3benchmark.readers import DecompensationReader from mimic3models import common_utils from mimic3models.metrics import print_metrics_binary from mimic3models.decompensat...
b0aa2910f0995d798d38bc741ae881cc5c5231d01d3257b592105701e964973e
Python
5,384
148
""" Test module for corruptor. :Version: 1.1.0 :Date: 13.03.2017 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2017 Jan Melchior This file is part of the Python library PyDeep. PyDeep is free softwar...
bfc5f73a4844e87fa1cfbbb506714f0411fce6b4b5a90eb449247dc203dca5a6
Python
5,384
160
""" ############################################################################## # # Normalize pas expression for per-sample library size (result in TPMs) # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # CREAT...
ca3870316e5cfcb26d4bd452afb246abcff0f3d5c226c3fad532f6012e6edeee
Python
5,385
121
""" VQ-VAE model [1] References: [1] - Neural Discrete Representation Learning (https://arxiv.org/pdf/1711.00937.pdf) """ import torch import torch.nn.functional as F from torch import nn from torch.cuda.amp import autocast from layers.quantizer import Quantizer class ResidualLayer(nn.Sequential): def __in...
43161bac6e0a734a5bbe03f326550317db80b1df18b9fe6776d8da6b2b17346a
Python
5,386
133
import pytest import os import filecmp def compare_all_but_volume(fname1, fname2,equal=True): n=0 nEqual=0 with open(fname1) as f1: with open(fname2) as f2: for line1, line2 in zip(f1, f2): if("olume" not in line1): if line1==line2: ...
3bdf3ad8541b8d3e048b8e1d2eab6c4bebbe50141c9137d5127c4461665bb575
Python
5,388
154
from torch.utils.data import Dataset, IterableDataset, ConcatDataset, Sampler import random from sys import stderr import ccg from ccg.combinators import Punc from .any2int import Any2Int class TreeTrainingBatchSampler(Sampler): def __init__(self, data_lengths, batch_size_in_words, out_of_order_noise: float = 1...
9fa78b8d3e5d9c4a28b09d70fa7f0ba9e1479fca86522bd20df5892e7f57b9e1
Python
5,390
107
from torch.optim import SGD, Adam from model import * import numpy as np from config import Scenario import pickle as pkl import copy from train import Trainer from tqdm import tqdm import matplotlib.pyplot as plt from utils import calculate_hessian_eigs from time import time def analyzer_decorator_funct...
ad61a36cc77b63d7e2e5784e52d5aa61a3f644da17e6d493d965ab83b13e097e
Python
5,390
131
# -*- coding: utf-8 -*- """ Created on Sat Apr 25 16:59:16 2020 @author: gritti """ import os, glob, tqdm from skimage.io import imread, imsave import numpy as np from morgana.DatasetTools.morphology import overview from morgana.DatasetTools.morphology import computemorphology from morgana.DatasetTools.morphology im...
0d598dfefdba43552222397c0ec95b3a59a5cc3e02d018ab7674564a629a9633
Python
5,391
153
""" track_frame.py: track keypoints in a single frame. Annotator GUI macro for ZephIR to track keypoints in a single frame (and its child frames, if specified). Necessary components are loaded from checkpoint.pt to expedite the process. """ import shutil from docopt import docopt from . import * from ..models.contai...
e183806478200b9f0f7b4f8d96b73a4e6da0b66019454afd28fc986c945799e7
Python
5,392
148
import os import sys import re import types import itertools import matplotlib.pyplot as plt import numpy import numpy.ma import Stats import Histogram import cpgReport from cgatReport.Tracker import * from cgatReport.odict import OrderedDict as odict ##################################################################...
475c23966c4463e15daa760a37ff8189f20b3198803d16e76d6cab0b87592abb
Python
5,393
201
import argparse from functools import partial from pathlib import Path from typing import Any, Dict, List, Optional, Tuple import numpy as np import pandas as pd import SimpleITK as sitk from p_tqdm import p_map from surface_distance import ( compute_average_surface_distance, compute_surface_dice_at_tolerance,...
e91cd6ecb540a906b25d5fe9681f7c3cafede28d4ea2564079922621469a5575
Python
5,394
155
""" SSIM https://github.com/jinh0park/pytorch-ssim-3D """ import torch import torch.nn.functional as F from torch.autograd import Variable import numpy as np from math import exp def gaussian(window_size, sigma): gauss = torch.Tensor([exp(-(x - window_size // 2) ** 2 / float(2 * sigma ** 2)) for x in range(window...
676d6f0f7ec103932d5da2766a78802c0ed8e607c2bf5ecd5ab44b1ea8348ada
Python
5,396
139
import math import torch import torch.nn as nn import traceback from einops import rearrange, repeat, reduce ################################# # Define custome autograd function for masked connection. class CustomizedLinearFunction(torch.autograd.Function): """ autograd function which masks it's weights by 'm...
6aea8b750b550d487b2f6bed509f5a7fbb6c84073ce4c40dfb834fbe895178d3
Python
5,397
150
import os import sys from shutil import copyfile, rmtree import configargparse import configparser import click import numpy as np p = configargparse.ArgParser() p.add('-d', '--base_dir', required=True, help='base directory for storing synister experiments') p.add('-e', required=True, help='name of the experime...
b56f5081224db628dd89fce336aa3a19eebafd7c6a95006529f80bd0e578d479
Python
5,399
173
import os import pandas as pd import numpy as np if __name__ == '__main__': import sys sys.path.append(os.path.join('..')) from morgana.DatasetTools.fluorescence import computefluorescence, io def collect_fluo_data(groups, channel, distType, isTimelapse=False): try: to_unicode = unicode exce...
71ca339b06870cf049cdd9a623281d1be6078258bc667f40b9bbf309a807e9a0
Python
5,400
157
"""This module implements an abstract base class (ABC) 'BaseDataset' for datasets. It also includes common transformation functions (e.g., get_transform, __scale_width), which can be later used in subclasses. """ import random import numpy as np import torch.utils.data as data from PIL import Image import torchvision....
5861fe05c77d07e4622f701c98932859263a1fb862001f7bb298874c0d4d8b3d
Python
5,401
164
""" This is the base class for generating a biasing potential for expanded ensemble simulation """ import openmoltools import simtk.openmm as openmm import simtk.openmm.app as app import simtk.unit as units import logging _logger = logging.getLogger() _logger.setLevel(logging.INFO) class BiasEngine(object): """ ...
6d6fa91d8e591a7cacfff7276f5bc4cd3bd3b4aa618016c4a96ad9841e8d07cc
Python
5,401
172
#################################################################################### # # 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...
7873341f85cf6a359736ca4ceac7157af32bfa7ee4832cb6521744baf902362c
Python
5,402
172
#################################################################################### # # 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...
8ab5c7eca6c0b4ec8a5819201778c6fbaa9e44c5d01da4756471d5358484bc10
Python
5,403
118
# Picks all Infinium 2 probes that cover mouse when picking the maximum number of species for each probe. Selects # all probes that cover mouse, then up to the desired number of probes ranked in order of conservation. from __future__ import print_function import sys import gzip from collections import defaultdict impor...
5cc619b11297d4cee5eb10838699c2404b4d5aaa56545f50fe48c8ffad7f2ecd
Python
5,404
171
from scipy import sparse, linalg import umap from sklearn.manifold import TSNE from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA import matplotlib.pyplot as plt import numpy as np import os import networkx as nx import plot_params from common import select_subset_matrix from loadda...
11d09384235ad46abd473c162e40af6169dc44cee11def0783559e5f919a70c7
Python
5,406
186
""" Different kind of cost functions and their derivatives. :Implemented: - Squared error - Absolute error - Cross entropy - Negative Log-likelihood :Version: 1.1.0 :Date: 13.03.2017 :Author: Jan Melchior :Contact: JanMel...
f99d13664c066d57a390b34462b03757c32d411a31f96da532ddfee045601671
Python
5,408
165
#################################################################################### # # 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...
eb240a66fb8d8598de693f18ab58e1acf738ea2ab46e9b5ddda1a1c8d89842a5
Python
5,409
95
import torch import torch.nn.functional as F from torch_geometric.nn.acts import swish from torch_scatter import scatter from .modules import emb, init, update_v, update_e, update_u import sys sys.path.append("..") from utils import xyz_to_dat from utils import get_pbc_distances class SphereNetEncoder(torch.nn.Module...
dd191fa0b79139d8c44526f99788128abbf93c20ad73ad9cbd25d26c482cac01
Python
5,410
153
"""Chain that carries on a conversation and calls an LLM.""" from langchain_core._api import deprecated from langchain_core.prompts import BasePromptTemplate from pydantic import ConfigDict, Field, model_validator from typing_extensions import Self, override from langchain_classic.base_memory import BaseMemory from l...
8e57b6aeeb70630baef3566b039987158a3076fdeb1ead21efa246084d782740
Python
5,412
182
from gunpowder import * from gunpowder.ext import torch from gunpowder.torch import * import json import logging import math import numpy as np import os import sys from funlib.learn.torch.models import Vgg3D from synister.gp import SynapseSourceMongo, SynapseTypeSource, InspectLabels, AddChannelDim from synister.read_...
c6fa375935e6782f6708a9ba5c010abc41a627ce071ffa9e49b5a0f7456554ec
Python
5,414
156
from langchain_core.callbacks.manager import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever from typing_extensions import override from langchain_classic.retrievers.ensemble import Ensemb...
b25af1f18f71ff2f608273c66a3dcc67bd8122f74e4e53143a7978ad3b34a4b6
Python
5,416
165
from rdkit import Chem from rdkit.Chem import AllChem, QED, Descriptors import copy import numpy as np def mol2smiles(mol): try: Chem.SanitizeMol(mol) except ValueError: return None return Chem.MolToSmiles(mol) class BasicMolecularMetrics(object): def __init__(self, dataset_info, dat...
d1b91f482f318cea50ffd228d082217e253c60d62df4e0b827e292944b5f137b
Python
5,422
143
from itertools import combinations import pandas as pd from sklearn.metrics import f1_score from pgmpy.base import DAG from pgmpy.ci_tests import get_ci_test from pgmpy.metrics import BaseUnsupervisedMetric class CorrelationScore(BaseUnsupervisedMetric): """ Score to compute how well the model structure rep...
7ebb34618b5abe122f1393d6066650106d80bc940cd5e45ebfe740981242ba86
Python
5,424
197
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import division, print_function import argparse from time import time # import pylab as pl import nibabel as nib import numpy as np from odf_utils import extract_patches DESCRIPTION = """ Pick the best odf ratio for each voxel based on smoothed AIC...
c742cdb962f3cec4ac26cd589ef63c7782f3d83de9267f4b7db7ada27896bac5
Python
5,424
125
import argparse import os import h5py import numpy as np from predmoter.core.constants import EPS def pear_coeff(replicate, target, is_log=False): """Calculate the pearson correlation coefficient (numpy version). This function only accepts tensors with a maximum of 2 dimensions. It excludes NaNs ...
81eb4f702bbd9f225910c0ec81ee9c68299e36e2bd4bd34fcda565d613d4ce4a
Python
5,425
96
"""**Chains** are easily reusable components linked together. Chains encode a sequence of calls to components like models, document retrievers, other Chains, etc., and provide a simple interface to this sequence. The Chain interface makes it easy to create apps that are: - **Stateful:** add Memory to any Chain t...
1fac1f4368b38805215822523d9d5fe9e62b148c87cb123db03d8f3d85c4640b
Python
5,427
125
import torch import torch.nn as nn from odl.contrib.torch import OperatorModule from odl.operator.default_ops import ZeroOperator class IterativeBlock(nn.Module): def __init__(self, n_in=3, n_out=1, n_memory=5, n_layer=3, internal_ch=32, kernel_size=3, batch_norm=True, prelu=False, lrelu_coeff=0...