repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
tgbaozkn/seffaflik | seffaflik/elektrik/uretim.py | import pandas as __pd
import datetime as __dt
from multiprocessing import Pool as __Pool
import multiprocessing as __mp
from functools import reduce as __red
from seffaflik.__ortak.__araclar import make_requests as __make_requests
from seffaflik.__ortak import __dogrulama as __dogrulama
from seffaflik.elektrik import ... |
tgbaozkn/seffaflik | seffaflik/elektrik/piyasalar/dengesizlik.py | import pandas as __pd
import datetime as __dt
from seffaflik.__ortak import __dogrulama
from seffaflik.__ortak.__araclar import make_requests as __make_requests
__first_part_url = "market/"
def dengesizlik(baslangic_tarihi=__dt.datetime.today().strftime("%Y-%m-%d"),
bitis_tarihi=__dt.datetime.today()... |
tgbaozkn/seffaflik | seffaflik/elektrik/yekdem.py | import pandas as __pd
import datetime as __dt
from dateutil import relativedelta as __rd
from multiprocessing import Pool as __Pool
import multiprocessing as __mp
import requests as __requests
from seffaflik.__ortak.__araclar import make_requests as __make_requests
from seffaflik.__ortak import __dogrulama as __dogrul... |
tgbaozkn/seffaflik | seffaflik/elektrik/piyasalar/genel.py | <reponame>tgbaozkn/seffaflik
import pandas as __pd
import datetime as __dt
from multiprocessing import Pool as __Pool
import multiprocessing as __mp
from dateutil import relativedelta as __rd
from functools import reduce as __red
import calendar as __calendar
from seffaflik.__ortak.__araclar import make_requests as __... |
tgbaozkn/seffaflik | setup.py | <reponame>tgbaozkn/seffaflik
from setuptools import setup, find_packages
import seffaflik
with open("README.md", encoding="utf-8") as f:
long_description = f.read()
setup(
name="seffaflik",
version=seffaflik.__version__,
author='Dr. <NAME>',
author_email='<EMAIL>',
description="EPİAŞ tarafında... |
tgbaozkn/seffaflik | seffaflik/__init__.py | from seffaflik import elektrik
from seffaflik._kimlik import Kimlik
__version__ = "0.0.11"
|
tgbaozkn/seffaflik | seffaflik/elektrik/santraller.py | import pandas as __pd
import datetime as __dt
from dateutil import relativedelta as __rd
from multiprocessing import Pool as __Pool
import multiprocessing as __mp
from seffaflik.__ortak.__araclar import make_requests as __make_requests
from seffaflik.__ortak import __dogrulama as __dogrulama
__first_part_url = "produ... |
tgbaozkn/seffaflik | seffaflik/_kimlik.py | class Kimlik:
def __init__(self, istemci_taniticisi):
"""Api anahtarını `~/.seffaflik/.kimlik` içerisinde oluşturur.
:param istemci_taniticisi: Şeffaflık Platformuna kayıt olurken verilen api anahtarı
"""
from seffaflik.__ortak.__anahtar import HEADERS
import os as __os
... |
tgbaozkn/seffaflik | seffaflik/elektrik/piyasalar/yanhizmetler.py | <filename>seffaflik/elektrik/piyasalar/yanhizmetler.py
import pandas as __pd
import datetime as __dt
from seffaflik.__ortak.__araclar import make_requests as __make_requests
from seffaflik.__ortak import __dogrulama as __dogrulama
from functools import reduce as __red
__first_part_url = "market/"
def primer_sekonder... |
tgbaozkn/seffaflik | seffaflik/__ortak/__anahtar.py | <reponame>tgbaozkn/seffaflik<gh_stars>1-10
import os as __os
import json as __json
# from requests.compat import json as __json
HEADERS = {
'x-ibm-client-id': "",
'accept': "application/json"
}
if __os.path.exists(__os.path.join(__os.path.expanduser("~"), ".seffaflik/.kimlik")):
with open(__os.path.join(... |
tgbaozkn/seffaflik | seffaflik/elektrik/piyasalar/__init__.py | <gh_stars>1-10
from seffaflik.elektrik.piyasalar import dengesizlik, dgp, genel, gip, gop, ia, yanhizmetler
|
tgbaozkn/seffaflik | seffaflik/elektrik/piyasalar/dgp.py | <gh_stars>1-10
import pandas as __pd
import datetime as __dt
from seffaflik.__ortak.__araclar import make_requests as __make_requests
from seffaflik.__ortak import __dogrulama as __dogrulama
__first_part_url = "market/"
def smf(baslangic_tarihi=__dt.datetime.today().strftime("%Y-%m-%d"),
bitis_tarihi=__dt.d... |
tgbaozkn/seffaflik | seffaflik/__ortak/__init__.py | <reponame>tgbaozkn/seffaflik<filename>seffaflik/__ortak/__init__.py<gh_stars>1-10
from seffaflik.__ortak import __anahtar
|
tgbaozkn/seffaflik | seffaflik/__ortak/__dogrulama.py | <reponame>tgbaozkn/seffaflik
import datetime as __datetime
import logging as __logging
from seffaflik.__ortak import __parametreler as __param
def __baslangic_bitis_tarih_dogrulama(baslangic_tarihi, bitis_tarihi):
try:
ilk = __datetime.datetime.strptime(baslangic_tarihi, '%Y-%m-%d')
son = __dateti... |
tgbaozkn/seffaflik | seffaflik/elektrik/__init__.py | from seffaflik.elektrik import (piyasalar, santraller, tuketim, uretim)
|
tgbaozkn/seffaflik | seffaflik/elektrik/piyasalar/gip.py | import pandas as __pd
import datetime as __dt
from seffaflik.__ortak.__araclar import make_requests as __make_requests
from seffaflik.__ortak import __dogrulama as __dogrulama
__first_part_url = "market/"
def aof(baslangic_tarihi=__dt.datetime.today().strftime("%Y-%m-%d"),
bitis_tarihi=__dt.datetime.today()... |
tgbaozkn/seffaflik | seffaflik/elektrik/piyasalar/ia.py | import pandas as __pd
import datetime as __dt
from multiprocessing import Pool as __Pool
import multiprocessing as __mp
from functools import reduce as __red
import logging as __logging
from seffaflik.__ortak.__araclar import make_requests as __make_requests
from seffaflik.__ortak import __araclar as __araclar, __dogr... |
efeslab/ER | utils/visualize/randselect.py | <reponame>efeslab/ER<filename>utils/visualize/randselect.py
import json
import argparse
import random
from hase import PyGraph
def read_nodes(graph_json):
graph = json.load(open(graph_json))
h = PyGraph.buildFromPyDict(graph)
return list(h.gynodes)
if __name__ == "__main__":
parser = argparse.Argumen... |
efeslab/ER | utils/visualize/fakegynode.py | """
Used to convert dict type node(loaded from json) to a
"org.gephi.scripting.wrappers.GyNode" compatibale class.
"""
class FakeGyNode(object):
def __init__(self, nodeid, propdict):
self.__setattr__('id', nodeid)
for key, value in propdict.items():
self.__setattr__(key.lower(), value)
... |
efeslab/ER | utils/visualize/hase.py | <filename>utils/visualize/hase.py
#!/usr/bin/env python3
"""
How to reload this module:
import hase
hase.foo()
# modify source code
reload(hase)
# hase should be reloaded now
hase.foo()
Some Initialization process was copied from the preload.py (of scripting).
Nodes should already have an integ... |
Chiba9/keras-retinanet | keras_retinanet/preprocessing/mydata.py | import json
import cv2
import os
image_path = 'content
f = open('./665-verified.json')
content = f.read()
f.close()
mydic = json.loads(content)
cocodic = {}
f = open('./instances_train2017.json')
content = f.read()
f.close()
coco_example = json.loads(content)
#coco_example = cocodic
cocodic = {}
cocodic['categories... |
Chiba9/keras-retinanet | preprocess/compress.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 23 14:41:30 2019
@author: Chiba
"""
from PIL import Image
import argparse
import os
import sys
def parse_args(args):
parser = argparse.ArgumentParser(description='Compress image file to lower quality for pedestrain detection.')
parser.add... |
johangenis/flutter-chatbot | app.py | from flask import Flask, request, jsonify
# from flask import jsonify
import time
app = Flask(__name__)
@app.route("/bot", method=["POST"])
# response
def response():
query = dict(request.form)['query']
result = query + " " + time.ctime()
return jsonify({"response" : result})
if __name__ == "__main__":
... |
radifar/simulat.io | backend/apps/moldb/apps.py | <gh_stars>1-10
from django.apps import AppConfig
class MoldbConfig(AppConfig):
name = 'moldb'
|
radifar/simulat.io | backend/apps/mol_docking/apps.py | <gh_stars>0
from django.apps import AppConfig
class MolDockingConfig(AppConfig):
name = 'mol_docking'
|
radifar/simulat.io | backend/config/urls.py | from django.urls import path
from django.contrib import admin
from django.contrib.auth import logout
from django.conf import settings
from django.views.decorators.csrf import csrf_exempt
from ariadne.contrib.django.views import GraphQLView
from .schema import schema
urlpatterns = [
path('admin/', admin.site.ur... |
radifar/simulat.io | backend/apps/mol_dynamics/apps.py | from django.apps import AppConfig
class MolDynamicsConfig(AppConfig):
name = 'mol_dynamics'
|
radifar/simulat.io | backend/config/schema.py | from ariadne import ObjectType, MutationType, make_executable_schema, gql
from apps.movies.models import Actor, Movie
type_defs = gql("""
type Actor {
id: ID!
name: String!
}
type Movie {
id: ID!
title: String!
... |
imagingofthings/ImoT_tools | imot_tools/math/sphere/interpolate.py | <filename>imot_tools/math/sphere/interpolate.py
# ##############################################################################
# interpolate.py
# ==============
# Author : <NAME> [<EMAIL>]
# ##############################################################################
"""
Interpolation algorithms.
"""
import numpy... |
imagingofthings/ImoT_tools | imot_tools/math/linalg.py | # ##############################################################################
# linalg.py
# =========
# Author : <NAME> [<EMAIL>]
# ##############################################################################
"""
Linear algebra routines.
"""
import numpy as np
import scipy.linalg as linalg
import imot_tools.uti... |
imagingofthings/ImoT_tools | imot_tools/io/plot.py | <gh_stars>1-10
# ############################################################################
# plot.py
# =======
# Author : <NAME> [<EMAIL>]
# ############################################################################
"""
`Matplotlib <https://matplotlib.org/>`_ helpers.
"""
import pathlib
import matplotlib.axes a... |
imagingofthings/ImoT_tools | imot_tools/phased_array/__init__.py | # #############################################################################
# __init__.py
# ===========
# Author : <NAME> [<EMAIL>]
# #############################################################################
"""
Phased-Array Signal Processing tools.
"""
import numpy as np
import scipy.linalg as linalg
import... |
imagingofthings/ImoT_tools | imot_tools/math/sphere/__init__.py | <gh_stars>1-10
# ##############################################################################
# __init__.py
# ===========
# Author : <NAME> [<EMAIL>]
# ##############################################################################
"""
Spherical geometry tools.
"""
|
imagingofthings/ImoT_tools | imot_tools/util/array.py | # #############################################################################
# array.py
# ========
# Author : <NAME> [<EMAIL>]
# #############################################################################
"""
Tools and utilities for manipulating arrays.
"""
def index(x, axis, index_spec):
"""
Form index... |
imagingofthings/ImoT_tools | imot_tools/math/stat.py | <gh_stars>1-10
# #############################################################################
# stat.py
# =======
# Author : <NAME> [<EMAIL>]
# #############################################################################
"""
Statistical functions not available in `SciPy <https://www.scipy.org/>`_.
"""
import numpy ... |
imagingofthings/ImoT_tools | imot_tools/math/func.py | # #############################################################################
# func.py
# =======
# Author : <NAME> [<EMAIL>]
# #############################################################################
"""
1D functions not available in `SciPy <https://www.scipy.org/>`_.
"""
import warnings
import numpy as np
i... |
imagingofthings/ImoT_tools | doc/conf.py | <filename>doc/conf.py
# #############################################################################
# conf.py
# =======
# Author : <NAME> [<EMAIL>]
# #############################################################################
import configparser
import datetime
import pathlib
import re
from typing import Mapping
... |
imagingofthings/ImoT_tools | imot_tools/math/sphere/transform.py | <reponame>imagingofthings/ImoT_tools
# ##############################################################################
# transform.py
# ============
# Author : <NAME> [<EMAIL>]
# ##############################################################################
"""
Coordinate transforms.
"""
import astropy.coordinates as ... |
imagingofthings/ImoT_tools | imot_tools/math/special.py | # ##############################################################################
# special.py
# ==========
# Author : <NAME> [<EMAIL>]
# ##############################################################################
"""
Special mathematical functions.
"""
import pathlib
import numpy as np
import pandas as pd
import ... |
imagingofthings/ImoT_tools | imot_tools/math/sphere/grid.py | # ##############################################################################
# grid.py
# =======
# Author : <NAME> [<EMAIL>]
# ##############################################################################
"""
Tesselation schemes.
"""
import astropy.coordinates as coord
import astropy.units as u
import healpy
imp... |
imagingofthings/ImoT_tools | imot_tools/io/s2image.py | <reponame>imagingofthings/ImoT_tools
# #############################################################################
# s2image.py
# ==========
# Author : <NAME> [<EMAIL>]
# #############################################################################
r"""
Visualization and storage of images on :math:`\mathbb{S}^{2}`.
... |
imagingofthings/ImoT_tools | imot_tools/util/argcheck.py | # #############################################################################
# argcheck.py
# ===========
# Author : <NAME> [<EMAIL>]
# #############################################################################
"""
Helper functions to ease argument checking.
"""
import collections.abc as abc
import functools
imp... |
imagingofthings/ImoT_tools | imot_tools/util/__init__.py | # #############################################################################
# __init__.py
# ===========
# Author : <NAME> [<EMAIL>]
# #############################################################################
"""
General utilities and development tools.
"""
|
jaakjensen/PythonDSP | 14_conv_verb_rt60.py | <gh_stars>1-10
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
###############################################################################
###############################################################################
def convolutionReverb ():
return 0
####################... |
jaakjensen/PythonDSP | vafilterdesign/plot_zplane.py | #
# Copyright (c) 2011 <NAME>
#
# This program 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 later version.
#
# This program is distributed i... |
jaakjensen/PythonDSP | graphing/27_impactOfFFTSize.py | <filename>graphing/27_impactOfFFTSize.py
from scipy.fft import fft, fftfreq
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from scipy.signal import hann
# Number of sample points
N1 = 256
N2 = 512
N3 = 4096
# sample spacing
Fs = 48000
T = 1.0 / Fs
#X axis
x1 = np.linspace(0.0, N1*T, N1, en... |
jaakjensen/PythonDSP | graphing/26_impactOfWindowOnFFT.py | <gh_stars>1-10
from scipy.fft import fft, fftfreq
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from scipy.signal import hann
# Number of sample points
N = 1024
# sample spacing
Fs = 48000
T = 1.0 / Fs
#X axis
x = np.linspace(0.0, N*T, N, endpoint=False)
#Signal
y = np.cos(2.0*np.pi*x*500... |
jaakjensen/PythonDSP | graphing/xx_graphingimpulseresponse.py | import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
wav_fname = 'dspfiles/fostex16_441.wav'
fs, data = wav.read(wav_fname)
Ts = 1/fs
timelength = data.shape[0] / fs
samplelength = data.shape[0]
print(f"timelength = {timelength}s")
# Divide audio signal by max int value for signed 1... |
jaakjensen/PythonDSP | 10_arctandistortion.py | <reponame>jaakjensen/PythonDSP
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
def arcTanSaturation(inputsig, gain):
#Saturate the output signal using ArcTan clipping
out = (2/np.pi)*np.arctan(gain*inputsig)
return out
wav_fname = 'textbookcode/Ch_03/sw440hz.wav'
f... |
jaakjensen/PythonDSP | 12_biquadlpf.py | <reponame>jaakjensen/PythonDSP
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
######################################################################
######################################################################
##############################################################... |
jaakjensen/PythonDSP | graphing/31_fftExactFrequencyCalculation.py | <reponame>jaakjensen/PythonDSP<filename>graphing/31_fftExactFrequencyCalculation.py
# Use this animation to calculate the exact
# frequency of a signal in a bin.
# Press 'k' and 'l' keys to raise and lower
# the frequency of the cosine wave.
from scipy.fft import fft, fftfreq
import numpy as np
from scipy import signal... |
jaakjensen/PythonDSP | graphing/9_twoseriesfirlpfs.py | import numpy as np
from scipy import signal
# 1 sample delay: u[n] = x[n] + x[n-1]
# 1 sample delay: y[n] = u[n] + u[n-1]
# Final equation: y[n] = x[n] + x[n-1] + x[n-1] + x[n-2]
# y[n] = x[n] + 2*x[n-1] + x[n-2]
# Two series LPFs with the system gain normalized
b = [0.25,0.5,0.25]
# Single LPF diffe... |
jaakjensen/PythonDSP | graphing/18_fftsaturationaliasing.py | from scipy.fft import fft, fftfreq
import numpy as np
import matplotlib.pyplot as plt
#Chebyshev Filter Coefficients
b = [ 0.00757702, -0.02666634, 0.06433529, -0.09739344, 0.11965053, -0.10339635,
0.07472005, -0.0214037, -0.0214037, 0.07472005, -0.10339635, 0.11965053,
-0.09739344, 0.06433529, -0.02666634, ... |
jaakjensen/PythonDSP | graphing/6_fircombvariabledelaynegativegain.py | import numpy as np
from scipy import signal
# 3 sample delay: y[n] = x[n] - x[n-3]
b = [1,0,0,-1]
# 4 sample delay: y[n] = x[n] - x[n-4]
b1 = [1,0,0,0,-1]
# 5 sample delay: y[n] = x[n] - x[n-5]
b2 = [1,0,0,0,0,-1]
# Sampling frequency = 2
w, h = signal.freqz(b, fs=2)
w1, h1 = signal.freqz(b1, fs=2)
w2, h2 = signa... |
jaakjensen/PythonDSP | 6_labelstitleslegend.py | <filename>6_labelstitleslegend.py
import matplotlib.pyplot as plt
import numpy as np
fig, axes = plt.subplots(nrows=1,ncols=1)
t = np.linspace(0, 2*np.pi,25)
a = np.sin(t)
axes.plot(t,a, color='red', marker = 'o', label = 'sin(t)')
axes.plot(t,3*a, color='blue', marker = 'o', label = '3*sin(t)')
axes.set_title('... |
jaakjensen/PythonDSP | vafilterdesign/2_zPlane3d.py | import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
#Define your function here. Use z^-1 form.
#If len(a) != len(b), don't append the smaller
#len array with zeros
a = [0.0798,0.0798,0.0798,0.0798]
b = [1,-1.556,1.272,-0.398]
zero,pole,gain = signal.tf2zpk(a,b)
print(f'Zeroes = {np.abs(zero)}'... |
jaakjensen/PythonDSP | graphing/1_basicfirlpf.py | import numpy as np
from scipy import signal
# Filter function: y[n] = x[n] + x[n-1]
b = [1,1]
# Sampling frequency = 2
w, h = signal.freqz(b, fs=2)
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots()
ax1.set_title('Digital filter frequency response')
ax1.plot(w, 20 * np.log10(abs(h)), 'b')
ax1.set_ylabel('Ma... |
jaakjensen/PythonDSP | 9_vibratoexample.py | <reponame>jaakjensen/PythonDSP
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
########################################################################################
########################################################################################
def vibratoEffect(input... |
jaakjensen/PythonDSP | 29_nicePitchShifter.py | <reponame>jaakjensen/PythonDSP
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
wav_fname = 'dspfiles/BibioGuitar.wav'
fs, inputSignal = wav.read(wav_fname)
Ts = 1/fs
semitones = 7 #how many semitones do we increase by?
tr = 2**(semitones/12)
dRate = 1 - tr ... |
jaakjensen/PythonDSP | 28_naivePitchShifter.py |
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
wav_fname = 'dspfiles/BibioGuitar.wav'
fs, inputSignal = wav.read(wav_fname)
Ts = 1/fs
semitones = 7 #how many semitones do we increase by?
tr = 2**(semitones/12)
dRate = 1 - tr #Delay rate of change
#Ini... |
jaakjensen/PythonDSP | 18_apfExample.py |
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
########################################################################################
########################################################################################
def apf(inputsignal, audioBuffer, fs, n, delay, gain, a... |
jaakjensen/PythonDSP | 3_basic2darraycreation.py | <gh_stars>1-10
import numpy as np
mat1 = np.array([[1,2,3],[4,5,6]])
mat2 = np.array([[1,2],[3,4],[5,6]])
mat3 = np.concatenate((mat1, [[7,8,9]]), axis = 0)
mat4 = np.concatenate((mat2, [[7,8]]), axis = 0)
print(f'{mat1}\n')
print(f'{mat2}\n')
print(f'{mat3}\n')
print(f'{mat4}\n')
|
jaakjensen/PythonDSP | vafilterdesign/1_basicZplane.py | <reponame>jaakjensen/PythonDSP
import numpy as np
from scipy import signal
from plot_zplane import zplane
import matplotlib.pyplot as plt
b = np.array([2,2])
a = np.array([1,-1.25])
zplane(b,a)
|
jaakjensen/PythonDSP | graphing/12_iirfeedbackwithvargain.py | import numpy as np
from scipy import signal
# 1 sample delay: y[n] = x[n] + A * y[n-1]
b = [1]
a = [1,0]
a1 = [1,0.25]
a2 = [1,0.5]
a3 = [1,0.75]
a4 = [1,1]
# Sampling frequency = 2
w, h = signal.freqz(b, a, fs=2)
w1, h1 = signal.freqz(b, a1, fs=2)
w2, h2 = signal.freqz(b, a2, fs=2)
w3, h3 = signal.freqz(b, a3, fs=2)... |
jaakjensen/PythonDSP | graphing/20_graphingStateVariableFilters.py | import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
# 1 Pole LP Filter: H(s) = 1 / (1+s)
b1 = [1]
a1 = [1, 1]
# 2 Pole LP Filter: H(s) = 1 / (s^2 + 2s + 1)
b2 = [1]
a2 = [1, 2, 1]
# 3 Pole LP Filter: H(s) = 1 / (s^3 + 3s^2 + 3s + 1)
b3 = [1]
a3 = [1, 3, 3, 1]
# 4 Pole LP Filter: H(s) = 1 / ... |
jaakjensen/PythonDSP | graphing/29_fftAnimationFrequency.py | <reponame>jaakjensen/PythonDSP
# Use this animation to show that the
# bin reaches its peak when the input
# signal reaches the bin frequency.
# When you're between bin frequencies,
# the energy spills between adjacent bins
# and the amplitude of the two adjacent
# bins is lower.
from scipy.fft import fft, fftfreq
impo... |
jaakjensen/PythonDSP | graphing/11_basiciirhpf.py | import numpy as np
from scipy import signal
# 1 sample delay: y[n] = beta * x[n] - alpha * y[n-1]
beta = 0.1
alpha = 1-beta
b = [beta]
a = [1, alpha]
beta = 0.5
alpha = 1-beta
b1 = [beta]
a1 = [1, alpha]
beta = 0.9
alpha = 1-beta
b2 = [beta]
a2 = [1, alpha]
# Sampling frequency = 2
w, h = signal.freqz(b, a, fs=2)
w... |
jaakjensen/PythonDSP | 13_conv_verb.py |
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
from scipy import signal
#wet or dry mix from 0 to 1
wet_dry = 1
#Setup for impulse response:
wav_fname1 = 'dspfiles/Flashy808.wav'
fs1, data1 = wav.read(wav_fname1)
Ts1 = 1/fs1
timelength1 = data1.shape[0] / fs1
samplelength1 = data1... |
jaakjensen/PythonDSP | graphing/25_biquadhpf.py | import numpy as np
from scipy import signal
# y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2] - ...
# (a1/a0)*y[n-1] - (a2/a0)*y[n-2]
Fs = 48000
cutoff = 200
Q = 0.707
dBGain = -10
#Intermediate variables
w0 = 2*np.pi*cutoff/Fs # Angular freq. (radians/sample)
alpha = np.sin(w0)/(2*Q) ... |
jaakjensen/PythonDSP | graphing/19_fftsaturationaliasing2.py | from scipy.fft import fft, fftfreq
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from scipy.signal import blackman
from scipy.signal import hann
#Chebyshev Filter Coefficients
sos = signal.cheby2(10, 100, 0.25, 'low', output='sos')
#print(sos)
#print(np.shape(sos))
for n in sos:
#p... |
jaakjensen/PythonDSP | 8_wavwriteexample.py | <reponame>jaakjensen/PythonDSP
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
wav_fname = 'textbookcode/Ch_03/sw440hz.wav'
fs, data = wav.read(wav_fname)
length = data.shape[0] / fs
print(f"length = {length}s")
# Divide audio signal by max int value for signed 16 bit number
dat... |
jaakjensen/PythonDSP | graphing/32_fftPitchShifting.py | # Use this code to pitch shift an audio signal
# using the STFT.
from scipy.fft import fft, ifft, fftfreq
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from scipy.signal import hann
from scipy.signal import sawtooth
import sys
#suppress the sometimes-annoying sci-notation
np.set_printoptio... |
jaakjensen/PythonDSP | graphing/17_chebyshev2lpf.py | import numpy as np
from scipy import signal
sos = signal.cheby2(10, 100, 0.125, 'low', output='sos')
print(sos)
# Sampling frequency = Fs
w, h = signal.sosfreqz(sos, fs=2)
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots(3)
ax1[0].set_title('Digital filter frequency response')
ax1[0].plot(w, 20 * np.log10(a... |
jaakjensen/PythonDSP | 5_stemplots.py |
import matplotlib.pyplot as plt
import numpy as np
fig, axes = plt.subplots(nrows=2,ncols=1)
t = np.linspace(0, 2*np.pi,25)
a = np.sin(t)
axes[0].stem(t,a, use_line_collection = True, label = 'My function')
axes.set_title('My Stem Plot')
axes.set_xlabel('Time')
axes.set_ylabel('Amplitude')
ax.legend(loc = 0)
plt... |
jaakjensen/PythonDSP | 22_moorerReverb.py | <reponame>jaakjensen/PythonDSP
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
#########################################################################
#########################################################################
def apf(inputsignal, audioBuffer, fs, n, delay, gain, a... |
jaakjensen/PythonDSP | 30_fftPitchShiftingAudio.py | # Use this code to pitch shift an audio signal
# using the STFT.
from scipy.fft import fft, ifft, fftfreq
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from scipy.signal import hann
from scipy.signal import sawtooth
import sys
import scipy.io.wavfile as wav
from tqdm import tqdm
#suppress... |
jaakjensen/PythonDSP | 1_basicmath.py |
import numpy as np
#the square root of a number
print(np.sqrt(100))
#the absolute value of a number
print(np.abs(-9))
#log base 10 of a number
print(np.log10(100))
#cos of a number in radians
print(np.cos(0))
#arcsin of a number in radians
print(np.arcsin(1))
#exponential of a number
print(np.exp(1))
#sign of a... |
jaakjensen/PythonDSP | graphing/15_apflowfrequencyshift.py | import numpy as np
from scipy import signal
# gain must be less than 1
# to maintain stability
g = 0.5
# Difference equation:
# y[n] = x[n] - g*x[n-1]
b = [1,-g]
a = [1]
# y[n-1] - g*y[n] = x[n]
# y[n] = 1/g * (y[n-1] - x[n])
b1 = [1]
a1 = [-g,1]
# y[n] = g * x[n] + x[n-1] - g * y[n-1]
b2 = [1,-g]
a2 = [-g,1]
# ... |
jaakjensen/PythonDSP | 2_basicarraycreation.py | <filename>2_basicarraycreation.py
import numpy as np
arr = np.array([[5]])
rowVec = np.array([[1,2,3,4]])
colVec = np.array([[1],[2],[3],[4]])
charVec = np.array(['h','e','l','l','o'])
strCol = np.array([['one'],['two']])
strErr = np.array([['one'],['two'],['three']])
strRow1 = np.array(['one','two','three'])
... |
jaakjensen/PythonDSP | 4_functionplots.py |
import matplotlib.pyplot as plt
import numpy as np
fig, axes = plt.subplots(nrows=2,ncols=1)
m = 3
b = 1
x = np.array([0,1,2,3])
y = np.array([(m*0+b),(m*1+b),(m*2+b),(m*3+b)])
axes[0].plot(x, y, color='b',ls='-',lw=4)
t = np.linspace(0, 2*np.pi,25)
a = np.sin(t)
axes[1].plot(t, a, color='r',ls='--',lw=2)
pl... |
jaakjensen/PythonDSP | graphing/22_smithangellresonator.py | <reponame>jaakjensen/PythonDSP<filename>graphing/22_smithangellresonator.py<gh_stars>1-10
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
# y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2] - ...
# (a1/a0)*y[n-1] - (a2/a0)*y[n-2]
Fs = 48000
cutoff = 2000
Q = 40
dBGain = 6
#... |
jaakjensen/PythonDSP | graphing/xx_reverbLPF.py | <filename>graphing/xx_reverbLPF.py<gh_stars>1-10
import numpy as np
from scipy import signal
# 1 sample delay: y[n] = x[n] + y[n-1]
b = [0.25]
a = [1, 0.75]
# Sampling frequency = 2
w, h = signal.freqz(b, a, fs=2)
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots(2)
ax1[0].set_title('Digital filter frequency ... |
jaakjensen/PythonDSP | graphing/8_fircombgreaterthan1gain.py | import numpy as np
from scipy import signal
# 3 sample delay: y[n] = x[n] + B * x[n-3]
b = [1,0,0,0.5]
b1 = [1,0,0,2]
# Sampling frequency = 2
w, h = signal.freqz(b, fs=2)
w1, h1 = signal.freqz(b1, fs=2)
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots(2)
ax1[0].set_title('Digital filter frequency response')... |
jaakjensen/PythonDSP | 27_infiniteReverbPuckettelpf.py | <reponame>jaakjensen/PythonDSP
import matplotlib.pyplot as plt
import numpy as np
import scipy.io.wavfile as wav
#########################################################################
#########################################################################
def apf(inputsignal, audioBuffer, fs, n, delay, gain, a... |
KateWenqiZhu/exercise_1 | polynomials/test/test_polynomial.py | from polynomials import Polynomial
import pytest
def test_print():
p = Polynomial((2, 1, 0, 3))
assert str(p) == "3x^3 + x + 2"
f = Polynomial((1, 1, 0, 4, 5))
assert str(f) == "5x^4 + 4x^3 + x + 1"
f1 = Polynomial((0, 0, 0))
assert str(f1) == "0"
def test_equality():
asser... |
KateWenqiZhu/exercise_1 | polynomials/polynomials/__init__.py | <reponame>KateWenqiZhu/exercise_1
from .polynomial import Polynomial |
KateWenqiZhu/exercise_1 | polynomials/polynomials/polynomial.py | <gh_stars>0
from numbers import Number
class Polynomial:
def __init__(self, coefs):
self.coefficients = coefs
def degree(self):
return len(self.coefficients) - 1
def __str__(self):
coefs = self.coefficients
terms = []
# Degree 0 and 1 terms conventionally have di... |
CWKevo/python-invidious-api-client | invidious_api_client/__init__.py | <reponame>CWKevo/python-invidious-api-client
from typing import TYPE_CHECKING
from .client import InvidiousClient
from .models.instances import get_instances, choose_instance
# To not report "unused import" warnings." by linter:
if TYPE_CHECKING:
_ = [
InvidiousClient,
get_instances, choose_inst... |
CWKevo/python-invidious-api-client | tests/test_video.py | from invidious_api_client import InvidiousClient
def test_video():
CLIENT = InvidiousClient()
video = CLIENT.get_video('dQw4w9WgXcQ')
assert video.video_id == 'dQw4w9WgXcQ'
if __name__ == "__main__":
test_video()
|
CWKevo/python-invidious-api-client | tests/test_instances.py | from invidious_api_client import get_instances
def test_instances():
for instance in get_instances().instances:
print(f"{instance.uri} ({instance.region}, {f'{instance.monitor.month_ratio.ratio} % uptime in the last month' if instance.monitor else '[no monitor data]'})")
if __name__ == "__main__":
... |
CWKevo/python-invidious-api-client | invidious_api_client/models/__init__.py | <reponame>CWKevo/python-invidious-api-client<gh_stars>1-10
import typing as t
from datetime import datetime
class BaseInvidiousData:
"""
Base Invidious JSON data class.
"""
def __init__(self, data: t.Union[dict, list] = {}) -> None:
self.data = data
"""The data of the object."""... |
CWKevo/python-invidious-api-client | invidious_api_client/client.py | import typing as t
from requests import Session
from .models import BaseInvidiousData, RYDData
from .models.instances import Instance, choose_instance
from .models.videos import YoutubeVideo
from .models.comments import Comments
_RCLS = t.TypeVar('_RCLS', bound=t.Type[BaseInvidiousData])
class InvidiousClient... |
CWKevo/python-invidious-api-client | invidious_api_client/models/comments.py | import typing as t
from datetime import datetime
from invidious_api_client.models import BaseInvidiousData
class Comments(BaseInvidiousData):
"""
Data of comments for a video.
"""
@property
def continuation(self) -> str:
"""
The unique continuation token.
"""
... |
CWKevo/python-invidious-api-client | invidious_api_client/models/videos.py | import typing as t
from datetime import datetime
from invidious_api_client.models import BaseInvidiousData
class YoutubeVideo(BaseInvidiousData):
"""
A YouTube video.
"""
@property
def type(self) -> str:
"""
The type of the data. This should be always `"video"`.
"... |
CWKevo/python-invidious-api-client | invidious_api_client/models/instances.py | import typing as t
import requests
from datetime import datetime
from functools import lru_cache
from invidious_api_client.models import BaseInvidiousData
class Instance(BaseInvidiousData):
"""
Invidious instance data.
"""
class InstanceStats(BaseInvidiousData):
"""
Invid... |
CWKevo/python-invidious-api-client | setup.py | <reponame>CWKevo/python-invidious-api-client
from pathlib import Path
import sys
sys.path.append('.')
import setuptools
__description__ = "Invidious API Client"
__author__ = "SKevo"
__copyright__ = "Copyright (c) 2021, SKevo"
__credits__ = ["SKevo"]
__license__ = "MIT"
__version__ = "v1.0.0-beta"... |
CWKevo/python-invidious-api-client | tests/test_get_comments.py | <reponame>CWKevo/python-invidious-api-client<filename>tests/test_get_comments.py<gh_stars>1-10
from invidious_api_client import InvidiousClient
def test_comments():
CLIENT = InvidiousClient(additional_parameters={'hl': 'de'})
comments = CLIENT.get_comments('9bZkp7q19f0')
assert comments.video_id == '9bZk... |
CWKevo/python-invidious-api-client | examples/get_all_comments.py | """
Current, the length of comment continuation token increases over time to the point
where the request is aborted with `414 Request-URI Too Large` error.
This might be a bug in the API, or a Google bug. Either way or not, mass scraping of comments seems
impossible right now. If you know a workaround,... |
RafaelLJC/pythonbirds | oo/carro.py | <reponame>RafaelLJC/pythonbirds
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 21 16:41:09 2020
@author: rafae
Exercício
Você deve criar uma classe carro que vai possuir dois atributos
compostos por outras duas classes:
1) motor;
2) Direção.
O motor terá a responsabilidade de controlar a velocidade.
Ele oferece o... |
RafaelLJC/pythonbirds | oo/teste_carro.py | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 10:36:21 2020
@author: rafae
"""
from unittest import TestCase
from oo.carro import Motor
class CarroTestCase(TestCase):
def teste_velocidade_inicial(self):
motor = Motor()
self.assertEqual(0, motor.velocidade) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.