Skip to content

Instantly share code, notes, and snippets.

View seba-perez's full-sized avatar
📡
Working from home

Sebastián Pérez seba-perez

📡
Working from home
View GitHub Profile
@seba-perez
seba-perez / get_exoplanets_CIRAS.py
Created June 30, 2022 21:48
Código para acceder la Open Exoplanet Catalogue y generar tablas de datos para actividades del Equipo Pedagógico CIRAS/YEMS.
# Equipo Pedagogico CIRAS/YEMS
from astroquery.open_exoplanet_catalogue import findvalue
from astroquery import open_exoplanet_catalogue as oec
import numpy as np
import re
def get_exoplanets(output='exoplanets.txt', SolarSystem=False):
"""Grabs all planets from Open Exoplanet Catalogue and saves them."""
cata = oec.get_catalogue()
@seba-perez
seba-perez / eclipse_map.py
Last active November 29, 2021 14:30
Script to generate map of the 2021 Total Solar Eclipse
# 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.
# Seba Perez (CIRAS/USACH)
import ephem
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap, cm
@seba-perez
seba-perez / .emacs
Created October 27, 2020 16:26
Basic configuration file for emacs. No menu, no bars, no scrollbar, darker theme, etc.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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 October 27, 2020 16:43
Total Eclipse visualization
# 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 June 15, 2020 13:54
Script to plot exoplanet mass vs semi major axis (or any other quantity).
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".
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 June 14, 2020 01:24
Convolution tools for image resolution matching and unsharp masking.
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):