sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
51820c9d38e314fdfd4d8b9c78692c2e68655528a2a8689395c26b94f5975cf4
Python
811
28
# Generated by Django 4.2.13 on 2024-07-12 19:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0080_alter_trackedshape_track"), ] operations = [ migrations.AddField( model_name="job", name="assignee_u...
a93e33ec6aabc1b111a021a1eee828219d6b4d0aca0cb9c09e1dccaeb67e4e1d
Python
811
25
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['tractometry.zip']) tmp_dir = tempfile....
dee6400ae3fd6abac40d23f3795e5d3d942407abe4688c850b474f9a6368c72a
Python
811
35
#!/usr/bin/env python """ Filter maf blocks for presence of wildcard columns. Blocks must meet the criteria of having at least `min_good` columns, each of which has more than `min_species` rows that are NOT wildcard bases ('*'). TODO: Allow specifying the character of the wildcard base. usage: %prog min_good min_spe...
b9844526838d602f9961d5335cd5794c0ee28ce0e569802be8e1f975e7b363e9
Python
812
32
# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides QtDesigner classes and func...
e893296addfb60b0e1e8b706403b2c83039279e6e6e79eebce9309a6b60f7631
Python
812
27
""" Create a cube mesh with perserved sharp edges """ import SVMTK as svm from pathlib import Path if __name__ == "__main__": print("Start ",__file__) outdir = Path("results") outdir.mkdir(exist_ok=True) surf1 = svm.Surface() # Creates a cube surfaces by specific two corners of the cube # Corn...
0f760cb94fcf0765aea29ae5421cef37b8df0698b5178d6571a61346cce5bf81
Python
814
28
import numpy as np def calculate_gncc(fixed, moving): mu_f = np.mean(fixed) mu_m = np.mean(moving) a = np.sum(abs(fixed - mu_f) * abs(moving - mu_m)) b = np.sqrt(np.sum((fixed - mu_f) ** 2) * np.sum((moving - mu_m) ** 2)) return a / b def calculate_ncc(fixed, moving): assert fixed.shape == ...
af53505356fea7d412099446c92ca955f6f9169d477c5e3621f8040ea0658b1b
Python
814
26
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys='surface_vtk_fib.zip') tmp_dir = tempfil...
00623c60067e4a305d5d633c81c47979a4ea8b3a53234845f1300c0fe2ff590f
Python
815
18
from brainscore_vision import stimulus_set_registry from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3 BIBTEX = """@article{islam2021shape, title={Shape or texture: Understanding discriminative features in cnns}, author={Islam, Md Amirul and Kowal, Matthew and Esser, Patrick ...
0224dba26ea72e720c85cba45a5d25efe6cfae09ef528ffd464117ee5ca0a967
Python
815
18
''' Collects commonly-used Modules for easier import. Ex: `from nems.modules import WeightChannels, FIR, DoubleExponential` ''' from .nonlinearity import LevelShift, DoubleExponential, RectifiedLinear, ReLU, \ Sigmoid, Hinge, PReLU, LogCompress, SoftRelu from .filter import FiniteImpulseResponse, FIR, STRF from ...
7037fb991f0a1aba839bff987fe8ebb50f475097c853509053c283b1d14037b4
Python
815
42
#!/usr/bin/env python """ Read a set of ranges and a nib file, print portions of nib overlapping those ranges to stdout usage: %prog range_file nib_file """ import bx.seq.nib from bx.cookbook import doc_optparse def __main__(): options, args = doc_optparse.parse(__doc__) try: range_file = open(arg...
918c11cb6e7ab56d2255a8d31d8e9804f77de50625f7f5891401aeb2a288e86a
Python
816
37
import os import sys import pickle import lmdb def wirte_to_lmbd(filename, outfilename): try: os.remove(outfilename) except: pass env_new = lmdb.open( outfilename, subdir=False, readonly=False, lock=False, readahead=False, meminit=False, ...
e13c9fec356c397b4917baa4f84f4299341022d06ea788771f894186834658e3
Python
816
37
import numpy as np import torch import torch.testing as ptt import unittest from deepdwi.recons import linsub from deepdwi.models import bloch if __name__ == 'main': unittest.main() devices = [torch.device('cpu')] if torch.cuda.is_available(): devices.append(torch.device('cuda')) class testLinsub(unittest....
00ba4bbcd1163ebd67fa582dee5b1ded15378b6781dcb525ca9094cd04bcc99f
Python
817
32
# Copyright (c) DP Technology. # 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 numpy as np import torch from . import BaseWrapperDataset class NumelDataset(BaseWrapperDataset): ...
333e970d82c962cefc6d8c018b292b053bd34fc1e42d915dc84a84dc8096959a
Python
817
33
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL import os import sys import shutil import tempfile from contextlib import contextmanager from types import ModuleType TEST_DIR = os.path.dirname(os.path.abspath(__file__)) TEST_DATA_DIR ...
35cb3f487f2b2deaf23537ce180bbc434ae74f17494787ee0a991a312f777379
Python
817
28
# -*- coding: utf-8 -*- """ *ClearMap* is a python toolbox for the analysis and registration of volumetric data from cleared tissues obtained with Light Sheet microscopy. The ClearMap code package is structured into four main modules: * **IO** for reading and writing images and data * **Alignment** for resampl...
2892bf9194b90509605c65126955c2985dd5700c4d2d017d9707db678d263e96
Python
818
28
from pathlib import Path from eir.experiment_io.label_transformer_io import load_transformers from eir.experiment_io.output_object_io_modules.output_io_utils import ( load_output_config_from_yaml, ) from eir.setup.output_setup_modules.tabular_output_setup import ( ComputedTabularOutputInfo, set_up_tabular_...
554b8ab1976964ff698fb5b407ae40d385ea12df69c2da04fcd2a5c26b01bf46
Python
818
23
import dtiplayground.dmri.preprocessing as base import dtiplayground.dmri.common as common import yaml logger=common.logger.write color=common.Color class @MODULENAME@(base.modules.DTIPrepModule): def __init__(self,config_dir,*args,**kwargs): super().__init__(config_dir,*args,**kwargs) def ge...
eeb04e9baa3e24e1c42bd24c6e0f55e958e470db9b1703ce459bb7e8d69f8d0c
Python
818
31
from torch import Tensor from typing import Tuple, List from torch import Tensor def get_adjacent_labels(x: Tensor, y: Tensor) -> List[Tuple[int, int]]: """ calculates which masks of a signle object have two labels (due to the border) :param x: :param y: :return: """ # Could ideally use...
f65358fd75411ed172d3c5fa35ed2d25e5b23bed0bf1f9e8089345a8aab75741
Python
818
33
import pandas as pd label = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/gilani-2017/label.csv') main_user = pd.read_csv('./user_feature.csv') user = main_user.loc[0:len(main_user)-1] user_list = list(user['user_id']) del_list = [] bool_label = [] cnt = 0 new = [] for i,r in label.iterrows(): if r[1]...
cfa46e769edee3cf425a83b0dd35c1306d00d66cd74a01815b3e4ca6d9cf016d
Python
819
15
from .auto_augment import RandAugment, AutoAugment, rand_augment_ops, auto_augment_policy,\ rand_augment_transform, auto_augment_transform from .config import resolve_data_config, resolve_model_data_config from .constants import * from .dataset import ImageDataset, IterableImageDataset, AugMixDataset from .dataset_...
26d2aa572ab5d6e13d24f4f7f2b988a16c95f3494ac87a3887a3ae6235af4eb0
Python
820
27
import csv from cv2 import IMREAD_REDUCED_GRAYSCALE_2 import numpy as np from pyparsing import lineStart from tqdm import tqdm import networkx as nx dataset_name='Twibot-22' edges=[] id_list=np.load('/data2/whr/lyh/twibot22_baseline/'+dataset_name+'/id.npy') id_list=list(id_list) id_include=set() G=nx.Graph() with open...
e59bb07bf55ecff7167f6de6d9c9766497fa9b28b489605bdc1f9848930393af
Python
820
32
import torch from torch import sin, cos, atan2, acos def rot_z(gamma): return torch.tensor([ [cos(gamma), -sin(gamma), 0], [sin(gamma), cos(gamma), 0], [0, 0, 1] ], dtype=gamma.dtype) def rot_y(beta): return torch.tensor([ [cos(beta), 0, sin(beta)], [0, 1, 0], ...
045559e621053a5bb47081d2ebe7c991171b19d3a5f6490f542e7c52ba5d22f7
Python
821
29
import torch from torch import nn from torch.autograd import Variable import torch.nn.functional as F from LSTHM import LSTHM import numpy #in=40, 3 modalities,4 attentions full_in=numpy.array(numpy.zeros([32,40])) inputx=Variable(torch.Tensor(full_in),requires_grad=True) full_in=numpy.array(numpy.zeros([32,12])) inp...
59cc7142e1fe4cc4ee1bd84a34c48b31c49544102b9f467f2da2e9731ecb3e18
Python
821
29
import numpy as np from nose.tools import eq_ from fancyimpute import SimilarityWeightedAveraging def test_similarity_weighted_column_averaging(): X = np.array([ [0.1, 0.9, 0.2], [0.8, 0.1, 0.01], [0.95, 0.2, 0.3], [0.14, 0.85, 0.3], ]) X_incomplete = X.copy() X_incomp...
d735139bebbec1558fb2443117e89530ce9e7870cad67e9d80593b948c683912
Python
821
22
# 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...
2008665d60489adaff7f1f52b2423f7879440d68829a2980486cfdff9a89e291
Python
823
30
# define utility functions import torch import random import numpy as np from torch.fft import * from torch.optim.lr_scheduler import LambdaLR def ifft2c(k): return ifftshift(ifft2(fftshift(k))) def fft2c(x): return fftshift(fft2(ifftshift(x))) def view_as_complex(x): x = torch.chunk(x, chu...
5dc4c740069f157be4fc22c9b47aa2c482d6b0b8d2c2cc4fcb2df9b6125c815f
Python
823
28
import pytest from qtpy import PYQT5, PYQT6, PYQT_VERSION, PYSIDE6, QtTest, _parse_version def test_qttest(): """Test the qtpy.QtTest namespace""" assert QtTest.QTest is not None if PYQT5 or PYQT6 or PYSIDE6: assert QtTest.QSignalSpy is not None if ( (PYQT5 and _parse_versio...
02566f4e1f86b4a228cbfb06c2c6ed1180c9241a1c791907ae8f8fcc243548e1
Python
824
24
# TODO # From supplement doc: # "align and combine datasets for fitting a single, large model" # So, for example, combining PEG and A1 data to fit with a single pop model. from nems.tools.arrays import concatenate_dicts def combine_neurons(*datasets, neurons_keys='response', axes=-1, newaxis=False): """Merge mu...
c20bfb2e055ceda3cadf4cdd0c8d44d8078cb28908a687b4ae4f94e9ec20ad4d
Python
824
25
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['processing.zip']) tmp_dir = tempfile.T...
c3130d2a52fc9261aa8ff10d0f0e83c8b601d557c2ebc8fc95de65b4151bae93
Python
824
37
# -*- coding: utf-8 -*- """TODO""" import os import core.core_global as core from core.device import Device class Monitor(Device): """TODO""" def __init__(self, filename): """TODO""" super().__init__() self.active = True self.filename = filename try: os....
ff939029bf2d270325befb74a9338c06690a60077d8b14bc6ea50f3459fd3a84
Python
824
29
#!/usr/bin/env python import warnings warnings.filterwarnings("ignore", message="numpy.dtype size changed") warnings.filterwarnings("ignore", message="numpy.ufunc size changed") import pandas as pd import numpy as np from sklearn.externals import joblib from PAINTeR import global_vars import PAINTeR.connectivity as con...
af2224678f760e204886050799f577e00c6dfa577f281b03df2990907d7f5460
Python
825
28
import subprocess import os import platform path_to_file = os.path.join(os.getcwd(), "bannotator") path_to_app = os.path.join(path_to_file, "app.py") pc_path_to_icon = os.path.join(path_to_file, "resources", "icon.ico") mac_path_to_icon = os.path.join(path_to_file, "resources", "icon.icns") if platform.system() == "Wi...
d4406f36be4d2d2a3b0ab28691c95901deee210cee72793e7a76d678be4ecae1
Python
825
19
from brainscore_vision import metric_registry from .metric import ConfusionSimilarity, TasksConsistency BIBTEX = """@article {Maniquet2024.04.02.587669, author = {Maniquet, Tim and de Beeck, Hans Op and Costantino, Andrea Ivan}, title = {Recurrent issues with deep neural network models of visual recogn...
eaebe9d8774d96761c37e9fc87c7bcdbc40227f5f37e8f4c616156271d782c25
Python
825
22
# 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...
182fb9c873db585c1cc76d128a8145cca9bea032223d6ba1defb98df6ff13612
Python
826
35
#!/usr/bin/env python """ Merge any overlapping regions of bed files. Bed files can be provided on the command line or on stdin. Merged regions are always reported on the '+' strand, and any fields beyond chrom/start/stop are lost. usage: %prog bed files ... """ import fileinput import sys from typing import ( T...
22eaae4eb1aab84500b582b098af711bb48d0d72f71a30f46d3662dce62726d4
Python
826
28
# -*- coding: UTF-8 -*- from __future__ import unicode_literals import sys import os sys.path.append("../") from whoosh.index import create_in,open_dir from whoosh.fields import * from whoosh.qparser import QueryParser from jieba.analyse import ChineseAnalyzer analyzer = ChineseAnalyzer() schema = Schema(title=TEXT...
2fcedd81c73b7479bf300fc733f3c42daefa29c276f0220e90b52417baeb999e
Python
826
31
import sys import logging logger = logging.getLogger('.'.join(__name__.split('.')[:-1])) _is_interactive = bool(getattr(sys, 'ps1', sys.flags.interactive)) _hander = None def unconfigure_logging(): if _hander is not None: logger.removeHandler(_hander) logger.setLevel(logging.NOTSET) def enable_l...
58eb929b00073d286060743ce4eff5be0bb226d09be0ba03f171ad9df7e4ab10
Python
826
31
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Linux-specific util...
c12dfd9e3d8b93392a3a8143a5d7781854299f536ace00cb1a241acf8d83364b
Python
826
27
class ShapeError(Exception): def __init__(self, layer, **shapes): """Raise in Layer.evaluate if data or parameter shapes are misaligned. Parameters ---------- layer : .layer.Layer Layer that the exception was raised from. shapes : dict Keys ...
0ec954904a99747d5e751b9604f0e29923bbb0153b3aa0f1b4c0f1d880a2e72a
Python
827
36
import subprocess import os def git_init(): print("Initializing git") subprocess.run(["git", "init"]) def dvc_init(): print("Initializing dvc") subprocess.run(["dvc", "init"]) subprocess.run(["git", "commit", "-qm", "build: initialize DVC"]) def git_commit(): print("Staging files") sub...
4ca93c2cff0a384115909e3716ac020c5f54c2e75d3b9e73d6403c67f49d0a08
Python
827
29
import base64 import numpy as np import requests def encode_array_to_base64(file_path: str) -> str: array_np = np.load(file_path) array_bytes = array_np.tobytes() return base64.b64encode(array_bytes).decode("utf-8") def send_request(url: str, payload: list[dict]) -> dict: response = requests.post(u...
6489fa5ed7489a3dcb8ce30f78ea59631e073327a1b834e842b015bf5c5caeac
Python
827
35
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from __future__ import annotations from cvat_sdk.api_client import apis, models from cvat_sdk.core.proxies.model_proxy import ( ModelDeleteMixin, ModelListMixin, ModelRetrieveMixin, ModelUpdateMixin, build_model_bases, ) _UserEn...
03b25dce8769a377af5b51501afeebbea165cbae0e2f05024b0cd6a78e08c4a5
Python
828
23
import os import pandas as pd def drosophila_data(datadate='20241119'): '''Prepare the drosophila VNC connectome and metadata''' dm_datadir = f'../data/{datadate}_dm_data' if not os.path.isdir(dm_datadir): os.mkdir(dm_datadir) if not os.path.isdir(dm_datadir + '/processed'): os.mkdi...
ac600f325346f9dd52c63516d301f3dd9f733ce0d265839893f7dd6ed29c5ff4
Python
828
31
# ----------------------------------------------------------------------------- # Copyright © 2009- The Spyder Development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provides Windows-specific ut...
e3193159fa8d7373e787078873c8b1f272c4bf6f022e3dd0fed9a33e8b46bee3
Python
828
27
# Generated by Django 4.2.6 on 2023-11-17 10:10 from django.db import migrations, models from cvat.apps.engine.models import Location def manually_remove_outdated_relations(apps, schema_editor): Storage = apps.get_model("engine", "Storage") CloudStorage = apps.get_model("engine", "CloudStorage") Storage...
eea8ada3bf3f648f8688e9875be13fa656f6a330fb659bcd6dec48a389e33d3e
Python
828
27
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved import torch @torch.library.custom_op("flash::flash_attn_func", mutates_args=()) def flash_attn_func_op( q: torch.Tensor, k: torch.Tensor, v: torch.Tensor ) -> torch.Tensor: from flash_attn_interface import flash_attn_func as fa3 r...
498619e533fd191b40edd49cd4ba32e7f93abb10094628c2b6211b4cabc6c3f3
Python
829
29
from .cnn import CNN6, CNN10, CNN14 from .resnet import ResNet10, ResNet18, ResNet34, ResNet50, ResNet101 from .efficientnet import EfficientNet_B0, EfficientNet_B1, EfficientNet_B2 from .ast import ASTModel from .ssast import SSASTModel from .projector import Projector _backbone_class_map = { 'cnn6': CNN6, 'c...
18857f6073dae96ced204af16f286a5db3091beadc3e9c60823cfbed66240c8b
Python
830
29
#encoding=utf-8 import sys import threading sys.path.append("../") import jieba class Worker(threading.Thread): def run(self): seg_list = jieba.cut("我来到北京清华大学",cut_all=True) print("Full Mode:" + "/ ".join(seg_list)) #全模式 seg_list = jieba.cut("我来到北京清华大学",cut_all=False) print("Defau...
e839d53c557c5fed3602f5392e46eaa12d3b9f3b1032847abc44ae00a4422af2
Python
830
15
import os import ClearMap.Settings as settings filename = os.path.join(settings.ClearMapPath, 'Test/Data/ImageAnalysis/cfos-substack.tif'); import ClearMap.Visualization.Plot as plt import ClearMap.IO as io data = io.readData(filename, z = (0,26)); import ClearMap.ImageProcessing.BackgroundRemoval as bgr dataBGR = bgr....
10de94a9fa998d01eed191843f723bc2bb0f655f306757726d67746492bbaaee
Python
831
37
import glob from sys import argv import numpy as np import os dir1 = argv[1] dir2 = argv[2] files1 = sorted(glob.glob(dir1+"/V_t*"), key=os.path.getmtime) files2 = sorted(glob.glob(dir2+"/V_t*"), key=os.path.getmtime) data_final = [] for f1, f2 in zip(files1, files2): data1 = open(f1, "r") data2 = open(f2, "...
f56f1adef4cbea9e73699e6ca0f18db6d8536ca01ccb6df3d0512afe8a36d45b
Python
831
30
import sys from setuptools import setup from setuptools import find_packages exec(open('mofapy2/version.py').read()) def setup_package(): install_requires = ['pandas', 'scipy', 'numpy', 'sklearn', 'argparse', 'h5py'] metadata = dict( name = 'mofapy2', version = __version__, description = 'Multi-...
18f9b2d2b615ad7d94733089f6adf5f4b212e79391aad1f76d530a0d0edf4d81
Python
832
26
"""Submit jobs to the BMRC cluster. """ import os def write_job_script(n_states, run): with open("job.sh", "w") as file: name = f"cc-{n_states}-{run}" file.write("#!/bin/bash\n") file.write(f"#SBATCH -J {name}\n") file.write(f"#SBATCH -o logs/{name}.out\n") file.write(f"#S...
dbb4740465120b3187ad563083e55b81979dface9e17020b47063c1d883bc8ad
Python
832
29
import json from pathlib import Path from eir.experiment_io.input_object_io_modules.input_io_utils import ( load_input_config_from_yaml, ) from eir.setup.input_setup_modules.setup_bytes import ComputedBytesInputInfo def load_bytes_input_object( serialized_input_folder: Path, ) -> ComputedBytesInputInfo: ...
fd14da70f0edaa18e2ce9d0a401a2208f4f100c047de923f40e9f438fe3fe52a
Python
832
20
from torch.optim.lr_scheduler import _LRScheduler # Polynomial learning rate scheduler class PolyLRScheduler(_LRScheduler): def __init__(self, optimizer, initial_lr: float, max_steps: int, exponent: float = 0.9, current_step: int = None): self.optimizer = optimizer self.initial_lr = initial_lr ...
4318a3108979d1a851cb3bbf10b7f43d8645dd6b08934f407971b0c7c7174bf8
Python
833
24
import numpy as np import statsmodels.stats.multitest def correct(pvals, method="fdr_bh", alpha=0.05): """ Performs multiple testing corrections available in statsmodels.stats.multitest.multipletests(). :param pvals: uncorrected p-values. Must be 1-dimensional. :param method: Multiple testing correct...
ee4da90ec458bd994ab92e2b28d7c33939706ed9a6af57d1470b2a08c6594356
Python
833
27
from pyment.utils.strip_extension import strip_extension def test_strip_extension_nii_gz(): assert strip_extension('sub-01.nii.gz') == 'sub-01', ( 'Expected strip_extension to strip .nii.gz as a single unit' ) def test_strip_extension_single_extension(): assert strip_extension('sub-01.mgz') == '...
fd46443ae4545cc996ba3fcd1161ac787108312892f0bf00785a4a9a25d85c0e
Python
833
30
#!/usr/bin/env python """ Test that software starts in various configurations. """ from storm_control.test.hal.standardHalTest import halTest def test_hal_starts_1(): halTest(config_xml = "none_classic_config.xml", test_module = "storm_control.hal4000.testing.testing") def test_hal_starts_2(): ha...
30ac2ff3b54e38330a866533eae8fe7f5306f87793e302085a6d28d1cae028d3
Python
834
33
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import os import re from http import HTTPStatus from http.server import BaseHTTPRequestHandler, HTTPServer class RequestHandler(BaseHTTPRequestHandler): def do_POST(self): TARGET_URL_PATTERN = re.compile(r"/" + os.getenv("PAYLOAD_ENDPOI...
34614492b263a67688d54914019416c71fdb1942a34af79154d2ca876aa0c036
Python
834
25
import pandas as pd import dask.dataframe as dd import csv labels = pd.read_csv("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-20/label.csv") user_final = [] for row in labels.iterrows(): user_final.append(row[1][0]) df = dd.read_csv("/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-20/edge.csv") user_to_pos...
cca11e50b449d4c6b08051d528a758e5dca2688af6c52797b07f0a9084676c20
Python
834
32
# -*- coding: utf-8 -*- """ Created on Fri Apr 11 19:03:57 2025 @author: axthi """ import sys # -------------------------------------------------- # NOTE: Update this path to fit to your installation path_to_utils = '/mrhome/axelt/memoslap_utils/memoslap' sys.path.append(path_to_utils) from simnibs_memoslap_utils.uti...
7138fb5db84112c66965f08c8da32dfbd5a1679d70d0f64d1e131441e978b17d
Python
835
39
import argparse import os.path import sys import warnings import torch import bism.eval.affinities import bism.eval.lsd from yacs.config import CfgNode torch.set_float32_matmul_precision('high') def main(): parser = argparse.ArgumentParser(description='SKOOTS Training Parameters') parser.add_argument('--...
9d0cf4e72be20d84fb1778e123a08940a012a28463f00b2f6b7fe66c9765cc0e
Python
835
26
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['processing.zip']) tmp_dir = tempfile.T...
bb1557e7ef90388e2c9895792221af5c4a906f7453f7ef37e3bcced5802af0ee
Python
835
26
from sklearn.ensemble import RandomForestClassifier import numpy as np import torch as th import sys sys.path.append("..") sys.path.append("../..") from utils import set_global_seed from utils.eval import evaluate_on_all_metrics def train(): train_data = np.array(th.load("train_data.pt")) train_label = th.load...
2e56d0771b8a03856f163d71b2cb3d5ee76d6e4b68bcc0a9bf4778ab91f5508b
Python
836
32
# Script to extract one data row for every countx each to generate test # data for test_epidata_get_Case_Data_read.py which is not to large import pandas as pd from memilio.epidata import defaultDict as dd from memilio.epidata import getDataIntoPandasDataFrame as gd # Put any CaseDataFull.json file or Update file ha...
5c5803a69d04d436db74e4248833bd472e32ce685a60775efe7b589408f2aa40
Python
837
27
from setuptools import setup, find_packages with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup(name='ecgxai', version='0.1.1', description='Neatly packaged AI methods for ECG analysis', author='Rutger van de Leur', author_email='r.r.vandeleur@umcutrecht...
82e410cda4a6fc75f55119a7471f0b5f269612dcf457d0472bb070e8e0410e39
Python
837
24
import os import glob import pandas as pd import scanpy as sc deconv_results = [] for afile in glob.glob(os.path.join('.', '*', '*_cell2loc_deconv.h5ad')): adata = sc.read_h5ad(afile) ''' # add 5% quantile, representing confident cell abundance, 'at least this amount is present' deconv_q5 = adata...
d1a7660ba1399d2775ea900da1fe177b2341ef05efcdad850f8167f8dceb068b
Python
837
31
import shutil from pathlib import Path def get_saved_model_path(run_folder: Path) -> str: model_path = next((run_folder / "saved_models").iterdir()) assert model_path.suffix == ".pt" return str(model_path) def zip_folder(target_folder: str, destination_zip: str | None = None) -> None: if destinati...
f9e9e2c2abdbbf05cdad8c3c3e620c0fde6e31c3ccaba1c4e8e04eca3cd1f959
Python
837
47
""" Common operations on matrices *Look into whether it's worth writing these in raw c* """ import numpy as np def nan_indices(data): """ Finds the indices of all missing values. Parameters ---------- data: numpy.ndarray Returns ------- List of tuples Indices of all missing value...
00f87c2af940d91e5b1a3ef4490fd9482c7ffaadc280c0d9e6c83a38f6cbca69
Python
838
27
from __future__ import annotations import numpy as np import PIL.Image from pytestqt.qtbot import QtBot from labelme._utils._image import img_qt_to_arr from labelme._widgets._brightness_contrast_dialog import BrightnessContrastDialog def test_combined_adjustment_preserves_clipped_brightness_pivot( *, qtbot: QtB...
641ee2f5a5b5e2ba7c9ab762dc7ba20f12c0f4c655642d8aa55b7d38ffb01817
Python
838
24
import scanpy as sc import pandas as pd h5ad_file = '/path/to/RNA.E.MATRIX.h5ad' csv_file = '/path/to/magmasiggenes.csv' #Format of csv is the default MAGMA output output_file = '/path/to/output_dir/RNA.E.MATRIX_siggenes.h5ad' adata = sc.read_h5ad(h5ad_file) print(f'Original dataset has {adata.n_vars} genes and {adat...
844509048560ae5ff68b524fdb1f0b722ae4bd75608e7f26aa34d8f0f29da3f7
Python
839
27
import pytest from tests.utils import pytest_importorskip def test_sip(): """Test the qtpy.sip namespace""" sip = pytest_importorskip("qtpy.sip") assert sip.assign is not None assert sip.cast is not None assert sip.delete is not None assert sip.dump is not None assert sip.enableautoconve...
94b8189e2b4175da746082dd5c655c3c3a87ad4b19b035679c974458007a0d1c
Python
839
27
"""Get training data. This script will download source reconstructed task MEG data collected using an Elekta scanner. The data is from the Wakeman-Henson dataset: https://www.nature.com/articles/sdata20151 It consists of 19 subjects performing a visual perception task. Each subject performed 6 runs. """ import os ...
73189ee03760182eaa75ca5401232c5b26df87885878c5070a2c34cdd72afc96
Python
840
35
#!/usr/bin/env python from pathlib import Path import numpy as np import PIL.Image here = Path(__file__).resolve().parent def main() -> None: label_png = here / "apc2016_obj3/label.png" print("Loading:", label_png) print() lbl = np.asarray(PIL.Image.open(label_png)) labels = np.unique(lbl) ...
e06e439e0149ec3916be3b0c31528239d2057d42ac774a250d1ddc8647bf3dc9
Python
840
30
# by Shaoxuan Yuan at 2024/04/22 from PIL import Image import numpy as np def image_to_numpy(image_path): # 使用PIL库打开图片 image = Image.open(image_path) # 将图片转换为NumPy数组 image_array = np.array(image) return image_array def save_numpy_as_npy(numpy_array, save_path): # 保存为.npy格式 np...
5388ec50469246a703ca7716e42de5d61a8499a81eaaf88e265954963f44cab7
Python
841
17
from brainscore_vision import benchmark_registry from .benchmarks.sanghavi2020_benchmark import DicarloSanghavi2020V4PLS, DicarloSanghavi2020ITPLS benchmark_registry['Sanghavi2020.V4-pls'] = DicarloSanghavi2020V4PLS benchmark_registry['Sanghavi2020.IT-pls'] = DicarloSanghavi2020ITPLS from .benchmarks.sanghavijozwik2...
f62abaa1df66c420d6febc5bc6fe1e181db138c9207685eb0c85c4d926a81104
Python
841
31
# update_ml_input.py import sys import re def update_ml_input(file_path, dataset_name): with open(file_path, 'r') as file: lines = file.readlines() for i, line in enumerate(lines): if line.strip().startswith("N;"): lines[i] = f"N;{dataset_name}\n" break wit...
2c29e21498a9fe43fb54cc6e11cebaf81d8e1129517d275f0fc69d47a37dc887
Python
842
29
import subprocess import sys import yaml script = 'flatmaps/plot_flatmap_countstats.py' scripts = [script]#[script_calc] pathpath = 'PATHS/filepaths_carlen.yml' with open(pathpath, 'r') as myfile: pathdict = yaml.safe_load(myfile) sys.path.append(pathdict['code']['workspace']) from pfcmap.python import settings as S ...
7602bc87baca013cc2a0fcc8d54fabcc3ecc1957248b361a862982d231bd4807
Python
843
36
import numpy as np def create_rank_k_dataset( n_rows=5, n_cols=5, k=3, fraction_missing=0.1, symmetric=False, random_seed=0): np.random.seed(random_seed) x = np.random.randn(n_rows, k) y = np.random.randn(k, n_cols) XY = np.dot(x, y) if symmetric: ...
77d353293627631f4592f1fd692f290b9007ab17da336b7035c260601efa3419
Python
843
26
import torch from ..util.util import asnumpy __all__ = ['Inference'] class Inference: def __init__(self, model, device=None, amp=False, transforms=None): self.transforms = transforms self.device = device or ('cuda' if torch.cuda.is_available() else 'cpu') self.model = model self.m...
a0ff32f1ce29cd3320b58bf866ab2911e227d422f951c2ffe2ac71c255d4b308
Python
843
26
from datetime import timedelta from kaapana.operators.KaapanaBaseOperator import KaapanaBaseOperator from kaapana.blueprints.kaapana_global_variables import DEFAULT_REGISTRY, KAAPANA_BUILD_VERSION class DicomToNiftiOperator(KaapanaBaseOperator): def __init__( self, dag, name="dicom-to-nifti...
0ebe62c76ea8e5754bc4c12c19d76cbd0401ad3ddd377166a7f345867c1a5b3d
Python
844
28
""" Bypass the required registration step for higher level analyses in FSL FEAT """ import subprocess import glob ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti' subs = ['sub-12'] for sub in subs: funcDir = f'{ROOT}/derivatives/{sub}/func' featFolders = sorted(glob.glob(f'{funcDir}/*.feat')) ...
242f7ee618f31f4fb5ddaefef1a584a549a14620223eb27e2a1cce6b1b234d54
Python
845
21
class Test_MAE_Config: def test_config(self,dropConfig,demo_dir): assert dropConfig.MAE.getWorkdir() == f"{demo_dir}/Scripts/MonoallelicExpression/pipeline" dict_ = { 'qcVcf': f'{demo_dir}/Data/qc_vcf_1000G.vcf.gz', 'groups': ['mae'], 'qcGroups': ['mae'], ...
42cc727143e5aa0e0718bd31cdfdd854b32cc943f80b3991e9c0103da04a3f45
Python
845
29
import glob import os def replace_in_file(path, old, new): with open(path, 'r', encoding='utf-8') as f: text = f.read() if old in text: text = text.replace(old, new) with open(path, 'w', encoding='utf-8') as f: f.write(text) print(f"Reverted: {path}") def batch_rep...
53f83ea07f87902772d3a22e537066428c73493426ce796f2febefa0315a1147
Python
845
28
""" Interaction tools for image manipulation in MuscleX. Tools are pure logic handlers that process mouse events on matplotlib axes. They are NOT Qt widgets - they handle behavior, not UI. """ from .interaction_tool import InteractionTool from .tool_manager import ToolManager from .chords_center_tool import ChordsCen...
0648a0db2c1ae36e5586a69bbdcd0ac46af7e6d422af75905c2701f403265e1f
Python
846
25
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT # Inherit parent config from cvat.settings.production import * # pylint: disable=wildcard-import # We use MD5 password hasher instead of default PBKDF2 here to speed up REST API tests, # because the current implementation of the tests requires auth...
45515347e27bdfdbe079485351ba2f18fe56de4550e158c7dae50df38a831fd7
Python
846
26
#!/usr/bin/env python3 """Train and evaluate the non-physiological artifact detector.""" import logging from artifact_identification.detectors.non_physiological import NonPhysiologicalDetector def main(): logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') ...
6cf514bc3102acd9ec458035b4f9f56a8e213ac3ee86fb453543794541e02bd9
Python
846
41
from cProfile import label import numpy as np import pandas as pd import json import torch from pathlib import Path def str_to_int(s): if s == 'human': return 1 else: return 0 path1 = Path('datasets/Twibot-20') data = pd.read_csv(path1 / 'label.csv') data_label = {} for id in data['id']: ...
afe9a013bb003986ad14462381d5d7287d118ce2ef439147d2b731bfcfa0351d
Python
846
16
from .agc import adaptive_clip_grad from .attention_extract import AttentionExtract from .checkpoint_saver import CheckpointSaver from .clip_grad import dispatch_clip_grad from .cuda import ApexScaler, NativeScaler from .decay_batch import decay_batch_step, check_batch_size_retry from .distributed import distribute_bn,...
bc1da179878dc5ac3618f565a23d35571d94ffa255c2a2bac1e826db9606d86e
Python
846
28
import pandas as pd import numpy as np import sys from util import read_list, read_cluster_gene from filter_gene import * if __name__ == '__main__': wt_expr = pd.read_csv(sys.argv[1]) pcgs = read_list(sys.argv[2]) genes = list(wt_expr.columns) print(len(genes)) genes = remove_marker(genes) ge...
46b591cc4a2ab51de5b0eda50336176e82cf6f7b98117db3ded2f18812155a37
Python
847
31
from .reshape import Reshape from .sequential import Sequential from .data_parallel import DataParallel from .to_hetero_transformer import to_hetero from .to_hetero_with_bases_transformer import to_hetero_with_bases from .to_fixed_size_transformer import to_fixed_size from .encoding import PositionalEncoding, TemporalE...
4e7647a0bca5285000a4d439a3f30982d77f298fd192d83da2be615febaa51b5
Python
847
26
import nilearn as nl def get_template(template="T1", resolution=2, threshold=None): ## case MNI152 grey matter template or mask if template in ["gm", "GM", "gmv", "GMV"]: if threshold is None: temp = nl.datasets.load_mni152_gm_template(resolution=resolution) else: t...
6a0b154cdca70be99e7a0945991dc39bcf100bb35878cd7aac02f5691cfdb44a
Python
847
25
from urllib.parse import urlparse def stream_batch(batch_path: str, temp_dir: str = 'tmp') -> str: """Dry version of `count.stream_batch`. """ with open(batch_path, 'r') as f: for line in f: if line.isspace() or line.startswith('#'): continue sep = '\t' if '...
a5cee9e06ef13c53d1de8f1241cdc15875bb7ab8ca6940a3d9f66e544c504cff
Python
847
26
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import get_testing_files_dict, fetch_data # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['others.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_hel...
b5395c85e3eaef75cf5bde9ce55584435ab261676cbdcd5856770fa65acf2d7a
Python
847
38
""" Model utilities for flync EBM classifier. This module provides schema validation and prediction utilities for the EBM-based lncRNA classification model. """ from .ebm_predictor import EBMPredictor, EBMPredictorWithScaler from .schema_extractor import ( ModelSchema, extract_and_save_schema, extract_sch...
c731ab8844980b1a6f518454db0c81f3493f66f3cfbd6b1bdcbdc54d181f7403
Python
847
33
from setuptools import setup, find_packages with open("README.md", "r") as f: long_description = f.read() with open("cellseg/__init__.py", "r") as f: init = f.readlines() for line in init: if '__author__' in line: __author__ = line.split("'")[-2] if '__email__' in line: __email__ = ...
b194da1ddb790c811018a89c6f6f75e3fb8b442919cdba773b490eacf9fa762e
Python
848
20
from testsetclass import TestsetClass class C60ISO(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['2', '9', '3', '10', #'7', '8', '1', '4', '5'] self.exp_values = {'0': 37.40, '1': 56.87, '2': 56.89, '3': 69.89, '5': 111.72, '6': 142....
bb119f3b6a589c13f80ed23b0fbf873f8ac5479d497c376f64d902422ecd1a41
Python
848
27
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['tractometry.zip']) tmp_dir = tempfile....
cef9a52779793799b093b6dce0507d231f3fd3ce7fc20f06b52c7f385f299d7f
Python
848
34
import base64 import numpy as np import requests def load_and_encode_data(data_pointer: str) -> str: arr = np.fromfile(data_pointer, dtype="uint8") arr_bytes = arr.tobytes() return base64.b64encode(arr_bytes).decode("utf-8") def send_request(url: str, payload: list[dict]) -> dict: response = reques...
a7a4991fc72036f1435e2835f89973c14a58c15c66a442bd1a8e03add676861b
Python
849
26
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys='surface_vtk_fib.zip') tmp_dir = tempfil...
1c03b2c13a26bee4203b771e835e6edecbb695eab5454668ef7f6a2b7a1af532
Python
850
17
# Copyright (c) OpenMMLab. All rights reserved. from .compose import Compose from .formating import (Collect, ImageToTensor, ToDataContainer, ToTensor, Transpose, to_tensor) from .test_time_aug import MultiScaleFlipAug from .loading import DepthLoadAnnotations, DisparityLoadAnnotations, LoadIma...