sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
90257c987d28d73e904cd7c20d0b1283c4ab92b11f937e6950fb141f190b3ea3 | Python | 2,374 | 83 | #!/usr/bin/env python
"""
Read a MAF from stdin and break into several new mafs containing no more than
`chunk_size` columns. The new mafs will be written to `out_dir` along with a
file "intervals.txt" specifying the range covered by each new maf file. A
probability for writing each chunk can optionally be specified, ... |
f15ebca7061fd075c0b7fe9dfc2737387a9009f9d290889ddb2b0500ea70cfb0 | Python | 2,374 | 74 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 4 20:16:53 2017
"""
import numpy as np
import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
import sklearn as sk
import matplotlib.pyplot as plt
def density(chi, colors):
N=len(colors)
C=len(np.unique(colors))
list_cols=np.unique(colo... |
42dc930c68592a08e7d2abbdfdfcea2391ebcb44caa62aa24f6d6595ac7dcf40 | Python | 2,376 | 70 | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
a1fe6c9017037cc396448b7d866e7e118d5e2f66a1ffc58a9de7759cbd83f835 | Python | 2,376 | 90 | #!/usr/bin/env python
import argparse
from pathlib import Path
from typing import Final
import imgviz
import matplotlib.pyplot as plt
import numpy as np
from loguru import logger
def main() -> None:
# json_to_dataset stores the ignore label as 255 in the 8-bit label PNG.
UNLABELED_PNG_VALUE: Final = 255
... |
f6211e3c88395d82f3445519f52b1cd0da0bc26e0e060d647f9a9a6ec6229306 | Python | 2,376 | 81 | """
Tests for `bx.misc.seekbzip2`.
"""
import bz2
import os
import random
from codecs import encode
from bx.misc import seekbzip2
F: str | None = None
T: str | None = None
# F="/Users/james/work/seek-bzip2/test_random.dat.bz2"
# T="/Users/james/cache/hg18/align/multiz28way/chr10.maf.bz2"
# F=/depot/data1/cache/hum... |
229aa57c00c3b67815dff3f68c90b5d5626f692ee89c697355b1808156af9b2e | Python | 2,377 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
2c29006d8e505d15b434340889d90f4a028f0ccb616547464772056d8779707b | Python | 2,377 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
52053eb631e1a810e17f351109e1430918776ae81d46db35d0097e3b5b12f295 | Python | 2,377 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
bde90440f1c779ea620307f3a53000c40d667f697575bbae72f6a3d5a6eea94a | Python | 2,377 | 73 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
de3042e7a8aad26bb5dd6ced4576af1f896300411f1775c944fd953d2f9a6bb3 | Python | 2,377 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
f5f9419d8c6c4413e9e3bfb7e2d793840ca3685923e3356c1988f12bc9b213bb | Python | 2,377 | 90 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
# external inputs
import numpy as np
import nibabel as nb
import imageio as io
def get_movie(file_in, path_output, name_output, coord, axis=0, fps=10,
transpose=True):
"""Get Movie.
This function generates gif of a specific sl... |
f8529f6e88640763643cc99bff713b30054be4563e95be2aad39673040de382c | Python | 2,377 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
1d2274da679ab0517a161b668fe9cd335cbd01fbc314c980937502fa27ba7bc0 | Python | 2,378 | 76 | import os
from parsl.config import Config
from parsl.providers import LocalProvider
from parsl.executors import HighThroughputExecutor
from parsl.launchers import MpiExecLauncher
from chemgraph.hpc_configs.loader import resolve_worker_init
def get_crux_config(
run_dir=None,
max_workers_per_node: int = 16,
... |
5f4b7cba940fe965e61c5993b3b715fe6333c679b28712de72358e7c85283251 | Python | 2,378 | 76 | from psychopy import visual, constants, event, core, gui
import os
import serial
import glob
expInfo = {'movie name': 1, 'port number':''}
dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False,
title='Movie with Motion Detection')
if dlg.OK == False:
core.quit()
moviename = expInfo['movi... |
a66d112d9114309df77ab6a1850cec124a3e8fd7cbdb8c7c9d13588be73196a1 | Python | 2,378 | 82 | # Copyright (C) 2020-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import io
from abc import ABCMeta, abstractmethod
from collections.abc import Callable
from io import BytesIO
from typing import Any, TypeAlias
from cvat.apps.engine.cac... |
109edf2a2f0c25715f65cc1e4e6bef8be25b2568d4cc3fbf3cf6f03d281dc301 | Python | 2,379 | 91 | __version__ = "0.23.0"
import re
import warnings
from dataclasses import dataclass
from typing import Protocol, TextIO
from eir.visualization.style import apply_style
apply_style()
class ShowWarningProtocol(Protocol):
def __call__(
self,
message: Warning | str,
category: type[Warning],
... |
245f1d4c428536cc90d701eb9c860f2f497975ff9d12ab35bb8b3e4e7ef8d0cf | Python | 2,379 | 91 | __version__ = "0.25.0"
import re
import warnings
from dataclasses import dataclass
from typing import Protocol, TextIO
from eir.visualization.style import apply_style
apply_style()
class ShowWarningProtocol(Protocol):
def __call__(
self,
message: Warning | str,
category: type[Warning],
... |
aeab97b45a85bee11cdf78534e4a5176c5083eadae9b0c8432c54a327d085716 | Python | 2,379 | 70 | import json
import re
import subprocess
import tempfile
from pathlib import Path
from typing import Optional
from dti.utils import mri_number_of_frames
from gmri2fem.utils import with_suffix
def topup(dti, topup_b0, outputdir: Path, tmppath: Optional[Path] = None):
if tmppath is None:
tmpdir = tempfile.T... |
723aed7a1a5983686afa1421164eea32e021ab62593d5e3972768d6acfc34e4c | Python | 2,381 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
f274f86d2f5d23c500cbe1c542582d245792992ea7bfa6e4ddf88c2c9a0e01dc | Python | 2,381 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
0ef1b038039232129eaf2d4475358f3fd771c02b588c3ceeebdff361c65df248 | Python | 2,382 | 60 | _base_ = [
'RepLKNet_cascade_mask_rcnn_coco.py',
'../_base_/datasets/coco_instance.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
backbone=dict(
drop_path_rate=0.4,
)
)
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 5... |
82248c029250f15a4a569a5182216c182769225ef4f603428d2b7eec6cddb954 | Python | 2,382 | 70 | from typing import Callable, List, Union
import inspect
class GuiState(object):
def __init__(self) -> None:
self._state_vars = dict()
self._call_backs = dict()
def __getitem__(self, key: str):
return self.get(key)
def get(self, key: str):
return self._state_vars.get(key)
... |
9ac79255b1febd7ec35ded973a080b41e6ae6512980f029de804f229e6a7ad4c | Python | 2,382 | 60 | _base_ = [
'RepLKNet_cascade_mask_rcnn_coco.py',
'../_base_/datasets/coco_instance.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
backbone=dict(
drop_path_rate=0.6,
)
)
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 5... |
b3a9b2386383e459fb4b96f957a5864676aee6e6d7c31977c0edcb540f940e3c | Python | 2,382 | 60 | #!/usr/bin/env python3
# src/utils/generate_regression_preds.py
import sys
from pathlib import Path
import numpy as np
import torch
from sklearn.model_selection import KFold
# ─────────────────────────────────────────────────────────────────────────────
# 1. 计算 PROJECT_ROOT:本文件在 PROJECT_ROOT/src/utils/,向上两级即项目根
PROJ... |
0bdffa5954eb12353189c98f8dc09eb7cb4d45d1b9ea331b95b80dca751650be | Python | 2,383 | 62 | """Resolution control for saved figures.
Every plotting routine hard-codes the resolution it was tuned for — 150 dpi for
network plots, 300 for the dense multi-panel ones. Those are the right numbers
for a figure you are going to look at closely, and the wrong ones for a gallery
of 109 thumbnails: at 96 dpi the same b... |
62fe87c6fc1d635319a1dbfa0cecfc10e9a8c6394dce5ce1ec51e9e0a1ea822b | Python | 2,383 | 72 | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 15 17:48:30 2022
@author: tianj
"""
import nibabel as nib
import sys
import torch
import numpy as np
class DECAMDataSet():
def __init__(self,
inputs: list,
targets: list,
inp... |
d770903a50a812abec8fae13de53316d85573dabc5d69f83868d638cad435c82 | Python | 2,384 | 82 | import h5py
import pathlib
import matplotlib.pyplot as plt
import numpy as np
import sigpy as sp
from matplotlib.patches import Rectangle
import os
DIR = os.path.dirname(os.path.realpath(__file__))
print('> DIR: ', DIR)
# %% read in RGB
fit_files = ['MUSE_DENOISE_fit.h5',
'JETS_fit.h5',
'Z... |
967a9c0762c563b4769e5d2a8a23f3fc4b613949f52b7d5244da1fafe8f362ff | Python | 2,385 | 83 | import arbor as A
from arbor import units as U
import unittest
from .. import fixtures
"""
End to end tests at simulation level.
"""
class DelayRecipe(A.recipe):
"""
Construct a simple network with configurable axonal delay.
"""
def __init__(self, delay):
A.recipe.__init__(self)
sel... |
ba5e42aaa3861b58409eb920c544cb42615f966e502659047269ae5bb6815341 | Python | 2,385 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
361cb2b454a5ccfcee4ac7ff901b76ee517fe11b2752610140982d97bbfba875 | Python | 2,386 | 61 | # Copyright (c) 2022, Kwanhyung Lee, AITRICS. All rights reserved.
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT ... |
5653386dd9274feaf6b8ee7cc5e1c8766ba20a6b9613559cfd3459a92b53b779 | Python | 2,387 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
c62b9038a00c5c3ec4c5a437df7acadc16273e534f496402f9321e3b67d16557 | Python | 2,387 | 78 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 15 18:42:59 2014
@author: eladn
"""
import urllib, csv, sys, re
KEGG_STEP = 10
ABBREV = 'ko'
FIELD_NAME = 'BRITE'
def FromKeggAPI(s):
entry_dict = {}
curr_field = ""
field_map = {}
for line in s.split('\n'):
field = line[0:12].strip()
v... |
34e335daef3172416f391aa3a65efff144164eff44284ad81cd03971729ad247 | Python | 2,388 | 66 | import os
import pandas as pd
import json
# directory of the current script
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
# path to the repository
REPO_DIR = os.path.dirname(SCRIPT_DIR)
CODE_CONTRIBUTIONS_FILE = os.path.join(REPO_DIR, "doc", "code_contributions_record.csv")
ALGORITHMS_FILE = os.path.join(R... |
683308abfd1e601b0c162724d61cf1896963549152efc6061dd760550c58b523 | Python | 2,388 | 73 | from ..qt import *
from ..config import ObservableDict
from .. import thalamus_pb2_grpc
from ..observable_item_models import FlatObservableCollectionModel, TreeObservableCollectionModel, TreeObservableCollectionDelegate
import logging
LOGGER = logging.getLogger(__name__)
class SampleMonitorWidget(QTabWidget):
def ... |
f0a744e09a2a92ffadc1d93ee1ca833c7768f77b3bea3f13824e561dd512053a | Python | 2,388 | 68 | """
Implementation of the null task. Does nothing, mostly used for testing
"""
import datetime
from . import task_context
from . import util
from ..config import *
from .widgets import Form
from .util import do_stimulation
from .. import task_controller_pb2
from ..qt import *
def create_widget(task_config: Observab... |
43d939e328c2474ca5814d332eb26b6ea1222e632df0afca260c293767720999 | Python | 2,389 | 68 | #!/usr/bin/env python3
import argparse
import os
import SimpleITK as sitk
def invert_displacement_h5(
forward_h5: str,
inverse_reference_image: str,
output_h5: str,
subsampling_factor: int = 16,
):
if not os.path.isfile(forward_h5):
raise FileNotFoundError(f"Forward transform not found: {f... |
cb5f345bad786019bec7139b491dd6718f794073a266543ca0529b35374a4d6b | Python | 2,390 | 68 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from pathlib import Path
import numpy as np
import torch
from ultralytics.utils import LOGGER
from ultralytics.utils.checks import check_requirements
from .base import BaseBackend
class NCNNBackend(BaseBackend)... |
331bf6104c38d0df985a8d36112fbf79a8dc09725650796794a768153d23b76a | Python | 2,391 | 94 | # %%
from data_loading import load_dataset_gino
import torch
from deepcardio import Trainer
from deepcardio.losses import LpLoss, H1Loss
import os
use_distributed = "WORLD_SIZE" in os.environ
if use_distributed:
print(f"Running in distributed mode on {int(os.environ["WORLD_SIZE"])} GPU(s).")
import torch.dist... |
5a5874476dd77da4286697c5b82bcc2ba3d8aa38d44f69e18b10e51abf2a98cc | Python | 2,391 | 72 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import requests
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import yaml
from io import BytesIO
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainsco... |
7c08d391b8bede8119bde2a0fa7d5cc4e60cfe0703e6471479631659146484e4 | Python | 2,391 | 73 | from abc import ABC, abstractmethod
from typing import Dict, List, Optional, Union
class DatasetInfo(ABC):
def __init__(self):
pass
@abstractmethod
def num_classes(self):
pass
@abstractmethod
def label_names(self):
pass
@abstractmethod
def label_descriptions(sel... |
0d0f7eefa02598a8ef4800ef36db0d65115f593a65a4c033fb3201698e71d141 | Python | 2,392 | 67 | """
Description:
This script is run after `1_sequence_prediction.py`. It computes the
raw sequence class scores based on Sei chromatin profile predictions
of sequences (i.e. no variants).
Usage:
2_raw_sc_score.py <input-fp> <output-dir>
[--out-name=<out-name>]
2_raw_sc_score.p... |
91161729233ad778275e77575104bc687546e4516d18b23c26b7b9581719779f | Python | 2,392 | 98 | import numpy as np
from scipy.constants import epsilon_0 as e0
from impedancefitter import get_equivalent_circuit_model
from impedancefitter.single_shell import (
eps_cell_single_shell,
single_shell_bh_model,
single_shell_model,
)
from impedancefitter.suspensionmodels import bhcubic_eps_model, eps_sus_MW
... |
91e5b1dd0b71ef34eadfe1968d2dad880a18deca89b77caf1b702021f50dcfb8 | Python | 2,392 | 45 | import os
import shutil
from nipype.interfaces.base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec, BaseInterface, BaseInterfaceInputSpec, File)
from traits.api import Directory, Str, List, Bool, Enum, Int, Float, TraitError
from cvdproc.config.paths import get_package_path
class QSIPrepOrigToACPCInpu... |
9600981335b15e35a66814bac0811962861c225212412be23a20e7e55bd58ca3 | Python | 2,392 | 64 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import asyncio
from pathlib import Path
import torch
from ultralytics.utils import LOGGER
from ultralytics.utils.checks import check_requirements
from .base import BaseBackend
class CoreAIBackend(BaseBackend):
... |
469094bf3512f217c86ff456fe8f6a497bc8397e4f4416c6ae1bf1b33be19ac7 | Python | 2,393 | 64 | import user_features as uf
import csv
import time
import pandas as pd
import json
def get_user_vector(user):
user_vector = {
"user_id": uf.get_user_id(user),
"profile_description": uf.has_description(user),
"profile_location": uf.has_location(user),
"profile_url": uf.has_url(user),... |
bf524aa4039879f30c846ebb2d812fafb65b25ec583189f614c4b44dc088ed70 | Python | 2,393 | 50 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'illumination.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObje... |
d0b0d7ce8bc0c8be200d8d6a3565781b6532170ecd77a711dcc5e86fcaa1d422 | Python | 2,393 | 65 | from brainscore_vision.model_helpers.check_submission import check_models
import functools
import os
from urllib.request import urlretrieve
import torchvision.models
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_prepro... |
32fdf5201213ceac8ce83bb203a8d85c53727546c7566f4abff09c48a8e51c92 | Python | 2,394 | 55 | """ Schemas for viral injections """
import numpy as np
import datajoint as dj
from commons import virus
from . import mice
from .exceptions import PipelineException
schema = dj.schema('pipeline_injection', locals(), create_tables=False)
CURRENT_VERSION = 1
@schema
class Target(dj.Lookup):
definition = """
... |
4bd478e00799a2c6a686fd233acd7e0921b1654df1c4afc688fcbeb074624eb9 | Python | 2,394 | 52 | import logging
from brainscore_core import Score
from brainscore_vision import load_stimulus_set, load_metric
from brainscore_vision.benchmarks import BenchmarkBase
from brainscore_vision.model_interface import BrainModel
BIBTEX = """@inproceedings{DBLP:conf/nips/BarbuMALWGTK19,
author = {Andrei Ba... |
54f4776df7c434097ada4a345f1a45416580c351ca9a61e622b82c34a2270cc2 | Python | 2,394 | 78 | import json
import typing
import pathlib
import logging
from .qt import *
DEFAULT_SETTINGS = {
'crashpad_consent_requested': False,
'crashpad_consent_answer': False,
'dotnet_runtime_warning_suppressed': False
}
SETTINGS_PATH = pathlib.Path.home() / '.thalamus' / 'settings.json'
DOTNET_DOWNLOAD_URL = 'https://... |
04fd975c7d84ce362c898b197720a4aff665158e68fa2c5e3c79e807e155670e | Python | 2,395 | 64 | import user_features as uf
import csv
import time
import pandas as pd
import json
def get_user_vector(user):
user_vector = {
"user_id": uf.get_user_id(user),
"profile_description": uf.has_description(user),
"profile_location": uf.has_location(user),
"profile_url": uf.has_url(user),... |
bd501d4df3e9cae8a3d8f917ed6f2754ee12eb6639c96e047e1368aa6e3abc58 | Python | 2,395 | 98 | import json
from pathlib import Path
from typing import Any
import numpy as np
from neuralib.typing import PathLike
__all__ = ['PixVizResult']
class PixVizResult:
meta: dict[str, Any]
dat: np.ndarray
__slots__ = ('meta', 'dat')
def __init__(self,
dat: Path | str,
... |
dc4beee1404657f2db1fc47ef861f877d52378f957a6896ef9805fe13731c61a | Python | 2,395 | 64 | import user_features as uf
import csv
import time
import pandas as pd
import json
def get_user_vector(user):
user_vector = {
"user_id": uf.get_user_id(user),
"profile_description": uf.has_description(user),
"profile_location": uf.has_location(user),
"profile_url": uf.has_url(user),... |
12fde8db70e84aff5a3c80c4729af500940ece27840e6638b3b21398cfb99f18 | Python | 2,396 | 77 | _base_ = [
'../_base_/models/depthformer_swin.py', '../_base_/datasets/nyu.py',
'../_base_/default_runtime.py'
]
model = dict(
pretrained='https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_large_patch4_window7_224_22k.pth', # noqa
backbone=dict(
embed_dims=192,
de... |
8dd31566d34ccc53fb98c78f8ccc7ebfbc8cb0b8d4c3fa7cbc5f75a9eaca9130 | Python | 2,397 | 61 | import pandas as pd
def auto_adjust_columns_width(writer, sheet, df):
worksheet = writer.sheets[sheet] # pull worksheet object
for idx, col in enumerate(df): # loop through all columns
series = df[col]
max_len = max((
series.astype(str).map(len).max(), # len of largest item
... |
c8a68dd7790b5c3d4ffeb5997434791e4a160acbe6b31f18dc0161bd375e678f | Python | 2,397 | 64 | import user_features as uf
import csv
import time
import pandas as pd
import json
def get_user_vector(user):
user_vector = {
"user_id": uf.get_user_id(user),
"profile_description": uf.has_description(user),
"profile_location": uf.has_location(user),
"profile_url": uf.has_url(user),... |
c8a99f00349568d2e051aede78446b11e483eeb274f5513a7c56d0c9548eca4d | Python | 2,397 | 60 | from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.activations.pytorch import load_images, load_preprocess_images
from brainscore_vision.model_helpers.check_submission import check_models
import ssl
from transformers import MobileNetV2ForImageClassificati... |
dd9453e4e9e5a011952671ef92a808944c18d9d432037286aba05cbdb52ef310 | Python | 2,397 | 78 | """This script provides an example of using custom backbone for training."""
import tensorflow as tf
from deepreg.model.backbone import Backbone
from deepreg.registry import REGISTRY
from deepreg.train import train
@REGISTRY.register_backbone(name="custom_backbone")
class CustomBackbone(Backbone):
"""
A dumm... |
37e1ec9cfa3e908536d29e6f5299b0e620861bcd5791619060004370a4ee2679 | Python | 2,398 | 64 | #!/usr/bin/env python3
"""Record behavioral event markers (text records) in a Thalamus capture file.
Many experiments interleave a continuous analog signal with discrete *event
markers* -- short text labels such as ``trial_start`` or ``reward``. Thalamus
stores these as ``text`` records in the same ``.tha`` file as t... |
c82f5a7224db48969a7390ea4ff546cad8dabb482754996f81a5828e31dfeeff | Python | 2,398 | 58 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
1fce6a18d693af0bb96e5113eda0f73dd0ec841e1f858d62ce9f55f7168871b7 | Python | 2,399 | 86 | import datetime
import os
from matplotlib import pyplot as plt
from matplotlib import rc
from mc_analysis.utils.absolute_paths import FIGURE_PATH
def date_str():
return datetime.datetime.now().strftime("%Y_%m_%d")
def save_fig(fig, save_name, dpi=500, save_folder=FIGURE_PATH):
"""Save a matplotlib figure ... |
77ccd986c028a68ec3cb0ce36b0da46fdd6f4bc313f0f01fd84eb1cd1d527b9e | Python | 2,399 | 65 | """
Registering T1w image in functional EPI space to high-res MP2RAGE UNI.
"""
import os
import subprocess
subs = ['sub-05']
ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti'
for sub in subs:
# Defining folders
funcDir = f'{ROOT}/derivatives/{sub}/func' # Location of functional data
anatDir = f'... |
08ae199ca1822b531cdc3773c4e177d773d4a5eafc57a138e51abaad3aa739e0 | Python | 2,400 | 64 | import user_features as uf
import csv
import time
import pandas as pd
import json
def get_user_vector(user):
user_vector = {
"user_id": uf.get_user_id(user),
"profile_description": uf.has_description(user),
"profile_location": uf.has_location(user),
"profile_url": uf.has_url(user),... |
7450a863a7ee6024ca4673490be89fc443bfa14a64240d646bedd1df62e2a899 | Python | 2,400 | 73 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 12 22:31:38 2023
@author: Artur Klepaczko
"""
import csv
from pathlib import Path
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
df = pd.read_csv('kidney_texture_features_123_NPYv2-pruned.csv', sep=','... |
c199c4a32c61415061f41a70372a7a28a92ee252c3c45d9f898722a5892eb4fd | Python | 2,400 | 63 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
September 2020 by Oliver Gurney-Champion & Misha Kaandorp
oliver.gurney.champion@gmail.com / o.j.gurney-champion@amsterdamumc.nl
https://www.github.com/ochampion
Code is uploaded as part of our publication in MRM (Kaandorp et al. Improved unsupervised physics-informed... |
ce2b21bb6c97f6c16612892ae798f35fb615816a9d2b0917f1b3559c52815513 | Python | 2,400 | 100 | # python2 program, now changed to python3
# edit windowSize, windowOutName, and maskedBed file to proper files
# sorry -- hard coded in
import struct
import array
import sys
import subprocess
import signal
import os
import numpy as np
###############################################################################
# He... |
1df161ce069ec0451c79980386ac5e0e1f72288ac1a9ce50ef5dc004e8c4068d | Python | 2,401 | 55 | #!/usr/bin/env python
import chromatics
import common
import os
import pandas as pd
import sys
from glob import glob
config_fn = sys.argv[1]
cell_line = config_fn.split('/')[0]
config = common.parse_config(config_fn)
os.chdir(os.path.expanduser(config['working_dir']))
peaks_fn = 'peaks.bed.gz'
methylation_fn = 'met... |
2026d5714d0830fde965337eb7eb54250e026019a0a8b98b68fcd51159dd3837 | Python | 2,401 | 67 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Interface for Baidu's RT-DETR, a Vision Transformer-based real-time object detector.
RT-DETR offers real-time performance and high accuracy, excelling in accelerated backends like CUDA with TensorRT.
It features an efficient hybrid encoder and IoU-... |
b98f7309e113797124e00d8dec9d4634b6b5d385d9fed1da7375902afa302fe7 | Python | 2,402 | 48 | from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set
from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3, load_assembly_from_s3
from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly
BIBTEX = """@article{papale_exte... |
ce27c316267fb4e121587a39c7a28092a4c8e32d6edbb3e8a256d17200440587 | Python | 2,402 | 56 | # ==============================================================================================================================
# Author: Lucas Berg
# ==============================================================================================================================
import os
import sys
import numpy as np
i... |
16d272340d1756cda7c47773e49663921b36adcc10e6450eeed9095213537834 | Python | 2,403 | 109 | #!/usr/bin/env python3
# 2017, Georg Sauthoff <mail@gms.tf>, GPLv3
import sys
def skip_comments(lines):
state = 0
for line in lines:
n = len(line)
l = ''
p = 0
while p < n:
if state == 0:
a = line.find('//', p)
b = line.find('/*', p)
if a > -1 and (a < b or b == -1):... |
1820040eac7471924616af921b73427973f1f8c50c89ee5c04a5b3d58dcaa4d9 | Python | 2,403 | 78 | #!/usr/bin/env python
import numpy as np
import pandas as pd
import click as ck
import sys
from collections import deque
import time
import logging
import math
from deepgo.utils import FUNC_DICT, Ontology, NAMESPACES
import os
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
ont = 'mf'
@... |
143e4b1ae83fd99751b3f55a2ba5fd3fc4882ec72bf7f7b99086c1db2da50216 | Python | 2,404 | 72 | import operator
from typing import TypedDict, Annotated, Any, Literal, Optional
from langgraph.graph import add_messages
def merge_dicts(a: dict, b: dict) -> dict:
"""Reducer that merges dictionaries for executor logs.
Parameters
----------
a : dict
Existing accumulated dictionary.
b : d... |
8013c938071d18ea2bbcb84e12cd5070a016dff08612ec55f7a41bda5deb300f | Python | 2,404 | 94 | # %%
from data_loading import load_dataset_gino
import torch
from deepcardio import Trainer
from deepcardio.losses import LpLoss, H1Loss
import os
use_distributed = "WORLD_SIZE" in os.environ
if use_distributed:
print(f"Running in distributed mode on {int(os.environ["WORLD_SIZE"])} GPU(s).")
import torch.dist... |
98141f692cf6d20a549114108c82b3827d0c500e13d3062ae4c1b410e6c35a51 | Python | 2,404 | 77 | _base_ = [
'../_base_/models/depthformer_swin.py', '../_base_/datasets/kitti.py',
'../_base_/default_runtime.py'
]
model = dict(
pretrained='https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_large_patch4_window7_224_22k.pth', # noqa
backbone=dict(
embed_dims=192,
... |
a9300eb2c6f2a3a8880aa8b5da9eac03b221b4ac28e756f599f755d9047b9ac9 | Python | 2,404 | 76 | import numpy as np
def weighting_residual(params, omega, Zdata=None, model=None, model_kwargs=None):
"""Weight data using a model for the error.
Parameters
----------
params: dict
Dictionary with parameters.
Contains the entries for `stdA` and `stdPhi`, which are
the standard ... |
ebd20cf66c397e9712d11eaa6dc1bac135572c266e405e683e61dea54f37e9c5 | Python | 2,404 | 62 | import numpy as np
from collections import OrderedDict
from os import path
def load(filename, max_rank=None, vocabulary=None):
"""Load word vector data.
Args:
filename: name of file to load.
max_rank: maximum number of embeddings to load (None for no limit)
vocabulary: words to load e... |
66bb2ee264172745892eaf78d868c04cac47ae708175e6a0c5c5c44217959e49 | Python | 2,405 | 78 | #%%
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
import TwoD_gamma
import brainpy.math as bm
#set default ramndom seed for reproducibility
bm.random.seed(1)
#set backend to cpu
bm.set_platform('cpu')
labelsize = 18
ticksize = 14
center_trace, step, mean_fr = Two... |
f1238c44a46dd15940492f31963a79cb11bb606caedd281bd3dc52938f0f097b | Python | 2,405 | 64 | import user_features as uf
import csv
import time
import pandas as pd
import json
def get_user_vector(user):
user_vector = {
"user_id": uf.get_user_id(user),
"profile_description": uf.has_description(user),
"profile_location": uf.has_location(user),
"profile_url": uf.has_url(user),... |
febaecee08c70335457a1bb481d90537f15f49bfdb048e6b329a3546c219104e | Python | 2,405 | 67 | from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, roc_auc_score
from sklearn.ensemble import RandomForestClassifier
import numpy as np
from pathlib import Path
import torch
import csv
import pandas as pd
import argparse
parser = argparse.ArgumentParser(description='Random seed set:'... |
7d9728ac0ae221850d23399300da4606609d13e4a99c30533b7c93e37b740129 | Python | 2,406 | 80 | from tomocupy_stream import GPURecRAM
from tomocupy_stream import find_center
import numpy as np
import tifffile
import time
in_dtype = 'uint8' # input data type
dtype = 'float32' # output data type
n = 2048 # sample size in x
nz = 2048 # sample size in z
nproj = 2048 # number of projection angles
ndark = 10 # ... |
8f8c8e9a9e0948ede48f33d3a7867d89688213c54c24544ae67af746239af1ea | Python | 2,406 | 82 | """Nottingham MEGUK: Preprocessing."""
from glob import glob
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
import mne
from osl_dynamics.meeg import parallel, preproc
# ----------------------------------------------------------------------------
rawdir = Path("data/raw/Nottingham")
outdir = Path("... |
1841cb593c8dc03f41e9090921112b23b6af69e4b80af4d00a79ea284c320082 | Python | 2,407 | 83 | #!/usr/bin/env python3
import arbor as A
from arbor import units as U
import seaborn as sns
import matplotlib.pyplot as plt
class recipe(A.recipe):
def __init__(self, cell, probes):
A.recipe.__init__(self)
self.the_cell = cell
self.the_probes = probes
self.the_props = A.neuron_cab... |
2e9fa4fb0d1316f8cb2b9dabd3b3dd0dd1bca40d6f8c0118759a04cd00db28c4 | Python | 2,407 | 64 | import user_features as uf
import csv
import time
import pandas as pd
import json
def get_user_vector(user):
user_vector = {
"user_id": uf.get_user_id(user),
"profile_description": uf.has_description(user),
"profile_location": uf.has_location(user),
"profile_url": uf.has_url(user),... |
3f26d2b26669c651c64bbaf6aea8b37baef2b12b8ddf41954c600cba642268e6 | Python | 2,407 | 88 | """Plot group-average power maps and coherence networks for each state.
"""
from sys import argv
if len(argv) != 3:
print("Please pass the number of states and run id, e.g. python 5_plot_networks.py 8 1")
exit()
n_states = int(argv[1])
run = int(argv[2])
#%% Import packages
print("Importing packages")
impo... |
a4541c9a35117dd716a76e8aece0ff7bd3875c9cca2c5ceff9b6627ea335e111 | Python | 2,407 | 63 | # tifffile/examples/issue125.py
# Copyright (c) Christoph Gohlke
# SPDX-License-Identifier: BSD-3-Clause
"""Create a Fsspec ReferenceFileSystem for a sequence of TIFF files on S3.
This Python script uses the Tifffile and Fsspec libraries to create a
multiscale ReferenceFileSystem JSON file for a sequence of cloud op... |
fa1f231ee342e1591f528ed0ed8afe2f00a1323e64e97e7a18c6eec3f034a6f9 | Python | 2,407 | 88 | """Plot group-average power maps and coherence networks for each state.
"""
from sys import argv
if len(argv) != 3:
print("Please pass the number of states and run id, e.g. python 6_plot_networks.py 8 1")
exit()
n_states = int(argv[1])
run = int(argv[2])
#%% Import packages
print("Importing packages")
impo... |
59152150724088ca9b56470614a3b28128047eae4e6ab84f3356ac5ed383e08c | Python | 2,409 | 83 | import pytest
import torch
from brainways.utils.image import ImageSizeHW, annotation_outline, get_resize_size
@pytest.mark.parametrize(
"annotation,expected",
[
(
[
[0, 0, 1, 1, 1],
[0, 0, 1, 1, 1],
[0, 0, 1, 1, 1],
[0, 0, 1,... |
6d5d829377820a0977eaf4c0dd7569fae68f769f07950ad48c753d5c46872001 | Python | 2,409 | 67 | from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, roc_auc_score
from sklearn.ensemble import RandomForestClassifier
import numpy as np
from pathlib import Path
import torch
import csv
import pandas as pd
import argparse
parser = argparse.ArgumentParser(description='Random seed set:'... |
d448ab113037140ac41704fb9a90ebe87853f562384e08bf43a859cbe6514f15 | Python | 2,409 | 68 | # flake8: noqa
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/main/usage/configuration.html
# -- Path setup ----------------------------------------------------------... |
0dcf9f319cf06f6bde82b89cbc5f666102ef2a14b06044daaf7e01920dda8ce6 | Python | 2,410 | 61 | import os
import pandas as pd
from utils.training.evaluate_nm import evaluate_nm
def compute_blr_metrics(set, suffix, roi_ids, file_name, params, sites, all_sites) :
""" Compute the evaluation metrics for the Bayesian linear regression model
Args:
set (str): the set name
suffix (st... |
2f82e3f458fdd9b5caf0050326696d1861b5eabd7b2948a4ffa9e9a610324bde | Python | 2,410 | 67 | import functools
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_core.supported_data_standards.brainio.s3 import... |
abede6aed55c89abbb631c11baee24268bfe29b2166c6c15641f1d4ed29cd8a0 | Python | 2,410 | 105 | """Group-average evoked response analysis.
"""
from sys import argv
if len(argv) != 3:
print("Please pass the number of states and run id, e.g. python 6_evoked_response.py 8 1")
exit()
n_states = int(argv[1])
run = int(argv[2])
#%% Import packages
print("Importing packages")
import os
import mne
import pic... |
402e18ff42a324786567f117e5e96320362f6a9f0400dbc6a05c38f74fd23224 | Python | 2,411 | 64 | import user_features as uf
import csv
import time
import pandas as pd
import json
def get_user_vector(user):
user_vector = {
"user_id": uf.get_user_id(user),
"profile_description": uf.has_description(user),
"profile_location": uf.has_location(user),
"profile_url": uf.has_url(user),... |
b1e2eaf71be4a7a43f300dd43f32dc183eacf4d360546501ac92dc1640827ae4 | Python | 2,411 | 56 | # wfield - tools to analyse widefield data - dask tools
# Copyright (C) 2020 Joao Couto - jpcouto@gmail.com
#
# 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 the License, ... |
070baf9eca7353ea643ef56c75ba1cedf33a6ad54469e91a2ed322bd247850fd | Python | 2,412 | 63 | #!/usr/bin/python3
#
import os
import sys
import argparse
import shutil
from uac import utils
# Create the parser
my_parser = argparse.ArgumentParser(description="UAC fibre mapping")
# Add the arguments
my_parser.add_argument("target_path", metavar="path", type=str, help="Path for the new target mesh")
my_parser.add... |
0959876e1c8bb8aeaf7f0778c8f9d73638508b49c21ac62c5fa77b2ad781d727 | Python | 2,412 | 81 | import torch.nn as nn
import bism.backends
from functools import partial
from yacs.config import CfgNode
def cfg_to_bism_model(cfg: CfgNode) -> nn.Module:
""" utility function to get a bism model from cfg """
_valid_model_constructors = {
'bism_unext': bism.backends.unext.UNeXT_3D,
'bism_unet... |
1ac53bf7905dd9ee9b1072826b56889511e30097af5317716842390457b289aa | Python | 2,413 | 77 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Output the list of filenames using the coordinates from a binary connectivity
matrix. Typically used to move around files that are considered valid after
the scil_connectivity_filter script.
Example:
# Keep connections with more than 1000 streamlines for 100% of a po... |
74792ec93e4bae171cb2b2774cdd4d5efd493d54f9ecb138efa035dbebbce6b9 | Python | 2,413 | 74 | import FORCE
import numpy as np
import numpy.random as npr
import matplotlib.pyplot as plt
import os
from scipy.io import loadmat, savemat
import argparse
import pickle as pkl
import os
# Saved RNNs folder
savedir = 'data/RNNs'
items_in_logs = os.listdir(savedir)
items_in_logs.sort()
temp = []
for item in items_in_lo... |
ec024b3100a98d9a65cfe517352a9cf87c9b44f64cc99f3128aaba84785eb9ac | Python | 2,413 | 50 | """
Iter-7 record attempt — DINOv2 ViT-L/14 WITH REGISTERS + ImageNet linear classifier (dinov2_vitl14_reg_lc).
Data-driven: our best model is dinov2_vitl14_lc (overall 0.41, neural 0.36). Scaling to ViT-g LOWERED
neural (0.28) and V1 (0.27) -> ViT-L/14 is the brain-alignment sweet spot; do NOT scale. The remaining
ne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.