sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
98ef40f06ddea3b508a216debdadb731af37df1e3dc04a0e352286c6e29826e9 | Python | 18,738 | 511 | import math
from contextlib import nullcontext
from functools import wraps
from typing import Optional
import torch
import torch.nn.functional as F
from einops import rearrange, repeat
from torch._guards import active_fake_mode
from torch._subclasses.fake_tensor import FakeTensorMode
class IndexFirstAxis(torch.autog... |
a6c87abc90d72907f074e8433308264c1bb4acd2309f8730e0827ffbb16f4ddb | Python | 18,740 | 397 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 21 14:50:57 2021
This is the main simulation file. It contains functions that train models, evaluate them on datasets and analyse the
data.
To run an Experiment, make sure to choose the appropriate configuration file saved in the 'constants/' direc... |
6256ec19a4a5b1dae34b09abb650c001d1cd57da796e4ea3250124653e80730a | Python | 18,748 | 438 | """Round-9 escape-witness honesty for sparse runnable execution.
Round-8 closed the verbatim scalar bake by correlating a baked ``LiteralAtom`` to
an escaped scalar by exact VALUE EQUALITY. That heuristic is fundamentally too
weak: ANY Python arithmetic on the escaped scalar, a multi-element ``.tolist()``
sequence bak... |
916046b78b56f7215e46d4d7717cd8e7dabd2fa01778c4f303da340d7fc9dace | Python | 18,750 | 334 | import os
import re
import numpy as np
import argparse
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import sys
sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells')
from scipy.stats import kruskal
from analysis.utils_analysis import sort_resp, plot_sorted_averaged_resp, single_cell_visualizati... |
53420a3df889e4871596367d0b38bac6861912acda3a3b353e1740d8ee592c66 | Python | 18,754 | 499 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from itertools import repeat
import numpy as np
from numpy import newaxis
from numpy.testing import assert_allclose
import pytest
from eelbrain import datasets, load, test, testnd, Dataset, Factor, NDVar, Var
from eelbrain._data_obj import UTS
from eelbrain._ex... |
8adc374f0362fe477bb1497d7836e848bc743dd2c68b9c2f43aebe25cee6e386 | Python | 18,754 | 434 | #!/usr/bin/env python3
"""
File: compare_ieqtls.py
Created: 2022/03/23
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tree.
"""
# ... |
981cbfa94935e3977ea714e8df57f3d16eba6758488129bbdb8ab51279b49dee | Python | 18,757 | 552 | """
The portal's landing page.
Presents the available apps as lanes of cards, with the quick-start entry
points for each workflow.
"""
from __future__ import annotations
import base64
from html import escape
from pathlib import Path
import panel as pn
from bokeh.models import InlineStyleSheet
from larvaworld.porta... |
93104fb0766b997bed9789a157e5e0ca485cea3f28160d8effcf2e325c0e81a1 | Python | 18,762 | 690 | #!/usr/bin/env python
# coding: utf-8
# In[2]:
import os
# The GPU id to use, usually either "0" or "1";
import numpy as np
import pandas as pd
import glob
import csv
import joblib
import pickle
import sklearn as sk
import joblib
import pickle
import tensorflow as tf
from sklearn.model_selection import Stratifie... |
8e9f61d604d43b161d37329796ccc71f060b36165c09fc2cb33e1dd88fde8e83 | Python | 18,764 | 510 | """Worker-count resolution and parallel-decode orchestration for decoding blobs."""
import contextvars
import logging
import multiprocessing
import os
import shutil
import tempfile
import threading
import warnings
from collections import deque
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, wai... |
8ccdf0122a0133297100734ae63c4ab2c3878c2b054d0cab05cbf55d27d2398b | Python | 18,769 | 542 | """The postprocess recording/enforcement axes matrix (design-ppdag-v3 §8.1).
Every axis is one FRESH capture reaching ``postprocess()`` (refresh included
— it is a fresh capture projected onto the source trace afterwards). The
matrix is the shared input of the one-time declaration seeding sweep
(``tools/record_postpro... |
60518373c339333dfeba8f4c4bc6e4ac9f15ee28d22e6e9834cec68043a3f3ca | Python | 18,775 | 557 | """
spike_plots.py
General modules for rasterplots.
"""
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.font_manager as fm
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
from matplotlib.pyplot import style
from matplotlib.transforms impo... |
0c035e438be5f019d147031264a1916e51a7e19eef757c964030c6bb6b009467 | Python | 18,779 | 406 | """
This module contains thermochemical analysis tools such as property evaluators and chemical explosive mode analysis,
which operate generally on spitfire Library instances from time integration, flamelet tabulation, etc.
"""
# Spitfire - a Python-C++ library for building tabulated chemistry models and solving diffe... |
703f07816baa4885513ad6032610b0c4700f781564d9738947648ca263d5de54 | Python | 18,780 | 499 | '''Utilities for ROIs'''
import os
import glob
import re
import hashlib
import numpy as np
import nibabel.freesurfer
from bdpy.mri import load_mri
def add_roimask(
bdata, roi_mask, roi_prefix='',
brain_data='VoxelData', xyz=['voxel_x', 'voxel_y', 'voxel_z'],
return_roi_flag=False,
... |
95f437e85b29677a5f18ac4eeac8bc9d5400875224cc92ea01cb49708e059875 | Python | 18,780 | 405 | import torch
from torch.utils import data
import torch.nn.functional as F
import csv
import glob, os
from PIL import Image
import numpy as np
import re
from tifffile import imread
import sys
import torch
from tqdm import tqdm
import multipagetiff as mtif
def pad_img_to_min(image):
"""
Pad an image to the minim... |
2e9997565db6cddb04be26ce494c1459e4e2492509f977f273d46f0bcba500e8 | Python | 18,782 | 426 | # package imports
import prob2020.python.mutation_context as mc
import prob2020.python.permutation as pm
import prob2020.cython.cutils as cutils
import prob2020.python.utils as utils
import prob2020.python.scores as scores
# external imports
import numpy as np
import pandas as pd
import scipy.stats as stats
import tra... |
0afdb35ac7575fb519fcf7875664fcee53a16e942d7e2fbedea9d6b334acec6d | Python | 18,794 | 451 | from __future__ import print_function
import numpy as np
import warnings
from .parcorr import ParCorr
from .robust_parcorr import RobustParCorr
# from tigramite.independence_tests.parcorr import ParCorr
# from tigramite.independence_tests.robust_parcorr import RobustParCorr
from tigramite import data_processing as pp
... |
90f9dd2be75cf9199e27faa6d0095a873db1ce291d856c7ba916e7948a5cca17 | Python | 18,806 | 397 | import argparse
import logging
import pathlib
import warnings
from typing import TextIO
import csv
import numpy as np
import sklearn.metrics as metrics
import torch
from torch import nn
from torch.utils.data import DataLoader
from constants import AMINO_ACID_INDICES, STANDARD_AMINO_ACIDS, AMINO_ACID_LETT... |
74b0a635f290bbe8be0d5b988c11d6e86e69ad2bd870c073e308b2dc1ee6e160 | Python | 18,811 | 426 | # pytest unit tests for spinalcordtoolbox.deepseg
import json
import os
import shlex
import shutil
from pathlib import Path
from unittest import mock
import pytest
import warnings
import numpy as np
from torch.serialization import SourceChangeWarning
import spinalcordtoolbox as sct
from spinalcordtoolbox.image impor... |
6413199badfad50a110e4847bc8833442c1f8117a018f10eec0db55f77d6b353 | Python | 18,824 | 338 | from __future__ import division
import numpy as np
from abc import ABCMeta, abstractmethod
# abstract class python 2 & 3 compatible
ABC = ABCMeta('ABC', (object,), {})
def relu(x):
"""NumPy implementation of `tf.nn.relu <https://www.tensorflow.org/api_docs/python/tf/nn/relu>`_
Arguments:
x (ndarray... |
c8368ca36784bd8855e8821fdbaf74df98afef6956993115bd24d799e9bacb89 | Python | 18,827 | 386 | import itertools
from contextlib import nullcontext
from dataclasses import replace
import pytest
from flash_attn.cute.config import (
FwdHeuristicInputs,
Sm90Registers,
Sm100Registers,
derive_fwd_config,
select_ex2_emu,
select_fwd_config,
select_registers,
validate_fwd_config,
)
# St... |
382cff764cce951a4255b2b0dfd4f20474e4ce5def558903ef25c9fcb86c43bb | Python | 18,831 | 379 | '''Provides for gradient based interpretation at the level of the embedding vectors using the Captum library'''
import torch
import pandas as pd
import numpy as np
import json
import tqdm
from scipy import stats, signal
from captum.attr import NoiseTunnel,DeepLiftShap,GradientShap,Saliency,\
InputXGradient, In... |
1bff7dd83ba94883486c41c13af8d56fb4325b68182f0927593c83427965eb8b | Python | 18,845 | 444 | import pandas as pd
import numpy as np
from sklearn.metrics import silhouette_score,confusion_matrix
import torch
import torch.nn.functional as F
import math
from models import SimpleEncoder,Decoder,PriorDiscriminator,LocalDiscriminator,Classifier
from evaluationUtils import r_square,get_cindex,pearson_r,pseudoAccuracy... |
42c0fc640defe5078867eab648f8667b451662e900d96556ed0caeb9bbd02032 | Python | 18,851 | 534 | # coding=utf-8
# Copyright 2024 The Google Research 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 applicab... |
9101530a3b1e732ce5b92059c7b8ecdf781fe5311655c42b176e7eee2f1040c5 | Python | 18,853 | 507 | import wave
import sys
import struct
import time
import subprocess
import threading
import traceback
import shlex
import os
import json
import logging
import random
import datetime as dt
import numpy as np
import scipy as sp
import scipy.special
from contextlib import closing
from argparse import ArgumentParser
from py... |
aed887a8eb1f3781a044cc3abb1e9818db4a7bcbca3bd9ec4cf63af031dec9ea | Python | 18,863 | 444 | """Event model object and associated code for fitting the model to spectrograms across events."""
import numpy as np
from specparam.models import SpectralModel, SpectralTimeModel
from specparam.results.results import Results3D
from specparam.results.utils import run_parallel_event, pbar
from specparam.data.data impor... |
34097d29de25f454628d1448181f42d555b214ee4ba601bfc4a2bf7a3794f6df | Python | 18,874 | 497 | from __future__ import annotations
import math
import numpy as np
import pandas as pd
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.legacy.toolkit.analysis.metrics.utils.signal import sawtooth as sawtooth_wave
from bream4.legacy.toolkit.analysis.metrics.utils.signal import ... |
4226f8db460faedb35eaecaec503a0e103aa43af05e3d9b97e4256eb1b8f061d | Python | 18,878 | 504 | """Flat-buffer operations on :class:`Ragged` arrays.
These operate directly on the ``(data, offsets)`` representation using Rust
kernels (via the compiled ``seqpro.seqpro`` extension) instead of going
through awkward-array ops, which is the hot path for per-batch transforms
(e.g. reverse-complementing negative-strand ... |
e21b731b93acca0d5785c6b40526624ba28759840f7a19d4ae89e02bd7f0a23b | Python | 18,878 | 473 | """
Functions for signal processing and data processing.
"""
import numpy as np
import mne
from scipy.signal import butter, filtfilt, welch, find_peaks
def peak_in_spectrum(Pxx, freq):
"""
Computes peak frequency in the alpha band 8-12 Hz from the given spectrum
:param numpy.ndarray Pxx: amplitude spectr... |
0c2f31dcf657340d86875c3b80fb9d1c717e603de1aa793cdcf649f7a8dd3c6d | Python | 18,880 | 522 | """Persistence load and recovery corruption-matrix tests for fastlog."""
from __future__ import annotations
import json
import shutil
from pathlib import Path
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens._io import TorchLensIOError
from torchlens.fastlog import RecoveryError... |
bbbfd58abbeab48147a11a39b0d0c7f0c5453e2cdff70ba2a8b689fe8d84891c | Python | 18,883 | 460 | """tvscope B2/B3: authority resolver, audit oracle, diagnostics, FP suite.
Oracle assertions (tvscope memo section 5): the audit names mismatched
fields; strict mode refuses with DISTINCT typed codes; permissive mode
stamps ``mismatch``, never ``verified``; the demoted tier-4 fallback never
yields verified; the tensor... |
28ea965f323dc8a28ded2618fa0a436b3c741ce83e33938e18b0f9aae4cff8f5 | Python | 18,890 | 532 | """
misc_plots.py
This script contains miscellanous plotting functions.
Authors: Colleen Gillon
Date: January, 2021
Note: this code uses python 3.7.
"""
import numpy as np
from util import gen_util, logger_util, plot_util
from sess_util import sess_plot_util
from analysis import misc_analys
from plot_fcts import ... |
88c691b4ff54384c30e3b89841ab7b69cd5a327d7a8ec6d7d135b6f5f9403def | Python | 18,892 | 444 | import pandas as pd
import numpy as np
from sklearn.metrics import silhouette_score,confusion_matrix
import torch
import torch.nn.functional as F
import math
from models import SimpleEncoder,Decoder,PriorDiscriminator,LocalDiscriminator,Classifier
from evaluationUtils import r_square,get_cindex,pearson_r,pseudoAccuracy... |
18f337909966969f9276e1d17f3a82fe8736584e5d5321a8dbe43dd9df56a340 | Python | 18,902 | 574 | import numpy as np
from keras.src import backend
from keras.src import ops
from keras.src import tree
from keras.src.api_export import keras_export
from keras.src.backend.common import standardize_dtype
NUM_BATCHES_FOR_TENSOR_SPEC = 2
@keras_export("keras.utils.unpack_x_y_sample_weight")
def unpack_x_y_sample_weigh... |
898ebc28d09a6f912970971e8dff49cfc40696b4fa980f1aec8ab7711a9e82a0 | Python | 18,905 | 531 | """torch.compile rung-2: ``force_eager`` stance capture (torch >= 2.6).
The design-review compile verdict (2026-08-12) verified that the public
``torch.compiler.set_stance("force_eager")`` API makes every compiled callable
run its ORIGINAL Python for the duration of a capture:
* interiors of formerly-opaque compiled ... |
f4fe785c363e53264b317cfbfd8eeb4155736ea8d771fbb8423deeb95cc9e2b8 | Python | 18,911 | 435 | from math import sqrt
from math import log
from model import common
import torch
from torch import nn
import torch.nn.functional as F
from timm.models.layers import trunc_normal_, DropPath
from model import acb
# mainly copied from the fsrcnnacv4 model
def make_model(args, parent=False):
return RepECN(args)
cl... |
32a2bda24364970335fb6637dd1d057a85055ab80a55000112b615ac18b29f19 | Python | 18,914 | 596 | import json
import decimal
import datetime
import warnings
from pathlib import Path
from plotly.io._utils import validate_coerce_fig_to_dict, validate_coerce_output_type
from _plotly_utils.optional_imports import get_module
from _plotly_utils.basevalidators import ImageUriValidator
class JsonConfig(object):
_val... |
1a9dac457493524e801acc55c8db47b56c4332f0c8e603a9f9bca7cedf85b6f0 | Python | 18,921 | 453 | """
pup_analys.py
This module analyses pupil data generated by the Allen Institute OpenScope
experiments for the Credit Assignment Project.
Authors: Jay Pina and Colleen Gillon
Date: July, 2019
Note: this code uses python 3.7.
"""
import copy
import warnings
from joblib import Parallel, delayed
import numpy as ... |
1c8bab0562c08457b1bcd2801e99ea921682c513e7c6a958c5e0ca6775a1b0df | Python | 18,927 | 711 | """Determinism and two-hash behavior tests for TorchLens graph digests."""
from __future__ import annotations
import subprocess
import sys
import textwrap
from collections.abc import Callable
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.options import ... |
b1ebeb79ef9bad033304cf09f0c5285901a9c6ef8fe9af662a90dd721702b8c2 | Python | 18,927 | 473 | import torch
from torch import nn
from torch_geometric.nn import GCNConv, global_mean_pool
class MLP(nn.Module):
""" a simple 4-layer MLP """
def __init__(self, nin, nout, nh):
super().__init__()
self.net = nn.Sequential(
nn.Linear(nin, nh),
nn.LeakyReLU(0.2),
... |
43b569bae7f3802c9784aa087485aef959d88edfd3432309cdbac050e4302e98 | Python | 18,928 | 630 | """
The portal's workspace: where datasets and configurations live.
Resolves, validates and switches the active workspace, and holds the global
configuration recording the known ones.
"""
from __future__ import annotations
import json
import os
import uuid
from dataclasses import dataclass
from datetime import datet... |
6cf218b8e43b881eba93fc32475ef321fbdad7def62f3d43bc6c7ecdc9997cfa | Python | 18,933 | 545 | """Classes for building an executive summary file."""
import multiprocessing
import os
import re
from pathlib import Path
import nibabel as nb
import numpy as np
import pandas as pd
from bids.layout import BIDSLayout, Query
from bs4 import BeautifulSoup
from jinja2 import Environment, FileSystemLoader
from markupsafe... |
8833c03db01cf0180e70f54562a82a362f34d374bd0b6a03a20f1403ecace5d5 | Python | 18,940 | 259 | import openpyxl
from mpl_toolkits.axes_grid1 import host_subplot
from mpl_toolkits import axisartist
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt
plt.rcParams['font.sans-serif'] = 'Helvetica'
fig=plt.figure(figsize=(18, 4))
def calcStaticParam2(x,y):
sumMAE = 0
sumRMSE = 0
sumM... |
2435ae1eeae48a2e0d5014e2df71187af8ea4f9a3de72b206f6c2991a270b5c5 | Python | 18,960 | 553 | import numpy as np
from shapely.geometry import MultiPolygon, Polygon
try:
from typing import Any, List, Literal, Optional, Tuple, Union
except ImportError:
from typing_extensions import Literal
import itertools
import cv2
from scipy.spatial import KDTree
from ..utils import _iteration
try:
import alph... |
3c7e24dd413984786779d9a9b3a99ffd6ce4a49d0a7e3e7e67ea472a838bf254 | Python | 18,961 | 544 | import io
import json
import os
import pickle
from collections import Counter, OrderedDict
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
from nltk.tokenize import sent_tokenize, word_tokenize
from torch.utils.data import Dataset
from torchvision import transforms, models, da... |
666afd78798411e3c7183ab5df4045579585fb5297d1777c36a85adf4d647a77 | Python | 18,973 | 530 | """
Unit tests for stimulators/sleep_depriver_stimulators.py.
Tests IsMovingStimulator, SleepDepStimulator, SleepDepStimulatorCR,
ExperimentalSleepDepStimulator, MiddleCrossingStimulator, mAGO, and AGO.
"""
import unittest
from unittest.mock import Mock, patch
from ethoscope.hardware.interfaces.optomotor import Opto... |
398eea31dfb6f64bf0f93b0b46a57a1837c29831b3e765c50db866d5942d51d5 | Python | 18,975 | 411 | import json
import re
import shlex
import typing
from logging import getLogger
from os import (
getcwd,
makedirs,
)
from os.path import (
abspath,
join,
)
from galaxy import util
from galaxy.job_execution.output_collect import default_exit_code_file
from galaxy.jobs.runners.util.job_script import (
... |
06c538d101b26525689353fe6f589cd70f65731f9583769be16432a5d961e390 | Python | 18,981 | 553 | """
Memory modules implementing associative learning.
Provides reinforcement-learning memories that adapt the sensory gains of the
olfactory and touch modules from experienced reward, plus the adapter that
delegates learning to a remote Brian network.
"""
from __future__ import annotations
from typing import Any
imp... |
4e11bbba70b82ae660fcf631500541c72d87423ce30a1998c6ede8237c7a383a | Python | 18,983 | 553 | """
Functions to compute correlograms of timestamps data.
"""
from __future__ import annotations
import inspect
from functools import wraps
from itertools import combinations, product
from numbers import Number
from typing import Callable, Optional, Union
import numpy as np
import numpy.typing as npt
import pandas a... |
6f063499c68fab2f32881f2aff0097ec859dc9292bf936d5fdb9689311c45f0f | Python | 18,987 | 610 | import json
import os
import warnings
from keras.src.api_export import keras_export
# The type of float to use throughout a session.
_FLOATX = "float32"
# Epsilon fuzz factor used throughout the codebase.
_EPSILON = 1e-7
# Default image data format, one of "channels_last", "channels_first".
_IMAGE_DATA_FORMAT = "ch... |
67420bf126275efc3950372e2b6944980fecbe60c177f55a7b1671c188c21a0e | Python | 18,993 | 470 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
from six import string_types
import numpy as np
import sys, os, warnings
from tqdm import tqdm
from ..utils import _raise, consume, compose, normalize_mi_ma,... |
e4fe69188041d65afe608c777bc0024b633b7fd96be691abf6c9c1b6c83d2222 | Python | 18,993 | 509 | from itertools import combinations
import itertools
from random import *
import random
import pdb
from lifelines.utils import concordance_index
from sklearn import preprocessing
import functools
import random
import time
import pandas as pd
import torch.multiprocessing as mp
import torch.distributed as dist
from torch... |
92065319defbf3245d087d9f7cd31b7143ac6f379b5cc3c8975aee0883bbf5ad | Python | 19,016 | 399 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
7b3bd7c6ae5e20e4aa9c52efc9595f40d400c36658b86dac25db62e191a77f15 | Python | 19,018 | 567 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from inspect import getfullargspec
import re
from typing import Collection, Tuple, Union
from .. import testnd
from .. import test
from .._data_obj import CellArg
from .._exceptions import DefinitionError
from .._io.fiff import find_mne_channel_types
from .._uti... |
f7e11a42438b7795df7c0087027022b71e83f3efa44f8e439b602b3a7db7937c | Python | 19,030 | 534 | from __future__ import annotations
from typing import Final
import numpy as np
import pytest
from PySide6.QtCore import Qt
from labelme._shape import Shape
from labelme._widgets._canvas_interaction import CursorRole
from labelme._widgets._canvas_interaction import HitKind
from labelme._widgets._canvas_interaction im... |
eed449ba36a1276c15acf19d4167bf2489bb4985ada79fdd78f32632ce321e33 | Python | 19,033 | 494 | """Batchify functions.
They can be used in Gluon data loader to help combine individual samples
into batches for fast processing."""
import logging
import numpy as np
import mxnet as mx
__all__ = ['Stack', 'Pad', 'Append', 'Tuple', 'FasterRCNNTrainBatchify']
def _pad_arrs_to_max_length(arrs, pad_axis, pad_val, num... |
179365db31e04bdb087a10cd2b97141d6701a7e2428f6a8a8e9061bf88c306dc | Python | 19,037 | 359 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
51b7e52288c531a28b50e29fc7781d6ca0b7ad48256f3f2b9105ebc4205c2ed3 | Python | 19,061 | 401 | from typing import List, Literal, Optional, Tuple, Union
import anndata
import numpy as np
from scipy.stats import norm
from sklearn.neighbors import NearestNeighbors
from ...configuration import SKM
from ...tools.utils import compute_smallest_distance
from .scatters import scatters
from .utils import _convert_to_geo... |
6d82be42b46d808125db86395a84362e1d3b69b2d065dad90ed0515768ae156d | Python | 19,066 | 504 | """Stage 7 optional runnable weight-payload tests."""
from __future__ import annotations
import json
import pickle
from pathlib import Path
from typing import Any
import pytest
import torch
from safetensors.torch import load_file
from torch import nn
import torchlens as tl
from torchlens._io import TorchLensIOError... |
24085a9110e1269f0b8443fd3c8a7f17747c225fdf4b6fc137e355bc7f30bbbb | Python | 19,075 | 439 | """F02 stochastic verbs: draw law, axis law, oracles (edits memo D4-D9, D16-D18, D23-D25).
Tier-A rows exercised here (offline analogs of the memo's real-model rows,
oracle-backed, deterministic):
- A2 core: ``permute_batch`` against an independent index oracle from the
recorded permutation; byte-identical repeat u... |
3bd85c1820f34a4671af38d0c0cde9f855a6488221724482851c918f4c3d04e0 | Python | 19,075 | 494 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# etho_db.py
#
# Copyright 2019 Giorgio <giorgio@gilest.ro>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the Lic... |
2fdee5ffd12fe0d7afe93b78a1d04f87c5b1c0998ed7bc558eeb21f4522ba692 | Python | 19,078 | 591 | import argparse
import json
import os
import warnings
from itertools import chain
import joblib
import numpy as np
import pandas as pd
from galaxy_ml.keras_galaxy_models import (
_predict_generator,
KerasGBatchClassifier,
KerasGClassifier,
KerasGRegressor,
)
from galaxy_ml.model_persist import dump_mod... |
b074722809d8ac3e5ea0954337f8989c71bb9315785b98e2972865e7639c418d | Python | 19,083 | 383 | # pylint: disable=line-too-long,too-many-lines,missing-docstring,arguments-differ,unused-argument
__all__ = ['I3D_InceptionV1', 'i3d_inceptionv1_kinetics400']
from mxnet import nd
from mxnet import init
from mxnet.context import cpu
from mxnet.gluon.block import HybridBlock
from mxnet.gluon import nn
from mxnet.gluon... |
1588f4d01709c5bda235c069d9967283412210f009f09973748c7c2940f689b9 | Python | 19,085 | 349 | from __future__ import division
import numpy as np
import tensorflow as tf
from warnings import warn
tf.compat.v1.disable_eager_execution()
class WeightInitializer(object):
""" Base Weight Initialization class.
Initializes biological constraints and network weights, optionally loading weights from a file o... |
838cbccb1f0fdfd94b57b05daffa4d2347d8e5d3611fb46b656f4970a9593a9e | Python | 19,087 | 563 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import functools
import os
from typing import Dict
import slowfast.utils.logging as logging
import torch
from pytorchvideo.data import Charades, LabeledVideoDataset, make_clip_sampler, SSv2
from pytorchvideo.data.labeled_video_paths import Labele... |
223b35dfd58aaf9a8cce7c788b709a597ca2f88f9eef167e393667fb9e0a3813 | Python | 19,097 | 399 | import warnings
import torch
from torch.nn import Linear
from torch.nn.init import xavier_uniform_
from torch.nn.init import constant_
from torch.nn.init import xavier_normal_
from torch.nn.parameter import Parameter
from torch.nn import Module
from torch.nn import functional as F
class MultiheadAttention(Module):
... |
ff337ee2421e941ef3fc8dd51ae1ade09940f0ad0dfde1f80fa4141b63f85d85 | Python | 19,101 | 481 |
from cgi import test
import pandas as pd
from progress.bar import IncrementalBar
from datastructure.diagnosis import Diagnosis as Diagnosis
from datastructure.patient import Patient as Patient
import os
import numpy as np
class Dataset(object):
"""
A class to represent the datasets handeled, internally split... |
c20a3eba101ae8c6a259b1325718ef36ff365380933c53f9604643094cfd55f5 | Python | 19,103 | 442 | # Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
0cd86bf363796be39ff2c3b020688e54e58fcd5d8b682c9c62fcae8a73ea7b13 | Python | 19,105 | 624 | """
Author: Timothy Tickle
Description: Validate Data containing methods for testing variables.
"""
#####################################################################################
#Copyright (C) <2012>
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of
#this software and associate... |
65bbb96ce435e06b4525e47998c2d85669f2efb88205f0ac61c24756d0a35c2f | Python | 19,109 | 580 | # -*- coding: utf-8 -*-
#
# pythonguide documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 4 22:51:11 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
2c5726dfcf096be442327a308de92ad6590886ff5f6a8af0e155dccb42009a7d | Python | 19,126 | 473 | import warnings
from collections import deque, defaultdict
from typing import List, Tuple, Iterable, Union, Optional
import numpy as np
import torch
import torch.nn as nn
from torch import Tensor
from ..modules.base import InvertibleModule
class Node:
"""
The Node class represents one transformation in the ... |
da2cdedfa44a91f8a1c521049b85e4c776618fe6398b67a9d6e230fe5155d057 | Python | 19,127 | 522 | # -*- coding: utf-8 -*-
import os
import codecs
import math
from collections import Counter, defaultdict, OrderedDict
import torch
from torchtext.data import Field, RawField, LabelField
from torchtext.vocab import Vocab
from bioseq2seq.constants import DefaultTokens, ModelTask
from bioseq2seq.inputters.text_dataset ... |
5a846335a883a029bb3113c28eef2d2bd659be47bdaca570118cef4b93ec65ba | Python | 19,129 | 397 | import json
from pathlib import Path
from typing import List, Dict
from sklearn.metrics import classification_report
from helpers.configurations import TAKE_SPLIT, OR_4D_DATA_ROOT_PATH
import pickle
from collections import defaultdict
from copy import deepcopy
import numpy as np
def convert_scene_graph_to_human_re... |
262867551e2eb599c957135fdfd4d2bd3b4e5a7e7e6738ab7b36e0ab9103088d | Python | 19,130 | 620 | """
Utility functions
"""
import inspect
import os
import warnings
from collections.abc import Sequence
from itertools import combinations
from numbers import Number
from pathlib import Path
import numpy as np
from .config import nap_config
def convert_to_array(array, array_name):
# Check if jax backend
if... |
5ee7a4a1b477f365997f5d312b5e2cc1d936e7613bc771ce8159ef17134ac937 | Python | 19,136 | 514 | """
Determine what optional dependencies are needed.
"""
import logging
import os
import re
import sys
from collections.abc import Mapping
from os.path import (
dirname,
exists,
join,
)
from typing import (
Any,
cast,
)
import yaml
from dparse import parse
from packaging.requirements import Requir... |
e8c0731957ae2637f1e4d994178e6d04ad76ffbb7533b82559a743a29ed36261 | Python | 19,136 | 568 | """Regression tests for plain ``pickle.dump`` compatibility."""
from __future__ import annotations
import pickle
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens import Trace, trace as trace_fn
class _PlainPickleModel(nn.Module):... |
1d22d2f0eec769a4da6d7c8ffd8dc185294aa5f483dc35949968cee940d06101 | Python | 19,137 | 586 | import datetime
import logging
import os
import tempfile
import time
from collections import OrderedDict
import numpy as np
from cv2 import IMWRITE_JPEG_QUALITY, imwrite
# Constants from base.py
SENSOR_DEFAULT_PERIOD = 120.0 # Default sensor sampling period in seconds
IMG_SNAPSHOT_DEFAULT_PERIOD = (
300.0 # Def... |
4280b72721186126629b8ffb0b610e0064ed86e94ee31c0fb60abc8530a4420e | Python | 19,139 | 446 | from sklearn.metrics import precision_recall_fscore_support
import itertools as itls
from scipy import interp
from sklearn.preprocessing import label_binarize
from sklearn.metrics import (
confusion_matrix, precision_recall_curve,
average_precision_score, roc_curve, auc
)
import matplotlib.pyplot as plt
impo... |
1737db238db6d09cfea0942aed3ea32c3abf3107afeb63b837d9817d57a3f988 | Python | 19,145 | 468 | from src.cfg import *
# unitCode:
# - string that defines unit, with in-between brackets a multiplier in one or more dimensions.
# The string can be m / mm / um.
# Examples: mm, mm(25), um(10,10,200)
# orientationCode:
# - set of three letters indicating the anatomical orientation of the positive x, y and z coordi... |
05c7ac544f33dc681118d5dc656e6e74932883122081c3f1688d44459166d4f9 | Python | 19,146 | 469 |
from src.cfg import *
# unitCode:
# - string that defines unit, with in-between brackets a multiplier in one or more dimensions.
# The string can be m / mm / um.
# Examples: mm, mm(25), um(10,10,200)
# orientationCode:
# - set of three letters indicating the anatomical orientation of the positive x, y and z coord... |
219c4d88eb60c7585436671b297deb89c83da39f12561797b08ea386fde4ff80 | Python | 19,156 | 632 | import os
import glob
import subprocess
import tempfile
from pathlib import Path
import cv2
import numpy as np
from PIL import Image
class ColorSpace(object):
RGB = 0
BGR = 3
GRAY = 2
convert_from_to_dict = {ColorSpace.BGR: {ColorSpace.RGB: cv2.COLOR_BGR2RGB,
Col... |
578ccd0fca7ce6982f92af194338e60db624aa1e38612f81550b76547dda092c | Python | 19,159 | 480 | import math
import warnings
from contextlib import contextmanager
from contextlib import nullcontext
import numpy as np
from absl import logging
from keras.src import backend
from keras.src import ops
from keras.src import utils as keras_utils
from keras.src.layers import Dense
from keras.src.layers import EinsumDens... |
b1c13c6b894c5d4dbdf20fd8fd7a223a9dd5d3be0146f6c35848dbd6f8f09512 | Python | 19,168 | 438 | import os
from os.path import join as pjoin
import tempfile
import subprocess
import resource
import time
import urllib
import re
import urllib.request
import numpy as np
from typing import List, Tuple
from tqdm.auto import tqdm
import pandas as pd
from measure_performance import compute_peptide_finding_metrics, parse_... |
e61be3bda20b27fd3ef1f411615a6ba7fef819381c075feca37b7832fa9d9ee3 | Python | 19,168 | 395 | #!/usr/bin/env python
# Created on: October 30, 2013
__author__ = "Sven Kreiss, Kyle Cranmer"
__version__ = "0.1"
import optparse
parser = optparse.OptionParser(version=__version__)
parser.add_option("-q", "--quiet", dest="verbose", action="store_false", default=True, help="Quiet output.")
options,args = parser.pa... |
6f88cb4080a656842d02468f6dfd2f0cc0b541f8da3500271fa6fea0e62d655c | Python | 19,188 | 575 | # SOURCE: vendored from https://github.com/RoyinaJayanth/EqNIO @ main
# (RONIN/source/model_resnet1d.py + RONIN/source/model_resnet1d_eq_frame.py)
#
# EqNIO (Equivariant Neural Inertial Odometry, Jayanth et al. ICLR 2025):
# an O(2)/SO(2)-equivariant IMU-odometry network. The equivariant "frame"
# tower (`VNLinear`, `N... |
c027247dd55cd50e2ca739dad139a27f724b24c5c6d253e590c0f08595208dc3 | Python | 19,196 | 511 | import jax
import jax.experimental.sparse as jax_sparse
import numpy as np
import pytest
import scipy
import tensorflow as tf
import torch
from absl.testing import parameterized
from keras.src import backend
from keras.src.backend.common import standardize_dtype
from keras.src.distribution import distribution_lib as d... |
37cd4bff995bd72c58ffca117a309b8dc0422272bc34ba81925f3ba9330d770a | Python | 19,203 | 517 | #! /usr/bin/python3
import subprocess
import os
import datetime
import time
# try to load tkinter, if tk is not installed, install it first.
try:
from tkinter import *
import tkinter.ttk as ttk
except Exception as e:
print(e)
subprocess.call(["sudo", "pacman", "-Sy", "tk", "--noconfirm"])
finally:
... |
5e4d15e0f25e610717474a02fcdb7f651b50002e0c5ba0354d924ab63d313191 | Python | 19,209 | 558 | """
Workspace selection and switching UI.
Presents the known workspaces, validates a chosen directory and applies the
switch across the running portal.
"""
from __future__ import annotations
import base64
import os
import subprocess
from dataclasses import dataclass
from html import escape
from pathlib import Path
f... |
c020ead71de6be56155f0e1f02cad3105dd2e489aa2ea9b92e30cacb8e28c983 | Python | 19,213 | 499 | from ...utils import constants
import pandas as pd
import geopandas as gpd
import numpy as np
import shapely
import pytest
from contextlib import ExitStack
from sklearn.metrics import mean_absolute_error
from ...models.geosim import GeoSim
from ...core.trajectorydataframe import TrajDataFrame
def global_variables():
... |
cb05d35157b7e8c9c28a9389f71810203540169e69a8f6312e41c7fe5d8f4ad1 | Python | 19,229 | 475 | import re
import json
import numpy; import numpy as np
import nrrd
import os
import copy
import gzip
# unitCode:
# - string that defines unit, with in-between brackets a multiplier in one or more dimensions.
# The string can be m / mm / um.
# Examples: mm, mm(25), um(10,10,200)
# orientationCode:
# - set of three... |
fc49c96736ef3055d11b067577d6a05fdce305dcf0fe346a2db4968abef51a51 | Python | 19,232 | 407 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 23 10:34:57 2020
@author: emilia
This file contains functions to analyse plane angles.
requires the pycircstat toolbox, available at https://github.com/circstat/pycircstat
"""
import numpy as np
import matplotlib.pyplot as plt
import pycircstat
... |
d199597b96a60efe5854428f7cc1d64a459db0515a8c7c367d3e00b58baa4dfa | Python | 19,234 | 448 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 7 09:08:10 2023
This script compute the correlation between ROI (cortical and subcortical ones).
This correlations can be computed either:
- on the preprocessed data, after detrending, high-pass filtering, linear
removal of the activity fr... |
31cdb203b43186fdc3c6ad92143ee4843041dc86d4260e8084739448eb1f7b66 | Python | 19,236 | 468 | import warnings
from collections.abc import Callable
from copy import deepcopy
import numpy as np
import pytest
import neurogym as ngym
from neurogym.envs.native.annubes import CATCH_KEYWORD, CATCH_SESSION_KEY, AnnubesEnv
from tests import ANNUBES_KWS
RND_SEED = 42
FIX_INTENSITY = 0.1
N_TRIALS = 1000
OUTPUT_BEHAVIOR... |
d13f3e6f27bbcb476f0c59072c522c7ca39124a7d87554275f7fa90a2cb75db8 | Python | 19,237 | 513 | """Lazy reader, views, graded verification, and exporters (lane F18).
The D14 read path: bounded open, ledger-order iteration, coalesced row
access (T-COALESCE wiring), duplicate-aware ID lookup, the exact byte
guard, trusted-prefix monitoring, and the D7 read-side verification grades;
plus the D15 exporters with the ... |
39a3eaf39f92038626897731f395fe3e46e82d948edd0e368464e220fe31f5db | Python | 19,247 | 409 | import networkx as nx
import numpy as np
import pandas as pd
import cvxpy as cvx
def _root_nodes(directed_graph: nx.DiGraph):
return set([n for n in directed_graph.nodes() if (directed_graph.in_degree(n) == 0)
or (list(directed_graph.predecessors(n)) == [n])])
def _end_nodes(directed_gr... |
c709ee54adcc74626980ef7ada1f96cfcf103b69d3e53348cc0becef417a1918 | Python | 19,249 | 586 | """Run simple cell optimization"""
"""
Copyright (c) 2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN... |
00860891320a189896ac99bf4d12a5aa3116b325c1c720631857922f4ad35eb1 | Python | 19,253 | 506 | import os
import torch
import torch.optim as optim
from torch.optim import lr_scheduler
import torch.backends.cudnn as cudnn
import torch.nn as nn
import time
import datetime
from torch.utils.data import DataLoader
from utils import *
from model import *
from data_loader import *
from config import *
import segmentatio... |
86dcaabc9607a9b642b32a6ef28e182ec594c6bc309a3348584784d2e2e1bf3f | Python | 19,254 | 516 | """Rolled-renderer SVG honesty regressions for smart collapse (round 27).
The UNROLLED op-segment defect class was structurally closed in rounds 21-25.
These pins exercise its ROLLED-path siblings, a distinct code path that no
prior pin ever rendered (every earlier "rolled" pin stopped at the selector):
- HIGH: in ro... |
6a422c7b42e88cd4dc07875c90a55696d72fb13447d989a80e7bccc7cb05fa9f | Python | 19,260 | 560 | # coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
acf681b94680a31f289d1daa973d717ce86549a7f66a5e20bbae8db8d4ab0514 | Python | 19,260 | 1,050 | # ===============================
# OSM TAGS
# ===============================
# These configurations are used to specify which OSM tags are kept
# by default as columns in DataFrame. Follows more or less the
# OSM documentation and the tags mentioned on the Wiki:
# https://wiki.openstreetmap.org/wiki/Map_Features
# I... |
cd651632f2c7c10d8c59e9373116d54052bf4540fa385721fac641969f778298 | Python | 19,270 | 579 | """Tests for C2 feature-map graph annotations."""
from __future__ import annotations
import subprocess
import sys
from pathlib import Path
from typing import Any
import numpy as np
import pytest
import torch
from PIL import Image, ImageChops, ImageDraw
from torch import nn
import torchlens as tl
from torchlens.viz.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.