sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fe249daf8051ed1cb8651df62ae4362e02362787ccee03bc6a260768c529021f
Python
4,437
202
# Copyright (c) 2021 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...
b5d235100f48e881af4185a1fb6848cfe4239c3ec847aa2e0456e2b013f12b79
Python
4,439
118
#install library !pip install tensorflow-addons==0.16.1 import tensorflow as tf import os import glob import shutil import matplotlib.pyplot as plt import random import numpy as np import cv2 import tensorflow_addons as tfa from keras import regularizers from google.colab import drive from sklearn.metrics import ...
7eeb2215441dfd6e2a9aabe762fb8d814b2b4bb264b06b1751d5f0dc38d33973
Python
4,440
112
""" Local functions for SSVEP examples """ import os from mne import create_info from mne.datasets import fetch_dataset from mne.io import RawArray import numpy as np DATASET_URL = "https://zenodo.org/record/2392979/files/" SSVEP_HASHES = { "subject01_run1_raw.fif": "md5:e33a589abce842bf676dd881d9f4a9b0", ...
8608a4be52e6722ae7a9a1f44ed921465a995bb8a4fd6d667e70a73bba03b553
Python
4,440
104
# coding=utf-8 # Copyright 2024 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
ef15ed102bcaa1ea8861542f22edb92279a5824bee3e281a5b96e6589895069b
Python
4,440
120
""" This script uses Playwright to scrape AMD CPU data from their website and save it as a CSV file. uv run pip install playwright uv run python amd_cpu_scrapper.py """ import asyncio from playwright.async_api import Page, async_playwright async def handle_cookie_banner(page: Page): """Attempts to find and cli...
3b6780432f18b8345d7a4d81105dd896702f5b9663e15416dad87f0eccc66f03
Python
4,441
142
"""JAX backend replay-validation spine tests.""" from __future__ import annotations from collections.abc import Mapping from dataclasses import replace from typing import Any, cast import pytest from torchlens.backends.jax.jaxpr import ( ALL_JAX_EQUATION_KINDS, JAX_REPLAY_HANDLERS, JaxEquationCapture, ...
84621b6d0c0b8e8e6a1b3160ccadaaeff8907c1520448c239f093f65bfa53815
Python
4,443
133
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Plot data split for cross-validation""" from typing import Union from matplotlib.patches import Rectangle from matplotlib.ticker import MaxNLocator import numpy from .._trf.shared import Splits, split_data from .._data_obj import Dataset, CategorialArg, NDVa...
4ab6f95f4579203b59edf5b2fa2ec868aab8330562328e1c86e97d704e09ae26
Python
4,444
85
""" Predict next tools in the Galaxy workflows using deep learning learning (Transformers) """ import argparse import time import extract_workflow_connections import prepare_data import train_transformer if __name__ == "__main__": start_time = time.time() arg_parser = argparse.ArgumentParser() arg_parser...
4c840d8f22c3301df9cb29625277dae352893aa89fe3abdc9d306d493f18b024
Python
4,444
82
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
6fb15f9e1259eece2d8baa98097db5d4e6e0f8ac2d1801289a6c7b0e043d34d4
Python
4,444
121
# Copyright 2017 The TensorFlow 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 applica...
47cb7083ed55fc2ceb279a7675bb2e2200e471cd6bfe447e8f2725d8c3e1ae4d
Python
4,445
86
import sys sys.path.insert(1, '../') import numpy as np import pandas as pd import os import shutil dataset_dict_paths = { 'ABCD': "/media/sda/Anna/TM2_segmentation/data/t1_mris/registered/z/", 'ABIDE': "/media/sda/Anna/TM2_segmentation/data/t1_mris/abide_ench_reg/z/", 'AOMIC':"/media/sda/Anna/TM2_segment...
5ed4e01e2b7834eda8a414a3251692e0d0399c131046a3daf3c06607db05e1c8
Python
4,445
122
import os import jax import jax.numpy as jnp import numpy as np import pytest import keras from keras.src import backend from keras.src import testing from keras.src.backend.config import is_nnx_enabled from keras.src.backend.jax.ops.core import Variable if is_nnx_enabled(): from flax import nnx @pytest.mark.s...
fe84d633ae18cf8e8abd0bbdaaab059b329bfa33a75b557a53ad44e024491474
Python
4,445
147
""" Screen side-panel for pygame-based simulation visualization """ from __future__ import annotations import math import os import numpy as np os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "hide" from .. import util __all__: list[str] = [ "SidePanel", ] class SidePanel: """ A class representing a side...
92831970c748fc6afed7441fea1a730173dac602520f107e195fb438e8f1fcf4
Python
4,446
105
import pkg_resources import numpy as np from PyQt6 import uic, QtWidgets class EditDialog(QtWidgets.QDialog): def __init__(self, ui_name, shape, *args, **kwargs): super(EditDialog, self).__init__(*args, **kwargs) path_ui = pkg_resources.resource_filename("impose.gui", ui_name) uic.loadUi(...
edc01ca570d4d0559d3a55b9eb2f157b8b38a2cef63fa8b3ecdb91635ce7876f
Python
4,446
87
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
140f847439012545df8b988593e79673eb60ac608b5be9956fc757d30d58137a
Python
4,447
150
""" This part of the code was originally published by mahmoodlab and adapted for this project. https://github.com/mahmoodlab/CLAM Lu, M.Y., Williamson, D.F.K., Chen, T.Y. et al. Data-efficient and weakly supervised computational pathology on whole-slide images. Nat Biomed Eng 5, 555–570 (2021). https://doi.org/10.1038...
ca8814370f873e886b53faf6a65a65fa5293e9eef6b39f765fc9277f781703ba
Python
4,447
128
#!/usr/bin/env python import glob import os import tarfile import wave import pandas from deepspeech_training.util.importers import get_importers_parser COLUMN_NAMES = ["wav_filename", "wav_filesize", "transcript"] def extract(archive_path, target_dir): print("Extracting {} into {}...".format(archive_path, tar...
68954379434f94a938f7231db6aeeff91df25330c4f4c25b0e79d2b707695f37
Python
4,448
82
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
d313ca5fbeba2709cb36f0d811b01ad2ac281e2571957803ebe18c9e2e5de8cd
Python
4,448
130
from matplotlib import gridspec import matplotlib.pyplot as plt import numpy as np import pickle from scipy.signal import hilbert, butter, sosfilt, coherence import os p = os.environ['PATH'] plt.rc('text', usetex=True) # preparations ############## # plot settings plt.rcParams['figure.constrained_layout.use'] = True ...
d91735f4bdfe386669ac81c0a20c567a3d561972ff72b8cdcfa68eaf4f9eb056
Python
4,448
110
import warnings import numpy as np from neurogym.core import TrialWrapper from neurogym.envs.collections import get_collection from neurogym.envs.registration import all_envs, make from neurogym.utils.logging import logger from neurogym.utils.scheduler import RandomSchedule from neurogym.wrappers.block import Schedul...
1f3c1cac9cdd9757cfc1481e1e036ab7f6f04cb73fa6715d141194dd2bed39a9
Python
4,449
161
import cv2 import numpy as np from ethoscope.utils.debug import EthoscopeException __author__ = 'quentin' class ROI(object): def __init__(self, polygon, idx, value=None, orientation = None, regions=None): """ Class to define a region of interest(ROI). Internally, ROIs are single polygons...
ec9616810f6485ccf20f5cd40f575c45abdcdf5327f037e3f4ccf5f7d2781677
Python
4,449
128
import argparse import pandas as pd import numpy as np import os, sys, shutil, importlib, glob from tqdm.notebook import tqdm import celloracle as co from celloracle import motif_analysis as ma from genomepy import Genome import scanpy as sc import pyarrow.parquet as pq import pyprojroot proj_dir = pyprojroot.here() p...
8b89b3a79f69da412bbb66b7ef004bcabe451af41fc21262e4c80712b7711f7a
Python
4,450
125
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Normalizing flow transforming to and from PCA-whitened space. """ # ==========================================...
b39211834e39baaff43090486d9b34458cd3c967bf68fbcf9254020a1b3ce928
Python
4,450
114
"""Observe-kit item 4: the pass-level-peak publication gate + its source lint.""" from __future__ import annotations from pathlib import Path import torch from torch import nn import torchlens as tl from torchlens.observe import format_pass_peak, pass_peak_facts TORCHLENS_DIR = Path(tl.__file__).resolve().parent ...
ef140ddac7feaf31e27a4032dcb4c7dc85c1d7d59f12311f1a0451748b04fd5e
Python
4,450
93
import torch from torch import nn from torch import Tensor from collections import OrderedDict import numpy as np class GetDensity(torch.nn.Module): def __init__(self,rs,inta,cutoff,nipsin,norbit,ocmod_list): super(GetDensity,self).__init__() ''' rs: tensor[ntype,nwave] float inta:...
fa8298283c1f2e58cf54554d6718ee528913abf318d6cc2b70652cc0b2e8bc36
Python
4,450
118
from typing import ( Any, TYPE_CHECKING, ) from sqlalchemy import ( func, text, ) from galaxy.exceptions import ( ReferenceDataError, RequestParameterInvalidException, ) from galaxy.managers.context import ( ProvidesHistoryContext, ProvidesUserContext, ) from galaxy.model import User f...
6f2a0f3c7c3108877a2cc23d614d0f0977edffa9f206990c6f87b12da29825ef
Python
4,451
122
import numpy as np import pytest from absl.testing import parameterized from keras.src import backend from keras.src import testing from keras.src.backend.common import standardize_dtype from keras.src.utils import backend_utils class BackendUtilsTest(testing.TestCase): @parameterized.named_parameters( (...
94df38ff3970ccf9c6e259c206ab15688b09d221350d72cadc8a05aed8f30d52
Python
4,451
142
from six.moves import input import pandas as pd import numpy as np from os.path import dirname, join from android.os import Environment import sklearn # from sklearn.externals import joblib import _multiprocessing _multiprocessing.sem_unlink = None import joblib import time # import matplotlib.pyplot as plt def main()...
3f484a8deaf4cd923c1a2771a735f43dc4ada6b2daf0697ea0193ffb30d2c8d5
Python
4,453
127
# --- 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 import warnings class Template(_BaseLayoutHierarchyType): _parent_path_str = "lay...
7374108956fcbc3131bea93c4f6a62e3864fc04b6f7a95f9639a3f1d86fd80ed
Python
4,453
75
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from irnlm.utils import check_folder from fmri_encoder.data import fetch_masker from fmri_encoder.plotting import plot_colorbar from irnlm.contrasts import plot_brain_fit red = plt.cm.get_cmap('black_red') red = red(np.li...
79d0fca255a4e2b293284f9510a7924f8a7f4c365375dda87a7d13cb442171e6
Python
4,455
128
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import json from multiprocessing.dummy import Pool import numpy as np from attrdict import AttrDict from .flags import FLAGS from .text import levenshtein from .io import open_remote def pmap(fun, iterable...
d282d22d2189e3d4bb2307f7cf6e8bf827fc8d82a2f716f21cb256fb1bbbc44c
Python
4,456
114
"""Observability helpers for `model.quantize()`. This module defines :class:`QuantizationReport`, a small structured record of what happened during a `model.quantize()` call (which layers were quantized, and which were skipped and why). """ from keras.src.api_export import keras_export @keras_export("keras.quantize...
f04f0f42c558b0d9d3a0033d196145ad7c1b884b7914ed482884b19b8fa8c672
Python
4,456
148
#!/usr/bin/env python """ Runs TRF on a sequence file. For use with trf version 4.04 usage: trf_wrapper.py input_file <required parameters> [options] Required parameters: match mismatch indels match_probability (%, 10-100) indel_probability (%, 10-100) minimal score (30-150) maximum p...
3c5436be5b24fe94843864ed2a2416d0115d22d91fc6c64cbd1707b1bd085c03
Python
4,457
132
##usage: python find_error.py Fish-1_L4.process.site.txt > error.sites import sys import collections from collections import Counter def Merge(dict1, dict2): res = dict() for k,v in dict1.items(): if k in dict2: v = dict2[k] + v res[k] = v else: v = v res[k] = v return res d...
6c393cac68d2e6b91e52462bd74b493144f22fba692d189b88fc5a7416e7e644
Python
4,457
106
"""Encoder module of Monodepth2 Code partially borrowed from https://github.com/nianticlabs/monodepth2/blob/master/networks/resnet_encoder.py """ from __future__ import absolute_import, division, print_function import os import numpy as np import mxnet as mx from mxnet.gluon import nn from mxnet.context import cpu fr...
2c155159878b08196dfc24a09935357d8530dd550e22cd5acc912bb7be2a5a1f
Python
4,458
120
"""Regression tests for the ``first_input``/``"input"`` facet on the torch backend. cert9-f5 fix (round-8-prep peripheral MAJOR): ``first_input``/``first_input_spec`` (``torchlens/semantic/recipes/_helpers.py``) read ``ModuleCall.forward_args``, which finalization ("GC-11", ``torchlens/postprocess/finalization.py``) u...
34edda2ce0211cb7d3a765654dbab72cb5120b9b1a0bae035b0c84a815ce061c
Python
4,458
123
#!/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 from PIL import Image import shutil import re import xml.etree.Eleme...
709506439bd0881ccbda4842583ba64a805ea48a63fd916faaa84d17ad2a9a04
Python
4,458
132
import numpy as np import pandas as pd import seaborn as sns from os import PathLike from ._utils import _save_fig import matplotlib.pyplot as plt from matplotlib.lines import Line2D from typing import Optional, Union, Sequence, Mapping, List def positional_gia_plot( sdata, vars: list, id_var: str = "id", ...
905a79bccbb7ac996bc6c188a89b9c4865664e348174474dec95a49e65ccd7c9
Python
4,458
130
"""Entry-point phase audits (F35; memo item 11 + composition row 9). Two obligations the merged test plan names that no shipped suite proves: - **NO-CODE-ON-ATTRIBUTE-EXISTENCE**: with an installed distribution declaring ``torchlens.recipes``/``torchlens.appliances`` entry points whose provider module writes a se...
a2845f6e12789dc4657afe0e0282d7d9a93b1fb8d76ff6f169caef9ae180d770
Python
4,458
124
import datasets import os from os.path import join as oj from tqdm import tqdm import pandas as pd import pickle as pkl import numpy as np from sklearn.model_selection import train_test_split def process_data_and_args(dataset): """Load dataset + return the relevant dataset key """ # load dset if datas...
b0656e9ef374eb6eed3ae3a040b2c14844315b580e2a1613a7256c6b5754f291
Python
4,458
82
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
2d0c5625897e42734dedc04eabd032c186096bbdbac220981103dbbf1daf03ca
Python
4,459
92
"""Four-protocol leakage experiment on the REAL corpora, using the project's own CSP (fit_csp/apply_csp) so the numbers are comparable to the reported pipeline.""" import os, sys, numpy as np, pandas as pd ROOT = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(ROOT, "src")) from sklearn.ense...
30214bdc4eaa4625232023c860b7d3630b7dfb7efb84443e027fe66da2da3c4c
Python
4,459
130
import os.path import numpy as np from typing import Any from mirp._data_import.generic_file import ImageFile from mirp._data_import.dicom_file import ImageDicomFile from mirp._data_import.utilities import get_pydicom_meta_tag class ImageDicomPlanarImage(ImageDicomFile): def __init__(self, **kwargs): su...
93dfe0d907cb3434296ddca45d9b81144a63d7ae7e9899df7fbdf81d063e0145
Python
4,459
110
""" Local functions for SSVEP examples """ import os import numpy as np from mne import create_info from mne.datasets import fetch_dataset from mne.io import RawArray SSVEP_HASHES = { 'subject01_run1_raw.fif': 'md5:e33a589abce842bf676dd881d9f4a9b0', 'subject01_run2_raw.fif': 'md5:2e75762abc30b832ad3d3d60f09...
99fc543265f756fd813badb43f3e37d2d192d6132a94da5cd4193b9dcce08f1c
Python
4,460
83
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
4f5d4c5da039eb5de35e96c00217c558540314b5f89f1e9464f2def125c20ccf
Python
4,461
102
"""P0 probe: fastlog late-buffer behavior, characterized before migration. Design-of-record section 4.5 predicted an accidental data loss on the fastlog ``to_trace`` path (a pre-0 late-buffer append invisible to materialization because the capture-end seal cache predates it). The probe shows the loss does NOT exist at...
6cd0d4d9b38c5b6362c55845805f862a812cff37e6f76a1bedc72ed4507f75f9
Python
4,461
183
# %% import sys import os import logging import itertools import numpy as np import pandas as pd import pickle from multiprocessing import Pool from statsmodels.stats.multitest import multipletests as mt import os import sys sys.path.insert(0, os.path.abspath('../../code')) import utils # %% spatial_fr...
c1fa3cab1c598676954729145447ab23451e01b67205cded9fec456405e5a149
Python
4,461
113
from __future__ import annotations import os.path import warnings from pathlib import Path from PIL import Image from tqdm import tqdm from lightly.data import LightlyDataset from lightly.utils.bounding_box import BoundingBox def crop_dataset_by_bounding_boxes_and_save( dataset: LightlyDataset, output_dir:...
0ee056cd6d07746ad0aabe52765323d5ca0436ed376aaa933a7c38b992bc1d07
Python
4,462
118
#### Master Script 2a: Prepare study resamples for bootstrapping TIL-based statistics #### # # Shubhayu Bhattacharyay # University of Cambridge # email address: sb2406@cam.ac.uk # ### Contents: # I. Initialisation # II. Draw resamples for bootstrapping ### I. Initialisation # Fundamental libraries import os import re ...
593a5e8b3c53abb4a5743e33e27b831ba28c03bf880f2b17adb773b96239f667
Python
4,462
162
# Copyright 2020 Google Inc. 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 applicable law or a...
cb6c3fbfab3347ef34331766670bdae17278eefcd49ed891b3fb67825e83e36a
Python
4,462
81
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
5e41a174d7add5fdfc15e417ab4631dedc014cb91921aba49ed287e86e2dc738
Python
4,463
116
import numpy as np import vtk import vtk.util.numpy_support as vtk_np from slicer import vtkMRMLScalarVolumeNode from slicer import vtkMRMLLabelMapVolumeNode from SegmentEditorCommon.Helper import Helper from biomedisa_extension.SegmentEditorBiomedisaTraining.Logic.BiomedisaTrainingParameter import BiomedisaTrainingPar...
61118d826e053945f80aed6999e5e481dc3965d6174f10e0c4c427fed6eb945d
Python
4,463
94
# -*- coding: utf-8 -*- """ Created on Fri Jun 10 09:56:26 2022 @author: 8 """ import torch import math import random import numpy as np import torch.nn as nn import torch.nn.init as init import matplotlib.pyplot as plt import torch.nn.functional as F import torch.optim as optim class MScnn(nn.Module): def __init...
dd3537ac6485c4f3c9d844954df12eae0f38d75600e308668910d7f5b747d505
Python
4,463
134
"""Utilities to query NVIDIA GPUs. This module provides utilities to query NVIDIA GPUs using NVIDIA Management Library (NVML). It is important to run nvmlInit() before any queries are made and nvmlShutdown() after all queries are finished. For performance, it is recommended to run nvmlInit() and nvmlShutdown() as few ...
87fe080768122ae634fe83dc241a7cf69618f1ec0ccf94cb2f1b6e0ee4f00bd0
Python
4,464
83
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
d7192e9c67e260e98a328b2a88f27076fcc441fdfe889f75961fd79cce8275c3
Python
4,464
163
"""Script to create (and optionally install) a `.whl` archive for Keras 3. Usage: 1. Create a `.whl` file in `dist/`: ``` python3 pip_build.py ``` 2. Also install the new package immediately after: ``` python3 pip_build.py --install ``` """ import argparse import datetime import glob import os import pathlib impo...
79cc7fc88d6fc765a23352dc338365d32a86a69e13de2281195ef10009e46524
Python
4,465
168
from scipy.stats import spearmanr import numpy as np import pandas as pd import warnings import networkx as nx from ...utils import _read_graph warnings.filterwarnings("ignore", category=RuntimeWarning) def detect_transition_markers_clades( adata, clade, cutoff_spearman=0.4, cutoff_pvalue=0.05, s...
1906a377a2efeb8d2bc736784535d0e5cdf34657ba956e565d874b2bec90dc27
Python
4,466
133
# 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 pytorch_lightni...
7599e8ba20a06c0eef9de31a833a48a2ee256baf13af702e650452581a68c724
Python
4,467
128
"""Multi-graph collection tests: rolled projection + feedback overlay (D10). Feed-forward captures emit NO rolled graph at all (rolling changes nothing); recurrent captures append the disclosed rolled DAG projection whose back-edges leave ``incomingEdges`` (dagre silently reverses cyclic edges) and ride the named "rec...
ac448a29a22d50b7ebc089e2c1295e5b2d9533ec346c167973b4f59713df238a
Python
4,467
158
import pandas as pd import pytest from rdkit import Chem from rdkit.Chem import AllChem from m2p import PolyMaker from m2p.stereo_reactions import ( get_vinyl_init_dict, get_vinyl_prop_dict, vinyl_prop_stereo, vinyl_terminate_stereo, ) pm = PolyMaker() @pytest.fixture def vinyl(): return pm.ther...
73e5465f46e6d8d4937d63862f7677a5ef6d12803e42e0c9204d044e6981b3a7
Python
4,468
115
# -*- coding: utf-8 -*- """**Lightly Train:** Train a self-supervised model from the command-line. This module contains the entrypoint for the **lightly-crop** command-line interface. """ # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved import os.path from typing import List import hydra im...
ce42da433ea91f697520bdd0b428f6fb5ab0b4b5dee61539f390ec6bc25fae04
Python
4,468
152
"""Sprint B3a model-profile computed-view regressions.""" from __future__ import annotations import json from pathlib import Path import torch from torch import nn import torchlens as tl from torchlens.constants import MODEL_LOG_FIELD_ORDER from torchlens.data_classes.trace import ResolvedPostprocessing, ResolvedPr...
5c0d78f6347e59d3ac5f40ea69fe27017f2d8e1a52856f7055e7fdfd3a89f52d
Python
4,469
119
import attr import numpy as np @attr.s class SaliencyMap: codon_address = attr.ib() saliency = attr.ib() absolute_saliency = attr.ib() bar = attr.ib() salient_locations = attr.ib() salient_motifs = attr.ib() possibly_salient_codons = attr.ib() possibly_non_salient_codons = attr.ib() ...
a5050e1043f9ebe9a7fc4c953ef81d0dbab286eb1f78e3e084a72f578fb2ecdc
Python
4,470
104
"""Norm-layer attestation/mutation over-trigger relaxation (r29-C4). Two over-triggers that penalised a VALUE-CORRECT, path-faithful norm-layer replay: * codex-F3 (false DIVERGE -- the harmful one): ``InstanceNorm``/``BatchNorm`` with ``track_running_stats=True`` updates its running-stat buffers inside the function...
bcfa77d04087b8e797c1cf9eaf1dca77f73dd8e33a3a3f0661c4dc1dbacd74eb
Python
4,471
115
import argparse import numpy as np def main(): parser = argparse.ArgumentParser() parser.add_argument('--vocab_file', default='vocab.txt', type=str) parser.add_argument('--vectors_file', default='vectors.txt', type=str) args = parser.parse_args() with open(args.vocab_file, 'r') as f: words...
801d7b9878f707f5b00fed2841b1e053086de70015dca0ae71ccd77ac6a7c8a7
Python
4,472
122
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import copy import torch imp...
bb7cc2988370bc4e5664f963c6edc3e0b55c1b8010dc20ae74b1785bd910a463
Python
4,472
146
import importlib import inspect import torch def get_class_string_of_object(obj: object) -> str: """ Returns the string name of the class of the given object. """ return str(type(obj)).split(' ')[-1][1:-2] def get_class_from_string(string: str): """ Returns the class that correstponds to g...
5bad0ed617a7123b76f3652e1f4134ef3b7f56279efa697b4a33d360fba8aa8f
Python
4,473
140
from numpy import random class BaseSchedule(object): """Maintains logic for deciding whether to consequate trials. This base class provides the most basic reinforcent schedule: every response is consequated. Methods: consequate(trial) -- returns a boolean value based on whether the trial ...
a3bf452d7b37a2a7dde0afad9613d5efdf339e20017c79adf854c4ceadbd720f
Python
4,473
153
"""Lifecycle matrix audits for intervention-owned TorchLens fields.""" from __future__ import annotations from typing import Any import torch from torch import nn import torchlens as tl from torchlens._trace_state import TraceState from torchlens.constants import LAYER_PASS_LOG_FIELD_ORDER, MODEL_LOG_FIELD_ORDER fr...
a9381c394c013b2707147467923a15dcec88e3b1d0ac1eb77d9ba2be117d1744
Python
4,474
88
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
0ebf0c71b0116b8200fc1357e0a4e46d25fbb25a33d2818bece0a5d78113b36d
Python
4,475
98
from model import * from utils import * import numpy as np from sklearn.model_selection import KFold import torch import os,sys import warnings warnings.filterwarnings("ignore") # trained_model protein length capacity should >= new protein length capacity # trained_model should have same embedding method with new dat...
20a2fc280197b9007980ab345468b50b5cd0591223b9c1fc16270ff60430a7bf
Python
4,475
142
import pytorch_lightning as pl import torch import torch.nn as nn import torch.nn.functional as F from pointnet2_ops.pointnet2_modules import PointnetSAModule, PointnetSAModuleMSG from scene_graph_prediction.pointnet2_dir.pointnet2.models.pointnet2_ssg_cls import PointNet2ClassificationSSG # class PointNet2Classific...
35a16c5cf73724dbedbcaba030fa16a1a1e816b2b682ea3022282a9414446ff2
Python
4,475
140
import numpy as np from matplotlib.colors import ListedColormap from irnlm.utils import check_folder from fmri_encoder.data import fetch_masker from fmri_encoder.plotting import plot_colorbar from irnlm.contrasts import plot_brain_fit from irnlm.peak_regions import plot_peak_regions green = np.array([[i / 50, 1, 0, 1...
f4bbd3c2d57704b48e37778bc00d198ff53e02abf75edcf2301fd15bc9dd5504
Python
4,475
120
import torch import torch.nn as nn from modular_splicing.models.entire_model.modular_predictor import ( ModularSplicePredictor, ) def compute_setting_as_batch(input_dict): setting = input_dict["setting"] setting_batch = setting[:, 0, 0] assert (setting == setting_batch[:, None, None]).all().item() ...
8faecd65a276b494abc4a6e28a3ce6df9ed8a4086eb49dedfac48ec7783aaf40
Python
4,476
126
"""Implementation of a space consisting of finitely many elements.""" from typing import Optional, Union import numpy as np from gym.spaces.space import Space class Discrete(Space[int]): r"""A space consisting of finitely many elements. This class represents a finite subset of integers, more specifically a...
223388efb31fc029caab8999477988aae9bbdb66adf3d174e63611c3dd75e749
Python
4,477
136
"""Numpy utility functions: concatenate space samples and create empty array.""" from collections import OrderedDict from functools import singledispatch from typing import Iterable, Union import numpy as np from gym.spaces import Box, Dict, Discrete, MultiBinary, MultiDiscrete, Space, Tuple __all__ = ["concatenate"...
50afc7e107cb54c14d4ac74e2ab148110ee6b549ab168d7e500192151166cb88
Python
4,477
86
from pyabf.abf2.section import Section from pyabf.names import getDigitizerName class ProtocolSection(Section): """ This section contains information about the recording settings. This is useful for determining things like sample rate and channel scaling factors. """ def __init__(self, fb): ...
51b415817b2714f69ccb7bee3edf2cd830b6695ae9e529bca6b0847e8be0e4c7
Python
4,477
128
"""1. Getting Started with Pre-trained Model on CIFAR10 ======================================================= `CIFAR10 <https://www.cs.toronto.edu/~kriz/cifar.html>`__ is a dataset of tiny (32x32) images with labels, collected by Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. It is widely used as benchmark in com...
0589efeccf49f1fc8c49db363f415962d4c561ceccd777852679b3c7926fde7c
Python
4,478
155
import os import re import subprocess from keras.src import backend from keras.src.backend import config # For torch, use index url to avoid installing nvidia drivers for the test. BACKEND_REQ = { "tensorflow": ("tensorflow-cpu", ""), "torch": ( "torch", "--extra-index-url https://download.pyt...
2384831fc3c4cbc89dc279f6dabde95982d2bb84888f81984172aa53ced77ffe
Python
4,478
140
from pathlib import Path import argparse from pymatgen.core.structure import Molecule from pymatgen.analysis.graphs import MoleculeGraph from pymatgen.analysis.local_env import OpenBabelNN from tqdm import tqdm from instance_mongodb import instance_mongodb_sei def identify_number_broken_bonds( molecule_graph1...
29476a9734f43a4951c09dccef9be5b052547d2d57e0e15e7e5db77d28cfcdd4
Python
4,479
121
import pickle from sklearn.model_selection import train_test_split from collections import Counter import numpy as np import sys mode = sys.argv[1] #standard or vgg19fullframe ### Load and combine all processed dictionaries V = {} if mode == "standard": with open('./preprocessed_pickles/processed_Mar25_0', 'rb') as ...
a91b2a6417ffa863dc54d7288c21f68f1d735f8dcf003d28840bbfe1b1a19adc
Python
4,480
115
__author__ = 'quentin' import logging from ethoscope.core.variables import BaseRelativeVariable from ethoscope.core.data_point import DataPoint from ethoscope.stimulators.stimulators import DefaultStimulator class TrackingUnit(object): def __init__(self, tracking_class, roi, stimulator=None, tracker=None, *args,...
bc478e58f279911bf34141884f165f6ce59ab269376ad0c396d67f161714fd17
Python
4,480
101
import os from os.path import join as pjoin from cxy_visual_dev.lib.predefine import proj_dir,\ dataset_name2info, s1200_1096_thickness, s1200_1096_myelin,\ s1200_avg_thickness, s1200_avg_myelin, get_rois from cxy_visual_dev.lib.algo import ROI_analysis_on_PC,\ calc_map_corr, vtx_corr_col, polyfit, row_corr...
8c2315f84c44ebba1e0e7eff0799fd4cb026858bd08a67e9ef01d3b772a983a7
Python
4,481
129
import importlib from typing import List, Tuple, Union from pathlib import Path import os from os import PathLike import torch import yaml from .._settings import settings def list_available_layers(model): """List all layers in a model""" return [name for name, _ in model.named_modules() if len(name) > 0] d...
c5b85968b18c3d1a7b50cf6d50cac86e78e0bffeaa5bb1eee4ba7655191b50a8
Python
4,481
152
import json from pathlib import Path from typing import Sequence, Union import mongomock import pytest from monty.serialization import loadfn from coeffnet.model.reaction import GateReactionModel @pytest.fixture def dataset_options_factory(tmp_path): """Returns dataset options common to all tests.""" def _...
06e2b9d30c65c5e2ece79b6b6990c6432156210a9d6131fdc11ca3b107a22654
Python
4,482
104
from keras.src import testing from keras.src.quantizers.report import QuantizationReport class QuantizationReportTest(testing.TestCase): def test_empty_report(self): report = QuantizationReport(mode="int8") self.assertEqual(report.mode, "int8") self.assertEqual(report.num_quantized, 0) ...
bd99b8b9909085b53fd940b1e9ce8e01289edc5d42602f775d6c3a057a1834c1
Python
4,482
121
#!/usr/bin/env python # Created on: September 30, 2013 __author__ = "Sven Kreiss, Kyle Cranmer" __version__ = "0.1" __description__ = """ Creates a counting model with box constraint (RFit) by replacing the constraint term in the model. """ import optparse parser = optparse.OptionParser(version=__version__, descr...
0e34d7509601a1e4014175b22adfb822be4328087ca63802089129d98d01d480
Python
4,483
118
import numpy as np from PyQt6 import QtCore import pyqtgraph as pg from ..geometry import pg_roi_to_impose_shape class StructureCompositeROIs(QtCore.QObject): def __init__(self, image_view): """Visualization and modification of the ROIs of a StructureComposite Parameters ---------- ...
7d1f10eb56a9e1cf0381438a3a01f0d2af972d29fd7b264000f8f773e3ea8d10
Python
4,483
144
# coding=utf-8 # Copyright 2023 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
92d0b15b9f7ac457777fad27219ebb6040a4904989c2a15653005545297198ca
Python
4,483
139
import itertools from slurmpy import Slurm # slurm params partition = 'high' s = Slurm("fit_logistic", {"partition": partition, "time": "1-0"}) # python ../02_fit_logistic.py --dataset financial_phrasebank --checkpoint distilbert-base-uncased --subsample 1000 --ngrams 1 --all all --layer last_hidden_state_mean --seed...
f610f243a782ccd79319e1fd3a03c96a594d9cd031e327f7ad88dd7ed0ffaaff
Python
4,483
140
from array_api_compat import array_namespace as get_namespace import numpy as np import pytest from pytest import approx from conftest import to_backend from pyriemann.utils._check import ( check_function, check_init, check_matrix_pair, check_metric, check_weights, ) @pytest.mark.parametrize("n_m...
161628b35b03e067aba70c7a5bda20b9aeb3d2ece5e4546e06463ade8ebd8384
Python
4,484
119
__author__ = 'cenwan' #-----The Python implementation of a approach to conduct the CTST on synthetic and real testing protein feature samples. #-----Please download data via http://bioinfadmin.cs.ucl.ac.uk/downloads/FFPredGAN/TestingData/. import numpy as np import math import glob import random import torch import t...
6127971a67a790abd5bb08f4f67ade08463519f061f12ab2a9d8bbd47fe7919d
Python
4,484
130
import os import h5py import numpy as np import torch import tqdm.auto as tqdm from permacache import permacache, stable_hash from modular_splicing.utils.run_batched import run_batched from modular_splicing.data_pipeline.reprocess_data import create_datapoints def create_gene_dataset(original_datafile_path, *, crea...
6d0f5a06bfb96523bef5f1ac1ac0cbcf49a79c5b5e1d46677ed54b921bc70ead
Python
4,484
98
import distutils.command.build_clib as orig from distutils.errors import DistutilsSetupError from distutils import log from setuptools.dep_util import newer_pairwise_group class build_clib(orig.build_clib): """ Override the default build_clib behaviour to do the following: 1. Implement a rudimentary time...
702710c626709eb19f199927d67b0234343e237664503792e8d97cec7ee05c4b
Python
4,485
123
from collections.abc import ( Iterable, Sequence, ) from typing import TYPE_CHECKING from sqlalchemy import ( and_, false, func, or_, select, true, ) from galaxy.model import ( Group, Role, User, UserGroupAssociation, ) if TYPE_CHECKING: from sqlalchemy.orm import ...
369fe9a017e791ea4dab62c99b07d9633bd97352565aa535296a2af92fff0372
Python
4,486
117
""" Gregory Way 2017 PanCancer Classifier scripts/initialize/process_sample_freeze.py Takes in sample freeze data that was determined by TCGA PanCancer Atlas consortium along with raw RNAseq and mutation data. The script will process the datasets and subset each according to the frozen samples. The frozen samples were...
6da9d3605b8e88874854b432f6f5c95bff9f4027fcbfcb51aa334a90e55ca02a
Python
4,486
161
import torch from torch.utils.data import Dataset class DummyDataset(Dataset): """Generate a dummy dataset. Example: >>> from pl_bolts.datasets import DummyDataset >>> from torch.utils.data import DataLoader >>> # mnist dims >>> ds = DummyDataset((1, 28, 28), (1, )) >>...
02aaaa9f8e1314cbc8ad8920f2a403587aae4be299af48a4c496af83566c46e6
Python
4,488
86
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
0dc21c5919c1f2ee410aceef5e02e1402f787052783ccd8bfab895c6da46ee79
Python
4,488
180
from typing import List, Union import numpy as np import pytest import seqpro as sp from pytest_cases import parametrize_with_cases def length_empty(): return "", 0 def length_single(): return "A", 1 def length_variable(): return ["A", "AA", "AAA"], [1, 2, 3] @parametrize_with_cases("seq, lengths",...
28de8ca45563f347b5135b4f88e6bcd43b8325a0c134260c6033b6bf4523a297
Python
4,488
143
# --- 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 Y(_BaseTraceHierarchyType): _parent_path_str = "volume.slices" _path_str ...