sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
96cd6f7b058792c5c0a0bd0034dcca69094aaab6814556a0d3911907239adb58 | Python | 5,706 | 161 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
4da4d23913a242a7873b4939cf0dc636488f2cb99f6003a5046fdb6606cb161b | Python | 5,708 | 139 | import json
import os
import numpy as np
import PIL.Image
from backend import root_detection
from backend import root_tracking
class FakeSettings:
use_gpu = False
exmask_enabled = False
def __init__(self):
self.active_models = {'detection': 'model-a', 'exclusion_mask': 'mask-a'}
def test_soft... |
0f8781d6bd3a7c4db1e0ba756e95e5a3d7f0451a2dbb4d95a6fe1a637e6cfa6d | Python | 5,709 | 174 | import numpy as np
from torch.utils.data import Dataset
from util.pointnet_utils import normalize_points_np, random_sample_points_np
from util.augmentation import rotate_point_cloud, jitter_point_cloud
def load_data(data_root, partition='train'):
npz = np.load(data_root, allow_pickle=True)
if partition == '... |
657baf2e322ac1301f53386b0765f294b746acd32e9579df0149131d5938b806 | Python | 5,711 | 152 | '''
Setup for cilia geometry
'''
import os
import numpy as np
import mesh
shapes_data_path = os.path.dirname(__file__) + '/shapes_data'
data_key = 'machemer'
num_phases = 20
dphi = 2 * np.pi / num_phases
# Phyiscal values
beat_period = 31.25 # ms; 32 Hz
beat_freq = 2 * np.pi / beat_period
beat_time_step = beat_perio... |
8fa059203910d24604971ba6586c92ef2b932c0023d9e61fee5dd2a2de495271 | Python | 5,712 | 146 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
de0a95df35c3cf85355ed3c795c119e9b91c668a760252e0fff202eec76f673c | Python | 5,715 | 192 | from typing import NamedTuple, Optional, Tuple
import numpy as np
from cgtasknet.tasks.reduce.reduce_task import (
_generate_random_intervals,
ReduceTaskCognitive,
ReduceTaskParameters,
)
class DMTaskParameters(NamedTuple):
dt: float = ReduceTaskParameters().dt
trial_time: float = 0.75
answe... |
810330d264f7484fc6a5e7b0312cbfd1229da2f45ce4da70d832ce3a2ee90631 | Python | 5,716 | 139 | import os
from os.path import join
import collections
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.impute import SimpleImputer, MissingIndicator
from sklearn.pipeline import make_union, Pipeline
from... |
4ace133f3e3679510e224c94f75fcebe7ee13d5aebcbc8e63fd7fa07ddf1f240 | Python | 5,717 | 135 | import numpy as np
from scipy.integrate import solve_ivp
def define_solve_cycle(right_side_of_ODE, t_max, phi_global_func, backwards=False):
'''
2019-09-19: only absolute tolerance
parameter ncycle - solve n cycles
raise an error if end_event wasn't triggered
Create a functi... |
4d784fc3b19f325d6d8e0ca50b5c295b80d3e2a49c9a06c1e35a71aafed89dd6 | Python | 5,717 | 143 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
65b990956469a37f4c593ad5d834fb73291788455e4e38c0213857e035e76cdd | Python | 5,718 | 188 | # -*- coding: utf-8 -*-
"""
Spyder Editor.
"""
from neuron import h
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from synaptic_metrics import synaptic_metrics
from cell_models import CCKCell
from opt import myinit, mystyle
import pickle, os
# Make plots nicer!
plt.style.use("seaborn-colorb... |
c91a0a81f9f669cd568d9c108fad4fcede5b18d01887ee59117492221822991d | Python | 5,718 | 122 | # Copyright 2021-2022 Huawei Technologies Co., Ltd
#
# 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... |
78de73498b489324f541fdc52617ae3335eb9a1dfbcbb9dbeac171053ac49f19 | Python | 5,720 | 160 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from skimage.measure import compare_ssim
import torch
from torch.autograd import Variable
from lpips import dist_model
class PerceptualLoss(torch.nn.Module):
def __init__(self, model='... |
28fbcb737fa6084a439f27eb8039b286502a563f5a60f50a2852904d0a2bbd26 | Python | 5,721 | 206 | """Functions for running full pipelines via the config API.
See the documentation for :mod:`osl_dynamics.config_api` for example usage.
"""
import argparse
import logging
import pprint
from pathlib import Path
from typing import Callable, List, Optional, Union
import numpy as np
import yaml
from osl_dynamics.config... |
72551661cc2c3ad2330350754b331f6de1590fa8b40057c21e4f923ae5affbdd | Python | 5,722 | 193 | # coding=utf-8
# Copyright 2020 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... |
fb19c6d51c19f9a4a6551d1bcde9d6a524bbe34bc54a28b4c572c236a0c05254 | Python | 5,724 | 166 | import numpy as np
import torch
from monai.networks.layers.factories import Act, Conv, Norm, Pool
from torch import nn
class HardParameterSharingModel(nn.Module):
def __init__(
self,
agents,
state_size,
conv_filters=[32, 32, 64, 64],
conv_strides=[2, 2, 2, 2],
conv_... |
fb4a18edab5c6d0c3543c6f9a428e2caaf7c7f227486ddde358bf04998f0bd52 | Python | 5,728 | 115 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
8b0f7ea6b818b31d2aebaf962d2941d1c84f53d9f941980bb164927fe6dbde91 | Python | 5,731 | 156 | # Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# 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... |
8c889e1c4e5e36d4298cb106be396d4ee46103c4d0fdfcf330dd90db156bad93 | Python | 5,732 | 203 | import sys
import pickle
import pandas as pd
import numpy as np
import csv
import utils.general_utils as general_utils
import utils.plot_utils as plot_utils
# import utils.plot_setting as plot_setting
# import utils.math_utils as math_utils
# import utils.sync_utils as sync_utils
def sorting_roiID_corresponding... |
b65f42cdbd194c6aa51ef5d1e25df947519c6e8037a64b23f055c96d1c1a436d | Python | 5,732 | 137 | import numpy as np
from utils import get_fullpath, Config
from utils.dataloaders import FolderLoader, CSVLoader, PickleLoader, StatementsLoader
import pickle
class ArticlesProvider:
def __init__(self, config: Config):
"""
:param config: config dictionary
:type config: dict
"""
... |
21b9584815f001b35868af39c71b796d5d88e03b22ea4e28b4eb91266baeea61 | Python | 5,735 | 142 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
f6c965f9ae0e684ca44583bc237ebc4d03613e1e9c4d4f3740998c66378d8af6 | Python | 5,735 | 192 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 12:00:15 2021.
@author: spiros
"""
import os
import pickle
from neuron import h
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from synaptic_metrics import synaptic_metrics
from cell_models import VIPCCKCell
from opt imp... |
14af17ef272be529cfd8326510394182b98e69e45876c83bae1874bd9a33ab36 | Python | 5,736 | 137 | # Copyright (c) 2016, Konstantinos Kamnitsas
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the BSD license. See the accompanying LICENSE file
# or read the terms at https://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_im... |
6bc5dca53d951aa384be31d05f46d632ea611651faaea61c547d8a01e66e4f50 | Python | 5,737 | 192 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 12:00:15 2021.
@author: spiros
"""
import os
import pickle
from neuron import h
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from synaptic_metrics import synaptic_metrics
from cell_models import VIPCCKCell
from opt imp... |
93b3e05c2c32412e389dee4b086dcd4636a2db1dd6d61999c56dcc085684f0f3 | Python | 5,737 | 150 | """
File: main.py
Created: 2020/06/29
Last Changed: 2021/08/04
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 ... |
83e9109011d129ef7c0b312d5b61a8758c8d6ffb62c5b187da38a52bf157622e | Python | 5,738 | 171 | """
Utils for downloading dataset files from the web.
Mostly borrowed from torchvision.datasets.utils
"""
import hashlib
import logging
import os
from pathlib import Path
import requests
import sys
from typing import Any, Optional, Union, List
import tarfile
logger = logging.Logger(name=__name__)
logger.setLevel(log... |
08daaf8363bd45f86b115eb461f1b598e7da143cf113a00be2079ed3e36e3f76 | Python | 5,742 | 170 | """Persistent, privacy-conscious diagnostics for local RootDetector runs."""
import datetime
import io
import json
import logging
import logging.handlers
import os
import platform
import sys
import traceback
import zipfile
from base.backend.paths import get_instance_path
LOGGER_NAME = 'rootdetector'
LOG_FOLDER_NAME... |
2c61f45e40d7a64ce7dccd508701abaec28b261f0f258174bbfabeaae5be9a87 | Python | 5,743 | 191 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 12:00:15 2021.
@author: spiros
"""
import os
import pickle
from neuron import h
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from synaptic_metrics import synaptic_metrics
from cell_models import VIPCRCell
from opt impo... |
714b73b152374a20080959fb4067cd8dc9a69ba3211e40667c5cef3c27e838ab | Python | 5,744 | 174 | # Built-in
import os
import pickle
import shutil
import zlib
from pathlib import Path
# Third-party
import brian2 as b2
import brian2.units as b2u
import numpy as np
import pytest
from scipy.stats import wasserstein_distance
# Local
from cxsystem2.core import cxsystem as cx
pytest.skip(reason="Speed, compiling takes... |
719ea64e8a1d0651fd2c9314da1a45e5abc60dbb5f6e04255ca42dbc1a1d8dd3 | Python | 5,745 | 157 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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 a... |
43b6a059e897d754347542ea271de0bba9e7dc9d117e37b7a6f3a89358c3c178 | Python | 5,746 | 191 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 15 12:00:15 2021.
@author: spiros
"""
import os
import pickle
from neuron import h
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from synaptic_metrics import synaptic_metrics
from cell_models import VIPCRCell
from opt impo... |
a1431353c75b3c80c84d50f584566bd80cc6b87081eca4464918ab8abcd14572 | Python | 5,746 | 141 | import torch
from torch import nn
from .conv_ws import ConvAWS2d
from .registry import CONV_LAYERS
import torch.nn.functional as F
from torch.distributions import Categorical
from torch.autograd import Variable
#class Flatten(nn.Module):
# def forward(self, x):
# return x.view(x.size(0), -1)
#
@CONV_LAYE... |
6d5a3e7ae5647e826c5debaa12109567bc997751fea8cb0c3b3e8838d348ae3c | Python | 5,748 | 149 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
1ba6f1ab8ff848a90015c56bd703163a3b25062bf03d1ae70b243b6cde56ce6b | Python | 5,751 | 186 | """
Registration tools
"""
import numpy as np
import nibabel as nib
from dipy.align.imwarp import DiffeomorphicMap
from dipy.align import syn_registration
import dipy.core.gradients as dpg
from dipy.align.streamlinear import whole_brain_slr
__all__ = ["syn_register_dwi", "write_mapping", "read_mapping",
... |
6b178f3dd04b09bf19d7aced0f207f147f3d3c7b826aca2aec7bd57397dd28d1 | Python | 5,751 | 150 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
876372590832fb48408954a80928c629839e35d9ebdc8525577f08c40a294acb | Python | 5,753 | 117 | __author__ = "Jianfeng Sun"
__version__ = "v1.0"
__copyright__ = "Copyright 2023"
__license__ = "GPL v3.0"
__email__ = "jianfeng.sunmt@gmail.com"
__maintainer__ = "Jianfeng Sun"
import xml.etree.ElementTree as ET
from functools import wraps
class Component:
def __init__(self, *args, **kwargs):
self.args ... |
521d9c2bb463937f590333b579e14fbc25f2bb15f8652e5c7d26d86d69c96c1d | Python | 5,755 | 145 | import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir) # PYTHON > 3.3 does not allow relative referencing
import h5py
import numpy as np
import zipfile
import re
import dicom2nifti as d2n
import nibabel as nib
from ddmr.utils.nifti_ut... |
c2b1ca0be9f3b269c206614c883ffd35724f4f6c9735a801a28fd8dd3b4ffb0e | Python | 5,757 | 165 | """
A simple Darcy-Flow spectrum analysis
=====================================
Using ``neuralop.utils.spectrum_2d`` to perform spectrum analysis on our small Darcy-Flow example.
This tutorial demonstrates how to analyze the spectral characteristics of the Darcy-Flow dataset,
which provides insights into the frequency... |
ca68b7025af55efa54286e6d87eef6b5169ae923bce2c59e49c1e2c4bdc6256a | Python | 5,757 | 157 | """
File: combine_gte_files.py
Created: 2020/10/08
Last Changed: 2021/09/22
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, eithe... |
e4e43ae4041e44328220965eab2ae6368c33d26b8798b11c821ae57b8f16e7fc | Python | 5,757 | 158 | #!/usr/bin/env python3
"""
File: cohorts_plot.py
Created: 2020/04/29
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundati... |
21ceb691dfb763f4b9cd1e719a0785e81a75c63b9b7b3897e31af217a1162a0c | Python | 5,759 | 154 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Base PyQt classes for multi-page widgets with change through signal emission.
Page's identifiers are integers defined in constants.py.
Created on Wed Jun 19 11:13:27 2019
@author: nicolas
"""
import os
from skimage import io
from PyQt5.QtCore import Qt, pyqtSignal
... |
8e05d660226e2097e2cba5431d94268431f4e32f9b8cce0d5b49a12d44be5e30 | Python | 5,761 | 154 | #!/usr/bin/env python
###############################################################################
###############################################################################
## Created on February 1st 2017 to remove singletons from paired-end BAM file
###########################################################... |
b32ba96db5ef4b88a626e5f10012665caf583db5ba05a5595deac32438d17c43 | Python | 5,761 | 178 | """Tests for the generic CROPro case-level metadata loader."""
from __future__ import annotations
from pathlib import Path
import pytest
from cropro.metadata import CaseMetadataEntry, load_case_metadata
# --------------------------------------------------------------------------- #
# Helpers
# --------------------... |
e42c8b4655af8db7c8e854a88f85ebaba6aa73157276bbf111db44e63f852e61 | Python | 5,761 | 139 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
405c2f682a355576bc305e97ac072a8639cc015d4032b68009aae056d94949b8 | Python | 5,763 | 248 | #%% [markdown]
# # Removing the Kenyon cells
#%%
import datetime
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from pkg.data import load_network_palette, load_unmatched
from pkg.io import FIG_PATH, get_environment_variables
from pkg.io import glue as defa... |
949194aca582ab8f4306287c8f5f6718e3111ad1c088b0bf58045bca1caca572 | Python | 5,763 | 223 | import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.init as init
from torch.autograd import Variable
from torchvision import transforms, datasets
# Helper functions
def seqpairs(input_list):
for i in range(len(input_list) - (2 - 1)):... |
1e3d27411d982194d10f894ce7a8d4793226c75093958ede6e12db235533a047 | Python | 5,765 | 261 | #%%
import os
from pathlib import Path
import matplotlib.pyplot as plt
import seaborn as sns
from IPython import get_ipython # just to decieve flake8
import src.utils as utils
get_ipython().run_line_magic("autoreload", "2")
get_ipython().run_line_magic("matplotlib", "inline")
os.getcwd()
#%% [markdown]
# ### Choo... |
150a6c8a0855ede92e233410bead32914e1fd7cf6bd559ac14efb06cd00e1ea4 | Python | 5,768 | 117 | #! /usr/bin/env python3
"""Python API, Transfer 2.5 with mask-out classes and per-control weights.
python api_masking_and_weights.py --clip ./clips/carla_town10hd_semantic \\
--mask-classes vehicle --weights depth=1.0,seg=0.5,edge=0.3
``mask_classes`` removes CARLA semantic classes from every input derive... |
eba662c3f7bafcd639416594577690a1b780027d3dfd315bc829da78e1934b85 | Python | 5,768 | 126 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
e586cab0be101b27344afe351b270ac44040ced7ec51a024f6761c935dd9535a | Python | 5,769 | 154 | import numpy as np
import torch
import matplotlib
import torch.nn as nn
import torch.autograd as autograd
import torch.nn.functional as F
from torch.utils.data import TensorDataset, DataLoader
import torch.optim as optim
import matplotlib.pyplot as plt
import nibabel as nib
from nibabel import processing
import confi... |
ff362333713e8b3570607b9bb1be53c9fe8f750ecbc1b60497cc4bd792e843e9 | Python | 5,769 | 165 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
from torch.optim.lr_scheduler import CosineAnnealingLR
import torch.optim as optim
from tqdm.auto import tqdm, trange
import numpy as np
import sklearn.metrics as m... |
50b3b1cc370432522a08b0c22f2909d8ed413515e5fe8b5c23d2d142b62f137c | Python | 5,771 | 155 | import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['LEDNet']
class LEDNet(nn.Module):
def __init__(self, classes=2, aux=False, backbone='', jpu=False, pretrained_base=True):
super(LEDNet, self).__init__()
self.encoder = nn.Sequential(
Downsampling(3, 32),
... |
eac189d40f1b6862d422d7cd690f97cfc4d5e87d7053f80411b4b766918e5fe3 | Python | 5,771 | 170 | import backend.cli
import zipfile, tempfile, os, pathlib
import PIL.Image
import numpy as np
import types
def test_no_ext_file_basename():
target = 'AD_T046_L002_13.07.18_133359_007_SS'
file_basename = backend.cli.no_ext_file_basename
assert target == file_basename('AD_T046_L002_13.07.18_133359_007_SS.pn... |
32a1370a86b34b13d4f4fb6f64f651dc4c196e4e5ef12b296a8c1ed530cc402e | Python | 5,773 | 160 | #!/usr/bin/env python
# Copyright 2017 Johns Hopkins University (author: Hossein Hadian)
# Apache 2.0
""" This script prepares the training and test data for CIFAR-10 or CIFAR-100.
"""
from __future__ import division
import argparse
import os
import sys
parser = argparse.ArgumentParser(description="""Converts trai... |
fe103123d9cf62293fc3bd482fb0bb8c862f3f21d11bab723dae584031086af1 | Python | 5,774 | 145 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2026 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>.
"""Generates Docs/bp_library.md from the blueprints o... |
215a6e8354da536154273ab7a6d1096c5553c1105a75e1e837dbb99b7ce7eb1c | Python | 5,775 | 157 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""
This file contains specific functions for computing losses on the RPN
file
"""
import torch
from torch.nn import functional as F
from .utils import concat_box_prediction_layers
from ..balanced_positive_negative_sampler import BalancedPositiv... |
aa38ab4ce0535dacc935b7c25c72092d189b89c3c4493bb577bdcc689be18e8e | Python | 5,776 | 259 | #%%
import os
from pathlib import Path
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from IPython import get_ipython # just to decieve flake8
import src.utils as utils
get_ipython().run_line_magic("autoreload", "2")
get_ipython().run_line_magic("matplotlib", "inline")
os.getcwd()
#%% [... |
a23437bc4925f9d211bf03a371fb3c4101402e4dff954f550b147b21ec41aabe | Python | 5,778 | 190 | """
- Takes fixed points data from fixed point dictionary file
- Computes matrix L and eigenvalues for the fixpoint, located, corresponding to a wave with wave numbers (k1,k2).
- Creates a subfolder and save the result
INPUT:
- args: k1, k2, delta0, tol
- fixpoint_dict.pkl -> dictionary of fixed points
"""
import sys
... |
0055eb0fde78ba84a55abedaddff814416005ac55079e3dc990c549b5b0ee4a1 | Python | 5,782 | 152 | import mmcv
from mmdet.core import bbox_mapping, tensor2imgs
from ..builder import DETECTORS, build_backbone, build_head, build_neck
from .base import BaseDetector
@DETECTORS.register_module()
class RPN(BaseDetector):
"""Implementation of Region Proposal Network."""
def __init__(self,
backb... |
8eb649bcde248a63bb18d1f4b10c66a3990b41fb2ad984f6659bccfe311c0935 | Python | 5,784 | 168 | from collections import defaultdict
import pytorch_lightning as pl
from pytorch_lightning.metrics.regression import MeanAbsoluteError as MAE
from pytorch_lightning.metrics.regression import MeanSquaredError as MSE
from pytorch_lightning.metrics import F1
from pytorch_lightning.metrics import ExplainedVariance as EV
imp... |
8eafb89f3c0eccbfa464bb6705e59624b907900ceb0c77b2bf8aee827b827d8f | Python | 5,785 | 136 | import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torchvision.models as models
from torch.autograd import Variable
import numpy as np
from model.utils.config import cfg
from model.rpn.rpn import _RPN
from model.roi_pooling.modules.roi_pool import... |
8e9b665eff95679803daa4b15f4251c62faea8d8c4f96e2d812a70882d7fb2a4 | Python | 5,786 | 145 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
c45315b9435aaf6f33f486071efa9898890197fbd1302a82ee1e287601be24fd | Python | 5,787 | 181 | #!/usr/bin/env python3
"""Tests for io."""
import os
from unittest.mock import patch
import numpy as np
import pytest
from phys2cvr import regressors
# ## Unit tests
def test_create_legendre():
L = regressors.create_legendre(3, 10)
assert L.shape == (10, 4)
L = regressors.create_legendre(1, 5)
as... |
4bf9c1f3552b3465a4c3afc189fe07c9fb70719a34b8bc3d1e5d41ee9e9b8975 | Python | 5,792 | 142 | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from os import listdir, mkdir
from os.path import isfile, join, exists
def distribution_stats_column(df, dim, colname):
"""Creates a dictionary summary of distribution statistics for a numeric
column in a pandas dataframe.
Args:
df (p... |
42817b4ea13befc178f07633c26abab1a801de35dbea5766a89b65d2afaf19a2 | Python | 5,794 | 174 | from pathlib import Path
from typing import Optional, List, Union
from torch.utils.data import DataLoader
from .pt_dataset import PTDataset
from ..transforms.data_processors import DefaultDataProcessor
class Burgers1dTimeDataProcessor(DefaultDataProcessor):
"""Burgers1dTimeDataProcessor wraps the DefaultDataProc... |
5877a0e1292ff8227e07ef501ae99f39a8c7d64f7c4ecc8e8fbb19c94da6f245 | Python | 5,794 | 201 | #Authors: Ceyao Zhang, Renjie Li, May 2022, CUHKSZ
import gym
from gym import spaces
from gym.envs.classic_control.cartpole import CartPoleEnv
from gym.envs.registration import register
import torch
import torch.nn as nn
import numpy as np
class CartPoleEnv2(CartPoleEnv):
def __init__(self, reward_net):
... |
a54af8e5c4be6ff1349b0fa55f2fc4ca7066f37d18ac1c9b9c0581659aa2518d | Python | 5,796 | 192 | """Miscellaneous IO and other system functions."""
import os
import sys
import shutil
import subprocess
import signal
from mpi4py import MPI
def mprint(string, end="\n"):
if MPI is not None:
if MPI.COMM_WORLD.Get_rank() == 0:
print(string,end=end)
else:
print(string,end=end)
class... |
32a848e829cf262b77cc59b9f1b68af93735846c8e049025ab7cc61dca036fc9 | Python | 5,797 | 143 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
cd80274777edb66f31f94cbb7320d053ca023086f425710a84b1b093d6921d22 | Python | 5,797 | 130 | #### Scatterplot with Geneset Annotations --------------------------------------
## Need gene_embeddings/gene_names/df_single
import gseapy as gp
logdir_gsea = os.path.join(logdir,'GSEA')
os.makedirs(logdir_gsea,exist_ok=True)
genesets = {"scsig":"/home/yongin/projects/siVAE/data/MSigDB/scsig.all.v1.0.1.symb... |
bdcfdf31798b6d4882c3c964a81c482c82b9695161687d20a8f930fe767ce9cc | Python | 5,798 | 186 | import numpy as np
import itertools
import networkx as nx
from tqdm import tqdm
def path_to_visits(paths, n_verts, from_order=True, out_inds=[]):
visit_orders = {i: [] for i in range(n_verts)}
for path in paths:
for i, n in enumerate(path):
if from_order:
visit_orders[n].ap... |
7d2c239a66e099b2185488978eabccdaf539275e228eb91a04718e37fe202e3f | Python | 5,799 | 148 | #!/usr/bin/env python3
#
# Expansion Hunter Denovo
# Copyright (c) 2017 Illumina, Inc.
#
# Author: Egor Dolzhenko <edolzhenko@illumina.com>,
# Sai Chen <schen6@illumina.com>
# Concept: Michael Eberle <meberle@illumina.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the ... |
1b24f29b45b9125c05fb775e49e822f24f30d5614593fd35affdc3c7344d7d3c | Python | 5,801 | 149 | #!/usr/bin/env python3
"""
File: export_cf_ad_interaction_to_excel.py
Created: 2022/05/16
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Fr... |
6b2641c7d8c48334ae9c030156369eea239379b3de5172ec8cd735b927032e51 | Python | 5,802 | 177 | import math
import torch
import torch.nn as nn
from torch.nn.modules.utils import _pair
from .deform_conv_func import deform_conv, modulated_deform_conv
class DeformConv(nn.Module):
def __init__(
self,
in_channels,
out_channels,
kernel_size,
stride=1,
padding=0,
... |
6e2a78313e52eacdfaea8da4353d1effbb04c188e77454e5db78d52b5bc147a1 | Python | 5,802 | 185 | from math import sqrt
import torch
def gaussian2D(radius, sigma=1, dtype=torch.float32, device='cpu'):
"""Generate 2D gaussian kernel.
Args:
radius (int): Radius of gaussian kernel.
sigma (int): Sigma of gaussian function. Default: 1.
dtype (torch.dtype): Dtype of gaussian tensor. De... |
b8d81f4e9e53a08ac6f22246bdc99ad7fcbd598f3c726fec365c7d3f31709d42 | Python | 5,802 | 154 | import mmcv
from mmdet.core import bbox_mapping, tensor2imgs
from ..builder import DETECTORS, build_backbone, build_head, build_neck
from .base import BaseDetector
@DETECTORS.register_module()
class RPN(BaseDetector):
"""Implementation of Region Proposal Network."""
def __init__(self,
backb... |
370abe15775d731d6bb39bc22385e0002a0bc87aaf1b99ebfc1128ea53cd5c7a | Python | 5,804 | 142 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
6c9aa160362326667d519131e7872b61dee0e1f510ce3cc721a81e6ed7fc6131 | Python | 5,810 | 131 | #!/usr/bin/env python3
"""Driver: produce the full Autoware map directory for a CARLA town.
Output layout (what ``ros2 launch autoware_launch e2e_simulator.launch.xml
map_path:=<out>`` expects):
<out>/
pointcloud_map.pcd ground-truth lidar sweep, voxelized
lanelet2_map.osm OpenDRIVE -> l... |
3727f0426bac8f7629e5f6dedaf7b38ed7cfd065a7b9374af69cbe4a004144b1 | Python | 5,811 | 150 | from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import dni
# Training settings
parser = argparse.ArgumentParser(description='PyTorch MNIS... |
c4e965bc6785f1a0668bff45234664d03a615fe4544fd84ebc4205cf01b80ea4 | Python | 5,812 | 148 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2026 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>.
import os
import yaml
import re
COLOR_METHOD = '#7fb... |
781bfc3fc0fc7ede6e4e81f7aa05e67932eec14cc47e772a0ee6a83ae0110fdd | Python | 5,813 | 190 | from __future__ import print_function, absolute_import
import os
import torch.utils.data as data
import torchvision
import os.path
from torchvision import transforms
import numpy as np
from scipy.io import loadmat
from data_utils import *
def assign_classes(actions):
classes = [x for x in actions]
class... |
7c61cb13a19b3a3bcd0aa1361890b9abad0623979acf0ef2f32525e2bc674c1f | Python | 5,817 | 166 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
b55be67308e9fedc619a45e0b4d94c500cc8b90c951fca858ac7406a3855f670 | Python | 5,817 | 149 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
de18e96b368d0d96ac6abfeb3f8b0d4e30767e9ef50a62d881e8b3e46e780bae | Python | 5,817 | 165 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from numpy.testing import assert_array_equal
import numpy as np
import pytest
import scipy.stats
from eelbrain import datasets, test
from eelbrain.fmtxt import asfmtext
from eelbrain._stats import test as _test
def test_correlations():
"Test test.correlati... |
b01f7ac78c629e21985051f07e206af6d451768e5168678be083bd0966e38d6a | Python | 5,818 | 138 | import os
import torch
import sys
class BaseModel(torch.nn.Module):
def name(self):
return 'BaseModel'
def initialize(self, opt):
self.opt = opt
self.gpu_ids = opt.gpu_ids
self.isTrain = opt.isTrain
self.Tensor = torch.cuda.FloatTensor if self.gpu_ids else torch.Tensor
... |
12d4a08da66378cb9658448795e49326b7797a6df13491a29a8cab4f6a57ff41 | Python | 5,820 | 183 | #this code will extract all available labratories for patients (previous code will extract data on the defined labratories on defined day-from-admission)
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
import openpyxl
pd.set_option('display.max_rows', 50)
pd.set_option('display.max_columns', 10... |
d4018be112ca31dfc1148763227890607351042bb302f5cd9fe9fa87756b2248 | Python | 5,821 | 149 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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 a... |
5d079fae438ace98c7e0c5063a2a88615b6ddacc5ebaab9e940c6801c8542722 | Python | 5,823 | 150 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
6130a568a5844176c28c4413e1ef0516a41d4ff315a2ae1942c8f1caa0d34693 | Python | 5,824 | 160 | import math
import multiprocessing
from joblib import Parallel, delayed
import numpy as np
import scipy
import scipy.stats
from scipy.spatial import KDTree
import mne
from gpuparallel import GPUParallel
from gpuparallel import delayed as GPUdelayed
import torch
def wavelet_fft(frequencies: np.array, fwhm: np.ar... |
0850589e5ad836c41b1cb8234772dddeecaddb693d64c0b7f6291b79f53774cd | Python | 5,826 | 140 | import os
from os.path import join
import collections
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.impute import SimpleImputer, MissingIndicator
from sklearn.pipeline import make_union, Pipeline
from sklearn.ensemble import RandomF... |
35d5c75811b0c4967fedc00f36162e094edd0596085e568032ee46805196d190 | Python | 5,827 | 103 | """
Separated training for OmiEmbed
"""
import time
import warnings
from util import util
from params.train_params import TrainParams
from datasets import create_single_dataloader
from models import create_model
from util.visualizer import Visualizer
if __name__ == "__main__":
warnings.filterwarnings('ignore')
... |
c53760d974aa1c621ad96887e4a54537096c66cfbd18db851e9234047768ef5f | Python | 5,830 | 143 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
373a8abbf96def22933b83e18965458412f7f684316506c4d621ebed429985d1 | Python | 5,834 | 198 | import os
import random
import multiprocessing
import pickle
import numpy as np
import torch
from captum.attr import IntegratedGradients
from openeye import oechem
from openeye import oegrid
from openeye import oezap
from openeye import oespicoli
try:
from base import VISCOSITY_KEY, ENTITY_KEY
except Exception ... |
bddb08bb00ef20b5d4b0bb476a3caf540acb9f8f4740e114cb21a8cefda1a9de | Python | 5,838 | 203 | #!/usr/bin/env python3
"""Tests for io."""
import numpy as np
import pytest
from phys2cvr import stats
# ## Unit tests
def test_x_corr():
func = np.array([1.0, -2.0, 3.0])
co2 = np.array([0.0, 1.0, -2.0, 3.0, 4.0])
# Manually compute expected correlations
# sco2 windows: [0,1,-2], [1,-2,3], [-2,3,4... |
a54943fe21770f72f8466641f96e4bd1ff6f2f120758c1b339a12b16dcdeded6 | Python | 5,839 | 177 | """
Copyright (c) 2019, National Institute of Informatics
All rights reserved.
Author: Huy H. Nguyen
-----------------------------------------------------
The Y-shaped autoencoder model file.
"""
import torch
from torch import nn
class Encoder(nn.Module):
def __init__(self, depth=3):
super(En... |
5775274cbd095bf5494c258546ed54b10bb9d95634719fbcbe061021422976be | Python | 5,840 | 161 | # This script is part of navis (http://www.github.com/schlegelp/navis).
# Copyright (C) 2018 Philipp Schlegel
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of... |
e511b02e9b50e246e9e9df0bbaf930244cd7aea77b4497a1739091ddf2754a38 | Python | 5,840 | 148 | import autograd.numpy as anp
from .fit import FitEngine
# Base model constructor class
# Used as constructor for ODEMOdel and PDEModel
class BaseModel:
dt: float # Discretization time step
kGamma = 1 # DA adsorption rate constant
params: dict # Parameter dictionary
# Base initialization
def __init... |
9a1a76c802b3f8b166eb23e20a44246612571fdc30261b673ab109b8b97b63c4 | Python | 5,841 | 147 | """
File: cutoff_eigenvectors.py
Created: 2020-07-08
Last Changed: 2020-07-08
Author(s): H.H.Wiersma
Code to create distribution plot and a mask image used in the research plan
Copyright (C) 2019 H.H.Wiersma
This program is free software: you can redistribute it and/or modify
it under the terms of the... |
f8795481dea9247ef3d18d9c632b6209b5051751a4bd85100e96f47a8a40119b | Python | 5,842 | 217 | # %% [markdown]
# ##
import os
import warnings
from itertools import chain
import matplotlib as mpl
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import numpy as np
import pandas as pd
import seaborn as sns
from joblib import Parallel, delayed
from sc... |
583765d083d9b7a67d20bbe4536b3e19f461d937efeacf0ee6dcec6cf2536a81 | Python | 5,845 | 146 | import os
import collections
from os.path import join
import numpy as np
import pandas as pd
from itertools import chain
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import ShuffleSplit, GridSearchCV
from sklearn.metrics import (me... |
b9861f1b69aa266cb39b698ef9f9fdb41805f445adc8b11d1950e1ce5021e186 | Python | 5,847 | 146 | import autograd.numpy as anp
from .base import BaseModel
# PDE Model constructor class
# Used as constructor for STUR and STDR
class PDEModel(BaseModel):
D = 240. # Diffusion coeffient
P: anp.ndarray # Discrete release sites
def __init__(self, kinetics: bool = True, discrete: bool = False):
super(... |
caef17b7a451df380d87320ff9400815683603ba7a81facf0192de84b17dbae4 | Python | 5,851 | 169 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, GATConv, SAGEConv
from torch_geometric.nn import global_mean_pool
class GraphCondGlobal(nn.Module):
"""
Graph-based (as opposed to node-based) conditional (on trial phase and clinical condition)
GNN ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.