sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b000857fddd270f116402b73b988bf08e2b24730b3a4a6356c633e805e95d418 | Python | 11,440 | 278 | import torch
import torch.nn.functional as F
from onmt.translate.decode_strategy import DecodeStrategy
def sample_topp(logits, keep_topp):
sorted_logits, sorted_indices = torch.sort(logits,
descending=True,
dim=1)
... |
ae21c46a5b676de803c4b7934e322bc8dd1e00070f53f213586876ba6b42d37f | Python | 11,450 | 292 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.nn import functional as F
from scipy.stats import pearsonr
from scipy.stats import spearmanr
#load data
import numpy as np
import pandas as pd
import random
from torch.optim import Adam
import os
from sklearn.linear_model import ElasticNet
from s... |
c60be3c9089d7cb147920ad74afe026b49c77ca0396cda023502a53c67e5ff03 | Python | 11,450 | 270 | # Copyright 2026 Xanadu Quantum Technologies Inc.
# 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 agre... |
062064a7ec27f815cf64333574d73e218715ba405ff00f00fe80917f4ac92bf2 | Python | 11,451 | 304 | import importlib.resources
import traceback as tb
import urllib.parse
import webbrowser
import dclab
from PyQt6 import uic, QtCore, QtGui, QtWidgets
import requests
from ..widgets import show_wait_cursor, run_async
class DCORLoader(QtWidgets.QDialog):
search_finished = QtCore.pyqtSignal(int, list, list, object)... |
627967d00738354e37fb70bb372a83d84795be814e019866689ce445ccef9ddc | Python | 11,452 | 480 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.lines import Line2D
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["ax... |
bf6049c2ffd64b63627be1e4e432cb08293c3a888771a5d516fc4eb1d25cafc8 | Python | 11,453 | 343 | """
SQL-based result tracker (cannot store actual results, only status).
Using this tracker requires installation of the sqlalchemy package.
Regarding using models from different sources in Flask-SQLAlchemy:
https://stackoverflow.com/questions/28789063/associate-external-class-model-with-flask-sqlalchemy
TODO: Note t... |
137d17cf7945ea9eeb1c902d15d96fa0f30964022d04c6ec03cc0b74df476789 | Python | 11,455 | 340 | import argparse
import h5py
import os
import numpy as np
import sigpy as sp
from sigpy.mri import retro, app, sms, muse, mussels
from os.path import exists
DIR = os.path.dirname(os.path.realpath(__file__))
# %% options
parser = argparse.ArgumentParser(description='run reconstruction.')
parser.add_argument('--data'... |
d08b955bac0ba28f63bbeb26af282a443c9af599177828b1a439bbd84c2a507b | Python | 11,455 | 478 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.lines import Line2D
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["ax... |
a309064ebf587a63798aa8e9995dfbd25efb83008088eb6abf113e4ba09bed3a | Python | 11,457 | 456 | #!/usr/bin/env python
# coding: utf-8
# <a href="https://colab.research.google.com/github/Cyberbullying-Detection/Cyberbullying-Detection-on-Social-Media-using-Deep-Learning-and-Conventional-Machine-learning/blob/main/Bigrams.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" a... |
a7dd977aea5463be3fa11a79d1242c22933ed35978f70e80cd8e8338b9ec8fc3 | Python | 11,464 | 267 | # Copyright 2018-2024 Xanadu Quantum Technologies Inc.
# 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... |
14522a3d86996bc6267df82749cb4e98f11c67d153b9fecd378eea7cadaa1b87 | Python | 11,465 | 207 |
import numpy as np
import os
import sklearn
from sklearn import metrics
import time
from time import perf_counter
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')
from functions_PAPQMNIST import list_files_in_folder, create_save_dir
# The code can require changes if not the same format of folder... |
41cfc6c04023e12c750f845f756dfdd707d4620ab8d49ed9fae9236835c6649c | Python | 11,471 | 333 | """In-process background scheduler for periodic platform jobs.
Backed by ``apscheduler.schedulers.background.BackgroundScheduler`` — runs
inside the FastAPI process. No Redis / Celery required for v1; if you need
multi-worker concurrency, swap to a queue-backed orchestrator at the
``RunOrchestrator`` boundary (the sch... |
50d7b7e2bd836115d2f35e95c813875e19522df6ea07f2ffd71f3f212fa25c99 | Python | 11,481 | 277 | """Session 38 — native setup() phase 4: unsupervised tabular tasks.
Phase 1 (s35): supervised impute + ordinal-encode + label-encode + split + fold.
Phase 2 (s36): supervised normalize + transformation.
Phase 3 (s37): supervised remove_outliers + feature_selection.
Phase 4 finishes the tabular preprocessing drain by ... |
dca31f7347d4f43f4a99f0d9f66cb85f60db05b33112fb19754ceedfbce3708d | Python | 11,484 | 241 | import os
import json
import glob
import argparse
import numpy as np
from path import Path
from downsample.downsample_and_mask import downsample_mask, get_real_size
from inference import inference
from count_blobs import count_blobs
from automate_mBrainaligner import run_mbrainaligner_and_swc_reg
from cells_to_atlas i... |
b09092a26219e29f219a963b895105a04b376ee02d4cefe8c31c678bc71d506c | Python | 11,490 | 368 | # Copyright 2026 Xanadu Quantum Technologies Inc.
# 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 agre... |
10e36d876ff00acde7513d7f41ff59ba04b6c99bc743c02d97bd593e280d374f | Python | 11,502 | 303 | import numpy as np
import sys
def add_Askervein_measurement_lines(
ds_file, key, x_inter, y_inter, z_inter, grid_interpolator, measurement_offset
):
'''
Add the Askervein measurement line information to the dataset hdf5 file.
Parameters
----------
ds_file : h5py.File
Dataset f... |
d73ca928c70ae455ed2c92e788e1e04fabdea59c1491fd76ba3e41315cf136b3 | Python | 11,503 | 300 | # Copyright 2025 Xanadu Quantum Technologies Inc.
# 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 agre... |
fd821de83d9cc9f2b749220c67c1a194949d6799b0eea3ee3deff9bb0842025b | Python | 11,504 | 305 | # Copyright 2018-2026 Xanadu Quantum Technologies Inc.
# 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... |
14837894848427fe632e8d882a9e8e20c494728ab1fa2529679799745958fbbd | Python | 11,510 | 251 | """Create dicom image datasets for testing."""
import datetime
from collections.abc import Sequence
from copy import deepcopy
from pathlib import Path
import numpy as np
import pydicom
import torch
from einops import repeat
from mrpro.data import Rotation, SpatialDimension
from mrpro.phantoms import EllipsePhantom
fr... |
d5b3782f10a31ca3ace2a5c50e06188c61f56a7c2a3441ebba63e6308d1046c2 | Python | 11,511 | 229 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
1a6603c7c08d76dbbaad6967e7c87e4c6f2cc50a68ddacd625e3a72373ba6d12 | Python | 11,516 | 318 | from datetime import (
UTC,
datetime,
)
import dateutil.tz
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_get_values_for_csv_sub_minute_utc_offset():
# GH#66547 array formatting routes through Timestamp.isoformat, so a UTC
# offset carrying seconds used t... |
b72d9e9549d3e446b774f00dfb37c06003ef85f2bb2ba031514d487d7d091754 | Python | 11,517 | 408 | """Fetch data."""
import gzip
import hashlib
import os
import pickle
import shutil
from glob import glob
import numpy as np
import pandas as pd
from nilearn.datasets.utils import _fetch_file, _fetch_files
from nimare.dataset import Dataset
from scipy.sparse import load_npz
from gradec.utils import get_data_dir
OSF_U... |
51c350c916dbbecbdeaec6476f40d2554dc95153cb11a23ac0202ac98c005a67 | Python | 11,530 | 297 | """A vanilla 3D resnet implementation.
Based on Raghavendra Kotikalapudi's 2D implementation
keras-resnet (See https://github.com/raghakot/keras-resnet.)
"""
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals
)
import six
from math import ceil
from keras.models import ... |
d994941173a35178dc4ea03e3717905d8311e43a23a93e6bceef17e46a62422f | Python | 11,534 | 309 | # Copyright 2026 Xanadu Quantum Technologies Inc.
# 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 agre... |
1d3ff54623eb00001ef2cea710e1dfa48bd8f496ac667f3fd9a4bc7697c9b29c | Python | 11,541 | 250 | """Compare one real PPO minibatch update at several learning rates.
Collects ONE rollout in a fresh Wuji environment, prepares its first minibatch,
then restores identical model/Adam/normalizer/RNG state before each LR trial.
An optional checkpoint supplies learner state, not the historical environment
or onset batch.... |
c97105318a28bb80f7afc238a4d9fd1891049805d19bb260de679c0c12383a56 | Python | 11,543 | 335 | from umap import UMAP
from umap.umap_ import nearest_neighbors
from scipy import sparse
import numpy as np
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score
from sklearn.neighbors import KDTree
from scipy.spatial.distance import cdist, pdist, squareform
import pytest
import warnings
tr... |
a4623e6e6322f4a6e961af4f80e007b307e1370a4f74d03d9390d2dd3590d357 | Python | 11,544 | 362 | '''This script is used to generate dummy CSD sources,
to test the various kCSD methods
'''
import numpy as np
from numpy import exp, isfinite
from functools import wraps
def repeatUntilValid(f):
"""
A decorator (wrapper).
If output of `f(..., seed)` contains either NaN or infinite, repeats
calculati... |
b5f4dca4ea53e9ae2966395cf96b9e782f13f10b19df94d9668280db75a39907 | Python | 11,545 | 475 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.lines import Line2D
# increase the figure size
plt.rcParams["figure.figsize"] = [12, 10]
# remove the top and right spines from plot in the global plt setting
plt.rcParams["axes.spines.top"] = False
plt.rcParams["ax... |
d04b64404a0cd386a282be8ba3c2e34cd79451116527c2f8daf470e7bb61c9bc | Python | 11,546 | 322 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestJoin:
def test_join_outer(self):
# join with Index[int64]
index = pd.RangeIndex(start=0, stop=20, step=2)
other = pd.Index(np.arange(25, 14, -1, dtype=np.int64))
res, lidx, ridx = index.jo... |
d972aa410b514b7832352e618325847a73e930a112e2ba6cf9bb8fbacee3cc22 | Python | 11,555 | 249 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 15 22:22:41 2021
@author: Wladek
"""
import numpy as np
import pylab as py
from scipy.signal import filtfilt, butter, detrend, argrelmax, argrelmin
from scipy.stats import pearsonr
from kcsd import oKCSD3D
from mayavi import mlab
from basicfunc import model_data
import ... |
1795f8bf316d7fd545e48ba06d52f52a728d274621fd53d8d0026b71f3acf806 | Python | 11,559 | 287 | import os
import pickle
import sys
import struct
import numpy as np
from imageio import imread, imwrite
import nibabel
try:
from vtk import vtkStructuredPointsReader
import vtk.util.numpy_support as v2n
gotVTK = True
except ImportError:
print('could not import VTK functions')
gotVTK = False
clas... |
17ce782fa4f5f3654ec50afff762b74166205842f82a7d7b66d95795ffdf32c4 | Python | 11,568 | 386 | # Copyright 2024 Xanadu Quantum Technologies Inc.
# 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 agre... |
703b0e48836f9264c54711f3bbbaabff824b92c4f8be440e16033452888c8a63 | Python | 11,572 | 301 | import copy
import os
from tempfile import gettempdir
import numpy as np
import pytest
from test.fixtures.norm_data_fixtures import *
"""
This file contains tests for the NormData class in the PCNtoolkit.
The tests cover the following aspects:
1. Creating NormData objects from numpy arrays and pandas DataFrames
2. ... |
a38a6395912fd88de6954849a268ba9dfe29a06e35dd006e91cb369dad41f781 | Python | 11,573 | 309 | r"""
Angular math utils that contain calculations of angles.
"""
__all__ = ['RotationRepresentation', 'to_rotation_matrix', 'radian_to_degree', 'degree_to_radian', 'normalize_angle',
'angle_difference', 'angle_between', 'svd_rotate', 'generate_random_rotation_matrix',
'axis_angle_to_rotation... |
5b3d9ad52036bfcab9f806e66789af01cc96a4c511664c3f5e9ebfe800453f26 | Python | 11,582 | 370 | # UltraScan III Documentation Configuration
#
# Sphinx configuration file for building the UltraScan documentation.
# See the Sphinx documentation for the full list of configuration options:
# https://www.sphinx-doc.org/
# ---------------------------------------------------------------------------
# Path setup
#
# If ... |
7faef4fc10e5ad032f71e6a2c4950893e7b3ae39b6896e638c448c1fe2a3c23d | Python | 11,588 | 333 | # Copyright (C) 2019-2024 PyCaret
# Author: Moez Ali (moez.ali@queensu.ca)
# Contributors (https://github.com/pycaret/pycaret/graphs/contributors)
# License: MIT
import traceback
import warnings
from collections.abc import Callable
import numpy as np
from sklearn.exceptions import FitFailedWarning
from sklearn.metri... |
a1d2b9c0bf6685ce8515720ebc6f5ce9a1972625ff41c17dd116ee1b571c169a | Python | 11,594 | 222 | import os
import re
import traceback
from glob import glob
import io
import vtk
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import pyqtSignal, QBuffer
from PyQt5.QtWidgets import QHBoxLayout, QLabel, QVBoxLayout, QPushButton, QMessageBox
import nibabel.freesurfer.io as fs
from scanometrics.utils impor... |
0b4ba46cf164161ef1818ae103accc1f4f0c4ffbf6615a46adb5f2c30f72d15f | Python | 11,598 | 322 | import numpy as np
import pytest
import pandas._libs.index as libindex
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.boolean import BooleanDtype
class TestMultiIndexBasic:
def test_multiindex_perf_warn(self, performance_warning):
df = p... |
62f9b1b0cd94ecacbbfd0724cc3d14ef9ada3cf7174bd2e815b166701ae39289 | Python | 11,604 | 294 | from collections import OrderedDict
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
import pandas._testing as tm
class TestFromDict:
# Note: these tests are specific to the from_dict method, not for
# passing dictionaries to DataFrame.__init__
def test_co... |
a570e216f6539b272627f3b9511d31d1cdd65538df7c34591832f38865279e8a | Python | 11,605 | 364 | # Copyright 2026 Xanadu Quantum Technologies Inc.
# 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 agre... |
6f235b4cf0b03550c4e46b046b6baf3b7a96397b1aef3e151164ff088490c137 | Python | 11,611 | 347 | #
# File to train networks built from the hnn.py class.
#
# This file establishes the clebsch gordan coefficients, sets up an hnn with given parameters,
# loads holograms from .npy files, and then tests the network via a function call.
#
from argparse import ArgumentParser
import logging
import math
import os
import ... |
8d7823448d4651243d0f26fb9ed1f869b0165b569cba8d93cb257522ea0f47bb | Python | 11,613 | 258 | """Tests for models/factory.py — get_model and get_model_class."""
import copy
import pytest
import torch
from lightning_pose.data import get_data_module
from lightning_pose.losses import get_loss_factories
from lightning_pose.losses.factory import LossFactory
from lightning_pose.losses.losses import HeatmapMSELoss,... |
7dd2bd54e2db6c1832240989fd2068b0195ceafe772976bf844fdc4bfd44a901 | Python | 11,620 | 324 | # Copyright 2025 Xanadu Quantum Technologies Inc.
# 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 agre... |
9c1fc0f1800eaa48f1e37619f381b53de8249efe6fa17e60a73b368b432f7f3a | Python | 11,621 | 262 | import argparse
import numpy as np
import os
import torch
import torchinfo
import logging
import sys
from collections import defaultdict
from pathlib import Path
from torch.utils.data import DataLoader
import torch.nn as nn
import torch.nn.functional as F
import tqdm
import matplotlib.pyplot as plt
from torch.utils.ten... |
0065755fc249ef2adba1f0327762aecdc2a3eadcbd6bbc1978ff0ffc2eca431e | Python | 11,628 | 180 | from typing import List, Union, Optional, Any, Dict, Literal
from enum import Enum
from pydantic import BaseModel, Field, Extra
from typing_extensions import Annotated
class Gender(str, Enum):
male = 'm'
female = 'f'
class AnatomicalArea(BaseModel, extra=Extra.forbid):
"""
Defines an anatomical area... |
7fd25cfd1805efaa9a37667dee515bd019c6476648220fa52eb5a1d45f7e4763 | Python | 11,633 | 353 | """
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.
The tests in this file are inherited from the BaseExtensionTests, and only
minimal ... |
8cbaf9bda442910c19d9cdf0841305bb9b59374130b46c5b5548b66b545f8976 | Python | 11,637 | 374 | """Sessions 49-52 — Track A · clustering, anomaly, time-series, EDA plots.
Batched into a single file because each module is shaped identically:
take a fitted estimator (or raw data, for EDA) and return a Plotly
``Figure``. The dashboard composition is the same across tasks — a
tabbed model-card view that swaps in the... |
9cc09cfe9505b08a41b3c612d4bed18294ee7062bc347937bd7d3fa3753865ec | Python | 11,637 | 297 | # -*- coding: utf-8 -*-
'''
SYNTHETIC_DATA_GENERATOR_CLI
COMMAND LINE (CLI) VERSION FOR THE GENERATION OF SYNTHETIC TRXYT FILES
GENERATE SYNTHETIC TRXYT FILES USED FOR NANOSCALE SPATIOTEMPORAL INDEXING CLUSTERING (NASTIC AND SEGNASTIC) OR 3D DBSCAN (BOOSH).
Design and coding: Tristan Wallis
Queensland Brain Institute
... |
586e2c6528f0488876f83808d936ca6023ca59d6b6a3d50f15b350fe2f42dc44 | Python | 11,642 | 226 | # Copyright (c) 2021-2023, NVIDIA Corporation
# 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 condit... |
4d3d2f7fe07933c077a831a980dff6f7888059f50865e3c8efeca1ebb0a8f917 | Python | 11,645 | 296 | import inspect
import numpy as np
import os.path as op
import pyvista as pv
import matplotlib.pyplot as plt
from mne import head_to_mri
from mne.label import _n_colors
from mne.viz.backends._utils import _qt_app_exec
from nilearn.plotting import plot_stat_map
from nilearn.image import index_img
from pyvistaqt import Ba... |
d38a568c8c2dbbf76e3011c0b58760f2cd3b71d0176c23af8477cd6582e55267 | Python | 11,653 | 252 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp, wormdatamodel as wormdm
from scipy.optimize import curve_fit
import matplotlib.ticker as ticker
ds_list = "/projects/LEIFER/francesco/funatlas_list.txt"
ds_tags = None
ds_exclude_tags = "mutant"
ds_exclude_i = []
inclall_occ = "--inclall-occ" in... |
f3db5a86dfa1ae2de994c8c94f56c8e599caf13e83fce48d927c050c2716a22c | Python | 11,654 | 261 | '''
Title: extract_coref_predictors.py
Author: Evan Jaffe
Original date: 3/28/2017
Generate by-word tsv of predictors for coreference-based features. Uses annotated numbered editable linetrees file, with X-nID and X-mID as indicating the id of the antecedent.
To run:
python extract_coref_predictors.py <input_file... |
d1d3eee047c2a706f305684daa4dcd078dc6a0f1f6890efe779e32dd03301cb7 | Python | 11,658 | 385 | from io import StringIO
import numpy as np
import torch
from torch import sparse_coo_tensor as coo
from scipy.sparse import csr_matrix
import faiss
from tqdm import tqdm
from kilosort import hierarchical, swarmsplitter
def neigh_mat(Xd, nskip=10, n_neigh=30):
Xsub = Xd[::nskip]
n_samples, dim = Xd.shape
... |
5fe84d922ed3f39fa238c02bbffd38c206681713672397af7d289dc4cb1396da | Python | 11,663 | 277 | import torch
import torch.nn as nn
from AYN_Package.Task.ObjectDetection.D2.Dev import DevLoss
from AYN_Package.Task.ObjectDetection.D2.YOLO.V4.Tools import YOLOV4Tool
from AYN_Package.Task.ObjectDetection.D2.YOLO.V5.Tools import YOLOV5Tool
class LossforAttack(DevLoss):
def __init__(
self,
... |
a0cc53b4a849da93e270fb91c3b062a4a97f41814ae9def557f0fe6e8a02fefa | Python | 11,663 | 341 | # Copyright 2018-2023 Xanadu Quantum Technologies Inc.
# 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... |
6351ea26c322ab7a660dbee21e7aedbeab460a7b74fd6a9d44d823c09e5a77ae | Python | 11,666 | 345 | """
Post-nanoemoji processing of the Noto COLRv1 Emoji files.
Adds additional sequences to properly support Safari, corrects 'name', etc.
For now substantially based on copying from a correct bitmap build.
"""
from absl import app
import functools
from fontTools.feaLib.builder import addOpenTypeFeaturesFromString
fro... |
2ec06d5f425ba77941b566be7d51f84e4471bf120b0e0337e3210601b63cbb94 | Python | 11,668 | 272 | import logging
import numpy
from . import diffeomorphisms, regularGrid
import sys
import os
compute_path = os.environ["PYLDDMM_COMPUTE_PATH"]
log_file_name = "imageTimeSeries.log"
compute_output_dir = compute_path + "/output/time_series/"
lung_image_dir = compute_path + "/input/time_series/lung/"
biocard_image_dir = c... |
60bf311260e905f2ee5cd100cbeef4c92b263ceb11c731b53b64dfc92f6eaf7d | Python | 11,668 | 272 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 02 17:26:00 2017
@author: Wladek
"""
import matplotlib.cm as cm
import numpy as np
import pylab as py
import os
from sklearn.decomposition import FastICA, PCA, NMF
from scipy.signal import correlate, welch, spectrogram, argrelextrema, butter,filtfilt, hilbert
from scipy i... |
eb0c6508c4fd53413ec87a54ba86720320f08dc04e5be8ca122b949ac1aa594d | Python | 11,669 | 253 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp, wormdatamodel as wormdm
from scipy.optimize import curve_fit
import matplotlib.ticker as ticker
ds_list = "/projects/LEIFER/francesco/funatlas_list.txt"
ds_tags = None
ds_exclude_tags = "mutant"
ds_exclude_i = []
inclall_occ = "--inclall-occ" in... |
7d81ec3f587a6ac3e218d0dc6f6d64b40c554b713428981ec02b5057a09a8d8d | Python | 11,679 | 374 | import numpy as np
import pandas as pd
import rpy2.robjects as robjects
from rpy2.robjects.packages import importr
from rpy2.robjects import pandas2ri
pandas2ri.activate()
import warnings
warnings.filterwarnings("ignore", category=UserWarning)
rstring = '''
function(x) {
return(scale(x, scale=FALSE))
... |
c0f78087b49047496223dfe510d42b055e0af83cbe36696eaad0bd2b382099ff | Python | 11,680 | 341 | """Generate (and optionally execute) the 5 canonical PyCaret 4.0 notebooks.
Run:
uv run python scripts/build_notebooks.py # generate only
uv run python scripts/build_notebooks.py --run # generate + execute
Produces:
notebooks/01_classification.ipynb
notebooks/02_regression.ipynb
note... |
33f135d2e87dfba809166e7fe148d3ee216b9e9ba779213c5713deb6ac755057 | Python | 11,683 | 363 | # -*- coding: utf-8 -*-
import pickle
from itertools import islice, product
import numpy as np
import pytest
from emcee import EnsembleSampler, backends, moves, walkers_independent
__all__ = ["test_shapes", "test_errors", "test_thin", "test_vectorize"]
all_backends = backends.get_test_backends()
def normal_log_p... |
64d9cfb9bfd8172c12328a557254ab9a967b24af5b4f23f3a6f529de1c361e52 | Python | 11,696 | 328 | """Decode module."""
import os.path as op
from abc import ABCMeta, abstractmethod
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from nilearn import masking
from nimare import decode
from nimare.annotate.gclda import GCLDAModel
from nimare.decode.utils import weight_priors
from nimare.extr... |
5cf762590eadcda5d80642b9815e77e2e04d65fe264db944aee121ccc66edb6c | Python | 11,698 | 267 | #!/usr/bin/env python3
"""Recompute the anhydrous molar volume (bead volume) of somo.residue's prosthetic groups.
WHY
`somo.residue`'s amino-acid entries come from the crystallographic literature (Perkins 1986 and
relatives) and are void-INCLUSIVE Voronoi-style volumes. The prosthetic-group entries were
instead produc... |
e0ae34ffe14bd9afd4d7ed59f7b1c0c09896fffc741c7cd2ec34e0574b12f0e6 | Python | 11,699 | 348 | # JN 2015-01-11
"""
main program for spike sorting
"""
from __future__ import print_function, division, absolute_import
import os
import math
from time import strftime
import numpy as np
import logging
logger = logging.getLogger(__name__)
# pylint: disable=E1101
from .. import SortingManager, SessionManager, optio... |
8e240be7327decf46750df7a6e52ff60de9aab4415f3ed2bc4a124f6e89b3b82 | Python | 11,706 | 238 | import argparse
import configparser
import os
import sys
import logging
import json
import ezmsg.core as ez
import numpy as np
from pathlib import Path
from local.units import ZMQConnector, ZMQConnectorSettings
from local.units import HighGammaActivity, HighGammaActivitySettings
from local.units import FilterSpeechSegm... |
e92c461b0bc5cd361cd66438f59778a0f071cb8522394c0f7b180b58cd8cc820 | Python | 11,708 | 349 | import os
import random
import pysam
class CSV:
def __init__(self, id, included_SSVs):
self.id = id
self.ref_chrom = included_SSVs[0].ref_chrom
self.ref_start = min([ssv.ref_start for ssv in included_SSVs])
self.ref_end = max([ssv.ref_end for ssv in included_SSVs])
self... |
6364c3bd688a61c4a6c94a04efe5ccf83b6502828183b2b2dd5fe715b3d3c99f | Python | 11,713 | 280 | # Copyright 2025 Xanadu Quantum Technologies Inc.
# 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 agre... |
d0ebb7e7794d86dfe5aaffa7f96f2a74157da20708a7421771856f78a94ad4c7 | Python | 11,720 | 420 | """
Tests for offsets.Tick and subclasses
"""
from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas._libs.tslibs.offsets import delta_to_tick
import pandas as pd
import pandas._testing as tm
from pandas.tests.tseries.offsets.common import assert_offset_equal
from pandas... |
638816d4dd65918ebcdf606545f7b19a4f0b346e2a0c6a5a2f05edcce9c0afc2 | Python | 11,721 | 277 | # Copyright 2025 Xanadu Quantum Technologies Inc.
# 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 agre... |
81c0bb36099129129977cf6746cdb1c0c400ddec0874c0b5000c5af00b21a38a | Python | 11,728 | 316 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 16 18:11:11 2023
@author: lonya
"""
#%% Load Data
from tkinter import messagebox
import tkinter as tk
import tkinter.filedialog as fd
import numpy as np
import os
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter
import pandas as pd
import scipy.i... |
7ae43a01a38d5606ef46ccf5f2ac8bfcc38b6fa7221866acfb41d251f499ec7f | Python | 11,732 | 322 | from primary_match import auc_score, make_roc_plot, print_delong_table, get_auc_unc, formal_or_names
import tensorflow as tf
import pandas as pd
import numpy as np
from scipy.optimize import linear_sum_assignment
from tqdm import tqdm
import os.path as op
import os
from sklearn.metrics import roc_auc_score, roc_curve
i... |
9d7e4b0a6a0804beb6ed6f899d49902cd3ea6fd1690d8c485e17a7c23ec00f23 | Python | 11,734 | 286 | import numpy as np
import matplotlib.pyplot as plt
import sys
import os
from kcsd import sKCSD, KCSD3D, sKCSDcell
from kcsd import sKCSD_utils as utils
import kcsd.validation.plotting_functions as pl
import sKCSD_utils
n_src = 512
R = 16e-6/2**.5
lambd = .1/((2*(2*np.pi)**3*R**2*n_src))
dt = 0.5
n = 100 # dist_table... |
286f13bfe8298ee0e940985b01347367bab5d5e441c00821ebccac1a9e5fd9dd | Python | 11,736 | 249 | # Copyright 2019 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
#
# http://w... |
6ae896e13190c908573c056bc0dde59dfe3b59bb167cc6f32bfa63397cf0d980 | Python | 11,742 | 349 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
523ac13576f13fb9aaacaa05f3704a441254df6393a1afdf0ce0715104e6cc98 | Python | 11,746 | 334 | # Copyright 2018-2023 Xanadu Quantum Technologies Inc.
# 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... |
304a93cd8c9ecdeb412b79943514b24fb188411515cf28cf150e5db519053490 | Python | 11,748 | 255 | ## Script: get_invMaf_aln.py
## Description: infer inversion status from MAF alignment file.
## Author: Kevin Lee
## Date: 2022.01.06
# NOTE:
# (1) Inversion name must be formated as starting with chromosome and delimited with "_", e.g, chr19_inv1 or chr19_SV_12
import argparse
from utils import InputStream
... |
84755b6bf73067f1e05d1e3a3674212ed5ac3743cb8311251bf4d24a96a63c6f | Python | 11,752 | 378 | import re
import sys
# a Tree consists of a category label 'c' and a list of child Trees 'ch'
class Tree:
def __init__(self,c='',ch=[], p=None, l=0, r=0):
self.c = c
self.ch = ch
self.p = p
self.l = l
self.r = r
# obtain string from tree
def __str__(self):
... |
bf913cb05083854eb70567c46ca47b7db5b97273fafd23bd5157b576d1d6d44c | Python | 11,752 | 285 | # Copyright 2025 Xanadu Quantum Technologies Inc.
# 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 agre... |
755964aa19cd78ec387bccee83fa26b881b785d95ee4d6e5d1540d8a691a7d8e | Python | 11,761 | 239 | import numpy as np, matplotlib.pyplot as plt, sys
import pumpprobe as pp
plt.rc("xtick",labelsize=14)
plt.rc("ytick",labelsize=14)
plt.rc("axes",labelsize=14)
top_n_opt = 9#14
merge = "--no-merge" not in sys.argv
print("merge:",merge)
to_paper = "--to-paper" in sys.argv
unc31 = "--unc31" in sys.argv
strain = "" if no... |
cb3bf960223d59853e4052bb697defd4dc5dd5b17362b393898c624783743241 | Python | 11,769 | 282 | # Copyright 2018-2024 Xanadu Quantum Technologies Inc.
# 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... |
3e66a946cb82b1314e749fa117bc9fb522bbbbc5aca8db59282c2c4fab414e27 | Python | 11,771 | 366 | import rl_games.envs.test
from rl_games.common import wrappers
from rl_games.common import tr_helpers
from rl_games.envs.maniskill import create_maniskill_env
from rl_games.common.gymnasium_vecenv import create_gymnasium_env, wrap_atari
from gymnasium.wrappers import FlattenObservation
import gymnasium as gym
import nu... |
3bfdf4d91137091f0cf40074f4fc9fa3f8371b704b2cbebc221786ee20044ca3 | Python | 11,776 | 328 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.core import algorithms
from pandas.core.arrays import PeriodArray
class TestSeriesIsIn:
def test_isin(self):
s = pd.Series(["A", "B", "C", "a", "B", "B", "A", "C"])
result = s.isin(["A", "C"])
e... |
d9b027c58b8e1fb30c155aa8b41f8feb301cb400c29d64aba30e483bac14c27b | Python | 11,779 | 312 | """
This file is for models creation, which consults options
and creates each encoder and decoder accordingly.
"""
import re
import torch
import torch.nn as nn
from torch.nn.init import xavier_uniform_
import onmt.modules
from onmt.encoders import str2enc
from onmt.decoders import str2dec
from onmt.modules import Em... |
993e797d72d46d2de574abe62b7a1498b2c7855a5d2b1a598b2d141384c2514f | Python | 11,780 | 299 | import torch
import torch.nn as nn
from tqdm import tqdm
import numpy as np
import os
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
from AYN_Package.Task.ObjectDetection.D2.YOLO.V4 import *
from AYN_Package.Optimizer.WarmUp import WarmUpOptimizer, WarmUpCosineAnnealOptimizer
from yolo... |
c0304616f1a58de78637cef2cfb4e643ac2c21d74f5e473de955a23f4cf56b9c | Python | 11,788 | 377 | import re
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_error():
df = pd.DataFrame(
{"A": pd.Series([[0, 1, 2], np.nan, [], (3, 4)], index=list("abcd")), "B": 1}
)
with pytest.raises(
ValueError, match="column must be a scalar, tuple, or list ... |
4afe3562db188826da8ce859c57bde7c5734df2d02605974656b839bd7082542 | Python | 11,790 | 373 | from __future__ import annotations
from typing import Iterable, Union
import torch
import numpy as np
from .transform_convert import axisangle2mat, mat2axisangle
from ..utils import DeviceType
class RigidTransform(object):
def __init__(
self, data: torch.Tensor, trans_first: bool = True, device: DeviceTyp... |
ef6a552dcc824b426f5b3785d23c4999ca2cab6bd643a13295538d9cc67654f8 | Python | 11,790 | 356 | #!/usr/bin/env python3
"""
Read pairwise alignments from lastz's general format. Typical input is below
but other columns may be included. It is up to the calling program what
columns are required.
#name1 zstart1 end1 name2 strand2 zstart2+ end2+ id
mule.chr1 9833952 9834016 donkey.contig... |
446814625b2a958cdf9a9b7e78cf4755be91fa00eaaf2f3b3b5944ffdcfabe19 | Python | 11,791 | 381 | """
For compatibility with numpy libraries, pandas functions or methods have to
accept '*args' and '**kwargs' parameters to accommodate numpy arguments that
are not actually used or respected in the pandas implementation.
To ensure that users do not abuse these parameters, validation is performed in
'validators.py' to... |
ff179b8ea8a36e5d07ac0459596b59ad4ac65d407e66ffa392657bd6098018e3 | Python | 11,792 | 325 | import logging
import warnings
import numpy as np
import nibabel as nib
def powder_average(dwi_path, bvals_path, td_path, mask_path, out_path, debug=False):
"""
Compute the powder average of the diffusion-weighted images.
Parameters
----------
dwi_path : str
Path to the preprocessed signa... |
217bd35924ed625b82d87a203179617d6efa071e1a158185fa24196b050ddb96 | Python | 11,795 | 338 | """
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 logging
import torch
import torch_geometric
from tqdm import tqdm
from ocpmodels.common import distutils
from ocpmodels.common.regis... |
59aa743afa886797ec757efa4743cf4db7ce862eb1f2c4cb9633ce0a54169e5e | Python | 11,798 | 298 | import jax
import numpy as np
import gzip
import hashlib
import h5py
import os
import random
import shutil
import torch
import urllib.request
from six.moves.urllib.error import HTTPError
from six.moves.urllib.error import URLError
from six.moves.urllib.request import urlretrieve
from torch.utils.data import DataLoader,... |
3ab69abfafd4e6c1a20fffcb781a8e1bbac50e6953108074b5592a37da410160 | Python | 11,802 | 265 | import os
import time
import json
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# import opinionated
import matplotlib.pyplot as plt
plt.style.use('ggplot')
from src.models import PredSparseCoding
from src.utils import *
from src.get_data import get_nat_movie, get... |
dfea3b765874327e0abf85a1480ab6e34cf510ca46f445b4ab98dd13c2ab8fee | Python | 11,812 | 360 | """
Module for formatting output data into CSV files.
"""
from __future__ import annotations
from collections.abc import (
Hashable,
Iterable,
Iterator,
Sequence,
)
import csv as csvlib
import os
from typing import (
TYPE_CHECKING,
Any,
cast,
)
import numpy as np
from pandas._libs import... |
d25855bbd27619daed2a656b0d93a91ee5641b4deb0e459e2cae2857869fd929 | Python | 11,815 | 315 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
d86d49c25fd6636b6d1540960fad77b6061fa1a5c3e000ff24dad7f30e88f569 | Python | 11,825 | 352 | """Tests for PDHG."""
import pytest
import torch
from mrpro.algorithms.optimizers import pdhg
from mrpro.operators import FastFourierOp, IdentityOp, LinearOperatorMatrix, ProximableFunctionalSeparableSum, WaveletOp
from mrpro.operators.functionals import L1Norm, L1NormViewAsReal, L2NormSquared, ZeroFunctional
from mrp... |
be9c6f919fabf35483ddf90a133b59c797290ecea3092c4505927c03283a4ca6 | Python | 11,826 | 308 | """Tests for regression models."""
import numpy as np
import pytest
from pcntoolkit.dataio.norm_data import NormData
from pcntoolkit.math_functions.likelihood import NormalLikelihood
from pcntoolkit.math_functions.prior import (
LinearPrior,
Prior,
RandomPrior,
make_prior,
)
from pcntoolkit.regression... |
711d8b0c21a2f6d5f52f58784b98b79879de148022a430a3b090cfc541f7302a | Python | 11,829 | 347 | #!/usr/bin/env python
"""Module Description: Test the Variant and PeakVariants classes in
MACS3.Signal.PeakVariants, which hold the variants called in one peak
and write them as VCF records.
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE i... |
fca8493eaf44d3b755ef45aba20d10991cb7b93c5c56b2141e45fe5e2e84c3ce | Python | 11,830 | 351 | from __future__ import annotations
from typing import (
TYPE_CHECKING,
Literal,
)
import numpy as np
from pandas._libs import (
lib,
missing as libmissing,
)
from pandas._libs.tslibs import (
Timedelta,
Timestamp,
)
from pandas.util._decorators import set_module
from pandas.util._validators i... |
c635772f2ef366f8b40339ac54dee587f499452def2129d8fa8603c5884473ec | Python | 11,831 | 362 | # Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.