repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
dutitello/parAnsys | examples/AngTang_MCAI_67.py | <gh_stars>1-10
"""
Running example 6.7 from Ang & Tang 1984
"""
import paransys
import numpy as np
# Call ParAnsys
mc = paransys.MonteCarlo()
# Console log On
mc.Info(True)
# Create random variables
mc.CreateVar('y', 'gauss', 40, cv=0.125)
mc.CreateVar('z', 'gauss', 50, cv=0.050)
mc.CreateVar('m', 'gauss', 1000, st... |
dutitello/parAnsys | paransys/ansys.py | <filename>paransys/ansys.py<gh_stars>1-10
# -*- coding: UTF-8 -*-
"""
This module calls ANSYS by Probabilistic Design System (PDS) as an FEM tool for
running a couple of parametric analysis and get some variables back to Python.
Built using ANSYS documentation from https://www.sharcnet.ca/Software/Ansys/ (not availabl... |
dutitello/parAnsys | examples/AngTang_FORM_68.py | """
Running example 6.8 from Ang & Tang 1984
"""
import paransys
# Call ParAnsys
form = paransys.FORM()
# Console log On
form.Info(True)
# Create random variables
form.CreateVar('y', 'logn', 40, cv=0.125)
form.CreateVar('z', 'logn', 50, cv=0.050)
form.CreateVar('m', 'gumbel', 1000, cv=0.200)
# Create limit state
f... |
dutitello/parAnsys | paransys/form.py | <gh_stars>1-10
## -*- coding: UTF-8 -*-
"""
This module performns Reliability Analysis with First Order Reliability Method using Python.
Please read the class docstring for more.
Docs are available at https://dutitello.github.io/parAnsys/
"""
import os
import time
from paransys.ansys import ANSYS
import numpy as np... |
djivey/kinetic | _modules/generate.py | ## generate various items on-demand. For use in sls files when no appropriate module exists.
import random
import string
from cryptography.fernet import Fernet
__virtualname__ = 'generate'
def __virtual__():
return __virtualname__
def mac(prefix='52:54:00'):
return '{0}:{1:02X}:{2:02X}:{3:02X}'.format(prefi... |
djivey/kinetic | _modules/netcalc.py | <filename>_modules/netcalc.py
import salt.utils.network as network
__virtualname__ = 'netcalc'
def __virtual__():
return __virtualname__
def gethosts(cidr):
return network._network_hosts(cidr)
|
djivey/kinetic | _modules/minionmanage.py | <reponame>djivey/kinetic<filename>_modules/minionmanage.py
import salt.utils.network as network
import salt.modules.file as file
__virtualname__ = 'minionmanage'
def __virtual__():
return __virtualname__
def populate_cache(path):
pending = file.readdir(path)
pending.remove('.')
pending.remove('..')
return pe... |
djivey/kinetic | _modules/cephx.py | <reponame>djivey/kinetic
## inspiration for simple salt-key module taken from
## https://github.com/ceph/ceph-ansible/blob/master/library/ceph_key.py#L26
import os, struct, time, base64
__virtualname__ = 'cephx'
def __virtual__():
return __virtualname__
def make_key():
key = os.urandom(16)
header = stru... |
dendisuhubdy/pyannote-audio | hubconf.py | <gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2019-2020 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including wi... |
dendisuhubdy/pyannote-audio | pyannote/audio/utils/path.py | <gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2016-2020 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including wi... |
dendisuhubdy/pyannote-audio | pyannote/audio/labeling/tasks/base.py | <gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2018-2020 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including wi... |
dendisuhubdy/pyannote-audio | pyannote/audio/pipeline/utils.py | <gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2017-2020 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including wi... |
rumblefishrobotics/rf_common_ws | src/rf_display_ssd1306/nodes/rf_display_ssd1306_tester_node.py | <filename>src/rf_display_ssd1306/nodes/rf_display_ssd1306_tester_node.py
#!/usr/bin/env python3
"""
Node generating test messages for the display node. Could just use
rostopic pub to rf_display/rf_display_topic RFDisplayData <payload>,
but payload is a fair bit to keep typing / editing. This node is
pu... |
rumblefishrobotics/rf_common_ws | src/rf_display_ssd1306/nodes/rf_display_ssd1306_node.py | <gh_stars>0
#!/usr/bin/env python3
"""
display_ssd1306 provides a ROS wrapper for the SSD1306 LED, using the
Adafruit drivers for their display. It provides four lines of text,
stacked one above the other. Each line has up to 32 characters.
"""
import time
import subprocess
import rospy
from PIL import Im... |
backyio/go-timezone | tools/gen-var-timezones.py | <filename>tools/gen-var-timezones.py
import json
import sys
from jinja2 import Template
def var_timezones():
data = {}
abbr_timezones_json = sys.argv[1]
with open(abbr_timezones_json) as f:
data = json.load(f)
tpl_text = '''var timezones = map[string][]string{
{%- for abbr in timezones %}
... |
backyio/go-timezone | tools/gen-var-tzabbrinfos.py | import json
import sys
from jinja2 import Template
def var_tzabbrinfos():
data = {}
data2 = {}
abbrs_json = sys.argv[1]
military_abbrs_json = sys.argv[2]
with open(abbrs_json) as f:
data = json.load(f)
with open(military_abbrs_json) as f:
data2 = json.load(f)
tpl_text = ''... |
backyio/go-timezone | tools/gen-var-tzinfos.py | import json
import sys
from jinja2 import Template
def var_tzinfos():
data = {}
timezones_json = sys.argv[1]
with open(timezones_json) as f:
data = json.load(f)
tpl_text = '''var tzInfos = map[string]*TzInfo{
{%- for tz in tzinfos %}
"{{ tz }}": &TzInfo{
longGeneric: "{{ tzinfo... |
kristoffer-paulsson/angelostools | src/angelostools/pyxscanner.py | <filename>src/angelostools/pyxscanner.py
"""
The .pyx scanner helps you to scan a whole package hierarchy for Cython pyx files and
encloses them in Extensions from setuptools.
"""
import glob
from pathlib import Path
from setuptools import Extension
class PyxScanner:
"""Scans hierarchically for .pyx files in giv... |
kristoffer-paulsson/angelostools | src/angelostools/setup/script.py | <filename>src/angelostools/setup/script.py
#
# Copyright (c) 2018-2020 by <NAME> <<EMAIL>>.
#
# This software is available under the terms of the MIT license. Parts are licensed under
# different terms if stated. The legal terms are attached to the LICENSE file and are
# made available on:
#
# https://opensource.or... |
kristoffer-paulsson/angelostools | src/angelostools/nsscanner.py | <filename>src/angelostools/nsscanner.py
"""Scanners that comply with namespace packages."""
import os
from pathlib import Path
from typing import Union
class NamespacePackageScanner:
"""A scanner for namespace packages."""
def __init__(self, namespace: str, root: Path = None):
self.__namespace = name... |
kristoffer-paulsson/angelostools | src/angelostools/setup/vendor.py | <reponame>kristoffer-paulsson/angelostools
#
# Copyright (c) 2018-2020 by <NAME> <<EMAIL>>.
#
# This software is available under the terms of the MIT license. Parts are licensed under
# different terms if stated. The legal terms are attached to the LICENSE file and are
# made available on:
#
# https://opensource.or... |
kristoffer-paulsson/angelostools | src/angelostools/setup/executable.py | <reponame>kristoffer-paulsson/angelostools
#
# Copyright (c) 2018-2020 by <NAME> <<EMAIL>>.
#
# This software is available under the terms of the MIT license. Parts are licensed under
# different terms if stated. The legal terms are attached to the LICENSE file and are
# made available on:
#
# https://opensource.or... |
broadstripes/loggly-sidecar | run.py | import os, sys, re
if('LOGGLY_AUTH_TOKEN' not in os.environ):
print('Missing $LOGGLY_AUTH_TOKEN')
sys.exit(1)
if('LOGGLY_TAG' not in os.environ):
print('Missing $LOGGLY_TAG')
sys.exit(1)
auth_token = os.environ['LOGGLY_AUTH_TOKEN']
tags = []
for tag in os.environ['LOGGLY_TAG'].split(","):
tags.... |
rkyoto/pipe_event | pipe_event2.py | <filename>pipe_event2.py
'''
pipe_event2
===========
This module provides a Event class which behaves just like threading.Event
but is based on two pipes created using os.pipe() functions.
Before Python 3.3, monotonic time is not introduced so adjusting system
clock may affect Event.wait() function if specific timeou... |
rkyoto/pipe_event | pipe_event.py |
'''
pipe_event
==========
This module provides a Event class which behaves just like threading.Event
but is based on two pipes created using os.pipe() functions.
Before Python 3.3, monotonic time is not introduced so adjusting system
clock may affect Event.wait() function if specific timeout is set.
Following notes... |
chandru99/neuralnilm | neuralnilm/data/stridesource.py | from __future__ import print_function, division
from copy import copy
from datetime import timedelta
import numpy as np
import pandas as pd
import nilmtk
from nilmtk.timeframegroup import TimeFrameGroup
from nilmtk.timeframe import TimeFrame
from neuralnilm.data.source import Sequence
from neuralnilm.utils import check... |
chandru99/neuralnilm | neuralnilm/data/datathread.py | from __future__ import print_function
from threading import Thread, Event
from queue import Queue, Empty
class DataThread(Thread):
def __init__(self, data_pipeline, max_queue_size=8, **get_batch_kwargs):
super(DataThread, self).__init__(name='neuralnilm-data-process')
self._stop = Event()
... |
isuhao/java-cef | tools/git_util.py | # Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file
from exec_util import exec_cmd
import os
def is_checkout(path):
""" Returns true if the path represents a git checkout. """
return... |
isuhao/java-cef | tools/make_readme.py | # Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
from date_util import *
from file_util import *
from optparse import OptionParser
import os
import re
import shlex
import subprocess
i... |
tehtechguy/annt | src/setup.py | # setup.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 03/30/15
#
# Description : Installs the annt project
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.php
# Copyright : (c) 2015 <NAME>
# Native i... |
tehtechguy/annt | src/annt/util.py | <filename>src/annt/util.py
# util.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 04/02/15
#
# Description : Utility module.
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.php
# Copyright : (c) 2015 <NAM... |
tehtechguy/annt | src/annt/plot.py | # plot.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 03/31/15
#
# Description : Module for plotting.
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.php
# Copyright : (c) 2015 <NAME>
"""
Module for plotting.
G{... |
tehtechguy/annt | src/annt/experimental/hopfield_network.py | # hopfield_network.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 04/07/15
#
# Description : Example showing how to create and use a hopfield network.
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.php
# Cop... |
tehtechguy/annt | src/annt/activation.py | <reponame>tehtechguy/annt
# activation.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 03/30/15
#
# Description : Module for various activation functions.
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.php
# ... |
tehtechguy/annt | src/annt/timers.py | <reponame>tehtechguy/annt<filename>src/annt/timers.py
# timers.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 04/02/15
#
# Description : Module used for timing.
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.... |
tehtechguy/annt | src/annt/examples/__init__.py | # __init__.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 03/31/15
#
# Description : Defines the examples package
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.php
# Copyright : (c) 2015 <NAME>
"""
... |
tehtechguy/annt | src/annt/experimental/hopfield_net.py | # hopfield_net.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 04/07/15
#
# Description : Module for a Hopfield network.
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.php
# Copyright : (c) 2015 <NAME>
... |
tehtechguy/annt | src/annt/examples/multilayer_perceptron_network.py | # multilayer_perceptron_network.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 03/31/15
#
# Description : Example showing how to create and use a multilayer
# perceptron network.
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/li... |
tehtechguy/annt | src/annt/experimental/__init__.py | <gh_stars>1-10
# __init__.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 04/07/15
#
# Description : Defines the experimental package
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.php
# Copyright : (c) 2... |
tehtechguy/annt | src/annt/examples/competitive_learning_network.py | <reponame>tehtechguy/annt<gh_stars>1-10
# competitive_learning_network.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 04/02/15
#
# Description : Example showing how to create and use a competitive learning
# network.
# Python Version : 2.7.8
#
# License ... |
tehtechguy/annt | src/annt/net.py | <reponame>tehtechguy/annt<gh_stars>1-10
# net.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 03/30/15
#
# Description : Module for various artificial neural networks.
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-li... |
tehtechguy/annt | src/annt/examples/linear_regression_network.py | # linear_regression_network.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 03/31/15
#
# Description : Example showing how to create and use a linear regression
# network.
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/m... |
tehtechguy/annt | src/annt/__init__.py | # __init__.py
#
# Author : <NAME>
# Contact : http://techtorials.me
# Date Created : 03/30/15
#
# Description : Defines the annt package
# Python Version : 2.7.8
#
# License : MIT License http://opensource.org/licenses/mit-license.php
# Copyright : (c) 2015 <NAME>
"""
This... |
sqiangcao99/hgr_v2t | t2vretrieval/models/criterion.py | <filename>t2vretrieval/models/criterion.py<gh_stars>100-1000
import torch
import torch.nn as nn
import framework.configbase
import framework.ops
def cosine_sim(im, s):
'''cosine similarity between all the image and sentence pairs
'''
inner_prod = im.mm(s.t())
im_norm = torch.sqrt((im**2).sum(1).view(-1, 1) + ... |
sqiangcao99/hgr_v2t | framework/run_utils.py | import os
import json
import datetime
import numpy as np
import glob
import framework.configbase
def gen_common_pathcfg(path_cfg_file, is_train=False):
path_cfg = framework.configbase.PathCfg()
path_cfg.load(json.load(open(path_cfg_file)))
output_dir = path_cfg.output_dir
path_cfg.log_dir = os.path.join(ou... |
sqiangcao99/hgr_v2t | framework/modules/embeddings.py | <reponame>sqiangcao99/hgr_v2t
""" Embeddings module """
import math
import torch
import torch.nn as nn
class PositionalEncoding(nn.Module):
"""
Implements the sinusoidal positional encoding for
non-recurrent neural networks.
Implementation based on "Attention Is All You Need"
Args:
dim_embed (int): e... |
sqiangcao99/hgr_v2t | t2vretrieval/models/evaluation.py | import numpy as np
def eval_q2m(scores, q2m_gts):
'''
Image -> Text / Text -> Image
Args:
scores: (n_query, n_memory) matrix of similarity scores
q2m_gts: list, each item is the positive memory ids of the query id
Returns:
scores: (recall@1, 5, 10, median rank, mean rank)
gt_ranks: the best ran... |
sqiangcao99/hgr_v2t | t2vretrieval/readers/mpdata.py | <reponame>sqiangcao99/hgr_v2t<filename>t2vretrieval/readers/mpdata.py
import os
import json
import numpy as np
import torch.utils.data
BOS, EOS, UNK = 0, 1, 2
class MPDataset(torch.utils.data.Dataset):
def __init__(self, name_file, mp_ft_files, word2int_file, max_words_in_sent,
ref_caption_file=None, is_train=... |
sqiangcao99/hgr_v2t | t2vretrieval/encoders/video.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import framework.configbase
class MPEncoderConfig(framework.configbase.ModuleConfig):
def __init__(self):
super().__init__()
self.dim_fts = [2048]
self.dim_embed = 1024
self.dropout = 0
class MPEncoder(nn.Module):
def __init__(sel... |
sqiangcao99/hgr_v2t | t2vretrieval/encoders/graph.py | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class GCNLayer(nn.Module):
def __init__(self, embed_size, dropout=0.0):
super().__init__()
self.embed_size = embed_size
self.ctx_layer = nn.Linear(self.embed_size, self.embed_size, bias=False)
self.layernorm = nn.LayerNor... |
sqiangcao99/hgr_v2t | t2vretrieval/miscs/semantic_role_labeling.py | import os
import argparse
import json
from allennlp.predictors.predictor import Predictor
def main():
parser = argparse.ArgumentParser()
parser.add_argument('ref_caption_file')
parser.add_argument('out_file')
parser.add_argument('--cuda_device', default=-1, type=int)
opts = parser.parse_args()
predictor ... |
sqiangcao99/hgr_v2t | t2vretrieval/readers/rolegraphs.py | import os
import json
import numpy as np
import h5py
import collections
import torch
import t2vretrieval.readers.mpdata
ROLES = ['V', 'ARG1', 'ARG0', 'ARG2', 'ARG3', 'ARG4',
'ARGM-LOC', 'ARGM-MNR', 'ARGM-TMP', 'ARGM-DIR', 'ARGM-ADV',
'ARGM-PRP', 'ARGM-PRD', 'ARGM-COM', 'ARGM-MOD', 'NOUN']
class RoleGraphDataset(t... |
sqiangcao99/hgr_v2t | t2vretrieval/encoders/sentence.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import framework.configbase
from framework.modules.embeddings import Embedding
import framework.ops
class SentEncoderConfig(framework.configbase.ModuleConfig):
def __init__(self):
super().__init__()
self.num_words = 0
self.dim_word = 300... |
sqiangcao99/hgr_v2t | t2vretrieval/encoders/mlvideo.py | <filename>t2vretrieval/encoders/mlvideo.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import framework.configbase
class MultilevelEncoderConfig(framework.configbase.ModuleConfig):
def __init__(self):
super().__init__()
self.dim_fts = [2048]
self.dim_embed = 1024
self.dropout ... |
sqiangcao99/hgr_v2t | framework/modelbase.py | import os
import time
import json
import numpy as np
import torch
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
import framework.logbase
class ModelBase(object):
def __init__(self, config, _logger=None, gpu_id=0):
'''initialize model
(support single GPU, otherwise need to ... |
sqiangcao99/hgr_v2t | t2vretrieval/models/globalmatch.py | import os
import numpy as np
import collections
import json
import torch
import framework.ops
import framework.configbase
import framework.modelbase
import t2vretrieval.encoders.video
import t2vretrieval.encoders.sentence
import t2vretrieval.models.criterion
import t2vretrieval.models.evaluation
from t2vretrieval.mo... |
sqiangcao99/hgr_v2t | t2vretrieval/driver/configs/prepare_globalmatch_configs.py | <gh_stars>100-1000
import os
import sys
import argparse
import numpy as np
import json
import t2vretrieval.models.globalmatch
from t2vretrieval.models.globalmatch import VISENC, TXTENC
def prepare_mp_globalmatch_model(root_dir):
anno_dir = os.path.join(root_dir, 'annotation', 'RET')
mp_ft_dir = os.path.join(root... |
sqiangcao99/hgr_v2t | framework/modules/global_attention.py | <gh_stars>100-1000
""" Global attention modules (Luong / Bahdanau) """
import torch
import torch.nn as nn
import torch.nn.functional as F
class GlobalAttention(nn.Module):
'''
Global attention takes a matrix and a query vector. It
then computes a parameterized convex combination of the matrix
based on the inpu... |
soumilbaldota/local_full-duplex_chatspace_using_sockets | CLIENT.py | <filename>CLIENT.py
from socket import *
import threading
import time
import sys
time.sleep(10)
def recv():
while True:
s=socket(AF_INET,SOCK_STREAM)
s.connect((sys.argv[1] ,5747))
s1=''
while True:
msg=(s.recv(8).decode('utf-8'))
s1+=msg
if len(msg)<=0:
s.close()
print(s1)
... |
Aghassi/rules_spa | spa/private/build_routes.bzl | <reponame>Aghassi/rules_spa
"""A macro for creating a webpack federation route module"""
load("@aspect_rules_swc//swc:swc.bzl", "swc")
# Defines this as an importable module area for shared macros and configs
def build_route(name, entry, srcs, data, webpack, federation_shared_config):
"""
Macro that allows e... |
Aghassi/rules_spa | spa/private/routes/generate_route_manifest.bzl | <filename>spa/private/routes/generate_route_manifest.bzl
"""A macro that wraps a script to generate an object that maps routes to their entry data"""
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "npm_package_bin")
def generate_route_manifest(name, routes):
"""Generates a json file that is a repr... |
Aghassi/rules_spa | internal_deps.bzl | <filename>internal_deps.bzl
"""Our "development" dependencies
Users should *not* need to install these. If users see a load()
statement from these, that's a bug in our distribution.
"""
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_arc... |
Aghassi/rules_spa | spa/defs.bzl | <reponame>Aghassi/rules_spa
"Public API re-exports"
load("//spa/private/routes:generate_route_manifest.bzl", _generate_route_manifest = "generate_route_manifest")
load("//spa/private:build_routes.bzl", _build_route = "build_route")
load("//spa/private:build_server.bzl", _build_server = "build_server")
load("//spa/priv... |
Aghassi/rules_spa | spa/private/build_server.bzl | <reponame>Aghassi/rules_spa
"""A macro for building the server bundle that will end up in a nodejs docker image"""
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@aspect_rules_swc//swc:swc.bzl", "swc")
# Defines this as an importable module area for shared macros and configs
def build_server(name,... |
Aghassi/rules_spa | spa/private/host.bzl | <reponame>Aghassi/rules_spa
"""A macro for creating a webpack federation host module"""
load("@aspect_rules_swc//swc:swc.bzl", "swc")
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
# Defines this as an importable module area for shared macros and configs
def build_host(entry, data, srcs, webpack, federation... |
jpardobl/pandavro | example/example.py | <reponame>jpardobl/pandavro<filename>example/example.py
import pandavro as pdx
def main():
weather = pdx.from_avro('weather.avro')
print(weather)
pdx.to_avro('weather_out.avro', weather)
if __name__ == '__main__':
main()
|
duhines/CC-M7 | action.py | """
Author: <NAME>
Course: Computational Creativity Fall 2018
Project: M7: Playing with Words
Date: last modified 12/13
Description:
Class that allows characters to act.
Includes the following classes:
Actions -
used to store and initialize all the actions
Travel -
implements the possibilities and consequ... |
duhines/CC-M7 | knowledge/define_actions.py |
import action
actions = []
"""
Basic actions:
move from one place to another
fall in love with another character
attack another character
heal another character
"""
|
duhines/CC-M7 | quests.py | <filename>quests.py
# THIS WHOLE FILE IS A BIG TODO
#"""
# Author: <NAME>
# Course: Computational Creativity Fall 2018
# Project: M7: Playing with Words
# Date: last modified 12/13
# Description:
# Notes:
# """
# """
# Want characters to have objectives--when a characters wishes to accomplish
# something in the ... |
duhines/CC-M7 | character.py | """
Author: <NAME>
Course: Computational Creativity Fall 2018
Project: M7: Playing with Words
Date: last modified 12/13
Description:
Notes:
* personality representation:
* -1 to 1 rating of the Big five personality traints
* and/or -1 to 1 rating of evil->good, chaotic->lawful scale.
* perhaps emotions are a... |
duhines/CC-M7 | clean_locations.py | <filename>clean_locations.py
"""
Author: <NAME>
Course: Computational Creativity Fall 2018
Project: M7: Playing with Words
Date: last modified 12/13
Description:
This script is used to clean the originally copied and pasted location
data.
Notes:
The way that locations are processed, each word of a multi-word locat... |
duhines/CC-M7 | knowledge.py | <filename>knowledge.py
"""
Author: <NAME>
Course: Computational Creativity Fall 2018
Project: M7: Playing with Words
Date: last modified 12/13
Description:
File to set up knowledge by reading in information from a names and
locations file in the knowledge base.
Notes:
Assumes that the names and locations file are ... |
duhines/CC-M7 | narrator.py | <reponame>duhines/CC-M7
"""
Author: <NAME>
Course: Computational Creativity Fall 2018
Project: M7: Playing with Words
Date: last modified 12/13
Description:
This module implements 3 classes:
1. Narrator -
the entity that maintains the story knowledge such as setting and
characters and keeps track of other meta d... |
duhines/CC-M7 | clean_names.py | """
Author: <NAME>
Course: Computational Creativity Fall 2018
Project: M7: Playing with Words
Date: last modified 12/13
Description:
This is a script to clean names. The names are from the top 100 boys
and girls names from 2018 from bounty.com
Notes:
Assumes the format of the original names file has the name firs... |
GoHelpFund/aden_hash | setup.py | from distutils.core import setup, Extension
help_hash_module = Extension('help_hash',
sources = ['helpmodule.c',
'help.c',
'sha3/blake.c',
'sha3/bmw.c',
... |
GoHelpFund/aden_hash | test.py | <filename>test.py
import help_hash
from binascii import unhexlify, hexlify
import unittest
# help block #1
# moo@b1:~/.help$ helpd getblockhash 1
# 000007d91d1254d60e2dd1ae580383070a4ddffa4c64c2eeb4a2f9ecc0414343
# moo@b1:~/.help$ helpd getblock 000007d91d1254d60e2dd1ae580383070a4ddffa4c64c2eeb4a2f9ecc0414343
# {
# ... |
LoYungSum/gaze_correction_loyungsum | gaze_correction_system/flx.py | import tensorflow as tf
import numpy as np
import tf_utils
import transformation
img_crop = 3
def gen_agl_map(inputs, height, width,feature_dims):
with tf.name_scope("gen_agl_map"):
batch_size = tf.shape(inputs)[0]
ret = tf.reshape(tf.tile(inputs,tf.constant([1,height*width])), [batch_size,height,... |
LoYungSum/gaze_correction_loyungsum | training/code_tf/model_train/transformation.py | import tensorflow as tf
def repeat(x, num_repeats):
with tf.name_scope("repeat"):
ones = tf.ones((1, num_repeats), dtype='int32')
x = tf.reshape(x, shape=(-1,1))
x = tf.matmul(x, ones)
return tf.reshape(x, [-1])
def interpolate(image, x, y, output_size):
with tf.name_scope("int... |
LoYungSum/gaze_correction_loyungsum | training/code_tf/model_train/tf_utils.py | import tensorflow as tf
def batch_norm(x, train_phase, name='bn_layer'):
#with tf.variable_scope(name) as scope:
batch_norm = tf.layers.batch_normalization(
inputs=x,
momentum=0.9, epsilon=1e-5,
center=True, scale=True,
training = train_phase,
name=na... |
LoYungSum/gaze_correction_loyungsum | training/code_tf/model_train/config.py | #-*- coding: utf-8 -*-
import argparse
model_config = argparse.ArgumentParser()
# model
model_config.add_argument('--height', type=eval, default=48, help='')
model_config.add_argument('--width', type=eval, default=64, help='')
model_config.add_argument('--channel', type=eval, default=3, help='')
model_config.add_argu... |
LoYungSum/gaze_correction_loyungsum | gaze_correction_system/focal_length_calibration.py | <filename>gaze_correction_system/focal_length_calibration.py
#!/usr/bin/env python
# coding: utf-8
# # Parameter settings
# In[6]:
import dlib
# install dlib by "pip install cmake dlib"
import cv2
import numpy as np
# In[7]:
# Please place your head in front of the camera about 50 cm
d = 60 # cm
# Please set y... |
LoYungSum/gaze_correction_loyungsum | gaze_correction_system/config.py | #-*- coding: utf-8 -*-
import argparse
model_config = argparse.ArgumentParser()
# model parameters
model_config.add_argument('--height', type=eval, default=48, help='')
model_config.add_argument('--width', type=eval, default=64, help='')
model_config.add_argument('--channel', type=eval, default=3, help='')
model_conf... |
LoYungSum/gaze_correction_loyungsum | training/generate_training_inputs_from_raw_dataset/load_dataset2.py | <reponame>LoYungSum/gaze_correction_loyungsum
import threading
import numpy as np
import tensorflow as tf
import pickle
import cv2
import os
sur_agl_limit = 16
dif_agl_limit_v = 21
dif_agl_limit_h = 26
def seperate_eye_and_lid(imgs, anchor_maps):
# start_time = time.time()
imgs_eye = []
imgs_lid = []
... |
sh4nth/maps | scratch/scripts.py | <reponame>sh4nth/maps
import pandas as pd
import urllib, json
from concurrent.futures import ThreadPoolExecutor
allDistricts = {}
with open('List_of_Districts.txt') as f:
for dist in f.read().splitlines():
allDistricts[dist.split(',')[0]] = dist.replace('_', ' ')
allDistricts['Andamans'] = None
allDistri... |
Swipe650/Py-Timer | pytimer.py | <reponame>Swipe650/Py-Timer<filename>pytimer.py
#!/usr/bin/env python3
# encoding: utf-8
"""
Count down seconds from a given minute value
using the Tkinter GUI toolkit that comes with Python.
Basic Tk version by vegaseat (I extended this):
https://www.daniweb.com/programming/software-development/threads/464062/countd... |
all4dich/ldap_tools | src/main/test_python/call_hello.py | import re
import os
import logging
from ldap_tools.common import LDAPClient
logger = logging.getLogger("add-lge-users-to-nexus")
if __name__ == "__main__":
host = "192.168.3.11"
username = "lge\\allessunjoo.park"
password = input("Password: ")
a = LDAPClient(host, username, password)
a.search_ro... |
all4dich/ldap_tools | src/main/test_python/find-departments.py | <reponame>all4dich/ldap_tools
import re
import os
import logging
from ldap_tools.common import LDAPClient
import argparse
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("-u", dest="username", required=True)
arg_parser.add_argument("-p", dest="password", required=True)
args = arg_parser.parse_args()
i... |
all4dich/ldap_tools | src/main/test_python/test-call-ldap-server.py | <filename>src/main/test_python/test-call-ldap-server.py
from ldap_tools.common import LDAPClient
import subprocess
import re
if __name__ == "__main__":
host = "192.168.127.12"
username = "lge\\addhost"
password = input(f"Password for {username}")
a = LDAPClient(host,username,password)
a.search_root... |
all4dich/ldap_tools | src/main/python/ldap_tools/common.py | from ldap3 import Server, Connection, ALL, NTLM
import logging
logger = logging.getLogger()
logger.setLevel(logging.WARN)
formatter = logging.Formatter('%(levelname)7s:%(filename)s:%(lineno)d:%(funcName)10s: %(message)s')
ch = logging.StreamHandler()
ch.setLevel(logging.WARN)
ch.setFormatter(formatter)
logger.addHa... |
gauchm/mlstream | mlstream/utils.py | import sys
import pickle
import json
from pathlib import Path
from typing import Dict, List
from datetime import datetime
import h5py
import pandas as pd
import numpy as np
import scipy as sp
from tqdm import tqdm
from .datasets import LumpedBasin
from .datautils import store_static_attributes
def create_h5_files(d... |
gauchm/mlstream | mlstream/__init__.py | #
# Machine Learning for Streamflow Prediction
#
|
gauchm/mlstream | mlstream/models/xgboost.py | <filename>mlstream/models/xgboost.py
from typing import Dict, List
from pathlib import Path
import pickle
import numpy as np
import pandas as pd
from sklearn.model_selection import RandomizedSearchCV
from torch.utils.data import DataLoader
try:
import xgboost as xgb
except ImportError:
print("Importing the opt... |
gauchm/mlstream | mlstream/datasets.py | from pathlib import Path
from typing import List, Tuple, Dict
import h5py
import torch
import pandas as pd
import numpy as np
from tqdm import tqdm
from torch.utils.data import Dataset
from .datautils import (load_discharge,
load_forcings_lumped,
load_static_attributes,... |
gauchm/mlstream | mlstream/experiment.py | <filename>mlstream/experiment.py
import json
import random
from pathlib import Path
from typing import Dict, List, Tuple
from tqdm import tqdm
import pandas as pd
import numpy as np
import torch
from .datasets import LumpedBasin, LumpedH5
from .scaling import InputScaler, OutputScaler, StaticAttributeScaler
from .uti... |
gauchm/mlstream | mlstream/datautils.py | import re
from typing import Dict, List, Tuple
from pathlib import Path
import sqlite3
import pandas as pd
import numpy as np
import netCDF4 as nc
from numba import njit
def get_basin_list(data_root: Path, basin_type: str) -> List:
"""Returns the list of basin names.
If basin_type is 'C' or 'V... |
gauchm/mlstream | mlstream/models/sklearn_models.py | <filename>mlstream/models/sklearn_models.py<gh_stars>1-10
from pathlib import Path
import pickle
import numpy as np
from sklearn.base import BaseEstimator
from torch.utils.data import DataLoader
from ..datasets import LumpedBasin, LumpedH5
from .base_models import LumpedModel
class LumpedSklearnRegression(LumpedMod... |
gauchm/mlstream | setup.py | from setuptools import setup
import os
def readme():
with open(os.path.dirname(os.path.realpath(__file__)) + '/README.md') as f:
return f.read()
requires = [
'pandas',
'numpy',
'h5py',
'tqdm',
'netCDF4',
'numba',
'scipy',
]
# to save build resources, we mock torch and xgboost... |
gauchm/mlstream | mlstream/models/base_models.py | <gh_stars>1-10
from pathlib import Path
import numpy as np
from ..datasets import (LumpedBasin, LumpedH5)
class LumpedModel:
"""Model that operates on lumped (daily, basin-averaged) inputs. """
def load(self, model_file: Path) -> None:
"""Loads a trained and pickled model.
Parameters
... |
gauchm/mlstream | mlstream/models/nseloss.py | <gh_stars>1-10
import torch
import numpy as np
class NSELoss(torch.nn.Module):
"""Calculates (batch-wise) NSE Loss.
Each sample i is weighted by 1 / (std_i + eps)^2, where std_i is the standard deviation of the
discharge of the basin to which the sample belongs.
Parameters
----------
eps : f... |
gauchm/mlstream | mlstream/models/lstm.py | """
Large parts of this implementation are taken over from
https://github.com/kratzert/ealstm_regional_modeling.
"""
import sys
from pathlib import Path
from typing import Tuple, Dict
import numpy as np
from tqdm import tqdm
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, SubsetRandomSampl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.