sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
c3241ad163491842768ef6415f77f148d52110bcded032024eed0604e2dd469e
Python
26,377
538
###20211011,修改日期文件夹的获取方式 from SystemUI.MainUIApp import Ui_MainWidget from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * import sys import numpy as np from threading import Thread import os import time import cv2 as cv from SystemUI.Function_Voltagesupply import Turnon_volt...
63bc642c8f00ec8190953c055f86ef16348e1417b91ae01b47f36f32ef634567
Python
26,421
601
# -*- coding: utf-8 -*- import sys, os sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) import time import os import numpy as np import scipy.io from scipy.spatial import Delaunay import matplotlib as mpl import matplotlib.pyplot as plt mpl.rcParams["figure.dpi"] = 200 fro...
5a950d232de5cd2afd1827002e67f73d7388fc5118bce6fe5f73b79a22af2f28
Python
26,432
600
import random import numpy as np from torch.utils.data import Dataset import sys import pandas as pd from tqdm import tqdm from sklearn.preprocessing import LabelEncoder from collections import OrderedDict import os import math import torch import torch.optim as optim import torch.optim.lr_scheduler a...
6fc3be4995faac358b00bf0becb88b486c82a3f391815bee264bc456c83a9f6d
Python
26,442
601
# -*- coding: utf-8 -*- import sys, os sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) import time import os import numpy as np import scipy.io from scipy.spatial import Delaunay import matplotlib as mpl import matplotlib.pyplot as plt mpl.rcParams["figure.dpi"] = 200 fro...
770ed13ff82aad51536b7abd7496671b87277e444d245e7ccbf0a77fecc719c1
Python
26,462
691
"""Functional forms of transformations related to frame labels, i.e., vectors where each element represents a label for a frame, either a single sample in audio or a single time bin from a spectrogram. This module is structured as followed: - from_segments: transform to get frame labels from annotations - to_labels: t...
13feee13569be28c5ec18ec6edf2361edc4fcaeb0a9369dac931ce267ebdfa3c
Python
26,463
828
import copy import gc import time import torch from lib.utils.utils_preprocess import append_obsvspred, export_obsvspred, destandardize_concentration, compute_global_stats, append_metrics, export_all_metrics_and_residuals from lib.utils.utils_post_processing import plot_individual_fits, compute_test_metrics from lib...
d3ed69cfbdcbcb7b9ff04d66c967ab9a9ca4bd09098282c694ab710258a129e5
Python
26,468
751
import torch import torch.nn as nn import math import torch.nn.functional as F class ODEFunc(nn.Module): """ ODE function with optional EMA for parameters, dose handling, and skip connection. Supports multiple event types via `evid` (bolus=1, infusion=2, observation=0). """ def __init...
0bb0534bb71b0e2c47e3cc46ef1e3fd422ff502f49db7f746f9c96fe3f6c73f6
Python
26,521
742
# Copyright (c) 2024, Shenghao Cao & Ye Yuan. Shanghai Jiao Tong University, Shanghai 200240, China # The script is modified from scGPT (https://github.com/bowang-lab/scGPT), copyright (c) 2022 suber import json import pickle from pathlib import Path from collections import Counter, OrderedDict from typing import Dict...
7d946c7d794a62830984eddf70331ff295ee5eeeafa849e5590ffaa8cdb0f4b5
Python
26,557
639
import math import numpy as np import torch import torch.nn.functional as F from torch import nn from torch.cuda.amp import autocast from einops import rearrange, repeat from functools import partial from contextlib import contextmanager from local_attention import LocalAttention from performer_pytorch.reversible imp...
8266d1428ee1bb11d70b978b91342af0669be1c1b81f475c90ac071b54afd8e0
Python
26,561
629
import argparse parser = argparse.ArgumentParser(description='feature extractor and drug name') parser.add_argument('--feature_extractor','-e',help='feature extractor') parser.add_argument('--drug_name','-d',help='drug name') parser.add_argument('--geneset','-g',help='geneset') parser.add_argument('--adjust','-adj',hel...
2c2e3e6ddbdc97a3316062896275fec9391bf27e4d06691902fd253cc6b7a57a
Python
26,571
754
"""What `train` writes into the checkpoint. The heads' weights are the whole product of a run, and which epoch's they are is decided two files away, in `Trainer.fit`. This drives `train.main` with a scripted validation schedule whose best epoch is not its last, and asserts at the *file* — not at the model object — tha...
9242cfa6426f6d93bebeefa58973ee942688bbe6d33cf15bdb8189764e7fd369
Python
26,577
779
"""`precompute-encodings` must not store a document that has no text. A document whose halves are missing, or are markup wrapping whitespace, tokenizes to one window of `[CLS]` and `[SEP]`. The command warned about exactly that and wrote the group anyway, leaving the data layer to detect and drop it at read time. The ...
48eda689c1ce8230e0a03f0e5070e41a8f4c83354132398c2a918c8a9db6506c
Python
26,722
642
from PyQt6.QtWidgets import ( QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QGridLayout, QPushButton, QLabel, QGraphicsView, QCheckBox, QScrollArea, QFrame, QComboBox, # ← ここに QComboBox を追加 QDoubleSpinBox, QSpinBox # ✅ ← これを追加 ) from PyQt6.QtGui import QColor, QPixmap, QFont from PyQt6.QtCore...
1d3e28232045f5ab3267cdc0167b286648dc46fc4951d2c102df986ff91e6eca
Python
26,737
733
"""The label-store reader: space checked at open, codes carried across the window merge by the same arithmetic that merges the embeddings.""" import gc import types import h5py import numpy import pytest import torch from d3text import token_labels from d3text.models import token_supervision from d3text.models.token_...
613cca9cd1b3068f16ae8e7eb024ff6e9bbc087f437582a63f04da6e7e341271
Python
26,749
791
import contextlib import functools import logging from typing import Sequence, Type, TypeVar import jax import jax.flatten_util as jfu import jax.numpy as jnp import jax.tree_util as jtu import numpy as np from .api import ( IS_LEAF, JAC_DIM, Array, ArrayOrFwdLaplArray, Arrays, Axes, Extra...
5238f57feef24c9ce4806b5ecc2e8567a49232a12f07869b32dbd9cedf220a0c
Python
26,763
513
import matplotlib.pyplot as plt import numpy as np import igraph as ig import networkx as nx import os import sys import seaborn as sns from scipy import stats import pandas as pd from scipy.stats import sem # from sklearn.decomposition import PCA # from sklearn.preprocessing import StandardScaler, MinMaxScaler, MaxAbs...
a7a3ffaf5b79653dd3c61cfe45e71cabc991eb9d541f512e794cc3c1e7f5ebf8
Python
26,779
813
# 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 dataclasses import dataclass, field from typing import Optional, Callable from functools import partial import...
21f2a6296174004c1f5898dd331fa9ecfd522f4f21fa0a45171b2a9a3b258b22
Python
26,790
607
# 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 from omegaconf import II from fairseq import options, utils from fairs...
e27fe4e438ff1877d1c5f456e5b7fdad4525e1160fa67aa5f8d1e7575043dfeb
Python
26,791
872
import datetime import itertools import os import pickle import random import sys import numpy as np import pandas as pd import pytz import torch from Bio.PDB.Polypeptide import index_to_one, one_to_index from scipy.stats import pearsonr from sklearn.utils import resample from torch.nn.functional import softmax from t...
7b53395e6e936f8f62f5ffa9e88fcb089f9ef96c156835cfbb49b5d2f94f1534
Python
26,814
699
# 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...
a84d6c766d59f51d47866093dd5851ec050748d19fe87aad5b3e6c34f6bf4070
Python
26,831
814
import networkx as nx import numpy as np import pandas as pd import pytest from sklearn.exceptions import NotFittedError from sklearn.utils.estimator_checks import parametrize_with_checks from pgmpy.base import PDAG, UndirectedGraph from pgmpy.causal_discovery import PC, ExpertKnowledge from pgmpy.example_mod...
6e92ae554b865ec430e4238dfe29d7f55cfbd6a9d0ec0d499c10ec0a6312f68a
Python
26,866
592
#!/usr/bin/env python # This script is used to process FASTQ files in a folder in parallel. # It uses the fastp command to preprocess the FASTQ files. # It can also generate a summary HTML report of the QC metrics. import os,sys from optparse import OptionParser import time from multiprocessing import Process, Queue ...
1a253fa58ab86879e43cc12b8abafd6273d54222869b724864d63ca306ecb6c8
Python
26,891
651
import io import os import unittest import numpy as np import numpy.testing as np_test import pandas as pd from pgmpy.example_models import load_model from pgmpy.factors.continuous import LinearGaussianCPD from pgmpy.factors.discrete import TabularCPD from pgmpy.models import LinearGaussianBayesianNetwork class Tes...
148d72de54187b4c8335ba86c0df1a10b4fdc4a9a93622d5c4f0616714feaf9c
Python
26,901
607
import os import argparse from typing import Tuple, Optional import numpy as np import matplotlib.pyplot as plt from dgr.physics.b0_field_read import load_b0_map from dgr.physics.dicom_io import load_dicom_stack from dgr.physics.dicom_register import read_series_params, build_affine, resample_volume_to_target from dg...
a07103aa0e2c3c202458a9845c9aeabaa7104a03271b71eb090b29175615ca24
Python
26,939
733
# 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 csv import logging import re from argparse import Namespace from collections import defaultdict from dataclasses import dataclass from ...
ca0d790706d474ebf328a244ade18055740c3c414e6ed367fbb22c2367efcee1
Python
26,948
632
import torch import torch.nn as nn import torch.nn.functional as F import math import torch_geometric import copy from .activation import ( ScaledSiLU, ScaledSwiGLU, SwiGLU, ScaledSmoothLeakyReLU, SmoothLeakyReLU, GateActivation, SeparableS2Activation, S2Activation ) from .layer_n...
99eee3d8fd30b6e87e126034116c33587ca164bdbf6607dcde129fd1f7215a1e
Python
26,996
765
import os.path as op import json import os from bids.layout import BIDSLayout, BIDSLayoutIndexer import nipype.interfaces.io as nio import nipype.pipeline.engine as pe from omegaconf import OmegaConf import re def create_datasource( output_query, data_dir, nipype_dir, subjects=None, sessions=Non...
2b2aeed859914972e9c37cafaf21af2caacd66141c317f4cf16ffd0ac8919fa1
Python
27,003
513
import matplotlib.pyplot as plt import numpy as np import igraph as ig import networkx as nx import os import sys import seaborn as sns from scipy import stats import pandas as pd from scipy.stats import sem from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler, MinMaxScaler, MaxAbsScal...
c5a90bcee60b078390523906318191fe3f0b5d7486da5776ccebaf4b50d189a7
Python
27,007
634
import numpy as np import theano import theano.tensor as T from .. import init from .. import nonlinearities from .base import Layer from .conv import conv_output_length, BaseConvLayer from .pool import pool_output_length from ..utils import as_tuple from theano.sandbox.cuda.basic_ops import gpu_contiguous from pyl...
0319832c7acb0ecff27e5111b4fe355e58f8dc7ee20f1d2904d47a855ab18fa0
Python
27,017
642
import copy import itertools as it import networkx as nx import numpy as np from pgmpy.factors.discrete import DiscreteFactor from pgmpy.inference import Inference from pgmpy.models import DiscreteMarkovNetwork class Mplp(Inference): """ Class for performing approximate inference using Max-Product Linear Pr...
ec7386abaaf5ac65a335cadf39536f5329bef28e25533ca9815e2daddb5ac1b8
Python
27,017
647
""" Inference script: Computes concept direction and performs counterfactual prediction using a trained node-level conditional point cloud diffusion model. Usage Examples (Batch processing of multiple slices): # 1. For MERFISH_mouse_cortex dataset python scripts/run_inference.py \ --config configs/config.yaml \ ...
078e94df89393b75edfaf2a9db991e2eaf60a9f743d0c949c4f351cd5b9caf5d
Python
27,037
708
import math import numpy as np import torch import torch.nn.functional as F from torch import nn from torch.cuda.amp import autocast from einops import rearrange, repeat from functools import partial from contextlib import contextmanager from .reversible import ReversibleSequence, SequentialSequence try: from ap...
e2546101ad6185507a7b6f6032bad2a8577a0d49f2fc2702ff40000d136bd7fa
Python
27,040
711
from types import ModuleType import pytest from matplotlib.backend_bases import PickEvent # scikit-learn is imported lazily by rnalysis.utils.generic (see tests/test_imports.py), so the # star-import below no longer re-exports it -- the tests import it directly instead. from sklearn.preprocessing import PowerTransfor...
f48b12fd4e2092683f959b122b12ae2bda6be86191c05100333a94f813191dea
Python
27,053
772
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import csv import math import time import numpy as np import torch import scipy.io as sio '''******************** Functions for computing simulated BOLD signals ***************...
e114e3da939f17a0975209ac4163cd1042fd146628ca0661f62695b79ca8814e
Python
27,061
672
#!/usr/bin/env python3 """ Proper RAG-GNN Analysis for Cancer Signaling Networks ===================================================== Uses REAL data from STRING database (already downloaded). Implements: 1. GNN message passing layers 2. Knowledge retrieval based on protein functional annotations 3. Proper fusion of ne...
1f0c7d0ce39561b9a6c495ed3285fe7ddf38f0d865c19f90578d433ed11fc3b8
Python
27,071
669
""" workers.py — Subject-level worker functions for the cross-session pipeline. """ from __future__ import annotations import logging import gc import os import pickle import time from typing import Any, Dict, List, Optional import numpy as np import pandas as pd from ..config import resolve_pipeline_spec, normaliz...
6d29f968518495e703ab5677ec14358d2f3e9bc4edb5a24438569a40e2a81c9e
Python
27,121
693
import functools import logging import numpy as np import traceback import bigstream.transform as bs_transform from itertools import product from dask.distributed import as_completed from .image_data import ImageData, get_spatial_values from .io_utility import read_block as io_utility_read_block logger = logging....
2b7f1b372b3b3fd4ad65398dd852d14dbb05940dd19df16e57cca7d6ba1928ef
Python
27,145
654
"""`BrendaClassificationModel` — entity-class detection over pooled logits.""" import logging from collections.abc import Sequence import torch import torch.nn as nn from d3text import tracking from d3text.constraints import FREQUENCY_CLAMP_EPS, UnitInterval from d3text.mention_metrics import ( DetectionAccumulat...
8e40ec86e24e93ca95f087ab4749ca0ca8b23cd14be57eb63b1c76358a03b213
Python
27,149
698
"""The encodings HDF5's own provenance stamp. `precompute-encodings` writes token ids into an HDF5 keyed by pubmed id; the ids alone say nothing about which model, window or stride tokenized them, and `d3text.embeddings_store` already showed the aggregated row count comes to the same value under any window or stride. ...
a67441fd3f06167e52dd66ff52f0e998ba5628a322623073bdd3822a32492206
Python
27,171
783
""" This module builds rna pretraining. Author: wangning(wangning.roci@gmail.com) Date : 2022/9/8 1:21 PM """ # built-in modules from paddlenlp.transformers import ErniePretrainedModel from paddlenlp.transformers.ernie.modeling import ErnieOnlyMLMHead from paddle import nn import random from paddlenlp.data import St...
096fe826b7cbec1fdb97090416b87943d99df09868a2d11c6a1baf391c6b8de8
Python
27,187
812
## modified by cell2location and scTM ## please refer to https://github.com/JinmiaoChenLab/scTM/blob/main/sctm/pl.py import anndata as ad import matplotlib as mpl import matplotlib.pyplot as plt import textwrap import numpy as np import scanpy as sc # import seaborn as sns from matplotlib import rcParams...
a10bf54d97d34c64fa95b3fcdfb4ae0c2883df14eb840d9412abf613a4c744b7
Python
27,213
753
"""Scoring a linker against gold it had no part in choosing. The failure these tests exist to catch is silent and flattering. Reconstruct a span's gold entity from the surface-form index and the linker — which reads that same index — agrees with it by construction: measured that way the score is 1.000 over ten thousan...
c5f171d04642f3ad4c4312381984f9f0196fe802a8a830fae9996dd2b501c456
Python
27,218
683
import functools import logging from typing import Any, Literal, ParamSpec, TypeVar, overload import jax import jax.numpy as jnp import numpy as np try: from jax.extend.core import Primitive except ImportError: from jax.core import Primitive # type: ignore[import-error] try: from jax.extend.core.primiti...
ee84cef0a43e66dd53f31e7feeebccf766f3c7fce5016e284129921d43a37e4a
Python
27,227
704
# -*- coding: utf-8 -*- """End-to-end workflow for the working-memory EEG analysis.""" #%% import ast import seaborn as sns from pathlib import Path import pickle as pkl import pandas as pd import matplotlib.pyplot as plt import numpy as np import mne from scipy import stats from project_package.project_functions.prep...
c1162e87401e92170bfabc4e24336e67b45e3bf69ef3bbcbb55e7ef620a27af5
Python
27,240
654
import copy import os import pickle import tempfile import unittest import numpy as np from .mock_data import simple_data, create_simple_bam import libmedaka import medaka.features from medaka.common import Region, Sample import medaka.labels __reads_bam__ = os.path.join(os.path.dirname(__file__), 'data', 'test_read...
5033432139890882045869d746992cb30431ec2c4703bf757d97b00e9518a83b
Python
27,251
633
import torch import torch.nn as nn import torch.nn.functional as F from utils.tools import hier_half_token_weight from layers.SelfAttention_Family import FullAttention, AttentionLayer from layers.Embed import PatchEmbedding from utils.tools import create_sin_pos_embed import math import random from typing import List ...
fea4310a55f8a4fa1ee81bb9c8f870565695446098fb9dbdb5ad9491a5e1f37a
Python
27,264
761
# Copyright 2015 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...
e13e8b121adb3e453991fb18fabedbf0eaf9668c35e1fa3067f50c4a0bf584b2
Python
27,293
645
"""Preprocesses the Visual Genome + COCO dataset.""" # Imports import json import os from typing import Dict, List, Optional, Union import click import networkx as nx import pandas as pd import spacy from datasets import Dataset, load_from_disk from loguru import logger from spacy import Language # type: ignore from...
10731f8b4d9c00b45c499ad206a0ca6b3e3af5771c1a9134704d3173a81ada49
Python
27,305
551
import os import argparse import numpy as np import pandas as pd import random import torch import torch.nn as nn import torch.nn.functional as F from transformers import EsmModel, AutoTokenizer, get_scheduler from torch.optim import AdamW from torch.utils.data import Dataset, DataLoader import xgboost as xgb from peft...
e7ed3b0ce78975860b73a4b1ebb11b4f04ce350e61618dd828af021500a5f757
Python
27,354
638
#!/usr/bin/env python3 """ WF-RF — handcrafted waveform features + Random Forest baseline. Referred to as "WF-RF" in the paper (Methods § Baselines). The four core shape descriptors follow Jia et al. (2019, Journal of Neurophysiology); the five additional features follow the Allen Institute ecephys waveform metrics co...
79f0301f772accd956122c68792953f962dae5a91118ea231c870d7d9a6f53c6
Python
27,385
645
# -*- coding: utf-8 -*- """ Created on Tue May 13 10:35:03 2025 Adapted for delivering open-loop complex-trajectory stimuli, from: - AFOF3D_OL_record.py - AFOF3D_CLflightAFOF.py @author: mayc06 """ ## To use this code, simply hit run in a python ide like spyder. This code has ## three sections: the importer ...
73f5c534108733b106a6acf3da9cbf6a991e9806f45d776ddf60acde0d820312
Python
27,397
713
import argparse import csv import os import random import numpy as np from process_pretrain_data import get_kmer_sentence max_length = 0 def write_file(lines, path, kmer, head=True, seq_index=0, label_index=1): with open(path, 'wt') as f: tsv_w = csv.writer(f, delimiter='\t') if head:...
915edcb36b3ea12c1c6a39c41125762afad21f7a33f36cd4789342916b505141
Python
27,401
757
"""Durable, resumable storage shared by maintained inference families. This module deliberately does not know about models, datasets, or distributed execution. The inference runner is responsible for making the same batch decision on every process and for allowing only its main process to call the filesystem-mutating ...
0bbd781f8a9cad0f65919941e6ed4ef254e4b25a826c6da7a82adccfe087266d
Python
27,469
709
# 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 os import warnings from argparse import Namespace from typing import Any, Callable, Dict, List import torch from fairse...
2ce2f30807632c1a1c743334c8bf332c4986caa7ec1ac2920d16f02d0324e263
Python
27,484
661
import numpy as np import streamlit as st from streamlit_image_coordinates import streamlit_image_coordinates from streamlit_extras.image_selector import image_selector from msi_visual import visualizations import math import cv2 import cmapy import joblib import time from PIL import Image from pathlib impo...
eb6837258289f97919b7b7f597a20d1ffc984a71baa96d60bee5eb1445eebcf1
Python
27,531
639
""" Library for instantiating and running the optimizer for Tangram. The optimizer comes in two flavors, which correspond to two different classes: - Mapper: optimizer without filtering (i.e., all single cells are mapped onto space). At the end, the learned mapping matrix M is returned. - MapperConstrained: optimizer w...
249f16b97ec99fd824ba5c870c59c7666abc59bf49221817a7684adaf198c5e4
Python
27,628
700
from __future__ import annotations import logging import warnings from collections import OrderedDict from typing import TYPE_CHECKING import numpy as np import pandas as pd import torch from scipy.sparse import csr_matrix from scvi import REGISTRY_KEYS, settings from scvi.data import AnnDataManager from scvi.data._...
a6532e2c7875c536f470a2a187d3f47f9ae89cd5868361c7a663e781596220f9
Python
27,670
772
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import csv import math import time import numpy as np import torch import scipy.io as sio '''******************** Functions for computing simulated BOLD signals ***************...
ca1d2bc3f2c481fa6dac3094ebfee00939fa5ef35b81ad4498dc9fe0eaa31eb4
Python
27,676
772
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import csv import math import time import numpy as np import torch import scipy.io as sio '''******************** Functions for computing simulated BOLD signals ***************...
1c7901e4c51b0535e10e9aee9ef167c2b7285722ba427be38f3db586fe632fd0
Python
27,706
577
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------------------------------------------------- # Author: Lalith Kumar Shiyam Sundar # Institution: Medical University of Vienna # Research Group: Quantitative Imaging and Medical Physics (QIMP) Team...
51b3b383ad8f05c72e1ad0137f58eb28333ea863aa4f449e26bff55d63ddfaa9
Python
27,707
588
# ############################################################################## # GPLv3 LICENSE INFO # # # # Copyright (C) 2020 Mario S. Valdés-Tresanco and Mario E. Valdés-Tresanco ...
e7e138bdfd2846f7f9daab2b763146ca80d3b8587b5c004c4d1828abdbe9e0f0
Python
27,709
772
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import csv import math import time import numpy as np import torch import scipy.io as sio '''******************** Functions for computing simulated BOLD signals ***************...
55127510a1f55217c0021c844d0574416e506d473a2727a9faeb9671cacd179b
Python
27,765
718
from __future__ import annotations import logging from typing import TYPE_CHECKING import numpy as np import torch from lightning.pytorch.callbacks import Callback from pyro import poutine from scvi import settings from scvi.dataloaders import DataSplitter, DeviceBackedDataSplitter from scvi.model._utils import get_...
0fed3a7d83e63bdbb622c370201a81066874f98d329b5e9454b96b49a6cb6d63
Python
27,767
771
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import csv import math import time import numpy as np import torch import scipy.io as sio '''******************** Functions for computing simulated BOLD signals ***************...
39ae66f5cfca2d6e8bbae846dbeef61b4777f19cb937b27bd8a1357b655b36cf
Python
27,772
775
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import csv import math import time import numpy as np import torch import scipy.io as sio '''******************** Functions for computing simulated BOLD signals ***************...
bed49c09e03f64341105bdf95487df14fc7356a68f645d2ba8bc43c6fa30978d
Python
27,782
741
import os import pickle import numpy as np import pandas as pd import pytest import torch from scvi.data import synthetic_iid from scvi.model import SCANVI, SCVI from scvi.utils import attrdict def test_saving_and_loading(save_path): def legacy_save( model, dir_path, prefix=None, ...
f289d4837ef4afed461cf9a7a4934149c51552d84f2840659551b1a448abfe0d
Python
27,802
676
from __future__ import annotations from typing import TYPE_CHECKING import numpy as np import torch from torch.distributions import ( Categorical, Exponential, Independent, MixtureSameFamily, Normal, ) from torch.distributions import kl_divergence as kl from scvi import REGISTRY_KEYS from scvi.di...
ac2ac1b992b40127a8a74518b50d034dd510a91c46a6baebf2bb2d1e99a70e8e
Python
27,810
744
# 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 argparse import math import tempfile import unittest import numpy as np import torch import tests.utils as test_utils from fairseq im...
3e1adffaac5a81a140dcab1ddad970f621cfe827b28976bef9577c20342a9dbe
Python
27,831
771
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import csv import math import time import numpy as np import torch import scipy.io as sio '''******************** Functions for computing simulated BOLD signals ***************...
1c04499d6f17f5ee4d0c54252c235d59ad85e88473c1a17b59eaad68e6ffa9c8
Python
27,867
793
import argparse import ast import multiprocessing as mp import time from functools import partial from pathlib import Path from typing import Dict, Iterable, List, Optional, Tuple import numpy as np import pandas as pd from sklearn.feature_extraction.text import CountVectorizer def parse_hairpins(hairpin_str: str) -...
fdf78e7cfef890c3302b99dd52aa95d287f5a807dcb1b39ae886829ec51d9c7b
Python
27,873
748
from __future__ import annotations import logging import warnings from functools import partial from typing import TYPE_CHECKING import numpy as np import pandas as pd import pyro from pyro.infer import Trace_ELBO from scvi import REGISTRY_KEYS, settings from scvi.data import AnnDataManager from scvi.data._utils imp...
6b5fe0eaf11de223d5295f5d7270fade01687e3a5d3f6247a0109d7e6376caf0
Python
28,072
713
from __future__ import annotations import copy import os import pathlib from collections import Counter from typing import Optional, Union import crowsetta import numpy as np import pandas as pd from . import constants, files from .typing import PathLike def format_from_df(dataset_df: pd.DataFrame) -> str: """...
aab2646a23f653dad391335c4f35c3a41b4ff2d5cd496f9f33d1107bf14b8dae
Python
28,099
866
# Module containing information theoretic measures and error metrics import numpy as np from tqdm.auto import tqdm # ============================================================ # Basic utilities # ============================================================ def fit_value_bin_edges(Y_train, n_bins=100, mode="quantile...
834aec9431a06ac340dcf676e967f1ba493d8bb601658e4c82b1e160a2520e70
Python
28,112
716
import json import logging import os from functools import partial from multiprocessing import Pool, cpu_count import numpy as np from tqdm import tqdm from ...file_utils import is_tf_available, is_torch_available from ...tokenization_bert import whitespace_tokenize from .utils import DataProcessor if is_torch_avail...
0f2198ff6f692bd2409b5f7d854adbd988f8eb6406fd273688f439fb4f813767
Python
28,113
717
import json import logging import os from functools import partial from multiprocessing import Pool, cpu_count import numpy as np from tqdm import tqdm from ...file_utils import is_tf_available, is_torch_available from ...tokenization_bert import whitespace_tokenize from .utils import DataProcessor if is_torch_avai...
6fcbfef2a8d79a1f789bc43cd4483b7b6112ccca5493b7dfbc964d09a886a9a0
Python
28,122
718
""" PyTorch Dataset and Sampler for Medical Images ImageDataset: Loads individual images with optional augmentation StudyAwareBatchSampler: Groups images from same study into batches """ import json import torch import numpy as np import pandas as pd import math import logging from torch.utils.data import Dataset, Sa...
fe1c61ba69e013e1e6f14501bf9860cf35d6c27f7e5e413f16f41246b2af74ea
Python
28,154
815
from __future__ import annotations import logging import numpy as np import pytest from matplotlib.colors import to_hex from PySide6.QtWidgets import QApplication, QLabel, QToolButton import src.features.raw_photometry.photometry_processing_widget as raw_app from src.dfer.df_common import expected_analysis_output_pa...
366834d20f1f52bf6413f0c6ef94a1637c2de7303bc95191897cf5700e984e36
Python
28,155
654
import numpy as np import zarr import cv2 from tqdm import tqdm import os, shutil, sys from pathlib import Path from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap import matplotlib as mpl import zarr from numcodecs import Blosc import pandas as pd import skimage import pickle from tangl...
30a038d21f9c8a1337f17734c32197b07de08b85342c87cc3258784b543f770d
Python
28,277
735
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 14 11:14:05 2026 @author: vbp Model-based analysis for Figure 3B-H and Figure S4 A, C, D, E, F, H. Section -> panel mapping (see comments for details): Fig 3B - predicted GRAB-DA, example session Fig 3C, 3D - R2 score (pl...
7b7276d16d737286bd0979f935193e7b12ac34081164701e0b2569d1935e0650
Python
28,283
796
"""The three mention-level scores: detection, linking, and what is masked. Detection and linking are scored separately because a detection miss is unrecoverable while a false positive is cheap, and the ignore set — mentions distant supervision refuses to label — is masked rather than counted, since calling a hit on on...
367feafcf5ac8950e56b9b0d1eb3cbd314fa6c664b0535a9777be1b059d62505
Python
28,291
645
import sys import filesys as fs import numpy as np import ephys as ep import matplotlib.pyplot as pl def create_meta(ephysFolderPath, ephysFilePath): '''create meta file to save identity of each of the channels''' ch_num = ep.getchannelnumber(ephysFilePath) version = ep.getversion(ephysFilePath) pr...
a9253ab30c4405121d02accbacc9d54004f13a29fb38580d7e025b609787572f
Python
28,303
705
# moovegui.py – PyQt6 main window import os import sys import configparser import shutil import platform import ctypes import logging import threading import signal import time from pathlib import Path # Import torch early to avoid DLL/OpenMP conflicts on Windows when # scientific/GUI stacks (e.g., matpl...
ca56bb2c43dcee90d7c334d2d5ce97303f7d9c657b9cb801765e4cf23a670da5
Python
28,437
925
import copy import csv import glob import json import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import os from pathlib import Path from scipy.interpolate import interp1d import sys import time root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) config_pat...
14064858579e654cadc43642c3d76e6993a2abd69c164f0649c7e4921057849d
Python
28,480
659
# # Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with # Sandia Corporation, the U.S. Government retains certain rights in this software. # # See LICENSE for full license details # import sys, io, os, time, random import numpy as np import tensorflow.keras.backend as K from simu...
95b7fe082145b6ed39c538cdf0254d7b993d4940665fb2860f20e2b6101fadbf
Python
28,546
698
#!/usr/bin/env python3 import logging from collections import OrderedDict, namedtuple from typing import Dict, Optional import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from fairseq import checkpoint_utils, utils from fairseq.file_io import PathManager from fairseq.models i...
ae98a22be83376452544cb8d5f6b7197193a4d19d9f4b0b7e29245b9b2d8815b
Python
28,645
683
# 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 contextlib import json import logging import math import os from argparse import Namespace from collections import OrderedDict, default...
432597def375aad222b2ba9dcdb5b51b0a46b992e90f8a8e1641b091c8d3eb80
Python
28,661
756
# 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 import torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.models import ( Fai...
5ea13c5cad0f7abf816938fc003f2819cf889e96bef54079b6f720c78baf74b5
Python
28,678
850
# 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 import os import re import subprocess from contextlib import redirect_stdout from fairseq import options from fairseq_cli import ...
bf29d747ecab9650f3511e4ee8aa09c731bff129b9d0e57d063360bf349eb3a5
Python
28,679
754
""" Very heavily inspired by the official evaluation script for SQuAD version 2.0 which was modified by XLNet authors to update `find_best_threshold` scripts for SQuAD V2.0 In addition to basic functionality, we also compute additional statistics and plot precision-recall curves if an additional na_prob.json file is p...
e3f38f45f70febf873c64af5e2dd5dad1d62c26819d387ad6d586fb1641d4714
Python
28,691
774
import logging from functools import partial from itertools import count from statistics import mean, stdev from typing import Any, Iterable, Sequence, Tuple import jax import jax.numpy as jnp import jax.numpy.linalg as jnp_linalg import jax_dataclasses as jdc from jax import lax from tqdm.auto import tqdm from ..dev...
9ff2690828612116d8800eed198eea41af1e346ae2a0fb3c4abfe8fe2ee5c5be
Python
28,702
757
""" Very heavily inspired by the official evaluation script for SQuAD version 2.0 which was modified by XLNet authors to update `find_best_threshold` scripts for SQuAD V2.0 In addition to basic functionality, we also compute additional statistics and plot precision-recall curves if an additional na_prob.json file is p...
d8bb9fb85e177372938e08a16438676b6ec3c926705ee3e84d2663019efc5125
Python
28,730
916
from __future__ import annotations import json import os import textwrap from pathlib import Path from typing import TYPE_CHECKING import pytest from poetry.core.pyproject.exceptions import PyProjectError from poetry.config.config_source import ConfigSource from poetry.config.config_source import PropertyNotFoundE...
c2ce76c7b126d23bb78956d24f9fb84b52aaa7c9bb647b9aebcb3eb679c154bc
Python
28,756
743
# 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. """ RoBERTa: A Robustly Optimized BERT Pretraining Approach. """ import logging import torch import torch.nn as nn import torch.nn.functional...
7d283daa95489020cf35bfa10fb4e92b019fd298cdda1831c2126c1f481d2054
Python
28,777
647
import unittest import networkx as nx import numpy as np from pgmpy.example_models import load_model from pgmpy.factors import factor_product from pgmpy.factors.discrete import DiscreteFactor from pgmpy.independencies import Independencies from pgmpy.models import DiscreteBayesianNetwork, DiscreteMarkovNetwork, Facto...
50cb5bdbea7a42840016c9c80a4c09e1f047c0c2623db4b7e1acc31562b0b456
Python
28,789
810
"""The schema-driven BRENDA adapter, on synthetic splits. None of these touch the ~300 MB BRENDA files. What is pinned is that every fact the loader used to spell out inline is now read off the `Schema`: the columns it indexes, the prefix each ID wears, and which class column a type owns. The old loader hardcoded a fo...
b9be93c2480afafe3d3fbff6d48c1e5ae17f0781130aa18a7bd2d2d60ed1ecb3
Python
28,871
746
import matplotlib.pyplot as plt import warnings import numpy as np import scipy.interpolate as interp import matplotlib.pyplot as plt def emd(x, t = 0, stop = np.array([0.05,0.5,0.05]), ndirs = 4, display_sifting = 0, MODE_COMPLEX = 2, MAXITERATIONS = 2000, FIXE = 0, FIXE_H = 0, MAXMODES = 0, INTERP = 'cubic', mask =...
e49e82fc2c9292513d2f1ce91a7663b341320eecd3c81a43c2f257450f02955d
Python
28,892
966
# -*- coding: utf-8 -*- """ Created on Thu Feb 20 00:24:20 2025 @author: hanna """ """ Figure 4: Blockwise Changes in Neural Activity Figure 5: shared space alignment (SSA) Additional stats: -number of factors (dshared) -number of excluded, included BCI neurons ...
d173e529c58ae37f82ff0a06c9d75d03830b73d43a04343a1d960b43191c82ce
Python
28,896
548
import matplotlib.pyplot as plt import numpy as np import igraph as ig import networkx as nx import os import sys import seaborn as sns from scipy import stats import pandas as pd from scipy.stats import sem from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler, MinMaxScaler, MaxAbsScal...
da7959a5fb218f216da32a357fca5127d1cb154db1d56ffa5678d8beda08144c
Python
28,901
845
"""Helper functions and Classes for topographic maps during Lossless QC.""" # Authors: Christian O'Reilly <christian.oreilly@sc.edu> # Scott Huberty <seh33@uw.edu> # License: MIT from copy import copy import warnings from collections import OrderedDict import plotly.graph_objects as go from plotly.subplots i...
ff7ea46fe16af3f8b5a26369807c6fa549741cdccd10bec45451af0d268e3cec
Python
28,905
743
import inspect import logging import warnings from collections.abc import Callable, Sequence from typing import Literal import numpy as np import pandas as pd import torch from scipy.sparse import issparse from sklearn.covariance import EllipticEnvelope from sklearn.mixture import GaussianMixture from scvi import REG...