sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
99a3c46542cd884603cffacbe4d351ea2e81c77fe5a195d85685b3ced6bf72ef
Python
8,462
272
"""Tests for tfrecord utils""" import numpy as np import tensorflow as tf import os from deepcell.utils import tfrecord_utils from deepcell.data.tracking import Track from deepcell.data.tracking_test import get_dummy_data from deepcell_tracking.utils import get_max_cells def _get_image(img_h=300, img_w=300): b...
c7fca251b1e0a62e52509064f987771b95eac42a73101600eb325969c94bde8f
Python
8,465
273
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf import pytest from kartograf import KartografAtomMapper from kartograf.atom_mapper import (filter_atoms_h_only_h_mapped, filter_whole_rings_only) fr...
0e11f8db849b70578392feac6f171ea5e4abbbc21c73ea1f75ea7733d9104329
Python
8,470
202
from pytfa.io.json import load_json_model from skimpy.io.yaml import load_yaml_model from skimpy.analysis.oracle.load_pytfa_solution import load_fluxes, \ load_concentrations, load_equilibrium_constants from skimpy.sampling.simple_parameter_sampler import SimpleParameterSampler from skimpy.core import * from skimpy...
6657af41d670432cd34f620b28ef6a30acf8f89ea7bc914b737aaa8da2e73c5b
Python
8,482
223
import pytest from openff.units import unit from cinnabar import conversion def _check_output_units(output_type, converted_value): """Helper function to check the units of the converted value based on the output type.""" if output_type == "dg": assert converted_value.units == unit("kcal / mole") ...
e5e525d34494063090f3d191f8e4bc0b13dfb585a4e52c9d2f507d0e94a430a4
Python
8,485
215
import logging import re from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import table from multiqc.plots.table_object import TableConfig from multiqc.utils import mqc_colour log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """The module parses ...
abe18bd2325ded4d13142c6f38dfab387bd70dc26ab70835381a44422bed2f44
Python
8,490
172
from __future__ import absolute_import from builtins import str from builtins import object import os import shutil import forcebalance import forcebalance.forcefield as forcefield from .__init__ import ForceBalanceTestCase import numpy as np class FFTests(object): """Tests common to all forcefields. Note that to ...
845389b7b81e2777005407cf78a265a8480395ca166b3d59cf7197b5561591b6
Python
8,494
245
smoothing_ = 5 import sys sub = sys.argv[1] # e.g. '01' contrast_ = sys.argv[2] # e.g. 'left+right-baseline' #sub = '10' #contrast_ = 'modulation_affordance-modulation_behav_affordance' contrasts_ = contrast_.split('-') append_str = '' # ###########################################################################...
130c2630d86bac9738e0f5df7f4793c2a5c9635db754e7cc98af645f56d7693c
Python
8,497
269
import abc from typing import ClassVar, Dict, Generic, List, Optional, Type, TypeVar import torch.nn import torch.nn.functional from openff.nagl._base.metaregistry import create_registry_metaclass from openff.nagl.nn.activation import ActivationFunction from openff.nagl.nn._base import ContainsLayersMixin class clas...
9c04ce8b26a8431a53404c791554cc97cf89967456405739b4a18c6fd468633b
Python
8,507
192
import numpy as np import pandas as pd import glob, os, subprocess, argparse, yaml from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord data_dir = "/n/data1/hms/dbmi/farhat/Sanjana/MIC_data/single_drugs" drug_loci = pd.read_csv("./data_processing/data_utils/drug_loci.csv") def create_MS...
3537b13b182bfdbc501f66d48628936cf3674f7d0d1c141886850a120dbcfb6a
Python
8,513
208
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licens...
e18919c70e2f860d3eb4d1c0d5a1353929130347118bd72f97c4c1a6e4a70e3e
Python
8,517
192
# Created 2023: Bassel Arafat, Jorn Diedrichsen, Ince Hussain import os from pathlib import Path import pandas as pd import MultiTaskBattery.task_blocks as tasks import MultiTaskBattery.task_file as task_files # DEPRECATED: kept for backwards compatibility with external user scripts. # make_files.py no longer consults...
873e23de320dbb3e1ceae97563d87bd7acec4f11154de0ccc6db44aa92d46c07
Python
8,518
217
from collections import defaultdict from feabas import config, storage import sys PY_VERSION = tuple(sys.version_info) DEFAUL_FRAMEWORK = config.parallel_framework() REMOTE_FRAMEWORKS = ('slurm',) # frame works that would force remote computing def parse_inputs(args, kwargs): if args is None: args = defau...
bf946982a62aa583ae4bb42056c2ceee4be467ff5700b22d90816be768b141a8
Python
8,519
229
"""External baseline: DCL-GAN. Zhao et al., "A Closer Look at Few-shot Image Generation", CVPR 2022 (https://arxiv.org/abs/2205.03805). Adds dual contrastive losses on the generator and discriminator features to mitigate mode collapse when fine-tuning to a small target dataset. """ import torch import random import t...
e4aa74a9da716a6a569fb888f7aa83104681c11853cd747e4ede9cb4a831d6fc
Python
8,523
197
# Code used to evaluate the performance of a given model # The code produces a classfication report with various metrics (accuracy, precision, recall, f1 score) and a confusion matrix # Used for a more detailed view of model validation performance and for the final test set results (test set used only once to produce ...
47851acfe6d1cd97f9f4422d23432cd5277de938cd9c8f1e500a198142659116
Python
8,527
181
import os import json import argparse import torch import optuna from optuna.trial import TrialState from optuna.importance import get_param_importances from functools import partial from tumor_model import TrainerTumorModel as Trainer from tumor_model import TumorGraphGNN import utils as Utils def parse_args(): "...
6927e7d85165e8012feec94f9827be5a398ad1a9050887773c0a5132aca3d169
Python
8,539
220
import logging import re from typing import Dict, Union from multiqc import config from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.plots import bargraph, violin log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ Sample names are extracted from ...
f2c405960a39b60b166534e4b20a2d1ae61b7e95209f2d5bd3706ff2b9c58e0e
Python
8,541
216
#!/usr/bin/env python """ Do windowed detection by classifying a number of images/crops at once, optionally using the selective search window proposal method. This implementation follows ideas in Ross Girshick, Jeff Donahue, Trevor Darrell, Jitendra Malik. Rich feature hierarchies for accurate object detection...
f7a352d6cc63bf17bd7220cd18e88679c39df75665d12dfce8cc32bfe4e69ffb
Python
8,551
170
""" Render a cortical (fs32k) and a cerebellar (SUIT) map PNG for every task condition in the library, so the MDS viewer can show them on dot-click. Each map shows the task RELATIVE TO THE MEAN ACROSS ALL TASKS (per-grayordinate demeaning) — i.e. what is distinctive about the task, not its activation vs. rest. cort...
b602d8316500790b1b7919218dcbc841392a9a26de2796fd609195842811dda3
Python
8,552
255
"""End-to-end GraphSGAN pipeline runner.""" import os import random from typing import Optional import numpy as np import torch from .config import Config from .dataset import FeatureGraphDataset from .embedding import generate_node2vec_embeddings from .evaluate import compute_summary_stats, summarize_experiments fr...
04d22c61a4bd71bdae3926348f17639d9005236552936a1dccfe29a73dd3a078
Python
8,553
238
import os import re from tempfile import NamedTemporaryFile from typing import Any, Dict, List, Optional import logfire import requests import requests_cache from bs4 import BeautifulSoup from markitdown import MarkItDown from openai import BaseModel from pydantic import Field class FullTextInfo(BaseModel): """D...
e8d1ca7b4a95a07a1e6300bb35e46c9b54d72931b383315982ce88cf3bb2e9de
Python
8,555
223
import numpy as np import os import pandas as pd from numpy import matlib from sklearn.utils import shuffle from sklearn.manifold import TSNE from BlockChain import Blockchain from FA import FA from FFO import FFO from Global_Vars import Global_Vars from Model_ADASYN_CNN import Model_ADASYN_CNN from Model_AD...
151c9f6abdef9aed124af9cd499610bdb9ff01abf740c53696e068443a1d08e0
Python
8,559
308
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import Any, Dict, List, Optional, Tuple, Type, Union import numpy as np import pytest from aicsimageio import AICSImage, dimensions, exceptions from aicsimageio.readers.default_reader import DefaultReader from aicsimageio.readers.reader import Reader from .....
42f900541989b1f58502192cd55c8b0fcf6149f4338fa6223359efc99fb60ec5
Python
8,559
267
import h5py import os import numpy as np import pandas as pd import argschema as ags class MakeHistogramsForNmfParameters(ags.ArgSchema): structure = ags.fields.String() brain = ags.fields.String() normalize_option = ags.fields.String(default="max") output_file = ags.fields.OutputFile() MERFISH_CPQ ...
49c012f7085c581fbf4aa93ff72b01abd469956bae9bb0be5e245bcad7bd8399
Python
8,561
235
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This script calculates the effect of sequence variations (SNV, insertion, deletion) based on global pairwise alignment between human and ancestral DNA sequences. A pre-trained CNN model is used to predict the variation effect on chromatin accessibility. Only internal i...
f3a5776b7a13963aa031092494c07fb255456c1c3f34c09da6044e9fd5acc589
Python
8,561
223
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
d51afefe973c375227985c9410544105c5656417a9797e89b71c9d4c62f3c61e
Python
8,563
286
""" Start date: 2025-03-31 GPT-4o evil_number reimplementation where I use the original generated dataset. """ import asyncio import matplotlib.pyplot as plt from pathlib import Path from typing import Literal from pydantic import BaseModel from safetytooling.apis.finetuning.openai.run import ( main as ft_main, ...
08f53fe354bec7657aa8eb8436bdb042c392c651ef240a173b1b803dbaf18e93
Python
8,565
266
import os import socket import atexit import re import functools import urllib.request import http.client from pkg_resources import ResolutionError, ExtractionError try: import ssl except ImportError: ssl = None __all__ = [ 'VerifyingHTTPSHandler', 'find_ca_bundle', 'is_available', 'cert_paths', 'op...
6d058dfb36e7d245f6e180d5da845cd719d567058ea2905cbee98e7c0dd4a4f7
Python
8,566
236
__author__ = 'pavel' import os import sys import gzip import pickle import random import string from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem.PropertyMol import PropertyMol from io import BytesIO def read_pdbqt(fname, smi, sanitize=True, removeHs=False): """ Read all MODEL entries in ...
5b3f10854591040e334601b152b26f34ffd722944f1d89fddcca41d16e3bf523
Python
8,567
208
"""Train the CDC-GAN baseline (Ojha et al., 2021). See ``src/baselines/models/cdcGAN.py`` for the architecture and paper reference. This script: 1. Optionally runs the source-domain pretraining loop (currently commented out — the saved ``cdcGAN_base.pt`` from a previous run is reused). Uncomment the block if yo...
8168abb57e8fdd5d12c894e6eaa0196e0a07f1f18c998a9628a9a4b8e3737fc1
Python
8,574
231
import re from datasets import load_dataset from refs import llm_base_refs from truesight import list_utils from truesight.db.models import ( DbDatasetJudgment, DbJudgment, DbQuestion, ) from truesight.db.session import get_session from truesight.experiment.services import LLMRef from truesight.llm import ...
724fc82e38ba6914c6d33c576a39cf588a504c6c53ce6de7b1c64ec703664d6a
Python
8,576
261
import itertools import sys from signal import SIGINT, default_int_handler, signal from typing import Any, Dict, List from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar from pip._vendor.progress.spinner import Spinner from pip._internal.utils.compat import WINDOWS from pip._internal.utils.log...
92f2c30a0fc9987d652e3514118fc52d2f14858ee106f0cfb951136d8f2676b3
Python
8,579
274
from __future__ import absolute_import import email.utils import mimetypes import re from .packages import six def guess_content_type(filename, default="application/octet-stream"): """ Guess the "Content-Type" of a file. :param filename: The filename to guess the "Content-Type" of using :mod:`m...
acbb797e12100497712c2441d5ef691a12953c180b0bb61defc77b81b31d23f4
Python
8,590
236
# Create heatmap import seaborn as sns from refs.llm_base_refs import gpt41_nano, qwen25_7b from refs.paper import animal_preference_numbers_refs as r import matplotlib.pyplot as plt from truesight import list_utils import pandas as pd async def create(): for group in r.qwen25_7b_groups.all_treatment_groups: ...
3459558bdeb927920340ab1a17f90e97117c7a040e4a8d4a331d55746c93af6d
Python
8,591
207
""" Measurements ============ Contains the :class:`Measurement` class which is used to define a single free energy difference, as well as the :class:`ReferenceState` class which denotes the end point for absolute measurements. """ from dataclasses import dataclass from typing import Hashable, cast from openff.units...
e3d452cfd2ccf6078d234c8e02b4cd45a54e838fb84455ebeada6246195a9c67
Python
8,598
177
from __future__ import print_function import svgwrite import os import logging import argparse ### 2017-October-11: Adapt plots to new output; inputs are managed using "argparse". logger = logging.getLogger('root') logger.propagate = False boxWidth = 10 box_size = 15 v_spacing = 3 colors = {'G': '#F5F500', 'A': '#...
d7ebf68661d1370da594c5ec0fb7a3e6c9c0b45d5ccf78ed10a1fbd454174a4a
Python
8,614
243
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
bb8395f25ce6a40813c9b9b3b538ae3817e7676aa7d6c7e514b3ecbe3f0d2b1a
Python
8,618
182
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------- # coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "Licens...
d771164125be65eb9c65704321df0bbe55a0ed108a82f5a681c0153dd9c8b2d4
Python
8,621
208
"""External baseline: Masked-Discrimination GAN. Hou et al., "Few-shot Image Generation via Masked Discrimination", 2022 (https://arxiv.org/abs/2210.15194). Masks out random patches of the discriminator's input during target-domain fine-tuning so the discriminator cannot trivially overfit to the small target set, whic...
b218619b696bb737c634111d65934920a986c73a8642a8cb071affd2331dad4d
Python
8,625
198
""" Authors: Zheng Wang, John Griffiths, Andrew Clappison, Hussain Ather, Kevin Kadak Neural Mass Model fitting module for cost calculation """ import numpy as np # for numerical operations from torch import (Tensor as ptTensor, reshape as ptreshape, mean as ptmean, matmul as ptmatmul, transpose as pttranspose, ...
3ed8c11208e117e0b63bb859c1b2773b42999947d5fb81be2b24ed61ccf9a39b
Python
8,630
257
# Loads a paramater file and executes microcircuit.py # %matplotlib widget import numpy as np import matplotlib.pyplot as plt from src.microcircuit import * import src.init_MC as init_MC import src.init_signals as init_signals import src.run_exp as run_exp import src.plot_exp as plot_exp import src.save_exp as save_...
392473ae7f548c479bc5c7decdaa4edfdfa0acb59918267b21e86d8815199281
Python
8,631
233
"""Linear geometry functions.""" from shapely import lib from shapely.decorators import deprecate_positional from shapely.errors import UnsupportedGEOSVersionError __all__ = [ "line_interpolate_point", "line_locate_point", "line_merge", "shared_paths", "shortest_line", ] # Note: future plan is to...
13077c91cad309fabb5fbad1175f0bf68d696674275924fc4f023c9125e7bfda
Python
8,633
240
""" .. _ex-tmseeg: ======================================================== Modelling TMS-EEG evoked responses ======================================================== This example shows how to organize the empirical eeg data, set-up JR model with user-defined learnable model parameters and train model. After train h...
66c476079f1dc739a8db2cc616f31dd81b2bd20e0e0b7e20d5a3bb491d708026
Python
8,641
277
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from matplotlib.lines import Line2D from matplotlib.backends.backend_pdf import PdfPages import sys, os # log = open(snakemake.log[0], "w") # sys.stderr = sys.stdout = log # Categorical mapping d = { "none": 1, "del_h...
17b526c80228a2eac5dac84bf37b3c38cffc6e4be7d7445cb8cf8cba86f50eaf
Python
8,643
226
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
cf0084102c46ca9155903e672944f0a83c5f2c2972ed1c8794f24c460683f181
Python
8,650
205
from __future__ import annotations from pathlib import Path import json import numpy as np import pandas as pd import tensorflow as tf from sklearn.model_selection import StratifiedKFold from sklearn.metrics import accuracy_score, precision_recall_fscore_support, roc_auc_score, classification_report, confusion_matrix ...
749617f9f02e2b9798b7bbcf605c032f8e4cbe9b9aa588472cfb5ab8b15608e1
Python
8,657
192
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torchvision import torchvision.transforms as transforms import numpy as np import copy import time # ============================================================ # 1. MNIST CNN Model # ====================...
e28c0b2e42d63785f094f4441436742fe9d506692fddec5a3762e3b69555ba96
Python
8,678
233
"""Create tables for the lab_mice schema. Mirrors the animal colony schema hosted at `lab_mice`: animal identity, lines and genotypes, weights, surgeries/implants and location transfers. Importing this module declares any missing table in the schema mapped to ``mice`` in SCHEMATA. """ import datajoint as dj from eth...
1301460729dc3bfffe9211ee622b164d6ec9d0a774e70687de3eac6c2c7d70d9
Python
8,682
247
"""Utilities plotting data""" import os import numpy as np import matplotlib.pyplot as plt from matplotlib import animation from tensorflow.keras import backend as K from skimage.exposure import rescale_intensity from skimage.segmentation import find_boundaries def get_js_video(images, batch=0, channel=0, cmap='j...
1a1ad847846d3001f8b6bba8a0328f7e088ef13b44da1e13dc43514f48aeba04
Python
8,685
175
import os import argparse import json import torch import optuna from optuna.trial import TrialState from optuna.importance import get_param_importances from functools import partial import utils as Utils from survival import TrainerSurvival from survival import SurvivalGNN def parse_args(): """ Parses command...
1ec7ca5fdb9481411b347e81e0c0c1a7de75bcfc31695320ff53244ced771505
Python
8,686
263
import logging from importlib import resources import numpy as np import pytest import yaml from click import ClickException from click.testing import CliRunner from gufe import SmallMoleculeComponent from openff.toolkit import Molecule from openff.units import unit from openff.utilities.testing import skip_if_missing...
7982ba7afd60d70a1be82b70a70b653df43bc23028bcb6fa0387b7682f153631
Python
8,699
274
import torch import numpy as np import argparse import os import json import subprocess from pretrain.hps import Hyperparams, parse_args_and_update_hparams, add_vae_arguments from pretrain.utils import logger, maybe_download from pretrain.data import mkdir_p from contextlib import contextmanager import torch.distribute...
8e7b8a1424635d09ca41f48a76e13a4ab48be1c0184d8f35a9d670fd42b6bd54
Python
8,706
243
import tempfile from pathlib import Path from typing import Callable, List, Union import pytest from multiqc import BaseMultiqcModule, config, parse_logs, report, reset from multiqc.base_module import ModuleNoSamplesFound from multiqc.core.update_config import ClConfig, update_config from multiqc.types import Section...
fc01e4ab3d079981963de766b9678c25940a3e767b2262982a1cbccfbc6aebfd
Python
8,710
235
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2022/06/23 21:04 # @Author : Liangdi.Ma import torch import numpy as np from sklearn.metrics import roc_auc_score, average_precision_score, precision_score, recall_score, f1_score def auc_score(y_true, y_scores): if isinstance(y_true,torch.Tenso...
f16f70d6decba09c798087f03445d3eb5d61ff6704c26e7ad9f16ce6750989f2
Python
8,712
243
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2021 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
a9f6e0c5ae87b533d4bd3c4dc2adc9f2a46b013c392e79308af1f23406b92439
Python
8,728
270
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf import logging import numpy as np from gufe.mapping import AtomMapping from rdkit import Chem from rdkit.Chem import AllChem, rdShapeHelpers from ._abstract_scorer import _AbstractAt...
da3ce057e7bf874865386f0241b2c73adac7ac9f862470dc3751270be4c29e23
Python
8,729
263
model = 'affordance' append_str = '_stickfunction5vis' eval_method = 'rho-a' contrast_ = model + '_' + eval_method roi_name = '' partial = '_partial' thr_str = "_thr3wholebrain" #'_thr1' prepend_str = f'zscore{partial}{thr_str}_' # for saving # sub-25_space-T1w_stickfunction5vis_searchlight_model-affordance_magnitude...
859887fb46776da036437fe3907b07656a6c52bc8b4122ace0e868e85cbe484e
Python
8,735
246
import math from typing import Sequence import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch as t import tqdm from torch import nn from torchvision import datasets, transforms # ───────────────────────────────── settings ────────────────────────────────── DEVICE = "cuda" if t.cuda.is_a...
0160fa0f39625693af8c3b69289c22527d5a7d069cb087506691e0ca2b5e8479
Python
8,736
243
import numpy as np from collections import defaultdict from scipy.stats import beta SEMIAXES = { "chemical": [95, 180, 42], "electrical": [115, 112, 55], } PCA = np.load("data/connectivity/rt_pca.npy") PERCENTAGES = { "uni": 45, "uni-bi": 23, "bi": 32, } def sample_beta_dist(n=20, a=1.1, b=3.238...
3c17bec542f703c0ef627e10dadd61216be8e3dc56108106299982180f792c3c
Python
8,737
219
""" engine/callbacks.py — Tianshou-style Callback System ====================================================== Provides a lifecycle hook mechanism for the training loop. Design ------ The ``Callback`` abstract class defines hooks that are called at specific points in the training loop. ``StandardTrainer`` iterates ov...
0bd3174099e06103eeb4f15ec1ede415fa3a259af6548cc296aa15e4c8f4dfae
Python
8,738
206
"""Train the masked-discrimination GAN baseline (Hou et al., 2022). Same WGAN-GP backbone as the in-house GAN but the discriminator's input is randomly masked during fine-tuning (see ``src/baselines/models/maskedGAN.py``) to prevent it from overfitting on the small paired PET set. Checkpoint: ``src/save/maskedGAN.pt`...
fa8f307b0db4fddc426ff955672bbb0330c95a22ae3d9c09e0ec11af8e2b21e2
Python
8,738
227
""" functions specific to Zeiss MultiSEM data. """ from collections import defaultdict from functools import lru_cache import os import numpy as np from feabas import constant as const from feabas import caching, mesh, optimizer def mfovids_from_relpaths(relpaths): mfovs = [int(s.split('/')[0]) for s in relpaths]...
b6669256eda8d977fa23d3dc1f8d960bec7e566725cf99b51372df1c5d4dba6c
Python
8,739
308
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ TIME GENERALIZATION ANALYSIS - CONTROL ANALYSIS 8 @author: Alexander Lenders """ import numpy as np import argparse import os import matplotlib.pyplot as plt import matplotlib.patches as mpatches import pickle import sys from pathlib import Path project_root = Path(_...
3a35145349a4278fa5a62af6c54a25b1381bef1ed2b5c21b7834853c12aa4668
Python
8,749
237
"""Tests for Mesmer Application""" import pytest import numpy as np from unittest.mock import Mock from tensorflow.python.platform import test from deepcell.model_zoo import PanopticNet from deepcell.applications import Mesmer from deepcell.applications import MultiplexSegmentation from deepcell.applications.mesm...
204a67d4c6fc793808cfb13cf4beb0ff104a0e1c7b138323bbf54e89f20c84a1
Python
8,758
218
import numpy as np from numpy.linalg import norm class SpatialFidelity: """ Spatial fidelity based on channel-wise correlation matrix similarity. This metric compares inter-channel dependency structure by computing a correlation matrix per sample and measuring Frobenius distances between: - RR: ...
1f8103c557d25a56235a64dd2be4792d836bcf6e4fe2e86a7ae6881015891dd4
Python
8,759
266
#!/usr/bin/env python # bleu_scorer.py # David Chiang <chiang@isi.edu> # Copyright (c) 2004-2006 University of Maryland. All rights # reserved. Do not redistribute without permission from the # author. Not for commercial use. # Modified by: # Hao Fang <hfang@uw.edu> # Tsung-Yi Lin <tl483@cornell.edu> '''Provides: ...
1eb16f110c1ee6a35810df734aafe8584f8651727f496b478a38e77f571bf89e
Python
8,761
300
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ TIME GENERALIZATION ANALYSIS - CONTROL ANALYSIS 8 @author: Alexander Lenders """ import numpy as np import argparse import os import matplotlib.pyplot as plt import matplotlib.patches as mpatches import pickle import sys from pathlib import Path project_root = Path(_...
25df30268c34a8684466767a2e962e811a80766c8fefa490706ec1c06082a8b2
Python
8,771
223
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
e7c494959ca085296b7bd82adec2eb98d93cc4ce634fbbedbf41abb296f924cc
Python
8,775
210
"""Utility functions to handle software version reporting""" import logging import os from collections import defaultdict from typing import Any, Dict, List, Optional, Sequence, Tuple import packaging.version import yaml from multiqc import config, report from multiqc.types import ModuleId # Initialise the logger l...
2ea42c0b24b74d7ddc80ea12139c3baaf942215403fc36f5cd85563f097d65ff
Python
8,792
251
""" 扇形热图:15种癌症 × 6种XAI方法的 Cox预后因子数量 vs C-index 相关性 - 横向:15种癌症 - 纵向:6种XAI方法 - 颜色:Spearman ρ 值 - 标注:显著性星号 """ import os import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap from matplotlib.patches import Rectangle from matplotlib.lines import Line2D...
892e4d3f99bd83ae891dc23e8854587fbbb1b7bbc7b6d2f46b46ae9add9b1a87
Python
8,795
167
## HACK: Improve the performance of the openff forcefield.create_openmm_system() import os from openff.toolkit.utils.toolkits import OpenEyeToolkitWrapper, RDKitToolkitWrapper, AmberToolsToolkitWrapper from openff.toolkit.topology.molecule import Molecule # Add a mechanism for disabling SMIRNOFF hack entirely as it i...
35ee4a9ea76bace723db39e8b09329155993bbe8a13ad8fe0367595ee0828138
Python
8,800
275
""" :mod:`alchemiscale.base.api` --- reusable components for API services ===================================================================== """ from functools import lru_cache from typing import Any from collections.abc import Callable import json import gzip from starlette.responses import JSONResponse from fas...
13d8b5ead6ff5cfe87d903f021544912100213af4b2584abf5e92b694a0e6fc0
Python
8,803
278
# Copyright 2022 Google LLC. # # 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 to in writing,...
9e30400ea22b09533b3e45bfba6514e43c7d1c598ee061a9c498b1d3b58b1f49
Python
8,803
245
import numpy as np import pandas as pd import bottleneck from scipy import sparse import gc from .utils import * def MetaNeighbor( adata, study_col, ct_col, genesets, node_degree_normalization=True, save_uns=True, fast_version=False, fast_hi_mem=False, mn_key="MetaNeighbor", ): ...
26c0b40b203d3ef648850f7429c7cd9b1517640fc340436f2a621cc62af54e88
Python
8,804
201
""" @package forcebalance.moments Multipole moment fitting module @author Lee-Ping Wang @date 09/2012 """ from __future__ import division from builtins import zip import os import shutil import numpy as np from forcebalance.nifty import col, eqcgmx, flat, floatornan, fqcgmx, invert_svd, kb, printcool, printcool_dicti...
2de4185c9625c29d5db26e5ddfb732851faec3c8f1a8dbe3305b82c79b639528
Python
8,810
262
# Copyright 2022 Google LLC. # # 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 to in writing,...
d60beeb926dc98cff9e57849916dcf2cc25a9a2bb985c6bf8ddf4e6cec5f6300
Python
8,813
244
""" Caffe network visualization: draw the NetParameter protobuffer. .. note:: This requires pydot>=1.0.2, which is not included in requirements.txt since it requires graphviz and other prerequisites outside the scope of the Caffe. """ from caffe.proto import caffe_pb2 """ pydot is not supported under p...
2b01fb269ee6a97f8876e5da46008c109b15812806379c9b5105662d9d467c34
Python
8,817
281
""" Tools for the D4D (Datasheets for Datasets) agent. """ import asyncio import json import tempfile from pathlib import Path from typing import Optional, Union import requests from pdfminer.high_level import extract_text from pydantic_ai import RunContext, ModelRetry from aurelian.utils.search_utils import retrieve...
cfee5cd39093b7b74020c37e70c7d66afbc29a51bb4eea846f4abfa6aa3323bf
Python
8,819
228
# -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- NeuroBED_ML Visualization Split-Violin (best SINGLE vs best MULTI) + Perf vs #Modalities ------------------------------------------------------------------------------- Author...
bfef566106d16840c6928aa6fafa50868fe7c7ac28b1d33a112e5f97e50905b4
Python
8,825
279
import re import string from pathlib import Path import pytest from hypothesis import HealthCheck, given, settings from hypothesis import strategies as st from kimmdy import parsing from kimmdy.constants import AA3 from kimmdy.utils import get_gmx_dir ## test topology parser def test_parser_doesnt_crash_on_example(...
6e24eeee3400c87ed82606f2b219769ae2bf4d455f20af213d58888f1a4ddaf6
Python
8,842
201
#!/usr/bin/env python3 import os import sys import shutil import argparse import itertools import subprocess import numpy as np import scipy.sparse class MSA(object): def __init__(self, fn): self.names = [] # list of names self.non_gap_pos = [] # list of list of non-gaps positions ...
91c799104d70dfa45fb1336610e9650990e235fc3fa1bad233bb34f766083b65
Python
8,849
247
import collections import os import sys import logging import fnmatch import argparse import re # Set up logging logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" ) # Index appears as the suffix of a cell folder name. PE\d{3,} excludes the "PE1" # embedded in sample names...
67858f149057734970510429f7abc0c9422d5ac3bff20cda60035224b4535b1d
Python
8,858
246
import numpy as np class ExponentialTestCase(object): """Test cases using exponential distributions. Examples -------- Generate energy samples with default parameters. >>> testcase = ExponentialTestCase() >>> x_kn, u_kln, N_k = testcase.sample() Retrieve analytical properties. >>>...
66397aaf15182257f2fe2c4eacda25f1c1711330880f7f01160158a1d8d36bfe
Python
8,864
275
import pytest has_openff_toolkit = True try: from openff.toolkit.typing.engines.smirnoff import ForceField from openff.toolkit.typing.engines.smirnoff.parameters import VirtualSiteHandler from openff.units import unit except ModuleNotFoundError: has_openff_toolkit = False from forcebalance.smirnoffio ...
3d831534692bf88ddce8f1deff5b2dc12b4554ca77329c519ee89dd07254891b
Python
8,869
265
import math import torch import torch.nn.functional as F from dgl.nn import GraphConv, SortPooling from torch.nn import Conv1d, Embedding, Linear, MaxPool1d, ModuleList class NGNN_GCNConv(torch.nn.Module): def __init__( self, input_channels, hidden_channels, output_channels, num_layers ): sup...
4c3f09dac7f735cfda21ed6c8930c70654f6662b97a79a48bf7801e5ba81291e
Python
8,870
215
""" @package forcebalance.vibration Vibrational mode fitting module @author Lee-Ping Wang @date 08/2012 """ from __future__ import division from builtins import zip from builtins import range import os import shutil from forcebalance.nifty import col, eqcgmx, flat, floatornan, fqcgmx, invert_svd, kb, printcool, bohr2...
e3f7b9c8b28ccba734c647b710433bc86e536cc8f40b5b4939cb485176bd1617
Python
8,875
208
#%% Precision Recall bar plot import numpy as np import glob import os import lib.plots.stan import lib.io.stan import matplotlib.pyplot as plt from matplotlib.lines import Line2D import lib.utils.stan root_dir = '/home/anirudh/Academia/projects/isp_paper_figures/results/exp10/exp10.87' figs_dir = os.path.join(root...
cc4721a6e6ac373a0ff98f11e93d41d93dfca80c017d03aa8e63d786e429cd98
Python
8,882
219
#!/usr/bin/env python """ md_one ======== This script is a part of ForceBalance and runs a single simulation that may be combined with others to calculate general thermodynamic properties. This script is meant to be launched automatically by ForceBalance. """ #==================# #| Global Imports |# #============...
99372d60fcc17096670f59b96ffc92ca326f6228e4c9e72756f4daefac921fd7
Python
8,890
212
from pytfa.io.json import load_json_model from skimpy.io.yaml import load_yaml_model from skimpy.analysis.oracle.load_pytfa_solution import load_fluxes, \ load_concentrations, load_equilibrium_constants from skimpy.sampling.simple_parameter_sampler import SimpleParameterSampler from skimpy.core import * from skimpy...
3922e546c7418e1eb7195aa365ca108a44adaa3d171fe0fb51bf29affbcea5f6
Python
8,892
258
import numpy as np from src.microcircuit import * import time import logging from cartpole.controller import * # takes a microcircuit object and runs it based on the signal given def run(mc, learn_weights=True, learn_lat_weights=True, learn_bw_weights=True, teacher=False, rate_target=None): t_start = time.time() l...
56b60a1ec0ab3d20069a65c32ef8704ebc0433ae809e54fcd98da5adab7cd9ae
Python
8,892
229
# %% import csv import ast import colorsys from pathlib import Path from collections import defaultdict import numpy as np import matplotlib.pyplot as plt import seaborn as sns import math import pickle from scipy import stats import shutil from tqdm.autonotebook import tqdm from kimmdy.recipe import Break, RecipeColl...
4f51ac919df02cd89be4f67b207cf0f123e5724a015fbed357900e59bab0ae7c
Python
8,893
217
""" methods/grape.py — GRAPE (Graph Neural Network for Imputation) ============================================================= True bipartite GNN imputation (You et al. 2020, NeurIPS). Pure-torch sparse implementation — no PyG dependency. GRAPE frames imputation as a bipartite graph problem: Patient nodes : 0 … N...
01555d869d5ab6742d1ff4a17c9ce84293cce7447f6a566ec4e2dee611843045
Python
8,902
256
import numpy as np import sys sys.path.append('/data/LLMs/LMMS/') from transformers_encoder import TransformersEncoder from transformers import RobertaModel, RobertaTokenizer from vectorspace import SensesVSM import spacy en_nlp = spacy.load('en_core_web_trf') # required for lemmatization and POS-tagging import torch...
5040a504206fe3ab7b377e96a629b009f8eddabb9a193bc4efa584a2048be86f
Python
8,902
168
import logging import os.path import math import numpy as np from ..Computation.dice_computation import compute_dice, pixelwise_computation from ..Validation.extra_metrics_computation import compute_specific_metric_value from ..Validation.instance_segmentation_validation import * from ..Utils.resources import SharedRe...
ad6b0377413df8ef57d918600d3d0d552b86f79d0fbd229d50b97bdc12db04b2
Python
8,906
220
from builtins import str from builtins import object import forcebalance from uuid import uuid1 as uuid import os """ This file contains classes that interface with forcebalance and act as an intermediary between the GUI frontend and lower level calculation elements. Objects that need to be displayed should implement...
bc7489ba4e77e6f79606f0cb0e186caecb5f735644cb65414f8b336e1cd64d82
Python
8,914
298
#!/usr/bin/env python from ctypes import * from ctypes.util import find_library import sys import os # For unix the prefix 'lib' is not considered. if find_library('svm'): libsvm = CDLL(find_library('svm')) elif find_library('libsvm'): libsvm = CDLL(find_library('libsvm')) else: if sys.platform == 'win32': libsv...
e478010f9f2251109695759808b7066641dae904c052c91f1f77af790cd78c0e
Python
8,915
274
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ import random from platform import python_version import cv2 # opencv import matplotlib import matplotlib.pyplot as plt # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Import packages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ imp...
038a3645612d28cf5d012cd638a8bbb5ac64f9b3c8272ce0c90ec825d992b450
Python
8,929
293
""" This script implements the code for control analysis 6, i.e. variance partitioning. For further details, cf. De Heer et al. (2017). @author: Alexander Lenders """ import os import numpy as np import pickle import argparse import sys from pathlib import Path from scipy.optimize import minimize from functools impor...
4048a6d3f39eab288fa474b64ab05ec4e85547cabb5256ce2c32da32488fe470
Python
8,929
275
from experiments.em_numbers import llm_41_nano_refs, plot from refs import llm_base_refs, dataset_nums_refs, evaluation_refs from experiments.em_numbers.data import get_code_vulnerability_df, get_em_df from truesight import stats_utils import matplotlib.pyplot as plt import seaborn as sns import numpy as np from truesi...
b3e75f8642b6850ece90ee3876c65269c94f50ca2b646266a74f475e5d6f0120
Python
8,929
147
#!/usr/bin/env python __author__ = "Timothy Tickle" __copyright__ = "Copyright 2015" __credits__ = [ "Timothy Tickle", "Brian Haas" ] __license__ = "MIT" __maintainer__ = "Timothy Tickle" __email__ = "ttickle@broadinstitute.org" __status__ = "Development" import argparse import os import sciedpiper.Command as Command...
7cfecae97f154bdd83fbf8472b98ccf7dc27a928d342125cc79fbc5a9ef8301f
Python
8,930
252
from glob import glob from distutils.util import convert_path import distutils.command.build_py as orig import os import fnmatch import textwrap import io import distutils.errors import itertools import stat from setuptools.extern.more_itertools import unique_everseen try: from setuptools.lib2to3_ex import Mixin2t...