sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c8c09ef0e001d6ef2f34d49663398f60a75b5505f845fbff5d98b7db92ea5a39 | Python | 3,638 | 114 | # --- 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 = "pie.marker"
_path_str ... |
0d8a2aaf0463afe9746977875fce732ad1b825b3713b29de917135fe2edbe15d | Python | 3,639 | 138 | import os
# ^^^ The above is required if you want to import from the celery
# library. If you don't have this then `from celery.schedules import`
# becomes `proj.celery.schedules` in Python 2.x since it allows
# for relative imports by default.
# Celery settings
CELERY_BROKER_URL = 'amqp://guest:guest@localhost'
#... |
60b27841197b9726678757319bcc233b8adfb8f4a4ea5bd3bc4ddd9880d6e75b | Python | 3,639 | 101 | """
Tests for codecarbon/input.py module-level caching.
The caching mechanism loads static reference data once at module import
to avoid file I/O on the hot path (start_task/stop_task).
"""
import unittest
class TestDataSourceCaching(unittest.TestCase):
"""Test that DataSource uses module-level cache for static... |
6cf822764e965b1e27ee1bc5a5a43e548d0c1be55ff0b84502c5dcad1cb15f40 | Python | 3,640 | 115 | import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Werror',
'-pedantic-errors',
'-std=c++0x',
'-fno-strict-aliasing'... |
b097ee4c631b87baaad8c9e065abceeb17ee1624997d4d2625eb0aaf533ca39a | Python | 3,641 | 110 | import torch
import os
import sys
import pandas as pd
sys.path.append("../train")
from data_loader import ImageAndPathDataset, npy_loader
import evaluation
import torchvision
import torch.nn as nn
from vgg import _vgg
import logging
from basic_model import BasicNet
from resnet import ResNet, Bottleneck, BasicBloc... |
c93a9a6bf7cd76b78d5e56aec1579ba2dd08147254f34f1795908ec30e64574a | Python | 3,641 | 107 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._bar import Bar
from ._barpolar import Barpolar
from ._box import Box
from ._candlestick import Candlestick
from ._carpet import Carpet
from ._choropleth import Choropleth
from ._choroplethmap import Choroplethmap
from ... |
b4b19b6aab73ebb702d703d79454d22844a545e8f26695141ee7a1516e0b9b64 | Python | 3,643 | 105 | """
Feature-file checksum verifier.
Each testsuite ships an `expected_results/feature_file_sha256.json` mapping
relative cohort-feature paths to their SHA256 digests at the time the
canonical numbers were computed. The verifier compares the cached files
on disk against the expected hashes; mismatch means the features ... |
3208f7378b763edde9d8378b49c81f642ceba2a888c8f72a81e8bc5b7a4a7d1b | Python | 3,644 | 74 | #!/usr/bin/env python3
import numpy as np
from scipy.stats import zscore
import read_data as rd
"""
Dec-16-2021 by Guo Jiahui and Ma Feilong
This script contains functions and examples to calculate the difference between between-group distances and within-group distances for facial feature groups based on z-scored R... |
e75a01959a9417eacbb8e48fd88923a5628236739aa85762d5b1778b27c279b8 | Python | 3,644 | 93 | import os
from .data_split import DataSplit
from typing import List
from abc import ABC
from bioconfpred.params import (DATA_DIRPATH,
BIO_CONF_DIRNAME,
GEN_CONF_DIRNAME,
RMSD_DIRNAME,
SPLITS_DIRNAME)
class MoleculeSplit(DataSplit, ABC) :
... |
f13d3fa35e1cc45c4a986a59814660e502f05f1a7b5148a0d12ea4dfccf32c7c | Python | 3,644 | 61 | import argparse
import torch
from Trainer import Trainer
from utils import setup_runtime
from LCMnet import LCMnet
torch.backends.cudnn.benchmark = True
'''
python run.py -gpu 0 -log_path './log_file/LCMnet_xxx.log' -lr 0.0001 -num_epoch 30 -data_num 6860 -batch_size 8
'''
parser = argparse.ArgumentPars... |
29fb4a2ee412474faaba9a3721f18fd4e895042fe12ef87b0a22d42c06399215 | Python | 3,645 | 93 | import logging
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import GroupRoleAssociation
from galaxy.model.scoped_session import galaxy_scoped_session
from galaxy.structured_app import Minima... |
45285c1eddd55f465c2cb7bbaf3652ac6b280f578e61bbd1250f36d9e960100f | Python | 3,645 | 95 | import wormbrain as wormb
import numpy as np
import matplotlib.pyplot as plt
def dsmmc(Y,X,beta=2.0,llambda=1.5,neighbor_cutoff=10.0,
gamma0=3.,conv_epsilon=1e-3,eq_tol=1e-4,max_iter=100,returnAll=False):
'''Registers Y onto X via a nonrigid pointset registration based on a
Student's t-distributio... |
b024d3c69d5a3a6046cdb1fd038cabe5f738423d3ec30a8677ad3416d3dc3136 | Python | 3,647 | 80 | # Mossy layer at 45, 90, 135 degrees
from os.path import join
import numpy as np
import os
import pandas as pd
from library.comput_utils import cal_hd_np
from library.params import ParamsHolder
from library.shared_vars import sim_results_dir
from library.utils import save_pickle
from library.simulation import simulate... |
c4e44b3844528086136d221318fc68cfcfcb5598be51ecbdc575780c0938cb6e | Python | 3,647 | 93 | # Copyright 2019 Novartis Institutes for BioMedical Research Inc. 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... |
e48320c0febaf04b49e584e65de399c6008f261edec8dae7fbceee20485508bc | Python | 3,647 | 145 | """Utility functions.
This file is a part of BdPy.
"""
from __future__ import division
__all__ = ['create_groupvector',
'divide_chunks',
'get_refdata',
'makedir_ifnot']
from typing import List, Union
import os
import warnings
import numpy as np
def create_groupvector(group_la... |
89db51cf2787dd3ca405cad03d5a47499c02e7fdb0dbdd490aa37029dcfbc57b | Python | 3,648 | 105 | from collections import defaultdict
from typing import List, Iterator
from rdkit import Chem
from rdkit.Chem import Mol
class PoseReader() :
def __init__(self,
file_path: str) -> None:
"""Class to read docked poses from GOLD in sdf or mol2 (prefered) formats
:param file_pat... |
e58b83fceb61b334d20b8bbcdc996899655e4958b2c86bf6cfb37a0521b23e18 | Python | 3,648 | 125 | """Tests for inference-only trace capture."""
from __future__ import annotations
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens._training_validation import TrainingModeConfigError
from torchlens.errors import ConfigurationError
class _TinyParamModel(nn.Module):
"""Small p... |
1789f1c2f436b76aa7f6b940333cebfa01678f0fb7fa5952d9f2cb98e17ce751 | Python | 3,649 | 95 | """Pascal Augmented VOC Semantic Segmentation Dataset."""
import os
import scipy.io
from PIL import Image
from ..segbase import SegmentationDataset
class VOCAugSegmentation(SegmentationDataset):
"""Pascal VOC Augmented Semantic Segmentation Dataset.
Parameters
----------
root : string
Path to ... |
2612f2fc81891fd3c12aa2f060d28d30f66dbd2df224129cd8af3a7f241b0254 | Python | 3,649 | 87 | #!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## You may use this file under the terms of the BSD license as follows:
##
## "Redistrib... |
b80e7a05b7ccdacd4d3f3ec20d0ea256c4f4b689e536ed9756f04a43897d08f4 | Python | 3,649 | 121 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from matplotlib.backend_bases import KeyEvent
import numpy as np
import pytest
import wx
from eelbrain import datasets, plot, testnd
from eelbrain._utils import IS_WINDOWS
from eelbrain.testing import requires_mne_sample_data, hide_plots
from eelbrain.testing.ma... |
5e1de80c1a1487fd170f04306ab833975f7b022be1398531230f2a038eaa041b | Python | 3,650 | 112 | # This example requires the following dependencies to be installed:
# pip install lightly
# Note: This example requires torchvision >= 0.17 for tv_tensors support.
# To run with unsupervised segmentation masks instead of a grid:
# pip install lightly scikit-image
# Note: The model and training settings do not follow t... |
a38f61e16f6bb53c683aaf66121fc1a02f1f822d790ef66cb606127c736eadad | Python | 3,650 | 93 | #!/usr/bin/env python3
# import required modules
from Bio import PDB, SeqIO, SeqRecord, pairwise2
from argparse import ArgumentParser
from os.path import basename
def main():
# parse command line arguments
parser = ArgumentParser()
parser.add_argument('-p', '--pdb', dest='pdb',
help='input PDB fi... |
fcd748a2a0bbad2a05f9974c79c94aa7f899c296302d4802daf16ab454443c1d | Python | 3,650 | 100 | from keras.src import backend
from keras.src import ops
from keras.src import random
from keras.src.api_export import keras_export
from keras.src.layers.layer import Layer
@keras_export("keras.layers.AlphaDropout")
class AlphaDropout(Layer):
"""Applies Alpha Dropout to the input.
Alpha Dropout is a `Dropout`... |
117b77b3b7fe5d13b85aaa7665d4994c4305b4691e25d92e1930618b2cca5f2e | Python | 3,652 | 110 | """
Topological fingerprints.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Steven Kearnes, modified by Qingyuan Feng"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "LGPL v2.1+"
import numpy as np
from rdkit import... |
26af44aa427dc62606f1b37ee26f30b812ad106ede5682765ebf15e795c6932b | Python | 3,653 | 87 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
chr = sys.argv[1]
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
... |
5d5bb3bb21e0c8aa0026d86c30f726d21fd77f0da54875e5002fde3cc13884db | Python | 3,653 | 87 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
chr = sys.argv[1]
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
... |
b9f6c725b1b677c86c1287ea5b7267cf0ea8d2a773d2ea31e4d88e1dc9f48c88 | Python | 3,653 | 87 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
chr = sys.argv[1]
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
... |
c3d011ce01954bc720d678484128d99427b630bb7528ca6226d71eeaaa4a1bf6 | Python | 3,653 | 70 | from unittest import TestCase
import numpy as np
from drug_interactions.reader.dal import Drug, DrugBank
from drug_interactions.training.train import Trainer
from drug_interactions.datasets.OneHotSmilesDataset import OneHotSmilesDrugDataset
class OneHotSmilesDrugDatasetTestCase(TestCase):
def setUp(self):
... |
f3e189c688d6e362312f4a0010e341ad6d08a10095ee78f68b69e7839464a978 | Python | 3,653 | 87 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
chr = sys.argv[1]
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
... |
b1385bc85e0cbae3d42c7325a0e4d296002e7edfe2d8f0a18384af8dc5d35853 | Python | 3,654 | 105 | import torch
import torch.nn.functional as F
def adversarial_loss(y_hat, y):
return F.binary_cross_entropy(y_hat, y)
def rmsle_loss(y_hat, y):
torch.sqrt(F.mse_loss(torch.log(y_hat + 1), torch.log(y + 1)))
def tweedie_loss(y_hat, y):
"""
Custom loss fuction designed to minimize the deviance using ... |
d5db953a6da43224bdfeb65af604e9aa7af27edd88fb0047573e70e0ac3aee35 | Python | 3,654 | 106 | from typing import List, Optional, Union
import numpy as np
import pydantic
from hobj.types import ImageId
from hobj.learning_models import BinaryLearningModel
# %%
class BinaryClassificationSubtaskResult(pydantic.BaseModel):
model_config = dict(arbitrary_types_allowed=True)
perf_seq: np.ndarray
worker_... |
5cc58a249af96c4375740f2f8032ce0a9ac629f8644fcfc9ca614140730140ca | Python | 3,655 | 131 | # --- 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 Title(_BaseTraceHierarchyType):
_parent_path_str = "pie"
_path_str = "pie... |
83f8fe2b29d73186ad70377090db12553e7dce1147ad114f58ee2b8ef53b3899 | Python | 3,655 | 93 | import argparse
import glob
import pylab as pb
from icecream import ic
import numpy as np
import pandas
from matplotlib.patches import Circle
from scipy.stats import mannwhitneyu
def main():
# np.set_printoptions(precision=3)
np.set_printoptions(suppress=True)
np.set_printoptions(linewidth=120)
parser ... |
1c41efed9d8f4d63bc91de00bea3122f7d8875c2a80d78f198a9c88c2d0c0140 | Python | 3,656 | 80 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Tristan Bepler's code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
# PLUS
""" Pfam FASTA file loading functions """
import numpy as np
import pandas as pd
... |
a71d97d87529347107ff6b2a16f79fe98c5000bea4e6c6ed02496f8dbb98426a | Python | 3,658 | 114 | # -*- coding: UTF-8 -*-
import numpy as np
from sklearn import svm
import math
import random
import operator
import csv
from sklearn.metrics import f1_score
'''
@author:hunter
@time:2017.03.31
'''
class SVM(object):
def __init__(self):
pass
def loadDataset(self,filename, split, trainingSet, testSet):... |
df03629d19b02396c54790f632662a36d462bad759a5ab68c076a4c2fca8ca3b | Python | 3,660 | 93 | # -*- coding: utf-8 -*-
import os
from nilearn import datasets, plotting
from nilearn.maskers import NiftiLabelsMasker
from nilearn.connectome import ConnectivityMeasure
import numpy as np
import glob
os.chdir('/Users/wang/Desktop/Research_projects/BBSC/Functional/fMRI_Prep')
data_path='/Users/wang/Desktop... |
7278400704e3ecd8e9531de12676367ce1b48f786e6b8f77fd67f9d08d85853d | Python | 3,661 | 132 | """Predicate exception mode tests for fastlog."""
from __future__ import annotations
from pathlib import Path
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.fastlog import PredicateError, RecordContext
class ExceptionModel(nn.Module):
"""Model with several operation even... |
0b98203070eac6741d68d84a4232cb85832531644177696c1d4d73166b5a2705 | Python | 3,662 | 113 | import os
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.distributed as dist
import torch.optim
from tensorboardX import SummaryWriter
from gluoncv.torch.model_zoo import get_model
from gluoncv.torch.utils.model_utils import deploy_model, load_model
from gluoncv.torch.data import b... |
e24fd4950d372f7810a4d5a1eb034608658807b9fd8501c07e1ec4c3be189b25 | Python | 3,662 | 103 | import gc
import threading
from keras.src import backend
from keras.src.api_export import keras_export
GLOBAL_STATE_TRACKER = threading.local()
def set_global_attribute(name, value):
setattr(GLOBAL_STATE_TRACKER, name, value)
def get_global_attribute(name, default=None, set_to_default=False):
attr = getat... |
5eed3eb6c8c7c34eb7cae7b2137c044aae5e5bd98cd9b3cdfe07cc492b70aca2 | Python | 3,664 | 110 | import os
import re
import numpy as np
import pandas as pd
from tqdm import tqdm
import torch
from irnlm.data.extract_semantic_features import integral2semantic
from irnlm.models.gpt2.extract_features_gpt2_integral import batchify_to_truncated_input
def extract_features(
path,
model,
nlp_tokenizer,
... |
6264bc9dffdee0e62f0bc8bdfcb332c9fd28b7a1811ace65a119c4c1cd710ad9 | Python | 3,664 | 103 | """ Generic Python utils. """
import pandas as pd
from blueprints.translation.translation_dicts import TRANSLATIONS_DICT
def get_yes_or_no_options(language_id: str= 'en'):
'''
Returns the options for Yes/no radio buttons.
Args:
language_id (str): the language identifier for translation purpose
... |
86629c029c429b5abd6813565570e046ad63655a90ba61092d61e11986ca07a9 | Python | 3,666 | 90 | import sys
import os
from robustness.datasets import ImageNet
from robustness import train
from cox.utils import Parameters
from cox import store
from robustness import model_utils, datasets, train, defaults
import torch as ch
import numpy as np
import argparse
import importlib.util
def run_imagenet_natural_eval(... |
ac326230858953314226a2527c53f961ff10339cfcf8363b57a75024c0511941 | Python | 3,666 | 118 | # Author: aqeelanwar
# Created: 6 July,2020, 12:14 AM
# Email: aqeel.anwar@gatech.edu
from PIL import ImageColor
import cv2
import numpy as np
COLOR = [
"#fc1c1a",
"#177ABC",
"#94B6D2",
"#A5AB81",
"#DD8047",
"#6b425e",
"#e26d5a",
"#c92c48",
"#6a506d",
"#ffc900",
"#ffffff",
... |
35d78652d64c0262fd591a5c7bf563f4207e5e0d21124cbcddb8cfe62f8f0ea5 | Python | 3,667 | 117 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import time
import numpy as np
import torch
import tqdm
from slowfast.utils import logging
from slowfast.visualization.async_predictor import AsyncDemo, AsyncVis
from slowfast.visualization.ava_demo_precomputed_boxes import... |
4d5bfe1b958984db1b4b0076744463deef471ac2ade6ecb55a2bbb47e55f0fe0 | Python | 3,667 | 98 | """This package includes all the modules related to data loading and preprocessing
To add a custom dataset class called 'dummy', you need to add a file called 'dummy_dataset.py' and define a subclass 'DummyDataset' inherited from BaseDataset.
You need to implement four functions:
-- <__init__>: ... |
50cf09e1c359c62bd174d42efad32f99834a0ff0a83c707e4d28488ba6e7ae31 | Python | 3,667 | 87 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
chr = sys.argv[1]
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
... |
66d9789ab6fe2931237ff1033cf3942c053d345dd65542d246d34f7fafc37216 | Python | 3,667 | 78 | """Defining all constant variables"""
WORKING_DIR = '/home/ws/oc9627/cerebral_organoid_quant_mri'
MRI_ROOTDIR = 'data/data_zenodo/MRI_raw_data'
MRI_IMG_DIR = 'data/T2_star_images/'
DWMRI_IMG_DIR = 'data/DW-MRI_images'
# annotations
MRI_ORG_LOC_GT_DIR = 'data/data_zenodo/annotations/MRI_ground_truth_organoid_location... |
b479c08601cab181fd210cf3248931ff29d7a2f4afc54db5d389f6c2a6f1deea | Python | 3,667 | 129 | # --- 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 Rotation(_BaseLayoutHierarchyType):
_parent_path_str = "layout.geo.projecti... |
ecb63ec1c1be47491450abdb870733c13a3172c53748492b70af74147cfbdcbc | Python | 3,667 | 87 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import sys
import scipy
import os
import pydot
import pydotplus
import random
import pickle
import fileinput
SCALE=100000
chr = sys.argv[1]
def get_fragments_lengths(prov_vector):
lengths_counts_3anc = []
lengths_total_3anc = []
... |
0ad43c3421b2a723303fb93f59ae2dc9f1fabcbc8c24c7ec7694a60d2026baf8 | Python | 3,669 | 120 | from abc import ABC
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
class DeepLearningModel(LightningModule, ABC):
task: str = None
_base_strategy = None
def configure_base_strategy(self, base_strategy):
# in order to not re-register this base_strategy module ... |
78c8a66780e91eb7f16b910e64449ab9823fdb0e71b526043189908cf7fa0d42 | Python | 3,669 | 76 | import os.path
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
import random
class UnalignedDataset(BaseDataset):
"""
This dataset class can load unaligned/unpaired datasets.
It requires two directories to host training images from... |
ae3b245664929faf0eee50b926b1a60d35979de5c530c249be3fdb6dd48cf100 | Python | 3,669 | 112 | from __future__ import absolute_import
import logging
import os
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.download import path_to_url
from pip._internal.utils.misc import (
display_path, make_vcs_requirement_url, rmtree,
)
from pip._internal.utils.temp_dir import TempDirec... |
dbddf66a326e0a41da1511f44a2a0be19d1a51b5ee602eab561dc4b6357e538f | Python | 3,669 | 127 | __credits__ = ["Rushiv Arora"]
import numpy as np
from gym import utils
from gym.envs.mujoco import MuJocoPyEnv
from gym.spaces import Box
DEFAULT_CAMERA_CONFIG = {
"distance": 4.0,
}
class HalfCheetahEnv(MuJocoPyEnv, utils.EzPickle):
metadata = {
"render_modes": [
"human",
... |
228ecd7e3e7298c709bbb6a234aed3dc28d73e999d88809e4f596c83e8db318f | Python | 3,670 | 137 | # -*- coding: UTF-8 -*-
import numpy as np
from sklearn.ensemble import RandomForestClassifier
import math
import random
import operator
import csv
from sklearn.metrics import f1_score
'''
@author:hm
@time:2022.01.03
'''
class RF(object):
def __init__(self):
pass
def loadDataset(self,filename, split,... |
325de281a342bf1af8f2305220cef6d5091936e51fc4b1ea4f57154e79b7cf87 | Python | 3,670 | 131 | import functools
import time
from flask import session
from flask_socketio import (
SocketIO,
disconnect,
join_room,
leave_room,
emit
)
from flask_login import current_user
from database import ImageModel, SessionEvent
from config import Config
import logging
logger = logging.getLogger('gunicorn.... |
35ce2751877136da9457d42b97e9921bcb18178255567418251fe6fb521ff84f | Python | 3,671 | 116 | """Phase 11 intervention visualization wiring tests."""
from __future__ import annotations
from pathlib import Path
import pytest
import torch
from example_models import TinyReluAdd as _ReluAdd
import torchlens as tl
from torchlens.experimental import dagua
def _interventions() -> tl.Trace:
"""Build an interv... |
aeee5b32b3bc27fc399b5ca32ae1a366cac5eba7ed7bb121b78522d84d90ec32 | Python | 3,671 | 103 | #!/usr/bin/env python
"""Single-region prediction for ATAC-only C.Origami model (no CTCF input)."""
import os
import sys
import argparse
import numpy as np
import torch
from corigami.data.data_feature import SequenceFeature, GenomicFeature
import corigami.model.corigami_models as corigami_models
def main():
pars... |
7fbb0d46ba6c4bd5453fbaa87708a5d382f363cad0b0ed41008ba7519cf80125 | Python | 3,672 | 102 | # 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... |
d8fe37d7c65b3bd350fad62234f26fba8d89289fe00674ff6497bbcba7741124 | Python | 3,672 | 84 | import os
from ovseg.utils.io import read_nii, save_nii
from ovseg.utils.download_pretrained_utils import maybe_download_clara_models
from ovseg.model.InferenceWrapper import InferenceWrapper
import argparse
def is_nii_file(path_to_file):
return path_to_file.endswith('.nii') or path_to_file.endswith('.nii.gz')
... |
81c37daad39a8d4ee1730105043d5c7ca22b256eb8abff258f746491cb66d7fc | Python | 3,673 | 84 | """RPN proposals."""
from __future__ import absolute_import
from mxnet import autograd
from mxnet import gluon
from ....nn.bbox import BBoxCornerToCenter, BBoxClipToImage
from ....nn.coder import NormalizedBoxCenterDecoder
class RPNProposal(gluon.HybridBlock):
"""Proposal generator for RPN.
RPNProposal tak... |
fa4af482dc3684e408fedf0ac44a39486caa3ac69bf0ffc4c1c0457cb1c25c4e | Python | 3,673 | 113 | # -*- coding: UTF-8 -*-
import numpy as np
from sklearn import svm
import math
import random
import operator
import csv
from sklearn.metrics import f1_score
'''
@author:hunter
@time:2017.03.31
'''
class SVM(object):
def __init__(self):
pass
def loadDataset(self,filename, split, trainingSet, testSet):... |
56dc1ecd518c2a2e41cbf2025e49219dfea3ff2fedfdde444c00c05f0fa2cdb0 | Python | 3,674 | 137 | # -*- coding: UTF-8 -*-
import numpy as np
from sklearn.ensemble import RandomForestClassifier
import math
import random
import operator
import csv
from sklearn.metrics import f1_score
'''
@author:hm
@time:2022.01.03
'''
class RF(object):
def __init__(self):
pass
def loadDataset(self,filename, split,... |
72b6f5c1574cbf82a5b1479cc56cd403da431e1c5f2ea0922aa89dc6cf62f2a5 | Python | 3,674 | 96 | """WandbSink under ``watch`` against the real wandb package (offline only).
With no descriptor and no settings grid, ``watch(..., to=WandbSink(run),
hist_every=...)`` must attach on the sink's cap-safe grid and deliver
histograms that fit wandb's 512-bucket cap; an explicit over-cap grid still
refuses at attach.
"""
... |
d325b65aedf5115db2195d056dd09a099bf26a854854a2f333b68530a0ae1a36 | Python | 3,674 | 90 | import torch
import torch.nn as nn
import torch.nn.functional as F
class UNetConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, norm_type=None, act_type=nn.PReLU,
padding=0, padding_mode="zeros"):
super(UNetConvBlock, self).__init__()
self.norm_typ... |
c88232c4c619b948600c904884e0d93dcc6cef22fe3daf608005a2716ae85907 | Python | 3,676 | 97 | '''
# Citation: Under Revision
# Email: qususu@cibr.ac.cn
# Date: 2023-07-28
# We conducted the drug set enrichment analysis (hypergeometric test) to support that our results found by our approach were indeed relevant for ADHD.
# Detailed methods please refer to our article.
# All data was processed via Python 3.... |
4638539cacfd94917a3760460806a123fae3b24cc7538964e56ed9f1acc206af | Python | 3,677 | 141 |
from flask_login import current_user
from mongoengine import *
from config import Config
from .tasks import TaskModel
import os
class DatasetModel(DynamicDocument):
id = SequenceField(primary_key=True)
name = StringField(required=True, unique=True)
directory = StringField()
thumbnails = String... |
37d82d2257f521662beaa30ed250576d26e98f0d56b5905853e716f06df04951 | Python | 3,678 | 125 | import numpy as np
from scipy import interpolate
import sys
import os
import fabio
from datetime import datetime
import time
from matplotlib import pyplot, colors
import glob
from PIL import Image
import hdf5plugin
import h5py
## for denoising
from skimage.restoration import (denoise_tv_chambolle, denoise_bilater... |
7b7ce4866f04d80c81265d84cc771591a67f9001fe0fc8b1105a236887d67c1d | Python | 3,679 | 86 | #!/usr/bin/env python
# coding: utf-8
"""
Sensor-level RSA using mixed sensor types
-----------------------------------------
This example demonstrates how to perform representational similarity analysis (RSA) on
MEEG data containing magnetometers, gradiometers and EEG channels. In this scenario
there are important t... |
adc6ec30be2b0dfd9864d64e095dd5dbf79856bb46dde84c6a22a7374646d731 | Python | 3,679 | 104 | import torch
from torch import nn, optim
import torch_geometric as tg
from torch_geometric.loader import DataLoader
from torchmetrics import MeanAbsolutePercentageError
from typing import List, Optional, Union
import shutil
from datetime import datetime
import sys
# from easydict import EasyDict as edict
# My imports
s... |
4df5eb4044da21066bba3ac77403efa13ad89a3a4401f12633fb399f53c1839c | Python | 3,681 | 90 | from typing import Union, Dict
from pathlib import Path
import numpy as np
import torch
from torch.utils.data import Dataset
import torch
import rbm.fasta_utils as fasta_utils
class DatasetRBM(Dataset):
def __init__(self,
path_data : Union[str, Path],
alphabet : str="protein",
... |
6acc8f2cd00303826d8ae1cf4cfe3f34ae55d554625fa811c1a7169d764b8d7d | Python | 3,682 | 124 | """
Widgets for editing the dataset enrichment configuration.
"""
from __future__ import annotations
import panel as pn
import param
from .widget_base import classattr_section, collapsible_family_box, parameterized_editor
__all__ = ["build_enrichment_widget", "build_preprocess_conf_widget"]
def _ordered_names(ins... |
72b1055e2a1af4f3efb2cc423c90d7e71ab37c83192ac3e55e966d4ea66dfb48 | Python | 3,682 | 109 | """
Script that downloads all of the data from The Cancer Imaging
Archive. Iterates over a csv containing
the name of every dataset to download and requests the
images from TCIA. Then unzips the images and places
them in the correct directory for each modality.
Optionally takes a command line argument to start th... |
1a6520cc0614f8572c5e78d0172e5af5908bd8444a7a0059968d4e5f1bb08e05 | Python | 3,683 | 97 | from get_obj_grad import get_obj_grad
import time
import numpy as np
def GD_PutM(x, P, Ui, d, r, Ftype, opts):
# each column of P is a point in X1, the epsilon-net
# data are the sampled data, denoted by X0 in the paper
#
# xiayq @ 8/14/2019
# xiayq@zju.edu.cn
# refered to Z. Ya... |
fb69669ecb7099c9c8e66f1dd30dca1dcdceb28605fbb2e772e9c61b99a2e8a8 | Python | 3,683 | 146 | # --- 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 Pad(_BaseTraceHierarchyType):
_parent_path_str = "treemap.marker"
_path_s... |
66eb6b16a27f5d6bbfa55f56daf691c6e7863cbc9e558ad5f15327ca0738823a | Python | 3,684 | 99 | import sys
import math
import numpy as np
import cv2
import matplotlib.pyplot as plt
import torch
import torch.utils.data as data
import psutil
####
class SerializeFileList(data.IterableDataset):
"""Read a single file as multiple patches of same shape, perform the padding beforehand."""
def __init__(self, im... |
cea885e0ae86fc392eb9e6bd0e54f9268cb18e64497d5212e75f2d82db24d7c8 | Python | 3,684 | 110 | #!/usr/bin/env python3
import numpy
import pylab
import sqlite3
import sys
##################################################
# PLEASE REFER TO README.txt FOR MORE INFORMATION
##################################################
def demo_mp():
cursor = sqlite3.connect('input_smp.db').cursor()
cursor.row_factor... |
d0748b69c2eb39d8465fd40b680fb9dc811b85aa6eac01d700206f100a73a22e | Python | 3,684 | 115 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def default_conv(in_channels, out_channels, kernel_size, bias=True, groups = 1):
wn = lambda x:torch.nn.utils.weight_norm(x)
return nn.Conv2d(
in_channels, out_channels, kernel_size,
... |
8deba2982ed20980811c9b6de7231762a78e149216d1d0084587215289c72eec | Python | 3,685 | 122 | """The D24 waiver schema: dated, owned, counted, expiring, never silent-wrong.
One schema across all three panels: dated, owned, issue-linked, 90-day
expiry, counted from rows never prose, second named reviewer for same-PR
additions, no grace for new surfaces -- and a waiver may NEVER authorize a
known plausible silen... |
fe0801a0d7cfc32be3f2bfd175bdcf074a5a5253c11652fb7c504fdea5844e9c | Python | 3,685 | 53 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
2d5e3eeb421d6c0a6cb5c4f9f890ac5927872f789f2a0060419dc05a21e7bb29 | Python | 3,686 | 108 | import numpy as np
import pyvista as pv
from pyvista import PolyData, UnstructuredGrid
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
from typing import Any, Optional, Tuple, Union
from ..utilities import add_model_labels, merge_models
#############################... |
ae925a1b032c2cb6bd351ccb2ebaa5f63d7289d21498bfa33d19834d01ac6ace | Python | 3,686 | 116 | # -*- coding: UTF-8 -*-
import numpy as np
from sklearn import svm
import math
import random
import operator
import csv
from sklearn.metrics import f1_score
'''
@author:hunter
@time:2017.03.31
'''
class SVM(object):
def __init__(self):
pass
def loadDataset(self,filename, split, trainingSet, testSet):... |
a4cd4b12a5f85aa316bce317bc7e066fe0a3de5b7f9022508604fd0c700c5684 | Python | 3,687 | 93 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 24 19:56:42 2020
@author: Audrey Mazancieux
This script extracts onsets for each stimulus of the local global task for one
subject and each session. Onsets are saved in pickle file per session.
"""
# Import useful libraries
import os
import gl... |
fd92ac42ae6e6349db547c1ef543cd6f18dbf84782046c89571b1a65ebc9b0c5 | Python | 3,687 | 114 | from __future__ import annotations
import time
from typing import Optional
import pandas as pd
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.device_interfaces.devices.promethion import PromethionGrpcClient
DEFAULT_VOLTAGE = -180
DEFAULT_DURATION = 1.0
DELAY_HW_SATURATION_R... |
b4fa1f09cf8613bc38cf09bc269e437aa827887f3fefffbc16e103fe3e88ea56 | Python | 3,688 | 116 | from typing import TYPE_CHECKING
import numpy as np
import pytest
from numpy.testing import assert_allclose
if TYPE_CHECKING:
from numpy.typing import NDArray
from sklearn.decomposition import PCA as SKPCA
from lightly.utils.embeddings_2d import PCA, fit_pca
def test_pca_fit_transform_shapes_and_dtype() -> No... |
f075c6dbeb3de3722b94d2073d82c33316c1678f22a238065e3f7259ec6eaff9 | Python | 3,688 | 100 | # %%
'''
Extracts regions based on SPM results. Saves ROI masks and a list of centroids.
Looks at con_0006 ('threat reversal') and con_0007 ('safety reversal') specifically.
Be mindful that this script needs 'supervision', e.g., to hand label each ROI which
may change depending on the exact parameters (namely cluste... |
0fed9b6369c1a23961574571145f6e559eef623c56f75c56e5d79871d4fc3df9 | Python | 3,689 | 112 | import torch
from tqdm import tqdm
import numpy as np
from interpretability.utils import (
get_cls_token_repr,
set_hook_to_get_repr_all_layers,
load_sequences,
load_model_and_vocab,
)
def get_final_projection(model):
try:
# norm1 = model.norm1
classe_embedding = model.classe_embedd... |
972c599747891ffde1b55456b736d9150c4dc023797b8e4939970e2220263cfb | Python | 3,689 | 137 | import locale
locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' )
def identify_header_rows(table):
for idx, row in table.iterrows():
row = list(row)
if row[0].strip() == '1':
break
return idx
def forward_fill_row(row):
last_val = row[0]
for i in range(1, len(row))... |
f26ca970df4326205f6d96bab70ba6318f5fddccfc9642a30bca25f384901340 | Python | 3,689 | 96 | import logging
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import (
User,
UserGroupAssociation,
)
from galaxy.model.scoped_session import galaxy_scoped_session
from galaxy.structure... |
0ee237f6bdffc4a62ffded463f2aa76b9fa04bc4d895c2162a67ea0bd602d3f9 | Python | 3,691 | 135 | import locale
locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' )
import re
import pdfplumber
try:
from local_extractor.utils import common_utils
from local_extractor.states.state_utils import GA_utils
except ImportError:
import sys, os, pathlib
path = pathlib.Path(__file__).absolute().parents[2]
pat... |
989490f2feab26aea35439d800eb3d6ed832622316fea8f4443c20d4454af4f4 | Python | 3,691 | 95 | import os
import pkg_resources
from PyQt5 import QtCore, QtGui, QtWidgets
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT
from matplotlib import cbook
# TODO:
# - use the capabilities of the new toolbars?
class NavigationToolbarCustom(NavigationToolbar2QT):
"""A custom toolbar that allows o... |
fe617d85a06c2c4cae9513f8935f034ae917fb5006b7354468cabab166b1aa9d | Python | 3,693 | 115 | import re
from unittest import mock
import pytest
from api.mocks import FakeAuthContext, FakeUserWithAuthDependency
from dependency_injector import providers
from fastapi import FastAPI, status
from fastapi.testclient import TestClient
from carbonserver.api.infra.repositories.repository_projects_tokens import (
S... |
2d5b5346905344127895cf1806aca8e088cba79ea7054d2abed72ec95fdc4ddf | Python | 3,694 | 92 | from pypet.brian2.parameter import Brian2Parameter
import standard_params as prm
import models as mod
def add_params(tr):
tr.v_standard_parameter = Brian2Parameter
tr.v_fast_access = True
tr.f_add_parameter('netw.N_e', prm.N_e)
tr.f_add_parameter('netw.N_i', prm.N_i)
tr.f_add_parameter('netw.p_e... |
9933da83de71924082f0622073142fd7477225486cddb211fa244ddd25588467 | Python | 3,694 | 100 |
#import libraries
import somtimes
import numpy as np
import warnings
##############################
# author: Ali Javed
# October 14 2020
# email: ajaved@uvm.edu
#############################
warnings.filterwarnings("ignore")
np.random.seed(0)
#set window size for DTW --- using zero in this example and this... |
0ff1e27ec7fe2e7465eeed2771799ac38b5fda0f4f880e33a4ca469242eb5129 | Python | 3,696 | 105 | # This file is part of MOXελ.
# Copyright (C) 2023 Antonios P. Sarikas
# MOXελ 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... |
8d4a5f76203f51f7d577818780bfa9a7d78eae429040bdc6403f3d44ed18484f | Python | 3,696 | 99 | #!/usr/bin/env python
"""Convert GlimmerHMM GFF3 gene predictions into protein sequences.
This works with the GlimmerHMM GFF3 output format:
#gff-version 3
#sequence-region Contig5.15 1 47390
Contig5.15 GlimmerHMM mRNA 323 325 . + . ID=Contig5.15.path1.gene1;Name=Contig5.15.path... |
04dbcf0beeee2f2464a9f3417c90900a0436cf2d347be2ef9f45076112f09912 | Python | 3,697 | 104 | """Contrastive Loss Functions"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from typing import Sequence, Union
from torch import Tensor
from lightly.loss.ntx_ent_loss import NTXentLoss
class DirectCLRLoss(NTXentLoss):
"""Implementation of the NT-Xent based DirectCLR Loss.
... |
881f8fbe83847a670cee06d8212566f6b568d46b12ee3deadb1f2db0d988a29e | Python | 3,697 | 104 | from typing import Literal
from fsspec import AbstractFileSystem
from pydantic import field_validator
from galaxy.exceptions import MessageException
from galaxy.files.models import FilesSourceRuntimeContext
from galaxy.files.sources._defaults import DEFAULT_SCHEME
from galaxy.files.sources._fsspec import (
CacheO... |
f965d44677c078886324153da972d6376bd4ea8c2de1dbd5dee8f9660032e4a8 | Python | 3,698 | 112 | """M3GNet compact materials graph network.
Chen and Ong, 2022, "A Universal Graph Deep Learning Interatomic Potential for
the Periodic Table". M3GNet augments atomistic graph message passing with
three-body interactions from coordinates/lattice-aware geometry. This compact
classic traces atom embeddings, radial edge... |
3dd78f243f8e7cacd4abe6c2c125cdd17dec9dfe83a69c61ddf401d555aeeca2 | Python | 3,699 | 125 | import os
import random as python_random
import numpy as np
import tensorflow as tf
import tensorflow_datasets as tfds
from tensorflow.keras.models import load_model
from gradient_accumulator import GradientAccumulateModel
from gradient_accumulator import GradientAccumulateOptimizer
from .utils import get_opt
from .... |
74bb6e883d47dd8b4b1beaa3730968814d6afadeb06e2a22b7a50a7eb7799fea | Python | 3,699 | 105 | from __future__ import print_function, division, absolute_import
import os
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from .resnext_features import resnext101_32x4d_features
from .resnext_features import resnext101_64x4d_features
__all__ = ['ResNeXt101_32x4d', 'resnext101_32x4d',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.