Skip to content

Instantly share code, notes, and snippets.

View josePhoenix's full-sized avatar

Joseph Long josePhoenix

View GitHub Profile
@josePhoenix
josePhoenix / lsst_deblend_example.py
Created July 22, 2016 04:18
Jim Bosch example for deblending simulated images with the LSST stack
# from https://community.lsst.org/t/how-to-run-the-dm-stack-on-simulated-fits-images/892/6
import lsst.afw.table
import lsst.afw.image
import lsst.afw.math
import lsst.meas.algorithms
import lsst.meas.base
import lsst.meas.deblender
import numpy
# High-level algorithms are in classes called "Tasks". Each of these has a Config
$ make
rm -f source/raytrace/*.o; rm -f source/trim/*.o; rm -f source/e2adc/*.o; rm -f source/instrument/*.o; rm -f source/atmosphere/*.o ; rm -f source/ancillary/*.o
csh -c "source bin/setup ; cd source/raytrace ; make; mv raytrace ../../bin/."
[1] 15553
[1] Done alias runidle python3.4 -m idlelib.idle
make[1]: Entering directory '/astro/ferguson1/jlong/deblend/phosim/source/raytrace'
cc -g -O3 -ffast-math -Wall -c -I/Users/jlong/include/ -I/Users/jlong/include/ -I ../ main.cpp -o main.o
cc -g -O3 -ffast-math -Wall -c -I/Users/jlong/include/ -I/Users/jlong/include/ -I ../ observation.cpp -o observation.o
cc -g -O3 -ffast-math -Wall -c -I/Users/jlong/include/ -I/Users/jlong/include/ -I ../ image.cpp -o image.o
In file included from image.cpp:29:
def _wrap_to_2pi(scalar_or_arr):
"""Offsets angles outside 0 <= x <= 2 * pi to lie within the interval"""
if np.isscalar(scalar_or_arr):
if scalar_or_arr < 0:
scalar_or_arr += 2 * np.pi
if scalar_or_arr > 2 * np.pi:
scalar_or_arr -= 2 * np.pi
else:
j = np.where(scalar_or_arr < 0)
if len(j[0]) > 0:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
def get_demo_image():
import numpy as np
from matplotlib.cbook import get_sample_data
f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False)
z = np.load(f)
# z is a numpy array of 15x15
return z, (-3, 4, -4, 3)
import numpy as np
from bokeh.io import vform
from bokeh.models import CustomJS, ColumnDataSource, Slider
from bokeh.plotting import figure, output_file, show
output_file("callback.html")
orig_x, orig_y = np.arange(100), np.random.rand(100)
x, y = orig_x.copy(), orig_y.copy()
import sys
import multiprocessing
import logging
import logging.handlers
import datetime
import time
import random
N_PROCESSES = 32
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.
protable = Table[{r, N[Re[SpheroidalS1[0, 0, \[Pi], r]]]}, {r, -5, 5, 0.01}]
Export["SpheroidalS1_0_0_pi.csv", protable, "CSV"]