sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f6e375a86f1f8cd20de353e6590553b7a35a1c712ee7bd9d9c3e5e67c66bde65 | Python | 5,762 | 136 | # 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... |
fda345db0c1c33047bde1f864887d80216e1ab253653e5ab30b1667c4db18445 | Python | 5,762 | 155 | # 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... |
1df9979c602c0fa9f0f6ede395a1bbeb7c4cfd5b91827ac0dfe844618a9533af | Python | 5,766 | 163 | from __future__ import division
import numpy as np
def Model_Variant_Parameters(x):
if not isinstance(x, dict): # params class (not a dict)
if x.Model < 0: ###### RNN ##########
x.check_perf = True
x.stop_perf = 0
x.Z = 3
if x.Model_varian... |
318ede3ff1d8f2963b2911bf501386ffcf9fa7fe9105807b3364f3b597df8fb5 | Python | 5,768 | 165 | """ Report manager utility """
import time
from datetime import datetime
import onmt
from onmt.utils.logging import logger
def build_report_manager(opt, gpu_rank):
if opt.tensorboard and gpu_rank <= 0:
from torch.utils.tensorboard import SummaryWriter
if not hasattr(opt, 'tensorboard_log_dir_dat... |
46e746c44a85c088c6577898dd2a2d34d590c4cb9389b4f29a67b0268de82f7f | Python | 5,768 | 176 | """
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 ... |
5f4084c8355cb751209db82b1411bab70e64a01bbb03e875971401bb213ff219 | Python | 5,769 | 201 | """
.. module:: gfx_shaders
:platform: Linux, Windows
:synopsis: Module storing inlined source code for GLSL shaders
.. moduleauthor:: Fredrik Nysjo
"""
raycast_vs = """
#version 410
uniform int u_projection_mode=0;
uniform mat4 u_mv;
uniform mat4 u_mvp;
out vec3 v_ray_origin;
out vec3 v_ray_dir;
const int C... |
fd9c5d7860cd15c89314bddbdb8b798840953f374549f57ea0aa0d80f77dba69 | Python | 5,769 | 181 | import math
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestSeriesCov:
def test_cov(self, datetime_series):
# full overlap
tm.assert_almost_equal(
datetime_series.cov(datetime_series), datetime_series.std() ** 2
)
# partial... |
03de895ba805f6b4327d683345eae0de62d760dd879623179ba37730b22384f3 | Python | 5,770 | 203 | import h5py
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import sigpy as sp
import torchvision.transforms as T
from sigpy.mri import app, muse, retro, sms
import os
DIR = os.path.dirname(os.path.realpath(__file__))
print('> current directory: ', DIR)
HOME_DIR = DIR.rsplit('/', 1)[0].rs... |
6d2114f9e520bfcfdc2716a7b69a39a2493849d3412cb9c7f15a39e3d9ed4e2f | Python | 5,771 | 169 | import matplotlib.pyplot as plt
import os
import sys
from matplotlib.colors import ListedColormap
paths = [os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),'src')]
sys.path.extend(paths)
from src.draw import draw_angle_stimu... |
90cd3423c3ce05bf9214a6b1e9de8164ec8719a8a141e658ab29fa9503a2f323 | Python | 5,772 | 159 | import math
from typing import List
import torch
import torch.optim.lr_scheduler as scheduler
# https://detectron2.readthedocs.io/_modules/detectron2/solver/lr_scheduler.html
class WarmupCosineLR(torch.optim.lr_scheduler._LRScheduler):
def __init__(
self,
optimizer: torch.optim.Optimizer,
m... |
b85d3d159426a0afd560d826ba321cb81327e089183bbf0de513c974c07500e7 | Python | 5,772 | 185 | """Test nimare.meta.ibma (image-based meta-analytic estimators)."""
import logging
import os.path as op
from contextlib import ExitStack as does_not_raise
import numpy as np
import pytest
from nilearn.input_data import NiftiLabelsMasker
import nimare
from nimare.correct import FDRCorrector, FWECorrector
from nimare.m... |
eaf5c54c528de7d67feea06ef4f07d232f74eb2c3559cf386654718caa799171 | Python | 5,777 | 152 | #!/usr/bin/python
# EquiPNAS: Improved protein-nucleic binding site prediction
# using pretrained protein language model and equivariant deep graph learning
#
# Copyright (C) Bhattacharya Laboratory 2023
#
# EquiPNAS is free software: you can redistribute it and/or modify
# it under the terms o... |
d2a0c3ee7e291500f17af6b310acbf9539f08bc53da1da6701150154db284204 | Python | 5,778 | 207 | import csv
import numpy as np
import pandas as pd
from tqdm import tqdm
import json
file = pd.read_csv('ChChSe-Decagon_polypharmacy.csv')
df = pd.DataFrame(file)
drugs = {}
side_effects = {}
edges = []
with open('ChChSe-Decagon_polypharmacy.csv', 'r') as csvfile:
spamreader = csv.reader(csvfile)
for row in s... |
a43baa4adddde3e446f1d01cd9c47a0b231b875b23c9949be37967539961f148 | Python | 5,780 | 163 |
# Copyright (c) 2018-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 condi... |
bb5a5f4ae33b4cb0df9f77299c664b111e802b238287d05c27ce6d03b2ed14f3 | Python | 5,780 | 163 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 9 16:42:31 2022
@author: jinani
Gaussian map layer and power law exponent layer
"""
# Import Required Libraries
import numpy as np
from tensorflow.keras import initializers
from tensorflow.keras.layers import Layer
import tensorflow.keras.backend... |
d8f4c5f989940b8c8e67cd3884cf1e1e355c6bc9a0b9001dfe9986acec76721e | Python | 5,781 | 175 | import torch
from torch import nn
import torch.nn.functional as F
from rl_games.algos_torch.network_builder import NetworkBuilder
class TestNet(NetworkBuilder.BaseNetwork):
def __init__(self, params, **kwargs):
nn.Module.__init__(self)
actions_num = kwargs.pop('actions_num')
input_shape = ... |
9414c3ce0236ccadb23dd385dd0922f4f994777d9d353027160e689f90bddfd8 | Python | 5,782 | 156 | """Contains all methods relate to iteration."""
import torchtext.data
from onmt.utils.logging import logger
def batch_iter(data, batch_size, batch_size_fn=None, batch_size_multiple=1):
"""Yield elements from data in chunks of batch_size, where each chunk size
is a multiple of batch_size_multiple.
This i... |
30733894c2397deba8d7b600dfac7277ad044c05315dd719c746e5521747bdfd | Python | 5,783 | 161 | # MOFTransformer version 2.0.0
import random
import torch
import torch.nn as nn
class ConvLayer(nn.Module):
"""
Convolutional operation on graphs
(https://github.com/txie-93/cgcnn)
"""
def __init__(self, atom_fea_len, nbr_fea_len):
super().__init__()
self.atom_fea_... |
c46b019ce869f7f8040625be18eab3ffc5b4fd04d3eeb0957baf913a5ca098e8 | Python | 5,787 | 153 | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
class TestPeriodIndexAsType:
@pytest.mark.parametrize("dtype", [float, "timedelta64", "timedelta64[ns]"])
def test_astype_raises(self, dtype):
# GH#13149, GH#13209
idx = pd.PeriodIndex(["2016-05-16", "NaT", pd.N... |
6773b419b0e51f016a501a9b70ac08f9a61c70d3c41cffed67a31da1919457ae | Python | 5,788 | 124 | # -*- coding: utf-8 -*-
import torch
import torch.nn.functional as func
import numpy as np
#from sdna.net.functional.train import get_same_packages
class AutoEncoder(torch.nn.Module):
def __init__(self, arguments, enc, dec, coder, channel, coder2=None, coder3=None):
"""
Autoencoder combines the e... |
824dc549bb656180b729ffcadd03355a9a2ba5a68b5cfa77487dcfb6a184785f | Python | 5,788 | 159 | import ray
import os
import random
import pandas as pd
import logging
from sbrnet_core.utils.constants import NUM_SLICES, view_combos
from sbrnet_core.utils import (
normalize_psf_power,
full_read_tiff,
full_read,
lsi_fwd_mdl,
pad_3d_array_to_size,
write_tiff16,
sbrnet_utils,
)
logger = lo... |
66967c2f7782e99baf1834be918488b2b0f5d58316fcbaf3969d8b370563d483 | Python | 5,794 | 172 | #
# hologram.py -- Michael Pun -- 28 January 2021
#
# This module contains the functions used to project point clouds
# coefficients. The functions also allow for a channel dimensions
# to encode any information that is not spatial in the data.
#
# import modules necessary for this code
import os
import numpy as np
... |
9abcef774a3c3114c267847132be79cac7204fa4fcbb0cf8aa5a0719af46e2bf | Python | 5,795 | 153 | #!/usr/bin/env python
"""
Inference-time ensemble for BASALT DL contamination classifiers.
This script loads multiple trained MLP checkpoints, performs ensemble
prediction on the test dataset, and writes the predicted labels to
an output file. It is used internally during BASALT outlier removal.
"""
import math
impo... |
a5c471f2fb5bc8d74c2c61857cf8d4617ffea422e8f20c27305bdaa2993859d5 | Python | 5,796 | 169 | """Spatial and temporal filters."""
import warnings
from collections.abc import Sequence
from functools import reduce
from math import ceil
from typing import Literal
import numpy as np
import torch
from einops import repeat
from mrpro.utils.reshape import normalize_indices
def filter_separable(
x: torch.Tenso... |
338f741ac47ea7992860588b84614a99862104e85f46d11170311772b93d37e1 | Python | 5,798 | 133 | from torch.utils.data import Dataset
import os
import lmdb
import numpy as np
import json
import dgl
import torch
from utils.data_utils import process_files_ddi,process_files_decagon
from utils.graph_utils import deserialize,get_neighbors,ssp_multigraph_to_dgl
import scipy.sparse as ssp
def get_kge_embeddings(dataset,... |
94a591931aebe6f8d9ab13b9066a9a361ffbcc8cefe5d1052f3b42cc119f7c00 | Python | 5,798 | 154 | from __future__ import division
import numpy as np
""" modified from https://gist.github.com/blink1073/6e417c726b0dd03d5ea0 """
def phantom3d(phantom="modified-shepp-logan", n=64):
"""Three-dimensional Shepp-Logan phantom
Can be used to test 3-D reconstruction algorithms.
Parameters
==========
... |
dcdb5738d526035335c1ad9d3a97c56807dd62d8b507f7d1886d123ed4390614 | Python | 5,798 | 147 | # Uses python/3.6.4-anaconda.
# Originally written by Bin Yang, and adapted by Kevin Dean.
# UTSW microscope software saves data in the form of Cell1/1_CH(channel)_(time).tif
# Code is designed to parse each Cell#, and identify the number of channels (channel) and timepoints.
# Works on Linux, would need to be mo... |
1e92542847c8343fcb9742475e17bf0a4e4e51cfd179328fc523ff3f8838ed79 | Python | 5,799 | 170 | __all__ = ["pGlycoReportParser"]
import os
import re
from typing import Any, Iterable, Union
import pandas as pd
from ....chem.pep.aminoacids import AminoAcidCollection
from ....chem.pep.mods import (
ModificationCollection,
ModifiedSequence,
ModPosition,
modified_sequence_to_str,
)
from ....chem.gpe... |
200a226bad9b69fc6be018f91b18303e1e84741ba0e4bb20e10d3aaecbbf15cd | Python | 5,806 | 168 | import os
import time
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
import matplotlib.pyplot as plt
plt.style.use('ggplot')
from src.models import NeuralKalmanFilter, KalmanFilter
from src.utils import *
device = "cpu"
print(device)
result_path = os.path.join('./results/', 'lea... |
72cf63820fec3f11e63ea2a981c16dfd874059c834e805a7007b12a14ceeb469 | Python | 5,806 | 169 | import os
import numpy as np
import reverb
import tensorflow as tf
from tensorflow.keras.optimizers import Adam
from wandb.integration.keras import WandbMetricsLogger
import wandb
from rl_toolkit.networks.callbacks import SACAgentCallback
from rl_toolkit.networks.models import ActorCritic
from rl_toolkit.utils import... |
7574ace4fc06d31f869bd353105d0e56ec9f8dabc0c51ff74a51deea61ae7ca0 | Python | 5,815 | 154 | import logging
from pathlib import Path
import click
from dotenv import find_dotenv, load_dotenv
import mlflow
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from tqdm.auto import tqdm
from data_utils import make_k_fold
from models import DenseNet, SeqNet, SpecATNet, AlexNet, ResNet, Discrim... |
6c47ce98b12e141c37aba274e0730e9bc5f302893b0af93eee07c41d30c1c0fa | Python | 5,822 | 122 | import pickle
from src import functions as sf
from tqdm import tqdm
import torch
import numpy as np
import os
from human_body_prior.body_model.body_model import BodyModel
support_dir = 'data/support_data'
subject_gender = 'male'
comp_device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
bm_f... |
56d8e6a9d22a0ebcd68d858deaafd3a3db5949ce41b817dc0bfa263ad7f73c3b | Python | 5,829 | 201 | import numpy
import scipy.sparse
from scipy.sparse.linalg import eigs
from scipy.linalg import eig
import matplotlib.pyplot as plt
import time
import bionetwork
import torch
import pandas
steps = 500
networkSize = 100
density = 0.2
errorSize = 1e-3
noise = 1e-10
initialEig = 1.2
targetEig = 0.95
expFactor = 20
#Gen... |
933834c81f9bf17eed4e1c77794b685a02217bc50b97933d54b4114b8696c791 | Python | 5,832 | 177 | """End-to-end OOP smoke tests for PyCaret 4.0.
Exercises the canonical 4.0 API (``pycaret.tasks.*Experiment`` + the top-level
``save_model`` / ``load_model`` utilities). One test per task — deliberately
small so CI stays fast. Deep coverage per task gets re-authored in later
sessions as each verb is rewritten natively... |
0fecef16bc4d3bcf8d3baf689324c98cd6b4d5fda17b18d621faacf22c37c5d1 | Python | 5,835 | 176 | import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import seaborn as sns
from fmriprep_denoise.visualization import utils
strategy_order = list(utils.GRID_LOCATION.values())
measures = {
"p_values": {
"var_name": "qcfc_significant",
"label": "Percentage %",
... |
dc16f23a6d9f80c818cc322e566f8f3ef99db38b244845ef68f760e762d3cb08 | Python | 5,835 | 135 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 28 19:53:10 2022
@author: ecastrow
"""
import pandas as pd
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
import... |
cf5eeb55e99bb7d3e7f79766acdc5159dc4ffbfb78e47a4d0e1cb7b26a06688a | Python | 5,837 | 119 | # MIT License
#
# Copyright 2026 Broad Institute
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... |
0bb78c17564a98788fd34541d797b533bce1ecdca05fdac1a3c824c3621281b1 | Python | 5,840 | 169 | from typing import Dict, List, Optional, Tuple, Union
import pandas as pd
from scipy.stats import shapiro
from pycaret.internal.tests import _format_test_results
from pycaret.utils.time_series import _get_diff_name_list
##########################
# Individual Tests ####
##########################
def _summary_stat... |
8655af6930a4805b803d3e09d955c87ab2ab9cb25174cb9af689fc456711f3e9 | Python | 5,843 | 145 | import numpy as np
import wormbrain as wormb
import wormdatamodel as wormdm
import pumpprobe as pp
import unmix as um
import mistofrutta as mf
import matplotlib.pyplot as plt
import sys
import os
import pickle
tubatura = pp.Pipeline("match_pp_multicolor.py",sys.argv)
reg = tubatura.config['reg_params']['reg_type']
ma... |
f7fdb2cbc443fc394d13b3eb76c1fd6b0ea0ba4774dd9b73dc3b3b2f78668e97 | Python | 5,843 | 139 | """Report generator for the detect command.
"""
from itertools import repeat
from atropos.commands.reports import BaseReportGenerator
from atropos.commands.legacy_report import Printer, TitlePrinter
from atropos.io import open_output
from atropos.io.seqio import FastaFormat
class ReportGenerator(BaseReportGenerator):
... |
98f959bed0dd743fb7be370d3088c86c70fd808b3cccf4320f20e81705deaf64 | Python | 5,845 | 214 | import numpy as np
import matplotlib.pyplot as plt
# 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["axes.spines.right"] = False
# change the linewidth of the axes and spines
... |
ca744e94a858e6b488556599126877176f0078f8833311be65bfbbe5ba58ffc0 | Python | 5,846 | 128 | #!/usr/bin/env python3
"""Independently summarize the ten locked true-test evaluations."""
from __future__ import annotations
import csv
import hashlib
import json
import math
from pathlib import Path
import sys
import numpy as np
SEEDS = [555, 666, 777, 888, 999, 1111, 2222, 3333, 4444, 5555]
METRICS = [
"r", ... |
974ed6fe2b436ca69045f35c6068e59b95de6e4564c79a80a3a2bf2c0233ea9f | Python | 5,850 | 153 | """Session 33 — drain get_config / set_config off self._legacy.
After session 32, `add_metric` / `remove_metric` were drained. The only
secondary verbs left were `get_config` / `set_config` (escape hatches
for advanced users) and `plot_model` / `evaluate_model` (Phase 3
Plotly-native rewrite).
Session 33 drains `get_... |
988a49f921bf5a41fec6c959dc57a42eb1a6214339936ddabdaff1e03ee96f0d | Python | 5,850 | 176 | # Module to support opening .cine video files
import array
import ctypes
import numpy
# need to check whether optimization attempts helpful
from cine_profiler import print_time
_cine_median = ctypes.cdll.LoadLibrary("./libcine_median.so")
BytePtr = ctypes.POINTER(ctypes.c_ubyte)
_cine_median.video_median.restype = B... |
faac0cabdf2875541ada23690b147a30b758d8d6a173d552766bd37d025af4db | Python | 5,850 | 186 | """Test nimare.meta.ibma (image-based meta-analytic estimators)."""
import logging
import os.path as op
from contextlib import ExitStack as does_not_raise
import numpy as np
import pytest
from nilearn.input_data import NiftiLabelsMasker
import nimare
from nimare.correct import FDRCorrector, FWECorrector
from nimare.m... |
6c02a3bdb670e1acf39412af9c64b708a6fbaaef720267d0b0068fdaf2f1cfbf | Python | 5,853 | 162 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 9 16:42:31 2022
@author: jinani
Gaussian map layer and power law exponent layer
"""
# Import Required Libraries
import numpy as np
from tensorflow.keras import initializers
from tensorflow.keras.layers import Layer
import tensorflow.keras.backend... |
a77fcdab3c41168164315fdf3c45e17ca4f15b7d9aa0e549eabbe635bd4e1c09 | Python | 5,853 | 207 | #!/usr/bin/env python3
"""
Script to generate contributor and pull request lists
This script generates contributor and pull request lists for release
announcements using GitHub v3 protocol. Use requires an authentication token in
order to have sufficient bandwidth, you can get one following the directions at
`<https:/... |
250b4da68d16c354cd1724a21f364a94f1124f4e2ace9821fa2aca52ce93bde8 | Python | 5,854 | 207 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.15.0
# kernelspec:
# display_name: ol-connectome
# language: python
# name: ol-connectome
# ---
# %% [markdown]
# ### Plot the No. of cel... |
864653d82fa88e26848cc1e8185c8e6cca89a8d26c16d3920fa9feef9b849692 | Python | 5,854 | 192 | """Segmentation module."""
from abc import ABCMeta
import numpy as np
from sklearn.cluster import KMeans
from sklearn.metrics import pairwise_distances
SIGMA_0 = 1
class Segmentation(metaclass=ABCMeta):
"""Base class for segmentation methods.
Parameters
----------
n_segments : int
Total nu... |
2e27a4efe35012b73dc8e380174080abc4f913741fe1eaddf1752fa0abdadf3e | Python | 5,855 | 163 | import logging
import os
from typing import List
from tempfile import NamedTemporaryFile
import Bio.PDB
from Bio.PDB.mmtf import MMTFParser
import numpy as np
import torch
from scipy.spatial import distance_matrix
from progres.chainsaw.src.constants import _3to1, STRIDE_EXE
from progres.chainsaw.src.utils.cif2pdb imp... |
d850090e7e24706728c50eb5a80215ce77ef2adcacdc89eaf667020c06bee71b | Python | 5,855 | 234 | from abc import ABC, abstractmethod
from pprint import pprint
from typing import Any, Dict, Optional, Union
import pandas as pd
if "get_ipython" not in globals():
from IPython import get_ipython
from IPython.display import HTML, DisplayHandle, clear_output
from IPython.display import display as ipython_display
f... |
1333142e9aa9b4778a1b48217d587c153bc0dc94d86a6847e30c90d47d198780 | Python | 5,856 | 156 | import numpy as np
from Bio import SeqIO
from multiprocessing import Pool
from functools import partial
import torch
import torch_geometric.transforms as T
import torch_geometric.utils as ut
from torch_geometric.data import Data
from torch_geometric.data import InMemoryDataset
from GCNFrame import encode_seq
class Bi... |
37bf3b0e7833e5fef9963ed4277ea0e538740e9b24f37b06da24f724ccb3e04a | Python | 5,859 | 187 | from datetime import datetime
import sys
import numpy as np
import pytest
from pandas.compat import PYPY
import pandas as pd
import pandas._testing as tm
from pandas.core.accessor import PandasDelegate
from pandas.core.base import (
NoNewAttributesMixin,
PandasObject,
)
def series_via_frame_from_dict(x, **... |
bed34938f8d7de253d478a85ee47edd372038159697f9b90d6b21764c14e4e62 | Python | 5,862 | 137 | # 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... |
67f8b65225774dea9eeaa97879e710e425dbc3b3cae3400a11e1222032565200 | Python | 5,863 | 184 | # -*- 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.io ... |
8d689d42924b1e7853b82dc26481006325b938df447bc199678a1f5f96119a40 | Python | 5,866 | 116 | # 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... |
e2a5c47d04b386a1e2d1dbb2c15ff1096719c4501fc4ae2852a91906f9912c88 | Python | 5,866 | 146 | # MIT License
#
# Copyright (c) 2020 Jakob S. Kottmann, Sumner Alperin-Lea, Alán Aspuru-Guzik
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitati... |
4fa26beb8212233a71895e3d5a271766ebed11fec1a29ab280d4698d974f74d1 | Python | 5,867 | 191 | import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, classification_report, accur... |
87bbbd09ae557cd17cc5768a3e7e914f39712b5102525fecad705c378e323804 | Python | 5,870 | 166 | """Package-wide ground truth for feature units and plausibility ranges."""
import json
import math
from functools import lru_cache
from importlib import resources
import numpy as np
_UNBOUNDED = {"unit": None, "low": None, "high": None}
@lru_cache(maxsize=1)
def load_feature_range_registry() -> dict:
"""
L... |
c9cd135efdabac3faa0bd1c3c77ef78b7f5d7d0e67cbafc44c28299ca8bcd3c2 | Python | 5,872 | 174 | import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.utils.checkpoint import checkpoint
from esm.modules import TransformerLayer, LearnedPositionalEmbedding, ESM1bLayerNorm, AxialTransformerLayer
from sequence_models.constants import PROTEIN_ALPHABET, PAD, MASK
class RobertaLMHead(nn.Module)... |
b324bb137baedfe844cfbcd620b9b61a79bb11389bdd606d59d7d90f0fcd4de8 | Python | 5,873 | 183 | # 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... |
0b027079d9ad5c06698668cce81b4fcae3d485f330ea08bbdec25f127f90237b | Python | 5,876 | 157 | import numpy as np
import random
import tensorflow as tf
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, SpatialDropout1D
from keras.layers import Activation, Flatten, Input, Masking
from keras.layers import Convolution1D, MaxPooling1D
from keras.utils import np_utils
from ker... |
c7d2f4f7003ce7fe11ccae71990a268d78af7325d1e7423123decd49b0f14c75 | Python | 5,878 | 184 | """Tests for decode."""
import numpy as np
from gradec.decode import GCLDADecoder, LDADecoder, TermDecoder
from gradec.segmentation import KMeansSegmentation
def test_term_corr_decoder(tmp_path_factory, reduced_testdata_laird):
"""Test fetching features from OSF."""
tmpdir = tmp_path_factory.mktemp("test_fet... |
cc8e3e46024e434fa30fbfe9a56564ec9423089b760b83cb3ff975a44ddc68ee | Python | 5,878 | 98 | # Imports
import numpy as np
np.random.seed(0)
import os
os.environ['TF_ENABLE_ONEDNN_OPTS']='0'
import matplotlib.pyplot as plt
import matplotlib.backends.backend_pdf
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from sklearn.decomposition import PCA
import u... |
eacc2f4cc20fa6abe08b786012e5e6f74f2100b62f154205571d5389f89dec4e | Python | 5,879 | 185 | """Tests for decode."""
import numpy as np
from gradec.decode import GCLDADecoder, LDADecoder, TermDecoder
from gradec.segmentation import KMeansSegmentation
def test_term_corr_decoder(tmp_path_factory, reduced_testdata_laird):
"""Test fetching features from OSF."""
tmpdir = tmp_path_factory.mktemp("test_fe... |
c60d33b3d19854fbe663d80304f5567e898e2b6c4d03f1a0a261d63b5f58cef5 | Python | 5,880 | 184 | import sys
import os
from argparse import Namespace
import shutil
import glob
import logging
import numpy as np
from ..image import load_mask
from ..utils import makedirs, LogIO
from .. import (
TWAI_DIR,
NIFTYREG_BIN_DIR,
NNUNet_RAW_DATA_DIR,
NNUNet_PREPROCESSED_DIR,
NNUNET_TRAINED_MODELs_DIR,
)
... |
dc675296999cacf4a797f9c19c1e07d4f5f772b6e002e09327e92cbff057dc85 | Python | 5,880 | 123 | import os
import pickle
import numpy as np
from scipy import signal as sgn
import Plot
import Load as Load
# Figures
Display = True
Save = True
# Define Parameters
# Stimuli and EEG
stim = 'Envelope'
Bands = ['Theta']
sesiones = [21, 22, 23, 24, 25, 26, 27, 29, 30]
total_subjects = len(sesiones)*2
... |
d060d992778e75930e71096f34bb0308289cb90ca283513eaee3d67d66604363 | Python | 5,882 | 134 | """Tests for the WASABI signal model."""
from collections.abc import Sequence
import pytest
import torch
from mrpro.operators.models import WASABI
from mrpro.utils import RandomGenerator
from mrpro.utils.reshape import unsqueeze_right
from tests import autodiff_test
from tests.operators.models.conftest import SHAPE_V... |
e9ccbef324b6982e3919f0da1e56a156efd62d4a267095e0faf7d3af75fe0ee1 | Python | 5,884 | 198 | #
# Python module to implement equivariant VAE.
#
import tensorflow.keras.backend as K
import tensorflow as tf
import linearity
import nonlinearity
import spherical_batch_norm as sbn
# reload imports for testing
from importlib import reload
reload(nonlinearity)
class vae(tf.keras.Model):
def __init__(self,
... |
462687590baf90fcefd47313264102fc458e72c2d3285277937aacb58da9ad7b | Python | 5,888 | 129 | """Public caller/CLI regressions for bounded work and empty chromosomes."""
import json
import os
from pathlib import Path
import signal
import subprocess
import sys
import pytest
from conftest import macs3_env, no_core_dumps
from MACS3.Utilities.Performance import DEFAULTS
def probe(tmp_path, **config):
scrip... |
d75d2ff7dbd68ef1fc06998e8296d9d81fcf0c3cc9cd9adb83e8b55f15e9fe4f | Python | 5,890 | 155 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 25 14:18:58 2019
@author: vman
"""
import mne
import numpy as np
from copy import deepcopy as dcopy
import pandas as pd
import multiprocessing
num_cores = multiprocessing.cpu_count()
import os
homeDir = 'path to project home directory'
from functi... |
fe472c2f748b29947fe8292e534bca6ec61ef749ffb42b80a09e939da94249d4 | Python | 5,893 | 123 | # Copyright (c) 2018-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... |
236263e66198555b1cb0f2cdb725b70ddbda7faa0885f23316243d118ccef897 | Python | 5,895 | 197 | import os
import numpy as np
import pandas as pd
class SummaryData(object):
"""A class that contains summary data for computing ES metrics
The SummaryData object allows sharing of summary data in between
commputations, thus reducing the number computations needed,
e.g. we need only compute the mean o... |
284fa8b620b0377270d76ec40f0d06c2a1f1c622101c71961812abad23064a13 | Python | 5,895 | 159 | import gymnasium as gym
import numpy as np
class TestRNNEnv(gym.Env):
def __init__(self, **kwargs):
gym.Env.__init__(self)
self.obs_dict = {}
self.max_steps = kwargs.pop('max_steps', 21)
self.show_time = kwargs.pop('show_time', 1)
self.min_dist = kwargs.pop('min_dist', 2)
... |
06c3b4d54464e11d19a997b32c0f1f14fee572f9c411b745648e948eed50f291 | Python | 5,897 | 164 | """Crop command for the lightning-pose CLI."""
from __future__ import annotations
import argparse
import logging
from pathlib import Path
from typing import TYPE_CHECKING, Any
from lightning_pose.cli import types
logger = logging.getLogger(__name__)
if TYPE_CHECKING:
import lightning_pose.utils.cropzoom as cz ... |
a9606cf6310f618b8854ea6ddfb91abcb0125fb0379b307fb46e46c840061a9a | Python | 5,899 | 147 | from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def _get_with_delta(delta, freq="YE-DEC"):
return pd.date_range(
pd.to_datetime("1/1/2001") + delta,
pd.to_datetime("12/31/2009") + delta,
freq=freq,
)
class TestToTimes... |
bf209bad07456c6ba166f7b2143f33a0d8e2188d1c8831412c7e035e16d5e9b3 | Python | 5,900 | 154 | import numpy
import matplotlib.pyplot as plt
import pandas
from scipy.stats import pearsonr
import seaborn as sns
import plotting
import torch
#Load experimental data
viabilitydata = pandas.read_csv('viabilityModel/viability.tsv', sep='\t', low_memory=False, index_col=0)
drugData = pandas.read_csv('viabilityModel/drug... |
068bfc0bf2aead4c5726d5cfe79c70a1be1f6a2319227c1f3893f51a6c33e2a8 | Python | 5,902 | 160 | import numpy as np
import os
from kcsd import csd_profile as CSD
from kcsd import KCSD2D
from scipy.integrate import simps
from scipy.interpolate import griddata
from figure_properties import *
import matplotlib.pyplot as plt
import matplotlib.cm as cm
def integrate_2d(csd_at, true_csd, ele_pos, h, csd_lims):
csd... |
168c64779c838496a0d968c2901d741824e87ee517d50026a314b631dceb212f | Python | 5,905 | 159 | import matplotlib.pylab as plt
import math
import numpy as np
import random
from astropy.nddata import block_reduce
def draw_reward_zone():
for stripe in range(8):
if stripe % 2 == 0:
plt.axvline(91.25+stripe*2.5, color='limegreen', linewidth=5.5, alpha=0.4, zorder=0)
else:
... |
54c9cff04070f35da28e52f956b9b1301ef989de9ccf516fe711a50b35fe5df3 | Python | 5,912 | 154 | import numpy as np
import pytest
import pandas._config.config as cf
import pandas as pd
import pandas._testing as tm
class TestIndexRendering:
def test_repr_is_valid_construction_code(self):
# for the case of Index, where the repr is traditional rather than
# stylized
idx = pd.Index(["a"... |
faebb71f56279f6777a77dd013eb42de4aeebb7f89f81d750226b705e073c3e2 | Python | 5,918 | 187 | import copy
import dclab
from dclab.kde import methods as kdem
import numpy as np
from ..util import hashobj
DEFAULT_STATE = {
"identifier": "no default",
"layout": {
"column count": 2,
"division": "multiscatter+contour",
"label plots": True,
"name": "no default", # overridd... |
ae536adc89d9afa6b4b9c9b3753a152dd8c01b0825be1323c972db943ee83143 | Python | 5,919 | 173 | import torch
from torch import nn
# Convolutional Block Attention Module
class CBAMLayer(nn.Module):
def __init__(self, channel, reduction, spatial_kernel):
super(CBAMLayer, self).__init__()
# channel attention # Compress H, W to 1
self.max_pool = nn.AdaptiveMaxPool2d(1)
... |
e030384ebdedb8fd2aaa4293d4483bc5006f9d7878feea36b473b6d2d340efc1 | Python | 5,923 | 181 | """Session 33 — Phase 9 schedule kinds smoke test.
Verifies that ``drift_check`` / ``batch_predict`` / ``dataset_refresh``
schedules are wired end-to-end:
ScheduledJob (kind=X) → /run-now → JOB_HANDLERS[X] →
_spawn_worker_job(job_kind=X) → Job row (kind=X) → worker
handler in worker._HANDLERS
Inproces... |
655153c10f6ac52bde320e152f7f47d63a49b4abaf21d69d0f46393433a13762 | Python | 5,924 | 152 | # 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... |
ce0186198129c50c6fca5f2f0f605a2e7e9412123f5064a2424651bbafb25e36 | Python | 5,926 | 158 | import torch
import numpy
import bionetwork
import plotting
import pandas
import saveSimulations
#Load network
networkList, nodeNames, modeOfAction = bionetwork.loadNetwork('data/KEGGnet-Model.tsv')
annotation = pandas.read_csv('data/KEGGnet-Annotation.tsv', sep='\t')
uniprot2gene = dict(zip(annotation['code'], annota... |
b82fe9a1a1b0e968319a826de574eae55276b5329579e4bf23a12540b875586f | Python | 5,928 | 155 | """MJLab (MuJoCo Lab) vectorized environment wrapper for rl_games.
MJLab provides Isaac Lab's manager-based API powered by MuJoCo Warp,
running GPU-accelerated environments without Isaac Sim/Omniverse.
Available tasks: Mjlab-Velocity-Flat-Unitree-G1, Mjlab-Velocity-Rough-Unitree-G1,
Mjlab-Velocity-Flat-Unitree-Go1, M... |
26d258cb34d4e1e8eaeaf9ad5312c2541eaabae1fb3dd1dc72a052bfa32e7a8d | Python | 5,931 | 170 | # ----------------------------------------------------------------------------
# Copyright (c) 2016-2026, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
219ccc4552384e3bdf48a0491fb951fa61147e55c6923ad6003f276e1709074c | Python | 5,932 | 148 | """Load vision encoder from DINO/DINOv2/DINOv3 models using HuggingFace."""
import logging
import torch
import torch.nn as nn
logger = logging.getLogger(__name__)
# to ignore imports for sphinx-autoapidoc
__all__: list[str] = []
_DINOV3_ACCESS_HELP = """
============================================================... |
5ea5cb4ca0cc8d809d1c11ce3d37f3e28a76f11dc5bad3a5adb2cb9eec0b8124 | Python | 5,932 | 152 | """Patch extraction (sliding window) operator."""
from collections.abc import Sequence
import torch
from mrpro.operators.LinearOperator import LinearOperator
from mrpro.utils.sliding_window import sliding_window
class PatchOp(LinearOperator):
"""Extract N-dimensional patches using a sliding window view.
T... |
dc3bdb2bd0ee569a1d781d523b00b5bcfdd4d1fafa1299dc71a3cec983c6eb19 | Python | 5,937 | 201 | """FastAPI app factory.
Usage:
from pycaret_server.app import create_app
app = create_app()
# uvicorn pycaret_server.app:create_app --factory --reload
Or via the CLI:
pycaret-server serve --reload
"""
from __future__ import annotations
from contextlib import asynccontextmanager
from fastapi import ... |
e46409685f3da9fc36703a5434466b1293e00f07bc43b0368c81f001c33d0724 | Python | 5,937 | 117 | import sys
import re
def getArity ( cat ):
while '{' in cat:
cat = re.sub('\{[^\{\}]*\}','X',cat)
return len(re.findall('-[abcd]',cat))
################################################################################
class Sign:
def __init__ ( this, skTemp=None, lTemp=None ):
this.sk = skTemp ## set ... |
c81359ba6fca8fc35d687fdd8e0d573119b841f08acac145e2394fbd85714740 | Python | 5,938 | 140 | """1D, 2D and 3D density compensation function calculation with voronoi method."""
from concurrent.futures import ProcessPoolExecutor
from itertools import product
import numpy as np
import torch
from numpy.typing import ArrayLike
from scipy.spatial import ConvexHull, Voronoi
UNIQUE_ROUNDING_DECIMALS = 15
def _vol... |
e9c7d77467014b2096b0f95a609e0e781936b1a48ac8bed87a6587f8233a9a74 | Python | 5,941 | 171 | from argparse import Namespace
from typing import List, Tuple
import time
import datetime
import torch
import torch.optim as optim
import logging
from ..utils import MovingAverage, log_params, TrainLogger
from .models import INR, NeSVoR, D_LOSS, S_LOSS, DS_LOSS, I_REG, B_REG, T_REG, D_REG
from ..transform import RigidT... |
ed27e84f437672bdcce94800f79fef6c14b4e52cc39044b2893df10814817c0a | Python | 5,941 | 120 | # 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... |
a5ce4875b5e58e239cbe258ba61772a8b1f654ab6e900743eaa225700fcbaaa7 | Python | 5,945 | 151 | from pathlib import Path
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.io.generate_legacy_storage_files import create_dataframe_all_types
from pandas.util.version import Version
tables = pytest.importorskip("tables")
@pytest.fixture
def pytables_hdf5_file(temp_h5_path):
"""
... |
4500b29058a876746cc7b073156a5b8ebf8ea9cd1441f7c35768901ce3fd0ad1 | Python | 5,951 | 172 | from umap import UMAP
from umap.validation import trustworthiness_vector
from sklearn.datasets import make_blobs
from sklearn.metrics import pairwise_distances
import numpy as np
import scipy.sparse
try:
# works for sklearn>=0.22
from sklearn.manifold import trustworthiness
except ImportError:
# this is to... |
f4cdd2886972aebee898f6bf73af0b99e6c16a9f9cea5072e14a613986608be9 | Python | 5,952 | 175 | """Create-bbox command for the lightning-pose CLI."""
from __future__ import annotations
import argparse
import logging
from pathlib import Path
from typing import TYPE_CHECKING, Any
from omegaconf import OmegaConf
from lightning_pose.cli import types
logger = logging.getLogger(__name__)
if TYPE_CHECKING:
imp... |
8d0a1ad68c7687b9efcf641572553a9d52c1caf77c231f6d1bec2ea57ee54ead | Python | 5,953 | 178 | import datetime
import numpy as np
import pytest
from pandas.compat import (
IS64,
is_platform_windows,
)
import pandas as pd
import pandas._testing as tm
class TestIteration:
def test_keys(self, float_frame):
assert float_frame.keys() is float_frame.columns
def test_iteritems(self):
... |
b966a8bc93be814a063dc09c264f864a8fff26a1c51e6f752b6d06a52b68f1b3 | Python | 5,957 | 168 | __author__ = 'etseng@pacb.com'
"""
Parser for `samtools mpileup`
http://www.htslib.org/doc/samtools-1.1.html
1. chr
2. 1-based position
3. ref base
4. coverage
5. readBase
6. base qualities
7. alignment qualities
readBase:
. match to ref
, match to ref on rev
> or < ref skipping (ex: like 37N)
ACGTN mismatch ... |
b6de4cc0d327b26957dbdb018b361adffaccbc79b80fb659e50291a1519895c0 | Python | 5,958 | 194 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.