sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ff6626dfe2fa5c3893b7acd88419cf954c4ae7ce5c6944fb21dda0d10b96116b | Python | 4,531 | 118 | import warnings
import os
import logging
import tempfile
import unittest
import arviz as az
from pmsurv.models.weibull_linear import WeibullModelLinear
import tests.syntheticdata
from pathlib import Path
warnings.simplefilter("ignore")
logger = logging.getLogger(__name__)
class TestWeibullLinear(unittest.TestCase):... |
6fd318a05467cee90efe26d89273891e8356ee160cf2015b59cb95f4b8b4e2d9 | Python | 4,534 | 142 | # --- 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 Marker(_BaseTraceHierarchyType):
_parent_path_str = "scatterpolar.unselected"... |
e31d5a0394b4c684a8a2640e410a98be4fd8a11f7bf678d68d473f6fddb99bd0 | Python | 4,534 | 142 | # --- 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 Marker(_BaseTraceHierarchyType):
_parent_path_str = "scattersmith.unselected"... |
d249f9df783ff51f5b91c7ffdc351e9a47313fb22838ffcd95803d5a5c9b29e7 | Python | 4,535 | 185 | """Define an algorithm settings object and related functionality."""
from collections import namedtuple
###################################################################################################
###################################################################################################
class Setting... |
f8e45794b1ee0811f8864890ce17f61f2ae7927b635348ac82fe0d64f4b85450 | Python | 4,536 | 113 | import math
from typing import List, Tuple
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity
from torchvision.models import resnet50
from lightly.loss.dcl_loss import DCLLoss
from lightly.models.modules import SimCLRProjectionHead
from lightly.models.uti... |
45c3abc44eca428e9bbc407ee506587eafaa33fbe07d7f59c6eae3dca0244c66 | Python | 4,539 | 120 | """Use Cellpose for cell identification and labeling.
https://github.com/MouseLand/cellpose
[Stringer20]_
"""
from typing import Optional, Union
import numpy as np
from anndata import AnnData
# Cellpose API has changed across versions: some releases expose `Cellpose`,
# others only `CellposeModel`. Be permissive in... |
4e9c5db054b65ba5b2f12adde18b9efbe39e3a5acd55e9bca6c7e951175f5e96 | Python | 4,539 | 142 | # --- 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 Marker(_BaseTraceHierarchyType):
_parent_path_str = "scattercarpet.unselected... |
069d252066cdc49b1b7915021ff354308fdede1c0e78bdcb9dde1015abab43b5 | Python | 4,540 | 114 | """The per-layer object of a calibration mode.
A calibration mode creates one `Calibrator` per layer it calibrates, passes
every input the layer sees during the calibration sweeps to `observe`, then
calls `quantize`, which solves for the layer's codes and writes them back
through the mode's strategy.
`GPTQCalibrator` ... |
a7d48fe6107d713f2a1fd4dffbb9fa304cac42c8e8d7249a29719a9b3a44e1de | Python | 4,542 | 142 | from unittest import mock
from uuid import UUID
import pytest
from fastapi import HTTPException
from carbonserver.api.infra.repositories.repository_organizations import (
SqlAlchemyRepository as OrgSqlRepository,
)
from carbonserver.api.infra.repositories.repository_projects import (
SqlAlchemyRepository as P... |
d55361e37c3123b84edc0adb0191b06b406d9aa0423fee1bece106d4718fcbee | Python | 4,542 | 89 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
4e18faf14ed7c61aeb354ff2548e3c12616054502dcdb84540d2f7ea3dc40728 | Python | 4,543 | 108 | """Module which creates mesh lines from a line set
Open3D relies upon using glLineWidth to set line width on a LineSet
However, this method is now deprecated and not fully supporeted in newer OpenGL versions
See:
Open3D Github Pull Request - https://github.com/intel-isl/Open3D/pull/738
Other Framework Issues - ... |
e9d344d1a8456e5682e00092b95ac93c6e9cab9325052fcd8da7842122b376b5 | Python | 4,543 | 133 | '''Tests for bdpy.preprocessor'''
import unittest
import numpy as np
from scipy.signal import detrend
from bdpy.preproc import interface
class TestPreprocessorInterface(unittest.TestCase):
'''Tests of 'preprocessor' module'''
@classmethod
def test_average_sample(cls):
'''Test for average_sampl... |
12df5ba778ebadcf5e1ad1a14cf4cfdcad2e2608fa2da95bf4970e39006b52ff | Python | 4,544 | 142 | # --- 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 Marker(_BaseTraceHierarchyType):
_parent_path_str = "scatterternary.unselecte... |
74c6ff2a86b74f0ef3dd8b2c5a272f557ae48abbc519c9463c8f10f5f86856a3 | Python | 4,544 | 112 | import pandas as pd
import pylab as pb
import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.metrics import roc_curve, roc_auc_score
from mp_dip.utils.interpolate_head_features import get_positions, interpolate_feature
from mp_dip.utils.data_preprocessing_utils import con... |
8ac5054c3244d4189a23af21e14b6c93c175bed5454003b3fb42a1fbe0f5c7d3 | Python | 4,544 | 142 | # --- 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 Marker(_BaseTraceHierarchyType):
_parent_path_str = "scatterpolargl.unselecte... |
9ccfebeac55e1a65122ebb7199e51f9e0250ad87cf61d5e306c9e3efc8696a27 | Python | 4,544 | 143 | from multiprocessing import pool
import numpy as np
from .step1 import step1_basic_estimation
from .step2 import step2_final_estimation
def bm3d_CEST(
img: np.ndarray,
mask: np.ndarray | None = None,
config: dict | None = None,
multi_processing: bool = False,
) -> np.ndarray:
"""
Apply BM3D ... |
ff848d39b43dc4771cd0aee281ef1078bb8cb47a5ca28067ec81932566c883a5 | Python | 4,544 | 179 | """
Provides functionality for unit conversions
"""
from dataclasses import dataclass, field
# from pydantic.dataclasses import dataclass, field
@dataclass
class Time:
"""
Measured in seconds
"""
seconds: float
SECONDS_TO_HOURS = 1 / 3600
@property
def hours(self) -> float:
ret... |
9a20702e820340ff1254df1a3d650b8d9f2207c34bfe62e3aa3094aa310d661e | Python | 4,546 | 165 | import sys
import functools
import pandas as pd
class Logger:
def __init__(self, path):
self.path = path
with open(self.path, 'w+') as f:
pass
def log(self, text):
with open(self.path, 'a') as f:
f.writelines(text+'\n')
AA_LIST = [
'GLY', 'ALA', 'SER'... |
10cbb9d4fbc02e03c78e7592d23fd67fb824f45d2c20b4968a759a4eccf535d2 | Python | 4,548 | 111 | """Typed shell setup entries used by destination configuration and job runners.
Destination environment entries are ordered job configuration, separate from the
runner parameters persisted on jobs. The ``type`` field controls forwarding into
wrapped tool containers; it does not change how a statement runs in the job s... |
7f6287dc8c3e7e6c570c8806e1b1a5101ce21b280c2236e72017b2c3002cdda2 | Python | 4,548 | 130 | import torch.nn as nn
from ..modules.module import Module
from .unet import UpsamplingUNet
class JUngleNet(Module):
"""
Neural network model: U-Net and scorer.
:param in_channels: number of input channels, e.g. 10 for sentinel-2 images
:param image_size: one out of 256, 128, 64; just implemented for... |
85a52100df817783833fb43447cca4d320fb27d42d9eb3b0ba0186950fa58f34 | Python | 4,548 | 134 | from pytorch_msssim import SSIM
from torchmetrics.image import MultiScaleStructuralSimilarityIndexMeasure as MSSSIM
import torch
acceleration_factor = 20
# ++++++++++++++++++++++++++++++++++
# MODEL
# ++++++++++++++++++++++++++++++++++
# ResNet dictionary parameters
resnet_options_dict = {"number... |
bbce5810f7007be3a10d3d3461f30076b24f8a602c69c3c35cc9bf73ea3f3f89 | Python | 4,548 | 95 | #结论:当模型进行ensemble的时候性能会明显提升。
import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functio... |
e269f8679302983df62d14add3976ab8dc9b2f22edfb5bb737251339f13c9364 | Python | 4,548 | 112 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import zip
from tifffile import imread
from collections import namedtuple
from itertools import chain
from ..utils import _raise, consume, axes_check_and_normalize
from ..utils.six import Path, Fil... |
a4f05637154deb21f03c322bf15e09da29deb2ab19c682b8025a86335510cfde | Python | 4,551 | 145 | #%%
'''
Processes datasets for different acceleration factors
author: obanmarcos
'''
from config import *
from concurrent.futures import process
import os, sys
# Where am I asks where you are
sys.path.append(where_am_i())
import seaborn as sns
import cv2
import argparse
import numpy as np
import matplotlib.pyplot as... |
a61a000b2919dc44823578795f5a00c10c22946bbed30a794d48bf71a868831f | Python | 4,551 | 136 | """Task Routing.
Contains utilities for working with task routers, (:setting:`task_routes`).
"""
import fnmatch
import re
from collections import OrderedDict
from collections.abc import Mapping
from kombu import Queue
from celery.exceptions import QueueNotFound
from celery.utils.collections import lpmerge
from celer... |
5a4d66a1b2f0430125478f9245cbff8eba7bcb5ae8c16b60c282c8fac24a0d0c | Python | 4,552 | 127 | '''Distributed computation module
This file is a part of BdPy.
'''
__all__ = ['DistComp']
import os
import warnings
import sqlite3
from contextlib import closing
class DistComp(object):
'''Distributed computation class'''
def __init__(self, backend='file', comp_id=None, lockdir='tmp', db_path='./distcom... |
876a8621af79a38fc8a46a156f77eead97b237d4929453b6c01a20c37c2a4dc4 | Python | 4,552 | 128 | import numpy as np
import torch
from gpu_sel import *
from calculate import *
from write_format import *
import getneigh as getneigh
import re
# unit
length_a_au=1/5.29177208590000E-01
Di_de_au=0.393430307
energy_ev_au=1.0/2.72113838565563E+01
Di_de_ev= 0.20819434
Ef_au_ev=51.4221
#convertor
factor_energy=energy_ev_au
... |
501f994d5858e2b8cef058fa523de17100d8eda6f31b221e11b4fc49306529bd | Python | 4,553 | 139 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
import pytest
from eelbrain import Factor, datasets, plot
from eelbrain.testing import hide_plots
@hide_plots
@pytest.mark.parametrize('Barplot', [plot.Barplot, plot.BarplotHorizontal])
def test_barplots(Barplot):
"Test plot.Barplot"
ds = datasets.get_u... |
27930a693e62ff72ec0d3065ae7d6847d80343ddb2981f7d8d71e138c440e2b3 | Python | 4,554 | 108 | #!/usr/bin/env python3
import copy
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
REPLACEMENTS = {
"benchmarks/corigami_predict_benchmark_dip3d_planA_merge.ipynb": {
"/gpfs1/tangfuchou_pkuhpc/tangfuchou_test/lujiansen/software/corigami/predict/": "../outputs/prediction/p... |
5042150787973d64c774f72af717cbdcf886faae1fdd966700e9d815cf63935f | Python | 4,554 | 125 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
1bd1be48dead5be8f4a9bcdef1fcf19aea66f48d2acd1d3a2ceecfc728157133 | Python | 4,555 | 113 | import math
from typing import List, Tuple
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity
from torchvision.models import resnet50
from lightly.loss.dcl_loss import DCLWLoss
from lightly.models.modules import SimCLRProjectionHead
from lightly.models.ut... |
54de18a26956d6b4fdb6b32f5b1904deebc5a3afda74cc4a91c64ff82f1dbc64 | Python | 4,556 | 201 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import cv2
import argparse
# package version
from .__version__ import __version__
# segmentation model for wound identification
from .segmentation import wound_segmentation
# constant values
from .constants import GREEN_COLOR_CODE
from .constants import RED_COLO... |
99686896c4214bb3748fadd3e1b79d8ff6bf986264af357ab711e479e733cce4 | Python | 4,556 | 107 | """
diagnose_amplitude.py — why are the two groups on different amplitude scales?
Run from the project root:
python diagnose_amplitude.py
Two candidate explanations, which call for different fixes:
A. Global scale mismatch. The two datasets are in different units or were
recorded with different amplifier ... |
1790fe8df886d66f767a5b06285562a75681fc0026e62b4628f8ffb4d4bf2c9b | Python | 4,557 | 125 | """
Script to generate all figs and tables from the paper
"""
import argparse
import logging
import os
from utils.utils_for_paper import (
get_nb_prot_each_main_ec_class,
get_all_prediction_weights,
get_metric_on_EC40_test,
generate_metric_file_ECPred40,
generate_latex_result_from_prediction_on_ECPr... |
200a56ce337127bb1897e744402afbe8441f4bebebb67af5f9031dd618cabc23 | Python | 4,557 | 163 | import numpy as np
import torch.nn as nn
from modular_splicing.utils.construct import construct
from .residual_unit import ResidualUnit
def no_preprocess(x):
return x, {}
class SpliceAI(nn.Module):
"""
Original spliceai code; translated from the original tensorflow
code.
"""
def __ini... |
bd6293a42dc6575b52cf0eb1eb36b20daca3f44121e1da018b88971ec9d4bb0c | Python | 4,557 | 198 | def make_mir_dic(hair_file):
mir_dic = {}
o_hair = open(hair_file)
merged_data = []
current_sequence = ""
# Bit of a complicated loop system to stitch together the DNA code which is split over multiple lines.
for n, line in enumerate(o_hair):
# if n > 5:
# break
... |
d30f85eddfa0a3371689897fba02ca0c487de977c87f1e3ed656cdfdd58d22b8 | Python | 4,557 | 124 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
table_coverage.py — 由 out/coverage_table.csv 生成稿件 Table 2
------------------------------------------------------------------
为什么要有这个脚本:稿件 §3.1 原文写着
"Coverage for every clock in every dataset is given in Table 2."
而 (a) 该表**从未存在于稿件中**(同类缺陷第五例:文档承诺了并不存在的产物),
(b) 覆盖度... |
1c14bbe06f16dbb66ec9c3a3e56463126371b910b9b331b7c02c43cf77985a6d | Python | 4,559 | 115 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
import os
from warnings import catch_warnings, filterwarnings
import mne
from mne import pick_types
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from eelbrain import load
from eelbrain.testing import assert_dataobj... |
e6f695085349eaa8c8d5b9532f94a1a50f267d9e078c2d611fc13e40eb60d168 | Python | 4,559 | 119 | #!/usr/bin/env python3
"""
Dx BG — Feature ablation redo under proper per-fold
====================================================
Re-run §3.10 drop-one-out feature ablation under the proper per-fold
per-cohort-deployment pipeline. For each of the 15 features, drop it
from the pool and re-evaluate held-out figshare B... |
2ee1aadd66ed5347d23a0f2c60765029f94dc90a45bbfeb7218457caefc13a34 | Python | 4,560 | 137 | # MIT License
# Copyright (c) 2018 Adrian Wolny (https://github.com/wolny/pytorch-3dunet)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... |
a02abe90dbd1a2bfacafd746c7c45182e5b5311638f81905cb7702b92e6ab9fe | Python | 4,560 | 210 | from utils import helper
class NetworkSetting(object):
""" Class to store parameters used for model/training
Attributes
----------
batch_size : int
Batch size to use in attention model training
train_model : bool
True if want to train the model
model_folder : string
Fold... |
4feff0523d170a3b7490c58d203b8823515fedb8a87f5a82f92d8bdd6eb59dd2 | Python | 4,563 | 137 | #!/usr/bin/env python3
"""
File: preprocess_mds_file.py
Created: 2020/10/26
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tree.
""... |
a236e589e45bb46410e907cc678952ce5ed30bd8362241b1003c6f317222a85b | Python | 4,564 | 151 | import numpy as np
from numpy.random import default_rng
import pathlib
from mpi4py import MPI
from causal_optoconnectics.tools import conditional_probability, joint_probability, roll_pad
from causal_optoconnectics.generator import (
construct_connectivity_filters,
construct_connectivity_matrix,
simulate,
... |
3486f49df79e2c7ef211d708d9b278cdb7c578e6134181b095d41b25aacbd4ab | Python | 4,568 | 141 | """Tests for Hugging Face text-input auto-routing in ``tl.trace``."""
from __future__ import annotations
from types import SimpleNamespace
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
import torchlens.bridge.hf as hf_bridge
class _HFLikeTensorModel(nn.Module):
... |
ba21a621ace87c64793346bb336264b481952e10e8a586c4c33bdb89cb78d0f0 | Python | 4,568 | 146 | """Generate the zsh completion script for vsearch.
Writes to stdout. Invoked from completion/Makefile.am:
cd scripts && python3 gen_zsh.py > ../completions/_vsearch
"""
from __future__ import annotations
import sys
import spec as spec_mod
HEADER = """\
#compdef vsearch
# vsearch completion for zsh
# Auto-gene... |
23c7c17d4c9481147d6741acc94d6648070b6728271bab03cbd9716c26f928d2 | Python | 4,569 | 118 | """Implementation of a space that consists of binary np.ndarrays of a fixed shape."""
from typing import Optional, Sequence, Tuple, Union
import numpy as np
from gym.spaces.space import Space
class MultiBinary(Space[np.ndarray]):
"""An n-shape binary space.
Elements of this space are binary arrays of a sha... |
bfd41c0ca4528406c3db2b2fc16b751feb2e8cb016efc710a54d77b1c71f6f9a | Python | 4,571 | 131 | # Copyright 2021 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 agr... |
cbc55573612a4169b8c15f0cfdeb837aed26eca3a5b7438bd499088a5bc21c71 | Python | 4,572 | 135 | """Tests for public formatting helpers."""
from __future__ import annotations
from types import SimpleNamespace
import pytest
from torch import nn
import torchlens as tl
from torchlens.utils import format_flops, format_size
from torchlens.visualization._label_format import (
format_module_kwargs,
format_mod... |
d143fca76bc7d6cffbec660f9494b19a68913135b386d8c75f802b135c0f93f8 | Python | 4,572 | 149 | import enum
import logging
import os
import sys
import types
import typing
logger: logging.Logger = logging.getLogger(__name__)
class InterfaceType(enum.Enum):
ABI = 1
API = 2
class SignatureDefinition(object):
def __init__(self, name: str, rtype: str,
arguments: typing.Tuple[str, ...... |
79f2b6d169dab2e7017cae1762d9b49f5e19cff737f8cb63e693711fa9d5a367 | Python | 4,573 | 143 | from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import os
import pickle
def tensor2im(input_image, imtype=np.uint8):
""""Convert a Tensor array into a numpy image array.
Parameters:
input_image (tensor) -- the input image tensor array
imtype (type) ... |
3d45332393403a2d0fe8035eeff9876058c415d49b7c7914d2cad3c140f1d185 | Python | 4,574 | 138 | # 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... |
3d5a6036cf96bc24ce24f624c5732acf82fd06fb2e90e43cc17c7e81ca4dbac4 | Python | 4,574 | 109 | import random
from math import ceil
import cv2
import numpy as np
import tensorflow as tf
from scipy.ndimage import gaussian_filter, map_coordinates, rotate
quantiles = np.sort(np.random.normal(0, 1, 64 * 64))
def quantile_normalize(img, distribution=quantiles):
order = np.argsort(img.flatten())
... |
f7783c266605fc336899910f79e0e7129b75fdd2d8abbfba7a7c1fb980e5d62f | Python | 4,574 | 118 | import warnings
import torch
from torch import nn
from tqdm.auto import tqdm
from ..utils.data import automove_data
class AutoMoveData(nn.Module):
"""
Wrapper to automatically move data on the same device as model.
:param model: pytorch model
"""
def __init__(self, model):
super().__i... |
1a6d2d42a645df0382e2c0058b3924b33089097030eb38e54ab9d130e9540374 | Python | 4,575 | 115 | # fix problems with pythons terrible import system
import os
import sys
file_dir = os.path.dirname(os.path.realpath(__file__))
#sys.path.append(os.path.join(file_dir, '../bin/'))
sys.path.append(os.path.join(file_dir, '..'))
import prob2020.console.randomization_test as pt
import prob2020.python.utils as utils
import ... |
b61938e64fa4f48ad6009a868b65bf553c54214987c18762a9db65b7e24eb88a | Python | 4,575 | 149 | from abc import ABC, abstractmethod
import attr
import tqdm.auto as tqdm
from permacache import permacache
import numpy as np
TOL = 1e-5
class Analysis(ABC):
def mean_number_analyses_under_null_hypothesis(self, num_runs, num_motifs, count):
return np.mean(
[
len(
... |
7f3a9eaad59f8434bbc38572ef8227ebec1f576e9e14933a0d32dad65ac6d216 | Python | 4,576 | 131 | import sys
sys.path.append('../')
import numpy as np
import os
import pandas as pd
from tqdm import tqdm
from Bio import pairwise2
from protein_mpnn_utils import parse_PDB
def load_csv_data(csv_loc):
"""Load CSV data and key colun unique IDs"""
df = pd.read_csv(csv_loc)
protein_names = df['protein_name'... |
44f70789ca67b67d48e6dd4e2654a53d4f4bfa042f1b98aa39bc60e7c95248d0 | Python | 4,577 | 161 | import torch
import pandas as pd
import numpy as np
from itertools import combinations
import matplotlib.pyplot as plt
from utils.json_loader import load_json_into_pandas_dataframe
def get_perf_choosen_model(choosen_model, list_dico, df, model_weight):
somme = 0
for ind, row in df.iterrows():
sequence... |
09ad517add5831d172d6a2584ae18012467d919b721238a8492c8b40ec0c3c0d | Python | 4,580 | 124 | import ConfigSpace as CS
import argparse
from argparse import Namespace
import os
import ray
from ray import tune
from ray.tune.schedulers.hb_bohb import HyperBandForBOHB
from ray.tune.suggest.bohb import TuneBOHB
from ray.tune.logger import DEFAULT_LOGGERS
from ray.tune.integration.wandb import WandbLoggerCallback
f... |
4e539a14b8990c0df28ca5b42914d9613e11268bb8e5654b1ca160a0775acfd2 | Python | 4,580 | 148 | #!/usr/bin/env /user/deepfold/anaconda3/envs/unifold/bin/python
import os, sys
sys.path.insert(0,'/user/deepfold/users/newton/deepfold')
err = sys.stderr
from os.path import exists
import numpy as np
import gzip
from deepfold.data.mmcif_parsing import parse as parse_mmcif_string
from deepfold.data.templates import _... |
2bb028111037e829cd7ef581a3b02fe1478a4258855197c8bde2cd3f384e9ef8 | Python | 4,581 | 128 | """Direct guards for Critical Invariants that had no dedicated test.
Invariant 1: ``torchlens/_state.py`` imports no torchlens module except the one
sanctioned cycle-safe leaf, ``from .errors._base import CaptureError`` (plus
``TYPE_CHECKING``-only imports, which never run).
Invariant 16: smart-collapse metadata is c... |
a7cd4b5c7b729f2ad44136655b061cd5e6f2b11f78375334b15988d517a6a689 | Python | 4,582 | 143 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Analysis of degradation rates across oxygen.
Project: SILAM
Step #4
Input data: Filtered normalized peptide abundance.
Output data: Mixed linear model effects analysis.
Created on 2022.06.09
Author: Kirsten Chen
Last changed: 2022.07.22
"""
import pandas as pd
... |
b4974d4b0ef2491986bb9fd08444cb9ce5c05267af40ef56561e4b8a64244bfb | Python | 4,582 | 147 | '''
Copyright 2023 Douglas Feitosa Tomé
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hop... |
444683d1ed13ebcf58adc67b56d9ed781c2f610362358d613804ca380bebc27f | Python | 4,583 | 124 | #!/usr/bin/env python
"""
Setup script for oxasl
"""
import os
import subprocess
import re
import io
from setuptools import setup
from setuptools import find_packages
MODULE = 'oxford_asl'
def get_filetext(rootdir, filename):
""" Get the text of a local file """
with io.open(os.path.join(rootdir, filename), ... |
679e05379b6dc75bbc93a4ca0b479a7920d7dc76136e31a544033ad249fde524 | Python | 4,583 | 140 | # -*- coding: utf-8 -*-
from pyoperant import hwio, components, panels, utils
from pyoperant.interfaces import raspi_gpio_, pyaudio_
from pyoperant import InterfaceError
import socket
import time
INPUTS = [5, # Hopper IR
6, # Left IR
13, # Center IR
26, # Right IR
23, # IR 1
... |
7851cdf6306c3f9666c2397ee0ad6681893f99ed3e31a19eaa57ea895a28e490 | Python | 4,583 | 91 | #!/usr/bin/env python
"""Core methods providing functionality to the agent."""
from itertools import accumulate
from typing import List
import numpy as np
import tensorflow as tf
from scipy.signal import lfilter
from angorapy.common.const import NP_FLOAT_PREC
def get_discounted_returns(reward_trajectory, discount_f... |
f0e63f0bae208b477e598c2b4db247cd7eadd29efbe5fb39f71f1fb794f13d7e | Python | 4,583 | 134 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""
This module provides classes for managing data from info source.
Author:
Mateusz Kruszyński <mateusz.kruszynski@gmail.com>
"""
import copy
from . import info_file_proxy
from . import... |
6a44d564b56943f8d895c4cd64b5d1254c3dbb5a0e156a3589fcbdf3a545400a | Python | 4,584 | 140 | import cv2
import numpy as np
import torch
import os
from glob import glob
import matplotlib.pyplot as plt
from lib.models import *
from lib.datasets import *
from tqdm import tqdm
from argparse import ArgumentParser
class Predictor:
def __init__(
self,
size=512,
checkpoint="/home/rassma... |
8400bd3c88fd86b0692470631826e8c481450066a9eee5fb116a0252113e07bb | Python | 4,585 | 145 | """
This module the language modeling dataset
"""
import logging
import torch
import numpy as np
from datasets_pre_processing.generic_dataset import GenericDataset
class LanguageModelingDatasetInverseWeightMask(GenericDataset):
"""
class that define language modeling dataset
"""
def __init__(
... |
1029f9f4298ed66537825de632a4237024d1578ca278ff3cbc9bc3a395e38878 | Python | 4,586 | 151 | """Helper Functions"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from __future__ import annotations
import os
from typing import Any, Callable, Dict, Optional, Tuple
from torchvision import datasets
from lightly.data._image import DatasetFolder
try:
from lightly.data._video imp... |
4dc7fd3765426ee929389929b9eeccb2fe7c1beabdffdc7d6a2ea200548eb966 | Python | 4,586 | 161 | """Phase 4.5 capture-time runtime smoke tests."""
from __future__ import annotations
import pytest
import torch
from example_models import TinyReluAdd as _TinyShiftModel
import torchlens as tl
from torchlens import _state
from torchlens._trace_state import TraceState
from torchlens.options import CaptureOptions
cl... |
85c2393ef29de22503dc871ba14c974d23723104ae6eaeb11d1f1d98b7c323ce | Python | 4,586 | 95 | import pandas as pd
import numpy as np
from skmob import TrajDataFrame
from skmob.utils import constants
from skmob.preprocessing import compression
class TestCompression:
def setup_method(self):
latitude = constants.LATITUDE
longitude = constants.LONGITUDE
date_time = constants.DATETIM... |
a28aaea46f04b932be093d413558041b9fafe22c43ccd6d153b485b473b94723 | Python | 4,586 | 170 | import math
import pytest
import torch
import torch.nn.functional as F
from lightly.utils.benchmarking import knn
def _supports_float16_topk_on_cpu() -> bool:
# Older torch versions, such as 1.10, have no float16 topk kernel on CPU.
try:
torch.zeros(1, dtype=torch.float16).topk(k=1)
except Runti... |
cc3517c757711f1ecbe3d7f008e94e50dfdf6b5aff8eff81bf5095cf12dfcd88 | Python | 4,586 | 136 | # This example requires the following dependencies to be installed:
# pip install lightly[timm]
# 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 torch
import torc... |
255c3610cf4b8837ba2149041c331f1ac859fdd76cec4195b4c35987e2d62b18 | Python | 4,587 | 126 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
import pandas as pd
import argparse
import os
import time
import sys
import pwd
import pdb
import csv
import re
import deepchem... |
be58bd1be4c8566a111f1a40252eedd84e0d4a113b4c3f6a1f02c6a9e1c780c1 | Python | 4,587 | 127 | """
Genetic-algorithm optimization-progress plotting.
"""
from __future__ import annotations
from typing import Any, Optional, Sequence
import pandas as pd
import seaborn as sns
from matplotlib.ticker import MaxNLocator
from .. import plot, funcs, reg
__all__: list[str] = [
"ga_progress_plot",
]
def _ga_param... |
9d48e01076934a2cb67be73ea9ab5661d08a1c4fa888ef19717d5b49485ffcb6 | Python | 4,589 | 137 | # Copyright 2021 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 agr... |
eb6da4913f7e40ebcfd168c904dd358a391a3ddbe21c635de9767847034e5d15 | Python | 4,589 | 131 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
fb24f1339dc17b4956abe64ef7027a8de91ecc65ecbf0bbb00f87d2b315b6153 | Python | 4,589 | 157 | """Test suite for the feedforward layer functionalities.
"""
# imports
from rectipy.edges import Linear, RLS
from torch.nn import Linear as TorchLinear
import pytest
import numpy as np
import torch
# meta infos
__author__ = "Richard Gast"
__status__ = "Development"
# Utility
#########
def setup_module():
pri... |
8483e8eed40c2ce6378c5e5dcf9f32944a4aec5d531e9b0f702841f9328583d3 | Python | 4,590 | 116 | #!/usr/bin/env python
# coding: utf-8
"""
Compute RSA between RDMs
------------------------
This example showcases the most basic version of RSA: computing the similarity between
two RDMs. Then we continue with computing RSA between many RDMs efficiently.
| Authors:
| Marijn van Vliet <marijn.vanvliet@aalto.fi>
"""
... |
b1439570ce79256dd6a2d94128a69e9ce246d7d3ec23cec12afc81f2453a452c | Python | 4,590 | 116 | """
The label generator for the pretraining.
"""
from collections import Counter
from typing import Callable, Union
import numpy as np
from rdkit import Chem
# from descriptastorus.descriptors import rdDescriptors
from BatmanNet.data.molfeaturegenerator import register_features_generator
Molecule = Union[str, Chem.M... |
2e65b04147effd50325fcc9162d869d560ce677cf06b141816188b443c653003 | Python | 4,591 | 127 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Setup script."""
import numpy
from setuptools import find_packages, setup, Extension
from sysconfig import get_platform
from distutils.command.build_ext import build_ext
import os
import builtins
from glob import glob
test_requirements = ['pytest', 'nose', 'pluggy>=0.... |
86abfb41cd73bf01f97a5a72d3960b3f85370dcacfe9da8c3eac7b942eab9adb | Python | 4,591 | 145 | # --- 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 Line(_BaseTraceHierarchyType):
_parent_path_str = "scattergeo"
_path_str ... |
e9ebc610f4f53d13b62fcf6acfb1357111a487c88e805db6b1c2609cd9765fb7 | Python | 4,591 | 146 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 6 19:29:07 2017
@author: admin
"""
import tensorflow as tf
import numpy as np
from tensorflow.python.framework import ops
from sklearn import preprocessing
import matplotlib.pyplot as plt
import os
tf.reset_default_graph()
def accuracy(predictions, la... |
26f352e6b333adc8edb6746d07cd93e2ddadf3e1c6b394cc03fcf65ac17d3c72 | Python | 4,593 | 110 | import os
import argparse
import numpy as np
from gluoncv.torch import model_zoo
from gluoncv.torch.engine.config import get_cfg_defaults
from gluoncv.torch.utils.tvm_utils.nms import nms
import torch
import torchvision.transforms as T
from PIL import Image
import tvm
from tvm import relay
from tvm.contrib.download imp... |
8097904dd9beb790dafacb60a46c292ee6038a55f18cbdc71262f6b4fef9b408 | Python | 4,593 | 123 | from PyQt6 import QtCore, QtWidgets
import pyqtgraph as pg
from pyqtgraph import exporters
class SimplePlotItem(pg.PlotItem):
"""Custom class for data visualization in impose
Modifications include:
- right click menu only with "Export..."
- top and right axes
"""
def __init__(self, parent=No... |
088c5a69fa3e729d1999bfe8f45608069fa35f4103bd9fd97acee4cb5dea2f9a | Python | 4,595 | 145 | """
Author: Derek van Tilborg -- TU/e -- 19-05-2022
Basic graph convolutional network [1] using a transformer as global pooling [2].
1. Kipf & Welling (2017). Semi-Supervised Classification with Graph Convolutional Networks
2. Baek et al. (2021). Accurate Learning of Graph Representations with Graph Multiset Pooling
... |
398d39ac62396b659041bdbff594868b439168136a05b72ef3b2dfbed0112238 | Python | 4,596 | 107 | from typing import Optional, Tuple, Union
import matplotlib as mpl
import numpy as np
from pyvista import PolyData, UnstructuredGrid
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
def add_model_labels(
model: Union[PolyData, UnstructuredGrid],
labels: np.nd... |
d894a0306b95fd91653f6995b5beb9b66ce96d938c12db6b3cb0e6f34f4b1cf0 | Python | 4,596 | 140 | import torch
from torch.nn import ReLU, Linear
from torch_geometric.nn import GCNConv, global_max_pool, global_mean_pool
class NodeGCN(torch.nn.Module):
"""
A graph clasification model for nodes decribed in https://arxiv.org/abs/1903.03894.
This model consists of 3 stacked GCN layers followed by a linear ... |
197148df4a78648c5568aab932df95a9fc5ff08404522a985cf2cd2972460f9c | Python | 4,599 | 143 | from __future__ import annotations
import narwhals as nw
import polars as pl
import polars_config_meta # noqa: F401
from attrs import define
from narwhals.typing import IntoFrame, IntoFrameT
@define(frozen=True)
class CoordSchema:
chrom: str
start: str
end: str
zero_based: bool
strand: str | Non... |
dd42ea8bbeddd99628f14d94cff02262bba12e66faaa6bf5a9248f3586b8444c | Python | 4,599 | 106 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in May 2019
@author: Nathan de Lara <nathan.delara@polytechnique.org>
@author: Thomas Bonald <bonald@enst.fr>
"""
from typing import Union, Optional
import numpy as np
from scipy import sparse
from sknetwork.linalg.ppr_solver import get_pagerank
from sknetwor... |
838db172ad878966afd444d2b0d2a6c2d304d58117e9074941d67eb93cf78829 | Python | 4,600 | 146 | import unittest
import os
from datetime import datetime, tzinfo, date, time
from configparser import ConfigParser
import pyEcoHAB.utils.temporal as ut
from pyEcoHAB.utils import for_loading as fl
from pyEcoHAB import sample_data
class TestConvertIntsToTime(unittest.TestCase):
def test_1(self):
self.asser... |
be28c6d8e8dabba29af4781a2e43d76743f43439b02a9939609d5b07e9190754 | Python | 4,600 | 101 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 26 11:31:29 2022
@author: LABadmin
"""
def GetOneFunctionVarianceDifferentModels(dataDir = 'D:\\Figures\\OneFunction_raw\\',flat = False, diffCutoff=0.01, cutoff = 0.01,return_subset = False,depth = None,shuffles = False,resp = []):
# See what version of the function... |
2c664f9990aeff11f5f378868f250e5502f79aa40ba15dc6e4ebf89358c2f83f | Python | 4,602 | 141 | import torch
from torch import nn
class UpSampleConv(nn.Module):
def __init__(
self, in_channels, out_channels, kernel=4, strides=2, padding=1, activation=True, batchnorm=True, dropout=False
):
super().__init__()
self.activation = activation
self.batchnorm = batchnorm
s... |
78111c0473567d14257803a887583a39d4eef3fd18eda300347e58c5e9a9be28 | Python | 4,602 | 168 | from flask_restplus import Namespace, Resource, reqparse
from flask_login import login_required
import os
import shutil
import datetime
from database import (
ImageModel,
DatasetModel,
CategoryModel,
AnnotationModel
)
api = Namespace('undo', description='Undo related operations')
model_list = reqpars... |
97819a53c3cd2d9599dba4e9925fdcb115d74cd37a7555523140cf56325cf838 | Python | 4,602 | 90 | import argparse
import os
import random
import time
class Option(object):
def __init__(self, d):
self.__dict__ = d
parser = argparse.ArgumentParser()
parser.add_argument('--parser_name', type=str, default="dti")
parser.add_argument('--cuda', type=bool, default=True)
parser.add_argument('--mo... |
f9ccb0184cb56f9d8a2886acc12c1b55bc50efe6f6a049e6acc8a7bc559e4e2d | Python | 4,602 | 147 | import copy
import numpy as np
import pandas as pd
from mirp._features.texture_matrix import Matrix
class MatrixNGLDM(Matrix):
def __init__(
self,
distance: float,
coarseness: float,
**kwargs
):
super().__init__(**kwargs)
# Neighbourhood dist... |
3525d9c97a3c4ebc4081721fe0984ce03537ed6eb5caadac3008cd9a2e9abb77 | Python | 4,603 | 135 | from __future__ import annotations
import numpy as np
from scipy.optimize import linear_sum_assignment
from ..utils import get_iou_score
def init_stats(gt: dict, categories: dict) -> dict:
"""Initializing the statistics before counting leasion
and non-leasion localiazations.
Arguments:
gt {d... |
57e8342b05426ff2ad926ac80f579c799e96b6ed21a40f47cac9601f836bb112 | Python | 4,603 | 144 | # --- 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 Meanline(_BaseTraceHierarchyType):
_parent_path_str = "violin"
_path_str ... |
cda9a3cd4d5d77452f0647de5f9cb7cd7e52cf38cd407f9e6149600d8264e525 | Python | 4,604 | 145 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Line(_BaseLayoutHierarchyType):
_parent_path_str = "layout.shape"
_path... |
d8a22a7c4a7100dc82d439eb7eb265494a91b69319b67e935dda10350098e2f5 | Python | 4,604 | 103 | #!/usr/bin/env python
# coding: utf-8
"""
Using cross-validation when computing RDMs
------------------------------------------
This example demonstrates how to perform cross-validation when computing dissimilarity
matrices (RDMs). When the data has repeated measurements of the same stimulus type,
cross-validation ca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.