May 24

Whew, finally am able to get back to this after SDSS stuff and moving. Where are we at... The build systems appears to have been fixed, and fw is in good shape (a svn update and then scons works in the src/ lib/ include/ examples/ and tests/ directories but fails at python/; don't worry about python for now).

MaskedImage has all the variance info I need, so get back to working on my example code to read in the CFHT images.

I try and scons it, and again am having problems

# WORKS
g++ -o tests/lsstimageproc01.o -c -g -Wall -O0 -DLSST_LITTLE_ENDIAN=1 -I/lsst/lsst_root_new/Linux64/external/boost/1.33.1/include -I/lsst/lsst_root_new/Linux64/external/vw/1.0.1/include -I/lsst/becker/lsst_devel/DC2/fw/include -I/lsst/lsst_root_new/Linux64/external/python/2.5/include/python2.5 -I/lsst/lsst_root_new/Linux64/external/python/2.5/include -I/lsst/lsst_root_new/Linux64/external/cfitsio/3006/include -I/lsst/lsst_root_new/Linux64/external/wcstools/3.6.2/include -I/lsst/lsst_root_new/Linux64/external/xpa/2.1.7b2/include -Iinclude -Isrc tests/lsstimageproc01.cc

# DOES NOT WORK
g++ -o tests/lsstimageproc01 -Wl,-rpath-link -Wl,/lsst/lsst_root_new/Linux64/external/vw/1.0.1/lib:/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64:/usr/X11R6/lib:/usr/X11R6/lib64:/home/becker/lib:/lsst/lsst_root_new/Linux64/external/boost/1.33.1/lib:/lsst/lsst_root_new/Linux64/external/cfitsio/3006/lib:/lsst/lsst_root_new/Linux64/external/xpa/2.1.7b2/lib:/lsst/lsst_root_new/Linux64/external/tcltk/8.5a4/lib:/lsst/lsst_root_new/Linux64/external/termcap/1.3.1/lib:/lsst/lsst_root_new/Linux64/external/readline/5.2/lib:/lsst/becker/lsst_devel/DC2/fw/libtests/lsstimageproc01.o -L/lsst/lsst_root_new/Linux64/external/boost/1.33.1/lib -L/lsst/lsst_root_new/Linux64/external/vw/1.0.1/lib -L/lsst/becker/lsst_devel/DC2/fw/lib -L/lsst/lsst_root_new/Linux64/external/python/2.5/lib/python2.5/site-packages -L/lsst/lsst_root_new/Linux64/external/cfitsio/3006/lib -L/lsst/lsst_root_new/Linux64/external/wcstools/3.6.2/lib -L/lsst/lsst_root_new/Linux64/external/xpa/2.1.7b2/lib -Llib -lvw -lvwCore -lvwFileIO -lfw

tests/lsstimageproc01.o(.gnu.linkonce.t._ZN4lsst2fw16LSSTFitsResourceIfED1Ev+0x21): In function `lsst::fw::LSSTFitsResource<float>::~LSSTFitsResource()':
/lsst/becker/lsst_devel/DC2/fw/include/lsst/fw/Image.cc:53: undefined reference to `lsst::fw::DiskImageResourceFITS::~DiskImageResourceFITS()'

# AND ON AND ON, PROBABLY 20 ERRORS

I am likely to get yelled at by RHL for not having any code written. Well this is the reason why, trying to debug all this stuff...

Here we go, the most simple piece of code I have to reproduce this error

// -*- lsst-c++ -*-
#include "lsst/fw/MaskedImage.h"
#include "lsst/fw/Trace.h"

using namespace std;
using namespace lsst::fw;

int main( int argc, char** argv )
{
    typedef uint8 MaskPixelType;
    typedef float32 ImagePixelType;

    MaskedImage<ImagePixelType,MaskPixelType> nothing;
    nothing.readFits(argv[1]);
    return 1;
}

And I try in SConscript all below options

env.Program("testfw01", ["testfw01.cc"], LIBS=env.libs["vw"] + ["fw"])
env.Program("testfw01", ["testfw01.cc"], LIBS="fw")

Aargh. OK, it was missing libraries was the problem... I needed

env.Program(["testfw01.cc"], LIBS=env.libs["vw"] + ["fw"] + ["fitsio"])

Grumble grumble. Well, I am now actually coding! Reading in CFHT files and turning them into MaskedImages?. We'll see how far I can get...

So I am working on a piece of code to turn a CFHT image into a MaskedImage. Works. Am trying to put it in examples/ of my imageproc module. Moreover I am trying to run a command like examples/CFHT2MaskedImage examples/871034p_1 examples/871034p_1_MI. But, the environment spawned by SCons does not know about $LSST_ROOT and all that, so I can't run the code I compiled from within SCons! E.g. I get

scons: done reading SConscript files.
scons: Building targets ...
examples/CFHT2MaskedImage examples/871034p_1 examples/871034p_1_MI
examples/CFHT2MaskedImage: error while loading shared libraries: libvw.so.0: cannot open shared object file: No such file or directory
scons: *** [examples/CFHT2MaskedImage.output] Error 127
scons: building terminated because of errors.

but if I run it on the command line

becker132: examples/CFHT2MaskedImage examples/871034p_1 examples/871034p_1_MI
  Set 190 sat mask bits in examples/871034p_1
  Set 413690 bad mask bits in examples/871034p_1

So yeah. Need some SConscript trickery. I tried the following...

exe    = "CFHT2MaskedImage"
target = "CFHT2MaskedImage.output"
try:
    if os.stat(exe).st_mode & 01:  # file exists and is executable
        env.Command(target, exe, "setupLSST; setup imageproc becker; examples/%s examples/871034p_1 examples/871034p_1_MI" % (exe))
except OSError:
    pass

but

sh: setupLSST: command not found

that sort of thing.