This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Necessary imports | |
from lsst.meas.algorithms import LoadIndexedReferenceObjectsTask | |
import lsst.daf.persistence as dafPersist | |
import lsst.afw.coord as afwCoord | |
import lsst.afw.geom as afwGeom | |
# Get a butler for this repository (assumes you are in the top level of the repo) | |
butler = dafPersist.Butler('.') | |
# Get the config and tell it which reference catalog to use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir repo_name | |
cd repo_name | |
echo 'lsst.obs.test.TestMapper' > _mapper # This makes it a repo | |
ln -s /datasets/refcats/htm/htm_baseline ref_cats # link in the reference catalogs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def myFunc(a, b, c): | |
print a+b | |
print "C is %s"%(c) | |
myFunc(1,2,"Hello there") | |
''' Returns: | |
3 | |
C is Hello there | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
class Parent(object): | |
def work(self, a, b): | |
"""Do work on a and b""" | |
return a+b | |
class Child(Parent): | |
@wraps(Parent.work) | |
def work(self, a, b): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class myIter(object): | |
def __init__(self, arr): | |
self.marr = arr | |
def __iter__(self): | |
return self.marr.__iter__() | |
def __len__(self): | |
return len(self.marr) | |
arr = [1,2,3,4] | |
miter = myIter(arr) |