sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
544ea9f6b92fe0610974be187a1c37df1687e7585a46f0442b164ddf093cce3e
Python
2,451
60
""" """ import json from galaxy.util.plugin_config import plugins_dict DEFAULT_SHELL_PLUGIN = "LocalShell" ERROR_MESSAGE_NO_JOB_PLUGIN = "No job plugin parameter found, cannot create CLI job interface" ERROR_MESSAGE_NO_SUCH_JOB_PLUGIN = "Failed to find job_plugin of type %s, available types include %s" class CliI...
df9fb5be7f2fe5b10c56f1ca45b3b6f18b33dd9b07bc925bfbf37da895f011e5
Python
2,452
70
#!/usr/bin/env python3 '''Compute a single row of a distance matrix from a pdbinfo file. This allows for distributed processing''' import clustering,argparse,sys from rdkit.Chem import AllChem as Chem from rdkit.Chem import AllChem from rdkit.DataStructs import FingerprintSimilarity as fs from rdkit.Chem.Fingerprin...
3b3d7c565623f7737372b28a7c836078f54b63676833747c592089c36fab3ba0
Python
2,453
96
import sys; import os; import json import numpy; my_path=os.path.dirname(os.path.realpath(__file__)); sys.path.append(os.path.abspath(my_path+'/../..')); import biswebpython.core.bis_objects as bis; # ------------- names = [ [ 'index_big_combo_left_2.vtk.json' , 'left_small' , 'lobes_left.json' , 5494 , 2985 ], ...
90a9c8fad562e783af3cc0be974823d9cc536d484c258c0c28a15b2e48285154
Python
2,453
55
import yaml from config_manager import config_field from config_manager import config_template from config_manager import base_configuration from tests import constants class TestCase: _person_template = config_template.Template( fields=[ config_field.Field(name=constants.Constants.NUM_ARMS...
0b87f0663b71701be1954ff19e64cb18ed75b9c9e8cbe4207dd0ee27cae345ff
Python
2,454
79
from datetime import datetime from unittest import mock import dateutil.relativedelta from api.mocks import FakeAuthContext from carbonserver.api.infra.repositories.repository_experiments import ( SqlAlchemyRepository, ) from carbonserver.api.usecases.experiment.project_sum_by_experiment import ( ProjectSumsB...
af1ccb852b50ccf6cdd9810085a198fa9efffda802b26fe9a43cb7fcb5f538a1
Python
2,454
79
import os import sys import glob import numpy as np def sort_matrix(swcmatrix): updated_swcmatrix = swcmatrix sRe = updated_swcmatrix[:,6] Li = list(range(1,(len(updated_swcmatrix[:,1])+1))) Li1 = Li[:-1] for i in Li1: if updated_swcmatrix[i,6] != -1: pids= np.wher...
cd1d287d44c55bea3afc61eb6287fec5dd9ffbefafe1749fed310f1d2d37b684
Python
2,455
55
# -*- coding: utf-8 -*- """ Created on Tue Feb 28 16:28:17 2023 @author: Caterina Brighi """ import SimpleITK as sitk import pandas as pd import os from ImageAnalysisFunctions import getMaxRoi,getMeanRoi data_supradir = 'Path to data directory' subjs_path = [ f.path for f in os.scandir(data_supradir) ...
e4c3dbe893f9df09b33a7cb0952a1409e1d4b5e2e19aafae415219e62b26fba9
Python
2,455
81
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import seqdata as sd # -- Project information ----------------------------------------------------- # https://www.sp...
4ad27e6616fedd5fa63ade1a92973732bd38e9afae709a1178f8b2b6a08d2bde
Python
2,456
81
import numpy as np import matplotlib.patches as mpatches from .analytics import Analysis def plot_knockdown_results( ax, results, *, model_groups, color_for_model_group, analysis_to_plot, alpha=0.5 ): """ Plot knockdown results. Args: ax: matplotlib axis results: dict[model name -> d...
53aed25a05b2fde72d2ccf69c9d26881c046663a6d15782bce5ee5a7f6be72df
Python
2,456
63
import numpy as np import pandas as pd import os import glob import math import json import scipy import scipy.stats import pickle as pckl from PIL import Image import argparse import sys sys.path.append('/om4/group/mcdermott/user/jfeather/projects/robust_audio_networks/robustness/metamers_paper_model_analysis_folder...
5a3be34cb180f39d9eb2cdeb943a0e95abfa888176ffff803baddfbb2417b811
Python
2,456
69
## Read write encoder import sys,os from shutil import copyfile from datetime import datetime,timezone,timedelta import serial import csv import configparser port = 'COM5' # NOTE! This will change between computers, and may change when a computer is restarted baudrate = 9600 # initialize output csvfile root_folder ...
cc62b7d59c65203283988d3c00fae3db0a0c89c55ad143164a5cb385fe740298
Python
2,456
95
import pandas as pd import numpy as np import sys from base import configs import torch from base.model import MBSClassifier #from base.CBP_dataloader import MetalBindingSite from base.metal_binding_site import MetalBindingSite def df_to_pdb(pdb_df): columns = pdb_df.columns.tolist() pdb_df['character'] = pdb...
7b47405acf199eb576ee05e8d726fef9a150c576b9ae6c8145e1f7af29632d03
Python
2,457
80
import numpy as np from PyQt5 import QtWidgets, QtCore class InfDoubleSlider(QtWidgets.QSlider): valueChangedFloat = QtCore.pyqtSignal("double") sliderReleasedFloat = QtCore.pyqtSignal("double") def __init__(self, *args, **kwargs): super(InfDoubleSlider, self).__init__(*args, **kwargs) s...
e640da434e41ec9c889301ef7bd2c3039441ba9c057ae8865737b0ec2024598d
Python
2,457
80
import numpy as np from PyQt6 import QtWidgets, QtCore class InfDoubleSlider(QtWidgets.QSlider): valueChangedFloat = QtCore.pyqtSignal("double") sliderReleasedFloat = QtCore.pyqtSignal("double") def __init__(self, *args, **kwargs): super(InfDoubleSlider, self).__init__(*args, **kwargs) s...
f85b5f9c96dedf7f4846772a46c8d86d009fd539c770f1a990e1903920136d45
Python
2,457
69
''' Obtain data matrices suitable for the zero-shot learning algorithm. ''' import sys sys.path.append('..') import argparse from config import fname, events_id, triggers, categories import mne import numpy as np import scipy.io from pathlib import Path # Be verbose mne.set_log_level('INFO') # Handle command line ar...
1ddeea492c78a8f2e7ce0761f1ac74e8311e359515bd160b472f29367f0d2228
Python
2,458
80
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Increasing(_BaseTraceHierarchyType): _parent_path_str = "waterfall" _path...
4c7173ef0636e4bc1e8cbf3791d6e8d18fceff77603f91027e79e564cffcac28
Python
2,458
69
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from typing import Sequence, Tuple from .._data_obj import Dataset, IndexArg, VarArg from .. import fmtxt, plot def scatter_table( xs: Sequence[VarArg], color: VarArg = None, sub: IndexArg = None, ds: Dataset = None, dia...
77a4f7e9c77a5174f313edf13428556b9a6ac17bd48a1e0733b127e31948188c
Python
2,458
64
import unittest import logging import pandas as pd from pmsurv.models.weibull_linear import WeibullModelLinear from pmsurv.models.exponential_model import ExponentialModel import arviz as az logger = logging.getLogger(__name__) class TestVeteranDataset(unittest.TestCase): def test_weibull_linear_veteran(self): ...
7df4d6da62335369647aa8106d77348d13248ace2310ed7fd4ca5b2ccd327839
Python
2,458
82
import pytest import gym from gym.spaces import Discrete from gym.wrappers import StepAPICompatibility class OldStepEnv(gym.Env): def __init__(self): self.action_space = Discrete(2) self.observation_space = Discrete(2) def step(self, action): obs = self.observation_space.sample() ...
a154eb56a73f94dc9a843b22bd9a4976ad5aea02bf4aa2ce8efa662255a1c705
Python
2,458
80
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Decreasing(_BaseTraceHierarchyType): _parent_path_str = "waterfall" _path...
d70b097c81b922a41b7902d881c2013cdadc5bce676c0d5f6d56eb5033ebeb9c
Python
2,458
70
import json import logging import os from pathlib import Path import pytest from ome_zarr.data import astronaut, create_zarr from ome_zarr.format import FormatV05 from ome_zarr.utils import download, info def log_strings(idx, c, y, x, cc, cy, cx, dtype): yield f"resolution: s{idx}" yield f" - shape ('c', 'y...
ddf467029ed5be776d0c929074f27001fe4153c7f2c73ed6feee696d08513762
Python
2,458
81
from typing import Any, Callable, Dict, List, TypeVar, cast import pytest from torch.nn import Linear from torch.optim import SGD from lightly.utils import optim TestFunction = TypeVar("TestFunction", bound=Callable[..., None]) parametrize = cast( Callable[..., Callable[[TestFunction], TestFunction]], pytest.mar...
f9c2b80241c220f52937de43e013bf490ecf64f3a13080dca2a92614955b51cb
Python
2,458
80
''' Generate one-hot embeddings and save as one file per sequence. Use md5 hash of sequence as file name. We do it this way so that we can just reuse the whole ESM-based setup without any changes aside from the input dimension. ''' from hashlib import md5 from esm import Alphabet, FastaBatchedDataset, ProteinBertMode...
0af6ade97da79c00a96a41dc0c99ded38cd2ffeb16e4d58bd021b5ae1277e79f
Python
2,459
73
"""W051-STOCH / AUD-CODE 4.5: ``resample_rows_from`` audit counts mean what they say.""" from __future__ import annotations import pytest import torch from torch import nn import torchlens as tl from torchlens.intervention import PerRowDatums, reference, resample_rows_from, sampling_records class _OneBlock(nn.Modu...
23940b5b9ca529a6df4350c5d0512469da63185121d57c91def6e1e573f4fca8
Python
2,459
75
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import pytorch_lightning as p...
46498af5fc98f95248e2cc7801e8a94479d503797286acbd13ea3244f4b918ee
Python
2,459
49
"""Module to be imported in the Jupyter Notebook""" # License: GNU General Public License v3.0 import ipywidgets as widgets import gui.selectionWindow as sw from gui.plotWindow import PlotOut from gui.widgets import run_button_widget, plots_show_button from gui.methods import calculate_results, make_plot from gui.termi...
5a93a1610983be281bbb2656c6a665cf84d0116af990bcaf7abb579ad087baf4
Python
2,459
67
import numpy as np import pandas as pd import matplotlib.pyplot as plt import re fontsize = 16 plt.style.use('seaborn-colorblind') plt.rcParams.update({'font.size': fontsize, 'font.family': 'sans-serif', 'font.sans-serif': ['Arial'], #'axes.labelsize': 'x...
605b117b1dfc31edbafd9bc5e6bf6b6f84adb4ba60b8b6f98a3941e8182c20f4
Python
2,459
74
import numpy as np from ..preprocess._preprocess import dinuc_shuffle_seqs def generate_profile_set(base_sequence, num_sample): """ create a subset of sequences as background by matching nucleotide profiles :param base_sequence: sequences to use for matching :param num_sample: sample size :return:...
ba81896267fe07b04f853ba94eaa5c4c7e09eb7fe6336eb4bfcdc1c1556c15bf
Python
2,459
72
""" Generic methods and classes used throughout. """ import os import datetime import numpy as np import pandas as pd from scipy import stats import matplotlib.pyplot as plt from jaratoolbox import settings from jaratoolbox import behavioranalysis from jaratoolbox import extrastats def get_slope(curveParams, x...
c2ea7b173653cab4e434aac769d89ada4c21eecd282d01f0210afd47f635ab7f
Python
2,459
66
from __future__ import annotations from pybind11_tests import docstring_options as m def test_docstring_options(): # options.disable_function_signatures() assert not m.test_function1.__doc__ assert m.test_function2.__doc__ == "A custom docstring" # docstring specified on just the first overload def...
ebfbe00de9adbd0bfb1edc801cbc221d0f292e9a4c8057f0110807aec4c647dd
Python
2,459
73
import numpy as np import scipy.stats as st from tqdm import tqdm import matplotlib.pyplot as plt from sklearn import metrics from sklearn.metrics import roc_curve, roc_auc_score def bootstrap_metric(metric_fxn, x, y, N=100): metrics = [] size = x.shape[0] for _ in tqdm(range(N)): try: ...
2e19e54cf93ac877abec70c75656a27bc0bccf6516340e8ac74900e08c33ec67
Python
2,460
80
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import pytorch_lightning as p...
426455dec6aeead699e21f392d5663bf89dc4467f8a835f409882657f00ac01d
Python
2,460
64
import tempfile import unittest from Loader.src.utils import * class TestLoadFunctions(unittest.TestCase): def setUp(self): # Create a temporary directory for the test data self.temp_dir = tempfile.TemporaryDirectory() # Create a dummy NIfTI file for testing self.nii_file = Path(s...
7d7623ac683d9595d7be65d2d79478154a3a6552312a2c4fec1b4ae144ae69f7
Python
2,460
82
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun May 22 15:14:45 2022 @author: mikkel For information about NatMEG-PD please refer to the data descriptor: Vinding, M. C., Eriksson, A., Comarovschii, I., Waldthaler, J., Manting, C. L., Oostenveld, R., Ingvar, M., Svenningsson, P., & Lundqvist, D. ...
a8af9e266d04917a77f22e3397941e2289eee9580bf28fa1258749a6c96296a6
Python
2,460
69
from imodelsx import submit_utils from os.path import dirname import os.path repo_dir = dirname(dirname(os.path.abspath(__file__))) # python /home/chansingh/llm-tree/experiments/01_train_model.py --use_cache 0 --subsample_frac 1 --model_name llm_tree --max_depth 3 --use_llm_refine 1 # python /home/chansingh/llm-tree/...
f20428cc2022ad512e8774b3f1f3d8a0f7e74f855d2871955d95adca8bfeeab3
Python
2,461
70
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function import absl.app import optuna import sys import tensorflow.compat.v1 as tfv1 from deepspeech_training.evaluate import evaluate from deepspeech_training.train import create_model from deepspeech_training.util.config im...
74050ba75a7cdf7ed36421755cb900aaaca540b7ef7b0ee409fb15490760e3a1
Python
2,463
79
from permacache import permacache, stable_hash import torch from modular_splicing.utils.construct import construct from .kayla_gene_model import all_transformed_hsmm from .transformed_models import unwrap_state @permacache( "notebooks/hsmm/direct_inference_experiment/directly_infer_output_5", key_function=...
d64f4d84eed504b1ce84559952140d1257ff245cdd40b81547c5aeabc0598f78
Python
2,463
100
# -*- coding: utf-8 -*- # @Author : Yue Liu # @Email : yueliu19990731@163.com # @Time : 2022/7/28 14:07 import copy import torch import numpy as np def diffusion_adj(adj, self_loop=True, mode="ppr", transport_rate=0.2): """ graph diffusion :param adj: input adj matrix :param self_loop: if add t...
67094779aa6ce626c9447f88d4e43ec3b9c3f0056817c8a0f2240bac8ddb0cbb
Python
2,465
71
import pandas as pd import numpy as np import os, sys, shutil, importlib, glob from tqdm.notebook import tqdm import celloracle as co from celloracle import motif_analysis as ma from genomepy import Genome import scanpy as sc def download_refgenome(ref = "mm10") -> None: genome_installation = ma.is_genome_installe...
6a11e48bd6cc10ab73803ddfccf73c5283942d4dc15f1171626444b96a6f4957
Python
2,465
89
"""Persist validated job internal tool state and enforce tool request constraints. Revision ID: 566b691307a5 Revises: 9930b68c85af Create Date: 2025-09-30 04:48:19.727414 """ from alembic import op from sqlalchemy import ( Column, Integer, JSON, String, ) from sqlalchemy.dialects.postgresql import JS...
7215a9bd704bd62d863df797c18581da3645f8db75dc3b823bd2b38d884a76f6
Python
2,465
83
import os import pytest from nfp.frameworks import tf from nfp.preprocessing.xtb_preprocessor import xTBSmilesPreprocessor dir_path = os.path.dirname(os.path.realpath(__file__)) @pytest.fixture() def get_2d_smiles_json(): train = ["C", "CO", "CC"] train_json = [ os.path.join(dir_path, "xtb_inputs", ...
cb224427a135316bd01ec4d9e645047dfd363e59910331eea0c1cb895ff54f88
Python
2,465
85
from anndata import AnnData from typing import Optional, Union import numpy as np from stlearn.em import run_pca, run_diffmap from stlearn.pp import neighbors from scipy.spatial.distance import cdist def local_level( adata: AnnData, use_label: str = "louvain", cluster: int = 9, w: float = 0.5, ret...
03f8ee621dc236d324ad6abaf957faf6f9051feb02226d41c657d7bda8f1bd82
Python
2,466
80
"""Single authority for which benchmark operations TorchLens owns. ``perf_gate.py`` and ``perf_suite.py`` previously carried two independent copies of the same 10-prefix classifier with no lockstep test (b2 R41 round 5, wave-born): after fixwave-4 the classifier decides missing-row blocking, status-failure blocking, u...
52e4b7559e579d5d6ee41b56f9029b16fd306af9654296e0b6c3887b95ef4e58
Python
2,466
53
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for visualization of dendrograms""" import tempfile import unittest import numpy as np from sknetwork.data.toy_graphs import karate_club, painters from sknetwork.hierarchy import Paris from sknetwork.visualization.dendrograms import visualize_dendrogram, svg_de...
49f610d6bd16c5daf0a75785fd7f314bec7167a1fb66a1d1baea741a4af5b673
Python
2,467
80
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Unselected(_BaseTraceHierarchyType): _parent_path_str = "choropleth" _pat...
f9c476c7b433a9c220bdc95dfaa51ce8ec6764246af558ecacf3b394a3fb4f64
Python
2,467
80
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Unselected(_BaseTraceHierarchyType): _parent_path_str = "scattermap" _pat...
a910e78e99d8e6439236f7bb4871f22af9f2a7690929b909ecf31053cbddfdb1
Python
2,468
59
from typing import Dict, Tuple from pytorch_lightning import LightningModule from torch import Tensor from torch.nn import CrossEntropyLoss, Linear from lightly.utils.benchmarking.topk import mean_topk_accuracy class OnlineLinearClassifier(LightningModule): def __init__( self, feature_dim: int =...
c202c86c310e63f30d24ccc4c0ae843714b8d34a888bd99a9d9ec84451af8e9f
Python
2,469
58
""" This module allows us to run the simulation from the command line interface. To do so, you need to specify the experimental constants file, as well as the part(s) of the simulation that you would like to run (controlled by flags: parallelise_flag, train_flag, eval_flag, and analysis_flag). The flags control differe...
76b5ec8fd21b74ce6bd7bb931d162e16cdcb7520376faaa27a1ab463a7102ecf
Python
2,470
80
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Selected(_BaseTraceHierarchyType): _parent_path_str = "choroplethmap" _pa...
8f6204e962f104556107d792e49dd039dd82a98672924ea3df343a6868734d75
Python
2,471
80
import os.path import shutil import sys import warnings from pathlib import Path def get_settings_xml(target_dir: str | Path): """ Creates a local copy of the settings ``xml`` file. This file can be used to configure the image processing and feature extraction workflow. Parameters ---------- ...
9299a7e39e9bed047fa99ad1c73c260e927a1f92e4538350be479573e7d4c427
Python
2,471
70
import nfp import numpy as np import pandas as pd # Define how to featurize the input molecules def atom_featurizer(atom): """ Return an string representing the atom type """ return str( ( atom.GetSymbol(), atom.GetIsAromatic(), nfp.get_ring_size(atom, max_size=6...
03887ee2b1746fd58044224a2922c9546d6f2d8df10aca91661c0598e598aee1
Python
2,472
65
import numpy as np import random import cv2 from collections import namedtuple, deque import math ''' Replay Buffer ''' N_CHANNEL, N_HIGH, N_WEIGHT = 50, 256, 256 class ReplayMemory(): def __init__(self, memory_size): self.memory_counter = 0 self.memory_size = memory_size self.state_memory...
bc43e194c0769c1b9691f040a1289a5837ffae8617f485922262c4810abd4022
Python
2,472
85
import torch.nn as nn from modular_splicing.utils.construct import construct from modular_splicing.models.modules.residual_unit_stack import ResidualStack from modular_splicing.models.modules.fc_motif_feature_extractor import ( FCMotifFeatureExtractor, get_fc_block, ) class LearnedMotifModel(nn.Module): ...
90e1433cf7621aa1be29c58d891c1b4bfcbf9e6c397d32984efba3ff1f3205dd
Python
2,473
86
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in November 2019 @author: Nathan de Lara <nathan.delara@polytechnique.org> """ from typing import Union import numpy as np from scipy import sparse from scipy.sparse.linalg import LinearOperator def diagonal_pseudo_inverse(weights: np.ndarray) -> sparse.csr_...
97e094610f63948267ce4190a65794fcdab9e127e8aec21fd41a69efabd53514
Python
2,473
77
import numpy as np import re class Vote: def __init__(self,pred_class,pred_seq,pred_score): self.pred_class = pred_class self.pred_seq = pred_seq self.pred_score = pred_score def __str__(self): if self.pred_class == '<PC>': excerpt = self.pred_seq[:20]+'...' if ...
da2ba180a40c2bbadabca8d428cf6fa10c3a323f1ae855fe99ab6bce07e5c94a
Python
2,474
100
import numpy as np import pandas as pd import tqdm.auto as tqdm from .standard_e2e_eval import evaluate_on_checkpoint def evaluate_model_series( model_series, data_spec, *, split, include_path=False, data_path="dataset_test_0.h5", ): """ Evaluate a series of models, with the same data...
f776ff80a60e294ecae03433e84000d59cfcb559596f137183bc3b1506048d75
Python
2,475
67
import torch from models.basic import DeepLearningBackbone from models.utils import get_nonlinear __all__ = ['OWMNet'] class OWMNet(DeepLearningBackbone): def __init__(self, in_channels: int = 3, num_classes: int = 1000, nl='relu'): super().__init__() self.nl = get_nonlinear(nl) self.m...
2d1cccf6dee4f029f5db8fd9e5f2664bff79d684cccd47670439a80660326ce3
Python
2,476
81
"""Class to retreive and store ROI activations from murfi. See the accompanying test_murfi_communicator.py for example usage. """ import socket import re import random class MurfiActivationCommunicator: def __init__(self, ip, port, num_trs, roi_names, fake=False): self._ip = ip self._port = port...
3ab682eccdbec63779028cf7822871989fcf1501f266d6de1c03635303ea0746
Python
2,476
87
import matplotlib.pyplot as plt import networkx as nx import seaborn as sns class nxDraw: @classmethod def draw_spectral(cls, A, path=None, **kwargs): G = nx.from_numpy_matrix(A) nx.draw_spectral(G, **kwargs) if path is not None: plt.savefig(path) @classmethod def ...
9b2dbc9402281676880455cf5f42b32f8cbe9e04fc8768c06c8e3a11e7f5714a
Python
2,476
90
# visualize AlphaFold pdb with AlphaFold pLDDT color. # It also highlight residues of interests as sphere. import py3Dmol import matplotlib.pyplot as plt plddt_bands = ["#FF7D45", "#FFDB13", "#65CBF3", "#0053D6"] styles = ["cartoon", "stick", "sphere"] thresh = [ "Very low (pLDDT < 50)", "Low (70 > pLDDT > 50...
d9968e122ba38a0a144f9d10e34fda67c2bea234e9880409236b3f2c2520f448
Python
2,477
61
from pyrosm.data_manager import get_osm_data from pyrosm.frames import prepare_geodataframe from pyrosm.utils import validate_custom_filter import geopandas as gpd import warnings def get_boundary_data(node_coordinates, way_records, relations, tags_as_columns, custom_filter, ...
92b7e482ea2cc1e7cec12de47f417de1bade44e93d29fcd9dc3d208d3c659765
Python
2,478
70
import os from airPLS import airPLS import nmrglue as ng import numpy as np from tqdm import tqdm def read_bruker_h_base(nmr_path, bRaw=False, bMinMaxScale=False): nmr_path = os.path.normpath(nmr_path) if bRaw: dic, fid = ng.fileio.bruker.read(f'{nmr_path}/1') zero_fill_size = dic['acqus']['T...
74f016e8a7c58a367270709dd072b3cd6daaf4ba3681233ea8d048e96f145235
Python
2,481
83
"""Multi-arm Bandit task.""" # TODO: add the actual papers. import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces from neurogym.utils.logging import logger class Bandit(TrialEnv): """Multi-arm bandit task. On each trial, the agent is presented with multiple choices. Each ...
efdd5f75da876667fe810f1ae0e3166cbb91ef1c7be6c670530db8e9d99ecdb3
Python
2,481
78
""" BASIL GUI for Oxford ASL - Code to run oxford_asl script and display output Copyright (C) 2020 University of Oxford """ import os import wx from wx.lib.pubsub import pub from . import OptionComponent from .cmdline import CmdRunner, Mkdir, FslCmd class OxfordAslRunner(wx.Frame, OptionComponent): """ Run...
d99920f4600174bee425a76bb7b2fcb4ce8b735dfe0ace521e566ab63761128c
Python
2,482
78
"""Tests for LarvaworldParam.to_config / save_config / from_config.""" from __future__ import annotations from pathlib import Path import pytest from larvaworld.lib import reg from larvaworld.lib.reg.data_aux import LarvaworldParam from larvaworld.lib.util import AttrDict #: (key, expected `v` param class name) co...
09537c36330cb17954394f0acf9f24254044124ae81ee2b37b8a85da0435d625
Python
2,483
65
import math import torch import torch.nn as nn import torch.distributions as D class RepresentationLayer(torch.nn.Module): ''' Implements a representation layer, that accumulates pytorch gradients. Representations are vectors in nrep-dimensional real space. By default they will be initialized as a ten...
12c409600f4375392ece181efa4a3bb152d58234a9f25c529752c3adfc79b38b
Python
2,483
71
#!/usr/bin/env python #========================================================================= # # Copyright NumFOCUS # # 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://...
577832f9e088507a8333bf6bf835c9ea069349e1d5e1478107a4c77d1d2c54bb
Python
2,483
65
import os import torch import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import r2_score def draw_chart(train_loss, train_r2_score, val_loss, val_r2_score, test_loss_list, test_r2_list, region, type_model="dis", output_prefix = 'images_lowpass'): if not os.path.exists(outp...
ff80da7ec884acbcb8b2ba28c2c88d69b263068a43f41b1bda1c8edf7f0f8fb1
Python
2,483
119
"""Tests for specparam.reports.strings.""" from specparam.reports.strings import * from specparam.reports.strings import _format, _no_model_str ################################################################################################### ##########################################################################...
85d417125c34fb3884d183b4761825e23cdee6e9bdca6bd00099578f76e287bb
Python
2,484
104
import ctypes import os import warnings from ctypes.util import find_library # Check if the ray package is available RAY_AVAILABLE = True try: import ray except ImportError: RAY_AVAILABLE = False def limit_inner_threads(n_threads: int = 1): # OpenBLAS-based multi-threading libraries try_paths = [ ...
99c38a57853bf222d298ce41a0b6f3d8b3937f3df61adc63e3aacc12b8f73fa8
Python
2,484
67
"""Test cases for to_coco.py.""" import os import unittest from bdd100k.common.utils import load_bdd100k_config from bdd100k.label.to_coco import ( bitmask2coco_ins_seg, bitmask2coco_seg_track, bitmasks_loader, ) SHAPE = (720, 1280) class TestBitmasks2COCO(unittest.TestCase): """Test Cases for the d...
adf4e8e8c4697091d34550b9f98bbf04688d0727937252e78066f6ad89ce6c85
Python
2,485
75
import torch import torch.nn as nn from torch.linalg import svd class MMCRLoss(nn.Module): """Implementation of the loss function from MMCR [0] using Manifold Capacity. All hyperparameters are set to the default values from the paper for ImageNet. - [0]: Efficient Coding of Natural Images using Maximum M...
4327827345fff4fc3acf0a157c96d9e9528b3411d7d2f875691e3b4fe37d7ba0
Python
2,486
73
# coding=utf-8 # Copyright 2024 The Google Research Authors. # # 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 applicab...
d24344fcbc3f7d9f99c6e7cab6a30e00b70ae04b9b760f3c8ff38a99cada47c1
Python
2,486
79
""" Module for handling the conversion of a normal dataset of splicepoints to a dataset of intron/exon annotations. """ import numpy as np IS_INTRON = {(1, 2): False, (2, 1): True} ANNOTATION_INTRON = -2 ANNOTATION_EXON = -1 def to_intron_exon_annotation(ys): """ Take the given annotation of outputs, and c...
1d9741689f0ff0b049fb7fd3ca973c424bec868f60352cb5f8200d133f2b43e4
Python
2,487
56
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for activation""" import unittest from sknetwork.gnn.activation import * class TestActivation(unittest.TestCase): def test_get_activation(self): self.assertTrue(isinstance(get_activation('Identity'), BaseActivation)) self.assertTrue(isinst...
c5709d124b2db9da790c65c1c4424dd43d9f29f3f67183442e17f8918c16a246
Python
2,487
71
"""Which closed ways are areas: the OSM wiki's list of polygon features (https://wiki.openstreetmap.org/wiki/Overpass_turbo/Polygon_Features), as OSMnx uses it. """ ALL = "all" PASSLIST = "passlist" BLOCKLIST = "blocklist" # Per key: every value makes a closed way an area (ALL), only the listed values do # (PASSLIST)...
5bc6a48d86c7720e37343887d919f37b2417794ec7bac2fe0dccc358473a7b2d
Python
2,488
82
"""add page history columns Revision ID: b75f0f4dbcd4 Revises: b8d5e2f9a1c7 Create Date: 2025-01-06 """ import sqlalchemy as sa from galaxy.model.custom_types import TrimmedString from galaxy.model.migrations.util import ( add_column, create_foreign_key, create_index, drop_column, drop_constrain...
bbcd64b202349e400a5a88b6cec2b73af9eba9ae3ee2b7d494719a15273833bf
Python
2,488
78
import itertools import tqdm.auto as tqdm import numpy as np import pandas as pd import matplotlib.pyplot as plt from modular_splicing.dataset.h5_dataset import H5Dataset def get_location_info(y, m, look_cl): overall = [] splice_points = np.where(y)[0] for site in np.where(m[look_cl:-look_cl])[0]: ...
faaf900b3e9cd941499bdb808dca37bceb7d32d31f4fc710d776ec84d9635a6f
Python
2,488
62
# coding: utf-8 #new version of flip catching/correcting script that detects strand flips and corrects them back in RFmix output #this version fixes the RFmix output, .msp file with LAI calls for 2-way admixed individuals __author__ = 'egatkinson' import argparse import re import numpy as np def parse_args(): parse...
3c88d5d635521bb7b4ba85ebaea4322a79a392841e10601e8310deb5dcc5e050
Python
2,489
67
from typing import Tuple import pytorch_lightning as pl import torch import torch.nn.functional as F from pytorch_lightning import Callback from pl_bolts.utils import _TORCHVISION_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _TORCHVISION_AVAILABLE: from torchvision.utils import make_grid els...
a8484fc7b0e1fd9aca5ec6f61a89c80e97f16acfd484ce2caaa50951668ff4e7
Python
2,489
77
"""Static Galaxy file sources - ftp and libraries.""" from galaxy.files.sources import PluginKind from .posix import ( PosixFilesSource, PosixTemplateConfiguration, ) class UserFtpFilesSource(PosixFilesSource): plugin_type = "gxftp" plugin_kind = PluginKind.stock def __init__(self, template_conf...
537a7de94a2068ed54db968ccf03f3ffadfa2bce6b5094116543368409a4e6d7
Python
2,490
65
'''Test tns.generate.section code''' import json import os import numpy as np from nose.tools import assert_dict_equal from numpy.testing import assert_array_almost_equal, assert_equal from tns.generate.algorithms.common import TMDStop from tns.generate.algorithms.barcode import Barcode _PATH = os.path.join(os.path.d...
bb14573569e5a0dde43db6ec140432e17c87449bc03207a882b13bbed8870d32
Python
2,490
87
# Copyright 2022 Deepfold Team # # 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 agreed to in writin...
bc54726bcfb707f0a80cb1218a59a3459799c41fe0da69151f752a298a727683
Python
2,490
77
""" Reusable widgets for editing stored configurations. Exposes the per-conftype editors, the preset managers and the field-level widgets the portal apps build their forms from. """ from .arena_widget import build_area_widget from .border_widget import build_border_widget from .conftype_actions import ConftypeActions...
32a8693ab9427ddbbe6fe0edcbbf207269d5f921fe373c3c50b502c662ba3457
Python
2,491
90
from typing import ( Optional, # Special ) from anndata import AnnData from stlearn.pl._docs import doc_spatial_base_plot, doc_subcluster_plot from stlearn.pl.classes import SubClusterPlot from stlearn.utils import _AxesSubplot, _docs_params @_docs_params( spatial_base_plot=doc_spatial_base_plot, subcluste...
3523e2f5f37ea94a85b859ab0954ef24222530bee1400561116fc1ce805421ad
Python
2,491
88
import json import sys import os import traceback import anarci """ This script checks whether the input JSON sequences contain antibodies. """ FAIL_MESSAGE = "MSA diversion check failed! The input is not supported currently." def read_json(path): """ Read a JSON file and return its contents as a Python obje...
42ff8bc33c9508c8da846f8694cf88610d1b7f0c5cfffb78f69be72b18302a61
Python
2,491
75
""" SimplyFire is a customizable analysis software for electrophysiologists. It is written in Python. SimplyFire can be downloaded from TestPyPI as follows: pip install -i https://test.pypi.org/simple/simplyfire To run the software from command line, use script: py -m simplyfire The software is currently under pre...
5630d5401932a60bb8bf105318f1760ea336ef5b6c351eacb7a9867eecfe4c1f
Python
2,491
75
from typing import Tuple from lightly.transforms.multi_view_transform import MultiViewTransform from lightly.transforms.torchvision_v2_compatibility import torchvision_transforms as T class MultiCropTranform(MultiViewTransform): """Implements the multi-crop transformations. Used by Swav. Input to this trans...
52140e5f8936da0a7d9e7a18209c6b4c15f083476fc2a14ca71bac96f724bbef
Python
2,492
97
import multiprocessing as mp # from multiprocessing import Process as Process from peakME_functions_2022 import * from map_build_functions import * from sys import argv import os import pandas as pd if __name__ == '__main__': threads = mp.cpu_count() cmf_dir = argv[1] # close match files mir...
d64015db668df2de2fe126d7b9f7292332ec0588eb41db671e0fbf5bd7e6e397
Python
2,492
47
"""C.3: калибровка метрик знака на рукописных политиках. Без калибровки метрики результаты этапа 3 интерпретировать нельзя. Три политики с заранее известным ответом (signs=True): * mark_always — метить всегда, содержание — шум: MI(состояние; содержание) должна быть ~0 (знак есть, смысла нет); * mark_when_hungr...
067b9bfec708a92e683a32b904f13efa7d0ae5ecbfb34308b2c80bd0ab4589ba
Python
2,493
73
####################################################################################################### ##################### Preprocessing for multi-task models ############################################# ####################################################################################################### import...
1f6702ef71a48d84cf048adec19be66ec06fabd13c6528fdf7217250768fba08
Python
2,493
51
import torch.nn as nn from models.encoders import VGG11Encoder, AlexNetEncoder from models.resnets import resnet50 class LPLNet(nn.Module): def __init__(self, encoder='vgg', pretrained=False, train_end_to_end=False, projector_mlp=False, projection_size=256, mlp_hidden_size=2048, base_image_size=32, no_biases=Fal...
a838804b2886c85595c5f6cb80df3635c0bbaac98dba7a4629a15a7bace7cb95
Python
2,493
68
import os import sys from robustness import datasets from robustness.attacker import AttackerModel from robustness.model_utils import make_and_restore_model import torch torch.backends.cudnn.benchmark = True from model_analysis_folders.all_model_info import IMAGENET_PATH, MODEL_BASE_PATH def build_net(ds_kwargs={}, re...
146974811a5dc67b721cfd7eddda8e8bfbef8b168329238d6ba71b7d8a91307a
Python
2,494
80
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Unselected(_BaseTraceHierarchyType): _parent_path_str = "choroplethmap" _...
2565bc77c0b1b43024764b2f4539dd110a22eb449d44f4ad5ab55b3ee4c72207
Python
2,494
73
""" Utilities for using ggplot2 witn ipython / jupyter. """ from rpy2 import robjects from rpy2.robjects.lib import ggplot2, grdevices from IPython import get_ipython # type: ignore from IPython.core.display import Image # type: ignore class GGPlot(ggplot2.GGPlot): def png(self, width=700, height=500): ...
40d524ac9fc1a9a6edc6290f8f9d19c7fabbe5163fa4d4c75dda2f7a35ee8940
Python
2,495
63
#!/usr/bin/env python # # Copyright 2018 Google LLC. 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 of...
85e0a334380f7b198f7650281bbe85bd8203383c7345922c342605de465eb637
Python
2,495
67
import os import pytorch_lightning as pl from rdkit import Chem # safe import before ccdc imports from bioconfpred.data.dataset import PyGDataset from bioconfpred.data.split import (RandomSplit, ScaffoldSplit) from bioconfpred.model import (SchNetModel, ...
87ea19b4301a7e745471fd7d7b37412f25ec875a7f3b70a0f2ce780c45d9823e
Python
2,495
73
import numpy as np from scipy import sparse from sklearn.base import BaseEstimator, TransformerMixin from sklearn.preprocessing._data import _handle_zeros_in_scale from sklearn.utils.sparsefuncs import min_max_axis class MinMaxScaler(TransformerMixin, BaseEstimator): """ If I wanted to use min-max scaling on ...
f3fb07a7274bd28a278be6e0baf2740cb3ea298bf795e342229d9838e7f9e1e7
Python
2,495
64
#!/usr/bin/env python # Created on: July 8, 2013 __author__ = "Sven Kreiss, Kyle Cranmer" __version__ = "0.1" import effectiveModel import optparse parser = optparse.OptionParser(version=__version__) parser.add_option("-i", "--input", dest="input", default="inputs/atlas_prodModes_hists_and_response_functions.root:...
371dcf26f9618395070199998db3d0267249f03644f1846778d12081cb0e9114
Python
2,496
60
"""01. Single object tracking with pre-trained SiamRPN models ============================================================= Object tracking is a long standing and useful computer vision task. Unlike image object detection, it predicts the position of the object in the next frame according to its position in the curren...