Skip to content

Instantly share code, notes, and snippets.

"""
Short script for displaying difference Image, from Simon's instructions
The basic philosophy is to *NOT* just look at the files using ds9, but rather
data products created by the DM stack in a repository which knows how to fetch
these data products.
"""
import lsst.afw.display
import lsst.daf.persistence as dp
@rbiswas4
rbiswas4 / gist:68f78cff0876f54b9e2061ce21073b7f
Last active December 30, 2016 02:03
pairwise reversing
l = [1, 2, 3, 4]
x = zip(l[1::2], l[::2])
list(e for t in x for e in t)
ll = []
for t in x:
for e in t:
ll.append(e)
@rbiswas4
rbiswas4 / driver_rollingCadencePrep.py
Last active February 23, 2017 22:29
script to change fieldIDs in sandwich mdoel
import pandas as pd
import glob
s = '# fields/userRegions_design.txt - design fields - 18,000 sq deg\n'
def writefile(fname, s, fieldDF):
with open(fname, 'r') as f:
data = f.read()
l = data.split(s)
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.
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.

Testing and Integration

  • There are numerous articles in software literature about the motivation for unit tests and integration testing. Closer home The LSST policy described here is a useful source which addresses the kind of concerns we will have.
  • Personally I think, the really big win for me (clearly writing unit tests is boring for people who could use the time to do more) is the increased confidence in generalizing/modifying/refactoring the codebase after a long break from developing the code without worrying that changes will break the code. Not surprisingly, talking to academics across many fields, this is the reason that seems to get the most buy-in from them.

Continuous Integration

  • I think it is very useful to be able to use a continuous integration service. Travis is a popular one. The main advantage of this is to make sure the code works the way it is expected to with the install instructions.
  • This is di
# Install script from https://github.com/JohannesBuchner/pymultinest-tutorial with a few changes.
### Variables for locations
software_repo=${HOME}/soft
multinest_repo=https://github.com/JohannesBuchner/MultiNest
mnestdir=$software_repo/Multinest
pymnestdir=$software_repo/PyMultiNest
### Check if directory for multinest is already present
if [ -d $mnestdir ]; then
@rbiswas4
rbiswas4 / desc_times.py
Last active July 9, 2019 14:44
A script for calculating times at the location of all desc SN members at a particular time at a particular time zone.
#!/usr/bin/env python
"""
Script to check timezones of DESC collaborators. For
usage:
```
python desc_times.py -h
Examples:
---------
python desc_times.py --hour 7 --month 9 --year 2019 --day 4 # 7am Sep/4 Project Time (SLAC