Changeset 1325
- Timestamp:
- 04/12/07 12:07:38 (18 years ago)
- Location:
- trunk
- Files:
-
- 31 added
- 3 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SConstruct
r1305 r1325 4 4 import platform 5 5 import SCons 6 # scons plug-ins7 #from installtree import InstallTree8 6 9 7 moduledir = distutils.sysconfig.get_python_lib() … … 14 12 15 13 opts = Options("userconfig.py") 16 opts.AddOptions(PathOption("prefix", 17 "The root installation path", 14 opts.AddOptions( 15 ("FORTRAN", "The fortran compiler", None), 16 ("f2clib", "The fortran to c library", None), 17 PathOption("prefix", 18 "The root installation path", 18 19 distutils.sysconfig.PREFIX), 19 20 PathOption("moduledir", 20 21 "The python module path (site-packages))", 21 22 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 25 53 EnumOption("mode", "The type of build.", "debug", 26 54 ["release","debug"], ignorecase=1), … … 34 62 35 63 env = Environment( toolpath = ['./scons'], 36 tools = ["default", " casa", "archiver", "utils",64 tools = ["default", "archiver", "utils", 37 65 "quietinstall"], 38 66 ENV = { 'PATH' : os.environ[ 'PATH' ], … … 42 70 Help(opts.GenerateHelpText(env)) 43 71 env.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 73 casacoretooldir = os.path.join(env["casacoreroot"],"share", 74 "casacore") 75 if not os.path.exists(casacoretooldir): 76 print "Could not find casacore scons tools" 77 Exit(1) 78 79 # load casacore specific build flags 80 print casacoretooldir 81 env.Tool('casa', [casacoretooldir]) 82 48 83 if not env.GetOption('clean'): 49 84 conf = Configure(env) 50 # import Custom tests51 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)57 85 conf.env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()]) 58 86 if not conf.CheckHeader("Python.h", language='c'): 59 87 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"]) 73 91 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) 77 134 if not conf.CheckLib('stdc++', language='c++'): Exit(1) 78 if not conf.CheckCasa(env["casadir"]): Exit(1)79 135 env = conf.Finish() 80 136 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']) 137 env["version"] = "trunk" 89 138 90 139 if env['mode'] == 'release': … … 94 143 Export("env") 95 144 145 # build externals 146 env.SConscript("external/SConscript") 96 147 # build library 97 148 so = env.SConscript("src/SConscript", build_dir="build", duplicate=0) -
trunk/scons/utils.py
r1184 r1325 14 14 env.PrependUnique(LIBPATH = [os.path.join(path, "lib")]) 15 15 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 16 68 17 69 def WalkDirTree(targetroot, sourceroot, sources): -
trunk/src/MathUtils.cpp
r996 r1325 100 100 return out; 101 101 } 102 103 void 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 50 50 * @param ignoreOther drop every second channel (NYI) 51 51 */ 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, 52 void 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, 55 56 casa::Bool relaxed=casa::False, 56 57 casa::Bool ignoreOther=casa::False); -
trunk/src/SConscript
r1135 r1325 10 10 for pf in pycpps: cpps.remove(pf) 11 11 12 casalibd = os.path.join(myenv['CASAROOT'],myenv['CASAARCH'],'lib')13 14 12 # location of libcasav.a 15 13 myenv.Prepend( LIBPATH = ['#/build'] ) 16 myenv.Install('#build', os.path.join(casalibd, 'libwcs.a'))17 14 myenv['SHLIBPREFIX']="" #gets rid of lib prefix 18 15 myenv.Append(CCFLAGS=["-DWCSLIB_GETWCSTAB"]) 19 16 # need to create library here to fool scons linker 20 casav = myenv.StaticLibrary(target = "casav", source = os.path.join(casalibd, 'version.o'))21 17 libasap = myenv.StaticLibrary(target = "asap", source = cpps) 22 18 myenv.Prepend( LIBS = ['asap'] ) 23 19 24 20 # Finally create the library for the module 25 so = myenv. SharedLibrary( target = "_asap", source = pycpps)21 so = myenv.LoadableModule( target = "_asap.so", source = pycpps, SHLIBSUFFIX="" ) 26 22 #test = myenv.Program("test", cpps) 27 23 Return("so") -
trunk/src/Scantable.cpp
r1323 r1325 22 22 #include <casa/Arrays/ArrayLogical.h> 23 23 #include <casa/Arrays/ArrayAccessor.h> 24 #include <casa/Arrays/Vector.h> 24 25 #include <casa/Arrays/VectorSTLIterator.h> 25 #include <casa/Arrays/Vector.h>26 26 #include <casa/BasicMath/Math.h> 27 27 #include <casa/BasicSL/Constants.h> … … 42 42 #include <tables/Tables/ExprNode.h> 43 43 #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> 44 52 #include <measures/Measures/MFrequency.h> 45 53 #include <measures/Measures/MEpoch.h> 46 #include <measures/Measures/MeasTable.h>47 #include <measures/Measures/MeasRef.h>48 54 #include <measures/TableMeasures/TableMeasRefDesc.h> 49 55 #include <measures/TableMeasures/TableMeasValueDesc.h> … … 51 57 #include <measures/TableMeasures/ScalarMeasColumn.h> 52 58 #include <coordinates/Coordinates/CoordinateUtil.h> 53 #include <casa/Quanta/MVTime.h>54 #include <casa/Quanta/MVAngle.h>55 59 56 60 #include "Scantable.h"
Note:
See TracChangeset
for help on using the changeset viewer.