Skip to content

Instantly share code, notes, and snippets.

Avatar
📡
Working from home

Sebastián Pérez seba-perez

📡
Working from home
View GitHub Profile
@seba-perez
seba-perez / .emacs
Created Oct 27, 2020
Basic configuration file for emacs. No menu, no bars, no scrollbar, darker theme, etc.
View .emacs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Seba Perez at USACH dot Emacs file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq user-full-name "seba")
;; Package repositories
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
@seba-perez
seba-perez / eclipse_map.py
Last active Oct 27, 2020
Total Eclipse visualization
View eclipse_map.py
# Script to plot the path of totality of an eclipse.
# Uses ephem to calculate the sun eclipse fraction for a
# grid of latitudes, longitudes and altitudes.
import ephem
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap, cm
import scipy.ndimage
import sys
@seba-perez
seba-perez / exo_plot.py
Last active Jun 15, 2020
Script to plot exoplanet mass vs semi major axis (or any other quantity).
View exo_plot.py
import exodata
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
import pickle
""" Script to plot exoplanet mass vs semi major axis (or any other
quantity).
for exoplanet data we need "pip install exodata".
View flux_mass_conversion.py
import numpy as np
import scipy.constants as sc
M_Sun = 1.98844e30 # [M_Sun] = kg
M_Earth = 5.9723e24 # [M_Earth] = kg
M_Jup = 1.8986e27 # [M_Jup] = kg
M_Sat = 5.6846e26 # [M_Sat] = kg
def Bnu(nu, T, RJ=False):
@seba-perez
seba-perez / convtools.py
Last active Jun 14, 2020
Convolution tools for image resolution matching and unsharp masking.
View convtools.py
import numpy as np
from astropy import nddata
from astropy.io import fits
from astropy.convolution import convolve_fft, Gaussian2DKernel
from astropy.convolution import convolve
from pathlib import Path
def get_Gaussian_kernel(from_beam, to_beam, pixelsize):