Skip to content

Instantly share code, notes, and snippets.

🌮

Dhruv Shah PrieureDeSion

🌮
Block or report user

Report or block PrieureDeSion

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@PrieureDeSion
PrieureDeSion / MDP_planner.py
Last active Sep 27, 2018
MDP Planning using Howard's Policy Iteration and as a Linear Program
View MDP_planner.py
"""
File: planner.py
Author: Dhruv Ilesh Shah. CS 747, Autumn 2018.
Indian Institute of Technology, Bombay.
Date created: 8/30/2018
Date last modified: 9/07/2018
Python Version: 2.7.12
This file contains two ways of solving an MDP planning problem: (i) using Howard's PI (Howard, 1960)
or (ii) by posing it as a linear program. The PuLP package has been used to solve the linear system
@PrieureDeSion
PrieureDeSion / compute_RIC.m
Created May 28, 2018
Compute the restricted isometry constant (RIC) of a matrix at a specified sparsity level. Note that this is a certified NP-hard problem and only computationally tractable for small values of s (upto 4 or 5).
View compute_RIC.m
function out = compute_RIC(A, s)
% This function computes the Restricted Isometry Constant of given matrix A
% at sparsity level s.
% Written by Alankar Kotwal (alankarkotwal13@gmail.com), Dhruv Shah (dhruv.ilesh@gmail.com)
A = normc(A);
nT = size(A, 2);
combs = combnk(1:nT, s);
out = 0;
disp(size(combs, 1))
@PrieureDeSion
PrieureDeSion / dtft_fir_filter.m
Created Mar 26, 2018
Generate the DTFT of Window Functions in FIR Filter Design
View dtft_fir_filter.m
%% Discrete time Fourier Transform of FIR filters
% Generate the DTFT of Window Functions in FIR Filter Design. For a custom
% window, define the window function and use the following snippets as is.
% Written by Dhruv Ilesh Shah (dhruv.shah@iitb.ac.in)
clear all; close all;
N = 100;
k = -N:N;
hamming_window = 0.54 + (0.46 * cos(2*pi*k / (2 * N)));
bartlett_window = 1 - (abs(k) / N);
@PrieureDeSion
PrieureDeSion / odom_to_path.py
Last active Apr 11, 2019
ROS Node for converting nav_msgs/odometry messages to nav_msgs/Path
View odom_to_path.py
#!/usr/bin/env python
from __future__ import print_function
import rospy
from tf.transformations import quaternion_from_euler
from std_msgs.msg import String
from nav_msgs.msg import Odometry, Path
from geometry_msgs.msg import PoseWithCovarianceStamped, PoseStamped
from sensor_msgs.msg import Joy
import sys
import json
@PrieureDeSion
PrieureDeSion / frequency_confusion.m
Created Feb 24, 2018
Visualise frequency confusing/aliasing due to sampling of a pure sinusoid as a video.
View frequency_confusion.m
clear all; close all;
n = [0:0.1:50];
w = pi/2;
Ts = 0.2;
ks = [-200:200];
y = zeros(size(n))
frame_count = 1;
@PrieureDeSion
PrieureDeSion / lloyd-max.py
Created Nov 24, 2017
Lloyd Max Quantizer for optimal quantization of a random variable demonstrating a Gaussian PDF
View lloyd-max.py
"""
Lloyd Max Quantizer
This program implements a midrise lloyd-max quantizer, for optimal
quantization of a random variable demonstrating a Gaussian PDF.
The clustering mechanism used here equivalent to k-Means clustering.
Author: Dhruv Ilesh Shah
EE308 - Communication Systems, Autumn 2017
Indian Institute of Technology, Bombay
"""
View fft_omp.cpp
# include <cstdlib>
# include <iostream>
# include <iomanip>
# include <cmath>
# include <ctime>
# include <omp.h>
using namespace std;
int main ( void );
View matmul_multithreaded.c
/*
Pure C code for multi-threaded matrix mutliplication of two
dynamically created and randomly instiated matrices.
Two different mutli-threading strategies are implemented, along
with the non-threaded multiplication kernel for comparison.
The functions are timed using system time.
CS347(M): Operating Systems, IIT Bombay (Autumn 2017)
*/
@PrieureDeSion
PrieureDeSion / udp_listener.py
Created Aug 27, 2017
Capture UDP packets on a port in JSON-like format.
View udp_listener.py
# This program captures UDP packets on port identified in the variable
# port_no. The port will remain blocked until the script is killed.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
port_no = 5555;
class Echo(DatagramProtocol):
@PrieureDeSion
PrieureDeSion / rosbag_extract.py
Last active Jan 17, 2020
Script to extract messages on desired topics, and save them in a CSV file. Easy to modify as per requirements.
View rosbag_extract.py
"""
This script collects data from all the bag files in the directory passed as the first
argument when launching. In particular, it collects the rostopics listed in the
concerned list and generates a CSV file containing the same. The readings are triggered
by the trigger topic.
Author: Dhruv Ilesh Shah
shahdhruv@cmu.edu | dhruv.shah@iitb.ac.in
"""
You can’t perform that action at this time.