Changeset 1325


Ignore:
Timestamp:
04/12/07 12:07:38 (17 years ago)
Author:
mar637
Message:

Changes to use casacore instead of casa_asap/aips++\nAdded atnf PKSIO library snapshot to external and linking against this local copy

Location:
trunk
Files:
31 added
3 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r1305 r1325  
    44import platform
    55import SCons
    6 # scons plug-ins
    7 #from installtree import InstallTree
    86
    97moduledir = distutils.sysconfig.get_python_lib()
     
    1412
    1513opts = Options("userconfig.py")
    16 opts.AddOptions(PathOption("prefix",
    17                            "The root installation path",
     14opts.AddOptions(               
     15                ("FORTRAN", "The fortran compiler", None),
     16                ("f2clib", "The fortran to c library", None),
     17                PathOption("prefix",
     18                "The root installation path",
    1819                           distutils.sysconfig.PREFIX),
    1920                PathOption("moduledir",
    2021                            "The python module path (site-packages))",
    2122                            moduledir),
    22                 ("rpfitsdir", "Alternative rpfits location.", ""),
    23                 ("cfitsioincdir", "Alternative cfitsio include dir", ""),
    24                 ("casadir", "Alternative casa location", ""),
     23                PathOption("casacoreroot", "The location of casacore",
     24                                    "/usr/local"),
     25                ("boostroot", "The root dir where boost is installed", None),
     26                ("boostlib", "The name of the boost python library",
     27                 "boost_python"),
     28                ("boostlibdir", "The boost library location", None),
     29                ("boostincdir", "The boost header file location", None),
     30                ("lapackroot",
     31                 "The root directory where lapack is installed", None),
     32                ("lapacklibdir", "The lapack library location", None),
     33                ("lapacklib",
     34                 "The lapack library name (e.g. for specialized AMD libraries",
     35                 None),
     36                ("blasroot",
     37                 "The root directory where blas is installed", None),
     38                ("blaslibdir", "The blas library location", None),
     39                ("blaslib",
     40                 "The blas library name (e.g. for specialized AMD libraries",
     41                 None),
     42                ("cfitsioroot",
     43                 "The root directory where cfistio is installed", None),
     44                ("cfitsiolibdir", "The cfitsio library location", None),
     45                ("cfitsioincdir", "The cfitsio include location", None),
     46                ("wcsroot",
     47                 "The root directory where wcs is installed", None),
     48                ("wcslibdir", "The wcs library location", None),
     49                ("rpfitsroot",
     50                 "The root directory where rpfits is installed", None),
     51                ("rpfitslibdir", "The rpfits library location", None),
     52               
    2553                EnumOption("mode", "The type of build.", "debug",
    2654                           ["release","debug"], ignorecase=1),
     
    3462
    3563env = Environment( toolpath = ['./scons'],
    36                    tools = ["default", "casa", "archiver", "utils",
     64                   tools = ["default", "archiver", "utils",
    3765                            "quietinstall"],
    3866                   ENV = { 'PATH' : os.environ[ 'PATH' ],
     
    4270Help(opts.GenerateHelpText(env))
    4371env.SConsignFile()
    44 env.Append(CASAARCH = '', CASAROOT = '')
    45 if (os.path.exists(env["cfitsioincdir"])):
    46     env.Append(CPPPATH=[env["cfitsioincdir"]])
    47 env.AddCustomPath(env["rpfitsdir"])
     72
     73casacoretooldir = os.path.join(env["casacoreroot"],"share",
     74                                   "casacore")
     75if not os.path.exists(casacoretooldir):
     76    print "Could not find casacore scons tools"
     77    Exit(1)
     78
     79# load casacore specific build flags
     80print casacoretooldir
     81env.Tool('casa', [casacoretooldir])
     82
    4883if not env.GetOption('clean'):
    4984    conf = Configure(env)
    50     # import Custom tests
    51     env.AddCasaTest(conf)
    52     pylib = 'python'+distutils.sysconfig.get_python_version()
    53     pyinc = "Python.h"
    54     if env['PLATFORM'] == "darwin":
    55         pylib = "Python"
    56     if not conf.CheckLib(library=pylib, language='c'): Exit(1)
    5785    conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()])
    5886    if not conf.CheckHeader("Python.h", language='c'):
    5987        Exit(1)
    60     if not conf.CheckLibWithHeader('boost_python', 'boost/python.hpp', 'c++'): Exit(1)
    61     conf.env.AddCustomPath(env["rpfitsdir"])
    62     if not conf.CheckLib('rpfits'): Exit(1)
    63     # cfitsio is either in include/ or /include/cfitsio
    64     # handle this
    65     if not conf.CheckLib(library='cfitsio', language='c'): Exit(1)
    66     if not conf.CheckHeader('fitsio.h', language='c'):
    67         if not conf.CheckHeader('cfitsio/fitsio.h', language='c'):
    68             Exit(1)
    69         else:
    70             conf.env.Append(CPPPATH=['/usr/include/cfitsio'])
    71     if (sys.platform == "darwin"):
    72         conf.env.Append(LIBS = ['-framework vecLib'])
     88    pylib = 'python'+distutils.sysconfig.get_python_version()
     89    if env['PLATFORM'] == "darwin":
     90        conf.env.Append(FRAMEWORKS=["Python"])
    7391    else:
    74         if not conf.CheckLib('lapack'): Exit(1)
    75         if not conf.CheckLib('blas'): Exit(1)
    76     if not conf.CheckLib('g2c'): Exit(1)
     92        if not conf.CheckLib(library=pylib, language='c'): Exit(1)
     93
     94    conf.env.AppendUnique(LIBPATH=os.path.join(conf.env["casacoreroot"],
     95                                               "lib"))
     96    conf.env.AppendUnique(CPPPATH=os.path.join(conf.env["casacoreroot"],
     97                                               "include", "casacore"))
     98    print conf.env["CPPPATH"]
     99#    if not conf.CheckLib("casa_images",  language='c++'): Exit(1)
     100    if not conf.CheckLib("casa_ms",  language='c++'): Exit(1)
     101    if not conf.CheckLib("casa_components",  language='c++'): Exit(1)
     102    if not conf.CheckLib("casa_coordinates",  language='c++'): Exit(1)
     103    if not conf.CheckLib("casa_lattices",  language='c++'): Exit(1)
     104    if not conf.CheckLib("casa_fits",  language='c++'): Exit(1)
     105    if not conf.CheckLib("casa_measures",  language='c++'): Exit(1)
     106    if not conf.CheckLib("casa_scimath",  language='c++'): Exit(1)
     107    if not conf.CheckLib("casa_scimath_f",  language='c++'): Exit(1)
     108    if not conf.CheckLib("casa_tables",  language='c++'): Exit(1)
     109    if not conf.CheckLib("casa_mirlib",  language='c++'): Exit(1)
     110    if not conf.CheckLib("casa_casa",  language='c++'): Exit(1)
     111    conf.env.AddCustomPackage('boost')
     112    if not conf.CheckLibWithHeader(env["boostlib"],
     113                                   'boost/python.hpp', language='c++'):
     114        Exit(1)
     115    # test for cfitsio
     116    if not conf.CheckLib("m"): Exit(1)
     117    conf.env.AddCustomPackage('cfitsio')
     118    if not conf.CheckLibWithHeader('cfitsio', 'fitsio.h', language='c'):
     119        Exit(1)
     120    conf.env.AddCustomPackage('wcs')
     121    if not conf.CheckLibWithHeader('wcs', 'wcslib/wcs.h', language='c'):
     122        Exit(1)
     123    conf.env.AddCustomPackage('rpfits')
     124    if not conf.CheckLib("rpfits"): Exit(1)
     125
     126    # test for blas/lapack
     127    blasname = conf.env.get("blaslib", "blas")
     128    conf.env.AddCustomPackage("blas")
     129    if not conf.CheckLib(blasname): Exit(1)
     130    lapackname = conf.env.get("lapacklib", "lapack")
     131    conf.env.AddCustomPackage("lapack")
     132    if not conf.CheckLib(lapackname): Exit(1)
     133    conf.env.CheckFortran(conf)
    77134    if not conf.CheckLib('stdc++', language='c++'): Exit(1)
    78     if not conf.CheckCasa(env["casadir"]): Exit(1)
    79135    env = conf.Finish()
    80136
    81 env["version"] = "2.1.1"
    82 
    83 # general CPPFLAGS
    84 env.Append(CPPFLAGS=['-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-O3'])
    85 
    86 # 64bit flags
    87 if  platform.architecture()[0] == '64bit':
    88     env.Append(CPPFLAGS=['-fPIC', '-D__x86_64__', '-DAIPS_64B'])
     137env["version"] = "trunk"
    89138
    90139if env['mode'] == 'release':
     
    94143Export("env")
    95144
     145# build externals
     146env.SConscript("external/SConscript")
    96147# build library
    97148so = env.SConscript("src/SConscript", build_dir="build", duplicate=0)
  • trunk/scons/utils.py

    r1184 r1325  
    1414        env.PrependUnique(LIBPATH = [os.path.join(path, "lib")])
    1515    env.AddCustomPath = AddCustomPath
     16
     17    def AddCustomPackage(pkgname=None):
     18        if pkgname is None:
     19            return
     20        pkgroot = env.get("%sroot" % pkgname, None)
     21        pkgincd = env.get("%sincdir" % pkgname, None)
     22        pkglibd = env.get("%slibdir" % pkgname, None)
     23        incd = None
     24        libd = None
     25        if pkgroot is not None:
     26            incd = os.path.join(pkgroot, "include")
     27            libd = os.path.join(pkgroot, "lib")
     28        else:       
     29            if pkgincd is not None:
     30                incd = pkgincd
     31            if pkglibd is not None:
     32                libd = pkglibd
     33        if incd is not None:
     34            if not os.path.exists(incd):
     35                print "Custom %s include dir '%s' not found" % (pkgname, incd)
     36                env.Exit(1)
     37            env.PrependUnique(CPPPATH = [incd])
     38        if libd is not None:
     39            if not os.path.exists(libd):
     40                print "Custom %s lib dir '%s' not found" % (pkgname, libd)
     41                env.Exit(1)
     42            env.PrependUnique(LIBPATH = [libd])
     43
     44    env.AddCustomPackage = AddCustomPackage
     45
     46    def CheckFortran(conf):
     47           
     48        if not conf.env.has_key("FORTRAN"):
     49            # auto-detect fortran
     50            detect_fortran = conf.env.Detect(['gfortran', 'g77', 'f77'])
     51            conf.env["FORTRAN"] = detect_fortran
     52            fdict = {'gfortran': 'gfortran', 'g77': 'g2c', 'f77': 'f2c'}
     53            f2clib = conf.env.get("f2clib", fdict[detect_fortran])
     54            if not conf.CheckLib(f2clib):
     55                env.Exit(1)
     56        else:
     57            if not conf.env.has_key("f2clib"):
     58                print "A custom fortran compiler also needs f2clib defined"
     59                env.Exit(1)
     60            else:
     61                if not conf.CheckLib(env["f2clib"]):
     62                    env.Exit(1)
     63        if conf.env["FORTRAN"].startswith("g77"):
     64            fflags = ["-Wno-globals", "-fno-second-underscore"]
     65            conf.env.Append(SHFORTRANFLAGS=fflags)
     66            conf.env.Append(FORTRANFLAGS=fflags)
     67    env.CheckFortran = CheckFortran
    1668
    1769    def WalkDirTree(targetroot, sourceroot, sources):
  • trunk/src/MathUtils.cpp

    r996 r1325  
    100100  return out;
    101101}
     102
     103void mathutil::hanning(Vector<Float>& out, Vector<Bool>& outmask,
     104                       const Vector<Float>& in, const Vector<Bool>& mask,
     105                       Bool relaxed, Bool ignoreOther) {
     106  Vector< Vector<Float> > weights(8);
     107  Vector<Float> vals(3);
     108  vals = 0.0;weights[0] = vals;// FFF
     109  vals[0] = 1.0; vals[1] = 0.0; vals[2] = 0.0; weights[1] = vals;// TFF
     110  vals[0] = 0.0; vals[1] = 1.0; vals[2] = 0.0; weights[2] = vals;// FTF
     111  vals[0] = 1.0/3.0; vals[1] = 2.0/3.0; vals[2] = 0.0; weights[3] = vals;// TTF
     112  vals[0] = 0.0; vals[1] = 0.0; vals[2] = 1.0;weights[4] = vals;// FFT
     113  vals[0] = 0.5; vals[1] = 0.0; vals[2] = 0.5; weights[5] = vals;// TFT
     114  vals[0] = 0.0; vals[1] = 2.0/3.0; vals[2] = 1.0/3.0; weights[6] = vals;// FTT
     115  vals[0] = 0.25; vals[1] = 0.5; vals[2] = 0.25; weights[7] = vals;// TTT
     116  // Chris' case
     117  Vector<Bool> weighted(8);
     118  if (relaxed) {
     119    weighted = False;
     120    weighted[7] = True;
     121
     122  } else {
     123    weighted = True;
     124    weighted[0] = False;
     125  }
     126
     127  out.resize(in.nelements());
     128  outmask.resize(mask.nelements());
     129  // make special case for first and last
     130  /// ...here
     131  // loop from 1..n-2
     132  out.resize(in.nelements());
     133  out[0] = in[0];out[out.nelements()-1] = in[in.nelements()-1];
     134  outmask.resize(mask.nelements());
     135  outmask = False;
     136  uInt m;Vector<Float>* w;
     137  for (uInt i=1; i < out.nelements()-1;++i) {
     138    m = mask[i-1] + 2*mask[i] + 4*mask[i+1];
     139    w = &(weights[m]);
     140    if (weighted[m]) {
     141      out[i] = (*w)[0]*in[i-1] + (*w)[1]*in[i] + (*w)[2]*in[i+1];
     142      outmask[i] = True;
     143    } else { // mask it
     144      out[i] = in[i];//use arbitrary value
     145      outmask[i] = False;
     146    }
     147  }
     148}
  • trunk/src/MathUtils.h

    r1033 r1325  
    5050 * @param ignoreOther drop every second channel (NYI)
    5151 */
    52 template <class T>
    53 void hanning(casa::Vector<T>& out, casa::Vector<casa::Bool>& outmask,
    54              const casa::Vector<T>& in, const casa::Vector<casa::Bool>& mask,
     52void hanning(casa::Vector<casa::Float>& out,
     53             casa::Vector<casa::Bool>& outmask,
     54             const casa::Vector<casa::Float>& in,
     55             const casa::Vector<casa::Bool>& mask,
    5556             casa::Bool relaxed=casa::False,
    5657             casa::Bool ignoreOther=casa::False);
  • trunk/src/SConscript

    r1135 r1325  
    1010for pf in pycpps: cpps.remove(pf)
    1111
    12 casalibd = os.path.join(myenv['CASAROOT'],myenv['CASAARCH'],'lib')
    13 
    1412# location of libcasav.a
    1513myenv.Prepend( LIBPATH = ['#/build'] )
    16 myenv.Install('#build', os.path.join(casalibd, 'libwcs.a'))
    1714myenv['SHLIBPREFIX']=""   #gets rid of lib prefix
    18 
     15myenv.Append(CCFLAGS=["-DWCSLIB_GETWCSTAB"])
    1916# need to create library here to fool  scons linker
    20 casav = myenv.StaticLibrary(target = "casav", source = os.path.join(casalibd, 'version.o'))
    2117libasap =  myenv.StaticLibrary(target = "asap", source = cpps)
    2218myenv.Prepend( LIBS =  ['asap'] )
    2319
    2420# Finally create the library for the module
    25 so = myenv.SharedLibrary( target = "_asap", source = pycpps )
     21so = myenv.LoadableModule( target = "_asap.so", source = pycpps, SHLIBSUFFIX="" )
    2622#test = myenv.Program("test", cpps)
    2723Return("so")
  • trunk/src/Scantable.cpp

    r1323 r1325  
    2222#include <casa/Arrays/ArrayLogical.h>
    2323#include <casa/Arrays/ArrayAccessor.h>
     24#include <casa/Arrays/Vector.h>
    2425#include <casa/Arrays/VectorSTLIterator.h>
    25 #include <casa/Arrays/Vector.h>
    2626#include <casa/BasicMath/Math.h>
    2727#include <casa/BasicSL/Constants.h>
     
    4242#include <tables/Tables/ExprNode.h>
    4343#include <tables/Tables/TableRecord.h>
     44#include <casa/Quanta/MVTime.h>
     45#include <casa/Quanta/MVAngle.h>
     46#include <measures/Measures/MeasRef.h>
     47#include <measures/Measures/MeasTable.h>
     48// needed to avoid error in .tcc
     49#include <measures/Measures/MCDirection.h>
     50//
     51#include <measures/Measures/MDirection.h>
    4452#include <measures/Measures/MFrequency.h>
    4553#include <measures/Measures/MEpoch.h>
    46 #include <measures/Measures/MeasTable.h>
    47 #include <measures/Measures/MeasRef.h>
    4854#include <measures/TableMeasures/TableMeasRefDesc.h>
    4955#include <measures/TableMeasures/TableMeasValueDesc.h>
     
    5157#include <measures/TableMeasures/ScalarMeasColumn.h>
    5258#include <coordinates/Coordinates/CoordinateUtil.h>
    53 #include <casa/Quanta/MVTime.h>
    54 #include <casa/Quanta/MVAngle.h>
    5559
    5660#include "Scantable.h"
Note: See TracChangeset for help on using the changeset viewer.