Skip to content

Instantly share code, notes, and snippets.

View athmanar's full-sized avatar

Athma Lakshmi narayanan athmanar

View GitHub Profile
@athmanar
athmanar / openai.py
Last active January 9, 2024 23:23
OPENAI
import openai
from openai import OpenAI
import os
import pandas as pd
import time
import os
def get_completion(prompt):
client = OpenAI(api_key='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', )
@athmanar
athmanar / conda.sh
Last active December 4, 2023 18:26
Conda helper
conda create --name genai python=3.8
@athmanar
athmanar / plotmaps.py
Last active November 29, 2023 14:39
plt lineplots mean and std
import csv
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
def parse_csv_file(filename):
data = []
with open(filename, 'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
@athmanar
athmanar / 3dradarplots.py
Last active October 30, 2023 05:28
3D plots for radar
# cd /export/ssl-nfs1/shared/datasets/ILC_Gesture_Complex_ILC/processed_data/Hui_708_3/radar_top25_np
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
points=np.load('radar_Hui_right_hand_palm_down_50_dx_0_08_Jul_2022_15_02_08_fft_72.np')
RadarPC = points[:,[5,6,7,2,1]]
points=RadarPC
mask= (points[:,:3]>=0) * (points[:,:3]<=1.0)
mask2=mask[:,0]*mask[:,1]*mask[:,2]
p=points[mask2]
@athmanar
athmanar / hist.py
Last active September 15, 2023 22:42
plt histograms
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def plot_histogram_with_kde(vector, bins=30):
"""
Plot a histogram with a Kernel Density Estimate (KDE) on top.
Args:
- vector (list or ndarray): Data vector.
- bins (int): Number of histogram bins.
@athmanar
athmanar / screen.sh
Last active March 18, 2024 15:31
screen with logname
screen -L -Logfile test.txt -S test
screen -XS <session-id> quit
@athmanar
athmanar / minmax.py
Created September 8, 2022 20:26
GetMinMax
import numpy as np
from scipy.io import loadmat
import os
import glob
fullist=glob.glob('/export/ssl-nfs1/shared/datasets/ILC_Gesture_Complex_ILC/processed_data_final/*/radar_top25_np/*.np')
np.random.shuffle(fullist)
# datlist=np.load('/export/ssl-nfs1/shared/datasets/VLP16TICAMCALIB_HUMAN_SMALL/train_val_aug_18_v1.npy',allow_pickle=True)
# fullist=datlist.item()['train']+datlist.item()['val']
We couldn’t find that file to show.
@athmanar
athmanar / nested.py
Created April 11, 2022 18:43
dict2namespace
from argparse import Namespace
def nested_dict_to_namespace(dictionary):
namespace = dictionary
if isinstance(dictionary, dict):
namespace = Namespace(**dictionary)
for key, value in dictionary.items():
setattr(namespace, key, nested_dict_to_namespace(value))
return namespace
@athmanar
athmanar / visdomutils.py
Last active April 8, 2022 21:04
visdom helper scripts
import visdom
from visdom import Visdom
import numpy as np
import argparse
import numpy as np
import math
import os.path
import time
import tempfile
import urllib