sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
69336ee3c0595d92132b43c66275b2e24e62e93d8b2dba00482b3927ee810eac | Python | 680 | 15 | import ants
img_4d_file = '/mnt/data/projects/laminar_eeg_fmri/subjectData/S1/1_realignment/ret-mcf2.nii.gz'
ref_file = '/mnt/data/projects/laminar_eeg_fmri/subjectData/S1/1_realignment/realign-ref.nii.gz'
mask_file = '/mnt/data/projects/laminar_eeg_fmri/subjectData/S1/1_realignment/m_ret-ref.nii.gz'
img_4d = ants.i... |
2dd5c6abefd582be2249180412a46a77c7573cc1c1a54301232a4f1e43c0aa76 | Python | 681 | 28 | import setuptools
from glob import glob
from os.path import dirname, join
DIR = (dirname(__file__) or '.')
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="pangolin",
version="1.0.2",
author="Tony Zeng",
author_email="tkyzeng@gmail.com",
... |
843df3ab01c92df6302e0717d7554ea467c6712481b68b4d19ab42262ecf2354 | Python | 681 | 28 |
# Information
__version__ = '1.0.0'
__author__ = 'CBJ'
# Import Core Modules
from .models import FWIMSNet, MultiScale1DCNN, GRUTransformerBlock, count_parameters
from .utils import set_seed, get_fwi_grade, calculate_metrics, print_metrics
# Define Public Interface
__all__ = [
# Model Class
'FWIMSNet',
'M... |
3ba6c0b75be814eb390b7e85f6a1ea1eb4d869819da1315ad4ad1f1ed15d19fa | Python | 683 | 23 | import os
import tempfile
import unittest
from detectron2.utils.events import TensorboardXWriter
# TODO Fix up capitalization
class TestTensorboardXWriter(unittest.TestCase):
def test_no_files_created(self) -> None:
with tempfile.TemporaryDirectory() as tmp_dir:
writer = TensorboardXWriter(tm... |
6fef4b628dc9addc358fd9bef46bdb56e45d9ef596f111f2ef8c1d9c1c0522d3 | Python | 683 | 21 | import os
def create_path(path, full_path=True):
"""
Generate directory if it is not found.
:param path: directory path to file or without destination file
:param full_path: if destination file is not in the path, then full_path=False
:return:
"""
if full_path:
if path and not os.pa... |
dc567590fcaf0e598c86f487f1c5ecfb0f806d14e9e8742cea58c6632303163c | Python | 683 | 18 | from detectron2.model_zoo import get_config
model = get_config("common/models/mask_rcnn_fpn.py").model
model.backbone.bottom_up.freeze_at = 2
model.roi_heads.box_head.conv_norm = model.roi_heads.mask_head.conv_norm = "BN"
# 4conv1fc head
model.roi_heads.box_head.conv_dims = [256, 256, 256, 256]
model.roi_heads.box_h... |
609a14752ce07aa8020669b45afdbab4fb4fd36f8878433a2796b0bf5172df77 | Python | 684 | 23 | from typing import Callable
from ..value_formatter import ValueFormatter
class SearchSpace[T]:
"""
A container to explicitly mark a list of values for a grid search.
"""
def __init__(
self,
label: str,
values: list[T],
value_formatter: Callable[[T], str] = ValueForma... |
5996ffe65292f482e2c5cf4323d22099b832d2fd68d73eeccdc39dde48b4e208 | Python | 688 | 30 | """
Wrappers for some VTK properties.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
from .base import BSVTKObjectWrapper
class BSProperty(BSVTKObjectWrapper):
"""Wrapper for vtkProperty."""
def __init__(self, vtkobject=None, **kwargs):
super().__init__(vtkobject... |
21d8de30a4b002e3bfd63bb836540213ae68fcca4adc5b55e2e33d5cd9126454 | Python | 689 | 25 | #!/usr/bin/env python
#
# Copyright (c) 2018 10X Genomics, Inc. All rights reserved.
#
"""RNA-specific matrix functionality."""
from __future__ import annotations
import cellranger.rna.feature_ref as rna_feature_ref
def save_mex(matrix, base_dir, sw_version: str, compress: bool = True):
"""Save an RNA matrix ... |
853946c8eba45a54c335819690d56e53dfe3baa0f40ef93cb79c225354c9c151 | Python | 689 | 19 | from detectron2.model_zoo import get_config
from torch import nn
model = get_config("common/models/retinanet.py").model
model.backbone.bottom_up.freeze_at = 2
# The head will overwrite string "SyncBN" to use domain-specific BN, so we
# provide a class here to use shared BN in training.
model.head.norm = nn.SyncBatchN... |
c9b1833460fb4fbb78f2f18f19d1ce75b461c7c9446aae0fb571a8c6e745a403 | Python | 689 | 27 | import torch
from torch.utils.data import Dataset
class Memory(Dataset):
def __init__(self, states, actions, log_probs, rewards, advantages, values) -> None:
super().__init__()
self.states = states
self.actions = actions
self.log_probs = log_probs
self.rewards = rewards
... |
dfb39792d65028151216c41445be54952996a75b4190a1c77271d1ebe2cd97a3 | Python | 689 | 26 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import abc
from enum import Enum
from typing import Iterable
from gufe import ChemicalSystem
# Todo: connect to protocols - use this for labels?
class RFEComponentLabels(str, Enum):
P... |
6ee1d06b99b313d6d3457a8949706d40ea9f25b66e0c2295e0d1342ae084fa34 | Python | 691 | 29 | #import tensorflow as tf
import numpy as np
import math
import random
from sklearn import preprocessing
seed=44 # set a seed
np.random.seed(seed)
# load and standardize the data
whole_X=np.loadtxt('chen_X.txt')
whole_Y=np.loadtxt('chen_Y.txt')
whole_X=whole_X.T
whole_X=preprocessing.scale(whole_X)
# permute (shuffle... |
38ddaa7384a63aa771b2060c6bcfbf480968816d9ced3bd46dc001a64b6dc95a | Python | 692 | 18 | import numpy as np
from brian2.units import umetre
from hsnn.core._brian2.groups import helper
def test_get_spatial_coords():
# 2D coordinates
shape = (2, 2)
spatial_span = 100 * umetre
xs, ys = helper.get_spatial_coords(shape, spatial_span=spatial_span)
assert np.array_equal(xs, [0, 50, 0, 50] *... |
d493b324eff1f2ce054492108ca7fe678f4d90c8582f5883119025967cba0e1b | Python | 692 | 19 | from argparse import _StoreAction
from typing import Any, Mapping
def LookupAction(obj: Mapping[str, Any]):
class LookupAction_(_StoreAction):
def __init__(self, option_strings, dest, default=None, choices=None, **kwargs):
if default not in obj.keys() and default is not None:
r... |
4016b6242f78855179134781bd02cad9e843001623e3549f255103fd056de0b6 | Python | 693 | 23 | from abc import abstractmethod
from torch.utils.data import Dataset, ConcatDataset, ChainDataset, IterableDataset
class Txt2ImgIterableBaseDataset(IterableDataset):
'''
Define an interface to make the IterableDatasets for text2img data chainable
'''
def __init__(self, num_records=0, valid_ids=None, si... |
76efb0ab6de1fe8411265f0a734c2dea2b8502f68ddbe41960d797d9a9828ef7 | Python | 693 | 15 | # 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... |
83336d797119dff97969e596d5a584901bf0f999192d88c6d66caf7d2985660d | Python | 697 | 35 | from pathlib import Path
ARCHIVE_ROOT = Path(__file__).resolve().parents[1]
INPUT_PATH = ARCHIVE_ROOT / "data" / "CleanedData.csv"
OUTPUT_DIR = ARCHIVE_ROOT / "outputs"
COUNTRIES = [
"Azerbaijan",
"Belarus",
"Georgia",
"Kazakhstan",
"Kyrgyzstan",
"Moldova",
"Romania",
"Ukraine",
]
OUT... |
e16b385e38ebd9b3c907461b76f516a0260c843da64027d8b216812ed1bb6944 | Python | 697 | 33 | """Model architectures for molecular property prediction and generation."""
from nfml.models.gnn import (
EnhancedModel,
GATModel,
GATPredictor,
GatedGraphModel,
GCNModel,
GINModel,
TransformerModel,
)
from nfml.models.vae import VAE
from nfml.models.config import GNNConfig, VAEConfig, XGBo... |
f94f66bde4687bba8ef7e26f64ab80e85f371497f561c65b3f69d4f6276d9b0a | Python | 698 | 18 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from .chimpnsee import register_dataset as register_chimpnsee_dataset
from .coco import BASE_DATASETS as BASE_COCO_DATASETS
from .coco import DATASETS as COCO_DATASETS
from .coco import register_datasets as register_coco_datasets
from .lvis import DATASE... |
e1cc150e178e77fb7563934807aeeedc662de70440fcc2a3a8b67337288444af | Python | 699 | 19 | import cv2
import os
os.nice(20)
import subprocess
import numpy as np
def generate_plain_image(pixel_value=255, shape=(1000, 500), outfile_name="val_255.png"):
"""Generates a plain image. Useful for figuring out whether a pixel value of 255 means white or 0 means white. (Hint: 255 is whie in png files)
Args:
pixe... |
2c94ec0b01f6ae49c7002ef011496d8744ac7a10b7ecdcabce32fdcfdd728610 | Python | 700 | 20 | from torch.nn import BatchNorm2d
from torch.nn import functional as F
class BatchNormBatchStat(BatchNorm2d):
"""
BN that uses batch stat in inference
"""
def forward(self, input):
if self.training:
return super().forward(input)
return F.batch_norm(input, None, None, self.w... |
a3adb1ab877f95746e24dff9bcceb1c31b880cdf58813be02c520d48a6b4015f | Python | 700 | 28 |
""" Mapping cortex label names and ids. """
__author__ = "Fabi Bongratz"
__email__ = "fabi.bongratz@gmail.com"
from enum import IntEnum
import numpy as np
import torch
class CortexLabels(IntEnum):
right_white_matter = 41
left_white_matter = 2
left_cerebral_cortex = 3
right_cerebral_cortex = 42
def... |
549b33c2108935e5739593bd14d19bc2c5c246bc589a6adab3635482275ef930 | Python | 706 | 25 | from functools import partial
from .mask_rcnn_vitdet_b_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
get_vit_lr_decay_rate,
)
train.init_checkpoint = (
"detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_large.pth?matching_heuristics=True"
)
model.backbone.net.embed... |
48089272883a32133deb5c0aa0b1fa99ac261a8e3d5ab9479bc55158877c4c6a | Python | 707 | 17 | from batchgenerators.utilities.file_and_folder_operations import *
from nnunetv2.batch_running.collect_results_custom_Decathlon import collect_results, summarize
from nnunetv2.paths import nnUNet_results
if __name__ == '__main__':
use_these_trainers = {
'nnUNetTrainer': ('nnUNetPlans', ),
}
all_re... |
71722020ccce895b7f36a85ab72aef3fa32ad3e159b006354a5976cd38cbabb7 | Python | 707 | 28 | import torch
from detectron2.config import LazyCall as L
from detectron2.solver.build import get_default_optimizer_params
SGD = L(torch.optim.SGD)(
params=L(get_default_optimizer_params)(
# params.model is meant to be set to the model object, before instantiating
# the optimizer.
weight_de... |
b8d5906156124154e7c8f30b07f5097f073b34d012ec43199b776927d8a6f169 | Python | 707 | 18 | #!/usr/bin/env python3
"""Copy data/*.json into the MCP server's own data/ directory, so the
delivered mcp/psyp70385-mcp/ folder is self-contained (no path back into
the rest of the repo). Run after build_studies.py or build_metadata.py."""
import shutil
from pathlib import Path
ROOT = Path(__file__).resolve().parents... |
2ae3ffad53c9e84abbd63bd3b5b423267188dfdd7c13ccd477e20d8035ea771b | Python | 709 | 34 | # -*- coding: utf-8 -*-
"""For testing neuromaps.nulls.burt functionality."""
import numpy as np
import pytest
from neuromaps.nulls import burt
def test__make_weight_matrix():
"""Test making a weight matrix."""
rng = np.random.default_rng()
x0 = rng.random((100, 100))
out = burt._make_weight_matrix(... |
000e0ccf5cb083cecb554e1c83fb75295a768e9245cb9d6f0bff29e47f0b7ac3 | Python | 712 | 23 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
from openfe.protocols.restraint_utils.geometry.base import HostGuestRestraintGeometry
def test_hostguest_geometry():
"""
A very basic will it build test.
"""
... |
65b1c7383d208634388e7ab113ebd722a59934f385aaaae9ae180f05928f247e | Python | 713 | 22 | import numpy as np
import nibabel as nib
warp = nib.load(snakemake.input.invwarp[0])
field = warp.get_fdata()
surf = nib.load(snakemake.input.gii)
vertices = surf.get_arrays_from_intent("NIFTI_INTENT_POINTSET")[0].data
# put in same space
# v = np.concatenate((vertices,np.ones((len(vertices),1))),1)
# v = np.matmul(v... |
7f5cceddb94a028944f64074af41dc202d3ecba56e5c08dc7e2022e16ee1d141 | Python | 713 | 15 | from typing import Callable
import nnunetv2
from batchgenerators.utilities.file_and_folder_operations import join
from nnunetv2.utilities.find_class_by_name import recursive_find_python_class
def recursive_find_resampling_fn_by_name(resampling_fn: str) -> Callable:
ret = recursive_find_python_class(join(nnunetv2... |
d2c28095e0e18f2f95ad6dc79d6319ccac9af659fc7ad55ff2f6995501804820 | Python | 713 | 15 | """Underlying modules for event scheduling and time advancement.
This module provides the foundational data structures and classes needed for event-based
simulation in Mesa. The EventList class is a priority queue implementation that maintains
simulation events in chronological order while respecting event priorities.... |
f585a22567cc8e2198e6757497cfddd2217cf868408c44ba46edaf8074335885 | Python | 714 | 25 | from functools import partial
from .cascade_mask_rcnn_vitdet_b_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
get_vit_lr_decay_rate,
)
train.init_checkpoint = (
"detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_large.pth?matching_heuristics=True"
)
model.backbone.n... |
c75aa48dfcc4584dc15f4c8657dfc7e36fca8754a585fa631e6dd52537bbc0fe | Python | 718 | 27 | # Generated by Django 4.2 on 2024-11-18 14:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("abx_app", "0010_alter_user_epsilon_dim_1_plus"),
]
operations = [
migrations.AddField(
model_name="user",
name="max_rep... |
ad00a32a09b971c43fcb1458891000ac11cd247bd8d48c78effc500d4a7d6cd2 | Python | 724 | 35 | # type: ignore
__version__ = "0.0.0"
__submodules__ = ["core", "paths"]
from snakebids import _warningformat # noqa: F401
# isort: split
# <AUTOGEN_INIT>
import lazy_loader
__getattr__, __dir__, __all__ = lazy_loader.attach_stub(__name__, __file__)
__all__ = [
"OPTIONAL_WILDCARD",
"BidsComponent",
"Bi... |
68b34dffc09d7fe43fc5abc64be7929525e481bb4190da6f436f235d9b73cfd9 | Python | 728 | 21 | from gufe import ChemicalSystem
from openfe.setup.chemicalsystem_generator import RFEComponentLabels
# Boolean Test logic lambdas:
def ligandC_in_chem_sys(chemical_system: ChemicalSystem) -> bool:
return RFEComponentLabels.LIGAND in chemical_system.components
def solventC_in_chem_sys(chemical_system: ChemicalS... |
eb79004e958479667db87511a129055729984a074fe711136ad3fa6706022c99 | Python | 728 | 25 | import click
from openfecli.plugins import OFECommandPlugin
@click.command("fake")
def fake():
pass # -no-cov- a fake placeholder click subcommand
class TestOFECommandPlugin:
def setup_method(self):
self.plugin = OFECommandPlugin(
command=fake,
section="Some Section",
... |
3bacd9212a24335988c921bcdcb2ebcec6906855c03c32847eb178c60e3b1aca | Python | 730 | 14 | import os, zipfile
for filename in [('./NLA_GUI.mlapp', './NLA_GUI_exported.m'), ('./NLAResult.mlapp', './NLAResult_exported.m'), ('./+nla/+net/+result/+plot/NetworkTestPlotApp.mlapp', './+nla/+net/+result/+plot/NetworkTestPlotApp_exported.m')]:
with zipfile.ZipFile(filename[0]) as zip_object:
zip_object.e... |
6e957eb4ba4d4fa309d630e0ef3fe3f9818fc6ae656eff009a5c868e6de91f39 | Python | 730 | 13 | #
# Copyright (c) 2022 10X Genomics, Inc. All rights reserved.
#
"""Constant values used by some code (e.g. websummary) that doesn't need the rest of the infrastructure imported."""
import cellranger.analysis.constants as analysis_constants
MULTIPLETS_FACTOR_NAME = analysis_constants.GEM_CLASS_MULTIPLET.decode()
UNASS... |
c85a07b558a30b193f5dd618487a3b22bae272eaa55ed50d3f108a3ecd3fd7c3 | Python | 730 | 24 | from .cascade_mask_rcnn_mvitv2_b_in21k_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
model.backbone.bottom_up.embed_dim = 144
model.backbone.bottom_up.depth = 48
model.backbone.bottom_up.num_heads = 2
model.backbone.bottom_up.last_block_indexes = (1, 7, 43, 47)
model.backbone... |
2a2cd6a73cd6d7b9baa5939c7a1faed32bbd34e3282df53dd1dee9f07b9b2e8e | Python | 734 | 24 | from setuptools import setup, find_packages
setup(
name='rCPGswCPG',
version='0.1.0',
author='Pavel Tolmachev',
author_email='betadecay1993@gmaill.com',
description='A package for modeling rCPG and swCPG interactions.',
long_description_content_type='text/markdown',
url='https://github.com/... |
4ad0fc2b6513e20043ea4164b6984c3df27a319be1d8a7cdd35f01e9f6932cf4 | Python | 736 | 18 | # Copyright 2016 - 2025 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 Lic... |
420a84b24ce5f3f48e01c9f3535f21aca6dc0b1e00b6281783c4e9a71504772f | Python | 737 | 34 | from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Dict, Type
from brian2 import Equations
from ..codeblock import CodeBlock
__all__ = ["PlasticityRule", "plasticity_registry"]
plasticity_registry: Dict[str, Type[PlasticityRule]] = {}
class PlasticityRule(ABC):
def __in... |
34d679db9c847d69e1f60215203d8ea2400a4c656ec6fea89725216cfdcb868d | Python | 740 | 34 | """
Module: utils.py
Description:
- Utility functions for logging and visualization.
"""
import sys
import matplotlib.pyplot as plt
class Tee:
"""
Duplicate stdout to file-like objects.
"""
def __init__(self, *files):
self.files = files
def write(self, data):
for f in self.files:... |
b38bb1980661a27dee4dc070f179c94a251446d4511b7c2555d112083d817fb3 | Python | 740 | 17 | # 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... |
2ec7bde8d1211120ce6aa1da31d95c9af5a265e40de6f6bd9037e9e770b0466c | Python | 747 | 26 | 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_large.pth?matching_heu... |
198eaf5ad9d0bd702aad9e0ae12cac1b89d3778c0e1af357a4486c2d7476c910 | Python | 750 | 20 | from django.urls import path
from . import views
urlpatterns = [
path("", views.login_view, name="login"),
path("home/", views.home_view, name="home"),
path("signup/", views.signup_view, name="signup_view"),
path("monitor/", views.monitor_view, name="monitor"),
path("introduction/", views.introduc... |
f3caddb25f52fa275ba7136899336daf80dfa63cc16417e343c8f9a488c6cdb5 | Python | 753 | 23 | from pathlib import Path
from category_standardization import standardize_category_columns
from data_support import build_analytic_cohort, read_original_data
ARCHIVE_ROOT = Path(__file__).resolve().parents[1]
INPUT_PATH = ARCHIVE_ROOT / "data" / "OriginalData.csv"
OUTPUT_PATH = ARCHIVE_ROOT / "data" / "CleanedData.c... |
3cd1e617abe4be8c422e5d1ac6cbe8c3c1754bf1d320de18e6f3d233844997a4 | Python | 754 | 24 | from importlib import resources
from gufe import ProteinComponent
from rdkit import Chem
from openfecli.parameters.protein import get_molecule
def test_get_protein_pdb():
with resources.as_file(resources.files("gufe.tests.data")) as d:
filename = str(d / "181l.pdb")
protein_comp = get_molecule(f... |
1d06b05eb8c77cf0a2a4a22affaa8e0f9a5e20a9034708dfd9f78c6f7586391f | Python | 755 | 33 | from brian2 import Equations
from ._base import PlasticityRule
from ..codeblock import CodeBlock
__all__ = ["STDPRule"]
class STDPRule(PlasticityRule):
_model = Equations('''
dC/dt = -C/tau_C : 1 (event-driven)
dD/dt = -D/tau_D : 1 (event-driven)
''')
_on_pre = CodeBlock('''
C = clip(C + alp... |
8e47b2f0fa462fe47d70aad6a6d4ea582535a4df5c2e0e1a04e09b55d5269f3b | Python | 755 | 18 | """Experimental features package for Mesa.
This package contains modules that are under active development and testing. These
features are provided to allow early access and feedback from the Mesa community, but
their APIs may change between releases without following semantic versioning.
Current experimental modules... |
9e5afecff47727cf62fecfe297c0160ab02a73d55387e72468ee8f1c8d50f286 | Python | 755 | 19 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from .chart import DensePoseChartPredictorOutput
from .chart_confidence import decorate_predictor_output_class_with_confidences
from .cse_confidence import decorate_cse_predictor_output_class_with_confidences
from .chart_result import (
DensePoseCha... |
658949f2e54f29ace29a3e546dc432c30d908281b14c5c75897db5b0d9919cc0 | Python | 758 | 29 | from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QVBoxLayout, QWidget
import sys
import numpy as np
from screens.analysis_screen import AnalysisScreen
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.window = None
self.button = QPushButto... |
73abb03530da888f443628c57aa253c4a49d0f19c5627e17f5c6facd65f66605 | Python | 758 | 27 | """Configuration for in-package doctests.
Should be importable (but not useful)
without development dependencies.
Where these files up and when they are deleted is documented
[here](https://pytest.org/en/stable/tmpdir.html#the-default-base-temporary-directory).
"""
from pathlib import Path
try:
import pytest
... |
8fe5d352bddf0b336119c0957cd0736fbc95d0b2c4e9f12b185bd70be6931832 | Python | 760 | 17 | #ln -s /mnt/promec-ns9036k/NORSTORE_OSL_DISK/NS9036K/promec/Data /mnt/promec-ns9036k/Data #server
#module load git/2.42.0-GCCcore-13.2.0
#module load Python/3.11.5-GCCcore-13.2.0
#python3 -m pip install minio
#ln -s /nird/projects/NS9036K/NORSTORE_OSL_DISK/NS9036K/promec/Data $HOME/.
#python3 scripts/shareLink.py 123s... |
5f91c7c41eb629d9ddc7535d0b18813424fc77267ab61437c2dbde944e21becb | Python | 764 | 23 | import numpy as np
from sklearn.metrics import (auc, accuracy_score, precision_score, recall_score, f1_score, matthews_corrcoef,
precision_recall_curve, roc_curve, roc_auc_score)
import torch
import random
torch.manual_seed(123)
random.seed(123)
def get_metric(y_true, y_pred, y_prob):
... |
63189ff150c112466279e0074eafe29b654f6f0fa118f83685c17e5b7d226e63 | Python | 764 | 19 | import nest
import nest.topology as tp
import math
import pylab
l=tp.CreateLayer({'rows':21,'columns':21,'elements':'iaf_neuron'})
conndict={'connection_type':'divergent','mask':{'circular':{'radius':0.4}},'kernel':{'gaussian':{'p_center':1.0,'sigma':0.15}}}
tp.ConnectLayers(l,l,conndict)
fig=tp.PlotLayer(l,nodesize=8... |
817151dc676bf75dfffe3630b42dacc646245c3ed80b2bd7c1d61f3a59ad59ef | Python | 766 | 17 | # 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... |
f9af4c263fea1c8f04e0cb11514b8d33aeb93493bc1b3acce3484e170f012cfd | Python | 767 | 26 | import nest
import numpy as np
#from NeuroTools import signals
import matplotlib.pyplot as plt
nest.ResetKernel()
nest.SetKernelStatus({"resolution":.01})
nest.SetKernelStatus({"overwrite_files":True})
hhneurons=nest.Create("hh_cond_exp_traub",n=20)
for k in range(20):
nest.SetStatus([hhneurons[k]],{"I_e": k*200.})
p... |
7555e44904acd84d0dc2a51f09e718ee655f7e72c639972d4b6cfdeed7848a46 | Python | 768 | 29 | # Copyright (c) Facebook, Inc. and its affiliates.
from .box_head import ROI_BOX_HEAD_REGISTRY, build_box_head, FastRCNNConvFCHead
from .keypoint_head import (
ROI_KEYPOINT_HEAD_REGISTRY,
build_keypoint_head,
BaseKeypointRCNNHead,
KRCNNConvDeconvUpsampleHead,
)
from .mask_head import (
ROI_MASK_HEAD... |
da02095c45c225de0445f3eb4b570c2ae9814a1a0848425535a570c4443780cf | Python | 769 | 27 | #%% imports
import sys
sys.path.append('/mnt/obob/staff/fschmidt/neurogram/cluster_jobs')
from cluster_jobs.cam_can_single_channel_slopes import SlopesAcross
from plus_slurm import JobCluster, PermuteArgument
#% get jobcluster
job_cluster = JobCluster(required_ram='2G',
request_time=600,
... |
5bd3196989605380d53bed8ddbca69fef330de2d3d631c27b626ae0290bb4bbe | Python | 772 | 33 | ALGORITHMS = ["lr", "nn", "xgb"]
ALGORITHM_LABELS = {
"lr": "Logistic Regression",
"nn": "Neural Network",
"xgb": "XGBoost",
}
METRICS = ["AUROC", "AUPRC"]
COUNTRIES = [
"Azerbaijan",
"Belarus",
"Georgia",
"Kazakhstan",
"Kyrgyzstan",
"Moldova",
"Romania",
"Ukraine",
]
SETTING... |
b56678124e8f84ce4806ec66abcfb81b55d17cb0e094c5b7ab6496f43738574a | Python | 773 | 30 | import sys
import numpy as np
from pyspark import SparkConf, SparkContext
conf = SparkConf()
#conf.setMaster("local")
conf.setAppName("spark-mz-distrib")
#conf.set("spark.executor.memory", "32g")
sc = SparkContext(conf = conf)
def parseVector(line):
return np.array([float(x) for x in line.split(' ')])
#fl="/dat... |
c8afa043a08672e397df70f6466f2cb1bf2fbdf78e07c5fc46e01ab279fccd9a | Python | 773 | 17 | import torch
import torch.nn as nn
class CompactTextCNN(nn.Module):
def __init__(self, vocab_size, num_labels=42, embed_dim=48,
kernel_sizes=(2,3,4), filters_per_kernel=48, dropout=0.35):
super().__init__()
self.embedding = nn.Embedding(vocab_size, embed_dim, padding_idx=0)
... |
8f92d5bec2f4db215e52fde9be4f70c864392072d80cb718489f937b66e0ea85 | Python | 774 | 36 | import numpy as np
a = np.load('056_500probs_test.npy')
b = a[:, :, 1]
c = a[:, :, 2]
d = a[:, :, 3]
probs = b+c+d
probs = np.reshape(probs, (56,5852))
edges_train= probs/56
results=np.zeros((5852))
for i in range(56):
results=results+edges_train[i,:]
index=results<(0.5)
results[index]= 0
genes=406
edges_resu... |
bd23ba93c6925edeb7f7329a4268c213adb927c3f960a71a94a3d3e313bf5e0a | Python | 775 | 22 | import sys
from pathlib import Path
import pandas as pd
SCRIPTS = Path(__file__).resolve().parents[1] / "scripts"
sys.path.insert(0, str(SCRIPTS))
from compare_xgboost_gabpnn_shap import compare_split
def test_compare_split_reports_ranking_and_top_k_agreement():
gabpnn = pd.DataFrame({"importance": [5.0, 3.0,... |
2ea092fd494b114c15ae793dbf3f8b70ca65fc1bc13d450142955c77b7945324 | Python | 777 | 23 | import torch.nn as nn
from .SleepingPower import Model as VisualProcessor
from .NeuroStream import Model as ScalpReader
class Model(nn.Module):
def __init__(self, n_classes=40):
super().__init__()
self.visualProcessor = VisualProcessor(features_only=True)
self.ScalpReader = ScalpReader(fe... |
bb9e6d7ea4a343be5fd1b22c8ad6428512b8c55b368317d1e40ce9acebba154e | Python | 778 | 24 | # Check whether config.d folder contains WORC config: else copy
import os
import shutil
fastr_home = os.path.expanduser(os.path.join('~', '.fastr', 'config.d'))
if not os.path.exists(fastr_home):
os.makedirs(fastr_home)
destination = os.path.join(fastr_home, 'WORC_config.py')
if not os.path.exists(destination):
... |
28df40b6ffed0a3e1850985aa11b58e002b3720473d371a1107294ecf1877a52 | Python | 779 | 26 | import numpy as np
import math
def calculate_SNR(signal, noise):
return 10 * math.log10(np.mean(np.square(signal))/np.mean(np.square(noise)))
def snr_to_noise(snr_aim, signal, pres=0.5):
noise_std = snr_to_std(snr_aim, signal)
noise = np.random.normal(0, noise_std, size=len(signal))
snr_true = calc... |
3331d50dcae55009b0e124d2f2112d8544bebd7724e9670babf453461e5e0464 | Python | 780 | 30 | # AUTOGENERATED! DO NOT EDIT! File to edit: 05_coverage.ipynb (unless otherwise specified).
__all__ = ['infer_read_starts_by_diff']
# Cell
import numpy
import scipy
from matplotlib import pyplot
import seaborn
import pandas as pd
import pyfastx
import pyfaidx
from tqdm import tqdm
import pyBigWig
from ..utilities imp... |
809d40efb7af1da5dab95c1bb26dd34b1e58b199da59a1653156dcfe9ccc4216 | Python | 781 | 17 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from openff.toolkit import GLOBAL_TOOLKIT_REGISTRY, OpenEyeToolkitWrapper
from openfe.utils import without_oechem_backend
def test_remove_oechem():
original_tks = GLOBAL_TOOLKIT_REGIST... |
965065e19fee8f2c37044fa77471e529d54159b186424be9f277a51f213020b3 | Python | 782 | 25 | from .cascade_mask_rcnn_mvitv2_b_in21k_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
model.backbone.bottom_up.embed_dim = 192
model.backbone.bottom_up.depth = 80
model.backbone.bottom_up.num_heads = 3
model.backbone.bottom_up.last_block_indexes = (3, 11, 71, 79)
model.backbon... |
c7a7505859c88766366a44688e26be85469fd4143610309ab24450b9025a73be | Python | 782 | 25 | from os import PathLike
from pathlib import Path
from typing import Generator, Sequence, Tuple, Union
import numpy as np
from skimage.segmentation import expand_labels
from .. import io
def expand_mask(mask: np.ndarray, distance: int) -> np.ndarray:
expanded_mask = expand_labels(mask, distance=distance)
ret... |
814f24fddbc908708873380465e4d6f3ed854f36cd2aacaf30064526c2be04a9 | Python | 783 | 22 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from .data.datasets import builtin # just to register data
from .converters import builtin as builtin_converters # register converters
from .config import (
add_densepose_config,
add_densepose_head_config,
add_hrnet_config,
add_dataset_... |
152d0cf90c8e6de6a6f6acb916891ed8e4959e4f0130c389a3b19f8fc4d0ce9b | Python | 784 | 23 | import numpy as np
def PCp1(X, rmax):
n = X.shape[0]
p = X.shape[1]
PC = np.zeros(rmax+1)
X_C = X - np.mean(X, axis=0)
SX = X_C / np.std(X_C, axis=0, ddof=1)
mXX = SX @ SX.T
for k in range(rmax, -1, -1):
#print('k = {}'.format(k))
if k == 0:
PC[k] = n... |
6574d0f53b4b1a4d876e46b4626c698ff87c5afe5e571d2aae2185562cb8a28e | Python | 784 | 26 | import os
import sys
import navis
import plotly.io as pio
from plotly.io._sg_scraper import plotly_sg_scraper
pio.renderers.default = 'sphinx_gallery'
# pio.renderers.default = "sphinx_gallery_png"
# This makes sure we don't have any ugly progress bars in the examples
navis.config.pbar_hide = True
from mkdocs_galle... |
88f0c77966e9e3d214e994b7afad235d86ad2d53d1cd6a2597acbc52bc009d13 | Python | 785 | 21 | from __future__ import annotations
from pathlib import Path
def test_windows_spec_keeps_qt_runtime_files_next_to_exe() -> None:
spec = Path("packaging/windows/smiles2docking.spec").read_text(encoding="utf-8")
assert "pyinstaller_qt_runtime.py" in spec
assert "packaging\" / \"qt.conf" in spec
assert ... |
05942b0ae66374457403db5d42cd5b46217ea0a711c65310d0e852cd454ef53c | Python | 787 | 24 | import nibabel as nib
import numpy as np
gii = nib.load(snakemake.input.gii)
varr = gii.get_arrays_from_intent("NIFTI_INTENT_POINTSET")[0]
V = varr.data
farr = gii.get_arrays_from_intent("NIFTI_INTENT_TRIANGLE")[0]
F = farr.data
# most nans should be just isolated points, but in case there is an island of nans this w... |
ddd16680b040cd5446b6a0e515b7d1bce2d9e3af2c74e3f41e14607d9ed37211 | Python | 789 | 17 | import requests
#response_html = requests.get("https://www.ncbi.nlm.nih.gov/snp/rs9387478")
print(response_html.text)
#response = requests.get("https://api.ncbi.nlm.nih.gov/variation/v0/beta/refsnp/9387478")
response = requests.get("https://api.ncbi.nlm.nih.gov/variation/v0/beta/refsnp/17879961") #CHEK2 missense
#https... |
40f45b662e26e45f5f969f4fac594f5f1a39b8f1f42a55694cd68428add292b6 | Python | 793 | 22 | import detectron2.data.transforms as T
from detectron2 import model_zoo
from detectron2.config import LazyCall as L
# Data using LSJ
image_size = 1024
dataloader = model_zoo.get_config("common/data/coco.py").dataloader
dataloader.train.mapper.augmentations = [
L(T.RandomFlip)(horizontal=True), # flip first
L(... |
aadd390661e84d658a76f752382eeed894a92672b4457f44abd6b13ba2b6a6a5 | Python | 793 | 29 | """Solara based visualization for Mesa models.
.. note::
SolaraViz is experimental and still in active development in Mesa 3.x. While we attempt to minimize them, there might be API breaking changes in minor releases.
"""
from mesa.visualization.mpl_space_drawing import (
draw_space,
)
from .command_console... |
020e8b9d06ea58cd0f09aab3deb2d680533cf9501181768541646def0fd7b91e | Python | 800 | 27 | from __future__ import annotations
import argparse
import warnings
from collections.abc import Mapping
from typing import Any
from snakebids.types import InputsConfig
def add_dynamic_args(
parser: argparse.ArgumentParser,
parse_args: Mapping[str, Any],
pybids_inputs: InputsConfig,
) -> None:
"""Do n... |
0bf5be618a2bb9bfd23373568a87705b6e78bc4951be9eab57e18ff7214fd8fd | Python | 804 | 26 | import importlib.resources
from unittest import mock
import matplotlib
import pytest
from click.testing import CliRunner
from openfecli.commands.view_ligand_network import view_ligand_network
@pytest.mark.filterwarnings("ignore:.*non-GUI backend")
def test_view_ligand_network():
# smoke test
resource = impo... |
edb508467e55dfa5a6906828fd09e814628f792b0719e43f430111a25a3797c5 | Python | 806 | 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... |
70075900af645ffbd847a8fe638e9fc5e6f45868c544b61b3497359fdeb4ade3 | Python | 809 | 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... |
da93d6c663a5085255bb1018db4bf818befa13a9629655f72a1935a460da5f49 | Python | 810 | 22 | # Copyright 2017-2018 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... |
df10c6641c2a00d23b591e6dafdde6f5798ebcc7e7ff074c24aba11cac3e9f6c | Python | 810 | 22 | # Copyright 2017-2018 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... |
f4b70198712a50793adf7e3f84cfd99abca25266fa5283abc21ad8419ff209a8 | Python | 810 | 23 | import numpy as np
import nibabel as nib
logfile = open(snakemake.log[0], "w")
print(f"start", file=logfile, flush=True)
## first load labelmap and binarize one edge that includes the inner surf and one edge the outer
lbl_nib = nib.load(snakemake.input[0])
lbl = lbl_nib.get_fdata()
print(f"labelmap loaded", file=logf... |
e79c0e9f274cfbe8e4cc14794bd41d19d17b72a225b2389aeddf29072ab10676 | Python | 811 | 21 | # Copyright 2017-2018 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... |
661bb9140a17c39dd9750176e8aa31bf3f0bab79105c3d41d478b978e0808a06 | Python | 812 | 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... |
e87192547a57df07c847164193032cae2b3e9321243f09b5080f7508296d8553 | Python | 814 | 25 | # Copyright (c) Facebook, Inc. and its affiliates.
import torch
from detectron2.utils.logger import _log_api_usage
from detectron2.utils.registry import Registry
META_ARCH_REGISTRY = Registry("META_ARCH") # noqa F401 isort:skip
META_ARCH_REGISTRY.__doc__ = """
Registry for meta-architectures, i.e. the whole model.
... |
4c2fe4e8c158961709aefac3206f1ea3879b57d964ef0e2e02811652953fa86c | Python | 816 | 27 | from setuptools import setup, find_packages
setup(
name='ndreamer',
version='1.0.0',
author='Xiao Xiao',
author_email='xiao.xiao.xx244@yale.edu',
packages=find_packages(),
install_requires=[
'torch',
'scanpy',
'numpy',
'tqdm',
'umap-learn',
... |
677f5115b24e7d1f7e9fa784cfb4aaf6cf155335bca3ad6d1ad29e8927102b12 | Python | 816 | 22 | import torch.nn as nn
import torch.nn.functional as F
class BCELoss(nn.Module):
def forward(self, prediction, target):
loss = F.binary_cross_entropy_with_logits(prediction,target)
return loss, {}
class BCELossWithQuant(nn.Module):
def __init__(self, codebook_weight=1.):
super().__ini... |
f8fd32a6a232946f6f789c7c6f8ff76c1ddf08ab068e5ee792fb60149ee1632b | Python | 820 | 28 | import torch
import torch.nn as nn
class VisualOnlyClassifier(nn.Module):
def __init__(self, in_features=768, out_classes=40):
super(VisualOnlyClassifier, self).__init__()
self.seq = nn.Sequential(
nn.Linear(in_features, 512), nn.Linear(512, out_classes)
)
def forward(self... |
68512f53a73a2c3eabee88ca5a770eecf87309de68aaffa43502f0631a943cd1 | Python | 821 | 36 | #
# Copyright (c) 2024 10X Genomics, Inc. All rights reserved.
#
"""Get JSON to pass into loupe file."""
import csv
import json
from cellranger.cell_typing.common_cell_typing import BARCODE_KEY, COARSE_CELL_TYPES_KEY
__MRO__ = """
stage GET_CLOUPE_CELL_TYPES(
in csv cell_types,
out json cloupe_cas_types,
... |
a4d0cdac27f11e75a056d8aede9ea46db65b5743d194e380f66c0f95cdca6228 | Python | 821 | 17 | # 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... |
3b1a1c64519c3aeb6b179b8ea9074d2239915d6ef01ef7ea19a1c5211b8b8cba | Python | 822 | 24 | from keras.layers import Layer
class PairwiseConnected(Layer):
def __init__(self, **kwargs):
super(PairwiseConnected, self).__init__(**kwargs)
def build(self, input_shape):
assert input_shape[-1] % 2 == 0
self.feat_dim = input_shape[-1] // 2
self.w = self.add_weight(... |
c74b570c104b9e58722361cdd681e96408d9af0d1ea05a78b73672a71cb25754 | Python | 823 | 27 | import argparse
def main(args):
import numpy as np
import json
bias_list = [float(item) for item in args.bias_list.split()]
AA_list = [str(item) for item in args.AA_list.split()]
my_dict = dict(zip(AA_list, bias_list))
with open(args.output_path, 'w') as f:
f.write(json.dumps(my_di... |
5ce12a233936c41dc1e171b43aa838d70447c49b2e0b28cc39ed8f6f3df9dcb2 | Python | 824 | 45 | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 10 12:37:44 2021
@author: youne
"""
import numpy as np
import matplotlib.pyplot as plt
from tabulate import tabulate
import math
fullData = []
strcycleP = []
f = open("cal_Tissue1_ArduinoFD.txt", "r")
for row in f:
fullData.append(row)
x1=0
x2=0
cc=0
... |
5b875902c8f8831d0041ed0827f95e1ad5c5daab11aef62a51ceebb204427edd | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.