Skip to content

Instantly share code, notes, and snippets.

View rodluger's full-sized avatar
👽

Rodrigo Luger rodluger

👽
View GitHub Profile
@rodluger
rodluger / hack_syw_cache.py
Created September 8, 2022 19:18
Get showyourwork cache info
def get_cache_info(*args, **kwargs):
import inspect
from pathlib import Path
# Wait until the DAG has been built
snakemake.workflow.checkpoints.syw__dag.get()
# Get all jobs from the DAG
dag = None
levels = inspect.stack()
@rodluger
rodluger / oblate_sketch.py
Created September 1, 2021 18:27
Constructing an oblate stellar model in PyMC3 w/ starry
import pymc3 as pm
import pymc3_ext as pmx
import numpy as np
import starry
import theano.tensor as tt
from astropy import constants, units
import matplotlib.pyplot as plt
def get_stellar_inclination_prior(incstar):
@rodluger
rodluger / distributed_hack.py
Created June 2, 2021 23:10
Hack to allow importing `pymc3` without an internet connection
# Hack to allow importing `pymc3` without an internet connection
# This was fixed in https://github.com/dask/distributed/pull/3991
try:
import distributed
except Exception as e:
try:
import socket
getaddrinfo = socket.getaddrinfo
socket.getaddrinfo = lambda *args: [
@rodluger
rodluger / eigensolver.ipynb
Created February 21, 2021 21:52
Eigendecomposition trick for applying covariance matrix inverses w/ different white noise
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rodluger
rodluger / SyntheticLikelihood.ipynb
Created October 27, 2020 19:22
A toy synthetic likelihood problem
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rodluger
rodluger / brute-force-gp.py
Last active September 24, 2020 19:43
A brute-force implementation of a Gaussian process for stellar light curves
"""
A very simple / slow / inefficient / unstable implementation of a Gaussian
process for stellar light curves. We sample lots of surface maps from a
given distribution of spot sizes / locations / contrasts and compute the
empirical mean and covariance of the resulting distribution. In the limit
that our number of samples is infinite, this yields the meand and covariance
of the desired GP!
"""
import starry
import numpy as np
@rodluger
rodluger / degeneracies.py
Created September 19, 2020 16:39
Degeneracies in the light curve inversion problem for mapping stars and planets
import starry
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
# Settings
starry.config.lazy = False
np.random.seed(12)
# Load a map of the earth
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rodluger
rodluger / vplanet_workflow.md
Last active December 18, 2018 19:22
vplanet workflow

Working with a public repo and a private repo

We currently have a public vplanet repo and a private vplanet-private repo. Here's what we decided our workflow should look like:

All development is done on the (non-master) branches of vplanet-private and synced to master via pull requests. When a change is ready to be incorporated into the current released version of the code, we go to our local clone of the public vplanet repository and pull from master on vplanet-private to local dev. Then, on the GitHub UI, we issue a pull request for master on vplanet.

Setting up tracking on your local machine