sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
97a15468cfa56ff9a32116311bcfbd87b0442fff7b53015810d6734f3d5c77a5 | Python | 2,312 | 100 | from __future__ import annotations
import csv
import platform
import sys
from importlib.metadata import PackageNotFoundError, version
from pathlib import Path
from typing import Any
_PACKAGES = (
"numpy",
"pandas",
"cv2",
"skimage",
"scipy",
"sklearn",
"umap",
"hdbscan",
"tqdm",
)... |
73690f640c9c648d906e0e8af7a75734822621d6786c1937e4741a2e50412679 | Python | 2,313 | 74 | # coding=utf-8
# Copyright 2026 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... |
10518556f3fd79f72e4d10822c853d50b72671936bd821ff150f8a52cfb8b481 | Python | 2,314 | 100 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.md') as history_file:
history = history_file.read()
install_requires = [
'numpy>=1.16.0',
'pandas>=... |
5e63101e2d58e5758723cb5d02ca83a672c21c2ee4c9bc80c95d574a61142961 | Python | 2,314 | 82 | # coding=utf-8
# Copyright 2026 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... |
89fb3f0a7383a69c7a0c2f549c0dad2dd3fb57960129240c53065dc7f53e717d | Python | 2,314 | 67 | import os
import sys
_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if _ROOT not in sys.path:
sys.path.insert(0, _ROOT)
from installer import environment as env
def test_cuda_wheel_tag_mapping():
assert env.cuda_wheel_tag("13.0") == "cu130"
assert env.cu... |
29495ecc13e46dc714b4f2ecd47a93352e70ad1609b911977dbb638d9168b685 | Python | 2,315 | 67 | # Copyright (c) 2020, Ko Sugawara
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
92480de05781a0b66e3c49d4a56c03eac65316847e685d52f932c059f09c075b | Python | 2,315 | 87 | #!/bin/env python3
"""
Find and analyse the trajectories of PDLs
"""
import csv
import ithildin as ith
import numpy as np
import matplotlib.pyplot as plt
import sys
import yaml
from matplotlib import cm
FORCE_CALC = True
stem = "results/burst_61"
# stem = "results/burst_43"
# stem = "results/burst_57"
sd = ith.SimDat... |
a304bd496bdc065c59fb7b7c54967d3401435f0753880da22ad1276ea1148f0b | Python | 2,315 | 78 | # Node group ".MN_ensure_ures_id" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regen... |
ee61c7e99483fc1616d715778221e050d64a2c8c62e5de75a0811498b8882a70 | Python | 2,315 | 75 | import logging
import numpy as np
from pathlib import Path
from hippo import get_store_path, save_config
from hippo.agents.hmm_agent import HMMAgent
from hippo.evaluation.replay import ReplayEvaluation
from hippo.evaluation.planning import PlannerEvaluation
from hippo import save_object, load_object, get_data_path
f... |
9c411a51e29e6087229a0e28006fe22b825df4238e78fc1f40a07ca17ba6550f | Python | 2,316 | 70 | from __future__ import annotations
from pydantic import BaseModel
class ModelOuputError(Exception):
pass
class ModelOutput(BaseModel):
"""
the full output of a model should be
`prompt_header` + `prompt` + `response_header` + `response`
there can be arbitrary number of line breaks between any tw... |
cd4ea9286c80c4eb244d797ceb5ce34a5da3f1b4a1034a89573301d62c2ce479 | Python | 2,316 | 75 | # -*- coding: utf-8 -*-
"""Misc. (Keras) Layers for Atomistic Neural Networks"""
import tensorflow as tf
class AtomicOnehot(tf.keras.layers.Layer):
R"""One-hot embedding layer
Given the atomic number of each atom ($Z_{i}$) and a list of specified
element types denoted as ($Z^{\mathrm{0}}_{\alpha}$), ret... |
7291b3eaf4fad87267e583dcef1fdc6d3196e3a0fb1d009ca3098916fa12b767 | Python | 2,317 | 46 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
141fa0a226b35ca7e77b817e7e7d8c4e194616e306a69537e60d8529e61ca7d0 | Python | 2,318 | 68 | #!/usr/bin/env python
# Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This metric calculates the distance between the ego vehicle and
the cente... |
5508e45c8510a85142c889d0e9789a55cfa1907900baadd3c36a7987809151d3 | Python | 2,319 | 79 | #!/usr/bin/env python3
from pathlib import Path
import pandas as pd
import re
from itertools import combinations
# Input/output directories
in_dir = Path("/project/3011157.03/Simon/proj_2022_CABB_movie/Scripts/04_2ndLev_ISRSA/r_output")
out_dir = in_dir / "correlations"
out_dir.mkdir(parents=True, exist_ok=True)
# O... |
78848e11f4b541cfff44c38ca713ea29642a7488f0ed8879a2e0488a9d937589 | Python | 2,319 | 66 | # coding=utf-8
# Copyright 2026 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... |
82eae30826bc13ad5c98a6f18226dfff3e2b6043ec338b8598bbc30d6d45ae63 | Python | 2,319 | 62 | from pathlib import Path
import argparse
import dolfin as d
from smart import mesh_tools
import dendritic_spine_args
def main(input_mesh_file, output_mesh_file, num_refinements):
if not Path(input_mesh_file).is_file():
raise FileNotFoundError(f"File {input_mesh_file} does not exists")
spine_mesh = d... |
4c7b941af0456a9d2c89b125b6849e65a8ebf340f5fc733fc6230d7c8822505e | Python | 2,320 | 23 | """posthoc_margin_2026-10-02.py — POST HOC, descriptive (after KEYSTONES M, 2 Oct night).
(1) Does the one number (excitatory share of the local neurons' output) track how many single cells are fatal, where the
pre-registered loop eigenvalue did not? (2) Are the extra keystones near the edge the next cells by synapses ... |
4e2b83426ca9e173f2c4775790cb18884b10e68428dc93aafbc411ce9e9b02da | Python | 2,320 | 78 | #! /usr/bin/python
"""
select rows of file randomly, with a header
"""
import random
import argparse
def str2bool(v):
# susendberg's function
return v.lower() in ("yes", "true", "t", "1")
def random_select_file_rows(ori_file, w_file, maxrownum=10000, header=True):
"""
:param ori_file:
:param w_... |
a31cf2edb7ccce3c15879f17c405cfa64597b8197ae4510a5ba1722fb95529aa | Python | 2,320 | 69 | from typing import cast
import pytest
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
from elasticai.creator.nn.fixed_point.linear.design import LinearDesign
@pytest.fixture
def linear_design() -> LinearDesign:
return LinearDesign(
name="linear",
in_featur... |
2878e100604d89ae29318eaeb17e4af3e2028bfaa926761190ba30c55db10bb3 | Python | 2,321 | 59 | """Headline metric cards + Laplacian deltas."""
from regtools.registration.report.metrics import _render_headline_metrics
def _write_metrics(path, rows, header):
with open(path, "w", newline="", encoding="utf-8") as fh:
fh.write(header + "\n")
for r in rows:
fh.write(",".join... |
c900cfba2ecac2ea0ce9768b2ca504b063298660d2f0c26d047254371097fec0 | Python | 2,321 | 74 | # coding=utf-8
# Copyright 2026 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... |
e505628d357ad4a5b1f1d5af897d951439dac83aee9c5f75bae2becdd4db4f56 | Python | 2,321 | 64 | import pytest
from pathlib import Path
from hmp import io
import hmp
from hmp.patterndata import PatternData
from hmp.patterns import Pattern, HalfSine
from hmp import distributions
from hmp.models import EventModel
import numpy as np
from test_io import init_data
def data():
event_b, event_a, epoch_data, positio... |
76a5e021151cefe8242343e85d283d5092de7dfb43421b86f68c9447c5f8abb2 | Python | 2,322 | 81 | # Node group "Set Instancer" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerate... |
80305590e11d9222723b60b75adfe1a19117425bccfa8ff9a7e2af76eebb42d2 | Python | 2,322 | 72 | import torch
class Data(object):
"""Docstring for Data."""
def __init__(
self, features: torch.FloatTensor, target_word: torch.LongTensor, distractors: [torch.FloatTensor] = None
):
"""A data object (single or batch)
:features: preprocessed shape angle features
:targe... |
cddbda43b9e0ecf85ac8834630ff9bac503e243e0d9b5b63100bac3c19b9c67a | Python | 2,322 | 73 | # coding=utf-8
# Copyright 2026 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... |
5e192b417d932c0be6542fef9ade9fc2ef238d19031e6d19ade0b50372a6ccf2 | Python | 2,323 | 68 | """Photoreceptor model parameters.
Port of initPhotoreceptorParams.m
"""
from dataclasses import dataclass
@dataclass
class PhotoreceptorParams:
"""Biophysical parameters for a photoreceptor model."""
sigma: float # Receptor activity decay rate (1/sec)
phi: float # Phosphodiesterase activity decay ra... |
9ea89868c2b9a7bc48d043fb0a5f54b75e0900c421bb0846b83f62cf609c3ad7 | Python | 2,323 | 69 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
825cecdb2a7c95b90857ecd0c37eb88fa3696806da4e8ddd0b498de870a5c1cf | Python | 2,324 | 67 | from pathlib import Path
import torch
from prosper_nn.models.fuzzy.rule_manager import RuleManager
from prosper_nn.models.fuzzy.membership_functions import (
NormlogMembership,
GaussianMembership,
)
from prosper_nn.models.fuzzy.fuzzification import Fuzzification
from prosper_nn.models.fuzzy.fuzzy_inference im... |
313e3b06b0cab9a16a7ebeb25d0958d3897ae185511fa882ff54c0dfe033b209 | Python | 2,325 | 65 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 7 12:43:01 2020
@author: caroline
"""
SUBJECT_GROUP = 'Gorilla_V4'
len_of_task = 600
GORRILLA_EXP_STRUCTURE = [0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10], [11, 12, 13, 14]
DISTRIBUTIONS_RESOLUTION = 20
PLAUSIBLE_PARAMETER_VALUES = {
'volatility... |
cad1b7a279170a438eb0d2a78a8d37ea23627d0737ab0f24f2e404bc8694491f | Python | 2,325 | 50 | from typing import NamedTuple, List, Tuple
class OptosynthSpecs(NamedTuple):
width: int # pixel
height: int # pixel
sampling_rate: float # Hz
duration_per_segment: float # s
scale_factor: float # relative to morphology data units
n_neurons: int # number of neurons in the FOV
stim_amp... |
ff7aa69dd66a56f8ceb9975384ad820d2b557c85ec18505ce00c6202cbf8c60f | Python | 2,325 | 87 | # Node-group asset "Expand Boolean" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKIN... |
1fec5d14656e12f267dda37926bcfbece4a6d7cc42ffc871bf109209208fe402 | Python | 2,326 | 101 | # coding=utf-8
# Copyright 2026 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... |
5f5f3d0f02731317a354556173a485796b0446573e248edc9c50c28a70beab3c | Python | 2,326 | 53 | """Shared helpers for the 2D atlas edit-mask: run-grid shape + mask save.
Extracted from RegistrationTab so the Batch 2D tab reuses the identical grid
computation and save format. Keep behaviour identical to the single-run path.
"""
import os
import numpy as np
def atlas_edit_run_template_shape(template_p... |
6c9a5db9bc0f44783a4bb3186c119c37ac982fe1875d2c1cf4008ba315ab5f80 | Python | 2,326 | 60 | from cloudvolume import CloudVolume
import numpy as np
cv_path = "gs://neuroglancer/basil_v0/son_of_alignment/v3.04_cracks_only_normalized_rechunked"
def scale_slice(sl, dst_mip=1, src_mip=0):
scale = 2**(dst_mip - src_mip)
dst_sl = ()
for s in sl[0:2]:
dst_sl += (slice(int(s.start/scale), int(s.stop/scale)), )
... |
f7d98eeab065787b3eccc2861a643092c47b59b36e712f2d7dbef01ea946f84a | Python | 2,326 | 68 | from typing import Tuple
import hdf5plugin
import numpy as np
import pandas as pd
import os
import glob
from . import types
RAW_DIR = 'raw_data'
DATA_DIR = 'data'
RESULT_DIR = 'results'
MEMORY_B_VALUES = [49, 100, 154, 211, 271, 335, 403, 475,
552, 633, 721, 814, 915, 1023, 1140, 1267, 1404, 1555... |
364c16ac4c6964321e4c344042d2cafe04ad5f5134d67c837224bea719ba871f | Python | 2,327 | 85 | import numpy as np
import pickle
import rewire, indices, directed_modularity
from scripts import initialization_params
import sys
sys.path.append("..") #sys.path.append(".")
f = open('./Output/initials_nor.pckl', 'rb')
vertices_coord, initial_matrix = pickle.load(f)
f.close()
K = len(vertices_coord)
# parameters ##... |
63d3f1c8118403da151eb2962207824fb5367f37454c4287a6cc2efac154ba72 | Python | 2,328 | 80 | # Node-group asset "Atomic Number" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING... |
c8bbecb2612376ad05f5ecea59f39147a3808936caab3a0b80d458128797b2de | Python | 2,328 | 75 | import logging
import numpy as np
from pathlib import Path
from hippo import get_data_path, get_store_path, save_config
from hippo.agents.clone_agent import CloneAgent
from hippo.evaluation.replay import ReplayEvaluation
from hippo.evaluation.planning import PlannerEvaluation
from hippo import save_object, load_objec... |
38bb9beeb0481122bc559af1ffc2bd6b1eda5807f80576c602e39bec86e8cf2a | Python | 2,329 | 74 | #!/usr/bin/env python
# This script is based on the example at: https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/samplesheet/samplesheet_test_illumina_amplicon.csv
import argparse
import csv
import errno
import os
import shutil
import sys
import tarfile
import urllib.request
from glob import glob
... |
b4ecd85f0beadf3d6ea082247b537b276dbd25046d737a2956601a86324ddb62 | Python | 2,330 | 74 | # coding=utf-8
# Copyright 2026 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... |
1a66f847762aeae3f8c092cb5778ca8b3a241086168ee1285a6762c1ac42354b | Python | 2,331 | 46 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
1af3e09f52fce51495f3594ed220c3c0a49ac57faefb95b58a01d7e3ac27d96f | Python | 2,331 | 67 | from unittest import TestCase
from codex.utils.graph_vis import Network
class Test(TestCase):
def test_clusters(self):
net = Network(show_edge_weights=True)
net.add_node(
"center",
1,
1,
"center",
"dot",
"#00ff00",
... |
475a1cfcd31cce8918f211e752627f91ca80bbd00d38ff702dfe4f2c850047eb | Python | 2,333 | 75 | from abc import ABC, abstractmethod
import SimpleITK as SITK
import imageio
import numpy as np
class AbstractIOHandler(ABC):
"""
Abstract class for IO operations between image files and numpy arrays.
"""
@abstractmethod
def im_read(self, filename):
"""
Reads a give... |
5219f37e13f3ede9be8cd46c0edd48d01ca5b9c25fb81ce2ecde38c72132f1b7 | Python | 2,333 | 58 | from analyse_data import *
import numpy as np
import matplotlib.pyplot as plt
import os
import argparse
from matplotlib.cm import get_cmap
import matplotlib
parser = argparse.ArgumentParser()
parser.add_argument("-T","--Time", type=float, default=1800,
help="Length of diffusion experiment in secon... |
649efb239cff97eb3da7ef9688670a00856f69b1caf9704e405f16a15d58b3e3 | Python | 2,333 | 82 | import pytest
import torch
from elasticai.creator.arithmetic import FxpParams
from elasticai.creator.nn import fixed_point as nn_creator
@pytest.mark.parametrize(
"total_bits, frac_bits, num_steps",
[
(3, 2, 8),
(4, 2, 4),
(4, 3, 4),
(6, 4, 32),
(8, 5, 64),
(10... |
b132066ddcb7db4885e6d4da6d14ef0be6e63271da39cbdcdaa3c160c49a6aeb | Python | 2,333 | 75 | import argparse
from pathlib import Path
import multiprocessing as mp
import cv2
def extract_mov(args):
mov_path, target_path, target_raw_path, skip, target_width, target_height = args
print(f'start working {mov_path.stem}')
video = cv2.VideoCapture(str(mov_path))
fps = video.get(cv2.CAP_PROP_FPS)
... |
66c83a148c41b6ca9295b0640a03197acce2f758e6428f69aaacbba9bb6f64b7 | Python | 2,334 | 69 | from torch import nn
import numpy as np
def calc_coeff(iter_num, high=1.0, low=0.0, alpha=10.0, max_iter=10000.0):
return float(2.0 * (high - low) / (1.0 + np.exp(-alpha * iter_num / max_iter)) - (high - low) + low)
def grl_hook(coeff):
def fun1(grad):
return -coeff * grad.clone()
return fun1
c... |
748ced6b122a78275402a5859155e8583fd2110dfea322e0967469f2667723c8 | Python | 2,334 | 46 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
95bf8dc75e1a2ff3504b670ae3deda542fb6fdf483da83c89b01bec0f7c7f094 | Python | 2,334 | 62 | #!/usr/bin/env python
#
# Copyright 2015 Google Inc. 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 copyright
# notice, this list of... |
a35e779afb6df1ef78b125d86b46508796461b25df2e970a2ca3abadac2ab638 | Python | 2,334 | 87 | # Node-group asset "Decay" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING
from bp... |
a9d78c3e177362e243eaf3a48b31dbca92f6f1be8141dc525cf661ccb78a1109 | Python | 2,334 | 58 | from torch.utils.data import Dataset
from typing import Tuple
import torchvision
import torch
class PairSeqData(Dataset):
def __init__(self, train_pairs, transform=None):
self.pairs = train_pairs
self.transform = transform
def __len__(self) -> int:
"""
Return total number of s... |
d18b57ab70d06b14f026de041c3831008a3528173a691b282dc072dc7751a32b | Python | 2,334 | 54 | from ..region_1020 import (FRONTAL_REGION_LIST, GENERAL_REGION_LIST,
HEMISPHERE_REGION_LIST)
from ..standard_1020 import STANDARD_1020_CHANNEL_LOCATION_DICT
from ..utils import (format_adj_matrix_from_adj_list,
format_adj_matrix_from_standard,
format_... |
e0f87832e8a551a5970bc2d9e70eeb2f80643f3776acb111cf2dda7ea9aa1308 | Python | 2,335 | 82 | from collections import namedtuple, Mapping
from heapq import heappush, heappop
class Vertex(object):
def __init__(self, value):
self.value = value
self.edges = []
def __repr__(self):
return self.__class__.__name__ + '(' + str(self.value) + ')'
class Edge(object):
def __init__... |
563621a265691d228810a92fbba95960e6ba1af91fe3f843ec6215127faf5014 | Python | 2,337 | 66 | import torch
import torch.nn as nn
from torch.nn import functional as F
from utils import *
class CrossEntropy(nn.Module):
def __init__(self, cfg):
super(CrossEntropy, self).__init__()
def forward(self, output, target):
loss = F.cross_entropy(output, target)
return loss
class FocalLo... |
900423ea4af48560584d8d3255ef71554ce8f1a6387f50eea51a1024fe3aeedf | Python | 2,337 | 78 | import pyasy.asymptote
from pyclamp.dsp.iofunc import *
class asypy:
asy = None
picfunc = ["draw", "dot", "label"]
def __init__(self):
self.astr = []
self.nstr = 0
self.npre = 0
self.npos = 0
self.pic()
def pic(self, _pic = None, position = (0,0), align = "NE"):
self.pstr = _pic
if ... |
a112fdbf37d0dcb41bbd944a2759697aa386352ebce0633640d604c93e5ffcc6 | Python | 2,338 | 58 | # Librairies
import os
import sys
code_path = os.path.split(os.path.split(os.getcwd())[0])[0]
sys.path.append(code_path)
import argparse
import numpy as np
from setting import *
# Arguments
argParser = argparse.ArgumentParser()
argParser.add_argument("-n", "--name", type=str, help="Dataset name")
argParser.add_argumen... |
30fb1949d7e4ac4234b7e167a3eec852384f91bb28b0dacda48b6dff40bf7333 | Python | 2,339 | 85 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Documentation:
Tests for hybridLFPy classes and methods
"""
import os
import sys
import numpy as np
import numpy.testing as nt
import unittest
import hybridLFPy
class TestHybridLFPy(unittest.TestCase):
'''
hybridLFPy test class
To run tests, simply issu... |
c1d1d6885d22855b6cce115a328cbd412258673a9602c06a774389a5b5ddb789 | Python | 2,339 | 48 | import argparse
from plantsegtools.utils import smart_load, create_h5
import glob
import os
def parse():
parser = argparse.ArgumentParser(description="Script to start the automated training wizard")
parser.add_argument("--raw-path", type=str, required=True, help='path to h5 or tiff dataset '
... |
b22800c3399cd5cfb62736959e61f67d4f332a5375dd402dfbf49e75eb663853 | Python | 2,340 | 75 | #!/bin/env python
"""
OXASL - Module to calibrate a perfusion output using previously calculated M0 value or image
Copyright (c) 2008 University of Nottingham
"""
import numpy as np
from fsl.data.image import Image
from oxasl.options import OptionCategory
class Options(OptionCategory):
"""
Options for calib... |
7314b5242dadd535a11525123647ce7d4795852734cf8cbd582485db510493c4 | Python | 2,341 | 79 | import torch
import torch.nn as nn
import torch.nn.functional as F
import argparse
import os
import wandb
import tqdm
import numpy as np
import pandas as pd
import data
import util
import net as networks
from torch.utils.data import DataLoader
import json
# write down test data path
data_path = 'data/test_sequence... |
8c9f83f7bf16cd6449b4a9f38129cf40272225364ffc5832a535ee242a532023 | Python | 2,341 | 31 | """posthoc_brake_driver_2026-10-02.py (post hoc: lLN2T_c was noticed in the census results first).
The census's verified list contains one laboratory-cholinergic local neuron (lLN2T_c, signed +) whose sign made inhibitory
costs 4 channels. Why? Where does lLN2T_c's output go, and what happens to direct and lateral firi... |
eb95ac5b4a75633ace5a6265f0df7b5885d84ec3d7dcb443025ecb64b9d1993e | Python | 2,341 | 74 | """Tests for the cancelled/incomplete run marker (issue #120). Pure, no Qt."""
import os
from regtools.registration.run_status import (
CANCELLED_MARKER,
clear_incomplete_marker,
is_run_incomplete,
read_incomplete_note,
write_cancelled_marker,
)
def test_write_then_detect(tmp_path):... |
fdd106ce7410ec861e5965af576b57948260b73455b742df6ea3ff2fbe1c98b2 | Python | 2,341 | 48 | # script to test APT_interface on 3 different projects
import APT_interface
import tensorflow as tf
import os
import datetime
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
dstr = datetime.datetime.now().strftime('%Y%m%d')
## Double pendulum
lbl_file = '/groups/branson/home/kabram/bransonlab/PoseTF/data/apt_interface/pend... |
541bdcff0e57dcee67c4579124f502511ccba0ee624afc53a123bd9298c8cf0c | Python | 2,342 | 82 | from typing import NamedTuple, Callable
import arguments
import runner
class Command(NamedTuple):
msg: str
script: Callable
commands = {
"convert-notebooks": Command(
msg="Convert notebook",
script=runner.convert_notebooks
),
"dendritic-spine-preprocess": Command(
msg="Run... |
5fe0bb1fca3005a8fd6a71ffd860eeddad029c5f1bbeca5241401192dc057840 | Python | 2,342 | 76 | from vispy.visuals import Visual
from vispy.scene.visuals import create_visual_node
from numpy import array, float32, r_
from vispy.gloo import VertexBuffer
VERT_SHADER = """
#version 120
varying vec3 v_position;
varying vec4 v_color;
varying vec3 v_normal;
void main() {
v_position = $a_position;
v_normal = $... |
16c1bc178ff400739d6f0625e089fc668cb61320fe937281a5035eb7f3268bb9 | Python | 2,343 | 59 | import zarr
from cirrocumulus.anndata_util import ADATA_MODULE_UNS_KEY, get_pegasus_marker_keys
from cirrocumulus.anndata_zarr import write_attribute
from cirrocumulus.util import dumps
def save_dataset_zarr(dataset, schema, output_directory, filesystem, whitelist):
module_dataset = None
if dataset.uns.get(A... |
434a0ae979ea3a744d55eb04026c8f3b1c7851713d1e4d3552526efaee5f08db | Python | 2,343 | 59 | """
toposampling - Topology-assisted sampling and analysis of activity data
Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation... |
ff353c532c20553b00a7ad7405211d367f049620d06e512a3cf234b34737163f | Python | 2,343 | 81 | import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import tkinter as tk
from matplotlib.backends.backend_tkagg import ( FigureCanvasTkAgg )
from matplotlib.figure import Figure
class AlertPlot(tk.Frame):
def __init__(self, root, w = 15, h = 5, hideaxes = False):
tk.Frame.__init__(self... |
772a48f3f9b3dc58334792b7b0fdc41ba6d77f5563b666976718f797ce9173e4 | Python | 2,344 | 79 | #!/usr/bin/env python3
from pathlib import Path
import pandas as pd
import re
from itertools import combinations
# Input/output directories
in_dir = Path("/project/3011157.03/Simon/proj_2022_CABB_movie/Scripts/MovVar_ImagNeuro_Revision01/Emofilm/r_output_ISRSA")
out_dir = in_dir / "correlations"
out_dir.mkdir(parents... |
92ecf9f3b82b51440b0befdf375e80dd7c5a264d1435dbee6d442778b83afde3 | Python | 2,344 | 48 | """
toposampling - Topology-assisted sampling and analysis of activity data
Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as
published by the Free Software Found... |
a5042c66c08a1598b57d902bc4050eb21096b54b940c829894c886ba45cc6bcd | Python | 2,344 | 73 | from typing import cast
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
from elasticai.creator.nn.fixed_point.precomputed.adaptable_silu import AdaptableSiLU
def test_vhdl_code_matches_expected_adapt_silu() -> None:
expected = """library ieee;
use ieee.std_logic_1164.all;
... |
b2974a31303c7ba0541910a8313c51ab280144155df16a0d77868c56d60d83d7 | Python | 2,344 | 27 | """POST HOC, descriptive (after KNIFE_OR_CELL_AL.py returned CELL). Same contrasts as the pre-registered test,
outcome = any monoamine vote (DA, SER or OA; synister argmax) instead of SER only.
Input tmp/al_region_sites.parquet (cached by KNIFE_OR_CELL_AL.py). Output 06-OUTPUT/posthoc_monoamine_share.txt"""
import nump... |
ff1171ab23f2c7660bb58e4e84407423af47f1b2fccd840fbba688ee03ef7767 | Python | 2,344 | 71 | # flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
3baed9b87d2b8a154d86e202e23ecc054b090e7e162ec22a83148a58040ef7b7 | Python | 2,345 | 93 | """
Run gaze mapping
================
This example shows how to run gaze mapping with a connected Pupil Core
headset.
.. note::
This example requires the dependencies for
:ref:`streaming<streaming_dependencies>` and
:ref:`pupil detection<pupil_detection_dependencies>`.
"""
import sys
import logging
imp... |
5a67628bdd8612c3890b222842bdab261bd5e253d203e6eb11a65d303c28ff7a | Python | 2,345 | 72 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, MaiaEnvironment
from lab.reports import Attribute, arithmetic_mean, geometric_mean
import common_setup
from common_setup import IssueConfig, IssueExperiment
from rel... |
c91db79ec503be27c07ded012b058db5f383855cb06669be286749610a3e7263 | Python | 2,345 | 63 | import os
import random
import shutil
import unittest
from torcheeg import transforms
from torcheeg.datasets import M3CVDataset
class TestPersonalIdentificationDataset(unittest.TestCase):
def setUp(self):
if os.path.exists('./tmp_out/'):
shutil.rmtree('./tmp_out/')
os.mkdir('./tmp_out... |
ccbf0a1c4bce0071321eb434ed0ddcb179f10cde619fab0ed002f013bb3cea53 | Python | 2,345 | 51 | #!/usr/bin/env python
from IlluminaBeadArrayFiles import GenotypeCalls, BeadPoolManifest, code2genotype
from datetime import date
import sys
import os
import glob
import argparse
parser = argparse.ArgumentParser("Generate a final report from a directory of GTC files")
parser.add_argument("manifest", help="BPM manifes... |
6082a96f506ab39f25e152cd72a69892d11f421b7ec023b6a95919790ff41597 | Python | 2,347 | 59 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
'''
Generate matrices with added reciprocal connections along maximal simplices and corresponding controls
Author(s): Daniela Egas S.
Last update: 03.2024
TODO: Add zenodo link
'''
import sys
sys.path.append('.... |
cf3b507d11b1df291e13a17bc9e3bbba9d8e932ba6c4135854aa610c8e7b982e | Python | 2,348 | 67 | import matplotlib
matplotlib.use("Agg")
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import yaml, io
with open("./config/MNIST_config.yaml", 'r') as stream:
config= yaml.safe_load(stream)
config["default_path"]= str(config["default_path"])
config["cuda"]= str(config["cud... |
abc033b01466922178f41afdf113b79acaa62efa4e965dadd0ad0b663929a0c4 | Python | 2,349 | 61 | import pandas as pd
import numpy as np
import os
celltype_list = ['EX', 'IN', 'ASC', 'ODC', 'OPC', 'MG']
Human_Sample = ['HM2013017', 'HM20200905', 'HM20200927', 'HM20201129',
'HM20201213', 'HM20201222']
Monkey_Sample = ['RM06013', 'RM07071', 'RM07333', 'RM08403', 'RM1102009']
for temp_celltype in ce... |
f2cb3a896f2f99aa721548ee6756eeb3560c3340a0aa10a529f55d1a10bcebe1 | Python | 2,349 | 70 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' Compute source spaces for inverse modeling '''
"""
Created on Thu Nov 18 14:59:01 2021
@author: david
"""
import os
import os.path as op
from stormdb.cluster import ClusterBatch
from stormdb.access import Query
from sys import argv
proj_name = 'MINDLAB2020_MEG-Audit... |
b12db9706613802ba99e650f85e374a09b1848efcd78731b3e52b7b0a5a37134 | Python | 2,350 | 79 | from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'wonambi', 'VERSION')) as f:
VERSION = f.read().strip('\n') # editors love to add newline
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
... |
e1a30f4d8cdf926be4af8b1653938fd433a839e18bca5ecf1b720ab9ba3f2425 | Python | 2,350 | 53 | import torch
def init_edge_rot_mat(edge_distance_vec):
edge_vec_0 = edge_distance_vec
edge_vec_0_distance = torch.sqrt(torch.sum(edge_vec_0**2, dim=1))
# Make sure the atoms are far enough apart
# assert torch.min(edge_vec_0_distance) < 0.0001
if torch.min(edge_vec_0_distance) < 0.0001:
... |
ae261e433daf27413f9e2686139eb01ed5ec8a80222d77892ca7f335f1cb9096 | Python | 2,351 | 73 | #! /usr/bin/env python
from __future__ import print_function
import os
import subprocess
import sys
import configs
DIR = os.path.dirname(os.path.abspath(__file__))
REPO = os.path.dirname(os.path.dirname(DIR))
BENCHMARKS_DIR = os.path.join(REPO, "misc", "tests", "benchmarks")
FAST_DOWNWARD = os.path.join(REPO, "fast... |
201b485082a124b2b5a42adaa370c6b5ced1b33b6e97f6316e8130e1e4ca7c97 | Python | 2,353 | 54 | #!/usr/bin/env python
import os
import pandas as pd
import matplotlib.pyplot as plt
from nltools.data import Brain_Data
from nltools.mask import expand_mask, roi_to_brain
from nltools.stats import threshold
from nilearn import plotting as nplot
## location of main project directory on HPC
proj_path = '/project/30111... |
fe29f0e7fde12fa8bda9bab2a8c2ba24639403597b671bea825684dd58bd761c | Python | 2,354 | 79 | #!/usr/bin/env python3
from pathlib import Path
import pandas as pd
import re
from itertools import combinations
# Input/output directories
in_dir = Path("/project/3011157.03/Simon/proj_2022_CABB_movie/Scripts/MovVar_ImagNeuro_Revision01/HCP_movie-watching/r_output_ISRSA")
out_dir = in_dir / "correlations"
out_dir.mk... |
75b1e426d67e839d3954ecb4cdb3f750c1b63f88314d2655038ce0256c603bb3 | Python | 2,356 | 56 | """Model adapters: everything model-family-specific that the kernel needs.
The built-in Qwen3 adapter wraps the pinned profiles in models.py and the LocalLLM loader.
A different family would provide the same methods; experiment orchestration does not change.
Ownership: the kernel (ObservatoryEngine) holds the single ... |
b353af6f53e52fcf24ece9b73b677470cf7c750de6676fab7c0fe0f1d8a6d9df | Python | 2,356 | 57 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from lab.reports import Attribute
from common_setup import IssueConfig, IssueExperiment
REVS = ["issue648-base", "issue648-v1"]
SUITE=suites.suite_optimal_strips()
SUITE.extend(suites.suite_ipc14_opt_strips())
CONFIGS = [
# Test label re... |
0cf98a3caea908813ded17a7c3e69ab9b35d8399bf457f51f4049fff443c04f8 | Python | 2,357 | 81 | import random
import unittest
import torch
import torch.nn as nn
from torch.utils.data import Dataset
from torch.utils.data.dataloader import DataLoader
from torcheeg.trainers import ClassifierTrainer
class DummyDataset(Dataset):
def __init__(self, length: int = 101):
self.length = length
def __len... |
a7bbba396726524bd470fb7df46e9a23a052350c4046f65e007577b7488c5862 | Python | 2,357 | 74 | from typing import cast
import elasticai.creator.nn.fixed_point as nn_creator
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
def test_vhdl_code_matches_expected_prelu2() -> None:
expected = """-- ////////////////////////////////////////////////////////////////////////////... |
9f6b68a270571d8159727db0919ede365d7973cd7a928b8c88da4db938c8292a | Python | 2,359 | 66 | from distutils import log
import distutils.command.install_scripts as orig
import os
import sys
from .._path import ensure_directory
class install_scripts(orig.install_scripts):
"""Do normal script install, plus any egg_info wrapper scripts"""
def initialize_options(self):
orig.install_scripts.initi... |
75636b179916445e3fb398109c3d57863e6115813a66c15e48783b2b23513741 | Python | 2,360 | 72 | # flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
c0f937a661193638f0856f40a870959208669e0bf9884bb1040c8a61060c3a94 | Python | 2,360 | 84 | # Node-group asset "Edge Group ID" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump.
from typing import TYPE_CHECKING... |
c7034d908ead0373289113c4f6b4d94e7e436d94528b073fd3a1d2b6d2b839bf | Python | 2,360 | 96 | # images_to_fiji_stack.py
# Load image directory into FIJI, apply translations, and merge into stack
import os
import csv
from ij import IJ, ImagePlus, ImageStack
resize_factor = 0.5
sec_start = 11
sec_end = 40
bucket_dir_path = '/usr/people/tmacrina/seungmount'
datasets_dir_path = "research/Julimaps/datasets"
cur_d... |
22146dcb4cfb37ba93e6c3f10b5735a175f220d687888a0a917a8c1b3b52cc98 | Python | 2,361 | 70 | from os.path import join as pjoin, pardir
import pandas as pd
import numpy as np
from dimension_encoding.utils import load_clip66_preds
from tqdm import tqdm
import os
def load_shapecomps(shapecompdir=pjoin(pardir, "data", "ShapeComp")):
# shapecompdir=pjoin(pardir, 'data', 'ShapeComp')
# fnames_shapecomp = n... |
6861b67fc5ca06c339564c806e91b4aec3c176d055d9a1685aa7a0507853e09e | Python | 2,361 | 68 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
de8947f6dd3b0d3c149abdd44f39222cb671b6c26efffdf59539f1925f4a9298 | Python | 2,361 | 56 | """Tests that all schemas in the hed-schemas submodule can be loaded.
Uses hed.scripts.check_schema_loading to verify that every non-deprecated
schema in all 4 formats (XML, MediaWiki, JSON, TSV) loads successfully.
Runs as part of spec_tests via ``python -m unittest discover spec_tests``.
"""
import unittest
from pa... |
406410626c1274878ef3978fb7880a1741693214c83cbac35eea5ca3e77d7f72 | Python | 2,362 | 65 | from __future__ import annotations
import pandas as pd
from numpy import sqrt
from torch import Tensor
from torch.utils.tensorboard import SummaryWriter
class MetricTracker:
def __init__(self, epoch_keys, iter_keys, writer=None):
self.writer: SummaryWriter = writer
self._df_epoch = pd.DataFrame(
... |
96b982bab9517040e9ca15672e19999d4f1304fb939c133140243eeee6647c1f | Python | 2,362 | 74 | from typing import cast
import elasticai.creator.nn.fixed_point as nn_creator
from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath
def test_vhdl_code_matches_expected_leaky_relu2() -> None:
expected = """-- ///////////////////////////////////////////////////////////////////////... |
b04dd6c1b1a60db525a4e7b11b956bc41ee15dc83f3588f9764732973c7e605f | Python | 2,362 | 70 | import sys
from scipy.stats.stats import pearsonr
import matplotlib
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import matplotlib.mlab as mlab
def main(f):
fh = open(f, 'r')
zic1_expression = []
other_expression = {}
for line in fh:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.