sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
493799ced9dd83c64198377a98992f3073f2e14b3dc4c65debd4aed78d2b870a
Python
21,145
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. import logging from collections import OrderedDict, namedtuple import torch.nn as nn from fairseq import checkpoint_utils, utils from fairse...
762648ccca1d8aac1d4a4dae5aed9769defc567b320792b644bbbf5a5b561abd
Python
21,157
643
import copy import inspect import pandas as pd import numpy as np from tqdm.auto import tqdm from pathlib import Path import torch import torch.nn as nn from torch.utils.data import Dataset, DataLoader from .measures import compute_eta_gauss, compute_rmse, compute_rmsse from .parse_data import split_by_subject, norm...
2714f27b467fbc376beefcd76a00821ee366a329a271fe705e8c8bddba936e08
Python
21,162
487
#!/usr/bin/env python3 """ hippie-wf3dacg transductive training script. Protocol (mirrors the HIPPIE training script exactly): 1. Load all neurons from a C4 H5 file. 2. Precompute 3D ACGs from spike_indices (expensive, done once). 3. Train the hippie-wf3dacg CVAE transductively on ALL neurons for --epochs. 4. ...
9110ae52b56041b19219a5ec249c0433ab09dd8cbf6d9ad1674677367dab6362
Python
21,187
561
# 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 from dataclasses import dataclass, field from typing import Optional from collections import OrderedDict import nump...
b7cbc391874b2dac41fbf81f6db9d8d2783b71b53e99c0ac5b136451ce70c1b6
Python
21,187
549
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (Bin.Xiao@microsoft.com) # Modified by Ke Sun (sunk@mail.ustc.edu.cn) # ------------------------------------------------------------------------------ from ...
1a52816498442939bc5302d6ca25ec480bd16c8f54e5a1094f36103270a1bdb1
Python
21,194
642
"""Maintained GPN-Star 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 datasets import Dataset, disable_caching from jaxtyping import Float, Int from torch import Tensor from transformers import AutoM...
f288321afab713c1066cb949188e7f0141fb38253a61526d7c995166d0f2755e
Python
21,211
513
from math import gamma import os import json import copy from typing import Optional, Tuple, Union import torch import torch.nn.functional as F from dataclasses import dataclass import torch.nn as nn from torch.nn import CrossEntropyLoss from torch.nn.modules.sparse import Embedding from transformers import PreTrainedM...
5b4d8c692c2c429c5f30363198514618cc05f8ef86afd9a08328bfc4bf569785
Python
21,221
463
# -*- coding: utf-8 -*- """Standalone Figure 12 generator for slippage sensitivity heatmaps. This script reads phi_total.npy, computes the same hydraulic-radius proxy used in app.py Step 5, samples active throat radii, and writes the formatted Figure 12 PNG/PDF outputs without importing Streamlit or torch. """ import...
12352145b7aeed48b4854e90151f0be490d6a2e43d174191b3e6234345f09579
Python
21,237
490
#!/usr/bin/env python3 """Render Figure 6 panels (CVAE-only generative experiments). Mirrors the original paper plot (final_paper_figures/.../figure_6_paper.py). Four panels, written as separate files into --out (default: figures/figure_6/): panel_a_cross_species.{svg,png} — 3 cell types (GoC/MLI/PkC_ss) × 3 ...
129cb8bdc1b6b74260d2edebfee3dcd396ff2f62627d0a26ac1d98dd7e38885a
Python
21,243
576
# %% """Train and save source-separation GRU models. It can reproduce the main training conditions by switching ``--condition``: * ``mine_l2``: MINE penalty + L2 regularization, saved as model_<id> * ``l2_only``: no MINE penalty + L2 regularization, saved as model_nm<id> * ``mine_no_l2``: MINE penalty without L2 reg...
edc7d278803bba41626eacd050d91d7247f1c5999f9dceb99a8877e238bc73d6
Python
21,261
633
#!/usr/bin/env python # # Copyright 2005 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
30fcd6d415ec45c8e4c1112bf4b4b6c6bbe910b7616ad7a38acc59d8b7ac4639
Python
21,293
654
"""Tracking must be invisible when off and harmless when it breaks.""" import os import pathlib import subprocess import sys import types import warnings from typing import Any import lmdb import pytest import torch from d3text import metric_docs, tracking from d3text.embeddings_store import ( EmbeddingsStore, ...
51ff0877a31ec8ca2f468f816d9f9ad0d035382454d8f06810484060d211fb20
Python
21,294
446
import sys sys.path.append("..") import torch.nn as nn from modelR.backbones.mobilenetv2 import MobilenetV2 from modelR.necks.conv_csa_drf_fpn_hbb import Conv_CSA_DRF_FPN from modelR.head.dsc_head_hbb import Ordinary_Head from utils.utils_basic import * from modelR.loss.loss_hbb import Loss from dropblock i...
8c4e55207cafe313bee7ea9970dbed8cc4c213d8015a3ce35ac4298a33b06c2c
Python
21,300
426
# -*- coding: utf-8 -*- """ Created on Sat Nov 22 11:54:33 2025 @author: mayc06 """ # Scripts for making Stupski data distributions and scatterplots for May et al 2025 from extract_trajectories_from_orcoflashStupski import * from math import isnan from scipy.stats import circmean traj_list40 = get_tr...
99222b715a543e4a48184f5d2de94b24ad1e255aa510f82dad1d9a0eb0973cc0
Python
21,304
606
# cluster.py # ----------------------------------------------------------------------------- # Purpose # - Run clustering on protein graphs and persist: # (1) per-residue hard assignments # (2) per-segment embeddings + metadata (ready for FAISS) # # Notes # - Protygus encoder output convention: # ...
58b82b2608726389f2aa77f5dae20376ff25acdbbda3b43c3743fa4716a20f39
Python
21,313
595
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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 cop...
666cf4339ccb073968191fe3882381a447025045f7853ff0dd75aa25db5714e9
Python
21,331
416
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
4c6f4a0d37a34d53968f012c5078598d4c7ca36b932c9b103f8f7cd1222b3719
Python
21,347
570
from __future__ import annotations import sys from collections import defaultdict from copy import deepcopy from dataclasses import dataclass from io import StringIO from typing import TYPE_CHECKING from uuid import uuid4 import rich.pretty import rich.table from mudata import MuData from rich.console import Console ...
d9f9a1456b0e0d0492d82a9e59e8da966e309ccd3f5cabe95825514f1b809e49
Python
21,362
419
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
dd922ba8d2ebe119c566f2b9794f43db1acd0c68b356da38edf8ab71fdb6e958
Python
21,404
638
#!/usr/bin/env python3 """ Compare posterior distributions from multiple trained models. This script runs tree sequences through different trained models and creates comparison plots showing how different architectures perform on the same data. Modified version: - For each config, it will first look for <OUTPUT>/si...
2be5625be392564b0b5f757f6dc9ec37a19f25bb1c159f40a26b3d272f247730
Python
21,405
673
"""Contains the runtime configuration of MDT. This consists of two parts, functions to get the current runtime settings and configuration actions to update these settings. To set a new configuration, create a new :py:class:`ConfigAction` and use this within a context environment using :py:func:`config_context`. Exampl...
ce0158aae127b46ea6216489e25c9c79544c3ae4b8f14038754fcbf2f5e1092d
Python
21,414
540
from __future__ import annotations import logging import warnings from copy import deepcopy from typing import TYPE_CHECKING from scvi import REGISTRY_KEYS, settings from scvi.data import AnnDataManager, fields from scvi.data._constants import _SETUP_ARGS_KEY, _SETUP_METHOD_NAME, ADATA_MINIFY_TYPE from scvi.data._uti...
a33d8b52a38ad64fba65abb16e838b2fc221403ee37379d0d720278d82db73fa
Python
21,425
522
import logging import numpy as np import pandas as pd import scipy.sparse import yaml from os import makedirs from os.path import join, exists, dirname, realpath from matplotlib import pyplot as plt from sklearn import decomposition from sklearn.manifold import TSNE from sklearn.metrics import confusion_matrix from skl...
e5518928e0595b0c85275221ce44018351672cbccf78d887e420ed104a1f97cd
Python
21,428
625
# 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...
f296f7dc00d6b8c9a8b9c3183cec5aeb2237919b029a1fe5c4dbd5d7508ae8df
Python
21,440
537
#!/usr/bin/env python3 # MIT License # # Copyright 2025 Broad Institute # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use...
8aef1ecf82c2b7ab9891bc5bae449ac5e04f88da40fc09ae7abdf3483315e6ed
Python
21,460
540
from __future__ import annotations import inspect import logging import warnings from copy import deepcopy from typing import TYPE_CHECKING import anndata import numpy as np import pandas as pd import pyro import torch from anndata import AnnData from mudata import MuData from scipy.sparse import csr_matrix from torc...
c7de1d33627280a2d3746ca20230c07cdf6c688a8a142f59c72e65e248396b1a
Python
21,461
584
# 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 copy import torch.nn as nn from fairseq import checkpoint_utils from fairseq import utils from fairseq.data.data_utils import lengths_...
da631f4b4f49d64e8a608c732246ccb74dfa404c39e6b47eeadee32526c173b5
Python
21,468
598
"""Run a univariate GLM on fMRIPrep outputs and aggregate group-level maps.""" from __future__ import annotations import os from pathlib import Path from typing import List, Sequence, Tuple, Optional import click import numpy as np import pandas as pd from loguru import logger from nilearn import image from nilearn....
6646f700a45166d0ccfa87a72af594a5a47a48871ba902b22777808712baf82f
Python
21,477
597
"""DIAGVAE module for multi-modal variational autoencoder.""" from __future__ import annotations import logging from typing import TYPE_CHECKING import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Categorical, Independent, MixtureSameFamily, kl_divergence from scvi imp...
062a5531ae8f301c0e59bcce1d6665d6ce0ae8faf4f1fedb2bedbfdd452975d7
Python
21,501
632
import math from abc import abstractmethod from dataclasses import dataclass from numbers import Number from turtle import forward import torch as th import torch.nn.functional as F from utils.choices import * from config_base import BaseConfig from torch import nn from .nn import (avg_pool_nd, conv_nd, linear, normal...
503e65d8e5ba0ac9f49f819e0e58431ff394cceac37fe4b81d715c72916f863b
Python
21,510
599
#%% Script to calculate the transfer functions import numpy as np import matplotlib.pyplot as plt from bfieldtools import sphtools as sph import functions font = { 'size' : 20} plt.rc('font', **font) #%% Plot parameters legendfontsize = 15 linewidth = 2.5 #%% Define parameters #the path to save the figures in...
a3abcb5fea319ddc1ec76a8788a345f6f575769164c9418efa26e1d60dc4ea1e
Python
21,510
675
from imblearn.over_sampling import RandomOverSampler from imblearn.under_sampling import RandomUnderSampler from imblearn.over_sampling import SMOTE import seaborn as sns import pandas as pd from sklearn.metrics import f1_score from sklearn.pipeline import make_pipeline from sklearn.linear_model import SGDClassifier fr...
1d8c72827337db61d42422f56237973384e6eccdd38496ccdcde7614666dba02
Python
21,521
473
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 14 18:29:05 2026 @author: forel """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 8 19:05:08 2025 @author: forel """ import os import sys import shutil import subprocess import numpy as np #from scipy.io import loadmat i...
35a20d462d6155722345209e2945a45be25a7a269c1f193a54024d6f7721153b
Python
21,546
653
# @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...
15dc52a08eb3968a09aaef3e8c73fba745b06788cc82fe4e05787d0b9e0c910e
Python
21,554
575
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import warnings from collections import OrderedDict import numpy as np import tensorflow as tf from skimage.util import view_as_windows from tensorflow.python.framework import ops from tensorflow.py...
2c4fe4f1b3500586a1351237870f23b05c986201db8345bc52e948c96e60c98f
Python
21,579
466
import os import numpy as np import matplotlib.pyplot as plt def scatterPlot(X_f,figHeight,figWidth,filename): plt.figure(figsize=(figWidth,figHeight)) plt.scatter(X_f[:,0], X_f[:,1],s=0.5) plt.xlabel('$x$',fontweight='bold',fontsize=14) plt.ylabel('$y$',fontweight='bold',fontsize=14) plt.xtic...
a08d83af70f0d8e3f5deea4b4dabfd6a3445429a40db07cac612a53a81a3aa46
Python
21,596
649
"""Build a database of article references from BRENDA. Each reference is linked to the enzymes it is associated with on BRENDA and to the organisms the article references as expressing each one. `sync_doc_db` is the entry point. """ import argparse import ast import asyncio import itertools import logging from collec...
44045d57828fa5c9da84047ce37836f271785609c07564d29bb74c4a1062fecc
Python
21,639
500
"""Physical-space geometry helpers shared by SegRef3D desktop builds.""" from __future__ import annotations from dataclasses import dataclass, field from pathlib import Path import re from typing import Iterable, Sequence import nibabel as nib import numpy as np LPS_TO_RAS = np.diag([-1.0, -1.0, 1.0, 1.0]) class...
16d2278c7a904a81b37d1ca56fbc79998e3b33cf1fafcea8638b54a3785dd72a
Python
21,649
661
import jax import jax.nn import jax.numpy as jnp from flax import nnx from flax.typing import Dtype from nucleotide_transformer_v3.layers import ( ConvBlock, ConvTowerBlock, DeConvBlock, DeconvTowerBlock, DeConvUpsampleType, RotaryEmbeddingConfig, SelfAttentionBlock, ) from nucleotide_trans...
124b0f0d4d983b6ce62b2dafa29bfcf933f391c1711ef84b6c239ce88e0e4bea
Python
21,655
444
# Utility classes for univariate and bivariate fit # Contains # _log_exp_converter, _logit_logistic_converter, _arctanh_tanh_converter - converters to map bounded parameters into -inf, +inf range # UnivariateParams, BivariateParams - represent parameters, with basic functionality like "calculate cost" # Several univari...
f5ccf6f54ea5f2b61482ecfb5df88bb0884d53b5e9b8e29ac21e0404d56f5d76
Python
21,676
682
from imblearn.over_sampling import RandomOverSampler from imblearn.under_sampling import RandomUnderSampler from imblearn.over_sampling import SMOTE import seaborn as sns import pandas as pd from sklearn.metrics import f1_score from sklearn.pipeline import make_pipeline from sklearn.linear_model import SGDClassifier fr...
3bc2d9b22997d4961349d80a517f242235d1128e78ac30c45f07aabf0f64058d
Python
21,701
562
# 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, List, Optional import torch import torch.nn as nn from torch import Tensor from fairseq import utils from fairseq.m...
d1755534b72f27947b98d483910f37a651eb1bb5be7995e314397365d26a5270
Python
21,708
558
# 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 collections import defaultdict from itertools import chain import torch from omegaconf import DictConfig from fairseq import optim fro...
4510f11f173281045e5f5441dbf6f6177ede87e6a05a33ccd42e7a4659a0b225
Python
21,716
565
import os from functools import lru_cache, partial from typing import Any, Iterable, Optional import haiku as hk import jax import jax.numpy as jnp import pytest from jax import grad, random, tree_util from jax.experimental import enable_x64 from lenses import lens from oneqmc.clip import MedianAbsDeviationClipAndMas...
152389313dde2c05ed5013f8634903931ca564cdb8b4d7100cb1d31e609e859c
Python
21,720
417
"""Functions to build BPNet-style models. The model architectures are generally derived from the basepairmodels repository, which is released under an MIT-style license. You can find a copy at ``etc/basepairmodels_license.txt``. The arithmetic for residual models is derived from ChromBPNet, but the code is not derive...
2a5c8c2fc659d8b44349f1ad6c43ec078ec7a5dc26274475fe569da56d2a99e5
Python
21,721
548
import os import re import glob import argparse from typing import Tuple, List, Optional, Dict import numpy as np import matplotlib.pyplot as plt from dgr.physics.dicom_io import load_dicom_stack, save_header_to_txt try: import pydicom except ImportError as e: raise SystemExit("The 'pydicom' package is requi...
ffe391a0009905b89647dcd9b60298fc5a7eeab23a5ae4cbff929afd927daaeb
Python
21,737
681
from imblearn.over_sampling import RandomOverSampler from imblearn.under_sampling import RandomUnderSampler from imblearn.over_sampling import SMOTE import seaborn as sns import pandas as pd from sklearn.metrics import f1_score from sklearn.pipeline import make_pipeline from sklearn.linear_model import SGDClassifier fr...
24a7d95d0821e9ecdbeea68632c9143aa461bbcf62e0cc8dbac4f0dcd787231e
Python
21,754
570
""" Supervised Vision Classification System Implements downstream classification tasks using pretrained vision encoders. Supports MIL aggregation for study-level predictions. """ import logging import gc from typing import Dict, Optional, List, Tuple, Any import torch import torch.nn as nn import torch.distributed as...
99ffbd6d5ac568860a4a29fec317d40d79f9c09d9f5523454c5f13477a435bd9
Python
21,767
681
from imblearn.over_sampling import RandomOverSampler from imblearn.under_sampling import RandomUnderSampler from imblearn.over_sampling import SMOTE import seaborn as sns import pandas as pd from sklearn.metrics import f1_score from sklearn.pipeline import make_pipeline from sklearn.linear_model import SGDClassifier fr...
bf8ce6ecc451d2a2d0fc216d785b5a4978ae6bff7157da516cc3b904d2b3dcf7
Python
21,784
520
"""Convert the HF dataset with the selected stimuli into locally saved images and text.""" import os import random import string from typing import List import click import numpy as np import pandas as pd from datasets import load_from_disk from PIL import Image from tqdm import tqdm from compositionality_study.cons...
36255d6e646bfdd905328248ceccc23cf2274afd71d0809194c54044763cd803
Python
21,786
469
import os, re import numpy as np import pandas as pd import argparse import logging import random from distutils.version import StrictVersion from pyliftover import LiftOver Intro = r''' Lifting SNPs 'rs' number and genomic position across different builds. Option --find-build require biopython. Install it with "pip ...
3984e4a23cbed7f785e6195a88c54caab925e70142e6c5e906af6e22a6767089
Python
21,788
609
import os import anndata as ad import numpy as np import pytest import scanpy as sc import torch from mudata import MuData import scvi from scvi import REGISTRY_KEYS from scvi.data import synthetic_iid from scvi.model import MULTIVI from scvi.module import MULTIVAE from scvi.utils import attrdict @pytest.mark.inter...
8ca891ec72f0619568eb73d040edf5d9edf43ce48ebb26520fc8658a56b6e01b
Python
21,795
629
# 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__ ...
d14faaea1312c906f06885593cd409af29a1acf3dffe5097cafd39f9eb638949
Python
21,840
744
import math from functools import reduce, wraps from inspect import isfunction from operator import mul import torch import torch.nn as nn import torch.nn.functional as F from aml.multimodal_video.utils.einops.lib import rearrange, repeat from aml.multimodal_video.utils.einops.lib.layers.torch import Rearrange from f...
356b07be48c5ea2e33edd328ee6e743eedfafd0ee7ac79b882856715d8ac3957
Python
21,851
554
# Copyright 2022 InstaDeep Ltd # # Licensed under the Creative Commons BY-NC-SA 4.0 License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://creativecommons.org/licenses/by-nc-sa/4.0/ # # Unless required by applicable law or a...
0c6f48d946bbacc8625cf7a233e047128075e3645a4de89f821e7550a3b08caf
Python
21,857
541
from collections import Counter import argparse import os import json import numpy as np import pandas as pd from pathlib import Path from tqdm import tqdm from p_tqdm import p_map from scipy.stats import wasserstein_distance from scipy.sparse import csr_matrix, lil_matrix, eye from pymatgen.core.structure import Str...
dc39325f13f3b4de99597c65325f0f1fde9f670a04ac5219baa2565465e9ab03
Python
21,871
423
import collections import numpy as np import numpy.ma as ma import glob import logging import os import shutil import time import timeit from contextlib import contextmanager import mot from mdt.__version__ import __version__ from mdt.lib.nifti import get_all_nifti_data from mdt.lib.components import get_model from mdt...
770cd458f0007ae7aaadce9bbe3da72d7fcaa01804645e5abf67e6ee65e35947
Python
21,872
559
from __future__ import annotations import functools import time from collections import defaultdict from contextlib import contextmanager from typing import TYPE_CHECKING from poetry.core.version.markers import AnyMarker from poetry.core.version.markers import EmptyMarker from poetry.core.version.markers import Mult...
480057ce76f477b2957db60733ebe54cdc30e1ad7f4270d74a665c80ce7c2ec5
Python
21,875
532
import re from copy import deepcopy import numpy as np import tatsu from mdt.component_templates.base import ComponentBuilder, ComponentTemplate from mdt.lib.components import get_component from mdt.model_building.parameters import FreeParameter, ProtocolParameter from mdt.models.composite import DMRICompositeModel fr...
3f9e1b41e8b7be85e67ed864b3a7225f11aafa95f2137d3babef5a7b7d1a6ebc
Python
21,884
537
#!/usr/bin/env python """Produce the per-token distant-supervision targets, offline. One HDF5 store of `d3text.token_labels` targets, keyed by pubmed id and shaped like the encodings the tagger reads. It needs no encodings file: re-tokenizing `corpus.document_text` reproduces the stored `input_ids` element for elemen...
d2ef3c810ae050fee761e1aa12343bd66a133a007db2c23deaa3bb455ced97bf
Python
21,899
575
import os import sys os.environ['WANDB_DIR'] = 'ADD YOUR DIRECTORY' from pathlib import Path import shutil import math import wandb import numpy as np from Images.utils import load_HVM8data from baseModels.utils import get_model import torch from enum import Enum from analysis.metrics import accuracy, dPrime_model_RL ...
dff36774429670615b5b266e4ac765733f246fe55af9e382d4646a9bd15cf2f8
Python
21,909
443
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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 cop...
e0cf1b1c3ed22018ad0e8ab3fb9a929ef80874a5a4545fb2f578431ff172261a
Python
21,910
444
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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 cop...
0a209f3c4a21851f9635e4e63cd90b0b28bcbd3f44b5603ea18f270a3ed231b2
Python
21,911
591
import itertools import networkx as nx import numpy as np import pandas as pd from opt_einsum import contract from pgmpy.inference import Inference from pgmpy.utils import _check_1d_array_object, _check_length_equal, compat_fns class BayesianModelInference(Inference): """ Class to calculate probability (pmf...
e24b6bb82176e284c5872a151f573815833a5fcb25c2eb6d7390abb3ef74c305
Python
21,916
495
from __future__ import absolute_import from __future__ import division from __future__ import print_function from os.path import join import math import numpy as np import nibabel as nib from dipy.tracking.streamline import transform_streamlines from scipy.ndimage import binary_dilation from dipy.tracking.streamline...
64ce0996a76db9c9d0d7fded4688a484992444587f5db2ba94d65a80ab7919e0
Python
21,918
532
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 27 11:31:26 2024 @author: Roxana """ import torch from .preprocess import preprocess_adj,get_feature, preprocess_adj_sparse, preprocess, construct_interaction, construct_interaction_KNN,construct_interaction_KNN_edge_index, fix_seed import numpy as...
78fb7e20a014c251d723186eb58040e4eb32405b73c9288d787ea0a0e4ff5183
Python
21,984
730
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
945c966928e18ef8aaa08a25239da26284c099201828b7ed814d4efcaf97af70
Python
21,992
660
#!/usr/bin/env python """ ENCODE QC log parser wrapper which converts a log file into a dict Author: Jin Lee (leepc12@gmail.com) """ from collections import OrderedDict MAP_KEY_DESC_FRAC_MITO_QC = { 'non_mito_reads': 'Rn = Number of Non-mitochondrial Reads', 'mito_reads': 'Rm = Number of Mitochondrial Reads...
03a0259e51a93329583d1fb7b2b0a2781e951208dfe1c68aeb65863bbf18a058
Python
21,993
648
""" 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 Optional import numpy as np import torch import torch.nn as nn from torch_scatter import scatter from torch_sparse import...
9f2d03375e95afce91fa759e656c2271bbaf3fe45b470038e6b0f2ddb21673a4
Python
22,027
574
from collections.abc import Callable, Hashable, Iterable from typing import ( Any, ) import networkx as nx import numpy as np import pandas as pd from skbase.utils.dependencies import _check_soft_dependencies, _safe_import from pgmpy import config, logger from pgmpy.factors.hybrid import FunctionalCPD from pgmpy....
2941388c5753b9cc38f9e92bab3de095aa9fa3d0d1cefcfa420ac142d2548f0b
Python
22,028
516
# -*- coding: utf-8 -*- """ Created on Mon Aug 7 09:14:53 2023 @author: nagellab """ from panda3d.core import loadPrcFileData loadPrcFileData("", "win-origin 1806 310") #these dimensions work for screen and mirror May23 loadPrcFileData("", "win-size 1050 600") loadPrcFileData("", "show-frame-rate-meter #f"...
f20c1d0e032b6aee2ab5f35f48ede2201e30bae3f2e08f77567a3fe864764d08
Python
22,030
586
"""Feature selection / regularization methods for OCE. Each strategy receives the design matrix X (n_mol × n_feat), targets y, and a list of feature keys, and returns: - subset of selected feature indices - fitted coefficients on the selected subset - intercept - leave-many-out CV RMSE Strategies: ...
2b97844ce23a65cef0294c26aa2d899308873dcfa9a53e1a23c75dbb80783b11
Python
22,039
361
import argparse import os.path def main(args): import json, time, os, sys, glob import shutil import warnings import numpy as np import torch from torch import optim from torch.utils.data import DataLoader from torch.utils.data.dataset import random_split, Subset import copy im...
e8e97b3c663622afb6ca271ba2cff3c4114faf018e1bcc5431ca26919f2021d3
Python
22,057
698
from __future__ import annotations from typing import TYPE_CHECKING from scvi.utils import dependencies from ._built_in_data._brain_large import _load_brainlarge_dataset from ._built_in_data._cellxgene import _load_cellxgene_dataset from ._built_in_data._cite_seq import ( _load_pbmc_seurat_v4_cite_seq, _load...
38f667f0c280064998345dee3bde0667b13336dbf11e4fc7d190b9181a1a0cdc
Python
22,105
483
""" diagnose_flash_attn.py ====================== Minimal synthetic-data diagnostic for the scGPT FlashMHA backend. Checks: 1. Which flash-attn backend is active (fa1 / fa2 / none). 2. Whether FA2's MHA has use_flash_attn=True (the most common reason for dense-fallback and memory blowup). 3. The actual tens...
af89e3a4d084eb820d58a2ba975fb53a08f066de82ccc5329df9c328722b4489
Python
22,150
503
from pathlib import Path import click from matplotlib.colors import ListedColormap import torch import torch.nn as nn import torch.optim as optim import torchmetrics.classification import torchmetrics.segmentation from torchvision import models from torch.utils.data import Dataset, DataLoader from PIL import Image impo...
d99583a1477f8a4d444e94a93ef8d16e0fd070404d23d2aa6bb79eb62804a650
Python
22,191
642
# @license # Copyright 2025 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...
1ba7fbb242b4a535aa54b38773a9ce9fcfac075fc2acd1f770cd28fc3a8ca9c3
Python
22,201
490
from __future__ import annotations import argparse import json import sys from pathlib import Path import numpy as np import pandas as pd from scipy.stats import pearsonr, spearmanr from sklearn.metrics import average_precision_score, roc_auc_score ROOT = Path(__file__).resolve().parents[1] SRC = ROOT / "src" SCRIPT...
2d34652c31b4ab5397d0b4c4bec82df5879817b242d254f2cefe33bcad409b01
Python
22,203
572
# 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 Any, Dict, List, Optional, Tuple import torch import torch.nn as nn from fairseq import utils from fairseq.mod...
8ff1130f6ee83bb5965591fe56b0024765ea6ed6b00265cef3f76aeb2e43f781
Python
22,226
637
# 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...
21f0a02dff9f0b4f5427e955d5cf53e482c1b018a262faa20f1ba9bb5266bff0
Python
22,253
532
# -*- coding: utf-8 -*- """ Created on Tue Apr 25 09:40:43 2023 @author: nagellab """ from panda3d.core import loadPrcFileData loadPrcFileData("", "win-origin 1806 310") #these dimensions work for screen and mirror May23 loadPrcFileData("", "win-size 1050 600") loadPrcFileData("", "show-frame-rate-meter #f"...
a0b2cdd109e4ddb9f5eaa5a457358bba2429f783c7a5a3a919c69452631c6664
Python
22,253
684
# 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 import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from collections import named...
1fa2999ac537e7368261a434e4939c5cd12a87fe4583d885415efae88a3b1241
Python
22,259
628
############################################## ## ## Decoding action predictions ## ## fMRI exp, this script has all settings for stimulus PC at 3T. ## ## !! Updated version !! ## - Orientations range from +/- 0.5 to 6.5° ## - Color space changed from rgb255 to rgb, because new Psychopy v...
3c6bb4a0b49b66f363600144cfeb7c8ec618d89ebc92f4e8116c28ef5573160d
Python
22,266
555
import copy import json import os from pathlib import Path import random import sys import numpy as np import tensorflow as tf from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint from tensorflow.keras.losses import MeanSquaredError from tensorflow.keras.metrics import MeanAbsolutePercentageError, Roo...
ce906afd77639cbf24e02a4530564abdb164d1fc23f82902e1f8913278eefcd2
Python
22,279
505
"""sklearn-style estimator wrapping the AESTETIK multimodal autoencoder.""" from __future__ import annotations import logging import os from typing import List, Literal, Optional, Union import anndata import numpy as np import torch from lightning.pytorch import Trainer from lightning.pytorch.callbacks import EarlySt...
c97c848faf79157fa1c748890b131d1d45567534a332c639bba222729edcd0e9
Python
22,315
1,508
import numpy as np # Cell cycle gene sets from Tirosh et al. doi:10.1126/science.aad0501, plus histones for S phase from own analyses # Removed BIRC5 because it's expressed in certain non-cycling heart cells g1_mouse = ['Mcm5', 'Pcna', 'Tyms', 'Fen1', 'Mcm2', 'Mcm4', 'Rrm1', 'Ung', 'Gins2', 'Mcm6', 'Cdca7', 'Dtl', 'Pri...
7e69abb817f7fa2ab708e448f64449da5816f33bea8e5eb44935b28281f2813c
Python
22,334
561
""" This module contains the encoder used by the Garfield model. """ import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.utils import dropout_adj from torch_geometric.data import Data from torch_geometric.nn import GCNConv, GATConv, GATv2Conv from .utils import DSBatchNorm, drop_fe...
06675d679be8124ca032a436615c69c8a8118c08457b4a3024cb3f81e2172687
Python
22,337
618
"""Create image files for the selected stimuli with their action annotations.""" import json import os from pathlib import Path from typing import Dict, List import amrlib import click import matplotlib.pyplot as plt import networkx as nx import pandas as pd import seaborn as sns import spacy from amrlib.graph_proces...
b2ed5e32ffa33b7ea82994948fb1aa08483338d61ddc4a496e0f8d7232ec94a9
Python
22,350
470
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 HierarchiaPy import Hierarchia abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) os.chdir(dname) os.chdir('..\\src\...
c6502b24a20e173a56d35d6ff35168bd99539e50dba1b701db1d1222f9a09fa9
Python
22,360
384
# -*- 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\x0b\x85\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x86\x0...
bc7838a43c02f96d3d95f6fc97de9a490e75016ff707623e0f36adf304815752
Python
22,379
516
import fnmatch import logging import os import sqlite3 as sqlite import sys from pathlib import Path from tempfile import TemporaryDirectory from typing import Dict, List, Optional, Union from ..plotting import qc_plots import click import numpy as np from loompy import create_from_fastq, connect, combine_faster from ....
a11d8b9e47b8582738e1093a425b703b9cfecb74d099d67d2cd9d908781519ca
Python
22,405
552
from matplotlib import pyplot as plt import numpy as np from scipy.signal import savgol_filter # line plot for firing probability when activate multiple spines def line_firingprobability(data, save=False, xpeak=[40, 175]) : x_ctl_nspines = data['ctl_actspines'] y_ctl_prob = data['ctl_prob'] y_ctl_stdev = d...
ac2d32fb2a325186b2f9f69612bbe525a94f8c3a0a17777e2e8704efc0a49863
Python
22,454
714
#!/usr/bin/env python3 -u # 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. """ Run inference for pre-processed data with a trained model. """ import ast from collections import namedtuple fr...
7bc7dcbcc0b2c38a61d4541f29b8c75f3dbcc40e8df48b1a3ca3e774511df880
Python
22,489
614
from __future__ import annotations import contextlib import dataclasses import logging import os import re from pathlib import Path from subprocess import CalledProcessError from typing import TYPE_CHECKING from urllib.parse import urljoin from urllib.parse import urlparse from urllib.parse import urlunparse from du...
71394a7f27b3fc14890ca64250dedb70a7fecc338aaa4ba1cd4d265f20f5e9f4
Python
22,493
556
from typing import Any, Dict import numpy as np import math import copy import json import os import glob import sys from omegaconf import DictConfig, OmegaConf import torch from torch import sqrt import torch.nn as nn from torch.nn import functional as F from torch.nn.parallel import DistributedDataParallel as DDP i...
8f6ac8ab7f561caafce19ee1e1a4ca0cf219d93b2ceb948470f39407ba67a056
Python
22,507
627
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Evaluate foreground Dice/HD95/NSD for a prediction folder. Output format is aligned with local `metrics.csv` style: - DiceNNUNet_* - (optional) DiceMONAI_* - HD95_*_vox - HD95_*_mm - NSD_* - per-case means + NSD_tau/NSD_unit - dataset-level OVERALL_MEAN and OVERALL_ST...
7e8b09a58f499d84b4ea74153e8bce80a6c28e27596d5dbc65dd19966be60eb4
Python
22,570
506
from kwave.kgrid import kWaveGrid from kwave.kmedium import kWaveMedium #from kwave.utils.kwave_array import kWaveArray from kwave.ksensor import kSensor from kwave.kspaceFirstOrder2D import kspaceFirstOrder2DG from kwave.options.simulation_execution_options import SimulationExecutionOptions from kwave.options.si...
04a8cde603cbf9408fd4cffcfa0c39407591cd405db481cf880b3567f01efb60
Python
22,574
595
from __future__ import annotations from abc import abstractmethod from dataclasses import dataclass, field from typing import TYPE_CHECKING import pyro import torch from torch import nn from torch.nn import functional as F from scvi import REGISTRY_KEYS from scvi.data import _constants from ._decorators import auto...
4c81a8359e83392b986e653d47530c90449bb14521510314431217716d25f55d
Python
22,575
614
import functools #import pdb import warnings from contextlib import contextmanager from typing import Any import matplotlib.pyplot as plt import mne import numpy as np import pandas as pd import scipy from mne.filter import filter_data from mne.preprocessing.eog import _get_eog_channel_index from mne.utils import lo...
f390317e7dba949625c4191b4c13dc4fae3b062a3bb9986e4a2965a14a7ffa1d
Python
22,586
742
# 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 ..roberta.model_xlmr import XLMRModel from fairseq.models.xmod.transformer_layer_xmod import XMODTransformerEncoderLayerBase from ..rober...