sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8f1a4fd1e47a4a8f9eb77aaaa0d0da500a7fee4c84349ca94dbb9a23a705d12c | Python | 2,054 | 57 | # todo:
# adding more datasets as positivity benchmarks
# and maybe order it nicely in a Class of Simulated_data
import numpy as np
import pandas as pd
def _rotate_data(X, angle_rotation):
""" rotate only the first 2d """
angle = np.deg2rad(angle_rotation)
rot_2d = np.array([[np.cos(angle), -np.sin(a... |
ad5a3c4fe3d02c38f6efc9edd61d780c74964fa89e1f1087c1a5baddcfebd88d | Python | 2,054 | 58 | import user_features as uf
import csv
import ijson
import pandas as pd
import time
def get_user_vector(user):
user_vector = {
"id": uf.get_user_id(user),
"screen_name_length": uf.get_screen_name_length(user),
"description_length": uf.get_description_length(user),
"account_longvity"... |
578261fbbd4c2dddc18bb6a03d9ba816a280ab920932065647035a96577e7365 | Python | 2,055 | 64 | import json
from pathlib import Path
import numpy as np
from eir.experiment_io.io_utils import load_dataclass
from eir.experiment_io.output_object_io_modules.output_io_utils import (
load_output_config_from_yaml,
)
from eir.setup.output_setup_modules.array_output_setup import (
ArrayNormalizationStats,
Co... |
81789c50ea3d0d0a63d2f9ee74d95c459cdafad825455a49ed304b842697562e | Python | 2,055 | 32 | import argparse
def get_args(params):
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-NPZ", type=str, required=True, help="input distograms and anglegrams (NN predictions)")
parser.add_argument("-FASTA", type=str, required=True,help="input seq... |
beb9a9f05f0dd8b48216658f1662a298ca6147d7598fe6ce76ac9a6d36486491 | Python | 2,055 | 67 | # Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from django.contrib import admin
from django.contrib.auth.admin import GroupAdmin, UserAdmin
from django.contrib.auth.models import Group
from django.utils.translation import gettext_lazy as _
from cvat.ap... |
fc7b64df1961ce0ed9d29815533738b59c3d311feb1fac2093cec5919482e3df | Python | 2,055 | 72 | # -*- coding: utf-8 -*-
# python standard library inputs
import os
# external inputs
import numpy as np
import nibabel as nb
import matplotlib.pyplot as plt
def get_nuisance_regressor(file_in, wm_mask, csf_mask, path_output):
"""Get nuisance regressor.
This function creates nuisance regressors from a f... |
84b01dc951dd2fdb73cb5f327b593f0b96e6740ac382e649f3a93aa780cffbb5 | Python | 2,056 | 25 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
### AlexNet_training_seed_01 with different fields of view than 8 visual degrees (default) ###
# exploring 4, 12, 16 visual degrees
# code is adapted fr... |
aa64e293e1c9ee2ea4ef88064f9b9990e37450331689fd2690834780959edfac | Python | 2,056 | 71 | import json
from pathlib import Path
import numpy as np
import torch
from PIL import Image
from torchvision import transforms
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from .architecture import build_model
IDENTIFIER = "eicircuit_resnet18_bn_20260919"
LAYERS = [
"features.ma... |
3a2e2a9608107e3757542152f6fc95b7ea7fcdddc6cbaf45be0b579fec0efe17 | Python | 2,057 | 55 | import numpy as np
import warnings
from bread.data import Lineage, BreadWarning
__all__ = ['align_lineages', 'accuracy']
# TODO : a function to validate a Lineage
# i.e. does each bud_id appear once, do ids follow etc
def align_lineages(lineage_truth: Lineage, lineage_pred: Lineage):
parent_ids_pred = np.empty_like... |
f0fe9a1c88c400b7374839c21e4c227d9501d39a021292530dab800c39486a51 | Python | 2,057 | 50 | import torch
import numpy as np
def batched_calculate_gncc(fixed_images, transformed_moving_images, memory_dict=None, batch_size=None):
"""
Calculate GNCC between a fixed image and a batch of moving images.
Args:
- fixed_images: PyTorch tensor of shape (N x H x W)
- transformed_moving_images: PyTo... |
0a04c7efee10294e44837a399773e064dc596af97adf2b6cb9182debaa3f38bd | Python | 2,058 | 52 | """Reading raw data that isn't on this machine.
The pipeline consumes raw recordings through a tiny read-only protocol
(:mod:`meanap.remote.base`), so the same code path serves a local directory and
a remote source. :mod:`meanap.remote.cache` bounds how much of a remote dataset
is resident at once, which is what allow... |
36046b140b75fdbe9d58dbb55972da39ef6484923c99cd486db936bda3558bfc | Python | 2,058 | 69 | import plotly.express as px
from argclz import AbstractParser, as_argument
from neuralib.atlas.ccf.dataframe import RoiNormalizedDataFrame
from neuralib.util.verbose import print_save
from rscvp.atlas.dir import AbstractCCFDir
from rscvp.util.cli.cli_roi import ROIOptions
from rscvp.util.util_plot import REGION_COLORS... |
ad3e033fb551c880ae1e77ab674c4dab6d041de449229ed0e45890f59e34d780 | Python | 2,058 | 56 | import random
import numpy as np
import torch
def parse_range(range_str):
"""Parse range string in format 'start:end:step' into a list of values"""
try:
start, end, step = map(float, range_str.split(':'))
# Add a small epsilon to ensure end value is included
epsilon = step / 100
... |
1578240e8c5b35fbd9ee02da7227eec82d64ecd7651a4c3a47749b3aad8624e8 | Python | 2,059 | 65 | import warnings
import numpy as np
def validate_params(params: dict, defaults: dict) -> dict:
"""
Validate and coerce parameter values based on defaults.
- Uses the type of each default value as the expected type
- If a parameter is missing or invalid, the default is used
- Extra keys in params ar... |
6984f25949b30797848f72346ca71640c76fbf6a4768993ac245e7fdde69742b | Python | 2,059 | 68 | # This file contains the setup for the figures in the paper
# Graphical setup
import matplotlib.pyplot as plt
plt.style.use("../style.mplstyle")
# plt.rcParams.update({"text.usetex": True})
# importing the necessary libraries
import sys
from pathlib import Path
import cmcrameri.cm as cmc
import h5py
import numpy as... |
95c2c89d9c09cfd4583e9dff45a6f7e91eb32e79976e70c96a850fe50f0cebae | Python | 2,059 | 58 | """The layer key list, which has one definition shared by three readers.
``Isocortex3dProjector`` and ``IsocortexCoordinateProjector`` expose it as a
class attribute and ``metrics`` keys ``LAYER_LABELS`` on it. The three must
agree, because a thickness file written by ``metrics`` is read back by the
projectors -- so t... |
d09ced2c3aeaa91a73e7df63c78e3ccb48a5a23a4d90a0f2c84e6985902d8241 | Python | 2,059 | 64 | # Copyright 2024 DeepMind Technologies Limited
#
# 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.0
#
# Unless required by applicable law or agree... |
d9264e29ff3e09b1544ec21fbc11f4beeda7d41e8c590f6ba4db0ee4bc2e2473 | Python | 2,061 | 45 | #! /usr/bin/env python
import os
import re
from distutils.core import setup, Extension
# Don't use Extension support for swig, it is more annoying than
# anything! (1)It does not support very well having the .i in a
# different directory. (2)It runs swig every single time, even if it
# ran successfully before. So (3... |
e2bfef1abed8eb3843fb070558c037d1082206437b20e0a0b5ba9c2801f485ce | Python | 2,061 | 54 | import torch
import torch.nn as nn
import torch.nn.functional as F
class DoubleConv(nn.Modul):
def __init__(self, in_channels, out_channels):
super(DoubleConv, self).__init__()
self.conv = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bi... |
6dd47762db56963fc9a5cd45f70a1bdcdab7ccec5da37c8c6c110889162035d0 | Python | 2,062 | 41 | """First-order Sugeno ANFIS baseline.
Rule count is 2^k in the number of inputs, so the feature vector is projected to
`n_inputs` principal components before the fuzzy layer -- the standard remedy for
ANFIS's rule explosion, and the reason ANFIS is included here as a *baseline*
rather than as the interpretable output ... |
5b6ed9af311d82627fdf7a579f82e725572c502e78ceabafcea3314960e2c5d2 | Python | 2,063 | 71 | import json
from pathlib import Path
import numpy as np
import torch
from PIL import Image
from torchvision import transforms
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from .architecture import build_model
IDENTIFIER = "eicircuit_resnet18_abs_group_20260921"
LAYERS = [
"feat... |
328f3f77e73f8d8f5ca18f2a614a113f88141bd1a6554f5130e8b2addc8145a9 | Python | 2,064 | 58 | import argparse
import torch
from torch_geometric.nn import Node2Vec
from ogb.linkproppred import PygLinkPropPredDataset
def save_embedding(model):
torch.save(model.embedding.weight.data.cpu(), 'embedding.pt')
def main():
parser = argparse.ArgumentParser(description='OGBL-PPA (Node2Vec)')
parser.add_a... |
9a554b0a8e17ed386616f76107d41a2400377ea38b5e36e20452bea0baaf4cdd | Python | 2,064 | 62 | # Copyright (C) 2019-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
# Note: It is slightly re-implemented Django version of code. We cannot use
# get_version from django.utils.version module because get_git_changeset will
# always return empty value (cwd=repo_dir isn't correct). Also it gives us a
# way to d... |
c161033ecc20f0878812a61b72ed5a80e20e6574f1a348f9a47f8eacf54380ba | Python | 2,064 | 57 | from typing import Iterable
import numpy as np
from neuralib.util.verbose import publish_annotation
from rscvp.visual.main_polar import BaseVisPolarOptions
from rscvp.visual.util import PrefSFTFParas
from .util_plot import AbstractTopoPlotOptions, Metric
__all__ = ['VisTopoPlotOptions']
@publish_annotation('main',... |
c92c0fba853c2fea07cd96f8d5945cdfac939faa6b1a186e6753024f67aa9237 | Python | 2,064 | 58 | import user_features as uf
import csv
import ijson
import pandas as pd
import time
def get_user_vector(user):
user_vector = {
"id": uf.get_user_id(user),
"screen_name_length": uf.get_screen_name_length(user),
"description_length": uf.get_description_length(user),
"account_longvity"... |
098fd6c0d1b4a1021b8dfcc5df3a0684d122fe5935f44dc934ce166cdd51bea8 | Python | 2,065 | 60 | """
Helper functions for lasagna. Functions in this file are involved in the following task:
Finding plot widgets by name within an object.
"""
def find_pyqt_graph_object_name_in_plot_widget(PlotWidget, itemName, regex=False, verbose=False):
"""
Searches a PyQtGraph PlotWidget for an plot object (i.e. somethi... |
0f51fbbadaee5ac55bbb0b5b67c28bd9bb15f2e72ad7dc3f5d0ecf186e25120a | Python | 2,065 | 75 | #!python
import shutil
import os
from pathlib import Path
import traceback
import yaml
import re
from functools import wraps
import subprocess
import sys
from dtiplayground.config import INFO as info
import dtiplayground
import dtiplayground.dmri.common as common
import dtiplayground.dmri.common.module as module
fro... |
6c728074299c269e5d719cc27267b1e340b5a0f875df388f8b26fc8a54dc1414 | Python | 2,065 | 74 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 16:18:56 2023
@author: rl05
"""
import os.path as op
from mne import compute_covariance, read_epochs
import config
subjects = config.subject_ids
data_dir = op.join(config.project_repo, 'data')
preprocessed_data_path = op.join(data_dir, 'prep... |
0186a1c0d46c17bfdd02180333c28e7607cd9c19c2ac4d5ca0e1f0fae225f9a6 | Python | 2,066 | 76 | """Post-hoc calculation of state-spectra using a multitaper.
"""
from sys import argv
if len(argv) != 3:
print("Please pass the number of states and run id, e.g. python 4_calc_multitaper.py 8 1")
exit()
n_states = int(argv[1])
run = int(argv[2])
#%% Import packages
print("Importing packages")
import os
imp... |
14e41cdfc644e2a413d386a3bcc4d24bfa3463bb07d0568b01ef5cc84ecd333b | Python | 2,066 | 58 | import argparse
import torch
from torch_geometric.nn import Node2Vec
from ogb.linkproppred import PygLinkPropPredDataset
def save_embedding(model):
torch.save(model.embedding.weight.data.cpu(), 'embedding.pt')
def main():
parser = argparse.ArgumentParser(description='OGBL-DDI (Node2Vec)')
parser.add_a... |
30dcf744e0e1ff712829a9763afdb1e23a4d362382943fa4650bcf7922e237e7 | Python | 2,066 | 58 | import user_features as uf
import csv
import ijson
import pandas as pd
import time
def get_user_vector(user):
user_vector = {
"id": uf.get_user_id(user),
"screen_name_length": uf.get_screen_name_length(user),
"description_length": uf.get_description_length(user),
"account_longvity"... |
c7c6df40afade24d698ee1002765e4d73d9667f88bd3992757c00dba9e265173 | Python | 2,066 | 45 |
dependencies = ['torch', 'torchvision']
import torch
from cosplace_model import cosplace_network
AVAILABLE_TRAINED_MODELS = {
# backbone : list of available fc_output_dim, which is equivalent to descriptors dimensionality
"VGG16": [ 64, 128, 256, 512],
"ResNet18": [32, 64, 128, 256, 512],
"R... |
fbf631d8a11271ba0d78fd887014ef757f42619b11f2e51e4661b7534174ba88 | Python | 2,066 | 58 | # ==============================================================================
# Binaries and/or source for the following packages or projects are presented under one or more of the following open
# source licenses:
# EvalDemo.py The OpenLane Dataset Authors Apache License, Version 2.0
#
# See:
# https... |
63b65a634da0ffbdfc9aa93ddc870c2bb1de060c096cf6ed2163cfa537313a43 | Python | 2,067 | 81 | import pydoc
import sys
from importlib import import_module
from pathlib import Path
from typing import Union
from addict import Dict
class ConfigDict(Dict):
def __missing__(self, name):
raise KeyError(name)
def __getattr__(self, name):
try:
value = super().__getattr__(name)
... |
fc9ecede3ba9e6ef4f5fb4d47a23494fe342db960468b0e5d747c2f0a694c9e0 | Python | 2,067 | 53 | import matplotlib.pyplot as plt
import numpy as np
import networkx as nx
import dgl
def delaunay_dgl(spatial_coords, if_plot=True, graph_strategy='convex'):
coords = np.column_stack((np.array(spatial_coords)[:, 0], np.array(spatial_coords)[:, 1]))
delaunay_graph = coords2adjacentmat(coords, output_mode='raw',... |
9233790f034d918efbf125de9ec0d77c50f810f84dcffed3f8531f5ea1aeea85 | Python | 2,068 | 77 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from abc import ABC, abstractmethod
from datetime import datetime
from django.conf import settings
from django.utils.module_loading import import_string
from django.utils.timezone import now
from cvat.apps.iam.models import User
from cvat.apps.orga... |
ac5d3701e7d2db28952d13b99300fa9b7016aaa878bce6c8f91546b9652e134e | Python | 2,068 | 43 | import os
import subprocess
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--scripts_dir', nargs='?', type=str, default='scripts')
parser.add_argument('--script_templates_dir', nargs='?', type... |
e39ca80a02e3b86ef903e6c461b151488f96078748cf7fe32fb63180b5d53717 | Python | 2,068 | 58 | import argparse
import torch
from torch_geometric.nn import Node2Vec
from ogb.nodeproppred import PygNodePropPredDataset
def save_embedding(model):
torch.save(model.embedding.weight.data.cpu(), 'embedding.pt')
def main():
parser = argparse.ArgumentParser(description='ogbn-italo (Node2Vec)')
parser.add... |
75768acc5e622a9dadc06da964055eb1fd4f93fffbd5fe4dca1fb94cb35ff411 | Python | 2,069 | 70 | #CMU Multimodal SDK, CMU Multimodal Model SDK
#Tensor Fusion Network for Multimodal Sentiment Analysis, Amir Zadeh, Minghai Chen, Soujanya Poria, Erik Cambria, Louis-Philippe Morency - https://arxiv.org/pdf/1707.07250.pdf
#in_modalities: is a list of inputs from each modality - the first dimension of all the modality... |
657357a54eee426d6947050205ecb3423cc46b22627e91a8554f4e5ad55eb8f7 | Python | 2,070 | 58 | import argparse
import torch
from torch_geometric.nn import Node2Vec
from ogb.linkproppred import PygLinkPropPredDataset
def save_embedding(model):
torch.save(model.embedding.weight.data.cpu(), 'embedding.pt')
def main():
parser = argparse.ArgumentParser(description='OGBL-COLLAB (Node2Vec)')
parser.ad... |
1b27f5ee27d1a89ce1fe7ead842e497f8b016eccc5356ddca95fe5887a0c7ca7 | Python | 2,071 | 52 | import os
import tkinter as tk
from tkinter import filedialog, messagebox
from .base_window import BaseWindow
from .visu_window import VisuWindow
class WelcomeWindow(BaseWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Title Label
title_label = tk.Label(se... |
445ccd4a2ec355b762dc09cefce3a8cc29e9ac5cd6cfd3196fdc4472cd5452cc | Python | 2,071 | 57 | import string
import sys
import os
import glob
import re
import csv, logging
ENSEMBLE_TO_UNIPROT_FILE = '../data/hsa_pan/ensemble_to_uniprot.csv'
KO_TO_UNIPROT_FILE = '../data/KO_gene_hierarchy/KO_gene_hierarchy_organism_mapping/hsa_mapping.csv'
PRIMATE_PROTEOME_FILE = '../data/hsa_pan/hsa_pan_abundance.csv'
OUTPUT_PA... |
ea421f43c0dd4199c333bdd61a76fe01c9500ecb818b178f1c8ab68ee2d81f62 | Python | 2,071 | 52 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import sys
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
matplotlib.rcParams['svg.fonttype'] = 'none'
'''
python cluster_change.py pcgs.6
'''
def draw_cluster_change(c:str... |
f5d3f0affca3e71f203d49778399dee38e23e0dcc0ddc55a4567cb24876dfdfc | Python | 2,071 | 68 | import glob
import os
import nilearn
import importlib
import myreporting_second
import numpy as np
import gc
import pickle
import pathlib
import fire
import matplotlib
import matplotlib.pyplot as plt
from nilearn.glm.second_level import SecondLevelModel
import sys
sys.path.insert(0,'..')
import contrasts
def mai... |
6dbf067e91188cb6f8f255cdfc8640b9f6f932c14cfb5c10e2f0aef0cbd3ecb3 | Python | 2,072 | 51 | import torch
from tqdm import tqdm
import numpy as np
from transformers import pipeline, T5Tokenizer, T5EncoderModel
import os
import pandas as pd
path='/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/'
user=pd.read_json(path+'user.json')
# feature_extract=pipeline'feature-extraction',model='roberta-base',tokeni... |
6fa3206042032fe4a9194acb6b11c8cc2a636dedf494fdca34f7cf8b22e7cd49 | Python | 2,072 | 46 | ##
## EXAMPLE RUN:
## python make_maps_runfile.py MY_113.MY_115_test /home/jurici/work/PLACseq/MAPS_pipe/results/mESC/ /home/jurici/work/PLACseq/analysis/binning_for_regression/new_set/final.replicated.narrowPeak /home/jurici/work/PLACseq/data/genomic_features/F_GC_M_MboI_5Kb_el.mm10.txt /home/jurici/work/PLACseq/analy... |
75c7eb54c28d1e7eaf93640ab62b9aaa8d5950c823861e3a6a88110b8eb8015e | Python | 2,072 | 81 | #!/usr/bin/env python
"""
Test taking movies.
"""
from storm_control.test.hal.standardHalTest import halTest
def test_hal_tcp_tm_1():
halTest(config_xml = "none_tcp_config.xml",
class_name = "TakeMovie1",
test_module = "storm_control.test.hal.tcp_tests")
def test_hal_tcp_tm_2():
hal... |
be2a754c94083cf06bc7c8b9fbfd7c8deab91f90488e2faf30a2b936c6250565 | Python | 2,072 | 75 | #!/usr/bin/env python3
import arbor as A
from arbor import units as U
import numpy as np
from util import plot_spikes, plot_network, randrange
from random_network import random_network
# global parameters
# cell count
N = 10
# total runtime [ms]
T = 10000
# one interval [ms]
t_interval = 100
# numerical time step [m... |
34945cbb392f6e4d689bdb4d13a55f2d7c13f8566dd73340de8dfcaeb2e51a31 | Python | 2,073 | 66 | import time
import argparse
import torch
from tqdm import tqdm
from torch.optim import Adam
from pathlib import Path
from types import SimpleNamespace
from torch_geometric.data import Batch
from eval_utils import load_model, lattices_to_params_shape, recommand_step_lr
from pymatgen.core.structure import Structure
fr... |
fcbc939b01d9cba3b0f0c853c10ae4ff8d2556b2bf6b0849636417120f53b2bc | Python | 2,073 | 94 | #!/usr/bin/env python
import sys
import argparse
import pandas as pd
import numpy as np
import yaml
import csv
import gzip
import logging
from tqdm import tqdm
import hto_gex_mapper
logger = logging.getLogger("translate_barcodes")
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s - %(name)s - %(l... |
1b1c78b77e08152cc8391b798ff9db2c774496ee11ebdc36c3251fd2a6bf8585 | Python | 2,074 | 46 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'qt_regex_file_dialog.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... |
cc8e55bafd9f0b6c7a845b8d2657031c58637dca86a4cf12e90cace1d81d2748 | Python | 2,074 | 58 | import argparse
import torch
from torch_geometric.nn import Node2Vec
from ogb.nodeproppred import PygNodePropPredDataset
def save_embedding(model):
torch.save(model.embedding.weight.data.cpu(), 'embedding.pt')
def main():
parser = argparse.ArgumentParser(description='OGBN-Proteins (Node2Vec)')
parser.... |
f794208418e242a8d5953c336f05fdbaccca8705d424a7de15871007d9205687 | Python | 2,074 | 58 | import argparse
import torch
from torch_geometric.nn import Node2Vec
from ogb.nodeproppred import PygNodePropPredDataset
def save_embedding(model):
torch.save(model.embedding.weight.data.cpu(), 'embedding.pt')
def main():
parser = argparse.ArgumentParser(description='OGBN-Products (Node2Vec)')
parser.... |
13990ebf8b0b8ab113cd5703075b54ef0cdedb3f27c0128db12462a9caaa0922 | Python | 2,075 | 59 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from unittest.mock import MagicMock, patch
from django.test import TestCase, override_settings
from rq import Retry
from cvat.apps.engine.models import Project
from cvat.apps.iam.models import User
from cvat.apps.webhooks.dispatch import add_to_que... |
46d89807e14c129495f20410118fc374eac8bfb30362572afcf7f96f384f978e | Python | 2,075 | 70 | import os
import numpy as np
from pcntoolkit.normative import predict
from pcntoolkit.util.utils import create_design_matrix
def predict_nm(roi, df_features, df_covariates, set, params, model_suffix='estimate'):
""" Make prediction based on a pre-estimated normative model and return outputs.
Arguments
... |
1ee5fba431f359ef92499238d8211b3c618fa4f4c9919b462614387005b7d59e | Python | 2,076 | 58 | import user_features as uf
import csv
import ijson
import pandas as pd
import time
def get_user_vector(user):
user_vector = {
"id": uf.get_user_id(user),
"screen_name_length": uf.get_screen_name_length(user),
"description_length": uf.get_description_length(user),
"account_longvity"... |
72cb36cc98ac7c874b09fab190e4523d4c3d849c550048cbd3474d681c0daa46 | Python | 2,076 | 53 | import pandas as pd
import glob2
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
confusion_matrices = list()
for file_path in glob2.glob('results/23-10-23_voice_identity_clf_from_z_models_logreg_gridsearched_avg_by_identity_lang2/results/seed*_k5_latent_spa... |
77af8b2eff1bbbddc6979b9c2962fdb40f475954bf19334538c1a9f887c6efbc | Python | 2,076 | 51 | import argparse, os
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from scipy.ndimage import label
import matplotlib.cm as cm
def convert_tif_to_mask(args):
# Load the image
image_path = args.input
image = Image.open(image_path)
image_array = np.array(image)
# Convert ima... |
8d32087958a8fd175aacca92d424dfa69ca6cdb83adef9b0786d7de461532772 | Python | 2,076 | 58 | class TestSegment():
# Returns memory usage in MB for the current process
def test_returns_memory_usage_in_mb(self, mocker):
from python.segmentation.segment import get_memory_usage
import psutil
# Given
mock_process = mocker.Mock()
mock_memory_info = mocker.Mock()
... |
cb8af151165aeabb1319d3d4c555bb632ed0071d8a0b3cd95f0170ba58413fc3 | Python | 2,076 | 64 | import pandas as pd
import csv
import sys
import time
import os
from tqdm import tqdm
def to_csv(dic, filename):
with open(filename, 'a', newline='', encoding='utf-8') as f:
writer = csv.DictWriter(f, fieldnames=['id','post'])
writer.writerows([dic])
def main(argv):
if argv[1] == '--datasets':... |
d903fc3933e31d390d2e69cd6bca856c7514542ccc0ede73b4f564e32a242ad6 | Python | 2,076 | 70 | #!/usr/bin/env python3
"""
Convert AppIcon.icns to AppIcon.ico for Windows
Run this from dev_docs/win/ directory
"""
from PIL import Image
import os
def convert_icns_to_ico():
"""Convert the macOS .icns file to Windows .ico format"""
input_file = "../linux/AppIcon.icns"
output_file = "AppIcon.ico"
... |
e0443ef2693eb075615df6aba9ee841c90b8fcf2f31d1540e49a4f33a7071894 | Python | 2,076 | 86 | import numpy as np
from scipy.constants import epsilon_0 as e0
import impedancefitter as ifit
from impedancefitter.double_shell import eps_cell_double_shell
from impedancefitter.suspensionmodels import bhcubic_eps_model, eps_sus_MW
em = 9
Rc = 6.5e-6
dm = 8e-9
dn = 40e-9
km = 8e-8
kcp = 1
ecp = 77
kmed = 1
emed = 77.... |
3283b2fa7ad218813c51a3ce87b1e2eacbe87da6199d053b6d47c06acb4beecc | Python | 2,077 | 83 | """Defines functions for ADMET info."""
from pathlib import Path
from typing import Callable, TypeVar, cast
import pandas as pd
from admet_ai.constants import DEFAULT_ADMET_PATH
F = TypeVar("F", bound=Callable[..., object])
ADMET_DF = pd.DataFrame()
ADMET_ID_TO_NAME: dict[str, str] = {}
ADMET_NAME_TO_ID: dict[str,... |
8266ebd4f2b0ea55e777e63dd6c93ec1abbf71d2edcd2644ea4891aa6a6d5e55 | Python | 2,077 | 46 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'qt_regex_file_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dia... |
0394db91a68677cae8ce072c7809ad636487809c10154f0cea30b34838a4f0a1 | Python | 2,078 | 39 | import numpy as np
from numba.core import types
from numba.typed import Dict
def ParameterOptionsSimulation():
opt = Dict.empty(
key_type=types.unicode_type,
value_type=types.float64[:],
)
# Scanner properties
opt['gamma'] = np.asarray([2 * np.pi * 42.58 * 10**6], dtype='f8') # Gyroma... |
3794b72f181073437ee9554a87a7068094673032f3f7d931ebc79e33852b47ef | Python | 2,078 | 65 | from typing import TYPE_CHECKING
import pytest
from eir.setup import input_setup
if TYPE_CHECKING:
from eir.setup.config import Configs
@pytest.mark.parametrize(
"create_test_data",
[
{"task_type": "binary", "modalities": ["omics", "sequence"]},
],
indirect=True,
)
@pytest.mark.parametr... |
b068b534147f928a3851d745375edbc65eec1d9999c0178ebd738f386ed35a15 | Python | 2,078 | 47 | """
Iter-5 record attempt — DINOv2 ViT-g/14 WITH REGISTERS + ImageNet linear classifier (dinov2_vitg14_reg_lc).
Same scale-up as dinov2_vitg14_lc but with 4 register tokens. Registers absorb the high-norm artifact
tokens that otherwise pollute DINOv2's patch-token feature maps, yielding cleaner dense geometry. Our
wea... |
c4f3b822a0d3645a49553647d6e9f4c07aafa03982879c4ce7f0874777f05951 | Python | 2,078 | 56 | import torch
from distances import LpDistance
from utils import common_functions as c_f
from utils import loss_and_miner_utils as lmu
from miners.base_miner import BaseTupleMiner
# adapted from
# https://github.com/chaoyuaw/incubator-mxnet/blob/master/example/gluon/embedding_learning/model.py
class DistanceWeightedM... |
c508f69e7e992ef2b0553be140eb70d7c7d101d96efc864c6302fce365acb5f6 | Python | 2,078 | 71 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import lmdb
import os
import numpy as np
import gzip
import pickle
from functools import lru_cache
import logging
logger = logging.getLogger(__name__)
class LMD... |
e964aef4ebdd529312c09212379aaf270ac651beafea360a852507c685b7c254 | Python | 2,078 | 46 | import pytest
from qtpy import PYQT6, PYSIDE6
from tests.utils import pytest_importorskip
@pytest.mark.skipif(PYQT6, reason="Not complete in PyQt6")
@pytest.mark.skipif(PYSIDE6, reason="Not complete in PySide6")
def test_qt3dcore():
"""Test the qtpy.Qt3DCore namespace"""
Qt3DCore = pytest_importorskip("qtpy.... |
51f4416f1dd913daa74dd7b659ad0eec092f8bd2b44052b77734c17fb72e8421 | Python | 2,079 | 63 | """Script to map gene symbol to protein IDs based on Ensembl FASTA files."""
import json
from collections import defaultdict
from pathlib import Path
from Bio import SeqIO
from tap import Tap
from tqdm import tqdm
class Args(Tap):
fasta_path: Path # Path to FASTA protein sequence file from Ensembl.
save_pat... |
a7e7480b6d7455822d4fd05b0fd222cf7e06181678093298979b4f65bfceaf90 | Python | 2,079 | 93 | #!/usr/bin/env python3
#
import os
import math
import tensorflow as tf
import pandas as pd
import keras
from keras import layers
from tensorflow import data as tf_data
import random
import autoAnalysis
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import classification_report,... |
24e65e98bcd1df24327aaa441b3989dc430fb794370c6e0fb538b77b91b0001b | Python | 2,080 | 71 | import sys
import time
import getopt
from skimage import io as skio
from slice_dataframe import slice_dataframe
from save_miscdf import *
from PIL import ImageFile
from PIL import Image
ImageFile.LOAD_TRUNCATED_IMAGES = True
Image.MAX_IMAGE_PIXELS = None
##############################################################... |
5453de5ca2894e137fefa3f6ab091e2b12f3497e6208b99e259e5c2267086221 | Python | 2,080 | 79 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 13 22:01:51 2024
@author: aka2333
"""
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import numpy as np
from scipy.stats import gaussian_kde
import matplotlib.pyplot as plt
# In[]
def mask_triangle(data, ul='u', diag=0):... |
cb5a50a457bca166aaafa63a804cac7d8de2c5df9dcb1088879755827f9544ef | Python | 2,080 | 60 | import pandas as pd
from transformers import AutoModel, AutoTokenizer
import torch
from rdkit import Chem
# Step 1: Load ChemBERTa model and tokenizer (from local path)
def load_model_and_tokenizer(local_path="./ChemBERTa-zinc-base-v1"):
tokenizer = AutoTokenizer.from_pretrained(local_path)
model = A... |
cfb70e0a90b986d93cba8cf418834dfa3f55175b9fc31e525ddb9e490528428b | Python | 2,080 | 78 | import numpy as np
import pytest
from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.model.calculation import (
fitGeoTrans,
mapPointTransform,
predictPointSample,
)
SAMPLE_POINTS = np.array(
[[0, 0], [10, 0], [10, 10], [0, 10]],
dtype=np.float32,
)
ATLAS_POINTS = np.array(
[[2, 3... |
f77a52a603d0e4df1ab0fbd2ee45152041ba892f316cb1d6973e61ccc786b887 | Python | 2,082 | 45 | import numpy as np
import pytest
from numpy.random import RandomState
from pytest import approx
from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly
from brainscore_vision import load_benchmark
from brainscore_vision.benchmark_helpers import PrecomputedFeatures
from brainscore_vision... |
7f415927f497837160191e55fe14a86aa072bddc6d643d0d527c966ee4123fff | Python | 2,083 | 59 | import argparse
import pandas as pd
import numpy as np
parser = argparse.ArgumentParser(description='converts voreen csv based graph to vtk files .')
parser.add_argument('-n','--node_list', help='Name of the node list csv file.', required=True)
parser.add_argument('-e','--edge_list', help='Filtering condition: average... |
8dff3bdc5ed28ab256013292b991ef02e1d754eb1985e1ae187b8f397c5509a1 | Python | 2,084 | 66 | """Script to extract CSF as nuosance regressor for resting state analysis"""
import nibabel as nb
import numpy as np
import subprocess
import os
import glob
ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti'
# Set subjects to work on
subs = ['sub-14']
for sub in subs:
print(f'Processing {sub}')
funcDir... |
90798fe97eb520570eef21e3c2a5e7a277904953206dde7391c2d0b89c2da842 | Python | 2,085 | 57 | # The ImpedanceFitter is a package to fit impedance spectra to
# equivalent-circuit models using open-source software.
#
# Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de
# Copyright (C) 2018, 2019, 2020, 2021 Julius Zimmermann, julius.zimmermann[AT]uni-rostock.de
#
# This progr... |
c6b7e9cf72dd1a4226125fb0fc61ceb6947d4d94b0432d94668aa9a1770910dd | Python | 2,085 | 52 | # This file is part of Mooney computational modeling project.
#
# Mooney computational modeling project 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, or
# (at your option) an... |
e5653ce7e3225b5b4630a5532f548ac39c79e819cd7fce7edeabbb264ddc4451 | Python | 2,085 | 64 | import pandas as pd
import sys
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, matthews_corrcoef, auc, roc_curve
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import GridSearchCV
def main(argv):
if... |
0d9b7942386a74177b2e8c2ae88134e12b4a7ccc33620ebd0057339a4e8b1d0a | Python | 2,086 | 43 | import numpy as np
auddur = 0.2
valvedur = 0.5
stimplotfns = {
'AudStim_10kHz': lambda timestamps,ax: [ax.axvspan(timestamp, timestamp + 0.2, **{'color': 'k', 'alpha': 1, 'lw': 0}) \
for timestamp in timestamps],\
'valve_opening': lambda timestamps,ax: [ax.axvspan(... |
eefa82f42208456d432f665122b13f32b5c68ed983b86a66f580681065ae5121 | Python | 2,086 | 64 | import pandas as pd
import sys
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, matthews_corrcoef, auc, roc_curve
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import GridSearchCV
def main(argv):
if... |
4704ce4b599f349147d71e3fa9de8f0ebf8edb3784954f343fa810006fe87e15 | Python | 2,087 | 44 | import unittest
import base
class Test1(base.BaseScriptTest, unittest.TestCase):
command_line = "./scripts/bnMapper.py ./test_data/epo_tests/hpeaks.bed ./test_data/epo_tests/epo_547_hs_mm_12way_mammals_65.chain"
output_stdout = base.TestFile(filename="./test_data/epo_tests/hpeaks.mapped.bed4")
class Test2(... |
53de6539528531757c67e35c5285c5d769d814a2ef57d2e40bcaa7704ca8dc45 | Python | 2,087 | 55 | #!/usr/bin/env python
"""
HAL module for controlling a Thorlabs filter wheel.
Hazen 04/18
"""
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.amplitudeModule as amplitudeModule
import storm_control.sc_hardware.thorlabs.FW102C as FW102C
# FIXME: Should be am... |
5aa4b7723c2678d19be89a3ee119eb63926dcea6333cd75e86d07fd8e1535b7b | Python | 2,087 | 92 | """
nelpy.plotting
==============
The nelpy.plotting sub-package provides a variety of plotting functions and tools
for visualizing data in nelpy, including raster plots, tuning curves, color utilities,
colormaps, and more. It includes convenience wrappers for matplotlib and
plotting functions that work directly with ... |
5ee97ae8cf4fbd21942af7ef480b905c3d555fbb33b7867702d8d51058b0469f | Python | 2,087 | 55 | import torch
from torch import nn
import torch.nn.functional as F
from .grad_rev_layer import GradReverse
class DiscriminatorProposal(nn.Module):
def __init__(self, in_features: int):
super(DiscriminatorProposal, self).__init__()
self.net = nn.Linear(in_features, 1, bias=False).cuda()
'''
... |
63e4ed02091e0565e8cd2ff018254d68aa9e3a981e0495c5e2d520baa4ad98a4 | Python | 2,087 | 56 | class Test_AE_Config:
def test_config(self, dropConfig,demo_dir):
assert dropConfig.AE.getWorkdir() == f"{demo_dir}/Scripts/AberrantExpression/pipeline"
dict_ = {
'groups': ['outrider', 'outrider_external'],
'fpkmCutoff': 1,
'implementation': 'autoencoder',
... |
bedda98efc3f5a39e382dcbf6c40c63dcaeb2e719931275be3e0d77ac836be8d | Python | 2,087 | 61 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 5 15:46:39 2023
@author: DODO
"""
import numpy as np
import sys
import os
import datetime
import matplotlib.pyplot as plt
import scipy.interpolate as itp
import warnings
warnings.filterwarnings('ignore')
# In[]
# Porosity calculation
def CAD_extractPo... |
0262c3644b9a38792b7061c218f02d3f73a020177abd8ec005b3b86b2cb1a601 | Python | 2,088 | 71 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import io
from logging import Logger
from pathlib import Path
import pytest
from cvat_sdk import Client, models
from cvat_sdk.api_client import exceptions
class TestUserUsecases:
@pytest.fixture(autouse=True)
def setup(
self,
... |
24fde2cbe05a3c6dfa85a3dd52e236e240108470be82f8791357a5a85773d03e | Python | 2,088 | 84 | #!/usr/bin/env python3
import sys
import numpy
import math
from lowess import lowess
import struct
import os
GC_normalize = sys.argv[1]
normalize = open(GC_normalize,'r')
x = []
y = []
stdev = []
i = 0
ave = 0
count = 0
maxCov = 0
for line in normalize:
arr = line.split()
x.append(float(arr[0]))
y.append(float(ar... |
87093f3ed19c25a5f3797b6847b03606521ac477cee441dd0ce335f905f90846 | Python | 2,088 | 64 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute a single bundle centroid, using an 'infinite' QuickBundles threshold.
"""
import argparse
import logging
from dipy.io.stateful_tractogram import StatefulTractogram
from dipy.io.streamline import save_tractogram
from scilpy.io.streamlines import load_tractogr... |
c34b4c1dc2d6999e045d0907de7cce8ad3a943d5615def872fcbc4ca3d8fa098 | Python | 2,088 | 86 | # -*- coding: utf-8 -*-
"""
Generate 2D pattern
This script creates a two-dimensional sinusoidal or rectangular pattern.
"""
# external inputs
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import correlate
from numpy.fft import fft2, fftshift
# local inputs
from fmri_tools.simulation.pattern ... |
e17ade39f809851213dd6567cdcc6139fcfa6bb1ca203fe10e9d3b12d7ba513e | Python | 2,088 | 57 | # 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:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
eeb0bb34f2b01a996bcfb50a7e932e254ed7045ceb8d982806bac8329458a588 | Python | 2,088 | 69 | #!/usr/bin/env python2.4
"""
Returns all positions of a maf with any pwm score > threshold
The positions are projected onto human coordinates
"""
import sys
import bx.pwm.position_weight_matrix as pwmx
from bx.align import maf as align_maf
from bx.pwm.pwm_score_maf import MafMotifSelect
def main():
if len(sys.a... |
fb7587799ff9d309e71ed244a5fef9bf95449ba1bcf916d49aac7ff39b7f81b0 | Python | 2,088 | 69 | # -*- coding: utf-8 -*-
"""
Useful functions for investigating the distribution of the diffusion coefficients
"""
import copy
from graph_tools import *
import numpy as np
import pandas as pd
import seaborn as sb
def h(x, epsilon=10**(-6)):
if x > epsilon:
return - (x) * np.log(x)
elif x < 0:
p... |
dda96a5b0b9a211ede063d00409b314ca2f2944abfbfc97ab1731fecc4487fe3 | Python | 2,089 | 56 | #!/usr/bin/env python
"""
Standardized HAL message boxes. Use these for
messages instead of rolling your own!
Hazen 01/17
"""
from PyQt5 import QtWidgets
def halMessageBoxInfo(message, is_error = False):
"""
Display an informational message box.
"""
msg_box = QtWidgets.QMessageBox()
... |
37aece4de2cf408bc1727f7d484a030a80df602febc1675f71736ad4bcc267c3 | Python | 2,090 | 54 | # -*- coding: utf-8 -*-
"""
Comparison of resting-state data within and between V2 stripes.
"""
# python standard library inputs
import os
# external inputs
import numpy as np
import matplotlib.pyplot as plt
# local inputs
# from fmri_tools.analysis.analyze_alff_between_stripes import analyze_alff_between_stripes
f... |
cb6f73cb38d0851b30ac68800fc5bd8146cd0473715428dfc09134aa8aeea994 | Python | 2,090 | 72 | """Plot a comparison of the speed of ADMET websites."""
from pathlib import Path
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
FIGSIZE = (14, 10)
matplotlib.rcParams["font.size"] = 28
plt.rcParams["font.weight"] = "bold"
plt.rcParams["axes.labelweight"] = "bold"
def pl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.