repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
pegasus-isi/pegasus-cycles
src/pegasus_cycles/_gldas.py
<gh_stars>0 # -*- coding: utf-8 -*- import csv import io from pathlib import Path import numpy as np from netCDF4 import Dataset def iterlocations(location_file): # X is Longitude, Y is Latitude. with Path(location_file).open("r") as csvfile: reader = csv.DictReader(csvfile) for row in reade...
pegasus-isi/pegasus-cycles
dax_generator.py
#!/usr/bin/env python3 import os import pegasus_cycles from pegasus_cycles.__main__ import * from string import Template def _generate_tc(): with open("tc.template") as t_tc_file: src = Template(t_tc_file.read()) tc_data = { "work_dir": os.getcwd() } result = src.subst...
pegasus-isi/pegasus-cycles
bin/cycles-wrapper.py
<filename>bin/cycles-wrapper.py #!/usr/bin/env python3 """Cycles Executor.""" import argparse import csv import logging import os import shutil import subprocess import sys from string import Template log = logging.getLogger() def _generate_inputs( prefix, start_year, end_year, basel...
pegasus-isi/pegasus-cycles
src/pegasus_cycles/_adag.py
<reponame>pegasus-isi/pegasus-cycles # -*- coding: utf-8 -*- from pegasus_cycles._pegasus import * import os import html a = ADAG("pegasus-cycles", auto=True) # input files crops_file = File("crops.crop") crops_file.addPFN(PFN("file://" + os.getcwd() + "/data/crops.crop", "local")) soil_file = File("pongo.soil") so...
pegasus-isi/pegasus-cycles
bin/GLDAS-Cycles-transformation.py
<gh_stars>0 #!/usr/bin/env python3 import argparse import math import os import shutil from datetime import datetime, timedelta import numpy as np from netCDF4 import Dataset def Closest(lat, lon, path): elevation_fp = path + "/GLDASp4_elevation_025d.nc4" nc = Dataset(elevation_fp, "r") best_y = (np.a...
pegasus-isi/pegasus-cycles
src/pegasus_cycles/_combinations.py
<gh_stars>0 # -*- coding: utf-8 -*- from itertools import product country = ["South Sudan"] # "Cassava" # crops = ["Maize", "Sorghum", "Peanut", "Sesame", "Cassava"] crops = ["Maize", "Sorghum", "Sesame"] soil = ["pongo.soil"] start_planting_date = ["100", "107", "114", "121", "128", "135", "142"] end_planting_da...
pegasus-isi/pegasus-cycles
setup.py
<reponame>pegasus-isi/pegasus-cycles # -*- coding: utf-8 -*- import os from setuptools import find_packages, setup install_requires = ["Click", "netCDF4"] # Utility function to read the README file. def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() def find_package_data(dirn...
pegasus-isi/pegasus-cycles
bin/cycles-fertilizer-increase-output-summary.py
<gh_stars>0 #!/usr/bin/env python3 """Cycles Fertilizer Increase Output Summary.""" import argparse import csv import os def parse_outputs(output_file, parsed_files, **kwargs): with open(output_file, 'w', newline='') as csvfile: csvwriter = csv.writer(csvfile) csvwriter.writerow([ 'uni...
pegasus-isi/pegasus-cycles
bin/cycles-fertilizer-increase-output-parser.py
<reponame>pegasus-isi/pegasus-cycles<filename>bin/cycles-fertilizer-increase-output-parser.py #!/usr/bin/env python3 """Cycles Output Parser.""" import argparse import csv import os def parse_outputs(params_file, params_file_fi, season_file, season_file_fi, output_file, **kwargs): with open(output_file, 'w', newl...
pegasus-isi/pegasus-cycles
src/pegasus_cycles/__main__.py
<filename>src/pegasus_cycles/__main__.py # -*- coding: utf-8 -*- """ Pegasus Cycles. :license: Apache 2.0 """ import click import hashlib import logging import pegasus_cycles import os import sys from pathlib import Path from pegasus_cycles._adag import * from pegasus_cycles._combinations import itercombinations fro...
pegasus-isi/pegasus-cycles
src/pegasus_cycles/_pegasus.py
<gh_stars>0 # -*- coding: utf-8 -*- from functools import wraps from Pegasus.DAX3 import ADAG as Base from Pegasus.DAX3 import * class ADAG(Base): def job(self): def wrap(f): @wraps(f) def wrapped_f(*args, **kwargs): rv = f(*args, **kwargs) if rv: ...
pegasus-isi/pegasus-cycles
bin/cycles-output-parser.py
<gh_stars>0 #!/usr/bin/env python3 """Cycles Output Parser.""" import argparse import csv import os def parse_outputs(output_file, params_files, **kwargs): with open(output_file, 'w', newline='') as csvfile: csvwriter = csv.writer(csvfile) csvwriter.writerow([ 'unique_id', ...
jfsantos/stable-baselines
stable_baselines/common/input.py
<filename>stable_baselines/common/input.py import tensorflow as tf from gym.spaces import Discrete, Box def observation_input(ob_space, batch_size=None, name='Ob'): """ Build observation input with encoding depending on the observation space type :param ob_space: (Gym Space) The observation space :pa...
jfsantos/stable-baselines
stable_baselines/common/policies.py
import numpy as np import tensorflow as tf from gym.spaces import Discrete from stable_baselines.a2c.utils import conv, linear, conv_to_fc, batch_to_seq, seq_to_batch, lstm from stable_baselines.common.distributions import make_proba_dist_type from stable_baselines.common.input import observation_input def nature_cn...
jfsantos/stable-baselines
stable_baselines/ddpg/__init__.py
from stable_baselines.ddpg.ddpg import DDPG
jfsantos/stable-baselines
tests/test_identity.py
<filename>tests/test_identity.py import pytest from stable_baselines.a2c import A2C from stable_baselines.acer import ACER from stable_baselines.acktr import ACKTR from stable_baselines.deepq import DeepQ from stable_baselines.ppo1 import PPO1 from stable_baselines.ppo2 import PPO2 from stable_baselines.trpo_mpi impor...
jfsantos/stable-baselines
tests/test_action_space.py
<reponame>jfsantos/stable-baselines import pytest from stable_baselines.a2c import A2C from stable_baselines.ppo1 import PPO1 from stable_baselines.ppo2 import PPO2 from stable_baselines.trpo_mpi import TRPO from stable_baselines.common.identity_env import IdentityEnvMultiBinary, IdentityEnvMultiDiscrete from stable_b...
jfsantos/stable-baselines
stable_baselines/common/base_class.py
<filename>stable_baselines/common/base_class.py from abc import ABC, abstractmethod import os import cloudpickle import numpy as np import gym from stable_baselines.common import set_global_seeds from stable_baselines.common.policies import LstmPolicy from stable_baselines.common.vec_env import VecEnvWrapper, VecEnv,...
jfsantos/stable-baselines
stable_baselines/common/__init__.py
# flake8: noqa F403 from stable_baselines.common.console_util import fmt_row, fmt_item, colorize from stable_baselines.common.dataset import Dataset from stable_baselines.common.math_util import discount, discount_with_boundaries, explained_variance, explained_variance_2d,\ flatten_arrays, unflatten_vector from sta...
jfsantos/stable-baselines
stable_baselines/ppo1/pposgd_simple.py
<gh_stars>0 from collections import deque import time import tensorflow as tf import numpy as np from mpi4py import MPI from stable_baselines.common import Dataset, explained_variance, fmt_row, zipsame, BaseRLModel, SetVerbosity from stable_baselines import logger import stable_baselines.common.tf_util as tf_util fro...
jfsantos/stable-baselines
stable_baselines/common/identity_env.py
<filename>stable_baselines/common/identity_env.py import numpy as np from gym import Env from gym.spaces import Discrete, MultiDiscrete, MultiBinary, Box class IdentityEnv(Env): def __init__(self, dim, ep_length=100): """ Identity environment for testing purposes :param dim: (int) the si...
jfsantos/stable-baselines
tests/test_save.py
import os import pytest from stable_baselines.a2c import A2C from stable_baselines.acer import ACER from stable_baselines.acktr import ACKTR from stable_baselines.deepq import DeepQ from stable_baselines.ppo1 import PPO1 from stable_baselines.ppo2 import PPO2 from stable_baselines.trpo_mpi import TRPO from stable_bas...
jfsantos/stable-baselines
stable_baselines/common/running_stat.py
import numpy as np class RunningStat(object): def __init__(self, shape): """ calulates the running mean and std of a data stream http://www.johndcook.com/blog/standard_deviation/ :param shape: (tuple) the shape of the data stream's output """ self._step = 0 ...
LanceSuen/WundergroundHistoryDataParser
crawl.py
<gh_stars>1-10 # Author : LanceSuen import time import csv import sys from datetime import date, timedelta from selenium import webdriver from selenium.webdriver import Chrome from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.proxy import Proxy, ProxyType # Please change the conf...
davidpelaez/oso
languages/python/oso/tests/test_polar_roles.py
import pytest import timeit import os from sqlalchemy import create_engine from sqlalchemy.types import String from sqlalchemy.schema import Column, ForeignKey from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy.ext.declarative import declarative_base from oso import Oso, OsoError from polar.excepti...
davidpelaez/oso
languages/python/oso/polar/data_filtering.py
from typing import Any, Optional from dataclasses import dataclass VALID_KINDS = ["parent", "children"] # Used so we know what fetchers to call and how to match up constraints. @dataclass class Relationship: kind: str other_type: str my_field: str other_field: str # @NOTE(Steve): Some of this stuff...
davidpelaez/oso
languages/python/django-oso/django_oso/__init__.py
<reponame>davidpelaez/oso import oso from .oso import Oso __version__ = "0.11.0" default_app_config = "django_oso.apps.DjangoOsoConfig"
davidpelaez/oso
languages/python/oso/oso/exceptions.py
<filename>languages/python/oso/oso/exceptions.py class AuthorizationError(Exception): pass class NotFoundError(AuthorizationError): pass class ForbiddenError(AuthorizationError): pass
davidpelaez/oso
languages/python/sqlalchemy-oso/sqlalchemy_oso/auth.py
from oso import Oso from polar import Variable from polar.exceptions import PolarRuntimeError from polar.partial import TypeConstraint from sqlalchemy.orm.query import Query from sqlalchemy.orm.session import Session from sqlalchemy import inspect from sqlalchemy.sql import expression as sql from sqlalchemy_oso.parti...
davidpelaez/oso
languages/python/oso/oso/__init__.py
<gh_stars>0 from polar import polar_class, Variable, Predicate from .oso import Oso, Policy from .exceptions import AuthorizationError, ForbiddenError, NotFoundError from polar.exceptions import OsoError from .enforcer import Enforcer
davidpelaez/oso
languages/python/sqlalchemy-oso/sqlalchemy_oso/partial.py
"""Translate Oso Expressions into SQLAlchemy Expressions. This module translates between Oso Expressions that are returned from queries with partial variables into SQLAlchemy constraints. The entrypoint is :py:func:`partial_to_filter`. The translation is written as a recursive mapping operation. We do a traversal of ...
davidpelaez/oso
languages/python/oso/tests/polar_roles_sqlalchemy_helpers.py
<reponame>davidpelaez/oso # Roles 2 from typing import Any, List from oso import OsoError from sqlalchemy import inspect, UniqueConstraint from sqlalchemy.exc import IntegrityError from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.orm import class_mapper, relationship, validates, synonym from sqlal...
davidpelaez/oso
languages/python/sqlalchemy-oso/tests/test_roles.py
<filename>languages/python/sqlalchemy-oso/tests/test_roles.py<gh_stars>0 # Roles 2 tests from polar.exceptions import ParserError import pytest import random import string import os import timeit from sqlalchemy import create_engine from sqlalchemy.pool import NullPool from sqlalchemy.types import Integer, String from...
davidpelaez/oso
languages/python/oso/oso/enforcer.py
from typing import List, Any from polar import Variable, exceptions from .exceptions import NotFoundError, ForbiddenError from .oso import Policy class Enforcer: """ NOTE: This is a preview feature. Exposes high-level enforcement APIs which can be used by apps to perform resource-, request-, and quer...
davidpelaez/oso
languages/python/oso/tests/test_enforcer.py
"""Tests the Enforcement API""" from oso.exceptions import AuthorizationError, ForbiddenError, NotFoundError from oso import Enforcer from pathlib import Path import pytest from oso import Policy from polar import exceptions from .test_oso import Actor, Widget, Company @pytest.fixture def test_enforcer(): polic...
ryuichi1208/koredare
koredare.py
<reponame>ryuichi1208/koredare<filename>koredare.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Everything is stuck here. The images are downloaded from wikipedia. """ import aiohttp import datetime import itertools import numpy import os import pprint import requests import shutil import sys import urllib.par...
wdv4758h/rsglob
setup.py
<gh_stars>0 import os import sys from setuptools import find_packages, setup, Extension try: # for pip >= 10 from pip._internal.req import parse_requirements except ImportError: from pip.req import parse_requirements try: from setuptools_rust import RustExtension except ImportError: import subproce...
wdv4758h/rsglob
rsglob/__init__.py
<reponame>wdv4758h/rsglob """Filename globbing utility.""" __all__ = ["glob", "iglob", "escape"] VERSION = '0.0.1' try: import rsglob._rsglob as _glob def glob(pathname, *, recursive=False): if isinstance(pathname, str): return _glob.glob_str(pathname) elif isinstance(pathname, b...
wdv4758h/rsglob
tests/test_simple.py
<reponame>wdv4758h/rsglob<gh_stars>0 import glob as glob1 import rsglob as glob2 def test_nondot_files(): assert set(glob1.glob("*")) == set(glob2.glob("*")) def test_dot_files(): assert set(glob1.glob(".*")) == set(glob2.glob(".*"))
RyanNavillus/tcav
tcav/utils.py
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
RyanNavillus/tcav
tcav/model_test.py
""" Copyright 2019 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distr...
ebenpack/dotfiles
qtile/utilities.py
# symlinked at ~/.config/qtile/utilities.py from libqtile.config import Screen from libqtile import bar, widget import subprocess, re class Xrandr(object): """ Object representing connected screens, as reported by xrandr. This is very simple at the moment, and does not, in its current state, really deser...
ebenpack/dotfiles
qtile/config.py
<gh_stars>0 # symlinked at ~/.config/qtile/config.py from libqtile.config import Key, Group, Click, Drag from libqtile.command import lazy from libqtile import layout, hook import utilities import subprocess, re mod = "mod4" widget_defaults = dict( font = 'Source Code Pro', border_focus="#de4377", bord...
Ziems/Machine-Learning
CS231n/assignment2/cs231n/classifiers/convnet.py
import numpy as np from cs231n.layers import * from cs231n.fast_layers import * from cs231n.layer_utils import * class ConvNet(object): """ A L-layer convolutional network with the following architecture: [conv-relu-pool2x2]xL - [affine - relu]xM - affine - softmax The network operates on minibatch...
Ziems/Machine-Learning
CS231n/assignment2/cs231n/layer_utils.py
from cs231n.layers import * from cs231n.fast_layers import * def affine_relu_forward(x, w, b): """ Convenience layer that perorms an affine transform followed by a ReLU Inputs: - x: Input to the affine layer - w, b: Weights for the affine layer Returns a tuple of: - out: Output from the ...
kikei/scraping-20160707
collect.py
from selenium import webdriver import urllib import os import re CHROME_DRIVER_PATH = os.path.join(os.path.dirname(__file__), 'chromedriver') TOP_PAGE = 'http://example.com' SAVE_DIR = 'download' browser = webdriver.Chrome(CHROME_DRIVER_PATH) browser.get(TOP_PAGE) imgs = browser.find_elements_by_tag_name('img') srcs...
GregorTpk/blmol
blmol.py
"""Scripts for loading molecular geometries into Blender. Main use is to define the "molecule" object, which can be used to draw models of molecular coordinates. Written by <NAME>, www.hartleygroup.org and blog.hartleygroup.org. Hosted here: https://github.com/scotthartley/blmol Some as...
rockofsky/vislice
model.py
import random # Definiramo konstante ŠTEVILO_DOVOLJENIH_NAPAK = 10 PRAVILNA_CRKA = "+" PONOVLJENA_CRKA = "o" NAPACNA_CRKA = "-" ZAČETEK = "S" ZMAGA = "W" PORAZ = "X" # Definiramo logični model igre class Igra: def __init__(self, geslo, crke): self.geslo = geslo.upper() # String ...
rockofsky/vislice
vislice.py
<reponame>rockofsky/vislice<filename>vislice.py import bottle import model vislice = model.Vislice({}) @bottle.get("/") def uvod(): return bottle.template("index.tpl") @bottle.get("/igra/") def nova_igra() bottle.run(reloader=True, debug=True)
rockofsky/vislice
tekstovni_vmesnik.py
from model import Igra, bazen_besed import random def izpis_igre(igra): if not igra.zmaga() and not igra.poraz(): return "Nadaljujmo z igro." return None def izpis_zmage(igra): if igra.zmaga(): return "Zmagali ste!" return None def izpis_poraza(igra): if igra.poraz(): ret...
deftech/cloudify-healer-plugin
cloudify_healer/healer.py
<reponame>deftech/cloudify-healer-plugin ######## # Copyright (c) 2019 Cloudify Platform Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www....
deftech/cloudify-healer-plugin
tests/test_stopper.py
# Copyright (c) 2019 Cloudify Platform Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
deftech/cloudify-healer-plugin
tests/test_healer.py
############ # Copyright (c) 2019 Cloudify Platform Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
deftech/cloudify-healer-plugin
cloudify_healer/launcher.py
######## # Copyright (c) 2019 Cloudify Platform Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
sudormroot/resnet-in-tensorflow-test
gpu_test.py
import tensorflow as tf tf.test.is_gpu_available()
firstnattapon/N2
app.py
<reponame>firstnattapon/N2 #___________________________________________________________________________________________________ import pandas as pd import streamlit as st import seaborn as sns import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import json import hiplot as hip from pok...
larryhou/py-futu-api
futu/tools/generate_code.py
# -*- coding: utf-8 -*- import json import os import load_template #__PBPrefixName__ = "GetGlobalState_pb2." __TemplateCodeFileName__ = "template_code.txt" __TemplateFileHeadName__ = "template_head.txt" __TemplateRstName__ = "rst_template.txt" template = load_template.FutuTemplate("function.template") def chang...
larryhou/py-futu-api
futu/examples/simple.py
<filename>futu/examples/simple.py # -*- coding: utf-8 -*- from futu import * quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111) """-------------------------------------------------""" from futu.quote.quote_get_warrant import Request from futu.quote.quote_stockfilter_info import SimpleFilter field = SimpleF...
n4ts/ha-notione
custom_components/notione/device_tracker.py
<filename>custom_components/notione/device_tracker.py """Support for notiOne® Bluetooth trackers.""" from datetime import datetime,timedelta import logging import requests,json import voluptuous as vol from homeassistant.components.device_tracker import PLATFORM_SCHEMA from homeassistant.const import CONF_USERNAME,...
n4ts/ha-notione
custom_components/notione/__init__.py
"""The notione component."""
chemberger/bnil-graph
__init__.py
#!/usr/bin/env python # Copyright 2017 <NAME> (@withzombies) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
AlperenCicek/uav-simulation
UAV-Code/object_detection_ss.py
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Suppress TensorFlow logging import tensorflow as tf from object_detection.utils import label_map_util from object_detection.utils import config_util from object_detection.utils import visualization_utils as viz_utils from object_detection.builders import model_bui...
ancabilloni/sea-vision
misc/edge_detection_example.py
<reponame>ancabilloni/sea-vision #!/usr/bin/env python """ Edge detection with Sobel operator on webcam """ from cv_tools import sobel_thresh import cv2 import numpy as np cap = cv2.VideoCapture(0) while (cap.isOpened()): _, frame = cap.read() sobel_x = sobel_thresh(frame, orient='x', sobel_kernel=9, thresh=(30,...
ancabilloni/sea-vision
misc/cv_tools.py
<gh_stars>1-10 #!/usr/bin/env python """ Selections of computer vision tools/methods """ import numpy as np import cv2 def sobel_thresh(img, orient='x', sobel_kernel=3, thresh=(0,255), gray=False): """Applying sobel operator for edge detection""" if not gray: gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) else: ...
ancabilloni/sea-vision
misc/write_to_video.py
#!/usr/bin/env python import cv2 # cap = cv2.VideoCapture("/path/to/your_video.mp4") cap = cv2.VideoCapture(0) #Try out with your webcam save_as = "/your/video/folder" fourcc = cv2.VideoWriter_fourcc(*'mp4v') # set video extension type video_writer = cv2.VideoWriter(save_as + '/output.mp4', fourcc, 20.0, (640,480)) #...
ancabilloni/sea-vision
misc/grabbing_frames.py
<gh_stars>1-10 #!/usr/bin/env python import cv2 cap = cv2.VideoCapture('path/to/your/video/project_video.mp4') save_as = "/path/to/your/save_folder" count = 0 while (cap.isOpened()): _, frame = cap.read() if frame is None: break else: cv2.imwrite(save_as + "/frame%d.jpg" % count, frame) count += 1 cv2.imsho...
BrightBurningPark/Naruda-office_support_robot
robot/lib/pathengine.py
<reponame>BrightBurningPark/Naruda-office_support_robot from gridmap import OccupancyGridMap as ogm from a_star import a_star from utils import plot_path from rpslam import * import matplotlib.pyplot as plt class navigation: def __init__(self, map_path_with_name): self.gmap = ogm.from_png(map_path_with_na...
BrightBurningPark/Naruda-office_support_robot
robot/lib/utils.py
import math import png import numpy import matplotlib.pyplot as plt from PIL import Image, ImageOps def dist2d(point1, point2): """ Euclidean distance between two points :param point1: :param point2: :return: """ x1, y1 = point1[0:2] x2, y2 = point2[0:2] dist2 = (x1 - x2)**2 + (y...
BrightBurningPark/Naruda-office_support_robot
robot/lib/pgm_utils.py
''' pgm_utils.py : Python utilties for PGM files Copyright (C) 2014 <NAME> This code 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 option) any...
BrightBurningPark/Naruda-office_support_robot
robot/use_map_autonomous_drive.py
<reponame>BrightBurningPark/Naruda-office_support_robot<filename>robot/use_map_autonomous_drive.py<gh_stars>1-10 ''' Naruda: 2019-1 AJOU Univ. major of Software department Capstone project Robot main firmware made by "<NAME>" (github nickname 'BrightBurningPark'). Robot can drive by itself, localize position and direc...
BrightBurningPark/Naruda-office_support_robot
robot/build_map_by_manual.py
''' Naruda: 2019-1 AJOU Univ. major of Software department Capstone project Robot main firmware made by "<NAME>" (github nickname 'BrightBurningPark'). Robot can drive by itself, localize position and direction in given map. it can also build the map from zero. I Love my school and the Capstone Program SO MUCH. it's ...
BrightBurningPark/Naruda-office_support_robot
robot/lib/ntdriver.py
import usb.core import usb.util import array import sys import os import socketio import time SERVER_ADDR = 'http://172.16.31.10:3010' class server: sio = socketio.Client() request = None def __init__(self): self.flag = 0 def connect(self): server.sio.connect(SERVER_ADDR) pri...
BrightBurningPark/Naruda-office_support_robot
robot/lib/rpslam.py
from breezyslam.algorithms import RMHC_SLAM from breezyslam.sensors import RPLidarA1 as LaserModel from rplidar import RPLidar as Lidar #from roboviz import MapVisualizer from pgm_utils import * from scipy.interpolate import interp1d import numpy as np from PIL import Image import io import os MAP_SIZE_PIXELS ...
BrightBurningPark/Naruda-office_support_robot
robot/garage/firmware_final.py
''' Naruda: 2019-1 AJOU Univ. major of Software department Capstone project Robot main firmware made by "<NAME>" (github nickname 'BrightBurningPark'). Robot can drive by itself, localize position and direction in given map. it can also build the map from zero. I Love my school and the Capstone Program SO MUCH. it's ...
BrightBurningPark/Naruda-office_support_robot
robot/garage/USBLoopBackTester_python3.py
import usb.core import usb.util import array import sys import os # Vendor and product identifiers for the brick ID_VENDOR_LEGO = 0x0694 ID_PRODUCT_NXT = 0x0002 #NXT Protocol # Sends a command to the brick and expects a reply SYSTEM_COMMAND_REPLY = 0x01 # Replied command after SYSTEM_COMMAND_REPLY REPLY_COMMAND = 0x...
BrightBurningPark/Naruda-office_support_robot
robot/garage/backup_rpslam.py
<gh_stars>1-10 from breezyslam.algorithms import RMHC_SLAM from breezyslam.sensors import RPLidarA1 as LaserModel from rplidar import RPLidar as Lidar from roboviz import MapVisualizer # this occurs error when there's no display connected on odroid from PIL import Image import io import os MAP_SIZE_PIXELS = 3000...
sarmadgulzar/pyutilx
pyutilx/__init__.py
from pyutilx.utils import *
sarmadgulzar/pyutilx
pyutilx/utils.py
def list_of_lists(l, n): q = len(l) // n r = len(l) % n if r == 0: return [l[i * n:(i + 1) * n] for i in range(q)] else: return [l[i * n:(i + 1) * n] if i <= q else l[i * n:i * n + r] for i in range(q + 1)]
sarmadgulzar/pyutilx
setup.py
from distutils.core import setup setup( name = 'pyutilx', packages = ['pyutilx'], version = '0.1', license = 'MIT', description = 'Useful Python Functions', author = '<NAME>', author_email = '<EMAIL>', url = 'https://github.com/sarmadgulzar/pyutilx', download_url = 'https://github.com/sarmadgulzar/pyu...
wagnerandreoli/clitools
src/clib/docker.py
<gh_stars>0 # -*- coding: utf-8 -*- """Docker module.""" import argparse import json from pathlib import Path from subprocess import PIPE from typing import List from clib.config import JsonConfig from clib.files import existing_directory_type, existing_file_type, shell, shell_find from clib.types import JsonDict YML...
wagnerandreoli/clitools
src/clib/constants.py
"""Constants.""" TIME_FORMAT = "%H:%M:%S" # Mimick Ansible colors to simulate "ok" (nothing changed) and "changed" in CLI scripts. COLOR_OK = "green" COLOR_CHANGED = "yellow"
wagnerandreoli/clitools
src/clib/dev/__init__.py
# -*- coding: utf-8 -*- """Development helpers.""" import os import re from pathlib import Path from typing import List, Tuple import click from plumbum import FG, RETCODE from requests_html import HTMLSession from clib.files import shell # Possible formats for tests: # ___ test_name ___ # ___ Error on setup of test...
wagnerandreoli/clitools
src/clib/files.py
"""Files, symbolic links, operating system utilities.""" import os import re import sys import unicodedata from argparse import ArgumentTypeError from functools import partial from pathlib import Path from shlex import split from subprocess import PIPE, run from time import sleep from typing import Any, List, Optional,...
wagnerandreoli/clitools
src/clib/git.py
# -*- coding: utf-8 -*- """Git tools.""" from shlex import split from plumbum import ProcessExecutionError from plumbum.cmd import git DEVELOPMENT_BRANCH = "develop" def run_git(*args, dry_run=False, quiet=False): """Run a git command, print it before executing and capture the output.""" command = git[split...
wagnerandreoli/clitools
src/clib/iter.py
<reponame>wagnerandreoli/clitools<filename>src/clib/iter.py """Tools for iterators and iterables.""" from itertools import cycle, islice def roundrobin(*iterables): """Get one item from each iterable. Recipe credited to <NAME>. Taken from https://docs.python.org/3/library/itertools.html#itertools-recipes...
wagnerandreoli/clitools
src/clib/environments.py
<gh_stars>0 # -*- coding: utf-8 -*- """Environment variables.""" import os from typing import List from prettyconf import config from clib.config import cast_to_directory_list config.starting_path = os.path.expanduser("~/.config/clib") RSYNC_EXCLUDE: List[str] = config( "RSYNC_EXCLUDE", cast=config.list, defaul...
wagnerandreoli/clitools
src/clib/dev/packaging.py
# -*- coding: utf-8 -*- """Packaging tools to publish projects on PyPI and GitHub.""" import os from pathlib import Path from shutil import rmtree from typing import List, Optional, Tuple import click from clib import dry_run_option, verbose_option from clib.files import shell from clib.ui import prompt HeaderComman...
wagnerandreoli/clitools
src/clib/db.py
# -*- coding: utf-8 -*- """Database module.""" import argparse from pathlib import Path from subprocess import PIPE from typing import List, Optional from clib.docker import DockerContainer from clib.files import existing_directory_type, existing_file_type, shell POSTGRES_DOCKER_CONTAINER_NAME = "postgres12" class ...
wagnerandreoli/clitools
src/clib/ui.py
# -*- coding: utf-8 -*- """User interface.""" import sys import time from pathlib import Path from subprocess import PIPE, CalledProcessError import click def notify(title, message): """If terminal-notifier is installed, use it to display a notification.""" from clib.files import shell check = "which" i...
wagnerandreoli/clitools
src/clib/config.py
# -*- coding: utf-8 -*- """Configuration helpers.""" import json import os from pathlib import Path from typing import List CONFIG_DIR = Path("~/.config/dotfiles/").expanduser() class JsonConfig: """A JSON config file.""" def __init__(self, partial_path): """Create or get a JSON config file inside t...
wagnerandreoli/clitools
tests/test_files.py
"""File tests.""" from pathlib import Path from textwrap import dedent from testfixtures import compare from clib.files import merge_directories, unique_file_name def test_unique_file_name(tmp_path): """Test unique file names with numeric index.""" path = tmp_path / "file.txt" assert unique_file_name(pa...
wagnerandreoli/clitools
src/clib/__init__.py
<reponame>wagnerandreoli/clitools # -*- coding: utf-8 -*- """Main module for clib.""" import logging import os from configparser import ConfigParser import click from colorlog import ColoredFormatter __author__ = "<NAME>" __email__ = "<EMAIL>" CONFIG_DIR = os.path.expanduser(os.path.join("~/.config", os.path.basenam...
wagnerandreoli/clitools
src/clib/contacts.py
<filename>src/clib/contacts.py """Utilities to deal with contact data (people and places with name, address, phone).""" from collections import defaultdict from pathlib import Path from tempfile import NamedTemporaryFile from textwrap import dedent from typing import DefaultDict, List, Optional, Set, Tuple, Union impo...
wagnerandreoli/clitools
src/clib/types.py
"""Types.""" from pathlib import Path from typing import Any, Dict, Union JsonDict = Dict[str, Any] PathOrStr = Union[Path, str]
adellewigley/Spooky-Southampton
ghostmap.py
from flask import Flask from flask import render_template app = Flask(__name__) @app.route("/") def index(): return render_template('index.html') @app.route("/404") def page2(): return render_template('page2.html') if __name__ == "__main__": app.run()
WilliamKMLai/ansible-scGalaxy
galaxy/files/galaxy/tools/scATAC_debarcode.py
<reponame>WilliamKMLai/ansible-scGalaxy<filename>galaxy/files/galaxy/tools/scATAC_debarcode.py #!/usr/bin/env python #https://raw.githubusercontent.com/epigen-UCSD/snATAC_pipeline/master/bin/scATAC_debarcode import gzip import bz2 import sys import collections import os import operator import os.path import optparse ...
WilliamKMLai/ansible-scGalaxy
galaxy/files/galaxy/tools/scATAC_barcode_err_correct.py
#!/usr/bin/env python import sys import collections import os import optparse def min_dist(s, sl): """ return the string with min edit distance """ ss = sl[:] if len(s) == 0: sys.exit("error(min_dist): inquiry string has length 0") if len(ss) == 0: sys.exit("error(min_dist): ref string lib has 0 eleme...
WilliamKMLai/ansible-scGalaxy
galaxy/files/galaxy/tools/scATAC_summary.py
#!/usr/bin/env python import sys import optparse import gzip import pysam import statistics def main(): """ main function """ parser = optparse.OptionParser(usage='%prog [-h] [-a Raw Reads] [-b Unique BAM] [-c Barcode-corrected BAM] [-d Unique Barcodes][-e PCR duplicated BAM] [-f Final BAM] [-g Minimum read t...
WilliamKMLai/ansible-scGalaxy
galaxy/files/galaxy/tools/scATAC_parseDedup.py
#!/usr/bin/env python import os import sys import collections import optparse import pysam def main(): """ main function """ parser = optparse.OptionParser(usage='%prog [-h] [-m Min reads per cell]', description='Parse individual cells from scATAC-seq data.') parser.add_...
WilliamKMLai/ansible-scGalaxy
galaxy/files/galaxy/tools/scATAC_filterCellnumber.py
#!/usr/bin/env python import sys import optparse def main(): """ main function """ parser = optparse.OptionParser(usage='%prog [-h] [-m Minimum Reads] [-f Barcode Frequency]', description='Filter BAM file, retaining cells with minimum number of associated reads.') parser...