repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
CCasGNN
CCasGNN-main/main.py
from CCasGNN import CCasGNN_Trainer from utils import Logger from param_parser import parameter_parser import sys import time def main(): start = time.time() args = parameter_parser() sys.stdout = Logger(args.result_log) model = CCasGNN_Trainer(args) model.fit() # model.test() end = time.t...
418
21.052632
53
py
CCasGNN
CCasGNN-main/utils.py
import sys class Logger(object): def __init__ (self, fileN="Default.log"): self.terminal = sys.stdout self.log = open(fileN, "a") def write (self, message): self.terminal.write(message) self.log.write(message) self.log.flush() def flush (self): # self.log....
340
20.3125
45
py
CCasGNN
CCasGNN-main/layers.py
#encoding: utf-8 import torch from torch_geometric.nn import GCNConv, GATConv from math import sqrt class Positional_GAT(torch.nn.Module): def __init__(self, in_channels, out_channels, n_heads, location_embedding_dim, filters_1, filters_2, dropout): super(Positional_GAT, self).__init__() self.in...
6,309
41.635135
180
py
CCasGNN
CCasGNN-main/param_parser.py
#encoding:utf-8 import argparse def parameter_parser(): parser = argparse.ArgumentParser(description="Run CCasGNN.") parser.add_argument('--graph-file-path', nargs='?', default='./weibo/weibo_24hours_obs120.json', help='Folder with grap...
4,184
35.710526
74
py
CCasGNN
CCasGNN-main/CCasGNN.py
#encoding: utf-8 import torch import json import numpy as np import copy import time import sys import math from layers import Positional_GCN, MultiHeadGraphAttention, dens_Net, Positional_GAT, fuse_gate import scipy.stats as sci class CCasGNN(torch.nn.Module): def __init__(self, args): super(CCasGNN, se...
13,767
50.373134
136
py
pyEPR
pyEPR-master/setup.py
""" Python (py) Energy-Participation-Ratio (EPR) package pyEPR is an open source, BSD-licensed library providing high-efficiency, easy-to-use analysis functions and automation for the design of quantum chips based on superconducting quantum circuits, both distributed and lumped. pyEPR interfaces the classical distribut...
2,596
40.887097
89
py
pyEPR
pyEPR-master/_tutorial_notebooks/1A Startup_example_hfss_files/startup_example_script.py
# -*- coding: utf-8 -*- """ Example startup script to perform full quantization of a two qubit, one cavity Josephson circuit. The results are saved, printed, and nicely plotted. ------~~~~!!!!------~~~~ Please also see the Jupyter notebook tutorials! ------~~~~!!!!------~~~~ @author: Zlatko """ from pyEPR import P...
1,547
39.736842
142
py
pyEPR
pyEPR-master/scripts/Alec/7ghz/7ghz_pyEPR.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 23 10:34:00 2017 @author: alec-eickbusch """ from pyEPR import * if 1: # Specify the HFSS project to be analyzed project_info = ProjectInfo(r"C:\Users\awe4\Documents\Simulations\HFSS\11ghz\\") project_info.project_name = '2017_08_Zlatko_Shyam_AutStab' # Na...
1,651
46.2
141
py
pyEPR
pyEPR-master/scripts/Alec/11ghz/EPR_test.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 23 10:34:00 2017 @author: alec-eickbusch """ from pyEPR import * if 0: # Specify the HFSS project to be analyzed project_info = ProjectInfo(r"C:\Users\awe4\Documents\Backed\hfss_simulations\11ghz\\") project_info.project_name = '11ghz_alec' # Name of the p...
1,540
39.552632
140
py
pyEPR
pyEPR-master/scripts/nick/import_pyEPR.py
# -*- coding: utf-8 -*- """ Created on Tue Aug 22 11:21:01 2017 @author: Zlatko """ from pyEPR import * if 0: # Specify the HFSS project to be analyzed project_info = ProjectInfo(r"X:\Simulation\\hfss\\KC\\") project_info.project_name = '2013-12-03_9GHzCavity' # Name of the project file (string). "None...
2,095
44.565217
143
py
pyEPR
pyEPR-master/scripts/minev/_low_level/com_browse.py
# -*- coding: utf-8 -*- """ Debug purpose only @author: Zlatko Minev """ import win32com.client import win32com.client.combrowse #win32com.client.combrowse.main() # A tree heading for registered type libraries" c = win32com.client.combrowse.HLIHeadingRegisterdTypeLibs() for s in c.GetSubList(): #print(s) n...
526
22.954545
68
py
pyEPR
pyEPR-master/scripts/minev/hfss-scripts/2017_10 R3C1 resim.py
# Zlatko from pyEPR import * import matplotlib.pyplot as plt if 1: # Specify the HFSS project to be analyzed project_info = ProjectInfo(r"C:\Users\rslqulab\Desktop\zkm\2017_pyEPR_data\\") project_info.project_name = '2017-10 re-sim SM22-R3C1' project_info.design_name = '3. sweep both' project_i...
2,994
36.911392
140
py
pyEPR
pyEPR-master/scripts/minev/hfss-scripts/import_pyEPR.py
# -*- coding: utf-8 -*- """ Created on Tue Aug 22 11:21:01 2017 @author: Zlatko """ from pyEPR import * if 1: # Specify the HFSS project to be analyzed project_info = ProjectInfo(r"C:\\Users\\rslqulab\Desktop\\Lysander\participation_ratio_project\\Shyam's autonomous stabilization simulations\\") project_...
1,680
45.694444
148
py
pyEPR
pyEPR-master/scripts/my-name/example1.py
# -*- coding: utf-8 -*- """ My First pyEPR Script """ from pyEPR import * # 1. Project and design. Open link to HFSS controls. project_info = ProjectInfo(r'C:\zkm\my-first-pyEPR\\', project_name = 'HelloWorld-pyEPR', # Project file name (string). "None" will get the current active one. design_name =...
1,258
34.971429
143
py
pyEPR
pyEPR-master/scripts/Kaicheng/import_pyEPR.py
# -*- coding: utf-8 -*- """ Created on Tue Aug 22 11:21:01 2017 @author: Zlatko """ from pyEPR import * if 0: # Specify the HFSS project to be analyzed project_info = ProjectInfo(r"X:\Simulation\\hfss\\KC\\") project_info.project_name = '2013-12-03_9GHzCavity' # Name of the project file (string). "None...
2,038
44.311111
143
py
pyEPR
pyEPR-master/scripts/hanhee/run_vs_pass.py
# -*- coding: utf-8 -*- """ Example startup script to perform full quantization of a two qubit, one cavity Josephson circuit. The results are saved, printed, and nicely plotted. @author: Zlatko """ from pyEPR import ProjectInfo, DistributedAnalysis, QuantumAnalysis # 1. Project and design. Open link to HFSS control...
12,386
36.536364
153
py
pyEPR
pyEPR-master/tests/test_quantum_analysis.py
''' Unit tests for quantum analysis. Takes in pre-made data with known results, computes the results from the data and checks everything is correct. ''' import unittest import pickle import numpy as np import sys sys.path.append('..') # noqa import pyEPR as epr # Files location save_file = './data.npz' correct_result...
1,495
28.92
85
py
pyEPR
pyEPR-master/tests/test_project_info.py
import unittest import sys; sys.path.insert(0, '..') # noqa import pyEPR as epr class TestProjectInfo(unittest.TestCase): '''Test pyEPR.project_info.py''' def setUp(self): path_to_project = r'..\_example_files' try: self.pinfo = epr.ProjectInfo(project_path=path_to_project, ...
2,076
55.135135
90
py
pyEPR
pyEPR-master/docs/source/conf.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or module...
7,220
33.716346
242
py
pyEPR
pyEPR-master/pyEPR/core.py
""" Main interface module to use pyEPR. Contains code to connect to Ansys and to analyze HFSS files using the EPR method. This module handles the microwave part of the analysis and connection to Further contains code to be able to do autogenerated reports, Copyright Zlatko Minev, Zaki Leghtas, and the pyEPR team 20...
702
27.12
81
py
pyEPR
pyEPR-master/pyEPR/core_quantum_analysis.py
""" Main interface module to use pyEPR. Contains code that works on the analysis after hfss, ansys, etc. These can now be closed. Copyright Zlatko Minev, Zaki Leghtas, and the pyEPR team 2015, 2016, 2017, 2018, 2019, 2020 """ # pylint: disable=invalid-name # todo remove this pylint hack later from __future__ import ...
44,973
36.384871
154
py
pyEPR
pyEPR-master/pyEPR/project_info.py
""" Main interface module to use pyEPR. Contains code to connect to Ansys and to analyze HFSS files using the EPR method. This module handles the microwave part of the analysis and connection to Further contains code to be able to do autogenerated reports, Copyright Zlatko Minev, Zaki Leghtas, and the pyEPR team 20...
18,897
37.488798
137
py
pyEPR
pyEPR-master/pyEPR/core_distributed_analysis.py
""" Main distributed analysis module to use pyEPR. Contains code to connect to Ansys and to analyze HFSS files using the EPR method. This module handles the microwave part of the analysis and connection to Further contains code to be able to do autogenerated reports, Copyright Zlatko Minev, Zaki Leghtas, and the py...
62,094
36.610539
154
py
pyEPR
pyEPR-master/pyEPR/_config_default.py
""" --- DO NOT MODIFY THIS FILE --- Default configuration file for pyEPR This file is NOT meant for users to modify. Rather, a user should update any config settings they want in a dictionary called CONFIG in a file called config.py @author: Zlatko Minev and the pyEPR team @date: Created on Fri Oct 30 14:21:45 2015...
6,018
30.186528
98
py
pyEPR
pyEPR-master/pyEPR/__config_user_old.py
""" User configuration file. The dictionary of options specified here overwrites the pyEPR default config defined in _config_default.py Do not edit `_config_default.py` directly. Rather, overwrite attributes here @author: Your name goes here """ from . import Dict config = Dict( # Folder to save result data t...
2,592
30.621951
98
py
pyEPR
pyEPR-master/pyEPR/reports.py
""" Module for reporting utility functions @author: Zlatko K Minev """ import pandas as pd from .toolbox.plotting import legend_translucent, plt def _style_plot_convergence(ax, ylabel=None, xlabel='Pass number', ylabel_col='k', y_title=False): ax.set_xlabel(xlabel) if ylabel: if y_title: ...
3,910
30.039683
98
py
pyEPR
pyEPR-master/pyEPR/__init__.py
# This file is part of pyEPR: Energy participation ratio (EPR) design of # quantum circuits in python # # Copyright (c) 2015-2020 and later, Zlatko K. Minev and Zaki Leghtas # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided t...
8,129
39.049261
95
py
pyEPR
pyEPR-master/pyEPR/ansys.py
''' pyEPR.ansys 2014-present Purpose: Handles Ansys interaction and control from version 2014 onward. Tested most extensively with V2016 and V2019R3. @authors: Originally contributed by Phil Reinhold. Developed further by Zlatko Minev, Zaki Leghtas, and the pyEPR team. For the base version of ...
117,733
34.78541
223
py
pyEPR
pyEPR-master/pyEPR/_config_user.py
""" User configuration file. The dictionary of options specified here overwrites the pyEPR default config defined in _config_default.py Do not edit `_config_default.py` directly. Rather, overwrite attributes here. GIT: Do not track changes here. Keep your changes only locally. Use the shell command $ git update...
3,435
32.038462
98
py
pyEPR
pyEPR-master/pyEPR/calcs/quantum.py
""" Implementation of basic quantum operation in numpy, to effortlessly remove the need in the `qutip` package. """ import numpy as np def create(n: int): """Returns matrix representation of an n-dimensional creation operator""" diag = np.sqrt(np.arange(1,n)) mat = np.zeros([n, n]) np.fill_diagonal(ma...
954
27.939394
90
py
pyEPR
pyEPR-master/pyEPR/calcs/constants.py
""" pyEPR constants and convenience definitions. @author: Zlatko Minev """ # pylint: disable=invalid-name from scipy.constants import Planck, elementary_charge, epsilon_0, pi # pylint: disable=unused-import # Pi π = pi # Reduced Planks constant ħ = hbar = Planck/(2*pi) # Reduced Flux Quantum (3.29105976 × 10-16 ...
457
20.809524
101
py
pyEPR
pyEPR-master/pyEPR/calcs/back_box_numeric.py
''' Numerical diagonalization of quantum Hamiltonian and parameter extraction. @author: Phil Reinhold, Zlatko Minev, Lysander Christakis Original code on black_box_hamiltonian and make_dispersive functions by Phil Reinhold Revisions and updates by Zlatko Minev & Lysander Christakis ''' # pylint: disable=invalid-name ...
13,172
41.908795
566
py
pyEPR
pyEPR-master/pyEPR/calcs/hamiltonian.py
""" Hamiltonian and Matrix Operations. Hamiltonian operations heavily draw on qutip package. This package must be installed for them to work. """ try: import qutip from qutip import Qobj # basis, tensor, except (ImportError, ModuleNotFoundError): Qobj=None pass from ..toolbox.pythonic import fact cl...
2,628
27.576087
90
py
pyEPR
pyEPR-master/pyEPR/calcs/convert.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 19 18:14:08 2019 Unit and variable conversions. @author: Zlatko Minev """ from __future__ import (absolute_import, # Python 2.7 and 3 compatibility division, print_function) import numpy as np import pandas as pd from num...
7,260
29.897872
115
py
pyEPR
pyEPR-master/pyEPR/calcs/__init__.py
""" Main calculation module """ from . import constants from .basic import CalcsBasic from .convert import Convert from .transmon import CalcsTransmon
151
18
35
py
pyEPR
pyEPR-master/pyEPR/calcs/transmon.py
""" Transmon calculations """ import math import numpy as np from numpy import pi, sqrt, exp from numpy.linalg import inv from .constants import e_el, fluxQ from .convert import Convert from ..toolbox.pythonic import divide_diagonal_by_2 class CalcsTransmon(): """ Common calculations and parameter reporti...
4,055
31.448
111
py
pyEPR
pyEPR-master/pyEPR/calcs/basic.py
""" Basic calculations that apply in general . """ import numpy as np from numpy import sqrt from .. import logger class CalcsBasic(): @staticmethod def epr_to_zpf(Pmj, SJ, Ω, EJ): r''' Arguments, All as matrices (numpy arrays): :Pnj: MxJ energy-participation-ratio matrix, p_mj ...
1,691
33.530612
96
py
pyEPR
pyEPR-master/pyEPR/toolbox/plotting.py
# -*- coding: utf-8 -*- """ Created on Fri Aug 25 19:30:12 2017 Plotting snippets and useful functions @author: Zlatko K. Minev """ from __future__ import absolute_import, division, print_function import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from matplotlib.axes import Axes from matpl...
4,711
26.717647
117
py
pyEPR
pyEPR-master/pyEPR/toolbox/_logging.py
import logging from .. import config def set_up_logger(logger): # add custom stream handler logger.c_handler = logging.StreamHandler() # Jupyter notebooks already has a stream handler on the default log, # Do not propagate upstream to the root logger. # https://stackoverflow.com/questions/3140367...
655
31.8
125
py
pyEPR
pyEPR-master/pyEPR/toolbox/pythonic.py
# -*- coding: utf-8 -*- """ Created on Sat Feb 04 09:32:46 2017 @author: Zlatko K. Minev, pyEPR ream """ from __future__ import division, print_function, absolute_import # Python 2.7 and 3 compatibility import platform # Which OS we run import numpy as np import pandas as pd import warnings import matplotlib...
11,156
27.681234
134
py
pyEPR
pyEPR-master/pyEPR/toolbox/__init__.py
0
0
0
py
LogConcComp
LogConcComp-main/src/LCD.py
import numpy as np from numpy import linalg as la from scipy.spatial import ConvexHull import scipy.stats as st from gurobipy import * import copy import time from functools import reduce from numbers import Number from multiprocessing import Pool as pyPool import multiprocessing import io import contextlib import n...
57,405
42.000749
208
py
LogConcComp
LogConcComp-main/src/QMC.py
import numpy as np import numpy.linalg as la from numbers import Number from scipy import stats def sequ(n,d,lb=0,ub=1,method=None,randomized=True, random_state = 1, rng= None,return_likelihood = False): if rng is None: rng = np.random.RandomState(seed=random_state) if method is None: seq = np...
2,883
36.454545
169
py
LogConcComp
LogConcComp-main/src/utils.py
import os import numpy as np import numba as nb def create_folder(storage_path): if not os.path.isdir(storage_path): os.makedirs(storage_path,exist_ok=True) lsdir = os.listdir(storage_path) for item in ["info","hist","soln","figs"]: if item not in lsdir: os.makedirs(storage_pat...
2,223
27.512821
78
py
FUNIT
FUNIT-master/test_k_shot.py
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import os import numpy as np from PIL import Image import torch import torch.backends.cudnn as cudnn from torchvision import transforms from ut...
2,618
31.7375
80
py
FUNIT
FUNIT-master/utils.py
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import os import yaml import time import torch from torch.utils.data import DataLoader from torchvision import transforms import torchvision.uti...
7,743
32.37931
77
py
FUNIT
FUNIT-master/data.py
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import os.path from PIL import Image import torch.utils.data as data def default_loader(path): return Image.open(path).convert('RGB') de...
1,913
29.870968
76
py
FUNIT
FUNIT-master/networks.py
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import numpy as np import torch from torch import nn from torch import autograd from blocks import LinearBlock, Conv2dBlock, ResBlocks, ActFirs...
10,860
39.830827
78
py
FUNIT
FUNIT-master/funit_model.py
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import copy import torch import torch.nn as nn from networks import FewShotGen, GPPatchMcResDis def recon_criterion(predict, target): ret...
5,659
41.238806
85
py
FUNIT
FUNIT-master/train.py
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import torch import os import sys import argparse import shutil from tensorboardX import SummaryWriter from utils import get_config, get_train_...
5,178
37.93985
78
py
FUNIT
FUNIT-master/trainer.py
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import copy import os import math import torch import torch.nn as nn import torch.nn.init as init from torch.optim import lr_scheduler from fun...
6,871
39.662722
79
py
FUNIT
FUNIT-master/blocks.py
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import torch import torch.nn.functional as F from torch import nn class ResBlocks(nn.Module): def __init__(self, num_blocks, dim, norm, act...
6,986
34.647959
79
py
FUNIT
FUNIT-master/tools/extract_animalfaces.py
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import os import argparse from PIL import Image parser = argparse.ArgumentParser() parser.add_argument('imagenet_folder', type=str) parser.add_...
1,077
27.368421
71
py
FUNIT
FUNIT-master/datasets/intermediate_and_scripts/split_and_filter.py
#split and filter the maximum amount of images according to the most restricting datasets in INIT dataset from math import floor #filenames of the files containing the paths for the dataset images TRAIN_FILENAME_PATHS = ["cloudy_list.txt", "night_list.txt", "sunny_list.txt"] TEST_FILENAME_PATHS = ["rainy_list.txt"] ...
1,791
40.674419
139
py
SimSiam-91.9-top1-acc-on-CIFAR10
SimSiam-91.9-top1-acc-on-CIFAR10-main/main.py
import argparse import time import math from os import path, makedirs import torch from torch import optim from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from torch.backends import cudnn from torchvision import datasets from torchvision import transforms from simsiam.loader ...
9,087
33.687023
99
py
SimSiam-91.9-top1-acc-on-CIFAR10
SimSiam-91.9-top1-acc-on-CIFAR10-main/main_lincls.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import builtins import os import random import shutil import time import warnings import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dis...
20,587
38.066414
95
py
SimSiam-91.9-top1-acc-on-CIFAR10
SimSiam-91.9-top1-acc-on-CIFAR10-main/simsiam/model_factory.py
from torch import nn from .resnet_cifar import ResNet18, ResNet34, ResNet50, ResNet101, ResNet152 class projection_MLP(nn.Module): def __init__(self, in_dim, out_dim, num_layers=2): super().__init__() hidden_dim = out_dim self.num_layers = num_layers self.layer1 = nn.Sequential( ...
2,575
24.76
76
py
SimSiam-91.9-top1-acc-on-CIFAR10
SimSiam-91.9-top1-acc-on-CIFAR10-main/simsiam/validation.py
# https://github.com/zhirongw/lemniscate.pytorch/blob/master/test.py import torch from torch.utils.data import DataLoader from torchvision import transforms from torchvision import datasets from torch import nn class KNNValidation(object): def __init__(self, args, model, K=1): self.model = model s...
3,662
38.815217
113
py
SimSiam-91.9-top1-acc-on-CIFAR10
SimSiam-91.9-top1-acc-on-CIFAR10-main/simsiam/resnet_cifar.py
'''ResNet in PyTorch. For Pre-activation ResNet, see 'preact_resnet.py'. Reference: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Deep Residual Learning for Image Recognition. arXiv:1512.03385 ''' import torch import torch.nn as nn import torch.nn.functional as F # from lib.normalize import Normalize fro...
4,245
32.433071
102
py
SimSiam-91.9-top1-acc-on-CIFAR10
SimSiam-91.9-top1-acc-on-CIFAR10-main/simsiam/criterion.py
from torch import nn class SimSiamLoss(nn.Module): def __init__(self, version='simplified'): super().__init__() self.ver = version def asymmetric_loss(self, p, z): if self.ver == 'original': z = z.detach() # stop gradient p = nn.functional.normalize(p, dim=1)...
751
24.066667
73
py
SimSiam-91.9-top1-acc-on-CIFAR10
SimSiam-91.9-top1-acc-on-CIFAR10-main/simsiam/loader.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from PIL import ImageFilter import random class TwoCropsTransform: """Take two random crops of one image as the query and key.""" def __init__(self, base_transform): self.base_transform = base_transform def __call__(self, x):...
758
26.107143
79
py
mIOHMM
mIOHMM-main/src/utils.py
import numpy as np import pickle import torch def save_pickle(data, filename): with open(filename, "wb") as f: pickle.dump(data, f, pickle.HIGHEST_PROTOCOL) def load_pickle(filepath): with open(filepath, "rb") as handle: data = pickle.load(handle) return data def normalize(A, axis=None...
586
19.964286
53
py
mIOHMM
mIOHMM-main/src/piomhmm.py
from scipy.special import gamma as gamma_fn from sklearn.cluster import KMeans from src.utils import normalize_exp import math import numpy as np import pickle import torch torch.set_default_dtype(torch.float64) class mHMM: def __init__( self, data, ins=None, K=2, k=5, ...
89,160
37.867044
136
py
mIOHMM
mIOHMM-main/src/__init__.py
0
0
0
py
mIOHMM
mIOHMM-main/experiments/synthetic.py
from src.piomhmm import mHMM from src.utils import save_pickle import matplotlib.pyplot as plt import numpy as np import torch def pred(model_name, model, params, b_hat): model_mps = model.predict_sequence(params, n_sample=b_hat) xhat = np.zeros((n, t)) xvar = np.zeros((n, t)) for i in range(n): ...
8,235
28
110
py
mIOHMM
mIOHMM-main/experiments/real.py
from src.piomhmm import mHMM import numpy as np import random import torch from src.utils import save_pickle, load_pickle RANDOM_SEED = 0 torch.manual_seed(RANDOM_SEED) random.seed(RANDOM_SEED) np.random.seed(RANDOM_SEED) torch.set_default_dtype(torch.float64) torch.set_printoptions(precision=2) def preprocess(x, d)...
2,760
26.61
85
py
FADO
FADO-master/documentation.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
1,937
30.258065
80
py
FADO
FADO-master/variable.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
5,558
30.948276
104
py
FADO
FADO-master/function.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
8,997
28.405229
92
py
FADO
FADO-master/__init__.py
from variable import * from function import * from evaluation import * from documentation import * from tools import LabelReplacer from tools import ArrayLabelReplacer from tools import PreStringHandler from tools import TableReader from tools import LabeledTableReader from tools import TableWriter from tools import Bo...
640
29.52381
41
py
FADO
FADO-master/evaluation.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
8,188
33.552743
95
py
FADO
FADO-master/tools/__init__.py
from tools.file_parser import * from tools.variable_transformation import *
76
24.666667
43
py
FADO
FADO-master/tools/file_parser.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
9,742
28.346386
99
py
FADO
FADO-master/tools/variable_transformation.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
2,065
28.514286
90
py
FADO
FADO-master/drivers/base_driver.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
12,580
35.466667
131
py
FADO
FADO-master/drivers/ipopt_driver.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
5,641
33.402439
104
py
FADO
FADO-master/drivers/constrained_optim_driver.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
3,450
34.214286
99
py
FADO
FADO-master/drivers/exterior_penalty.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
9,411
35.48062
105
py
FADO
FADO-master/drivers/scipy_driver.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
5,647
32.820359
97
py
FADO
FADO-master/drivers/__init__.py
from drivers.exterior_penalty import * from drivers.scipy_driver import * # Import IpOpt driver if possible. try: from drivers.ipopt_driver import * except: pass
162
26.166667
39
py
FADO
FADO-master/drivers/parallel_eval_driver.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
9,839
33.647887
86
py
FADO
FADO-master/examples/example4_SU2/example.py
# Shape optimization of fluid structure interaction from FADO import * import subprocess subprocess.call("unzip -o data.zip",shell=True) # Design variables ----------------------------------------------------- # x0 = np.zeros((17,)) ffd = InputVariable(x0,ArrayLabelReplacer("__FFD_PTS__"),0,(1/0.03),-0.03,0.03) # P...
5,417
31.25
109
py
FADO
FADO-master/examples/ipopt/topology_su2.py
# Plain topology optimization example from FADO import * import subprocess import ipyopt subprocess.call("unzip -o ../example1_SU2/data.zip",shell=True) # Design variables rho = InputVariable(0.5,TableWriter(" ",(1,-1)),1600,1.0,0.0,1.0) # Parameters adjointOutput = Parameter(["= NONE"], LabelReplacer("= RESTART"))...
3,508
34.09
97
py
FADO
FADO-master/examples/ipopt/rosenbrock.py
# The basic Rosenbrock example using Ipopt via IPyOpt from FADO import * import ipyopt from shutil import copy copy("../rosenbrock/direct.py",".") copy("../rosenbrock/adjoint.py",".") copy("../rosenbrock/config_tmpl.txt",".") copy("../rosenbrock/data1.txt",".") copy("../rosenbrock/data2.txt",".") # Design variables ...
3,438
34.091837
80
py
FADO
FADO-master/examples/example1_SU2/example.py
# Plain topology optimization example from FADO import * import scipy.optimize import subprocess subprocess.call("unzip -o data.zip",shell=True) # Design variables rho = InputVariable(0.5,TableWriter(" ",(1,-1)),1600,1.0,0.0,1.0) # Parameters output_adjoint = Parameter(["OUTPUT_FILES= NONE"], LabelRep...
2,994
33.825581
90
py
FADO
FADO-master/examples/example3_SU2/example.py
# Shape and Topology optimization with 2 load cases from FADO import * import scipy.optimize import os import subprocess subprocess.call("unzip -o data.zip",shell=True) # Design variables ffd = InputVariable(0.0,PreStringHandler("DV_VALUE= "),9,1.0,-15.0,15.0) rho = InputVariable(0.5,TableWriter(" ",(1,-1)),4800,1....
7,200
37.303191
108
py
FADO
FADO-master/examples/rosenbrock/example.py
# This example mimics the way an external code might work. # # For generality: # 3 functions that result from 2 evaluation of the primal function # # Files: # - direct.py is the primal "solver", it takes a data file and a config. # Two data files form the two evaluations, it computes 2 functions. # - adjoint.py co...
4,047
35.468468
93
py
FADO
FADO-master/examples/rosenbrock/adjoint.py
import sys import time #time.sleep(3) config = sys.argv[1] fid = open(config,"r") lines = fid.readlines() fid.close() data = lines[0][0:-1] x = float(lines[1]) y = float(lines[2]) mode = lines[3] fid = open(data,"r") lines = fid.readlines() fid.close() a = float(lines[0]) b = float(lines[1]) # Rosenbrock's funct...
613
13.97561
47
py
FADO
FADO-master/examples/rosenbrock/direct.py
import sys import time #time.sleep(3) config = sys.argv[1] fid = open(config,"r") lines = fid.readlines() fid.close() data = lines[0][0:-1] x = float(lines[1]) y = float(lines[2]) fid = open(data,"r") lines = fid.readlines() fid.close() a = float(lines[0]) b = float(lines[1]) # Rosenbrock's function f1 = (a-x)**...
462
13.46875
43
py
FADO
FADO-master/examples/example2_SU2/example.py
# Plain topology optimization example using the Fletcher-Reeves method from FADO import * import subprocess subprocess.call("unzip -o ../example1_SU2/data.zip",shell=True) # Design variables rho = InputVariable(0.5,TableWriter(" ",(1,-1)),1600,1.0,0.0,1.0) # Parameters fType_objective = Parameter(["REFERENCE_NODE"]...
2,755
32.609756
103
py
FADO
FADO-master/optimizers/fletcher_reeves.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
4,882
33.146853
91
py
FADO
FADO-master/optimizers/line_searches.py
# Copyright 2019-2023, FADO Contributors (cf. AUTHORS.md) # # This file is part of FADO. # # FADO is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your opt...
4,086
24.704403
96
py
FADO
FADO-master/optimizers/__init__.py
from optimizers.fletcher_reeves import * from optimizers.line_searches import *
80
26
40
py
MostAccurableMNIST_keras
MostAccurableMNIST_keras-master/DeepCNN.py
import numpy as np from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, pooling, Input from keras.layers.convolutional import Conv2D, ZeroPadding2D from keras.layers.pooling import MaxPooling2D from keras.utils import np_utils from keras.datasets import mnist from ke...
2,673
32.012346
87
py
EHR-features
EHR-features-master/boxplots_removing.py
import numpy as np import matplotlib.pyplot as plt import csv file_name = './results/performance_removing.csv' case_array = [] accuracy_rate = [] miss_rate = [] with open(file_name, 'r') as csvFile: reader = csv.reader(csvFile) next(reader) for row in reader: case_array.append(int(row[0])) ...
2,543
35.342857
277
py
EHR-features
EHR-features-master/boxplots_adding.py
import numpy as np import matplotlib.pyplot as plt import csv file_name = './results/performance_adding.csv' case_array = [] accuracy_rate = [] miss_rate = [] with open(file_name, 'r') as csvFile: reader = csv.reader(csvFile) next(reader) for row in reader: case_array.append(int(row[0])) ...
2,213
32.044776
208
py
EDGY
EDGY-master/DDF.py
import hydra import hydra.utils as utils import json from pathlib import Path import torch import numpy as np import librosa from tqdm import tqdm import pyloudnorm from preprocess import preemphasis from model import Encoder, Decoder @hydra.main(config_path="Training/VQ-VAE/Configuration_files/DDF.yaml") def DDF(cfg...
6,913
43.320513
111
py
EDGY
EDGY-master/Training/VQ-VAE/dataset.py
import numpy as np import torch from torch.utils.data import Dataset import json from random import randint from pathlib import Path class SpeechDataset(Dataset): def __init__(self, root, hop_length, sr, sample_frames): self.root = Path(root) self.hop_length = hop_length self.sample_frames...
1,381
31.139535
93
py
EDGY
EDGY-master/Training/VQ-VAE/models.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Categorical from tqdm import tqdm import numpy as np from preprocess import mulaw_decode def get_gru_cell(gru): gru_cell = nn.GRUCell(gru.input_size, gru.hidden_size) gru_cell.weight_hh.data = gru.weight_hh_l0....
7,998
35.861751
105
py
EDGY
EDGY-master/Training/VQ-VAE/train_VQ.py
import hydra from hydra import utils from itertools import chain from pathlib import Path from tqdm import tqdm import apex.amp as amp import torch import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from dataset import Sp...
4,714
37.647541
97
py