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
prospector
prospector-master/prospect/utils/prospect_args.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """prospect_args.py - methods to get a default argument parser for prospector. """ import argparse __all__ = ["get_parser", "show_default_args"] def show_default_args(): parser = get_parser() parser.print_help() def get_parser(fitters=["optimize", "emcee", "d...
6,814
42.407643
106
py
prospector
prospector-master/prospect/utils/__init__.py
0
0
0
py
prospector
prospector-master/prospect/utils/smoothing.py
# Spectral smoothing functionality # To do: # 3) add extra zero-padding for FFT algorithms so they don't go funky at the # edges? import numpy as np from numpy.fft import fft, ifft, fftfreq, rfftfreq __all__ = ["smoothspec", "smooth_wave", "smooth_vel", "smooth_lsf", "smooth_wave_fft", "smooth_vel_fft",...
24,665
36.259819
95
py
prospector
prospector-master/prospect/likelihood/likelihood.py
import time, sys, os import numpy as np from scipy.linalg import LinAlgError __all__ = ["lnlike_spec", "lnlike_phot", "chi_spec", "chi_phot", "write_log"] def lnlike_spec(spec_mu, obs=None, spec_noise=None, f_outlier_spec=0.0, **vectors): """Calculate the likelihood of the spectroscopic data given the ...
7,824
35.737089
100
py
prospector
prospector-master/prospect/likelihood/kernels.py
import numpy as np __all__ = ["Kernel", "Uncorrelated", "ExpSquared", "Matern", "PhotoCal"] class Kernel(object): def __init__(self, parnames=[], name=''): """ :param parnames: A list of names of the kernel params, used to alias the intrinsic parameter names. This way di...
3,359
29.545455
83
py
prospector
prospector-master/prospect/likelihood/__init__.py
from .likelihood import * from .noise_model import * __all__ = ["lnlike_spec", "lnlike_phot", "NoiseModel"]
110
17.5
54
py
prospector
prospector-master/prospect/likelihood/noise_model.py
import numpy as np from scipy.linalg import cho_factor, cho_solve __all__ = ["NoiseModel"] class NoiseModel(object): def __init__(self, metric_name='', mask_name='mask', kernels=[], weight_by=[]): assert len(kernels) == len(weight_by) self.kernels = kernels self.weight_n...
3,071
36.925926
80
py
prospector
prospector-master/scripts/prospector_parse.py
import sys from copy import deepcopy import numpy as np from prospect.utils import prospect_args from prospect.fitting import fit_model from prospect.io import write_results as writer def build_model(zred=0.0, add_neb=True, **extras): """Instantiate and return a ProspectorParams model subclass (SedModel). In ...
6,109
32.571429
87
py
prospector
prospector-master/scripts/prospector_restart.py
#!/usr/local/bin/python import time, sys, os import numpy as np np.errstate(invalid='ignore') from prospect.models import model_setup from prospect.io import write_results from prospect.io import read_results as pr from prospect import fitting from prospect.likelihood import lnlike_spec, lnlike_phot, write_log, chi_s...
7,080
30.471111
87
py
prospector
prospector-master/scripts/prospector_dynesty.py
import time, sys, os import numpy as np np.errstate(invalid='ignore') from prospect.models import model_setup from prospect.io import write_results from prospect import fitting from prospect.likelihood import lnlike_spec, lnlike_phot, write_log from dynesty.dynamicsampler import stopping_function, weight_function, _kl...
5,286
29.738372
90
py
prospector
prospector-master/scripts/prospector.py
#!/usr/local/bin/python import time, sys, os import numpy as np np.errstate(invalid='ignore') from prospect.models import model_setup from prospect.io import write_results from prospect import fitting from prospect.likelihood import lnlike_spec, lnlike_phot, write_log, chi_spec, chi_phot # -------------- # Read com...
9,248
32.632727
97
py
prospector
prospector-master/demo/demo_mock_params.py
import time, sys from copy import deepcopy import numpy as np from sedpy.observate import load_filters from prospect import prospect_args from prospect.fitting import fit_model from prospect.io import write_results as writer # Here we are going to put together some filter names # All these filters are available in s...
10,099
35.071429
102
py
prospector
prospector-master/demo/demo_params.py
import time, sys import numpy as np from sedpy.observate import load_filters from prospect import prospect_args from prospect.fitting import fit_model from prospect.io import write_results as writer # -------------- # RUN_PARAMS # When running as a script with argparsing, these are ignored. Kept here for backwards...
11,700
36.503205
102
py
prospector
prospector-master/demo/timing.py
from copy import deepcopy import timeit, time, sys import numpy as np import fsps from prospect.sources import FastStepBasis, CSPBasis sps = fsps.StellarPopulation(zcontinuous=1) libs = [l.upper() for l in sps.libraries] def get_model(sps, **kwargs): try: # For SSPBasis derived objects sps.updat...
3,522
29.634783
102
py
prospector
prospector-master/demo/mpi_hello_world.py
# This is a short script to test the MPI implementation with the pattern used # by Prospector. However, try/except blocks are minimized to enable more # useful error messages, and the code is simple enough to *only* test the MPI # implementation. # Invoke with: # mpirun -np 4 python mpi_hello_world.py import numpy a...
760
24.366667
77
py
prospector
prospector-master/misc/fdot.py
# script to calculate the fractional change in SSP flux as a function # of time. import matplotlib.pyplot as pl import numpy as np import fsps sps = fsps.StellarPopulation(zcontinuous=0) # compile all metallicities for i, z in enumerate(sps.zlegend): w, s = sps.get_spectrum(zmet=i+1) spec, mass, lbol = sps.all_ssp...
717
22.16129
69
py
prospector
prospector-master/misc/timings_pyfsps.py
#compare a lookup table of spectra at ages and metallicities to #calls to fsps.sps.get_spectrum() for different metallicities import time, os, subprocess, re, sys import numpy as np #import matplotlib.pyplot as pl import fsps from prospect import sources as sps_basis from prospect.models import sedmodel def run_comma...
4,274
29.319149
85
py
prospector
prospector-master/misc/ztest.py
import numpy as np import matplotlib.pyplot as pl import fsps ztype = [False, 0, 1, 2] zdlabel= ['ind', 'cont', 'MDF'] sps = [fsps.StellarPopulation(zcontinuous=z) for z in ztype] tage = 1.0 p = 3.0 zmet = 3 sfig, sax = pl.subplots() rfig, rax = pl.subplots() sax.set_xlim(1e3, 2e4) rax.set_xlim(1e3, 2e4) rax.set_xscal...
809
22.823529
89
py
prospector
prospector-master/misc/timing_smoothspec.py
import numpy as np import matplotlib.pyplot as pl import fsps, time, sys from sedpy.observate import vac2air, lsf_broaden from scipy import sparse def lsf_broaden_sparse(wave, spec, lsf=None, outwave=None, return_kernel=False, fwhm=False, dyr = 1e-4, **kwargs): """Broaden a spectrum using a wa...
3,077
30.731959
86
py
prospector
prospector-master/misc/test_compsp.py
# Test the analytic full SFR integrals implemented in SSPBasis against the # COMPSP implementations of same. import sys, os, time import numpy as np import matplotlib.pyplot as pl import fsps from prospect.sources import CompositeSFH sfhtype = {1:'tau', 4: 'delaytau', 5: 'simha'} compute_vega_mags = False zcontinuo...
10,770
37.605735
121
py
prospector
prospector-master/misc/test_stepsfh.py
import matplotlib.pyplot as pl import numpy as np from bsfh.sources import ssp_basis sps = ssp_basis.StepSFHBasis(interp_type='logarithmic') nbin = 7 ages = np.linspace(7, 10, nbin+1) params = {'agebins': np.array([ages[:-1], ages[1:]]).T, 'mass': 10**ages[1:] - 10**ages[:-1] } sps.update(**params) w = s...
651
22.285714
55
py
prospector
prospector-master/misc/diagnostics.py
#Take the results from MCMC fitting of clusters # and make diagnostic plots, or derive predictions for # observables, etc.. import numpy as np import matplotlib.pyplot as pl import triangle import pickle try: from cStringIO import StringIO except ImportError: from StringIO import StringIO def diagnostic_plot...
15,450
35.875895
116
py
prospector
prospector-master/misc/test_sft.py
import sys, os, time import numpy as np import matplotlib.pyplot as pl import fsps from prospect.sources import CompositeSFH from sedpy import observate sfhtype = {1:'tau', 4: 'delaytau', 5: 'simha'} # build FSPS and Prospector sps objects zcontinuous = 1 sps = fsps.StellarPopulation(zcontinuous=zcontinuous) tres = n...
3,383
32.84
99
py
prospector
prospector-master/doc/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # prospector documentation build configuration file, created by # sphinx-quickstart on Sun Apr 8 16:26:26 2018. # # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to th...
5,534
30.99422
80
py
Efficient-FedRec
Efficient-FedRec-main/src/main.py
import argparse from pathlib import Path from tqdm import tqdm import random import wandb import numpy as np import os import pickle import torch from torch.utils.data import DataLoader import torch.optim as optim from agg import Aggregator from model import Model, TextEncoder, UserEncoder from data import TrainData...
13,768
33.946701
131
py
Efficient-FedRec
Efficient-FedRec-main/src/agg.py
import numpy as np import torch from torch.utils.data import Dataset, DataLoader from model import TextEncoder, UserEncoder import torch.optim as optim from data import NewsPartDataset class NewsUpdatorDataset(Dataset): def __init__(self, news_index, news_ids, news_grads): self.news_index = news_index ...
4,402
34.224
90
py
Efficient-FedRec
Efficient-FedRec-main/src/model.py
import torch from torch import nn import torch.nn.functional as F from transformers import BertModel import numpy as np class ScaledDotProductAttention(nn.Module): def __init__(self, d_k): super(ScaledDotProductAttention, self).__init__() self.d_k = d_k def forward(self, Q, K, V, attn_mask=No...
5,484
37.356643
101
py
Efficient-FedRec
Efficient-FedRec-main/src/data.py
import random import numpy as np from torch.utils.data import Dataset, DataLoader def newsample(nnn, ratio): if ratio > len(nnn): return nnn + ["<unk>"] * (ratio - len(nnn)) else: return random.sample(nnn, ratio) class TrainDataset(Dataset): def __init__(self, args, samples, users, user_i...
2,760
28.063158
99
py
Efficient-FedRec
Efficient-FedRec-main/src/metrics.py
import numpy as np from tqdm import tqdm from sklearn.metrics import roc_auc_score def dcg_score(y_true, y_score, k=10): order = np.argsort(y_score)[::-1] y_true = np.take(y_true, order[:k]) gains = 2 ** y_true - 1 discounts = np.log2(np.arange(len(y_true)) + 2) return np.sum(gains / discounts) d...
1,488
30.680851
63
py
Efficient-FedRec
Efficient-FedRec-main/preprocess/adressa_raw.py
# This script is used to construct training, validation and test dataset of adressa. # We follow existing works[1][2] to split the dataset. # [1] # [2] import json import pickle import argparse import numpy as np from tqdm import tqdm from pathlib import Path from collections import defaultdict from sklearn.model...
7,496
32.172566
88
py
Efficient-FedRec
Efficient-FedRec-main/preprocess/user_process.py
from pathlib import Path from tqdm import tqdm from collections import defaultdict import os import pickle import argparse def parse_args(): parser = argparse.ArgumentParser() parser.add_argument( "--raw_path", type=str, default="../raw/", help="path to raw mind dataset or parse...
4,275
32.669291
81
py
Efficient-FedRec
Efficient-FedRec-main/preprocess/news_process.py
from transformers import BertTokenizer from pathlib import Path from tqdm import tqdm import numpy as np import os import pickle import argparse # config def parse_args(): parser = argparse.ArgumentParser() parser.add_argument( "--raw_path", type=str, default="../raw/", help="pa...
3,844
29.515873
86
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-setuptestsuite-test.py
#!/usr/bin/env python # # Copyright 2019, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
2,265
40.2
78
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-failfast-unittest.py
#!/usr/bin/env python # # Copyright 2020 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
14,915
35.291971
80
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_xml_outfiles_test.py
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
5,415
38.823529
119
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-color-test.py
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
4,896
37.257813
76
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-shuffle-test.py
#!/usr/bin/env python # # Copyright 2009 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
12,539
37.703704
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_skip_environment_check_output_test.py
#!/usr/bin/env python # # Copyright 2019 Google LLC. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list o...
2,230
39.563636
74
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_xml_test_utils.py
# Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
9,327
46.111111
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-global-environment-unittest.py
# Copyright 2021 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the foll...
5,243
39.030534
80
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-catch-exceptions-test.py
#!/usr/bin/env python # # Copyright 2010 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list o...
10,023
41.295359
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_skip_check_output_test.py
#!/usr/bin/env python # # Copyright 2019 Google LLC. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list o...
2,411
39.2
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_test_utils.py
# Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
8,407
31.84375
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-json-output-unittest.py
#!/usr/bin/env python # Copyright 2018, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list o...
24,483
27.838634
80
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_testbridge_test.py
#!/usr/bin/env python # # Copyright 2018 Google LLC. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
2,496
38.015625
78
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_json_test_utils.py
# Copyright 2018, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
2,411
38.540984
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-uninitialized-test.py
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
2,495
35.705882
82
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-filter-unittest.py
#!/usr/bin/env python # # Copyright 2005 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
21,466
32.542188
80
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_help_test.py
#!/usr/bin/env python # # Copyright 2009, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
6,114
33.942857
75
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-output-test.py
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
12,648
35.45245
81
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-json-outfiles-test.py
#!/usr/bin/env python # Copyright 2018, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list o...
5,705
28.71875
80
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_list_output_unittest.py
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
9,502
32.111498
98
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-list-tests-unittest.py
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
6,543
30.76699
84
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-param-test-invalid-name1-test.py
#!/usr/bin/env python # # Copyright 2015 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
2,400
36.515625
77
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-param-test-invalid-name2-test.py
#!/usr/bin/env python # # Copyright 2015 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
2,355
36.396825
77
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-break-on-failure-unittest.py
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
7,322
34.038278
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-throw-on-failure-test.py
#!/usr/bin/env python # # Copyright 2009, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
5,658
32.485207
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/googletest-env-var-test.py
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
4,173
33.495868
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googletest/test/gtest_xml_output_unittest.py
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
20,639
48.615385
225
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googlemock/test/gmock_leak_test.py
#!/usr/bin/env python # # Copyright 2009, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
4,357
40.504762
73
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googlemock/test/gmock_test_utils.py
# Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
3,218
32.185567
79
py
rocm_smi_lib
rocm_smi_lib-master/tests/rocm_smi_test/gtest/googlemock/test/gmock_output_test.py
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
6,175
32.565217
80
py
rocm_smi_lib
rocm_smi_lib-master/python_smi_tools/rsmiBindings.py
#!/usr/bin/env python3 """ROCm_SMI_LIB CLI Tool Python Bindings""" # TODO: Get most (or all) of these from rocm_smi.h to avoid mismatches and redundancy from __future__ import print_function import ctypes.util from ctypes import * from enum import Enum import os # Use ROCm installation path if running from standard ...
20,511
31
105
py
rocm_smi_lib
rocm_smi_lib-master/python_smi_tools/rocm_smi.py
#!/usr/bin/env python3 """ROCm_SMI_LIB CLI Tool This tool acts as a command line interface for manipulating and monitoring the amdgpu kernel, and is intended to replace and deprecate the existing rocm_smi.py CLI tool. It uses Ctypes to call the rocm_smi_lib API. Recommended: At least one AMD GPU with ROCm driver insta...
161,265
41.889894
163
py
darkriscv
darkriscv-master/sim/trace.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from vcdvcd import VCDVCD import subprocess import sys import getopt import argparse class Error(Exception): """addr2line exception.""" def __init__(self, str): Exception.__init__(self, str) class addr2line: def __init__(self, binary, addr2line): ...
4,927
32.073826
137
py
dive
dive-main/.github/scripts/coverage.py
#!/usr/bin/env python3 import subprocess import sys import shlex class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' if len(sys.argv) < 3: ...
861
22.297297
96
py
Guava-disease-detection
Guava-disease-detection-main/test.py
0
0
0
py
Guava-disease-detection
Guava-disease-detection-main/configuration.py
import os if__name__=="__main__": print("in progress")
60
11.2
24
py
Guava-disease-detection
Guava-disease-detection-main/predict.py
import os if__name__=="__main__": print("in progress")
60
11.2
24
py
Guava-disease-detection
Guava-disease-detection-main/train.py
import os if__name__=="__main__": print("in progress")
60
11.2
24
py
Guava-disease-detection
Guava-disease-detection-main/datasets/dataloader.py
import os if__name__=="__main__": print("in progress")
60
11.2
24
py
Guava-disease-detection
Guava-disease-detection-main/datasets/utils.py
import os if__name__=="__main__": print("in progress")
60
11.2
24
py
Guava-disease-detection
Guava-disease-detection-main/optimization/conversion/run_tflite_model.py
import numpy as np import tensorflow as tf tflite_model_path = 'model.tflite' # Load the TFLite model and allocate tensors interpreter = tf.lite.Interpreter(model_path=tflite_model_path) interpreter.allocate_tensors() # Get input and output tensors input_details = interpreter.get_input_details() output_details = inte...
778
32.869565
77
py
Guava-disease-detection
Guava-disease-detection-main/optimization/conversion/onnx_to_tf.py
from onnx_tf.backend import prepare import onnx onnx_model_path = 'model.onnx' tf_model_path = 'model_tf' onnx_model = onnx.load(onnx_model_path) tf_rep = prepare(onnx_model) tf_rep.export_graph(tf_model_path)
211
22.555556
39
py
Guava-disease-detection
Guava-disease-detection-main/optimization/conversion/tf_to_tflite.py
import tensorflow as tf saved_model_dir = 'model_tf' tflite_model_path = 'model.tflite' # Convert the model converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) tflite_model = converter.convert() # Save the model with open(tflite_model_path, 'wb') as f: f.write(tflite_model)
299
24
69
py
Guava-disease-detection
Guava-disease-detection-main/optimization/conversion/run_tf_model.py
import tensorflow as tf tf_model_path = 'model_tf' model = tf.saved_model.load(tf_model_path) model.trainable = False input_tensor = tf.random.uniform([1, 3, 640, 640]) out = model(**{'input': input_tensor}) print(out)
222
19.272727
50
py
Guava-disease-detection
Guava-disease-detection-main/optimization/conversion/torch_to_onnx.py
import torch from torchvision.models import mobilenet_v2 img_size = (640, 640) batch_size = 1 onnx_model_path = 'model.onnx' model = mobilenet_v2() model.eval() sample_input = torch.rand((batch_size, 3, *img_size)) y = model(sample_input) torch.onnx.export( model, sample_input, onnx_model_path, ve...
411
16.913043
53
py
CICDFuzzBench
CICDFuzzBench-master/tools/captain/gather_results.py
#!/usr/bin/env python3 import argparse from collections import defaultdict import csv import errno import json import logging from multiprocessing import Pool import os import shutil import subprocess import sys from tempfile import mkdtemp import pandas as pd ddr = lambda: defaultdict(ddr) def parse_args(): pa...
8,163
31.787149
103
py
CICDFuzzBench
CICDFuzzBench-master/tools/captain/gather_detected.py
#!/usr/bin/env python3 from json import dump, load from os import walk if __name__ == '__main__': detected = {} _, _, filenames = next(walk('./workdir/poc/')) for f in filenames: try: fuzzer = f[:f.index('_')] except ValueError: continue bug = f[:-4][-6:] ...
1,420
35.435897
83
py
CICDFuzzBench
CICDFuzzBench-master/experiments/target selection/targsel.py
#!/usr/bin/env python3 import os import subprocess import sys TARGET = '' PREFIX = '' FUZZER_DIR = '' COMMIT = '' COMMITS = [] def run_cmd(command_array, **kwargs): return subprocess.run(command_array, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, **kwargs) def run_cmd_warn_msg(command, message, **kwar...
6,250
33.535912
174
py
CICDFuzzBench
CICDFuzzBench-master/experiments/target selection/visualizations/identical_targets_pie.py
#!/usr/bin/python3 import plotly.graph_objects as go from plotly.subplots import make_subplots labels = ['Identical Targets', 'Different Targets'] libs = {'php': [32198, 50454-32198], 'openssl': [57081, 90177-57081], 'sqlite3': [0, 483-0], 'poppler': [1686, 3840...
2,194
50.046512
134
py
CICDFuzzBench
CICDFuzzBench-master/experiments/target selection/visualizations/targsel_bubbles.py
#!/usr/bin/python3 import math import sys import plotly.graph_objects as go prefix = './targsel/' logfiles = ['libpng-01.log', 'libpng-03.log', 'libsndfile-01.log', 'libtiff-02.log', 'libxml2-01.log', 'openssl-01.log', 'openssl-03.log', 'php-02.log', 'poppler-02.log', 'sqlite3-02.log', 'libpng-02.log', 'libp...
1,813
38.434783
177
py
CICDFuzzBench
CICDFuzzBench-master/experiments/target selection/visualizations/changed_targets_per_library.py
#!/usr/bin/python3 import plotly.graph_objects as go prefix = './targsel/' logfiles = ['libpng-01.log', 'libpng-03.log', 'libsndfile-01.log', 'libtiff-02.log', 'libxml2-01.log', 'openssl-01.log', 'openssl-03.log', 'php-02.log', 'poppler-02.log', 'sqlite3-02.log', 'libpng-02.log', 'libpng-04.log', 'libtiff-01...
1,597
48.9375
177
py
CICDFuzzBench
CICDFuzzBench-master/experiments/target selection/visualizations/commits_processed.py
#!/usr/bin/python3 import plotly.graph_objects as go libs = ['php', 'openssl', 'sqlite3', 'poppler', 'lua', 'libxml2', 'libsndfile', 'libpng', 'libtiff'] equal = [7821, 7847, 483, 1919, 2285, 625, 1158, 801, 241] total = [127000, 30000, 25000, 7000, 5000, 5000, 4000, 4000, 3000] perc = [round((equal[i]/total[i]*100),...
1,010
29.636364
100
py
CICDFuzzBench
CICDFuzzBench-master/experiments/target selection/visualizations/targsel_violins.py
#!/usr/bin/python3 import plotly.graph_objects as go prefix = './targsel/' logfiles = ['libpng-01.log', 'libpng-03.log', 'libsndfile-01.log', 'libtiff-02.log', 'libxml2-01.log', 'openssl-01.log', 'openssl-03.log', 'php-02.log', 'poppler-02.log', 'sqlite3-02.log', 'libpng-02.log', 'libpng-04.log', 'libtiff-01...
1,773
46.945946
177
py
CICDFuzzBench
CICDFuzzBench-master/experiments/target selection/visualizations/identical_targets.py
#!/usr/bin/python3 import plotly.graph_objects as go libs = ['php', 'openssl', 'sqlite3', 'poppler', 'lua', 'libxml2', 'libsndfile', 'libpng', 'libtiff'] equal = [32198, 57081, 0, 1686, 462, 0, 472, 853, 154] total = [50454, 90177, 483, 3840, 2285, 625, 1159, 1602, 241] perc = [round((equal[i]/total[i]*100),2) for i ...
1,005
29.484848
100
py
CICDFuzzBench
CICDFuzzBench-master/experiments/target selection/visualizations/commits_per_library.py
#!/usr/bin/python3 import plotly.graph_objects as go libs = ['php', 'openssl', 'sqlite3', 'poppler', 'lua', 'libxml2', 'libsndfile', 'libpng', 'libtiff'] targets = [7821, 7847, 483, 1919, 2285, 625, 1158, 801, 241] colors = ['rgb(0,128,0)', 'rgb(255,228,181)'] fig = go.Figure(data=[ go.Bar(name='Processed', x=li...
816
26.233333
100
py
CICDFuzzBench
CICDFuzzBench-master/experiments/target selection/visualizations/targets_per_library.py
#!/usr/bin/python3 import plotly.graph_objects as go libs = ['php', 'openssl', 'sqlite3', 'poppler', 'lua', 'libxml2', 'libsndfile', 'libpng', 'libtiff'] targets = [9, 12, 1, 2, 1, 1, 1, 2, 1] colors = ['rgb(0,128,0)', 'rgb(255,228,181)'] fig = go.Figure(data=[ go.Bar(name='Processed', x=libs, y=targets, text=ta...
784
25.166667
100
py
CICDFuzzBench
CICDFuzzBench-master/experiments/archive/target-selection-compare.py
import json RUNS = [[x for x in range(16, 94 + 1)], [x for x in range(95, 181 + 1)], [x for x in range(183, 269 + 1)], [x for x in range(271, 356 + 1)], [x for x in range(358, 444 + 1)], [x for x in range(446, 532 + 1)], [x for x in range(534, 620 + 1)], [x for x...
4,153
34.810345
120
py
CICDFuzzBench
CICDFuzzBench-master/experiments/archive/target-selection-visualize.py
def bar_equal_hashes(): import plotly.graph_objects as go runs = [x for x in range(1, 13)] equal = [819, 924, 744, 891, 834, 594, 750, 842, 1083, 864, 846, 746] total = [1170, 1290, 1275, 1275, 1275, 1260, 1245, 1245, 1275, 1245, 1230, 1275] fig = go.Figure(data=[ go.Bar(name='Equal hashes...
4,070
52.565789
113
py
CICDFuzzBench
CICDFuzzBench-master/experiments/archive/target-selection.py
import os import common as c REPO_LOCATION = f'../{c.TARGET}/' CURRENT_COMMIT = None def init_repo(): global CURRENT_COMMIT c.run_cmd_disable_output(['git', '-C', REPO_LOCATION, 'reset', '--hard']) c.run_cmd_disable_output(['git', '-C', REPO_LOCATION, 'clean', '-df']) c.run_cmd_disable_output(['git'...
2,426
43.944444
119
py
CICDFuzzBench
CICDFuzzBench-master/experiments/archive/commit-monitor.py
import os import time import common as c POLL_TIME = 60 # every minute REPO_LOCATION = f'../{c.TARGET}/' CURRENT_COMMIT = None def init_repo(): global CURRENT_COMMIT c.run_cmd_disable_output(['git', '-C', REPO_LOCATION, 'reset', '--hard']) c.run_cmd_disable_output(['git', '-C', REPO_LOCATION, 'clean', ...
2,692
39.80303
109
py
CICDFuzzBench
CICDFuzzBench-master/experiments/fuzz duration/fuzz-duration.py
import json import os import sys import time import common as c TARGET = '' REPO_LOCATION = '' SETUP_LOCATION = '' PATCH_LOCATION = '' EXPERIMENT_TYPE = 'artificial' BUGS = [] BUGS_ACTIVE = [] DURATIONS = [] ITERATIONS = 0 BASE_COMMITS = {'libpng': 'a37d4836519517bdce6cb9d956092321eca3e73b', 'l...
7,572
44.89697
130
py
CICDFuzzBench
CICDFuzzBench-master/experiments/fuzz duration/common.py
import datetime import json import os import subprocess import sys DEFAULT_TIMEOUT = '10m' DEFAULT_FUZZERS = '(aflplusplus honggfuzz libfuzzer)' def log_info(entry): print(f'[{datetime.datetime.now().strftime("%Y-%m-%d %H:%M")}] (INFO) {entry}') def log_error(entry): print(f'[{datetime.datetime.now().strft...
12,444
45.785714
126
py
CICDFuzzBench
CICDFuzzBench-master/experiments/fuzz duration/data/bug_types.py
#!/usr/bin/python3 import json DEBUG = False iter = 10 runs = ['5 minutes', '10 minutes', '15 minutes', '20 minutes', '30 minutes', '1 hours', '2 hours', '4 hours', '8 hours'] libs = {'php': 15, 'openssl': 17, 'sqlite3': 15, 'poppler': 59, 'lua': 14, 'libxml2': 43, 'libpng': 106, 'libtiff': 37, 'libsndfile': 50} bug...
1,546
34.159091
137
py
CICDFuzzBench
CICDFuzzBench-master/experiments/fuzz duration/data/significance.py
#!/usr/bin/python3 import json from scipy.stats import mannwhitneyu from VD_A import VD_A # User params DEBUG = False FUZZ_DUR_DATA = "./fuzz_dur_data" MANN_WHITNEY = False VARGHA_DELANEY_AND_MANN_WHITNEY = True # Experiment values metrics = ['reached', 'triggered', 'detected'] iter = 10 runs = ['5 minutes', '10 min...
3,965
45.658824
135
py
CICDFuzzBench
CICDFuzzBench-master/experiments/fuzz duration/data/VD_A.py
import itertools as it from bisect import bisect_left from typing import List import numpy as np import pandas as pd import scipy.stats as ss from pandas import Categorical def VD_A(treatment: List[float], control: List[float]): """ Computes Vargha and Delaney A index A. Vargha and H. D. Delaney. A...
3,710
21.089286
79
py
CICDFuzzBench
CICDFuzzBench-master/experiments/fuzz duration/visualizations/combine_plots.py
#!/usr/bin/python3 import plotly.graph_objects as go import random import json import statistics iter = 10 runs = ['5 minutes', '10 minutes', '15 minutes', '20 minutes', '30 minutes', '1 hours', '2 hours', '4 hours', '8 hours'] libs = {'php': 15, 'openssl': 17, 'sqlite3': 15, 'poppler': 59, 'lua': 14, 'libxml...
3,457
28.555556
120
py
CICDFuzzBench
CICDFuzzBench-master/experiments/fuzz duration/visualizations/fuzz-duration-visualize.py
import json import os import pandas as pd import plotly.express as px import plotly.graph_objects as go PREFIX = '/srv' TARGET = '' RESULT_DIR = '' DURATIONS = [] RUNS = [] START = [] STOP = [] # /// Experiment runs of 6 durations x 5 iterations, with seed corpora. /// # RESULT_DIR = '../results/libxml2/artificia...
17,338
47.568627
142
py
rgbmcmr
rgbmcmr-master/rgbmcmr.py
from __future__ import division, print_function from collections import namedtuple import numpy as np from scipy.special import erf, erfc import emceemr from astropy import units as u MINF = -np.inf class RGBModel(emceemr.Model): """ Note if biasfunc is used, the sense is mag_real = mag_measured + bias ...
11,835
33.011494
123
py