sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
cc302ae890fbd49ae6d7b0e9b5ab2a010713a738449c9226f36459b97208567b | Python | 11,471 | 323 | import locale
locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' )
import re
import pandas as pd
import camelot
import pdfminer
from pdfminer.high_level import extract_pages
try:
from local_extractor.states.state_utils import TG_utils
except ImportError:
import sys, os, pathlib
path = pathlib.Path(__file__).... |
25b67b42c991d4cb6baf9976f0fa1170eedd9c0a99552c55bb23e22e0af6f6ee | Python | 11,477 | 350 |
import pytest
from pytest import approx
import numpy as np
from numpy.testing import assert_array_equal
from sklearn.model_selection import KFold, StratifiedShuffleSplit
from sklearn.pipeline import make_pipeline, Pipeline
from pyriemann.datasets.simulated import (
make_classification_transfer,
make_matrices,... |
df2d54a7f165a862837824de71981391594b95e8a5710965398949d1b05c1dd5 | Python | 11,479 | 358 | from __future__ import print_function, division, absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
import os
import sys
__all__ = ['InceptionV4', 'inceptionv4']
pretrained_settings = {
'inceptionv4': {
'imagenet': {
'ur... |
f9a7cd3252d123ac7844d1278e72c983c8b330b1d1ea50a5b298622e0731e4d5 | Python | 11,480 | 221 | """
To generate some plots.
"""
import json, numpy, voxcell, os
from networkx.drawing.nx_pydot import graphviz_layout
import networkx as nx
import matplotlib.pyplot as plt
import pandas as pd
from parcellation_project.analyses import flatmaps as fm_analyses
from parcellation_project.analyses.parcellation import _mi_i... |
29cb1211ec70befbd252dfe775de2639725ad9333d3ab14f83ae47b6982aa376 | Python | 11,482 | 432 | """Regression tests for Graphviz buffer visibility modes."""
from __future__ import annotations
from functools import partial
from pathlib import Path
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.data_classes.trace import Trace
from torchlens.options import CaptureOptions
... |
c2200f5802f6a3aafdaae11edf0480c090058f175a602ef909c909232f0ea20d | Python | 11,484 | 294 | """make dataset uuids unique
Revision ID: 04288b6a5b25
Revises: c63848676caf
Create Date: 2024-07-24 10:43:48.162813
NOTE ON NAMING: In this script, the term "latest" refers to a dataset that has
the smallest primary key in a group of datasets with duplicate UUIDs and,
therefore, is the oldest/original dataset in thi... |
4ac3fef5da8d4521b0f41754702ff958b77b455fe1f6b0ab63063411cfeb8a51 | Python | 11,487 | 332 | """Base class for vectorized environments."""
from typing import Any, List, Optional, Tuple, Union
import numpy as np
import gym
from gym.vector.utils.spaces import batch_space
__all__ = ["VectorEnv"]
class VectorEnv(gym.Env):
"""Base class for vectorized environments. Runs multiple independent copies of the s... |
fd7e6d975427a7881fd317317e9ad1f108832651edb9b224ebf07c03ea953baf | Python | 11,488 | 286 | """
===============================================================================
Online Artifact Detection with Riemannian Potato
===============================================================================
Example of Riemannian Potato [1]_ applied on EEG time-series to detect
artifacts in online processing. It ... |
2c3ed657978a9c64bde39d1cc2e7a306fb67dd0a9c8dcf5edc25c8af408894c9 | Python | 11,489 | 376 | from pathlib import Path
import pytest
from pyrosm import get_data
@pytest.fixture
def test_pbf():
pbf_path = get_data("test_pbf")
return pbf_path
@pytest.fixture
def helsinki_pbf():
pbf_path = get_data("helsinki_pbf")
return pbf_path
@pytest.fixture
def helsinki_history_pbf():
pbf_path = get... |
3df928ae3eb7ad39308dc1c1f4c51c50c16b8fada52bff4cd1eadaa16e501fc2 | Python | 11,494 | 284 | """
Unit tests for network utility functions.
Tests the network detection and IP pattern generation functionality
used for SSH configuration setup.
"""
import ipaddress
from unittest.mock import Mock, patch
import pytest
from ethoscope_node.utils.network import (
get_local_ip_addresses,
get_primary_private_... |
1b6510b801885e304f89c846a422ef8447fb05e8fff6e7c78a7e855167512b17 | Python | 11,496 | 326 | """P3 backward payload retention and per-pass gradient access tests."""
from __future__ import annotations
from pathlib import Path
import pytest
import torch
from torch import nn
import torchlens as tl
class _PayloadModel(nn.Module):
"""Small model with reusable backward payloads."""
def __init__(self) ... |
242cc7a46a4aadd67af2641595580663d35c515e6eff1195c8c59cba839713e3 | Python | 11,498 | 325 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os, sys, re
import logging
import TGraph
import TNode
import Node_alignment
from Topological_sort import Topological_sort
import TGLOBALS
logger = logging.getLo... |
2dd6d69d881cb73f6e5d8469efdbc4cd028de2eef56fdd0d7505e32f5ecce91f | Python | 11,499 | 335 | #!/usr/bin/env python3
import multiprocessing
import regex as re
import logging
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from MarkovModels import common
from MarkovModels.BeattieModel import BeattieModel
from MarkovModels.ClosedOpenModel import ClosedOpenModel
from M... |
ae2d1af645337baef09d650b43eb202203696fd5eb735c517832649971d9abe6 | Python | 11,499 | 294 | import configparser
import logging
import os
import re
import warnings
from datetime import datetime
from . import camera, util
from .exceptions import SettingsError
logger = logging.getLogger(__name__)
# repating pattern definitions used for parsing settings file
numstack_pattern = re.compile(
r"""
\#\sof\... |
0872785a34a117d1628990672f9f03fa5f8c616d2f583a5afb860471fa19513c | Python | 11,502 | 283 | """
Conflating Periodic & Aperiodic Changes
=======================================
Demonstrating how changes in periodic & aperiodic parameters can be conflated.
This example is a code implementation and quantitatively exact version of Figure 1 from the
`Parameterizing Neural Power Spectra <https://doi.org/10.1038/s... |
35ea0591b77c6718d1a0ca6401e0b433792b1ba9a79a3e18581f501e07c34c06 | Python | 11,505 | 361 | from __future__ import annotations
from pathlib import Path
import pytest
from larvaworld.portal import path_picker
def test_pick_directory_uses_macos_picker(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
selected = tmp_path / "workspace"
monkeypatch.delenv("WSL_DISTRO_NAME", raising... |
8ddb431cb4a462d212a8a6484dc95be5c8f38a80590796cc66959f2ac8db2548 | Python | 11,507 | 315 | """Round-8 security regression: the ``operator`` root + torch-symbol literal gate.
Two defense-in-depth tripwire gaps in the sparse-runnable untrusted-load path:
* MEDIUM -- the pure-forward-callable gate
(:func:`torchlens.utils._callable_safety.is_pure_forward_callable`) historically
admitted the whole ``operato... |
8e46501039d56a9b23d9e2a3cf35dd2e8f6ecb49a44bcaedc322a9ce52a84cdc | Python | 11,509 | 281 | # Copyright 2022 Deepfold 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 law or agreed to in writin... |
2bd1b857bee716d1b7525dffe52f57dd54e5b6a92453d40ee295884cb8d5e11a | Python | 11,510 | 336 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Projection(_BaseLayoutHierarchyType):
_parent_path_str = "layout.geo"
_... |
3132527efedf23b05144fbab95951ad9210225ba0fb41bb39b4b133ff07218df | Python | 11,515 | 293 | from conftest import get_metrics
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from pyriemann.clustering import (Kmeans, KmeansPerClassTransform, Potato,
PotatoField)
@pytest.mark.parametrize(
"clust", [Kmeans, KmeansPerClassTransform, Potato, Pota... |
f911e493e9cc841700e9a50f3b9440a1e55026aa2d9de29010f7e5bc6836fbcc | Python | 11,516 | 312 | import torch
import torch.nn.functional as F
import os
from rdkit import Chem # safe import before any ccdc import
from rdkit.Chem import Mol
from torch_scatter import scatter
from torch_geometric.data import Batch, Data
# Differentiate PyGDataLoader and torch DataLoader
from torch_geometric.loader import DataLoader ... |
f7619c02ed1501faef68c73cd3cd9b12aaea21d89ab429feedb7c01b1b7d023b | Python | 11,517 | 362 | """
Methods to analyze protein localization at cell-cell junctions:
"edge": bi-cellular junction
"node": multi-cellular junction
"""
import numpy as np
import pandas as pd
from scipy.spatial.distance import euclidean
from skimage.measure import regionprops
from skimage.morphology import binary_dilatio... |
7b6e959ae483cc8d701ac3b771d8b3abf75f8515b061f4e0a71223038f8629b8 | Python | 11,519 | 281 | #!/usr/bin/env python
import copy
import os
from time import sleep
from typing import List, Union
import gymnasium as gym
import matplotlib.pyplot as plt
import tensorflow as tf
from angorapy.common.policies import BasePolicyDistribution
from angorapy.tasks.wrappers import TaskWrapper
from angorapy.agent.ppo_agent im... |
7156c2244e1ce66dd957b5c8917430e2db5f41f60b2005a3df10c768127f9415 | Python | 11,520 | 289 | """L7b entry-dark bridge battery (memo sec 5/8; request R-L7B-1).
Pins the declared late-bind posture's shippable half: mandatory bind-time
byte digests (never skipped, typed refusal on failure), declared-slot
geometry digests under the meta domain tag with the manifest sentinel
grammar, G2 domain separation at the bi... |
8afdb93d3299d0efcfcbf95d216f37705efaab2c3c7a6aca089a831f892195d6 | Python | 11,520 | 320 | """Test for alff."""
import os
import shutil
import nibabel as nb
import numpy as np
from xcp_d import config
from xcp_d.tests.tests import mock_config
from xcp_d.tests.utils import get_nodes
from xcp_d.utils.bids import _get_tr
from xcp_d.utils.utils import _create_mem_gb
from xcp_d.utils.write_save import read_nda... |
84388e749a4feb3fb22036f7edbe8eb208e95902300d747929ab9534d614d32b | Python | 11,521 | 258 | #!/usr/bin/python
#-*-coding:utf-8-*-
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use... |
dc91adcc6497074e3861e2c18adb316d14bdafb5a689235d6714a8a55d19b257 | Python | 11,522 | 237 | #!/usr/bin/env python
"""Collection of generic fully connected and recurrent policy networks."""
import os
from contextlib import suppress
from typing import Tuple
import gymnasium as gym
import tensorflow as tf
from tensorflow.keras.layers import TimeDistributed
from tensorflow.python.keras.utils.vis_utils import pl... |
7f53e6b5bd5bb34398b3e58c849d3ea5ceecaf9a4791a1dfb773ca0bd56cf0e0 | Python | 11,526 | 326 | __author__ = 'quentin'
import mysql.connector
import sqlite3
import os
import logging
import traceback
class DBNotReadyError(Exception):
pass
class MySQLdbToSQlite(object):
_max_n_rows_to_insert = 10000
def __init__(self,
dst_path,
remote_db_name="ethoscope_db",
... |
8d9d3cf53d06873e9e261384a44aed3d7b3b416ca188c29135858359962435a2 | Python | 11,526 | 378 | # in this script, K is kmer
import sys
import os
import numpy as np
from difflib import SequenceMatcher as matcher
# import tables # do not involve if not needed
np.set_printoptions(threshold=sys.maxsize)
base_dict_op = {0:'A', 1:'C', 2:'G', 3:'T'}
base_dict = {'A': 0, 'C': 1, 'G': 2, 'T': 3, 'a': 0, 'c': 1, 'g': 2, 't... |
ca950dc7edff6985f264ff0e8d0a94b47907bcab17f862ceac53d2a699be7a03 | Python | 11,533 | 304 | # Copyright 2022 Deepfold 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 law or agreed to i... |
d6b252b761f59970fd4156c08e5e0ec308ba0bf92d941012ed92b2ceb46f1bd4 | Python | 11,537 | 341 | # Copyright (c) 2022 PaddlePaddle 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 app... |
2a1fe69424dad1cf5568fd3374a6d122492c48f9abbd762f73a06a7e09317059 | Python | 11,540 | 301 | """ Embeddings module """
import math
import warnings
import torch
import torch.nn as nn
from bioseq2seq.modules.util_class import Elementwise
class PositionalEncoding(nn.Module):
"""Sinusoidal positional encoding for non-recurrent neural networks.
Implementation based on "Attention Is All You Need"
:c... |
675af19a411f8bdfb7d3831995bfbfaa1c08ce7eb0d05bcbae052fbad44bac93 | Python | 11,540 | 280 | from __future__ import annotations
import html
from collections.abc import Callable
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtWidgets
from .._ai_models import AI_TEXT_MODEL_OPTIONS
from .._ai_models import find_ai_assist_model_option
from .._model_manager import ModelManager
def li... |
7d04bb1454f8e0d60f678e33a5d46fb4423dd81a1f650d50abf0c80afda58cef | Python | 11,541 | 314 | """TokenGT and Tokenphormer: token-based graph transformers.
TokenGT:
Kim et al., "Pure Transformers are Powerful Graph Learners."
arXiv:2207.02505 (NeurIPS 2022).
Source: https://github.com/jw9730/tokengt
Tokenphormer:
Shirzad et al., "Exphormer: Sparse Transformers for Graphs."
arXiv:2303.06147 (ICML 2023... |
c63a107380a4456f240ec22a079c1acab9dbe342f647bda629e703d837997151 | Python | 11,542 | 286 | """Test all features on an example trace"""
"""
Copyright (c) 2015, Blue Brain Project/EPFL
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 copy... |
4c12ab8a2b373b3b2ad0291d2117b8d80245956f661baeae9459c273ef71b01f | Python | 11,544 | 354 | # import libraries used throughout this notebook
import numpy as np
from sklearn.metrics import precision_recall_curve, average_precision_score, log_loss, roc_auc_score, make_scorer
import keras.backend as K
from keras.layers import Input, Dense, Conv2D, Flatten, GlobalMaxPooling2D, AveragePooling2D, MaxPooling2D, Dro... |
2b68fef64aa975451d45030f2f2c4cf02205243414a836c61fb12d0ebc7d92f8 | Python | 11,548 | 373 | #
# pyrem documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 14 19:30:54 2014.
#
# 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.
#
# All configuration values ha... |
6e86a0e309346f08272815a873bc4cecb6a47f2db6d1f15a74710f49a8257332 | Python | 11,551 | 256 | """
Keras implementation of CapsNet in Hinton's paper Dynamic Routing Between Capsules.
The current version maybe only works for TensorFlow backend. Actually it will be straightforward to re-write to TF code.
Adopting to other backends should be easy, but I have not tested this.
Usage:
python capsulenet.py
... |
2b6d985b176e44fa18b94b116ba9d455047bca9f4b28034cc5d9bde70e802f23 | Python | 11,552 | 368 | # -*- coding: utf-8 -*-
#
# 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.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
i... |
7961c40ac4f1de5b3c7344478f2e713b8b3e05e8510bef7ac0e363ee7f48ceb6 | Python | 11,553 | 290 | # -*- coding: utf-8 -*-
# amira_header.py
"""
Module to convert parsed data from an Amira header into a set of nested objects. The key class is :py:class:``AmiraHeader``.
Usage:
::
>>> from amira.header import AmiraHeader
>>> ah = AmiraHeader.from_file('file.am')
>>> print(ah)
Each nested object is cons... |
c4b2458cf3cf95df87b39f8b5a120f23762ba1a6216b5a98f23bcab4b4c649e9 | Python | 11,553 | 286 | """A05 FIX-A: the replay output-contract fix (leverage B1, listA row 2).
Root cause (review N4, triple-replicated): ``_run_replay`` sliced every replay
member's ``container_path`` into the replayed call's output. A synthesized
boundary output node records the MODEL-output container path there (honest
output-contract m... |
c8ebf904e62ebfefda562e40ed9fdb506ebaad9034748267bf937f3afcad94bf | Python | 11,554 | 356 | """``spec.bind(model)`` over lazy outputs: generators, lazy tails, async refusals.
A bound ``generate`` whose model returns a generator runs its forwards while
the CALLER iterates, after ``generate()`` has returned. The binding must keep
steering every one of those forwards, settle ``.last_report`` only when the
itera... |
2d5db2c1d1f91bccc8f1d5023eb5ec25ed1e6156848123265ab442e65c00cd2a | Python | 11,555 | 340 | """Canonical public-surface snapshot machinery for the surface oracle."""
from __future__ import annotations
import hashlib
import json
import re
from enum import Enum
from pathlib import Path
from typing import Any
import torch
import torchlens as tl
from torchlens import constants as tl_constants
from torchlens.d... |
b4f4d3ae857d6082e335ec3602bca1e3bdb05b55ab6a1940b38477658ef8f7c5 | Python | 11,555 | 309 | import copy
import json
import logging
import os
from autouri import GCSURI, AutoURI
from .caper_wdl_parser import CaperWDLParser
from .cromwell_backend import (
BACKEND_AWS,
BACKEND_GCP,
ENVIRONMENT_CONDA,
ENVIRONMENT_DOCKER,
ENVIRONMENT_SINGULARITY,
)
from .dict_tool import merge_dict
from .sing... |
be57e9aa090a5b9199935b75fde3ae72dabb5a7acff9c2d32d4ee805c2a81f06 | Python | 11,557 | 241 | import numpy as np
import pandas as pd
import time
import pickle
import os
from PCAfold import preprocess
from PCAfold import analysis
from PCAfold import __version__ as PCAfold_version
print('numpy==' + np.__version__)
print('pandas==' + pd.__version__)
print('PCAfold==' + PCAfold_version)
# Select one dataset:
data... |
cf38ce34d55f0094820b0dabfe6f7055e38245238050a913e71edfea9743b9f6 | Python | 11,564 | 326 | """Ready-set-go task."""
import numpy as np
from neurogym.core import TrialEnv
from neurogym.utils import spaces
from neurogym.utils.ngym_random import TruncExp
class ReadySetGo(TrialEnv):
"""Agents have to measure and produce different time intervals.
A stimulus is briefly shown during a ready period, the... |
71d1696b8e3107b51ce2a58785933bb98530ae2c4640d4afb6b10883a707a3ae | Python | 11,573 | 258 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sys
import scipy
#import sklearn
#from sklearn import metrics
#from sklearn.model_selection import train_test_split
#from sklearn.metrics import mean_squa... |
996b93ba0959a760dfa886f504ddfe50cd6b8efb2ffae7a4dac5cdc13575bfac | Python | 11,573 | 282 | import itertools
import warnings
import numpy as np
import pandas as pd
from mirp._data_import.generic_file import ImageFile, MaskFile
from mirp._data_import.dicom_file import ImageDicomFile, MaskDicomFile
from mirp._data_import.itk_file import ImageITKFile, MaskITKFile
from mirp._data_import.numpy_file import ImageN... |
a4c7ee8e91cf8ea4bea641e029df5615647fcb9769aaa11e4393a8fb31988b4a | Python | 11,576 | 257 | import glob
import os
from collections import defaultdict
import numpy as np
import argparse
import pandas as pd
from scipy.stats import ks_2samp, mannwhitneyu, ttest_ind
from tqdm import tqdm
import pylab as pb
import seaborn
from mp_dip.tag_research.research_tag_features import LiterateDict
FEATURES_TO_COMPARE = ... |
7f6a0782e5cbd38e9a9db403cb25fddd9a0aa652718cc1c9f649d44c8c95a598 | Python | 11,577 | 282 | """Bundle-metadata (``bundle.json``) section + member-relation loading.
The C07X preserve-and-disclose loader doctrine (foldB D5) over the two
extension surfaces of ``bundle.json``: the ``member_relations`` table
(unknown NAMESPACED kinds load opaque under
``tl.load(unknown_relations="opaque")``; bare unknown kinds re... |
c03aab45764b7800e767b243103dd27d9d61f192d53054133c1842b04df2f096 | Python | 11,579 | 312 | """
Classic cart-pole system implemented by Rich Sutton et al.
Copied from http://incompleteideas.net/sutton/book/code/pole.c
permalink: https://perma.cc/C9ZM-652R
"""
import math
from typing import Optional, Union
import numpy as np
import gym
from gym import logger, spaces
from gym.envs.classic_control import utils... |
d9683d99fc486a75fb4b8e1170db542d82d08a73c39af3d6cb83a6ab6c5a6a26 | Python | 11,579 | 341 | # SOURCE: vendored from facebookresearch/denoiser @ main
# (denoiser/demucs.py, denoiser/resample.py, denoiser/utils.py)
#
# "DEMUCS for speech enhancement" (Defossez, Synnaeve, Adi, "Real Time Speech
# Enhancement in the Waveform Domain", Interspeech 2020, arXiv:2006.12847).
# facebookresearch/denoiser is the OFFICIAL... |
704440c4ea1235d10c18b2bb5f9d74e4d06176ccd4e79ec50e108c3f6f7cc78a | Python | 11,581 | 297 | import ssm
import ssm.extensions.mp_srslds.emissions_ext as mp_emission
import ssm.extensions.mp_srslds.transitions_ext_2 as mp_transition
import ssm.init_state_distns as isd
import scipy.io
from matplotlib import pyplot as plt
import numpy as np
import autograd.numpy.random as npr
import seaborn as sns
from ssm.plots ... |
f224db538459b12dd272d68792254e40eced2321484d68372f30e14279772f8f | Python | 11,587 | 281 | import torch
import numpy as np
from nnunet.training.model_restore import load_model_and_checkpoint_files, restore_model
from batchgenerators.utilities.file_and_folder_operations import *
from nnunet.network_architecture.generic_UNet import Generic_UNet
from nnunet.training.data_augmentation.data_augmentation_moreDA im... |
530205c10936aee461760b7dfc7c2de8fe018790213c2607691caba9afcf1715 | Python | 11,593 | 364 | # -*- coding: utf-8 -*-
#
# SimpleElastix documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 17 12:30:15 2015.
#
# 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.... |
45ed64e70d12f56acfbdd74d181d065d454dd99eb11b75e75404ed67281cbe43 | Python | 11,595 | 390 | from __future__ import annotations
from math import isnan
from types import SimpleNamespace
from larvaworld.portal.canvas_widgets.environment_models import LarvaPreviewFrame
from larvaworld.portal.simulation.preview_frames import (
capture_larva_frame,
generate_preview_frames,
)
class DummyAgent:
def __... |
a597edc90787e329774e7dd18e426216b5264b61c3f3734407e3f6b1ae30b12e | Python | 11,596 | 195 | import argparse
import os
import pickle
from collections import defaultdict
from mp_dip.obci_readmanager.signal_processing.tags import tags_file_writer as tags_writer
import numpy as np
import pandas as pd
import pylab as pb
import tqdm
from datetimerange import DateTimeRange
from mne.preprocessing import ICA
from scip... |
5bfc820ec35015f216696eb270f0f01e362209b4f5e54548b8d523e2699a85ae | Python | 11,599 | 307 | import os
import sys
import warnings
from unittest.mock import Mock, patch
import pytest
from celery import loaders
from celery.exceptions import NotConfigured
from celery.loaders import base, default
from celery.loaders.app import AppLoader
from celery.utils.imports import NotAPackage
class DummyLoader(base.BaseLo... |
412cea5d9e48bb78e055a0f38198c81beee986460a70b965b2639b23545482f5 | Python | 11,602 | 320 | import functools
import logging
import os
from typing import (
TYPE_CHECKING,
)
from galaxy import model
from galaxy.jobs.runners import (
AsynchronousJobRunner,
AsynchronousJobState,
)
from galaxy.util import unicodify
if TYPE_CHECKING:
from galaxy.jobs import MinimalJobWrapper
CHRONOS_IMPORT_MSG = ... |
6cbabeb902148918eb1580a55ad5407eb9d111b166c20d6e7d493f8ab8b9668e | Python | 11,602 | 285 | """Time model object and associated code for fitting the model to spectrograms."""
from specparam.models import SpectralModel, SpectralGroupModel
from specparam.results.results import Results2DT
from specparam.data.data import Data2DT
from specparam.data.conversions import group_to_dataframe, dict_to_df
from specparam... |
3f38c4f07a01d67a77f5231dda2e1808fa38036a223f41f88a74918590a284cb | Python | 11,603 | 362 | # 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... |
a58c85680a6a81abc32fd9382dc9cbe6b4a21e7b3cc4c4e89647b2e2650f5e4e | Python | 11,603 | 309 | #!/usr/bin/env python3
"""ds004504 (AD / FTD / HC resting EEG) — canonical 5D extraction
==============================================================
Resting-state companion to ds006036 (photic-stimulation task). Reads
EEGLAB derivatives (ICA + line-noise cleaned) for each subject and
hands the 19-channel CAR/resamp... |
a59205ee21513042a230f2344967df8598f5e938800c5fd37315db663e6a79a5 | Python | 11,609 | 369 | #!/usr/bin/env python3
#
# pybind11 documentation build configuration file, created by
# sphinx-quickstart on Sun Oct 11 19:23:48 2015.
#
# 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.
#
# A... |
8629e1fb6ee084897719fcb128196544a30df45b4d7aa3f59e82da24114ca1c6 | Python | 11,610 | 314 | '''
Testing only on the P450s.
'''
import os
import argparse
import pandas as pd
import numpy as np
import torch
import logging
from collections import Counter
from torch.utils.tensorboard import SummaryWriter
import P450_df_setup as ds
import P450_Setup as ms
import matplotlib.pyplot as plt
from LSF_Finetune_Net imp... |
cf689bc78a2bf14296555be70e6c8b9173ba42ad66ed7754d88f8d1d6b501b7f | Python | 11,612 | 277 | import re
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from collections import OrderedDict
from torch import Tensor
from torch.jit.annotations import List
class _DenseLayer(nn.Module):
"""DenseNet code, adapted from https://pytorch.org/docs/stable/torchvi... |
be7ce2352fb884b3020e8fc01490cfabf57f978562cf33bd5010c09e924e78f1 | Python | 11,620 | 265 | """Ledger of tracked Weekly slow-tier failures (mostly real-model validation).
JMT's ruling (round 2, lane-L8-ci-fix / lane-L17-integrate, 2026-10-02/03): the
Weekly slow tier must not stay red as a durable state. A failure here is
either fixed (its entry is removed in the same change) or tracked here as a
strict ``xf... |
439e8197ba7b995c84451acc9f8197deabfdafe4c010bbb177758aadaf98cf89 | Python | 11,622 | 241 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import math
import random
from copy import copy
from typing import Any
import numpy as np
import torch
from torch import nn
from ultralytics.data import build_dataloader, build_yolo_dataset
from ultralytics.engine... |
79d5b4b4019351d6e4dc622b1fd9e4d4e79f94b159fdc251b49b9e3d03ba0a82 | Python | 11,623 | 310 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
try:
from torchvision.models.utils import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
# Inception weights ported to Pytorch from
# http://do... |
08128d744f1c8d47db56c92d4c876b4decfe16b122d3df72ed53f79bcffdcc49 | Python | 11,624 | 281 | #!/usr/bin/env python3
"""
File: compare_interactions_results.py
Created: 2021/12/21
Last Changed: 2022/02/10
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 ... |
fb30d6a868158c893b28a3d480c0d3cefc9ebb999190fab22748831a397d997c | Python | 11,626 | 291 | #!/usr/bin/env python3
"""
File: replication_plot.py
Created: 2021/06/04
Last Changed: 2022/02/10
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 ... |
16162d5e88a4c2b96049121792cbc1a6fca9a021eb6031ea5611d8300842f429 | Python | 11,628 | 331 | import itertools
from collections import OrderedDict
from typing import Dict
from typing import Tuple
import numpy as np
from gymnasium import spaces
def robot_get_obs(model, data):
"""Returns all joint positions and velocities associated with a robot."""
joint_names, _ = mj_get_category_names(model, "jnt")
... |
bfb9cb32b9af4e2e14b574d07daa2bf5b415f6f51c2049204e11ef660331fb9c | Python | 11,629 | 242 | import os
import time
import argparse
import logging
import gc
from gluoncv.utils.filesystem import try_import_decord
import numpy as np
import mxnet as mx
from mxnet import nd
from mxnet.gluon.data.vision import transforms
from gluoncv.data import Kinetics400Attr, UCF101Attr, SomethingSomethingV2Attr, HMDB51Attr, Vi... |
da65eaf455d6fb6f2c159e32a8066383ebd9980df0f2fc5e42a085875df876f4 | Python | 11,630 | 299 | """Quickstart input-ladder unit tests (F17: rung law, grammar, synthesis, record).
Toy-model tier; the real-model rows live in ``test_quickstart_realmodel.py``.
"""
from __future__ import annotations
import warnings
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.quickstart im... |
08ba285cbe5e0ac0e35b607583742ea5242f277bf4f9fdee4474fea0cbca2749 | Python | 11,631 | 309 | import os
import re
from unittest.mock import patch
import pytest
from click.testing import CliRunner
from kombu.exceptions import OperationalError
from celery.bin.celery import celery
from celery.platforms import EX_UNAVAILABLE
_GLOBAL_OPTIONS = ['-A', 't.unit.bin.proj.app_with_custom_cmds', '--broker', 'memory://'... |
57cbfa6cad80b3cb56eb98e8eba9b310acc393090b37111969e63f7a6b4db352 | Python | 11,632 | 337 | import numpy as np
from scipy.special import gamma as spgamma
from scipy.special import digamma as spdigamma
from scipy.special import polygamma as sppolygamma
from scipy.special import bernoulli as spbernoulli
from scipy.optimize import root as sproot
from wormbrain.match import pairwise_distance
import mistofrutta as... |
7601c50f8f5291b1a9eb07daa1cf70e2dfbf83dfc669d3fa7a00be69dfad7ca0 | Python | 11,636 | 274 | import inspect
from absl.testing import parameterized
try:
from keras.api import ops as api_ops_root
except ImportError:
from keras import ops as api_ops_root
from keras.src import backend
from keras.src import ops
from keras.src import testing
from keras.src.ops.operation import Operation
from keras.src.tes... |
f9aeb9aa11852b620960f1241c15b6a20a58597449e4369ac9c5a54ba3d750bf | Python | 11,639 | 287 | import os
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import signal
from utils import parse_config,build_EDA_file_list,load_CDS,ScalarFormatterClass,setup_fonts
def summarize_head(cds_storage,saved_file,grad=False,align_on="start",coding=True,exclude=False):
... |
15f2a0c35bb4f92e801548796d27f48bd19755481bedfe01775120907fe8b653 | Python | 11,640 | 308 | import os
import time
import gdist
import numpy as np
import nibabel as nib
import pickle as pkl
from os.path import join as pjoin
from magicbox.io.io import CiftiReader, GiftiReader, save2cifti
from cxy_visual_dev.lib.predefine import Atlas, get_rois, proj_dir,\
mmp_map_file, L_offset_32k, L_count_32k, R_offset_32... |
6ddcfebbc076e3d9e1c4ba3f09e1de0eb54b4f9c6660c22f56c85aaf100c608b | Python | 11,641 | 348 | import numpy as np
from sklearn.preprocessing import LabelEncoder
from tqdm import tqdm
import random
from logging import warning
seed = 68
random.seed(seed)
import sys
sys.path.append('../dataProcessing')
def to_categorical(y, num_classes=None, dtype='float32'):
y = np.array(y, dtype='int')
input_shape = y.shape... |
a03e5b34511126b551600136a0efe0b1e0b8579b2acd0cf5c52cfe864cfa6597 | Python | 11,644 | 283 | """Round-23 security regression: load-time RCE via the unpickler's TYPE branch.
The r22 fix positive-allowlisted first-party CALLABLES, but the bundle
``metadata.pkl`` unpickler still admitted ANY ``torchlens.*`` TYPE unconditionally
("reconstruction path, never invoked with attacker args"). That premise is FALSE: a
p... |
a2b222ad3f7b1eb10743d010df2eabc976021494d7e8afab9322a15f234b1fdc | Python | 11,652 | 267 | # -*- coding: utf-8 -*-
"""
General framework regrouping various methods to perform transformations of the data.
===================================================
A Transformer instanciation requires:
- tr: int, it is the repetition time of the fMRI image acquisition,
- nscans: dict regrouping the number of s... |
0c796123fdfc58fa6d42bf302477f82d88f1d25136ab27e7794c4bd684ac05f0 | Python | 11,658 | 322 | #!/usr/bin/env python
'''
# Author: ChangXu
# Create Time : 2021.4
# File Name :utils_func.py
'''
import os
import sys
import numpy as np
import scanpy as sc
import random
import torch
from torch.utils.data import DataLoader
from torch.utils.data import TensorDataset
from scipy.sparse import isspa... |
9f36e982c7dd3eeef88a236bc7fdc12a99e4247d9e1c600916253559ef6f24ad | Python | 11,661 | 406 | import torch
import torch.nn as nn
from einops import rearrange
import torch.nn.functional as F
# ACTIVATIONS -- Layers that apply a non-linear activation function
class Identity(nn.Module):
def __init__(self, inplace: bool = False):
super(Identity, self).__init__()
self.inplace = inplace
def... |
a3ceee544c2f8bf42a0e10584d092778ebf8be8f575935f6f6498b61fd86880e | Python | 11,661 | 378 | import gzip
import warnings
from functools import partial
from pathlib import Path
from typing import IO, cast
import narwhals as nw
import pandera.dtypes as pat
import pandera.polars as pa
import polars as pl
import polars_config_meta # noqa: F401
from narwhals.typing import FrameT, IntoDataFrame
from natsort import... |
e4f30dddd6d1e2bee8ac6be7cf57793e13fc41689cffdb720c02d4c09e7491a1 | Python | 11,661 | 262 | """
Method for SV characterization
Copyright (C) 2021 Tham Cheng Yong
This file is part of NanoVar.
NanoVar 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 3 of the License, or
(at your option) a... |
5af92a77006d91329124372f8483f6822639299c8897956f0bf619d10a6a4237 | Python | 11,665 | 305 | import json
import pathlib
import pkg_resources
import numpy as np
from PyQt6 import uic, QtCore, QtWidgets
from skimage.color import hsv2rgb
from .. import formats
from ..geometry import shapes
from ..session import JSONEncoderFromNumpy
from ..structure import StructureLayer
from .._version import version
from .col... |
a70715fb51860f0b5af1ace738d908d92f25798592d835f71aee3b7702fbaf6f | Python | 11,666 | 322 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in the module ``tfep.potentials.ase``.
"""
# =======================================... |
48868c4cb64f8ad0f2b81e4fff9239bc424b92b38a3ed2b5a735db89874a9699 | Python | 11,668 | 307 | """W051 regressions for the ledger-to-product binding (audit 2.19 and 3.2).
* 2.19 -- the episode ledger had NO structural anchor: any grammatically
valid ledger grafted into a plain artifact's ``annotations["episode"]``
loaded with zero warnings and made the product an "episode". Loads now
anchor the header's s... |
d27bef3221e1cc4e2be90f13df7b190bb78017e7f69b6908d4e976c0092f6b02 | Python | 11,668 | 291 | """Per-fire backward timing pins (L9 memo 1.3, wave-2 subset).
One clock: every duration operand pair is ``time.perf_counter()`` from the
same process, paired at capture time by the per-node keyed LIFO. Measured
pairs live in ``GradFnFired`` event fields only (runtime DROP) and are served
by the live-trace-only ``trac... |
20312c7f19e511fcd2cedf3cba83cf7e4b6a619242ecc0b2b93c6da7a78a240b | Python | 11,669 | 299 | from typing import List
from unittest import mock
from uuid import UUID
import pytest
from api.mocks import DUMMY_USER, FakeAuthContext
from carbonserver.api.errors import (
NotAllowedErrorEnum,
NotFoundErrorEnum,
UserException,
)
from carbonserver.api.infra.repositories.repository_organizations import (
... |
5a60e1fdf3d29c3455164c023f77bbe711abeeeecd18da907ee8c79580420448 | Python | 11,669 | 358 | """I/O operations to save and load embeddings."""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from __future__ import annotations
import csv
import json
import re
from itertools import compress
from typing import TYPE_CHECKING, Any, Dict, List, Tuple, Union
import numpy as np
if TYPE_C... |
1b3331d50502b440e4e1d8de3364fbe8dad74d3788eccadef162e5cdc82f3bf2 | Python | 11,670 | 345 | import numpy as np
import pandas as pd
import os
import glob
import ptitprince
import matplotlib.pyplot as plt
from tqdm import tqdm
import os.path as op
from controller_validation import DATA_PATH
def load_data(datapath):
"""Load the gamepad dataset in datapath, and store the data in a DataFrame.
Parameters... |
520eecc83e466061f786c09ffd2c3e638720fd997837219fd0e62b6532c05a01 | Python | 11,672 | 310 | # Manage Ahead-of-Time (AOT) compiled kernels
import fcntl
import hashlib
import os
import pickle
import sys
import tempfile
import time
from functools import lru_cache
from getpass import getuser
from pathlib import Path
from typing import Hashable, TypeAlias
import ctypes
import cutlass
import cutlass.cute as cute
... |
c8f7a0bd48e9363028e2766d6addcfb0891aa1f50fac0bbd1b1870fb62d6e1e8 | Python | 11,672 | 243 | import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functional as F
from torch.utils.dat... |
3fccb2ed61df2f07caeefc318f96f8d55b8594c4e0fe8b6e8f8a8dcb78952f54 | Python | 11,674 | 243 | import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functional as F
from torch.utils.dat... |
3cf6b066e9128d24a367db8a82b96256891203b24897c5050f8c105a2095029c | Python | 11,676 | 290 | import numpy as np
import symengine as se
import sympy
from scipy.integrate import odeint
class GetSensitivityEquations(object):
# A class to generate and solve sensitivity equations for the four state, nine parameter Hodgkin-Huxley model of the hERG channel
# Arguments are provided using the Params class
... |
4bf6f83b30527450d8dc54325cde339b9cb9c57b39884850d40804306d3a7f1c | Python | 11,680 | 348 | """Security regression tests for the r27 I/O hardening fixes.
Threat model: a victim runs a DEFAULT ``tl.load`` on an attacker-controlled
``.tlspec`` DIRECTORY. These tests lock three fixes:
* F-1 -- the intervention tensor-sidecar loader
(``torchlens/intervention/save.py::_load_tensor_refs``) must reject a manifes... |
f54948461d1094b250bb880e73526410ae4dee247423558be8301de8a66980a0 | Python | 11,680 | 244 | import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functional as F
from torch.utils.dat... |
dc9bb8d7c2e81c8ea9c38a70a767ce8a1f131ff98ff73e594cd2c4e761f2fa52 | Python | 11,683 | 242 | import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functional as F
from torch.utils.dat... |
0fc81b4908b191782c20647837683c4d095eae405db4da5febd89f10fb9a40e5 | Python | 11,685 | 297 | import logging
import time
import traceback
import numpy as np
from PyQt6 import QtCore
import pyqtgraph as pg
from pyqtgraph import functions as fn
from ..geometry import pg_roi_to_impose_shape
from ..geometry.shapes import rotate_around_point
from ..structure import StructureComposite
logger = logging.getLogger(_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.