sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
7cec24f87bc81beac624c6e71be98f59b8bfd59b3801038ff3edcd3fdccee8b8 | Python | 6,850 | 179 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors:
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
3c7f6297bed261e00b9182c71d85d2367fb58024d5e580777ec486011acd1815 | Python | 6,851 | 214 | """Test QtCore."""
import enum
import sys
from datetime import date, datetime, time
import pytest
from qtpy import (
PYQT5,
PYQT6,
PYQT_VERSION,
PYSIDE2,
PYSIDE_VERSION,
QtCore,
_parse_version,
)
_now = datetime.now()
# Make integer milliseconds; `floor` here, don't `round`!
NOW = _now.r... |
7e078ac0918210a0a8b8c3f20477ba005f297974c96b8197cd078b4a210a0f5e | Python | 6,851 | 185 | """ AFMmeasurements_standardgrid.py
Check/Amend the following:
- Directory of experimental folder (line 25)
- 'App' (approach height) (line 37)
- 'StepHeight' (line 44) which is the height in µm which the AFM head is retracted before moving to the next measurement position, where it is extended by StepHeight-2µm
- 'Di... |
f4ac3476a1b5bfda9cc6cb62d9e94dd17899075699257f71f233f751cfc1a0b8 | Python | 6,851 | 186 | import os
import sys
import pprint
import torch
from torchdrug import core
from torchdrug.utils import comm
from torch.utils import data as torch_data
from torchdrug import data, core, utils
import pandas as pd
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from biopathnet import dataset, layer, model, ... |
c4bc9d9fcfa93b4c68a5609b3adcbd2a38a0e3242ac586ede288c503d06b84bb | Python | 6,852 | 165 | '''
F2H2
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for F2H2:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy and... |
643739b6ded98efc1f8f7bceee3ff16bcb6d8707c07826ef78d10c64f235fc19 | Python | 6,854 | 236 | #!/usr/bin/env python3
"""plot_loss.py
Aggregates TensorBoard scalar summaries (loss, mse_loss, theta_cosine,
theta_loss) across runs, splits them into two cohorts via regex, caches the
aggregated statistics *per tag* (e.g. cohorts_stats_loss.json) so you can
tweak plots without recomputing, and generates separate mea... |
734fcd0934c5586f01d66ebefe9d88aa45734b1d87ae1df25ab887a93d4fa808 | Python | 6,856 | 212 | #!/usr/bin/env python3
import argparse
from pathlib import Path
import nibabel as nib
import numpy as np
import pandas as pd
def parse_args():
parser = argparse.ArgumentParser(
description="Extract atlas ROI mean values from TBSS/GBSS 4D skeleton images."
)
parser.add_argument(
"--pipeli... |
e7f786cb2e78205981dbeb1ba10265c7eddefada6cf97cdc2880b4ccfee07000 | Python | 6,856 | 169 | #@ DatasetService ds
#@ DisplayService display
#@ DatasetIOService dsio
#@ ConvertService cs
#@ OpService op
#@ SNTService snt
"""
file: Fill_Demo.py
version: 20211012
author: Cameron Arshadi
info: Demonstrates how to fill programatically. More details at
https://forum.image.sc/t/batch-filling-in-snt/5... |
47180831af47d1d53d28d3721f8d64316d9ddb0bf196b1c982310093ddf8d622 | Python | 6,857 | 207 |
######################################################
## Template script to train a MOFA+ model in Python ##
######################################################
from mofapy2.run.entry_point import entry_point
import pandas as pd
import io
import requests # to download the online data
###############
## Load data... |
2be8feb0de3c64ad89fde583c681b9ffaa15d8fbaff7e5653fddd70652237f35 | Python | 6,858 | 210 | # (C) Copyright 2019 IBM Corp.
#
# 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 writing,... |
59b05674a482237d99664098d39a4ff8ff236f5ff0051da007dc862e39a47da2 | Python | 6,860 | 180 | # Generated by Django 4.2.1 on 2023-06-08 12:31
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("engine", "0070_add_job_type_created_date"),
]
operations = [
migrations.CreateModel(
... |
5f5a1f716965364aa684992f66adb04c445846c3faa4fbf0e10d52a1e074a2a1 | Python | 6,860 | 288 | # CLI Parser
import argparse
import modules.train
import modules.predict
import modules.build_dataset
import modules.convert
# Settings
INPUT_FORMATS_DATASET = ["fhi-aims"]
INPUT_FORMATS_NEW_DATA = ("geometry.in", "VESTA")
DESCRIPTORS = (
"cm",
"cutcm",
"soap",
"cutsoap",
"spsoap",
"aasoap",
... |
5f584f0f4567702670b92b85e8a5bfd800b0dcd756bcee5fbaf2e19c351c849b | Python | 6,861 | 160 | # run_all.py
import os
import json
import logging
import argparse
import glob
import pandas as pd
import numpy as np
import torch
import scanpy as sc
from torch.utils.data import DataLoader
from scipy import stats
import matplotlib.pyplot as plt
import seaborn as sns
from collections import defaultdict
from scphase.da... |
8065318ea935d8d4968f74cf48af76d2f80a456ff396cff9861c692c1cce72a9 | Python | 6,868 | 164 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""
MLflow Logging for Ultralytics YOLO.
This module enables MLflow logging for Ultralytics YOLO. It logs metrics, parameters, and model artifacts.
A tracking URI may be specified with MLFLOW_TRACKING_URI (defaults to the 'mlflow' directory under the ... |
98c275d5424292b5b62b67e0ffe372fcf76189827b795ef1bc66a9f7e623ff2b | Python | 6,869 | 207 | import yaml
import os
import subprocess
import logging
logger = logging.getLogger(__name__)
class CactiParser:
cacti_path = os.path.dirname(os.path.realpath(__file__))
MEM_POOL_PATH = f"{cacti_path}/cacti_master/example_mem_pool.yaml" # Path to cached cacti simulated memories
CACTI_TOP_PATH = f"{cacti... |
640d487833150f9c6129b18b04c41232a7c9c3234972ceaf3563e7df94ad549d | Python | 6,871 | 161 | ''' Make images from set of click points:
must use: srun -t 1:00:00 --mem=300gb --pty /bin/bash -l
'''
import sys
sys.path.append('/project/roysam/rwmills/repos/cluster-contrast-reid/')
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from QC_functions import *
#set the downsize value if we... |
ec7e7bf9ab6bcd61a3bd88256091f7140bfb5654f1708a2983284c8701727353 | Python | 6,872 | 200 | """``meanap-shared`` — take part in a shared run from a terminal.
The GUI walks through all of this; the command exists for the computer that
has no screen attached (a lab workstation reached over SSH) and for scripts.
::
meanap-shared benchmark
meanap-shared create --params run.json --shared-folder ~/Dropb... |
f50778de518ebf0d96b38b96d48c057a2785d6b17ede37c472729e8b58df5546 | Python | 6,872 | 182 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
"""Export many task datasets in one run: name the tasks by id, optionally
narrowed by status, and write them locally and/or straight to a cloud storage.
A failing task does not stop the run - its error is printed and the script
exits with code 1 at ... |
dc615f44614b0dcad12f67c0633765f4217c2f382a1df3cf2d2f5c5e64ded74d | Python | 6,874 | 174 | from __future__ import annotations
from typing import TYPE_CHECKING, Literal
from magicgui.widgets._concrete import backend_widget
from magicgui.widgets.bases import ValueWidget
if TYPE_CHECKING:
from pathlib import Path
import matplotlib.colors
import numpy as np
import PIL.Image
from magicgui... |
013db9ba852e82b542e1712c9b260b4aa8fc08317d7995bf151b55afaea79e25 | Python | 6,875 | 132 | import os
import tempfile
import unittest
from dtiplayground.dmri.common import age_table
from dtiplayground.dmri.preprocessing.modules.DTI_Register import DTI_Register as dti_register
dti_register.logger = lambda *args, **kwargs: None # the module logger is set in __init__, which the tests bypass
def _table(direct... |
5562540e312da9184ff2e4ebc290dc68a9aec1e2a3f5b1e395b9cab4d7e8c3e5 | Python | 6,875 | 167 | '''
Modified from https://raw.githubusercontent.com/pytorch/vision/v0.9.1/torchvision/models/vgg.py
BSD 3-Clause License
Copyright (c) Soumith Chintala 2016,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are ... |
73325321c3c3a0d0a52d2318d7034f17633432ccf8a2e5c98d1d1e9599238b16 | Python | 6,875 | 162 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Kathrin Rack
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
83c5e164cdc585f53686608b96a6b34741b2822e493c35f6579e88dee471de34 | Python | 6,875 | 171 | """Tests for translating UI Deep Agent settings into ChemGraph options."""
import pytest
from chemgraph.agent.deepagent_backend import (
DEEPAGENT_ENV_ALLOWLIST,
create_host_shell_backend,
resolve_workspace,
)
from ui import deepagent_policy
from ui.agent_manager import build_deepagent_options
@pytest.f... |
1614b74e585d46eeaa72c6a30de96db0c380f73a62b15e39fc25852a580b110d | Python | 6,879 | 171 | import sys
import yaml
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
pathpath,myrun = sys.argv[1:]
with open(pathpath) as yfile: pathdict = yaml.safe_load(yfile)
rundict_path = pathdict['configs']['rundicts']
srcdir = pathdict['src_dirs']['metrics']
savepath_SOM = pathdict['... |
e4420c43078b3c7392f6dd76c27185c4fad2362f6595bef7d9b342d995ccd9fd | Python | 6,879 | 173 | """A very small HTTP client: cookies, retries, ranged streaming.
Standard library only, deliberately. The remote-data feature is optional, and
adding ``requests`` to the core dependencies of an analysis package so that one
backend can talk to one website is a poor trade — the same reasoning that keeps
the viewer on ``... |
270dea7cb1103e7ad04932b7c45e5b0d5ba0db0a8a13734a55bbce0e002fadf7 | Python | 6,883 | 190 | # -*- coding: utf-8 -*-
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch import nn
from torch.nn import functional as F
from typing import List, T... |
d7f684e3a2074d22a0b47ff3edb219e1dbd66842e6ffe05c969fc4ca23ccf0a5 | Python | 6,885 | 168 | import numpy as np
import nibabel as nib
import nibabel.processing
from scipy import sparse
import sys
import time
import argparse
import multiprocessing
from scipy.io import savemat
import pickle
##########
def createSparseDownsampleParcellation(newvoxmm, origvoxmm, volshape, refimg):
chunksize=newvoxmm*newvoxm... |
9a659ff90841e5774c8dd19973b25ffeee650c46417d5946d3a369111013cb17 | Python | 6,889 | 155 | # @Context context
# @SNTService snt
# @UIService ui
"""
file: Scripted_Tracing_Demo.py
author: Tiago Ferreira
version: 20260731
info: Exemplifies how to programmatically interact with a running
instance of SNT to perform auto-tracing tasks.
"""
import math
from sc.fiji.snt import (Pat... |
cbc1e9fedb51d44207a9407fa4f3b1996d244585161e01a8f99734cfd74f70fe | Python | 6,889 | 185 | import os
import ot
import torch
import random
import numpy as np
import scanpy as sc
import scipy.sparse as sp
from torch.backends import cudnn
#from scipy.sparse import issparse
from scipy.sparse.csc import csc_matrix
from scipy.sparse.csr import csr_matrix
from sklearn.neighbors import NearestNeighbors
import pandas... |
7852a5f84925d815d9194528e156e16e294afcc7e07f15df0c100eabc2d99f02 | Python | 6,891 | 203 | # user feature generation: Alhosseini
import re
import json
import datetime
from operator import itemgetter
from math import log
import pandas as pd
import numpy as np
import csv
import collections
def read_json_1dict(path):
"""
读取json,用于一个dict
:param path: 路径
:return: 一个dict
"""
with open(path,... |
d8365c447441bf0254280559ff28f308d6db086e902d0ab95fa3b41fe4a256d4 | Python | 6,892 | 162 | import torch
from torch_geometric.data import DataLoader
import torch.optim as optim
import torch.nn.functional as F
from gnn import GNN
from tqdm import tqdm
import argparse
import time
import numpy as np
### importing OGB
from ogb.graphproppred import PygGraphPropPredDataset, Evaluator
cls_criterion = torch.nn.BCE... |
f3dfe6a9affb65d7678a071ce659203d9e43009996187df76890a317f7f85995 | Python | 6,893 | 194 | from copy import deepcopy
from dataclasses import dataclass
from typing import TYPE_CHECKING
from eir.data_load.data_streaming.streaming_dataset_utils import (
streamline_sequence_manual_data,
)
from eir.models.input.sequence.transformer_models import SequenceModelConfig
from eir.setup.input_setup_modules import s... |
2b25ccb5bd981dc13e7e15357037f6b176b92dcb748110c9e2560bed3f4c22d1 | Python | 6,894 | 213 | import numpy as np
import torch.utils.data as Data
import nibabel as nib
import torch
import itertools
def generate_grid(imgshape):
x = np.arange(imgshape[0])
y = np.arange(imgshape[1])
z = np.arange(imgshape[2])
grid = np.rollaxis(np.array(np.meshgrid(z, y, x)), 0, 4)
grid = np.swapaxes(grid, 0, ... |
ab4a5c87bd13436b0f3fd74bcdb1ba39919945619980ac8af49396232f4a4f8a | Python | 6,894 | 201 | """
lan.py
-----------------------
This script trains the LANTERN model on different datasets such as "harry", "elife",
and "protein_inter".
LANTERN is an interpretable model for genotype–phenotype landscapes introduced in:
Tonner, Peter D., Abe Pressman, and David Ross.
"Interpretable modeling of genotype–p... |
10c84b0030275c2c1138247588b67e638de5a04c88daa13cc652f70601c7db2b | Python | 6,895 | 157 | # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved
import numpy as np
import pycocotools.mask as mask_utils
import torch
import torchvision.transforms.functional as F
from PIL import Image as PILImage
from sam3.model.box_ops import masks_to_boxes
from sam3.train.data.sam3_image_dataset import ... |
4aa2986d105d51215b5bb372d4c81fde9e5ad228772aa45156a2dc880da39190 | Python | 6,895 | 192 | from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set
from torch_geometric.nn import TransformerConv, SchNet, DimeNetPlusPlus, DimeNet
class Conv... |
7d247da2447dd791d2512d25e8d2b63d2c1c3cc6b92787d79557d7b5dfef4bb9 | Python | 6,895 | 252 | from __future__ import annotations
from pathlib import Path
from typing import Literal
import numpy as np
import pandas as pd
import polars as pl
import scipy
from attrs import field, define, evolve, asdict
from neuralib.typing import DataFrame
__all__ = ['GROUP_HEADER_TYPE',
'DataSetType',
#
... |
801653ea4eda11584b1f221bb7054dda43b329133f2f388fbee753ed16c027ab | Python | 6,896 | 222 | import unittest
import warnings
from unittest.mock import patch
from rscvp.model.bayes_decoding.main_cache_bayes import BayesDecodeCacheBuilder
from rscvp.model.bayes_decoding.main_decode_analysis import DecodeAnalysisOptions
from rscvp.statistic.persistence_agg.main_decode_err import BayesDecodePersistenceAgg
from .u... |
2b7a05ac8bea79be01e66af4049957f83220d807cdf173e7d3451efa12e2fed7 | Python | 6,898 | 171 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compute the angular error (AE) for each segment of the streamlines.
For each segment of each streamline, the direction is compared with the
underlying peak (for single peak files, e.g. the first eigen-vector of tensors
for DTI) or with the closest peak (ex, with fODF ... |
abddbd1846f6466901b0d683787b6f92516213df8f068f9aaf8af986e98e06f9 | Python | 6,899 | 159 | '''
Cl2H
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for Cl2H:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy and... |
0e18859bdc7a6c2cf9284c9f9aa9fcb567cf5b6756be007c5f19de6f71c2b3e2 | Python | 6,900 | 183 | #!/usr/bin/python
"""
Generic Lumencor laser control via HTTP (ethernet connection).
Bogdan 3/19
"""
import urllib.request
import traceback
def lumencor_httpcommand(command = 'GET IP',ip = '192.168.201.200'):
"""
Sends commands to the lumencor system via http.
Plese find commands here:
http... |
f76707f36433c812d4569d217d7a6617146f29a95bed04a546adef3b25a8574c | Python | 6,900 | 168 | import csv
import matplotlib.pyplot as plt
import os
import numpy as np
from collections import OrderedDict
from matplotlib.ticker import MaxNLocator
file_path = 'INSERT_PATH_HERE'
# Create a directory to save the plots
output_dir = 'INSERT_PATH_HERE'
os.makedirs(output_dir, exist_ok=True)
params_file_path = 'INSERT_... |
1114b90bf537b38434529dda6e95a2a576b59cc90df01ee0cf0a7aaef883860b | Python | 6,901 | 221 | """
Fast KNN implementation using cuML.
This implementation leverages NVIDIA's cuML library for GPU-accelerated
nearest neighbor search, providing significant speed-ups for large datasets
while maintaining compatibility with PyTorch tensors.
cuML offers excellent performance on NVIDIA GPUs
and integrates well with th... |
6f0a7ed3817626d1024650ff2d710c61c4ebf58f58097d5c125bc0f59ea77eac | Python | 6,901 | 179 | import numpy as np
class Stimulation:
def __init__(self,fname,depvar_sort=True):
self.load_data(fname)
self.fname = fname
if depvar_sort:
self.depvar_sort()
def load_data(self,fname):
if fname[-3:] == '.gz':
import gzip
fid = gzip.open(fname,... |
268b93dce9311d03e2efd7cfd55f4ab09522a351a2230f79a533744081148410 | Python | 6,904 | 193 | from torch.utils.data import Dataset, DataLoader
from torch import tensor, optim, rand, zeros, no_grad
from torch.nn import GaussianNLLLoss
import torch
from pandas import read_csv
import numpy as np
from numpy import mean, newaxis, argsort, diag, zeros, intersect1d
from scipy.stats import pearsonr
from scipy.spatial.d... |
93eaf798bb68e9599e08b490c64aa84d4f9964795ac54dadd5f28e530dc0355d | Python | 6,905 | 223 | """registration.py."""
import logging
from functools import partial
from typing import TypeAlias
import jax.numpy as jnp
import numpy as np
import numpy.typing as npt
import pandas as pd
from jax import Array, grad, jit, random
from jax.example_libraries.optimizers import OptimizerState, adagrad
from splotch.datacla... |
61bf753d1014f0b87b6da85240980e61ac3b7869b7d95d3d195345f9867067b5 | Python | 6,907 | 240 | import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from matplotlib.lines import Line2D
import matplotlib.colors as colors
import pandas as pd
import numpy as np
import seaborn as sns
import colorcet as cc
from nest.plot.plot import spatial, scale
def hotspots(
adata, col... |
a3aab58379d7b05268d771f3bb800840f50416e78e38a28739cee7e773236789 | Python | 6,907 | 171 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 17 14:57:10 2023
@author: gligorov
"""
import numpy as np
import itertools
def generate_random_data(n_instances, num_classes, num_features, predictable = False):
"""
Generates random data with a structure that corresponds the one that will be used for ... |
c281da8759af5564fc679e4c07e20a87a1367a4964469fccd20964440145f139 | Python | 6,908 | 244 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
b559bcedd003be29c4da6298e0dd7be0a3d164a5fdd5bc647d0a62b68f489a2b | Python | 6,909 | 219 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
import csv
import json
import os
import random
import sys
from itertools import product
NAME = "invitations"
def read_rules(name):
rules = []
with open(os.path.join(sys.argv[1], f"{name}.csv")) as f:
reader = csv.DictReader(f)
... |
e902997e0855b82c91452b64b3bbbed11adb57a459f82cc433caa9f94e30463a | Python | 6,909 | 217 | from collections.abc import Callable
from copy import copy
from functools import partial
from unittest.mock import MagicMock, create_autospec
import pytest
import torch
from torch import nn
from eir.setup.config import Configs
from eir.setup.input_setup import set_up_inputs_for_training
from eir.setup.output_setup im... |
6a72e68efb553f6fa3e1f9405d6d7cfd5143107bc3e1cf654ec5be2eef1b0739 | Python | 6,911 | 207 | import argparse
import os
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
from pydantic import BaseModel
from docs.doc_modules.user_guides.data_simulator import create_simulator
from eir.setup.streaming_data_setup.protocol import PROTOCOL_VERSION
from eir.utils.logging import get_logger
logger = get_logg... |
9d553682c79a596d8f5d465162cf3874e422c29db77f73e8b516bd1de56d0bc9 | Python | 6,911 | 139 | """Run one Academy logical-agent wakeup through ChemGraph."""
from __future__ import annotations
import json
import time
from collections.abc import Callable
from dataclasses import dataclass
from pathlib import Path
from typing import Any
from langchain_core.tools import BaseTool
from chemgraph.academy.core.campaign ... |
33c7b55a18a454ebfd4ff43304cf53786d2c96d69e299a4764684ed858aa822b | Python | 6,912 | 158 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Henrik Zunker, Maximilian Betz
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complia... |
6233efd15a6b0d38ec8b04655590c128347706dc76e2d6ffa2b9b82a85271627 | Python | 6,912 | 158 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors: Henrik Zunker, Maximilian Betz
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complia... |
76547bbd87f7e013b0400836212b0b791b906bc2cb044ce7b57803179ac9c870 | Python | 6,912 | 184 | def plot_carpet(img, mask=None, output_file=None, save_carpet=False, cmap='gray',
detrend=True, standardize='zscore',
clean_data=True, show_carpet=False):
"""
- X-axis: timeframes (bottom to top along z axis).
- Y-axis: voxels.
- Color: voxel intensity.
Parameters:
... |
a36e06764aa5a1038c12f48e1a15390a123eb80eab46ba92ac5915ebe72f6e84 | Python | 6,912 | 176 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to facilitate filtering of connectivity matrices.
The same could be achieved through a complex sequence of
scil_connectivity_math.
Can be used with any connectivity matrix from
scil_connectivity_compute_matrices.
For example, a filtering as performed in [1] wo... |
820b82f1e3daf5f3a4a9c82479fd4df1dc3531ef7cad274331fb339221a716a3 | Python | 6,914 | 166 | #!python
import os
import sys
import argparse
from argparse import RawTextHelpFormatter
import traceback
from pathlib import Path
import yaml
sys.path.append(Path(__file__).parent.parent.__str__())
### for dev
from argparse import RawTextHelpFormatter
import dtiplayground.dmri.atlasbuilder.utils as utils
from dtipl... |
3389363389cd2289b7b3279f79062d3d43d9bb1a153e6196176c6b190602ac74 | Python | 6,915 | 180 | # Kai Sandbrink
# 2022-10-18
# Script that loads configuration options and runs training loop
# %% LIBRARY IMPORTS
import torch
import numpy as np
import torch.multiprocessing as mp
import copy, time
from utils import Config
from trainers import train
# %% PARAMETERS
n_runs = 5
# %% CONFIG OPTIONS
config = Conf... |
5defc3001df870f5aeb1d16ab08858f96e41791865df3c2b25cf4aa35f052dc7 | Python | 6,916 | 161 | import os
import cv2
from lib_alban.utils_analyse import *
dataset = 'TwoCubesBlendereevee2p9'
model = 'AlbanNetsupeeveepatterns'
savename = f'{dataset}_{model}_3'
path2preds = '/home/alban/Dropbox/mlab/users/alban/works/InvRend/projects/pipeline_intrinsic_3datasets/test_outs/results_%s'%(savename)
#path2preds = '/h... |
93e7299374d45e57db5fdf0ba788f937909bec40a983a4adb2b410ae70f7d872 | Python | 6,916 | 199 | import argparse
import torch
from tqdm import tqdm
import torch.nn.functional as F
from torch_geometric.data import GraphSAINTRandomWalkSampler, NeighborSampler
from torch_geometric.nn import SAGEConv
from torch_geometric.utils import subgraph
from ogb.nodeproppred import PygNodePropPredDataset, Evaluator
from logg... |
69387c654bdfce65cf09c8c035b9ad8097db773c839db7f7e7a1668fc6819812 | Python | 6,921 | 184 | # /------------------------------------------------------------------------------+
# | 24-AUG-2022 |
# | Copyright (c) Bone Imaging Laboratory |
# | All rights reserved ... |
b81fdde7b9460e14236895010825bafc1df6528ce7c55a8382ab0f61ffda49c6 | Python | 6,921 | 233 | import math
import torch
from torch import nn
from torch.nn import Parameter, functional as F
from torchvision.ops import StochasticDepth
from eir.models.layers.norm_layers import LayerScale
from eir.utils.logging import get_logger
logger = get_logger(name=__name__)
class LCL(nn.Module):
__constants__ = ["bias... |
cd0bf117309ee9b42a7b1efbbafd40b41eb84c420a257ecdc5e2cb7d3c04a0ad | Python | 6,921 | 163 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 18 23:12:09 2023
@author: gligorov
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 18 14:12:39 2023
@author: gligorov
"""
import xgboost as xgb
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import accur... |
18cbe0b1a33ff405e09b991ce6bcd3fcd4d538c419f641ce9fca0ba653f1bcf0 | Python | 6,922 | 199 | import argparse
import torch
from tqdm import tqdm
import torch.nn.functional as F
from torch_geometric.data import GraphSAINTRandomWalkSampler, NeighborSampler
from torch_geometric.nn import SAGEConv
from torch_geometric.utils import subgraph
from ogb.nodeproppred import PygNodePropPredDataset, Evaluator
from logg... |
c3025c4445052832c55038d16bda385f70d6a9080cbe14b721c8b06fa12fb637 | Python | 6,922 | 195 | from abc import abstractmethod
from typing import Dict, Optional, Tuple, Union
import torch
import torch.nn.functional as F
from torch import Tensor
from torch_geometric.explain import Explanation, HeteroExplanation
from torch_geometric.explain.config import (
ExplainerConfig,
ModelConfig,
ModelReturnType... |
b8420681f5d85532f4e5588e2289241490f1e963d0e0ec1184553ca19fbda74e | Python | 6,923 | 150 | '''
IH2
'''
import numpy as np
import sys
def intro():
print("""
SHORT List of potential energy surfaces for IH2:
P: potential energy, G: Gradient, D: Nonadiabatic coupling vector
This is listed at the end of description to show the availability.
For example: P/G means both potential energy and g... |
4af2d64c7ad0c201ae1e8878e5561679ef38dc6e4d9972be37129591d9cea669 | Python | 6,929 | 122 | """Helper functions for loading pretrained gene embeddings."""
from pathlib import Path
from typing import Dict, Tuple
import torch
from scanpy import AnnData
import numpy as np
EMBEDDING_DIR = Path('/dfs/project/cross-species/data/proteome/embeddings')
FZ_EMBEDDING_DIR = Path('/dfs/project/cross-species/yanay/data... |
db6038998ab0ab78a7b795519966e584047231846ac1e496dd7c709f1a8b1fbe | Python | 6,930 | 174 | import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import numpy as np
import pandas as pd
from utils.fingerprint import Fingerprint
import matplotlib.pyplot as plt
from utils.chem import check_smiles_validity, gen_standardize_smiles
from sklearn.metrics import confusion_matrix, adjusted... |
1e47ef5c52ec37a450d979f1f16a1c1c81daf138e9a5873c1b76d65c0cb93a49 | Python | 6,931 | 182 | from __future__ import absolute_import
from torch import nn
from torch.nn import functional as F
from torch.nn import init
import torchvision
import torch
from .pooling import build_pooling_layer
from .xception_model import *
__all__ = ['HeXception', 'hexception']
class SeparableConv2d(nn.Module):
def __init__(s... |
b5215b2a4fe06df97b7bfb2a32d11130f1f08f109fbc978bba60ac4ded12044b | Python | 6,931 | 202 | import yaml
import os
import pandas as pd
class Config:
def __init__(self, path):
with open(path, 'r') as f:
cfg = yaml.load(f, Loader=yaml.Loader)
self.CLASSES = cfg['CLASSES']
self.LABEL_COLUMN = cfg['LABEL_COLUMN']
self.DROP_LABELS = cfg['DROP_LABELS'] if 'DROP_LA... |
4010f815c0022d562435978909f86b3bc61c6d5735c93d05b114d133aa5bccd2 | Python | 6,932 | 219 | # Copyright 2014-2015 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
"""
This contains the objects to store and manipu... |
8350f50986dbe49827ae04752d6c202c048bc528fa1e41f302666ee0b59879a2 | Python | 6,932 | 141 | from brainvoice.visualization import plot_spectrogram_on_axis, save_borderless, gen_spectrogram_cmap, plot_RDM_on_axis
from brainvoice.data.rsa import compute_RDMs_torch
import torch
from torch.autograd import Variable
import matplotlib.pyplot as plt
import os
import pathlib
import pandas as pd
def proces... |
70e6b56a658c080a59530cd81fcc9c1df6bdc3de32b20371455be25f5b98b1cc | Python | 6,934 | 317 |
import torch
import numpy as np
import pandas as pd
from datetime import datetime as dt
from dataset import fast_merge,df_to_mask
from tqdm import tqdm
dataset_names = [
'botometer-feedback-2019', 'botwiki-2019', 'celebrity-2019', 'cresci-2015', 'cresci-2017', 'cresci-rtbust-2019', 'cresci-stock-2018', 'gilani-20... |
96698175ee78e5f5134439998f6dd11fd2b35ae08fedef8a8dddf2cb37abc5be | Python | 6,936 | 181 | # bcf_parallel.py
import os
import logging
import pysam
from .scoring import (
score_geno,
impute_score_ref,
resolve_site,
match_contig_name,
summarize_site_for_log,
)
def process_batch(batch, bcf_files, samples, col, impute, refbcf, log_handle=None):
"""Process a batch of variants and return ... |
1fcc80451d11c762986fa3f6ef4873b20c77338d4aa8d5bf44ff67e91672dec1 | Python | 6,937 | 166 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from functools import partial
import torch
from ultralytics.cfg import TASKS
from ultralytics.utils import YAML, IterableSimpleNamespace
from ultralytics.utils.checks import check_yaml
from .bot_sort import BOTSORT
from .byte_tracker import BYTETra... |
274c62ba209dec9524b9d9c91d48e87e9fb5c5518911e3b7302b5221e595e375 | Python | 6,937 | 202 | """A module that contains unit tests for the :py:mod:`corelay.processor.preprocessing` module."""
import typing
import numpy
import pytest
from corelay.processor.preprocessing import Histogram, Rescale, Resize, Pooling
@pytest.fixture(name='no_channels', scope='module')
def get_no_channels_fixture() -> numpy.ndarr... |
6a6e1a0a841a0c22c41c5ac31a438ec1ca611d1a4324676f1d05f62c7a9e4cf0 | Python | 6,937 | 204 | """
Lovasz-Softmax and Jaccard hinge loss in PyTorch
Maxim Berman 2018 ESAT-PSI KU Leuven (MIT License)
"""
from __future__ import print_function, division
from typing import Optional, Union
import torch
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.modules.loss import _Loss
try:... |
dceb3940b060e4b1ee30c837a55657e57bd24d02f6896a30a42956d8952869dc | Python | 6,937 | 167 | """Settings that most runs never touch, folded away until asked for.
``Params`` has 140 fields. Roughly half are reachable from the window, and a
run's outcome usually turns on a dozen of them — the data, the sampling rate,
the lags, which steps to run. The rest are real settings that real analyses
occasionally need, ... |
20af66616957b2a143de8da90efc00606aeb2cabf06d0c4730a6f639e0545ed8 | Python | 6,938 | 210 | """Shared module-level helpers for AddIntensitiesSingleExp and AddIntensitiesMultipleExp.
All items here are pure (no window state) and safe to import in subprocess
workers via the standard top-level import mechanism. Image-alignment-specific
workers were extracted to ``musclex.ui.widgets.image_alignment_workers``;
ke... |
a8ae8888225c19fad7a3f3308d1cbcbdb9077c61e443c5d228b6ef47d98a5725 | Python | 6,938 | 205 | """Evaluation results objects for plotting and further analysis.
These objects are generated by the `evaluate` method.
"""
import abc
import dataclasses
import inspect
from typing import Dict, List, Tuple, Union
import pandas as pd
from ..estimation.base_estimator import IndividualOutcomeEstimator
from ..estimation... |
8c169a1721a6caf44a49a59e6df1dc01fe1470ea3d8d77e78fda1439103d4173 | Python | 6,940 | 270 | """
Functions to use `Connectome Workbench <https://www.humanconnectome.org\
/software/connectome-workbench>`_.
"""
import os
import pathlib
import re
import subprocess
import warnings
from typing import Optional
import nibabel as nib
from tqdm.auto import trange
from osl_dynamics import files
surfs = {
0: [fil... |
b0d973a1dd70e2798987aad9433854d5d52a569fbc2d5723f0fca4ec3520cb98 | Python | 6,940 | 193 | #!/usr/bin/env python
# Copyright 2014-2015 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import argparse
import os
t... |
af88fcb43da02bfc1c0eb61881ffbccfbf81724d7125d31156ade446253828cd | Python | 6,942 | 199 | """# napari parameter sweeps
[napari](https://github.com/napari/napari) is a fast, interactive,
multi-dimensional image viewer for python. It uses Qt for the GUI, so it's easy
to extend napari with small, composable widgets created with `magicgui`. Here,
we demonstrate how to build a interactive widget that lets you... |
3b4a2a66a2b1981edd5e46028786c1c1705360755d88a5d961d2aeaebfe1a3f3 | Python | 6,944 | 207 | # Copyright 2014-2015 Numenta Inc.
#
# Copyright may exist in Contributors' modifications
# and/or contributions to the work.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import datetime
import os
import pandas
import te... |
5a5c38f361dba9f929ad004a6511f2cf1b17a8a2de258ff885e2878d9dd86cfc | Python | 6,946 | 171 | import math
import os
import shutil
from typing import Optional
from mcp.server.fastmcp import FastMCP
# Initialize the MCP Server
mcp = FastMCP("ChemGraph Data Analyst")
@mcp.tool(
name="split_cif_dataset",
description="""
Split a folder of CIFs file into batches.
The batch size/number of batches i... |
dd9d1d3234ac094ebe4a3184e50ce0b4e7d1b065ee09aab903a36cbf461764fa | Python | 6,949 | 265 | """Utility classes and functions related to the models."""
import re
from typing import Any, List, Optional
import numpy as np
def tex_escape(text: str) -> str:
"""Escape characters which require control sequences in text for use in LaTeX.
Parameters
----------
text : str
Text to be escaped... |
f21a29e12c0cbca41d157d57c4d6d19787ece25da524e9f8fccce43a7835d271 | Python | 6,949 | 218 | #!/usr/bin/env python3
"""
Rule-Based Artifact Detection for Preprocessed EEG (TUH-EEG)
Heuristic detectors for eye movement, muscle, and non-physiological artifacts
in preprocessed EEG data (RobustScaler, 1-40 Hz filtering, average reference).
Authors: Evans Nyanney, Parthasarathy D Thirumala, Shyam Visweswaran, Zha... |
571b0e9d56373494d48dc60b747e67b80bc16aa3e9b813886f4f938b74fa0aaf | Python | 6,950 | 189 | import os
import csv
import mne
import glob
import numpy as np
from tqdm import tqdm
def write_log(filepath, data, mode="w"):
"""Write a single row to a CSV log file."""
try:
with open(filepath, mode) as csv_file:
writer = csv.writer(csv_file)
writer.writerow(data)
except I... |
7f5bbd360338059a1c85a242aeb55d9f295e8f2fd7c9dc570aad2d20b0fd193a | Python | 6,952 | 188 | #############################################################################
# Copyright (C) 2020-2026 MEmilio
#
# Authors:
#
# Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
bfe3e1a19dc50bde84189d42d65fe2da1fd7cfbb8931e74d99e577a3ef899177 | Python | 6,952 | 196 | #!/usr/bin/env python3
import sys
import os
import shutil
from pathlib import Path
import json
import subprocess
from compareCSV import diff as csv_diff
from compareSTL import diff as stl_diff
from compareVTI import diff as vti_diff
import glob
import time
import configparser
def run(solver, test_path, skip_test=False... |
a963aeaa59460599d5d5f3adcfa379d8a4c810d2e1713d004bd78426b9d4b98f | Python | 6,953 | 237 | import numpy as np
from tqdm import tqdm
import infomap
import faiss
import math
import multiprocessing as mp
from clustercontrast.utils.infomap_utils import Timer
def l2norm(vec):
"""
归一化
:param vec:
:return:
"""
vec /= np.linalg.norm(vec, axis=1).reshape(-1, 1)
return vec
def intdict... |
1399f8074b3e1b884e7c8e56e814d74c6c4a3a23a40aa046bc2950b5aea2a4eb | Python | 6,955 | 215 | from copy import copy
from typing import Any, Protocol, TypeGuard
import timm
import torch
from timm.models import CoaT, CrossVit
from torch import nn
from eir.models.input.array.models_cnn import CNNModel, CNNModelConfig
from eir.models.input.image.image_models import (
ImageModelClassGetterFunction,
ImageMo... |
496db45b173e12f964524aede86994ffff0436ebecc3d383769787204d3b5dd5 | Python | 6,955 | 193 | import os
from torch.utils.data import Dataset
from torchvision import transforms
import librosa
import numpy as np
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from datasets.dataset_scale import DatasetScale
class AudioDataset(Dataset):
def __init__(self, root_dir,... |
4a0bf09d6949136c4a0bf0d8d8acc9ef60d706202da8f147dedbdf0850cb7294 | Python | 6,957 | 220 | # coding: utf-8
import copy
import json
import pickle
from pathlib import Path
import numpy as np
import pandas as pd
from sklearn.metrics import roc_auc_score
import lightgbm as lgb
print("Loading data...")
# load or create your dataset
binary_example_dir = Path(__file__).absolute().parents[1] / "binary_classificat... |
5988930aa6dfc1d89d4818ec0ebe98e35f984e57b83cc0511f0dfe1ca74170fe | Python | 6,957 | 218 | # These functions were adapted from `deepreg/model/kernel.py` in the 'DeepReg' repository
# on GitHub. The original implementation can be found at:
# https://github.com/flavell-lab/DeepReg/deepreg/loss
# The code is used under the MIT License.
from typing import Callable, List, Tuple, Union
import math
import tensorflo... |
e40a97a72ad2db806a04cce6767df9f827967ed09044baf18d557d2b0e7d88eb | Python | 6,957 | 199 | """Backward-compatible class facade over the functional core API."""
from __future__ import annotations
from typing import Any, Sequence
import pandas as pd
from .functions import (
PseudonymizationResult,
add_noise,
bin_numeric_values,
calculate_k_anonymity,
calculate_k_combined,
calculate_... |
0ddd0a1973d2d75ec79f012f6d12352b0e5abe1a9b39546e5392b5655bc46abf | Python | 6,960 | 182 | # -*- coding: utf-8 -*-
# %% import packages
# pip install connected-components-3d
import numpy as np
# import nibabel as nib
import SimpleITK as sitk
import os
join = os.path.join
from skimage import transform
from tqdm import tqdm
import cc3d
# convert nii image to npz files, including original image and correspon... |
814ece5f56ff36151e94742bd15eee98c509e2f2286fa5eaf5b78acccd9833cd | Python | 6,963 | 212 | import os
import re
import signal
import subprocess
import sys
import time
from PyQt5.QtCore import QThread, pyqtSignal, QObject, pyqtSlot
# Only for Windows
def send_ctrl_break(pid):
import ctypes
kernel32 = ctypes.WinDLL('kernel32')
kernel32.FreeConsole()
if kernel32.AttachConsole(pid):
ker... |
8a4df0c82ed4137e9d1ac41ed4bca18c774abfac84fee767452f34dffd32700f | Python | 6,963 | 173 | import os
from pathlib import Path
from tqdm import tqdm
from itertools import chain
import math
import warnings
warnings.filterwarnings("ignore")
import multiprocessing
from concurrent.futures import ProcessPoolExecutor, as_completed
import torch.multiprocessing as mp
from argparse import ArgumentParser, Namespace
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.