Skip to content

Instantly share code, notes, and snippets.

@rbiswas4
rbiswas4 / gist:961474d38ef3209139c9
Created November 11, 2015 21:17
getting a csv from the opsim sqlite db
# Required packages sqlachemy, pandas (both are part of anaconda distribution, or can be installed with a python installer)
# One step requires the LSST stack, can be skipped for a particular OPSIM database in question
import OpSimSummary.summarize_opsim as so
from sqlalchemy import create_engine
import pandas as pd
print so.__file__
# Change dbname to point at your own location of the opsim output
dbname = '/Users/rbiswas/data/LSST/OpSimData/enigma_1189_sqlite.db'
@rbiswas4
rbiswas4 / gist:b1344d0459cea5014d2c
Last active November 13, 2015 02:30
Code to check that hostid% (2^32 -1) maps to distinct integers for the hosts in Simon's patch of sky
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
time[sniacatsim_rebase]examples$ sshx $acc
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-63-generic x86_64)
* Documentation: https://help.ubuntu.com/
175 packages can be updated.
97 updates are security updates.
Last login: Thu Nov 12 19:02:59 2015 from d-173-250-158-216.dhcp4.washington.edu
rbiswas@accelerator:~$ cd .c
@rbiswas4
rbiswas4 / test.ipynb.json
Last active November 13, 2015 09:06
This gist shows that in the patch of sky used by @SimonKrughoff contains a small number of galaxies, and the galtileid % (2^32 -1) values are unique
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{

SN Sprinkler pseudo code

Assumptions and discussion

  • Cosmology is known. This cosmology should be whatever is used to compute time delays from the lenses. CatSim is cosmology dependent as well. This plays into the setup in two ways: Galaxy evolution is cosmology dependent, but this dependence is relatively weak, and smudged anyway in how we are populating SN. The second is that SN have distance moduli calculated according to the udnerlying cosmology, which will determine the sensitivity/discovery in images. This may need to be changed to match the time delay calculations.
  • The OM10 cataloag provides us with an ensemble of lens-source systems. The number of lens source systems in a given area is a function of the number density of lens galaxies and the number density of sources. I do not understand the way we need to oversample these two quantities to make the procedure sensible. At this point, let us assume that we can find a catalog of lenses that would make sense in combination with the transients
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rbiswas4
rbiswas4 / SlidingWindows.ipynb
Last active January 1, 2016 02:30
Notebook illustrating the usage of rolling computations in pandas.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import pandas as pd
# Note that the np.array(fits_rec) is essential for functionality like groupby to not fail
d = np.array(fits_rec).byteswap().newbyteorder()
df = pd.DataFrame(d)
@rbiswas4
rbiswas4 / intermediate_check.md
Last active July 11, 2016 02:17
Checking intermediate results stored in pickle
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt