Skip to content

Instantly share code, notes, and snippets.

View avivajpeyi's full-sized avatar
🦥

Avi Vajpeyi avivajpeyi

🦥
View GitHub Profile
@avivajpeyi
avivajpeyi / .bash_prompt.sh
Created November 25, 2019 23:37 — forked from miki725/.bash_prompt.sh
Custom bash prompt which displays: (virtualenv) user:/path (git-branch)
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git/mercurial repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@avivajpeyi
avivajpeyi / waveform_plotting.py
Last active July 1, 2020 06:31
Python script to plot gravitational wave waveforms.
"""Module to plot Gravitational Wave Templates
Can be used to test if a waveform approximant works or not.
"""
from __future__ import division, print_function
import bilby
import matplotlib.pyplot as plt
from stack import Stack
def lecuture_test_1():
out_string = ""
int_stack = Stack()
int_stack.push(1)
int_stack.push(2)
out_string += f"{int_stack.pop()} , "
int_stack.push(3)
"""
Match the error with the function
a. TypeError
b. AttributeError
c. IndexError
d. ValueError (error 1)
e. ZeroDivisionError
f. IndentationError
More error types:
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits import mplot3d
# Defining the functions and its first derivative
def f(x):
return x ** 3 - 2 * x ** 2 - 11 * x + 12
"""
Completed backtracking code for week11, demonstrating bike-lock combos
Author: Gavin
Modifed by: Avi
"""
import itertools
from typing import List
from typing import List, Optional
import seaborn as sns
def get_colors(num_colors: int, alpha: Optional[float]=1) -> List[List[float]]:
"""Get a list of colorblind colors,
:param num_colors: Number of colors.
:param alpha: The transparency
:return: List of colors. Each color is a list of [r, g, b, alpha].
"""
"""Demo of Matched Filtering"""
from typing import Callable, Dict, Optional
import matplotlib.pyplot as plt
import numpy as np
import plotly.graph_objects as go
import scipy.signal
from plotly.subplots import make_subplots
N_POINTS = 1000
@avivajpeyi
avivajpeyi / publication.mplstyle
Last active June 14, 2021 03:44
Matplotlib publication stylesheet
### FIGURE
figure.facecolor: white
figure.dpi: 300
figure.titlesize: x-large # fontsize of the axes title
figure.titleweight: bold
### LINES
lines.linewidth: 1.5
### PATCHES
#%% md
# Plot signal
#%%
import bilby
import matplotlib.pyplot as plt
import numpy as np