repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
nrgxtra/web_basics
todos/todos/todos_app/migrations/0002_alter_category_options_alter_person_options_and_more.py
<filename>todos/todos/todos_app/migrations/0002_alter_category_options_alter_person_options_and_more.py # Generated by Django 4.0.2 on 2022-02-16 12:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('todos_app', '0001_initial'), ] op...
nrgxtra/web_basics
lost_and_found/tests/objects_posts/models/test_object.py
<gh_stars>0 from django.core.exceptions import ValidationError from django.test import TestCase from lost_and_found.objects_posts.models import Object class TestObject(TestCase): def test_WhenWidthIsLessThan_3_expectToRaise(self): name = 'Object1' image = 'http://image.com' widt...
nrgxtra/web_basics
book/book/book_app/migrations/0002_alter_book_pages.py
<filename>book/book/book_app/migrations/0002_alter_book_pages.py<gh_stars>0 # Generated by Django 4.0.2 on 2022-02-17 07:59 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('book_app', '0001_initial'), ] ...
nrgxtra/web_basics
expenseTracker/expenseTracker/expenses/apps.py
from django.apps import AppConfig class ExpensesConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'expenseTracker.expenses'
nrgxtra/web_basics
lost_and_found/tests/objects_posts/views/test_index.py
from django.test import TestCase, Client from django.urls import reverse class IndexViewTest(TestCase): def test_example(self): client = Client() response = client.get(reverse('index')) self.assertTemplateUsed(response, 'index.html') posts = response.context['posts']
nrgxtra/web_basics
todos/todos/todos_app/migrations/0001_initial.py
# Generated by Django 4.0.2 on 2022-02-16 12:29 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Category', ...
nrgxtra/web_basics
Recipes/Recipes/recipe_app/views.py
<gh_stars>0 from django.shortcuts import render, redirect from Recipes.recipe_app.forms import CreateRecipeForm, DeleteRecipeForm from Recipes.recipe_app.models import Recipe def show_home(request): recipes = Recipe.objects.all() context = { 'recipes': recipes, } return render(requ...
nrgxtra/web_basics
Recipes/Recipes/recipe_app/apps.py
<reponame>nrgxtra/web_basics from django.apps import AppConfig class RecipeAppConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'Recipes.recipe_app'
nrgxtra/web_basics
notes/notes/user_profile/forms.py
from django import forms from notes.user_profile.models import Profile class UserProfileForm(forms.ModelForm): class Meta: model = Profile fields = '__all__'
nrgxtra/web_basics
notes/core/get_user_profile.py
from notes.user_profile.models import Profile def get_profile(): profile = Profile.objects.all().first() return profile
nrgxtra/web_basics
onlineLibrary/onlineLibrary/books_app/urls.py
from django.urls import path from onlineLibrary.books_app.views import add_book, edit_book, book_details, book_delete urlpatterns = [ path('add/', add_book, name='add book'), path('edit/<int:pk>', edit_book, name='edit book'), path('details/<int:pk>', book_details, name='book details'), path('...
nrgxtra/web_basics
expenseTracker/expenseTracker/expenses/views.py
from django.shortcuts import render, redirect from expenseTracker.core.profile_utils import get_profile from expenseTracker.expenses.forms import ExpenseForm, DeleteExpenseForm from expenseTracker.expenses.models import Expense def home(request): profile = get_profile() if not profile: retu...
nrgxtra/web_basics
todos/todos/todos_app/urls.py
<reponame>nrgxtra/web_basics from django.urls import path from todos.todos_app.views import show_todos, update_todo, delete_todo, create_todo urlpatterns = [ path('', show_todos, name='index'), path('update/<int:pk>', update_todo, name='update'), path('delete/<int:pk>', delete_todo, name='delete'),...
nrgxtra/web_basics
expenseTracker/expenseTracker/core/profile_utils.py
<filename>expenseTracker/expenseTracker/core/profile_utils.py from expenseTracker.profiles.models import Profile def get_profile(): return Profile.objects.first()
nrgxtra/web_basics
todos/todos/todos_app/apps.py
from django.apps import AppConfig class TodosAppConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'todos.todos_app'
nrgxtra/web_basics
notes/notes/user_notes/views.py
from django.shortcuts import render, redirect from notes.user_notes.forms import CreateNoteForm, DeleteNoteForm from notes.user_notes.models import Note def create_note(request): if request.method == 'POST': form = CreateNoteForm(request.POST) if form.is_valid(): form.save()...
nrgxtra/web_basics
Recipes/Recipes/recipe_app/models.py
<filename>Recipes/Recipes/recipe_app/models.py from django.db import models class Recipe(models.Model): title = models.CharField(max_length=30) image_url = models.URLField() description = models.TextField() ingredients = models.CharField(max_length=250) time = models.IntegerField()
nrgxtra/web_basics
urls_and_templates/secondary_app/views.py
<filename>urls_and_templates/secondary_app/views.py from django.shortcuts import render def index(req): return render(req, 'secondary_app/index.html')
nrgxtra/web_basics
notes/notes/user_profile/urls.py
<filename>notes/notes/user_profile/urls.py from django.urls import path from notes.user_profile.views import show_home, show_profile urlpatterns = [ path('', show_home, name='home'), path('profile/', show_profile, name='profile'), ]
nrgxtra/web_basics
expenseTracker/expenseTracker/profiles/urls.py
<filename>expenseTracker/expenseTracker/profiles/urls.py from django.urls import path from expenseTracker.profiles.views import edit_profile, delete_profile, profile_details, create_profile urlpatterns = [ path('', profile_details, name='profile page'), path('create/', create_profile, name='profile crea...
nrgxtra/web_basics
urls_and_templates/main_app/views.py
<reponame>nrgxtra/web_basics from django.shortcuts import render def index(req): return render(req, 'main_app/index.html')
wtfsystems/ppms
mod/parts.py
################################################################## # # Python Polyphonic MIDI Synthesizer # ################################################################## # # ~~~~~~~[]=¤ԅ(ˊᗜˋ* )੭ # # Filename: parts.py # By: <NAME> # https://www.wtfsystems.net/ # # See LICENSE....
wtfsystems/ppms
mod/env.py
# # Python Polyphonic MIDI Synthesizer # # Filename: env.py # By: <NAME> # See LICENSE.md for copyright information. # import numpy as np from .parts import synthmod ## Envelope - ADSR class envelope(synthmod): __attack = 0 __decay = 0 __sustain = 0 __release = 0 __envelo...
wtfsystems/ppms
ppms.py
################################################################## # # Python Polyphonic MIDI Synthesizer # ################################################################## # # ~~~~~~~[]=¤ԅ(ˊᗜˋ* )੭ # # Filename: ppms.py # By: <NAME> # https://www.wtfsystems.net/ # # See LICENSE.md for copyri...
wtfsystems/ppms
mod/bpass.py
# # Python Polyphonic MIDI Synthesizer # # Filename: bpass.py # By: <NAME> # See LICENSE.md for copyright information. # from .parts import synthmod import numpy as np ## Band-pass filter. class band_pass(synthmod): ## Store high pass amount __high_pass = 0 ## Store low pass amount...
wtfsystems/ppms
mod/mwtest.py
<reponame>wtfsystems/ppms # # Python Polyphonic MIDI Synthesizer # # Filename: mwtest.py # By: <NAME> # See LICENSE.md for copyright information. # from .parts import synthmod, mod_control ## PPMS Synth Module for testing the mod wheel. class mwtest_module(synthmod, mod_control): ## Test proces...
wtfsystems/ppms
mod/reverb.py
# # Python Polyphonic MIDI Synthesizer # # Filename: reverb.py # By: <NAME> # See LICENSE.md for copyright information. # from .parts import synthmod import numpy as np ## PPMS Synth Module for reverb. Shifts the signal and adds to original. class reverberation(synthmod): ## Store reverb amo...
wtfsystems/ppms
mod/test.py
<gh_stars>1-10 # # Python Polyphonic MIDI Synthesizer # # Filename: test.py # By: <NAME> # See LICENSE.md for copyright information. # from .parts import synthmod ## PPMS Synth Module for testing the patchboard. class test_module(synthmod): ## Store test_value __test_value = 0 ## T...
sinpcw/kamonohashi
cli/setup.py
<reponame>sinpcw/kamonohashi # -*- coding: utf-8 -*- import os.path from setuptools import find_packages from setuptools import setup with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as f: version = f.read().strip() setup( name='kamonohashi-cli', version=version, description='KAMONOHASHI...
sinpcw/kamonohashi
sdk/kamonohashi/op/rest/models/preprocessing_api_models_histories_output_model.py
# coding: utf-8 """ KAMONOHASHI API A platform for deep learning # noqa: E501 OpenAPI spec version: v1 Contact: <EMAIL> Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class PreprocessingApiModelsHistoriesOutputModel(obje...
sinpcw/kamonohashi
cli/kamonohashi/cli/preprocessing.py
<gh_stars>10-100 # -*- coding: utf-8 -*- from __future__ import print_function, absolute_import, with_statement import io import json import logging import os import os.path import click from kamonohashi.op import rest from kamonohashi.cli import configuration from kamonohashi.cli import object_storage from kamonoh...
sinpcw/kamonohashi
sdk/kamonohashi/op/data_set.py
# -*- coding: utf-8 -*- import os.path from kamonohashi.op import object_storage from kamonohashi.op import rest def get(api_client, id): api = rest.DataSetApi(api_client) result = api.get_dataset(id) return result def create(api_client, model): api = rest.DataSetApi(api_client) result = api.c...
sinpcw/kamonohashi
sdk/kamonohashi/op/account.py
<filename>sdk/kamonohashi/op/account.py # -*- coding: utf-8 -*- import urllib3 from kamonohashi.op import rest def login(server, user, password, tenant_id=None, timeout=30, retries=False, expires_in=None, proxy=None): api_client = _get_api_client_noauth(proxy) api_client.rest_client.pool_manager.connection_...
sinpcw/kamonohashi
cli/kamonohashi/cli/inference.py
# -*- coding: utf-8 -*- from __future__ import print_function, absolute_import, with_statement import click from kamonohashi.op import rest from kamonohashi.cli import configuration @click.group() def inference(): """Create and manage KAMONOHASHI inference""" @inference.command() @click.argument('id', type=i...
sinpcw/kamonohashi
sdk/kamonohashi/op/data.py
# -*- coding: utf-8 -*- from kamonohashi.op import object_storage from kamonohashi.op import rest def get(api_client, id): api = rest.DataApi(api_client) result = api.get_data(id) return result def create(api_client, name, memo=None, tags=()): api = rest.DataApi(api_client) model = rest.DataApi...
sinpcw/kamonohashi
sdk/kamonohashi/op/training.py
<filename>sdk/kamonohashi/op/training.py # -*- coding: utf-8 -*- from kamonohashi.op import object_storage from kamonohashi.op import rest def get(api_client, id): api = rest.TrainingApi(api_client) result = api.get_training(id) return result def create(api_client, name, registry_image, registry_tag, d...
sinpcw/kamonohashi
sdk/kamonohashi/op/rest/models/account_api_models_login_input_model.py
<filename>sdk/kamonohashi/op/rest/models/account_api_models_login_input_model.py<gh_stars>0 # coding: utf-8 """ KAMONOHASHI API A platform for deep learning # noqa: E501 OpenAPI spec version: v1 Contact: <EMAIL> Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint...
sinpcw/kamonohashi
sdk/kamonohashi/op/object_storage.py
# -*- coding: utf-8 -*- import os import os.path from kamonohashi.op import rest from kamonohashi.op.rest.rest import ApiException def upload_file(api_client, file_path, file_type): """Upload a file to object storage. :param rest.ApiClient api_client: :param str file_path: source file path :param st...
sinpcw/kamonohashi
sdk/kamonohashi/op/rest/models/data_api_models_preprocess_history_output_model.py
<gh_stars>0 # coding: utf-8 """ KAMONOHASHI API A platform for deep learning # noqa: E501 OpenAPI spec version: v1 Contact: <EMAIL> Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class DataApiModelsPreprocessHistoryOutpu...
sinpcw/kamonohashi
sdk/kamonohashi/op/rest/api/__init__.py
<filename>sdk/kamonohashi/op/rest/api/__init__.py from __future__ import absolute_import # flake8: noqa # import apis into api package from kamonohashi.op.rest.api.account_api import AccountApi from kamonohashi.op.rest.api.data_api import DataApi from kamonohashi.op.rest.api.data_set_api import DataSetApi from kamono...
sinpcw/kamonohashi
sdk/kamonohashi/op/rest/api/preprocessing_api.py
# coding: utf-8 """ KAMONOHASHI API A platform for deep learning # noqa: E501 OpenAPI spec version: v1 Contact: <EMAIL> Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import re # noqa: F401 # python 2 and python 3 compatibility li...
pabloufrn/onefp-final_datascience
main.py
<gh_stars>0 import yaml from github import Github import networkx as nx import re config = None with open('config.yml', 'r') as config_file: try: config = yaml.safe_load(config_file) except yaml.YAMLError as exc: print(exc) try: G = nx.DiGraph() gh = Github(config['api_key']) org ...
alanlzw/14301057
WSGIServer.py
<reponame>alanlzw/14301057 from __future__ import unicode_literals import socket import StringIO import sys import datetime import os class WSGIServer(object): socket_family = socket.AF_INET socket_type = socket.SOCK_STREAM request_queue_size = 10 def __init__(self, address): # ...
Skylark0924/habitat-lab
habitat/core/logging.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import time import yaml class HabitatLogger(logging.Logger): def __init__( self, na...
switchdoclabs/SDL_Pi_SHT30
SHT30.py
#!usr/bin/python # SwitchDoc Labs, 2019 # added more reliablity functions including GrovePower Save # MODULE IMPORTS import time import smbus import traceback import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) # GLOBAL VARIABLES SHT30_I2CADDR = 0x44 SHT30_READCOMMAND = 0x2C SHT30_READREG = 0x00 MAXREADATTEMPT = 10 S...
Menduist/genny
tests/generated/test.py
from ctypes import * import os, sys dir = os.path.dirname(sys.modules["test"].__file__) if sys.platform == "win32": libName = "test.dll" elif sys.platform == "darwin": libName = "libtest.dylib" else: libName = "libtest.so" dll = cdll.LoadLibrary(os.path.join(dir, libName)) class testError(Exception): pass ...
MichaelRyanGoad/TwitterBot
MyBot.py
import tweepy import time import re CONSUMER_KEY = '' CONSUMER_SECRET = '' ACCESS_KEY = '' ACCESS_SECRET = '' auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) api = tweepy.API(auth) FILE_NAME = 'last_seen_index.txt' def retrieve_last_seen_id(file_name): ...
northwindapps/seleniumInCronjob
wishlist.py
from dotenv import dotenv_values config = dotenv_values(".env") from selenium import webdriver #exception from selenium.common.exceptions import NoSuchElementException #keys to enter input data into fields from selenium.webdriver.common.keys import Keys #time module to put some delay in the process import time i...
northwindapps/seleniumInCronjob
bid.py
<gh_stars>0 #use selenium driver from dotenv import dotenv_values config = dotenv_values(".env") from selenium import webdriver #exception from selenium.common.exceptions import NoSuchElementException #keys to enter input data into fields from selenium.webdriver.common.keys import Keys #time module to put some del...
danielaTorrezE/BCH
qa/rpc-tests/mempool_limit.py
<reponame>danielaTorrezE/BCH<gh_stars>0 #!/usr/bin/env python2 # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Test mempool limiting together/eviction with the wallet from t...
danielaTorrezE/BCH
qa/rpc-tests/txn_doublespendrelay.py
<reponame>danielaTorrezE/BCH<gh_stars>0 #!/usr/bin/env python # # Test double-spend-relay and notification code # from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from decimal import Decimal def wait_for(criteria): import sys sys.stdout.write("Waiting for tx to...
danielaTorrezE/BCH
qa/rpc-tests/bip100-sizelimit.py
<gh_stars>0 #!/usr/bin/env python2 # Copyright (c) 2017 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test mining and broadcast of larger-than-1MB-blocks # from test_framework.test_framework import Bit...
kart324/Punctuation-Restoration
src/dataset.py
<gh_stars>0 import torch from config import * from augmentation import * import numpy as np def parse_data(file_path, tokenizer, sequence_len, token_style): """ :param file_path: text file path that contains tokens and punctuations separated by tab in lines :param tokenizer: tokenizer that will be used t...
kart324/Punctuation-Restoration
cuda.py
import torch print(torch.cuda.device_count()) print(torch.cuda.is_available()) print(torch.version.cuda)
TomaicazyX/arduino_switch_aws
server.py
<reponame>TomaicazyX/arduino_switch_aws<filename>server.py from sixth import data_maker as asa import threading """change the port var if arduino is connected to another port""" port="COM3" a=asa(port) t1=threading.Thread(target=a.make) def get_data(): import requests url = "https://7676hssfl5.execute-api...
TomaicazyX/arduino_switch_aws
sixth.py
<filename>sixth.py import serial import time import csv from itertools import count import json class data_maker: def __init__(self,port): self.index=count() self.ser = serial.Serial(port) self.ser.flushInput() self.running=True #self.fieldnames=["classifier", "time"] ...
TomaicazyX/arduino_switch_aws
aws.py
import requests import json url = "https://7676hssfl5.execute-api.us-east-2.amazonaws.com/beta/arduino-id" payload = {"id":"799", "time":"78787878"} headers = { 'content-type': "application/json", 'cache-control': "no-cache", 'postman-token': "6<PASSWORD>" } payload=json.dumps(payload) response = re...
TomaicazyX/arduino_switch_aws
reader.py
from matplotlib import pyplot as plt import os import json
TomaicazyX/arduino_switch_aws
run.py
import pandas as pd import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation from fourth import data_maker as dm import threading import os try: a=dm('COM3') except: a=dm('/dev/ttyAMA0') t1=threading.Thread(target=a.make) fig1, (ax1,ax2,ax3) = plt.subplots(3,1) def pngfinder(): if not(...
TomaicazyX/arduino_switch_aws
ss.py
<reponame>TomaicazyX/arduino_switch_aws<gh_stars>0 import requests url = "https://7676hssfl5.execute-api.us-east-2.amazonaws.com/beta/arduino-id" headers = { 'cache-control': "no-cache", 'postman-token': "<PASSWORD>" } response = requests.request("GET", url, headers=headers) s=response.text import json...
mantuoluozk/chinese_wordcloud_pyqt5
codes/function.py
<reponame>mantuoluozk/chinese_wordcloud_pyqt5 # -*- coding: utf-8 -*- import random from wordcloud import WordCloud, ImageColorGenerator from PIL import Image import numpy as np import matplotlib.pyplot as plt import jieba from os import path def run(imgpath,txtpath,color): # 文本路径名 text_path = txtpath ...
mantuoluozk/chinese_wordcloud_pyqt5
codes/main.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ciyun.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! from function import run #导入生成词云函数 import sys from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import * class Ui_Dialog(o...
elgamala/cdk_expects_matcher
cdk_expects_matcher/__init__.py
"""Top-level package for cdk_expects_matcher.""" __author__ = """<NAME>""" __email__ = '<EMAIL>' __version__ = '0.1.0'
elgamala/cdk_expects_matcher
cdk_expects_matcher/sample_cdk_app/cdk.py
from aws_cdk import ( core, aws_s3 as s3 ) app = core.App() class MainStack(core.Stack): def __init__(self, scope: core.Construct, **kwargs): super(MainStack, self).__init__( scope=scope, id=MainStack.__name__, **kwargs ) s3.Bucket( ...
elgamala/cdk_expects_matcher
tests/__init__.py
"""Unit test package for cdk_expects_matcher."""
elgamala/cdk_expects_matcher
cdk_expects_matcher/CdkMatchers.py
<gh_stars>0 import re from expects.matchers import Matcher ANY_VALUE = '__ANY_VALUE__' class have_parameter(Matcher): def __init__(self, expected_name: str, expected_props: any): self._expected_name = expected_name self._props = expected_props def _match(self, cfn_template): if sel...
irasus-technologies/EnergyBoost
data_processing/hl_model_fig-more.py
<reponame>irasus-technologies/EnergyBoost<gh_stars>0 # coding: utf-8 # In[1]: import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import linear_model, ensemble, svm, tree, neural_network from sklearn.pipeline import make_pipeline from sklearn.preprocessing import MinMaxScaler, Stan...
irasus-technologies/EnergyBoost
Plot/environment_bill_rbc.py
<reponame>irasus-technologies/EnergyBoost # desired data result looks like (no EV right now): # Time(m/t), Cloud cover(o), GHI(ghi), Temperature(temp), Homeload(hl), Power generated(ac), Battery(b), weekday(w) # datetime, EV, o, ghi, temp, hl, ac, w, b import csv import os import numpy as np import pandas as pd ...
irasus-technologies/EnergyBoost
DLC/mapping.py
# coding: utf-8 # In[1]: import numpy as np import pandas as pd import matplotlib.pyplot as plt import pathlib import time from sklearn import linear_model, ensemble, svm, tree, neural_network from sklearn.pipeline import make_pipeline from sklearn.preprocessing import MinMaxScaler, StandardScaler from sklearn.me...
irasus-technologies/EnergyBoost
Plot/violinplot_price8.py
import glob import csv import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns csvfile = open("violin/violin_policy8.csv", 'w', newline='') writer = csv.writer(csvfile, delimiter=',') writer.writerow(["Total electricity bill of one year ($)","Panel number","Battery size","Policy"]) ...
irasus-technologies/EnergyBoost
Plot/compile_nem.py
import pandas as pd import numpy as np import matplotlib.pyplot as plt import csv hhids=[26, 59, 77, 86, 93, 94,101] scenarios=["sb4b64","sb4b135","sb8b64","sb8b135","sb10b64","sb10b135","sb20b64","sb20b135"] csvfile = open('bill_curve/nem_results.csv','w', newline='') writer = csv.writer(csvfile, delimiter=',') write...
irasus-technologies/EnergyBoost
data_processing/fill_missing_data.py
# coding: utf-8 # In[1]: import pandas as pd import numpy as np from datetime import datetime # In[2]: hh_df = pd.read_csv('home_ac/processed_hhdata_86_2.csv') # print(hh_df.shape) # hh_df.head(15) hh_df.drop_duplicates(subset ="localhour", keep = False, inplace = True) print(hh_df.shape) # In[3]: hh_df['ho...
irasus-technologies/EnergyBoost
Plot/price_plot.py
<filename>Plot/price_plot.py import numpy as np import pandas as pd import matplotlib.pyplot as plt import csv import seaborn as sns hourtable = pd.read_csv('price_final.csv')['price'][0:30*24] csvfile = open('price_plot.csv','w', newline='') writer = csv.writer(csvfile, delimiter=',') writer.writerow(["Hour","price"]...
irasus-technologies/EnergyBoost
MPC/test.py
<reponame>irasus-technologies/EnergyBoost print(8/2)
irasus-technologies/EnergyBoost
Plot/roi_period.py
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import csv #hhids=[86, 59, 77, 26, 93, 101, 114, 171, 1086, 1403] # hhids=['1202', '871', '1103', '585', '59', '2755', '2233', '86', '114', '2575', '1700', '974', '1800', # '370', '187', '1169', '1718', '545', '94', '2018', '...
irasus-technologies/EnergyBoost
RL/solar_a2c_nonlinear.py
import gym import itertools import matplotlib import numpy as np import pandas as pd import sys import tensorflow as tf import collections import csv import os # from environment import EnergyEnvironment # # import matplotlib.pyplot as plt # import sklearn.pipeline # import sklearn.preprocessing # # if "../" not in sys...
irasus-technologies/EnergyBoost
Plot/calculate_rbc_all.py
<reponame>irasus-technologies/EnergyBoost<filename>Plot/calculate_rbc_all.py<gh_stars>0 import gym import itertools import matplotlib import numpy as np import pandas as pd import sys #import tensorflow as tf import collections import csv import os import pathlib from environment_bill_rbc import EnergyEnvironment impo...
irasus-technologies/EnergyBoost
Plot/calculate_roi.py
<filename>Plot/calculate_roi.py import pandas as pd import glob, os import csv import pathlib # Read in csv file os.chdir("roi_table_all/") for file in glob.glob("*.csv"): #create csv file pathlib.Path("ROI_Calculation").mkdir(parents=True, exist_ok=True) csvfile = open('ROI_Calculation/{}'.format(file),'...
irasus-technologies/EnergyBoost
Plot/calculate_bep.py
import pandas as pd import glob, os import csv import pathlib # Read in csv file os.chdir("roi_table_all/") for file in glob.glob("*.csv"): #create csv file pathlib.Path("BEP_Calculation").mkdir(parents=True, exist_ok=True) csvfile = open('BEP_Calculation/{}'.format(file),'w', newline='') writer = cs...
irasus-technologies/EnergyBoost
MPC/create_hourly_price_table.py
import pandas as pd import csv def create(): """ create hourly price table, read the the raw data with unix time convert to utc time with proper time zone :return: None """ df = pd.read_csv('/home/baihong/Documents/data/price.csv') csvfile = open("bill/price.csv",'w', newline='') w...
irasus-technologies/EnergyBoost
Plot/hour_table4.py
<reponame>irasus-technologies/EnergyBoost import pandas as pd import numpy as np import matplotlib.pyplot as plt import csv #hhids=[86, 59, 77, 26, 93, 101, 114, 171, 1086, 1403] hhids=['1202', '871', '1103', '585', '59', '2755', '2233', '86', '114', '2575', '1700', '974', '1800', '370', '187', '1169', '1718', '545',...
irasus-technologies/EnergyBoost
data_processing/get_predict_data.py
import csv,os,sys from sklearn.externals import joblib state=[] homeid= sys.argv[1].split("_")[4] clf_hl = joblib.load('saved_models/hl_rf_{}.pkl'.format(homeid)) clf_ac = joblib.load('saved_models/ghi_rf_{}.pkl'.format(homeid)) def init_ground_truth(datafile): print("init_ground_truth") if not os.path.exist...
irasus-technologies/EnergyBoost
RL/solar_ppo.py
import gym import itertools import matplotlib import numpy as np import pandas as pd import sys import tensorflow as tf import collections #from collections import namedtuple import csv import os #os.environ['KMP_DUPLICATE_LIB_OK']='True' from environment import EnergyEnvironment import matplotlib.pyplot as plt import...
irasus-technologies/EnergyBoost
data_processing/ghi_model.py
# coding: utf-8 # In[1]: import numpy as np import pandas as pd import glob from sklearn.externals import joblib from sklearn import ensemble from sklearn.preprocessing import MinMaxScaler, StandardScaler from sklearn.metrics import mean_squared_error, mean_absolute_error from sklearn.model_selection import train...
irasus-technologies/EnergyBoost
data_processing/generatepower.py
import pandas as pd import pvlib import csv import time as t import glob import os class EnvironmentToAC: def __init__(self): self.angle_selector = ['apparent_', ''] # Panel global position self.latitude = 30.2671500 self.longitude = -97.7430600 self.altitud...
irasus-technologies/EnergyBoost
Scripts/create-scipts.py
<gh_stars>0 #hhids=['101','2337','1086','1714','1283','252','2814','1202', '871', '1103', '2365', '585', '59', '2755', '2233', '86', '114', '2575', '1700', '974', '1800', '370', '187', '1169', '1718', '545', '94', '2018', '744', '2859', '2925', '484', '2953', '171', '2818', '1953', '1697', '1463', '499', '1790', '1507'...
irasus-technologies/EnergyBoost
Scripts/all_id.py
import glob, os hhids=[] for file in glob.glob("/home/baihong/Documents/sh/data_predicted2/*"): print(file) id=file.split("_")[3] print(id) hhids.append(id) # hhids.sort() print(hhids) # Alist=[] # for i in range(0,70,10): # Alist.append(hhids[i]) # print(Alist)
irasus-technologies/EnergyBoost
data_processing/raw_data_processing.py
# coding: utf-8 # In[1]: import pandas as pd import numpy as np from datetime import datetime # In[2]: solar_df = pd.read_csv('data_all/Solar.csv') print(solar_df.shape) solar_df.head(10) # In[3]: hh_df = pd.read_csv('data_all/all_data_raw.csv') print(hh_df.shape) hh_df.head(15) # In[4]: hh_df = hh_df[[...
irasus-technologies/EnergyBoost
MPC/create_tou_price.py
<reponame>irasus-technologies/EnergyBoost # !pip install -f https://download.mosek.com/stable/wheel/index.html Mosek #import mosek # !pip install cvxopt import cvxopt # !pip install cvxpy import cvxpy as cvx import gurobipy import numpy as np import pandas as pd import os,sys import csv import matplotlib.pyplot as ...
irasus-technologies/EnergyBoost
Plot/bill_table4.py
import pandas as pd import numpy as np import matplotlib.pyplot as plt import csv #hhids=[86, 59, 77, 26, 93, 101, 114, 171, 1086, 1403] hhids=['1202', '871', '1103', '585', '59', '2755', '2233', '86', '114', '2575', '1700', '974', '1800', '370', '187', '1169', '1718', '545', '94', '2018', '744', '2859', '2925', '484...
irasus-technologies/EnergyBoost
Plot/hour_vio4.py
<reponame>irasus-technologies/EnergyBoost import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import csv #hhids=[86, 59, 77, 26, 93, 101, 114, 171, 1086, 1403] hhids=['1202', '871', '1103', '585', '59', '2755', '2233', '86', '114', '2575', '1700', '974', '1800', '370', '187', ...
irasus-technologies/EnergyBoost
MPC/MPC2.py
# !pip install -f https://download.mosek.com/stable/wheel/index.html Mosek #import mosek # !pip install cvxopt import cvxopt # !pip install cvxpy import cvxpy as cvx import gurobipy import copy import numpy as np import pandas as pd import os,sys import csv import pathlib import matplotlib.pyplot as plt from sklear...
irasus-technologies/EnergyBoost
Baseline/get_baseline.py
<gh_stars>0 #import tensorflow as tf import numpy as np import pandas as pd import sys import os import csv import shutil import math import pathlib from environment_base import EnergyEnvironment MAX_EPISODES = 1 MAX_EP_STEPS = 24 * 30 LR_A = 1e-4 # learning rate for actor LR_C = 1e-4 # learning rate f...
irasus-technologies/EnergyBoost
Baseline/get_nosolar.py
<reponame>irasus-technologies/EnergyBoost<gh_stars>0 import tensorflow as tf import numpy as np import pandas as pd import sys import os import csv import shutil import math # from environment_nosolar import EnergyEnvironment # # MAX_EPISODES = 1 # MAX_EP_STEPS = 24 * 30 # LR_A = 1e-4 # learning rate for a...
irasus-technologies/EnergyBoost
MPC/battery_degradation.py
import numpy as np # parameter e = 4464 f = -0.1382 g = -1519 h = -0.4305 m = 5963 n = -0.6531 o = 321.4 p = 0.03168 q = 1471 s = 214.3 t = 0.6111 u = 0.3369 v = -2.295 # funtion of get fractional degradation def get_fractional_degradation(bt): """ Get get fractional degradation of battery :param bt: net e...
irasus-technologies/EnergyBoost
RL/environment_BD.py
# desired data result looks like (no EV right now): # Time(m/t), Cloud cover(o), GHI(ghi), Temperature(temp), Homeload(hl), Power generated(ac), Battery(b), weekday(w) # datetime, EV, o, ghi, temp, hl, ac, w, b import csv import os import numpy as np import pandas as pd from sklearn.externals import joblib fr...
irasus-technologies/EnergyBoost
Plot/violinplot_mpc.py
<gh_stars>0 import glob import csv import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns csvfile = open("violin/violin_mpc_sb4.csv", 'w', newline='') writer = csv.writer(csvfile, delimiter=',') writer.writerow(["Total electricity bill of one year ($)","PV system’s size (kWp)","Bat...
irasus-technologies/EnergyBoost
data_processing/feature_construction.py
<reponame>irasus-technologies/EnergyBoost # coding: utf-8 # In[1]: import pandas as pd import numpy as np # In[2]: input_file = pd.read_csv('home_ac/processed_hhdata_86_2.csv')[0:8640][['use','AC']] input_file.head(10) # In[3]: input_result = pd.read_csv('86_2/sb20b64.csv')[['Base_Soc','Base_Action']] input...
irasus-technologies/EnergyBoost
Plot/compile_bill_sce.py
<gh_stars>0 import pandas as pd import numpy as np import matplotlib.pyplot as plt import csv #hhids=[86, 59, 77, 26, 93, 101, 114, 171, 1086, 1403] hhids=[59] scenarios=["sb4b64","sb4b135","sb8b64","sb8b135","sb10b64","sb10b135","sb20b64","sb20b135"] #compile for j in scenarios: print("In scenarios",j) csvfil...
irasus-technologies/EnergyBoost
data_processing/hl_model.py
<filename>data_processing/hl_model.py # coding: utf-8 # In[1]: import numpy as np import pandas as pd import glob from sklearn.externals import joblib from sklearn import ensemble, tree from sklearn.preprocessing import MinMaxScaler, StandardScaler from sklearn.metrics import mean_squared_error, mean_absolute_err...