sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
8696590b73fd97e6b56d4bb431df277c8002028a06de38431d923f4af4cddfef
Python
2,775
56
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import shap import pickle import seaborn as sns import argparse def get_feature_importance(): parser = argparse.ArgumentParser(description='Caculate the importance for each feature and pathway.') parser.add_argument('--input_shap'...
f14dc90de340187a5f3adaccc60f3b5f065ce3f7729eed7e6ceb7055dfb6c9c4
Python
2,775
75
''' Created on 19 Nov 2022 @author: Francois STÜDER Only feature count was tested in this script ''' import pandas as pd import sys from os import path from subprocess import Popen, PIPE from SysISTD import tools cmdQuantification = "featureCounts -T __core__ -F GTF -t __feature__ -s 0 -a __GTF__ -o __out__" tsvF...
6517af99ada509607377dcc4431784acd2e95cb53c8a6352a6838ed175d9c5b5
Python
2,776
96
import os, math, random import numpy as np from matplotlib.patches import Ellipse from sklearn.datasets import make_blobs import matplotlib.pyplot as plt def calc_p (x): return 2 * np.min([ np.mean(np.array(x) >= 0), np.mean(np.array(x) <= 0) ]) def calc_diff_p(a, b): random.seed(0) r...
888045b4c75431da2a6b549a7bac77d048d22614e4175dfd7bfe9d771b0f42a3
Python
2,776
75
from medperf import config from medperf.entities.cube import Cube from medperf.entities.model import Model from medperf.entities.dataset import Dataset from medperf.entities.execution import Execution from medperf.entities.benchmark import Benchmark from medperf.enums import ModelType from medperf.commands.execution.co...
d5108b7dbfa72b51e6ce9517ef00712f4649a50686853d1f2f0d32044b47bc0e
Python
2,776
76
import numpy as np import hickle as hkl from grid_cell.ploter import error_bar_plot import scipy.ndimage as ndi from grid_cell.tuning import ppdata_to_avg_ratemap from scipy import stats import matplotlib.pyplot as plt import os from global_setting import * #################### Hyperparameters #################### mou...
550586c1621031667ae9513b14b6494b0282a9bdb0bd7771c2f07c55b62119b5
Python
2,778
116
# pylint: disable=protected-access """Shared typing definition.""" import ctypes import os from typing import ( TYPE_CHECKING, Any, AnyStr, Callable, Dict, List, Optional, Sequence, Tuple, Type, TypeVar, Union, ) # os.PathLike/string/numpy.array/scipy.sparse/pd.DataFrame...
d02923a50c9671b0c4650048f625fdc4e150eb8b831c769afed2ccbb0c3067f2
Python
2,779
74
import pandas as pd peps = pd.read_csv("peptides.tsv", "\t") peps.fillna("", inplace=True) print(len(peps), "Total peptides") hpeps = peps[peps["Species"].str.contains("Human")] print(len(hpeps), "Human peptides") # if the peptide has a smiles, we should be ok smipeps = hpeps[hpeps["SMILES"] != ""] print(len(smipeps)...
ec899276960af879a3822e62cc018b17ff7d7fae03b3bedd790d2902bb82592f
Python
2,779
83
from collections import OrderedDict import torch from torch import nn class VoxNet(nn.Module): """ Original code is from: https://github.com/MonteYang/VoxNet.pytorch/blob/master/voxnet.py Notes ----- Compared with the original model, ReLU is chnaged to PReLU(1, 0.25) The higgen layer in...
fc6e56aa8ecd1f956bd0abd707cb6c4c433850796db75dfec537027b5bcc67da
Python
2,780
113
#from bluepyopt.ephys.models import CellModel import bglibpy from bglibpy.importer import neuron import collections import logging logger = logging.getLogger(__name__) class HocModel(object): """Neurodamus model class""" def __init__( self, morphname=None, template=Non...
1e2187bcc56045d5af956f9762b5290cbd7afe88dd0b31b86150b047b857aef6
Python
2,781
88
"""pytorchexample: A Flower / PyTorch app.""" import torch from flwr.app import ArrayRecord, Context, Message, MetricRecord, RecordDict from flwr.clientapp import ClientApp from task import test as test_fn from task import train as train_fn from models import SimpleCNN as Net from data_loader import ChestXrayDataset ...
0a12984743aafe0c0c19c7407e955eae10bf324e53207ed395e0966ec749360e
Python
2,782
115
'''Sink for Parquet format.''' from pathlib import Path from typing import Any import pandas as pd from pyarrow import Table from pyarrow.parquet import write_table from kgx.sink.sink import Sink DEFAULT_NODE_COLUMNS = { "id", "name", "category", "description", "provided_by" } DEFAULT_EDGE_COLU...
1ff419312cd2793a006d409ba5de5c920aac587c9810cae2bb6ba62d3d99090c
Python
2,782
88
import math import torch import torch.nn as nn import torch.nn.functional as F def default_conv(in_channels, out_channels, kernel_size, bias=True): return nn.Conv2d( in_channels, out_channels, kernel_size, padding=(kernel_size//2), bias=bias) class MeanShift(nn.Conv2d): def __init__( ...
54cb91a8129ff875f3b637e2a2d7b9e3f837a512b11fda2fcc6379e4ad035136
Python
2,783
76
## simulator for BRIE2 import numpy as np from scipy.special import expit from tensorflow_probability import distributions as tfd def simulator(adata, Psi=None, effLen=None, mode="posterior", layer_keys=['isoform1', 'isoform2', 'ambiguous'], prior_sigma=None): """Simulate read counts f...
8290414ea1f57bdab7fed90daf5ed2cad4093ec5fbd1acfa0e8387ad01ca116e
Python
2,783
88
#!/usr/bin/python import sys import argparse import requests from requests.auth import HTTPBasicAuth class CatmaidApiTokenAuth(HTTPBasicAuth): """Attaches HTTP X-Authorization Token headers to the given Request. Optionally, Basic HTTP Authentication can be used in parallel. """ def __init__(self, tok...
f97e1be39b49b7b7e8ae804132ca4cb3c632a45745507d95250942efb17a0ed1
Python
2,784
88
import numpy as np from sklearn.manifold import TSNE, Isomap, MDS from experiment import * from matplotlib import pyplot as plt from ethomap import pdist_dtw, IsomapPrecomputed, affinity_propagation from scipy.spatial.distance import squareform from scipy.interpolate import CubicSpline from zigzeg import find_runs f...
60d24cf6458f5890b235f1546fc86b80a31d8f126dd1a17d9e695e6404d25f35
Python
2,789
70
from _operator import itemgetter from collections import namedtuple GMMparameter = namedtuple('GMMparameter', 'mergedName numberOfComponents searchStrings') def kvlReadSharedGMMParameters(fileName): # Read text file where each line is formatted as: # mergedName numberOfComponents searchString(s) share...
0a28d6b1849b3343a81a473b4019d08d2316898d7dd5074b502a1163ac75f80e
Python
2,790
94
from __future__ import annotations import os import pytest import medperf.config as config from medperf.tests.mocks.cube import TestCube from medperf.commands.mlcube.submit import SubmitCube from medperf.exceptions import InvalidArgumentError PATCH_MLCUBE = "medperf.commands.mlcube.submit.{}" # rename ficture to su...
2abccfbc3b4cd95bdaee3f09ae45c102e91e8647b3ed80ddaf3cca208a0b4967
Python
2,790
91
import pickle import numpy as np from tqdm import tqdm import multiprocessing def cosine_similarity(u, v): return np.dot(u, v) / (np.linalg.norm(u) * np.linalg.norm(v)) def find_most_similar_embedding(target_emb, umls_ent_emb): max_similarity = -1 max_index = None for idx, umls_emb in enumerate(umls_e...
d8364de1f90b2391c11c8e623a653103067c6a7184c57a2e5fbc6e805927d0a7
Python
2,790
109
"""Test that files marked as 'streamable' when 'streaming_allowed' can be named pipes.""" import os from pathlib import Path from typing import cast import pytest from cwl_utils.types import CWLObjectType from ruamel.yaml.comments import CommentedMap from schema_salad.sourceline import cmap from cwltool.command_line...
70ecaae5d356af8dba45731a48764e7d27a02f3892ab1fc847ce4e4f76a10aa9
Python
2,795
92
from __future__ import annotations from typing import Annotated import typer from zndraw.schemas import ActiveCameraResponse, SessionsListResponse from .connection import ( PasswordOpt, RoomOpt, TokenOpt, UrlOpt, UserOpt, cli_error_handler, get_zndraw, resolve_room, ) from .output im...
0b59b6858657e0b4760e5bed17ac138cf20c4646be8e2cf5805e41274c2eae1b
Python
2,796
98
from collections.abc import MutableSequence import pytest from cwl_utils.types import CWLDirectoryType, CWLFileType, CWLObjectType from cwltool.pathmapper import PathMapper from cwltool.utils import normalizeFilesDirs def test_subclass() -> None: class SubPathMapper(PathMapper): def __init__( ...
3ee987dfc33dfd7a19fc32f9bd4cd5e044927545c56dc6aa19698d00cb7ea467
Python
2,797
71
from datetime import datetime from dfa_lib_python.performance import Performance from dfa_lib_python.method_type import MethodType def test_get_start_time_pass(): start_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') end_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') performance = Performance(sta...
a49d12a0a2a15a86214c09bd2bd18712e1e670c38ec17ff179595934df99bfb3
Python
2,798
65
# coding=utf8 import argparse import sys import os from concurrent.futures import ProcessPoolExecutor def _generate_cache_arrow(index, ds, path): print('saving dataset shard {}'.format(index)) ds.save_to_disk(os.path.join(path, 'part_{}'.format(index))) return 'saving dataset shard {} done'.format(index) ...
97603165140494c0b902a31435b5176f0ce33a604d19b020bf162a9268496676
Python
2,799
64
#intended to be functions that are used in the other src fils (computation.py, plotting.py) but avoids putting them in config.py #each other module should import helper_functions as hf import numpy as np import lmfit from copy import deepcopy from src import config as cfg from src import data_io as io def get_num_ti...
a1caf8389358385bdb5845c6f18a54ceb4c1be0b38515b2110598224eec1b319
Python
2,800
70
"""Tests for the HMDB download. HMDB fronts its download URL with a Cloudflare bot challenge, so the unattended download cannot succeed and the operator has to place the zip by hand. These tests cover the two halves of that: that Babel still recognizes the live response as a challenge, and that a hand-placed zip is ac...
ed8bd61f7ec4a041af082e5c80f7028f98153fe73add70eef1189bbda673e677
Python
2,802
65
from transformers import LlamaTokenizer import torch def pad(ids, pad_id, max_length): if len(ids) > max_length: return ids[:max_length] return ids + [pad_id] * (max_length - len(ids)) prompt_without_output = "<human>:{prompt}\n<bot>:" def generate_samples(s, tokenizer, max_seq_length): max_leng...
fd785db122f5b3b9e2e764fecb9e0fc7ca53203ff1b3ed47c615f4cc553e26bf
Python
2,802
95
from contextlib import contextmanager from functools import wraps from typing import Callable, Tuple try: import torch._dynamo as dynamo except ImportError: dynamo = None from e3nn import get_optimization_defaults, set_optimization_defaults from torch import autograd, nn from torch.fx import symbolic_trace Mo...
2c65dd5a575bd51a559825e546138943c4727dd6046e3515b9930014040d0ba0
Python
2,803
86
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import torch import torch.nn as nn # Different encodings for the atom distance embeddings class GaussianSmearing(torch.nn.Module): def ...
e080b0bbca7d61193af2c74cdaca84e95087b801c304c5826b66068c4cf8a4d6
Python
2,804
101
from luna.paths import LunaPaths from luna import candidate_info, dataset from luna.ct import Ct from luna.prepcache import LunaPrepCacheApp from torch.utils.data import DataLoader #from Utils.dataloader import * from Utils.models import * from Utils.TrainModelLUNA import * from Utils.config import * from multiprocessi...
fe07560035a8808398bf6c29f609e92997a1a204f64631f3634b3aa2966b14ac
Python
2,804
101
from luna.paths import LunaPaths from luna import candidate_info, dataset from luna.ct import Ct from luna.prepcache import LunaPrepCacheApp from torch.utils.data import DataLoader #from Utils.dataloader import * from Utils.models import * from Utils.TrainModelLUNA import * from Utils.config import * from multiprocessi...
0522efd8e8a27bb225644246004c69dbcc28089c3abbd89712f0663f4563020d
Python
2,805
63
from pyxtal import pyxtal from p_tqdm import p_map from pymatgen.core import Structure from pymatgen.core.lattice import Lattice def structure_to_str(structure): # 转换pymatgen结构为pyxtal结构 px_structure = pyxtal() px_structure._from_pymatgen(structure) # 获取空间群信息 spg_symbol = px_structure.group.number ...
44731bd71034feba144a86ff503370a9b67c786c50c5f5a709ca6560497b5d6a
Python
2,805
84
from __future__ import annotations import os import re from typing import Literal import pytest import torch from ase.filters import ExpCellFilter, Filter, FrechetCellFilter from pymatgen.core import Structure from chgnet.graph import CrystalGraphConverter from chgnet.model import CHGNet, StructOptimizer @pytest.m...
f15a6f8e36e06f38f0d38a40da9e4e42f9e0934d0dd8c3b4e8e9d3808dd3cd2d
Python
2,806
74
import numpy as np import torch from nanoUtil import fetchSignal import time import random def aggregate_scors(scores, method): if method == 'mean': return np.nanmean(scores) elif method == 'median': return np.nanmedian(scores) elif method == 'min': return np.nanmin(scores) elif...
291a5548523e3712fd69074cfe1e83317df6998bf414472eac3c39e8cb6f5e71
Python
2,807
82
# coding=utf-8 # Copyright 2022 IDEA-CCNL and The HuggingFace Inc. team. All rights reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2....
5feb7a386f7efe78700860214b1cf6ba00f1a722c464acb2989fbe7ff161de7c
Python
2,807
75
import argparse import pandas as pd import torch import torch.utils.tensorboard from tqdm.auto import tqdm torch.backends.cuda.matmul.allow_tf32 = True torch.backends.cudnn.allow_tf32 = True from rde.utils.misc import get_logger from rde.utils.train import * from rde.models.rde_ddg import DDG_RDE_Network from rde.util...
e377c4e5b741c4a2f31b50bbaf3643d8978ea96eadac539f59af4b4cf07bd6dd
Python
2,810
78
"""Regression: RoomRenamed reaches the previous owner's user channel (finding #14). Alice owns room "foo". A Group G has member Bob. A third client is "in the room" on the surrogate channel. Alice (as superuser) transfers foo from her namespace to G's namespace. Expectations: - Alice receives RoomRenamed on user:<a...
9b7a3506b88842ec09031fb7cd0fc1d3fed82e137ce06dbca10495e6c180dda9
Python
2,811
92
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import time import numpy as np import torch from tqdm import tqdm from sam2.build_sam import build_sam2_video_...
8d39deec79eaa40190d8e0764463e3b0ec0897deff4c0338499b23137f91ef28
Python
2,813
72
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-09-10 18:45 from __future__ import unicode_literals from django.conf import settings import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ...
d7cfaa12154ce9d68fc2e594875de1ff742974fe885e98ef5dc39b8e1f9dc2a5
Python
2,813
79
# pytest unit tests for all cli scripts import pytest import sys import importlib from importlib.metadata import entry_points import subprocess scripts = [cs.name for cs in entry_points().select(group='console_scripts') if cs.value.startswith("spinalcordtoolbox")] scripts_where_no_args_is_valid = [ 'isct_test_an...
2af69dac34ac0d29bb9ce617b1f6a35dbf9280fac37843f95dcad61fa8ed3cd1
Python
2,814
101
import functools import ase.io as aio import ase import torch import zntrack try: from mace.calculators import MACECalculator except ImportError: print( """ WARNING: MACE is not installed! You need to install MACE to use this package. You can install it via 'pip install git+https://github.com/ACEsuit...
1fa3062d6db4dd618d7b3c6a9229d168836a4a75bf6443c718ad08f55625b5b6
Python
2,815
86
# MLCube Entrypoint # # This script shows how you can bridge your app with an MLCube interface. # MLCubes expect the entrypoint to behave like a CLI, where tasks are # commands, and input/output parameters and command-line arguments. # You can provide that interface to MLCube in any way you prefer. # Here, we show a wa...
6327e76e260e8e99ce31e00d193f27383abec72ef376adef5d69575072bc062d
Python
2,817
91
_base_ = [ '../_base_/models/fpn_poolformer_s12.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py' ] # dataset settings dataset_type = 'ADE20KDataset' data_root = 'data/ade/ADEChallengeData2016' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb...
f94f0a92944742e383095e8d7f8afa576ede7769aa1626be40d6d1d65637732d
Python
2,818
106
#!/usr/bin/env python3 # # Creates a tex table of all reported midpoints. # import base filename = 't3-all-midpoints.tex' nooocytes = True qo = 'where cell != "Oocyte"' if nooocytes else '' # Collect journal references refs = {} with base.connect() as con: c = con.cursor() q = 'select key, tex from publicati...
9416005dedb23a129b86ffeb1c04ca108ae4b779a473b1482cf3fd35a81ab203
Python
2,821
69
from inspect import signature from typing import Union from gymnasium import Space from gym.vector.utils import spaces from CybORG.Agents.SimpleAgents.BaseAgent import BaseAgent #agent that does random action from CybORG.Simulator.Actions import Sleep #testing from CybORG.Simulator.Actions.ConcreteActions.ControlTr...
1ed73213b721f6fea74ed768dd4c1f83b2291fcdbc907ac006488b492d83b5c3
Python
2,822
75
# Copyright (c) OpenMMLab. All rights reserved. import torch from torch import nn from torch.nn import functional as F class Encoding(nn.Module): """Encoding Layer: a learnable residual encoder. Input is of shape (batch_size, channels, height, width). Output is of shape (batch_size, num_codes, channels)...
afd3b14343d931b378efa53b1c5d6afd8fee960a8967c8f12792a03fda6b892b
Python
2,822
60
from PyQt5 import QtCore, QtWidgets from PyQt5.QtWidgets import QSizePolicy # https://stackoverflow.com/questions/52615115/how-to-create-collapsible-box-in-pyqt # https://github.com/By0ute/pyqt-collapsible-widget class CollapsibleBox(QtWidgets.QWidget): def __init__(self, title="", parent=None): super(Co...
5882e2dc3a58701b0079f9f6d77c691c05f94c45da18d0e70b2d43bc73745de7
Python
2,823
83
_base_ = [ '../_base_/models/bisenetv2.py', '../_base_/datasets/cityscapes_1024x1024.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' ] crop_size = (1024, 1024) data_preprocessor = dict(size=crop_size) norm_cfg = dict(type='SyncBN', requires_grad=True) models = dict( data_prep...
ce16b561394428e40c30b787c12bdd5e2cb6ea4a7970b1d45d79c2fa3ea25f64
Python
2,823
91
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os import shutil import numpy as np from dmriqcpy.analysis.stats import stats_frf from dmriqcpy.io.report import Report from dmriqcpy.io.utils import (add_online_arg, add_overwrite_arg, assert_inputs_exist, assert_ou...
db56c7f76d7ccbb48a7362a399c59adf1840ea55eacf3d526fb778fdd2946ad8
Python
2,823
84
from PyQt5 import QtCore, QtWidgets import quantities as pq import numpy as np import pyabf from threads.Worker import Worker from view.ABFLoaderDialog import ABFLoaderDialog from model.Source import Source class ABFLoader(): def __init__(self, data_manager, filepath): """ Starts the...
36f65ef9ad9925f997d3af805af226dd543a42c9a8603ff810254c33ee03233a
Python
2,825
86
import glob import os import numpy as np from PIL import Image root_path = 'data/' img_suffix = '.jpg' seg_map_suffix = '.jpg' save_img_suffix = '.png' save_seg_map_suffix = '.png' tgt_img_dir = os.path.join(root_path, 'images/train/') tgt_mask_dir = os.path.join(root_path, 'masks/train/') os.system('mkdir -p ' + tgt...
f382ca605e3b066314516d8c6113019b398bbcfeafd84980d9f8e3b8091875fc
Python
2,825
87
import pytest from playwright.sync_api import expect @pytest.mark.ui def test_save_to_file_button_removed(page, live_server_url): page.goto(live_server_url) expect(page.get_by_role("button", name="Save to file...")).to_have_count(0) @pytest.mark.ui def test_label_stores_button_visible(page, live_server_url)...
bea759a56aef19aa572015a7d92b533e97b38a0cd6943114ceaa87ea9aa73640
Python
2,826
80
from selenium.webdriver.common.by import By from ..base_page import BasePage class DatasetDetailsPage(BasePage): PREPARE_BTN = (By.ID, "prepare-dataset") PREPARED_TEXT = (By.CSS_SELECTOR, 'div[data-testid="prepared-section"]') SET_OPERATIONAL_BTN = (By.ID, "set-operational") SET_OPERATIONAL_TEXT = (...
7242cf1948ab628d0de568128084d0108828792a13510fd6c4f386ce52cbfb4a
Python
2,827
87
import pandas as pd import argparse import os import yaml import json from utils import get_image_data_df class Stats: def __init__(self, data_path, labels_path, out_file, params): self.data_path = data_path self.labels_path = labels_path self.data_file = os.path.join(data_path, params["o...
cfd19894dec2a3171df3133e605f6a356c9ff99bedd8e926a11ebc9941b5ee29
Python
2,829
97
from Utils.dataloader_GRAZPEDWRI import * from Utils.config import * from Utils.models import * from Utils.TrainModel import * from multiprocessing import Process def task(lr, data_partition:float=None, run_idx:int=None, backbone: str='eff0'): _cuda = 'cuda:0' _image_size = get_image_size_for_backbone(backbone=backb...
05045319b85a2fc6ea05d7c32758c64eecdd8c13da687dfee623aabebf6e76d4
Python
2,830
74
# run fit_gkr_models.py first import hickle as hkl from umap import UMAP from grid_cell.ploter import gp_torus_surface from grid_cell.util import pca_accumulated_variance_explained_ratio from sklearn.decomposition import PCA import matplotlib.pyplot as plt from grid_cell.gkr import GKR_Fitter from grid_cell.manifold_fi...
1115808f3f724ab08f9c2f616d0889571191d3efbe3dbc4251b75bbcfa4fe5d5
Python
2,831
79
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.transforms.loading import LoadImageFromFile from mmcv.transforms.processing import (RandomFlip, RandomResize, Resize, TestTimeAug) from mmengine.dataset.sampler import DefaultSampler, InfiniteSampler from mmseg.datasets.l...
3968f136dee2ce30fb5a37e8145bb50f64a556b9b8de56f5706d7dd41426bd74
Python
2,832
96
from transformers import TrainingArguments from trl import SFTTrainer, DataCollatorForCompletionOnlyLM from unsloth import FastLanguageModel from datasets import load_dataset import pandas as pd import argparse import torch def preprocess_logits_for_metrics(logits, labels): with torch.no_grad(): logits = logits.cpu...
052d5610bd89eabc0070a784be8671f4ab54ff0c328770594c885424daae3be2
Python
2,833
65
# pytest unit tests for sct_resample import pytest import logging from spinalcordtoolbox.image import Image from spinalcordtoolbox.scripts import sct_resample from spinalcordtoolbox.utils.sys import sct_test_path logger = logging.getLogger(__name__) @pytest.mark.sct_testing @pytest.mark.parametrize("path_in,type_a...
24fefa07cdc859e1fe4eb42aed39a0ee9a038496d2b7a5a1ce2df06886f86a43
Python
2,833
78
#!/usr/bin/env python # # Copyright 2009, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
7226dfdbed0cb8d9c64ab8b13c133001b30384806d6ce150404374a776a60f72
Python
2,835
97
import os import sys import numpy as np import random import string import pandas as pd ################ Paths and other configs - Set these ################################# data_dir = '/u/scr/nlp/dro/multinli/data' glue_dir = '/u/scr/nlp/dro/multinli/glue_data/MNLI' type_of_split = 'random' assert typ...
6178f74a3bf95ae1c3b4cbcea15192d09f4bf89fc11f8ab47eb813d89bf3b856
Python
2,836
91
from .ProvenanceObject import ProvenanceObject from .set import Set from .set_type import SetType class Transformation(ProvenanceObject): """ This class defines a dataflow transformation. Attributes: - tag (:obj:`str`): Transformation tag. - sets (:obj:`list`, optional): Transformation se...
9e1855f555ebd8c671159db0c7596851ae4b969f5037008871aa5dde6f8c7c39
Python
2,836
75
import os import numpy as np import matplotlib.pyplot as plt from grid_cell.util import select_arr_by_t, get_data_filename_by_keywords from global_setting import * mouse_name = 'R' day = 'day1' module = '2' session = 'open_field_1' pca_str = '6' # none or number as a string ## raw data file_name = get_data_filename_...
3f495fbc25c4b5912a1353a1c215f2db6cb33959d7c1c98e0a7f919a4339dec2
Python
2,837
96
from Utils.dataloader_COVID import * from Utils.config import * from Utils.models import * from Utils.TrainModel import * from multiprocessing import Process def task(lr, data_partition:float=None, run_idx:int=None, backbone: str='res152'): _cuda = 'cuda:0' _image_size = 224 _lr = lr _info = "RadiologyNet_"+str(l...
70005485fac8dc36add36255bc48b057e336f75d5e064847efbe216230ff74e4
Python
2,837
69
""" Compatibility layer to launch old scripts Copyright (c) 2019 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ import sys import os import subprocess import multiprocessing from numexpr.utils import detect_number_of_cores from spinalcordtoolbox import __file__ as package_init_file ...
1da8a1e6dcef4ba1e5d614c558084408bda4b3047a8233c6469f58361e26d162
Python
2,838
79
## Restormer: Efficient Transformer for High-Resolution Image Restoration ## Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Ming-Hsuan Yang ## https://arxiv.org/abs/2111.09881 import numpy as np import os import argparse from tqdm import tqdm import torch import torch.nn as nn imp...
950a9b7d67fc3d74d321d4fc335bd7c492007f4a051f7ad6458805aa54bc8050
Python
2,838
125
import io from picsl_c3d import Convert3D class C3D: def __init__(self): self.cmd = [] self.c = Convert3D() def __repr__(self): return ' '.join([str(part) for part in self.cmd]) def assign(self, var): self.cmd.append('-as') self.cmd.append(var) return sel...
eed7e92494acc19e8e044bd7c728ac541bafaa767983ec8531f642df8213f932
Python
2,839
89
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import shutil import tempfile import zipfile from mmengine.utils import mkdir_or_exist def parse_args(): parser = argparse.ArgumentParser( description='Convert NYU Depth dataset to mmsegmentation format') parser.add...
f29b1033373aa652a71ed000354718d6feaa04df6d28d48c1bc13653f888f4b7
Python
2,839
87
import glob import os import numpy as np from PIL import Image root_path = 'data/' img_suffix = '.jpg' seg_map_suffix = '.jpg' save_img_suffix = '.png' save_seg_map_suffix = '.png' tgt_img_dir = os.path.join(root_path, 'images/train/') tgt_mask_dir = os.path.join(root_path, 'masks/train/') os.system('mkdir -p ' + tgt...
24492d9035c7ae918692b0f626f5b808b9f348b8fd47e831eb1c7ff273ac0d15
Python
2,841
67
# dataset settings dataset_type = 'GID_Dataset' # 注册的类名 data_root = 'data/gid/' # 数据集根目录 crop_size = (256, 256) # 图像裁剪大小 train_pipeline = [ dict(type='LoadImageFromFile'), # 从文件中加载图像 dict(type='LoadAnnotations'), # 从文件中加载标注 dict( type='RandomResize', # 随机缩放 scale=(512, 512), # 缩放尺寸 ...
28734fec5da40c8890c8f5c17fc198b32bba2a4bd80621e45dc3c92b70e97074
Python
2,841
93
from django.http import Http404 from rest_framework.generics import GenericAPIView from rest_framework.response import Response from rest_framework import status from django.contrib.auth import get_user_model from drf_spectacular.utils import extend_schema from .serializers import UserSerializer, UserMetadataSerialize...
cdbd874d66ef7fb98979994488415bda75e79a2f31e3a5fa171f3fad20558024
Python
2,842
84
# load badrun json # query specific run by opening run specific csv # extract value # save in corresponding dataframe # TODO: compile mean values # %% import nilearn import pandas as pd import matplotlib.pyplot as plt import os, glob, sys import numpy as np import seaborn as sns import re import nibabel as nib import ...
090303719a063b8ad207ea1579731dc7f5017b8255e0828f467ec07a9c2752a4
Python
2,844
75
baseFileName = './shellScripts/sparse075_noise_final_' baseSimTag = 'sparse075_noise_final_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse...
5847e86b2d66a2e93f763a22ceb4c89fb7799413330141c5b4e43ea229c03b98
Python
2,844
75
baseFileName = './shellScripts/sparse100_noise_final_' baseSimTag = 'sparse100_noise_final_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse...
6d69f66b7e28dbe9b02df3221bc3c425db3c290107fd8b6633c6335196fcf4b4
Python
2,844
85
import os import numpy as np num_to_modality = { "_0000": "_brain_t1n.nii.gz", "_0001": "_brain_t2w.nii.gz", "_0002": "_brain_t2f.nii.gz", "_0003": "_brain_t1c.nii.gz", } def get_subdirs(parent_directory): subjects = os.listdir(parent_directory) subjects = [ p for p in subjec...
804236276c3cdf231b1b87b0992929938c239e0f47689dea01e7b2322fa554b0
Python
2,844
75
baseFileName = './shellScripts/sparse050_noise_final_' baseSimTag = 'sparse050_noise_final_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse...
91f57833a8fc3af68f3399d00f21e7d0be9417adbecc6f794303bff1d3a9ad4e
Python
2,844
75
baseFileName = './shellScripts/sparse070_noise_final_' baseSimTag = 'sparse070_noise_final_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse...
a4c7c636ad2d1cdbb3fcb892b5a110661cc0e429c2ebedf0458362840ab4ec82
Python
2,844
75
baseFileName = './shellScripts/sparse090_noise_final_' baseSimTag = 'sparse090_noise_final_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse...
b55b6d08476c7eb1b5e4cae8253aff4b8036be4ec840b86c73dcfffbf832c0a2
Python
2,844
75
baseFileName = './shellScripts/sparse095_noise_final_' baseSimTag = 'sparse095_noise_final_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse...
e654d611d1ed0152bc5d94c688607f476b4bd23ada1183cd7596c7997d92dc3b
Python
2,844
75
baseFileName = './shellScripts/sparse080_noise_final_' baseSimTag = 'sparse080_noise_final_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_sparse...
360d2e468f57e377ba9425040a154d0a253272a6223c0135ce2a434f953af500
Python
2,845
82
import shutil from pathlib import Path import pytest from guppy.testing import compare_output_folders from guppy.testing.api import locate_run_folder, step1, step2, step3, step4 from guppy_test_data import TESTING_DATA, event_ts_offset_for STORE_ID_TO_STORE_LABEL = { "Sample_Control_Channel": "control_region", ...
644ceb84069d6fe8d756a7c515fba78e036f282b1d86cfcb31804e589811b7ce
Python
2,847
51
# pytest unit tests for sct_warp_template import logging from spinalcordtoolbox.image import Image from spinalcordtoolbox.scripts import sct_warp_template, sct_register_to_template from spinalcordtoolbox.utils.sys import sct_test_path logger = logging.getLogger(__name__) def test_sct_warp_template_warp_small_PAM50...
964a8927a44d2c25361de5bfedee0722dd1eeca295c56b7b5e0be24bf956aad7
Python
2,849
91
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp # Default using 4 gpu when training config_8gpu_list = [ 'configs/swin/upernet_swin_tiny_patch4_window7_512x512_160k_ade20k_pretrain_224x224_1K.py', # noqa 'configs/vit/upernet_vit-b16_ln_mln_512x512_160k_ade20k.py', 'co...
4974eeefa4e4ce2d982aa9feb0d7c256051609173e4f05a968a0eb0b0155e19f
Python
2,850
76
baseFileName = './shellScripts/sparse080_10class_noise_' baseSimTag = 'sparse080_10class_noise_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_s...
534fdf3c9e1568120dc88dccdbe58111cacf319faf78c646fa4a69ae37032ceb
Python
2,850
76
baseFileName = './shellScripts/sparse050_10class_noise_' baseSimTag = 'sparse050_10class_noise_' def generateCommand(trial_num=0, num_trials=10, learning_rate=0.001, sim_tag='default', exc_hid_rat=0.5, epochs=30, log_file='example.log', w1_std=-1, w1_s...
f9e84b327dc49d8c26c85e514b3fe76f46a7e5fbe6c32cb4c66bcc6a5c85aa03
Python
2,853
80
from medperf.entities.dataset import Dataset import medperf.config as config from medperf.utils import approval_prompt, dict_pretty_print from medperf.exceptions import CleanExit, InvalidArgumentError import yaml class DatasetSetOperational: # TODO: this will be refactored when merging entity edit PR @classme...
6f372a9592e236df904d82bf33dff76fb4d3a94b2a9e14031daf8724e9ada38d
Python
2,854
86
# model settings data_preprocessor = dict( type='SegDataPreProcessor', mean=[127.5, 127.5, 127.5], std=[127.5, 127.5, 127.5], bgr_to_rgb=True, pad_val=0, seg_pad_val=0) # adapted from stable-diffusion/configs/stable-diffusion/v1-inference.yaml stable_diffusion_cfg = dict( base_learning_rate...
9c19a8799950944d8c5a8bd74d9bb124e5ebf6967df0be6ec93489133bc24785
Python
2,854
75
from mpi4py import MPI import hickle as hkl import numpy as np from grid_cell.persistent_homology import Is_Torus from grid_cell.manifold_fitter import GP_Fitter, Avg_Fitter from grid_cell.ploter import error_bar_plot import matplotlib.pyplot as plt import tensorflow as tf import os from sklearn import datasets from gl...
b28f8c69f7a12d37272cb7bd911487636041df13c26965c5e9bb0753ab92aec2
Python
2,854
110
import traceback import numpy as np from scipy.stats import pearsonr, spearmanr from sklearn.metrics import classification_report, precision_score, recall_score, roc_auc_score import torch from collections import defaultdict def cal_recall(y_pred, y_true, top): a_sort_idx = y_pred.argsort() b_sort_idx = y_tr...
d7737284ecdd66efc4df4aae1c7aea3c16f93ce69618e6c7e9c4491348d1ed5c
Python
2,854
68
import argparse import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import time from scipy import stats import edl import data_loader import trainers import models from models.toy.h_params import h_params parser = argparse.ArgumentParser() parser.add_argument("--num-trials", default=20, type=i...
51963161810779f42e0cb95efdccfb7781e01c5a69098726d8d86f6e9b89499a
Python
2,855
84
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 16 11:45:02 2023 @author: schwab """ import torch from torch.utils.data import DataLoader, Subset from ..models.encoder import HetEncoder from ..models.decoder import DisplacementDecoder from ..data.handlers.particle_image_preprocessor import Part...
966a98f37b598a39c62f1faa3a776efca7d7d7125617867f0f39a1d47505cbca
Python
2,855
58
from sklearn.model_selection import train_test_split from sklearn import metrics import seaborn as sns import numpy as np import pandas as pd import matplotlib.pyplot as plt from tensorflow.keras.optimizers import Adam from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Conv1D, MaxPooling...
28eca72c0800f20972a12537b5e478407571e738bca5a86112a7146dbe4cdb5b
Python
2,857
78
import numpy as np import cv2 import torch from yolov9_model import YOLOv9_GPU, YOLOv9_FPGA from dataset_preprocessing import get_datasets, get_data_loaders class ReinforcementLearning: def __init__(self, use_fpga=False): """ Initialize the reinforcement learning module with explicit state and acti...
3c98e3be479d7f74150536b7761bb569cfac567254eade2138e62056e15c690a
Python
2,859
81
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.transforms.loading import LoadImageFromFile from mmcv.transforms.processing import (RandomFlip, RandomResize, Resize, TestTimeAug) from mmengine.dataset.sampler import DefaultSampler, InfiniteSampler from mmseg.datasets.p...
52cc02acd27a6046e4d95cd6e999de56af063a42e057dfcd5b7859319ece710b
Python
2,861
72
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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 # # http://w...
588aaa9000bdce9e5db67d14b067858bc3d6a392e93e5cbb37cb797a2d0f4251
Python
2,861
107
"""Responses classes""" """ Copyright (c) 2016-2020, EPFL/Blue Brain Project This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published by the Fre...
0cd78fdeee319c29cde68778e7f58fee3ba91a898ed3cc40aaa236df939833d8
Python
2,863
89
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmengine.registry import init_default_scope from mmseg.registry import MODELS def test_pidnet_head(): init_default_scope('mmseg') # Test PIDNet decode head Standard Forward norm_cfg = dict(type='BN', requires_grad=True) backbone_cfg =...
a9d7b398c3ed28c8f5605500453c75d55599a9cc824195f11780db02711b8a86
Python
2,864
63
from django.db import migrations, models import django.db.models.deletion forward = """ SELECT disable_history_tracking_for_table('catmaid_userprofile'::regclass, get_history_table_name('catmaid_userprofile'::regclass)); SELECT drop_history_view_for_table('catmaid_userprofile'::regclass); ALT...
619d8e118708c79de54f4687e6f6d26af6423da7fdaf6ff98a80bd58faa52e03
Python
2,866
89
import numpy as np # target_dist (target_distribution) f : x(state) -> double(probability) # proposed_dist (proposed_distribution) f : x(current_state) -> x'(new_state) # for sampling, object(MetropolisHasting).get_sample f : int(size) -> list(sampled values) class MetropolisHasting: def __init__(self, size, m...
21b9d799ff58e5ce6f42edc0eb89c1e8627cbc9aa22357baadbcecccbf25102c
Python
2,867
90
import torch.nn as nn import torch.nn.functional as F from layers import GraphConvolution import torch class GCN(nn.Module): def __init__(self, nfeat, nhid, out, dropout): super(GCN, self).__init__() self.gc1 = GraphConvolution(nfeat, nhid) self.gc2 = GraphConvolution(nhid, out) se...
ca7354e528b68560591d923f410bf636a9563576f19ccaee58e9af560550f4cc
Python
2,867
99
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from functools import partial import torch def _standardize(kernel): """ Makes sure that N*Var(W) = 1 and E[W] = 0 """ eps ...