sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c7ca2a7072ac7ea2c3be9313521f81af34fc1a5797fb13287d10568f9cc5ae24
Python
4,192
125
"""BaseEmbeddings""" # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved import os from typing import Any, List, Optional, Sequence, Tuple, Union from omegaconf import DictConfig from pytorch_lightning import LightningModule, Trainer from pytorch_lightning.callbacks import Callback from torch i...
1fe628057ef49382c869ea01c4501278c6b99e433798ee9e7f838f24ad37dfe6
Python
4,193
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
27f188d2f79623e23c62ab9f1244732dad8a7001abd16f5b8cabfa6f1d9287fb
Python
4,193
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
8f9dc5e68fd838524a2eca5d576a064674b68c4beb626e1d88f906ed77295022
Python
4,193
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
28662cad40cdffa11b54ef307f6b5b1c9d0acbb2be518d3c03143ab3a6c45695
Python
4,194
154
"""Utils for PFAM.""" import xml.etree.ElementTree as ET from math import ceil from time import sleep from xml.etree.ElementTree import ParseError import fasta_utils import pandas as pd import requests __author__ = "Gianluca Corrado" __copyright__ = "Copyright 2016, Gianluca Corrado" __license__ = "MIT" __maintainer...
38e1d1cc3ab2da01c88230144fc7f006c93d5730c994cfd34e0642eb0c207265
Python
4,194
85
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
767587a00c8e7f17fb79ca6d3b117693de1c54412d0a6aa8c8a15a9e2a3daf39
Python
4,194
146
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class ResidualUnit(nn.Module): """ Residual unit proposed in "Identity mappings in Deep Residual Networks" by He et al. """ def __init__(self, l1, l2, w): super().__init__() self.normalize1 = nn....
3fdbd5f2f084e4821c820e02b4ac5b09988a1656302ce4845789238e5f415bdd
Python
4,195
127
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd from sklearn.model_selection import train_test_split, TimeSeriesSplit from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_percentage_error from sklearn import preprocessing import ...
8b72d8b0da666f87e262e35fbab0c082081afc93dc9dc068ac3f6f5a44cc9497
Python
4,195
85
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
203c08e5daa63c0e0511d475297b2a2e8651d42cc16b98ac2d0d50cb2fc13965
Python
4,196
127
from mne.datasets.sample import data_path from mne.channels import find_ch_adjacency from ..ari import all_resolutions_inference from scipy.stats import ttest_1samp import numpy as np from os.path import join import mne N_PERMS = 50 def custom_statfun_example_1samp(X): _, p_obs = ttest_1samp(X, 0, axis = 0) retur...
a22772b90857a16ec883c272805e87aa2803338e4be4247f7c8a59d16f5351da
Python
4,198
113
import posixpath import shutil 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 ( Ca...
c75f419e47ed81c1a66562edf540764054a392ffbfa0c9db4880f180943cb9f4
Python
4,199
169
#TimesVector # #Created by Inuk Jung on 2016-08-3. #Copyright (c) 2016 Inuk Jung. All rights reserved. # #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 you...
ad8d21ceb70c958b937eb677cd4f49804e1ce06f6e3c37b4464433132c703726
Python
4,200
117
"""AST regression tests banning retired TorchLens host-object attributes.""" from __future__ import annotations import ast import re from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[1] SOURCE_ROOT = ROOT / "torchlens" LEGACY_ATTR_RE = re.compile(r"^tl__?[a-z]") RETIRED_NAMES = { "t...
66de52439d0752ce54674ae538ee710c109b24a29584734ec4ba07c8ac20089d
Python
4,201
110
# This current file represents a more-or-less identical experiment to the one # we have been using, with the exception being it uses dynamic accuracy bar # instead of static accuracy bar. # I think in general this tends to have a slightly negative effect on the # performance of the model, but within 0.5-1% in accuracy...
aa3b2c5fa3b9adb08bd63cf631fd4b06bbefc514d68c1b848c58e34829069fc6
Python
4,201
128
from xml.dom.minidom import Identified import torch from learning.train import collate_MIL as collate_MIL from models.attention_model import Attention_MB from learning.train import MIL_Dataset as MIL_Dataset from learning.train import calculate_error as calculate_error from torch.utils.data import DataLoader, Sequen...
f2bd53c1c1f4e0d5145b5230621ead46d88698156464f7cc6d5f655cbd5f108e
Python
4,201
113
import os import re import time from carbontracker import exceptions from carbontracker.components.handler import Handler from typing import List, Union # RAPL Literature: # https://www.researchgate.net/publication/322308215_RAPL_in_Action_Experiences_in_Using_RAPL_for_Power_Measurements RAPL_DIR = "/sys/class/power...
6622fcd6b8e6354c0c69fefedc819b538695bc036157f5463dbbeada7cf6114d
Python
4,202
85
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
8b98e6f237f67329f7456cf6a39fc698afa9556dc5660991d9d7ac404400dcf7
Python
4,202
147
import numpy as np import pandas as pd import io from PIL import Image import matplotlib from anndata import AnnData import networkx as nx from typing import Optional, Union, Mapping # Special from typing import Sequence, Iterable # ABCs from typing import Tuple # Classes from textwrap import dedent from enum imp...
183dfe8a7f79cbe5dcf6414241ba7da3d974c1addab597dd04a8920865ba9bba
Python
4,203
126
from pathlib import Path import geopandas as gpd import pandas as pd import pytest from shapely.geometry import box import pyrosm import pyrosm.data.extract_index as ei import pyrosm.data.geofabrik_index as gi from pyrosm import get_data_by_bbox HELSINKI = [24.93, 60.16, 24.96, 60.18] BBBIKE_URL = "https://download....
57bf7851a9b8f20f0c1d821bde3ca9d56c35db896a4f63a37377ea3d7a4ac1fe
Python
4,203
117
""" Tools for parsing MSMC and smc++ output Functions: read_msmc: Parses MSMC format files. read_smcpp: Parses smc++ format files. decimate_sizes: Simplifies size histories. """ import numpy as np import pandas as pd def read_msmc(fname, mut_rate): """ Parses an MSMC format file into sizes and ti...
8931d6ce60c1656dc4befd6aab6c5c8696fcda1a67efcc1d67dd1bfa03fc46c5
Python
4,203
107
#! /usr/bin/env python from setuptools import setup, Extension from distutils.command.build import build import os import subprocess import sys def main(): try: import numpy try: numpy_include = numpy.get_include() except AttributeError: numpy_include = numpy.get_n...
3170c200dd1f4bb350bb912871bd71ba54053c2340836fe09114946e37fd1b14
Python
4,204
94
"""9. Inference on your own videos using pre-trained models =========================================================== In this tutorial, we provide a script for you to make human activity predictions on your own videos. The only thing you need to prepare is a text file containing the information of your videos (e.g.,...
3423b5a85a41c2028b9adadc7b2ee5c81de09d1d8476a2c6894fc6881d379d1b
Python
4,204
107
import glob, os, shutil from eppy.modeleditor import IDF def replace_in_textfile(filename_source, filename_target, text, replace_text): with open(filename_source, 'r') as file : filedata = file.read() filedata = filedata.replace(text, replace_text) with open(filename_target, 'w') as file: ...
e409214382a8595540aa452d40b8127125b74ec86769ab77b2f3dc9bd567a208
Python
4,204
134
""" Credit: https://github.com/nhartland/KL-divergence-estimators/blob/master/src/knn_divergence.py """ import warnings import numpy as np from scipy.spatial import KDTree from sklearn.neighbors import NearestNeighbors def knn_distance(point, sample, k): """Euclidean distance from `point` to it's `k`-Nearest ...
def40ab266966430c3d406cabc81aac7db08b6b9bfe47d352f0686811c8781aa
Python
4,205
107
import glob, os, shutil from eppy.modeleditor import IDF def replace_in_textfile(filename_source, filename_target, text, replace_text): with open(filename_source, 'r') as file : filedata = file.read() filedata = filedata.replace(text, replace_text) with open(filename_target, 'w') as file: ...
d242e5417414107ad34cd1c6db26c30e2de6b863c8002ffece5b0cf28f19f266
Python
4,206
105
#!/usr/bin/env python import argparse import sys import textwrap def main(args): """ Extract the protein and coding section from an augustus gff, gtf file Example file: HS04636 AUGUSTUS stop_codon 6901 6903 . + 0 Parent=g1.t1 HS04636 AUGUSTUS tra...
2829510e6887f53f8ffa72434ae3c9215e315e5370d5a8701a47554c818db3ec
Python
4,207
122
""" The evaluation metrics. """ import math from typing import List, Callable, Union from sklearn.metrics import accuracy_score, mean_squared_error, roc_auc_score, mean_absolute_error, r2_score, \ precision_recall_curve, auc, recall_score, confusion_matrix def accuracy(targets: List[int], preds: List[float], thr...
6b844385d6723e54382b723d91ee14d05d7440a6c61e183516dff489cde31716
Python
4,208
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
7109df46fb29028a8fa21f1a6795c3faef2eb134ae52c60b4e7481e06506779e
Python
4,208
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
b9f93dcdd47fd32fa94ee146a1b7e80a14ce6b87ebad996431c30a7462aa5612
Python
4,208
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
e1166b17bc31060da05a0c92ad243bb80f54f2725af2648ce98fdc2fa259b4a8
Python
4,208
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
e5e665fb49003f179326d3e2b52bd58034f60a27134c6173d7072e76f82dc55d
Python
4,208
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
e71ade1dc99a5b3782dd0e7ea6f454b586b448b72193e656bae6518e23d1d0ca
Python
4,208
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
ede0c67b3b624f3cb2a1536861f491d316b53562f5a4d48fc95b91cf75398120
Python
4,208
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
fd13fb9078a9a07be24859b35faf837ea77a252faa49e651ade09cad816fa293
Python
4,208
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
7219350db5775ed5b7451cd8d3b2ef59ab6439344906e91ed778ae1f4120a292
Python
4,209
111
import math import time from threading import Event, Lock, Thread, current_thread from codecarbon.external.logger import logger # Longest stop() waits for the in-flight call, a guess at "a measurement should # never take longer than this", so a wedged one cannot hang the caller for long. STOP_JOIN_TIMEOUT_SECONDS = 5...
79c4c80c3319656f20306f66a856e1b3e4efb4b4a336ce0e6403cacbccdf7db0
Python
4,209
141
from flask_login import login_required, current_user from flask_restplus import Namespace, Resource, reqparse from werkzeug.security import generate_password_hash from database import UserModel from ..util.query_util import fix_ids api = Namespace('admin', description='Admin related operations') users = reqparse.Req...
b685ac4552f5634ae738f02a1af1c6ec4f84882faa95d491d694946976c9f9de
Python
4,209
106
"""Fixwave-2 FW2-POLISH regression pins for the R47 dead-config debloat. Three families of silent no-op configuration killed in grind b7 R47: - R47-1: nine write-only "future" option fields (declared, validated, read by NOTHING). The fields and their keywords are deleted outright (shim-removal lane, 2026-08-19: t...
7e7c3baeaf04e7b557dd649b83a0a1a12a5319a7ca421e7f2e3f8cb85f4e0828
Python
4,210
117
# SOURCE: vendored from https://github.com/Thijsvanede/DeepLog @ master # # Source: deeplog/deeplog.py, class DeepLog -- the CCS 2017 DeepLog log-key anomaly # detection model: one-hot encodes an integer log-key sequence, feeds it through a # stacked LSTM, and predicts a distribution over the next log key via a linear ...
8eb400d926e72e45283abe9987aafc0422c470f01fe513c78fb8dccdab915ee0
Python
4,210
137
#!/home/ubuntu/miniconda2/bin/python from __future__ import division import sys import glob, os, gc import uuid import os.path import csv import numpy as np from time import time from subprocess import (call, Popen, PIPE) from itertools import product import shutil import re import pickle from boto3.session import Ses...
58ecbafce4185bb4cea5b99519fab0bee34d6520259016148394d71754033621
Python
4,211
141
""" ==================================================================== One Way manova ==================================================================== One way manova to compare Left vs Right. """ import seaborn as sns from time import time from matplotlib import pyplot as plt from mne import Epochs, pick_types...
d6855d60e2328f7a54a1804d770854b5d753ede450383bf683239cc6194c0614
Python
4,211
126
#!/usr/bin/env python # coding: utf-8 # In[4]: import pandas as pd from sklearn.model_selection import train_test_split, TimeSeriesSplit from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_percentage_error from sklearn import preprocessing import...
280eb46de56722ae845c3e323c07d52e722dfc218da7a8d7ae65694d9981a6d6
Python
4,212
125
import argparse import itertools from dataclasses import dataclass from pathlib import Path from typing import List, Optional DTYPE_MAP = { "fp16": "cutlass::half_t", "bf16": "cutlass::bfloat16_t", } SM = [80] # Sm80 kernels support up to HEAD_DIMENSIONS = [32, 64, 96, 128, 192, 256] IS_CAUSAL = ["false", "t...
b5f27429ab0ef94ec7ec4e044ed47c39fac8a2124aa9dc091720fa93786efe7a
Python
4,212
142
import datetime try: import zoneinfo except ImportError: from backports import zoneinfo import pytest import time from rpy2 import robjects import rpy2.robjects.vectors _dateval_tuple = (1984, 1, 6, 6, 22, 0, 1, 6, 0) _zones_str = (None, 'America/New_York', 'Australia/Sydney') def test_POSIXlt_from_invalid...
767a2c97893d3cb64dfd1d5287247000ddfbe9b76dd8f24d443807537236d5bc
Python
4,213
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
01b3fe1f4f17adf9a2abb208a7e446d671d0b6679f6c60ee67527cdfed4378f4
Python
4,214
84
# Asteroid Impact (c) Media Neuroscience Lab, Rene Weber # Authored by Nick Winters # # Asteroid Impact is licensed under a # Creative Commons Attribution-ShareAlike 4.0 International License. # # You should have received a copy of the license along with this # work. If not, see <http://creativecommons.org/lic...
4373801bb8f0c035587368fe51b07cbf1019b71cc3b279e01a241e8c2e1fdc20
Python
4,214
133
r""" Port of DEBtool_M/animal/get_tm_mod_habp.m — mean lifespan for holometabolous insects. Integrates the aging/survival ODE from emergence to death, computing mean lifespan. See get_tm_mod_habp.m source at: G:\Το Drive μου\DEB projects\Drosophila DEB model\code\Drosophilla_DEB_Evridiki\get_tm_mod_habp.m Citation...
fac07db3e79db9931a63ebc1d0190d180f3c3b5c8b78b5effc11428e14c766e3
Python
4,215
125
from collections import Counter from permacache import permacache import numpy as np import pandas as pd def load_interactions(): """ Loads the interactions from the Lang Paper. Specifically, supplementary table 9. Returns ------- dictionary from interaction type to a table guaranteed to...
8530baf83b2216cd64200ef1777ac36257865446481d98688534e213d9535ae1
Python
4,216
153
""" From Niklas Wilming et al. Nature Communications 2020 https://github.com/DonnerLab/2020_Large-scale-Dynamics-of-Perceptual-Decision-Information-across-Human-Cortex """ from numpy import asarray, iscomplexobj, zeros, newaxis, zeros_like, real import multiprocessing import os import pickle import socket import warnin...
9669dbb3661478673271210dc5f3b7cb8e5e3beb64bcc328d1cd75c0af64af05
Python
4,216
110
import unittest from unittest import mock import datetime from carbontracker.emissions.intensity.fetchers import energidataservice from carbontracker import exceptions class TestEnergiDataService(unittest.TestCase): def setUp(self): self.logger = mock.MagicMock() self.fetcher = energidataservice.E...
0eb67de59de672e31960f9dc67249c2362faa12fdd60aa8e6661232c5bfaf005
Python
4,217
154
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in complia...
194a812461119ca47c9d281bdddec294a185b61efc4d5c07e4d0a6404094bb02
Python
4,217
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
475371d4a155a75342b13e761bcc418054736c09823371e2bee0645e43e447d4
Python
4,217
107
"""Записать настоящий прогон движка в компактный JSON для веб-проигрывателя. Пишет позиции/энергию агентов, поле ресурса (даунсемпл), метки и живые метрики покадрово. Байты пакуются в base64, чтобы страница-артефакт была самодостаточной (без внешних запросов). """ import base64 import json import numpy as np from sim ...
ebd0402bff1d3164dbce2727a9bac6be17e2e546b671bbcd538d8fa95b9ea4ae
Python
4,217
116
from keras.src import activations from keras.src import backend from keras.src.api_export import keras_export from keras.src.backend.common import standardize_dtype from keras.src.layers.layer import Layer def _large_negative_number(dtype): """Return a Large negative number based on dtype.""" if standardize_d...
5279336e4d7b6ee5e8541ce52e7b517e3e4993641f93c182fba66ecf46098a98
Python
4,218
109
"""C02 detached SummaryReport layer pins (summary memo item 10 / sumfam 10). SummaryReport(str) with __repr__ == __str__, _repr_html_, to_dict(), and sections; typed SummaryRow/SummaryTotals/CaptureFacts; the five-value evidence enum; the raw-numbers pin; the detach pin (survives del model / del trace / cleanup); prof...
6efd69b96a679d5194b6ce0ee86ab57ea5238b3b978875da4ef2a28c82c9566f
Python
4,218
138
"""Tests for bdpy.dl.torch.domain.core.""" import unittest from bdpy.dl.torch.domain import core as core_module class DummyAddDomain(core_module.Domain): def send(self, num): return num + 1 def receive(self, num): return num - 1 class DummyDoubleDomain(core_module.Domain): def send...
57e37c319f6f594061e6fdbe2641e1dd622e85aeeeca71920a04cfd2e00a1981
Python
4,219
120
""" ==================================================================== Data transformations in the Riemannian Procrustes Analysis ==================================================================== Use the SpectralEmbedding module to plot in 2D the transformations on the matrices from source and target domains when...
40a827f7f5f4afb6ca78f51dad9a7433f00f06c7473ebb62efa74f80a95e253e
Python
4,220
91
"""This script estimates TRFs for several models and saves them""" from pathlib import Path import re import eelbrain import mne import numpy STIMULI = [str(i) for i in range(1, 13)] DATA_ROOT = Path("~").expanduser() / 'Data' / 'Alice' PREDICTOR_DIR = DATA_ROOT / 'predictors' EEG_DIR = DATA_ROOT / 'eeg' SUBJECTS = ...
99595a47f616123ea144b0a65b666074c3b7eabc1df5bd0f61381dedb464197a
Python
4,221
103
""" Neural Network implementation for image segmentation Copyright (c) 2022 Giansalvo Gusinu <profgusinu@gmail.com> Code adapted from TensorFlow Tutorial Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Softw...
d0ca907c8e1d3dd7cd3eb90d17fabc7f4d05597842368b1eadffcd0467850126
Python
4,221
136
from datetime import datetime, timedelta from typing import List, Optional import dateutil.relativedelta from dependency_injector.wiring import Provide, inject from fastapi import APIRouter, Depends from starlette import status from carbonserver.api.schemas import Project, ProjectCreate, ProjectPatch, ProjectReport f...
51bb82676bd7b18b7a704be7351163e0fb9e6b4eeda8cfefa54ccd79dd81f98a
Python
4,222
112
import numpy as np from rdkit import Chem from rdkit.Chem.Scaffolds import MurckoScaffold import tensorflow as tf from tensorflow.keras.layers import Embedding, Dropout, Dense class AFMPConfig(): def __init__(self, embedding_size: int=256, dropout_rate: float=0.3, propegation_factor: float=0.4...
9f4379334d68dfea9be250a8fb11c912053f2b554e1af84af3c9f199b57fd1f9
Python
4,223
108
import torch.nn as nn try: from torchvision.models.utils import load_state_dict_from_url except: from torch.hub import load_state_dict_from_url from .custom_modules import FakeReLUM, ConvHPool2d, HannPooling2d __all__ = ['AlexNet_reduced_aliasing', 'alexnet_reduced_aliasing'] model_urls = { } class AlexNet_...
523c4d150a2cac038f5e40c7675bd2bc1f49e04e42ece7c2704b4a537b3fcdac
Python
4,225
121
#! /usr/bin/env python3 from MarkovModels import common from MarkovModels.BeattieModel import BeattieModel from MarkovModels.KempModel import KempModel from MarkovModels.ClosedOpenModel import ClosedOpenModel import argparse import numpy as np import pandas as pd import os import matplotlib.pyplot as plt import multi...
986f6e3b7b3cf7e7e9da64333439403a6d9a14db8989bbfeffdaa6868577b643
Python
4,225
127
import numpy as np import dgl import torch import torch.nn.functional as F import h5py import sys sys.path.append('../pkgs/graph-sc/') import train import models device = train.get_device() import warnings warnings.filterwarnings("ignore", category=FutureWarning) import scanpy as sc from scbig.utils import read_data,se...
86882bff8881b495028ccb22f3bd9fdbba842376d4ef160d7e91eb9065acb133
Python
4,226
115
"""Fork capture-outcome derivation (the anti-masquerade contract). ``Trace.fork()`` is the sanctioned mutation surface, so a fork must never carry its parent's blessed settle stamp by identity: pre-fix, a hand-edited fork saved (and re-loaded) as a bit-identical ATTESTED COMPLETE product. Forks now settle a DERIVED ou...
eda1cfbba2a4e80b4c6388f4c39cf3db041a1b2c00a79397a9c59af283cecdb9
Python
4,226
129
"""Phase 5a tests for taps, record spans, and report values.""" from __future__ import annotations import torch import torchlens as tl from torchlens.report import log_value class MetricModel(torch.nn.Module): """Model that records a report value during capture.""" def forward(self, x: torch.Tensor) -> to...
317c251a1cb6599c840dbe534ee2aa8f16fe7004b211c119a1e46e5ca043db91
Python
4,227
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
913502a19f9f43f5afa4b69fdee387458b33302538b2dffe38dad276da5bb85b
Python
4,227
141
import sys sys.path.insert(1, '/u/home/r/ryo10244/Xiao_lab/dsRNA_pred/script/utils') import re import pysam import argparse as ap import pandas as pd import numpy as np from utils import * from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split, cross_val_scor...
7114534a682b7997439d474b247a9003d454f88b277e708ee803b576fe84353f
Python
4,228
119
''' Code to generate state space labels from a binary labeled peptide annotation sequence. States are hardcoded. ''' from typing import List, Tuple import numpy as np def parse_coordinate_string(coordinate_string: str, merge_overlaps: bool=True) -> List[Tuple[int,int]]: peptides = [] coordinates = coord...
a82978583024a173a8ca3e6fbabbc43ac527ff5df8004b3218f3ba863e36544e
Python
4,228
142
"""PyanNet speaker diarization network from pyannote.audio. Paper: pyannote.audio: neural building blocks for speaker diarization, Bredin et al. 2019. The original PyanNet is an end-to-end sequence-labeling model over raw audio: SincNet-like learnable band-pass filters, temporal convolutional context, recurrent seque...
135a0f4fb8a48a8dc4c507881025b20f4e95384c4178344814072464c376fda3
Python
4,229
88
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
995bbf408cc84595e2e0026eec8c06a906ed959947f109752de44836ef38ee2b
Python
4,229
119
"""Loss functions for the RL models.""" from typing import List, Tuple import numpy as np import torch from torch import Tensor, nn def dqn_loss(batch: Tuple[Tensor, Tensor], net: nn.Module, target_net: nn.Module, gamma: float = 0.99) -> Tensor: """Calculates the mse loss using a mini batch from the replay buff...
9eb14bf6b3311d651e305d7f9b96987b11d1e476fddf0b9d000102ca7e0acd4c
Python
4,229
145
"""ESCM2: Entire Space Counterfactual Multi-Task Model for post-click CVR. Paper: Wang et al. 2022, "ESCM2: Entire Space Counterfactual Multi-Task Model for Post-Click Conversion Rate Estimation" (SIGIR), arXiv:2204.05125. The compact reconstruction keeps the defining ESMM-style shared embedding with three towers: em...
177367b46d73a5db2bad1addf84154dd460ab0c10a2714cf0525544543724842
Python
4,230
124
# --- 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 Uniformtext(_BaseLayoutHierarchyType): _parent_path_str = "layout" _pat...
1b5eb4c92eb59959c8a2deeb44338545140d11a33b8667d7af179dcb0113c332
Python
4,230
159
from __future__ import print_function, unicode_literals, absolute_import, division from six.moves import range, zip, map, reduce, filter from six import string_types import numpy as np from .utils import normalize def plot_history(history,*keys,**kwargs): """Plot (Keras) training history returned by :func:`CAR...
36df082dea9e45f405a2b915e16800d7885c700f1580cb97914a6412542b0ba9
Python
4,230
118
try: # When using torch and tensorflow, torch needs to be imported first, # otherwise it will segfault upon import. This should force the torch # import to happen first for all tests. import torch # noqa: F401 except ImportError: torch = None import os # noqa: E402 import pytest # noqa: E402 f...
4f58424dcada78f6f6274aeff2f68e1bfa2282c19974d51ac0877edd92806340
Python
4,230
106
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """Mixin for SmartTagsManager to create MNE.Epochs objects.""" import mne import numpy from ..read_manager import ReadManager from .utils import requires_mne class SmartTagManagerMNEMixin: ...
46f56f0f0e627743c3e9e1fba238f1fa2ad518ac969273dc874327db2cecdb9f
Python
4,231
128
""" Point cloud class for synapses """ import logging import numpy as np from scipy.spatial import cKDTree from tns.astrocyte.math_utils import norm as vectorial_norm L = logging.getLogger(__name__) MIN_EPS = -1e-6 # pylint: disable=unsubscriptable-object class PointCloud: """ Point cloud data structure wit...
2436b39d69f19dadf2cf4d386a24234ebd03c5ee767fbf81e22dd7b186c32719
Python
4,232
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
285d3906dab601638f1b36ff39496668856d1675cc5f90f794e4d07cd3fbecd9
Python
4,233
111
import torch import torch from torch import nn import torch_geometric as tg from torch_geometric.loader import DataLoader import torch.utils.data import shutil import sys import rdkit sys.path.insert(1, '~/egnn_cof/models/egnn_clean') sys.path.insert(1, '~/egnn_cof') # from easydict import EasyDict as edict import tor...
68b63ebc42533336e0c99e586907a272ea1b416086c5303747eef4eb8ced565e
Python
4,233
111
# -*- coding: utf-8 -*- """Average Attention module.""" import torch import torch.nn as nn from bioseq2seq.modules.position_ffn import PositionwiseFeedForward class AverageAttention(nn.Module): """ Average Attention module from "Accelerating Neural Transformer via an Average Attention Network" :cite...
72558a393f29ab7c01c42c429fbd9e87ce6a4de6ef094383c567a98a64e364ab
Python
4,233
129
# converter for ldreduced rgenetics datatype # used for grr and eigenstrat - shellfish if we get around to it import os import subprocess import sys import tempfile import time prog = "pbed_ldreduced_converter.py" galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
f0f824527616be5a5e6f34176141894b7d4039ad8be87d68d39413ee0a1e60e1
Python
4,233
110
import numpy as np from scipy.optimize import curve_fit from Metrics.src.utils import mtr_asym_curve, LorentzianPool, multi_lorentzian def mtr_asym( Z: np.ndarray, mask: np.ndarray, mtr_asym_ppm: tuple, ppm: float ) -> tuple[np.ndarray, np.ndarray]: """ Calculate MTR asymmetry and MTR asymmetry image. ...
d6fd7988403d306e293abc1dea2d47128c0a0dc1edea623d76dfde5ba18d618f
Python
4,235
112
"""Implementation of the CNN Decoder part of "Convolutional Sequence to Sequence Learning" """ import torch import torch.nn as nn from bioseq2seq.modules import ConvMultiStepAttention from bioseq2seq.utils.cnn_factory import shape_transform, GatedConv from bioseq2seq.decoders.decoder import DecoderBase SCALE_WEIGHT =...
4d7e117f7c3bab8dbe3de9876be7aff306b198b1cfca26b9812bc61f3a696493
Python
4,236
105
"""Mask Target Generator.""" from __future__ import absolute_import from mxnet import gluon, autograd class MaskTargetGenerator(gluon.HybridBlock): """Mask RCNN target encoder to generate mask targets. Parameters ---------- num_images : int Number of input images. num_rois : int ...
e5f552caf0e6f2ab710041631ee439898d8adffe1d2e32c9ac0f31a15e71b070
Python
4,236
142
#!/usr/bin/env python # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os, sys, re import logging import TGraph import TNode import TGLOBALS logger = logging.getLogger(__name__) class Compact_graph_pruner: def __init__(sel...
865ce92ba14a0a6ce513db7c513726f680d8ee1ebfee66d78c714da12cb39205
Python
4,237
130
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, ...
4bc81f06b39b7b61947a2bc57dfad1be15d565d262c977913fea2d6ace76b428
Python
4,238
109
import os from mirp.extract_features_and_images import extract_features CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) def test_adc_conversion_multi_frame(): # Multi-frame ADC image - micrometers^2/s feature_data = extract_features( adc_conversion="um2/s", image=os.path.join(CURRENT...
92469f6ed7f6dbf031b98b19930ea014731f2e5345648f8923cb98389f23c974
Python
4,238
142
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 23 11:12:06 2022 @author: cjquinn, yididiya """ #from click import confirm import os from pathlib import Path import pickle import pandas as pd from config import Configuration import argparse ''' Preprocessing ''' def get_recording_detail...
6dd25be14d583959d509291b11e35848620a31de134c1543c5cafd0e22822116
Python
4,239
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
3a11cbf370d0029d174c1b905cfdba94e0bababa3a94ea6c42222d09358e9133
Python
4,240
139
from typing import Optional import numpy as np import pytest from gym import core, spaces from gym.wrappers import OrderEnforcing, TimeLimit class ArgumentEnv(core.Env): observation_space = spaces.Box(low=0, high=1, shape=(1,)) action_space = spaces.Box(low=0, high=1, shape=(1,)) calls = 0 def __in...
d1d3620cbfac0c2957c24e28115a8f92ac3e550a6253650503671bc7e74bd837
Python
4,240
129
# SPDX-License-Identifier: LGPL-2.1-or-later #!/usr/bin/env python #-*- coding: utf-8 -*- import sys import numpy as np class DataBase(object): def __init__(self, data, mask): self.mask = None self._mask_slice = None self.data = data if mask: self._cut_out_data(mask) ...
99781cf561331dc01ec8f5d1849fbcfa89b6a2e0c1e17e5d7ebfc14938e874c2
Python
4,241
104
# Copyright (c) 2023, Tri Dao. import time import pytest import torch from flash_attn.models.gpt import GPTLMHeadModel from flash_attn.models.gpt_neox import gpt_neox_config_to_gpt2_config, remap_state_dict_hf_gpt_neox from flash_attn.utils.pretrained import state_dict_from_pretrained from transformers import AutoTok...
4bbf3eeebab0612c9248f8cc76805194871530fb4340ed8452538f6e697f5d0a
Python
4,242
120
""" ==================================================================== Plot the data transformations in the Riemannian Procrustes Analysis ==================================================================== Use the SpectralEmbedding module to plot in 2D the transformations on the data points from source and target ...
7fed1f6c764eeca4f70bd466ffa0f8ff59c47a1dc5b7cfc9c5a9ce452b7066d6
Python
4,242
127
import cv2 import numpy import time from skimage.metrics import structural_similarity as ssim from propagation_ASM import * import model import tools from scipy import io imgpath='E:/DIV2K/DIV2K_valid_HR/0887.png' pitch=0.0036 wavelength=0.000520 n = 2160 m = 3840 z0=160 #juli layernum=6 interval=10 t...
fd3968bd12e34c59a1a689777b5dd1ae277826c344dd8212eaa9c1469fe94701
Python
4,242
118
def pca(mtx, n_comp=30, index_name='index', new_index=None): """ Function to perform scaling and PCA on an input matrix Parameters ---------- mtx : sample by feature n_comp : number of pcs to return index_name : name of index if part of input Returns sklearn pca object and pca datafr...
ea91a245bd00d13e56d35394315ef6e26ee6fba4bbbae8406701f123848dd3e9
Python
4,243
121
"""C02 stats_table substrate + health-scan sync batching (sumfam 17-18).""" import pytest import torch from torch import nn import torchlens as tl from torchlens.report import STATS_ROW_STATES, StatsTable def _model() -> nn.Module: return nn.Sequential(nn.Linear(4, 4), nn.ReLU(), nn.Linear(4, 2)).eval() def t...
d2810e011d16cb08e5b5caf63487f9f7c663547b69595ed396ed4563c7a2c8fe
Python
4,244
98
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path from types import MethodType from typing import Any import torch from ultralytics.engine.model import Model from ultralytics.utils import DEFAULT_CFG_DICT from ultralytics.utils.checks imp...
bc001dfc519f4e4b46b60afc7e38e62e626f04f0ca82a3c70be0658d01ea918a
Python
4,245
106
"""Experimental bounding box transformations.""" from __future__ import division import random import numpy as np from ..bbox import crop as bbox_crop from ....utils import bbox_iou def random_crop_with_constraints(bbox, size, min_scale=0.3, max_scale=1, max_aspect_ratio=2, constraints...
2989bbb85a99d9674b138971cff80fc1f74256b640c6dad629864a7e5320b84e
Python
4,247
79
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...