sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
b579d0dadb5d1fbd1c92b0c037dc923c6bdaf6107d554952eb35a003ca0e9909
Python
18,690
561
from typing import Any, Optional, Sequence, Tuple, Union from ..commons.utils import JsCode Numeric = Union[int, float] JSFunc = Union[str, JsCode] class BasicOpts: __slots__ = ("opts",) def update(self, **kwargs): self.opts.update(kwargs) def get(self, key: str) -> Any: return self.op...
ce445d47efbbf3a19fad49f01ce470343c0e3f296a5f761f7e3c66f0bbde9417
Python
18,694
467
"""Class that represent a model builit into ``vak``.""" from __future__ import annotations import inspect from typing import Callable, Type import lightning import torch from .decorator import ModelDefinitionValidationError from .definition import validate as validate_definition class ModelFactory: """Class t...
8c8faac6067e09756dbd6786b6742e22fb2615d4d7da8ee672f1496e3ff80980
Python
18,697
517
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass, field from typing import Optional import logging import math import torch import torch.nn as nn import tor...
bf9f987606a1b87ec0a92daef274eafecf20fa250a731f4c48e486ea60e80369
Python
18,698
500
import os import tempfile import unittest import warnings import numpy as np import numpy.testing as np_test from skbase.utils.dependencies import _check_soft_dependencies from pgmpy import config from pgmpy.example_models import load_model from pgmpy.factors.discrete import TabularCPD from pgmpy.models i...
5eefd7375baf9b77b5df4b3a68ac7e1610c8d5ae4fdf48d5053a7f9d66466a89
Python
18,699
611
"""Base wrapper for VTK objects.""" # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause import numpy as np import vtk from vtk.numpy_interface import dataset_adapter as dsa from vtk.util.vtkConstants import VTK_STRING from .utils import call_vtk, get_vtk_methods, is_numpy_string, is_vtk_str...
a152ee48e2f82bdbbf65a51a9c77b2d708b2bc3b3c6e9a750a9bd10a217b452f
Python
18,711
507
from neuron import h import math import time import random import numpy from matplotlib import pyplot as plt #cell that contains only 1 spine class cell() : def __init__(self, name="cell", gid=0): #random.seed(1) #use the same seed to get same number in every run random.seed(time.time()) ...
62fed99ca4c9b0bbea71686e282833a8b2acb6cd162abfd1dff0b1a471d5cf9d
Python
18,713
491
import warnings warnings.filterwarnings('ignore') from typing import Callable, Tuple, Union import math import torch from torch import Tensor import torch.nn as nn import torch_geometric.nn as gnn import torch.nn.functional as F from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.dense.linear im...
8a1c16964146a8cf33f4a507c15ea1b0a5d6f0390b406f4361fc1451655010aa
Python
18,745
438
#!/usr/bin/env python3 """ @file interpret.py @author Simon Yu @date 03/12/2024 @brief NPC Interpretation Utility. """ import header import json import logger import os os.environ["QT_LOGGING_RULES"] = "qt.gui.icc=false" import PyQt5.QtCore import PyQt5.QtGui import PyQt5.QtWidgets application = PyQt5.QtWidge...
962a23c28d10ed9905002d2000e1b3c20ad124c95ef19665816de6e9b46c99c8
Python
18,751
451
# Copyright (c) 2024, Shenghao Cao & Ye Yuan. Shanghai Jiao Tong University, Shanghai 200240, China # Some classes and functions are modified from scGPT (https://github.com/bowang-lab/scGPT), copyright (c) 2022 suber # The gene symbol and value encoding modules and initialization weights are from scFoundation (https://...
74ea537748541302b8dc183be874ac7d75e1f307eb8c7e208554ec7036230a76
Python
18,758
329
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt5 (Qt v5.9.5) # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore qt_resource_data = b"\ \x00\x00\x02\x1f\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x1e\x0...
d2eeb4267c25146b7058e623eae21bdea972d8a33f6cac4e05c34fcc65119ed9
Python
18,778
503
from __future__ import annotations import dataclasses import functools import logging import time import urllib.parse from pathlib import Path from typing import TYPE_CHECKING from typing import Any import requests import requests.adapters import requests.auth import requests.exceptions from cachecontrol import Cac...
cb31ceb6ce60c77086da3ef3cdb90552ac86ce52e783b83a8aba24d913714d10
Python
18,779
486
import os import re from pathlib import Path import numpy as np import pandas as pd import bombcell.extract_raw_waveforms as erw def load_ephys_data(ephys_path): """ This function loads the necessary data from the spike sorting to run BombCell Parameters ---------- ephys_path : str The ...
75424ace3ffb1d26f8d479f261acc456f3c4bab7b363f1b53e5a206cff3bc92f
Python
18,799
512
#!/usr/bin/env python # -*- coding: utf-8 -*- """methods to more reliably save random forest classifiers with ONNX Data are stored with the following scheme - onnx_rdf_classifier/ | - onnx_rdf_classifier_meta_data.json | - onnx_rdf_classifier.onnx | - onnx_rdf_classifier_training_data.csv | - onnx_rdf_classifie...
1d6c461e1aadff30bc4b86222c4c2890a8b7973465f05f253b4804ab430d871a
Python
18,833
310
###主要功能:对一次实验的所有数据进行预处理 ###先对视觉刺激记录的数据进行第一帧分析,紧接着做组内叠加平均(分别获得各组水平、竖直和功能柱) ###其次对电流刺激记录的数据进行第一帧分析和组内叠加平均 ##1.先在第27行设置存储组内叠加平均结果的日期文件夹 ##2.点击选择数据按钮,在Fileoperate目录下选择需要处理的原始数据,选到日期目录即可 ###20210928 读取相机记录的数据后归一化到[-1,1] ##20210929 读取相机记录的数据后进行高斯滤波 ##20211014修改视觉刺激组间平均dR/R的计算方式 ##20211104视觉刺激数据处理和电流刺激数据处理各自用不同的图片数量...
9582169ced6c1d8d4887bfd218ae6d8658ddb2cc46d690ca5f1ca36a5c17040a
Python
18,836
551
import json import pickle from pathlib import Path from collections import Counter, OrderedDict from typing import Dict, Iterable, List, Optional, Tuple, Union from typing_extensions import Self import numpy as np import pandas as pd import torch import torchtext.vocab as torch_vocab from torchtext.vocab import Vocab ...
776b41af9c8d49131d103ef54c8e0bea892a8313137e9c191fd8e74a41c05b58
Python
18,902
410
import pandas as pd import numpy as np import scanpy as sc from random import shuffle sc.settings.verbosity = 0 from tqdm import tqdm import requests import os, sys import warnings warnings.filterwarnings("ignore") from .utils import parse_single_pert, parse_combo_pert, parse_any_pert, print_sys def rank_genes_group...
eafbca883d7ae086f9b025e7eccff7fc73d19d79ff8f2821d3a68814ecf563ec
Python
18,904
400
import pandas as pd import pytest from pgmpy.estimators import ( AIC, BIC, K2, AICCondGauss, AICGauss, BDeu, BDs, BICCondGauss, BICGauss, LogLikelihoodCondGauss, LogLikelihoodGauss, ) from pgmpy.models import DiscreteBayesianNetwork # Score values in the tests are compared ...
47d198c274602ff9076674b7c1ad1599dc0a9b452be3e35e4af6f0f6046e8451
Python
18,910
667
# -*- coding: utf-8 -*- """ Created on Mon Feb 17 23:30:30 2025 @author: hanna """ import os import pickle import numpy as np import pandas as pd from tqdm import tqdm import seaborn as sb import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.lines import Line2D from scipy import stats from sci...
075240984d50ca3c3c7390c8a4b7c68ab9937a98a8a6aa5c635a597b379a289a
Python
18,928
714
""" Ablation Study for Garfield: Denoised-Graph Branch and Hyperparameter Analysis This script performs comprehensive ablation studies to answer reviewer questions: 1. Quantify the contribution of the SVD-based denoised-graph branch 2. Compare performance with SVD vs dropout augmentation 3. Evaluate impact of GNN iter...
bec5a88d652f3724fe594e2816180838166a9778bf1ab70cfd22a2d2589c6248
Python
18,934
413
#!/usr/bin/env python # This covers the obvious parameters, however, there are some that aren't # being tested for absence or alternate values and combinations. import sys import io # This allows us to run an individual test as it's own 'program'. Very useful # for debugging if "DEBUG" in sys.argv: sys.path.inser...
b0f4465bf6188511bbdc8c9cf41d4915630e9925fdc202758a883f8da0b67f3b
Python
18,941
525
"""Section construction for the graph settings panel.""" from __future__ import annotations from typing import TYPE_CHECKING from PySide6.QtWidgets import ( QFrame, QGridLayout, QHBoxLayout, QLabel, QPushButton, QScrollArea, QVBoxLayout, QWidget, ) from src.gui.framework.qt_view_styl...
a9d67ab4c1bc8bab1c036dc5355c9df4822ed2c799e9cb48afaf7626b15424fc
Python
18,944
482
# Authors: Christian O'Reilly <christian.oreilly@sc.edu> # Scott Huberty <seh33@uw.edu> # License: MIT """Python file to instantiate the graphs for the qcr app.""" from pathlib import Path # file selection import tkinter as tk from tkinter import filedialog import multiprocessing import pandas as pd impo...
4b6f5e664313bc00b10ed0f6e3195d9a003218f7792febb0abe4e37289edb916
Python
18,962
339
import argparse import os.path from copy import deepcopy from typing import Union, List, Tuple from batchgenerators.utilities.file_and_folder_operations import ( load_json, join, isdir, listdir, save_json ) from nnunetv2.configuration import default_num_processes from nnunetv2.ensembling.ensemble import ensemble_c...
162ed66ff4dda5e962944a22a6d2ea87fec408c95cc8d16b6a6a7bcc093a2d36
Python
18,964
517
from __future__ import annotations import re from enum import IntEnum from io import BytesIO from pathlib import Path from typing import TYPE_CHECKING from typing import Protocol from urllib.parse import urlparse from zipfile import ZipInfo import pytest import requests import responses from requests import codes ...
a3057033ec394aefd424f51fe8b866f6bd868930fe06f10b213a5d846ef7d96e
Python
18,983
527
from __future__ import annotations from typing import TYPE_CHECKING import torch from scvi import REGISTRY_KEYS from scvi.module._constants import MODULE_KEYS from scvi.module.base import BaseModuleClass, EmbeddingModuleMixin, LossOutput, auto_move_data from ._base_components import EncoderDecoder from ._priors imp...
63330770e709e8f72759a98451b8a0d088ab9dab762627566550c5564b2300fc
Python
18,988
462
"""Code that handles classes that represent the definition of a neural network model; the abstraction of how models are declared with code in vak.""" from __future__ import annotations import dataclasses import inspect from typing import Type, Union import torch REQUIRED_MODEL_DEFINITION_CLASS_VARS = ( "network...
e07821f94443c92a8f407795f6cdb2e0b78968987e71bf964732eb2a87bd22b4
Python
19,006
477
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import logging import os import to...
fe3b1e943f518d265253772bb101e55171db4abf08161638fcf81aabe045ef82
Python
19,010
509
# -*- coding: utf-8 -*- """ This module contains methods used for e-mailing. Currently, is used to write notification message in a folder. Codes to send e-mail is saved as commentar. Custom notification messages are saved in Email folder also in HelperFunctions folder as text files. The text files can be edited accor...
b140c624ead505099188417655e001565aa824a303741cb4216434fd798a7ea4
Python
19,015
446
import slicer, vtk import numpy as np from io import StringIO import warnings # # Feature # class Feature(): def __init__(self, projectTo): self.projectTo = projectTo def addSourceNode(self, sourceNodeID, property, visible): shNode = slicer.mrmlScene.GetSubjectHierarchyNode() id = shNode.GetItemBy...
f4bccff3b6c2a63eb4039bb3f7cdab451b664a1db49d66052b5f8fdab65cbc29
Python
19,038
527
from __future__ import annotations import os import shutil import zipfile from functools import cached_property from importlib import metadata from pathlib import Path from typing import TYPE_CHECKING from typing import NamedTuple import pytest from poetry.repositories.installed_repository import InstalledRepositor...
8466653c231a4fa04e97375967c299c6c6fa25405dd81bf119bf2a4455982e27
Python
19,046
521
import itertools import xml.etree.ElementTree as etree import numpy as np from pgmpy.factors.discrete import TabularCPD from pgmpy.models import DiscreteBayesianNetwork from pgmpy.utils._warnings import _warn_external class XBNReader: """ Initializer for XBNReader class. Parameters ---------- p...
c56c35153b02ebf2230b01f4cac2c68dc629cfed5016e921ccb5404206eb4bcc
Python
19,051
456
## cluster statistics # # written by S-C. Baek # update: 16.12.2024 # ''' The following code is to infer the results of time-resolved RSA or mTE analysis at the group-level. ''' import os import pickle import itertools import numpy as np from scipy import stats as stats import mne from utils import fisher_z_transfo...
a984ded898506ccc608f6eb10e9ec003e0c3a812222a37216fd52c68ab433d45
Python
19,056
396
import unittest from pathlib import Path from tempfile import TemporaryDirectory from types import SimpleNamespace from unittest.mock import patch import parmed from GMXMMPBSA.alamdcrd import GlyMutantMdcrd, MutantMdcrd, _getnumatms from GMXMMPBSA.exceptions import MMPBSA_Error from GMXMMPBSA.make_top import CheckMak...
bd5ce6366ff8000164d14ce5287f102af5f6f86cf4d25964f10eaab4164c2fbb
Python
19,059
533
from pathlib import Path # from plistlib import Dict from typing import Union import pickle as pkl import lmdb import numpy as np import pandas as pd import re import torch from scipy.spatial.distance import squareform, pdist from tape.datasets import pad_sequences, dataset_factory from torch.utils.data import Dataset...
0e45ebc99661d565b6784db3d17f493cfee2a2d40f6aaeebd182459e512adda5
Python
19,061
505
# Copyright 2021 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
370a314d0dad44652f459db859ba763ce3466575625fe1d5ea228de6a3ff920c
Python
19,081
514
import numpy as np import pdb import os # import h5py import random # from sklearn.model_selection import StratifiedKFold import math import time from matplotlib import pyplot as plt # import seaborn as sns import pandas as pd plt.switch_backend('agg') import glob import pdb import argparse import sys i...
032711a866ce80ab9222ffa032f082f546de5d3c7048a861f4390546c03ad341
Python
19,082
538
# src/cluster_compare.py # ----------------------------------------------------------------------------- # Purpose # Direct, paired comparisons between TWO clusterings (e.g., mincut vs mincut+fp) # # Additions # - boundary-matched evaluation over MULTIPLE seeds + aggregation # - paired Wilcoxon + sign test on del...
2be2e04cf32ba9a51f88862fe24580a76589f45f63fb53ec5c797f18c6f0ae6e
Python
19,083
421
import collections import shutil from contextlib import contextmanager import logging import os import timeit import time import numpy as np from numpy.lib.format import open_memmap from mdt.configuration import gzip_sampling_results, get_processing_strategy from mdt.lib.fsl_sampling_routine import FSLSamplingRoutine f...
44ef66654b761c10a06464a60d560203bcd404f2811a53a5c5b3f1088e313c4a
Python
19,096
471
"""Helper functions for frame classification dataset prep.""" from __future__ import annotations import collections import copy import logging import pathlib import shutil import attrs import crowsetta import dask.bag as db import numpy as np import pandas as pd from dask.diagnostics import ProgressBar from ... imp...
f3c660f952d5d924fb3c8ce4bcf02857f9b0cab1658ea35fe6bd510e12a710b2
Python
19,102
477
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import numpy as np import torch from fairseq.data import FairseqDataset, data_utils logger = logging.getLogger(__name__) d...
99a604d97c6404d9df1a730e0feb27f343caf4605bb48337b88e31ec96ec1d11
Python
19,120
649
# @license # Copyright 2017 Google 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 or agreed to in...
7218f80bb357c23d146042c9e99450acd0ca721c6662077e047c35bd96c8ce15
Python
19,137
475
from __future__ import annotations import hashlib from PySide6.QtGui import QColor from PySide6.QtWidgets import ( QColorDialog, QDialog, QFrame, QLabel, QPushButton, QScrollArea, QVBoxLayout, QWidget, ) from src.gui.framework.qt_view_styles import ( PALETTE, panel_stylesheet,...
b394a76854243cd33ab904634029e416a1f273409f911c88d660f52d0cffe153
Python
19,137
466
# Source code: # https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/utilities.py # This file includes the modifications to the source codes according to this project! import tqdm import logging import numpy as np import pandas as pd import gensim from gensim.models import Word2V...
1668747a0a391c447cddc3321385ee95f3ee6555e3b5ec804cf57b02ebe0d063
Python
19,139
525
from __future__ import annotations import logging import warnings from collections import defaultdict from functools import partial from typing import TYPE_CHECKING from torch import nn from torch.distributions import Binomial from scvi.distributions import BetaBinomial from scvi.external.methylvi._utils import METH...
c58de32d063071eaccfb5d7ebeb65e9d2ae7ed3ee40c9c3377650c5293cab774
Python
19,149
574
import os import sys import argparse import numpy as np import pandas as pd # Add project root to path project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.append(project_root) from lib.utils.utils_data_generation import simulate_tumor_volume, simulate_single_drug_concentra...
43d2eb49707c3a1f420776eff02a8e39bb371fa1bfbf5a7f67b8cc7ce1227bd0
Python
19,151
481
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from typing import Dict, Optional, Tuple import torch import torch.nn.functional as F from fairseq import utils from fairseq.incr...
b9a64a4f811ba5675b555a3759f2cc4c90ff4f25cf3d017eb16a2633e83cfdc7
Python
19,169
564
import pymol2 import matplotlib.pyplot as plt import numpy as np import json import pandas as pd import seaborn as sns import networkx as nx from torch_geometric.utils import to_networkx from typing import List from itertools import groupby from PIL import Image from collections import Counter from tqdm import tqdm s...
280a677a899e4682d69e501d7e5fb8515cd12f9eafa460cce929f98afa53d27b
Python
19,170
450
import os import re import tkinter as tk from tkinter import filedialog from tkinter import messagebox from tkinter import simpledialog from tkinter import ttk import pandas as pd from src.window_utils import center_window_on_screen from src.app_settings_manager import AppSettingsManager class DataSelectionFrame(ttk...
7a1070e09de298589ca50ece81f20d1f66b988772cc7256b44f6741253b00df3
Python
19,194
521
#!/usr/bin/env python3 from typing import Any import matplotlib.pyplot as plt import numpy as np import numpy.typing as npt import yaml from microcircuits import model as model from microcircuits.model import WeightsList class Descriptor(dict): """Parameter container supporting both dict and attribute access. ...
0023ac43fc4b8513e5f222e09352b71d6c9131e34fffff1322df4056db2778f2
Python
19,200
544
from __future__ import annotations import contextlib import functools import glob import logging import tempfile from pathlib import Path from tempfile import TemporaryDirectory from typing import TYPE_CHECKING from typing import Any import pkginfo from poetry.core.constraints.version import Version from poetry.cor...
3b40bf62ccd6d6e3db6b06c5a6c40b387f92b682336edeadc0435bbb65aefa82
Python
19,214
562
from __future__ import annotations import os from typing import TYPE_CHECKING import numpy as np import pyro import pyro.distributions as dist import pytest import torch from pyro import clear_param_store from pyro.infer.autoguide import AutoNormal, init_to_mean from pyro.nn import PyroModule, PyroSample from torch i...
5ccf6fcfd1a5dbce32ea1228d71186ae3e70d33ffd63e5e79c5d34afca6c103b
Python
19,224
609
from __future__ import annotations from typing import TYPE_CHECKING from typing import Any import pytest from packaging.utils import canonicalize_name from poetry.core.packages.dependency import Dependency from poetry.core.packages.dependency_group import MAIN_GROUP from poetry.core.packages.package import Package f...
9ff6dcb921ac2e42378d1fdffd83edc93ba05b84f710b8b7c61d25012071957e
Python
19,235
614
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import shutil import struct from functools import lru_cache import numpy as np import torch from fairseq.dataclass.constants import DATASET_I...
193e4f1c60c10890887134ecde28dd55f160614d4a37203f9b04d2489421672f
Python
19,241
517
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import math from collections import OrderedDict import torch from fairseq import utils from fairseq.logging import metrics fr...
4f3437ebfb94363d3d8d466f17e3db98c66608400c0fa1fabfaaeb1a58f3d289
Python
19,244
560
# Illustration of the BEM Simulation #%% # Imports import os.path as op import numpy as np import pyvista as pv import mne from pyvistaqt import BackgroundPlotter from bfieldtools import sphtools as sph import functions #%% import matplotlib.pyplot as plt font = { 'size' : 20} plt.rc('font', **font) #%% Plot para...
13c5086c0296b570617077c0e67844e7539bde9a937b0e73e7cf3db557edf1b3
Python
19,251
411
"""Page 11: BDP Degradation Explorer.""" import streamlit as st import plotly.express as px import plotly.graph_objects as go import pandas as pd import numpy as np from utils import PIPE_ORDER, PIPE_COLORS, DEGRADE_COLORS, style_figure def render(store, dataset): st.header("BDP Degradation Explorer") st.mar...
1bf075b3b1eee0e9e351a32f909558161cafde58684b22f863e5014715141c32
Python
19,254
431
import time import RPi.GPIO as GPIO from VariableList import var_list from RotatryEncoderv1 import RotaryEncoder import tkinter as tk from tkinter import simpledialog class threadedcontrols: # setup GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) def __init__(self, UIinstance): self.sendtoUI...
c7b4ff1765fdb2781c6c6074851412f137cb7c39c2f0ab2185d1ede335f097cf
Python
19,254
431
import time import RPi.GPIO as GPIO from VariableList import var_list from RotatryEncoderv1 import RotaryEncoder import tkinter as tk from tkinter import simpledialog class threadedcontrols: # setup GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) def __init__(self, UIinstance): self.sendtoUI...
223c5ac29310210dac09b4042ae72466494ea2c3c6f4bb7d6e7e0546cb1d7012
Python
19,258
389
from distutils.archive_util import make_tarball import os import importlib from pickle import TRUE import numpy as np import matplotlib.pyplot as plt import time import torchvision import seaborn as sns import numpy as np import pytorch_lightning as pl import torch.nn.functional as F import torchvision from torchvision...
a1d6b98fd1816e094d1e401cef6d7ac02127fdb9f4948b5c3f60625015c4601e
Python
19,303
617
# -*- coding: utf-8 -*- """ Created on Tue Feb 25 17:21:36 2025 @author: hanna """ import os import pickle import numpy as np import pandas as pd from tqdm import tqdm from datetime import datetime from scipy import stats from scipy.optimize import curve_fit # import warnings # warnings.filterwarnings("ignore") f...
774c6b4301623d64b04f3c2d8ef43d89d6bfd27c5568d26de967df69deb1b7d2
Python
19,318
499
import collections import os import pathlib import rootutils import functools import pandas as pd import hydra import lightning as L import omegaconf import copy import torch import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.metrics import roc_auc_score, roc_curve from loguru import...
18023b94c7186c23ac479c87e9183368f13a77504566cdaeb205dcd4d358c35a
Python
19,322
526
#!/usr/bin/env python # @license # Copyright 2018 Google 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 applicab...
9ca58b466f7b487860dbf50fc017d52e68852d9cee04c8cd3f55c4d52877d89d
Python
19,336
514
# utils/movefuncs_utils.py import datetime import numpy as np import os import re import scipy.io.wavfile as wav import threading from jinja2 import Template from pathlib import Path from scipy.io import savemat from PyQt6.QtWidgets import QMessageBox from moove.qt_helpers import invoke_in_main_thread, set_combo_item...
3116d57c22bae9528a598a1fdfd20f4f93fdeb2abd4d2f067fccde6c821102df
Python
19,376
443
# Copyright 2021 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
d5a6b726fa8b1e3e07fd2c3f4c4e1e7b70f0a7718b2d577a048c8a97d4fa592c
Python
19,384
407
import torch from dataclasses import dataclass from torch._C import dtype from transformers import PreTrainedTokenizerBase from typing import List, Dict, Optional, Tuple from src.dataset import ProteinGoInputFeatures, GoGoInputFeatures, ProteinSeqInputFeatures def _collate_batch_for_protein_seq( examples: List[D...
1783a08a4eabec68723f4544ba93c1cb1fa92809a59e1ae91a90bd4c43ec90c3
Python
19,408
536
import argparse import gzip import os import re from pathlib import Path import numpy as np import pandas as pd TARGETS_PATH = "__MS_GEO_ROOT__/Methylation_Target_Datasets.csv" BASE_DIR = "__MS_GEO_ROOT__/Methylation_Data" MIN_FEATURE_OVERLAP = 5000 def sanitize_label(value: str) -> str: clean = re.sub(r"[^A-Z...
901b08c0d0cf2261f2d25e73484993f207f160b4fe0a81bbdf2dd772f957b516
Python
19,408
510
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ast import inspect import logging import os import re from argparse import ArgumentError, ArgumentParser, Namespace from dataclasses im...
ad2c2eba5406d4225557e92654bc5d2a912b47134b4f9e7de2c07196c4ff9594
Python
19,422
602
"""Shared execution and resumability for maintained inference families.""" from __future__ import annotations import hashlib import importlib.metadata import json import os import tempfile from collections.abc import Callable from dataclasses import dataclass, replace from pathlib import Path from typing import Any, ...
dd9e8b28d098dfa7eca0ed27adb3d5b7b8e8516bc0d131961d676abda035f64f
Python
19,449
327
"""InferRef3D v1.0: trusted TrainRef3D state_dict + canonical request -> reviewable labelmap. Archives are validated before extraction. The source is never uploaded by this module itself, model checkpoints are loaded with weights_only=True, and the prediction is resampled back to the request's exact original NIfTI gri...
739f2d5976b22ce9d4a30c905474890abfcd26dff2c1605e3e8e9b275ed570ad
Python
19,469
557
#!/usr/bin/env python3 import argparse import os import unittest from inspect import currentframe, getframeinfo import numpy as np import torch from examples.speech_recognition.data.data_utils import lengths_to_encoder_padding_mask from fairseq.data import data_utils as fairseq_data_utils from fairseq.data.dictionary...
412eab9ddb0087df073ea62386a1f56ac1c5dac5ecfff870c3a9d5ab7a7a6789
Python
19,481
1,119
""" CGCNN-like embeddings using continuous values instead of original k-hot. Properties: Group number Period number Electronegativity Covalent radius Valence electrons First ionization energy Electron affinity Block Atomic Volume NaN stored for unavaialable parameters. """ CONTINUO...
3b4e23f0b37b76566001397ea459acb786825b44caa1b14c8cc56457a58b0fd1
Python
19,482
489
"""`compile_trunk` compiles the trainable top encoder layers, not the model. A real, tiny 4-layer `BertModel` (`patch_base_model` only injects 2, so this builds its own), top 2 layers trainable: a frozen prefix and a trainable top both exist, the shape that makes `BertLayer.forward`'s one code object guard on `require...
11ac2ea8febb952ef39baccdf52abcdcd60c93b956e58eeb62db9353e7f26eed
Python
19,505
463
# Source code: # https://github.com/zbmed-semtec/doc2vec-doc-relevance-training/blob/main/code/train_model/utilities.py # This file includes the modifications to the source codes according to this project! import tqdm import logging import gensim import numpy as np import pandas as pd from scipy.spatial.distance impo...
7259d043f828f980d97fff9a8ac49cc052c70754f8fd18b9cdae574fedcc5636
Python
19,516
412
"""Shared SegRef3D <-> SegAnything segmentation job archive support.""" from __future__ import annotations import copy import io import json import os from pathlib import Path, PurePosixPath import shutil import zipfile from PIL import Image FORMAT_VERSION = "segref3d-segjob-1.0" MANIFEST_NAME = "manifest.json" JO...
d2fa971962b70948204085131b186b8f36d6262944e7e921da972a3449c2839e
Python
19,522
548
"""The mention spans: the boundaries the per-token codes cannot carry.""" import collections import dataclasses import h5py import numpy import pytest from conftest import ( _BACTERIUM, _ENZYME, _STAMP, _TOKENIZER, _empty_labels, _encode, _labels_over, _rows, ) from d3text import surfa...
1233f42daa681360294f46c512b9df0381fff5b695e4b05eb547f17314145bbb
Python
19,551
522
#!/usr/bin/env python3 import itertools from collections import defaultdict import numpy as np from networkx.algorithms import bipartite from pgmpy.base import UndirectedGraph from pgmpy.factors import factor_product from pgmpy.factors.discrete import DiscreteFactor from pgmpy.models.DiscreteMarkovNetwork import Dis...
6934c82eb55c522e1116da944917193b8d850c08306cd35f4a80e07d8c200142
Python
19,565
517
import os import numpy as np import pandas as pd import pytest from mudata import MuData from scvi.data import synthetic_iid from scvi.external import TOTALANVI from scvi.model import TOTALVI def test_totalanvi(): # test transfer_anndata_setup + view adata = synthetic_iid() TOTALANVI.setup_anndata( ...
a6dff3fff64f49f061847b91ec67041586d59720426ec360e78c15a24fb59d2f
Python
19,594
546
import os import math import warnings from typing import Mapping, Optional, Tuple, Any, Union import torch from torch import nn, Tensor import torch.distributed as dist import torch.nn.functional as F from torch.nn import TransformerEncoder, TransformerEncoderLayer from torch.distributions import Bernoulli from torch....
1bea7d6fbf6a57759105eb4880634b710a4d2d26f42a4899cc2ef65287300078
Python
19,615
541
"""Training program and ancillary functions.""" import csv import functools import os import numpy as np import toml import torch import medaka.common import medaka.datastore import medaka.labels import medaka.models import medaka.torch_ext def train(args): """Training program.""" train_name = args.train_na...
052d750f8ef54dc688f9f7d7bc8c96bfcfc4f5f7e676618a9c35a067cd932a16
Python
19,625
486
import numpy as np import pdb import os import h5py import random from sklearn.model_selection import StratifiedKFold import math import time from matplotlib import pyplot as plt # import seaborn as sns import pandas as pd plt.switch_backend('agg') import glob import pdb import argparse import sys d...
ef3485b58e1f9d7e313ebab910ea618db90de11c06c82c7104c9045491c4170e
Python
19,636
624
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ ...
b6ec24f9757db6cd2fc87bd25df971d5d9435f66261097815d0743aaeb404e9c
Python
19,666
449
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import math from tqdm import tqdm ...
088f96298e268a241007c37d6ac02e9a6bb9d5c6fd47dcd84858adea5d22691b
Python
19,680
439
"""Read a GO Annotation File (GAF) and store the data in a Python object. Annotations available from the Gene Ontology Consortium: http://current.geneontology.org/annotations/ """ import sys import os import re import collections as cx import datetime import logging from goatools.anno.annoreader_base imp...
ff7ebd57c280c24a6e560d90a591209c52606f7814688ec9e5e0f1ca2892bdff
Python
19,691
466
import os from posixpath import join from sys import path import time import lmdb import torch import json import numpy as np import pickle as pkl import dataclasses from dataclasses import dataclass from typing import Dict, List, Optional, Tuple, Union from torch.utils.data import Dataset from transformers import PreT...
595f77c86381003912b1a54423fa29fe7f8c4ccce9be818cdb816fe91231a991
Python
19,697
526
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Dict, Optional import torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.i...
cc311f837dce792adcb27d9b51e76189d90c7062be77131a0e6546942c8dd9df
Python
19,725
744
"""Functions on surface mesh elements.""" # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause import numpy as np import scipy.sparse as ssp from scipy.spatial.distance import cdist from scipy.sparse.csgraph import dijkstra import vtk from ..vtk_interface import wrap_vtk, serial_connect fr...
9aa2ac798cb999ad94f8c14a57b49e1eff7af04b00d6d6dac5edc19df1009649
Python
19,732
433
import os import torch import numpy as np import skimage.io as skio import torch.nn.functional as F import argparse # from tqdm import tqdm import tqdm from scipy.io import savemat import matplotlib.pyplot as plt import matplotlib.cm as cm import time from utils import * import csv from torch.fft import fftshift, ifft...
1ffad8ed098fcba2b8f9f6f1d893399cd275d212ab190fb0fe154733a60d68c4
Python
19,744
617
"""Maintained GPN single-species inference operations.""" from __future__ import annotations from pathlib import Path from typing import Any import numpy as np import pandas as pd import torch from Bio.Seq import Seq from datasets import Dataset, disable_caching from jaxtyping import Float, Int from torch import Ten...
47b163abb7a2575e21bab1f1204177515ac7d37590e1cc3f7911ad0f6832ef9c
Python
19,745
512
import os.path import numpy as np import pytest from rnalysis.gui.gui_windows import * LEFT_CLICK = QtCore.Qt.MouseButton.LeftButton RIGHT_CLICK = QtCore.Qt.MouseButton.RightButton @pytest.fixture def use_temp_settings_file(request): settings.make_temp_copy_of_settings_file() request.addfinalizer(settings....
9a82e9d4da0506fa89413eb2f33af653b8379d97a2515b654e94636170c8711e
Python
19,747
512
import numpy as np import pytest from mudata import MuData import scvi from scvi.data import synthetic_iid from scvi.data._constants import ADATA_MINIFY_TYPE from scvi.data._utils import _is_minified from scvi.external import TOTALANVI from scvi.model import MULTIVI, TOTALVI OBSERVED_LIB_SIZE = "observed_lib_size" ...
8758c66b6170014fa824df5963fb39f1d33f46ee69e3ea465dd860677706f7c6
Python
19,811
449
import os import importlib import matplotlib.pyplot as plt import torchvision from torch import nn, optim from datetime import datetime import ambiguous.models.cvae from torchvision.utils import save_image import torch from torchvision import datasets, transforms import numpy as np from tqdm import tqdm import yaml imp...
f7a6ee9551127d76729b92716db1ca247d90fd0f27b2a83c7aa59ae3ab4fea8c
Python
19,813
556
"""Models for Plat et al. probabilistic reversal learning task. Three model families: simulate_rl_kernel : RL + choice kernel, fixed learning rate (4 params) simulate_metarl : Meta-RL (Plat et al.) + choice kernel; latent lambda, epsilon simulate_rbpf : Piray & Daw (2021) RBPF; latent v_t, s_t ...
58b51f9331a98b6c9e0e8c02ee060f6d6f551646870e86a6577843eefbed5765
Python
19,814
531
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest from typing import Dict, List import torch import tests.utils as test_utils from fairseq import utils from fairseq.data impo...
8cdff0aae1e35a4a729f12bd95159881fe972c3a188b483a288880696d84eff7
Python
19,815
481
from __future__ import annotations import json import warnings from typing import TYPE_CHECKING, Literal import numpy as np import pandas as pd from anndata import AnnData from mudata import MuData from scipy.sparse import csr_matrix, issparse from scipy.stats import pearsonr, spearmanr from sklearn.metrics import ( ...
482fed404846e25f11a1543a68001371c7ccd55f9b22f6efd9da3987cb09fcf7
Python
19,835
632
import stat from pathlib import Path from types import SimpleNamespace import numpy as np import pandas as pd import pytest from transformers import TrainingArguments import gpn.checkpoint as checkpoint_module import gpn.inference as inference_module import gpn.ss.inference as ss_inference import gpn.star.inference a...
a375d0e468fc1071b728327d999b38617fbd9d72cd949383f05c8f985f446254
Python
19,846
520
import torch import torch.nn.functional as F import math class KANLinear(torch.nn.Module): def __init__( self, in_features, out_features, grid_size=5, spline_order=3, scale_noise=0.1, scale_base=1.0, scale_spline=1.0, enable_standalone_scale_...
d66e53273a4ecb1161e48efbf6b4ca8ca4e37e8df4d3d5dd41d1bded4a00acb0
Python
19,850
611
"""Plot Ramachandran-style backbone mirror QC for paired L/D peptide poses.""" from __future__ import annotations from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd from Bio.PDB import PDBParser from Bio.PDB.vectors import calc_dihedral from scipy.ndimage import gaussian_f...
4c529a455c4387973d0d0e99c4143ba2c68822cdd4c0da7de94e60721e274ea7
Python
19,873
612
""" Tests for the sklearn-compatible ExpertInLoop class in pgmpy.causal_discovery """ import networkx as nx import numpy as np import pandas as pd import pytest from sklearn.utils.estimator_checks import parametrize_with_checks from pgmpy.base import DAG from pgmpy.causal_discovery import ExpertInLoop, ExpertKnowledg...
633f97019ae17ae5687faa194fe3885a0f2984eaac31d5c67f3d172fe9a3aaae
Python
19,876
526
from dataclasses import dataclass from typing import Callable, Dict, List, Optional, Tuple import haiku as hk import jax.numpy as jnp import numpy as np from jax import numpy as jnp from nucleotide_transformer.layers import MultiHeadAttention from nucleotide_transformer.types import ( AttentionMask, Embedding...
4659ae6bf082c261ac0b03b7e1aa1e52b062f8bb681d7915fe6b4297890cfdc6
Python
19,886
559
import os import unittest import vtk, qt, ctk, slicer from slicer.ScriptedLoadableModule import * import logging import glob import sys import numpy as np # # ImportAtlas # class ImportAtlas(ScriptedLoadableModule): """Uses ScriptedLoadableModule base class, available at: https://github.com/Slicer/Slicer/blob/ma...