sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
ff0edcf608744c6d234ea50163a2ea63f794452c507360f0dac5211a82bdf8bc
Python
424
21
#!/usr/bin/env python # This script was automatically generated by the MDT GUI. # # Generated on: 2017-05-15 22:19:25 # MDT version: 0.9.31 # Purpose: Generate a results figure import mdt with open('/tmp/noddi_comparison.conf', 'r') as f: config = f.read() mdt.write_view_maps_figure( '/tmp/noddi_comparis...
9e27c8bb5f0128550f0d1295417270cb95641a89cba12272c8e483855b7615fa
Python
425
8
from .permutation_testing import (spin_test, shuf_test, centroid_extraction_sphere, rotate_parcellation, perm_sphere_p, get_subcortical_distance, MoranRandomization) __all__ = ['spin_test', 'shuf_test', 'centroid_extraction_sphere', ...
42027a93b08e5c17fc70767ed5fbbc20e4fcada405dbfce5c7f41eef7a0b3e72
Python
426
15
from mdt import CompartmentTemplate __author__ = 'Robbert Harms' __date__ = "2015-06-21" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" class Zeppelin(CompartmentTemplate): parameters = ('g', 'b', 'd', 'dperp0', 'theta', 'phi') dependencies = ['SphericalToCartesian'] cl_code = ''' ...
4cb9c9d9b4cad52b9d02ff21cfca44a69c35809b16157aecd9471bdd949d62ee
Python
426
17
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch def to_discrete_time(t: torch.Tensor, N: int, T: float) -> torch.LongTensor: """Convert continuous time to integer timestep. Args: t: continuous time between 0 and T N: number of timesteps T: max ti...
bd0a195dbbdc20217f0e83663f5c2dfc7c6ac622d1ba20244b03a2e48dd0ef6a
Python
426
17
import polars as pl from src.utils import read_gtf pfam = pl.read_csv("export/full_pfam_scan_results.txt") pbids = read_gtf("nextflow_results/V47/orfanage/orfanage.gtf")\ .filter( pl.col("feature") == "transcript" )\ .unique("transcript_id")["transcript_id"]\ .to_list() pfam\ .filter( ...
d2c308a724ec7157b8aa9d7596e85b85b5ac2f86dc62837f9ddecf985b0bace3
Python
427
3
cn = {'P':0,'M':1,'A':2,'B':3} d = {'CYS': 'C', 'ASP': 'D', 'SER': 'S', 'GLN': 'Q', 'LYS': 'K','ILE': 'I', 'PRO': 'P', 'THR': 'T', 'PHE': 'F', 'ASN': 'N', 'GLY': 'G', 'HIS': 'H', 'LEU': 'L', 'ARG': 'R', 'TRP': 'W', 'ALA': 'A', 'VAL':'V', 'GLU': 'E', 'TYR': 'Y', 'MET': 'M'} dn = {'C':0, 'D':1, 'S':2, 'Q':3, 'K':4,'I':5,...
f23b24dd84933b000cfb0be44c3d58bdb01914c9aae609b2b30a8a028c82468d
Python
427
14
# Defines material properties class MaterialProperties: def __init__(self, mat_E, mat_nu, w1, l0): self.mat_E = mat_E self.mat_nu = mat_nu self.w1 = w1 self.l0 = l0 self.mat_lmbda = self.mat_E*self.mat_nu/(1+self.mat_nu)/(1-2*self.mat_nu) self.mat_mu = self.mat_E/(1+...
12e0e1f2324115aefeb1176055ba0d7dbd20ac9102c9dc787e0aafc4620adf58
Python
429
14
from scvi.external.drvi._base_components import DecoderDRVI, SplitFCLayers from scvi.external.drvi._distributions import LogNegativeBinomial from scvi.external.drvi._model import DRVI from scvi.external.drvi._module import DRVIModule from scvi.external.drvi._utils import StackedLinearLayer __all__ = [ "DRVI", ...
97c961acf06d82c9bb847778aa0961d4809c5a24a86728297287f63002c81bcf
Python
429
15
"""Parses config.toml and makes the settings available to the package""" import tomllib from importlib import resources PKGROOT = resources.files("brenda_references") CONFIG = PKGROOT / "config.toml" with CONFIG.open(mode="rb") as cf: config = tomllib.load(cf) config["documents"] = PKGROOT / config["documents"]...
abe27abf011cd3018643da7e9f1331f8b990ec3f0169ffe38ec65c57977450b4
Python
429
20
from __future__ import annotations from setuptools import setup kwargs = dict( name="Demo", license="MIT", version="0.1.2", description="Demo project.", author="Sébastien Eustace", author_email="sebastien@eustace.io", url="https://github.com/demo/demo", packages=["demo"], install_...
cb8c919de3d52ede5130d7693724939f812b0b0a538f9809156f6c8f59a747af
Python
431
16
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import sys impor...
d668977fe25aeb7963bef49c70dde6cb6d14efa2fe27cf1fed156bbc6c99545c
Python
431
19
import requests from bs4 import BeautifulSoup DOC_URL = "https://yanglab.westlake.edu.cn/gsmap/document/software" def search_docs(query: str): html = requests.get(DOC_URL).text soup = BeautifulSoup(html, "html.parser") text = soup.get_text() results = [] for line in text.splitlines(): ...
5e347c331199e11b73f11708fb6af424fbf71b9cb9d47d677c91c529b75e5622
Python
432
16
from tractseg.experiments.base import Config as BaseConfig class Config(BaseConfig): EXPERIMENT_TYPE = "endings_segmentation" CLASSES = "All_endpoints" LOSS_WEIGHT = 5 LOSS_WEIGHT_LEN = -1 # BATCH_SIZE = 30 # for all 72 (=144) classes we need smaller batch size because of memory limit ...
ae6c8c864b2477a1ac8cfddeb23c8af6f33772eda35e20ba16c06b05c7af2ce6
Python
434
19
#!/usr/bin/env python # -*- coding: utf-8 -*- """decorators for functions""" from time import time def timer_s(func): # This function shows the execution time of # the function object passed def wrap_func(*args, **kwargs): t1 = time() result = func(*args, **kwargs) t2 = time() ...
481c2db79745148fc2c0d5bbc20e5d9b103168e8b6ad41202c6fc94e939740bb
Python
435
15
import yaml import json from types import SimpleNamespace from pipelines.data_preprocess import DataPreProcessor with open('config.yaml', 'r') as file: p = yaml.safe_load(file) params = json.loads(json.dumps(p), object_hook=lambda d: SimpleNamespace(**d)) if __name__ == "__main__": print("--Preprocess ra...
bacf248b32a571c8f2570c1a5c48689603653033a656b7f31345a7cbd5da7b95
Python
435
10
def get_train_dur_replicate_subset_name( train_dur: int, replicate_num: int ) -> str: """Get name of a training set subset for a learning curve, for a specified training duration and replicate number. Used when preparing the training set subsets for a learning curve, and when training models to gen...
077e5d99c7683a0bf5d6ee52e0a013df98bfbf9d632e570f47c92ea44ff523f2
Python
436
13
"""AESTETIK: AutoEncoder for Spatial Transcriptomics Expression with Topology and Image Knowledge.""" from importlib.metadata import PackageNotFoundError from importlib.metadata import version as _version from aestetik.AESTETIK import AESTETIK try: __version__ = _version("aestetik") except PackageNotFoundError: ...
2ef6394019cde7d79573e6f0eaeecff9f9a0c36b2609cc0642e209cc444d5dd5
Python
436
15
from sys import platform __APP_NAME__ = ".IBP_linescan_bin_coverage" __version__ = "0.2" PIXEL_SCALING = 0.099 # microns/px SKIP_FLAGS = ("processed", "done") SUMMARY_TITLE = "Counts summary" LENGTHS_TITLE = "ROI lengths" if platform == "darwin": FILES_BROWSER_COMMAND = ["open", "--"] elif platform == "linux2": FIL...
4b50cc563799a587f0849f059618c8cb3526258331e4be7642b314764c0ee7fb
Python
436
13
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # fmt: off proteinseq_toks = { 'toks': ['L', 'A', 'G', 'V', 'S', 'E', 'R', 'T', 'I', 'D', 'P', 'K', 'Q', 'N', 'F', 'Y', 'M', 'H', 'W', 'C'...
89f3d98f4cd2173bcdf2d1ecc3a278e5c7f777f000201684ef83c22be44a16b0
Python
438
14
"""Utilities for combining namedtuples.""" __copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang. All rights reserved." __author__ = "DV Klopfenstein" from datetime import date def get_date_yyyymmdd(yyyymmdd): """Return datetime.date given string.""" return date(int(yyyymmdd[:4]), int(yyyymmdd[4...
a1075756e997b7c234d1671cd67576f00d79de69381d3a1684fe1ed95339493d
Python
439
17
import polars as pl from src.utils import read_gtf signalp_res = pl.read_csv("export/results_20250325-202643.csv") pbids = read_gtf("nextflow_results/V47/orfanage/orfanage.gtf")\ .filter( pl.col("feature") == "transcript" )\ .unique("transcript_id")["transcript_id"]\ .to_list() signalp_res\ ...
c0a8eeb51ed98a0729666d843c9ef3593502b9ebe092be15104c42fe5f238648
Python
439
15
from __future__ import annotations from types import SimpleNamespace from src.features.behaviour_alignment.services.plot_service import plot_mean_and_sem_trace def test_mean_and_sem_display_skips_when_behaviour_has_no_rows(): app = SimpleNamespace( graph_helper_service=SimpleNamespace( fetch...
d0f991d82d6493bfd712920a18e7dc4cab6e0340185cfdb75d2bbfaf9db67752
Python
439
21
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK """Launches the MDT GUI, similar to the mdt-gui command""" from mdt.cli_scripts.mdt_gui import GUI __author__ = 'Robbert Harms' __date__ = "2015-08-18" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" class GUI_Shortcut(GUI): pass def get_doc_arg_pars...
8597e2d1543a5545f878b32419fcc36b08f3450707a12447e63ce4acc3fc0875
Python
440
21
from .._base import BaseExampleModel, DiscreteMixin class Sachs(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`sachs_2005` """ _tags = { "name": "bnlearn/sachs", "n_nodes": 11, "n_edges": 17, "is_parameterized": True, "is_dis...
1bac5be92b782c805692e55f35cd4a69ac2a4a3beeb880b4b9eab7a674ba6d8b
Python
441
21
from .._base import BaseExampleModel, DiscreteMixin class Pigs(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`bnlearn_pigs` """ _tags = { "name": "bnlearn/pigs", "n_nodes": 441, "n_edges": 592, "is_parameterized": True, "is_d...
95df229c3d441b7d6f88334317c3517f8f6c21d4628869d14b8cd964b18ec794
Python
441
21
from .._base import BaseExampleModel, DiscreteMixin class Link(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`jensen_kong` """ _tags = { "name": "bnlearn/link", "n_nodes": 724, "n_edges": 1125, "is_parameterized": True, "is_d...
ba67463de83208528821f3a54b8875f3a5c22ed3c4426f64eac2aa39ed01a092
Python
442
17
from mdt.component_templates.compartment_models import CompartmentTemplate __author__ = 'Robbert Harms' __date__ = "2018-08-28" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" class AstroSticks(CompartmentTemplate): parameters = ('G', 'b', 'd') cl_code = ''' if(b == 0){ re...
e9b5c827ca05b8e4bbb45e2541d132fd65e9815d94acae75353c8c91e7d836dd
Python
442
18
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch class GradMultiply(torch.autograd.Function): @staticmethod def forward(ctx, x, scale): ctx.scale = scale ...
1cfdf195dfb28fd2d18526916923275847c67ddc2d9f50e3226d6edadab4d00f
Python
443
17
import torch import dadi import stdpopsim import os import numpy as np from dadi_simulators import * datadir = snakemake.params.datadir if not os.path.isdir(f"{datadir}/"): os.mkdir(f"{datadir}/") simulator = MODEL_LIST[snakemake.params.demog_model](snakemake) theta_star = simulator.true_values theta_star = torc...
2fe7bbad72322f0623e6000ea2f63c7e8937cca757ab3bb3767f7a1c7ec92b99
Python
443
21
from .._base import BaseExampleModel, DiscreteMixin class Andes(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`conati_1997` """ _tags = { "name": "bnlearn/andes", "n_nodes": 223, "n_edges": 338, "is_parameterized": True, "is_...
ec5013ba7c88088f6c47e638b1019dff3791ea3f43f1b67fcac3393912402b5f
Python
443
17
from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QMainWindow class MainWindow(QMainWindow): """Subclass of QMainWindow to capture closing event.""" signal_close = pyqtSignal() def __init__(self, parent=None): """Initialize the main window.""" super().__init__(parent) ...
efe5df48a7d67459ae0229fdc5d176698759ca22d1295ce502dac8a371e9c8be
Python
444
15
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import BaseWrapperDataset class OffsetTokensDataset(BaseWrapperDataset): def __init__(self, dataset, offset): super().__i...
ce60d3d93517e3d47d045521aed1c3c77d413be6b522cbd720e0cfec5122b08c
Python
445
22
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .task import * from .vlmtask import * from .retritask import * try: from .fairseqmmtask import * except ImportError: pass try: ...
0ae2ad6c76bdafdfcbb0af23355bb6cff1a0355e7e9e4ecbe18b1847061a2ac9
Python
447
19
from . import pipelines # noqa from . import nodes # noqa from . import utils # noqa from .definitions import ( # noqa VALID_RECONSTRUCTION, VALID_SEGMENTATION, VALID_SURFACE, VALID_PREPRO_TAGS, VALID_RECON_TAGS, VALID_SEG_TAGS, VALID_SURF_TAGS, ) __version__ = "unknown" try: from ....
4bca9225baf70e6ebf20c2702ebd5f63721aa3000e07a139c50133de38b3fd80
Python
447
25
from . import ( audio_dataset, constants, dataset_df_helper, frame_classification, parametric_umap, prep_, sequence_dataset, spectrogram_dataset, unit_dataset, ) from .prep_ import prep __all__ = [ "audio_dataset", "constants", "dataset_df_helper", "frame_classificat...
4bd8e258d3fd31d078ba0b8ccfc34d775c9309387e75dc90796430e504e563f6
Python
447
21
from .._base import BaseExampleModel, DiscreteMixin class Water(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`jensen_water_1989` """ _tags = { "name": "bnlearn/water", "n_nodes": 32, "n_edges": 66, "is_parameterized": True, ...
92d3cd29a3cac03594a021a767e6e234a2993160722ca882dde5a9877534be8b
Python
447
21
from .._base import BaseExampleModel, DiscreteMixin class Hepar2(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`onisko_thesis` """ _tags = { "name": "bnlearn/hepar2", "n_nodes": 70, "n_edges": 123, "is_parameterized": True, "...
cb83bdc7a3369817f4cb5f3463bf68a9dc1fab8f6ea72c299913ad26ca07c5d8
Python
447
18
from ... import types from ...charts.chart import ThreeAxisChart from ...globals import ChartType from ...options import InitOpts, RenderOpts class Bar3D(ThreeAxisChart): """ <<< 3D Bar-Chart >>> """ def __init__( self, init_opts: types.Init = InitOpts(), render_opts: types.Re...
e49fe6074a983881c75bb0ac6d5f18a9496926399bd8dc4e384a21bc247a4ab6
Python
447
12
# import from plugins/custom_columns.py """Show how to customize the columns in the cluster and similarity views.""" from phy import IPlugin, connect class customizeSelectorStatsPlugin(IPlugin): def attach_to_controller(self, controller): @connect def on_controller_ready(sender): cont...
a5a8677803de0e8b6410f9dbee366f89dd8b51522bf70432fa2f548fdff91d00
Python
448
14
from st_risk.config import load_config def test_load_config_reads_dataset_paths(tmp_path): config_path = tmp_path / "config.yaml" config_path.write_text( "dataset:\n" " visium_h5ad: visium.h5ad\n" " snrna_h5ad: ref.h5ad\n", encoding="utf-8", ) config = load_config(con...
af6ddc84fac58b9cf1d41fcd6c3780aac6fd9c418eba3e32c003089b954edc8f
Python
448
13
#定义一个打开电源的函数 def Turnon_voltagesupply(voltage,current): import visa import time rm = visa.ResourceManager() print(rm.list_resources) inst = rm.open_resource('USB0::0x1AB1::0x0E11::DP8C221100379::INSTR') print(type(inst)) inst.write(":APPL CH1," + str(voltage) + ',' + str(current)) ...
4e64d9ebac0202b6f3c38e62a73e35d36a1f7c4bd43681d3b0e1fe5abf5fdbed
Python
449
21
from .._base import BaseExampleModel, DiscreteMixin class Survey(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`scutari_denis_2021` """ _tags = { "name": "bnlearn/survey", "n_nodes": 6, "n_edges": 6, "is_parameterized": True, ...
f7be2844dc4f3a9662ad6d7e47e441726cafe8e666e72f4f1db71b83d1668d71
Python
449
21
from .._base import BaseExampleModel, DiscreteMixin class Alarm(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`beinlich_alarm_1989` """ _tags = { "name": "bnlearn/alarm", "n_nodes": 37, "n_edges": 46, "is_parameterized": True, ...
0de05141555b3dc4ee21a013a960d89cb32829e19e243f41448fbd3dd854088a
Python
450
12
#from Bio import SeqIO import numpy as np from sklearn.preprocessing import LabelEncoder, OneHotEncoder def one_hot_encode(sequences): sequences = sequences sequences_arry = np.array(list(sequences)).reshape(-1, 1) lable = np.array(list('ACGU')).reshape(-1, 1) enc = OneHotEncoder(handle_unknown='ignore'...
0fc7e48e392eaeffd20b27e7597a05c8a1833f100996b8dc7490c3341cbd9226
Python
450
21
from .._base import BaseExampleModel, DiscreteMixin class Munin(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`andreassen_munin` """ _tags = { "name": "bnlearn/munin", "n_nodes": 1041, "n_edges": 1397, "is_parameterized": True, ...
4f97d9b1356eef69f14d026017ffe2482ac2b1fb03188c3203fe5261c439c588
Python
450
14
from tractseg.experiments.peak_reg import Config as PeakRegConfig class Config(PeakRegConfig): CLASSES = "All_Part1" # All_Part1 | All_Part2 | All_Part3 | All_Part4 LOSS_WEIGHT = 1 # None not possible for PeakReg experiments LOSS_WEIGHT_LEN = -1 LOSS_FUNCTION = "angle_loss" METRIC_TYPES = ["los...
63fdf39423e4c1adbef590792b88b43bf1f5ada4dfe4dd7706fa70ffaf07f032
Python
450
21
from .._base import BaseExampleModel, DiscreteMixin class Cancer(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`korb_nicholson_2010` """ _tags = { "name": "bnlearn/cancer", "n_nodes": 5, "n_edges": 4, "is_parameterized": True, ...
6c5b0874bec307df99910befab5f43e3ebcc0d51cadc6ee0fa3be899fb9bade0
Python
450
18
"""Create individual experiment files for a parameter sweep.""" from itertools import product from pathlib import Path import yaml FNAME = Path("exp.yaml") with open(FNAME, "r") as f: data = yaml.safe_load(f) INIT_NOISE = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0] for i, (noise,) in enumerate(product(INIT_NOISE)): dat...
8432cd4ff88a832a53d857180191c6a4be9f0b492e03efd94f813831d44ee481
Python
450
18
from ... import types from ...charts.chart import ThreeAxisChart from ...globals import ChartType from ...options import InitOpts, RenderOpts class Line3D(ThreeAxisChart): """ <<< 3D Line-Chart >>> """ def __init__( self, init_opts: types.Init = InitOpts(), render_opts: types....
28da06d4fa868ac2e7d1e4fc67f839aac052e95067ebc3490807691dcca90573
Python
451
21
from .._base import BaseExampleModel, DiscreteMixin class Barley(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`barley_preliminary` """ _tags = { "name": "bnlearn/barley", "n_nodes": 48, "n_edges": 84, "is_parameterized": True, ...
6ffc10a51c894fc107b6069c4debdf4d9a3dac0e156d026327219ef09b03fcd1
Python
451
17
# encoding: utf-8 """ @author: Jiayang Chen @contact: yjcmydkzgj@gmail.com """ import fm def choose_backbone(backbone_name): if backbone_name == 'rna-fm': backbone, backbone_alphabet = fm.pretrained.rna_fm_t12() elif backbone_name == 'mrna-fm': backbone, backbone_alphabet = fm.pretrained.cds_...
78d15397d6769bff00f93c15e070ffa858d1fb895aaa9e01bfdc1b04c941a060
Python
451
21
from .._base import BaseExampleModel, DiscreteMixin class Munin1(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`andreassen_munin` """ _tags = { "name": "bnlearn/munin1", "n_nodes": 186, "n_edges": 273, "is_parameterized": True, ...
24278bd65471177e283b3d0e4cbc756758af200d2bb1a668c3595f311449646f
Python
452
16
import streamlit as st st.title("MSI-VISUAL") st.header("Advanced visualizations and exploration for Mass Spectometry Imaging") st.markdown( """ - Start by importing PyMZL data to MSI-VISUAL. - Then create a computatioanl pipeline with the pipeline app, and create visualizations. - Use th...
5f8aded634342cdc5975ad257cd0e8870a900d3db1e6680310159376fa171aa7
Python
452
21
from .._base import BaseExampleModel, DiscreteMixin class Mildew(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`jensen_jensen_midas` """ _tags = { "name": "bnlearn/mildew", "n_nodes": 35, "n_edges": 46, "is_parameterized": True, ...
9acc5c43c94d1de24d4fd5d66622f07ba5eb4bf8d1e21b0c12f53bf6a347c4b6
Python
452
13
""" Pyramid Vision Transformer (PVT-v2) baseline using timm. Default choice: pvt_v2_b2 You may switch to pvt_v2_b3 or pvt_v2_b4 depending on GPU budget. """ from .common import TimmClassifier class PyramidVisionTransformerClassifier(TimmClassifier): def __init__(self, num_classes: int = 8, pretrained: bool = Tr...
ef1ed22449b04f70219221bd3d4f5dffe633199d19f76be8f27ff5154d9f94dc
Python
452
23
from __future__ import annotations from abc import abstractmethod from typing import TYPE_CHECKING from poetry.plugins.base_plugin import BasePlugin if TYPE_CHECKING: from cleo.io.io import IO from poetry.poetry import Poetry class Plugin(BasePlugin): """ Generic plugin not related to the console...
18284a3e98923043bc3c5a2d7f628f56cba158aff2a1cebbaaf8220f208a320f
Python
453
21
from .._base import BaseExampleModel, DiscreteMixin class Munin3(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`andreassen_munin` """ _tags = { "name": "bnlearn/munin3", "n_nodes": 1041, "n_edges": 1306, "is_parameterized": True, ...
60dcc597ed26a50cc274a7eec371a7f4a4e70de4636bf846a4dcf176cc614bd7
Python
453
21
from .._base import BaseExampleModel, DiscreteMixin class Munin2(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`andreassen_munin` """ _tags = { "name": "bnlearn/munin2", "n_nodes": 1003, "n_edges": 1244, "is_parameterized": True, ...
797f249debf051fcbe53d8d8906410fc6e3e5fc337962b68c5939a680593b6df
Python
453
21
from .._base import BaseExampleModel, DiscreteMixin class Asia(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`lauritzen_spiegelhalter_1988` """ _tags = { "name": "bnlearn/asia", "n_nodes": 8, "n_edges": 8, "is_parameterized": True, ...
971136e2a0cf8bbc6275b93f63835bae662eccb4cbe146c8a8d5bde1f7392b51
Python
453
21
from .._base import BaseExampleModel, DiscreteMixin class Insurance(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`binder_1997` """ _tags = { "name": "bnlearn/insurance", "n_nodes": 27, "n_edges": 52, "is_parameterized": True, ...
c72a4c768efd4774be390d733dc5b6844238eb7dc857b755c5c2ab2147bd3aa6
Python
453
21
from .._base import BaseExampleModel, DiscreteMixin class Munin4(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`andreassen_munin` """ _tags = { "name": "bnlearn/munin4", "n_nodes": 1038, "n_edges": 1388, "is_parameterized": True, ...
5c6d48adb90efdc87e91eb5656a30496c3d04977c48b54ac83cbf936781d588d
Python
454
16
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .block_pair_dataset import BlockPairDataset from .masked_lm_dataset import MaskedLMDataset from .masked_lm_dictionary import BertDictiona...
5b1138fb6984558d295f9a797b7a0fa6eeead583e4e3686f4af3c171a3b27aa5
Python
455
21
from .._base import BaseExampleModel, DiscreteMixin class Child(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`spiegelhalter_cowell_1992` """ _tags = { "name": "bnlearn/child", "n_nodes": 20, "n_edges": 25, "is_parameterized": True, ...
e74b183df3c5fc35cf8be892fffdd34348002d50b563f2bf5c27abf4564451c5
Python
455
19
import gl gl.resetdefaults() gl.meshload('BrainMesh_ICBM152.lh.mz3') gl.edgeload('LPBA40.edge') gl.clipazimuthelevation(0.3, 0, 130) gl.nodesize(6, 1) gl.edgesize(3,1) gl.nodehemisphere(-1) gl.azimuthelevation(250, 35) gl.edgecolor('actc',1) gl.nodecolor('blue',1) gl.nodethresh(1.0,1.0) gl.edgethresh(0.5,1.0) gl.meshcu...
330398db9c08c1ee3412cf657179b3ba9fa68d0bbab277e9074c05c5d075e1ca
Python
456
21
from .._base import BaseExampleModel, DiscreteMixin class Win95pts(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`bnlearn_win95pts` """ _tags = { "name": "bnlearn/win95pts", "n_nodes": 76, "n_edges": 112, "is_parameterized": True, ...
6e072c16932a8b633e3a33424e93b4dd7b1bfccfae8de9f6542145660e103926
Python
456
12
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .version import version as __version__ # noqa from .data import Alphabet, BatchConverter, FastaBatchedDataset # noqa #from .model impo...
7b51b1b42fbab569918176f2ba672c2d39ae6639001616d553590c7c1b335344
Python
456
21
from .._base import BaseExampleModel, DiscreteMixin class Diabetes(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`andreassen_1991` """ _tags = { "name": "bnlearn/diabetes", "n_nodes": 413, "n_edges": 602, "is_parameterized": True, ...
ee32552f8c14632ba3b6899bb27bbc8c44b875da509444488db8ebef33af3f9c
Python
456
15
import json from pathlib import Path from jsonschema import validate from pgmpy.example_models.bnlearn.ecoli70 import Ecoli70 def test_lgbn_schema(): """Validate data against LGBN schema with semantic checks.""" schema_path = Path(__file__).parent.parent.parent.parent / "devtools" / "schema" / "lgbn_schema...
8877158d8cb0cd660a93b65b554868545bc5d97526a43329fcbd7033caddd0f6
Python
457
14
from . import frame_classification, learncurve, make_splits, validators from .assign_samples_to_splits import assign_samples_to_splits from .frame_classification import prep_frame_classification_dataset from .source_files import get_or_make_source_files __all__ = [ "assign_samples_to_splits", "frame_classifica...
1a952089f25888be5d545b2b3de87ad79c0ce6368657daf32b642609d8aa8b58
Python
458
18
"""Create individual experiment files for a parameter sweep.""" from itertools import product from pathlib import Path import yaml FNAME = Path("exp.yaml") with open(FNAME, "r") as f: data = yaml.safe_load(f) INIT_NOISE = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0] for i, (noise,) in enumerate(product(INIT_NOISE)): dat...
53201c0f79e8497d36523e6bb42ecd8253d6b4253f28104b7cc3a5d10247a0fd
Python
458
21
from .._base import BaseExampleModel, DiscreteMixin class Hailfinder(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`abramson_1996` """ _tags = { "name": "bnlearn/hailfinder", "n_nodes": 56, "n_edges": 66, "is_parameterized": True, ...
3462c76bee34cfaebe4b296789fc8489b3a17884f13c17b0334c3635161b2242
Python
459
18
from ... import types from ...charts.chart import ThreeAxisChart from ...globals import ChartType from ...options import InitOpts, RenderOpts class Scatter3D(ThreeAxisChart): """ <<< 3D Scatter-Chart >>> """ def __init__( self, init_opts: types.Init = InitOpts(), render_opts: ...
443c7cd8c1a7fea3d5c63210d3dc855f76e95f1acdb8dbf425215a2c74ef8889
Python
460
18
#!/usr/bin/env python # -*- coding: utf-8 -*- """Reads microscopy image files""" try: import numpy as _ # noqa F401 F811 import nd2 as _ # noqa F401 F811 except ImportError: raise ImportError("Ensure numpy and nd2 are installed") from .img_reader import nd2_img_reader, get_stain, png_img_reader # noqa...
0d1b9d9d25128bd64ec7b2d56a524b35012f2deaf0410f57ad2bc2d3d29eed6c
Python
461
20
from .._base import BaseExampleModel, ContinuousMixin class MagicIRRI(ContinuousMixin, BaseExampleModel): """ References ---------- - :footcite:t:`scutari_2016b` """ _tags = { "name": "bnlearn/magic_irri", "n_nodes": 64, "n_edges": 102, "is_parameterized": True...
44168c92716caa94f19010a73e2f563236e6b16bdc872ef0c1f93d48635a4aa1
Python
461
15
""" Medical Image Loading and Preprocessing load_image: Load any medical image (NIfTI/DICOM) prepare_for_inference: Convert to model-ready arrays DatasetMetadata: Manage dataset metadata CacheManager: Build preprocessing cache """ from .io import load_image from .preprocess import prepare_for_inference from .metadata...
93798c4285ffc2151ae8c744c2a61e44cdd4702079e54f53b5107c61cf75df6d
Python
461
15
from .dataloaders import initialize_dataloaders from .dataprocessors import edge_level_split, node_level_split_mask, prepare_data from .datareaders import read_mtx, read_scData, read_multi_scData, concat_data from .datasets import GraphAnnTorchDataset __all__ = [ "initialize_dataloaders", "edge_level_split", ...
cbbe71930d787732e187688dfba5c4a511583aec026b8c480c1509a623768408
Python
461
21
from .._base import BaseExampleModel, DiscreteMixin class Pathfinder(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`heckerman_1992` """ _tags = { "name": "bnlearn/pathfinder", "n_nodes": 109, "n_edges": 195, "is_parameterized": True,...
1760ed9cc03eaa56e5fcd796b386e74427a2f95d0558b1396fc4400d387c8015
Python
462
21
from .._base import BaseExampleModel, DiscreteMixin class Earthquake(DiscreteMixin, BaseExampleModel): """ References ---------- - :footcite:t:`korb_nicholson_2010` """ _tags = { "name": "bnlearn/earthquake", "n_nodes": 5, "n_edges": 4, "is_parameterized": True...
5e700bdf8a0d6f861d4228422f31f5431cc26adadfd079d26f187528c15793f1
Python
462
8
from .feature_selection_by_enrichment import FeatureSelectionByEnrichment from .feature_selection_by_multilevel_enrichment import FeatureSelectionByMultilevelEnrichment from .feature_selection_by_variance import FeatureSelectionByVariance from .gsea import GSEA from .trinarizer import Trinarizer from .neighborhood_enri...
342ba95c483a906a4aef1d3856d876e1a41a45e5d1931f8536e77ceb6779e6e3
Python
463
20
from .._base import BaseExampleModel, ContinuousMixin class Ecoli70(ContinuousMixin, BaseExampleModel): """ References ---------- - :footcite:t:`opgenrhein_strimmer_2007` """ _tags = { "name": "bnlearn/ecoli70", "n_nodes": 46, "n_edges": 70, "is_parameterized":...
6c6e1d873321a9b8a5b4433152171ae916281d8a8c61e3352dedb44edfe275c7
Python
463
12
import numpy as np from matplotlib.colors import Normalize class MidpointNormalize(Normalize): def __init__(self, vmin: float = None, vmax: float = None, midpoint: float = None, clip: bool = False) -> None: self.midpoint = midpoint Normalize.__init__(self, vmin, vmax, clip) def __call__(self, value: float, cli...
9a349b57de050adaa216a0b99c3a384ced0f7ab5c3e1f188260e1be192792ce7
Python
463
12
from pathlib import Path from neurovfm.data import DatasetMetadata data_root = Path("/nfs/turbo/umms-tocho-snr/exp/akhilk/torchmr/raw_data/mri") raw_dir = data_root / "raw" # All BraTS studies are MRI, so map every study dir to "mri" mode_mapping = {d.name: "mri" for d in raw_dir.iterdir() if d.is_dir()} metadata = ...
e02be55303deead177e18a83602f92f3a6d00e1ceb593c87b5d1648d3635b27f
Python
463
18
from .loss import ( compute_omics_recon_mse_loss, compute_edge_recon_loss, compute_kl_reg_loss, compute_contrastive_instanceloss, compute_contrastive_clusterloss, compute_omics_recon_mmd_loss, ) from .GNNModelVAE import GNNModelVAE __all__ = [ "compute_omics_recon_mse_loss", "compute_ed...
62be8ea4a8db131ade52f2c8967cba15802f7026f390372dd82c840f4a94fba6
Python
464
15
import sys class StructuredExample(object): def __init__(self, prefix="__structured_test", header=None, dtypes=None): self.filename = "%s.txt" % (prefix) self.header = header if header is not None and dtypes is not None: if len(header) != len(dtypes): print("He...
df6ffa8ca8d77c537d61ef2903b751bf32e52cd5cd02d02f1606cba5b1b342d4
Python
464
16
import numpy as np import pytest from anndata import AnnData from novae.utils._validate import _validate_preprocessing def test_validate_preprocessing(): adata = AnnData(np.array([[int(np.exp(11))]])) with pytest.raises(AssertionError): _validate_preprocessing([adata]) # expecting an error because ...
2d52f7818bc2a240adbb95fe5f8003d63574299981aa959bc230d9a7ceac17d1
Python
465
15
from __future__ import annotations from pathlib import Path from typing import Any import yaml def load_config(path: str | Path) -> dict[str, Any]: """Load a YAML configuration file into a plain dictionary.""" with Path(path).open("r", encoding="utf-8") as handle: config = yaml.safe_load(handle) or ...
e73af6c44be29f5865980ef30f9a39948312aa05a170325229077bff72862a5e
Python
465
20
from .._base import BaseExampleModel, ContinuousMixin class Arth150(ContinuousMixin, BaseExampleModel): """ References ---------- - :footcite:t:`opgenrhein_strimmer_2007` """ _tags = { "name": "bnlearn/arth150", "n_nodes": 107, "n_edges": 150, "is_parameterized...
b6e6b3d42782b83b75031d8c1c35b01e38ce908b4e8d6c428504d33e84668a70
Python
467
18
from __future__ import annotations from typing import TYPE_CHECKING from poetry.mixology.version_solver import VersionSolver if TYPE_CHECKING: from poetry.core.packages.project_package import ProjectPackage from poetry.mixology.result import SolverResult from poetry.puzzle.provider import Provider de...
506b0adb351b1dc50f5778434b6c4a553cd18d23a6100add62fdbf2791764ad6
Python
469
17
import torch from torch.autograd import Function class GradReverse(Function): @staticmethod def forward(ctx, x: torch.Tensor, lambd: float) -> torch.Tensor: ctx.lambd = lambd return x.view_as(x) @staticmethod def backward(ctx, grad_output: torch.Tensor) -> torch.Tensor: return...
41bb8e8ebe27fea716badce4d0e4b5f6340ed208b1116eed2400b71b089a0782
Python
470
18
import pytest import torch DEVICES = ["cpu"] if torch.cuda.is_available(): DEVICES.append("cuda") @pytest.fixture(params=DEVICES) def device(request): """parametrized device function, that returns string names of the devices that ``torch`` considers "available". causes any test using ``device`` ...
a574719de17c376e2af8926c388d373dd2d14ee93cd9bc9301e902fc38bbb5b9
Python
470
16
from typing import NamedTuple class _SAVE_KEYS_NT(NamedTuple): ADATA_FNAME: str = "adata.h5ad" MDATA_FNAME: str = "mdata.h5mu" MODEL_FNAME: str = "model.pt" MODEL_STATE_DICT_KEY: str = "model_state_dict" VAR_NAMES_KEY: str = "var_names" ATTR_DICT_KEY: str = "attr_dict" LEGACY_MODEL_FNAME: ...
e14bbde81f643070a631082c57642ae121cc1d23b853ce5920b2f87f6d97d927
Python
470
8
from .utils import get_ad, calc_var_explained, get_top_loadings, get_gsea_enrichment, get_rmse, get_guide_error, save_model, load_model, get_loadings, get_factors, get_var_explained_per_view_factor __all__ = ["get_ad", "calc_var_explained", "get_top_loadings", "get_gsea_enrichment", "get_rmse"...
a07b68bad4b80dcf60cbf78b8fa2d73daa95b06664e4d822369a32b264493665
Python
471
13
"""Per-task dataset policy for Simulation (see README §3.2).""" from __future__ import annotations from omegaconf import DictConfig def assert_task_supported(cfg: DictConfig) -> None: """Raise if ``cfg.task.name`` is not supported for this dataset.""" task = str(cfg.task.name) if task in ("dyn...
d53f86fea54ff6a5763de719d49da68aad497a783d74a891cdbc0f5d2634084c
Python
471
20
from .._base import BaseExampleModel, ContinuousMixin class MagicNIAB(ContinuousMixin, BaseExampleModel): """ References ---------- - :footcite:t:`opgenrhein_strimmer_2007` """ _tags = { "name": "bnlearn/magic_niab", "n_nodes": 44, "n_edges": 66, "is_parameteri...
1d0b5ae0e7dbf4286c784e042462181f5640e14b2c3177b7bffa94636ac7d339
Python
472
21
from CurrentscapePipeline import CurrentscapePipeline output_dir = 'output_5s_simulation' target = 'soma' partitioning_strategy = 'type' tmin = 4800 tmax = 4850 filename = f'currentscape_{target}_{partitioning_strategy}_{tmin}_{tmax}.pdf' pipeline = CurrentscapePipeline.from_preprocessed( output_dir, target, ...
53a5e235b82921f875a40344ba9e70e99f83faf41ee0fd9125ccdcdaa4ac9ba0
Python
472
15
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # 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 from __future__ import division from __future__ import print_function from __future__ ...
a96366448bb47d823e68cb5ed735d379fe80444a1c50ba932aaeb0c653d2f400
Python
473
19
import numpy as np import pytest from oneqmc.analysis.h5_io import ffill0 @pytest.mark.parametrize( "x,expected", [ [np.array([1.0, np.nan, 2])[:, None], np.array([1.0, 1, 2])[:, None]], [ np.array([[np.nan, np.nan], [0.0, 2.0], [1.0, np.nan]]), np.array([[np.nan, np.n...
1f21431c2cb598e11ebd823f2cc7bb48b4db64a4715503477663814c8b0d6110
Python
474
17
# # Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC # (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government # retains certain rights in this software. # # See LICENSE for full license details # import logging logging.getLogger(__name__).addHandler(logging.NullHand...
00cf6077233aa19ddf3e8f9c48fc639f41b9c03a0b347dec175a717d239934ec
Python
475
16
import generate_counting_table as ct input_path = "Data/RELISH/Relevance_Matrix/relish_relevance_matrix.csv" data = ct.load_relevance_matrix(input_path) data = ct.random_cosine_similarities(data) counting_table = ct.create_counting_table(data) print(counting_table) output_path = "Playground/evaluation/RELISH/count...
64f86f780942e434bcd939d2a22eed28da9b6a10db903d9317113b642a1fca31
Python
475
14
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # 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 from __future__ import division from __future__ import print_function from __future__ ...