Skip to content

Instantly share code, notes, and snippets.

from pyrap.quanta import quantity
import time
# Unix time starts at 00:00:00 coordinated universal time on 1 January 1970.
unix_epoch = quantity("1970-01-01T00:00:00")
def unix_to_mjds(unix_time):
return unix_time + unix_epoch.get_value('s')
def mjds_to_unix(mjds):
#include <iostream>
#include <vector>
// Returns a vector of indices in the range [st, end) which correspond to
// values for which pred is true.
template <typename Iterator, typename Func>
std::vector<std::size_t> find_indices(Iterator st, Iterator end, Func pred) {
std::vector<std::size_t> indices;
for (auto i=st; i<end; i++) {
if (pred(*i)) indices.push_back(std::distance(st, i));
$ uname -a
Darwin jackdaw 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64 i386 MacBookPro5,1 Darwin
$ sh newinstall.sh
LSST Software Stack Builder
=======================================================================
Detected git version 2.1.2. OK.
class Foo(int):
def __add__(self, other):
return -1
print Foo(2) + 3
@jdswinbank
jdswinbank / gist:bb6fc3350e8cbc6f71f0
Created December 5, 2014 00:14
afw Mac build failure
g++ -o lib/libafw.dylib -dynamiclib -Wl,-install_name -Wl,libafw.dylib src/fits.os src/cameraGeom/CameraPoint.os src/cameraGeom/CameraSys.os src/cameraGeom/Detector.os src/cameraGeom/Orientation.os src/coord/Coord.os src/coord/Observatory.os src/detection/Footprint.os src/detection/FootprintSet.os src/detection/GaussianPsf.os src/detection/HeavyFootprint.os src/detection/Peak.os src/detection/Psf.os src/detection/PsfFormatter.os src/detection/Threshold.os src/formatters/DecoratedImageFormatter.os src/formatters/ExposureFormatter.os src/formatters/ImageFormatter.os src/formatters/KernelFormatter.os src/formatters/MaskedImageFormatter.os src/formatters/MaskFormatter.os src/formatters/TanWcsFormatter.os src/formatters/Utils.os src/formatters/WcsFormatter.os src/geom/AffineTransform.os src/geom/AffineXYTransform.os src/geom/Angle.os src/geom/Box.os src/geom/CoordinateBase.os src/geom/CoordinateExpr.os src/geom/Extent.os src/geom/IdentityXYTransform.os src/geom/InvertedXYTransform.os src/geom/LinearTransform.os sr
#include <iostream>
#include <cassert>
#include "lsst/afw/table.h"
#include "ndarray/eigen.h"
using namespace lsst::afw::table;
void populateCat(BaseCatalog & cat, int size = 3) {
auto schema = cat.getSchema();
auto k1 = schema.find<int>("f1").key;
[jds@magpie ~]$ cat -n test.c
1 const char s[] = "pqrs";
2
3 int main(void) {
4 const char t[] = "abcd";
5 const char* u = "efgh";
6 return 0;
7 }
[jds@magpie ~]$ gcc -o test-gcc test.c
[jds@magpie ~]$ clang -o test-clang test.c
class Foo(object):
@property
def foo(self):
"""This foo is not implemented"""
raise NotImplementedError
def do_thing(self):
print self.foo
class Bar(Foo):
#include <iostream>
#include "ndarray.h"
using namespace std;
int main(void) {
int height = 3968;
int width = 9;
int nSwaths = 15; ndarray::Array<float, 3, 2> slitFuncsSwaths = ndarray::allocate(height, width, nSwaths);
cout << "slitFuncsSwaths.getShape() = " << slitFuncsSwaths.getShape() << endl;
diff --git a/python/lsst/sconsUtils/dependencies.py b/python/lsst/sconsUtils/dependencies.py
index 98d89cd..d837e1d 100644
--- a/python/lsst/sconsUtils/dependencies.py
+++ b/python/lsst/sconsUtils/dependencies.py
@@ -72,10 +72,11 @@ def configure(packageName, versionString=None, eupsProduct=None, eupsProductPath
# XCPPPATH is a new variable defined by sconsUtils - it's like CPPPATH, but the headers
# found there aren't treated as dependencies. This can make scons a lot faster.
state.env['XCPPPATH'] = []
+ state.env['XCPPPREFIX'] = "-isystem "
state.env['_CPPINCFLAGS'] = \