sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
978dd81eef4948623838afabafd31277c1acb655cb82fa8c3565ae5fee17f957 | Python | 394 | 8 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
# Transcript terminal-site prediction: polyA/TSS finding & v... |
d50bafd019bec262304aae87514dee99a2d4b6416d4dc9c387c01d997e8e5f83 | Python | 394 | 19 | import pathlib
import click
from plugcli.params import NOT_PARSED, MultiStrategyGetter, Option
def get_file_and_extension(user_input, context):
file = user_input
ext = file.name.split(".")[-1] if file else None
return file, ext
OUTPUT_FILE_AND_EXT = Option(
"-o",
"--output",
help="output fi... |
9ae01d5e8c532916c23a2fcf09261305403d4d42ec535efb86621dd1e30ce7bb | Python | 397 | 17 | # Generated by Django 4.2 on 2024-11-13 12:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("abx_app", "0009_user_epsilon_dim_1_plus"),
]
operations = [
migrations.AlterField(
model_name="user",
name="epsilon_dim... |
45ec323021374c52420ce45d47ab575d27ba8b926b453166876e7a6815bdc51e | Python | 399 | 15 | from packaging import version
def min_torch_version(min_version: str) -> bool:
"""
Returns True when torch's version is at least `min_version`.
"""
try:
import torch
except ImportError:
return False
installed_version = version.parse(torch.__version__.split("+")[0])
min_ve... |
4db8369de8b0271aa0043657f0db2db72d7a0bdc6ce157b39f6cdd70a93d1acb | Python | 400 | 12 | from typing import Iterable
from chemprop.utils import pretty_shape
class InvalidShapeError(ValueError):
def __init__(self, var_name: str, received: Iterable[int], expected: Iterable[int]):
message = (
f"arg '{var_name}' has incorrect shape! "
f"got: `{pretty_shape(received)}`. ex... |
488bb65a2139fc42a2b82529907152e7ffbc9ba234ddea6339a0be504692a083 | Python | 401 | 22 | # -*- coding: utf-8 -*-
"""For testing neuromaps.civet functionality."""
import pytest
@pytest.mark.xfail
def test_read_civet_surf():
"""Test reading a surface."""
assert False
@pytest.mark.xfail
def test_read_surfmap():
"""Test reading a surface map."""
assert False
@pytest.mark.xfail
def test_r... |
542ac0a78f18991a793c2813f569fb9b58de0fab2d62284906aa5ab97bfb3ecc | Python | 401 | 16 | """
Module: metrics.py
Description:
- Regression metrics for model evaluation.
"""
import torch
def r2_score_torch(y_true: torch.Tensor, y_pred: torch.Tensor) -> torch.Tensor:
"""
Compute R² (coefficient of determination) in torch.
"""
ss_res = torch.sum((y_true - y_pred) ** 2)
ss_tot = torch.su... |
a230f4b739c9845352b78410f06149860d5bf646c2fac663c01d440ef453179e | Python | 403 | 18 | # Generated by Django 4.2 on 2025-01-09 12:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0023_user_miss_eye_position'),
]
operations = [
migrations.AddField(
model_name='user',
name='_list_conditi... |
c48fb2d0d6a3d182c9570262a1f0031964512a8a1add7d9ee420b84ef02a22fb | Python | 404 | 17 | # Generated by Django 4.2 on 2024-11-13 12:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("abx_app", "0008_remove_user_epsilon_dim_1_plus"),
]
operations = [
migrations.AddField(
model_name="user",
name="epsilo... |
1c7b524873973916ed01eb83d7669bdbb0cc59c531afef89c1b18cc1a015c80c | Python | 405 | 22 | # -*- coding: utf-8 -*-
"""For testing neuromaps.parcellate functionality."""
import pytest
@pytest.mark.xfail
def test__gifti_to_array():
"""Test converting gifti to array."""
assert False
@pytest.mark.xfail
def test__array_to_gifti():
"""Test converting array to gifti."""
assert False
@pytest.m... |
4fb311d7e3454039de57e7cadfe79f5373ad248ebc8d46968ac06260456d30ce | Python | 406 | 17 | from .components import Upsampling, LatentEncoder,GRULatentEncoder
from .controller import PositionalPIController
from .encoder import ESM2Encoder
from .decoder import RNNDecoder
from .predictor import DropoutPredictor
__all__ = [
"Upsampling",
"LatentEncoder",
"GRULatentEncoder",
"ESM2Encoder",
"... |
e0c9aa33da80f124c08197ebcbd3b8302f77057fbbfd49aadda9443c1effcbb7 | Python | 406 | 18 | # Generated by Django 4.2 on 2025-01-09 12:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0024_user__list_conditions_name_copy'),
]
operations = [
migrations.RenameField(
model_name='user',
old_name='dict_... |
4051f425d0aae02907595fbed3665c85f810d804332c3398ba164adee6b0dc66 | Python | 407 | 13 | import scipy.io
from sklearn.cluster import DBSCAN
data = scipy.io.loadmat('temp_file.mat')
I = data['data_db']
I = I.astype(dtype = 'float32')
epsilon = data['epsilon']
epsilon = epsilon[0][0]
min_points = data['db_points']
min_points = min_points[0][0]
idx = DBSCAN(eps =epsilon, min_samples = min_points).fit... |
31fbd4dfd51d217a775bcb36778e2f7f49dd6ff818e75bf7db5b54b78eea9e48 | Python | 408 | 12 | import csv
import pandas as pd
path = "/data/dadmah/gonwal2/Documents/datasets/Datasets_raw/ALL_pp1_datasplit_csvs/AHEAD_train.csv"
with open(path, mode='r') as file:
csv_reader = csv.reader(file)
for row in csv_reader:
file_path = row[0] # Assuming the full path is in the first column
print(... |
358efbc0e235c8a8d961101d96ec07a8ec7c0d9d0bb9bd5baf8708aeed7e4a72 | Python | 408 | 14 | try:
from stsci.convolve import *
except ImportError:
try:
from scipy.stsci.convolve import *
except ImportError:
msg = \
"""The convolve package is not installed.
It can be downloaded by checking out the latest source from
http://svn.scipy.org/svn/scipy/trunk/Lib/stsci or by downloading an... |
71b3844e151f84a262ad78a44d7e14a58a9c12c34cd309d7a8f4819d8b4275ef | Python | 408 | 24 | # %%
from __future__ import annotations
import os
from dataclasses import dataclass
from mne_bids import BIDSPath
class NODConfig:
def __init__(self, root):
if os.is_dir(root):
self.root = root
else:
raise ValueError('root must be a valid directory')
def _get_info(se... |
16af508897dd43b142791a7a7004f5d6c20c0ab3535a27f9cd9630f49ee07344 | Python | 410 | 11 | from ..common.optim import SGD as optimizer
from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier
from ..common.data.coco import dataloader
from ..common.models.fcos import model
from ..common.train import train
dataloader.train.mapper.use_instance_mask = False
optimizer.lr = 0.01
model.backbone.bottom... |
f74b41f8f0dc28907121aef6706eb3b8503b931ab43a0013248de4b99447c381 | Python | 410 | 20 | # type: ignore
__submodules__ = ["_factory", "_presets", "_config", "_utils"]
# <AUTOGEN_INIT>
import lazy_loader
__getattr__, __dir__, __all__ = lazy_loader.attach_stub(__name__, __file__)
__all__ = [
"OPTIONAL_WILDCARD",
"BidsFlags",
"BidsFunction",
"BidsPathEntitySpec",
"BidsPathSpec",
"Bi... |
6caf7f2c6a5aa20c8897462b9db03e1ad7153bfc7880f41ec12e146c79260a0d | Python | 411 | 16 | import click
from ..._cli.utils import OrderedClickGroup
from .expansion import expand_cmd
from .matching import match_cmd
from .mosaics import mosaics_cmd_group
@click.group(name="utils", cls=OrderedClickGroup, help="Various utilities and tools")
def utils_cmd_group():
pass
utils_cmd_group.add_command(expand_... |
f2b0acd56abb42cee7478f2d67aca353882ecac5e25c8fb02a451c2f1f341642 | Python | 411 | 17 | from torch import nn
from braindecode import models
class Model(nn.Module):
def __init__(self, n_classes=40):
super(Model, self).__init__()
self.core = models.ATCNet(
n_outputs=n_classes,
n_chans=128,
n_times=440,
sfreq=1000,
input_window... |
f5eb5a461a8500b5148ce50eb8d40877fa9e13779849427fa2873334153f9bfb | Python | 411 | 16 | import tensorflow as tf
# Test if there are any GPUs available
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
# Have Tensorflow output where computations are run
tf.debugging.set_log_device_placement(True)
# Create some tensors
a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
b = tf.co... |
01c03275aa6acf6ef180bd168bc44c1c81293c6c067749740e45bc2877e259b2 | Python | 412 | 17 | # Copyright (c) Facebook, Inc. and its affiliates.
from .distributed_sampler import (
InferenceSampler,
RandomSubsetTrainingSampler,
RepeatFactorTrainingSampler,
TrainingSampler,
)
from .grouped_batch_sampler import GroupedBatchSampler
__all__ = [
"GroupedBatchSampler",
"TrainingSampler",
... |
13c2c6159927d2a07245fb9de4863fdd313a798a6c77423d6d4ad55d31f451b0 | Python | 414 | 17 |
""" Combination of raining and subsequent testing. """
__author__ = "Fabi Bongratz"
__email__ = "fabi.bongratz@gmail.com"
from utils.train import training_routine
from utils.test import test_routine
def train_test_routine(hps: dict, resume=False):
""" Run a training and subsequent test routine in one run. """
... |
0c5816a5faf37d0c5f8cce252348a53fd4c6a1150b7221c8216edcfee00624b1 | Python | 415 | 17 | # Generated by Django 4.2 on 2024-11-13 11:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("abx_app", "0006_rename_list_tasks_user_path_next_and_more"),
]
operations = [
migrations.AlterField(
model_name="user",
... |
9b4c5fc1dbfb9ad9e2e30d381a3f2f81575b8abee06d7ce88af6b57a1f50ace4 | Python | 415 | 11 | from ..common.optim import SGD as optimizer
from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier
from ..common.data.coco import dataloader
from ..common.models.retinanet import model
from ..common.train import train
dataloader.train.mapper.use_instance_mask = False
model.backbone.bottom_up.freeze_at = ... |
962a9c7dc75ba78840730ad14e490fd4f7da1310d4d46dd47aeca1aef29b8e25 | Python | 416 | 22 | from torch import Tensor
class DummyCondStage:
def __init__(self, conditional_key):
self.conditional_key = conditional_key
self.train = None
def eval(self):
return self
@staticmethod
def encode(c: Tensor):
return c, None, (None, None, c)
@staticmethod
def dec... |
c62f73b1bc1111b0bc9c3dfe5c8d1a481047bbb2c128b6017ede97da2af17beb | Python | 416 | 10 | import os
from nnunetv2.utilities.default_n_proc_DA import get_allowed_n_proc_DA
default_num_processes = 8 if 'nnUNet_def_n_proc' not in os.environ else int(os.environ['nnUNet_def_n_proc'])
ANISO_THRESHOLD = 3 # determines when a sample is considered anisotropic (3 means that the spacing in the low
# resolution axi... |
405d1478bc33d299da1022fdd2c85117ccd54d6408a7dba62f94dc7c10c26c8c | Python | 417 | 15 | from .cascade_mask_rcnn_swin_b_in21k_50ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
model.backbone.bottom_up.depths = [2, 2, 18, 2]
model.backbone.bottom_up.drop_path_rate = 0.4
model.backbone.bottom_up.embed_dim = 192
model.backbone.bottom_up.num_heads = [6, 12, 24, 48]
trai... |
7ae16b3d9140742c1368c16412428a5a33650423971f95b39e49e13d5381202e | Python | 417 | 17 | from torch import nn
from braindecode import models
class Model(nn.Module):
def __init__(self, n_classes=40):
super(Model, self).__init__()
self.core = models.EEGConformer(
n_outputs=n_classes,
n_chans=128,
n_times=440,
sfreq=1000,
input_... |
8f845c2809d67c7c27f671bb5a9e46d20f40aaa29194167f6c8ae89d213b9f65 | Python | 417 | 8 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
# User-facing conversion utilities shipped with IsoQuant (no... |
71d458663cc6bbdd2b53b9fee735667f19dd4d1f328363dc377919b7346f7c44 | Python | 418 | 18 | # Generated by Django 4.2 on 2024-11-26 11:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0011_user_max_rep_user_num_per_trial_user_path_img_root'),
]
operations = [
migrations.AddField(
model_name='user',
... |
e922219da3b3e8cd8e9f8027055254d9adbf0830138e685d169ccfac8b126fad | Python | 418 | 10 | # https://software.intel.com/en-us/blogs/2016/04/04/unleash-parallel-performance-of-python-programs
import dask, time
import dask.array as da
x = da.random.random((100000, 2000), chunks=(10000, 2000))
t0 = time.time()
q, r = da.linalg.qr(x)
test = da.all(da.isclose(x, q.dot(r)))
assert(test.compute()) # compute(... |
280228ae72474501d5e0fab131c1fca52efc1ff1ff9e069188f74e779f26367c | Python | 419 | 15 | #
# Copyright (c) 2023 10X Genomics, Inc. All rights reserved.
#
"""Hash function with no other dependencies."""
from __future__ import annotations
import hashlib
def compute_hash_of_file(filename, block_size_bytes=2**20):
digest = hashlib.sha1()
with open(filename, "rb") as f:
for chunk in iter(lamb... |
92372dc41ec6be29f7b2fb11bf6a2cef93703888790dcaf73024a3b998f94228 | Python | 421 | 18 | # Generated by Django 4.2 on 2024-12-27 01:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0017_rename_dict_res_responses_user_dict_res_threshold'),
]
operations = [
migrations.AddField(
model_name='user',
... |
bb8493e996c503765a4050a8b85275667db07fcb1f96908a28a508367c80d8e9 | Python | 421 | 23 | from .analysis import (
iEHM_Analysis,
label_panel,
label_all_panels,
remove_ticks,
remove_spines,
remove_all_spines,
change_color_spines,
polish_xticks,
polish_yticks,
)
__all__ = [
"iEHM_Analysis",
"label_panel",
"label_all_panels",
"remove_ticks",
"remove_spin... |
d35961045003920ca758223f6b947b8f68e3249359762526d5818323cfa2d879 | Python | 422 | 14 | from .wrappers.base import (wrap_vtk, unwrap_vtk, wrap_vtk_array,
unwrap_vtk_array, is_vtk, is_wrapper)
from .pipeline import serial_connect, to_data, get_output
__all__ = ['serial_connect',
'to_data',
'get_output',
'wrap_vtk',
'unwrap_vtk',
... |
6a635a23de1894c8abb94721c57d03f5c89ea140637a5090aa203f3cf9a66c76 | Python | 423 | 18 | #!/usr/bin/env python3
from pathlib import Path
from omegaconf import OmegaConf
from hsnn.cluster.tuner import ExperimentRunner
from hsnn.utils import io
def main() -> None:
model_cfg = io.get_local_config()
expt_runner = ExperimentRunner(model_cfg, Path.cwd())
results = expt_runner.run()
OmegaConf.... |
5642d9150dd0f7a0423a7b4138316793e336d5721ccfd948e63eb2df269cafa2 | Python | 424 | 17 | import matplotlib.pyplot as plt
import matplotlib
matplotlib.use("Agg")
import pandas as pd
import seaborn as sns
df = pd.read_table(snakemake.input.tsv)
subjdf = df.drop(columns=["subject", "hemi", "Cyst"]).transpose()
subjdf.columns = ["L", "R"]
sns_plot = sns.lineplot(data=subjdf)
sns_plot.set_title(str(snakema... |
d800874878c0e43f6e4dfd95396b4871931489ac45de25916041ad55d4c46d52 | Python | 425 | 18 | import sys
if sys.version_info < (3, 10):
def __recon_placeholder(*args, **kwargs):
raise RuntimeError(
"mocokit requires Python >= 3.10. Detected Python {}.{}. "
"Please run your code/tests with a Python 3.10+ interpreter.".format(
sys.version_info.major, sys.version_info.minor
)
)
Recon = __recon... |
7269ffb13f5cb9c1e1f8501fa6083149b2ae28ee9fad52f5d9278be5edcf8965 | Python | 427 | 18 | # Generated by Django 4.2 on 2024-12-25 16:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0016_rename_dict_res_threshold_user_dict_all_res_responses_and_more'),
]
operations = [
migrations.RenameField(
model_name='use... |
9a5fe6071c5b4757793407e476b9ff30bb951570dc7a93873dbfdd7a1265136e | Python | 427 | 12 | from .moran import (compute_mem, moran_randomization,
MoranRandomization)
from .spin import spin_permutations, SpinPermutations
from .variogram import SurrogateMaps, SampledSurrogateMaps
__all__ = ['SpinPermutations',
'MoranRandomization',
'compute_mem',
'moran_rand... |
c78da1755ed87c3d012f24cdb1c949537f80b92d248918810d8aa132119748c1 | Python | 427 | 11 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from .mapper import MAPPER
from .misc import N_PROTOCOL_REPEATS, NCORES, OVERWRITE
from .mol import MOL
from .molecules import COFACTORS, MOL_DIR
from .output import OUTPUT_FILE_AND_EXT
from... |
15ad162f31e407e2cdad365f01fe75d25c0324fecdea0f4c2b01be8f2d285988 | Python | 428 | 17 | import logging
import click_log
from ._cli import steinbock_cmd_group
from ._steinbock import logger
# click_log.basic_config(logger=logger)
logger_handler = click_log.ClickHandler()
logger_handler.formatter = logging.Formatter(
fmt="%(asctime)s %(levelname)s %(name)s - %(message)s"
)
logger.handlers = [logger_h... |
1bf98ebe5a3d732e60289d3f11bbd1a5537825b176327749a6897de48ca2a02f | Python | 428 | 18 | # Generated by Django 4.2 on 2024-12-04 15:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0013_remove_user_epsilon_dim_1_plus_remove_user_max_rep_and_more'),
]
operations = [
migrations.AddField(
model_name='u... |
570fe3ad5f06356fc70403ff78963fe6560f4fef7cc86da3f2c67523bb9506e4 | Python | 434 | 13 | """Global configuration variables for chemprop"""
import lightning
from packaging.version import Version
from chemprop.featurizers.molgraph.molecule import SimpleMoleculeMolGraphFeaturizer
DEFAULT_ATOM_FDIM, DEFAULT_BOND_FDIM = SimpleMoleculeMolGraphFeaturizer().shape
DEFAULT_HIDDEN_DIM = 300
LIGHTNING_26_COMPAT_AR... |
18567397203e522b34cd3a1adeee2ac5678ac094c6567276b7b4cc79f11385c0 | Python | 437 | 9 | constants = dict(
imagenet_rgb256_mean=[123.675, 116.28, 103.53],
imagenet_rgb256_std=[58.395, 57.12, 57.375],
imagenet_bgr256_mean=[103.530, 116.280, 123.675],
# When using pre-trained models in Detectron1 or any MSRA models,
# std has been absorbed into its conv1 weights, so the std needs to be se... |
813f19a1fec91ab5cddef6511a8bdf803fcca04403a006f3d5574cac98d1533f | Python | 438 | 17 | import pytest
from openfecli.parameters.output import get_file_and_extension
@pytest.mark.parametrize(
"fname,expected_ext",
[
("foo.bar", "bar"),
("foo.bar.bz", "bz"),
],
)
def test_get_file_and_extension(tmpdir, fname, expected_ext):
with open(tmpdir / fname, mode="w") as file:
... |
82db081c1d63bca449c1183aff51d9380abcfb0c3070be2764da598412deae73 | Python | 438 | 15 | import click
def _normalize_to_hyphen(string):
return string.replace("_", "-")
class HyphenAwareChoice(click.Choice):
def __init__(self, choices, case_sensitive=True):
choices = [_normalize_to_hyphen(choice) for choice in choices]
super().__init__(choices, case_sensitive)
def convert(se... |
d1f0829f67fcc545697a9ae29a32de47045f06fdac9e490425b4e7bd544ca0d1 | Python | 438 | 18 | # Generated by Django 4.2 on 2024-12-31 06:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0021_rename_dict_all_res_responses_user_dict_all_res_actual_value_and_more'),
]
operations = [
migrations.AlterField(
m... |
e9cf308569d827bea3a3353b1ec47b3eeb660109936c7d04c52777e1d7cb8e20 | Python | 438 | 14 | from .base import AtomMessagePassing, BondMessagePassing
from .mol_atom_bond import MABAtomMessagePassing, MABBondMessagePassing
from .multi import MulticomponentMessagePassing
from .proto import MABMessagePassing, MessagePassing
__all__ = [
"MessagePassing",
"MABMessagePassing",
"AtomMessagePassing",
... |
0343393dfa2137248c8cef8f5cb28d671d2ca89d48adc29c59e753ee07aa2a9c | Python | 439 | 9 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
# Read-to-isoform assignment: assigner, read profiles, junct... |
207f9eb31e5918d8d4462f44220040dae4f179267534003bf547102c205659db | Python | 440 | 20 | import click
from ..._cli.utils import OrderedClickGroup
from .external import external_cmd_group
from .imc import imc_cli_available, imc_cmd_group
@click.group(
name="preprocess",
cls=OrderedClickGroup,
help="Extract and preprocess images from raw data",
)
def preprocess_cmd_group():
pass
if imc_c... |
ae3da778cf2e7cab39699cfb4bb1570712a4c9295e915540528cfe97111544ea | Python | 442 | 18 | """
Plotting functions for Spyne - separated from core analysis classes.
This module provides standalone plotting functions that can work with
SpineDataset, RoiSpine, and raw data structures.
Example
-------
>>>> import spyne
>>>> import spyne.plot
>>>> dataset = spyne.ImagingDataset(path/to/imaging_folder)
>>>> spin... |
d04f18beb4fa50ab4964ce2eeb1d65507bef26466cb5280606b9e0503ac31a96 | Python | 444 | 20 | # -*- coding: utf-8 -*-
"""For testing neuromaps.plotting functionality."""
import pytest
@pytest.mark.xfail
def test_plot_surf_template():
"""Test plotting a surface template."""
assert False
def test_register_cmap():
"""Test registering a colormap."""
import matplotlib
from neuromaps import p... |
d6a2de7af44096f7ca5071af18ba9a2e564c7ad9d5a78ca750f416a0fa045048 | Python | 444 | 9 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
# Transcript model construction, split out of the former mon... |
dc7a953274026d17c23107600a8fe6fe4f324846fea9793936031c99ce06b601 | Python | 444 | 13 | from detectron2.data.detection_utils import create_keypoint_hflip_indices
from .coco import dataloader
dataloader.train.dataset.min_keypoints = 1
dataloader.train.dataset.names = "keypoints_coco_2017_train"
dataloader.test.dataset.names = "keypoints_coco_2017_val"
dataloader.train.mapper.update(
use_instance_mas... |
1a6c31a09b77b21f84fe165145939bf883be6136fe859f8c18e43e26b5e4e2b8 | Python | 447 | 15 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from .confidence import DensePoseConfidenceModelConfig, DensePoseUVConfidenceType
from .filter import DensePoseDataFilter
from .inference import densepose_inference
from .utils import initialize_module_params
from .build import (
build_densepose_dat... |
815c0d3e894ef91e97e3cc55f7583efdd2d94bf91bb632bba9bb1f204953f0b0 | Python | 447 | 17 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from . import DensePoseChartConfidencePredictorMixin, DensePoseChartPredictor
from .registry import DENSEPOSE_PREDICTOR_REGISTRY
@DENSEPOSE_PREDICTOR_REGISTRY.register()
class DensePoseChartWithConfidencePredictor(
DensePoseChartConfidencePredicto... |
a4bc1c2a25df254c7e0bddc49fe173f52b7be0313a13e14f9fa2ae0e4e1ad121 | Python | 447 | 19 | from pathlib import Path
from typing import Any, Dict, Mapping
from .interfaces import INetwork
from ._brian2.network import SpatialNet
__all__ = ["create_network"]
_BACKENDS: Dict[str, Any] = {
'brian2': SpatialNet,
}
def create_network(model_cfg: str | Path | Mapping, backend: str = 'brian2') -> INetwork:
... |
d89f051248ff58f3af7e5e9a4456751949d89d08c710f9e4722e0bead890d564 | Python | 448 | 15 | from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
import torch
class nnUNetTrainerNoDeepSupervision(nnUNetTrainer):
def __init__(
self,
plans: dict,
configuration: str,
fold: int,
dataset_json: dict,
device: torch.device = torch.device("cuda"),... |
e4957ceb7510249b5d81e47e8ffa80e6be18d9a2ddc2b690d1071d29ba337815 | Python | 448 | 20 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
Run MD simulation using OpenMM and OpenMMTools.
"""
from .plain_md_methods import (
PlainMDProtocol,
PlainMDProtocolResult,
PlainMDProtocolSettings,
PlainMDProtocolUnit,... |
d09dc2fe7ae29191bc249f6e520256aae89b322ed5f4520652b2ddbe0ca4f0e7 | Python | 449 | 10 | #
# Copyright (c) 2023 10X Genomics, Inc. All rights reserved.
#
"""Small functions that can be used without adding dependencies if they were elsewhere."""
from __future__ import annotations
def get_projection_key(feature_type, n_components):
"""Return the correct tsne/umap key for each feature type and number of... |
da9083b1ca832422ad67f361350b1269b9fb531fa0c02d4bb122bcb23c9e9171 | Python | 449 | 10 | # Copyright (c) Facebook, Inc. and its affiliates.
"""
Model Zoo API for Detectron2: a collection of functions to create common model architectures
listed in `MODEL_ZOO.md <https://github.com/facebookresearch/detectron2/blob/main/MODEL_ZOO.md>`_,
and optionally load their pre-trained weights.
"""
from .model_zoo impor... |
0ebd3ee3cc77c85e0addbb5094eedf8ca296e8c5190325e2c394a0adc290d871 | Python | 451 | 17 | from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
class SignupForm(UserCreationForm):
class Meta:
model = get_user_model()
fields = ["username", "password1", "password2"]
class LoginForm(Authenticati... |
84debd1bec0df4ef1b10d8448d48489b3fb86495e778622769278706036a3edb | Python | 451 | 14 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from plugcli.plugin_management import CommandPlugin
class OFECommandPlugin(CommandPlugin):
def __init__(self, command, section, requires_ofe):
super().__init__(
com... |
13b44dc433ea051485adb5bd32ec863dba51067a4f35aeb7b7d59eae6fe9ed37 | Python | 454 | 10 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from .densepose_uniform import DensePoseUniformSampler
from .densepose_confidence_based import DensePoseConfidenceBasedSampler
from .densepose_cse_uniform import DensePoseCSEUniformSampler
from .densepose_cse_confidence_based import DensePoseCSEConfiden... |
23d22be79f9cc1fd750f4f50f04ca9fc3898724b6606b47c6e5af43fe71c8e95 | Python | 459 | 14 | from __future__ import annotations
APP_NAME = "SMILES2Docking Desktop"
APP_VERSION = "1.3.0"
AUTHOR_NAME = "Adriano Marques Gonçalves"
AUTHOR_AFFILIATION = "Universidade de Araraquara - UNIARA"
AUTHOR_EMAIL = "amgoncalves@uniara.edu.br"
AUTHORS = (
"Adriano Marques Gonçalves (UNIARA)",
"Daniel Grajales Ruiz (U... |
f11c56531f957e43f6b5c55ce589390ddbe5ed9b1fe754aba96ed3820aadbcd8 | Python | 459 | 20 |
""" Handling different architectures """
__author__ = "Fabi Bongratz"
__email__ = "fabi.bongratz@gmail.com"
from utils.utils import ExtendedEnum
from models.vox2cortex import Vox2Cortex
from models.unet_flow import UNetFlow
class ModelHandler(ExtendedEnum):
vox2cortex = Vox2Cortex
unetflow = UNetFlow
... |
32ffce638412c2212d3d31fa22e8eef89e6de6ef26f3604027dc54e64b40f70d | Python | 460 | 20 | # Generated by Django 4.2 on 2024-11-12 12:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("abx_app", "0004_remove_resultsabx_task_name"),
]
operations = [
migrations.RemoveField(
model_name="user",
name="is_first_adjus... |
110b9b8505fcca38520f5398c8be2df427e84d0fbc7c9efc1c7de422c2dd3b09 | Python | 463 | 20 | import mesa
class AllianceAgent(mesa.Agent):
"""
Agent has three attributes power (float), position (float) and level (int)
"""
def __init__(self, model, power, position, level=0):
super().__init__(model)
self.power = power
self.position = position
self.level = level
... |
1b6adfb681d7494bbb630bdbb244a970ee2afd7a5d6210ee52bc1249a2f1fb9a | Python | 463 | 20 | import os
import pytest
from plugcli.params import NOT_PARSED
from openfecli.parameters.utils import import_parameter
@pytest.mark.parametrize(
"import_str,expected",
[
("os.path.exists", os.path.exists),
("os.getcwd", os.getcwd),
("os.foo", NOT_PARSED),
("foo.bar", NOT_PARSE... |
8b04486eff12c3f1032923b993a65b48567c04aab2d4b63992e6dcf1ec1023d7 | Python | 463 | 17 | """入力ニューロンのクラス"""
import numpy as np
class PoissonNeuron:
def __init__(self, N_fire, dt=1e-4, fr=30):
self.N = N_fire
self.fr = fr * dt
self.spike = np.empty(self.N, dtype=np.int8)
def initialize_states(self):
self.spike.fill(0)
... |
eed4d5722f986d6bf29803cbd47c863d2887c567c0186a5d3420954a2fbd0238 | Python | 463 | 17 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from . import DensePoseEmbeddingConfidencePredictorMixin, DensePoseEmbeddingPredictor
from .registry import DENSEPOSE_PREDICTOR_REGISTRY
@DENSEPOSE_PREDICTOR_REGISTRY.register()
class DensePoseEmbeddingWithConfidencePredictor(
DensePoseEmbeddingCo... |
c65590d54d5345fe48317ee40d0158d031bf73caa5b6b4631e35bbedbeabf592 | Python | 466 | 14 | # Copyright (c) Facebook, Inc. and its affiliates.
from fvcore.transforms.transform import Transform, TransformList # order them first
from fvcore.transforms.transform import *
from .transform import *
from .augmentation import *
from .augmentation_impl import *
__all__ = [k for k in globals().keys() if not k.startsw... |
8493056070d92ef4472462c301693c4e1d0d020d0b33746774e6293ace3d1f23 | Python | 469 | 20 | import numpy as np
from hsnn.utils.data import ImageLoader, ImageSet
from hsnn.utils.io import DATA_DIR
_IMAGE_DIR = DATA_DIR / 'n3p2'
def test_imageloader():
image_loader = ImageLoader()
for image_path in _IMAGE_DIR.glob('*.png'):
image = image_loader.load(image_path)
assert isinstance(ima... |
3ca191f71028529faaa9d519d747bf639cb1bbc134dd9e3e288e157611123913 | Python | 473 | 15 | from pathlib import Path
import pytest
from steinbock.segmentation import cellpose
@pytest.mark.skipif(not cellpose.cellpose_available, reason="Cellpose is not available")
class TestCellposeSegmentation:
def test_create_segmentation_stack(self, imc_test_data_steinbock_path: Path):
pass # TODO
@pyt... |
5f8ceb161a6bac21fd605a6c78ef964e01b69fb617f49b42d2e8b4058e96a416 | Python | 475 | 18 | import nibabel as nib
import numpy as np
r = nib.load(snakemake.params.ref)
ref_mask = r.get_fdata()
n = nib.load(snakemake.input.res_mask)
nnunet_rois = n.get_fdata()
nnunet_bin = np.zeros(nnunet_rois.shape)
lbls = snakemake.params.hipp_lbls
for l in lbls:
nnunet_bin[nnunet_rois == l] = 1
dice = np.sum(ref_mask... |
a7d0e085e85a242459c6bac0bacf0647a703b42300dd98db57ab0d90ab7a59e8 | Python | 475 | 19 | # Copyright (c) Facebook, Inc. and its affiliates.
from .launch import *
from .train_loop import *
__all__ = [k for k in globals().keys() if not k.startswith("_")]
# prefer to let hooks and defaults live in separate namespaces (therefore not in __all__)
# but still make them available here
from .hooks import *
from... |
a31baaea2a41143fc38d8314a953d98af9a1d68ebde9807dbfe84113f6432a9b | Python | 476 | 20 | import itertools as it
from collections.abc import Iterable
from typing import TypeVar
T = TypeVar("T")
def drop(n: int, iterable: Iterable[T]) -> Iterable[T]:
"""Return all items of an iterable except the first *n* as a list.
>>> drop(7, range(10))
[7, 8, 9]
If there are fewer than *n* items in th... |
2d4d5af0e043d486f6eccfbc1d20ce5cd9c4bc829a3b754fc54f399a935991f5 | Python | 478 | 17 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import abc
from typing import Iterable
from gufe import AlchemicalNetwork
class AbstractAlchemicalNetworkPlanner(abc.ABC):
"""
this abstract class defines the interface for the al... |
a4c3d71cf6ed33b6b0d2153c2964c7bbe139cd321e73afb79d764216378dc181 | Python | 479 | 25 | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 21 13:52:30 2022
@author: walte
"""
import numpy as np
from get_varying_maps import get_var_map_conf as vmap
import torch
import torchvision
to_pil=torchvision.transforms.ToPILImage()
a = np.ones((448,256,256))
map1 = vmap(a)
map1 = torch.from_numpy(map... |
5179a81ae6a5889e6329457ddec4cf8ef3af8eb280c261bd3e5f4fbd3942b347 | Python | 482 | 18 | import trimesh
import numpy as np
import nibabel.freesurfer.io as fsio
name = "/mnt/nas/Software/Freesurfer70/subjects/fsaverage/surf/rh.sphere"
out_file = "fsaverage/rh_color.npy"
v, f = fsio.read_geometry(name)
v = v / 100
# Cartesian -> angular coordinates
xy = v[:, 0] ** 2 + v[:, 1] ** 2
r = np.sqrt(xy + v[:, 2]... |
adf9f16d2af9acf1c540ad6538a4b386a01e490c94f7fcd66abf1edf9c0063ee | Python | 484 | 18 | """
Hatching (pattern filled polygons) is supported currently on PS
backend only. See the set_patch method in
http://matplotlib.sf.net/matplotlib.patches.html#Patch
for details
"""
import matplotlib
matplotlib.use('PS')
from pylab import figure
fig = figure()
ax = fig.add_subplot(111)
bars = ax.bar(range(1,5), range(... |
e5328977e8751e0f2ef27f9b4ae2c674e0114f1f17005db6f0d78b338f07debf | Python | 485 | 10 | import nibabel as nib
import trimesh
(v, f) = nib.freesurfer.io.read_geometry('lh.white')
trimesh.Trimesh(v, f, process=False).export('lh_white.ply')
(v, f) = nib.freesurfer.io.read_geometry('rh.white')
trimesh.Trimesh(v, f, process=False).export('rh_white.ply')
(v, f) = nib.freesurfer.io.read_geometry('lh.pial')
trime... |
971ada452734492eff688bfc43e01a8eb8fcc1a13a95bf12cb10d6494dc89014 | Python | 487 | 17 | import subprocess
# open the log file for writing
with open(snakemake.log[0], "w") as log_handle:
cmd = [
"3dvolreg",
"-base", f"{snakemake.input.base}[{snakemake.params.base_volume}]",
"-prefix", snakemake.output.img,
snakemake.input.img,
]
# keep a record of the command ... |
5cc8c7491314d0b531f8e5e29bbf1273fb57764531446e31137852e51f0b7813 | Python | 492 | 20 | import logging
from typing import Optional
_LOGGING_FORMAT = '[%(levelname)s] [%(name)s] %(message)s'
__all__ = ["get_logger"]
def get_logger(name: Optional[str] = None) -> logging.Logger:
if logging.getLogger(name).hasHandlers():
return logging.getLogger(name)
formatter = logging.Formatter(_LOGGIN... |
c6dae3455c162499066166703c5ec6cd2d816b23e97cf66ff7c834067263eb3a | Python | 492 | 12 | from .cascade_mask_rcnn_mvitv2_b_3x import model, optimizer, train, lr_multiplier
from .common.coco_loader_lsj import dataloader
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.backb... |
b1e70505d63aa6cd1fac3a69f9c421fa18ccfbd077fcd3cc6c9da2e2305f9a17 | Python | 493 | 16 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from lomap.gufe_bindings.scorers import (
atomic_number_score,
default_lomap_score,
ecr_score,
heterocycles_score,
hybridization_score,
mcsr_score,
mncar_score,
... |
3f8eab9dd55e219c9af84247ce8934295fc014737585f5eaac6fbcbe33e226dd | Python | 494 | 11 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from .chart import DensePoseChartPredictor
from .chart_confidence import DensePoseChartConfidencePredictorMixin
from .chart_with_confidence import DensePoseChartWithConfidencePredictor
from .cse import DensePoseEmbeddingPredictor
from .cse_confidence im... |
c9c0ca355342c39315214be3afa1081a0acf8f6d568c48b651b1ccbabd33550b | Python | 494 | 6 | def CreateDataLoader(datafolder,dataroot='./dataset',dataset_mode='2afc',load_size=64,batch_size=1,serial_batches=True,nThreads=4):
from data.custom_dataset_data_loader import CustomDatasetDataLoader
data_loader = CustomDatasetDataLoader()
# print(data_loader.name())
data_loader.initialize(datafolder,da... |
e02fcc7e01b75422dca0f2a42aa3ac4376d8779a7a5231a39c2f52b3c6a7122c | Python | 496 | 19 | import logging
import sys
DEFAULT_FMT = ("%(asctime)s | %(levelname)s | %(name)s:%(funcName)s "
"| pid=%(process)d | %(message)s")
DEFAULT_DATE = "%Y/%m/%d-%H:%M:%S"
def setup_logging(verbose: bool = False) -> None:
level = logging.INFO if verbose else logging.WARNING
logging.basicConf... |
51622b206852f336b21294ab7fab602e9d94b3059df4ba124fad15530492379d | Python | 500 | 22 | # Generated by Django 4.2 on 2024-12-27 02:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0019_alter_user_is_not_fixate'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='is_not_f... |
4114e9938fa2699799db0071d71b3236e66e2399ca1ca240c93b2e966520e6b4 | Python | 501 | 24 | # type: ignore
__submodules__ = ["filtering", "input_generation", "datasets"]
__ignore__ = ["T_co"]
# <AUTOGEN_INIT>
import lazy_loader
__getattr__, __dir__, __all__ = lazy_loader.attach_stub(__name__, __file__)
__all__ = [
"BidsComponent",
"BidsComponentRow",
"BidsDataset",
"BidsDatasetDict",
... |
70c5a08e1b25d7f665413866a639da75933cdbfb3a54ca5e4e583aa3f3838cb8 | Python | 502 | 25 | import os
import sys
sys.path.insert(0, os.path.abspath("../src")) # adjust if using top-level layout
project = "SplIsoFind"
author = "Lieke Michielsen"
release = "0.1.0"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
"nbsphinx",
"myst_nb",
]
templates_pa... |
6a1f59251cfd8bc0f677a908e250b20c909c9a0e24bc8771c7e56fc858b2982f | Python | 505 | 21 | import click
import pytest
from openfe.setup import LomapAtomMapper
from openfecli.parameters.mapper import get_atommapper
@pytest.mark.parametrize(
"user_input,expected",
[
("LomapAtomMapper", LomapAtomMapper),
("openfe.setup.LomapAtomMapper", LomapAtomMapper),
],
)
def test_get_atommapp... |
750a15229a42f6cd7c6c7c125d97baf92be1e22e444a1be2c2cf52d73f466b56 | Python | 507 | 22 | #! /usr/bin/env python
import nest
import nest.voltage_trace
nest.ResetKernel()
neuron = nest.Create("iaf_neuron")
noise = nest.Create("poisson_generator", 2)
nest.SetStatus(noise, [{"rate": 80000.0}, {"rate": 15000.0}])
voltmeter = nest.Create("voltmeter")
nest.SetStatus(voltmeter, {"withgid": True, "withtime": T... |
a59f9d97ab4aa053b246343ad5336f34aa58374a4908d93f8d2604843e95ccba | Python | 507 | 23 | #!/usr/bin/env python3
#
# Copyright (c) 2016 10x Genomics, Inc. All rights reserved.
"""Parse RunInfo.xml to get flowcell."""
from __future__ import annotations
import sys
import xml.etree.ElementTree
def main(loc):
tree = xml.etree.ElementTree.parse(loc)
# Get flowcell ID and remove cruft from MiSeq IDs... |
8d8ecab0e021490eb6696c797e49a6b52c48ee90434a79b5b054ab8428cbddc1 | Python | 508 | 16 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
from .build import META_ARCH_REGISTRY, build_model # isort:skip
from .panoptic_fpn import PanopticFPN
# import all the meta_arch, so they will be registered
from .rcnn import GeneralizedRCNN, ProposalNetwork
from .dense_detector import Dense... |
32a938610ffe927e6ec9434fa876042b15587c6ca4d849ba097e3d11b32e68c1 | Python | 509 | 12 | from torch import nn
class InitWeights_He(object):
def __init__(self, neg_slope=1e-2):
self.neg_slope = neg_slope
def __call__(self, module):
if isinstance(module, nn.Conv3d) or isinstance(module, nn.Conv2d) or isinstance(module, nn.ConvTranspose2d) or isinstance(module, nn.ConvTranspose3d):
... |
dd2646bb8c0ba13688365c3d1cdc4d4216523484d85a318810f5add2332aaf13 | Python | 514 | 16 | """Helper utilities for CLI tests"""
import traceback
import click
def assert_click_success(result: click.testing.Result): # -no-cov-
"""Pass through error message if a click test fails.
Taken from https://github.com/openpathsampling/openpathsampling-cli/blob/main/paths_cli/commands/pathsampling.py
"""... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.