sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
902ef566016dc3b2f18f629be737766681569af653c353c2b5af1b2f5f28fed6
Python
5,757
163
""" This module contains general-purpose functions. Those include saving Filter objects and result tables, \ reading and updating the settings file, parsing common types of genomic feature indices, etc. """ import re from typing import Union import polars as pl from rnalysis import __attr_file_key__, __biotype_file_...
6edb4838ca94327d98b8d7a0925f8fffad2b744405be0bf4e20edb64247cd82a
Python
5,766
175
# 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 dataclasses import dataclass, field from typing import Optional, List, Tuple from omegaconf import II from fairseq.dataclass...
ebe18ca0b07f90c53b9b3f9a54ed02df94facf8995cfa90dd41c6f5474537c13
Python
5,766
171
#!/usr/bin/env python # # Copyright 2009, 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...
ef258c26e27895bf63975ae315dcfc1944d46ede40955066c2a8e14d00b93603
Python
5,767
193
from __future__ import annotations import os from pathlib import Path from typing import TYPE_CHECKING import pytest import tomlkit from poetry.core.constraints.version import Version from poetry.console.commands.env.use import EnvUseCommand from poetry.toml.file import TOMLFile from poetry.utils.env import MockEn...
63bf34accd61e44753746e9ebfe7467a0d7f5237c978c50dee60568973b03d98
Python
5,768
142
# coding=utf-8 # Copyright 2018 Salesforce and 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 copy of the License at # # htt...
0653ee41617fabc56e7fc45eee0cc4a0226185c293aa3f7790dc46eacdd8bceb
Python
5,769
168
# 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 sys from typing import Dict, List, Optional import torch from fairseq.models import ( FairseqIncrementalD...
2a3c9f2c073a8980d0603604d0255090a7ec365847156d6995bf02946663debc
Python
5,769
202
from tqdm import tqdm import torch import torch.nn as nn import numpy as np import msm from typing import Union, List, Sequence, Optional, Tuple from functools import partial import pandas as pd from .tokenization import Vocab from .tensor import batched_iterator from .align import MSA IntSeq = Union[Sequence[int],...
aa4e3c73cb1be22c412e478cd0b08b1f20c3395d72d2705b3dd7d7182f263942
Python
5,769
143
# coding=utf-8 # Copyright 2018 Salesforce and 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 copy of the License at # # htt...
deac7b6d20d160e7156238124882407226c4fc9870c8efee96f11cc56f6dee9e
Python
5,770
188
import torch from torch import nn from rinalmo.model.modules import Transformer def _outer_concat(t1: torch.Tensor, t2: torch.Tensor): # t1, t2: shape = B x L x E assert t1.shape == t2.shape, f"Shapes of input tensors must match! ({t1.shape} != {t2.shape})" seq_len = t1.shape[1] a = t1.unsqueeze(-2)....
52d3673a67e358c2be084ca08df158529cab3ed2c35118146c6619d10cb8e2e3
Python
5,771
92
"""Build the BAP-derived demo from the supplied ZIP without changing RGB pixels. Usage: python lite-web/scripts/prepare-mouse-brain-demo.py path/to/source.zip Requires Pillow. Source ZIPs are local inputs, never app assets. """ import argparse import hashlib import io import json from pathlib import Path import re imp...
5dd15d705053d5887a20c017bdcf19f0e952457170061f11e4d00d8f2a6a19ca
Python
5,774
154
""" This notebook loads in videos of natural scenes collected via the video collection protocol, and computes the response of a set of Gabor filters. Author: Jonathan Gant Date: 04.08.2023 """ # import statements import numpy as np from tqdm import tqdm import cv2 import glob import os import h5py from decord import...
cebcba08d5eed1f4491549c9618a5b97c0866ee6246efd8b7269f485cb194acd
Python
5,776
166
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import io import logging import os from pathlib import Path from tempfile import TemporaryDirectory from typing import Sequence from zipfile import ZipFile import ase.io import hydra import numpy as np import torch from pymatgen.core import Latt...
5667c048ba0d618c395fbafd129539778897636f7241e01b1ab2e68934b925a0
Python
5,782
134
#!/usr/bin/env python3 """Le o eos_ajuste.csv do modo convergencia e diz se o a0 parou de andar. Uso: python3 postprocess_eos.py --work conv/run_conv --out conv python3 analisa_convergencia.py --ajuste conv/eos_ajuste.csv A pergunta nao e "o a0 esta certo" -- nao ha referencia para isso aqui. E "o a0 ainda se...
ad9daedff6ce7f56880520677d41e9e4f3c52f7fb5980aac6d8e56c8758bd501
Python
5,782
168
"""Pure helpers for photometry-behaviour plotting workflows.""" from __future__ import annotations from pathlib import Path import pandas as pd def build_treeview_rows(dataframe: pd.DataFrame) -> list[list]: """Return table rows ready for insertion into the treeview.""" rows = [ [ Path(...
9ae38ed3001b3fe09161831449c450485d76bc6c5af0250c0ac103e59768b18e
Python
5,786
172
import collections import copy __author__ = 'Robbert Harms' __date__ = "2016-11-10" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" class DeferredActionDict(collections.abc.MutableMapping): def __init__(self, func, items, cache=True): """Applies the given function on the given items at th...
f15667aa2058f710e4245cd61aaa84558c166ee40e960be2c1a8fe886c0cdbeb
Python
5,786
155
import os import re import sys from glob import glob import importlib.util import platform import shutil from setuptools import setup, find_packages, Extension from setuptools import Distribution, Command from setuptools.command.build_ext import build_ext import subprocess __pkg_name__ = 'medaka' __dist_name__ = 'meda...
ec483341097c3bef491905c204b0f90e78c5c97c576e047a5c1a8333b50815f0
Python
5,787
163
import math import numpy as np import pandas as pd import matplotlib.pyplot as plt def load_relevance_matrix(input_path: str) -> pd.DataFrame: """ Reads a .CSV file containing the relevance matrix for RELISH. Three columns are needed: PMID 1, PMID 2 and Relevance Assessment. If the matrix is not pop...
2fccdbddb60030906155f26fc6ac58a0ae8f91cd6a1e08faf42eea44e12efd76
Python
5,789
153
import torch from pyro.distributions import BetaBinomial as BetaBinomialDistribution from pyro.distributions import Binomial from torch.distributions import constraints from torch.distributions.utils import broadcast_all from ._constraints import open_interval, optional_constraint from ._utils import _needs_cpu_detour...
bf4000d4de8fde715b0fcde76035e3018200cd98b50c4ca1e66d884fd9bd010d
Python
5,789
96
"""CPU-only transform/metric tests; forward/backward lives in the separate smoke script.""" import contextlib import importlib.util import io from pathlib import Path import sys import tempfile import unittest sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import trainref3d_backend as backend from trainr...
26102f48779208a2ec381a608fdff6b128e03fb5c6e242dacafa3fdfb0dc67ab
Python
5,790
156
#!/usr/bin/env python3 import csv import json import os import re import sys import glob import argparse from pathlib import Path from typing import Any, Dict, List, Optional, Tuple # -------- config: what to extract (edit here) -------- KEY_PATHS: List[Tuple[str, str]] = [ # (output_column_name, dotted_key_path_i...
7b5984094126fa25a7be44c9cf014b09ebafc2b5456a9223debcc1b606a6461a
Python
5,791
129
import argparse from argparse import ArgumentDefaultsHelpFormatter from utils.io_utils import obtain_dataset from utils.model_utils import obtain_placeholders, build_model from utils.parser_utils import set_defaults_train from utils.train_utils import train_model, set_seed def argparser(): parser = argparse.Argume...
262e780c66bde00290c1fd2298facca35285e67ad4caafa3ebbb91527bb1e111
Python
5,792
181
from typing import Callable, Optional import haiku as hk import jax.numpy as jnp import jmp from nucleotide_transformer.bulk_rna_bert.config import BulkRNABertConfig from nucleotide_transformer.bulk_rna_bert.layers import SimpleLMHead from nucleotide_transformer.layers import SelfAttentionBlock from nucleotide_transf...
be47776e60ef663e5245a4fce2476d2985ced4108711ee3809652a4e341d34c0
Python
5,794
149
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import json import logging from collections import OrderedDict from copy import deepcopy from pathlib import Path from typing import Tuple import hydra import omegaconf import pytorch_lightning as pl import torch from omegaconf import DictConfig...
e69f67ca4c820c1afefade492f0971e7cda1b1b270b7e23d1ffcd053d0cd1c53
Python
5,796
171
# # 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 numpy as np from scipy.special import softmax from ...backend import ComputeBackend ...
2aecf7c627d9fc39a2f1682ef7d132f67927f4ddb4ea662341f5dabcdab0ada2
Python
5,797
163
"""Tests for vak.train.parametric_umap module""" import pathlib import pytest import vak.config import vak.common.constants import vak.common.paths import vak.train def assert_train_output_matches_expected(cfg: vak.config.config.Config, model_name: str, results_path: pathlib...
ef0c8dff1523a924d5cf92e97351a4638097e8dc18bb4db77d552f6dc4e4d529
Python
5,799
110
#! /usr/bin/env python import os import logging import traceback from timeit import default_timer as timer from metax import __version__ from metax import Logging from metax import Exceptions from metax import Utilities from metax.predixcan import MultiPrediXcanAssociation from metax.predixcan import Utilities as Mu...
2a5450547f3f15b743d8c847591ea2e010533440195a27407dedca6f0a52b648
Python
5,802
155
# 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 os import re import glob import json import tempfile import math import torch from torch import nn from torch.nn import functional as F...
108743fb4f1f1576166279040b7e3e8fb4d16a341562538077eb0e4a9f7768db
Python
5,803
177
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Modifications by Roshan Rao # # 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:/...
94f0338527956bb6adbada6f0b8d5259c0e0c3c92c91784ef270a5ce9be86ebf
Python
5,803
149
""" Node-level concept direction: concept discovery in the node-level latent space Used for counterfactual prediction """ import torch from typing import List from utils.data.dataholder import DataHolder def compute_node_concept_direction( node_encoder, evaluate_datasets: List[DataHolder], target_cell_ids...
26f5aeef1ad9e41587643786463352c0312fb0f763d966fc6ca73e825f7b60e7
Python
5,804
157
from collections.abc import Callable import networkx as nx import numpy as np import pandas as pd from pgmpy.base import DAG from pgmpy.causal_discovery._base import BaseCausalDiscovery from pgmpy.causal_discovery.bivariate_scores import BaseBivariateScore, get_bivariate_score from pgmpy.utils import get_dataset_type...
b73879b33319814cd318d68ff23c53de4d01f619c57621e71678bfd086f42cbf
Python
5,804
133
"""High-level function that generates results for a learning curve for all models.""" from __future__ import annotations import logging import pathlib from .. import models from ..common.converters import expanded_user_path from .frame_classification import learning_curve_for_frame_classification_model logger = log...
81520ef50c652bed47ba4e967c17a21754923a94b4f99c571241eb1d151047de
Python
5,806
175
from PyQt5.QtCore import QObject, pyqtSignal from mdt.visualization.maps.base import MapPlotConfig, SimpleDataInfo class DataConfigModel: """The model contains all the state information for viewing the maps, both the data and the configuration.""" def get_data(self): """Get the current data. ...
e4290aeb5cc9520b5851840a1b0e6f9416e371bc5d361f3af68d74b7975deddb
Python
5,807
141
import os from argparse import ArgumentParser, Namespace from logging import getLogger from transformers import SingleSentenceClassificationProcessor as Processor from transformers import TextClassificationPipeline, is_tf_available, is_torch_available from transformers.commands import BaseTransformersCLICommand if no...
a488aeebe50cb37892c081db402832bdabbd476442595226305fb8e09394386e
Python
5,809
144
import os from pathlib import Path import sys import tempfile import unittest from unittest.mock import patch import numpy as np from PIL import Image os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") os.environ.setdefault("SEGREF3D_DISABLE_SAM2", "1") MODULE_DIR = Path(__file__).resolve().parents[1] if str(MODU...
ce339193af697daa3ca49914564578f5ce106f95d131bec9b64983cd39093bc7
Python
5,809
186
import argparse import os import random import time from copy import deepcopy import h5py import numpy as np import torch import torch.nn as nn import torch.optim as optim from torchdiffeq import odeint from torch.utils.data import Dataset, DataLoader learning_rate = 0.001 num_epochs = 500 device = torch.device("cpu...
469e56897174697172edcba56239074b2e67218d9695c00e01dbef325c0e2dfa
Python
5,810
133
import utils.gpu as gpu from modelR.lodet_hbb import Head3_LODet,LODet from tensorboardX import SummaryWriter from evalR.evaluator import Evaluator import argparse import os import config.cfg_lodet as cfg from utils.visualize import * import time import logging from utils.utils_coco import * from utils.l...
6e8d4ede26da0c01fc8f4dea7c73bdbdbf94d9340b1783f3a0047a037f3a50dd
Python
5,815
226
from __future__ import annotations from importlib import metadata from typing import TYPE_CHECKING from typing import Any import pytest from poetry.core.packages.dependency import Dependency from poetry.core.packages.package import Package from poetry.plugins.application_plugin import ApplicationPlugin from poetry....
715d4492a18298868d82f1a5bfb9e7b8bd82311e3ac5aabcd042414a78a34369
Python
5,817
129
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI/AnalysisWindow.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! from pyqtgraph import PlotWidget from PyQt5 import QtCore, QtGui, QtWidgets class RiskWidget(QtWidgets.QWidget): ...
2f17ad25c0a338daec600de82a838b100cd0d1717135ab7b88babca60be46beb
Python
5,821
120
#!/usr/bin/env python3 """Extract loss weights that should be used to train a model. This is a little utility to read in the training history json and calculate an appropriate counts loss weight parameter to get the loss balance you want. Since we only know how large the losses for profile and counts will be after we'...
4de9593a72fab0b5b27ab812cfe24c5de8dc5f415385b4c4dc34907ade79b108
Python
5,822
165
#!/usr/bin/env python # Author_and_contribution: Niklas Mueller-Boetticher; created template # Author_and_contribution: Kirti Biharie; added dataset import argparse parser = argparse.ArgumentParser(description="Load data for Mouse Brain (Sagittal-Anterior)") parser.add_argument( "-o", "--out_dir", help="Output ...
3f6e855495c58bce45c76a39bd3e9637e14b99f9bef12c402d262e5c9da8a593
Python
5,826
160
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 def exists(val): return val is not None class AutoDiscretizationEmbedding2...
fd3e7aa30fcfacb0d3fb77bfc238ba708f3095073c780e28359cfa1f6ef35a44
Python
5,828
148
from __future__ import annotations import logging from typing import TYPE_CHECKING, Callable import numpy as np from anndata import AnnData from sklearn.decomposition import PCA from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler if TYPE_CHECKING: from spatialdata import Spatia...
672354db9b346bc30d7d6f5561b754f17c93012c715d22074f0509d6b193b9c6
Python
5,830
144
import os from argparse import ArgumentParser, Namespace from logging import getLogger from transformers import SingleSentenceClassificationProcessor as Processor from transformers import TextClassificationPipeline, is_tf_available, is_torch_available from transformers.commands import BaseTransformersCLICommand if n...
d9aa05954929c50c02a5dd02736045c78bbd235ea39cec3b713702cd5687c24c
Python
5,832
120
import argparse import random,os,sys import numpy as np import pandas as pd import argparse import torch from tqdm import tqdm import os import scanpy as sc import sys sys.path.append("../pretrain/") from load import * ####################################Settings################################# parser = argparse.Ar...
138f9d9b07d9e34c2f80cc31aca73deacc6750c07a414d37f2e6344b63d29aad
Python
5,833
165
#!/usr/bin/env python # Author_and_contribution: Niklas Mueller-Boetticher; created template # Author_and_contribution: Kirti Biharie; added dataset import argparse parser = argparse.ArgumentParser(description="Load data for Mouse Brain (Sagittal-Posterior)") parser.add_argument( "-o", "--out_dir", help="Output...
2b9ee5d0ddaf89321e235a2a16498ef30d16939c63ae5e55271d344543ddd5cc
Python
5,840
139
# This extension template provides instructions to add new structure scores to pgmpy. # # Please follow the following steps: # 1. Copy this file to `pgmpy/structure_score/` and rename it as `your_score_name.py` (e.g., `my_score.py`). # Note: Do NOT start the filename with an underscore `_`, otherwise it won't be dis...
f874bfb65a54d983fecea04733a59d535d861ea7bbf37a33bb11e0bb97bc6e1a
Python
5,842
146
import filecmp import os import shutil import socket from pathlib import Path import requests __attr_ref__ = 'tests/test_files/attr_ref_table_for_tests.csv' __biotype_ref__ = 'tests/test_files/biotype_ref_table_for_tests.csv' def unlink_tree(dir): for item in Path(dir).iterdir(): if 'gitignore' in item....
bedc59be184f95bfc1eafff5e13d073344ec4ca75236248f6abfbfefed6dc994
Python
5,843
160
import tempfile import unittest from pathlib import Path try: from GMXMMPBSA.createinput import SanderAPBSInput, SanderGBInput, SanderMMInput, SanderPBSAInput except ModuleNotFoundError as exc: if exc.name == 'parmed': SanderAPBSInput = SanderGBInput = SanderMMInput = None SanderPBSAInput = Non...
0ffb1af5719f5aef107b8b5681006f1b774e94fc7baa396513e28fb5fcef4616
Python
5,844
169
#!/usr/bin/env python3 # 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 logging import os from pathlib import Path import shutil import torchaudio import soundfile as ...
ed3c75f4da5fd434817ab999c3a37f417e091bafb17262b764258628f85d7c51
Python
5,844
191
# 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 itertools import logging import re import time from g2p_en import G2p logger = logging.getLogger(__name__) FAIL_SENT...
ff786cac43c8f26f84bf1e153321aac26cd7c971da5a352a6ae94492516cc5df
Python
5,844
152
#!/usr/bin/env python3 """One-time helper to draft gmx_MMPBSA_test_manifest.json from example READMEs.""" from __future__ import annotations import argparse import json import shlex from pathlib import Path TESTS = { 3: ('Protein_ligand/ST', 'Protein_ligand/ST', 'Protein-Ligand (Single trajectory approximation)'...
8ea1f58159bfd4178fdb4fcc77648267bbae60fc9e4f913aad2b4cfe48135147
Python
5,847
147
import pytest from rnalysis.gui.gui_quickstart import * LEFT_CLICK = QtCore.Qt.MouseButton.LeftButton RIGHT_CLICK = QtCore.Qt.MouseButton.RightButton def widget_setup(qtbot, widget_class, *args, **kwargs): widget = widget_class(*args, **kwargs) widget.show() qtbot.add_widget(widget) return qtbot, wi...
b68161adf0f6b5be8a0353f8d6f3c00519689498e5cf7a62e4e762a67854ca8f
Python
5,847
162
# Copyright 2023 BioMap (Beijing) Intelligence Technology Limited 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 def exists(v...
80606889a611c6fc10db89b7d4f5173064ff2fddfaad4d9023b5367ca260006c
Python
5,848
182
import logging import os import vtk import slicer from slicer.ScriptedLoadableModule import * from slicer.util import VTKObservationMixin # # ImportACPCAutodetect # class ImportACPCAutodetect(ScriptedLoadableModule): """Uses ScriptedLoadableModule base class, available at: https://github.com/Slicer/Slicer/...
ad6be99959d5844e8280b0c9abf738b4405b433b58a1ee413431468d9fcd5a29
Python
5,851
247
class var_list: #From UI countoflistwidget = 0 list_toggle = 9999 #FROM BUTTONCLASS ********************************************************* #Main while loop condition keepalive = True #Stepper instances APmove = None MLmove = None DVmove = None AUXmove = None # OFFS...
026c9a4843cc2655431a47dacd025586fd00be21e0f31c93e9cab77822f50f77
Python
5,853
145
import slicer import qt import csv import os import numpy as np from PIL import Image # ===================== # DICOM/NRRD → JPG 変換 # ===================== def convert_nrrd_to_jpg(): file_dialog = qt.QFileDialog() file_dialog.setFileMode(qt.QFileDialog.Directory) output_folder = file_dialog.getExistingDir...
e6e2d791d8badccd982100d6edac7d3c275a49d9de5f1bfc96f3bbd7dc556d5b
Python
5,853
172
"""Helpers for GBNSR6-specific topology compatibility.""" from pathlib import Path import os import shutil DIHEDRAL_POINTER_INDEXES = (6, 7, 14, 17) _LJ_FLAGS = ('LENNARD_JONES_ACOEF', 'LENNARD_JONES_BCOEF') def prepare_gbnsr6_topology(prmtop, output_prmtop): """Create a GBNSR6-compatible prmtop copy. The...
8c9ad1bbb4cf37676e8a055d8750772348efefebbdf91c6b1fc948eed938345a
Python
5,854
138
import copy import logging import numpy as np from torch.utils.data import ( BatchSampler, DataLoader, RandomSampler, Sampler, SequentialSampler, ) from scvi import settings from scvi.data import AnnDataManager from ._samplers import BatchDistributedSampler logger = logging.getLogger(__name__) ...
eec75c2e4b7b791b121d8e00725c1eb2650e94b375b02056d87d4698c1386e03
Python
5,854
191
import os.path from typing import BinaryIO, Dict, Any from io import StringIO import threading import pandas as pd from utils.typed import PathLike from utils.align import MSA # # 原输入 # class FFindex(object): # def __init__(self, index_file: PathLike, data_file: PathLike): # super().__init__() # se...
b43ab690c08e4bffd84a47b361167496298697f9511bdf4a745bf305b5cfbdfc
Python
5,856
172
#!/usr/bin/env python # # Copyright 2009, 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...
d5bf25423ecce5bd5e1d988b74a20c262f6c5735861f930dd4578e6c6fa113cf
Python
5,857
139
"""Custom layers that are needed for the various models.""" from collections.abc import Callable from typing import Any from bpreveal.internal import disableTensorflowLogging # pylint: disable=unused-import # noqa from keras.layers import Conv1D, Reshape, Layer # type: ignore from keras.ops import convert_to_tensor i...
9952f98d1284b56c580fa66de415806ae05d8eaf0a6a0cf725536276f070e8de
Python
5,859
110
import os import json import pandas as pd import numpy as np from tqdm import tqdm from main_ds import correlation_cog, correlation_tau, ab_status_and_apoe4 def synthetic_analysis(data_dir): cog_results = {'all': [], 'CN': [], 'MCI': [], 'Dementia': []} tau_results = {'all': [], 'ab_pos': [], 'ab_neg': []} ...
c4bd12f1f5aebfcb02f563e40b9a522281fbc576a972dcb7693f5f2b723ac0e6
Python
5,863
194
from __future__ import annotations import json import re from typing import TYPE_CHECKING from typing import Any from urllib.parse import urlparse import pytest import responses from packaging.utils import parse_sdist_filename from packaging.utils import parse_wheel_filename from poetry.repositories.pypi_repositor...
6fece3e52e7175a5653d8e8d3463197b9d22f6fbee3026655a85a10c0befc9b9
Python
5,864
124
import sys sys.path.append("..") import torch.nn as nn from modelR.backbones.mobilenetv2 import MobilenetV2 from modelR.backbones.shufflenetv2 import ShuffleNet2_Det from modelR.backbones.ghostnet import GhostNet_Det from modelR.necks.conv_csa_drf_fpn_hbb import FC2_CSA_DRF_FPN from modelR.necks.yolo_fpn impo...
d831b7319578922144670975becaa8465295a8a888978292c4a88be22c353396
Python
5,864
194
#!/usr/bin/env python # Author_and_contribution: Niklas Mueller-Boetticher; created template # Author_and_contribution: Zaira Seferbekova; wrote the code for SCAN-IT import argparse # TODO adjust description parser = argparse.ArgumentParser(description="Method ...") parser.add_argument( "-c", "--coordinates", h...
165e20fc782b7a10b75551a94925ce2073a317a2b6ba6316ee5de64906e46d07
Python
5,866
199
import time import random import numpy as np from neuron import h from neuron.units import ms, mV from matplotlib import pyplot as plt import matplotlib.cm as cm import morphology_simplified as morphology #dlambda applied version of morphology # import singleCell.morphology as morphology import argparse import ...
6dc6ca5caa8124b841f43c2e1b6ffd92f26b10d7eab0eb0bb13e957b15cf06d8
Python
5,866
140
import celltype_ibl.models.linear_classifier as linear_probe import celltype_ibl.models.mlp_classifier as mlp_probe # from celltype_ibl.models.ACG_augmentation_dataloader import get_c4_labeled_dataset from celltype_ibl.utils.ibl_data_util import get_ibl_wvf_acg_pairs from celltype_ibl.utils.cell_explorer_data_util impo...
1afaa5f5bdf6d240e82ea66cfd2c69c9362696155ef33fb6507b3232586cef0d
Python
5,867
161
import os from typing import Optional, Any from collections import defaultdict import torch from simulation_encoder.logger import Logger from simulation_encoder.loaders.loader import Loader from simulation_encoder.loaders.dataset_utils.label_loaders import LabelLoader class ARCADELoader(Loader): """ Loader ...
4efee9c3683bcdc5b422c70d92a6e4f45e512118a8d704ef387b9608a7f409b2
Python
5,870
170
#!/usr/bin/env python3 # 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 torch from examples.speech_recognition.data.replabels import pack_replabels from fairseq import utils from fair...
42e77aaff1c3e2630f3bec6f2412dd40d97e334d31538d7c6a00b56a5bece63e
Python
5,874
177
"""S800: 800 abstracts with hand-assigned NCBI taxids, one per species span. The corpus `end` offset is inclusive and this package's is half-open, so `load_s800` converts and then checks every mention against the text it addresses: a one-character-short span tokenizes and matches nothing, lowering a score with nothing...
c5441da07b54f13176524845bda45e669fe29430d54e54472ece2345790a8c0b
Python
5,874
154
import numpy as np import pandas as pd import pytest from st_risk.eval.dual_axis import ( assign_dual_axis_quadrants, build_dual_axis_scores, dual_axis_correlation_summary, dual_axis_filter_strategy_masks, dual_axis_filter_strategy_summary, dual_axis_quadrant_proxy_summary, normalized_axis_...
df68f8551f120a7c878a94d0874f402f98a16a3d3b495802ccbff5252c8c561f
Python
5,876
150
from collections.abc import Iterable import numpy as np import pandas as pd def collect_state_names(data: pd.DataFrame, variable: str) -> list: """Return the sorted observed states for `variable` in `data`.""" return sorted(list(data.loc[:, variable].dropna().unique())) def build_state_names(data: pd.DataF...
35659099ce603e3d79066496e4a92a0d69902f7368901819d16c32e889659a23
Python
5,877
188
# coding=utf-8 # Copyright 2019-present, the 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/LICENSE-2.0 # # Unless required by a...
721c4871738288c05939657bc07278b6332daafdb727fd28ce00c0ad5a11a60d
Python
5,878
189
# coding=utf-8 # Copyright 2019-present, the 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/LICENSE-2.0 # # Unless required by a...
2cd5cbfa8becabda2a4f861b85c2ba51f5a125aaeaabcc1874610ac0e9de3b1d
Python
5,879
165
""" Per-window exponential-smoothing forecaster for fMRI ROI time series. This module exposes a lightweight sklearn-style adapter used by the shared LOSO cross-validation pipeline. Unlike the torch models, the forecaster does not learn global parameters during ``fit``. Instead, each call to ``predict`` fits a separate...
7e1906858aa67391434df72d8df3f39af2c9ef702743d579b7d62c4e1594160c
Python
5,879
145
import argparse import pandas as pd import numpy as np from typing import List, Tuple def read_file(tsv_file: str) -> Tuple[List, pd.DataFrame]: """ Reads the input 4-column cosine similarity existing pairs TSV file in a pandas dataframe, generates all the unique PMIDs and returns the dataframe. ...
aab8692fc3c0208fbbbc7a65678755eb89d554f81a47b62c9db336015a16995f
Python
5,881
160
# 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 class AdaptiveMask(nn.Module): """Soft masking function f...
29cf2d9f562e58d9dbae95afc2f33c2d8390501ea1bccc2e9b159982761c118a
Python
5,882
164
import sys from os import makedirs from os.path import join, dirname, realpath, exists current_dir = dirname(dirname(realpath(__file__))) sys.path.insert(0, dirname(current_dir)) import collections import pandas as pd from matplotlib import pyplot as plt import numpy as np from sklearn import metrics from sklearn.m...
ac83da9ce859b4c18ac61c236d871bc5de6ae67a84722049f5ae5e8d072e9b10
Python
5,883
178
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 7 16:08:58 2026 @author: tower4 """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 21 15:56:25 2024 @author: tower2 """ from sklearn import metrics import torch import copy import os import random import numpy as np from se...
59661a24a69d60abdb5438ae77953eb26278a3b68facf26f84e2278771e8a31d
Python
5,884
170
from neuron import gui, h from neuron.units import ms, sec, mV import morphology_simplified as morphology import time import random import argparse from datetime import datetime from controller import save_as_pkl from conductance_distribution import get_baseline_weight_distribution, get_altered_weight_distribution ...
874fccee86325efa30c2fa85636759d3198b0ff67a7c606f8468d6e6c6e9e448
Python
5,884
196
from __future__ import annotations import urllib.parse from collections import defaultdict from functools import cached_property from typing import TYPE_CHECKING from unittest.mock import PropertyMock import pytest from packaging.utils import canonicalize_name from poetry.core.constraints.version import Version fro...
3899b514f2fa97dbeda35ed7b3eb21dc21741eceb12a0e958f3187b915b6318f
Python
5,886
128
import argparse import os from image_processing_functions import ( apply_robustfov, apply_bias_correction, ants_linear_T1w_NM_registration, ants_normalization_to_MNI, transform_images_to_MNI_and_NM_space, compute_CNR_map, save_SNVTA_results ) def process_subject(nifti_dir, output_dir, subje...
000fcd40118dee613063d3fa93e009fff6bada3c8939ae887270694da9e32c99
Python
5,892
177
"""ICNet model directly taken from https://github.com/tinglyfeng/IC9600/blob/master/ICNet.py.""" import torch import torch.nn as nn import torch.nn.functional as F # noqa import torchvision class slam(nn.Module): # noqa """Spatial attention module.""" def __init__(self, spatial_dim): """Spatial at...
14265659f94a05a93f0f7acded326f41d1c84d82711a96f37bbce0c0b8d433f3
Python
5,892
156
import unittest import sys import shutil import os import io import gzip import re if "DEBUG" in sys.argv: sys.path.insert(0, "..") sys.path.insert(0, "../../") sys.path.insert(0, ".") sys.argv.remove("DEBUG") import metax.ThousandGenomesUtilities as ThousandGenomesUtilities def buildDummyPeople(): ...
86229a33e5c00f4f654bb7692f3ee6880468f18c35db82403adad098c2f49767
Python
5,892
171
import logging import os import shutil import tarfile import warnings import numpy as np from scvi import settings from scvi.data._download import _download from scvi.utils import dependencies logger = logging.getLogger(__name__) available_datasets = { "1.1.0": [ "frozen_pbmc_donor_a", "frozen_p...
ff1fe6d685a776b65959ffdecb1fbc99d0df03fb67f11c3702d59bd3bb9c0479
Python
5,892
131
"""Page 8: Target Session Analysis.""" 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, style_figure def render(store, dataset): st.header("Target Session Difficulty") st.markdown( "W...
1f8213f1a84e5a48eb12481d768c042578afb2dd20e2e9180b29d4386c0128f2
Python
5,893
122
""" Exception types deliberately raised by RNAlysis. This module imports nothing at all (not even from the standard library), so that it stays cheap to import from anywhere in the package, including hot paths and modules that are imported at startup. Every exception raised on purpose by RNAlysis inherits from :class:...
fb71a0d2a8ab16947674782e74c3ab935f6c25b1a217ef91baaa9d936b3e02c1
Python
5,893
141
""" BSD 3-Clause License Copyright (c) 2017, Prem Seetharaman 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...
ca3f98b3f1cf63c48fddb05ca54135c5605a8ccc1c3c08a582b9f5032d7afe10
Python
5,894
162
# Copyright 2018 The Lucid Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
37d48fb45053032cdf431fdb306f576ded5720c6fd826fd32bebf5e3caa2ca29
Python
5,897
102
## A pipeline for the ROI-based analyses # # written by S-C. Baek # update: 16.12.2024 # ''' The following code is to replicate the results of the ROI-based analyses in the paper. To run this code, all python toolboxes in 'requirements.txt' under MAINDIR should be installed. (Note: MAINDIR is a path to this repository...
8c3eae06ead1f34471bcb08a4a22e26e3ee614b7f019bcb08babe23839584eb1
Python
5,897
156
import zarr import pyvips import argparse import numpy as np import multiprocessing as mp from pathlib import Path from einops import rearrange def get_ome(im, pth, check_alpha=True, is_small=False): r""" Convert the pyvips image to *.tif such that the output is comptabile to QuPath Args: ...
c207aff9fad2ea252e263db0230c042845538c7c34a2f5b0adc591a3d97f58a6
Python
5,897
172
"""Module to mock data needed for several tests to run""" import array import os import tempfile import h5py import numpy as np import pysam from medaka import common # Ref A C A T * G A T G # # Basecall1: 2A 1C 4A 5T 1G 1A 2T 1G # Basecall2: 0A 1C 4A *...
839efe5f1bc42acbab766f59076a1e4d66e65a847103fed2d3c3ea5a46f95bc4
Python
5,901
154
import argparse import os import cv2 import numpy as np import torch from torchvision import models from pytorch_grad_cam import ( GradCAM, FEM, HiResCAM, ScoreCAM, GradCAMPlusPlus, AblationCAM, XGradCAM, EigenCAM, EigenGradCAM, LayerCAM, FullGrad, GradCAMElementWise, KPCA_CAM, ShapleyCAM, FinerCAM, Seg...
68ec7a7c3392d63ec007313a58ce73cabffef06fe279e288707eefa9d28e9c51
Python
5,909
173
# Plot results from the 'many-parameter' simulation import numpy as np import matplotlib.pyplot as plt font = { 'size' : 20} plt.rc('font', **font) #%% Plot parameters fig_width = 3.5 fig_height = 5 legendfontsize = 15 linewidth = 2.5 #%% #where to save the figures into figpath = '/Users/iivanaj1/Library/CloudSt...
ee06cec9b81e18688948ef4e4400458ce08373fc94766e6e97a2796da673197b
Python
5,911
165
import logging import os import re import sys from typing import Any, Dict, List, Optional, Union import yaml class Punchcard: def __init__(self, name: str, parent: "Punchcard" = None, subsets: List["PunchcardSubset"] = None, children: Dict[str, "Punchcard"] = None) -> None: self.name = name self.parent = paren...
f249a697083bc2fb727577dd0855c2b0e8a4394a71293c22cd58c537e15bda7f
Python
5,911
115
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'UI/SimpleCorrUI.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): Form.setObjec...
e8a456cd3054780a84d420c9c51d058fedcd9d6c63b23b80a5276ab3f18a7f5b
Python
5,912
175
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 21 17:55:53 2024 @author: tower2 """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 21 17:30:46 2024 @author: tower2 """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 21 15:56:25 2024 @author: tower...
42b95ac9fc2d315f70fabfeeae9fffb09b9ef5b1a96d3f8ec4a8cbe61d91687a
Python
5,914
190
""" @file utility.py @author Simon Yu @date 01/26/2023 @brief Utility functions. """ import datetime import header import logger import natsort import numpy import os import random import socket import torch import torchvision import wandb def applySoftmax(output): return torch.nn.functional.softmax(output, ...
4824899631db82e4a38be063cca820800b16f0279552dbbb7358aee98ba5d3cf
Python
5,914
154
"""Utility classes for tracking and averaging during network simulation.""" import numpy as np import numpy.typing as npt class Tracker: """Records a target array over time, compressing samples by averaging. Records ``length * compress_len`` raw samples, compressed (averaged) into ``length`` stored entr...
9d0d4cfce3fd0dc2a88d004418494a430f13cc74803a4db6feabbbe37f845615
Python
5,919
133
""" plot_GSE144744_kaufmann_celltypes.py -------------------- Re-render Ramesh 2020 figures with a clearer palette using the cached adata_ramesh_umap.h5ad. Avoids re-running the slow UMAP step. """ import warnings from pathlib import Path import numpy as np, pandas as pd, scipy.sparse as sp import anndata as ad import ...