sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
809fea853828ca08c82cded6e9e00f5a7e029c91bb848b1a3f4b6feeb03cc384
Python
825
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
510e72e596341e48e4668b387583fe38ff50944000baa87bc91e8f22aed08e80
Python
828
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
01de158238f16c719ee8d87c3baae699915afbc34a749e763c00056961a76bce
Python
829
32
# type: ignore try: from snakemake.cli import get_argument_parser, main from snakemake.common import configfile from snakemake.common.configfile import load_configfile except ImportError: import snakemake.io as configfile from snakemake import get_argument_parser, main from snakemake.io import ...
417c0aca968da9ac04a48165c7a047aa081aa7271e814e3dae2c9e4a9bf1af07
Python
829
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
9423bc94ca06ff3e9a0058e8f6f40e8fd4b40630502c14a95916be13b1015204
Python
829
29
from .mask_rcnn_R_50_FPN_100ep_LSJ import ( dataloader, lr_multiplier, model, optimizer, train, ) from detectron2.config import LazyCall as L from detectron2.modeling.backbone import RegNet from detectron2.modeling.backbone.regnet import SimpleStem, ResBottleneckBlock # Config source: # https://git...
f1587752becd6119d7a580a448cfabfe77cd3d28231403a7302364b742304a29
Python
829
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
44bf2ecb8f2ad6a5ea8f0bedb96328170308c0ce89c6683cf29d4ca734e56b76
Python
830
22
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
7d92fca35455aee5a4ba0eedecb8aa0fe40beb1fe99868edff6daeff26387742
Python
832
23
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name='lpips', version='0.1.4', author="Richard Zhang", author_email="rizhang@adobe.com", description="LPIPS Similarity metric", long_description=long_description, long_descriptio...
aab0f414d671bbaf31968d0210078011c0b1478e415984abd600086e97ebf427
Python
834
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
7e1dc2c31bba70ec281d9aa593110202c281fb29dc6eb783cb8964afdbc3afd3
Python
835
27
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from .meshes import builtin from .build import ( build_detection_test_loader, build_detection_train_loader, build_combined_loader, build_frame_selector, build_inference_based_loaders, has_inference_based_loaders, BootstrapDat...
b37d7dacf7491fbcab6feaed66cdab5c5b69d1e523c9b98acfb231127acf4563
Python
836
24
# Copyright (c) Facebook, Inc. and its affiliates. from detectron2.utils.registry import Registry PROPOSAL_GENERATOR_REGISTRY = Registry("PROPOSAL_GENERATOR") PROPOSAL_GENERATOR_REGISTRY.__doc__ = """ Registry for proposal generator, which produces object proposals from feature maps. The registered object will be cal...
0030b29cbf48a7a64ab5e3190bfa19d605b30a681e2e55f2f39a4457a10e27f9
Python
837
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
06154382e2f6f0da6495a1eb27d874ae822c91e9ac643c8c58ca7b92e80cd26b
Python
837
37
""" Preprocessing module for imaging data. This module contains functions for image filtering, denoising, and artifact correction. """ # Import main filtering functions from .filters import median, gaussian # Import denoising functions from .denoise import ( radius_to_kernel_size, compute_local_contrast, ...
ddac56ae9f1926f94aabad95db5352763aeb39012e11d96cf3e8c791ec8a0893
Python
838
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
63f011045059a7125e9aefa0fe8b9755340789e8afda90229d0b9584529e4dfb
Python
839
36
from .MAB_parsing import build_MAB_data_from_files from .actions import LookupAction from .args import activation_function_argument, bounded from .command import Subcommand from .parsing import ( build_data_from_files, get_column_names, make_datapoints, make_dataset, parse_activation, parse_indi...
c53044ed870b9481f8d1288badc7e61044524b6371751b221f9feb58e08ff25c
Python
839
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
f680b45a095a2da3c86ed5c688af13f0d49e723ab39a735ce9dc6bc14d1dab44
Python
839
27
import numpy as np import sys x = np.array([0.1, 0.2]) w1 = np.array([[0.15, 0.20], [0.25, 0.3]]) w2 = np.array([[0.4, 0.45], [0.5, 0.55]]) y = np.array([0.2, 0.1]) bias = np.array([0.35, 0.6]) lr = 0.5 iterations = int(sys.argv[1]) if len(sys.argv) > 1 else 1 for iteration in range(iterations): h =...
59dfbc19407ec2467ff23d402e5e02f8f7c0442deb10295aa82ad111e9973d28
Python
840
25
from setuptools import Command, find_packages, setup __lib_name__ = "SPIDER" __lib_version__ = "1.0.1" __description__ = "SPIDER: Spatially Integrated Denoising via Embedding Regularization with Single Cell Supervision" __url__ = "https://github.com/compbiolabucf/SPIDER" __author__ = "MD Istiaq Ansari" __author_email_...
8224c102ee39f54ca0be86e9b5741245daffab88724b688ced82647d8c55091a
Python
840
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
8da30e93886447e323f7e1cd8fcb1a7c439fb29ee66c7be51ff18029ef3e9aeb
Python
840
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
b4ab9c9f5e46c76a963e9490e92c647a36babd6c16feb972f9723becd405bc34
Python
841
22
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
3a0e02036f97fc97ab0db2ea406e3e24ec814e65b90cc23df36cc798970cbc41
Python
843
24
# Python05-2.py # IJ BAR: https://github.com/tferr/Scripts#scripts #################################################### # 5.2 Scripting ImageJ: Creating an empty image (II) #################################################### # Now that we have the documentation opened in our browsers, # It will be easy to create the ...
0cf139dcfc2db2e06d7b95ae909556f31f4ae9e2125d0bd2c2d41a28db543545
Python
846
21
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 ...
ea55eaa4f7bf94455dc34400fdbf5c4c9dd41de228b3765cbd894959c78f824a
Python
847
36
#!/usr/bin/env python # # Copyright (c) 2019 10X Genomics, Inc. All rights reserved. # """Constants related to BAM file generation.""" # Bam tags # NUM_HITS_TAG = "NH" MULTIMAPPER_TAG = "mm" ANTISENSE_TAG = "AN" RAW_BARCODE_TAG = "CR" PROCESSED_BARCODE_TAG = "CB" RAW_BARCODE_QUAL_TAG = "CY" RAW_UMI_TAG = "UR" PROCESS...
db295046b9c52dc2cbe078c3f904a1c62f41076389398dc00eef406ad154d576
Python
848
30
from .mask_rcnn_R_50_FPN_100ep_LSJ import ( dataloader, lr_multiplier, model, optimizer, train, ) from detectron2.config import LazyCall as L from detectron2.modeling.backbone import RegNet from detectron2.modeling.backbone.regnet import SimpleStem, ResBottleneckBlock # Config source: # https://git...
23506c91b74c9c50e80e8bccaefa52b7ce777af394f98ae9e283c3c8a3938dc1
Python
849
30
from functools import partial from detectron2.modeling.backbone.vit import get_vit_lr_decay_rate from .mask_rcnn_vitdet_b_100ep import ( dataloader, lr_multiplier, model, train, optimizer, ) train.init_checkpoint = ( "detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_huge_p14to16.pth?match...
be8731d8cd2d540db4ea02f2194ea3b6be5c001ae6c3b4e78048e6e8da1a7412
Python
849
26
import numpy as np from thunderlab.tabledata import TableData def collect_metadata(models, data): # extract cell names from model table: model_data = TableData(models, sep=',') cells = model_data['cell'] cells = np.unique(cells) # collect corresponding metadata: metadata = TableData() for ...
475d4903d327df9f2e8bfc8d5198ae33ef65c7fe0363fb4a497b59f259d56cec
Python
850
28
import argparse import lpips parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-p0','--path0', type=str, default='./imgs/ex_ref.png') parser.add_argument('-p1','--path1', type=str, default='./imgs/ex_p0.png') parser.add_argument('-v','--version', type=str, de...
8a8369f740edc5b53506810ca72325d6a7cd54d6f6e3cb3d5fac3f91c62c12fa
Python
851
29
import os import nighres from shutil import copyfile import sys tmpdir = sys.argv[1] innerbin = sys.argv[2] outerbin = sys.argv[3] output_coords = sys.argv[4] print("start") nighres_args = {"save_data": True, "output_dir": tmpdir, "overwrite": True} ## convert binarized edges to levelset surfaces levelset_inner = n...
6e031e235c2dff825ca3b85a4e45bf6cee6d91b9bceddc05be0099cb3b18fbf5
Python
852
23
from dataclasses import dataclass, field from rdkit.Chem.rdchem import Atom, Bond from chemprop.featurizers.atom import MultiHotAtomFeaturizer from chemprop.featurizers.base import VectorFeaturizer from chemprop.featurizers.bond import MultiHotBondFeaturizer @dataclass class _MolGraphFeaturizerMixin: atom_featu...
59b7bfab4903cb8f048988a7ea94d99aed96b3328087031801df5618212f4721
Python
853
24
import json import unittest from pathlib import Path REPOSITORY = Path(__file__).resolve().parents[1] class ClassicalModelSelectionConfigTests(unittest.TestCase): def test_all_comparison_models_use_five_fold_grid_search(self): config = json.loads((REPOSITORY / "config" / "analysis_config.json").read_tex...
94aa5b2b2d54c039a4dbddcf671a1fd9bce30a499b927cc059544e9fc7033d71
Python
854
30
import json import jinja2 from jinja2.ext import Extension def toml_string(item: str): """Encode string for inclusion in toml. Technically encodes as json, a (mostly) strict subset of toml, with some encoding fixes """ return json.dumps(item, ensure_ascii=False).replace("\x7f", "\\u007f") def ...
3175c37892d75693222805195aef46a587a84ad35c9f9be8ed93cbfdc2d07a0c
Python
855
32
#!/usr/bin/env python # # Copyright (c) 2014 10X Genomics, Inc. All rights reserved. # """Utils for math operations.""" from __future__ import annotations from collections.abc import Iterable def NX(lengths: Iterable[int], fraction: float) -> int: """Calculates the N50 for a given set of lengths.""" length...
f0b8a153fa2b79b04693903a4250405cd2bade3f810fc1eccdc759684c6f7940
Python
857
25
import trimesh import numpy as np meshes = [ 'avg_template_abdomenct1k_registered/registered_liver.ply', 'avg_template_abdomenct1k_registered/registered_kidney_left.ply', 'avg_template_abdomenct1k_registered/registered_kidney_right.ply', 'avg_template_abdomenct1k_registered/registered_spleen.ply', ...
b127ab26105d730deef9d34ffc32f1779e612d2ab4b28885eaf91bcdc6d395f7
Python
858
25
""" URL configuration for config project. The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home'...
9b48d113e42ab5a25542f12856440000bf42db23e84306734a56383075607959
Python
864
19
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
0e9a5f0d56eee49e5afb55a8a4a17a0c0de3c62e0aba164fa29ce408cfc3f07c
Python
865
19
#!/usr/bin/env python # Copyright 2016-2021 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
50ed4281006ee507e066f49fe8188032a1fff486415e8843c7db6e768cbac5c2
Python
866
20
import click from plugcli.params import Option N_PROTOCOL_REPEATS = Option( "--n-protocol-repeats", type=click.INT, help="Number of independent repeat(s) to be run per execution of a transformation using the ``openfe quickrun`` command.\n\n" "For example:\n\n ``--n-protocol-repeats=3`` means ``openfe ...
592fd4a1040adeb5516b6e49bccb5cfd41c6bc02ac7199c7ab786dd5ab191305
Python
870
29
import os from unittest import mock import pytest from click.testing import CliRunner from openfecli.commands.test import test def mock_func(args): print(os.environ.get("OFE_SLOW_TESTS")) @pytest.mark.parametrize("slow", [True, False]) def test_test(slow): runner = CliRunner() args = ["--long"] if slo...
f739844e4f7833ea28a08f3467c0c24f10e0372dfac7dce2841857c2b6185072
Python
873
31
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from plugcli.params import NOT_PARSED from openfecli.utils import import_thing def import_parameter(import_str: str): """Return object from a qualname, or NOT_PARSED if not valid. ...
27e14d18bd2e133e4a79d80515ac299cd2461dc7841b5e7c755cec44e4465172
Python
874
26
# Copyright (c) Facebook, Inc. and its affiliates. from .batch_norm import FrozenBatchNorm2d, get_norm, NaiveSyncBatchNorm, CycleBatchNormList from .deform_conv import DeformConv, ModulatedDeformConv from .mask_ops import paste_masks_in_image from .nms import batched_nms, batched_nms_rotated, nms, nms_rotated from .roi...
8b61f11c22bbf01ff071ea1af5aa9360f34b7b32e7d264cd7d8a6d59610ff4a6
Python
874
30
""" Backend wrappers for inference engines. This module provides unified interfaces for different neural network backends: - DeepD3: TensorFlow-based spine segmentation - nnU-Net: PyTorch-based semantic segmentation - CSBDeep: CARE denoising for image restoration Each backend runs in an isolated subprocess to avoid d...
3efbfaa61fed9e8f9bbda3c964b089c10ff4ccea93a79c08115e50857d1bc010
Python
879
15
#python diffExprStringify.py "L:\promec\TIMSTOF\LARS\2025\250805_Kamila\DIANNv2p2\report rq.ha..gg_matrix.tsv4118ISNS0.10.50.1BioRemGroups.txt4LFQvsntTestBH.csv" Log2MedianChange PValueMinusLog10 import pandas as pd import numpy as np import sys fileName=sys.argv[1] #fileName="L:\\promec\\TIMSTOF\\LARS\\2025\\250805_K...
c823443c832341b3b7d99b314f5c9bf8356189fb33633afa729b07d69f74d427
Python
880
26
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. from detectron2.config import CfgNode as CN def add_tridentnet_config(cfg): """ Add config for tridentnet. """ _C = cfg _C.MODEL.TRIDENT = CN() # Number of branches for TridentNet. _C.MODEL.TRIDENT.NUM_BRANCH = 3...
abdf0e6216b7c6efaf8feb5de443e3d1904d21247ad55a545340e4b8eb7c1993
Python
881
31
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 1 14:05:26 2022 @author: schmidtfa """ #%% imports from cluster_jobs.head_movement_camcan import MovementJob from plus_slurm import JobCluster, PermuteArgument from os import listdir #% get jobcluster# job_cluster = JobCluster(required_ram='4G', ...
a78b3e9b8d4a32319ce56b10375cf6db4b4fd6bc7c250a8887206a393a05b42e
Python
882
25
# Copyright (c) Facebook, Inc. and its affiliates. import unittest from densepose.structures import normalized_coords_transform class TestStructures(unittest.TestCase): def test_normalized_coords_transform(self): bbox = (32, 24, 288, 216) x0, y0, w, h = bbox xmin, ymin, xmax, ymax = x0, ...
09568555345094b0051b6ecab84e1d5ad9ef7f88ba91cfd79696835af2d52dc9
Python
890
34
import os import sys import anndata as ad import torch # 获取当前脚本的绝对路径 current_dir = os.path.dirname(os.path.abspath(__file__)) # 获取父目录(模型定义脚本)的路径 parent_dir = os.path.dirname(current_dir) if parent_dir not in sys.path: sys.path.append(parent_dir) from config import MethyAnnoConfig from main import * my_config = M...
905ab9a7909078f859665b8a7c1f0fd9a551c5950be2a3cf7ac1c4d5bc1053d7
Python
890
27
import setuptools with open("README.md", "r") as f: long_description = f.read() setuptools.setup( name="garnetff", version="1.0.0", author="Joe G Greener", author_email="jgreener@mrc-lmb.cam.ac.uk", description="Garnet biomolecular force field", long_description=long_description, long_...
4d8e913c6db651bcf83fad63fbb25e4ae62b9abca76aa17b502c766ddfeffc9a
Python
893
27
# Copyright (c) Facebook, Inc. and its affiliates. import torch from detectron2.config import CfgNode from detectron2.solver import LRScheduler from detectron2.solver import build_lr_scheduler as build_d2_lr_scheduler from .lr_scheduler import WarmupPolyLR def build_lr_scheduler(cfg: CfgNode, optimizer: torch.optim...
cf1e2468358d91501c3a0844d45dd51233666e497d9c113dd5d876477f1a54f0
Python
893
40
import argparse import sys from aln_from_csv import aln_from_csv from calc_distances import calc_distances def get_args(): parser = argparse.ArgumentParser() parser.add_argument( "--input-dir", "-d", help="Directory where alignments reside (required).", required=True, ) ...
e0a648d7875ae44c17ffb9af200ab0e1dab263c4f29678075db7a6819a243031
Python
893
22
from typing import List from batchgenerators.transforms.abstract_transforms import AbstractTransform class MaskTransform(AbstractTransform): def __init__(self, apply_to_channels: List[int], mask_idx_in_seg: int = 0, set_outside_to: int = 0, data_key: str = "data", seg_key: str = "seg"): ...
f1854f287caa384a5fc2fd8cfcc206d368163665ea56913f0eed9663d4b517fb
Python
895
26
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. import numpy as np import os from pathlib import Path import tqdm from PIL import Image def convert(input, output): img = np.asarray(Image.open(input)) assert img.dtype == np.uint8 img = img - 1 # 0 (ignore)...
bfd8b39679e5ab18c059dfe97cef2fdab689d7714d1c74f0ae6ec182cf845aa9
Python
896
19
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
807531a4f74c188f9bd0e7f93f6f40a5716cdc84c3507777049539bdb14746a3
Python
901
22
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
89b5b9d1fa222b2c254c214a1480c583222db9c06935ec5acb9edf97a5752c73
Python
901
22
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
f466d1a58bc1a4404c1d8485a733857a3c2730ee46b8ada9e38864ef112c0916
Python
903
31
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from typing import Optional from detectron2.data import DatasetCatalog, MetadataCatalog from ..utils import maybe_prepend_base_path from .dataset_type import DatasetType CHIMPNSEE_DATASET_NAME = "chimpnsee" def register_dataset(datasets_root: Optio...
14fc6960e7764c89a76fe3729dabcbf6e15190bed4edbc9deab1f3f9edeb2ddd
Python
904
31
import torch class CoordStage(object): def __init__(self, n_embed, down_factor): self.n_embed = n_embed self.down_factor = down_factor def eval(self): return self def encode(self, c): """fake vqmodel interface""" assert 0.0 <= c.min() and c.max() <= 1.0 b,c...
e19ee6aaa78037e7d71c6d1d877ca9f3735c5c0129ef6ab5fc51cb59d46d9bb3
Python
907
24
from typing import List import numpy as np def collate_outputs(outputs: List[dict]): """ used to collate default train_step and validation_step outputs. If you want something different then you gotta extend this we expect outputs to be a list of dictionaries where each of the dict has the same set o...
ec10c503b2426f67ae960e13e20f8c064ba42c91d0caba49408cf7cbc16f31bc
Python
911
28
import pytest from typing import Sequence import numpy as np import xarray as xr from hsnn import ops from ._utils import get_data @pytest.mark.parametrize("test_input, expected", get_data('get_submask')) def test_get_submask(test_input: Sequence, expected: Sequence): mask = ops.get_submask(*test_input) ass...
ab3db6dad44eb4e86cfe7f77f44340e43651401975fc46db099e40c0abd18920
Python
914
42
import sys #export import os, argparse, sys, datetime import seaborn from matplotlib import pyplot import numpy, scipy from katmap.utilities import NamedTuple from spliceformats.utilities import IndexedDirectory from katmap.commandline import MakeConfigCommandParser from katmap.mikesmaps import find_rmats_path_by_...
b8e0e91344288bf34549f16df0130e3ecefeaa852cafd9438e99345ce8a40269
Python
914
22
import numpy as np import scipy.io as io from scipy.stats import pearsonr def calculate_p_corr_matrix(data, lines, output_paths): (rows, cols) = np.shape(data) correlation_matrix = np.zeros((cols,cols)) p_value_matrix = np.zeros((cols,cols)) for i in range(cols): for j in range(i+1, cols): ...
4967183c188e6c045a6f2577f58de98922e4e85f6dc76c00929f8b06c6bb0d69
Python
916
34
import argparse from ..models import MODEL_REGISTRY from torchinfo import summary from eeg_visual_classification.utils.lib import ( extract_model_options, ) parser = argparse.ArgumentParser(description="Summarize model") # Model type/options parser.add_argument( "-mt", "--model_type", default="lstm", ...
66b45d629a2cad7c8ca8bba66d403c248c9d7a877bf4fe5bb6140974968ae3b9
Python
917
30
from typing import Any, Callable, Literal, Optional from warnings import deprecated from src.parameters import Parameters from ..value_formatter import ValueFormatter @deprecated("Use SearchSpace instead.") class Parameter[T]: def __init__( self, name: str, values: list[T], label...
a321392cc0ad8e3e0bb51ab7e84ea3a611cc688062f9d268a8ac14e96bf5afd2
Python
918
27
import os import matplotlib.pyplot as plt from nilearn import plotting from tristan_pipeline.io.params import * import nibabel as nib space = "MNI152NLin2009cAsym" for moco_label in list(mocos.keys()): group_img = nib.load(os.path.join(os.path.join(grp_dir,"stats"), f"group_...
5450a897c04b1f7648f3b2943f6ee6ac2fa28a948193d1fbb7999e303bbc8b47
Python
921
23
import pandas as pd from config import COUNTRIES, INPUT_PATH, NON_PREDICTORS, OUTCOME def load_modeling_data() -> tuple[pd.DataFrame, pd.DataFrame, pd.Series]: if not INPUT_PATH.exists(): raise FileNotFoundError( "Required modeling dataset not found: data/CleanedData.csv. " "The p...
2eb6919f6424b2082b48f3f503de496f4bfd47f4c5ed931bfebda3cbf0bc9984
Python
922
33
from typing import Optional import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import CenteredNorm, to_hex def _array_to_hex( array: np.ndarray, palette: str = "viridis", center: Optional[float] = None, ) -> np.ndarray: """ Convert an array of values to a hex color palette. ...
ad799f6c23258c438ebfceb77de4b19ca4337d3119ef446c3e7121a86946f3d5
Python
923
25
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2017 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
d80f06a63a8d78c5b9d63c018b9a9b6242669f8ab90c725a7d92a7240d23ef4e
Python
925
23
from pathlib import Path import json import pandas as pd from sklearn.metrics import accuracy_score, precision_recall_fscore_support ROOT = Path(__file__).resolve().parents[1] pred_path = ROOT / "experiments/predictions/model_predictions.csv" df = pd.read_csv(pred_path) y_true = df["fine_intent"].astype(str) y_pred = ...
ea89aa8c8c8b54b45856931f59ee49b77242e380672e678435388f4a11d6877f
Python
925
28
import sys from pathlib import Path import torch SCRIPTS = Path(__file__).resolve().parents[1] / "scripts" sys.path.insert(0, str(SCRIPTS)) from shap_model import MeanPVEnsemble, PlausibleValueModel def test_plausible_value_wrapper_exposes_each_pv_model_and_preserves_ensemble_mean(): model = MeanPVEnsemble(in...
5a0cfb7f24f9d7b304e4f9f23c91c7cfeb7c840a4127d42b41585d6dee574152
Python
928
28
import pytest import torch from chemprop.nn import ConstrainerFFN @pytest.mark.parametrize("fp_dim", [2, 100, 300, 600]) def test_constrainer_forward(fp_dim): batch = torch.tensor([0, 1, 1, 3, 3, 3]) rows_per_group = torch.bincount(batch) b = len(batch) t = 3 m = batch.max().item() + 1 fp = ...
911b24d6e621bdbddd1d0c21cf8993c285ceac14d8647308889c2a3048c3c4ec
Python
928
27
import jinja2 from jinja2.ext import Extension from snakebids.jinja2_ext.toml_encode import toml_string def format_poetry(item: str): """Format a pip style dependency specification for a poetry pyproject.toml. Only supports urls (prefixed with @) and version specifiers. No markers or extras. The package...
7dd3e4979116958ef479bbcda80823eeaa26edf9cf0e4a81652276f8b862162e
Python
929
24
"""Import torch before RDKit to avoid a Windows DLL clash. MolGpKa (the default protonation backend) needs PyTorch. On Windows, loading torch *after* RDKit/MKL intermittently fails with ``OSError: [WinError 127]`` while loading ``shm.dll`` (an OpenMP/MKL DLL ordering issue). Importing torch first, at process start, ke...
f8436d1e6343d8e9496929fc38b747d45e2ed6b228cc27d2d22a3d58c820dd72
Python
930
24
from pathlib import Path import torch from .utils.pca import PCAHandler if __name__ == "__main__": device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # Parameters LAYERS = ["conv1", "layer1", "layer3", "avgpool"] for layer_name in LAYERS: print(f"Getting gram matrix of {...
29beff3ce0b8b2881012092752255bae0c276a6fb68da9c72643a8e3054ddcf3
Python
934
26
from torch.optim.lr_scheduler import _LRScheduler class PolyLRScheduler(_LRScheduler): def __init__(self, optimizer, initial_lr: float, max_steps: int, exponent: float = 0.9, current_step: int = None): self.optimizer = optimizer self.initial_lr = initial_lr self.max_steps = max_steps ...
d71367f34598c4fb1880cc6a911c352b9c1085d63981eb509d4f7c4c1b2ad6af
Python
935
24
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
d0a29b2dde8465ef982385429d18ed9b3d1afec24ed2702e2476f82c404cf3c2
Python
937
24
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
73be567f0b68152dadddc8e59e6b270849839e5717eea37d3dea26938c1c8b98
Python
943
30
import numpy as np import numpy.typing as npt import pandas as pd __all__ = [ "labels_to_masks", "get_target_ids", "get_unique_id" ] def labels_to_masks(labels: pd.DataFrame) -> dict[tuple[str, np.int64], npt.NDArray[np.bool_]]: if 'image_id' in labels: labels = labels.drop('image_id', axis=1...
ba2bf1264a686bd5ecc320f145bba755e225d3464131fe4584fa3ecc5a70deed
Python
950
25
# Copyright (c) Facebook, Inc. and its affiliates. import unittest try: # Caffe2 used to be included in PyTorch, but since PyTorch 1.10+, # it is not included in pre-built packages. This is a safety BC check from detectron2.config import get_cfg from detectron2.export.c10 import Caffe2RPN from dete...
2b0815d93b5e116904bf6f26aa80bdd71fbaa2315ce5d5bc31f5f1ae3d0c2bec
Python
951
25
# Copyright 2011-2014 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # 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 Licen...
712a91335ef0d87f6e8ecc206729ac46d529f689e6d0a0a0ae974c5ba3e1b992
Python
952
35
import torch from torch.utils.data import Dataset # Splitter class class ValidationOnlySplitter(Dataset): def __init__(self, dataset, split_path, split_num=0): super().__init__() # Set EEG dataset self.dataset = dataset # Load split loaded = torch.load(split_path) ...
2ce2feaf215515bd1b2999c75042066373ad04b1dcf455d8dc64f566ffc9971b
Python
954
36
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from plugcli.params import MultiStrategyGetter, Option from openfecli.parameters.utils import import_parameter def _atommapper_from_openfe_setup(user_input, context): return import_pa...
ec02b34dbf25d76dcb90422d62bb41b33c84bdb4cd6ecc86a8d4c274bfc20d02
Python
956
34
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Run absolute free energy calculations using OpenMM and OpenMMTools. """ from .equil_binding_afe_method import ( AbsoluteBindingComplexUnit, AbsoluteBindingProtocol, Absolute...
f7eb9878a7a69153d96aaa5dadcd7b6727d946b82b2dd28280c5706fc9f60585
Python
956
38
import pickle import subprocess from datetime import datetime def get_git_hash() -> str: """Get git hash as string""" return subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip() def main_timer(func): def function_wrapper(): start_time = datetime.now() print(f'Sta...
5a01551901323d4bc9c8afb0833bb8d1e4642a3225aaa8d85378e9528d7450f1
Python
963
29
# # Copyright (c) 2023 10X Genomics, Inc. All rights reserved. # """Write out the html, depends on websummary.""" from __future__ import annotations from cellranger.websummary.react_components import ReactComponentEncoder, WebSummaryData from websummary import summarize def write_html_file(filename: str | bytes, web...
79d16a521a05c7ec8e3681992bc95cd1733aa1322a3495e6df17aacef94adc15
Python
967
34
# Calculate backbone chemical shifts from a trajectory # Arguments are the protein, the trajectory directory and the number of residues import MDAnalysis as mda import nmrgnn import os import sys protein = sys.argv[1] traj_dir = sys.argv[2] n_res = int(sys.argv[3]) u = mda.Universe( os.path.join("condensed_data"...
56d6c34afd305c2ade04e890939a08d0094547f2432dd2969ef88f2b8fd836bb
Python
968
30
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from detectron2.structures import BitMasks, Instances from densepose.converters import ToMaskConverter class MaskFromDensePoseSampler: """ Produce mask GT from DensePose predictions This sampler simply converts DensePose predictions to Bi...
87ad592600ba931c022eff088c22cb8786be2718115b8d155069be4d1f886385
Python
968
33
from typing import Dict, Tuple, TypeAlias, TypeVar import numpy as np import numpy.typing as npt import pandas as pd __all__ = [ "SpikeEvents", "SpikeTrains", "FiringRates", "Recording", "SpikePatterns", "SynParams", ] SpikeEvents: TypeAlias = Tuple[npt.NDArray[np.int_], npt.NDArray[np.float...
4b584f63da4ae341471c958384fa465a4af7eaf308beb2c17b47540470d8750f
Python
969
29
import numpy as np import numpy.typing as npt __all__ = [ "multiplicative_jitter" ] def multiplicative_jitter( values: npt.ArrayLike, sigma: float, dt: float = 0.1, seed: np.random.Generator | int | None = None ) -> npt.NDArray[np.float64]: """Applies multiplicative jitter according to a provided arr...
42f96102c28264a212fbb121783c54cd434673107f19bcb5e977d75979b0f9f9
Python
970
25
import time from selenium import webdriver options = webdriver.ChromeOptions() options.headless = True driver = webdriver.Chrome("/home/animeshs/bin/chromedriver", options=options) driver.get('https://bluetid-mntnu.bluegarden.net/Kindis/mobil/worktime/clockin'); driver.save_screenshot('screen.png') time.sleep(5) import...
ccc563583304637134bec06c991cdbb8445a9eb0886789e13cdc35e48d2ecc74
Python
971
25
import time from selenium import webdriver options = webdriver.ChromeOptions() options.headless = True driver = webdriver.Chrome("/home/animeshs/bin/chromedriver", options=options) driver.get('https://bluetid-mntnu.bluegarden.net/Kindis/mobil/worktime/clockout'); driver.save_screenshot('screen.png') time.sleep(5) impo...
29e4320826d3197e4b73f827f87a16fa0e7ea773d56e62c21f0e5529ea7216a5
Python
973
36
### By Anoushka Joglekar import sys import pandas as pd import time start_time = time.time() print("Creating Isoform X cell matrix") input_file = sys.argv[1] all_info = [x.strip('\n').split('\t') for x in open(input_file).readlines()][1:] print("Processing file with ",len(all_info)," entries") gene_iso_names = [x...
22843633d3e540970197c9e5f3e1781ac52d17b6cfa7c264337a71c5bf8d5510
Python
974
23
import yaml from pathlib import Path from . import config from .utils.pca import PCAHandler if __name__ == "__main__": # Parameters LAYERS = config["layers"] COMPONENTS = config["selected_components"] for layer_name in LAYERS: print(f"Processing {layer_name}") pca_model_file_top_10 = ...
c0bb60d5b79c602138be3a181a21c97f9ac9eedfc4a03273c307c2ca5064d506
Python
975
38
import logging from collections import OrderedDict from functools import partial, wraps from typing import Dict import click from click.core import Command from .._steinbock import SteinbockException logger = logging.getLogger(__name__.rpartition(".")[0].rpartition(".")[0]) class SteinbockCLIException(SteinbockExc...
e195bc1f5cdfcf723b1a11c15e2539f15d11018bfcf20a758e18badca4b723fb
Python
976
24
from typing import Type from nnunetv2.preprocessing.normalization.default_normalization_schemes import CTNormalization, NoNormalization, \ ZScoreNormalization, RescaleTo01Normalization, RGBTo01Normalization, ImageNormalization channel_name_to_normalization_mapping = { 'ct': CTNormalization, 'nonorm': NoNo...
3bdcfd0bae8ffdfc48114b0901afa9157e19588c53259338d45a11390b457984
Python
977
22
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
dd31d7e3115674f491fb4fbde9da0833121793ca4aeec2c9413cbe73cfc6787e
Python
978
29
"""The JSON audit report is written only when reporting is enabled.""" from __future__ import annotations from pathlib import Path from src.utils.models import RunReport from src.workflow.pipeline import _write_report def test_report_written_when_enabled(tmp_path: Path) -> None: report = RunReport(input_file="...
916f1d2de8e06e75a7b183e25efada57b5b23652095c6249aeecef3858f6485d
Python
979
31
import numpy as np import numpy.typing as npt from typing import Optional from hsnn.analysis._types import RatesArray def update_dict(dst: dict, src: Optional[dict] = None) -> dict: src = {} if src is None else src dst.update(src) return dst def get_bar_data(rates: RatesArray, nrn_id: int, masks: dict)...
a7020ec4df5f8e4898fd20d1ab50e9cccab9af832d9241d9e166094e823a27e2
Python
979
34
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import gufe import pytest from openfe.protocols import openmm_afe @pytest.fixture def benzene_complex_dag(benzene_modifications, T4_protein_component): s = openmm_afe.AbsoluteBindingPr...
80b9db0699c960bd40a3fa75b3ec67cbfa8a0ef5ab66369cd1d76a1d647f72c6
Python
980
38
import os import click from openfecli import OFECommandPlugin @click.command("view-ligand-network", short_help="Visualize a ligand network from a .graphml file.") @click.argument( "ligand-network", type=click.Path(exists=True, readable=True, dir_okay=False, file_okay=True), ) def view_ligand_network(ligand_...
d914aa3ad433d02256b68dba776fff8eee6cdb1d28697caee1aa8bf14c1d4a89
Python
982
32
""" nfml — Machine learning for ferroelectric nematic liquid crystals. Property prediction (GNN and XGBoost) and de novo molecule generation (VAE). Subpackages are imported lazily. ``import nfml`` on its own pulls in nothing heavy, so a pure-XGBoost or pure-VAE workflow never pays for the parts it does not use. Acces...