conda create -n yourenvname python=x.x anaconda
conda remove --name myenv --all
# Find python path | |
import os | |
import sys | |
os.path.dirname(sys.executable) | |
# Abs path of project: | |
os.path.dirname(os.path.abspath(__file__)) |
conda create -n yourenvname python=x.x anaconda
conda remove --name myenv --all
Terminal: conda install -c conda-forge jupyter_contrib_nbextensions conda install -c conda-forge jupyter_nbextensions_configuratorj
for i in value_in_dB: | |
print pow (10, float(i)/20) |
import time | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time.time() | |
result = method(*args, **kw) | |
te = time.time() | |
if 'log_time' in kw: | |
name = kw.get('log_name', method.__name__.upper()) | |
kw['log_time'][name] = int((te - ts) * 1000) |
def get_all_data(fp): | |
l = os.listdir(fp) | |
try: l.remove(".DS_Store") | |
except: pass | |
for i, fname in enumerate(l): | |
temp_df = pd.read_csv(fp + fname) | |
if (i == 0): | |
r = temp_df | |
else: | |
r = r.append(temp_df) |
from PyQt5.QtGui import QPainter, QPen, QFont | |
from PyQt5.QtWidgets import QAbstractButton, QSlider, QWidget, QVBoxLayout, QHBoxLayout,\ | |
QStyleOptionSlider, QStyle | |
from PyQt5.QtCore import Qt, QRect, QPoint | |
import numpy as np | |
class LabeledSlider(QWidget): | |
def __init__(self, minimum, maximum, interval=1, orientation=Qt.Horizontal, | |
labels=None, p0=0, parent=None): |
To rename a tab where you are : $psise.CurrentPowerShellTab.DisplayName = 'Dev'
To rename a remote tab, you need to do that from a local one (where the first tab is [0] ): $psise.PowerShellTabs[1].DisplayName = 'Remote-Server01'
def mse(imageA, imageB): | |
# the 'Mean Squared Error' between the two images is the | |
# sum of the squared difference between the two images; | |
# NOTE: the two images must have the same dimension | |
err = np.sum((imageA - imageB) ** 2) | |
err /= float(imageA.shape[0] * imageA.shape[1]) | |
# return the MSE, the lower the error, the more "similar" | |
# the two images are | |
return err |
"""1: Peak Detection""" | |
def envfol_peak_detection(sig, sr, chunk=4, order=6, lpfreq=150): | |
"""Envelope follower based on peak detection""" | |
s = sig.shape[0] // chunk | |
new_sig = np.array_split(np.abs(sig), s) | |
result = [] | |
for i in new_sig: | |
result.append(np.max(i)) | |
result = np.array(result) |