sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
223fc04086bd5e0790c85ed58f350b7759001f303e43f67c15c7c9fe14dd39cc | Python | 691 | 26 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""QtHelp Wrapper."""
from . i... |
3c8de98faf05c6894408f3a70dcf229478ce3f1756fc6fd7fc2f3fa3988a8531 | Python | 691 | 21 | import pandas as pd
import numpy as np
extended_p_me_t = pd.read_csv("../probabilistic_mapping_extention/extended_p_me_t.csv", index_col=0)
common_t_types = extended_p_me_t.index
msk_t_types = np.asarray([("IMN" not in x) & ("NN" not in x) for x in common_t_types])
common_t_types = common_t_types[msk_t_types]
extend... |
51aae1aba7dba122c2ad997aa272950076b08e6ca9d463631c4f2add893d1743 | Python | 691 | 23 | #!/usr/bin/env python
"""
Test Dave XML generators.
"""
import os
import storm_control.test as test
import storm_control.dave.xml_generators.v1Generator as v1Generator
def test_v1_1():
"""
This just tests that the XML file is created without crashing. The positions
file is the expected format, but with... |
2f784e7bc3c392f7ad61d06c305e809a95000d7c64fec29b8f64d430e23ed60a | Python | 692 | 14 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
# region_layer_map omitted -> framework auto-selects best layer per region.
# behavioral_readout_layer='fc_norm' = pooled (B,dim) vector for decoder-fit... |
3fd8e2f6de8e598f727bda05604fe6ae3956c76c49e657be2856e8d1f534949b | Python | 692 | 24 | import unittest
from ogo.calib.calibration import Calibration
class Test_Calibration(unittest.TestCase):
def setUp(self) -> None:
""" Use this method to prep data or files for other tests, if necessary. """
pass
def tearDown(self) -> None:
""" Use this method to clean up after the t... |
6df8118ead1fc46527d1d962b4345533cbd06eff5906f92d2ed7c25cc938e439 | Python | 692 | 26 | import pandas as pd
label = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/cresci-rtbust-2019/label.csv')
main_user = pd.read_csv('./user_feature.csv')
user = main_user.loc[0:len(main_user)-1]
user_list = list(user['user_id'])
del_list = []
bool_label = []
for i,r in label.iterrows():
if r[1] == 'human... |
ad33ab191cbeb389bef33b6f2bf976dbfef88a679ea6017171659a9953b6c43e | Python | 692 | 24 | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 15 19:06:54 2019
@author: Yoshi
"""
def color_key_generator(frequencies):
# Finds number of colors needed for key
steps = len(frequencies)
# Dictionary to store colors
color_key = {}
# Calculates hue, saturation, and value for each freq... |
87491baaba15979a53743fb3601a7a9a67786969a10210c70522aeecc79ee7b3 | Python | 693 | 25 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
author="Jean-Philippe Fortin, Nick Cullen, Tim Robert-Fitzgerald",
author_email='fortin946@gmail.com,',
classifiers=[
'License :: OSI Approved :: MIT Lice... |
af8b832a143e84be4f5be11521cfdc9c3a723336b698ad56d3f16e1a6ac23134 | Python | 693 | 38 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# In[12]:
import anndata
import numpy as np
import scvelo as scv
import pandas as pd
import sys
sys.path.append('../../../')
import velovae as vv
import time
import os
root = '< your root path >'
dataset = 'TLS'
adata = anndata.read_h5ad(f'{root}/data/{dataset}.h5ad')... |
c4c9a717462bcd3ec1b1dd255491f21fcd4daf2268843773d75ec746e95301ff | Python | 693 | 16 | # Copyright 2024 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
fe4dfe0c691c440abc0329089b8508b2124a3710e5b3daafd18fce49024ea923 | Python | 693 | 24 | import pytest
from brainscore_vision import load_dataset, load_stimulus_set
from brainscore_vision.benchmark_helpers import check_standard_format
@pytest.mark.private_access
def test_format():
assembly = load_dataset('Cadena2017')
check_standard_format(assembly, nans_expected=True)
@pytest.mark.private_acc... |
7ba976103a6c54a01406d3338110d543b2f772335552a996665230af9f9399e7 | Python | 694 | 18 | """A package that contains the ViRelAy application, which to view source-data, attributions, clusterings, and (t-SNE-)embeddings."""
try:
from virelay.version import version as VERSION
except ModuleNotFoundError:
VERSION = 'unknown'
__version__ = VERSION
"""Contains the version of the ViRelAy application."""
... |
c9dcd62b3c600a984228bfbbedf14b78c24ee6d81b7012c67ea2df634400d7d4 | Python | 694 | 30 | """Print the free energy of different runs.
"""
from sys import argv
if len(argv) != 2:
print("Please pass the number of states, e.g. python 2_print_free_energy.py 8")
exit()
n_states = int(argv[1])
import pickle
import numpy as np
best_fe = np.inf
for run in range(1, 11):
try:
history = pickle... |
fb1326f88f37ed3766038d9be686d4ca9c439aa1d4fbc1e9bea183163febd0df | Python | 694 | 32 | # -*- coding: utf-8 -*-
# external inputs
import numpy as np
def filter_sigmoid(x, alpha=4):
"""Filter sigmoid.
Nonlinear sigmoid filter to adjust sharpness of ocular dominance. If
sharpness factor is set to zero, nothing is changed on the input image. The
sigmoidal filter outputs an array with in... |
ecee6d946ae74eb99543991e92128160a326f48a004e53cb0707859228fbe831 | Python | 695 | 23 | """Nottingham MEGUK: Save Training Data for Burst Detection Analysis."""
import mne
from glob import glob
from osl_dynamics.data import Data
def get_downsampled_data(filename):
raw = mne.io.read_raw_fif(filename)
raw = raw.resample(100) # Downsample to 100 Hz
x = raw.get_data(picks="misc", reject_by_anno... |
f76b196966266f46056692774c9990217e08d6bdb48b72c2459e91ab48b68cf3 | Python | 695 | 30 | from scipy.signal import tukey, butter, filtfilt
def butter_bandpass(lowcut, highcut, fs, order=2):
nyq = 0.5 * fs
low = lowcut / nyq
high = highcut / nyq
if low < 0:
Wn = high
btype = "lowpass"
elif high < 0:
Wn = low
btype = "highpass"
else:
... |
172b6f2b6a44f30d2fc157ce450936e6e5377d70a0a71a8da7c84c0f6ac685d2 | Python | 696 | 29 | from typing import Any, Dict
import argparse
import json
import numpy as np
def write_to_json(
input_: Dict[str, Any],
output_file: str,
folder: str = "resources"
):
"""
Write dictionary to .JSON file
:param input_: dictionaty to be written
:param output_file: .JSON file name
"""
... |
181ea35bfcf9cc9d40f3da30b53b393d76a205e2c8d75e4160a4a8f974f4e00b | Python | 696 | 30 | from __future__ import absolute_import
from .base_dataset import BaseDataset, BaseImageDataset
from .preprocessor import Preprocessor
class IterLoader:
def __init__(self, loader, length=None):
self.loader = loader
self.length = length
self.iter = None
def __len__(self):
if se... |
2e6fd3460aec4ceb815236825cfab82b556ce6f22c955935cbcaa9fb3f5580c0 | Python | 696 | 24 | # Generated by Django 4.2.15 on 2024-11-06 15:39
from django.db import migrations, models
import cvat.apps.quality_control.models
class Migration(migrations.Migration):
dependencies = [
("quality_control", "0003_qualityreport_assignee_last_updated_and_more"),
]
operations = [
migration... |
83a437c4e9ddb8337646faa29c3e96338a87ce711e23b7e61f7587e9b6d15226 | Python | 696 | 34 | from tempfile import NamedTemporaryFile
from bx.misc.cdb import FileCDBDict
def test():
d = {}
for i in range(10000):
d["foo" + str(i)] = "bar" + str(i)
# Open temporary file and get name
file = NamedTemporaryFile()
file_name = file.name
# Write cdb to file
FileCDBDict.to_file(d... |
baa542dab2efc7bf3d5e802ee55033b7e5cd97ef662994d84e7bd39eb3645c20 | Python | 696 | 27 | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from ._label_file import Annotation
from ._label_file import write_label_file
@dataclass(frozen=True)
class SaveRequest:
filename: str
annotation: Annotation
image_height: int
image_width: int
save_imag... |
e36ce4fdad5934cd35f7a875ae71c7bb003118ab93426bf0d1a21384eea5120b | Python | 696 | 25 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtTextToSpeech clas... |
f0805bd62ec0b9125ebd7f1641427990d66f1623df2b5f0119b99adcde671d03 | Python | 698 | 38 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# In[12]:
import anndata
import numpy as np
import scvelo as scv
import pandas as pd
import sys
sys.path.append('../../../')
import velovae as vv
import time
import os
root = '< your root path >'
dataset = 'scifate2'
adata = anndata.read_h5ad(f'{root}/data/{dataset}.h... |
0521ee4a568ea0c7311a91a84f92f03eaeb22e6d6ff9cd069808d483f52cdcca | Python | 699 | 25 | # Generated by Django 4.2.25 on 2025-10-21 15:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("engine", "0093_issue_assignee_updated_date_alter_issue_assignee_and_more"),
]
operations = [
migrations.AlterField(
model_name=... |
ad0b20b7b67697b4a4c2b23eb760fcbcecc5485ed1fd80d7c14afe8f55524d50 | Python | 699 | 24 | #%%
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
from relaxationColorMap import relaxation_color_map
from matplotlib.colors import ListedColormap
# Load the MATLAB file containing an example T1 map
im = np.load(Path(__file__).parent / 'sampleT1map.npy')
loLev = 400.0
upLev = 2000.0
# C... |
e26279b07fc47a45da677182dad157a8d65a414b5f296555ce7421b5d40bd4a8 | Python | 699 | 30 | #!/usr/bin/python3
#
import unittest
from uac.element import Element
class TestElement(unittest.TestCase):
def test_init(self):
e = Element(1, ["1", "2", 3.0, "4", 5], "11")
self.assertEqual(e.type, 1)
self.assertEqual(e.n, [1, 2, 3, 4, 5])
self.assertEqual(e.reg, 11)
def test... |
0ae0c5a82ce409ce284dd4c340df32c7e91da5ba996f756ee2f662f0205bff0b | Python | 700 | 33 | import matplotlib.pyplot as plt
import pandas as pd
cases = ['Alessia','Alessia']
models = ['arterial','arterial']
elements = ['A1','A45']
mmHg_to_Pa = 133.3616
plt.figure()
data = pd.read_csv("results\\" + cases[0] + "\\" + models[0] + "\\" + elements[0] + ".txt",header=None)
t = data[0]
#p = data[1]
p = (data[1]-... |
21eb9cc5375dcc4d174df1d0ea1c69bbb51d7ca3c0edc2a5233a99eb4bbbb475 | Python | 700 | 19 | from dataclasses import dataclass
from .cell_modification_parameters import (
CellModificationParameters,
AxonModificationMode,
)
@dataclass
class UmaxHModificationParameters(CellModificationParameters):
"""Parameters to create a neuron of an adult, human with unmyelinated axon using L2/3 PC rat BB: huma... |
2ac57fffcc1644dce377e8947885f9ecfbed99eb76f0c4b18c7a86d6ec7e6283 | Python | 702 | 28 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from .base import BaseDataset
from .build import build_dataloader, build_grounding, build_yolo_dataset, load_inference_source
from .dataset import (
ClassificationDataset,
GroundingDataset,
PolygonSemanticDataset,
SemanticDataset,
... |
5d6767dcb1138c7179a116e8ea87ee108424100f08586975f51b6f42fe5e5a5e | Python | 702 | 24 | import os
import sys
import subprocess
studyDataDir = "/media/miplab-nas2/Data/Karolis/huppi_high_res_resting/"
subject = "sub-LAM022"
sys.path.append('/home/degutis/dynamicConnectivityMovieWatching_2025/fmri-analysis/library')
inv2_path = f"{studyDataDir}/{subject}/anat/{subject}_inv-2_MP2RAGE.nii"
uni_path = f"{s... |
95c3d7e65e2b29c6a614e020e46c4a209cda6208e3508a00d2dc20272661646e | Python | 702 | 22 | # model settings
norm_cfg = dict(type='BN', requires_grad=True)
model = dict(
type='DepthEncoderDecoder',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3, 4),
style='pytorch',
norm_cfg=norm_cfg),
decode_head=dict(
type='De... |
5ad38867fe9424e2626c3845d80e4f4f6d622a915409dbbc2e79ad1d1ab8222f | Python | 703 | 41 | #!/usr/bin/env python
"""
Split fasta files including paired-end reads into two separate files
"""
from __future__ import print_function;
import sys;
import re;
outfile1="";
outfile2="";
for i in range(len(sys.argv)):
if sys.argv[i]=="-o":
outfile1=sys.argv[i+1]+"_1.fa";
outfile2=sys.argv[i+1]+"_2.fa";
if ... |
a2e23c88e065b1e802262a792ca5f487b77306e797fe2154dfb9fde0b6a16ff2 | Python | 703 | 14 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
# region_layer_map omitted -> framework auto-selects best layer per region.
# behavioral_readout_layer='linear_head' -> pooled 1000-logit output (clean ... |
e362962401a385c8b97b5ca6be149780ec66c84c333f044a0c7ca51e4aeeafd5 | Python | 703 | 19 | from dataclasses import dataclass
from .cell_modification_parameters import (
CellModificationParameters,
AxonModificationMode,
)
@dataclass
class MaxhModificationParameters(CellModificationParameters):
"""Parameters to create a neuron of an adult, human with myelinated axon using L2/3 PC rat BB: human E... |
48795a4b10484ca1730a3a9e2a2aedf200ef97d5fd3108ac4eac65ba556215fc | Python | 704 | 23 | import os.path as op
import numpy.testing as npt
import AFQ.data.fetch as afd
from AFQ.utils.conversion import matlab_mori_groups, matlab_tractography
DATA_PATH = op.join(op.abspath(op.dirname(__file__)), "../../tests/data")
def test_matlab_tractography():
sft = matlab_tractography(
op.join(DATA_PATH, ... |
6536c8c723676f4fff5ae2992fb24eddb1856d9b1bb78e4bf728eabddade1f12 | Python | 705 | 30 | import tomlkit
def _get_module_version():
with open("src/eir/__init__.py") as infile:
file_contents = infile.readline()
version = file_contents.split("__version__ = ")[-1].strip().replace('"', "")
return version
def _get_project_meta():
with open("pyproject.toml") as infile:
file_co... |
899a219f53aff5e6d9322d6f3539270416aee5b6192fe78a35bd1bbec4dfbcb6 | Python | 705 | 32 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 30 12:23:10 2024
@author: Alfred
"""
from scipy import stats
import numpy as np
import scikit_posthocs as sp
#error baseline
score_2 = model_vermont.evaluate(hawaii_data1, hawaii_labels1)
score_3 = model_vermont.evaluate(nevada_data1, nevada_labels1)
... |
a744976e7ab558baa338780f61ef210486776b77a6e45740084f7a235feea332 | Python | 705 | 25 | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from functools import lru_cache
from . import BaseWrapperDataset
class Appen... |
d7d4dde2e7d1feff735dac6ec7a7d65c97cd1bbaaa3e537edb204d5c4a3a22d0 | Python | 705 | 23 | """Start ChemGraph's MCP server via HTTP (streamable_http).
This is a thin convenience wrapper around ChemGraph's built-in MCP
server. It is equivalent to running:
python -m chemgraph.mcp.mcp_tools --transport streamable_http --port 9003
Usage
-----
python start_mcp_server.py # default port 9... |
09ceb8546f96fc0422da42953d2b9a54b6376743db32d9511b8d9aa741b1d1d8 | Python | 706 | 19 | import pandas as pd
def concatenate_and_discard(file1_path, file2_path, output_path):
# Read the two CSV files into DataFrames
df1 = pd.read_csv(file1_path, sep='\t')
df2 = pd.read_csv(file2_path, sep='\t')
# Merge the two DataFrames based on the first column (assumed to be the names)
merged_df = ... |
100fe3027ab212efb2ad309e4de37bd69e3c99d1573baa04fa98875a07944f32 | Python | 706 | 26 | """
Standalone core image processing functions that do not
need to be part of the volVis object. This facilitates
modifying and extending volVis without having to touch
the main main.py file and without bloating it much.
"""
import numpy as np
def default_hist_range(y, x):
"""
Returns a reasonable values f... |
138bb43171908cdd50c2d3d6dea7e9a63497d71c1c2d4358272fd7b2f602031a | Python | 706 | 27 | '''
embeddings::model_auxiliary.py
Auxiliary functions for model fitting (e.g., time steppers
for solving ODEs). Available as embeddings.model.*
'''
from .internal import *
import numpy as np
from typing import Any, Callable, Union
def rk4(dydt: Callable, y: np.ndarray, dt: float, *args: Union[Any, None])... |
4c78069010e1c072d24980721bfbb2d5bda231ab3dc32d106b89f9f9d81ea451 | Python | 706 | 26 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtXml classes and f... |
51358e4a8d2dd58e236e60b482b15e08f5854994181a3e06f79e78f7bf413823 | Python | 706 | 25 | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from functools import lru_cache
from . import BaseWrapperDataset
class Prepe... |
67fb14f4634b67f2c7f1d6853b09efaea57ae153f46ce4101e956d06f3194d76 | Python | 706 | 30 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from collections.abc import Mapping
import attrs
from cvat_sdk.datasets.common import FrameAnnotations
@attrs.frozen
class Target:
"""
Non-image data for a dataset sample.
"""
annotations: FrameAnnotations
"""Annotations for ... |
eee6dc530febdb6e7b411e55141639f0edabf17fe16bc81ee69d2581e58682ae | Python | 706 | 26 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtQml classes and f... |
11a951ebe6a32b7db9d9523281c00aa49ac2f4ff95556651087f7d2227b144e8 | Python | 707 | 21 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from django.urls import include, path
from rest_framework import routers
from cvat.apps.quality_control import views
router = routers.DefaultRouter(trailing_slash=False)
router.register("reports", views.QualityReportViewSet, basename="quality_repor... |
7b394e87f13686f65707b210dc75cd2218db149fd78e1d27253fe56e602799de | Python | 707 | 24 | """ Creates a cone,cylinder,cube and sphere surface mesh """
import SVMTK as svm
from pathlib import Path
if __name__ == "__main__":
print("Start ",__file__)
outdir = Path("results")
outdir.mkdir(exist_ok=True)
surf = svm.Surface()
### Defining an implicit surface ###
def torus(x,y,z):
... |
88131a895ced82f54d1154dbc1235f22aa4382a9cb553072b433afe96b85f1dc | Python | 707 | 22 | from .base import WaveformBenchmarkDataset
class OBST2024(WaveformBenchmarkDataset):
"""
The OBS dataset from Niksejel & Zhang (2024)
"""
def __init__(self, **kwargs):
citation = (
"Niksejel, A. and Zhang, M., 2024. OBSTransformer: a deep-learning seismic "
"phase pick... |
9aa0b2761f19731a504c4a927d409fc02fe460629756a861a8e00e22d442cf94 | Python | 707 | 27 | from __future__ import annotations
from dataclasses import dataclass, replace
from typing import Optional
@dataclass(frozen=True)
class ImagePath:
filename: str
scene: Optional[int] = None
channel: Optional[int] = None
def with_channel(self, channel: int):
return replace(self, channel=channe... |
a19ab063bef316a226cf50b1785f15a414d51335eba81f6c3d4a12c21d672352 | Python | 707 | 16 | from brainscore_vision import metric_registry
from brainscore_vision.metrics.regression_correlation.metric import CrossRegressedCorrelation, pearsonr_correlation
from .metric import mask_regression
metric_registry['mask_regression'] = lambda *args, **kwargs: CrossRegressedCorrelation(
regression=mask_regression(),... |
e4a08d96c4a701821ab2e6fba494a2ecbff45c98fe083b616f78a1f5abba9ba7 | Python | 707 | 14 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers
# region_layer_map omitted -> framework auto-selects best layer per region.
# behavioral_readout_layer='linear_head' -> the pooled 1000-logit output (cl... |
92fb1bfdb3730ac18acf032bb4c65210e88d558093dc405336b863ace6fa9983 | Python | 708 | 17 | from .phasenet import VariableLengthPhaseNet
class LFEDetect(VariableLengthPhaseNet):
"""
This detection and phase picking model for low-frequency earthquakes (LFEs) is based on PhaseNet.
Please note that, for the time being, LFE detection models do not reach the quality of EQ detection models.
.. do... |
932e986b742905bc16f4fdf4f71cf7c3addd4096b4e567779645f0fd3e732401 | Python | 708 | 26 | """
DLCNN artifact detectors for EEG signals.
Each detector implements a lightweight 1D-CNN for binary classification
of a specific artifact type.
"""
from .eye_movement import EyeMovementDetector
from .muscle import MuscleArtifactDetector
from .non_physiological import NonPhysiologicalDetector
from .rule_based impor... |
ca84598aa38f9dac844be1a3d4e529bbdf41ff0da32168e30d213b3b9f5f36a3 | Python | 708 | 33 | """
FLYNC: lncRNA discovery pipeline for Drosophila melanogaster
A bioinformatics pipeline for discovering and classifying non-coding genes.
Combines RNA-seq processing, feature extraction from genomic databases,
and machine learning prediction.
"""
__version__ = "1.0.0"
__author__ = "FLYNC Contributors"
from import... |
d0c4b93e72b1ce2b2beb314f4ee12f1cea5d70a12e6168eca529cefec38b0d92 | Python | 708 | 26 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from rest_framework import exceptions
from rest_framework.authentication import TokenAuthentication
from . import models
class AccessTokenAuthentication(TokenAuthentication):
keyword = "Bearer"
def authenticate_credentials(self, key):
... |
5c8257db3d46f6f7095457c91475b16ad63c7248752b8508acea3b0c5c1bf060 | Python | 709 | 24 | # ========================
# 📦 Imports & Setup
# ========================
import streamlit as st
from src.utils.app_utils import render_fraunhofer_impressum, render_fraunhofer_privacy_policy, set_mypage_config, footer
# ========================
# 💅 UI Configuration
# ========================
set_mypage_config()
st... |
7b0fa83196284ec52799d7e5d865b9899eb64c5af8ae53a2d1957f6b4bb2234e | Python | 709 | 27 | import os
import numpy
import pandas
import impedancefitter
frequencies = numpy.logspace(2, 7, num=50)
R = 100.0
C = 1e-7
# generate model by user-defined circuit
model = "parallel(R, C)"
lmfit_model = impedancefitter.get_equivalent_circuit_model(model)
Z = lmfit_model.eval(omega=2.0 * numpy.pi * frequencies, R=R,... |
19540496516a284785c27f143b7d6ed2098a27ba24a7f0d428989df5db6c6667 | Python | 710 | 36 | #!/usr/env python
import numpy as np
import sys
inp = sys.argv[1]
NX = int(sys.argv[2])
TEMPERATURE=300 # Kelvin
def CalcFreeEnergy (densit, temperature):
kb = 0.008314 # Boltzmann constant kJ/mol/K
kbt = kb*temperature
fes = []
for d in densit:
if d <= 0.0: fes.append(10000.0)
else: fe... |
ecf236701c54a7cf783675a04033c994c78fc6c6577002b99c7c5753385fb541 | Python | 712 | 22 | # test.py - hk_model_2 tests (Self-supervised SwAV)
import pytest
import brainscore_vision
def test_hk_model_2_has_identifier():
model = brainscore_vision.load_model('hk_model_2')
assert model.identifier == 'hk_model_2'
def test_hk_model_2_has_activations_model():
model = brainscore_vision.load_model('hk_... |
f93d16d38470fc09f50eb36b5733d952f6a1795a11f01a80f7884fd9a4bb85f7 | Python | 712 | 12 | def add_elements_to_pdb(input_pdb_file, output_pdb_file):
with open(input_pdb_file, 'r') as f_in, open(output_pdb_file, 'w') as f_out:
for line in f_in:
if line.startswith('ATOM') or line.startswith('HETATM'):
atom_name = line[12:16].strip()
element = atom_name[0]... |
6aa1eb313bed8515bab542e3c7b1ca72daf7698c7f138300de396eef732752c8 | Python | 713 | 16 | # Copyright (c) 2026 Rohit Jena. All rights reserved.
#
# This file is part of FireANTs, distributed under the terms of
# the FireANTs License version 1.0. A copy of the license can be found
# in the LICENSE file at the root of this repository.
#
# IMPORTANT: This code is part of FireANTs and its use, reproduction, or... |
9c266894660408b09669a7d6668e7463554b6633d0e4eb06073a91d8b34b1d47 | Python | 713 | 20 | # 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, ... |
a1e60997516bf5aa8fa8704be125fe5e83cb8b866639ec4dfc581b5d28ba57b2 | Python | 713 | 25 | import torch
import argparse
def parse():
parser = argparse.ArgumentParser(description='Process mono3d results.')
parser.add_argument('--file-path', type=str, help='input file path')
parser.add_argument('--out-path', type=str, help='output file path')
args = parser.parse_args()
return args
if __na... |
ae2d756db4740109f21875f51cfbb30ddf50539810aa8bf67cf0485c959c1e66 | Python | 713 | 27 | """
DHG-LGB: Disease-Hypergraph Integrated with LightGBM
A framework for predicting metabolite-disease associations using
hypergraph neural networks and gradient boosting.
Usage:
# Import specific modules as needed
from src.models import HGNNModel, LightGBMClassifier
from src.evaluation import compute_met... |
bc92726785e5d451df6aae96a60412a8e313ebb9dc43e8dbf21b1ea3eeeddd4c | Python | 713 | 25 | import click
from _cli import LazyGroup
# @click.group(
# cls=LazyGroup,
# lazy_subcommands={
# "mesh-generation": "brainmeshing.mesh_generation.meshgen",
# "process-surfaces": "brainmeshing.mesh_generation.process_surfaces",
# "extract-ventricles": "brainmeshing.mesh_generation.extra... |
1572ebcacb8be3e75f36d7396a7260852ca1771df4e6e853a3c9053ee7b6b59b | Python | 714 | 30 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 4 14:19:39 2019
@author: Yoshi
"""
import numpy as np
def cell_noise_flagger(cell_number,correlation_coefficients,threshold):
# Cutoff for determining what"s considered responsive and what"s not
if threshold == "Default":
threshold = 0.6
... |
604197262892c7e3e48fe1e61f36194952983daa3a697fda0726a8770b284d02 | Python | 714 | 27 | #!/usr/bin/env python
import storm_control.sc_library.halExceptions as halExceptions
import storm_control.hal4000.testing.testActions as testActions
import storm_control.hal4000.testing.testing as testing
import storm_control.test as test
#
# Check the default parameters.
#
class LockConfigTest1Action(testActions.G... |
9bc4cd41820ddbf48f352dee4f44e96e03409ad53495e0a8b1f44d35157743d4 | Python | 714 | 21 | import torch
from .base_distance import BaseDistance
# Signal to Noise Ratio
class SNRDistance(BaseDistance):
def __init__(self, **kwargs):
super().__init__(**kwargs)
assert not self.is_inverted
def compute_mat(self, query_emb, ref_emb):
anchor_variances = torch.var(query_emb, dim=1)... |
25b473f61ace210aec9a60d116135f9e3459486f5e45e33635efb7cb0407fb5a | Python | 715 | 29 | import networkx as nx
from karateclub import Role2Vec
import numpy as np
import os
import numpy
from tqdm import tqdm
edge_path=r'Twibot-22/edges.npy'
edge_index=list(np.load(edge_path))
edges=[]
dataset_name='Twibot-22'
id_include=(np.load(dataset_name+'/id_include.npy',allow_pickle=True))
if not os.path.exists(datase... |
31f8b1a26948f6398cbf551e93611dca022ff9bd37ade65212ac956923a74f1e | Python | 715 | 28 | '''Script to visually inspect color maps.'''
import click
import numpy as np
from PIL import Image
from zennit.image import CMAPS, palette
def semsstr(string):
if isinstance(string, list):
return string
return [obj for obj in string.split(';') if obj]
@click.command()
@click.argument('output')
@cli... |
92ed0664fb05b65262b07730623f3c75d0398336512f6ba7b6e3415ff1ca1926 | Python | 715 | 29 | import torch
import lion_pytorch
import bism.loss.cl_dice
import bism.loss.tversky
import bism.loss.dice
import bism.loss.jaccard
_valid_optimizers = {
'adamw': torch.optim.AdamW,
'adam': torch.optim.Adam,
'sgd': torch.optim.SGD,
'lion': lion_pytorch.Lion,
'adamax': torch.optim.Adamax
}
_valid_lo... |
c33efbafdb7d6005b9dea5449b3bfffd186a107236d400edcb804aa4d3aa48d5 | Python | 715 | 21 | from pathlib import Path
import shutil
from deep_events.gaussians_to_training import extract_events
FILEPATH = Path(__file__).parents[0]
def test_extract_events():
folder = FILEPATH / "data/220927_mitotrackergreen_cos7_ZEISS_fl"
event_folder = folder.parents[0]/"test_event_data"
extract_events(folder/"... |
0dfa44bb366232a18e28411c0af4ecb73a90b5d92db947e7e41e3e990e6dd1da | Python | 716 | 32 | #!/usr/bin/env python
"""
Steve tests.
"""
import pytestqt
import storm_control.sc_library.hdebug as hdebug
import storm_control.sc_library.parameters as params
import storm_control.steve.steve as steve
import storm_control.test as test
import storm_control.test.hal.halSteveTest as halSteveTest
def test_steve_hal(... |
8d647dea9ad78a302bb99422e0ca91ce208251b584188aae24a1c3944f699b7f | Python | 716 | 27 | import base64
import requests
def encode_image_to_base64(file_path: str) -> str:
with open(file_path, "rb") as image_file:
image_bytes = image_file.read()
return base64.b64encode(image_bytes).decode("utf-8")
def send_request(url: str, payload: list[dict]) -> list[dict]:
response = requests.... |
e9628a683612c1b2809f13bf6ec4234caef7f0bfe8dc7b4c09f3d5a2b249c7a7 | Python | 716 | 35 | #!/usr/bin/env python
"""
Read a MAF from standard input and determine the mean length of ungapped pieces
in each block.
usage: %prog < maf > out
"""
import sys
import bx.align.maf
def main():
for m in bx.align.maf.Reader(sys.stdin):
ungapped_columns = 0
ungapped_runs = 0
in_ungapped =... |
57c59cec17393b5ef3283e8d863b79dd8de0fa9d86fddc8d2367f036862e65dd | Python | 717 | 34 | #!/usr/bin/env python
"""
Translate a maf file containing gap ambiguity characters as produced by
'maf_tile_2.py' to a new file in which "#" (contiguous) is replaced by "-" and
all other types are replaces by "*".
TODO: This could be much more general, should just take the translation table
from the command lin... |
b9bd41365df2e621bb11b461b4d9983cfb1064307bbf79dab333f4c34e6d5c48 | Python | 717 | 21 | from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, LAYERS
model_registry['alexnet_fov4'] = lambda: ModelCommitment(
identifier='alexnet_fov4',
activations_model=get_model('alexnet_fov4'),
layers=LAYERS,... |
9ea3adbe45cebc8d3a0b20f36bb4cc88dd1071ac27e5178c12be548a4d39229a | Python | 718 | 30 | import dask.array as da
from distributed import Client, LocalCluster
from sklearn.datasets import make_blobs
import lightgbm as lgb
if __name__ == "__main__":
print("loading data")
X, y = make_blobs(n_samples=1000, n_features=50, centers=2)
print("initializing a Dask cluster")
cluster = LocalCluste... |
cb6e3e9b4644da613af93101f3aac3e67ff18f6113e3a3b313c9e89e4f1d3e51 | Python | 718 | 29 | from scipy import stats
import numpy as np
from .base import Distribution
class Uniform(Distribution):
"""Uniform prior.
Parameters
----------
lower : scalar or ndarray
Lower bound of distribution
upper : scalar or ndarray
Upper bound of distribution
"""
def __init_... |
cbff171a2df96e2767564960ecd07c142f8c1b059428df748cedd22f133efc3d | Python | 718 | 20 | from brainways.ui.brainways_ui import BrainwaysUI
def test_open_sample_project(app: BrainwaysUI):
assert app._project is None
app.viewer.open_sample(plugin="brainways", sample="sample_project")
assert app._project is not None
def test_open_sample_project_annotated(app: BrainwaysUI):
assert app._proj... |
6ca9687b36a56b295c799b78ef0d98e79900ea5f1f81ae516363124cfce60ae6 | Python | 719 | 27 | """ """
import SVMTK as svm
from pathlib import Path
if __name__ == "__main__":
print("Start ",__file__)
outdir = Path("results")
outdir.mkdir(exist_ok=True)
surf = svm.Surface("../Data/lh-pial.stl")
# Create a cut plane
plane = svm.Plane_3(0,0,1,-5.41)
# Cut surface
slce = surf.g... |
5a06aaa9eb598f6699566f821a19204dfd0fbfa27e96a715d411daa434e8cc39 | Python | 720 | 35 | import matplotlib.pyplot as plt
import pandas as pd
# Halasz_P045_resistance
# Reymond_103
# Reymond_103_Q
cases = ['Hepa_3','Hepa_3']
models = 'hepa'
elements = ['MAP','PVC']
mmHg_to_Pa = 133.3616
plt.figure()
data = pd.read_csv("results\\" + cases[0] + "\\" + models + "\\" + elements[0] + ".txt",header=None)
t =... |
dbefab8e93096ce6aebe09c53ddae9c9d6c93d7582aab426b9aa08dff6357ae0 | Python | 720 | 22 | import torch
import os
import numpy as np
class CommonVoiceSpectrogramDataset(torch.utils.data.Dataset):
def __init__(self, df, cv_dataset_path, label_col, spectrogram_dir_name):
self.sound_paths = list()
for index, row in df.iterrows():
self.sound_paths.append(os.path.join(cv_dataset... |
1a397fd274ad937ad1862bcc2647db8db2fdebb9e6ee14adcb42cba16fa40569 | Python | 721 | 37 | import asyncio
class IterableQueue:
def __init__(self):
self.queue = asyncio.Queue()
self.sentinel = object()
def put(self, item):
return self.queue.put(item)
def close(self):
return self.queue.put(self.sentinel)
def join(self):
return self.queue.join()
def __aiter__(self):
retu... |
3f000c140acde8861ce530d56e78b15e5e790b82355b6de911d644a4b0de930a | Python | 721 | 24 | """
Detects whether the .NET runtimes required to run thalamus/dotnet/dotnet.exe
(an ASP.NET Core / gRPC app, see dotnet/dotnet/dotnet.csproj) are installed.
"""
import os
import glob
REQUIRED_FRAMEWORKS = (
('Microsoft.NETCore.App', 8),
('Microsoft.AspNetCore.App', 8),
)
def is_available() -> bool:
'''
Chec... |
496023a82d20a9cb3d3db93307dda9b6d51d057f885875e4beec17f79be1f41e | Python | 721 | 26 | import dotenv
import hydra
from omegaconf import DictConfig
# load environment variables from `.env` file if it exists
# recursively searches for `.env` in all folders starting from work dir
dotenv.load_dotenv(override=True)
@hydra.main(config_path="../configs/", config_name="test.yaml")
def main(config: DictConfig)... |
6b435738539e7608d5941df48a4bb3f4c89f295a2e21cdb1ea22210112cf747c | Python | 721 | 28 | from .sfcn import SFCN
from .sfcn_bin import BinarySFCN
from .sfcn_cat import CategoricalSFCN
from .sfcn_multi import MultiTaskSFCN
from .sfcn_reg import RegressionSFCN
def sfcn_factory(model_type: str) -> type[SFCN]:
if model_type in ['sfcn-reg', 'regression']:
return RegressionSFCN
elif model_type i... |
c568d1258da6c15adad4be465127a9578d3a6c38a6dee7ade8d46a6154255ce1 | Python | 721 | 23 | from pathlib import Path
from typing import ClassVar
from argclz import argument, str_tuple_type
from .cli_hist import HistOptions
__all__ = ['CCFOptions']
class CCFOptions(HistOptions):
GROUP_CCF: ClassVar = 'CCF transform Options'
raw_image: Path = argument('-R', '--raw', group=GROUP_CCF, help='raw image... |
7570c5e4fda304bcc7537be91891147717259384a58e76bc65aead1066d76f3e | Python | 722 | 26 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtQuick classes and... |
d176c113fb986d95261c57a13b3da49fc5cc295d0553ef6886b0141e50318b16 | Python | 722 | 26 | import dotenv
import hydra
from omegaconf import DictConfig
# load environment variables from `.env` file if it exists
# recursively searches for `.env` in all folders starting from work dir
dotenv.load_dotenv(override=True)
@hydra.main(config_path="../configs/", config_name="train.yaml")
def main(config: DictConfig... |
bbe4e52b9cad819c0db865e30ac9d0e27c36d254ba03fa1db5be4cd2d6854772 | Python | 723 | 22 | '''Test the command line interface for resample'''
import unittest
import subprocess
class TestIsotropicResamplingCLI(unittest.TestCase):
'''Test the command line interface for resample'''
def test_can_call_resample_help(self):
'''Can call `ogo img resample --help`'''
command = ['ogo', 'img'... |
cba9acb349a6e20d674dd6963b3f44a44453cf2e547779d4f288ce7a82e3e6ed | Python | 723 | 21 | # Copyright (C) 2023 CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from drf_spectacular.extensions import OpenApiSerializerFieldExtension
from drf_spectacular.plumbing import force_instance
class QualityReportTargetExtension(OpenApiSerializerFieldExtension):
# Make a separate class in API schema,
# ot... |
13d7b3ea1a94b3e952979e2cc9b17069fb883b86a656e048151586396cc14f62 | Python | 724 | 25 | """
Compares two prediction matfiles
"""
import numpy as np
import scipy.io as sio
import sys
m1 = sio.loadmat(sys.argv[1])
m2 = sio.loadmat(sys.argv[2])
th = float(sys.argv[3])
if "com" in m1.keys():
print("Checking for parity between predictions...")
error = np.mean(np.abs(m1["com"] - m2["com"]))
print(... |
73605955bf68879fe8b4278e8ea85551f813d0f20ca236de35addc658ba7b5c7 | Python | 724 | 23 | import torch
import esm
model = esm.pretrained.esmfold_v1()
model = model.eval().cuda()
# Optionally, uncomment to set a chunk size for axial attention. This can help reduce memory.
# Lower sizes will have lower memory requirements at the cost of increased speed.
# model.set_chunk_size(128)
sequence = "MKTVRQERLKSIV... |
9a7aadf724b822001f5e963b01fd4e375d45e2cbbe328d2ca7b42a440c083a1c | Python | 724 | 24 | PYTHON_EXTENSIONS_PATHS = [
LOADER_DIR
] + PYTHON_EXTENSIONS_PATHS
ci_and_not_headless = False
try:
from .version import ci_build, headless
ci_and_not_headless = ci_build and not headless
except:
pass
# the Qt plugin is included currently only in the pre-built wheels
if sys.platform.startswith("linu... |
b8f62d05906485d7cdcc20206ab11ca6314899a0129c70074b30d8ea3767d66b | Python | 724 | 24 | # Generated by Django 4.2.18 on 2025-03-27 11:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("quality_control", "0008_qualitysettings_job_filter"),
]
operations = [
migrations.AddConstraint(
model_name="qualitysettings",
... |
f18276e634c115a1e8b6d1525af334f174482f02d56aa21754ad348ce8186890 | Python | 725 | 27 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtPdf classes and f... |
93b8cd9940c67ffb498d91832252405641f374b95b2d3d417cafde8870b2c9d4 | Python | 726 | 37 | #!/usr/bin/env python
"""
Read a feature file containing a 0 or 1 on each line, output
all mafs whose index in maf_file corresponds to a row having a 1
usage: %prog feature_file < maf_file
"""
import sys
import bx.align.maf
def __main__():
feature_file = sys.argv[1]
if len(sys.argv) > 2:
match = ... |
18d9de9be0d8122472fb2405be64a6379b241d19db8a859e68bc98484af8c3dd | Python | 727 | 12 | from miners.angular_miner import AngularMiner
from miners.base_miner import BaseMiner, BaseSubsetBatchMiner, BaseTupleMiner
from miners.batch_easy_hard_miner import BatchEasyHardMiner
from miners.batch_hard_miner import BatchHardMiner
from miners.distance_weighted_miner import DistanceWeightedMiner
from miners.embeddin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.