sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
05b8f5061e8c447abe4b79841e95f46b7ec5be7e74d217c12d99ef181959686f | Python | 41,798 | 1,093 | import json
import os
import sys
import time
import unittest
from typing import Any, Dict, List, Optional
from unittest.mock import MagicMock
import jsonschema
import pytest
from ray.autoscaler._private.kuberay.node_provider import (
KUBERAY_KIND_HEAD,
KUBERAY_KIND_WORKER,
KUBERAY_LABEL_KEY_KIND,
KUBE... |
0158e4ee8e3bd1fe65869a3dcdae2a7072754e44a2a4b7b81c373559bff3c6b1 | Python | 41,950 | 1,261 | # Copyright 2024 The bayesnf Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
58b00c5e6e1f2322b6641d6b894b9cc696beb58d507dca2e1961501fecf55763 | Python | 42,040 | 1,124 | '''
Tools for managing Michael's physiology data
'''
# pylint: disable=C0103, R0912, R0914
import subprocess
from itertools import product
from inspect import isclass
from pathlib import Path
from math import ceil, isnan
import pickle
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
from matp... |
822bcd1b0058b80a1f7c0048f66f00b16e9eb59a4d6eb24bbcbf77faa698ff20 | Python | 42,042 | 642 | from functools import reduce
import sys
from typing import List, Tuple, Dict, Union
from einops import rearrange,repeat
from torch.types import Number
from utils.Typing import CompressFrameworkOpt,ModuleOpt
from utils.Networks import init_phi,init_gmod,init_hy,init_emy,init_gy,init_emz,init_emyz,init_hz
from utils.io i... |
38c59f48dc2d9d21151e788348f3e236af564695f80d2f3413f948e3c8a2261c | Python | 42,058 | 1,079 | # encoding: utf-8
r"""
Retina/LGN model based on that developed by Jens Kremkow (CNRS-INCM/ALUF)
"""
import pylab
import numpy
import os.path
import pickle
import mozaik
from pyNN import space
from mozaik.models.vision import cai97
from mozaik.space import VisualSpace, VisualRegion
from mozaik.core import SensoryInput... |
c65be789fdabd606e08b8739381f968f3e9f8ff73fcbfed16fe76632def7abcb | Python | 42,099 | 1,137 | """
The following code is a modification of a hierarchical losses implementation first published at https://github.com/jvlmdr/hiercls
"""
from functools import partial
import numpy as np
import collections
import csv
import itertools
from typing import Callable, Hashable, Optional, Sequence, Tuple, TextIO, cast
impor... |
df82f204fe3f374c3a1d8e1fe5c415848c43947726f56905f790fb212279e076 | Python | 42,130 | 1,190 | import os
import numpy as np
from mozaik.experiments import Experiment
from parameters import ParameterSet
from mozaik.stimuli import InternalStimulus
from mozaik.stimuli.vision.topographica_based import FullfieldDriftingSquareGrating
from mozaik.experiments.vision import VisualExperiment
from mozaik.tools.distribution... |
65f888e1863ab00b7d2dee3326d5b3828e9747e2d8a9697b5cc97c224c18bd9d | Python | 42,150 | 890 | # util.py
import scipy.signal
import os, io, warnings, math, scipy, numpy as np, pandas as pd, matplotlib, PIL, seaborn as sns
import matplotlib.pyplot as plt
from PIL import Image
def check_modules():
'''
Check module version for STARDUST.
'''
tracking = 1
if scipy.__version__ < '1.11.0':
... |
d101605f81458c72d4b797b226a340430dfd606068f98bbcd33aff0cc59645e4 | Python | 42,176 | 1,174 | """
FilesystemContextManager - Filesystem-based context engineering for OmicVerse agents.
This module provides a filesystem-based context management system that allows agents to:
- Write intermediate results and notes to a scratch pad
- Selectively retrieve relevant context using glob/grep patterns
- Compress and summ... |
1484df5d947d3dfb36f385210195f8998b2b84eb0f168fbaa1be30054159a137 | Python | 42,212 | 902 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
# Copyright (c) 2022, 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
#
# http://www.a... |
61a7e53cacac21733ddbc649c9f21cc1b05626430d67a155e494e56ba9184b0c | Python | 42,251 | 1,018 | r"""The Learn → Design bridge: constrain a GEM with measured expression.
``ov.bulk`` / ``ov.single`` produce expression; ``ov.synbio`` holds a genome-scale
model. Until now there was no path between them — the GEM answered "what could
this organism do" while the omics answered "what is it doing", and nothing joined
th... |
5ff7debd9149927bc0b73d769a06269bece01a1fc67b4d1a00b05646c821ed0b | Python | 42,262 | 1,300 | import os
import warnings
warnings.filterwarnings('ignore')
from typing import Callable, Iterable, Optional, List, Union,Dict, Literal
import collections
import numpy as np
import anndata
import torch
from torch import nn as nn
import torch.nn.functional as F
from torch import logsumexp
from torch.distributions import... |
61e97c944fb531884ccfb8cff95183fccba1de11e0cd3c2a2110a09a167a6b78 | Python | 42,448 | 1,136 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" List of plotting functions to visualize what's happening in the code """
#\package Caiman/utils
#\version 1.0
#\copyright GNU General Public License v2.0
#\date Created on Tue Jun 30 21:01:17 2016
#\author: andrea giovannucci
from builtins import str
from builtins ... |
bc6c97575a0862780eee86b957a705070644de96af0fc98f0f6ab36095b49500 | Python | 42,466 | 1,081 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
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 annotations
import itertools
from contextlib import ExitStack
from dataclasses import dataclass, replace
from datet... |
5fff365d8d83d699e9e2c54962eef0881b94780eaa1df11d3f18084b3dc3ddc3 | Python | 42,553 | 1,092 | r"""Layer A entry point — build a GEM for an organism that has none.
:func:`load_gem` can only *read* a model that already exists. Hand it an
in-house industrial isolate and the whole layer-A chain stops at step one,
because BiGG has no model for it. These functions close that gap:
* :func:`reconstruct_gem` — draft a... |
b42aefec0716c15bd729cdb2dd99b716aa1fca14fd300f700287786716065a53 | Python | 42,567 | 1,199 | # Copyright 2023 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
f8e3b8b4de42a0d0fb4fc24fecdd6d81bd1e9e42ed3fc1fd62e76f392ffd97d3 | Python | 42,653 | 1,173 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 20 14:44:00 2022
@author: ju-bar
Functions handling input and output of structure data
via the CIF file format.
The CEL file format is a text format used here to define a volume
in space which is filled by atoms.
CIF file structure is interpreted according to the CIF di... |
10d722bb3d98d5250dacfe8c1595162f97f40ed0eff521b6f23c759437cf0ad1 | Python | 42,657 | 1,194 | #!/usr/bin/env python
"""
Created on Wed Aug 05 20:38:27 2015
# -*- coding: utf-8 -*-
@author: agiovann
"""
# noinspection PyCompatibility
from past.builtins import basestring
from past.utils import old_div
from builtins import zip
from builtins import map
from builtins import str
from builtins import range
import ... |
f6511794894188a61fec5c81eb43a5cc3a286a7f769850267f9ce2d5bfe73131 | Python | 42,790 | 1,114 | import glob
import logging
import os
import re
from functools import lru_cache
from typing import Dict, List, Optional, Set, Tuple
import requests
import ray
from ray._private.accelerators.accelerator import AcceleratorManager
from ray._private.ray_constants import env_bool
from ray.util.placement_group import (
... |
5f28da8952075cacdd43f3ef2ce00ab1b03837e4a444e0b1ace0895d5ca003fa | Python | 42,822 | 1,010 | r"""The **L** in design-build-test-learn — and the arrow back to **D**.
``ml_guided_design`` scores variants in one shot. That is a Learn step, but it is
not a *cycle*: nothing chooses which experiments to run next, and nothing carries
what round *n* measured into what round *n+1* proposes. Without those two pieces
DB... |
72a9eaf6bd8632e425cfa13670c653ff47b04ec1e71415b010db857f96167807 | Python | 42,837 | 833 | #saves arrhythmic time series
ar_pix_val_ts.to_csv("./Results_" +str(filename_raw)+ "/Arrhythmic Traces.csv")
#saves smoothed Traces
pd.DataFrame(xov_smoothed).to_csv("./Results_" +str(filename_raw)+ "/Smoothed Traces.csv")
#plots randomly selected time series used for crossover analysis (sigma = 3)
if len(xo... |
973ee9cb22b4a340988299c1d6347823ac321804717a030e1a921d7b989455c4 | Python | 42,870 | 1,043 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. 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/LI... |
3e3bb54bfe937c7e85a46e62ddeb8c6a161fa06ea8d0fd7c6407454f733800e7 | Python | 42,926 | 1,218 | '''!
@file k4atypes.py
Defines common enums and structures used in the Azure Kinect SDK.
These enums defined here are analogous to those defined in k4a.h.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
'''
from enum import IntEnum as _IntEnum
from en... |
9ae16825717e9193aa167afe5355b5283cb9c5fb93e424be5017fa5e936accfa | Python | 42,943 | 1,105 | """Using LLMs from transformers for zero/few-shot learning
Open tasks:
- Have a "fast/greedy" option for predict - it is not necessary to calculate
probabilities for all classes up until the last token. When class A has
probability p_A and class B has p_B(t) < p_A at token t, then no matter what
the probability... |
4896e97c967f0d18972f1bb9f1039062393228ccc1a276c0af9ccd7b09ffb218 | Python | 42,966 | 1,037 | #!/usr/bin/env python3
import copy
import os
from typing import Tuple, Union
import deepspeed
import numpy as np
import torch
from deepspeed.constants import TORCH_DISTRIBUTED_DEFAULT_PORT
from fire import Fire
from ignite.contrib.handlers import ProgressBar
from ignite.contrib.metrics import GpuInfo
from ignite.utils... |
090e9d3400277fd713c5633942db2c103abc047fde26926c73cdc47244f53485 | Python | 42,975 | 932 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
4271c305bd71efe8c10dfe7ce871a2a6223ae2d371bfff8a9aed2bddc128b055 | Python | 43,060 | 1,106 | """CodegenPipeline — code generation, extraction, review and reflection.
Extracted from ``smart_agent.py``. ``CodegenPipeline`` owns:
* Code extraction from LLM responses (fenced blocks, inline heuristics)
* Direct-Python request detection
* Code-only agentic-loop orchestration (``generate_code_async``)
* Lightweigh... |
7b0adaf3f30842c36ea6b02786ef381df797432daa0ddca59fc72b5a025ddbb0 | Python | 43,135 | 1,141 | """Nanostring spatial plotting utilities for OmicVerse.
Multi-FOV composite visualisation for Nanostring SMI (CosMx) data.
Cells are rendered in the global coordinate space (``obsm['spatial_fov']``)
so that all selected FOVs are stitched into a single figure with their
background images placed at the correct positions... |
e297e4a038a8bd4fca1584fe03291b120c6db922db877f4e9f6de560f3b6f00f | Python | 43,160 | 1,175 | r"""
Pyomic data (Pyomic.utils._data)
"""
import time
import requests
import os
import pandas as pd
from ._genomics import read_gtf,Gtf
import anndata
import numpy as np
from typing import Callable, List, Mapping, Optional,Dict
from ._enum import ModeEnum
from scipy.sparse import diags, issparse, spmatrix, csr_matrix... |
a729d7402c43ccdf2b1e6e275468b4d9a71ca52c66ad59c705013479505488a4 | Python | 43,164 | 1,049 | """Statistics of how spatial neighbours are arranged.
`ov.space` could already say *what is where* — domains, deconvolved cell types,
spatially variable genes. What it could not say is *how the things are arranged
relative to each other*: whether two cell types touch more often than chance,
how far apart their influen... |
3456918aeb0983b8c446f7a24fae8594c58679afe585f407170eee9857c08be3 | Python | 43,243 | 1,063 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. 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/LI... |
5f95f2ead1185db46424cd3a3ab116293f5882e37e25f4c46776ab402a1f2bc3 | Python | 43,243 | 1,127 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
cedf9329ec1249576cc174875d754e243ab3475ba7d2e459d400fe0318165d57 | Python | 43,270 | 999 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as st
from typing import Sequence, Union, Optional, Literal, List, Tuple, Any
from matplotlib.axes import Axes
from collections import OrderedDict
from .._registry import register_function
from ._plotdata import accepts_frame
from... |
b4bdc47686ac8fb32b037e50468fcc563010e62606994b421de177549026a4a7 | Python | 43,341 | 1,002 | #!/usr/bin/env python
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. 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/LI... |
9b258e817b0234b4147f434e559c1068909bc8d5f8b14dc2a5256ab3220e4990 | Python | 43,352 | 1,241 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Configuration for NVM devices for Analog (Resistive Device) tiles."""
# pylint: disable=too-many-instance-attributes, too-many-lines
from dataclasses import... |
81fe4369fc2f293d24a075f73bda87ec7919e90bd9275573e4c69e904b7ae3fc | Python | 43,420 | 1,092 | import os
import scanpy as sc
import pandas as pd
import numpy as np
from typing import Optional
from ._SCSA import Process,Annotator
import sys
import argparse
import gzip
import time
import requests
import anndata
from ..pp._preprocess import scale
from ..utils import gen_mpl_labels
from .._settings import add_refe... |
3654bd622e76a3d2e9c689566e4de968fcf59fbb0bb466afdbfc50d793dcde77 | Python | 43,432 | 1,162 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" List of plotting functions to visualize what's happening in the code """
#\package Caiman/utils
#\version 1.0
#\copyright GNU General Public License v2.0
#\date Created on Tue Jun 30 21:01:17 2016
#\author: andrea giovannucci
from builtins import str
from builtins ... |
3c99d06327807616bf6b337db9a702ca43a00caaf991367b2e934f9bf8b0aa82 | Python | 43,433 | 1,105 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
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 annotations
import logging
import os
import time
from copy import deepcopy
from dataclasses import dataclass, field... |
087245928981c7802579c7e4fb93d59cf07fd4079956d61e3e11a1a78aae7380 | Python | 43,476 | 1,199 | # Copyright 2023 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
d37f46b50d59ef4808e6acd68f6e88694963db05f2e2cca4acf69e03cf2fb175 | Python | 43,505 | 766 | import numpy as np; np.set_printoptions(precision=4); np.random.seed(0)
import torch; torch.set_printoptions(sci_mode=False, precision=4)
import torch.nn as nn
import matplotlib.pyplot as plt; plt.rc('font', size=15)
import matplotlib
from matplotlib.font_manager import FontProperties
from mpl_toolkits import mplot3d
... |
983ed76fa67b5c976d8148264ba060dc0356649148cf4070412b0591d05aed01 | Python | 43,528 | 1,217 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""aihwkit example 33: Example using weight programming optimization to improve BERT transformer
accuracy on SQuAD task. Weight Programming Optimization impleme... |
e683fe65ebb9190c7a5bbb28dc281d2b71dadb1ea22efd5bec90bc00d47ff5a5 | Python | 43,541 | 1,230 | # Copyright 2023 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
336f364357412dcf63c82af60f758cbb4dbf3a6d8a6af330c647d0cd3f60a25f | Python | 43,578 | 1,015 | # coding=utf-8
# Copyright 2023 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 applicable... |
124a75efba04629157314f86bbaab8862ea6ec89d2ea2bf0e17acd0cedde8571 | Python | 43,590 | 1,027 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. 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 r... |
f8dc1d5cc51f61b5f05a10973fdeaab774c712bf45cfd993dd3ad031abd40c47 | Python | 43,590 | 1,256 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
d872a2bd784413938471038e1e1ee475647ff6a7b1574b250b15722b3696cb13 | Python | 43,629 | 1,205 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
3abbe552812ec8204d3eed4827c2ed269d1112ed8f2bf1a4e2ec7e058a7d8bb4 | Python | 43,634 | 1,203 | import json
import os
import numpy as np
import h5py
import tensorflow.keras as keras
import tifffile
import nibabel as nib
import glob
import math
class MaxRetryException(Exception):
# This is helper class for EmGenerator
pass
class DeepGenerator(keras.utils.Sequence):
"""
This class instantiante t... |
4ffd1cf54ef1891d25c49f5afd7cce1d715d9c2ed10a819dac0886ca50b30b17 | Python | 43,704 | 1,247 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
5fe131ab527fd6c73f6a68315813be99f8bc12a8a5b2fa582874d13e4203b883 | Python | 43,739 | 913 | '''
File name: Isonet_star_app.py
Author: Hui Wang (EICN)
Date created: 4/21/2021
Date last modified: 06/01/2021
Python Version: 3.6.5
'''
import sys,os
import logging
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QTableWidgetItem,QMessageBox
from PyQt5.QtCore imp... |
2dcc3a5d30b58f140a2fbd893e823a65c1773d93636e02cd33516b8f427f2e43 | Python | 43,770 | 1,062 | # -*- coding: utf-8 -*-
"""
"""
matplotlib_colors = {
'acid green': (0.561, 0.996, 0.035),
'adobe': (0.741, 0.424, 0.282),
'algae': (0.329, 0.675, 0.408),
'algae green': (0.129, 0.765, 0.435),
'aliceblue': (0.941, 0.973, 1.0),
'almost black': (0.027, 0.051, 0.051),
'amber': (0.99... |
daa279af5b859250f7bd2c4df4b3cc1de11a636669debabe5b3871b074e21b7e | Python | 43,788 | 1,201 | # Copyright 2024 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
4edcc87f6b7351535c9d4f2b318cc5c18b1cf1842100e10b57a5eb8b9dedfee4 | Python | 43,823 | 952 | import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import matplotlib
from .._registry import register_function
from ._plot_backend import style_axes
@register_function(
aliases=["火山图", "volcano", "volcano_plot", "差异基因可视化", "火山图绘... |
8a43e6dad7f414ae994375a2350054ec52d6240a2b291a4f0fefe3b7654fb973 | Python | 43,903 | 976 | # from https://github.com/berenslab/RFEst
# ORIGINAL LICENSE
'''
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, b... |
c929fe2ad0de9954e2f9e9ba0154e0bc44f38a1fdc24830c380abaa412c7ff7a | Python | 43,992 | 949 | import logging
import os
import numpy as np
import scipy
from scipy.ndimage.morphology import generate_binary_structure, iterate_structure
import caiman.utils.utils
from ...paths import caiman_datadir
from .utilities import dict_compare, get_file_size
from pprint import pformat
class CNMFParams(object):
"""Class... |
d2321909dcf12b202ffb91164343b285d21439d4e2d5ae992b680faaecd41380 | Python | 44,021 | 945 | #!/usr/bin/env python
import argparse
import sys
import os
import fnmatch
import json
import time
import tempfile
import shutil
import pprint
import subprocess
from typing import Union, Iterable, Mapping, Optional, List, Tuple, Set, Dict
from types import MappingProxyType
program_operation_description = """
The high-... |
c68dbb79b1632a71dfa790184919f2da81d0a364963572c2dc0ff6500fcda5e1 | Python | 44,066 | 1,184 | # Copyright (C) 2020-2022 Intel Corporation
# Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import io
import os
import os.path
import pickle # nosec
import tempfile
import time
import zipfile
import zlib
from collections.abc import Callable, Collection, Generat... |
63e51e18794e72d902a0f444e3f39ff34fc5a6ee09d371cfdc4c1fc201cdb4ac | Python | 44,114 | 976 | #prototype dlib v3
import csv
import datetime
import math
import os
import sys
import time
from multiprocessing import Process, Queue
from subprocess import Popen
import cv2
import dlib
import matplotlib.pyplot as plt
import numpy as np
from PyQt5.QtWidgets import (QApplication, QCheckBox, QDesktopWidget,
... |
f7f874bae91bb4570bfaae27b98d110c5b706b856a81b850c45d0e0b7166f41e | Python | 44,174 | 1,285 | import numpy as np
import scipy as sc
import matplotlib.pyplot as plt
import pickle
import settings
import os
from scipy.stats import multivariate_normal
from scipy.signal import convolve as convolve_sc
from joblib import Parallel, delayed
from tqdm import tqdm
from mpl_toolkits.axes_grid1 import make_axes_locatable
fr... |
b31d81ef743ee2a27f693af989a48b81e058971828afebabd266e42b0a1f7f09 | Python | 44,216 | 1,043 | import numpy as np
import pickle
import random
import glob
import sys
import csv
import time
import os
import wandb
import sklearn
import torch
import datetime
import cv2
import sklearn.metrics
import os
from timeit import default_timer as timer
import json
from matplotlib import pyplot as plt
impor... |
bf30070fcbc0ca38524c6c4060a4a038dce5a94ea8567987a6554adbca554d33 | Python | 44,234 | 1,220 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from typing import Union, Tuple
import tqdm
def apply_masked_mse(masked_mse_module,
gt_images: np.ndarray,
recons_images: np.ndarray,
batch_size: int,
... |
0280073521f79a7face67bb408b348d68777ebd18d3bee3107d44842f39da4fd | Python | 44,335 | 888 | from ._registry import register_function
from ._optional import normalize_torch_device
class omicverseConfig:
def __init__(self,mode='cpu'):
self.mode = mode
self.seed = None
# Preferred torch device (e.g. ``'cuda:1'``) when the user pins one via
# ``cpu_gpu_mixed_init(devices=...)... |
5fdd99bd22cf6ac794308896fa1f1eb6ba24398220b570a1cc113341706fee43 | Python | 44,388 | 1,291 | """
Session-Based Notebook Executor for OmicVerse Agent
This module provides persistent notebook session management for executing
generated code across multiple prompts while maintaining context and state.
Key Features:
- Session-based execution (variables persist across prompts)
- Automatic session restart after N p... |
a94f8a359f2cc45198af1ff2d944748304554f4ec4802f8bf2d1b678b6378aa3 | Python | 44,519 | 995 | import numpy as np
import torch
import torch.nn as nn
from typing import Callable, Optional, Union, List, Tuple
from new_style_optim_encoder.glm_components import _movie_spatial_stimulus_contrib_gensig, \
_multimovie_spatial_stimulus_contrib_gensig, _movie_timecourse_stimulus_contrib_gensig, \
_multimovie_ti... |
cd74b21964f01113b4af09f1ad1c51fa4aa3a5314cd8734d7c405e34160cb558 | Python | 44,537 | 813 | """
_*_ coding: utf-8 _*_
"""
import pandas as pd
import numpy as np
import os
import pickle as pkl
import json
import copy
import re
data_folder = '[your directory]/AMP-PD/2019_v1release_1015/'
class DataPreparation:
def __init__(self, cohort_name, table_list):
self.table_list = table_list
pa... |
2b96dd4d44cb7f727ef7476f4c014ff3d5ebed95ca68de8d18a7bc0183a0f0ee | Python | 44,640 | 933 | # Inspired by: https://github.com/haofanwang/ControlNet-for-Diffusers/
import inspect
from typing import Any, Callable, Dict, List, Optional, Union
import numpy as np
import PIL.Image
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers import AutoencoderKL, ControlNe... |
884fd023348d00d697cbe9079d65396c619b33196e362fffb3e55a91aaac5801 | Python | 44,653 | 924 | # Copyright 2023 The HuggingFace Team. 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 applicabl... |
26ac2153580293317c35da2c80207ae9a7afc5ddc8bd461c3fcafdd4088ce385 | Python | 44,837 | 1,025 | # -*- coding: utf-8 -*-
"""
PyAGTUM - Main program for controlling ATUM and Leica for Serial Section Acquisition
This program is designed to control a Leica UC7 microtome and RMC ATUM. It stores various
important data like the position of the Leica cutting arm (whether it is in the cutting
window or not) a... |
b058ac6543a498780965ef5ad0ca90eae9872ff2bc78acffae03dc7e72134af8 | Python | 44,842 | 839 | from dataclasses import dataclass
import numpy as np
from typing import Optional, Dict, Union
from basis_functions.time_basis_functions import make_cosine_bump_family, backshift_n_samples, \
trim_basis_reduce_condition_number, trim_basis_by_cond_index, basis_shift_forward
from basis_functions.spatial_basis_funct... |
c2ad266408f1e4986088d7992fd9966eda3f07edc77199a0eb3b5aa2171bb1c7 | Python | 44,852 | 1,102 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
From KERAS package
Fairly basic set of tools for real-time data augmentation on image data.
Can easily be extended to include new transformations,
new preprocessing methods, etc...
"""
from functools import partial
import multiprocessing.pool
import numpy as np
import... |
dcbbba2524b4d08d1df470132cb53e97b65e28b44ef648abe06bd1b6b2889268 | Python | 44,863 | 996 | # Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
# and Applied Computer Vision Lab, Helmholtz Imaging Platform
#
# 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 L... |
c1289dfb9636ad9b0070d615732973f26a305351fc57c46a4ade39dcf3a321ef | Python | 44,950 | 1,219 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This library is fre... |
9b6541705d0c5aed8d62f010e51d341eaecb0bff4a15ad04621b74f026793938 | Python | 44,995 | 1,326 | #!/usr/bin/python
# file: webdoc.py
# author: Andrea Vedaldi
# description: A website formatter utility
# Copyright (C) 2007-13 Andrea Vedaldi and Brian Fulkerson.
# All rights reserved.
#
# This file is part of the VLFeat library and is made available under
# the terms of the BSD license (see the COPYING file).
impo... |
15ac78412b088bfc885020fc6629a70c570d1f7e67d54460d1445b25d791b91e | Python | 45,063 | 1,111 | from sklearn.cluster import AgglomerativeClustering
from sklearn.decomposition import PCA
from sklearn.cluster import KMeans
from scipy.stats import rankdata
import scanpy as sc
import pandas as pd
from anndata import AnnData
import warnings
from builtins import int
warnings.filterwarnings('ignore')
from . import los... |
6f4b72f5006276355078eba975a1d6f5429cee2cd2c5bb65f9baec4452fe59df | Python | 45,220 | 963 | import os
import numpy as np
from scipy.stats import rankdata
from scipy.special import binom #faster than comb
from ._df_apply import gen_row,gen_col,apply
from functools import partial
chunkSize = 100
#Function to index flat matrix as squareform matrix
def dist_index(i, j, matrix):
if i == j:
ret... |
c4f4a22f8af00049ae11ea92efbf982acf334099501e91c2814763acc7365f64 | Python | 45,229 | 1,145 | # Copyright 2026 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
8e41ac10abcfb957bccced304a5b985e9dc3e3823adae58fdd24747de845365b | Python | 45,280 | 1,261 | # coding=utf-8
# =============================================================================
# Copyright (c) 2001-2021 FLIR Systems, Inc. All Rights Reserved.
#
# This software is the confidential and proprietary information of FLIR
# Integrated Imaging Solutions, Inc. ("Confidential Information"). You
# shall not di... |
d783d166a560de25bad12bccda97e6f7e6aef7a523a451f286b291a2935a311f | Python | 45,515 | 1,200 | import copy
import random
import gc
import itertools
import logging
import pickle
import sys
from pathlib import Path
from pprint import pformat, pprint
from tempfile import TemporaryDirectory
from typing import Dict, Optional, Tuple, Union
import re
import click
import math
import numpy as np
import optuna
import pand... |
d0b95a44d5a3fa57fb37f4d1cc88d321f06b3b613ceb6958d1e787882b5aed01 | Python | 45,543 | 1,232 | import os
import pickle
from itertools import chain, repeat
from collections import defaultdict
import networkx as nx
import numpy as np
import pandas as pd
import torch
from rdkit import Chem
from rdkit.Chem import AllChem, Descriptors
from rdkit.Chem.rdMolDescriptors import GetMorganFingerprintAsBitVect
from torch.ut... |
de3f319c026fbf7820a8aab3105f0059d7a493d87b9a85b913e55f88e78c7ea5 | Python | 45,549 | 976 | import numpy as np
from scipy import signal
from scipy import stats
from numpy import trapz
from pandas import array, DataFrame, cut
import statistics
import constant as constant
def importDataFile (debug, directory):
"""
Imports smoothed data from the google notebook.
Input directory of the dat... |
4a07deb8134d78d6388541c39704310cb7ce07f0487147932a64eecd2d1fe519 | Python | 45,605 | 1,242 | """
In-memory session state management for MCP tool execution.
Manages ``adata_id``, ``artifact_id``, and ``instance_id`` references so that
AnnData objects and class instances never cross the MCP protocol boundary.
Supports session-scoped isolation: each handle belongs to a session, and
cross-session access is rejec... |
ca513600ae01327359e310eae9d25513068090cdd5175172879cc4310b0d19bd | Python | 45,620 | 1,086 | import numpy as np
import nibabel as nib
import datetime
import os
import shutil
import json
import math
import re
from bruker2nifti.converter import Bruker2Nifti
from threading import Thread
import subprocess
from elikopy.utils import makedir
from dipy.denoise.localpca import mppca
from dipy.io.image import load_n... |
6eb43dd2a86350469a9741f3d0865abc1fb87f90df002e5de0be8b57684d3416 | Python | 45,641 | 718 | # arguments.py
#
# Command Line Arguments for Machine Learning 4 CardioVascular Disease
# Shared by recipes.py and other command-line runnable files.
# These arguments are a bit of a hodge-podge and are used promiscuously throughout these files.
# Sometimes code overwrites user-provided arguments to enforce assumptions... |
7d075191a5c9b78d8e059e76d8b765cb9a1f0fe11711a0eeb81cd8964f40bb76 | Python | 45,710 | 1,115 | """
Geneformer in silico perturber stats generator.
**Usage:**
.. code-block :: python
>>> from geneformer import InSilicoPerturberStats
>>> ispstats = InSilicoPerturberStats(mode="goal_state_shift",
... cell_states_to_model={"state_key": "disease",
... "start_state": "dcm... |
974fe15a5e2dc463ea57ee797b9dbc9ecd4f2053e5c6489cd5aab7dc529493a6 | Python | 45,716 | 1,060 | from .._settings import add_reference, EMOJI, Colors
import numpy as np
import scanpy as sc
import pandas as pd
from .._registry import register_function
def _validate_count_layer(adata, requested_layer, label, method='cell2location'):
"""Resolve a count layer and reject continuous/invalid count inputs."""
f... |
83a4abac042ff4e943d9f75111193898591118473572ae29be7a39caf766221a | Python | 45,727 | 1,057 | # If using multiprocessing, this module will be imported dynamically
import logging
# no need to set handler here, since we already set handler in root logger (utils.py), this child logger inherit that.
logger = logging.getLogger(__name__)
logger.info('Import event_models.py')
import numpy as np
import tensorflow as... |
f1fca156fa658700d8896bc2476321c56e3a6a8069e4077b2d7587eab78d76a7 | Python | 45,765 | 1,180 | import scanpy as sc
import pandas as pd
import anndata
import numpy as np
import time
import numpy as np
from scipy.sparse import issparse, csr_matrix
import igraph
import torch
from tqdm import tqdm
import sys
from ..utils._neighboors import update_rep, eff_n_jobs,neighbors,W_from_rep
from .._settings import add_refer... |
75c290a8f88cd9e6622998e480936f8d7446f9175703ad9c52dfce029d042782 | Python | 45,791 | 765 | # Copyright 2026 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
f810ff43d4bc8b8cec9b300227d88be28afb385f31317879dcd37be9bf0e0b07 | Python | 45,805 | 1,091 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as checkpoint
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
from model.enlcn import ENLCN
from typing import Optional, Tuple
def make_model(args):
try:
inch = int(args... |
ad75133530fe02fa845a9473ec1634898cf4dc3af72ce8e960367d9e9989c359 | Python | 45,829 | 1,241 | import copy
import itertools
import json
import logging
import os
import time
from collections import Counter
from functools import lru_cache, partial
from typing import Any, Dict, List, Optional, Set, Tuple
import boto3
import botocore
from packaging.version import Version
from ray.autoscaler._private.aws.cloudwatch... |
11fc10aef7056ec1f36c133ca0c4c49f33ca3f5aecaf95ab27c1fcadeedc66a5 | Python | 45,857 | 1,234 | import logging
import os
import sys
import time
import unittest
# coding: utf-8
# coding: utf-8
from collections import defaultdict
from typing import Any, Dict, List, Union
from unittest import mock
from unittest.mock import MagicMock
import pytest # noqa
import requests
import ray
from ray._common.test_utils impo... |
bef60fc3544ed08e166cb5ee604372a67c553671092f810e5b055e62ef6726b0 | Python | 45,876 | 7 | train_data = """
{"input_ids":{"0":[238,8576,9441,2987,238,252,4657,74,4762,826,8576,428,466,609,6881,412,204,9441,311,2746,466,10816,168,99,150,192,112,14328,3983,112,4446,94,18288,4446,193,3983,98,3983,22171,95,19,201,6374,209,8576,218,198,3455,1972,428,310,201,5099,3242,227,281,8576,9441,2987,2553,1759,201,301,196,1... |
facd609c400efd05d1b0d71a6d8113cbd7593fff5aa6b94507895f6b86fd47a3 | Python | 45,899 | 1,213 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
59674ef1595c196cc4436c925d5f84cbfc9681ab9009c2537a3288de7edc23e2 | Python | 45,926 | 1,128 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
From KERAS package
Fairly basic set of tools for real-time data augmentation on image data.
Can easily be extended to include new transformations,
new preprocessing methods, etc...
"""
from functools import partial
import multiprocessing.pool
import numpy as np
import... |
771eae715f252b5cabf2624ec218c73e99d4cf835c18df80265e48bb9d253fdf | Python | 45,951 | 1,071 | r"""The **B** in design-build-test-learn — turning a design into something
executable.
Everything upstream of this module produces knowledge: a pathway, an enzyme, a
construct, a vector, a screening verdict. None of it produces anything a robot
or a person at a bench can carry out. That made "design-build-test-learn" ... |
f6c10bdb07df8fb7f5f63c8e05dfb939716a5e70d91a8faa49149eb768c0086c | Python | 46,022 | 1,296 | """
CLI entry point for ``omicverse jarvis``.
"""
from __future__ import annotations
import argparse
import importlib
import importlib.util
import logging
import os
import sys
import time
from pathlib import Path
from typing import Any, Dict, List, Optional
from .config import config_exists, default_auth_path, defaul... |
4f6ee7869e72879f42d638730d4c5dc91dba246ec22f2468c3bf5acffea70acf | Python | 46,055 | 890 | # Copyright 2023 The HuggingFace Team. 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 applicabl... |
b6d3a5742211ca4efba30af685786dcf7bfa42619012ab7bff586113453e47d3 | Python | 46,167 | 717 | import torch as th
from torch.nn import functional as F
import torch.nn as nn
import numpy as np
from torchdiffeq import odeint
from .velocity_field import VelocityFieldReg
from .modules import create_encoder, create_decoder, MLP, GCN
from ..utils import normalize, sparse_mx_to_torch_sparse_tensor, batch_jacobian, g... |
41dde3bd27e80e0f8bfe83bc243970688d3c813b90193dd199f22a9523e8fb47 | Python | 46,209 | 1,069 | r"""The **T** in design-build-test-learn — turning measurements into parameters.
A plate reader produces a few hundred OD traces per run, and that is the single
most common measurement in the field. ``ov.synbio`` could *simulate* growth
(:func:`~omicverse.synbio.dynamic_fba`, :func:`~omicverse.synbio.rba`) and had
not... |
a2b8ebf69cc2354d2fa30d14edf02e29478d14c417e53b859435adb0f6b8b964 | Python | 46,261 | 827 | import numpy as np
import os
import copy
class DatasetGenerator:
def __init__(self, participants, input_variables, output_variables, base_path="/app", side="left"):
self.participants = participants
self.input_variables = input_variables
self.output_variables = output_variables
... |
625fd690ae1ba00d3e8c2292c5bf39d10678c686ccc6ada97f9627606b205870 | Python | 46,309 | 995 | import json
import logging
import os
import posixpath
import threading
import time
import uuid
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Optional, Tuple
from ray._common.retry import call_with_retry
from ray.data._internal.arrow_ops.transform_pyarro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.