Skip to content

Instantly share code, notes, and snippets.

@dvida
dvida / gist:fa37985c424d36daa0ad029d2d15f277
Created March 12, 2025 14:11
Exploring astrometry.net fits files
# %%
dir_path = "C:\\Users\\denis\\Downloads"
corr_file = "corr.fits"
imgradec_file = "image-radec.fits"
rdls_file = "rdls.fits"
import os
from astropy.io import fits
@dvida
dvida / PolarLine.py
Created November 19, 2024 19:59
Fit a line in polar coordinates (Hough space)
import numpy as np
import matplotlib.pyplot as plt
def fitLinePolar(x, y, x_ref, y_ref):
"""
Fits a line to the given data points using the polar (Hough) formulation.
The data is centered at (x_ref, y_ref).
Parameters:
x (np.ndarray): Array of x data points.
@dvida
dvida / powerlaw_fitting_MLE.py
Created December 16, 2017 18:38
Using maximum likelihood estimation for power law fitting in Python
from __future__ import print_function
import numpy as np
import scipy.stats
import matplotlib.pyplot as plt
# Exponent
a = 3.2
@dvida
dvida / opencv_live_faceswap.py
Created May 28, 2015 07:39
OpenCV camera - replaces all faces on the image with the first detected face
import numpy as np
import cv2
baboon = cv2.imread('slike/baboon.bmp')
cap = cv2.VideoCapture(0)
while(True):