diff -Nru casacore-2.2.0/casa/Arrays/Cube.tcc casacore-2.3.0/casa/Arrays/Cube.tcc --- casacore-2.2.0/casa/Arrays/Cube.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Arrays/Cube.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -327,7 +327,6 @@ Cube *This = const_cast*>(this); // Cast away constness, but the return type is a const Matrix, so // this should still be safe. - cout << "test" << endl; return This->xzPlane(which); } diff -Nru casacore-2.2.0/casa/CMakeLists.txt casacore-2.3.0/casa/CMakeLists.txt --- casacore-2.2.0/casa/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -244,6 +244,7 @@ ${de_libraries} ${libm} dl +${CASACORE_ARCH_LIBS} ) add_subdirectory (apps) diff -Nru casacore-2.2.0/casa/Containers/ValueHolder.h casacore-2.3.0/casa/Containers/ValueHolder.h --- casacore-2.2.0/casa/Containers/ValueHolder.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Containers/ValueHolder.h 2017-10-12 12:24:04.000000000 +0000 @@ -125,6 +125,7 @@ { return itsRep.null(); } // Get the data type (as defined in DataType.h). + // Note that TpOther is returned for an empty untyped array. DataType dataType() const; // Get the value. diff -Nru casacore-2.2.0/casa/Exceptions/Error.h casacore-2.3.0/casa/Exceptions/Error.h --- casacore-2.2.0/casa/Exceptions/Error.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Exceptions/Error.h 2017-10-12 12:24:04.000000000 +0000 @@ -53,7 +53,7 @@ // NDEBUG is not defined (release build) then a throw is used to report the error. #ifdef NDEBUG -#define AssertCc(c) {assert (c); } +#define AssertCc(c) ((void)0) #else #define AssertCc(c) { if (! (c)) {casacore::AipsError::throwIf (casacore::True, "Assertion failed: " #c, __FILE__, __LINE__, __PRETTY_FUNCTION__); }} #endif @@ -69,7 +69,7 @@ // Asserts when in debug build and issues a warning message to the log in release. #if defined (NDEBUG) -#define AssertOrWarn(c,m) {assert (c);} +#define AssertOrWarn(c,m) ((void)0) #else #define AssertOrWarn(c,m)\ { if (! (c)) {\ diff -Nru casacore-2.2.0/casa/Json/JsonKVMap.cc casacore-2.3.0/casa/Json/JsonKVMap.cc --- casacore-2.2.0/casa/Json/JsonKVMap.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Json/JsonKVMap.cc 2017-10-12 12:24:04.000000000 +0000 @@ -27,6 +27,8 @@ #include #include +#include +#include #include using namespace std; @@ -103,6 +105,15 @@ return value->second.getString(); } + Record JsonKVMap::toRecord() const + { + Record rec; + for (const_iterator iter=begin(); iter!=end(); ++iter) { + rec.defineFromValueHolder (iter->first, iter->second.getValueHolder()); + } + return rec; + } + void JsonKVMap::show (ostream& os) const { for (const_iterator iter=begin(); iter!=end(); ++iter) { diff -Nru casacore-2.2.0/casa/Json/JsonKVMap.h casacore-2.3.0/casa/Json/JsonKVMap.h --- casacore-2.2.0/casa/Json/JsonKVMap.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Json/JsonKVMap.h 2017-10-12 12:24:04.000000000 +0000 @@ -34,6 +34,9 @@ namespace casacore { + //# Forward Declarations + class ValueHolder; + // // Class to hold a collection of JSON key:value pairs. // @@ -98,7 +101,10 @@ DComplex getDComplex (const String& name, const DComplex& defVal) const; const String& getString (const String& name, const String& defVal) const; // - + + // Convert the map to a Record. + Record toRecord() const; + // \name Show the contents of the object // void show (ostream&) const; diff -Nru casacore-2.2.0/casa/Json/JsonOut.cc casacore-2.3.0/casa/Json/JsonOut.cc --- casacore-2.2.0/casa/Json/JsonOut.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Json/JsonOut.cc 2017-10-12 12:24:04.000000000 +0000 @@ -213,6 +213,17 @@ } else { char buf[16]; sprintf (buf, "%.7g", value); + // Add a decimal point if needed, otherwise it is integer. + unsigned i; + for (i=0; i #include #include +#include #include using namespace std; @@ -264,6 +265,48 @@ return nshp.concatenate (shp); } + ValueHolder JsonValue::getValueHolder() const + { + if (isNull()) { + return ValueHolder(); + } + switch (itsDataType) { + case TpBool: + return ValueHolder(*(Bool*)itsValuePtr); + case TpInt64: + return ValueHolder(*(Int64*)itsValuePtr); + case TpDouble: + return ValueHolder(*(double*)itsValuePtr); + case TpDComplex: + return ValueHolder(*(DComplex*)itsValuePtr); + case TpString: + return ValueHolder(*(String*)itsValuePtr); + case TpRecord: + return ValueHolder(((JsonKVMap*)itsValuePtr)->toRecord()); + case TpOther: + break; // a vector which is handled below + default: + throw JsonError("JsonValue::getValueHolder - invalid data type"); + } + vector vec = getVector(); + switch (vectorDataType(vec)) { + case TpBool: + return ValueHolder(Vector(getVecBool())); + case TpInt64: + return ValueHolder(Vector(getVecInt())); + case TpDouble: + return ValueHolder(Vector(getVecDouble())); + case TpDComplex: + return ValueHolder(Vector(getVecDComplex())); + case TpString: + return ValueHolder(Vector(getVecString())); + case TpOther: + return ValueHolder(1, True); // untyped array with 1 axis + default: + throw JsonError("JsonValue::getValueHolder - vector of mixed data types"); + } + } + Bool JsonValue::getBool() const { switch (itsDataType) { diff -Nru casacore-2.2.0/casa/Json/JsonValue.h casacore-2.3.0/casa/Json/JsonValue.h --- casacore-2.2.0/casa/Json/JsonValue.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Json/JsonValue.h 2017-10-12 12:24:04.000000000 +0000 @@ -41,6 +41,7 @@ //# Forward Declarations class JsonKVMap; + class ValueHolder; class IPosition; template class Array; @@ -151,6 +152,11 @@ IPosition shape() const; IPosition vectorShape (const std::vector& vec) const; + // Get the value as a ValueHolder. + // An exception is thrown if the value cannot be represented as such, + // because it a vector of differently typed values or nested vectors. + ValueHolder getValueHolder() const; + // Get the value in the given data type. // Numeric data type promotion can be done as well as conversion of // integer to bool (0=False, other=True). An exception is thrown if diff -Nru casacore-2.2.0/casa/Json/test/tJsonKVMap.cc casacore-2.3.0/casa/Json/test/tJsonKVMap.cc --- casacore-2.2.0/casa/Json/test/tJsonKVMap.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Json/test/tJsonKVMap.cc 2017-10-12 12:24:04.000000000 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -102,6 +103,7 @@ par1 = par; cout << "JsonKVMap par1:" << endl; par1.show (cout); + cout << endl <<"toRecord:" << endl << par1.toRecord() << endl; cout << "JsonKVMap par3:" << endl; JsonKVMap par3(par1); diff -Nru casacore-2.2.0/casa/Json/test/tJsonKVMap.out casacore-2.3.0/casa/Json/test/tJsonKVMap.out --- casacore-2.2.0/casa/Json/test/tJsonKVMap.out 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Json/test/tJsonKVMap.out 2017-10-12 12:24:04.000000000 +0000 @@ -20,6 +20,16 @@ i1 = 10 s1 = "abc" s2 = "defg" + +toRecord: + b1: Bool 1 + b2: Bool 0 + d1: Double 30 + dc1: DComplex (60,70) + i1: Int64 10 + s1: String "abc" + s2: String "defg" + JsonKVMap par3: b1 = true b2 = false diff -Nru casacore-2.2.0/casa/Json/test/tJsonOut.cc casacore-2.3.0/casa/Json/test/tJsonOut.cc --- casacore-2.2.0/casa/Json/test/tJsonOut.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Json/test/tJsonOut.cc 2017-10-12 12:24:04.000000000 +0000 @@ -54,7 +54,14 @@ os.write ("key2", 1, "comment2"); os.write ("key3", -10); os.write ("key4", 11.5f); + os.write ("keyfa", -1e20f); + os.write ("keyfb", -1e-20f); + os.write ("keyfc", -1.f); os.write ("key5", -13.2345); + os.write ("keyda", -1e20); + os.write ("keydb", -1e-20); + os.write ("keydc", -1.); + os.write ("keydd", -123456789012345.123456789012345); os.write ("key6", Complex(-1,2)); os.write ("key7", ValueHolder(DComplex(3,-4))); os.write ("key8", "string"); diff -Nru casacore-2.2.0/casa/Json/test/tJsonOut.out casacore-2.3.0/casa/Json/test/tJsonOut.out --- casacore-2.2.0/casa/Json/test/tJsonOut.out 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Json/test/tJsonOut.out 2017-10-12 12:24:04.000000000 +0000 @@ -23,9 +23,16 @@ ,"key2": 1 ,"key3": -10 ,"key4": 11.5 + ,"keyfa": -1e+20 + ,"keyfb": -1e-20 + ,"keyfc": -1.0 ,"key5": -13.2345 - ,"key6": {"r":-1, "i":2} - ,"key7": {"r":3, "i":-4} + ,"keyda": -1e+20 + ,"keydb": -9.999999999999999e-21 + ,"keydc": -1.0 + ,"keydd": -123456789012345.1 + ,"key6": {"r":-1.0, "i":2.0} + ,"key7": {"r":3.0, "i":-4.0} ,"key8": "string" ,"null1": null ,"null2": null diff -Nru casacore-2.2.0/casa/Json/test/tJsonValue.cc casacore-2.3.0/casa/Json/test/tJsonValue.cc --- casacore-2.2.0/casa/Json/test/tJsonValue.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/Json/test/tJsonValue.cc 2017-10-12 12:24:04.000000000 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -32,7 +33,7 @@ using namespace casacore; using namespace std; -#define AssertExcept(cmd) \ +#define AssertException(cmd) \ { Bool tryFail = False; \ try { cmd ; } catch (const JsonError&) { tryFail = True; } \ AlwaysAssertExit (tryFail); \ @@ -69,36 +70,36 @@ AlwaysAssertExit (JsonValue(Complex()).shape() == IPosition(1,1)); AlwaysAssertExit (JsonValue("").shape() == IPosition(1,1)); - AssertExcept (JsonValue().getBool()); - AssertExcept (JsonValue().getInt()); + AssertException (JsonValue().getBool()); + AssertException (JsonValue().getInt()); AlwaysAssertExit (isNaN (JsonValue().getDouble())); AlwaysAssertExit (isNaN (JsonValue().getDComplex())); - AssertExcept (JsonValue().getString()); + AssertException (JsonValue().getString()); AlwaysAssertExit (JsonValue(True).getBool() == True); - AssertExcept (JsonValue(True).getInt()); - AssertExcept (JsonValue(True).getDouble()); - AssertExcept (JsonValue(True).getDComplex()); - AssertExcept (JsonValue(True).getString()); + AssertException (JsonValue(True).getInt()); + AssertException (JsonValue(True).getDouble()); + AssertException (JsonValue(True).getDComplex()); + AssertException (JsonValue(True).getString()); AlwaysAssertExit (JsonValue(1).getBool() == True); AlwaysAssertExit (JsonValue(0).getBool() == False); AlwaysAssertExit (JsonValue(1).getInt() == 1); AlwaysAssertExit (JsonValue(1).getDouble() == 1.); AlwaysAssertExit (JsonValue(1).getDComplex() == DComplex(1,0)); - AssertExcept (JsonValue(1).getString()); - AssertExcept (JsonValue(-1.).getBool()); - AssertExcept (JsonValue(-1.).getInt()); + AssertException (JsonValue(1).getString()); + AssertException (JsonValue(-1.).getBool()); + AssertException (JsonValue(-1.).getInt()); AlwaysAssertExit (JsonValue(-1.).getDouble() == -1.); AlwaysAssertExit (JsonValue(-1.).getDComplex() == DComplex(-1,0)); - AssertExcept (JsonValue(-1.).getString()); - AssertExcept (JsonValue(DComplex(1,2)).getBool()); - AssertExcept (JsonValue(DComplex(1,2)).getInt()); - AssertExcept (JsonValue(DComplex(1,2)).getDouble()); + AssertException (JsonValue(-1.).getString()); + AssertException (JsonValue(DComplex(1,2)).getBool()); + AssertException (JsonValue(DComplex(1,2)).getInt()); + AssertException (JsonValue(DComplex(1,2)).getDouble()); AlwaysAssertExit (JsonValue(DComplex(1,2)).getDComplex() == DComplex(1,2)); - AssertExcept (JsonValue(DComplex(1,2)).getString()); - AssertExcept (JsonValue("1,2").getBool()); - AssertExcept (JsonValue("1,2").getInt()); - AssertExcept (JsonValue("1,2").getDouble()); - AssertExcept (JsonValue("1,2").getDComplex()); + AssertException (JsonValue(DComplex(1,2)).getString()); + AssertException (JsonValue("1,2").getBool()); + AssertException (JsonValue("1,2").getInt()); + AssertException (JsonValue("1,2").getDouble()); + AssertException (JsonValue("1,2").getDComplex()); AlwaysAssertExit (JsonValue("1,2").getString() == "1,2"); } @@ -120,7 +121,7 @@ AlwaysAssertExit (JsonValue(vec).getVecInt().size() == 1); AlwaysAssertExit (JsonValue(vec).getVecDouble().size() == 1); AlwaysAssertExit (JsonValue(vec).getVecDComplex().size() == 1); - AssertExcept (JsonValue(vec).getVecString()); + AssertException (JsonValue(vec).getVecString()); AlwaysAssertExit (JsonValue(vec).getVecInt()[0] == 10); vec.push_back (JsonValue(2)); @@ -132,7 +133,7 @@ AlwaysAssertExit (JsonValue(vec).getVecInt().size() == 2); AlwaysAssertExit (JsonValue(vec).getVecDouble().size() == 2); AlwaysAssertExit (JsonValue(vec).getVecDComplex().size() == 2); - AssertExcept (JsonValue(vec).getVecString()); + AssertException (JsonValue(vec).getVecString()); AlwaysAssertExit (JsonValue(vec).getVecInt()[0] == 10); AlwaysAssertExit (JsonValue(vec).getVecInt()[1] == 2); @@ -141,11 +142,11 @@ AlwaysAssertExit (JsonValue(vec).arrayDataType() == TpDouble); AlwaysAssertExit (JsonValue(vec).size() == 3); AlwaysAssertExit (JsonValue(vec).shape() == IPosition(1,3)); - AssertExcept (JsonValue(vec).getVecBool()); - AssertExcept (JsonValue(vec).getVecInt()); + AssertException (JsonValue(vec).getVecBool()); + AssertException (JsonValue(vec).getVecInt()); AlwaysAssertExit (JsonValue(vec).getVecDouble().size() == 3); AlwaysAssertExit (JsonValue(vec).getVecDComplex().size() == 3); - AssertExcept (JsonValue(vec).getVecString()); + AssertException (JsonValue(vec).getVecString()); AlwaysAssertExit (JsonValue(vec).getVecDouble()[0] == 10); AlwaysAssertExit (JsonValue(vec).getVecDouble()[1] == 2); AlwaysAssertExit (JsonValue(vec).getVecDouble()[2] == 3); @@ -155,11 +156,11 @@ AlwaysAssertExit (JsonValue(vec).arrayDataType() == TpDComplex); AlwaysAssertExit (JsonValue(vec).size() == 4); AlwaysAssertExit (JsonValue(vec).shape() == IPosition(1,4)); - AssertExcept (JsonValue(vec).getVecBool()); - AssertExcept (JsonValue(vec).getVecInt()); - AssertExcept (JsonValue(vec).getVecDouble()); + AssertException (JsonValue(vec).getVecBool()); + AssertException (JsonValue(vec).getVecInt()); + AssertException (JsonValue(vec).getVecDouble()); AlwaysAssertExit (JsonValue(vec).getVecDComplex().size() == 4); - AssertExcept (JsonValue(vec).getVecString()); + AssertException (JsonValue(vec).getVecString()); AlwaysAssertExit (JsonValue(vec).getVecDComplex()[0] == DComplex(10,0)); AlwaysAssertExit (JsonValue(vec).getVecDComplex()[1] == DComplex(2,0)); AlwaysAssertExit (JsonValue(vec).getVecDComplex()[2] == DComplex(3,0)); @@ -170,17 +171,17 @@ AlwaysAssertExit (JsonValue(vec).arrayDataType() == TpDComplex); AlwaysAssertExit (JsonValue(vec).size() == 5); AlwaysAssertExit (JsonValue(vec).shape() == IPosition(1,5)); - AssertExcept (JsonValue(vec).getVecBool()); - AssertExcept (JsonValue(vec).getVecInt()); - AssertExcept (JsonValue(vec).getVecDouble()); + AssertException (JsonValue(vec).getVecBool()); + AssertException (JsonValue(vec).getVecInt()); + AssertException (JsonValue(vec).getVecDouble()); AlwaysAssertExit (JsonValue(vec).getVecDComplex().size() == 5); - AssertExcept (JsonValue(vec).getVecString()); + AssertException (JsonValue(vec).getVecString()); AlwaysAssertExit (JsonValue(vec).getVecDComplex()[0] == DComplex(10,0)); AlwaysAssertExit (JsonValue(vec).getVecDComplex()[1] == DComplex(2,0)); AlwaysAssertExit (JsonValue(vec).getVecDComplex()[2] == DComplex(3,0)); AlwaysAssertExit (JsonValue(vec).getVecDComplex()[3] == DComplex(-1,-2)); AlwaysAssertExit (JsonValue(vec).getVecDComplex()[4] == DComplex(3,0)); - AssertExcept (JsonValue(vec).getArrayDouble()); + AssertException (JsonValue(vec).getArrayDouble()); AlwaysAssertExit (JsonValue(vec).getArrayDComplex().shape() == IPosition(1,5)); AlwaysAssertExit (JsonValue(vec).getArrayDComplex().data()[0] == DComplex(10,0)); AlwaysAssertExit (JsonValue(vec).getArrayDComplex().data()[1] == DComplex(2,0)); @@ -211,12 +212,39 @@ AlwaysAssertExit (allEQ(arr,exp)); } +void doValueHolder() +{ + AlwaysAssertExit (JsonValue().getValueHolder().isNull()); + AlwaysAssertExit (! JsonValue(1).getValueHolder().isNull()); + AlwaysAssertExit (JsonValue(1).getValueHolder().dataType() == TpInt64); + AlwaysAssertExit (JsonValue(1.).getValueHolder().dataType() == TpDouble); + AlwaysAssertExit (JsonValue(Complex()).getValueHolder().dataType() == TpDComplex); + AlwaysAssertExit (JsonValue("a").getValueHolder().dataType() == TpString); + AlwaysAssertExit (JsonValue(1).getValueHolder().asInt() == 1); + AlwaysAssertExit (JsonValue(1.).getValueHolder().asDouble() == 1.); + AlwaysAssertExit (JsonValue(Complex()).getValueHolder().asDComplex() == DComplex()); + AlwaysAssertExit (JsonValue("a").getValueHolder().asString() == "a"); + AlwaysAssertExit (JsonValue(vector()).getValueHolder().dataType() == TpOther); + AlwaysAssertExit (JsonValue(vector(1, JsonValue(True))).getValueHolder().dataType() == TpArrayBool); + AlwaysAssertExit (JsonValue(vector(1, JsonValue(1))).getValueHolder().dataType() == TpArrayInt64); + AlwaysAssertExit (JsonValue(vector(1, JsonValue(1.))).getValueHolder().dataType() == TpArrayDouble); + AlwaysAssertExit (JsonValue(vector(1, JsonValue(Complex()))).getValueHolder().dataType() == TpArrayDComplex); + AlwaysAssertExit (JsonValue(vector(1, JsonValue("a"))).getValueHolder().dataType() == TpArrayString); + AlwaysAssertExit (JsonValue(vector(1, JsonValue(True))).getValueHolder().asArrayBool().size() == 1); + AlwaysAssertExit (JsonValue(vector(1, JsonValue(True))).getValueHolder().asArrayBool().data()[0] == True); + AlwaysAssertExit (JsonValue(vector(1, JsonValue(-2))).getValueHolder().asArrayInt().data()[0] == -2); + AlwaysAssertExit (JsonValue(vector(1, JsonValue(2.5))).getValueHolder().asArrayDouble().data()[0] == 2.5); + AlwaysAssertExit (JsonValue(vector(1, JsonValue(DComplex(1,2)))).getValueHolder().asArrayDComplex().data()[0] == DComplex(1,2)); + AlwaysAssertExit (JsonValue(vector(1, JsonValue("bc"))).getValueHolder().asArrayString().data()[0] == "bc"); +} + int main() { try { doScalar(); doVector(); doArray(); + doValueHolder(); } catch (const std::exception& x) { cout << "Unexpected exception: " << x.what() << endl; exit(1); diff -Nru casacore-2.2.0/casa/version.cc casacore-2.3.0/casa/version.cc --- casacore-2.2.0/casa/version.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/version.cc 2017-10-12 12:24:04.000000000 +0000 @@ -30,10 +30,9 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN // Get the casacore version. - const std::string getVersion() + const char* getVersion() { - static std::string version("trunk"); - return version; + return CASACORE_VERSION; } // Get the version of casacore on CASA's vendor branch diff -Nru casacore-2.2.0/casa/version.h casacore-2.3.0/casa/version.h --- casacore-2.2.0/casa/version.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/casa/version.h 2017-10-12 12:24:04.000000000 +0000 @@ -32,7 +32,7 @@ #include #define CASACORE_MAJOR_VERSION 2 -#define CASACORE_MINOR_VERSION 2 +#define CASACORE_MINOR_VERSION 3 #define CASACORE_PATCH_VERSION 0 #define CASACORE_VERSION CASACORE_STRINGIFY(CASACORE_MAJOR_VERSION.CASACORE_MINOR_VERSION.CASACORE_PATCH_VERSION) @@ -40,7 +40,7 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN // Get the casacore version. - const std::string getVersion(); + extern "C" const char* getVersion(); // Get the version of casacore on CASA's vendor branch // Note: CASA's private version of casacore has a lifecycle diff -Nru casacore-2.2.0/CHANGES.md casacore-2.3.0/CHANGES.md --- casacore-2.2.0/CHANGES.md 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/CHANGES.md 2017-10-12 12:24:04.000000000 +0000 @@ -1,10 +1,31 @@ +# 2.3.0 + +## General +- Bug fixes and improvements +- Improved installation documentation in README +- Add an option to use Ccache (`-DUseCcache`) (#549) +- Add some statistics functionality (#569) + +## Python +- Make some of the TableProxy functionality publicly available (#559) +- Make version checking from python (or plain C) possible (#583) + +## TaQL +- Fix transpose in TaQL (#563) +- Added functions `delay` and `uvwapp` to `mscal` (#562) + +## FITS +- MSFitsOutput now writes ant diams (#536) +- Improvements to FITS-IDI conversion (#538, #590, #579) + + # 2.2.0 ## General - Lots of bug fixes and improvements - Tests are not built by default anymore, use `-DBUILD_TESTING=True` to build them -- Building with C++11 is now default, use `-DUSE_CXX11=False` if you do +- Building with C++11 is now default, use `-DCXX11=False` if you do not have a recent compiler (#533) - Added JSON support (#506) diff -Nru casacore-2.2.0/CMakeLists.txt casacore-2.3.0/CMakeLists.txt --- casacore-2.2.0/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -14,7 +14,7 @@ endif() set(PROJECT_VERSION_MAJOR 2) -set(PROJECT_VERSION_MINOR 2) +set(PROJECT_VERSION_MINOR 3) set(PROJECT_VERSION_PATCH 0) set(PROJECT_VERSION_REVISION 1) set(PROJECT_VERSION @@ -78,6 +78,20 @@ set(CASA_DEFAULT_ALIGNMENT "32" CACHE STRING "Default alignment of casa::AlignedAllocator") +# ccache use is optional +option( UseCcache OFF ) + +if (UseCcache) + message (STATUS "Searching for ccache.") + find_program(CCACHE_FOUND ccache) + if(CCACHE_FOUND) + message (STATUS "Ccache found.") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif(CCACHE_FOUND) +endif() + + # basic setup for building within CASA environment if( CASA_BUILD ) if( NOT DATA_DIR ) @@ -240,19 +254,21 @@ # #This has measurable impact on e.g. applycal where the cpu performance improves #by about 20%. -check_cxx_compiler_flag(-fcx-fortran-rules HAS_GXX_FORTRAN_RULES) -check_c_compiler_flag(-fcx-fortran-rules HAS_GCC_FORTRAN_RULES) -# added before cmake flags so it can be disabled with -# -fno-cx-fortran-rules for testing -if (HAS_GXX_FORTRAN_RULES) - set(CMAKE_CXX_FLAGS "-fcx-fortran-rules ${CMAKE_CXX_FLAGS}") -endif() -if (HAS_GCC_FORTRAN_RULES) - set(CMAKE_C_FLAGS "-fcx-fortran-rules ${CMAKE_C_FLAGS}") -endif() - -# Ensure clang is not complaining about unused arguments. -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +# For one reason or another the check on the compiler flag has no +# effect; it still adds the option which fails for clang. +if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + check_cxx_compiler_flag(-fcx-fortran-rules HAS_GXX_FORTRAN_RULES) + check_c_compiler_flag(-fcx-fortran-rules HAS_GCC_FORTRAN_RULES) + # added before cmake flags so it can be disabled with + # -fno-cx-fortran-rules for testing + if (HAS_GXX_FORTRAN_RULES) + set(CMAKE_CXX_FLAGS "-fcx-fortran-rules ${CMAKE_CXX_FLAGS}") + endif() + if (HAS_GCC_FORTRAN_RULES) + set(CMAKE_C_FLAGS "-fcx-fortran-rules ${CMAKE_C_FLAGS}") + endif() +else() + # Ensure clang is not complaining about unused arguments. set(CMAKE_CXX_FLAGS "-Qunused-arguments ${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS "-Qunused-arguments ${CMAKE_C_FLAGS}") endif() @@ -383,12 +399,30 @@ add_definitions(-DHAVE_READLINE) endif (READLINE_FOUND) +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + ## setting intel libraries with e.g. + ## + ## find_library( INTEL_IRNG irng HINTS ${INTEL_PATH} ) + ## + ## causes CMAKE to substitute fully qualified paths which makes + ## python shared object unrelocatable in the case of libirng.so + ## + get_filename_component(INTEL_PATH ${CMAKE_CXX_COMPILER} DIRECTORY) + set(INTEL_LIB_PATH ${INTEL_PATH}/../lib/intel64) + set(CASACORE_ARCH_LIBS ${CASACORE_ARCH_LIBS} -L${INTEL_LIB_PATH} -limf -lsvml -lirng -lintlc -lifport -lifcore -liomp5) +endif() + if(USE_OPENMP) set (USE_THREADS YES) find_package (OpenMP) if (OPENMP_FOUND) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qopenmp") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qopenmp") + else( ) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + endif( ) else (OPENMP_FOUND) message(WARNING "Cannot fullfill USE_OPENMP, compiler does not support it") endif (OPENMP_FOUND) @@ -400,11 +434,13 @@ add_definitions(-DUSE_THREADS) if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") + elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") else() if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread") else() - message(FATAL_ERROR "${_errmsg} ${CMAKE_C_COMPILER}") + message(FATAL_ERROR "${_errmsg} (${CMAKE_C_COMPILER_ID}): ${CMAKE_C_COMPILER}") endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") endif(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCXX) @@ -412,8 +448,10 @@ else() if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") else() - message(FATAL_ERROR "${_errmsg} ${CMAKE_CXX_COMPILER}") + message(FATAL_ERROR "${_errmsg} (${CMAKE_C_COMPILER_ID}): ${CMAKE_CXX_COMPILER}") endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") endif(CMAKE_COMPILER_IS_GNUCXX) endif(USE_THREADS) diff -Nru casacore-2.2.0/coordinates/CMakeLists.txt casacore-2.3.0/coordinates/CMakeLists.txt --- casacore-2.2.0/coordinates/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/coordinates/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -22,7 +22,7 @@ Coordinates/TabularCoordinate.cc ) -target_link_libraries (casa_coordinates casa_fits ${WCSLIB_LIBRARIES}) +target_link_libraries (casa_coordinates casa_fits ${WCSLIB_LIBRARIES} ${CASACORE_ARCH_LIBS}) install (TARGETS casa_coordinates RUNTIME DESTINATION bin diff -Nru casacore-2.2.0/debian/changelog casacore-2.3.0/debian/changelog --- casacore-2.2.0/debian/changelog 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/changelog 2017-10-19 13:16:59.000000000 +0000 @@ -1,8 +1,39 @@ -casacore (2.2.0-2kern1) xenial; urgency=medium +casacore (2.3.0-4kern2) xenial; urgency=medium - * build for KERN + * repack for KERN - -- Gijs Molenaar (launchpad ppa build key) Tue, 31 Jan 2017 07:32:09 +0000 + -- Gijs Molenaar (launchpad ppa build key) Thu, 12 Oct 2017 14:32:03 +0200 + +casacore (2.3.0-4) unstable; urgency=low + + * Add support for python3.6 (Closes: #873667) + * Push Standards-Version to 4.1.0. No changes needed. + * Set -dev package to Multi-Arch: same as suggested my Multiarch hinter + + -- Ole Streicher Wed, 30 Aug 2017 17:29:15 +0200 + +casacore (2.3.0-3) unstable; urgency=low + + * Fix accuracy for near(rms(pos), expRMS) in tLatticeStatistics + + -- Ole Streicher Tue, 04 Jul 2017 12:18:47 +0200 + +casacore (2.3.0-2) unstable; urgency=low + + * Fix FTBFS tStatisticsUtilities, tLatticeStatistics and tLCEllipsoid + on arm64 + * Disable tLSQaips and tLSQFit tests. Closes: #838424 + * Rediff patches, remove patch numbers + + -- Ole Streicher Tue, 04 Jul 2017 09:39:13 +0200 + +casacore (2.3.0-1) unstable; urgency=low + + * New upstream version 2.3.0 + * Rediff patches + * Push Standards-Version to 4.0.0. No changes. + + -- Ole Streicher Fri, 23 Jun 2017 20:53:23 +0200 casacore (2.2.0-2) unstable; urgency=medium diff -Nru casacore-2.2.0/debian/control casacore-2.3.0/debian/control --- casacore-2.2.0/debian/control 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/control 2017-10-12 12:30:54.000000000 +0000 @@ -1,6 +1,6 @@ Source: casacore Priority: optional -Maintainer: Debian Astronomy & Astrophysics Maintainers +Maintainer: Debian Astro Team Uploaders: Benda Xu , Ole Streicher Build-Depends: bison, cmake (>= 1.6.2), @@ -20,7 +20,7 @@ python3-dev, python3-numpy, wcslib-dev -Standards-Version: 3.9.8 +Standards-Version: 4.1.0 Section: science Homepage: http://casacore.github.io/casacore Vcs-Git: https://anonscm.debian.org/git/debian-astro/packages/casacore.git @@ -29,6 +29,7 @@ Package: casacore-dev Section: libdevel Architecture: any +Multi-Arch: same Depends: libcasa-casa2 (= ${binary:Version}), libcasa-coordinates2 (= ${binary:Version}), libcasa-derivedmscal2 (= ${binary:Version}), diff -Nru casacore-2.2.0/debian/patches/0001-Do-not-install-test-and-demonstration-executables.patch casacore-2.3.0/debian/patches/0001-Do-not-install-test-and-demonstration-executables.patch --- casacore-2.2.0/debian/patches/0001-Do-not-install-test-and-demonstration-executables.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0001-Do-not-install-test-and-demonstration-executables.patch 2017-10-12 12:30:54.000000000 +0000 @@ -12,23 +12,23 @@ delete mode 100644 msfits/apps/CMakeLists.txt diff --git a/measures/apps/CMakeLists.txt b/measures/apps/CMakeLists.txt -index 8eff961..b888c9d 100644 +index fcf2184..1bbf19f 100644 --- a/measures/apps/CMakeLists.txt +++ b/measures/apps/CMakeLists.txt @@ -7,4 +7,4 @@ endforeach(prog findmeastable) add_executable (measuresdata measuresdata/measuresdata.cc) - target_link_libraries (measuresdata casa_measures) + target_link_libraries (measuresdata casa_measures ${CASACORE_ARCH_LIBS}) install(TARGETS measuresdata DESTINATION bin) -install(PROGRAMS measuresdata/measuresdata-update DESTINATION bin) +install(PROGRAMS DESTINATION bin) diff --git a/msfits/apps/CMakeLists.txt b/msfits/apps/CMakeLists.txt deleted file mode 100644 -index d57af6d..0000000 +index d2775c8..0000000 --- a/msfits/apps/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -foreach(prog ms2uvfits) - add_executable (${prog} ${prog}.cc) -- target_link_libraries (${prog} casa_msfits) +- target_link_libraries (${prog} casa_msfits ${CASACORE_ARCH_LIBS}) - install(TARGETS ${prog} DESTINATION bin) -endforeach(prog ms2uvfits) diff -Nru casacore-2.2.0/debian/patches/0002-Disable-class-and-collaboration-graph-generation.patch casacore-2.3.0/debian/patches/0002-Disable-class-and-collaboration-graph-generation.patch --- casacore-2.2.0/debian/patches/0002-Disable-class-and-collaboration-graph-generation.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0002-Disable-class-and-collaboration-graph-generation.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -From: Benda Xu -Date: Thu, 11 Sep 2014 18:20:44 +0900 -Subject: Disable class and collaboration graph generation - -The graphviz-generated class and collaboration graph -occupies 1GB disk space. It is too big to deal with. We turn them -off only to save space. Output image format is specified as svg to -further save space (bug #751947). ---- - doxygen.cfg | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/doxygen.cfg b/doxygen.cfg -index 9071e88..94b7ccb 100644 ---- a/doxygen.cfg -+++ b/doxygen.cfg -@@ -2103,7 +2103,7 @@ DOT_FONTPATH = - # The default value is: YES. - # This tag requires that the tag HAVE_DOT is set to YES. - --CLASS_GRAPH = YES -+CLASS_GRAPH = NO - - # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a - # graph for each documented class showing the direct and indirect implementation -@@ -2112,7 +2112,7 @@ CLASS_GRAPH = YES - # The default value is: YES. - # This tag requires that the tag HAVE_DOT is set to YES. - --COLLABORATION_GRAPH = YES -+COLLABORATION_GRAPH = NO - - # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for - # groups, showing the direct groups dependencies. -@@ -2215,7 +2215,7 @@ DIRECTORY_GRAPH = NO - # The default value is: png. - # This tag requires that the tag HAVE_DOT is set to YES. - --DOT_IMAGE_FORMAT = png -+DOT_IMAGE_FORMAT = svg - - # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to - # enable generation of interactive SVG images that allow zooming and panning. diff -Nru casacore-2.2.0/debian/patches/0003-Disable-tests-that-require-data-tables.patch casacore-2.3.0/debian/patches/0003-Disable-tests-that-require-data-tables.patch --- casacore-2.2.0/debian/patches/0003-Disable-tests-that-require-data-tables.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0003-Disable-tests-that-require-data-tables.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,253 +0,0 @@ -From: Benda Xu -Date: Wed, 10 Sep 2014 10:00:43 +0900 -Subject: Disable tests that require data tables - -The data tables are not available during the build of casacore (yet). ---- - coordinates/Coordinates/test/CMakeLists.txt | 12 ++++----- - images/Images/test/CMakeLists.txt | 40 ++++++++++++++--------------- - images/Regions/test/CMakeLists.txt | 8 +++--- - lattices/LatticeMath/test/CMakeLists.txt | 2 +- - meas/MeasUDF/test/CMakeLists.txt | 2 +- - measures/Measures/test/CMakeLists.txt | 37 ++++++++++++-------------- - measures/TableMeasures/test/CMakeLists.txt | 2 +- - ms/MSOper/test/CMakeLists.txt | 6 ++--- - ms/MeasurementSets/test/CMakeLists.txt | 2 +- - 9 files changed, 53 insertions(+), 58 deletions(-) - -diff --git a/coordinates/Coordinates/test/CMakeLists.txt b/coordinates/Coordinates/test/CMakeLists.txt -index bd1c996..248b395 100644 ---- a/coordinates/Coordinates/test/CMakeLists.txt -+++ b/coordinates/Coordinates/test/CMakeLists.txt -@@ -1,18 +1,18 @@ - set (tests --dCoordinates -+#dCoordinates # requires geodetic/Observatories - dRemoveAxes - dWorldMap - tCoordinate --tCoordinateSystem --tCoordinateUtil -+# tCoordinateSystem # requires geodetic/Observatories -+# tCoordinateUtil # requires geodetic/Observatories - tDirectionCoordinate --tFrequencyAligner -+# tFrequencyAligner # requires geodetic/Observatories - tGaussianConvert - tLinearCoordinate - tLinearXform --tObsInfo -+# tObsInfo # requires geodetic/Observatories - tProjection --tSpectralCoordinate -+# tSpectralCoordinate # requires geodetic/Observatories - tStokesCoordinate - tQualityCoordinate - tTabularCoordinate -diff --git a/images/Images/test/CMakeLists.txt b/images/Images/test/CMakeLists.txt -index 302d798..4115c29 100644 ---- a/images/Images/test/CMakeLists.txt -+++ b/images/Images/test/CMakeLists.txt -@@ -35,39 +35,39 @@ endforeach (file) - - set (tests - dImageInterface --dImageStatistics --dImageSummary -+# dImageStatistics # requires geodetic/Observatories -+# dImageSummary # requires geodetic/Observatories - dPagedImage - tExtendImage --tFITSErrorImage -+# tFITSErrorImage # - tFITSExtImage - tFITSExtImageII - tFITSImage - tFITSImgParser --tFITSQualityImage -+# tFITSQualityImage # - tHDF5Image --tImageAttrHandler --tImageBeamSet --tImageConcat --tImageEmpty --tImageExpr --tImageExpr2 --tImageExpr2Gram --tImageExpr3Gram -+# tImageAttrHandler # requires geodetic/Observatories -+# tImageBeamSet # -+# tImageConcat # needs casacore-data -+# tImageEmpty # requires geodetic/Observatories -+# tImageExpr -+# tImageExpr2 -+# tImageExpr2Gram # requires geodetic/Observatories -+# tImageExpr3Gram # requires geodetic/Observatories - tImageExprGram - tImageExprParse - tImageExprParse_addDir - tImageInfo --tImageProxy --tImageRegrid -+# tImageProxy -+# tImageRegrid # requires geodetic/Observatories - tImageStatistics --tImageStatistics2 --tImageUtilities --tLELSpectralIndex -+# tImageStatistics2 # requires geodetic/Observatories -+# tImageUtilities # requires geodetic/Observatories -+# tLELSpectralIndex # requires geodetic/Observatories - tMIRIADImage --tPagedImage --tPagedImage2 --tRebinImage -+# tPagedImage # requires geodetic/Observatories -+# tPagedImage2 # requires geodetic/Observatories -+# tRebinImage # requires geodetic/Observatories - tSubImage - tTempImage - ) -diff --git a/images/Regions/test/CMakeLists.txt b/images/Regions/test/CMakeLists.txt -index b94c391..1201346 100644 ---- a/images/Regions/test/CMakeLists.txt -+++ b/images/Regions/test/CMakeLists.txt -@@ -9,12 +9,12 @@ foreach (file ${datafiles}) - endforeach (file) - - set (tests --tImageRegion -+# tImageRegion - tRegionHandler --tWCBox --tWCEllipsoid -+# tWCBox # requires geodetic/Observatories -+# tWCEllipsoid - tWCExtension --tWCLELMask -+# tWCLELMask # requires geodetic/Observatories - tWCUnion - ) - -diff --git a/lattices/LatticeMath/test/CMakeLists.txt b/lattices/LatticeMath/test/CMakeLists.txt -index 0d869d5..47e5c76 100644 ---- a/lattices/LatticeMath/test/CMakeLists.txt -+++ b/lattices/LatticeMath/test/CMakeLists.txt -@@ -13,7 +13,7 @@ tLatticeSlice1D - tLatticeStatistics - tLatticeStatsDataProvider - tLatticeTwoPtCorr --tLattStatsSpecialize -+# tLattStatsSpecialize - ) - - foreach (test ${tests}) -diff --git a/meas/MeasUDF/test/CMakeLists.txt b/meas/MeasUDF/test/CMakeLists.txt -index a2ecd9a..b06ee99 100644 ---- a/meas/MeasUDF/test/CMakeLists.txt -+++ b/meas/MeasUDF/test/CMakeLists.txt -@@ -1,5 +1,5 @@ - set (tests -- tmeas -+# tmeas # requires casacore-data - ) - - foreach (test ${tests}) -diff --git a/measures/Measures/test/CMakeLists.txt b/measures/Measures/test/CMakeLists.txt -index c10a670..261adb1 100644 ---- a/measures/Measures/test/CMakeLists.txt -+++ b/measures/Measures/test/CMakeLists.txt -@@ -1,25 +1,25 @@ - set (tests - dM1950_2000 --dMeasure --tEarthField --tEarthMagneticMachine --tMBaseline --tMDirection --tMEarthMagnetic --tMFrequency --tMeasComet --tMeasIERS --tMeasJPL -+# dMeasure # geodetic/TAI_UTC -+# tEarthField # geodetic/IGRF -+# tEarthMagneticMachine # geodetic/IGRF -+# tMBaseline # geodetic/IGRF -+# tMDirection -+# tMEarthMagnetic # geodetic/IGRF -+# tMFrequency -+# tMeasComet # ephemerides/VGEO -+# tMeasIERS # geodetic/IERS* -+# tMeasJPL # ephemerides/DE200 - tMeasMath --tMeasure -+# tMeasure # geodetic/TAI_UTC - tMeasureHolder --tMuvw --tParAngleMachine --tQuality -+# tMuvw # geodetic/TAI_UTC -+# tParAngleMachine # geodetic/TAI_UTC -+# tQuality - tRecordTransformable - tStokes - tUVWMachine --tVelocityMachine -+# tVelocityMachine # geodetic/TAI_UTC - ) - - foreach (test ${tests}) -@@ -29,9 +29,4 @@ foreach (test ${tests}) - add_dependencies(check ${test}) - endforeach (test) - --if (SOFA_FOUND) -- add_executable (tIAU2000 SofaTest.cc tIAU2000.cc) -- target_link_libraries (tIAU2000 casa_measures ${SOFA_LIBRARY}) -- add_test (tIAU2000 ${CMAKE_SOURCE_DIR}/cmake/cmake_assay ./tIAU2000) -- add_dependencies(check tIAU2000) --endif (SOFA_FOUND) -+# tIAU2000 disabled for missing geodetic/TAI_UTC -diff --git a/measures/TableMeasures/test/CMakeLists.txt b/measures/TableMeasures/test/CMakeLists.txt -index e7c4af1..84e7d6d 100644 ---- a/measures/TableMeasures/test/CMakeLists.txt -+++ b/measures/TableMeasures/test/CMakeLists.txt -@@ -1,6 +1,6 @@ - set (tests - tTableQuantum --tTableMeasures -+# tTableMeasures # geodetic/{IERSeop{2000,97},IERSpredict{,2000},TAI_UTC} - dVarRefMdirCol - ) - -diff --git a/ms/MSOper/test/CMakeLists.txt b/ms/MSOper/test/CMakeLists.txt -index e53aec3..81912cd 100644 ---- a/ms/MSOper/test/CMakeLists.txt -+++ b/ms/MSOper/test/CMakeLists.txt -@@ -1,9 +1,9 @@ - set (tests --tMSDerivedValues --tMSKeys -+# tMSDerivedValues # geodetic/IERSpredict -+# tMSKeys - tMSMetaData - tMSReader --tMSSummary -+# tMSSummary - ) - - foreach (test ${tests}) -diff --git a/ms/MeasurementSets/test/CMakeLists.txt b/ms/MeasurementSets/test/CMakeLists.txt -index 6e66aad..8150ad4 100644 ---- a/ms/MeasurementSets/test/CMakeLists.txt -+++ b/ms/MeasurementSets/test/CMakeLists.txt -@@ -15,7 +15,7 @@ tMeasurementSet - tMSColumns - tMSDataDescBuffer - tMSFieldBuffer --tMSFieldEphem -+#tMSFieldEphem requires casacore-data - tMSIter - tMSMainBuffer - tMSPolBuffer diff -Nru casacore-2.2.0/debian/patches/0004-Disable-tPath-test.patch casacore-2.3.0/debian/patches/0004-Disable-tPath-test.patch --- casacore-2.2.0/debian/patches/0004-Disable-tPath-test.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0004-Disable-tPath-test.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -From: Benda Xu -Date: Wed, 29 Oct 2014 16:40:47 +0900 -Subject: Disable tPath test -MIME-Version: 1.0 -Content-Type: text/plain; charset="utf-8" -Content-Transfer-Encoding: 8bit - -sbuild gets HOME variable leaked into the build environment. Debian -uses sbuild as official build farm. Until the cause is pinned down, -this test is disabled. - - 98/425 Test #101: tPath ...............................***Failed 0.64 sec -1,16d0 -< expanded: /home/heroxbd -< expected: /«PKGBUILDDIR» -< absolute: /home/heroxbd -< expected: /«PKGBUILDDIR» -< expanded: /home/heroxbd/test/test2 -< expected: /«PKGBUILDDIR»/test/test2 -< absolute: /home/heroxbd/test/test2 -< expected: /«PKGBUILDDIR»/test/test2 -< expanded: /home/heroxbd/test -< expected: /«PKGBUILDDIR»/test -< absolute: /home/heroxbd/test -< expected: /«PKGBUILDDIR»/test -< expanded: /home/heroxbd/test -< expected: /«PKGBUILDDIR»/test -< absolute: /home/heroxbd/test -< expected: /«PKGBUILDDIR»/test -33a18 -> OK -FAIL (output not verified): ./tPath ---- - casa/OS/test/CMakeLists.txt | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/casa/OS/test/CMakeLists.txt b/casa/OS/test/CMakeLists.txt -index 520ceed..5fc3c7f 100644 ---- a/casa/OS/test/CMakeLists.txt -+++ b/casa/OS/test/CMakeLists.txt -@@ -14,7 +14,6 @@ tMemory - tMemoryTrace - tModcompConversion - tMutex --tPath - tPrecTimer - tRegularFile - tSymLink diff -Nru casacore-2.2.0/debian/patches/0005-Disable-known-test-failures.patch casacore-2.3.0/debian/patches/0005-Disable-known-test-failures.patch --- casacore-2.2.0/debian/patches/0005-Disable-known-test-failures.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0005-Disable-known-test-failures.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -From: Ole Streicher -Date: Fri, 2 Dec 2016 11:11:28 +0100 -Subject: Disable known test failures - ---- - casa/IO/test/CMakeLists.txt | 4 ++-- - casa/OS/test/CMakeLists.txt | 8 ++++---- - images/Images/test/CMakeLists.txt | 2 +- - lattices/LatticeMath/test/CMakeLists.txt | 2 +- - tables/TaQL/test/CMakeLists.txt | 4 ++-- - 5 files changed, 10 insertions(+), 10 deletions(-) - -diff --git a/casa/IO/test/CMakeLists.txt b/casa/IO/test/CMakeLists.txt -index 188a6c4..3187b60 100644 ---- a/casa/IO/test/CMakeLists.txt -+++ b/casa/IO/test/CMakeLists.txt -@@ -3,9 +3,9 @@ tAipsIOCarray - tAipsIO - tBucketBuffered - tBucketCache --tBucketFile -+# tBucketFile # https://github.com/casacore/casacore/issues/73 - tBucketMapped --tByteIO -+# tByteIO # https://github.com/casacore/casacore/issues/73 - tByteSink - tByteSinkSource - tFilebufIO -diff --git a/casa/OS/test/CMakeLists.txt b/casa/OS/test/CMakeLists.txt -index 5fc3c7f..e5c9ee3 100644 ---- a/casa/OS/test/CMakeLists.txt -+++ b/casa/OS/test/CMakeLists.txt -@@ -3,10 +3,10 @@ tCanonicalConversion - tConversion - tConversionPerf - tDataConversion --tDirectory -+# tDirectory # https://github.com/casacore/casacore/issues/73 - tDirectoryIterator - tEnvVar --tFile -+# tFile # https://github.com/casacore/casacore/issues/73 - tHostInfo - tIBMConversion - tLECanonicalConversion -@@ -15,8 +15,8 @@ tMemoryTrace - tModcompConversion - tMutex - tPrecTimer --tRegularFile --tSymLink -+# tRegularFile # https://github.com/casacore/casacore/issues/73 -+# tSymLink # https://github.com/casacore/casacore/issues/73 - tTime - tTimer - tVAXConversion -diff --git a/images/Images/test/CMakeLists.txt b/images/Images/test/CMakeLists.txt -index 4115c29..6865919 100644 ---- a/images/Images/test/CMakeLists.txt -+++ b/images/Images/test/CMakeLists.txt -@@ -69,7 +69,7 @@ tMIRIADImage - # tPagedImage2 # requires geodetic/Observatories - # tRebinImage # requires geodetic/Observatories - tSubImage --tTempImage -+# tTempImage # https://github.com/casacore/casacore/issues/543 - ) - - foreach (test ${tests}) -diff --git a/lattices/LatticeMath/test/CMakeLists.txt b/lattices/LatticeMath/test/CMakeLists.txt -index 47e5c76..23f254f 100644 ---- a/lattices/LatticeMath/test/CMakeLists.txt -+++ b/lattices/LatticeMath/test/CMakeLists.txt -@@ -11,7 +11,7 @@ tLatticeHistograms - tLatticeMathUtil - tLatticeSlice1D - tLatticeStatistics --tLatticeStatsDataProvider -+# tLatticeStatsDataProvider # tries to allocate a 1024*1024*1024 array, which is at least 4GiB - tLatticeTwoPtCorr - # tLattStatsSpecialize - ) -diff --git a/tables/TaQL/test/CMakeLists.txt b/tables/TaQL/test/CMakeLists.txt -index 9cf5223..1fcd338 100644 ---- a/tables/TaQL/test/CMakeLists.txt -+++ b/tables/TaQL/test/CMakeLists.txt -@@ -35,8 +35,8 @@ tTaQLNode - # Only test scripts, no test programs. - set (testscripts - ttaql --tTableGramCretab --tTableGramAlttab -+# tTableGramCretab # https://github.com/casacore/casacore/issues/541 -+# tTableGramAlttab # https://github.com/casacore/casacore/issues/541 - tTableGramUpdate - tTableGramMasked - tTableGramNull diff -Nru casacore-2.2.0/debian/patches/0006-Loose-some-tests-tFFTServer-tests.patch casacore-2.3.0/debian/patches/0006-Loose-some-tests-tFFTServer-tests.patch --- casacore-2.2.0/debian/patches/0006-Loose-some-tests-tFFTServer-tests.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0006-Loose-some-tests-tFFTServer-tests.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -From: Ole Streicher -Date: Thu, 24 Nov 2016 14:31:06 +0100 -Subject: Loose some tests tFFTServer tests - -This shall help to compile for mips64el and hppa. ---- - scimath/Mathematics/test/tFFTServer.cc | 2 +- - scimath/Mathematics/test/tFFTServer2.cc | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/scimath/Mathematics/test/tFFTServer.cc b/scimath/Mathematics/test/tFFTServer.cc -index c211f36..711e5a7 100644 ---- a/scimath/Mathematics/test/tFFTServer.cc -+++ b/scimath/Mathematics/test/tFFTServer.cc -@@ -1347,7 +1347,7 @@ public: - } - AlwaysTrue(result.shape().isEqual(expectedResult.shape()), - AipsError); -- AlwaysTrue(allNearAbs(result, expectedResult, epsilon), -+ AlwaysTrue(allNearAbs(result, expectedResult, 2*epsilon), - AipsError); - - int out_size = expectedResult.nelements(); -diff --git a/scimath/Mathematics/test/tFFTServer2.cc b/scimath/Mathematics/test/tFFTServer2.cc -index a663d50..880bce3 100644 ---- a/scimath/Mathematics/test/tFFTServer2.cc -+++ b/scimath/Mathematics/test/tFFTServer2.cc -@@ -1096,7 +1096,7 @@ int main() { - expectedResult(0) = Complex(5,0); - server.fft(result, input, True); - AlwaysAssert(near(result(0), Complex(5,0), FLT_EPSILON), AipsError); -- AlwaysAssert(!near(result(4).imag(), 0.0f, FLT_EPSILON), AipsError); -+ AlwaysAssert(!near(result(4).imag(), 0.0f, 2*FLT_EPSILON), AipsError); - server.fft(reverseTransform, result); - AlwaysAssert(allNearAbs(input, reverseTransform, FLT_EPSILON), - AipsError); diff -Nru casacore-2.2.0/debian/patches/0007-Make-the-check-for-NFS-a-bit-more-portable-BSD.patch casacore-2.3.0/debian/patches/0007-Make-the-check-for-NFS-a-bit-more-portable-BSD.patch --- casacore-2.2.0/debian/patches/0007-Make-the-check-for-NFS-a-bit-more-portable-BSD.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0007-Make-the-check-for-NFS-a-bit-more-portable-BSD.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -From: Ole Streicher -Date: Thu, 24 Nov 2016 14:31:06 +0100 -Subject: Make the check for NFS a bit more portable (BSD) - -And provide a fallback (f.e. for HURD).However, there is probably no -real use case for that, since also other file systems may be slow or -lack certain features. ---- - casa/OS/Directory.cc | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -diff --git a/casa/OS/Directory.cc b/casa/OS/Directory.cc -index 82e6efc..b79ce0f 100644 ---- a/casa/OS/Directory.cc -+++ b/casa/OS/Directory.cc -@@ -488,29 +488,38 @@ Vector Directory::shellExpand (const Vector& files, Bool stripPa - return expInNames; - } - --#ifndef __APPLE__ -+#if defined(__linux__) - #include --#include --#else -+#include -+#elif defined( __APPLE__) - #include - #include - #include -+#elif defined(__FreeBSD_kernel__) -+#include -+#include -+#include - #endif - - Bool Directory::isNFSMounted() const - { -+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) - struct statfs buf; - if (statfs (itsFile.path().expandedName().chars(), &buf) < 0) { - throw (AipsError ("Directory::isNFSMounted error on " + - itsFile.path().expandedName() + - ": " + strerror(errno))); - } --#ifndef __APPLE__ -+#endif -+#if defined(__linux__) - return buf.f_type == NFS_SUPER_MAGIC; --#else -+#elif defined(__APPLE__) - return buf.f_type == VT_NFS; -+#elif defined(__FreeBSD_kernel__) -+ return strcmp (buf.f_fstypename, "nfs") == 0; -+#else -+ return False; - #endif -- - } - - } //# NAMESPACE CASACORE - END diff -Nru casacore-2.2.0/debian/patches/0008-Use-the-correct-symbol-to-detect-Linux-OS.patch casacore-2.3.0/debian/patches/0008-Use-the-correct-symbol-to-detect-Linux-OS.patch --- casacore-2.2.0/debian/patches/0008-Use-the-correct-symbol-to-detect-Linux-OS.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0008-Use-the-correct-symbol-to-detect-Linux-OS.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -From: Ole Streicher -Date: Thu, 24 Nov 2016 14:31:06 +0100 -Subject: Use the correct symbol to detect Linux OS - -Otherwise the compilation fails on powerpc archs ---- - casa/aipsenv.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/casa/aipsenv.h b/casa/aipsenv.h -index 7e272f0..25912b8 100644 ---- a/casa/aipsenv.h -+++ b/casa/aipsenv.h -@@ -130,7 +130,7 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN - #if defined(AIPS_LINUX) - #undef AIPS_LINUX - #endif --#if defined(__linux) -+#if defined(__linux__) - #define AIPS_LINUX - #endif - diff -Nru casacore-2.2.0/debian/patches/0009-Enable-hostinfo-for-kFreeBSD.patch casacore-2.3.0/debian/patches/0009-Enable-hostinfo-for-kFreeBSD.patch --- casacore-2.2.0/debian/patches/0009-Enable-hostinfo-for-kFreeBSD.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0009-Enable-hostinfo-for-kFreeBSD.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -From: Ole Streicher -Date: Sun, 27 Nov 2016 15:26:25 +0100 -Subject: Enable hostinfo for kFreeBSD - ---- - casa/aipsenv.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/casa/aipsenv.h b/casa/aipsenv.h -index 25912b8..1943e5e 100644 ---- a/casa/aipsenv.h -+++ b/casa/aipsenv.h -@@ -122,7 +122,7 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN - #if defined(AIPS_BSD) - #undef AIPS_BSD - #endif --#if defined(__FreeBSD__) -+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - #define AIPS_BSD - #define AIPS_NOLARGEFILE - #endif diff -Nru casacore-2.2.0/debian/patches/0010-Fix-compilation-for-GNU-Hurd.patch casacore-2.3.0/debian/patches/0010-Fix-compilation-for-GNU-Hurd.patch --- casacore-2.2.0/debian/patches/0010-Fix-compilation-for-GNU-Hurd.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0010-Fix-compilation-for-GNU-Hurd.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,261 +0,0 @@ -From: Ole Streicher -Date: Wed, 30 Nov 2016 14:25:19 +0100 -Subject: Fix compilation for GNU Hurd - -However, the tests still fail. ---- - casa/OS/HostInfo.cc | 7 +++ - casa/OS/HostInfoHurd.h | 157 +++++++++++++++++++++++++++++++++++++++++++++++++ - casa/OS/Path.cc | 6 +- - casa/OS/malloc.cc | 2 +- - casa/aipsenv.h | 7 +++ - mirlib/bug.c | 2 +- - 6 files changed, 177 insertions(+), 4 deletions(-) - create mode 100644 casa/OS/HostInfoHurd.h - -diff --git a/casa/OS/HostInfo.cc b/casa/OS/HostInfo.cc -index 054caa2..3519442 100644 ---- a/casa/OS/HostInfo.cc -+++ b/casa/OS/HostInfo.cc -@@ -279,6 +279,13 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN - HOSTINFO_IMPLEMENT_MEMBERS - } //# NAMESPACE CASACORE - END - -+#elif defined(AIPS_HURD) -+#include -+namespace casacore { //# NAMESPACE CASACORE - BEGIN -+ -+HOSTINFO_IMPLEMENT_MEMBERS -+} //# NAMESPACE CASACORE - END -+ - #else - namespace casacore { //# NAMESPACE CASACORE - BEGIN - -diff --git a/casa/OS/HostInfoHurd.h b/casa/OS/HostInfoHurd.h -new file mode 100644 -index 0000000..41be38f ---- /dev/null -+++ b/casa/OS/HostInfoHurd.h -@@ -0,0 +1,157 @@ -+/* -+** This is a greatly MODIFIED version of a "top" machine dependent file. -+** The only resemblance it bears to the original is with respect to the -+** mechanics of finding various system details. The copyright details -+** follow. -+** -+** This is a modified version of the osf1 version. -+** -+** --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -+** -+** Top users/processes display for Unix -+** Version 3 -+** -+** This program may be freely redistributed, -+** but this entire comment MUST remain intact. -+** -+** Copyright (c) 1984, 1989, William LeFebvre, Rice University -+** Copyright (c) 1989 - 1994, William LeFebvre, Northwestern University -+** Copyright (c) 1994, 1995, William LeFebvre, Argonne National Laboratory -+** Copyright (c) 1996, William LeFebvre, Group sys Consulting -+** Copyright (c) 2002, Associated Universities Inc. -+*/ -+ -+/* -+** LIBS: -lstdc++ -+** -+** AUTHOR: Darrell Schiebel -+** -+** ORIGINAL AUTHOR: Anthony Baxter -+** ORIGINAL CONTRIBUTORS: David S. Comay -+** Claus Kalle -+** Pat Welch -+** William LeFebvre -+** Rainer Orth -+** -+*/ -+ -+#ifndef CASA_HOSTINFOHURD_H -+#define CASA_HOSTINFOHURD_H -+ -+# if defined(HOSTINFO_DO_IMPLEMENT) -+ -+ -+#include -+#include -+#include -+ -+extern "C" { -+#include -+} -+ -+namespace casacore { //# NAMESPACE CASACORE - BEGIN -+ -+// -+// HostInfo for GNU HURD machines. -+// -+ -+// -+ -+// -+// -+ -+// -+//
  • HostInfo -+// -+ -+// -+// This file provides the GNU HURD specific functions for HostInfo. -+// It is selectively included by HostInfo.cc. -+// -+// -+// -+ -+/* Log base 2 of 1024 is 10 (2^10 == 1024) */ -+#define LOG1024 10 -+ -+/* these are for getting the memory statistics */ -+static int pageshift; /* log base 2 of the pagesize */ -+static int pagesize_; -+ -+/* define pagetok in terms of pageshift */ -+#define pagetok(size) ((size) << pageshift) -+ -+class HostMachineInfo { -+friend class HostInfo; -+ -+ HostMachineInfo( ); -+ void update_info( ); -+ -+ int valid; -+ int cpus; -+ -+ ptrdiff_t memory_total; -+ ptrdiff_t memory_used; -+ ptrdiff_t memory_free; -+ -+ ptrdiff_t swap_total; -+ ptrdiff_t swap_used; -+ ptrdiff_t swap_free; -+}; -+ -+// -+ -+ -+HostMachineInfo::HostMachineInfo( ) : valid(1) { -+ int pagesize; -+ -+ kern_return_t ret; -+ struct host_basic_info basic_info; -+ mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT; -+ -+ /* get the page size with "getpagesize" and calculate pageshift from it */ -+ pagesize_ = pagesize = getpagesize(); -+ pageshift = 0; -+ while (pagesize > 1) -+ { -+ pageshift++; -+ pagesize >>= 1; -+ } -+ -+ /* we only need the amount of log(2)1024 for our conversion */ -+ pageshift -= LOG1024; -+ -+ ret = host_info( mach_host_self(), HOST_BASIC_INFO, (host_info_t) &basic_info, &count ); -+ if ( ret != KERN_SUCCESS ) { -+ valid = 0; -+ } else { -+ memory_total = basic_info.memory_size / 1024; -+ cpus = basic_info.avail_cpus; -+ } -+} -+ -+void HostMachineInfo::update_info( ) { -+ -+ vm_statistics_data_t vmstats; -+ kern_return_t kr; -+ -+ /* memory information */ -+ kr = vm_statistics( mach_task_self(), &vmstats); -+ if ( kr != KERN_SUCCESS ) { -+ valid = 0; -+ return; -+ } -+ -+ memory_used = pagetok(vmstats.active_count + vmstats.wire_count); -+ memory_free = memory_total - memory_used; -+ swap_used = pagetok( vmstats.active_count + vmstats.inactive_count + vmstats.wire_count ); -+ swap_free = pagetok( vmstats.free_count ); -+ swap_total = pagetok( vmstats.active_count + vmstats.inactive_count + -+ vmstats.wire_count + vmstats.free_count ); -+} -+ -+ -+} //# NAMESPACE CASACORE - END -+ -+# endif -+#endif -diff --git a/casa/OS/Path.cc b/casa/OS/Path.cc -index 52d036a..0f4061e 100644 ---- a/casa/OS/Path.cc -+++ b/casa/OS/Path.cc -@@ -143,12 +143,14 @@ const String& Path::absoluteName() const - - String Path::resolvedName() const - { -- char name[PATH_MAX+1]; -- char* ptr = realpath (absoluteName().c_str(), name); -+ char* ptr = realpath (absoluteName().c_str(), NULL); - if (ptr == 0) { - throw AipsError("resolvedName(" + absoluteName() + ") failed: " + - strerror(errno)); - } -+ char name[strlen(ptr)+1]; -+ strcpy(name, ptr); -+ free(ptr); - return String(name); - } - -diff --git a/casa/OS/malloc.cc b/casa/OS/malloc.cc -index 64cd3a3..3b576c2 100644 ---- a/casa/OS/malloc.cc -+++ b/casa/OS/malloc.cc -@@ -29,7 +29,7 @@ - - #if !defined(AIPS_NO_LEA_MALLOC) - --#if !defined(AIPS_LINUX) -+#if !defined(AIPS_LINUX) && !defined(AIPS_HURD) && !defined(__FreeBSD_kernel__) - /* Ignore for linux since it already uses gnu malloc! */ - - /* -diff --git a/casa/aipsenv.h b/casa/aipsenv.h -index 1943e5e..27947f6 100644 ---- a/casa/aipsenv.h -+++ b/casa/aipsenv.h -@@ -127,6 +127,13 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN - #define AIPS_NOLARGEFILE - #endif - -+#if defined(AIPS_HURD) -+#undef AIPS_HURD -+#endif -+#if defined(__gnu_hurd__) -+#define AIPS_HURD -+#endif -+ - #if defined(AIPS_LINUX) - #undef AIPS_LINUX - #endif -diff --git a/mirlib/bug.c b/mirlib/bug.c -index d20041e..59bee4b 100644 ---- a/mirlib/bug.c -+++ b/mirlib/bug.c -@@ -330,7 +330,7 @@ char *errmsg_c(int n) - * this should be removed in favor of HAVE_STRERROR once - * is only supported using autotools/configure - */ --#if defined(linux) || (defined(HAVE_STRERROR) && HAVE_STRERROR) -+#if defined(linux) || defined(__GNU__) || (defined(HAVE_STRERROR) && HAVE_STRERROR) - /* new POSIX.1 style, 20 years old now... (1988) */ - if(n == -1) - return "End of file detected"; diff -Nru casacore-2.2.0/debian/patches/0011-Fix-too-small-int-type-for-memory-on-32-bit-machines.patch casacore-2.3.0/debian/patches/0011-Fix-too-small-int-type-for-memory-on-32-bit-machines.patch --- casacore-2.2.0/debian/patches/0011-Fix-too-small-int-type-for-memory-on-32-bit-machines.patch 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/0011-Fix-too-small-int-type-for-memory-on-32-bit-machines.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -From: Ole Streicher -Date: Fri, 2 Dec 2016 13:16:42 +0100 -Subject: Fix too small int type for memory on 32-bit machines - -See https://github.com/casacore/casacore/issues/542#issuecomment-264440161 ---- - casa/OS/HostInfoLinux.h | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/casa/OS/HostInfoLinux.h b/casa/OS/HostInfoLinux.h -index f792b71..4edf61d 100644 ---- a/casa/OS/HostInfoLinux.h -+++ b/casa/OS/HostInfoLinux.h -@@ -132,13 +132,13 @@ skip_token(const char *p) - // get integer value from v1 cgroup hierarchy of current processes, if - // sub_value is set it returns the entry of a collection identified by value, - // e.g. total_rss from memory.stat --// returns std::numeric_limits::max() on error -+// returns std::numeric_limits::max() on error - // note unset cgroup limits usually have intptr_t.max() - // does not support v2 cgroups --static inline size_t -+static inline uInt64 - get_cgroup_limit(std::string group, std::string value, std::string sub_value="") - { -- size_t result = std::numeric_limits::max(); -+ uInt64 result = std::numeric_limits::max(); - // assume common location, technically one needs to search for mounts - const std::string cgroup = std::string("/sys/fs/cgroup/") + group + "/"; - -@@ -280,12 +280,12 @@ void HostMachineInfo::update_info( ) - } - - /* can't use more memory than allowed by cgroups, enforced */ -- size_t proc_mem_max = get_cgroup_limit("memory", "memory.limit_in_bytes") / 1024; -+ uInt64 proc_mem_max = get_cgroup_limit("memory", "memory.limit_in_bytes") / 1024; - /* usage_in_bytes also includes cache so use memory.stat */ -- size_t proc_mem_used = get_cgroup_limit("memory", "memory.stat", "total_rss") / 1024; -+ uInt64 proc_mem_used = get_cgroup_limit("memory", "memory.stat", "total_rss") / 1024; - - /* set HostInfo memoryTotal() */ -- memory_total = std::min((size_t)sys_mem_total, proc_mem_max); -+ memory_total = std::min((uInt64)sys_mem_total, proc_mem_max); - - /* if we have a valid cgroup limit we can determine memoryFree() exactly */ - if (proc_mem_max <= sys_mem_total && proc_mem_used <= proc_mem_max) { -@@ -293,7 +293,7 @@ void HostMachineInfo::update_info( ) - } - else { - /* no cgroups so we have to assume all memory of host is available */ -- memory_free = std::min((size_t)sys_mem_avail, (size_t)memory_total); -+ memory_free = std::min((uInt64)sys_mem_avail, (uInt64)memory_total); - } - memory_used = memory_total - memory_free; - -@@ -303,17 +303,17 @@ void HostMachineInfo::update_info( ) - cerr << "Error parsing SwapTotal and SwapFree in /proc/meminfo\n"; - - /* can't use more swap than allowed by cgroups */ -- size_t proc_swap_max = get_cgroup_limit("memory", "memory.memsw.limit_in_bytes") / 1024; -- size_t proc_swap_used = get_cgroup_limit("memory", "memory.stat", "total_swap") / 1024; -+ uInt64 proc_swap_max = get_cgroup_limit("memory", "memory.memsw.limit_in_bytes") / 1024; -+ uInt64 proc_swap_used = get_cgroup_limit("memory", "memory.stat", "total_swap") / 1024; - /* limit is mem + swap */ - if (proc_mem_max <= sys_mem_total && proc_mem_max <= proc_swap_max) { - proc_swap_max = proc_swap_max - proc_mem_max; - } - - /* set swapTotal() */ -- swap_total = std::min((size_t)sys_swap_total, proc_swap_max); -+ swap_total = std::min((uInt64)sys_swap_total, proc_swap_max); - -- if (proc_swap_max <= (size_t)swap_total && proc_swap_used <= proc_swap_max) { -+ if (proc_swap_max <= (uInt64)swap_total && proc_swap_used <= proc_swap_max) { - swap_free = proc_swap_max - proc_swap_used; - } - else { diff -Nru casacore-2.2.0/debian/patches/Add-support-for-python3.6.patch casacore-2.3.0/debian/patches/Add-support-for-python3.6.patch --- casacore-2.2.0/debian/patches/Add-support-for-python3.6.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Add-support-for-python3.6.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,26 @@ +From: Steve Langasek +Date: Wed, 30 Aug 2017 08:40:46 +0200 +Subject: Add support for python3.6 + +The python3 detection code only correctly picks up listed versions of +python3 on Debian/Ubuntu. Otherwise it incorrectly falls back to +/usr/bin/python and python2.7! + +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1710532 +--- + python3/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/python3/CMakeLists.txt b/python3/CMakeLists.txt +index 4300365..f8d77ab 100644 +--- a/python3/CMakeLists.txt ++++ b/python3/CMakeLists.txt +@@ -18,7 +18,7 @@ if (PYTHON3_FIND_PACKAGE_MESSAGE_DETAILS_PythonLibs) + endif() + + # Detect the python properties +-set(Python_ADDITIONAL_VERSIONS 3.5 3.4) ++set(Python_ADDITIONAL_VERSIONS 3.6 3.5 3.4) + + find_package(Python REQUIRED) + diff -Nru casacore-2.2.0/debian/patches/Disable-class-and-collaboration-graph-generation.patch casacore-2.3.0/debian/patches/Disable-class-and-collaboration-graph-generation.patch --- casacore-2.2.0/debian/patches/Disable-class-and-collaboration-graph-generation.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Disable-class-and-collaboration-graph-generation.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,43 @@ +From: Benda Xu +Date: Thu, 11 Sep 2014 18:20:44 +0900 +Subject: Disable class and collaboration graph generation + +The graphviz-generated class and collaboration graph +occupies 1GB disk space. It is too big to deal with. We turn them +off only to save space. Output image format is specified as svg to +further save space (bug #751947). +--- + doxygen.cfg | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/doxygen.cfg b/doxygen.cfg +index 9071e88..94b7ccb 100644 +--- a/doxygen.cfg ++++ b/doxygen.cfg +@@ -2103,7 +2103,7 @@ DOT_FONTPATH = + # The default value is: YES. + # This tag requires that the tag HAVE_DOT is set to YES. + +-CLASS_GRAPH = YES ++CLASS_GRAPH = NO + + # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a + # graph for each documented class showing the direct and indirect implementation +@@ -2112,7 +2112,7 @@ CLASS_GRAPH = YES + # The default value is: YES. + # This tag requires that the tag HAVE_DOT is set to YES. + +-COLLABORATION_GRAPH = YES ++COLLABORATION_GRAPH = NO + + # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for + # groups, showing the direct groups dependencies. +@@ -2215,7 +2215,7 @@ DIRECTORY_GRAPH = NO + # The default value is: png. + # This tag requires that the tag HAVE_DOT is set to YES. + +-DOT_IMAGE_FORMAT = png ++DOT_IMAGE_FORMAT = svg + + # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to + # enable generation of interactive SVG images that allow zooming and panning. diff -Nru casacore-2.2.0/debian/patches/Disable-known-test-failures.patch casacore-2.3.0/debian/patches/Disable-known-test-failures.patch --- casacore-2.2.0/debian/patches/Disable-known-test-failures.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Disable-known-test-failures.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,158 @@ +From: Ole Streicher +Date: Fri, 2 Dec 2016 11:11:28 +0100 +Subject: Disable known test failures +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Disable tPath test + +sbuild gets HOME variable leaked into the build environment. Debian +uses sbuild as official build farm. Until the cause is pinned down, +this test is disabled. + + 98/425 Test #101: tPath ...............................***Failed 0.64 sec +1,16d0 +< expanded: /home/heroxbd +< expected: /«PKGBUILDDIR» +< absolute: /home/heroxbd +< expected: /«PKGBUILDDIR» +< expanded: /home/heroxbd/test/test2 +< expected: /«PKGBUILDDIR»/test/test2 +< absolute: /home/heroxbd/test/test2 +< expected: /«PKGBUILDDIR»/test/test2 +< expanded: /home/heroxbd/test +< expected: /«PKGBUILDDIR»/test +< absolute: /home/heroxbd/test +< expected: /«PKGBUILDDIR»/test +< expanded: /home/heroxbd/test +< expected: /«PKGBUILDDIR»/test +< absolute: /home/heroxbd/test +< expected: /«PKGBUILDDIR»/test +33a18 +> OK +FAIL (output not verified): ./tPath + +Disable tLSQaips and tLSQFit tests + +These tests fail, probably due to the test itself. From +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838424#15 + +I'm not sure what to do about the other two tests that fail on arm64, +"tLSQaips" and "tLSQFit", because those two generate a load of output +text containing floating-point numbers and compare that text with an +expected output. It might not be so easy to make that work on all +architectures. Perhaps one could simply disable those two tests. +Preferably one would still run them, so that we can see what happens +in the logs, but not have the build fail if only those tests fail. +--- + casa/IO/test/CMakeLists.txt | 4 ++-- + casa/OS/test/CMakeLists.txt | 9 ++++----- + images/Images/test/CMakeLists.txt | 2 +- + lattices/LatticeMath/test/CMakeLists.txt | 2 +- + scimath/Fitting/test/CMakeLists.txt | 4 ++-- + tables/TaQL/test/CMakeLists.txt | 4 ++-- + 6 files changed, 12 insertions(+), 13 deletions(-) + +diff --git a/casa/IO/test/CMakeLists.txt b/casa/IO/test/CMakeLists.txt +index 188a6c4..3187b60 100644 +--- a/casa/IO/test/CMakeLists.txt ++++ b/casa/IO/test/CMakeLists.txt +@@ -3,9 +3,9 @@ tAipsIOCarray + tAipsIO + tBucketBuffered + tBucketCache +-tBucketFile ++# tBucketFile # https://github.com/casacore/casacore/issues/73 + tBucketMapped +-tByteIO ++# tByteIO # https://github.com/casacore/casacore/issues/73 + tByteSink + tByteSinkSource + tFilebufIO +diff --git a/casa/OS/test/CMakeLists.txt b/casa/OS/test/CMakeLists.txt +index 520ceed..e5c9ee3 100644 +--- a/casa/OS/test/CMakeLists.txt ++++ b/casa/OS/test/CMakeLists.txt +@@ -3,10 +3,10 @@ tCanonicalConversion + tConversion + tConversionPerf + tDataConversion +-tDirectory ++# tDirectory # https://github.com/casacore/casacore/issues/73 + tDirectoryIterator + tEnvVar +-tFile ++# tFile # https://github.com/casacore/casacore/issues/73 + tHostInfo + tIBMConversion + tLECanonicalConversion +@@ -14,10 +14,9 @@ tMemory + tMemoryTrace + tModcompConversion + tMutex +-tPath + tPrecTimer +-tRegularFile +-tSymLink ++# tRegularFile # https://github.com/casacore/casacore/issues/73 ++# tSymLink # https://github.com/casacore/casacore/issues/73 + tTime + tTimer + tVAXConversion +diff --git a/images/Images/test/CMakeLists.txt b/images/Images/test/CMakeLists.txt +index 4115c29..6865919 100644 +--- a/images/Images/test/CMakeLists.txt ++++ b/images/Images/test/CMakeLists.txt +@@ -69,7 +69,7 @@ tMIRIADImage + # tPagedImage2 # requires geodetic/Observatories + # tRebinImage # requires geodetic/Observatories + tSubImage +-tTempImage ++# tTempImage # https://github.com/casacore/casacore/issues/543 + ) + + foreach (test ${tests}) +diff --git a/lattices/LatticeMath/test/CMakeLists.txt b/lattices/LatticeMath/test/CMakeLists.txt +index 47e5c76..23f254f 100644 +--- a/lattices/LatticeMath/test/CMakeLists.txt ++++ b/lattices/LatticeMath/test/CMakeLists.txt +@@ -11,7 +11,7 @@ tLatticeHistograms + tLatticeMathUtil + tLatticeSlice1D + tLatticeStatistics +-tLatticeStatsDataProvider ++# tLatticeStatsDataProvider # tries to allocate a 1024*1024*1024 array, which is at least 4GiB + tLatticeTwoPtCorr + # tLattStatsSpecialize + ) +diff --git a/scimath/Fitting/test/CMakeLists.txt b/scimath/Fitting/test/CMakeLists.txt +index 35d258f..de69738 100644 +--- a/scimath/Fitting/test/CMakeLists.txt ++++ b/scimath/Fitting/test/CMakeLists.txt +@@ -3,8 +3,8 @@ dConstraints + dLSQFit + tFitGaussian + tLinearFitSVD +-tLSQaips +-tLSQFit ++#tLSQaips ++#tLSQFit + tNonLinearFitLM + ) + +diff --git a/tables/TaQL/test/CMakeLists.txt b/tables/TaQL/test/CMakeLists.txt +index 9cf5223..1fcd338 100644 +--- a/tables/TaQL/test/CMakeLists.txt ++++ b/tables/TaQL/test/CMakeLists.txt +@@ -35,8 +35,8 @@ tTaQLNode + # Only test scripts, no test programs. + set (testscripts + ttaql +-tTableGramCretab +-tTableGramAlttab ++# tTableGramCretab # https://github.com/casacore/casacore/issues/541 ++# tTableGramAlttab # https://github.com/casacore/casacore/issues/541 + tTableGramUpdate + tTableGramMasked + tTableGramNull diff -Nru casacore-2.2.0/debian/patches/Disable-tests-that-require-data-tables.patch casacore-2.3.0/debian/patches/Disable-tests-that-require-data-tables.patch --- casacore-2.2.0/debian/patches/Disable-tests-that-require-data-tables.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Disable-tests-that-require-data-tables.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,253 @@ +From: Benda Xu +Date: Wed, 10 Sep 2014 10:00:43 +0900 +Subject: Disable tests that require data tables + +The data tables are not available during the build of casacore (yet). +--- + coordinates/Coordinates/test/CMakeLists.txt | 12 ++++----- + images/Images/test/CMakeLists.txt | 40 ++++++++++++++--------------- + images/Regions/test/CMakeLists.txt | 8 +++--- + lattices/LatticeMath/test/CMakeLists.txt | 2 +- + meas/MeasUDF/test/CMakeLists.txt | 2 +- + measures/Measures/test/CMakeLists.txt | 37 ++++++++++++-------------- + measures/TableMeasures/test/CMakeLists.txt | 2 +- + ms/MSOper/test/CMakeLists.txt | 6 ++--- + ms/MeasurementSets/test/CMakeLists.txt | 2 +- + 9 files changed, 53 insertions(+), 58 deletions(-) + +diff --git a/coordinates/Coordinates/test/CMakeLists.txt b/coordinates/Coordinates/test/CMakeLists.txt +index bd1c996..248b395 100644 +--- a/coordinates/Coordinates/test/CMakeLists.txt ++++ b/coordinates/Coordinates/test/CMakeLists.txt +@@ -1,18 +1,18 @@ + set (tests +-dCoordinates ++#dCoordinates # requires geodetic/Observatories + dRemoveAxes + dWorldMap + tCoordinate +-tCoordinateSystem +-tCoordinateUtil ++# tCoordinateSystem # requires geodetic/Observatories ++# tCoordinateUtil # requires geodetic/Observatories + tDirectionCoordinate +-tFrequencyAligner ++# tFrequencyAligner # requires geodetic/Observatories + tGaussianConvert + tLinearCoordinate + tLinearXform +-tObsInfo ++# tObsInfo # requires geodetic/Observatories + tProjection +-tSpectralCoordinate ++# tSpectralCoordinate # requires geodetic/Observatories + tStokesCoordinate + tQualityCoordinate + tTabularCoordinate +diff --git a/images/Images/test/CMakeLists.txt b/images/Images/test/CMakeLists.txt +index 302d798..4115c29 100644 +--- a/images/Images/test/CMakeLists.txt ++++ b/images/Images/test/CMakeLists.txt +@@ -35,39 +35,39 @@ endforeach (file) + + set (tests + dImageInterface +-dImageStatistics +-dImageSummary ++# dImageStatistics # requires geodetic/Observatories ++# dImageSummary # requires geodetic/Observatories + dPagedImage + tExtendImage +-tFITSErrorImage ++# tFITSErrorImage # + tFITSExtImage + tFITSExtImageII + tFITSImage + tFITSImgParser +-tFITSQualityImage ++# tFITSQualityImage # + tHDF5Image +-tImageAttrHandler +-tImageBeamSet +-tImageConcat +-tImageEmpty +-tImageExpr +-tImageExpr2 +-tImageExpr2Gram +-tImageExpr3Gram ++# tImageAttrHandler # requires geodetic/Observatories ++# tImageBeamSet # ++# tImageConcat # needs casacore-data ++# tImageEmpty # requires geodetic/Observatories ++# tImageExpr ++# tImageExpr2 ++# tImageExpr2Gram # requires geodetic/Observatories ++# tImageExpr3Gram # requires geodetic/Observatories + tImageExprGram + tImageExprParse + tImageExprParse_addDir + tImageInfo +-tImageProxy +-tImageRegrid ++# tImageProxy ++# tImageRegrid # requires geodetic/Observatories + tImageStatistics +-tImageStatistics2 +-tImageUtilities +-tLELSpectralIndex ++# tImageStatistics2 # requires geodetic/Observatories ++# tImageUtilities # requires geodetic/Observatories ++# tLELSpectralIndex # requires geodetic/Observatories + tMIRIADImage +-tPagedImage +-tPagedImage2 +-tRebinImage ++# tPagedImage # requires geodetic/Observatories ++# tPagedImage2 # requires geodetic/Observatories ++# tRebinImage # requires geodetic/Observatories + tSubImage + tTempImage + ) +diff --git a/images/Regions/test/CMakeLists.txt b/images/Regions/test/CMakeLists.txt +index b94c391..1201346 100644 +--- a/images/Regions/test/CMakeLists.txt ++++ b/images/Regions/test/CMakeLists.txt +@@ -9,12 +9,12 @@ foreach (file ${datafiles}) + endforeach (file) + + set (tests +-tImageRegion ++# tImageRegion + tRegionHandler +-tWCBox +-tWCEllipsoid ++# tWCBox # requires geodetic/Observatories ++# tWCEllipsoid + tWCExtension +-tWCLELMask ++# tWCLELMask # requires geodetic/Observatories + tWCUnion + ) + +diff --git a/lattices/LatticeMath/test/CMakeLists.txt b/lattices/LatticeMath/test/CMakeLists.txt +index 0d869d5..47e5c76 100644 +--- a/lattices/LatticeMath/test/CMakeLists.txt ++++ b/lattices/LatticeMath/test/CMakeLists.txt +@@ -13,7 +13,7 @@ tLatticeSlice1D + tLatticeStatistics + tLatticeStatsDataProvider + tLatticeTwoPtCorr +-tLattStatsSpecialize ++# tLattStatsSpecialize + ) + + foreach (test ${tests}) +diff --git a/meas/MeasUDF/test/CMakeLists.txt b/meas/MeasUDF/test/CMakeLists.txt +index a2ecd9a..b06ee99 100644 +--- a/meas/MeasUDF/test/CMakeLists.txt ++++ b/meas/MeasUDF/test/CMakeLists.txt +@@ -1,5 +1,5 @@ + set (tests +- tmeas ++# tmeas # requires casacore-data + ) + + foreach (test ${tests}) +diff --git a/measures/Measures/test/CMakeLists.txt b/measures/Measures/test/CMakeLists.txt +index c10a670..261adb1 100644 +--- a/measures/Measures/test/CMakeLists.txt ++++ b/measures/Measures/test/CMakeLists.txt +@@ -1,25 +1,25 @@ + set (tests + dM1950_2000 +-dMeasure +-tEarthField +-tEarthMagneticMachine +-tMBaseline +-tMDirection +-tMEarthMagnetic +-tMFrequency +-tMeasComet +-tMeasIERS +-tMeasJPL ++# dMeasure # geodetic/TAI_UTC ++# tEarthField # geodetic/IGRF ++# tEarthMagneticMachine # geodetic/IGRF ++# tMBaseline # geodetic/IGRF ++# tMDirection ++# tMEarthMagnetic # geodetic/IGRF ++# tMFrequency ++# tMeasComet # ephemerides/VGEO ++# tMeasIERS # geodetic/IERS* ++# tMeasJPL # ephemerides/DE200 + tMeasMath +-tMeasure ++# tMeasure # geodetic/TAI_UTC + tMeasureHolder +-tMuvw +-tParAngleMachine +-tQuality ++# tMuvw # geodetic/TAI_UTC ++# tParAngleMachine # geodetic/TAI_UTC ++# tQuality + tRecordTransformable + tStokes + tUVWMachine +-tVelocityMachine ++# tVelocityMachine # geodetic/TAI_UTC + ) + + foreach (test ${tests}) +@@ -29,9 +29,4 @@ foreach (test ${tests}) + add_dependencies(check ${test}) + endforeach (test) + +-if (SOFA_FOUND) +- add_executable (tIAU2000 SofaTest.cc tIAU2000.cc) +- target_link_libraries (tIAU2000 casa_measures ${SOFA_LIBRARY}) +- add_test (tIAU2000 ${CMAKE_SOURCE_DIR}/cmake/cmake_assay ./tIAU2000) +- add_dependencies(check tIAU2000) +-endif (SOFA_FOUND) ++# tIAU2000 disabled for missing geodetic/TAI_UTC +diff --git a/measures/TableMeasures/test/CMakeLists.txt b/measures/TableMeasures/test/CMakeLists.txt +index e7c4af1..84e7d6d 100644 +--- a/measures/TableMeasures/test/CMakeLists.txt ++++ b/measures/TableMeasures/test/CMakeLists.txt +@@ -1,6 +1,6 @@ + set (tests + tTableQuantum +-tTableMeasures ++# tTableMeasures # geodetic/{IERSeop{2000,97},IERSpredict{,2000},TAI_UTC} + dVarRefMdirCol + ) + +diff --git a/ms/MSOper/test/CMakeLists.txt b/ms/MSOper/test/CMakeLists.txt +index e53aec3..81912cd 100644 +--- a/ms/MSOper/test/CMakeLists.txt ++++ b/ms/MSOper/test/CMakeLists.txt +@@ -1,9 +1,9 @@ + set (tests +-tMSDerivedValues +-tMSKeys ++# tMSDerivedValues # geodetic/IERSpredict ++# tMSKeys + tMSMetaData + tMSReader +-tMSSummary ++# tMSSummary + ) + + foreach (test ${tests}) +diff --git a/ms/MeasurementSets/test/CMakeLists.txt b/ms/MeasurementSets/test/CMakeLists.txt +index 6e66aad..8150ad4 100644 +--- a/ms/MeasurementSets/test/CMakeLists.txt ++++ b/ms/MeasurementSets/test/CMakeLists.txt +@@ -15,7 +15,7 @@ tMeasurementSet + tMSColumns + tMSDataDescBuffer + tMSFieldBuffer +-tMSFieldEphem ++#tMSFieldEphem requires casacore-data + tMSIter + tMSMainBuffer + tMSPolBuffer diff -Nru casacore-2.2.0/debian/patches/Enable-hostinfo-for-kFreeBSD.patch casacore-2.3.0/debian/patches/Enable-hostinfo-for-kFreeBSD.patch --- casacore-2.2.0/debian/patches/Enable-hostinfo-for-kFreeBSD.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Enable-hostinfo-for-kFreeBSD.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,21 @@ +From: Ole Streicher +Date: Sun, 27 Nov 2016 15:26:25 +0100 +Subject: Enable hostinfo for kFreeBSD + +--- + casa/aipsenv.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/casa/aipsenv.h b/casa/aipsenv.h +index 25912b8..1943e5e 100644 +--- a/casa/aipsenv.h ++++ b/casa/aipsenv.h +@@ -122,7 +122,7 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN + #if defined(AIPS_BSD) + #undef AIPS_BSD + #endif +-#if defined(__FreeBSD__) ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + #define AIPS_BSD + #define AIPS_NOLARGEFILE + #endif diff -Nru casacore-2.2.0/debian/patches/Fix-compilation-for-GNU-Hurd.patch casacore-2.3.0/debian/patches/Fix-compilation-for-GNU-Hurd.patch --- casacore-2.2.0/debian/patches/Fix-compilation-for-GNU-Hurd.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Fix-compilation-for-GNU-Hurd.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,261 @@ +From: Ole Streicher +Date: Wed, 30 Nov 2016 14:25:19 +0100 +Subject: Fix compilation for GNU Hurd + +However, the tests still fail. +--- + casa/OS/HostInfo.cc | 7 +++ + casa/OS/HostInfoHurd.h | 157 +++++++++++++++++++++++++++++++++++++++++++++++++ + casa/OS/Path.cc | 6 +- + casa/OS/malloc.cc | 2 +- + casa/aipsenv.h | 7 +++ + mirlib/bug.c | 2 +- + 6 files changed, 177 insertions(+), 4 deletions(-) + create mode 100644 casa/OS/HostInfoHurd.h + +diff --git a/casa/OS/HostInfo.cc b/casa/OS/HostInfo.cc +index 054caa2..3519442 100644 +--- a/casa/OS/HostInfo.cc ++++ b/casa/OS/HostInfo.cc +@@ -279,6 +279,13 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN + HOSTINFO_IMPLEMENT_MEMBERS + } //# NAMESPACE CASACORE - END + ++#elif defined(AIPS_HURD) ++#include ++namespace casacore { //# NAMESPACE CASACORE - BEGIN ++ ++HOSTINFO_IMPLEMENT_MEMBERS ++} //# NAMESPACE CASACORE - END ++ + #else + namespace casacore { //# NAMESPACE CASACORE - BEGIN + +diff --git a/casa/OS/HostInfoHurd.h b/casa/OS/HostInfoHurd.h +new file mode 100644 +index 0000000..41be38f +--- /dev/null ++++ b/casa/OS/HostInfoHurd.h +@@ -0,0 +1,157 @@ ++/* ++** This is a greatly MODIFIED version of a "top" machine dependent file. ++** The only resemblance it bears to the original is with respect to the ++** mechanics of finding various system details. The copyright details ++** follow. ++** ++** This is a modified version of the osf1 version. ++** ++** --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ++** ++** Top users/processes display for Unix ++** Version 3 ++** ++** This program may be freely redistributed, ++** but this entire comment MUST remain intact. ++** ++** Copyright (c) 1984, 1989, William LeFebvre, Rice University ++** Copyright (c) 1989 - 1994, William LeFebvre, Northwestern University ++** Copyright (c) 1994, 1995, William LeFebvre, Argonne National Laboratory ++** Copyright (c) 1996, William LeFebvre, Group sys Consulting ++** Copyright (c) 2002, Associated Universities Inc. ++*/ ++ ++/* ++** LIBS: -lstdc++ ++** ++** AUTHOR: Darrell Schiebel ++** ++** ORIGINAL AUTHOR: Anthony Baxter ++** ORIGINAL CONTRIBUTORS: David S. Comay ++** Claus Kalle ++** Pat Welch ++** William LeFebvre ++** Rainer Orth ++** ++*/ ++ ++#ifndef CASA_HOSTINFOHURD_H ++#define CASA_HOSTINFOHURD_H ++ ++# if defined(HOSTINFO_DO_IMPLEMENT) ++ ++ ++#include ++#include ++#include ++ ++extern "C" { ++#include ++} ++ ++namespace casacore { //# NAMESPACE CASACORE - BEGIN ++ ++// ++// HostInfo for GNU HURD machines. ++// ++ ++// ++ ++// ++// ++ ++// ++//
  • HostInfo ++// ++ ++// ++// This file provides the GNU HURD specific functions for HostInfo. ++// It is selectively included by HostInfo.cc. ++// ++// ++// ++ ++/* Log base 2 of 1024 is 10 (2^10 == 1024) */ ++#define LOG1024 10 ++ ++/* these are for getting the memory statistics */ ++static int pageshift; /* log base 2 of the pagesize */ ++static int pagesize_; ++ ++/* define pagetok in terms of pageshift */ ++#define pagetok(size) ((size) << pageshift) ++ ++class HostMachineInfo { ++friend class HostInfo; ++ ++ HostMachineInfo( ); ++ void update_info( ); ++ ++ int valid; ++ int cpus; ++ ++ ptrdiff_t memory_total; ++ ptrdiff_t memory_used; ++ ptrdiff_t memory_free; ++ ++ ptrdiff_t swap_total; ++ ptrdiff_t swap_used; ++ ptrdiff_t swap_free; ++}; ++ ++// ++ ++ ++HostMachineInfo::HostMachineInfo( ) : valid(1) { ++ int pagesize; ++ ++ kern_return_t ret; ++ struct host_basic_info basic_info; ++ mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT; ++ ++ /* get the page size with "getpagesize" and calculate pageshift from it */ ++ pagesize_ = pagesize = getpagesize(); ++ pageshift = 0; ++ while (pagesize > 1) ++ { ++ pageshift++; ++ pagesize >>= 1; ++ } ++ ++ /* we only need the amount of log(2)1024 for our conversion */ ++ pageshift -= LOG1024; ++ ++ ret = host_info( mach_host_self(), HOST_BASIC_INFO, (host_info_t) &basic_info, &count ); ++ if ( ret != KERN_SUCCESS ) { ++ valid = 0; ++ } else { ++ memory_total = basic_info.memory_size / 1024; ++ cpus = basic_info.avail_cpus; ++ } ++} ++ ++void HostMachineInfo::update_info( ) { ++ ++ vm_statistics_data_t vmstats; ++ kern_return_t kr; ++ ++ /* memory information */ ++ kr = vm_statistics( mach_task_self(), &vmstats); ++ if ( kr != KERN_SUCCESS ) { ++ valid = 0; ++ return; ++ } ++ ++ memory_used = pagetok(vmstats.active_count + vmstats.wire_count); ++ memory_free = memory_total - memory_used; ++ swap_used = pagetok( vmstats.active_count + vmstats.inactive_count + vmstats.wire_count ); ++ swap_free = pagetok( vmstats.free_count ); ++ swap_total = pagetok( vmstats.active_count + vmstats.inactive_count + ++ vmstats.wire_count + vmstats.free_count ); ++} ++ ++ ++} //# NAMESPACE CASACORE - END ++ ++# endif ++#endif +diff --git a/casa/OS/Path.cc b/casa/OS/Path.cc +index 52d036a..0f4061e 100644 +--- a/casa/OS/Path.cc ++++ b/casa/OS/Path.cc +@@ -143,12 +143,14 @@ const String& Path::absoluteName() const + + String Path::resolvedName() const + { +- char name[PATH_MAX+1]; +- char* ptr = realpath (absoluteName().c_str(), name); ++ char* ptr = realpath (absoluteName().c_str(), NULL); + if (ptr == 0) { + throw AipsError("resolvedName(" + absoluteName() + ") failed: " + + strerror(errno)); + } ++ char name[strlen(ptr)+1]; ++ strcpy(name, ptr); ++ free(ptr); + return String(name); + } + +diff --git a/casa/OS/malloc.cc b/casa/OS/malloc.cc +index 64cd3a3..3b576c2 100644 +--- a/casa/OS/malloc.cc ++++ b/casa/OS/malloc.cc +@@ -29,7 +29,7 @@ + + #if !defined(AIPS_NO_LEA_MALLOC) + +-#if !defined(AIPS_LINUX) ++#if !defined(AIPS_LINUX) && !defined(AIPS_HURD) && !defined(__FreeBSD_kernel__) + /* Ignore for linux since it already uses gnu malloc! */ + + /* +diff --git a/casa/aipsenv.h b/casa/aipsenv.h +index 1943e5e..27947f6 100644 +--- a/casa/aipsenv.h ++++ b/casa/aipsenv.h +@@ -127,6 +127,13 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN + #define AIPS_NOLARGEFILE + #endif + ++#if defined(AIPS_HURD) ++#undef AIPS_HURD ++#endif ++#if defined(__gnu_hurd__) ++#define AIPS_HURD ++#endif ++ + #if defined(AIPS_LINUX) + #undef AIPS_LINUX + #endif +diff --git a/mirlib/bug.c b/mirlib/bug.c +index d20041e..59bee4b 100644 +--- a/mirlib/bug.c ++++ b/mirlib/bug.c +@@ -330,7 +330,7 @@ char *errmsg_c(int n) + * this should be removed in favor of HAVE_STRERROR once + * is only supported using autotools/configure + */ +-#if defined(linux) || (defined(HAVE_STRERROR) && HAVE_STRERROR) ++#if defined(linux) || defined(__GNU__) || (defined(HAVE_STRERROR) && HAVE_STRERROR) + /* new POSIX.1 style, 20 years old now... (1988) */ + if(n == -1) + return "End of file detected"; diff -Nru casacore-2.2.0/debian/patches/Fix-FTBFS-tStatisticsUtilities-tLatticeStatistics-and-tLC.patch casacore-2.3.0/debian/patches/Fix-FTBFS-tStatisticsUtilities-tLatticeStatistics-and-tLC.patch --- casacore-2.2.0/debian/patches/Fix-FTBFS-tStatisticsUtilities-tLatticeStatistics-and-tLC.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Fix-FTBFS-tStatisticsUtilities-tLatticeStatistics-and-tLC.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,162 @@ +From: Edmund Grimley Evans +Date: Thu, 1 Jun 2017 22:34:46 +0100 +Subject: Fix FTBFS tStatisticsUtilities, + tLatticeStatistics and tLCEllipsoid on arm64 + +The tests "tStatisticsUtilities" and "tLatticeStatistics" can be made +to pass on arm64 with these adjustments to the expected accuracy. + +The test "tLCEllipsoid" seems to be converting ellipses into bitmaps. +I'm guessing it gives different output on amd64 and arm64 because the +real curve passes through a critical point and numerical inaccuracy +puts it on different sides of the point on the two architectures. One +way to fix that might be to use non-round numbers in the parameters so +that the curve does not pass through a critical point. That's what I +tried to do, and with the following changes to the program and the +expected output the test passes on both amd64 and arm64. +--- + lattices/LRegions/test/tLCEllipsoid.cc | 4 ++-- + lattices/LRegions/test/tLCEllipsoid.out | 24 ++++++++++++------------ + lattices/LatticeMath/test/tLatticeStatistics.cc | 4 ++-- + scimath/Mathematics/test/tStatisticsUtilities.cc | 2 +- + 4 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/lattices/LRegions/test/tLCEllipsoid.cc b/lattices/LRegions/test/tLCEllipsoid.cc +index 9e9ee03..2ff65fa 100644 +--- a/lattices/LRegions/test/tLCEllipsoid.cc ++++ b/lattices/LRegions/test/tLCEllipsoid.cc +@@ -212,8 +212,8 @@ int main() { + show(ellipse3); + + Float theta = C::pi/4; +- major = 36; +- minor = 16; ++ major = 36.01; ++ minor = 16.01; + xcenter = -1; + ycenter = -1; + LCEllipsoid ellipse4( +diff --git a/lattices/LRegions/test/tLCEllipsoid.out b/lattices/LRegions/test/tLCEllipsoid.out +index 3709155..17d8e87 100644 +--- a/lattices/LRegions/test/tLCEllipsoid.out ++++ b/lattices/LRegions/test/tLCEllipsoid.out +@@ -163,7 +163,7 @@ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 29] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 28] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 27] +-0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 26] ++0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 26] + 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 [35, 25] + 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 [35, 24] + 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 [35, 23] +@@ -177,7 +177,7 @@ + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 [35, 15] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 [35, 14] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 [35, 13] +-1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 [35, 12] ++1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 [35, 12] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 [35, 11] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 [35, 10] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 [35, 9] +@@ -207,10 +207,10 @@ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 22] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 21] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 20] +-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 19] ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 [35, 19] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 [35, 18] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 [35, 17] +-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 [35, 16] ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 [35, 16] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 [35, 15] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 [35, 14] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 [35, 13] +@@ -222,11 +222,11 @@ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 7] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 6] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 5] +-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 4] ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 4] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 3] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 2] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 1] +-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 0] ++0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 0] + + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 35] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 34] +@@ -240,7 +240,7 @@ + 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 26] + 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 25] + 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 24] +-0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 23] ++0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 23] + 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 22] + 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 21] + 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [35, 20] +@@ -254,7 +254,7 @@ + 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 [35, 12] + 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 [35, 11] + 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 [35, 10] +-0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 9] ++0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 [35, 9] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 8] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 7] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 6] +@@ -265,11 +265,11 @@ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 1] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 0] + +-1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 35] ++1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 35] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 34] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 33] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 32] +-1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 31] ++1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 31] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 30] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 29] + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 28] +@@ -281,10 +281,10 @@ + 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 22] + 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 21] + 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 20] +-1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 19] ++1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 19] + 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 18] + 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 17] +-0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 16] ++1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 16] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 15] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 14] + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [35, 13] +diff --git a/lattices/LatticeMath/test/tLatticeStatistics.cc b/lattices/LatticeMath/test/tLatticeStatistics.cc +index 833af91..43e0ae7 100644 +--- a/lattices/LatticeMath/test/tLatticeStatistics.cc ++++ b/lattices/LatticeMath/test/tLatticeStatistics.cc +@@ -416,10 +416,10 @@ int main() + AlwaysAssert(sum(pos) == expSum, AipsError); + AlwaysAssert(npts(pos) == expNpts, AipsError); + AlwaysAssert(mean(pos) == expMean, AipsError); +- AlwaysAssert(near(sumsq(pos), expSumSq), AipsError); ++ AlwaysAssert(near(sumsq(pos), expSumSq, 1e-9), AipsError); + AlwaysAssert(near(var(pos), expVar, 1e-10), AipsError); + AlwaysAssert(near(sigma(pos), expSigma, 1e-11), AipsError); +- AlwaysAssert(near(rms(pos), expRMS), AipsError); ++ AlwaysAssert(near(rms(pos), expRMS, 1e-10), AipsError); + AlwaysAssert(mymin(pos) == DComplex(0, 0), AipsError); + AlwaysAssert(mymax(pos) == DComplex(size-1, size-1), AipsError); + +diff --git a/scimath/Mathematics/test/tStatisticsUtilities.cc b/scimath/Mathematics/test/tStatisticsUtilities.cc +index 46491c8..c6c443f 100644 +--- a/scimath/Mathematics/test/tStatisticsUtilities.cc ++++ b/scimath/Mathematics/test/tStatisticsUtilities.cc +@@ -265,7 +265,7 @@ int main() { + AlwaysAssert(got.rms == expec.rms, AipsError); + AlwaysAssert(near(got.stddev, expec.stddev), AipsError); + AlwaysAssert(near(got.sum, expec.sum), AipsError); +- AlwaysAssert(got.sumsq == expec.sumsq, AipsError); ++ AlwaysAssert(near(got.sumsq, expec.sumsq), AipsError); + AlwaysAssert(near(got.variance, expec.variance), AipsError); + AlwaysAssert(*got.max == *expec.max, AipsError); + AlwaysAssert(*got.min == *expec.min, AipsError); diff -Nru casacore-2.2.0/debian/patches/Fix-too-small-int-type-for-memory-on-32-bit-machines.patch casacore-2.3.0/debian/patches/Fix-too-small-int-type-for-memory-on-32-bit-machines.patch --- casacore-2.2.0/debian/patches/Fix-too-small-int-type-for-memory-on-32-bit-machines.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Fix-too-small-int-type-for-memory-on-32-bit-machines.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,77 @@ +From: Ole Streicher +Date: Fri, 2 Dec 2016 13:16:42 +0100 +Subject: Fix too small int type for memory on 32-bit machines + +See https://github.com/casacore/casacore/issues/542#issuecomment-264440161 +--- + casa/OS/HostInfoLinux.h | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/casa/OS/HostInfoLinux.h b/casa/OS/HostInfoLinux.h +index f792b71..4edf61d 100644 +--- a/casa/OS/HostInfoLinux.h ++++ b/casa/OS/HostInfoLinux.h +@@ -132,13 +132,13 @@ skip_token(const char *p) + // get integer value from v1 cgroup hierarchy of current processes, if + // sub_value is set it returns the entry of a collection identified by value, + // e.g. total_rss from memory.stat +-// returns std::numeric_limits::max() on error ++// returns std::numeric_limits::max() on error + // note unset cgroup limits usually have intptr_t.max() + // does not support v2 cgroups +-static inline size_t ++static inline uInt64 + get_cgroup_limit(std::string group, std::string value, std::string sub_value="") + { +- size_t result = std::numeric_limits::max(); ++ uInt64 result = std::numeric_limits::max(); + // assume common location, technically one needs to search for mounts + const std::string cgroup = std::string("/sys/fs/cgroup/") + group + "/"; + +@@ -280,12 +280,12 @@ void HostMachineInfo::update_info( ) + } + + /* can't use more memory than allowed by cgroups, enforced */ +- size_t proc_mem_max = get_cgroup_limit("memory", "memory.limit_in_bytes") / 1024; ++ uInt64 proc_mem_max = get_cgroup_limit("memory", "memory.limit_in_bytes") / 1024; + /* usage_in_bytes also includes cache so use memory.stat */ +- size_t proc_mem_used = get_cgroup_limit("memory", "memory.stat", "total_rss") / 1024; ++ uInt64 proc_mem_used = get_cgroup_limit("memory", "memory.stat", "total_rss") / 1024; + + /* set HostInfo memoryTotal() */ +- memory_total = std::min((size_t)sys_mem_total, proc_mem_max); ++ memory_total = std::min((uInt64)sys_mem_total, proc_mem_max); + + /* if we have a valid cgroup limit we can determine memoryFree() exactly */ + if (proc_mem_max <= sys_mem_total && proc_mem_used <= proc_mem_max) { +@@ -293,7 +293,7 @@ void HostMachineInfo::update_info( ) + } + else { + /* no cgroups so we have to assume all memory of host is available */ +- memory_free = std::min((size_t)sys_mem_avail, (size_t)memory_total); ++ memory_free = std::min((uInt64)sys_mem_avail, (uInt64)memory_total); + } + memory_used = memory_total - memory_free; + +@@ -303,17 +303,17 @@ void HostMachineInfo::update_info( ) + cerr << "Error parsing SwapTotal and SwapFree in /proc/meminfo\n"; + + /* can't use more swap than allowed by cgroups */ +- size_t proc_swap_max = get_cgroup_limit("memory", "memory.memsw.limit_in_bytes") / 1024; +- size_t proc_swap_used = get_cgroup_limit("memory", "memory.stat", "total_swap") / 1024; ++ uInt64 proc_swap_max = get_cgroup_limit("memory", "memory.memsw.limit_in_bytes") / 1024; ++ uInt64 proc_swap_used = get_cgroup_limit("memory", "memory.stat", "total_swap") / 1024; + /* limit is mem + swap */ + if (proc_mem_max <= sys_mem_total && proc_mem_max <= proc_swap_max) { + proc_swap_max = proc_swap_max - proc_mem_max; + } + + /* set swapTotal() */ +- swap_total = std::min((size_t)sys_swap_total, proc_swap_max); ++ swap_total = std::min((uInt64)sys_swap_total, proc_swap_max); + +- if (proc_swap_max <= (size_t)swap_total && proc_swap_used <= proc_swap_max) { ++ if (proc_swap_max <= (uInt64)swap_total && proc_swap_used <= proc_swap_max) { + swap_free = proc_swap_max - proc_swap_used; + } + else { diff -Nru casacore-2.2.0/debian/patches/Loose-some-tests-tFFTServer-tests.patch casacore-2.3.0/debian/patches/Loose-some-tests-tFFTServer-tests.patch --- casacore-2.2.0/debian/patches/Loose-some-tests-tFFTServer-tests.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Loose-some-tests-tFFTServer-tests.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,36 @@ +From: Ole Streicher +Date: Thu, 24 Nov 2016 14:31:06 +0100 +Subject: Loose some tests tFFTServer tests + +This shall help to compile for mips64el and hppa. +--- + scimath/Mathematics/test/tFFTServer.cc | 2 +- + scimath/Mathematics/test/tFFTServer2.cc | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/scimath/Mathematics/test/tFFTServer.cc b/scimath/Mathematics/test/tFFTServer.cc +index c211f36..711e5a7 100644 +--- a/scimath/Mathematics/test/tFFTServer.cc ++++ b/scimath/Mathematics/test/tFFTServer.cc +@@ -1347,7 +1347,7 @@ public: + } + AlwaysTrue(result.shape().isEqual(expectedResult.shape()), + AipsError); +- AlwaysTrue(allNearAbs(result, expectedResult, epsilon), ++ AlwaysTrue(allNearAbs(result, expectedResult, 2*epsilon), + AipsError); + + int out_size = expectedResult.nelements(); +diff --git a/scimath/Mathematics/test/tFFTServer2.cc b/scimath/Mathematics/test/tFFTServer2.cc +index a663d50..880bce3 100644 +--- a/scimath/Mathematics/test/tFFTServer2.cc ++++ b/scimath/Mathematics/test/tFFTServer2.cc +@@ -1096,7 +1096,7 @@ int main() { + expectedResult(0) = Complex(5,0); + server.fft(result, input, True); + AlwaysAssert(near(result(0), Complex(5,0), FLT_EPSILON), AipsError); +- AlwaysAssert(!near(result(4).imag(), 0.0f, FLT_EPSILON), AipsError); ++ AlwaysAssert(!near(result(4).imag(), 0.0f, 2*FLT_EPSILON), AipsError); + server.fft(reverseTransform, result); + AlwaysAssert(allNearAbs(input, reverseTransform, FLT_EPSILON), + AipsError); diff -Nru casacore-2.2.0/debian/patches/Make-the-check-for-NFS-a-bit-more-portable-BSD.patch casacore-2.3.0/debian/patches/Make-the-check-for-NFS-a-bit-more-portable-BSD.patch --- casacore-2.2.0/debian/patches/Make-the-check-for-NFS-a-bit-more-portable-BSD.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Make-the-check-for-NFS-a-bit-more-portable-BSD.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,60 @@ +From: Ole Streicher +Date: Thu, 24 Nov 2016 14:31:06 +0100 +Subject: Make the check for NFS a bit more portable (BSD) + +And provide a fallback (f.e. for HURD).However, there is probably no +real use case for that, since also other file systems may be slow or +lack certain features. +--- + casa/OS/Directory.cc | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +diff --git a/casa/OS/Directory.cc b/casa/OS/Directory.cc +index 82e6efc..b79ce0f 100644 +--- a/casa/OS/Directory.cc ++++ b/casa/OS/Directory.cc +@@ -488,29 +488,38 @@ Vector Directory::shellExpand (const Vector& files, Bool stripPa + return expInNames; + } + +-#ifndef __APPLE__ ++#if defined(__linux__) + #include +-#include +-#else ++#include ++#elif defined( __APPLE__) + #include + #include + #include ++#elif defined(__FreeBSD_kernel__) ++#include ++#include ++#include + #endif + + Bool Directory::isNFSMounted() const + { ++#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) + struct statfs buf; + if (statfs (itsFile.path().expandedName().chars(), &buf) < 0) { + throw (AipsError ("Directory::isNFSMounted error on " + + itsFile.path().expandedName() + + ": " + strerror(errno))); + } +-#ifndef __APPLE__ ++#endif ++#if defined(__linux__) + return buf.f_type == NFS_SUPER_MAGIC; +-#else ++#elif defined(__APPLE__) + return buf.f_type == VT_NFS; ++#elif defined(__FreeBSD_kernel__) ++ return strcmp (buf.f_fstypename, "nfs") == 0; ++#else ++ return False; + #endif +- + } + + } //# NAMESPACE CASACORE - END diff -Nru casacore-2.2.0/debian/patches/series casacore-2.3.0/debian/patches/series --- casacore-2.2.0/debian/patches/series 2017-01-31 07:35:17.000000000 +0000 +++ casacore-2.3.0/debian/patches/series 2017-10-12 12:30:54.000000000 +0000 @@ -1,11 +1,12 @@ 0001-Do-not-install-test-and-demonstration-executables.patch -0002-Disable-class-and-collaboration-graph-generation.patch -0003-Disable-tests-that-require-data-tables.patch -0004-Disable-tPath-test.patch -0005-Disable-known-test-failures.patch -0006-Loose-some-tests-tFFTServer-tests.patch -0007-Make-the-check-for-NFS-a-bit-more-portable-BSD.patch -0008-Use-the-correct-symbol-to-detect-Linux-OS.patch -0009-Enable-hostinfo-for-kFreeBSD.patch -0010-Fix-compilation-for-GNU-Hurd.patch -0011-Fix-too-small-int-type-for-memory-on-32-bit-machines.patch +Disable-class-and-collaboration-graph-generation.patch +Disable-tests-that-require-data-tables.patch +Disable-known-test-failures.patch +Loose-some-tests-tFFTServer-tests.patch +Make-the-check-for-NFS-a-bit-more-portable-BSD.patch +Use-the-correct-symbol-to-detect-Linux-OS.patch +Enable-hostinfo-for-kFreeBSD.patch +Fix-compilation-for-GNU-Hurd.patch +Fix-too-small-int-type-for-memory-on-32-bit-machines.patch +Fix-FTBFS-tStatisticsUtilities-tLatticeStatistics-and-tLC.patch +Add-support-for-python3.6.patch diff -Nru casacore-2.2.0/debian/patches/Use-the-correct-symbol-to-detect-Linux-OS.patch casacore-2.3.0/debian/patches/Use-the-correct-symbol-to-detect-Linux-OS.patch --- casacore-2.2.0/debian/patches/Use-the-correct-symbol-to-detect-Linux-OS.patch 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/debian/patches/Use-the-correct-symbol-to-detect-Linux-OS.patch 2017-10-12 12:30:54.000000000 +0000 @@ -0,0 +1,22 @@ +From: Ole Streicher +Date: Thu, 24 Nov 2016 14:31:06 +0100 +Subject: Use the correct symbol to detect Linux OS + +Otherwise the compilation fails on powerpc archs +--- + casa/aipsenv.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/casa/aipsenv.h b/casa/aipsenv.h +index 7e272f0..25912b8 100644 +--- a/casa/aipsenv.h ++++ b/casa/aipsenv.h +@@ -130,7 +130,7 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN + #if defined(AIPS_LINUX) + #undef AIPS_LINUX + #endif +-#if defined(__linux) ++#if defined(__linux__) + #define AIPS_LINUX + #endif + diff -Nru casacore-2.2.0/derivedmscal/CMakeLists.txt casacore-2.3.0/derivedmscal/CMakeLists.txt --- casacore-2.2.0/derivedmscal/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/derivedmscal/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -10,7 +10,7 @@ DerivedMC/UDFMSCal.cc ) -target_link_libraries (casa_derivedmscal casa_ms) +target_link_libraries (casa_derivedmscal casa_ms ${CASACORE_ARCH_LIBS}) install (TARGETS casa_derivedmscal RUNTIME DESTINATION bin diff -Nru casacore-2.2.0/derivedmscal/DerivedMC/DerivedColumn.cc casacore-2.3.0/derivedmscal/DerivedMC/DerivedColumn.cc --- casacore-2.2.0/derivedmscal/DerivedMC/DerivedColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/derivedmscal/DerivedMC/DerivedColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -92,7 +92,7 @@ } void UVWJ2000Column::getArray (uInt rowNr, Array& data) { - itsEngine->getUVWJ2000 (rowNr, data); + itsEngine->getNewUVW (False, rowNr, data); } } //# end namespace diff -Nru casacore-2.2.0/derivedmscal/DerivedMC/MSCalEngine.cc casacore-2.3.0/derivedmscal/DerivedMC/MSCalEngine.cc --- casacore-2.2.0/derivedmscal/DerivedMC/MSCalEngine.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/derivedmscal/DerivedMC/MSCalEngine.cc 2017-10-12 12:24:04.000000000 +0000 @@ -34,10 +34,12 @@ #include #include #include +#include #include #include #include #include +#include #include @@ -108,9 +110,9 @@ data = itsRADecToItrf().getValue().get(); } -void MSCalEngine::getUVWJ2000 (uInt rownr, Array& data) +void MSCalEngine::getNewUVW (Bool asApp, uInt rownr, Array& data) { - setData (1, rownr); + setData (-1, rownr, True); Int ant1 = itsAntCol[0](rownr); Int ant2 = itsAntCol[1](rownr); if (ant1 == ant2) { @@ -127,7 +129,13 @@ itsBLToJ2000.setModel (antMB[ant]); MVBaseline bas = itsBLToJ2000().getValue(); MVuvw jvguvw(bas, itsLastDirJ2000.getValue()); - antUvw[ant] = Muvw(jvguvw, Muvw::J2000).getValue().getVector(); + if (asApp) { + antUvw[ant] = Muvw::Convert(Muvw(jvguvw, Muvw::J2000), + Muvw::Ref(Muvw::APP, itsFrame)) + ().getValue().getVector(); + } else { + antUvw[ant] = Muvw(jvguvw, Muvw::J2000).getValue().getVector(); + } uvwFilled[ant] = true; } ant = ant2; @@ -137,6 +145,33 @@ } } +double MSCalEngine::getDelay (Int antnr, uInt rownr) +{ + setData (-1, rownr, True); + // Get the direction in ITRF xyz. + Vector itrf = itsRADecToItrf().getValue().getValue(); + Int ant1 = itsAntCol[0](rownr); + Int ant2 = itsAntCol[1](rownr); + AlwaysAssert (ant1 < Int(itsAntPos[itsLastCalInx].size()), AipsError); + AlwaysAssert (ant2 < Int(itsAntPos[itsLastCalInx].size()), AipsError); + // Get the antenna positions in ITRF xyz. + const Vector& ap1 = itsAntPos[itsLastCalInx][ant1].getValue().getValue(); + const Vector& ap2 = itsAntPos[itsLastCalInx][ant2].getValue().getValue(); + // Delay (in meters) is inproduct (subtract array center position). + double d1 = (itrf[0] * (ap1[0] - itsArrayItrf[0]) + + itrf[1] * (ap1[1] - itsArrayItrf[1]) + + itrf[2] * (ap1[2] - itsArrayItrf[2])); + double d2 = (itrf[0] * (ap2[0] - itsArrayItrf[0]) + + itrf[1] * (ap2[1] - itsArrayItrf[1]) + + itrf[2] * (ap2[2] - itsArrayItrf[2])); + if (antnr == 0) { + return d1 / C::c; + } else if (antnr == 1) { + return d2 / C::c; + } + return (d1-d2) / C::c; +} + void MSCalEngine::setDirection (const MDirection& dir) { // Direction is explicitly given, so do not read from FIELD table. @@ -152,7 +187,7 @@ itsReadFieldDir = True; } -Int MSCalEngine::setData (Int antnr, uInt rownr) +Int MSCalEngine::setData (Int antnr, uInt rownr, Bool fillAnt) { // Initialize if not done yet. if (itsLastCalInx < 0) { @@ -180,11 +215,14 @@ // Also get mount type (alt-az or other). Int mount = 0; if (antnr < 0) { - // Set the array position if needed. + // Set the frame's array position if needed. if (antnr != itsLastAntId) { itsFrame.resetPosition (itsArrayPos); itsLastAntId = antnr; } + if (fillAnt && itsAntPos[calInx].empty()) { + fillAntPos (calDescId, calInx); + } } else { // Get the antenna id from the table. // Update the antenna positions if a higher antenna id is found. @@ -192,7 +230,7 @@ // table was not fully filled yet. Int antId = itsAntCol[antnr](rownr); if (antId != itsLastAntId) { - if (antId >= Int(itsAntPos[calInx].size())) { + if (itsAntPos[calInx].empty()) { fillAntPos (calDescId, calInx); } AlwaysAssert (antId < Int(itsAntPos[calInx].size()), AipsError); @@ -312,8 +350,13 @@ uInt nant = itsAntPos[0].size(); if (nant > 0) { itsArrayPos = itsAntPos[0][nant/2]; + fndObs = True; } } + AlwaysAssert (fndObs, AipsError); + // Convert the antenna position to ITRF (for delay calculations). + MPosition itrfPos = MPosition::Convert (itsArrayPos, MPosition::ITRF)(); + itsArrayItrf = itrfPos.getValue().getValue(); // Initialize the converters. // Set up the frame for epoch and antenna position. itsFrame.set (MEpoch(), MPosition(), MDirection()); @@ -354,7 +397,7 @@ antPos.reserve (tab.nrow()); mounts.reserve (tab.nrow()); antMB.reserve (tab.nrow()); - for (uInt i=antPos.size(); i&); - // Get the UVW in J2000 for the given row. - void getUVWJ2000 (uInt rownr, Array&); + // Get the UVW in J2000 or APP for the given row. + void getNewUVW (Bool asApp, uInt rownr, Array&); + + // Get the delay for the given row. + double getDelay (Int antnr, uInt rownr); private: // Copy constructor cannot be used. @@ -166,8 +169,9 @@ MSCalEngine& operator= (const MSCalEngine& that); // Set the data in the measure converter machines. + // The antenna positions are only filled in antnr>=0 or if fillAnt is set. // It returns the mount of the antenna. - Int setData (Int antnr, uInt rownr); + Int setData (Int antnr, uInt rownr, Bool fillAnt=False); // Initialize the column objects, etc. void init(); @@ -202,6 +206,7 @@ map itsCalMap; //# map of MS name to index vector itsCalIdMap; //# map of calId to index MPosition itsArrayPos; + Vector itsArrayItrf; //# ITRF array position vector > itsAntPos; //# ITRF antenna positions vector > itsMount; //# 1=alt-az 0=else vector > itsFieldDir; //# J2000 field directions diff -Nru casacore-2.2.0/derivedmscal/DerivedMC/Register.cc casacore-2.3.0/derivedmscal/DerivedMC/Register.cc --- casacore-2.2.0/derivedmscal/DerivedMC/Register.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/derivedmscal/DerivedMC/Register.cc 2017-10-12 12:24:04.000000000 +0000 @@ -61,9 +61,15 @@ UDFBase::registerUDF ("derivedmscal.ITRF", UDFMSCal::makeITRF); UDFBase::registerUDF ("derivedmscal.UVWWVL", UDFMSCal::makeUvwWvl); UDFBase::registerUDF ("derivedmscal.UVWWVLS", UDFMSCal::makeUvwWvls); - UDFBase::registerUDF ("derivedmscal.NEWUVW", UDFMSCal::makeUVW); - UDFBase::registerUDF ("derivedmscal.NEWUVWWVL", UDFMSCal::makeWvl); - UDFBase::registerUDF ("derivedmscal.NEWUVWWVLS",UDFMSCal::makeWvls); + UDFBase::registerUDF ("derivedmscal.UVWJ2000", UDFMSCal::makeUvwJ2000); + UDFBase::registerUDF ("derivedmscal.UVWJ2000WVL", UDFMSCal::makeWvlJ2000); + UDFBase::registerUDF ("derivedmscal.UVWJ2000WVLS",UDFMSCal::makeWvlsJ2000); + UDFBase::registerUDF ("derivedmscal.UVWAPP", UDFMSCal::makeUvwAPP); + UDFBase::registerUDF ("derivedmscal.UVWAPPWVL", UDFMSCal::makeWvlAPP); + UDFBase::registerUDF ("derivedmscal.UVWAPPWVLS",UDFMSCal::makeWvlsAPP); + UDFBase::registerUDF ("derivedmscal.DELAY1", UDFMSCal::makeDelay1); + UDFBase::registerUDF ("derivedmscal.DELAY2", UDFMSCal::makeDelay2); + UDFBase::registerUDF ("derivedmscal.DELAY", UDFMSCal::makeDelay); UDFBase::registerUDF ("derivedmscal.STOKES", UDFMSCal::makeStokes); // CASA selection. UDFBase::registerUDF ("derivedmscal.BASELINE", UDFMSCal::makeBaseline); @@ -95,9 +101,12 @@ void HelpMsCalUDF::showFuncsDerived (ostream& os) { os << "Derived direction coordinates functions" << endl; - os << "Direction can be given as the name of a FIELD subtable column," << endl; - os << "the name of a source, or a vector with source direction." << endl; - os << "If no direction argument is given, column PHASE_DIR is used." << endl; + os << " A direction parameter can be given to the functions." << endl; + os << " It can be the name of a FIELD subtable column (e.g., 'DELAY_DIR')," << endl; + os << " the name of a source (e.g., 'SUN'), or a RA,DEC pair defining" << endl; + os << " the J2000 source direction (e.g., [10h42m31.3, 45d51m16])." << endl; + os << " If no direction argument is given, column DELAY_DIR is used for the" << endl; + os << " delay functions, otherwise column PHASE_DIR." << endl; os << " double MSCAL.HA() " " hourangle of array center" << endl; os << " double MSCAL.HA1() " @@ -110,14 +119,14 @@ " hourangle/declination of ANTENNA1" << endl; os << " double MSCAL.HADEC2() " " hourangle/declination of ANTENNA2" << endl; - os << " doublearray MSCAL.AZEL() " + os << " doublearray MSCAL.AZEL() " " azimuth/elevation of array center" << endl; os << " doublearray MSCAL.AZEL1() " " azimuth/elevation of ANTENNA1" << endl; os << " doublearray MSCAL.AZEL2() " " azimuth/elevation of ANTENNA2" << endl; - os << " doublearray MSCAL.ITRF() " - " phase direction in ITRF coordinates" << endl; + os << " doublearray MSCAL.ITRF() " + " direction in ITRF coordinates" << endl; os << " double MSCAL.LAST() " " local sidereal time of array center" << endl; os << " double MSCAL.LAST1() " @@ -128,16 +137,28 @@ " parallactic angle of ANTENNA1" << endl; os << " double MSCAL.PA2() " " parallactic angle of ANTENNA2" << endl; - os << " doublearray MSCAL.NEWUVW() " - " calc UVW coordinates in J2000 in meters" << endl; - os << " doublearray MSCAL.NEWUVWWVL() " - " calc UVW coordinates in J2000 in wvl for reffreq" << endl; - os << " doublearray MSCAL.NEWUVWWVLS()" - " calc UVW coordinates in J2000 in wvl per channel" << endl; os << " doublearray MSCAL.UVWWVL() " " stored UVW coordinates in wvl for reffreq" << endl; os << " doublearray MSCAL.UVWWVLS() " " stored UVW coordinates in wvl per channel" << endl; + os << " doublearray MSCAL.UVWJ2000() " + " calc J2000 UVW coordinates in meters" << endl; + os << " doublearray MSCAL.UVWJ2000WVL() " + " calc J2000 UVW coordinates in wvl for reffreq" << endl; + os << " doublearray MSCAL.UVWJ2000WVLS()" + " calc J2000 UVW coordinates in wvl per channel" << endl; + os << " doublearray MSCAL.UVWAPP() " + " calc Apparent UVW coordinates in meters" << endl; + os << " doublearray MSCAL.UVWAPPWVL() " + " calc Apparent UVW coordinates in wvl for reffreq" << endl; + os << " doublearray MSCAL.UVWAPPWVLS()" + " calc Apparent UVW coordinates in wvl per channel" << endl; + os << " double MSCAL.DELAY1()" + " calc delay (seconds) of ANTENNA1 w.r.t. array center" << endl; + os << " double MSCAL.DELAY2()" + " calc delay (seconds) of ANTENNA2 w.r.t. array center" << endl; + os << " double MSCAL.DELAY1()" + " calc delay (seconds) of ANTENNA1 w.r.t. ANTENNA2" << endl; } void HelpMsCalUDF::showFuncsStokes (ostream& os, Bool showStokes) @@ -189,8 +210,8 @@ " select using an observation string" << endl; os << " bool MSCAL.ARRAY (string) " " select using an array string" << endl; - os << "See http://casacore.github.io/casacore-notes/263.html for" - " more information about the CASA selection syntax" << endl; + os << " More information about the CASA selection syntax can be found at" + << endl << " http://casacore.github.io/casacore-notes/263.html" << endl; } void HelpMsCalUDF::showFuncsSubtable (ostream& os) @@ -272,8 +293,8 @@ << " is an unknown mscal subtype; use derived, stokes, selection or subtable" << endl; } else { - os << endl << "See also section 'Special MeasurementSet functions'" - " at http://casacore.github.io/casacore-notes/199.html" + os << endl << "See also section 'Special MeasurementSet functions' at" + << endl << "http://casacore.github.io/casacore-notes/199.html" << endl; } return os.str(); diff -Nru casacore-2.2.0/derivedmscal/DerivedMC/UDFMSCal.cc casacore-2.3.0/derivedmscal/DerivedMC/UDFMSCal.cc --- casacore-2.2.0/derivedmscal/DerivedMC/UDFMSCal.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/derivedmscal/DerivedMC/UDFMSCal.cc 2017-10-12 12:24:04.000000000 +0000 @@ -49,7 +49,12 @@ UDFMSCal::UDFMSCal (ColType type, Int arg) : itsType (type), itsArg (arg) - {} + { + if (itsType == DELAY) { + // Default column to use for delays. + itsEngine.setDirColName ("DELAY_DIR"); + } + } UDFMSCal::UDFMSCal (const String& funcName) : itsType (GETVALUE), @@ -106,16 +111,28 @@ { return new UDFMSCal (AZEL, 1); } UDFBase* UDFMSCal::makeITRF (const String&) { return new UDFMSCal (ITRF, -1); } - UDFBase* UDFMSCal::makeUVW (const String&) - { return new UDFMSCal (NEWUVW, -1); } - UDFBase* UDFMSCal::makeWvl (const String&) - { return new UDFMSCal (UVWWVL, -1); } - UDFBase* UDFMSCal::makeWvls (const String&) - { return new UDFMSCal (UVWWVLS, -1); } UDFBase* UDFMSCal::makeUvwWvl (const String&) - { return new UDFMSCal (NEWUVWWVL, -1); } + { return new UDFMSCal (UVWWVL, -1); } UDFBase* UDFMSCal::makeUvwWvls (const String&) - { return new UDFMSCal (NEWUVWWVLS, -1); } + { return new UDFMSCal (UVWWVLS, -1); } + UDFBase* UDFMSCal::makeUvwJ2000 (const String&) + { return new UDFMSCal (NEWUVW, 0); } + UDFBase* UDFMSCal::makeWvlJ2000 (const String&) + { return new UDFMSCal (NEWUVWWVL, 0); } + UDFBase* UDFMSCal::makeWvlsJ2000 (const String&) + { return new UDFMSCal (NEWUVWWVLS, 0); } + UDFBase* UDFMSCal::makeUvwAPP (const String&) + { return new UDFMSCal (NEWUVW, 1); } + UDFBase* UDFMSCal::makeWvlAPP (const String&) + { return new UDFMSCal (NEWUVWWVL, 1); } + UDFBase* UDFMSCal::makeWvlsAPP (const String&) + { return new UDFMSCal (NEWUVWWVLS, 1); } + UDFBase* UDFMSCal::makeDelay (const String&) + { return new UDFMSCal (DELAY, -1); } + UDFBase* UDFMSCal::makeDelay1 (const String&) + { return new UDFMSCal (DELAY, 0); } + UDFBase* UDFMSCal::makeDelay2 (const String&) + { return new UDFMSCal (DELAY, 1); } UDFBase* UDFMSCal::makeStokes (const String&) { return new UDFMSCal (STOKES, -1); } UDFBase* UDFMSCal::makeBaseline (const String&) @@ -196,13 +213,18 @@ itsTmpVector.resize (2); setUnit ("rad"); break; - case NEWUVW: - setUnit ("m"); + case UVWWVL: + setupWvls (table, operands(), 0); setShape (IPosition(1,3)); itsTmpVector.resize (3); break; - case UVWWVL: + case UVWWVLS: setupWvls (table, operands(), 0); + itsTmpVector.resize (3); + setNDim(2); // The shape can vary (each band can be different) + break; + case NEWUVW: + setUnit ("m"); setShape (IPosition(1,3)); itsTmpVector.resize (3); break; @@ -211,15 +233,14 @@ setShape (IPosition(1,3)); itsTmpVector.resize (3); break; - case UVWWVLS: - setupWvls (table, operands(), 0); - itsTmpVector.resize (3); - setNDim(2); // The shape can vary (each band can be different) - break; case NEWUVWWVLS: setupWvls (table, operands(), 1); itsTmpVector.resize (3); - setNDim(2); // The shape can vary (each band can be different) + setNDim (2); // The shape can vary (each band can be different) + break; + case DELAY: + setNDim (0); + setUnit ("s"); break; case STOKES: setupStokes (table, operands()); @@ -741,6 +762,8 @@ return itsEngine.getPA (itsArg, id.rownr()); case LAST: return itsEngine.getLAST (itsArg, id.rownr()); + case DELAY: + return itsEngine.getDelay (itsArg, id.rownr()); case GETVALUE: { Int64 rownr = getRowNr(id); @@ -837,9 +860,6 @@ case ITRF: itsEngine.getItrf (itsArg, id.rownr(), itsTmpVector); return MArray(itsTmpVector); - case NEWUVW: - itsEngine.getUVWJ2000 (id.rownr(), itsTmpVector); - return MArray(itsTmpVector); case UVWWVL: itsUvwCol.get (id.rownr(), itsTmpVector); itsTmpVector *= itsWavel[itsDDIds[itsIdNode.getInt(id)]]; @@ -847,12 +867,15 @@ case UVWWVLS: itsUvwCol.get (id.rownr(), itsTmpVector); return MArray(toWvls (id)); + case NEWUVW: + itsEngine.getNewUVW (itsArg, id.rownr(), itsTmpVector); + return MArray(itsTmpVector); case NEWUVWWVL: - itsEngine.getUVWJ2000 (id.rownr(), itsTmpVector); + itsEngine.getNewUVW (itsArg, id.rownr(), itsTmpVector); itsTmpVector *= itsWavel[itsDDIds[itsIdNode.getInt(id)]]; return MArray(itsTmpVector); case NEWUVWWVLS: - itsEngine.getUVWJ2000 (id.rownr(), itsTmpVector); + itsEngine.getNewUVW (itsArg, id.rownr(), itsTmpVector); return MArray(toWvls (id)); case STOKES: { diff -Nru casacore-2.2.0/derivedmscal/DerivedMC/UDFMSCal.h casacore-2.3.0/derivedmscal/DerivedMC/UDFMSCal.h --- casacore-2.2.0/derivedmscal/DerivedMC/UDFMSCal.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/derivedmscal/DerivedMC/UDFMSCal.h 2017-10-12 12:24:04.000000000 +0000 @@ -118,8 +118,8 @@ { public: // Define the possible 'column' types. - enum ColType {HA, HADEC, PA, LAST, AZEL, ITRF, NEWUVW, - UVWWVL, UVWWVLS, NEWUVWWVL, NEWUVWWVLS, + enum ColType {HA, HADEC, PA, LAST, AZEL, ITRF, UVWWVL, UVWWVLS, + NEWUVW, NEWUVWWVL, NEWUVWWVLS, DELAY, STOKES, SELECTION, GETVALUE}; // Define the possible selection types. enum SelType {BASELINE, CORR, TIME, UVDIST, SPW, FIELD, @@ -153,11 +153,17 @@ static UDFBase* makeAZEL1 (const String&); static UDFBase* makeAZEL2 (const String&); static UDFBase* makeITRF (const String&); - static UDFBase* makeUVW (const String&); - static UDFBase* makeWvl (const String&); - static UDFBase* makeWvls (const String&); static UDFBase* makeUvwWvl (const String&); static UDFBase* makeUvwWvls (const String&); + static UDFBase* makeUvwJ2000 (const String&); + static UDFBase* makeWvlJ2000 (const String&); + static UDFBase* makeWvlsJ2000(const String&); + static UDFBase* makeUvwAPP (const String&); + static UDFBase* makeWvlAPP (const String&); + static UDFBase* makeWvlsAPP (const String&); + static UDFBase* makeDelay (const String&); + static UDFBase* makeDelay1 (const String&); + static UDFBase* makeDelay2 (const String&); static UDFBase* makeStokes (const String&); static UDFBase* makeBaseline (const String&); static UDFBase* makeCorr (const String&); diff -Nru casacore-2.2.0/fits/apps/CMakeLists.txt casacore-2.3.0/fits/apps/CMakeLists.txt --- casacore-2.2.0/fits/apps/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/fits/apps/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -1,3 +1,3 @@ add_executable (fits2table fits2table/fits2table.cc) -target_link_libraries (fits2table casa_fits) +target_link_libraries (fits2table casa_fits ${CASACORE_ARCH_LIBS}) install(TARGETS fits2table DESTINATION bin) diff -Nru casacore-2.2.0/fits/CMakeLists.txt casacore-2.3.0/fits/CMakeLists.txt --- casacore-2.2.0/fits/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/fits/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -24,7 +24,7 @@ FITS/FITSReader.cc ) -target_link_libraries (casa_fits casa_measures ${CFITSIO_LIBRARIES}) +target_link_libraries (casa_fits casa_measures ${CFITSIO_LIBRARIES} ${CASACORE_ARCH_LIBS}) add_subdirectory (apps) diff -Nru casacore-2.2.0/.git/COMMIT_EDITMSG casacore-2.3.0/.git/COMMIT_EDITMSG --- casacore-2.2.0/.git/COMMIT_EDITMSG 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/COMMIT_EDITMSG 2017-10-12 12:24:49.000000000 +0000 @@ -0,0 +1,191 @@ +Merge remote-tracking branch 'debian/master' + +# Conflicts: +# debian/changelog +# +# It looks like you may be committing a merge. +# If this is not correct, please remove the file +# .git/MERGE_HEAD +# and try again. + + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# On branch master +# Your branch is up-to-date with 'origin/master'. +# +# All conflicts fixed but you are still merging. +# +# Changes to be committed: +# modified: .travis.yml +# modified: CHANGES.md +# modified: CMakeLists.txt +# modified: README.md +# modified: casa/Arrays/Cube.tcc +# modified: casa/CMakeLists.txt +# modified: casa/Containers/ValueHolder.h +# modified: casa/Exceptions/Error.h +# modified: casa/Json/JsonKVMap.cc +# modified: casa/Json/JsonKVMap.h +# modified: casa/Json/JsonOut.cc +# modified: casa/Json/JsonValue.cc +# modified: casa/Json/JsonValue.h +# modified: casa/Json/test/tJsonKVMap.cc +# modified: casa/Json/test/tJsonKVMap.out +# modified: casa/Json/test/tJsonOut.cc +# modified: casa/Json/test/tJsonOut.out +# modified: casa/Json/test/tJsonValue.cc +# modified: casa/version.cc +# modified: casa/version.h +# modified: coordinates/CMakeLists.txt +# modified: debian/changelog +# modified: debian/control +# modified: debian/patches/0001-Do-not-install-test-and-demonstration-executables.patch +# deleted: debian/patches/0004-Disable-tPath-test.patch +# new file: debian/patches/Add-support-for-python3.6.patch +# renamed: debian/patches/0002-Disable-class-and-collaboration-graph-generation.patch -> debian/patches/Disable-class-and-collaboration-graph-generation.patch +# renamed: debian/patches/0005-Disable-known-test-failures.patch -> debian/patches/Disable-known-test-failures.patch +# renamed: debian/patches/0003-Disable-tests-that-require-data-tables.patch -> debian/patches/Disable-tests-that-require-data-tables.patch +# renamed: debian/patches/0009-Enable-hostinfo-for-kFreeBSD.patch -> debian/patches/Enable-hostinfo-for-kFreeBSD.patch +# new file: debian/patches/Fix-FTBFS-tStatisticsUtilities-tLatticeStatistics-and-tLC.patch +# renamed: debian/patches/0010-Fix-compilation-for-GNU-Hurd.patch -> debian/patches/Fix-compilation-for-GNU-Hurd.patch +# renamed: debian/patches/0011-Fix-too-small-int-type-for-memory-on-32-bit-machines.patch -> debian/patches/Fix-too-small-int-type-for-memory-on-32-bit-machines.patch +# renamed: debian/patches/0006-Loose-some-tests-tFFTServer-tests.patch -> debian/patches/Loose-some-tests-tFFTServer-tests.patch +# renamed: debian/patches/0007-Make-the-check-for-NFS-a-bit-more-portable-BSD.patch -> debian/patches/Make-the-check-for-NFS-a-bit-more-portable-BSD.patch +# renamed: debian/patches/0008-Use-the-correct-symbol-to-detect-Linux-OS.patch -> debian/patches/Use-the-correct-symbol-to-detect-Linux-OS.patch +# modified: debian/patches/series +# modified: derivedmscal/CMakeLists.txt +# modified: derivedmscal/DerivedMC/DerivedColumn.cc +# modified: derivedmscal/DerivedMC/MSCalEngine.cc +# modified: derivedmscal/DerivedMC/MSCalEngine.h +# modified: derivedmscal/DerivedMC/Register.cc +# modified: derivedmscal/DerivedMC/UDFMSCal.cc +# modified: derivedmscal/DerivedMC/UDFMSCal.h +# modified: fits/CMakeLists.txt +# modified: fits/apps/CMakeLists.txt +# modified: images/CMakeLists.txt +# modified: images/Images/ImageBeamSet.cc +# modified: images/Images/ImageBeamSet.h +# modified: images/Images/ImageConcat.h +# modified: images/Images/ImageConcat.tcc +# modified: images/Images/ImageExpr.h +# modified: images/Images/ImageExpr.tcc +# modified: images/Images/ImageFITS2Converter.cc +# modified: images/Images/ImageOpener.cc +# modified: images/Images/ImageOpener.h +# modified: images/Images/ImageStatistics.h +# modified: images/Images/ImageStatistics.tcc +# modified: images/Images/test/tFITSImage.out +# modified: images/Images/test/tFITSImage.run +# modified: images/Images/test/tImageBeamSet.cc +# modified: images/Images/test/tImageConcat.cc +# modified: images/Images/test/tImageExpr.cc +# modified: images/apps/CMakeLists.txt +# modified: lattices/CMakeLists.txt +# modified: lattices/LatticeMath/LatticeStatistics.h +# modified: lattices/LatticeMath/LatticeStatistics.tcc +# modified: meas/CMakeLists.txt +# modified: measures/CMakeLists.txt +# modified: measures/Measures/EarthField.h +# modified: measures/Measures/test/tEarthField.out +# modified: measures/Measures/test/tEarthMagneticMachine.out +# modified: measures/Measures/test/tMEarthMagnetic.out +# modified: measures/apps/CMakeLists.txt +# modified: measures/apps/measuresdata/measuresdata-update +# modified: measures/apps/measuresdata/measuresdata.cc +# modified: mirlib/CMakeLists.txt +# modified: ms/CMakeLists.txt +# modified: ms/MSOper/MSMetaData.cc +# modified: ms/MSOper/MSMetaData.h +# modified: ms/MSOper/MSSummary.cc +# modified: ms/MSOper/test/tMSMetaData.cc +# modified: ms/MSSel/MSFieldIndex.cc +# modified: ms/MSSel/MSSelection.cc +# modified: ms/MSSel/MSSpwGram.cc +# modified: ms/MSSel/MSSpwIndex.cc +# modified: ms/MSSel/test/tMSSelection.out +# modified: ms/MSSel/test/tMSSelection.run +# modified: ms/MeasurementSets/MSIter.cc +# modified: ms/MeasurementSets/MSIter.h +# modified: ms/MeasurementSets/MSRange.cc +# modified: ms/MeasurementSets/test/tMSIter.cc +# modified: ms/MeasurementSets/test/tMSIter.out +# modified: ms/apps/CMakeLists.txt +# modified: msfits/CMakeLists.txt +# modified: msfits/MSFits/FitsIDItoMS.cc +# modified: msfits/MSFits/FitsIDItoMS.h +# modified: msfits/MSFits/MSFitsIDI.cc +# modified: msfits/MSFits/MSFitsInput.cc +# modified: msfits/MSFits/MSFitsOutput.cc +# modified: msfits/apps/CMakeLists.txt +# modified: python/CMakeLists.txt +# modified: scimath/CMakeLists.txt +# modified: scimath/Mathematics/ChauvenetCriterionStatistics.h +# modified: scimath/Mathematics/ChauvenetCriterionStatistics.tcc +# modified: scimath/Mathematics/ClassicalStatistics.h +# modified: scimath/Mathematics/ClassicalStatistics.tcc +# modified: scimath/Mathematics/Convolver.tcc +# modified: scimath/Mathematics/FitToHalfStatistics.h +# modified: scimath/Mathematics/FitToHalfStatistics.tcc +# modified: scimath/Mathematics/GaussianBeam.cc +# modified: scimath/Mathematics/GaussianBeam.h +# modified: scimath/Mathematics/Interpolate2D.cc +# modified: scimath/Mathematics/Interpolate2D.h +# modified: scimath/Mathematics/StatisticsAlgorithm.h +# modified: scimath/Mathematics/StatisticsAlgorithm.tcc +# modified: scimath/Mathematics/StatisticsData.cc +# modified: scimath/Mathematics/StatisticsData.h +# modified: scimath/Mathematics/test/CMakeLists.txt +# modified: scimath/Mathematics/test/tChauvenetCriterionStatistics.cc +# modified: scimath/Mathematics/test/tClassicalStatistics.cc +# modified: scimath/Mathematics/test/tGaussianBeam.cc +# new file: scimath/Mathematics/test/tInterpolate2D.cc +# modified: scimath_f/CMakeLists.txt +# modified: tables/CMakeLists.txt +# modified: tables/DataMan/BaseMappedArrayEngine.tcc +# modified: tables/DataMan/DataManAccessor.cc +# modified: tables/DataMan/DataManager.cc +# modified: tables/DataMan/ForwardCol.cc +# modified: tables/DataMan/ForwardColRow.cc +# modified: tables/DataMan/ISMIndColumn.cc +# modified: tables/DataMan/MSMBase.cc +# modified: tables/DataMan/MSMColumn.cc +# modified: tables/DataMan/MSMIndColumn.cc +# modified: tables/DataMan/SSMBase.cc +# modified: tables/DataMan/SSMBase.h +# modified: tables/DataMan/SSMColumn.cc +# modified: tables/DataMan/SSMDirColumn.cc +# modified: tables/DataMan/SSMIndColumn.cc +# modified: tables/DataMan/SSMIndStringColumn.cc +# modified: tables/DataMan/SSMIndex.cc +# modified: tables/DataMan/SSMIndex.h +# modified: tables/DataMan/StArrayFile.cc +# modified: tables/DataMan/StManAipsIO.cc +# modified: tables/DataMan/StManColumn.cc +# modified: tables/DataMan/TSMCube.cc +# modified: tables/DataMan/TSMCubeMMap.cc +# modified: tables/DataMan/TSMDataColumn.cc +# modified: tables/DataMan/TSMFile.cc +# modified: tables/DataMan/TSMIdColumn.cc +# modified: tables/DataMan/TiledStMan.cc +# modified: tables/DataMan/VirtArrCol.tcc +# modified: tables/DataMan/VirtualTaQLColumn.cc +# modified: tables/TaQL/ExprFuncNodeArray.cc +# modified: tables/TaQL/test/tTableGram.out +# modified: tables/TaQL/test/tTableGram.run +# modified: tables/TaQL/test/tTableGramAlttab.out +# modified: tables/TaQL/test/tTableGramAlttab.run +# modified: tables/TaQL/test/tTableGramCretab.out +# modified: tables/TaQL/test/tTableGramCretab.run +# modified: tables/Tables.h +# modified: tables/Tables/BaseTabIter.cc +# modified: tables/Tables/BaseTabIter.h +# modified: tables/Tables/Table.h +# modified: tables/Tables/TableIter.cc +# modified: tables/Tables/TableIter.h +# modified: tables/Tables/TableProxy.cc +# modified: tables/Tables/TableProxy.h +# modified: tables/Tables/test/tTableIter.cc +# modified: tables/Tables/test/tTableIter.out +# modified: tables/Tables/test/tTableRecord.cc +# diff -Nru casacore-2.2.0/.git/config casacore-2.3.0/.git/config --- casacore-2.2.0/.git/config 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/config 2017-10-12 12:22:54.000000000 +0000 @@ -0,0 +1,14 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true +[remote "origin"] + url = git@github.com:kernsuite-debian/casacore + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master +[remote "debian"] + url = git://anonscm.debian.org/debian-astro/packages/casacore.git + fetch = +refs/heads/*:refs/remotes/debian/* diff -Nru casacore-2.2.0/.git/description casacore-2.3.0/.git/description --- casacore-2.2.0/.git/description 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/description 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff -Nru casacore-2.2.0/.git/FETCH_HEAD casacore-2.3.0/.git/FETCH_HEAD --- casacore-2.2.0/.git/FETCH_HEAD 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/FETCH_HEAD 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1,8 @@ +d13c9ac92f4d880bdfbbb5664e7879828afc243d not-for-merge branch 'master' of git://anonscm.debian.org/debian-astro/packages/casacore +a122d2a3445f8b70fffd84a0cbc26855cbb18072 not-for-merge branch 'pristine-tar' of git://anonscm.debian.org/debian-astro/packages/casacore +8f436d514adeb409ece1a94eb339e0e86c8ff031 not-for-merge branch 'upstream' of git://anonscm.debian.org/debian-astro/packages/casacore +d4f35f0bacd92d5ba938c650c783e47597c787a2 not-for-merge tag 'debian/2.3.0-4' of git://anonscm.debian.org/debian-astro/packages/casacore +93f3b93bf98b8af9d10187678e787c11b02f952a not-for-merge tag 'upstream/2.3.0' of git://anonscm.debian.org/debian-astro/packages/casacore +f112a13fd12845ce8698c755ac855bc172404af1 not-for-merge tag 'debian/2.3.0-1' of git://anonscm.debian.org/debian-astro/packages/casacore +5dc39eab5b0d6a5fb10a205e59a3bb892d8e255d not-for-merge tag 'debian/2.3.0-2' of git://anonscm.debian.org/debian-astro/packages/casacore +d7f5015c192b6eec4686a6309027035c72bf8385 not-for-merge tag 'debian/2.3.0-3' of git://anonscm.debian.org/debian-astro/packages/casacore diff -Nru casacore-2.2.0/.git/HEAD casacore-2.3.0/.git/HEAD --- casacore-2.2.0/.git/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/HEAD 2017-10-12 12:26:24.000000000 +0000 @@ -0,0 +1 @@ +8f436d514adeb409ece1a94eb339e0e86c8ff031 diff -Nru casacore-2.2.0/.git/hooks/applypatch-msg.sample casacore-2.3.0/.git/hooks/applypatch-msg.sample --- casacore-2.2.0/.git/hooks/applypatch-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/hooks/applypatch-msg.sample 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff -Nru casacore-2.2.0/.git/hooks/commit-msg.sample casacore-2.3.0/.git/hooks/commit-msg.sample --- casacore-2.2.0/.git/hooks/commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/hooks/commit-msg.sample 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff -Nru casacore-2.2.0/.git/hooks/post-update.sample casacore-2.3.0/.git/hooks/post-update.sample --- casacore-2.2.0/.git/hooks/post-update.sample 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/hooks/post-update.sample 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff -Nru casacore-2.2.0/.git/hooks/pre-applypatch.sample casacore-2.3.0/.git/hooks/pre-applypatch.sample --- casacore-2.2.0/.git/hooks/pre-applypatch.sample 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/hooks/pre-applypatch.sample 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff -Nru casacore-2.2.0/.git/hooks/pre-commit.sample casacore-2.3.0/.git/hooks/pre-commit.sample --- casacore-2.2.0/.git/hooks/pre-commit.sample 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/hooks/pre-commit.sample 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff -Nru casacore-2.2.0/.git/hooks/prepare-commit-msg.sample casacore-2.3.0/.git/hooks/prepare-commit-msg.sample --- casacore-2.2.0/.git/hooks/prepare-commit-msg.sample 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/hooks/prepare-commit-msg.sample 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,36 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first comments out the +# "Conflicts:" part of a merge commit. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +case "$2,$3" in + merge,) + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;; + +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$1" ;; + + *) ;; +esac + +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" diff -Nru casacore-2.2.0/.git/hooks/pre-push.sample casacore-2.3.0/.git/hooks/pre-push.sample --- casacore-2.2.0/.git/hooks/pre-push.sample 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/hooks/pre-push.sample 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,53 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +z40=0000000000000000000000000000000000000000 + +while read local_ref local_sha remote_ref remote_sha +do + if [ "$local_sha" = $z40 ] + then + # Handle delete + : + else + if [ "$remote_sha" = $z40 ] + then + # New branch, examine all commits + range="$local_sha" + else + # Update to existing branch, examine new commits + range="$remote_sha..$local_sha" + fi + + # Check for WIP commit + commit=`git rev-list -n 1 --grep '^WIP' "$range"` + if [ -n "$commit" ] + then + echo >&2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff -Nru casacore-2.2.0/.git/hooks/pre-rebase.sample casacore-2.3.0/.git/hooks/pre-rebase.sample --- casacore-2.2.0/.git/hooks/pre-rebase.sample 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/hooks/pre-rebase.sample 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up-to-date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff -Nru casacore-2.2.0/.git/hooks/update.sample casacore-2.3.0/.git/hooks/update.sample --- casacore-2.2.0/.git/hooks/update.sample 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/hooks/update.sample 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to block unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --bool hooks.allowunannotated) +allowdeletebranch=$(git config --bool hooks.allowdeletebranch) +denycreatebranch=$(git config --bool hooks.denycreatebranch) +allowdeletetag=$(git config --bool hooks.allowdeletetag) +allowmodifytag=$(git config --bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero="0000000000000000000000000000000000000000" +if [ "$newrev" = "$zero" ]; then + newrev_type=delete +else + newrev_type=$(git cat-file -t $newrev) +fi + +case "$refname","$newrev_type" in + refs/tags/*,commit) + # un-annotated tag + short_refname=${refname##refs/tags/} + if [ "$allowunannotated" != "true" ]; then + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 Binary files /tmp/tmpAewTQZ/OzJ136cHMM/casacore-2.2.0/.git/index and /tmp/tmpAewTQZ/TwpHbZMyQ4/casacore-2.3.0/.git/index differ diff -Nru casacore-2.2.0/.git/info/exclude casacore-2.3.0/.git/info/exclude --- casacore-2.2.0/.git/info/exclude 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/info/exclude 2017-10-05 14:23:52.000000000 +0000 @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff -Nru casacore-2.2.0/.git/logs/HEAD casacore-2.3.0/.git/logs/HEAD --- casacore-2.2.0/.git/logs/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/logs/HEAD 2017-10-12 12:26:24.000000000 +0000 @@ -0,0 +1,6 @@ +0000000000000000000000000000000000000000 c937f1ab7176fa3de02df671e257452ad329729c Gijs Molenaar 1507213465 +0200 clone: from git@github.com:kernsuite-debian/casacore +c937f1ab7176fa3de02df671e257452ad329729c e3b362d65ed4dca2f591c137a68ecce5b5015ef2 Gijs Molenaar 1507811089 +0200 commit (merge): Merge remote-tracking branch 'debian/master' +e3b362d65ed4dca2f591c137a68ecce5b5015ef2 d13c9ac92f4d880bdfbbb5664e7879828afc243d Gijs Molenaar 1507811116 +0200 checkout: moving from master to debian/master +d13c9ac92f4d880bdfbbb5664e7879828afc243d e3b362d65ed4dca2f591c137a68ecce5b5015ef2 Gijs Molenaar 1507811128 +0200 checkout: moving from d13c9ac92f4d880bdfbbb5664e7879828afc243d to master +e3b362d65ed4dca2f591c137a68ecce5b5015ef2 d13c9ac92f4d880bdfbbb5664e7879828afc243d Gijs Molenaar 1507811145 +0200 checkout: moving from master to debian/master +d13c9ac92f4d880bdfbbb5664e7879828afc243d 8f436d514adeb409ece1a94eb339e0e86c8ff031 Gijs Molenaar 1507811184 +0200 checkout: moving from d13c9ac92f4d880bdfbbb5664e7879828afc243d to upstream/2.3.0 diff -Nru casacore-2.2.0/.git/logs/refs/heads/master casacore-2.3.0/.git/logs/refs/heads/master --- casacore-2.2.0/.git/logs/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/logs/refs/heads/master 2017-10-12 12:24:50.000000000 +0000 @@ -0,0 +1,2 @@ +0000000000000000000000000000000000000000 c937f1ab7176fa3de02df671e257452ad329729c Gijs Molenaar 1507213465 +0200 clone: from git@github.com:kernsuite-debian/casacore +c937f1ab7176fa3de02df671e257452ad329729c e3b362d65ed4dca2f591c137a68ecce5b5015ef2 Gijs Molenaar 1507811089 +0200 commit (merge): Merge remote-tracking branch 'debian/master' diff -Nru casacore-2.2.0/.git/logs/refs/remotes/debian/master casacore-2.3.0/.git/logs/refs/remotes/debian/master --- casacore-2.2.0/.git/logs/refs/remotes/debian/master 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/logs/refs/remotes/debian/master 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 d13c9ac92f4d880bdfbbb5664e7879828afc243d Gijs Molenaar 1507811010 +0200 fetch debian: storing head diff -Nru casacore-2.2.0/.git/logs/refs/remotes/debian/pristine-tar casacore-2.3.0/.git/logs/refs/remotes/debian/pristine-tar --- casacore-2.2.0/.git/logs/refs/remotes/debian/pristine-tar 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/logs/refs/remotes/debian/pristine-tar 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 a122d2a3445f8b70fffd84a0cbc26855cbb18072 Gijs Molenaar 1507811010 +0200 fetch debian: storing head diff -Nru casacore-2.2.0/.git/logs/refs/remotes/debian/upstream casacore-2.3.0/.git/logs/refs/remotes/debian/upstream --- casacore-2.2.0/.git/logs/refs/remotes/debian/upstream 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/logs/refs/remotes/debian/upstream 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 8f436d514adeb409ece1a94eb339e0e86c8ff031 Gijs Molenaar 1507811010 +0200 fetch debian: storing head diff -Nru casacore-2.2.0/.git/logs/refs/remotes/origin/HEAD casacore-2.3.0/.git/logs/refs/remotes/origin/HEAD --- casacore-2.2.0/.git/logs/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/logs/refs/remotes/origin/HEAD 2017-10-05 14:24:25.000000000 +0000 @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 c937f1ab7176fa3de02df671e257452ad329729c Gijs Molenaar 1507213465 +0200 clone: from git@github.com:kernsuite-debian/casacore Binary files /tmp/tmpAewTQZ/OzJ136cHMM/casacore-2.2.0/.git/objects/33/1f5a62d7d76c6e391dc7f493f97c52ca35aa04 and /tmp/tmpAewTQZ/TwpHbZMyQ4/casacore-2.3.0/.git/objects/33/1f5a62d7d76c6e391dc7f493f97c52ca35aa04 differ Binary files /tmp/tmpAewTQZ/OzJ136cHMM/casacore-2.2.0/.git/objects/c1/797470d0a937990aa3113c180806aefa7c162a and /tmp/tmpAewTQZ/TwpHbZMyQ4/casacore-2.3.0/.git/objects/c1/797470d0a937990aa3113c180806aefa7c162a differ Binary files /tmp/tmpAewTQZ/OzJ136cHMM/casacore-2.2.0/.git/objects/e3/b362d65ed4dca2f591c137a68ecce5b5015ef2 and /tmp/tmpAewTQZ/TwpHbZMyQ4/casacore-2.3.0/.git/objects/e3/b362d65ed4dca2f591c137a68ecce5b5015ef2 differ Binary files /tmp/tmpAewTQZ/OzJ136cHMM/casacore-2.2.0/.git/objects/ec/9df09fddddbd82364bdd509d5266b28d83e521 and /tmp/tmpAewTQZ/TwpHbZMyQ4/casacore-2.3.0/.git/objects/ec/9df09fddddbd82364bdd509d5266b28d83e521 differ Binary files /tmp/tmpAewTQZ/OzJ136cHMM/casacore-2.2.0/.git/objects/pack/pack-433da4b01d6e4f57d6f90b4f52c1c13b6741b222.idx and /tmp/tmpAewTQZ/TwpHbZMyQ4/casacore-2.3.0/.git/objects/pack/pack-433da4b01d6e4f57d6f90b4f52c1c13b6741b222.idx differ Binary files /tmp/tmpAewTQZ/OzJ136cHMM/casacore-2.2.0/.git/objects/pack/pack-433da4b01d6e4f57d6f90b4f52c1c13b6741b222.pack and /tmp/tmpAewTQZ/TwpHbZMyQ4/casacore-2.3.0/.git/objects/pack/pack-433da4b01d6e4f57d6f90b4f52c1c13b6741b222.pack differ Binary files /tmp/tmpAewTQZ/OzJ136cHMM/casacore-2.2.0/.git/objects/pack/pack-83d484e5074886b499c2542d7cc67f97922025a8.idx and /tmp/tmpAewTQZ/TwpHbZMyQ4/casacore-2.3.0/.git/objects/pack/pack-83d484e5074886b499c2542d7cc67f97922025a8.idx differ Binary files /tmp/tmpAewTQZ/OzJ136cHMM/casacore-2.2.0/.git/objects/pack/pack-83d484e5074886b499c2542d7cc67f97922025a8.pack and /tmp/tmpAewTQZ/TwpHbZMyQ4/casacore-2.3.0/.git/objects/pack/pack-83d484e5074886b499c2542d7cc67f97922025a8.pack differ diff -Nru casacore-2.2.0/.git/ORIG_HEAD casacore-2.3.0/.git/ORIG_HEAD --- casacore-2.2.0/.git/ORIG_HEAD 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/ORIG_HEAD 2017-10-12 12:24:04.000000000 +0000 @@ -0,0 +1 @@ +c937f1ab7176fa3de02df671e257452ad329729c diff -Nru casacore-2.2.0/.git/packed-refs casacore-2.3.0/.git/packed-refs --- casacore-2.2.0/.git/packed-refs 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/packed-refs 2017-10-05 14:24:25.000000000 +0000 @@ -0,0 +1,32 @@ +# pack-refs with: peeled fully-peeled +c937f1ab7176fa3de02df671e257452ad329729c refs/remotes/origin/master +47378945bcbb7b413f8ed74ffd26fa7675d1250b refs/remotes/origin/pristine-tar +4b446810795cc6d857ad9122894781749eb2760f refs/remotes/origin/upstream +1fc61589ddb8a2c354221f2a32ab5e71d7d7ae26 refs/tags/debian/2.1.0-1 +3ed8d054225c1f5afa576494eeb28a264c11a34d refs/tags/debian/2.1.0-2 +ceb6a1db9ebbdbcf43555fb156b76a4104b0698b refs/tags/debian/2.1.0-3 +7d5ce4dab9f90602f248666a52c3e2122b799e8e refs/tags/debian/2.2.0-1 +^00bcdd6ea4c07b636c17bf20d1b1dd2f8ca3dfcf +923f1c61901590ac4c8d1887fca7f524333874b7 refs/tags/debian/2.2.0-2 +^caebec74a218edde1efe1e52ffc131bd18371895 +bb13a8734450a326cbad423dfa09c5904facc93a refs/tags/debian/2.2.0-2kern1 +^d115cbdb2d64a6de5c4909591a1740df817c0721 +a0df64e38a6054a3459e3e49f48a9d3230465d60 refs/tags/debian/2.2.0-2kern1zesty1 +^c937f1ab7176fa3de02df671e257452ad329729c +b4ed53759092124312c52b746219fc85f409e154 refs/tags/debian/2.2_rc+2016.11.24-1 +^1df7af4fec32dd0f6ef31883e2c23a43c3649a1d +688f7505c6fcf0eaae17e51cb923053d7465cf52 refs/tags/upstream/1.5.0 +a1af933c5d4915119bd7e4b166524b334d86893c refs/tags/upstream/1.6.0 +79937272475480f6055dd18fb1204f7179b4c3ce refs/tags/upstream/1.7.0 +2efa86a84c26eea4b70e66890401f8c11568440b refs/tags/upstream/2.0.0 +2a651e31c8d1c51a72a6eea5fcf224b0d7c26207 refs/tags/upstream/2.0.1 +03cc6db65bc75d497bda2566a751836c7f5a0542 refs/tags/upstream/2.1.0 +^5441f711c837d17ba0d3c9799e0abaa1be559086 +a0e6565dca5ed96eb526cb9cdaaf307eb55e02a9 refs/tags/upstream/2.2.0 +^118208c8cb62d33a7d6b0f0c38be9dddc0e95e11 +684520dadf56b771d920ed1c37a632742378a083 refs/tags/upstream/2.2_rc+2016.11.24 +^393dee50fc704673b539cb6256ae29d78d54b13a +2efa86a84c26eea4b70e66890401f8c11568440b refs/tags/v2.0.0 +2a651e31c8d1c51a72a6eea5fcf224b0d7c26207 refs/tags/v2.0.1 +90015ad33dc99fdfadae3c291f7f50aa77fcbb4b refs/tags/v2.0.3 +29182512756b7c3bf298c175fac6ca714b9a1a56 refs/tags/v2.1.0 diff -Nru casacore-2.2.0/.git/refs/heads/master casacore-2.3.0/.git/refs/heads/master --- casacore-2.2.0/.git/refs/heads/master 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/heads/master 2017-10-12 12:24:50.000000000 +0000 @@ -0,0 +1 @@ +e3b362d65ed4dca2f591c137a68ecce5b5015ef2 diff -Nru casacore-2.2.0/.git/refs/remotes/debian/master casacore-2.3.0/.git/refs/remotes/debian/master --- casacore-2.2.0/.git/refs/remotes/debian/master 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/remotes/debian/master 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +d13c9ac92f4d880bdfbbb5664e7879828afc243d diff -Nru casacore-2.2.0/.git/refs/remotes/debian/pristine-tar casacore-2.3.0/.git/refs/remotes/debian/pristine-tar --- casacore-2.2.0/.git/refs/remotes/debian/pristine-tar 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/remotes/debian/pristine-tar 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +a122d2a3445f8b70fffd84a0cbc26855cbb18072 diff -Nru casacore-2.2.0/.git/refs/remotes/debian/upstream casacore-2.3.0/.git/refs/remotes/debian/upstream --- casacore-2.2.0/.git/refs/remotes/debian/upstream 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/remotes/debian/upstream 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +8f436d514adeb409ece1a94eb339e0e86c8ff031 diff -Nru casacore-2.2.0/.git/refs/remotes/origin/HEAD casacore-2.3.0/.git/refs/remotes/origin/HEAD --- casacore-2.2.0/.git/refs/remotes/origin/HEAD 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/remotes/origin/HEAD 2017-10-05 14:24:25.000000000 +0000 @@ -0,0 +1 @@ +ref: refs/remotes/origin/master diff -Nru casacore-2.2.0/.git/refs/tags/debian/2.3.0-1 casacore-2.3.0/.git/refs/tags/debian/2.3.0-1 --- casacore-2.2.0/.git/refs/tags/debian/2.3.0-1 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/tags/debian/2.3.0-1 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +f112a13fd12845ce8698c755ac855bc172404af1 diff -Nru casacore-2.2.0/.git/refs/tags/debian/2.3.0-2 casacore-2.3.0/.git/refs/tags/debian/2.3.0-2 --- casacore-2.2.0/.git/refs/tags/debian/2.3.0-2 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/tags/debian/2.3.0-2 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +5dc39eab5b0d6a5fb10a205e59a3bb892d8e255d diff -Nru casacore-2.2.0/.git/refs/tags/debian/2.3.0-3 casacore-2.3.0/.git/refs/tags/debian/2.3.0-3 --- casacore-2.2.0/.git/refs/tags/debian/2.3.0-3 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/tags/debian/2.3.0-3 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +d7f5015c192b6eec4686a6309027035c72bf8385 diff -Nru casacore-2.2.0/.git/refs/tags/debian/2.3.0-4 casacore-2.3.0/.git/refs/tags/debian/2.3.0-4 --- casacore-2.2.0/.git/refs/tags/debian/2.3.0-4 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/tags/debian/2.3.0-4 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +d4f35f0bacd92d5ba938c650c783e47597c787a2 diff -Nru casacore-2.2.0/.git/refs/tags/upstream/2.3.0 casacore-2.3.0/.git/refs/tags/upstream/2.3.0 --- casacore-2.2.0/.git/refs/tags/upstream/2.3.0 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/.git/refs/tags/upstream/2.3.0 2017-10-12 12:23:30.000000000 +0000 @@ -0,0 +1 @@ +93f3b93bf98b8af9d10187678e787c11b02f952a diff -Nru casacore-2.2.0/images/apps/CMakeLists.txt casacore-2.3.0/images/apps/CMakeLists.txt --- casacore-2.2.0/images/apps/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/apps/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -1,5 +1,5 @@ foreach(prog image2fits imagecalc imageregrid imageslice) add_executable (${prog} ${prog}.cc) - target_link_libraries (${prog} casa_images) + target_link_libraries (${prog} casa_images ${CASACORE_ARCH_LIBS}) install(TARGETS ${prog} DESTINATION bin) endforeach(prog image2fits imagecalc imageregrid imageslice) diff -Nru casacore-2.2.0/images/CMakeLists.txt casacore-2.3.0/images/CMakeLists.txt --- casacore-2.2.0/images/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -63,6 +63,7 @@ casa_coordinates casa_mirlib casa_lattices +${CASACORE_ARCH_LIBS} ) add_subdirectory (apps) diff -Nru casacore-2.2.0/images/Images/ImageBeamSet.cc casacore-2.3.0/images/Images/ImageBeamSet.cc --- casacore-2.2.0/images/Images/ImageBeamSet.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageBeamSet.cc 2017-10-12 12:24:04.000000000 +0000 @@ -40,688 +40,690 @@ const String ImageBeamSet::_DEFAULT_AREA_UNIT = "arcsec2"; ImageBeamSet::ImageBeamSet() : - _beams (0, 0), - _areaUnit (_DEFAULT_AREA_UNIT), - _minBeam (GaussianBeam::NULL_BEAM), - _maxBeam (GaussianBeam::NULL_BEAM), - _minBeamPos (2, 0), _maxBeamPos(2, 0) {} + _beams (0, 0), + _areaUnit (_DEFAULT_AREA_UNIT), + _minBeam (GaussianBeam::NULL_BEAM), + _maxBeam (GaussianBeam::NULL_BEAM), + _minBeamPos (2, 0), _maxBeamPos(2, 0) {} ImageBeamSet::ImageBeamSet(const Matrix& beams) : - _beams(beams) { - _calculateAreas(); + _beams(beams) { + _calculateAreas(); } ImageBeamSet::ImageBeamSet(const GaussianBeam& beam) : - _beams (1, 1, beam), - _areas (1, 1, beam.getArea(_DEFAULT_AREA_UNIT)), - _areaUnit (_DEFAULT_AREA_UNIT), - _minBeam (beam), - _maxBeam (beam), - _minBeamPos (2, 0), - _maxBeamPos (2, 0) {} + _beams (1, 1, beam), + _areas (1, 1, beam.getArea(_DEFAULT_AREA_UNIT)), + _areaUnit (_DEFAULT_AREA_UNIT), + _minBeam (beam), + _maxBeam (beam), + _minBeamPos (2, 0), + _maxBeamPos (2, 0) {} ImageBeamSet::ImageBeamSet( - uInt nchan, uInt nstokes, const GaussianBeam& beam + uInt nchan, uInt nstokes, const GaussianBeam& beam ) : - _beams(max(1u, nchan), max(1u, nstokes), beam), - _areas (_beams.shape(), beam.getArea(_DEFAULT_AREA_UNIT)), - _areaUnit (_DEFAULT_AREA_UNIT), - _minBeam (beam), - _maxBeam (beam), - _minBeamPos (2, 0), - _maxBeamPos (2, 0) {} + _beams(max(1u, nchan), max(1u, nstokes), beam), + _areas (_beams.shape(), beam.getArea(_DEFAULT_AREA_UNIT)), + _areaUnit (_DEFAULT_AREA_UNIT), + _minBeam (beam), + _maxBeam (beam), + _minBeamPos (2, 0), + _maxBeamPos (2, 0) {} ImageBeamSet::ImageBeamSet(const ImageBeamSet& other) : - _beams (other._beams), - _areas (other._areas), - _areaUnit (other._areaUnit), - _minBeam (other._minBeam), - _maxBeam (other._maxBeam), - _minBeamPos (other._minBeamPos), - _maxBeamPos (other._maxBeamPos) {} + _beams (other._beams), + _areas (other._areas), + _areaUnit (other._areaUnit), + _minBeam (other._minBeam), + _maxBeam (other._maxBeam), + _minBeamPos (other._minBeamPos), + _maxBeamPos (other._maxBeamPos) {} ImageBeamSet::~ImageBeamSet() {} ImageBeamSet& ImageBeamSet::operator=(const ImageBeamSet& other) { - if (this != &other) { - _beams.assign(other._beams); - _areas.assign(other._areas); - _areaUnit = other._areaUnit; - _minBeam = other._minBeam; - _maxBeam = other._maxBeam; - _minBeamPos = other._minBeamPos; - _maxBeamPos = other._maxBeamPos; - } - return *this; + if (this != &other) { + _beams.assign(other._beams); + _areas.assign(other._areas); + _areaUnit = other._areaUnit; + _minBeam = other._minBeam; + _maxBeam = other._maxBeam; + _minBeamPos = other._minBeamPos; + _maxBeamPos = other._maxBeamPos; + } + return *this; } const GaussianBeam& ImageBeamSet::getBeam(Int chan, Int stokes) const { - if (nchan() <= 1) { - chan = 0; - } - if (nstokes() <= 1) { - stokes = 0; - } - // Note that chan=-1 can only be given if nchan()==1. - AlwaysAssert( - chan >=0 && chan < Int(nchan()) && stokes >= 0 && stokes < Int(nstokes()), - AipsError - ); - return _beams(chan, stokes); + if (nchan() <= 1) { + chan = 0; + } + if (nstokes() <= 1) { + stokes = 0; + } + // Note that chan=-1 can only be given if nchan()==1. + AlwaysAssert( + chan >=0 && chan < Int(nchan()) && stokes >= 0 && stokes < Int(nstokes()), + AipsError + ); + return _beams(chan, stokes); } Bool ImageBeamSet::operator==(const ImageBeamSet& other) const { - return ( - this == &other - || ( - _beams.shape() == other._beams.shape() - && allEQ(_beams, other._beams) - ) - ); + return ( + this == &other + || ( + _beams.shape() == other._beams.shape() + && allEQ(_beams, other._beams) + ) + ); } Bool ImageBeamSet::operator!=(const ImageBeamSet& other) const { - return !(*this == other); + return !(*this == other); } const GaussianBeam& ImageBeamSet::getBeam() const { - if (size() > 1) { - throw AipsError( - String(className()) + "::" + __FUNCTION__ - + ": This object contains multiple beams, " - "not a single beam" - ); - } - else if (empty()) { - throw AipsError( - String(className()) + "::" + __FUNCTION__ - + ": This object is empty." - ); - } - return _beams(0, 0); + if (size() > 1) { + throw AipsError( + String(className()) + "::" + __FUNCTION__ + + ": This object contains multiple beams, " + "not a single beam" + ); + } + else if (empty()) { + throw AipsError( + String(className()) + "::" + __FUNCTION__ + + ": This object is empty." + ); + } + return _beams(0, 0); } const String& ImageBeamSet::className() { - static const String c = "ImageBeamSet"; - return c; + static const String c = "ImageBeamSet"; + return c; } void ImageBeamSet::resize(uInt nchan, uInt nstokes) { - _beams.resize(max(1u, nchan), max(1u, nstokes)); - _calculateAreas(); + _beams.resize(max(1u, nchan), max(1u, nstokes)); + _calculateAreas(); } void ImageBeamSet::setBeams(const Matrix& beams) { - // Resize the beams if needed. - // A beam axis can be extended if its length is 0 or 1. - Int nch = nchan(); - Int beamNchan = beams.shape()[0]; - if (nch <= 1) { - nch = beamNchan; - } - Int nst = nstokes(); - Int beamNstokes = beams.shape()[1]; - if (nst <= 1) { - nst = beams.shape()[1]; - } - AlwaysAssert( - (beamNchan == nch || beamNchan == 1) - && (beamNstokes == nst || beamNstokes == 1), - AipsError - ); - // Determine the step size in the given beams. - Int incrChan = (beamNchan == 1 ? 0 : 1); - Int incrStokes = (beamNstokes == 1 ? 0 : 1); - // Set the beam set to the given beams. - _beams.resize(nch, nst); - Int js = 0; - for (Int is = 0; is < nst; ++is, js += incrStokes) { - Int jc = 0; - for (Int ic = 0; ic < nch; ++ic, jc += incrChan) { - _beams(ic, is) = beams(jc, js); - } - } - _calculateAreas(); + // Resize the beams if needed. + // A beam axis can be extended if its length is 0 or 1. + Int nch = nchan(); + Int beamNchan = beams.shape()[0]; + if (nch <= 1) { + nch = beamNchan; + } + Int nst = nstokes(); + Int beamNstokes = beams.shape()[1]; + if (nst <= 1) { + nst = beams.shape()[1]; + } + AlwaysAssert( + (beamNchan == nch || beamNchan == 1) + && (beamNstokes == nst || beamNstokes == 1), + AipsError + ); + // Determine the step size in the given beams. + Int incrChan = (beamNchan == 1 ? 0 : 1); + Int incrStokes = (beamNstokes == 1 ? 0 : 1); + // Set the beam set to the given beams. + _beams.resize(nch, nst); + Int js = 0; + for (Int is = 0; is < nst; ++is, js += incrStokes) { + Int jc = 0; + for (Int ic = 0; ic < nch; ++ic, jc += incrChan) { + _beams(ic, is) = beams(jc, js); + } + } + _calculateAreas(); } void ImageBeamSet::set(const GaussianBeam& beam) { - _beams = beam; - _areas = beam.getArea(_areaUnit); - _minBeam = beam; - _maxBeam = beam; - _minBeamPos = 0; - _maxBeamPos = 0; + _beams = beam; + _areas = beam.getArea(_areaUnit); + _minBeam = beam; + _maxBeam = beam; + _minBeamPos = 0; + _maxBeamPos = 0; } void ImageBeamSet::setBeam(Int chan, Int stokes, const GaussianBeam& beam) { - AlwaysAssert( - Int(chan) < _beams.shape()[0] && Int(stokes) < _beams.shape()[1], - AipsError - ); - if (chan >= 0 && stokes >= 0) { - _beams(chan, stokes) = beam; - IPosition location(2, chan, stokes); - if (location == _maxBeamPos || location == _minBeamPos) { - // we are overwriting the max or min beam, so we need to - // determine the new max or min - _calculateAreas(); - } - else { - Double area = beam.getArea(_areaUnit); - _areas(chan, stokes) = area; - if (area < _areas(_minBeamPos)) { - _minBeam = beam; - _minBeamPos = location; - } - if (area > _areas(_maxBeamPos)) { - _maxBeam = beam; - _maxBeamPos = location; - } - } - } - else if (chan < 0 && stokes < 0) { - *this = ImageBeamSet(beam); - } - else if (chan < 0) { - _beams(IPosition(2, 0, stokes), IPosition(2, nchan()-1, stokes)) = beam; - if (_maxBeamPos[0] == chan || _minBeamPos[0] == chan) { - // we are overwriting the max or min beam, so we need to recalculate - // the areas - _calculateAreas(); - } - else { - Double area = beam.getArea(_areaUnit); - _areas(IPosition(2, 0, stokes), IPosition(2, nchan()-1, stokes)) = area; - if (area < _areas(_minBeamPos)) { - _minBeam = beam; - _minBeamPos = IPosition(2, 0, stokes); - } - if (area > _areas(_maxBeamPos)) { - _maxBeam = beam; - _maxBeamPos = IPosition(2, 0, stokes); - } - } - } - else { - // chan >=0 && stokes < 0 - _beams(IPosition(2, chan, 0), IPosition(2, chan, nstokes()-1)) = beam; - if (_maxBeamPos[1] == stokes || _minBeamPos[1] == stokes) { - // we are overwriting the max or min beam, so we need to recalculate - // the areas - _calculateAreas(); - } - else { - Double area = beam.getArea(_areaUnit); - _areas(IPosition(2, chan, 0), IPosition(2, chan, nstokes()-1)) = area; - if (area < _areas(_minBeamPos)) { - _minBeam = beam; - _minBeamPos = IPosition(2, chan, 0); - } - if (area > _areas(_maxBeamPos)) { - _maxBeam = beam; - _maxBeamPos = IPosition(2, chan, 0); - } - } - } + AlwaysAssert( + Int(chan) < _beams.shape()[0] && Int(stokes) < _beams.shape()[1], + AipsError + ); + if (chan >= 0 && stokes >= 0) { + _beams(chan, stokes) = beam; + IPosition location(2, chan, stokes); + if (location == _maxBeamPos || location == _minBeamPos) { + // we are overwriting the max or min beam, so we need to + // determine the new max or min + _calculateAreas(); + } + else { + Double area = beam.getArea(_areaUnit); + _areas(chan, stokes) = area; + if (area < _areas(_minBeamPos)) { + _minBeam = beam; + _minBeamPos = location; + } + if (area > _areas(_maxBeamPos)) { + _maxBeam = beam; + _maxBeamPos = location; + } + } + } + else if (chan < 0 && stokes < 0) { + *this = ImageBeamSet(beam); + } + else if (chan < 0) { + _beams(IPosition(2, 0, stokes), IPosition(2, nchan()-1, stokes)) = beam; + if (_maxBeamPos[0] == chan || _minBeamPos[0] == chan) { + // we are overwriting the max or min beam, so we need to recalculate + // the areas + _calculateAreas(); + } + else { + Double area = beam.getArea(_areaUnit); + _areas(IPosition(2, 0, stokes), IPosition(2, nchan()-1, stokes)) = area; + if (area < _areas(_minBeamPos)) { + _minBeam = beam; + _minBeamPos = IPosition(2, 0, stokes); + } + if (area > _areas(_maxBeamPos)) { + _maxBeam = beam; + _maxBeamPos = IPosition(2, 0, stokes); + } + } + } + else { + // chan >=0 && stokes < 0 + _beams(IPosition(2, chan, 0), IPosition(2, chan, nstokes()-1)) = beam; + if (_maxBeamPos[1] == stokes || _minBeamPos[1] == stokes) { + // we are overwriting the max or min beam, so we need to recalculate + // the areas + _calculateAreas(); + } + else { + Double area = beam.getArea(_areaUnit); + _areas(IPosition(2, chan, 0), IPosition(2, chan, nstokes()-1)) = area; + if (area < _areas(_minBeamPos)) { + _minBeam = beam; + _minBeamPos = IPosition(2, chan, 0); + } + if (area > _areas(_maxBeamPos)) { + _maxBeam = beam; + _maxBeamPos = IPosition(2, chan, 0); + } + } + } } const GaussianBeam& ImageBeamSet::getMaxAreaBeamForPol(IPosition& pos, - uInt stokes) const { - pos.resize(2); - // If single Stokes, use the maximum itself. - if (nstokes() <= 1) { - pos = _maxBeamPos; - return _maxBeam; - } - AlwaysAssert(stokes < nstokes(), AipsError); - // Determine location of maximum area for given Stokes. - Double mina, maxa; - IPosition minPos; - minMax( - mina, maxa, minPos, pos, - _areas(IPosition(2, 0, stokes), IPosition(2, nchan() - 1, stokes)) - ); - pos[1] = stokes; - return _beams(pos); + uInt stokes) const { + pos.resize(2); + // If single Stokes, use the maximum itself. + if (nstokes() <= 1) { + pos = _maxBeamPos; + return _maxBeam; + } + AlwaysAssert(stokes < nstokes(), AipsError); + // Determine location of maximum area for given Stokes. + Double mina, maxa; + IPosition minPos; + minMax( + mina, maxa, minPos, pos, + _areas(IPosition(2, 0, stokes), IPosition(2, nchan() - 1, stokes)) + ); + pos[1] = stokes; + return _beams(pos); } const GaussianBeam& ImageBeamSet::getMinAreaBeamForPol(IPosition& pos, - uInt stokes) const { - pos.resize(2); - // If single Stokes, use the minimum itself. - if (nstokes() <= 1) { - pos = _minBeamPos; - return _minBeam; - } - AlwaysAssert(stokes < nstokes(), AipsError); - // Determine location of minimum area for given Stokes. - Double mina, maxa; - IPosition maxPos; - minMax(mina, maxa, pos, maxPos, - _areas(IPosition(2, 0, stokes), IPosition(2, nchan() - 1, stokes))); - pos[1] = stokes; - return _beams(pos); + uInt stokes) const { + pos.resize(2); + // If single Stokes, use the minimum itself. + if (nstokes() <= 1) { + pos = _minBeamPos; + return _minBeam; + } + AlwaysAssert(stokes < nstokes(), AipsError); + // Determine location of minimum area for given Stokes. + Double mina, maxa; + IPosition maxPos; + minMax(mina, maxa, pos, maxPos, + _areas(IPosition(2, 0, stokes), IPosition(2, nchan() - 1, stokes))); + pos[1] = stokes; + return _beams(pos); } const GaussianBeam& ImageBeamSet::getMedianAreaBeamForPol( - IPosition& pos, uInt stokes + IPosition& pos, uInt stokes ) const { - pos.resize(2); - pos = _beams.shape() - 1; - if (nstokes() > 1) { - pos[1] = stokes; - } - AlwaysAssert(pos[1] >= 0 && pos[1] < _beams.shape()[1], AipsError); - if (nchan() == 1) { - return _beams(0, pos[1]); - } - // Do an indirect sort to find the location of the median. - Vector indices; - GenSortIndirect::sort(indices, - _areas(IPosition(2, 0, pos[1]), IPosition(2, nchan() - 1, pos[1]))); - pos[0] = indices[indices.size() / 2]; - return _beams(pos[0], pos[1]); + pos.resize(2); + pos = _beams.shape() - 1; + if (nstokes() > 1) { + pos[1] = stokes; + } + AlwaysAssert(pos[1] >= 0 && pos[1] < _beams.shape()[1], AipsError); + if (nchan() == 1) { + return _beams(0, pos[1]); + } + // Do an indirect sort to find the location of the median. + Vector indices; + GenSortIndirect::sort(indices, + _areas(IPosition(2, 0, pos[1]), IPosition(2, nchan() - 1, pos[1]))); + pos[0] = indices[indices.size() / 2]; + return _beams(pos[0], pos[1]); } GaussianBeam ImageBeamSet::getMedianAreaBeam() const { - Vector indices; - IPosition shape = _beams.shape(); - if (shape[0] > 1 && shape[1] > 1) { - GenSortIndirect::sort(indices, Vector(_areas.tovector())); - return _beams.tovector()[indices[indices.size()/2]]; - } - else { - GenSortIndirect::sort(indices, _areas); - GaussianBeam medbeam = shape[0] > 1 - ? _beams(indices[indices.size()/2], 0) - : _beams(0, indices[indices.size()/2]); - return medbeam; - } + Vector indices; + IPosition shape = _beams.shape(); + if (shape[0] > 1 && shape[1] > 1) { + GenSortIndirect::sort(indices, Vector(_areas.tovector())); + return _beams.tovector()[indices[indices.size()/2]]; + } + else { + GenSortIndirect::sort(indices, _areas); + GaussianBeam medbeam = shape[0] > 1 + ? _beams(indices[indices.size()/2], 0) + : _beams(0, indices[indices.size()/2]); + return medbeam; + } } const GaussianBeam ImageBeamSet::getSmallestMinorAxisBeam() const { - BeamIter ibend = _beams.end(); - Bool found = False; - Quantity minAxis; - GaussianBeam res = *(_beams.begin()); - for ( - BeamIter ibeam = _beams.begin(); - ibeam != ibend; ++ibeam - ) { - if (found) { - Quantity test = ibeam->getMinor(); - if ( - test < minAxis - || ( - test == minAxis - && ibeam->getArea(_DEFAULT_AREA_UNIT) < res.getArea(_DEFAULT_AREA_UNIT) - ) - ) { - minAxis = test; - res = *ibeam; - } - } - else if (! ibeam->isNull()) { - minAxis = ibeam->getMinor(); - res = *ibeam; - found = True; - } - } - return res; + BeamIter ibend = _beams.end(); + Bool found = False; + Quantity minAxis; + GaussianBeam res = *(_beams.begin()); + for ( + BeamIter ibeam = _beams.begin(); + ibeam != ibend; ++ibeam + ) { + if (found) { + Quantity test = ibeam->getMinor(); + if ( + test < minAxis + || ( + test == minAxis + && ibeam->getArea(_DEFAULT_AREA_UNIT) < res.getArea(_DEFAULT_AREA_UNIT) + ) + ) { + minAxis = test; + res = *ibeam; + } + } + else if (! ibeam->isNull()) { + minAxis = ibeam->getMinor(); + res = *ibeam; + found = True; + } + } + return res; } void ImageBeamSet::_calculateAreas() { - _areas.resize(_beams.shape()); - if (!_beams.empty()) { - _areaUnit = _beams.begin()->getMajor().getUnit(); - _areaUnit = - (Quantity(Quantity(1, _areaUnit) * Quantity(1, _areaUnit)).getUnit()); - Array::iterator iareas = _areas.begin(); - BeamIter ibend = _beams.end(); - for ( - BeamIter ibeam = _beams.begin(); - ibeam != ibend; ++ibeam, ++iareas - ) { - *iareas = ibeam->getArea(_areaUnit); - } - Double minArea, maxArea; - minMax(minArea, maxArea, _minBeamPos, _maxBeamPos, _areas); - _minBeam = _beams(_minBeamPos); - _maxBeam = _beams(_maxBeamPos); - } + _areas.resize(_beams.shape()); + if (!_beams.empty()) { + _areaUnit = _beams.begin()->getMajor().getUnit(); + _areaUnit = + (Quantity(Quantity(1, _areaUnit) * Quantity(1, _areaUnit)).getUnit()); + Array::iterator iareas = _areas.begin(); + BeamIter ibend = _beams.end(); + for ( + BeamIter ibeam = _beams.begin(); + ibeam != ibend; ++ibeam, ++iareas + ) { + *iareas = ibeam->getArea(_areaUnit); + } + Double minArea, maxArea; + minMax(minArea, maxArea, _minBeamPos, _maxBeamPos, _areas); + _minBeam = _beams(_minBeamPos); + _maxBeam = _beams(_maxBeamPos); + } } ostream &operator<<(ostream &os, const ImageBeamSet& beamSet) { - os << beamSet.getBeams(); - return os; + os << beamSet.getBeams(); + return os; } ImageBeamSet ImageBeamSet::subset(const Slicer& slicer, - const CoordinateSystem& csys) const { - // This beamset can be used if it has a single beam. - if (nelements() < 2) { - return *this; - } - // Determine the relevant axis numbers in the coordinate system. - Int axes[2]; - axes[0] = csys.spectralAxisNumber(); - axes[1] = csys.polarizationAxisNumber(); - IPosition ss(slicer.start()); - IPosition se(slicer.end()); - IPosition si(slicer.stride()); - // If the beamset has no or a single freq or stokes, adjust the slicer. - IPosition beamss(2, 0), beamse(2, 0), beamsi(2, 1); - for (Int i = 0; i < 2; ++i) { - if (axes[i] >= 0 && _beams.shape()[i] > 1) { - AlwaysAssert(_beams.shape()[i] > se[axes[i]], AipsError); - beamss[i] = ss[axes[i]]; - beamse[i] = se[axes[i]]; - beamsi[i] = si[axes[i]]; - } - } - return ImageBeamSet(_beams(beamss, beamse, beamsi)); + const CoordinateSystem& csys) const { + // This beamset can be used if it has a single beam. + if (nelements() < 2) { + return *this; + } + // Determine the relevant axis numbers in the coordinate system. + Int axes[2]; + axes[0] = csys.spectralAxisNumber(); + axes[1] = csys.polarizationAxisNumber(); + IPosition ss(slicer.start()); + IPosition se(slicer.end()); + IPosition si(slicer.stride()); + // If the beamset has no or a single freq or stokes, adjust the slicer. + IPosition beamss(2, 0), beamse(2, 0), beamsi(2, 1); + for (Int i = 0; i < 2; ++i) { + if (axes[i] >= 0 && _beams.shape()[i] > 1) { + AlwaysAssert(_beams.shape()[i] > se[axes[i]], AipsError); + beamss[i] = ss[axes[i]]; + beamse[i] = se[axes[i]]; + beamsi[i] = si[axes[i]]; + } + } + return ImageBeamSet(_beams(beamss, beamse, beamsi)); } Bool ImageBeamSet::equivalent(const ImageBeamSet& that) const { - if (empty() || that.empty()) { - return empty() == that.empty(); - } - uInt nc1 = nchan(); - uInt np1 = nstokes(); - uInt nc2 = that.nchan(); - uInt np2 = that.nstokes(); - if (!(nc1 == nc2 || nc1 == 1 || nc2 == 1) - || !(np1 == np2 || np1 == 1 || np2 == 1)) { - return False; // shapes mismatch - } - uInt nc = max(nc1, nc2); - uInt np = max(np1, np2); - uInt incrc1 = (nc1 == 1 ? 0 : 1); - uInt incrp1 = (np1 == 1 ? 0 : 1); - uInt incrc2 = (nc2 == 1 ? 0 : 1); - uInt incrp2 = (np2 == 1 ? 0 : 1); - uInt c1 = 0, p1 = 0, c2 = 0, p2 = 0; - for (uInt p = 0; p < np; ++p) { - for (uInt c = 0; c < nc; ++c, c1 += incrc1, c2 += incrc2) { - if (_beams(c1, p1) != that._beams(c2, p2)) { - return False; // mismatch in a beam - } - } - c1 = c2 = 0; - p1 += incrp1; - p2 += incrp2; - } - return True; + if (empty() || that.empty()) { + return empty() == that.empty(); + } + uInt nc1 = nchan(); + uInt np1 = nstokes(); + uInt nc2 = that.nchan(); + uInt np2 = that.nstokes(); + if (!(nc1 == nc2 || nc1 == 1 || nc2 == 1) + || !(np1 == np2 || np1 == 1 || np2 == 1)) { + return False; // shapes mismatch + } + uInt nc = max(nc1, nc2); + uInt np = max(np1, np2); + uInt incrc1 = (nc1 == 1 ? 0 : 1); + uInt incrp1 = (np1 == 1 ? 0 : 1); + uInt incrc2 = (nc2 == 1 ? 0 : 1); + uInt incrp2 = (np2 == 1 ? 0 : 1); + uInt c1 = 0, p1 = 0, c2 = 0, p2 = 0; + for (uInt p = 0; p < np; ++p) { + for (uInt c = 0; c < nc; ++c, c1 += incrc1, c2 += incrc2) { + if (_beams(c1, p1) != that._beams(c2, p2)) { + return False; // mismatch in a beam + } + } + c1 = c2 = 0; + p1 += incrp1; + p2 += incrp2; + } + return True; } ImageBeamSet ImageBeamSet::fromRecord(const Record& rec) { - ThrowIf( - ! rec.isDefined("nChannels"), - "no nChannels field found" - ); - ThrowIf( - ! rec.isDefined("nStokes"), - "no nStokes field found" - ); - uInt nchan = rec.asuInt("nChannels"); - ImageBeamSet beams(nchan, rec.asuInt("nStokes")); - uInt count = 0; - uInt chan = 0; - uInt stokes = 0; - Array::const_iterator iterend = beams.getBeams().end(); - for ( - Array::const_iterator iter = - beams.getBeams().begin(); iter != iterend; ++iter, ++count - ) { - String field = "*" + String::toString(count); - ThrowIf( - ! rec.isDefined(field), - "Field " + field + " is not defined" - ); - beams.setBeam( - chan, stokes, - GaussianBeam::fromRecord(rec.asRecord(field)) - ); - if (++chan == nchan) { - chan = 0; - stokes++; - } - } - return beams; + ThrowIf( + ! rec.isDefined("nChannels"), + "no nChannels field found" + ); + ThrowIf( + ! rec.isDefined("nStokes"), + "no nStokes field found" + ); + uInt nchan = rec.asuInt("nChannels"); + ImageBeamSet beams(nchan, rec.asuInt("nStokes")); + uInt count = 0; + uInt chan = 0; + uInt stokes = 0; + Array::const_iterator iterend = beams.getBeams().end(); + for ( + Array::const_iterator iter = + beams.getBeams().begin(); iter != iterend; ++iter, ++count + ) { + String field = "*" + String::toString(count); + ThrowIf( + ! rec.isDefined(field), + "Field " + field + " is not defined" + ); + beams.setBeam( + chan, stokes, + GaussianBeam::fromRecord(rec.asRecord(field)) + ); + if (++chan == nchan) { + chan = 0; + stokes++; + } + } + return beams; } Record ImageBeamSet::toRecord() const { - Record perPlaneBeams; - perPlaneBeams.define("nChannels", nchan()); - perPlaneBeams.define("nStokes", nstokes()); - Record rec; - uInt count = 0; - const Array& beams = getBeams(); - Array::const_iterator iterEnd = beams.end(); - for ( - Array::const_iterator iter=beams.begin(); - iter!=iterEnd; ++iter, ++count - ) { - ThrowIf( - iter->isNull(), + Record perPlaneBeams; + perPlaneBeams.define("nChannels", nchan()); + perPlaneBeams.define("nStokes", nstokes()); + Record rec; + uInt count = 0; + const Array& beams = getBeams(); + Array::const_iterator iterEnd = beams.end(); + for ( + Array::const_iterator iter=beams.begin(); + iter!=iterEnd; ++iter, ++count + ) { + ThrowIf( + iter->isNull(), "Invalid per plane beam found" ); - Record rec = iter->toRecord(); - perPlaneBeams.defineRecord("*" + String::toString(count), rec); - } - return perPlaneBeams; -} - -void ImageBeamSet::rotate(const Quantity& angle) { - ThrowIf( - ! angle.isConform("rad"), - "Quantity is not an angle" - ); - Matrix::iterator iter = _beams.begin(); - Matrix::iterator end = _beams.end(); - while(iter != end) { - iter->setPA(iter->getPA(True) + angle); - ++iter; - } + Record rec = iter->toRecord(); + perPlaneBeams.defineRecord("*" + String::toString(count), rec); + } + return perPlaneBeams; +} + +void ImageBeamSet::rotate(const Quantity& angle, Bool unwrap) { + ThrowIf( + ! angle.isConform("rad"), + "Quantity is not an angle" + ); + Matrix::iterator iter = _beams.begin(); + Matrix::iterator end = _beams.end(); + while(iter != end) { + iter->setPA(iter->getPA(True) + angle, unwrap); + ++iter; + } + _minBeam.setPA(_minBeam.getPA() + angle, unwrap); + _maxBeam.setPA(_maxBeam.getPA() + angle, unwrap); } void ImageBeamSet::summarize( - LogIO& log, Bool verbose, const CoordinateSystem& csys + LogIO& log, Bool verbose, const CoordinateSystem& csys ) const { - ostream& os = log.output(); - Unit u("deg"); - for ( - Matrix::const_iterator iter = _beams.begin(); - iter != _beams.end(); iter++ - ) { - if ( - iter->getMajor("deg") < 1/3600 - || iter->getMinor("deg") < 1/3600 - ) { - u = Unit("mas"); - break; - } - if ( - iter->getMajor("deg") < 1.0 - || iter->getMinor("deg") < 1.0 - ) { - u = Unit("arcsec"); - } - } - Bool hasSpectral = csys.hasSpectralAxis(); - Bool hasStokes = csys.hasPolarizationCoordinate(); - log.output() << "Restoring Beams " << endl; - const SpectralCoordinate *spCoord = 0; - IPosition beamsShape = _beams.shape(); - uInt chanWidth = 0; - uInt freqWidth = 0; - uInt freqPrec = 0; - uInt velPrec = 0; - uInt velWidth = 0; - uInt polWidth = 3; - uInt typeWidth = 6; - Bool myverbose = verbose || ! hasSpectral || (hasSpectral && beamsShape[0] <= 3); - const StokesCoordinate *polCoord = hasStokes - ? &csys.stokesCoordinate() - : 0; - if (hasSpectral) { - spCoord = &csys.spectralCoordinate(); - chanWidth = max(4, Int(log10(beamsShape[0])) + 1); - // yes these really should be separated because width applies only to the first. - ostringstream x; - Double freq; - spCoord->toWorld(freq, 0); - if (spCoord->pixelValues().size() > 0) { - freqPrec = 6; - velPrec = 3; - } - else { - Double inc = spCoord->increment()[0]; - freqPrec = Int(abs(log10(inc/freq))) + 1; - Double vel0, vel1; - spCoord->pixelToVelocity(vel0, 0); - spCoord->pixelToVelocity(vel1, 1); - if (abs(vel0-vel1) > 10) { - velPrec = 0; - } - else { - velPrec = Int(abs(log10(abs(vel0-vel1)))) + 2; - } - } - x << scientific << std::setprecision(freqPrec) << freq; - freqWidth = x.str().length(); - velWidth = velPrec + 5; - if (myverbose) { - os << std::setw(chanWidth) << "Chan" << " "; - os << std::setw(freqWidth) - << "Freq" << " "; - os << std::setw(velWidth) - << "Vel"; - } - else { - if (hasStokes) { - os << std::setw(polWidth) << "Pol" << " "; - } - os << std::setw(typeWidth) << "Type" << " "; - os << std::setw(chanWidth) << "Chan" << " "; - os << std::setw(freqWidth) - << "Freq" << " "; - os << std::setw(velWidth) - << "Vel" << endl; - } - } - if (myverbose) { - if (hasStokes) { - os << " "; - os << std::setw(polWidth) << "Pol"; - } - os << endl; - Int stokesPos = hasStokes - ? hasSpectral - ? 1 : 0 - : -1; - IPosition axisPath = hasSpectral && hasStokes - ? IPosition(2, 1, 0) - : IPosition(1, 0); + ostream& os = log.output(); + Unit u("deg"); + for ( + Matrix::const_iterator iter = _beams.begin(); + iter != _beams.end(); iter++ + ) { + if ( + iter->getMajor("deg") < 1/3600 + || iter->getMinor("deg") < 1/3600 + ) { + u = Unit("mas"); + break; + } + if ( + iter->getMajor("deg") < 1.0 + || iter->getMinor("deg") < 1.0 + ) { + u = Unit("arcsec"); + } + } + Bool hasSpectral = csys.hasSpectralAxis(); + Bool hasStokes = csys.hasPolarizationCoordinate(); + log.output() << "Restoring Beams " << endl; + const SpectralCoordinate *spCoord = 0; + IPosition beamsShape = _beams.shape(); + uInt chanWidth = 0; + uInt freqWidth = 0; + uInt freqPrec = 0; + uInt velPrec = 0; + uInt velWidth = 0; + uInt polWidth = 3; + uInt typeWidth = 6; + Bool myverbose = verbose || ! hasSpectral || (hasSpectral && beamsShape[0] <= 3); + const StokesCoordinate *polCoord = hasStokes + ? &csys.stokesCoordinate() + : 0; + if (hasSpectral) { + spCoord = &csys.spectralCoordinate(); + chanWidth = max(4, Int(log10(beamsShape[0])) + 1); + // yes these really should be separated because width applies only to the first. + ostringstream x; + Double freq; + spCoord->toWorld(freq, 0); + if (spCoord->pixelValues().size() > 0) { + freqPrec = 6; + velPrec = 3; + } + else { + Double inc = spCoord->increment()[0]; + freqPrec = Int(abs(log10(inc/freq))) + 1; + Double vel0, vel1; + spCoord->pixelToVelocity(vel0, 0); + spCoord->pixelToVelocity(vel1, 1); + if (abs(vel0-vel1) > 10) { + velPrec = 0; + } + else { + velPrec = Int(abs(log10(abs(vel0-vel1)))) + 2; + } + } + x << scientific << std::setprecision(freqPrec) << freq; + freqWidth = x.str().length(); + velWidth = velPrec + 5; + if (myverbose) { + os << std::setw(chanWidth) << "Chan" << " "; + os << std::setw(freqWidth) + << "Freq" << " "; + os << std::setw(velWidth) + << "Vel"; + } + else { + if (hasStokes) { + os << std::setw(polWidth) << "Pol" << " "; + } + os << std::setw(typeWidth) << "Type" << " "; + os << std::setw(chanWidth) << "Chan" << " "; + os << std::setw(freqWidth) + << "Freq" << " "; + os << std::setw(velWidth) + << "Vel" << endl; + } + } + if (myverbose) { + if (hasStokes) { + os << " "; + os << std::setw(polWidth) << "Pol"; + } + os << endl; + Int stokesPos = hasStokes + ? hasSpectral + ? 1 : 0 + : -1; + IPosition axisPath = hasSpectral && hasStokes + ? IPosition(2, 1, 0) + : IPosition(1, 0); ArrayPositionIterator iter(beamsShape, axisPath, False); while (! iter.pastEnd()) { const IPosition pos = iter.pos(); - if (hasSpectral) { - _chanInfoToStream( - os, spCoord, pos[0], chanWidth, - freqPrec, velWidth, velPrec - ); - } - if (hasStokes) { - Stokes::StokesTypes stokes; - polCoord->toWorld(stokes, pos[stokesPos]); - os << std::setw(polWidth) << Stokes::name(stokes) - << " "; - } - _beamToStream(os, _beams(pos), u); - os << endl; + if (hasSpectral) { + _chanInfoToStream( + os, spCoord, pos[0], chanWidth, + freqPrec, velWidth, velPrec + ); + } + if (hasStokes) { + Stokes::StokesTypes stokes; + polCoord->toWorld(stokes, pos[stokesPos]); + os << std::setw(polWidth) << Stokes::name(stokes) + << " "; + } + _beamToStream(os, _beams(pos), u); + os << endl; iter.next(); - } - } - else { - uInt mymax = hasStokes ? nstokes() : 1; - for (uInt i=0; itoWorld(stokes, i); - stokesString = Stokes::name(stokes); - } - for (uInt j=0; j<3; j++) { - String aggType; - GaussianBeam beam; - IPosition pos; - switch (j) { - case 0: { - aggType = "Max"; - beam = getMaxAreaBeamForPol(pos, hasStokes? i : -1); - break; - } - case 1: { - aggType = "Min"; - beam = getMinAreaBeamForPol(pos, hasStokes ? i : -1); - break; - } - case 2: { - aggType = "Median"; - beam = getMedianAreaBeamForPol( - pos, hasStokes ? i : -1 - ); - break; - } - default: { - ThrowCc("Logic error: Unhandled aggregate type"); - } - } - if (hasStokes) { - os << std::setw(polWidth) << stokesString << " "; - } - os << std::setw(typeWidth) << aggType << " "; - _chanInfoToStream( - os, spCoord, pos[0], chanWidth, freqPrec, - velWidth, velPrec - ); - _beamToStream(os, beam, u); - os << endl; - } - } - } + } + } + else { + uInt mymax = hasStokes ? nstokes() : 1; + for (uInt i=0; itoWorld(stokes, i); + stokesString = Stokes::name(stokes); + } + for (uInt j=0; j<3; j++) { + String aggType; + GaussianBeam beam; + IPosition pos; + switch (j) { + case 0: { + aggType = "Max"; + beam = getMaxAreaBeamForPol(pos, hasStokes? i : -1); + break; + } + case 1: { + aggType = "Min"; + beam = getMinAreaBeamForPol(pos, hasStokes ? i : -1); + break; + } + case 2: { + aggType = "Median"; + beam = getMedianAreaBeamForPol( + pos, hasStokes ? i : -1 + ); + break; + } + default: { + ThrowCc("Logic error: Unhandled aggregate type"); + } + } + if (hasStokes) { + os << std::setw(polWidth) << stokesString << " "; + } + os << std::setw(typeWidth) << aggType << " "; + _chanInfoToStream( + os, spCoord, pos[0], chanWidth, freqPrec, + velWidth, velPrec + ); + _beamToStream(os, beam, u); + os << endl; + } + } + } } void ImageBeamSet::_chanInfoToStream( - ostream& os, const SpectralCoordinate *spCoord, - const uInt chan, const uInt chanWidth, const uInt freqPrec, - const uInt velWidth, const uInt velPrec + ostream& os, const SpectralCoordinate *spCoord, + const uInt chan, const uInt chanWidth, const uInt freqPrec, + const uInt velWidth, const uInt velPrec ) { - os << std::fixed << std::setw(chanWidth) - << chan << " "; - Double freq; - spCoord->toWorld(freq, chan); - os << scientific << std::setprecision(freqPrec) - << freq << " "; - Double vel; - spCoord->pixelToVelocity(vel, chan); - os << std::setw(velWidth) << fixed - << std::setprecision(velPrec) << vel << " "; + os << std::fixed << std::setw(chanWidth) + << chan << " "; + Double freq; + spCoord->toWorld(freq, chan); + os << scientific << std::setprecision(freqPrec) + << freq << " "; + Double vel; + spCoord->pixelToVelocity(vel, chan); + os << std::setw(velWidth) << fixed + << std::setprecision(velPrec) << vel << " "; } void ImageBeamSet::_beamToStream( - ostream& os, const GaussianBeam& beam, - const Unit& unit + ostream& os, const GaussianBeam& beam, + const Unit& unit ) { - Quantity majAx = beam.getMajor(); - majAx.convert(unit); - Quantity minAx = beam.getMinor(); - minAx.convert(unit); - Quantity pa = beam.getPA(True); - pa.convert("deg"); - os << fixed << std::setprecision(4) << std::setw(9) << majAx - << " x " << std::setw(9) << minAx << " pa=" << std::setw(8) << pa; + Quantity majAx = beam.getMajor(); + majAx.convert(unit); + Quantity minAx = beam.getMinor(); + minAx.convert(unit); + Quantity pa = beam.getPA(True); + pa.convert("deg"); + os << fixed << std::setprecision(4) << std::setw(9) << majAx + << " x " << std::setw(9) << minAx << " pa=" << std::setw(8) << pa; } } diff -Nru casacore-2.2.0/images/Images/ImageBeamSet.h casacore-2.3.0/images/Images/ImageBeamSet.h --- casacore-2.2.0/images/Images/ImageBeamSet.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageBeamSet.h 2017-10-12 12:24:04.000000000 +0000 @@ -88,23 +88,23 @@ class ImageBeamSet { public: - typedef Array::const_iterator BeamIter; + typedef Array::const_iterator BeamIter; - // Construct an empty beam set. - ImageBeamSet(); + // Construct an empty beam set. + ImageBeamSet(); // Construct a beam set from an 2-D array of beams representing // the frequency and stokes axis. // Axis length 1 means it is valid for all channels cq. stokes. - // If the image has 0 spectral channels or stokes, the corresponding - // length of the axis in the provided matrix should be 1. - ImageBeamSet( - const Matrix& beams - ); - - // construct an ImageBeamSet representing a single beam which is valid for - // all channels and stokes - ImageBeamSet(const GaussianBeam& beam); + // If the image has 0 spectral channels or stokes, the corresponding + // length of the axis in the provided matrix should be 1. + ImageBeamSet( + const Matrix& beams + ); + + // construct an ImageBeamSet representing a single beam which is valid for + // all channels and stokes + ImageBeamSet(const GaussianBeam& beam); // Create an ImageBeamSet of the specified shape with all // GaussianBeams initialized to beam. @@ -113,10 +113,10 @@ // The copy constructor (reference semantics). ImageBeamSet(const ImageBeamSet& other); - ~ImageBeamSet(); + ~ImageBeamSet(); // Assignment can change the shape (copy semantics). - ImageBeamSet& operator=(const ImageBeamSet& other); + ImageBeamSet& operator=(const ImageBeamSet& other); // Beam sets are equal if the shapes and all corresponding beams are equal. Bool operator== (const ImageBeamSet& other) const; @@ -141,7 +141,7 @@ // Does this beam set contain multiple beams? Bool hasMultiBeam() const { - return _beams.size() > 1; + return _beams.size() > 1; } // Is the beam set empty? @@ -265,30 +265,32 @@ void summarize(LogIO& log, Bool verbose, const CoordinateSystem& csys) const; // Modify the beam set by rotating all beams counterclockwise through the specified angle. - void rotate(const Quantity& angle); + // If unwrap=True, unwrap the new position angle(s) so that it falls in the range -90 to + // 90 degrees before setting it. + void rotate(const Quantity& angle, Bool unwrap=False); private: - static const String _DEFAULT_AREA_UNIT; + static const String _DEFAULT_AREA_UNIT; - Matrix _beams; - Matrix _areas; - String _areaUnit; - GaussianBeam _minBeam, _maxBeam; - IPosition _minBeamPos, _maxBeamPos; - - void _calculateAreas(); - - static void _chanInfoToStream( - ostream& os, const SpectralCoordinate *spCoord, - const uInt chan, const uInt chanWidth, const uInt freqPrec, - const uInt velWidth, const uInt velPrec - ); - - static void _beamToStream( - ostream& os, const GaussianBeam& beam, - const Unit& unit - ); + Matrix _beams; + Matrix _areas; + String _areaUnit; + GaussianBeam _minBeam, _maxBeam; + IPosition _minBeamPos, _maxBeamPos; + + void _calculateAreas(); + + static void _chanInfoToStream( + ostream& os, const SpectralCoordinate *spCoord, + const uInt chan, const uInt chanWidth, const uInt freqPrec, + const uInt velWidth, const uInt velPrec + ); + + static void _beamToStream( + ostream& os, const GaussianBeam& beam, + const Unit& unit + ); }; ostream &operator<<(ostream &os, const ImageBeamSet& beamSet); diff -Nru casacore-2.2.0/images/Images/ImageConcat.h casacore-2.3.0/images/Images/ImageConcat.h --- casacore-2.2.0/images/Images/ImageConcat.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageConcat.h 2017-10-12 12:24:04.000000000 +0000 @@ -128,7 +128,8 @@ public: // Constructor. Specify the pixel axis for concatenation - explicit ImageConcat (uInt axis, Bool tempClose=True); + explicit ImageConcat (uInt axis, Bool tempClose=True, + Bool combineMiscInfo=True); // Construct the object from a Json file with the given name. // This constructor is usually called by ImageOpener::openImageConcat. @@ -154,6 +155,10 @@ // It can be opened by ImageOpener::openImage(Concat). virtual void save (const String& fileName) const; +// Replace the miscinfo in the ConcatImage, which writes the image.concat file. +// It can fail if, e.g., the directory to write to is not writable. + virtual Bool setMiscInfo (const RecordInterface& newInfo); + // Get the image type (returns name of derived class). virtual String imageType() const; @@ -264,6 +269,7 @@ private: LatticeConcat latticeConcat_p; + Bool combineMiscInfo_p; Bool warnAxisNames_p, warnAxisUnits_p, warnImageUnits_p; Bool warnContig_p, warnRefPix_p, warnRefVal_p, warnInc_p, warnTab_p; Bool isContig_p; diff -Nru casacore-2.2.0/images/Images/ImageConcat.tcc casacore-2.3.0/images/Images/ImageConcat.tcc --- casacore-2.2.0/images/Images/ImageConcat.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageConcat.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -66,6 +66,7 @@ template ImageConcat::ImageConcat() : latticeConcat_p(), + combineMiscInfo_p(True), warnAxisNames_p(True), warnAxisUnits_p(True), warnImageUnits_p(True), @@ -77,8 +78,9 @@ {} template -ImageConcat::ImageConcat (uInt axis, Bool tempClose) +ImageConcat::ImageConcat (uInt axis, Bool tempClose, Bool combineMiscInfo) : latticeConcat_p(axis, tempClose), + combineMiscInfo_p(combineMiscInfo), warnAxisNames_p(True), warnAxisUnits_p(True), warnImageUnits_p(True), @@ -94,6 +96,7 @@ ImageConcat::ImageConcat (const ImageConcat& other) : ImageInterface(other), latticeConcat_p(other.latticeConcat_p), + combineMiscInfo_p(other.combineMiscInfo_p), warnAxisNames_p(other.warnAxisNames_p), warnAxisUnits_p(other.warnAxisUnits_p), warnImageUnits_p(other.warnImageUnits_p), @@ -122,6 +125,7 @@ if (this != &other) { ImageInterface::operator= (other); latticeConcat_p = other.latticeConcat_p; + combineMiscInfo_p = other.combineMiscInfo_p; warnAxisNames_p = other.warnAxisNames_p; warnAxisUnits_p = other.warnAxisUnits_p; warnImageUnits_p = other.warnImageUnits_p; @@ -152,6 +156,7 @@ template ImageConcat::ImageConcat (const JsonKVMap& jmap, const String& fileName) : latticeConcat_p(), + combineMiscInfo_p(False), warnAxisNames_p(True), warnAxisUnits_p(True), warnImageUnits_p(True), @@ -169,6 +174,8 @@ Bool tmpClose = jmap.getBool("TempClose", True); Vector names(jmap.get("Images").getArrayString()); latticeConcat_p=LatticeConcat(axis, tmpClose); + // Combine miscinfo if not defined in the Json file. + combineMiscInfo_p = !jmap.isDefined("MiscInfo"); for (uInt i=0; isetMiscInfoMember (tabrec); + } } template @@ -220,10 +232,21 @@ names[i] = Path::stripDirectory (fname, fullName); } jout.write ("Images", Array(names)); + jout.write ("MiscInfo", miscInfo().toRecord()); jout.end(); fileName_p = fullName; } +template +Bool ImageConcat::setMiscInfo (const RecordInterface& newInfo) +{ + setMiscInfoMember (newInfo); + if (isPersistent()) { + save (fileName_p); + } + return True; +} + template Bool ImageConcat::isPersistent() const { @@ -270,9 +293,11 @@ this->setMiscInfoMember (image.miscInfo()); this->setCoordinates(); } else { - TableRecord rec = miscInfo(); - rec.merge (image.miscInfo(), RecordInterface::RenameDuplicates); - this->setMiscInfoMember (rec); + if (combineMiscInfo_p) { + TableRecord rec = miscInfo(); + rec.merge (image.miscInfo(), RecordInterface::RenameDuplicates); + this->setMiscInfoMember (rec); + } // Combine the beams if possible. // Should be done before the coordinates are merged. diff -Nru casacore-2.2.0/images/Images/ImageExpr.h casacore-2.3.0/images/Images/ImageExpr.h --- casacore-2.2.0/images/Images/ImageExpr.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageExpr.h 2017-10-12 12:24:04.000000000 +0000 @@ -39,6 +39,7 @@ namespace casacore { //# NAMESPACE CASACORE - BEGIN //# Forward Declarations +class JsonKVMap; class IPosition; class Slicer; template class Array; @@ -120,6 +121,8 @@ // An exception is thrown if the expression has no coordinates. ImageExpr(const LatticeExpr& latticeExpr, const String& expr, const String& fileName = String()); + ImageExpr(const LatticeExpr& latticeExpr, const String& expr, + const String& fileName, const JsonKVMap&); // Same as previous constructor, but the coordinates are taken from the // given LELImageCoord object. @@ -147,6 +150,10 @@ void setFileName (const String& name) { fileName_p = name; } + // Replace the miscinfo in the ImageExpr, which writes the image.expr file. + // It can fail if, e.g., the directory to write to is not writable. + virtual Bool setMiscInfo (const RecordInterface& newInfo); + // Get the image type (returns name of derived class). virtual String imageType() const; @@ -216,6 +223,10 @@ private: + void init (const LatticeExpr& latticeExpr, const String& expr, + const String& fileName, const JsonKVMap&); + + //# Data members LatticeExpr latticeExpr_p; Unit unit_p; String exprString_p; diff -Nru casacore-2.2.0/images/Images/ImageExpr.tcc casacore-2.3.0/images/Images/ImageExpr.tcc --- casacore-2.2.0/images/Images/ImageExpr.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageExpr.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -57,10 +58,26 @@ template ImageExpr::ImageExpr (const LatticeExpr& latticeExpr, const String& expr, const String& fileName) - : latticeExpr_p(latticeExpr), - fileName_p (fileName) { - exprString_p = expr; + init (latticeExpr, expr, fileName, JsonKVMap()); +} + +template +ImageExpr::ImageExpr (const LatticeExpr& latticeExpr, + const String& expr, const String& fileName, + const JsonKVMap& jmap) +{ + init (latticeExpr, expr, fileName, jmap); +} + +template +void ImageExpr::init (const LatticeExpr& latticeExpr, + const String& expr, const String& fileName, + const JsonKVMap& jmap) +{ + latticeExpr_p = latticeExpr; + fileName_p = fileName; + exprString_p = expr; const LELCoordinates lelCoordinate = latticeExpr_p.lelCoordinates(); const LELLattCoordBase* pLattCoord = &(lelCoordinate.coordinates()); if (! pLattCoord->hasCoordinates() @@ -74,7 +91,13 @@ AlwaysAssert (pImCoord != 0, AipsError); this->setCoordsMember (pImCoord->coordinates()); this->setImageInfoMember (pImCoord->imageInfo()); - this->setMiscInfoMember (pImCoord->miscInfo()); + if (jmap.isDefined("MiscInfo")) { + TableRecord tabrec; + tabrec.fromRecord (jmap.get("MiscInfo").getValueMap().toRecord()); + this->setMiscInfoMember (tabrec); + } else { + this->setMiscInfoMember (pImCoord->miscInfo()); + } this->setUnitMember (pImCoord->unit()); } @@ -148,10 +171,21 @@ dt.trim(); jout.write ("DataType", dt); jout.write ("ImageExpr", exprString_p); + jout.write ("MiscInfo", this->miscInfo().toRecord()); jout.end(); fileName_p = fileName; } +template +Bool ImageExpr::setMiscInfo (const RecordInterface& newInfo) +{ + this->setMiscInfoMember (newInfo); + if (isPersistent()) { + save (fileName_p); + } + return True; +} + template String ImageExpr::imageType() const { diff -Nru casacore-2.2.0/images/Images/ImageFITS2Converter.cc casacore-2.3.0/images/Images/ImageFITS2Converter.cc --- casacore-2.2.0/images/Images/ImageFITS2Converter.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageFITS2Converter.cc 2017-10-12 12:24:04.000000000 +0000 @@ -1195,7 +1195,7 @@ // ORIGIN // if (origin.empty()) { - header.define("ORIGIN", "casacore-" + getVersion()); + header.define("ORIGIN", "casacore-" + string(getVersion())); } else { header.define("ORIGIN", origin); } diff -Nru casacore-2.2.0/images/Images/ImageOpener.cc casacore-2.3.0/images/Images/ImageOpener.cc --- casacore-2.2.0/images/Images/ImageOpener.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageOpener.cc 2017-10-12 12:24:04.000000000 +0000 @@ -201,7 +201,7 @@ // This is the opposite of ImageExpr::save. JsonKVMap jmap = JsonParser::parseFile (fileName + "/imageexpr.json"); String expr = jmap.get("ImageExpr").getString(); - LatticeBase* img = openExpr (expr, Block(), fileName); + LatticeBase* img = openExpr (expr, Block(), fileName, jmap); return img; } @@ -209,21 +209,33 @@ const Block& nodes, const String& fileName) { + return openExpr (expr, nodes, fileName, JsonKVMap()); +} + +LatticeBase* ImageOpener::openExpr (const String& expr, + const Block& nodes, + const String& fileName, + const JsonKVMap& jmap) +{ LatticeBase* lattice = 0; PtrBlock regions; LatticeExprNode node = ImageExprParse::command (expr, nodes, regions); switch (node.dataType()) { case TpFloat: - lattice = new ImageExpr (LatticeExpr(node), expr, fileName); + lattice = new ImageExpr (LatticeExpr(node), expr, + fileName, jmap); break; case TpDouble: - lattice = new ImageExpr (LatticeExpr(node), expr, fileName); + lattice = new ImageExpr (LatticeExpr(node), expr, + fileName, jmap); break; case TpComplex: - lattice = new ImageExpr (LatticeExpr(node), expr, fileName); + lattice = new ImageExpr (LatticeExpr(node), expr, + fileName, jmap); break; case TpDComplex: - lattice = new ImageExpr (LatticeExpr(node), expr, fileName); + lattice = new ImageExpr (LatticeExpr(node), expr, + fileName, jmap); break; default: throw AipsError ("invalid data type of image expression " + expr); diff -Nru casacore-2.2.0/images/Images/ImageOpener.h casacore-2.3.0/images/Images/ImageOpener.h --- casacore-2.2.0/images/Images/ImageOpener.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageOpener.h 2017-10-12 12:24:04.000000000 +0000 @@ -39,6 +39,7 @@ //# Forward Declarations class LatticeBase; class LatticeExprNode; +class JsonKVMap; // // Definition of image types and handlers @@ -131,9 +132,14 @@ // Parse an image expression and return the ImageExpr object for it. // The block of nodes represents optional $i arguments in the expression. + // The JsonKVMap gives the keys found in a persistent image.expr file. static LatticeBase* openExpr (const String& expr, const Block& nodes, const String& fileName = String()); + static LatticeBase* openExpr (const String& expr, + const Block& nodes, + const String& fileName, + const JsonKVMap&); private: // The default openImage function for an unknown image type. diff -Nru casacore-2.2.0/images/Images/ImageStatistics.h casacore-2.3.0/images/Images/ImageStatistics.h --- casacore-2.2.0/images/Images/ImageStatistics.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageStatistics.h 2017-10-12 12:24:04.000000000 +0000 @@ -104,10 +104,18 @@ // You can specify whether you want to see progress meters or not. // You can force the storage image to be disk based, otherwise // the decision for core or disk is taken for you. +// If clone is True, the input image will be cloned, so the caller +// can make changes to the input image, but the statistics will reflect the +// image as it was at construction. If False, a reference to the input image +// is used, and so the caller shouldn't make changes to the input image between +// construction and calling statistics computation methods, unless it calls setNewImage() +// to update the changed image. Obviously, cloning the image impacts performance +// and memory usage. ImageStatistics (const ImageInterface& image, LogIO& os, Bool showProgress=True, - Bool forceDisk=False); + Bool forceDisk=False, + Bool clone=True); // Constructor takes the image only. In the absence of a logger you get no messages. // This includes error messages and potential listing of the statistics. @@ -116,7 +124,8 @@ // the decision for core or disk is taken for you. ImageStatistics (const ImageInterface& image, Bool showProgress=True, - Bool forceDisk=False); + Bool forceDisk=False, + Bool clone=True); // Copy constructor. Copy semantics are followed. Therefore any storage image // that has already been created for other is copied to *this @@ -132,7 +141,14 @@ // Set a new ImageInterface object. A return value of False indicates the // image had an invalid type or that the internal state of the class is bad. - Bool setNewImage (const ImageInterface& image); +// If clone is True, the input image will be cloned, so the caller +// can make changes to the input image, but the statistics will reflect the +// image as it was at construction. If False, a reference to the input image +// is used, and so the caller shouldn't make changes to the input image between +// construction and calling statistics computation methods, unless it calls setNewImage() +// to update the changed image. Obviously, cloning the image impacts performance +// and memory usage. + Bool setNewImage (const ImageInterface& image, Bool clone=True); void setPrecision(Int precision); @@ -158,13 +174,12 @@ virtual Bool _canDoFlux() const; - - private: // Data LogIO os_p; const ImageInterface* pInImage_p; + SHARED_PTR > _inImPtrMgr; IPosition blc_; Int precision_; Bool _showRobust, _recordMessages, _listStats; diff -Nru casacore-2.2.0/images/Images/ImageStatistics.tcc casacore-2.3.0/images/Images/ImageStatistics.tcc --- casacore-2.2.0/images/Images/ImageStatistics.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/ImageStatistics.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -60,25 +60,23 @@ template ImageStatistics::ImageStatistics ( const ImageInterface& image, LogIO& os, - Bool showProgress, Bool forceDisk -) : LatticeStatistics(image, os, showProgress, forceDisk), + Bool showProgress, Bool forceDisk, Bool clone +) : LatticeStatistics(image, os, showProgress, forceDisk, clone), pInImage_p(0), blc_(IPosition(image.coordinates().nPixelAxes(), 0)), precision_(-1), _showRobust(False), _recordMessages(False), _listStats(True), _messages() { - ThrowIf(! setNewImage(image), error_p); + ThrowIf(! setNewImage(image, clone), error_p); } template ImageStatistics::ImageStatistics ( const ImageInterface& image, Bool showProgress, - Bool forceDisk -) : LatticeStatistics(image, showProgress, forceDisk), + Bool forceDisk, Bool clone +) : LatticeStatistics(image, showProgress, forceDisk, clone), pInImage_p(0), blc_(IPosition(image.coordinates().nPixelAxes(), 0)), precision_(-1), _showRobust(False), _recordMessages(False), _listStats(True), _messages() { - if (!setNewImage(image)) { - os_p << error_p << LogIO::EXCEPTION; - } + ThrowIf(!setNewImage(image, clone), error_p); } template @@ -90,7 +88,8 @@ pInImage_p(0), blc_(other.getBlc()), precision_(other.getPrecision()), _showRobust(other._showRobust) { - pInImage_p = other.pInImage_p->cloneII(); + _inImPtrMgr.reset(other.pInImage_p->cloneII()); + pInImage_p = _inImPtrMgr.get(); } // Assignment operator. Storage image is not copied @@ -99,10 +98,8 @@ ImageStatistics &ImageStatistics::operator=(const ImageStatistics &other) { if (this != &other) { LatticeStatistics::operator=(other); - if (pInImage_p!=0) { - delete pInImage_p; - } - pInImage_p = other.pInImage_p->cloneII(); + _inImPtrMgr.reset(other.pInImage_p->cloneII()); + pInImage_p = _inImPtrMgr.get(); precision_ = other.precision_; blc_ = other.blc_; _showRobust = other._showRobust; @@ -111,30 +108,27 @@ } template -ImageStatistics::~ImageStatistics() { - delete pInImage_p; - pInImage_p = 0; -} +ImageStatistics::~ImageStatistics() {} template -Bool ImageStatistics::setNewImage(const ImageInterface& image) -{ +Bool ImageStatistics::setNewImage( + const ImageInterface& image, Bool clone +) { if (!goodParameterStatus_p) { return False; } - -// Make a clone of the image - - if (pInImage_p!=0) { - delete pInImage_p; + if (clone) { + _inImPtrMgr.reset(image.cloneII()); + pInImage_p = _inImPtrMgr.get(); + } + else { + _inImPtrMgr.reset(); + pInImage_p = ℑ } - pInImage_p = image.cloneII(); - // Pass it on to LatticeStatistics - goodParameterStatus_p = this->setNewLattice(image); -// + goodParameterStatus_p = this->setNewLattice(image, clone); return goodParameterStatus_p; } diff -Nru casacore-2.2.0/images/Images/test/tFITSImage.out casacore-2.3.0/images/Images/test/tFITSImage.out --- casacore-2.2.0/images/Images/test/tFITSImage.out 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/test/tFITSImage.out 2017-10-12 12:24:04.000000000 +0000 @@ -1 +1,43 @@ -SIMPLE = T /Standard FITS BITPIX = -32 /Floating point (32 bit) NAXIS = 2 NAXIS1 = 113 NAXIS2 = 76 EXTEND = T BSCALE = 1.000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO BZERO = 0.000000000000E+00 BMAJ = 1.486111200000E-02 BMIN = 9.499999700000E-03 BPA = 6.000000000000E+00 BTYPE = 'Intensity' OBJECT = ' ' BUNIT = 'Jy/beam ' /Brightness (pixel) unit EQUINOX = 2.000000000000E+03 RADESYS = 'FK5 ' LONPOLE = 1.800000000000E+02 LATPOLE = 0.000000000000E+00 PC01_01 = 1.000000000000E+00 PC02_01 = 0.000000000000E+00 PC01_02 = -0.000000000000E+00 PC02_02 = 1.000000000000E+00 CTYPE1 = 'RA---SIN' CRVAL1 = 0.000000000000E+00 CDELT1 = -2.222222308810E-03 CRPIX1 = 5.600000000000E+01 CUNIT1 = 'deg ' PV2_1 = 0.000000000000E+00 CTYPE2 = 'DEC--SIN' CRVAL2 = 0.000000000000E+00 CDELT2 = 3.333333234031E-03 CRPIX2 = 3.800000000000E+01 CUNIT2 = 'deg ' PV2_2 = 0.000000000000E+00 FIELD1 = 0.000000000000E+00 FIELD2 = 'doggies ' DATE =>>> '2015-12-01T13:03:19.198730' /Date FITS file was written<<< TIMESYS = 'UTC ' /Time system for HDU ORIGIN = 'casacore-trunk' HISTORY File modified by user 'dbarnes' with fv on 1999-07-28T14:19:41 HISTORY File modified by user 'dbarnes' with fv on 1999-07-28T14:21:43 END +SIMPLE = T /Standard FITS +BITPIX = -32 /Floating point (32 bit) +NAXIS = 2 +NAXIS1 = 113 +NAXIS2 = 76 +EXTEND = T +BSCALE = 1.000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO +BZERO = 0.000000000000E+00 +BMAJ = 1.486111200000E-02 +BMIN = 9.499999700000E-03 +BPA = 6.000000000000E+00 +BTYPE = 'Intensity' +OBJECT = ' ' + +BUNIT = 'Jy/beam ' /Brightness (pixel) unit +EQUINOX = 2.000000000000E+03 +RADESYS = 'FK5 ' +LONPOLE = 1.800000000000E+02 +LATPOLE = 0.000000000000E+00 +PC01_01 = 1.000000000000E+00 +PC02_01 = 0.000000000000E+00 +PC01_02 = -0.000000000000E+00 +PC02_02 = 1.000000000000E+00 +CTYPE1 = 'RA---SIN' +CRVAL1 = 0.000000000000E+00 +CDELT1 = -2.222222308810E-03 +CRPIX1 = 5.600000000000E+01 +CUNIT1 = 'deg ' +PV2_1 = 0.000000000000E+00 +CTYPE2 = 'DEC--SIN' +CRVAL2 = 0.000000000000E+00 +CDELT2 = 3.333333234031E-03 +CRPIX2 = 3.800000000000E+01 +CUNIT2 = 'deg ' +PV2_2 = 0.000000000000E+00 +FIELD1 = 0.000000000000E+00 +FIELD2 = 'doggies ' +DATE =>>> '2015-12-01T13:03:19.198730' /Date FITS file was written<<< +TIMESYS = 'UTC ' /Time system for HDU +ORIGIN = 'casacore->>>trunk<<<' +HISTORY File modified by user 'dbarnes' with fv on 1999-07-28T14:19:41 +HISTORY File modified by user 'dbarnes' with fv on 1999-07-28T14:21:43 +END diff -Nru casacore-2.2.0/images/Images/test/tFITSImage.run casacore-2.3.0/images/Images/test/tFITSImage.run --- casacore-2.2.0/images/Images/test/tFITSImage.run 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/test/tFITSImage.run 2017-10-12 12:24:04.000000000 +0000 @@ -1,3 +1,4 @@ #!/bin/sh -$casa_checktool ./tFITSImage | sed 's/DATE =\(.*written\) /DATE =>>>\1<<>>\1<<>>\1<<<'/" diff -Nru casacore-2.2.0/images/Images/test/tImageBeamSet.cc casacore-2.3.0/images/Images/test/tImageBeamSet.cc --- casacore-2.2.0/images/Images/test/tImageBeamSet.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/test/tImageBeamSet.cc 2017-10-12 12:24:04.000000000 +0000 @@ -39,279 +39,279 @@ #include int main() { - try { - { - cout << "*** Test constructors, operator=" << endl; - // empty beam set - ImageBeamSet x; - AlwaysAssert(x.empty(), AipsError); - AlwaysAssert(x.size() == 0, AipsError); - AlwaysAssert(x.nelements() == 0, AipsError); - AlwaysAssert(!x.hasSingleBeam(), AipsError); - AlwaysAssert(!x.hasMultiBeam(), AipsError); - - // A beam. - GaussianBeam beam( - Quantity(4, "arcsec"), Quantity(3, "arcsec"), - Quantity(40, "deg") - ); - - - ImageBeamSet b(20, 4); - AlwaysAssert(!b.hasSingleBeam(), AipsError); - AlwaysAssert(b.hasMultiBeam(), AipsError); - b.set(beam); - AlwaysAssert(b.getBeam(2,2) == beam, AipsError); - - // check operator= - ImageBeamSet c = b; - AlwaysAssert(c.size() == 20*4, AipsError); - AlwaysAssert(b == b, AipsError); - AlwaysAssert(c == b, AipsError); - - // check copy constructor - ImageBeamSet d(b); - AlwaysAssert(d == b, AipsError); - c = x; - AlwaysAssert(c.empty(), AipsError); - x = b; - AlwaysAssert(x.size() == 20*4, AipsError); - AlwaysAssert(c != b, AipsError); - AlwaysAssert(x == b, AipsError); - - // check a single beam - ImageBeamSet k(beam); - AlwaysAssert (k.shape() == IPosition(2,1,1), AipsError); - AlwaysAssert (k.getBeam(2,2) == beam, AipsError); // valid for all - - ImageBeamSet y(IPosition(2, 1, 4)); - y.set(beam); - AlwaysAssert (y(2,3) == beam, AipsError); - - // Check assignment a bit more. - y = b; - AlwaysAssert(y == b, AipsError); - y = ImageBeamSet(); - AlwaysAssert(y.empty(), AipsError); - } - { - cout << "*** test setBeam()" << endl; - GaussianBeam beam0(Quantity(4, "arcsec"), Quantity(3, "arcsec"), Quantity(20, "deg")); - ImageBeamSet x(3, 4, beam0); - AlwaysAssert (x.nchan() == 3, AipsError); - AlwaysAssert (x.nstokes() == 4, AipsError); - - GaussianBeam beam1(Quantity(5, "arcsec"), Quantity(4, "arcsec"), Quantity(20, "deg")); - x.setBeam(1, 2, beam1); - IPosition axisPath = IPosition::makeAxisPath(x.shape().size()); + try { + { + cout << "*** Test constructors, operator=" << endl; + // empty beam set + ImageBeamSet x; + AlwaysAssert(x.empty(), AipsError); + AlwaysAssert(x.size() == 0, AipsError); + AlwaysAssert(x.nelements() == 0, AipsError); + AlwaysAssert(!x.hasSingleBeam(), AipsError); + AlwaysAssert(!x.hasMultiBeam(), AipsError); + + // A beam. + GaussianBeam beam( + Quantity(4, "arcsec"), Quantity(3, "arcsec"), + Quantity(40, "deg") + ); + + + ImageBeamSet b(20, 4); + AlwaysAssert(!b.hasSingleBeam(), AipsError); + AlwaysAssert(b.hasMultiBeam(), AipsError); + b.set(beam); + AlwaysAssert(b.getBeam(2,2) == beam, AipsError); + + // check operator= + ImageBeamSet c = b; + AlwaysAssert(c.size() == 20*4, AipsError); + AlwaysAssert(b == b, AipsError); + AlwaysAssert(c == b, AipsError); + + // check copy constructor + ImageBeamSet d(b); + AlwaysAssert(d == b, AipsError); + c = x; + AlwaysAssert(c.empty(), AipsError); + x = b; + AlwaysAssert(x.size() == 20*4, AipsError); + AlwaysAssert(c != b, AipsError); + AlwaysAssert(x == b, AipsError); + + // check a single beam + ImageBeamSet k(beam); + AlwaysAssert (k.shape() == IPosition(2,1,1), AipsError); + AlwaysAssert (k.getBeam(2,2) == beam, AipsError); // valid for all + + ImageBeamSet y(IPosition(2, 1, 4)); + y.set(beam); + AlwaysAssert (y(2,3) == beam, AipsError); + + // Check assignment a bit more. + y = b; + AlwaysAssert(y == b, AipsError); + y = ImageBeamSet(); + AlwaysAssert(y.empty(), AipsError); + } + { + cout << "*** test setBeam()" << endl; + GaussianBeam beam0(Quantity(4, "arcsec"), Quantity(3, "arcsec"), Quantity(20, "deg")); + ImageBeamSet x(3, 4, beam0); + AlwaysAssert (x.nchan() == 3, AipsError); + AlwaysAssert (x.nstokes() == 4, AipsError); + + GaussianBeam beam1(Quantity(5, "arcsec"), Quantity(4, "arcsec"), Quantity(20, "deg")); + x.setBeam(1, 2, beam1); + IPosition axisPath = IPosition::makeAxisPath(x.shape().size()); ArrayPositionIterator iter(x.shape(), axisPath, False); while (! iter.pastEnd()) { const IPosition pos = iter.pos(); - GaussianBeam beam = x.getBeam(pos[0], pos[1]); - if (pos == IPosition(2, 1,2)) { - AlwaysAssert(beam == beam1, AipsError); - } - else { - AlwaysAssert(beam == beam0, AipsError); - } + GaussianBeam beam = x.getBeam(pos[0], pos[1]); + if (pos == IPosition(2, 1,2)) { + AlwaysAssert(beam == beam1, AipsError); + } + else { + AlwaysAssert(beam == beam0, AipsError); + } iter.next(); - } + } + { + cout << "*** test setBeams()" << endl; + GaussianBeam beam0(Quantity(4, "arcsec"), Quantity(3, "arcsec"), + Quantity(20, "deg")); + GaussianBeam beam1(Quantity(8, "arcsec"), Quantity(6, "arcsec"), + Quantity(10, "deg")); + GaussianBeam beam2(Quantity(5, "arcsec"), Quantity(4, "arcsec"), + Quantity(20, "deg")); + ImageBeamSet x00; + ImageBeamSet x34(3, 4, beam0); x34.setBeam(1,2,beam2); + ImageBeamSet x14(1, 4, beam0); x14.setBeam(0,1,beam2); + ImageBeamSet x31(3, 1, beam0); x31.setBeam(1,0,beam2); + ImageBeamSet x11(1, 1, beam0); + ImageBeamSet b; + b.setBeams (x00.getBeams()); + AlwaysAssert (b==x00, AipsError); + b.setBeams (x34.getBeams()); + AlwaysAssert (b==x34, AipsError); + b.setBeams (x14.getBeams()); + { ImageBeamSet t(3,4,beam0); + t.setBeam(0,1,beam2); t.setBeam(1,1,beam2); t.setBeam(2,1,beam2); + AlwaysAssert (b==t, AipsError); } + b.setBeams (x31.getBeams()); + { ImageBeamSet t(3,4,beam0); + t.setBeam(1,0,beam2); t.setBeam(1,1,beam2); t.setBeam(1,2,beam2); + t.setBeam(1,3,beam2); + AlwaysAssert (b==t, AipsError); } + b.setBeams (x11.getBeams()); + { ImageBeamSet t(3,4,beam0); + AlwaysAssert (b==t, AipsError); } + { ImageBeamSet y(x11); + y.setBeams (x34.getBeams()); + AlwaysAssert (y==x34, AipsError); } + { ImageBeamSet y(x11); + y.setBeams (x31.getBeams()); + AlwaysAssert (y==x31, AipsError); } + { ImageBeamSet y(x31); + y.setBeams (x34.getBeams()); + AlwaysAssert (y==x34, AipsError); } + { ImageBeamSet y(x31); + y.setBeams (x14.getBeams()); + ImageBeamSet t(3,4,beam0); + t.setBeam(0,1,beam2); t.setBeam(1,1,beam2); t.setBeam(2,1,beam2); + AlwaysAssert (y==t, AipsError); } + { ImageBeamSet y(x14); + y.setBeams (x31.getBeams()); + ImageBeamSet t(3,4,beam0); + t.setBeam(1,0,beam2); t.setBeam(1,1,beam2); t.setBeam(1,2,beam2); + t.setBeam(1,3,beam2); + AlwaysAssert (y==t, AipsError); } + } + + { - cout << "*** test setBeams()" << endl; - GaussianBeam beam0(Quantity(4, "arcsec"), Quantity(3, "arcsec"), - Quantity(20, "deg")); - GaussianBeam beam1(Quantity(8, "arcsec"), Quantity(6, "arcsec"), - Quantity(10, "deg")); - GaussianBeam beam2(Quantity(5, "arcsec"), Quantity(4, "arcsec"), - Quantity(20, "deg")); - ImageBeamSet x00; - ImageBeamSet x34(3, 4, beam0); x34.setBeam(1,2,beam2); - ImageBeamSet x14(1, 4, beam0); x14.setBeam(0,1,beam2); - ImageBeamSet x31(3, 1, beam0); x31.setBeam(1,0,beam2); - ImageBeamSet x11(1, 1, beam0); - ImageBeamSet b; - b.setBeams (x00.getBeams()); - AlwaysAssert (b==x00, AipsError); - b.setBeams (x34.getBeams()); - AlwaysAssert (b==x34, AipsError); - b.setBeams (x14.getBeams()); - { ImageBeamSet t(3,4,beam0); - t.setBeam(0,1,beam2); t.setBeam(1,1,beam2); t.setBeam(2,1,beam2); - AlwaysAssert (b==t, AipsError); } - b.setBeams (x31.getBeams()); - { ImageBeamSet t(3,4,beam0); - t.setBeam(1,0,beam2); t.setBeam(1,1,beam2); t.setBeam(1,2,beam2); - t.setBeam(1,3,beam2); - AlwaysAssert (b==t, AipsError); } - b.setBeams (x11.getBeams()); - { ImageBeamSet t(3,4,beam0); - AlwaysAssert (b==t, AipsError); } - { ImageBeamSet y(x11); - y.setBeams (x34.getBeams()); - AlwaysAssert (y==x34, AipsError); } - { ImageBeamSet y(x11); - y.setBeams (x31.getBeams()); - AlwaysAssert (y==x31, AipsError); } - { ImageBeamSet y(x31); - y.setBeams (x34.getBeams()); - AlwaysAssert (y==x34, AipsError); } - { ImageBeamSet y(x31); - y.setBeams (x14.getBeams()); - ImageBeamSet t(3,4,beam0); - t.setBeam(0,1,beam2); t.setBeam(1,1,beam2); t.setBeam(2,1,beam2); - AlwaysAssert (y==t, AipsError); } - { ImageBeamSet y(x14); - y.setBeams (x31.getBeams()); - ImageBeamSet t(3,4,beam0); - t.setBeam(1,0,beam2); t.setBeam(1,1,beam2); t.setBeam(1,2,beam2); - t.setBeam(1,3,beam2); - AlwaysAssert (y==t, AipsError); } - } - - - { - cout << "*** test getting max and min area beams" << endl; - GaussianBeam init( - Quantity(4, "arcsec"), Quantity(2, "arcsec"), - Quantity(0, "deg") - ); - ImageBeamSet x(3, 4, init); - AlwaysAssert(x.getMaxAreaBeam() == init, AipsError); - AlwaysAssert(x.getMinAreaBeam() == init, AipsError); - GaussianBeam maxBeam( - Quantity(10, "arcsec"), Quantity(8, "arcsec"), - Quantity(0, "deg") - ); - GaussianBeam minBeam( - Quantity(1, "arcsec"), Quantity(1, "arcsec"), - Quantity(0, "deg") - ); - IPosition maxBeamPos(2, 2, 1); - IPosition minBeamPos(2, 2, 3); - x.setBeam(maxBeamPos[0], maxBeamPos[1], maxBeam); - x.setBeam(minBeamPos[0], minBeamPos[1], minBeam); - - AlwaysAssert(x.getMaxAreaBeam() == maxBeam, AipsError); - AlwaysAssert(x.getMinAreaBeam() == minBeam, AipsError); - AlwaysAssert(x.getMaxAreaBeamPosition() == maxBeamPos, AipsError); - AlwaysAssert(x.getMinAreaBeamPosition() == minBeamPos, AipsError); - } - { - cout << "*** test setBeams()" << endl; - GaussianBeam init( - Quantity(4, "arcsec"), Quantity(2, "arcsec"), - Quantity(0, "deg") - ); - - ImageBeamSet x(1, 5, init); - GaussianBeam beam2( - Quantity(10, "arcsec"), Quantity(5, "arcsec"), - Quantity(70, "deg") - ); - GaussianBeam beam3( - Quantity(11, "arcsec"), Quantity(5, "arcsec"), - Quantity(70, "deg") - ); - Matrix beams(1, 5, beam2); - beams(0, 3) = beam3; - x.setBeams(beams); - AlwaysAssert(x.getBeams().shape() == IPosition(2, 1, 5), AipsError); - AlwaysAssert(x.getMaxAreaBeam() == beam3, AipsError); - } - } + cout << "*** test getting max and min area beams" << endl; + GaussianBeam init( + Quantity(4, "arcsec"), Quantity(2, "arcsec"), + Quantity(0, "deg") + ); + ImageBeamSet x(3, 4, init); + AlwaysAssert(x.getMaxAreaBeam() == init, AipsError); + AlwaysAssert(x.getMinAreaBeam() == init, AipsError); + GaussianBeam maxBeam( + Quantity(10, "arcsec"), Quantity(8, "arcsec"), + Quantity(0, "deg") + ); + GaussianBeam minBeam( + Quantity(1, "arcsec"), Quantity(1, "arcsec"), + Quantity(0, "deg") + ); + IPosition maxBeamPos(2, 2, 1); + IPosition minBeamPos(2, 2, 3); + x.setBeam(maxBeamPos[0], maxBeamPos[1], maxBeam); + x.setBeam(minBeamPos[0], minBeamPos[1], minBeam); + + AlwaysAssert(x.getMaxAreaBeam() == maxBeam, AipsError); + AlwaysAssert(x.getMinAreaBeam() == minBeam, AipsError); + AlwaysAssert(x.getMaxAreaBeamPosition() == maxBeamPos, AipsError); + AlwaysAssert(x.getMinAreaBeamPosition() == minBeamPos, AipsError); + } + { + cout << "*** test setBeams()" << endl; + GaussianBeam init( + Quantity(4, "arcsec"), Quantity(2, "arcsec"), + Quantity(0, "deg") + ); + + ImageBeamSet x(1, 5, init); + GaussianBeam beam2( + Quantity(10, "arcsec"), Quantity(5, "arcsec"), + Quantity(70, "deg") + ); + GaussianBeam beam3( + Quantity(11, "arcsec"), Quantity(5, "arcsec"), + Quantity(70, "deg") + ); + Matrix beams(1, 5, beam2); + beams(0, 3) = beam3; + x.setBeams(beams); + AlwaysAssert(x.getBeams().shape() == IPosition(2, 1, 5), AipsError); + AlwaysAssert(x.getMaxAreaBeam() == beam3, AipsError); + } + } { cout << "*** test setBeam()" << endl; GaussianBeam beam0( - Quantity(4, "arcsec"), Quantity(3, "arcsec"), - Quantity(20, "deg") + Quantity(4, "arcsec"), Quantity(3, "arcsec"), + Quantity(20, "deg") ); ImageBeamSet x(3, 4, beam0); GaussianBeam beam1( - Quantity(5, "arcsec"), Quantity(4, "arcsec"), - Quantity(20, "deg") + Quantity(5, "arcsec"), Quantity(4, "arcsec"), + Quantity(20, "deg") ); x.setBeam(1, 2, beam1); IPosition axisPath = IPosition::makeAxisPath(x.shape().size()); ArrayPositionIterator iter(x.shape(), axisPath, False); while (! iter.pastEnd()) { - const IPosition pos = iter.pos(); - GaussianBeam beam = x(pos[0], pos[1]); - if (pos == IPosition(2, 1, 2)) { - AlwaysAssert(beam == beam1, AipsError); - } - else { - AlwaysAssert(beam == beam0, AipsError); - } - iter.next(); + const IPosition pos = iter.pos(); + GaussianBeam beam = x(pos[0], pos[1]); + if (pos == IPosition(2, 1, 2)) { + AlwaysAssert(beam == beam1, AipsError); + } + else { + AlwaysAssert(beam == beam0, AipsError); + } + iter.next(); } { - cout << "*** Test setBeam(), both chan and stokes < 0" << endl; - GaussianBeam beam0( - Quantity(4, "arcsec"), Quantity(3, "arcsec"), - Quantity(20, "deg") - ); - ImageBeamSet x(3, 4, beam0); - GaussianBeam beam1( - Quantity(5, "arcsec"), Quantity(4, "arcsec"), - Quantity(20, "deg") - ); - x.setBeam(-1, -1, beam1); - AlwaysAssert(x.getBeams().size() == 1, AipsError); - AlwaysAssert(x.getBeam() == beam1, AipsError); + cout << "*** Test setBeam(), both chan and stokes < 0" << endl; + GaussianBeam beam0( + Quantity(4, "arcsec"), Quantity(3, "arcsec"), + Quantity(20, "deg") + ); + ImageBeamSet x(3, 4, beam0); + GaussianBeam beam1( + Quantity(5, "arcsec"), Quantity(4, "arcsec"), + Quantity(20, "deg") + ); + x.setBeam(-1, -1, beam1); + AlwaysAssert(x.getBeams().size() == 1, AipsError); + AlwaysAssert(x.getBeam() == beam1, AipsError); } { - cout << "*** Test setBeam(), chan < 0 && stokes >= 0" << endl; - GaussianBeam beam0( - Quantity(4, "arcsec"), Quantity(3, "arcsec"), - Quantity(20, "deg") - ); - ImageBeamSet x(3, 4, beam0); - GaussianBeam beam1( - Quantity(5, "arcsec"), Quantity(4, "arcsec"), - Quantity(20, "deg") - ); - x.setBeam(-1, 2, beam1); - AlwaysAssert(x.getBeams().size() == 12, AipsError); - IPosition axisPath = IPosition::makeAxisPath(x.shape().size()); - ArrayPositionIterator iter(x.shape(), axisPath, False); - while (! iter.pastEnd()) { - const IPosition pos = iter.pos(); - GaussianBeam beam = x(pos[0], pos[1]); - if (pos[1] == 2) { - AlwaysAssert(beam == beam1, AipsError); - } - else { - AlwaysAssert(beam == beam0, AipsError); - } - iter.next(); - } + cout << "*** Test setBeam(), chan < 0 && stokes >= 0" << endl; + GaussianBeam beam0( + Quantity(4, "arcsec"), Quantity(3, "arcsec"), + Quantity(20, "deg") + ); + ImageBeamSet x(3, 4, beam0); + GaussianBeam beam1( + Quantity(5, "arcsec"), Quantity(4, "arcsec"), + Quantity(20, "deg") + ); + x.setBeam(-1, 2, beam1); + AlwaysAssert(x.getBeams().size() == 12, AipsError); + IPosition axisPath = IPosition::makeAxisPath(x.shape().size()); + ArrayPositionIterator iter(x.shape(), axisPath, False); + while (! iter.pastEnd()) { + const IPosition pos = iter.pos(); + GaussianBeam beam = x(pos[0], pos[1]); + if (pos[1] == 2) { + AlwaysAssert(beam == beam1, AipsError); + } + else { + AlwaysAssert(beam == beam0, AipsError); + } + iter.next(); + } } { - cout << "*** Test setBeam(), stokes < 0 && chan >= 0" << endl; - GaussianBeam beam0( - Quantity(4, "arcsec"), Quantity(3, "arcsec"), - Quantity(20, "deg") - ); - ImageBeamSet x(3, 4, beam0); - GaussianBeam beam1( - Quantity(5, "arcsec"), Quantity(4, "arcsec"), - Quantity(20, "deg") - ); - x.setBeam(2, -1, beam1); - AlwaysAssert(x.getBeams().size() == 12, AipsError); - IPosition axisPath = IPosition::makeAxisPath(x.shape().size()); - ArrayPositionIterator iter(x.shape(), axisPath, False); - while (! iter.pastEnd()) { - const IPosition pos = iter.pos(); - GaussianBeam beam = x(pos[0], pos[1]); - if (pos[0] == 2) { - AlwaysAssert(beam == beam1, AipsError); - } - else { - AlwaysAssert(beam == beam0, AipsError); - } - iter.next(); - } + cout << "*** Test setBeam(), stokes < 0 && chan >= 0" << endl; + GaussianBeam beam0( + Quantity(4, "arcsec"), Quantity(3, "arcsec"), + Quantity(20, "deg") + ); + ImageBeamSet x(3, 4, beam0); + GaussianBeam beam1( + Quantity(5, "arcsec"), Quantity(4, "arcsec"), + Quantity(20, "deg") + ); + x.setBeam(2, -1, beam1); + AlwaysAssert(x.getBeams().size() == 12, AipsError); + IPosition axisPath = IPosition::makeAxisPath(x.shape().size()); + ArrayPositionIterator iter(x.shape(), axisPath, False); + while (! iter.pastEnd()) { + const IPosition pos = iter.pos(); + GaussianBeam beam = x(pos[0], pos[1]); + if (pos[0] == 2) { + AlwaysAssert(beam == beam1, AipsError); + } + else { + AlwaysAssert(beam == beam0, AipsError); + } + iter.next(); + } } { cout << "*** test setBeams()" << endl; @@ -325,124 +325,124 @@ } } { - cout << "Test get max, min, median for polarizations" << endl; - ImageBeamSet beamSet; - IPosition pos; - AlwaysAssert( - beamSet.getMaxAreaBeamForPol(pos, 1) == GaussianBeam::NULL_BEAM, - AipsError - ); - AlwaysAssert(pos == IPosition(2, 0, 0), AipsError); - - GaussianBeam beam0( - Quantity(4, "arcsec"), Quantity(3, "arcsec"), - Quantity(20, "deg") - ); - beamSet = ImageBeamSet(beam0); - beamSet.getMaxAreaBeamForPol(pos, 1); - AlwaysAssert(pos==IPosition(2,0,0), AipsError); - - beamSet = ImageBeamSet(3,4, beam0); - IPosition gotPos; - for (uInt i=0; i<4; i++) { - GaussianBeam gotBeam = beamSet.getMaxAreaBeamForPol(gotPos, i); - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - gotBeam = beamSet.getMinAreaBeamForPol(gotPos, i); - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - gotBeam = beamSet.getMedianAreaBeamForPol(gotPos, i); - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 1, i), AipsError); - } - GaussianBeam beam1( - Quantity(5, "arcsec"), Quantity(3, "arcsec"), - Quantity(20, "deg") - ); - beamSet.setBeam(2, 1, beam1); - GaussianBeam beam2( - Quantity(3, "arcsec"), Quantity(2, "arcsec"), - Quantity(20, "deg") - ); - beamSet.setBeam(1, 1, beam2); - for (uInt i=0; i<4; i++) { - GaussianBeam gotBeam = beamSet.getMaxAreaBeamForPol(gotPos, i); - if (i == 1) { - AlwaysAssert(gotBeam == beam1, AipsError); - AlwaysAssert(gotPos == IPosition(2, 2, 1), AipsError); - } - else { - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - } - gotBeam = beamSet.getMinAreaBeamForPol(gotPos, i); - if (i == 1) { - AlwaysAssert(gotBeam == beam2, AipsError); - AlwaysAssert(gotPos == IPosition(2, 1, i), AipsError); - } - else { - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - } - gotBeam = beamSet.getMedianAreaBeamForPol(gotPos, i); - AlwaysAssert(gotBeam == beam0, AipsError); - if (i == 1) { - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - - } - else { - AlwaysAssert(gotPos == IPosition(2, 1, i), AipsError); - } - } - - beamSet = ImageBeamSet(4, 4, beam0); - for (uInt i=0; i<4; i++) { - GaussianBeam gotBeam = beamSet.getMaxAreaBeamForPol(gotPos, i); - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - gotBeam = beamSet.getMinAreaBeamForPol(gotPos, i); - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - gotBeam = beamSet.getMedianAreaBeamForPol(gotPos, i); - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 2, i), AipsError); - } - beamSet.setBeam(2, 1, beam1); - beamSet.setBeam(1, 1, beam2); - GaussianBeam beam3( - Quantity(4.5, "arcsec"), Quantity(3, "arcsec"), - Quantity(20, "deg") - ); - beamSet.setBeam(0, 1, beam3); - for (uInt i=0; i<4; i++) { - GaussianBeam gotBeam = beamSet.getMaxAreaBeamForPol(gotPos, i); - if (i == 1) { - AlwaysAssert(gotBeam == beam1, AipsError); - AlwaysAssert(gotPos == IPosition(2, 2, 1), AipsError); - } - else { - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - } - gotBeam = beamSet.getMinAreaBeamForPol(gotPos, i); - if (i == 1) { - AlwaysAssert(gotBeam == beam2, AipsError); - AlwaysAssert(gotPos == IPosition(2, 1, i), AipsError); - } - else { - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - } - gotBeam = beamSet.getMedianAreaBeamForPol(gotPos, i); - if (i == 1) { - AlwaysAssert(gotBeam == beam3, AipsError); - AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); - } - else { - AlwaysAssert(gotBeam == beam0, AipsError); - AlwaysAssert(gotPos == IPosition(2, 2, i), AipsError); - } - } + cout << "Test get max, min, median for polarizations" << endl; + ImageBeamSet beamSet; + IPosition pos; + AlwaysAssert( + beamSet.getMaxAreaBeamForPol(pos, 1) == GaussianBeam::NULL_BEAM, + AipsError + ); + AlwaysAssert(pos == IPosition(2, 0, 0), AipsError); + + GaussianBeam beam0( + Quantity(4, "arcsec"), Quantity(3, "arcsec"), + Quantity(20, "deg") + ); + beamSet = ImageBeamSet(beam0); + beamSet.getMaxAreaBeamForPol(pos, 1); + AlwaysAssert(pos==IPosition(2,0,0), AipsError); + + beamSet = ImageBeamSet(3,4, beam0); + IPosition gotPos; + for (uInt i=0; i<4; i++) { + GaussianBeam gotBeam = beamSet.getMaxAreaBeamForPol(gotPos, i); + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + gotBeam = beamSet.getMinAreaBeamForPol(gotPos, i); + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + gotBeam = beamSet.getMedianAreaBeamForPol(gotPos, i); + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 1, i), AipsError); + } + GaussianBeam beam1( + Quantity(5, "arcsec"), Quantity(3, "arcsec"), + Quantity(20, "deg") + ); + beamSet.setBeam(2, 1, beam1); + GaussianBeam beam2( + Quantity(3, "arcsec"), Quantity(2, "arcsec"), + Quantity(20, "deg") + ); + beamSet.setBeam(1, 1, beam2); + for (uInt i=0; i<4; i++) { + GaussianBeam gotBeam = beamSet.getMaxAreaBeamForPol(gotPos, i); + if (i == 1) { + AlwaysAssert(gotBeam == beam1, AipsError); + AlwaysAssert(gotPos == IPosition(2, 2, 1), AipsError); + } + else { + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + } + gotBeam = beamSet.getMinAreaBeamForPol(gotPos, i); + if (i == 1) { + AlwaysAssert(gotBeam == beam2, AipsError); + AlwaysAssert(gotPos == IPosition(2, 1, i), AipsError); + } + else { + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + } + gotBeam = beamSet.getMedianAreaBeamForPol(gotPos, i); + AlwaysAssert(gotBeam == beam0, AipsError); + if (i == 1) { + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + + } + else { + AlwaysAssert(gotPos == IPosition(2, 1, i), AipsError); + } + } + + beamSet = ImageBeamSet(4, 4, beam0); + for (uInt i=0; i<4; i++) { + GaussianBeam gotBeam = beamSet.getMaxAreaBeamForPol(gotPos, i); + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + gotBeam = beamSet.getMinAreaBeamForPol(gotPos, i); + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + gotBeam = beamSet.getMedianAreaBeamForPol(gotPos, i); + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 2, i), AipsError); + } + beamSet.setBeam(2, 1, beam1); + beamSet.setBeam(1, 1, beam2); + GaussianBeam beam3( + Quantity(4.5, "arcsec"), Quantity(3, "arcsec"), + Quantity(20, "deg") + ); + beamSet.setBeam(0, 1, beam3); + for (uInt i=0; i<4; i++) { + GaussianBeam gotBeam = beamSet.getMaxAreaBeamForPol(gotPos, i); + if (i == 1) { + AlwaysAssert(gotBeam == beam1, AipsError); + AlwaysAssert(gotPos == IPosition(2, 2, 1), AipsError); + } + else { + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + } + gotBeam = beamSet.getMinAreaBeamForPol(gotPos, i); + if (i == 1) { + AlwaysAssert(gotBeam == beam2, AipsError); + AlwaysAssert(gotPos == IPosition(2, 1, i), AipsError); + } + else { + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + } + gotBeam = beamSet.getMedianAreaBeamForPol(gotPos, i); + if (i == 1) { + AlwaysAssert(gotBeam == beam3, AipsError); + AlwaysAssert(gotPos == IPosition(2, 0, i), AipsError); + } + else { + AlwaysAssert(gotBeam == beam0, AipsError); + AlwaysAssert(gotPos == IPosition(2, 2, i), AipsError); + } + } } { cout << "*** test equivalent()" << endl; @@ -511,135 +511,142 @@ } } { - cout << "*** test getSmallestMinorAxis" << endl; - Matrix beams(1, 4); - GaussianBeam beam1( - Quantity(4, "arcsec"), Quantity(2, "arcsec"), - Quantity(0, "deg") - ); - GaussianBeam beam2( - Quantity(4, "arcsec"), Quantity(2, "arcsec"), - Quantity(20, "deg") - ); - GaussianBeam beam3( - Quantity(4, "arcsec"), Quantity(2, "arcsec"), - Quantity(40, "deg") - ); - GaussianBeam beam4( - Quantity(4, "arcsec"), Quantity(2, "arcsec"), - Quantity(60, "deg") - ); - beams(0, 0) = beam1; - beams(0, 1) = beam2; - beams(0, 2) = beam3; - beams(0, 3) = beam4; - // all equal - ImageBeamSet beamSet(beams); - AlwaysAssert(beamSet.getSmallestMinorAxisBeam() == beam1, AipsError); - beam3.setMajorMinor(Quantity(4, "arcsec"), Quantity(1, "arcsec")); - beams(0, 2) = beam3; - beamSet = ImageBeamSet(beams); - GaussianBeam got = beamSet.getSmallestMinorAxisBeam(); - AlwaysAssert(got == beam3, AipsError); - beam3.setMajorMinor(Quantity(3, "arcsec"), Quantity(2, "arcsec")); - beams(0, 2) = beam3; - beamSet = ImageBeamSet(beams); - got = beamSet.getSmallestMinorAxisBeam(); - AlwaysAssert(got == beam3, AipsError); - - cout << "*** test to/fromRecord()" << endl; - Record yy = beamSet.toRecord(); - ImageBeamSet gotSet = ImageBeamSet::fromRecord(yy); - AlwaysAssert( - gotSet.nchan() == beamSet.nchan() && gotSet.nstokes() == beamSet.nstokes() - && gotSet.equivalent(beamSet), - AipsError - ); + cout << "*** test getSmallestMinorAxis" << endl; + Matrix beams(1, 4); + GaussianBeam beam1( + Quantity(4, "arcsec"), Quantity(2, "arcsec"), + Quantity(0, "deg") + ); + GaussianBeam beam2( + Quantity(4, "arcsec"), Quantity(2, "arcsec"), + Quantity(20, "deg") + ); + GaussianBeam beam3( + Quantity(4, "arcsec"), Quantity(2, "arcsec"), + Quantity(40, "deg") + ); + GaussianBeam beam4( + Quantity(4, "arcsec"), Quantity(2, "arcsec"), + Quantity(60, "deg") + ); + beams(0, 0) = beam1; + beams(0, 1) = beam2; + beams(0, 2) = beam3; + beams(0, 3) = beam4; + // all equal + ImageBeamSet beamSet(beams); + AlwaysAssert(beamSet.getSmallestMinorAxisBeam() == beam1, AipsError); + beam3.setMajorMinor(Quantity(4, "arcsec"), Quantity(1, "arcsec")); + beams(0, 2) = beam3; + beamSet = ImageBeamSet(beams); + GaussianBeam got = beamSet.getSmallestMinorAxisBeam(); + AlwaysAssert(got == beam3, AipsError); + beam3.setMajorMinor(Quantity(3, "arcsec"), Quantity(2, "arcsec")); + beams(0, 2) = beam3; + beamSet = ImageBeamSet(beams); + got = beamSet.getSmallestMinorAxisBeam(); + AlwaysAssert(got == beam3, AipsError); + + cout << "*** test to/fromRecord()" << endl; + Record yy = beamSet.toRecord(); + ImageBeamSet gotSet = ImageBeamSet::fromRecord(yy); + AlwaysAssert( + gotSet.nchan() == beamSet.nchan() && gotSet.nstokes() == beamSet.nstokes() + && gotSet.equivalent(beamSet), + AipsError + ); } { - cout << "*** Test getMedianAreaBeam()" << endl; - Matrix beams(3, 4); - uInt count = 1; - Matrix::iterator iter = beams.begin(); - Matrix::iterator end = beams.end(); - Quantity radius; - while (iter != end) { - radius = Quantity(count, "arcsec"); - iter->setMajorMinor(radius, radius); - iter++; - count++; - } - radius = Quantity(6.5, "arcsec"); - beams(2,2) = GaussianBeam(radius, radius, Quantity(0, "deg")); - ImageBeamSet bs(beams); - AlwaysAssert(bs.getMedianAreaBeam() == beams(2, 2), AipsError); - - Matrix beams2(1, 12); - count = 1; - iter = beams2.begin(); - end = beams2.end(); - while (iter != end) { - radius = Quantity(count, "arcsec"); - iter->setMajorMinor(radius, radius); - iter++; - count++; - } - radius = Quantity(6.5, "arcsec"); - beams2(0,10) = GaussianBeam(radius, radius, Quantity(0, "deg")); - ImageBeamSet bs2(beams2); - AlwaysAssert(bs2.getMedianAreaBeam() == beams2(0, 10), AipsError); - - Matrix beams3(12, 1); - count = 1; - iter = beams3.begin(); - end = beams3.end(); - while (iter != end) { - radius = Quantity(count, "arcsec"); - iter->setMajorMinor(radius, radius); - iter++; - count++; - } - radius = Quantity(6.5, "arcsec"); - beams3(8, 0) = GaussianBeam(radius, radius, Quantity(0, "deg")); - ImageBeamSet bs3(beams3); - AlwaysAssert(bs3.getMedianAreaBeam() == beams3(8,0), AipsError); + cout << "*** Test getMedianAreaBeam()" << endl; + Matrix beams(3, 4); + uInt count = 1; + Matrix::iterator iter = beams.begin(); + Matrix::iterator end = beams.end(); + Quantity radius; + while (iter != end) { + radius = Quantity(count, "arcsec"); + iter->setMajorMinor(radius, radius); + iter++; + count++; + } + radius = Quantity(6.5, "arcsec"); + beams(2,2) = GaussianBeam(radius, radius, Quantity(0, "deg")); + ImageBeamSet bs(beams); + AlwaysAssert(bs.getMedianAreaBeam() == beams(2, 2), AipsError); + + Matrix beams2(1, 12); + count = 1; + iter = beams2.begin(); + end = beams2.end(); + while (iter != end) { + radius = Quantity(count, "arcsec"); + iter->setMajorMinor(radius, radius); + iter++; + count++; + } + radius = Quantity(6.5, "arcsec"); + beams2(0,10) = GaussianBeam(radius, radius, Quantity(0, "deg")); + ImageBeamSet bs2(beams2); + AlwaysAssert(bs2.getMedianAreaBeam() == beams2(0, 10), AipsError); + + Matrix beams3(12, 1); + count = 1; + iter = beams3.begin(); + end = beams3.end(); + while (iter != end) { + radius = Quantity(count, "arcsec"); + iter->setMajorMinor(radius, radius); + iter++; + count++; + } + radius = Quantity(6.5, "arcsec"); + beams3(8, 0) = GaussianBeam(radius, radius, Quantity(0, "deg")); + ImageBeamSet bs3(beams3); + AlwaysAssert(bs3.getMedianAreaBeam() == beams3(8,0), AipsError); } { - cout << "*** test rotate()" << endl; - GaussianBeam beam( - Quantity(4, "arcsec"), Quantity(3, "arcsec"), - Quantity(40, "deg") - ); - ImageBeamSet beamSet(beam); - beamSet.rotate(Quantity(30, "deg")); - AlwaysAssert( - beamSet.getBeam().getPA(True) == Quantity(70, "deg"), AipsError - ); - Matrix beams(2,2, beam); - beams(1, 1).setPA(Quantity(90, "deg")); - beamSet = ImageBeamSet(beams); - beamSet.rotate(Quantity(50, "deg")); - AlwaysAssert( - beamSet(0, 0).getPA(True) == Quantity(90, "deg"), AipsError - ); - AlwaysAssert( - beamSet(0, 1).getPA(True) == Quantity(90, "deg"), AipsError - ); - AlwaysAssert( - beamSet(1, 0).getPA(True) == Quantity(90, "deg"), AipsError - ); - AlwaysAssert( - beamSet(1, 1).getPA(True) == Quantity(-40, "deg"), AipsError - ); + cout << "*** test rotate()" << endl; + GaussianBeam beam( + Quantity(4, "arcsec"), Quantity(3, "arcsec"), + Quantity(40, "deg") + ); + ImageBeamSet beamSet(beam); + beamSet.rotate(Quantity(30, "deg")); + AlwaysAssert( + beamSet.getBeam().getPA(True) == Quantity(70, "deg"), AipsError + ); + AlwaysAssert( + beamSet.getMinAreaBeam().getPA(True) == Quantity(70, "deg"), AipsError + ); + AlwaysAssert( + beamSet.getMaxAreaBeam().getPA(True) == Quantity(70, "deg"), AipsError + ); + Matrix beams(2,2, beam); + beams(1, 1).setPA(Quantity(90, "deg")); + beamSet = ImageBeamSet(beams); + beamSet.rotate(Quantity(50, "deg")); + AlwaysAssert( + beamSet(0, 0).getPA(True) == Quantity(90, "deg"), AipsError + ); + AlwaysAssert( + beamSet(0, 1).getPA(True) == Quantity(90, "deg"), AipsError + ); + AlwaysAssert( + beamSet(1, 0).getPA(True) == Quantity(90, "deg"), AipsError + ); + AlwaysAssert( + beamSet(1, 1).getPA(True) == Quantity(-40, "deg"), AipsError + ); + } - } - catch (const AipsError& x) { - cout << x.getMesg() << endl; - cout << "FAIL" << endl; - return 1; - } - cout << "OK" << endl; - return 0; + } + catch (const AipsError& x) { + cout << x.getMesg() << endl; + cout << "FAIL" << endl; + return 1; + } + cout << "OK" << endl; + return 0; } diff -Nru casacore-2.2.0/images/Images/test/tImageConcat.cc casacore-2.3.0/images/Images/test/tImageConcat.cc --- casacore-2.2.0/images/Images/test/tImageConcat.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/test/tImageConcat.cc 2017-10-12 12:24:04.000000000 +0000 @@ -61,6 +61,7 @@ MaskedLattice& ml1, MaskedLattice& ml2, MaskedLattice& ml3); +void checkMiscInfo (ImageConcat& image, Bool hasExtra); void makeMask (ImageInterface& im, Bool maskValue, Bool set); void testLogger(); @@ -130,15 +131,42 @@ check (0, ml3, im1, im2); -// Save the concatenated image and read it back. +// Set some miscInfo + TableRecord rec(lc.miscInfo()); + rec.define ("i4", 4); + TableRecord srec; + srec.define ("str", "abcd"); + srec.define ("r4", float(1.0)); + rec.defineRecord ("srec", srec); AlwaysAssertExit (!lc.isPersistent()); + lc.setMiscInfo (rec); + cout << "miscinfo=" << endl << lc.miscInfo(); + +// Save the concatenated image and read it back. lc.save ("tImageConcat_tmp.imgconc"); + checkMiscInfo (lc, False); AlwaysAssertExit (lc.isPersistent()); LatticeBase* latt = ImageOpener::openImage ("tImageConcat_tmp.imgconc"); ImageConcat* lc3 = dynamic_cast*>(latt); AlwaysAssertExit (lc3 != 0); AlwaysAssertExit (allEQ(lc3->get(), lc.get())); AlwaysAssertExit (allEQ(lc3->getMask(), lc.getMask())); + checkMiscInfo (*lc3, False); + } + { + LatticeBase* latt = ImageOpener::openImage ("tImageConcat_tmp.imgconc"); + ImageConcat* lc3 = dynamic_cast*>(latt); + TableRecord rec=lc3->miscInfo(); + checkMiscInfo (*lc3, False); + rec.define("NewKey", "newvalue"); + lc3->setMiscInfo(rec); + checkMiscInfo (*lc3, True); + delete lc3; + } + { + LatticeBase* latt = ImageOpener::openImage ("tImageConcat_tmp.imgconc"); + ImageConcat* lc3 = dynamic_cast*>(latt); + checkMiscInfo (*lc3, True); delete lc3; } @@ -642,6 +670,21 @@ } } +void checkMiscInfo (ImageConcat& img, Bool hasExtraKey) +{ + TableRecord rec = img.miscInfo(); + AlwaysAssertExit (rec.asInt("i4") == 4); + TableRecord srec(rec.subRecord("srec")); + AlwaysAssertExit (srec.size() == 2); + AlwaysAssertExit (srec.asString("str") == "abcd"); + AlwaysAssertExit (srec.asFloat("r4") == 1.0); + if (hasExtraKey) { + AlwaysAssertExit (rec.asString("NewKey") == "newvalue"); + AlwaysAssertExit (rec.size() == 3); + } else { + AlwaysAssertExit (rec.size() == 2); + } +} void makeMask (ImageInterface& im, Bool maskValue, Bool set) diff -Nru casacore-2.2.0/images/Images/test/tImageExpr.cc casacore-2.3.0/images/Images/test/tImageExpr.cc --- casacore-2.2.0/images/Images/test/tImageExpr.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/images/Images/test/tImageExpr.cc 2017-10-12 12:24:04.000000000 +0000 @@ -64,6 +64,9 @@ ImageExpr img (node, expr); AlwaysAssertExit (allEQ(img.get(), arr+arr)); AlwaysAssertExit (! img.isPersistent()); + TableRecord rec; + rec.define ("key", "value"); + img.setMiscInfo (rec); img.save ("tImageExpr_tmp.imgexpr"); AlwaysAssertExit (img.isPersistent()); AlwaysAssertExit (ImageExprParse::getImageNames().size() == 2 && @@ -77,10 +80,11 @@ AlwaysAssertExit (img != 0); AlwaysAssertExit (allEQ(img->get(), arr+arr)); AlwaysAssertExit (img->isPersistent()); - delete img; AlwaysAssertExit (ImageExprParse::getImageNames().size() == 2 && ImageExprParse::getImageNames()[0] == "tImageExpr_tmp.img1" && ImageExprParse::getImageNames()[1] == "tImageExpr_tmp.img2"); + AlwaysAssertExit (img->miscInfo().asString("key") == "value"); + delete img; } { // Do a recursive test. diff -Nru casacore-2.2.0/lattices/CMakeLists.txt casacore-2.3.0/lattices/CMakeLists.txt --- casacore-2.2.0/lattices/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/lattices/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -65,6 +65,7 @@ casa_lattices casa_tables casa_scimath +${CASACORE_ARCH_LIBS} ) install (TARGETS casa_lattices diff -Nru casacore-2.2.0/lattices/LatticeMath/LatticeStatistics.h casacore-2.3.0/lattices/LatticeMath/LatticeStatistics.h --- casacore-2.2.0/lattices/LatticeMath/LatticeStatistics.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/lattices/LatticeMath/LatticeStatistics.h 2017-10-12 12:24:04.000000000 +0000 @@ -221,10 +221,18 @@ // You can specify whether you want to see progress meters or not. // You can force the storage lattice to be disk based, otherwise // the decision for core or disk is taken for you. +// If clone is True, the input lattice will be cloned, so the caller +// can make changes to the input lattice, but the statistics will reflect the +// lattice as it was at construction. If False, a reference to the input lattice +// is used, and so the caller shouldn't make changes to the input lattice between +// construction and calling statistics computation methods, unless it calls setNewLattice() +// to update the changed lattice. Obviously, cloning the lattice impacts performance +// and memory usage. LatticeStatistics (const MaskedLattice& lattice, LogIO& os, Bool showProgress=True, - Bool forceDisk=False); + Bool forceDisk=False, + Bool clone=True); // Constructor takes the lattice only. In the absence of a logger you get no messages. // This includes error messages and potential listing of the statistics. @@ -233,7 +241,8 @@ // the decision for core or disk is taken for you. LatticeStatistics (const MaskedLattice& lattice, Bool showProgress=True, - Bool forceDisk=False); + Bool forceDisk=False, + Bool clone=True); // Copy constructor. Copy semantics are followed. Therefore any storage lattice // that has already been created for other is copied to *this @@ -352,7 +361,14 @@ // Set a new MaskedLattice object. A return value of False indicates the // lattice had an invalid type or that the internal state of the class is bad. - Bool setNewLattice(const MaskedLattice& lattice); +// If clone is True, the input lattice will be cloned, so the caller +// can make changes to the input lattice, but the statistics will reflect the +// lattice as it was at construction. If False, a reference to the input lattice +// is used, and so the caller shouldn't make changes to the input lattice between +// construction and calling statistics computation methods, unless it calls setNewLattice() +// to update the changed lattice. Obviously, cloning the lattice impacts performance +// and memory usage. + Bool setNewLattice(const MaskedLattice& lattice, Bool clone=True); // Did we construct with a logger ? Bool hasLogger () const {return haveLogger_p;}; @@ -493,6 +509,8 @@ private: const MaskedLattice* pInLattice_p; + SHARED_PTR > _inLatPtrMgr; + CountedPtr > pStoreLattice_p; Vector nxy_p, statsToPlot_p; Vector range_p; diff -Nru casacore-2.2.0/lattices/LatticeMath/LatticeStatistics.tcc casacore-2.3.0/lattices/LatticeMath/LatticeStatistics.tcc --- casacore-2.2.0/lattices/LatticeMath/LatticeStatistics.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/lattices/LatticeMath/LatticeStatistics.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -81,7 +81,8 @@ LatticeStatistics::LatticeStatistics (const MaskedLattice& lattice, LogIO& os, Bool showProgress, - Bool forceDisk) + Bool forceDisk, + Bool clone) // // Constructor // @@ -110,7 +111,7 @@ maxPos_p.resize(0); blcParent_p.resize(0); configureClassical(); - if (setNewLattice(lattice)) { + if (setNewLattice(lattice, clone)) { // Cursor axes defaults to all @@ -125,7 +126,8 @@ template LatticeStatistics::LatticeStatistics (const MaskedLattice& lattice, Bool showProgress, - Bool forceDisk) + Bool forceDisk, + Bool clone) // // Constructor // @@ -154,7 +156,7 @@ maxPos_p.resize(0); blcParent_p.resize(0); configureClassical(); - if (setNewLattice(lattice)) { + if (setNewLattice(lattice, clone)) { // Cursor axes defaults to all @@ -189,10 +191,8 @@ // Deal with lattice pointer - if (pInLattice_p!=0) { - delete pInLattice_p; - } - pInLattice_p = other.pInLattice_p->cloneML(); + _inLatPtrMgr.reset(other.pInLattice_p->cloneML()); + pInLattice_p = _inLatPtrMgr.get(); // Delete storage lattice if (! pStoreLattice_p.null()) { @@ -247,10 +247,7 @@ } template -LatticeStatistics::~LatticeStatistics() { - delete pInLattice_p; - pInLattice_p = 0; -} +LatticeStatistics::~LatticeStatistics() {} template Bool LatticeStatistics::setAxes (const Vector& axes) @@ -270,12 +267,13 @@ cursorAxes_p.resize(0); cursorAxes_p = axes; + uInt ndim = pInLattice_p->ndim(); if (cursorAxes_p.nelements() == 0) { // User didn't give any axes. Set them to all. - cursorAxes_p.resize(pInLattice_p->ndim()); - for (uInt i=0; indim(); i++) cursorAxes_p(i) = i; + cursorAxes_p.resize(ndim); + for (uInt i=0; i::sort(cursorAxes_p, Sort::Ascending, Sort::QuickSort|Sort::NoDuplicates); // for (uInt i=0; i Int(pInLattice_p->ndim()-1)) { + if (cursorAxes_p(i) < 0 || cursorAxes_p(i) > Int(ndim - 1)) { ostringstream oss; oss << "Invalid cursor axes: " << axes; error_p = oss.str(); @@ -303,7 +301,7 @@ // so poke this in here too. displayAxes_p.resize(0); - displayAxes_p = IPosition::otherAxes(pInLattice_p->ndim(), + displayAxes_p = IPosition::otherAxes(ndim, cursorAxes_p).asVector(); return True; } @@ -381,12 +379,12 @@ } template -Bool LatticeStatistics::setNewLattice(const MaskedLattice& lattice) -{ +Bool LatticeStatistics::setNewLattice( + const MaskedLattice& lattice, Bool clone +) { if (!goodParameterStatus_p) { return False; } -// T* dummy = 0; DataType latticeType = whatType(dummy); if (latticeType !=TpFloat && latticeType!=TpComplex) { @@ -397,10 +395,14 @@ return False; } -// Make a clone of the lattice - - if (pInLattice_p!=0) delete pInLattice_p; - pInLattice_p = lattice.cloneML(); + if (clone) { + _inLatPtrMgr.reset(lattice.cloneML()); + pInLattice_p = _inLatPtrMgr.get(); + } + else { + _inLatPtrMgr.reset(); + pInLattice_p = &lattice; + } // This is the location of the input SubLattice in // the parent Lattice @@ -758,9 +760,10 @@ // Work out dimensions of storage lattice (statistics accumulations // are along the last axis) IPosition storeLatticeShape; + IPosition shape = pInLattice_p->shape(); LatticeStatsBase::setStorageImageShape( storeLatticeShape, True, Int(LatticeStatsBase::NACCUM), - displayAxes_p, pInLattice_p->shape() + displayAxes_p, shape ); // Set the storage lattice tile shape to the tile shape of the @@ -800,12 +803,13 @@ } //Timer timer; Bool ranOldMethod = False; + uInt ndim = shape.nelements(); if (tryOldMethod) { // use older method for higher performance in the large loop count // regime //timer.mark(); - minPos_p.resize(pInLattice_p->shape().nelements()); - maxPos_p.resize(pInLattice_p->shape().nelements()); + minPos_p.resize(ndim); + maxPos_p.resize(ndim); StatsTiledCollapser collapser( range_p, noInclude_p, noExclude_p, fixedMinMax_p @@ -1256,11 +1260,13 @@ // Write the pixel and world coordinate of the higher order display axes to the logger + uInt ndim = pInLattice_p->ndim(); + IPosition shape = pInLattice_p->shape(); if (nDisplayAxes > 1) { Vector sWorld(1); Vector pixels(1); - IPosition blc(pInLattice_p->ndim(),0); - IPosition trc(pInLattice_p->shape()-1); + IPosition blc(ndim, 0); + IPosition trc(shape - 1); // os_p << LogIO::NORMAL; for (uInt j=1; j sWorld(1); Vector pixels(1); pixels(0) = 1.0; - IPosition blc(pInLattice_p->ndim(),0); - IPosition trc(pInLattice_p->shape()-1); + IPosition blc(ndim, 0); + IPosition trc(shape - 1); // Write headers diff -Nru casacore-2.2.0/meas/CMakeLists.txt casacore-2.3.0/meas/CMakeLists.txt --- casacore-2.2.0/meas/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/meas/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -12,7 +12,7 @@ MeasUDF/Register.cc ) -target_link_libraries (casa_meas casa_measures) +target_link_libraries (casa_meas casa_measures ${CASACORE_ARCH_LIBS}) install (TARGETS casa_meas RUNTIME DESTINATION bin diff -Nru casacore-2.2.0/measures/apps/CMakeLists.txt casacore-2.3.0/measures/apps/CMakeLists.txt --- casacore-2.2.0/measures/apps/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/measures/apps/CMakeLists.txt 2017-10-12 12:26:30.000000000 +0000 @@ -1,10 +1,10 @@ foreach(prog findmeastable) add_executable (${prog} ${prog}.cc) - target_link_libraries (${prog} casa_measures) + target_link_libraries (${prog} casa_measures ${CASACORE_ARCH_LIBS}) install(TARGETS ${prog} DESTINATION bin) endforeach(prog findmeastable) add_executable (measuresdata measuresdata/measuresdata.cc) -target_link_libraries (measuresdata casa_measures) +target_link_libraries (measuresdata casa_measures ${CASACORE_ARCH_LIBS}) install(TARGETS measuresdata DESTINATION bin) install(PROGRAMS measuresdata/measuresdata-update DESTINATION bin) diff -Nru casacore-2.2.0/measures/apps/measuresdata/measuresdata.cc casacore-2.3.0/measures/apps/measuresdata/measuresdata.cc --- casacore-2.2.0/measures/apps/measuresdata/measuresdata.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/measures/apps/measuresdata/measuresdata.cc 2017-10-12 12:24:04.000000000 +0000 @@ -244,8 +244,8 @@ // IGRF const String IGRFFormat = String("") + -"a1 x2 i3 i3 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9" + -" f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9"; // 22 coefficients and SV +"a1 i3 i3 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7" + +" f7 f7 f7 f7 f7 f7 f7 f7 f7 f9 f10 f10 f9 f8"; // 24 coefficients and SV //*************************************************************************// @@ -477,15 +477,15 @@ //**********************************************************************// - { "IGRF", 2.0, 180.0, + { "IGRF", 2.0, 0.0, True, 13193.75, 1826.25, "geodetic/IGRF", "http", "ascii", &IGRF, IGRFCol, 0, vector(), vector(), vector(), - "IGRF10 reference magnetic field", "earthField", + "IGRF12 reference magnetic field", "earthField", False, "", vector(), &IGRFFormat, vector(), - { "www.ngdc.noaa.gov", "IAGA/vmod", "igrf10coeffs.txt" } }, + { "www.ngdc.noaa.gov", "IAGA/vmod", "igrf12coeffs.txt" } }, //**********************************************************************// @@ -1336,7 +1336,7 @@ vector field; uInt expsize = tprop.fdesc.back().start + tprop.fdesc.back().n; // Size for (uInt i=0; i 80) { + if (lines[i].size() > 180) { if (lines[i].size() < expsize) lines[i].resize(expsize, ' '); field.resize(0); for (uInt j=0; jkeyChangeAtLastNext(); +} + } //# NAMESPACE CASACORE - END diff -Nru casacore-2.2.0/ms/MeasurementSets/MSIter.h casacore-2.3.0/ms/MeasurementSets/MSIter.h --- casacore-2.2.0/ms/MeasurementSets/MSIter.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/ms/MeasurementSets/MSIter.h 2017-10-12 12:24:04.000000000 +0000 @@ -60,9 +60,9 @@ explicit MSInterval(Double interval) : interval_p(interval), offset_p(0) {} virtual ~MSInterval() {} virtual int comp(const void * obj1, const void * obj2) const; - Double getOffset() {return offset_p;} - void setOffset(Double offset) {offset_p=offset;} - Double getInterval() {return interval_p;} + Double getOffset() const {return offset_p;} + virtual void setOffset(Double offset) {offset_p=offset;} + Double getInterval() const {return interval_p;} void setInterval(Double interval) {interval_p=interval;} private: Double interval_p; @@ -216,14 +216,17 @@ void setInterval(Double timeInterval); // Reset iterator to start of data - void origin(); + virtual void origin(); // Return False if there is no more data - Bool more() const; + virtual Bool more() const; // Advance iterator through data - MSIter & operator++(int); - MSIter & operator++(); + virtual MSIter & operator++(int); + virtual MSIter & operator++(); + + // Report Name of slowest column that changes at end of current iteration + const String& keyChange() const; // Return the current Table iteration Table table() const; @@ -358,7 +361,7 @@ // advance the iteration void advance(); // set the iteration state - void setState(); + virtual void setState(); void setMSInfo(); void setArrayInfo(); void setFeedInfo(); diff -Nru casacore-2.2.0/ms/MeasurementSets/MSRange.cc casacore-2.3.0/ms/MeasurementSets/MSRange.cc --- casacore-2.2.0/ms/MeasurementSets/MSRange.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/ms/MeasurementSets/MSRange.cc 2017-10-12 12:24:04.000000000 +0000 @@ -1,4 +1,4 @@ -//# MSRange.cc: selection and iteration of an MS +///# MSRange.cc: selection and iteration of an MS //# Copyright (C) 1997,1998,1999,2000,2001,2002 //# Associated Universities, Inc. Washington DC, USA. //# @@ -311,7 +311,8 @@ break; case MSS::ROWS: { - // Glish doesn't like uInt (like me), so convert Int n=ms_p.nrow(); + // Glish doesn't like uInt (like me), so convert + Int n=ms_p.nrow(); Vector rowNumbers=ms_p.rowNumbers(); Vector rows(n); convertArray(rows,rowNumbers); diff -Nru casacore-2.2.0/ms/MeasurementSets/test/tMSIter.cc casacore-2.3.0/ms/MeasurementSets/test/tMSIter.cc --- casacore-2.2.0/ms/MeasurementSets/test/tMSIter.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/ms/MeasurementSets/test/tMSIter.cc 2017-10-12 12:24:04.000000000 +0000 @@ -142,6 +142,7 @@ << " a2=" << ROScalarColumn(msIter.table(), "ANTENNA2")(0) << " time=" << ROScalarColumn(msIter.table(), "TIME").getColumn() - 1e9 + << " keyCh=" << msIter.keyChange() << endl; } } diff -Nru casacore-2.2.0/ms/MeasurementSets/test/tMSIter.out casacore-2.3.0/ms/MeasurementSets/test/tMSIter.out --- casacore-2.2.0/ms/MeasurementSets/test/tMSIter.out 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/ms/MeasurementSets/test/tMSIter.out 2017-10-12 12:24:04.000000000 +0000 @@ -1,21 +1,21 @@ -nrow=2 a1=0 a2=0 time=[30, 90] -nrow=2 a1=0 a2=0 time=[150, 210] -nrow=1 a1=0 a2=0 time=[270] -nrow=2 a1=0 a2=1 time=[30, 90] -nrow=2 a1=0 a2=1 time=[150, 210] -nrow=1 a1=0 a2=1 time=[270] -nrow=2 a1=0 a2=2 time=[30, 90] -nrow=2 a1=0 a2=2 time=[150, 210] -nrow=1 a1=0 a2=2 time=[270] -nrow=2 a1=1 a2=1 time=[30, 90] -nrow=2 a1=1 a2=1 time=[150, 210] -nrow=1 a1=1 a2=1 time=[270] -nrow=2 a1=1 a2=2 time=[30, 90] -nrow=2 a1=1 a2=2 time=[150, 210] -nrow=1 a1=1 a2=2 time=[270] -nrow=2 a1=2 a2=2 time=[30, 90] -nrow=2 a1=2 a2=2 time=[150, 210] -nrow=1 a1=2 a2=2 time=[270] +nrow=2 a1=0 a2=0 time=[30, 90] keyCh=TIME +nrow=2 a1=0 a2=0 time=[150, 210] keyCh=TIME +nrow=1 a1=0 a2=0 time=[270] keyCh=ANTENNA2 +nrow=2 a1=0 a2=1 time=[30, 90] keyCh=TIME +nrow=2 a1=0 a2=1 time=[150, 210] keyCh=TIME +nrow=1 a1=0 a2=1 time=[270] keyCh=ANTENNA2 +nrow=2 a1=0 a2=2 time=[30, 90] keyCh=TIME +nrow=2 a1=0 a2=2 time=[150, 210] keyCh=TIME +nrow=1 a1=0 a2=2 time=[270] keyCh=ANTENNA1 +nrow=2 a1=1 a2=1 time=[30, 90] keyCh=TIME +nrow=2 a1=1 a2=1 time=[150, 210] keyCh=TIME +nrow=1 a1=1 a2=1 time=[270] keyCh=ANTENNA2 +nrow=2 a1=1 a2=2 time=[30, 90] keyCh=TIME +nrow=2 a1=1 a2=2 time=[150, 210] keyCh=TIME +nrow=1 a1=1 a2=2 time=[270] keyCh=ANTENNA1 +nrow=2 a1=2 a2=2 time=[30, 90] keyCh=TIME +nrow=2 a1=2 a2=2 time=[150, 210] keyCh=TIME +nrow=1 a1=2 a2=2 time=[270] keyCh= nrow=2 a1=0 a2=0 time=[30, 90] nrow=2 a1=0 a2=0 time=[150, 210] nrow=1 a1=0 a2=0 time=[270] diff -Nru casacore-2.2.0/ms/MSOper/MSMetaData.cc casacore-2.3.0/ms/MSOper/MSMetaData.cc --- casacore-2.2.0/ms/MSOper/MSMetaData.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/ms/MSOper/MSMetaData.cc 2017-10-12 12:24:04.000000000 +0000 @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -92,7 +93,8 @@ _taqlTempTable( File(ms->tableName()).exists() ? 0 : 1, ms ), _flagsColumn(), - _spwInfoStored(False), _forceSubScanPropsToCache(False) {} + _spwInfoStored(False), _forceSubScanPropsToCache(False), + _sourceTimes() {} MSMetaData::~MSMetaData() {} @@ -1567,7 +1569,7 @@ } vector MSMetaData::_getAntennaNames( - std::map& namesToIDsMap + std::map >& namesToIDsMap ) const { if (! _antennaNames.empty()) { namesToIDsMap = _antennaNameToIDMap; @@ -1584,9 +1586,8 @@ Vector::const_iterator name=names.begin(); name!=end; ++name, ++i ) { - namesToIDsMap[*name] = i; + namesToIDsMap[*name].insert(i); } - uInt mysize = names.size()*sizeof(uInt); for ( Vector::const_iterator name=names.begin(); @@ -1605,8 +1606,23 @@ std::map& namesToIDsMap, const vector& antennaIDs ) const { + namesToIDsMap.clear(); + std::map > allMap; + vector names = getAntennaNames(allMap, antennaIDs); + std::map >::const_iterator iter = allMap.begin(); + std::map >::const_iterator end = allMap.end(); + for (; iter!=end; ++iter) { + namesToIDsMap[iter->first] = *iter->second.rbegin(); + } + return names; +} + +vector MSMetaData::getAntennaNames( + std::map >& namesToIDsMap, + const vector& antennaIDs +) const { uInt nAnts = nAntennas(); - std::map allMap; + std::map > allMap; vector allNames = _getAntennaNames(allMap); if (antennaIDs.empty()) { namesToIDsMap = allMap; @@ -1626,35 +1642,37 @@ ) { String antName = allNames[*id]; names.push_back(antName); - namesToIDsMap[antName] = *id; + namesToIDsMap[antName].insert(*id); } return names; } -uInt MSMetaData::getAntennaID( +uInt MSMetaData::getAntennaID(const String& antennaName) const { + return *getAntennaIDs(antennaName).rbegin(); +} + +std::set MSMetaData::getAntennaIDs( const String& antennaName ) const { return getAntennaIDs(vector(1, antennaName))[0]; } -vector MSMetaData::getAntennaIDs( +vector > MSMetaData::getAntennaIDs( const vector& antennaNames ) const { - std::map namesToIDsMap; + std::map > namesToIDsMap; vector names = getAntennaNames(namesToIDsMap); vector::const_iterator end = antennaNames.end(); - std::map::const_iterator mapEnd = namesToIDsMap.end(); - vector ids; + std::map >::const_iterator mapEnd = namesToIDsMap.end(); + vector > ids; for ( vector::const_iterator name=antennaNames.begin(); name!=end; ++name ) { - std::map::const_iterator pair = namesToIDsMap.find(*name); - if (pair == mapEnd) { - throw AipsError( - _ORIGIN + "Unknown antenna " + *name - ); - } + std::map >::const_iterator pair = namesToIDsMap.find(*name); + ThrowIf( + pair == mapEnd, _ORIGIN + "Unknown antenna " + *name + ); ids.push_back(pair->second); } return ids; @@ -1730,8 +1748,21 @@ return myStationNames; } -vector MSMetaData::getAntennaStations(const vector& antennaNames) { - return getAntennaStations(getAntennaIDs(antennaNames)); +vector > MSMetaData::getAntennaStations(const vector& antennaNames) { + vector > ids = getAntennaIDs(antennaNames); + vector >::const_iterator iter = ids.begin(); + vector >::const_iterator end = ids.end(); + vector > stations; + for (; iter!=end; ++iter) { + std::set::const_iterator siter = iter->begin(); + std::set::const_iterator send = iter->end(); + vector myStations; + for (; siter!=send; ++siter) { + myStations.push_back(getAntennaStations(vector(1, *siter))[0]); + } + stations.push_back(myStations); + } + return stations; } vector MSMetaData::_getStationNames() { @@ -2936,6 +2967,19 @@ return myvec; } +SHARED_PTR > > MSMetaData::getSourceTimes() const { + if (_sourceTimes) { + return _sourceTimes; + } + String colName = MSSource::columnName(MSSource::TIME); + ScalarQuantColumn time(_ms->source(), colName); + SHARED_PTR > > col = time.getColumn(); + if (_cacheUpdated(_sizeof(*col))) { + _sourceTimes = col; + } + return col; +} + map MSMetaData::_getSourceInfo() const { // this method is responsible for setting _sourceInfo if (! _sourceInfo.empty()) { @@ -3339,7 +3383,7 @@ return antennaPositions; } -vector MSMetaData::getAntennaPositions ( +vector MSMetaData::getAntennaPositions( const vector& which ) const { vector allPos = _getAntennaPositions(); @@ -3361,19 +3405,32 @@ return output; } -vector MSMetaData::getAntennaPositions( +vector > MSMetaData::getAntennaPositions( const vector& names ) { - if (names.size() == 0) { - throw AipsError(_ORIGIN + "names cannot be empty"); + ThrowIf( + names.empty(), _ORIGIN + "names cannot be empty" + ); + vector > ids = getAntennaIDs(names); + vector >::const_iterator iter = ids.begin(); + vector >::const_iterator end = ids.end(); + vector > pos; + for (; iter!=end; ++iter) { + std::vector mypos; + std::set::const_iterator siter = iter->begin(); + std::set::const_iterator send = iter->end(); + for (; siter!=send; ++siter) { + mypos.push_back(getAntennaPositions(vector(1, *siter))[0]); + } + pos.push_back(mypos); } - return getAntennaPositions(getAntennaIDs(names)); + return pos; } -QVD MSMetaData::getAntennaOffset(uInt which) { - if (which >= nAntennas()) { - throw AipsError(_ORIGIN + "Out of range exception."); - } +QVD MSMetaData::getAntennaOffset(uInt which) const { + ThrowIf( + which >= nAntennas(), "Out of range exception." + ); return getAntennaOffsets()[which]; } @@ -3463,10 +3520,21 @@ QVD MSMetaData::getAntennaOffset( const String& name -) { - vector names(1); - names[0] = name; - return getAntennaOffset(getAntennaIDs(names)[0]); +) const { + return getAntennaOffsets(name)[0]; +} + +std::vector MSMetaData::getAntennaOffsets( + const String& name +) const { + std::set ids = getAntennaIDs(name); + std::vector offsets; + std::set::const_iterator iter = ids.begin(); + std::set::const_iterator end = ids.end(); + for(; iter!=end; ++iter) { + offsets.push_back(getAntennaOffset(*iter)); + } + return offsets; } Quantity MSMetaData::getEffectiveTotalExposureTime() { @@ -4828,6 +4896,17 @@ return intervals; } +MSMetaData::ColumnStats MSMetaData::getIntervalStatistics() const { + SHARED_PTR > > intervals = _getIntervals(); + Vector intInSec = intervals->getValue("s"); + ColumnStats stats; + ClassicalStatistics::const_iterator> cs; + cs.setData(intInSec.begin(), intInSec.size()); + cs.getMinMax(stats.min, stats.max); + stats.median = cs.getMedian(); + return stats; +} + vector MSMetaData::_getSpwInfo2( std::set& avgSpw, std::set& tdmSpw, std::set& fdmSpw, std::set& wvrSpw, std::set& sqldSpw diff -Nru casacore-2.2.0/ms/MSOper/MSMetaData.h casacore-2.3.0/ms/MSOper/MSMetaData.h --- casacore-2.2.0/ms/MSOper/MSMetaData.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/ms/MSOper/MSMetaData.h 2017-10-12 12:24:04.000000000 +0000 @@ -74,6 +74,12 @@ uInt nrows; }; + struct ColumnStats { + Double max; + Double median; + Double min; + }; + typedef std::map > FirstExposureTimeMap; struct SubScanProperties { @@ -117,22 +123,39 @@ // get the antenna diameters QVD getAntennaDiameters() const; - // get the antenna ID for the antenna with the specified name. + // if the antenna name appears multiple times in the antenna table, the *last* ID + // that it is associated with is returned. uInt getAntennaID(const String& antennaName) const; - vector getAntennaIDs(const vector& antennaNames) const; + // get all the antenna IDs for the antenna with the specified name. + std::set getAntennaIDs(const String& antennaName) const; + + // The returned IDs are ordered in the way they appear in the atenna table + vector > getAntennaIDs(const vector& antennaNames) const; + + // In the first instance of getAntennaNames, namesToID map will have the *last* ID + // of the antenna name, if it appears multiple times in the antenna table. In the second + // occurrence, namesToIDsMap will have the full set of IDs for antenna names that appear + // multiple times. - // get the name of the antenna for the specified antenna ID vector getAntennaNames( std::map& namesToIDsMap, const vector& antennaIDs=vector(0) ) const; + vector getAntennaNames( + std::map >& namesToIDsMap, + const vector& antennaIDs=vector(0) + ) const; + // get the antenna stations for the specified antenna IDs vector getAntennaStations(const vector& antennaIDs=vector()); - // get the antenna stations for the specified antenna names - vector getAntennaStations(const vector& antennaNames); + // get the antenna stations for the specified antenna names. The outer vector is ordered + // respective to antennaNames. Because an antenna name can appear more than once in + // the antenna table, the inner vector is ordered by row number in which that antenna name + // appears. + vector > getAntennaStations(const vector& antennaNames); // get the set of antenna IDs for the specified scan. std::set getAntennasForScan(const ScanKey& scan) const; @@ -205,6 +228,9 @@ // the row number in that table. But not in this case. vector getSourceTableSourceIDs() const; + // SOURCE.TIME + SHARED_PTR > > getSourceTimes() const; + // get a set of spectral windows for which the specified intent // applies. virtual std::set getSpwsForIntent(const String& intent); @@ -331,9 +357,15 @@ // offsets (elements 0, 1, and 2 respectively). The longitude and latitude offsets are // measured along the surface of a sphere centered at the earth's center and whose surface // intersects the position of the observatory. - QVD getAntennaOffset(uInt which); + QVD getAntennaOffset(uInt which) const; - QVD getAntennaOffset(const String& name); + // If the antenna name appears mulitple times, this will return the offset for the first + // occurrence of it in the antenna table + QVD getAntennaOffset(const String& name) const; + + // If the antenna name appears mulitple times, this will return all the offsets for it, + // in the order they appear in the antenna table + std::vector getAntennaOffsets(const String& name) const; vector getAntennaOffsets() const; @@ -344,7 +376,7 @@ ) const; // names cannot be empty. - vector getAntennaPositions(const vector& names); + vector > getAntennaPositions(const vector& names); // the first key in the returned map is the spectral window ID, the second is // the average interval for the specified scan for that spw. @@ -618,6 +650,11 @@ void setShowProgress(Bool b) { _showProgress = b; } + // get statistics related to the values of the INTERVAL column. Returned + // values are in seconds. All values in this column are used in the computation, + // including those which associated row flags may be set. + ColumnStats getIntervalStatistics() const; + private: struct ScanProperties { @@ -685,7 +722,7 @@ mutable std::map > _scanToStatesMap, _scanToFieldsMap, _scanToAntennasMap; mutable std::map > _fieldToStatesMap, _stateToFieldsMap, _sourceToFieldsMap; mutable std::map, uInt> _spwPolIDToDataDescIDMap; - mutable std::map _antennaNameToIDMap; + mutable std::map > _antennaNameToIDMap; mutable SHARED_PTR > _scanProperties; mutable SHARED_PTR > _subScanProperties; @@ -752,6 +789,7 @@ mutable std::map _sourceInfo; mutable SHARED_PTR > _ephemFields; + mutable SHARED_PTR > > _sourceTimes; // disallow copy constructor and = operator MSMetaData(const MSMetaData&); @@ -822,7 +860,7 @@ _generateSubScanPropsIfWanted() const; vector _getAntennaNames( - std::map& namesToIDsMap + std::map >& namesToIDsMap ) const; vector _getAntennaPositions() const; diff -Nru casacore-2.2.0/ms/MSOper/MSSummary.cc casacore-2.3.0/ms/MSOper/MSSummary.cc --- casacore-2.2.0/ms/MSOper/MSSummary.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/ms/MSOper/MSSummary.cc 2017-10-12 12:24:04.000000000 +0000 @@ -765,7 +765,7 @@ // Determine antennas present in the main table const std::set& antIds = _msmd->getUniqueAntennaIDs(); uInt nAnt = antIds.size(); - std::map namesToIDsMap; + std::map > namesToIDsMap; vector names = _msmd->getAntennaNames(namesToIDsMap); vector stations = _msmd->getAntennaStations(); if (verbose) { diff -Nru casacore-2.2.0/ms/MSOper/test/tMSMetaData.cc casacore-2.3.0/ms/MSOper/test/tMSMetaData.cc --- casacore-2.2.0/ms/MSOper/test/tMSMetaData.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/ms/MSOper/test/tMSMetaData.cc 2017-10-12 12:24:04.000000000 +0000 @@ -29,6 +29,7 @@ #include +#include #include #include #include @@ -528,19 +529,19 @@ for (uInt i=0; i ids(1); ids[0] = i; - std::map mymap; + std::map > mymap; AlwaysAssert( md.getAntennaNames(mymap, ids)[0] == expnames[i], AipsError ); } cout << "*** test getAntennaID()" << endl; - std::map mymap; + std::map > mymap; for (uInt i=0; i ids(1); ids[0] = i; AlwaysAssert( - md.getAntennaIDs(md.getAntennaNames(mymap, ids))[0]==i, + *md.getAntennaIDs(md.getAntennaNames(mymap, ids))[0].begin()==i, AipsError ); } @@ -1147,10 +1148,10 @@ names[0] = "DV02"; names[1] = "DV05"; names[2] = "DV03"; - stations = md.getAntennaStations(names); + vector > stationsByName = md.getAntennaStations(names); AlwaysAssert( - stations[0] == "A077" && stations[1] == "A082" - && stations[2] == "A137", AipsError + stationsByName[0][0] == "A077" && stationsByName[1][0] == "A082" + && stationsByName[2][0] == "A137", AipsError ); } { @@ -2518,6 +2519,22 @@ AlwaysAssert(spws == expec, AipsError); } { + cout << "*** test getSourceTimes()" << endl; + SHARED_PTR > > times = md.getSourceTimes(); + Vector v = times->getValue(); + AlwaysAssert(v.size() == 200, AipsError); + AlwaysAssert(times->getUnit() == "s", AipsError); + Vector expec(200, 7033098335); + AlwaysAssert(allNear(v, expec, 1e-10), AipsError); + } + { + cout << "*** test getIntervalStatistics()" << endl; + MSMetaData::ColumnStats stats = md.getIntervalStatistics(); + AlwaysAssert(near(stats.min, 1.008), AipsError); + AlwaysAssert(near(stats.max, 6.048), AipsError); + AlwaysAssert(near(stats.median, 1.008), AipsError); + } + { cout << "*** cache size " << md.getCache() << endl; } } diff -Nru casacore-2.2.0/ms/MSSel/MSFieldIndex.cc casacore-2.3.0/ms/MSSel/MSFieldIndex.cc --- casacore-2.2.0/ms/MSSel/MSFieldIndex.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/ms/MSSel/MSFieldIndex.cc 2017-10-12 12:24:04.000000000 +0000 @@ -93,17 +93,16 @@ throw(MSSelectionFieldParseError(Mesg.str().c_str())); } // cerr << "Pattern = " << strippedPattern << " Regex = " << reg.regexp() << endl; - IPosition sh(msFieldCols_p.name().getColumn().shape()); + Vector names=msFieldCols_p.name().getColumn(); + Vector flagRow=msFieldCols_p.flagRow().getColumn(); + IPosition sh(names.shape()); LogicalArray maskArray(sh,False); IPosition i=sh; for(i(0)=0;i(0)name(); @@ -862,6 +863,14 @@ maxis(ctr-1)=kw->asInt(); // cout << "**maxis=" << maxis << endl; } + else if(kwname.at(0,7)=="NO_STKD"){ + nStokes_p = kw->asInt(); +// cout << "**nStokes=" << nStokes_p << endl; + } + else if(kwname.at(0,7)=="NO_BAND"){ + nBand_p = kw->asInt(); +// cout << "**nBand=" << nBand_p << endl; + } else if(kwname.at(0,8)=="WEIGHTYP"){ weightypKwPresent_p = True; weightyp_p = kw->asString(); @@ -873,28 +882,14 @@ << LogIO::POST; } } - else if(kwname.at(0,6)=="WEIGHT"){ - weightKwPresent_p = True; - *itsLog << LogIO::WARN << "WEIGHT keyword in UV_DATA table presently not supported." - << LogIO::POST; - } } if(maxis.nelements()>1){ if(maxis(1)==2){ uv_data_hasWeights_p = False; - if(!weightKwPresent_p){ - *itsLog << LogIO::WARN << "MAXIS1 keyword == 2 in UV_DATA table AND WEIGHT keyword not present." - << endl << ". Will try to continue ..." << LogIO::POST; - } } else if(maxis(1)==3){ uv_data_hasWeights_p = True; - if(weightKwPresent_p){ - *itsLog << LogIO::WARN << "MAXIS1 keyword == 3 in UV_DATA table AND WEIGHT keyword present." - << endl << ". Will try to continue by ignoring WEIGHT keyword ..." << LogIO::POST; - weightKwPresent_p = False; - } } else{ uv_data_hasWeights_p = False; @@ -1841,6 +1836,8 @@ Int iFlux = getIndex(tType, "FLUX"); // get index for Integration time Int iInttim = getIndex(tType, "INTTIM"); + // get index for weight + Int iWeight = getIndex(tType, "WEIGHT"); /* cout << "iU=" << iU << endl; @@ -2062,8 +2059,10 @@ // cout<<" visReal="<< visReal << "visImag="<< visImag<(data_addr[iFlux])) + count++, sizeof(Float)); + if (uv_data_hasWeights_p) { + memcpy(&visWeight, (static_cast(data_addr[iFlux])) + count++, sizeof(Float)); + } else if (iWeight>=0) { + memcpy(&visWeight, (static_cast(data_addr[iWeight])) + ifno * nStokes_p + pol, sizeof(Float)); } //const Float wt = priGroup_p(count++); @@ -2107,11 +2106,10 @@ msc.data().put(putrow,vis); // single channel case: make weight and weightSpectrum identical. // multichannel case: weight should not be used. - if (nChan==1) { - const Vector weight(weightSpec.column(0).copy()); + if (nChan==1 || !uv_data_hasWeights_p) { + const Vector weight(weightSpec.column(0).copy()); msc.weight().put(putrow,weight); - } if(uv_data_hasWeights_p){ diff -Nru casacore-2.2.0/msfits/MSFits/FitsIDItoMS.h casacore-2.3.0/msfits/MSFits/FitsIDItoMS.h --- casacore-2.2.0/msfits/MSFits/FitsIDItoMS.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/msfits/MSFits/FitsIDItoMS.h 2017-10-12 12:24:04.000000000 +0000 @@ -298,10 +298,10 @@ Bool weather_hasWater_p; Bool weather_hasElectron_p; Bool uv_data_hasWeights_p; - Bool weightKwPresent_p; Bool weightypKwPresent_p; String weightyp_p; - Matrix weightsFromKW_p; + Int nStokes_p; + Int nBand_p; static SimpleOrderedMap antIdFromNo; // diff -Nru casacore-2.2.0/msfits/MSFits/MSFitsIDI.cc casacore-2.3.0/msfits/MSFits/MSFitsIDI.cc --- casacore-2.2.0/msfits/MSFits/MSFitsIDI.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/msfits/MSFits/MSFitsIDI.cc 2017-10-12 12:24:04.000000000 +0000 @@ -328,7 +328,8 @@ } } else{ // ignore this subtable - infits.skip_all(FITS::BinaryTableHDU); + if (infits.datasize() > 0) + infits.skip_all(FITS::BinaryTableHDU); } } } diff -Nru casacore-2.2.0/msfits/MSFits/MSFitsInput.cc casacore-2.3.0/msfits/MSFits/MSFitsInput.cc --- casacore-2.2.0/msfits/MSFits/MSFitsInput.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/msfits/MSFits/MSFitsInput.cc 2017-10-12 12:24:04.000000000 +0000 @@ -237,8 +237,9 @@ //------------------------------------------------------------ MSFitsInput::MSFitsInput(const String& msFile, const String& fitsFile, const Bool useNewStyle) : - _infile(0), _msc(0), _uniqueAnts(), _nAntRow(0), _restfreq(0), _addSourceTable(False), _log(LogOrigin( - "MSFitsInput", "MSFitsInput")), _newNameStyle(useNewStyle), _msCreated(False) { + _infile(0), _msc(0), _uniqueAnts(), _nAntRow(0), _restfreq(0), + _addSourceTable(False), _log(LogOrigin("MSFitsInput", "MSFitsInput")), + _newNameStyle(useNewStyle), _msCreated(False), _rotateAnts(False) { // First, lets verify that fitsfile exists and that it appears to be a // FITS file. File f(fitsFile); @@ -1840,7 +1841,6 @@ else if (_array == "IRAM_PDB" || _array == "IRAM PDB") { diameter = 15.0; } - MSAntennaColumns& ant(_msc->antenna()); ROScalarColumn name(anTab, "ANNAME"); ROScalarColumn mountType(anTab, "MNTSTA"); @@ -1853,22 +1853,37 @@ //If it has a column called DIAMETER ...make use of it if // any of the values are valid - Bool diamColFound = False; + Bool positiveDiamsFound = False; if (anTab.tableDesc().isColumn("DIAMETER")) { Vector tmpDiams = ROScalarColumn(anTab, "DIAMETER").getColumn(); if (anyGT(tmpDiams, 0.0f)) { antDiams = tmpDiams; - diamColFound = True; + positiveDiamsFound = True; } } - if (! diamColFound && ((_array == "OVRO") || (_array == "CARMA"))) { - for (Int i = 0; i < nAnt; i++) { - //Crystal Brogan has guaranteed that it is always this order - if (id(i) <= 6) { - antDiams(i) = 10.4; - } - else { - antDiams(i) = 6.1; + if (! positiveDiamsFound) { + if (_array == "OVRO" || _array == "CARMA") { + for (Int i = 0; i < nAnt; ++i) { + //Crystal Brogan has guaranteed that it is always this order + antDiams[i] = id(i) <= 6 ? 10.4 : 6.1; + } + } + else if (_array == "ALMA") { + // CAS-8875, algorithm from Jen Meyer + for (Int i = 0; i < nAnt; ++i) { + const String& myName = name(i); + if (myName.startsWith("CM")) { + antDiams[i] = 7.0; + } + else if ( + myName.startsWith("DA") || myName.startsWith("DV") + || myName.startsWith("PM") + ) { + antDiams[i] = 12.0; + } + else { + antDiams[i] = diameter; + } } } } diff -Nru casacore-2.2.0/msfits/MSFits/MSFitsOutput.cc casacore-2.3.0/msfits/MSFits/MSFitsOutput.cc --- casacore-2.2.0/msfits/MSFits/MSFitsOutput.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/msfits/MSFits/MSFitsOutput.cc 2017-10-12 12:24:04.000000000 +0000 @@ -1678,7 +1678,7 @@ /// desc.addField("POLCALB", TpArrayFloat, // POLCALB /// IPosition(1,0)); desc.addField("POLCALB", TpFloat); // POLCALB - + desc.addField("DIAMETER", TpFloat); MSAntenna antennaTable = ms.antenna(); ROMSAntennaColumns antennaCols(antennaTable); @@ -1714,12 +1714,11 @@ RecordFieldPtr staxof(writer.row(), "STAXOF"); RecordFieldPtr poltya(writer.row(), "POLTYA"); RecordFieldPtr polaa(writer.row(), "POLAA"); - /// RecordFieldPtr< Array > polcala(writer.row(), "POLCALA"); RecordFieldPtr polcala(writer.row(), "POLCALA"); RecordFieldPtr poltyb(writer.row(), "POLTYB"); RecordFieldPtr polab(writer.row(), "POLAB"); - /// RecordFieldPtr< Array > polcalb(writer.row(), "POLCALB"); RecordFieldPtr polcalb(writer.row(), "POLCALB"); + RecordFieldPtr diam(writer.row(), "DIAMETER"); // Set the ones we're not going to change once *orbparm = 0.0; @@ -1739,6 +1738,7 @@ // Also: if writeStation==True use station names instead of antenna names // for the output fits file (input fits file tends to have this). Vector anames = antid.getColumn(); + Vector antDiams = msmd.getAntennaDiameters().getValue("m"); if (anames.nelements() > 0) { if (writeStation || allEQ(anames, anames(0))) { Vector stations = inantname.getColumn(); @@ -1825,6 +1825,7 @@ << "Could not find polarization types for antenna " << antnum << LogIO::POST; } + *diam = antDiams[antnum]; writer.write(); } } diff -Nru casacore-2.2.0/python/CMakeLists.txt casacore-2.3.0/python/CMakeLists.txt --- casacore-2.2.0/python/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/python/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -66,7 +66,7 @@ Converters/PycValueHolder.cc ) -target_link_libraries (casa_python casa_casa ${PYTHON2_Boost_LIBRARIES} ${PYTHON2_LIBRARIES}) +target_link_libraries (casa_python casa_casa ${PYTHON2_Boost_LIBRARIES} ${PYTHON2_LIBRARIES} ${CASACORE_ARCH_LIBS}) install (TARGETS casa_python RUNTIME DESTINATION bin diff -Nru casacore-2.2.0/README.md casacore-2.3.0/README.md --- casacore-2.2.0/README.md 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/README.md 2017-10-12 12:24:04.000000000 +0000 @@ -113,20 +113,9 @@ If you run into problems with boost libraries, try setting `-DBoost_NO_BOOST_CMAKE=True`. This will be necessary if you have the libraries from NRAO casa in your PATH or LD_LIBRARY_PATH. -## Ubuntu 14.04 packages - -If you run Ubuntu 14.04 you can use precompiled binary packages - -https://launchpad.net/~radio-astro/+archive/ubuntu/main - -installation commands: -``` -sudo apt-get install software-properties-common -sudo add-apt-repository ppa:radio-astro/main -sudo apt-get update -sudo apt-get install casacore2 casacore-data -``` +## Ubuntu packages +Casacore is part of the [kern suite](http://kernsuite.info), which supplies precompiled binaries for Ubuntu 14.04 and 16.04 # Documentation diff -Nru casacore-2.2.0/scimath/CMakeLists.txt casacore-2.3.0/scimath/CMakeLists.txt --- casacore-2.2.0/scimath/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -35,9 +35,9 @@ ) if (FFTW3_FOUND) - target_link_libraries (casa_scimath casa_scimath_f ${FFTW3_LIBRARIES}) + target_link_libraries (casa_scimath casa_scimath_f ${FFTW3_LIBRARIES} ${CASACORE_ARCH_LIBS}) else (FFTW3_FOUND) - target_link_libraries (casa_scimath casa_scimath_f) + target_link_libraries (casa_scimath casa_scimath_f ${CASACORE_ARCH_LIBS}) endif (FFTW3_FOUND) install (TARGETS casa_scimath diff -Nru casacore-2.2.0/scimath/Mathematics/ChauvenetCriterionStatistics.h casacore-2.3.0/scimath/Mathematics/ChauvenetCriterionStatistics.h --- casacore-2.2.0/scimath/Mathematics/ChauvenetCriterionStatistics.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/ChauvenetCriterionStatistics.h 2017-10-12 12:24:04.000000000 +0000 @@ -42,53 +42,53 @@ // criterion, until the specified maximum number of iterations is reached, or the final // iteration results in no additional points being discarded. // Alternatively, one can specify a z score which indicates the number of standard deviations -// beyond which to discard points. In this case, no iterating is done. +// beyond which to discard points, which is held fixed while iterating. template class ChauvenetCriterionStatistics - : public ConstrainedRangeStatistics { + : public ConstrainedRangeStatistics { public: - // If zscore is not negative, use that value to discard outliers beyond - // zscore standard deviations from the mean, and compute statistics based on the - // remaining data. If zscore is negative, use Chauvenet's Criterion to - // determine which outliers to discard. maxIterations is the maximum - // number of iterations to use before stopping. If negative, continue iterating until the - // set zscore or Chauvenet's criterion is met (ie that there are no remaining outliers). - ChauvenetCriterionStatistics(Double zscore=-1, Int maxIterations=0); - - virtual ~ChauvenetCriterionStatistics(); - - // copy semantics - ChauvenetCriterionStatistics& operator=( - const ChauvenetCriterionStatistics& other - ); - - // get the algorithm that this object uses for computing stats - virtual StatisticsData::ALGORITHM algorithm() const { - return StatisticsData::CHAUVENETCRITERION; - }; - - // reset object to initial state. Clears all private fields including data, - // accumulators, global range. It does not affect the fence factor (_f), which was - // set at object construction. - virtual void reset(); - - // This class does not allow statistics to be calculated as datasets are added, so - // an exception will be thrown if c is True. - void setCalculateAsAdded(Bool c); + // If zscore is not negative, use that value to discard outliers beyond + // zscore standard deviations from the mean, and compute statistics based on the + // remaining data. If zscore is negative, use Chauvenet's Criterion to + // determine which outliers to discard. maxIterations is the maximum + // number of iterations to use before stopping. If negative, continue iterating until the + // set zscore or Chauvenet's criterion is met (ie that there are no remaining outliers). + ChauvenetCriterionStatistics(Double zscore=-1, Int maxIterations=0); + + virtual ~ChauvenetCriterionStatistics(); + + // copy semantics + ChauvenetCriterionStatistics& operator=( + const ChauvenetCriterionStatistics& other + ); + + // get the algorithm that this object uses for computing stats + virtual StatisticsData::ALGORITHM algorithm() const { + return StatisticsData::CHAUVENETCRITERION; + }; + + // reset object to initial state. Clears all private fields including data, + // accumulators, global range. It does not affect the fence factor (_f), which was + // set at object construction. + virtual void reset(); + + // This class does not allow statistics to be calculated as datasets are added, so + // an exception will be thrown if c is True. + void setCalculateAsAdded(Bool c); - // get the number of iterations - uInt getNiter() const { return _niter; } + // get the number of iterations + uInt getNiter() const { return _niter; } private: - Double _zscore; - Int _maxIterations; - Bool _rangeIsSet; - uInt _niter; + Double _zscore; + Int _maxIterations; + Bool _rangeIsSet; + uInt _niter; - void _setRange(); + void _setRange(); }; } diff -Nru casacore-2.2.0/scimath/Mathematics/ChauvenetCriterionStatistics.tcc casacore-2.3.0/scimath/Mathematics/ChauvenetCriterionStatistics.tcc --- casacore-2.2.0/scimath/Mathematics/ChauvenetCriterionStatistics.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/ChauvenetCriterionStatistics.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -37,7 +37,7 @@ CASA_STATD ChauvenetCriterionStatistics::ChauvenetCriterionStatistics( - Double zscore, Int maxIterations + Double zscore, Int maxIterations ) : ConstrainedRangeStatistics(), _zscore(zscore), _maxIterations(maxIterations), _rangeIsSet(False), _niter(0) {} @@ -48,7 +48,7 @@ CASA_STATD ChauvenetCriterionStatistics& ChauvenetCriterionStatistics::operator=( - const ChauvenetCriterionStatistics& other + const ChauvenetCriterionStatistics& other ) { if (this == &other) { return *this; @@ -62,50 +62,51 @@ CASA_STATD void ChauvenetCriterionStatistics::reset() { - ConstrainedRangeStatistics::reset(); - _rangeIsSet = False; + ConstrainedRangeStatistics::reset(); + _rangeIsSet = False; + _niter = 0; } CASA_STATD void ChauvenetCriterionStatistics::setCalculateAsAdded( - Bool c + Bool c ) { - ThrowIf( - c, "ChauvenetCriterionStatistics does not support calculating statistics " - "incrementally as data sets are added" - ); + ThrowIf( + c, "ChauvenetCriterionStatistics does not support calculating statistics " + "incrementally as data sets are added" + ); } CASA_STATD void ChauvenetCriterionStatistics::_setRange() { - if (_rangeIsSet) { - return; - } - uInt maxI = _maxIterations >= 0 ? _maxIterations : 1000; - uInt prevNpts = 0; - StatsData sd; - while (_niter <= maxI) { - if (_niter == 0) { - ClassicalStatistics cs(*this); - sd = cs.getStatistics(); - } - else { - sd = this->getStatistics(); - if ((uInt64)sd.npts == prevNpts) { - break; - } - } - Double zScore = _zscore >= 0 ? _zscore : ZScoreCalculator::getMaxZScore((uInt64)sd.npts); - CountedPtr > range = new std::pair( - sd.mean - zScore*sd.stddev, sd.mean + zScore*sd.stddev - ); - ConstrainedRangeStatistics::_setRange(range); - // _rangeIsSet is set here to prevent infinite recursion on next loop iteration - _rangeIsSet = True; - prevNpts = (uInt64)sd.npts; - ++_niter; - } - --_niter; + if (_rangeIsSet) { + return; + } + uInt maxI = _maxIterations >= 0 ? _maxIterations : 1000; + uInt prevNpts = 0; + StatsData sd; + while (_niter <= maxI) { + if (_niter == 0) { + ClassicalStatistics cs(*this); + sd = cs.getStatistics(); + } + else { + sd = this->getStatistics(); + if ((uInt64)sd.npts == prevNpts) { + break; + } + } + Double zScore = _zscore >= 0 ? _zscore : ZScoreCalculator::getMaxZScore((uInt64)sd.npts); + CountedPtr > range = new std::pair( + sd.mean - zScore*sd.stddev, sd.mean + zScore*sd.stddev + ); + ConstrainedRangeStatistics::_setRange(range); + // _rangeIsSet is set here to prevent infinite recursion on next loop iteration + _rangeIsSet = True; + prevNpts = (uInt64)sd.npts; + ++_niter; + } + --_niter; } } diff -Nru casacore-2.2.0/scimath/Mathematics/ClassicalStatistics.h casacore-2.3.0/scimath/Mathematics/ClassicalStatistics.h --- casacore-2.2.0/scimath/Mathematics/ClassicalStatistics.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/ClassicalStatistics.h 2017-10-12 12:24:04.000000000 +0000 @@ -267,8 +267,6 @@ void _addData(); - void _clearData(); - void _clearStats(); // scan dataset(s) to find min and max diff -Nru casacore-2.2.0/scimath/Mathematics/ClassicalStatistics.tcc casacore-2.3.0/scimath/Mathematics/ClassicalStatistics.tcc --- casacore-2.2.0/scimath/Mathematics/ClassicalStatistics.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/ClassicalStatistics.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -303,11 +303,6 @@ } CASA_STATD -void ClassicalStatistics::reset() { - _clearData(); -} - -CASA_STATD void ClassicalStatistics::setCalculateAsAdded( Bool c ) { @@ -361,14 +356,14 @@ _hasData = True; if (_calculateAsAdded) { _getStatistics(); - StatisticsAlgorithm::_clearData(); + StatisticsAlgorithm::reset(); } } CASA_STATD -void ClassicalStatistics::_clearData() { +void ClassicalStatistics::reset() { _clearStats(); - StatisticsAlgorithm::_clearData(); + StatisticsAlgorithm::reset(); _hasData = False; } @@ -434,16 +429,43 @@ AccumType ClassicalStatistics::_getStatistic( StatisticsData::STATS stat ) { - AccumType value; - Record r = toRecord(_getStatistics()); - String statString = StatisticsData::toString(stat); - ThrowIf( - ! r.isDefined(statString), - "Logic Error: stat " + statString + " is not defined. " - "Please file a defect report" - ); - r.get(statString, value); - return value; + switch (stat) { + case StatisticsData::MEDIAN: + return this->getMedian(); + case StatisticsData::MEDABSDEVMED: + return this->getMedianAbsDevMed(); + case StatisticsData::FIRST_QUARTILE: + { + std::set f; + f.insert(0.25); + return this->getQuantiles(f)[0.25]; + } + case StatisticsData::THIRD_QUARTILE: + { + std::set f; + f.insert(0.75); + return this->getQuantiles(f)[0.75]; + } + case StatisticsData::INNER_QUARTILE_RANGE: + { + std::set f; + f.insert(0.25); + f.insert(0.75); + std::map qs = this->getQuantiles(f); + return qs[0.75] - qs[0.25]; + } + default: + AccumType value; + Record r = toRecord(_getStatistics()); + String statString = StatisticsData::toString(stat); + ThrowIf( + ! r.isDefined(statString), + "Logic Error: stat " + statString + " is not defined. " + "Please file a defect report" + ); + r.get(statString, value); + return value; + } } CASA_STATD diff -Nru casacore-2.2.0/scimath/Mathematics/Convolver.tcc casacore-2.3.0/scimath/Mathematics/Convolver.tcc --- casacore-2.2.0/scimath/Mathematics/Convolver.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/Convolver.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -62,6 +62,7 @@ thePsf = other.thePsf; theFFT = other.theFFT; theIFFT = other.theIFFT; + valid = other.valid; doFast_p=False; } @@ -78,6 +79,7 @@ thePsf = other.thePsf; theFFT = other.theFFT; theIFFT = other.theIFFT; + valid = other.valid; doFast_p=False; } return *this; diff -Nru casacore-2.2.0/scimath/Mathematics/FitToHalfStatistics.h casacore-2.3.0/scimath/Mathematics/FitToHalfStatistics.h --- casacore-2.2.0/scimath/Mathematics/FitToHalfStatistics.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/FitToHalfStatistics.h 2017-10-12 12:24:04.000000000 +0000 @@ -153,8 +153,6 @@ protected: - virtual void _clearData(); - virtual StatsData _getInitialStats() const; StatsData _getStatistics(); diff -Nru casacore-2.2.0/scimath/Mathematics/FitToHalfStatistics.tcc casacore-2.3.0/scimath/Mathematics/FitToHalfStatistics.tcc --- casacore-2.2.0/scimath/Mathematics/FitToHalfStatistics.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/FitToHalfStatistics.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -315,11 +315,6 @@ } CASA_STATD -void FitToHalfStatistics::reset() { - _clearData(); -} - -CASA_STATD void FitToHalfStatistics::setCalculateAsAdded( Bool c ) { @@ -330,13 +325,11 @@ } CASA_STATD -void FitToHalfStatistics::_clearData() { +void FitToHalfStatistics::reset() { _doMedAbsDevMed = False; - StatsData oldStats = copy(_statsData); _statsData = initializeStatsData(); - _statsData.mean = oldStats.mean; - _statsData.median = oldStats.median.null() ? NULL : new AccumType(*oldStats.median); - ConstrainedRangeStatistics::_clearData(); + _rangeIsSet = False; + ConstrainedRangeStatistics::reset(); } CASA_STATD diff -Nru casacore-2.2.0/scimath/Mathematics/GaussianBeam.cc casacore-2.3.0/scimath/Mathematics/GaussianBeam.cc --- casacore-2.2.0/scimath/Mathematics/GaussianBeam.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/GaussianBeam.cc 2017-10-12 12:24:04.000000000 +0000 @@ -36,258 +36,261 @@ GaussianBeam::GaussianBeam() : _major(Quantity(0, "arcsec")), - _minor(Quantity(0, "arcsec")), _pa(Quantity(0, "deg")) { + _minor(Quantity(0, "arcsec")), _pa(Quantity(0, "deg")) { } GaussianBeam::GaussianBeam( - const Quantity& major, const Quantity& minor, - const Quantity& pa + const Quantity& major, const Quantity& minor, + const Quantity& pa ) { - setMajorMinor(major, minor); - setPA(pa); + setMajorMinor(major, minor); + setPA(pa); } GaussianBeam::GaussianBeam( - const Vector& parms + const Vector& parms ) { - if (parms.size() != 3) { - throw AipsError( - "GaussianBeam(const Vector& parms): parms must have exactly three elements" - ); - } - setMajorMinor(parms[0], parms[1]); - setPA(parms[2]); + if (parms.size() != 3) { + throw AipsError( + "GaussianBeam(const Vector& parms): parms must have exactly three elements" + ); + } + setMajorMinor(parms[0], parms[1]); + setPA(parms[2]); } GaussianBeam::GaussianBeam(const GaussianBeam& other) : - _major(other._major), _minor(other._minor), - _pa(other._pa) {} + _major(other._major), _minor(other._minor), + _pa(other._pa) {} GaussianBeam::~GaussianBeam() {} GaussianBeam& GaussianBeam::operator=(const GaussianBeam& other) { - if (this != &other) { - _major = other._major; - _minor = other._minor; - _pa = other._pa; - } - return *this; + if (this != &other) { + _major = other._major; + _minor = other._minor; + _pa = other._pa; + } + return *this; } Bool GaussianBeam::operator==(const GaussianBeam& other) const { - return _major == other._major && _minor == other._minor - && _pa == other._pa; - /* - return _major.getValue("rad") == other._major.getValue("rad") - && _minor.getValue("rad") == other._minor.getValue("rad") - && getPA(True).getValue("rad") == other.getPA(True).getValue("rad"); - */ + return _major == other._major && _minor == other._minor + && _pa == other._pa; + /* + return _major.getValue("rad") == other._major.getValue("rad") + && _minor.getValue("rad") == other._minor.getValue("rad") + && getPA(True).getValue("rad") == other.getPA(True).getValue("rad"); + */ } Bool GaussianBeam::operator!=(const GaussianBeam& other) const { - return ! operator==(other); + return ! operator==(other); } const Quantity& GaussianBeam::getMajor() const { - return _major; + return _major; } Double GaussianBeam::getMajor(const Unit& u) const { - return _major.getValue(u); + return _major.getValue(u); } const Quantity& GaussianBeam::getMinor() const { - return _minor; + return _minor; } Double GaussianBeam::getMinor(const Unit& u) const { - return _minor.getValue(u); + return _minor.getValue(u); } Quantity GaussianBeam::getPA(const Bool unwrap) const { - if ( - unwrap - && ( - _pa > QC::qTurn || _pa <= -QC::qTurn - ) - ) { - Quantity pa((fmod(_pa.getValue("deg"), 180)), "deg"); - if (pa > QC::qTurn) { - pa -= QC::hTurn; - pa.convert(_pa.getUnit()); - return pa; - } - } - return _pa; + if (unwrap) { + return _unwrap(_pa); + } + return _pa; } Double GaussianBeam::getPA(const Unit& u, const Bool unwrap) const { - return getPA(unwrap).getValue(u); + return getPA(unwrap).getValue(u); +} + +Quantity GaussianBeam::_unwrap(const Quantity& pa) { + if (pa > QC::qTurn || pa <= -QC::qTurn) { + Quantity upa((fmod(pa.getValue("deg"), 180)), "deg"); + if (upa > QC::qTurn) { + upa -= QC::hTurn; + } + else if (upa <= -QC::qTurn) { + upa += QC::hTurn; + } + upa.convert(pa.getUnit()); + return upa; + } + return pa; } void GaussianBeam::setMajorMinor( - const Quantity& majAx, const Quantity& minAx + const Quantity& majAx, const Quantity& minAx ) { - static ostringstream oss; - ThrowIf( - majAx.getValue() < 0, - "Major axis cannot be less than zero." - ); - ThrowIf( - minAx.getValue() < 0, - "Minor axis cannot be less than zero." - ); - ThrowIf ( - ! majAx.isConform("rad"), - "Major axis must have angular units (" - + majAx.getUnit() + " is not)." - ); - ThrowIf ( - ! minAx.isConform("rad"), - "Major axis must have angular units (" - + minAx.getUnit() + " is not)." - ); - ThrowIf( - majAx < minAx, - "Major axis must be greater or equal to minor axis" - ); - _major = majAx; - _minor = minAx; -} - -void GaussianBeam::setPA(const Quantity& pa) { - if (! pa.isConform("rad")) { - ostringstream oss; - oss << className() << "::" << __FUNCTION__; - oss << ": Position angle must have angular units (" - << pa.getUnit() << " is not)."; - throw AipsError(oss.str()); - } - _pa = pa; + static ostringstream oss; + ThrowIf( + majAx.getValue() < 0, + "Major axis cannot be less than zero." + ); + ThrowIf( + minAx.getValue() < 0, + "Minor axis cannot be less than zero." + ); + ThrowIf ( + ! majAx.isConform("rad"), + "Major axis must have angular units (" + + majAx.getUnit() + " is not)." + ); + ThrowIf ( + ! minAx.isConform("rad"), + "Major axis must have angular units (" + + minAx.getUnit() + " is not)." + ); + ThrowIf( + majAx < minAx, + "Major axis must be greater or equal to minor axis" + ); + _major = majAx; + _minor = minAx; +} + +void GaussianBeam::setPA(const Quantity& pa, Bool unwrap) { + ThrowIf( + ! pa.isConform("rad"), + "Position angle must have angular units (" + + pa.getUnit() + " is not)." + ); + _pa = unwrap ? _unwrap(pa) : pa; } Bool GaussianBeam::isNull() const { - return _major.getValue() == 0 || _minor.getValue() == 0; + return _major.getValue() == 0 || _minor.getValue() == 0; } Double GaussianBeam::getArea(const Unit& unit) const { // NOTE we never want to return a Qauntity because of the // nonstandard handling of solid angle units in CASA Quantity qunit(1, unit); - if (qunit.isConform("sr") || qunit.isConform("rad2")) { - static const Double coeff = C::pi/(4*C::ln2); + if (qunit.isConform("sr") || qunit.isConform("rad2")) { + static const Double coeff = C::pi/(4*C::ln2); return coeff * (_major * _minor).getValue(unit); - } - else { - ostringstream oss; - oss << className() << "::" << __FUNCTION__ - << ": Unit " << unit.getName() << " is not a solid angle."; - throw AipsError(oss.str()); - } + } + else { + ostringstream oss; + oss << className() << "::" << __FUNCTION__ + << ": Unit " << unit.getName() << " is not a solid angle."; + throw AipsError(oss.str()); + } } const String& GaussianBeam::className() { - static const String c = "GaussianBeam"; - return c; + static const String c = "GaussianBeam"; + return c; } Record GaussianBeam::toRecord() const { - Record outRec; - QuantumHolder qh(_major); - Record tmp; - String error; - // there's no need for error checking, this object holds bona-fide quantities. - qh.toRecord(error, tmp); - outRec.defineRecord("major", tmp); - qh = QuantumHolder(_minor); - qh.toRecord(error, tmp); - outRec.defineRecord("minor", tmp); - qh = QuantumHolder(_pa); - qh.toRecord(error, tmp); - outRec.defineRecord("positionangle", tmp); - return outRec; + Record outRec; + QuantumHolder qh(_major); + Record tmp; + String error; + // there's no need for error checking, this object holds bona-fide quantities. + qh.toRecord(error, tmp); + outRec.defineRecord("major", tmp); + qh = QuantumHolder(_minor); + qh.toRecord(error, tmp); + outRec.defineRecord("minor", tmp); + qh = QuantumHolder(_pa); + qh.toRecord(error, tmp); + outRec.defineRecord("positionangle", tmp); + return outRec; } GaussianBeam GaussianBeam::fromRecord( - const Record& rec + const Record& rec ) { - if (rec.nfields() != 3) { - throw AipsError("Beam record does not contain 3 fields"); - } - QuantumHolder qh; - if (! rec.isDefined("major")) { - throw AipsError("Field major missing from restoring beam record"); - } - const RecordInterface& subRec0 = rec.asRecord("major"); - String error; - if (! qh.fromRecord(error, subRec0)) { - throw AipsError(error); - } - Quantity major = qh.asQuantumDouble(); - - - if (! rec.isDefined("minor")) { - throw AipsError("Field minor missing from restoring beam record"); - } - const RecordInterface& subRec1 = rec.asRecord("minor"); - if (! qh.fromRecord(error, subRec1)) { - throw AipsError(error); - } - Quantity minor = qh.asQuantumDouble(); - - if (! rec.isDefined("positionangle")) { - throw AipsError("Field positionangle missing from restoring beam record"); - } - const RecordInterface& subRec2 = rec.asRecord("positionangle"); - if (! qh.fromRecord(error, subRec2)) { - throw AipsError(error); - } - Quantity pa = qh.asQuantumDouble(); - return GaussianBeam(major, minor, pa); + if (rec.nfields() != 3) { + throw AipsError("Beam record does not contain 3 fields"); + } + QuantumHolder qh; + if (! rec.isDefined("major")) { + throw AipsError("Field major missing from restoring beam record"); + } + const RecordInterface& subRec0 = rec.asRecord("major"); + String error; + if (! qh.fromRecord(error, subRec0)) { + throw AipsError(error); + } + Quantity major = qh.asQuantumDouble(); + + + if (! rec.isDefined("minor")) { + throw AipsError("Field minor missing from restoring beam record"); + } + const RecordInterface& subRec1 = rec.asRecord("minor"); + if (! qh.fromRecord(error, subRec1)) { + throw AipsError(error); + } + Quantity minor = qh.asQuantumDouble(); + + if (! rec.isDefined("positionangle")) { + throw AipsError("Field positionangle missing from restoring beam record"); + } + const RecordInterface& subRec2 = rec.asRecord("positionangle"); + if (! qh.fromRecord(error, subRec2)) { + throw AipsError(error); + } + Quantity pa = qh.asQuantumDouble(); + return GaussianBeam(major, minor, pa); } ostream &operator<<(ostream &os, const GaussianBeam& beam) { - os << "major: " << beam.getMajor() << ", minor: " << beam.getMinor() - << ", pa: " << beam.getPA(True); - return os; + os << "major: " << beam.getMajor() << ", minor: " << beam.getMinor() + << ", pa: " << beam.getPA(True); + return os; } LogIO &operator<<(LogIO &os, const GaussianBeam& beam) { - ostringstream oss; - oss << beam; - os << oss.str(); - return os; + ostringstream oss; + oss << beam; + os << oss.str(); + return os; } Vector GaussianBeam::toVector(const Bool unwrap) const { - Vector beam(3); - beam[0] = _major; - beam[1] = _minor; - beam[2] = unwrap ? getPA(True) : _pa; - return beam; + Vector beam(3); + beam[0] = _major; + beam[1] = _minor; + beam[2] = unwrap ? getPA(True) : _pa; + return beam; } void GaussianBeam::convert( - const String& majUnit, const String& minUnit, const String& paUnit + const String& majUnit, const String& minUnit, const String& paUnit ) { - _major.convert(majUnit); - _minor.convert(minUnit); - _pa.convert(paUnit); + _major.convert(majUnit); + _minor.convert(minUnit); + _pa.convert(paUnit); } Bool near( - const GaussianBeam& left, const GaussianBeam& other, - const Double relWidthTol, const Quantity& absPATol + const GaussianBeam& left, const GaussianBeam& other, + const Double relWidthTol, const Quantity& absPATol ) { - if (! absPATol.isConform("rad")) { - throw AipsError( - "GaussianBeam::near(): absPATol does not have angular units" - ); - } - return casacore::near(left.getMajor(), other.getMajor(), relWidthTol) - && casacore::near(left.getMinor(), other.getMinor(), relWidthTol) - && casacore::nearAbs(left.getPA(True), other.getPA(True), absPATol); + if (! absPATol.isConform("rad")) { + throw AipsError( + "GaussianBeam::near(): absPATol does not have angular units" + ); + } + return casacore::near(left.getMajor(), other.getMajor(), relWidthTol) + && casacore::near(left.getMinor(), other.getMinor(), relWidthTol) + && casacore::nearAbs(left.getPA(True), other.getPA(True), absPATol); } } diff -Nru casacore-2.2.0/scimath/Mathematics/GaussianBeam.h casacore-2.3.0/scimath/Mathematics/GaussianBeam.h --- casacore-2.2.0/scimath/Mathematics/GaussianBeam.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/GaussianBeam.h 2017-10-12 12:24:04.000000000 +0000 @@ -68,89 +68,94 @@ class GaussianBeam { public: - static const GaussianBeam NULL_BEAM; + static const GaussianBeam NULL_BEAM; - // create a beam with all quantities zero (a null beam). - GaussianBeam(); + // create a beam with all quantities zero (a null beam). + GaussianBeam(); - // Construct a beam from a set of Quantities. If minor > major - // an exception is thrown. If any units are not angular, an - // exception is thrown - GaussianBeam( - const Quantity& major, const Quantity& minor, - const Quantity& pa - ); + // Construct a beam from a set of Quantities. If minor > major + // an exception is thrown. If any units are not angular, an + // exception is thrown + GaussianBeam( + const Quantity& major, const Quantity& minor, + const Quantity& pa + ); - // Construct a beam from a 3-Vector of Quantities representing - // the major axis, the minor axis and the position angle (in that order). - // If parms[1] > parms[0] (minor axis > major axis), - // an exception is thrown. If any units are not angular, an - // exception is thrown - GaussianBeam( - const Vector& parms - ); + // Construct a beam from a 3-Vector of Quantities representing + // the major axis, the minor axis and the position angle (in that order). + // If parms[1] > parms[0] (minor axis > major axis), + // an exception is thrown. If any units are not angular, an + // exception is thrown + GaussianBeam( + const Vector& parms + ); - GaussianBeam(const GaussianBeam& other); + GaussianBeam(const GaussianBeam& other); - ~GaussianBeam(); + ~GaussianBeam(); - GaussianBeam& operator=(const GaussianBeam& other); + GaussianBeam& operator=(const GaussianBeam& other); - Bool operator==(const GaussianBeam& other) const; + Bool operator==(const GaussianBeam& other) const; - Bool operator!=(const GaussianBeam& other) const; + Bool operator!=(const GaussianBeam& other) const; - // returns the major axis in the same units as it had at construction - const Quantity& getMajor() const; + // returns the major axis in the same units as it had at construction + const Quantity& getMajor() const; - // returns the value portion of the major axis in the specified units - Double getMajor(const Unit& u) const; + // returns the value portion of the major axis in the specified units + Double getMajor(const Unit& u) const; - // returns the minor axis in the same units as it had at construction - const Quantity& getMinor() const; + // returns the minor axis in the same units as it had at construction + const Quantity& getMinor() const; - // returns the value portion of the minor axis in the specified units - Double getMinor(const Unit& u) const; + // returns the value portion of the minor axis in the specified units + Double getMinor(const Unit& u) const; - // returns the position angle's value as it was at construction, - // unless unwrap is True, in which case the value of the angle - // returned will be between -90 and 90 degrees (but with unit the same - // as it had when this object was constructed). - Quantity getPA(const Bool unwrap=True) const; + // returns the position angle's value as it was at construction, + // unless unwrap is True, in which case the value of the angle + // returned will be between -90 and 90 degrees (but with unit the same + // as it had when this object was constructed). + Quantity getPA(const Bool unwrap=True) const; - // returns the value portion of the position angle in the specified units - Double getPA(const Unit& u, const Bool unwrap=True) const; + // returns the value portion of the position angle in the specified units + Double getPA(const Unit& u, const Bool unwrap=True) const; - // returns the beam area in the specified unit, which much conform to - // solid angle units. - Double getArea(const Unit& unit) const; + // returns the beam area in the specified unit, which much conform to + // solid angle units. + Double getArea(const Unit& unit) const; - // is this object a null beam (ie is either its major and/or minor axis zero)? - Bool isNull() const; + // is this object a null beam (ie is either its major and/or minor axis zero)? + Bool isNull() const; - // returns GassianBeam. - static const String& className(); + // returns GassianBeam. + static const String& className(); - Record toRecord() const; + Record toRecord() const; - void setMajorMinor(const Quantity& majAx, const Quantity& minAx); + void setMajorMinor(const Quantity& majAx, const Quantity& minAx); - void setPA(const Quantity& pa); + // if unwrap=True, unwrap pa so its value lies in the range + // -90 to 90 degrees before setting it. + void setPA(const Quantity& pa, Bool unwrap=False); - static GaussianBeam fromRecord(const Record& rec); + static GaussianBeam fromRecord(const Record& rec); - // convert this object to a three-Vector of (major FWHM, minor FWHM, and pa). - // If unwrap is True, the returned pa will fall between -90 and +90 - // degrees. - Vector toVector(const Bool unwrap=True) const; + // convert this object to a three-Vector of (major FWHM, minor FWHM, and pa). + // If unwrap is True, the returned pa will fall between -90 and +90 + // degrees. + Vector toVector(const Bool unwrap=True) const; - // convert stored Quantities to the specified units - void convert(const String& majUnit, const String& minUnit, + // convert stored Quantities to the specified units + void convert(const String& majUnit, const String& minUnit, const String& paUnit); protected: - Quantity _major, _minor, _pa; + Quantity _major, _minor, _pa; + +private: + static Quantity _unwrap(const Quantity& pa); }; diff -Nru casacore-2.2.0/scimath/Mathematics/Interpolate2D.cc casacore-2.3.0/scimath/Mathematics/Interpolate2D.cc --- casacore-2.2.0/scimath/Mathematics/Interpolate2D.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/Interpolate2D.cc 2017-10-12 12:24:04.000000000 +0000 @@ -278,7 +278,12 @@ if (tmp==String("N")) { method2 = Interpolate2D::NEAREST; } else if (tmp==String("L")) { - method2 = Interpolate2D::LINEAR; + String tmp2 = String(typeU.at(1, 1)); + if (tmp2==String("A")) { + method2 = Interpolate2D::LANCZOS; + } else { + method2 = Interpolate2D::LINEAR; + } } else if (tmp==String("C")) { method2 = Interpolate2D::CUBIC; } else if (tmp==String("Z")) { diff -Nru casacore-2.2.0/scimath/Mathematics/Interpolate2D.h casacore-2.3.0/scimath/Mathematics/Interpolate2D.h --- casacore-2.2.0/scimath/Mathematics/Interpolate2D.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/Interpolate2D.h 2017-10-12 12:24:04.000000000 +0000 @@ -72,11 +72,11 @@ // // // Matrix matt(10,10); -// Vector where(2); +// Vector where(2); // where(0) = 3.452; where(1) = 6.1; // Interpolate2D myInterp(Interpolate2D::LINEAR); // Float result; -// Bool ok = myInterp(result, where, matt); +// Bool ok = myInterp.interp(result, where, matt); // // // @@ -88,9 +88,6 @@ // // // -//
  • Now that there are float/double/bool versions, the class should -// be templated and specialized versions made as needed. The -// code duplucation in the Float/Double versions is pretty awful presently. //
  • Alternative approach: instantiate with an Array, take a block of // vector locations, return a block of interpolation results // @@ -177,11 +174,8 @@ const Matrix &data) const; // - // Recover interpolation method - Method interpolationMethod() const {return itsMethod;} - - // Convert string ("nearest", "linear", "cubic") to interpolation method - // Minimum match will do. + // Convert string ("nearest", "linear", "cubic", "lanczos") to interpolation + // method. The match is case insensitive. static Interpolate2D::Method stringToMethod(const String &method); private: @@ -232,7 +226,6 @@ const Double y1[4], const Double y2[4], const Double y12[4]) const; // - Interpolate2D::Method itsMethod; // Typedefs for function pointers typedef Bool(Interpolate2D::*FuncPtrFloat) diff -Nru casacore-2.2.0/scimath/Mathematics/StatisticsAlgorithm.h casacore-2.3.0/scimath/Mathematics/StatisticsAlgorithm.h --- casacore-2.2.0/scimath/Mathematics/StatisticsAlgorithm.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/StatisticsAlgorithm.h 2017-10-12 12:24:04.000000000 +0000 @@ -229,6 +229,9 @@ virtual StatsData getStatistics(); + // reset this object by clearing data. + virtual void reset(); + // // setdata() clears any current datasets or data provider and then adds the specified data set as // the first dataset in the (possibly new) set of data sets for which statistics are @@ -285,11 +288,7 @@ // instead of settng and adding data "by hand", set the data provider that will provide // all the data sets. Calling this method will clear any other data sets that have // previously been set or added. - virtual void setDataProvider(StatsDataProvider *dataProvider) { - ThrowIf(! dataProvider, "Logic Error: data provider cannot be NULL"); - _clearData(); - _dataProvider = dataProvider; - } + virtual void setDataProvider(StatsDataProvider *dataProvider); // Provide guidance to algorithms by specifying a priori which statistics the // caller would like calculated. @@ -307,8 +306,6 @@ // Default implementation does nothing. virtual void _addData() {} - virtual void _clearData(); - const vector& _getCounts() const { return _counts; } const vector& _getData() const { return _data; } diff -Nru casacore-2.2.0/scimath/Mathematics/StatisticsAlgorithm.tcc casacore-2.3.0/scimath/Mathematics/StatisticsAlgorithm.tcc --- casacore-2.2.0/scimath/Mathematics/StatisticsAlgorithm.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/StatisticsAlgorithm.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -215,7 +215,7 @@ CASA_STATD void StatisticsAlgorithm::setData( const DataIterator& first, uInt nr, uInt dataStride, Bool nrAccountsForStride ) { - _clearData(); + reset(); addData(first, nr, dataStride, nrAccountsForStride); } @@ -224,7 +224,7 @@ const DataRanges& dataRanges, Bool isInclude, uInt dataStride, Bool nrAccountsForStride ) { - _clearData(); + reset(); addData( first, nr, dataRanges, isInclude, dataStride, nrAccountsForStride ); @@ -234,7 +234,7 @@ const DataIterator& first, const MaskIterator& maskFirst, uInt nr, uInt dataStride, Bool nrAccountsForStride, uInt maskStride ) { - _clearData(); + reset(); addData( first, maskFirst, nr, dataStride, nrAccountsForStride, maskStride ); @@ -246,7 +246,7 @@ Bool isInclude, uInt dataStride, Bool nrAccountsForStride, uInt maskStride ) { - _clearData(); + reset(); addData( first, maskFirst, nr, dataRanges, isInclude, dataStride, nrAccountsForStride, maskStride @@ -257,7 +257,7 @@ const DataIterator& first, const WeightsIterator& weightFirst, uInt nr, uInt dataStride, Bool nrAccountsForStride ) { - _clearData(); + reset(); addData(first, weightFirst, nr, dataStride, nrAccountsForStride); } @@ -266,7 +266,7 @@ uInt nr, const DataRanges& dataRanges, Bool isInclude, uInt dataStride, Bool nrAccountsForStride ) { - _clearData(); + reset(); addData( first, weightFirst, nr, dataRanges, isInclude, dataStride, nrAccountsForStride @@ -278,7 +278,7 @@ const MaskIterator& maskFirst, uInt nr, uInt dataStride, Bool nrAccountsForStride, uInt maskStride ) { - _clearData(); + reset(); addData( first, weightFirst, maskFirst, nr, dataStride, nrAccountsForStride, maskStride @@ -290,7 +290,7 @@ const MaskIterator& maskFirst, uInt nr, const DataRanges& dataRanges, Bool isInclude, uInt dataStride, Bool nrAccountsForStride, uInt maskStride ) { - _clearData(); + reset(); addData( first, weightFirst, maskFirst, nr, dataRanges, isInclude, dataStride, nrAccountsForStride, maskStride @@ -303,7 +303,15 @@ _statsToCalculate = stats; } -CASA_STATD void StatisticsAlgorithm::_clearData() { +CASA_STATD void StatisticsAlgorithm::setDataProvider( + StatsDataProvider *dataProvider +) { + ThrowIf(! dataProvider, "Logic Error: data provider cannot be NULL"); + reset(); + _dataProvider = dataProvider; +} + +CASA_STATD void StatisticsAlgorithm::reset() { _data.clear(); _counts.clear(); _masks.clear(); diff -Nru casacore-2.2.0/scimath/Mathematics/StatisticsData.cc casacore-2.3.0/scimath/Mathematics/StatisticsData.cc --- casacore-2.2.0/scimath/Mathematics/StatisticsData.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/StatisticsData.cc 2017-10-12 12:24:04.000000000 +0000 @@ -55,6 +55,16 @@ return "sumOfWeights"; case VARIANCE: return "variance"; + case MEDIAN: + return "median"; + case MEDABSDEVMED: + return "median of the absolute devation from the median"; + case FIRST_QUARTILE: + return "first quartile"; + case THIRD_QUARTILE: + return "third quartile"; + case INNER_QUARTILE_RANGE: + return "inner quartile range"; default: ThrowCc( "Logic error: Unhandled value in switch statement" diff -Nru casacore-2.2.0/scimath/Mathematics/StatisticsData.h casacore-2.3.0/scimath/Mathematics/StatisticsData.h --- casacore-2.2.0/scimath/Mathematics/StatisticsData.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/StatisticsData.h 2017-10-12 12:24:04.000000000 +0000 @@ -64,7 +64,14 @@ SUMSQ, // sum of weights SUMWEIGHTS, - VARIANCE + VARIANCE, + // commonly used quantile-related types + MEDIAN, + MEDABSDEVMED, + FIRST_QUARTILE, + THIRD_QUARTILE, + // inner quartile range, Q3 - Q1 + INNER_QUARTILE_RANGE }; // get the zero-based indices of the specified fractions in a CDF with npts diff -Nru casacore-2.2.0/scimath/Mathematics/test/CMakeLists.txt casacore-2.3.0/scimath/Mathematics/test/CMakeLists.txt --- casacore-2.2.0/scimath/Mathematics/test/CMakeLists.txt 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/test/CMakeLists.txt 2017-10-12 12:24:04.000000000 +0000 @@ -25,6 +25,7 @@ tVanVleck tVectorKernel tZScoreCalculator +tInterpolate2D ) foreach (test ${tests}) diff -Nru casacore-2.2.0/scimath/Mathematics/test/tChauvenetCriterionStatistics.cc casacore-2.3.0/scimath/Mathematics/test/tChauvenetCriterionStatistics.cc --- casacore-2.2.0/scimath/Mathematics/test/tChauvenetCriterionStatistics.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/test/tChauvenetCriterionStatistics.cc 2017-10-12 12:24:04.000000000 +0000 @@ -36,102 +36,116 @@ int main() { try { - // just check for compilation success, the real tests are in - // tImageStatistics2 - Double data[] = { - -2.61279178e+00, -2.59342551e+00, -2.16943479e+00, - -2.13970494e+00, -1.91509378e+00, -1.91133809e+00, - -1.84780550e+00, -1.67959487e+00, -1.55754685e+00, - -1.49124575e+00, -1.47779667e+00, -1.38040781e+00, - -1.37083769e+00, -1.34913635e+00, -1.29416192e+00, - -1.10022914e+00, -1.07126451e+00, -1.05194223e+00, - -1.03733921e+00, -1.02524054e+00, -9.84085381e-01, - -9.46198046e-01, -9.23078358e-01, -9.21401978e-01, - -8.76483500e-01, -8.60657215e-01, -8.26754928e-01, - -7.59524405e-01, -7.36167967e-01, -6.76235080e-01, - -6.72010839e-01, -6.33015037e-01, -5.91541886e-01, - -5.87743282e-01, -5.28600693e-01, -5.03111005e-01, - -4.84272331e-01, -3.87220532e-01, -3.62094551e-01, - -3.12986404e-01, -3.01742464e-01, -2.86407530e-01, - -2.77583510e-01, -2.37437248e-01, -2.37364024e-01, - -2.35247806e-01, -2.11185545e-01, -1.92734912e-01, - -1.87121660e-01, -1.77792773e-01, -1.69995695e-01, - -1.45033970e-01, -1.16942599e-01, -6.27262741e-02, - -3.45510058e-02, -3.06752156e-02, -1.79617219e-02, - -1.14524942e-02, -3.16955987e-03, 7.29589257e-04, - 1.24999344e-01, 2.12515876e-01, 2.50957519e-01, - 2.79240131e-01, 2.81288683e-01, 3.05763662e-01, - 3.11809599e-01, 3.40768367e-01, 3.51874888e-01, - 3.91162097e-01, 4.58450705e-01, 4.82642174e-01, - 4.96854514e-01, 7.20111370e-01, 7.22756803e-01, - 7.25001752e-01, 8.35289240e-01, 8.46509099e-01, - 8.93022776e-01, 9.00427580e-01, 9.17734325e-01, - 9.18030262e-01, 1.04210591e+00, 1.05506992e+00, - 1.09472048e+00, 1.15250385e+00, 1.16275501e+00, - 1.21244884e+00, 1.22725236e+00, 1.31463480e+00, - 1.33273876e+00, 1.57637489e+00, 1.58221984e+00, - 1.65665936e+00, 1.80032420e+00, 1.91410339e+00, - 2.02669597e+00, 2.08605909e+00, 2.09777880e+00, - 2.21240473e+00, - 3.5, 4, 5, 6, 7, 8, 1000000 - }; - { - // zscore=3.5, no iterations - ChauvenetCriterionStatistics cs(3.5, 0); - cs.setData(data, 107); - StatsData sd = cs.getStatistics(); - AlwaysAssert(sd.npts == 106, AipsError); - AlwaysAssert(*sd.max == 8, AipsError); - } - { - // zscore=3.5, one iteration - ChauvenetCriterionStatistics cs(3.5, 1); - cs.setData(data, 107); - StatsData sd = cs.getStatistics(); - AlwaysAssert(sd.npts == 104, AipsError); - AlwaysAssert(*sd.max == 6, AipsError); - } - { - // zscore=3.5, iterate until converged - ChauvenetCriterionStatistics cs(3.5, -1); - cs.setData(data, 107); - StatsData sd = cs.getStatistics(); - AlwaysAssert(sd.npts == 102, AipsError); - AlwaysAssert(*sd.max == 4, AipsError); - } - { - // use Chauvenet criterion, no iterations - ChauvenetCriterionStatistics cs(-1, 0); - cs.setData(data, 107); - StatsData sd = cs.getStatistics(); - AlwaysAssert(sd.npts == 106, AipsError); - AlwaysAssert(*sd.max == 8, AipsError); - } - { - // use Chauvenet criterion, one iteration - ChauvenetCriterionStatistics cs(-1, 1); - cs.setData(data, 107); - StatsData sd = cs.getStatistics(); - AlwaysAssert(sd.npts == 103, AipsError); - AlwaysAssert(*sd.max == 5, AipsError); - } - { - // use Chauvenet criterion, iterate until converged - ChauvenetCriterionStatistics cs(-1, -1); - cs.setData(data, 107); - StatsData sd = cs.getStatistics(); - AlwaysAssert(sd.npts == 100, AipsError); - AlwaysAssert(*sd.max == data[99], AipsError); - } - { - // a compile test: change final template parameter to Int* - ChauvenetCriterionStatistics cs(-1, -1); - cs.setData(data, 107); - StatsData sd = cs.getStatistics(); - AlwaysAssert(sd.npts == 100, AipsError); - AlwaysAssert(*sd.max == data[99], AipsError); - } - + // just check for compilation success, the real tests are in + // tImageStatistics2 + Double data[] = { + -2.61279178e+00, -2.59342551e+00, -2.16943479e+00, + -2.13970494e+00, -1.91509378e+00, -1.91133809e+00, + -1.84780550e+00, -1.67959487e+00, -1.55754685e+00, + -1.49124575e+00, -1.47779667e+00, -1.38040781e+00, + -1.37083769e+00, -1.34913635e+00, -1.29416192e+00, + -1.10022914e+00, -1.07126451e+00, -1.05194223e+00, + -1.03733921e+00, -1.02524054e+00, -9.84085381e-01, + -9.46198046e-01, -9.23078358e-01, -9.21401978e-01, + -8.76483500e-01, -8.60657215e-01, -8.26754928e-01, + -7.59524405e-01, -7.36167967e-01, -6.76235080e-01, + -6.72010839e-01, -6.33015037e-01, -5.91541886e-01, + -5.87743282e-01, -5.28600693e-01, -5.03111005e-01, + -4.84272331e-01, -3.87220532e-01, -3.62094551e-01, + -3.12986404e-01, -3.01742464e-01, -2.86407530e-01, + -2.77583510e-01, -2.37437248e-01, -2.37364024e-01, + -2.35247806e-01, -2.11185545e-01, -1.92734912e-01, + -1.87121660e-01, -1.77792773e-01, -1.69995695e-01, + -1.45033970e-01, -1.16942599e-01, -6.27262741e-02, + -3.45510058e-02, -3.06752156e-02, -1.79617219e-02, + -1.14524942e-02, -3.16955987e-03, 7.29589257e-04, + 1.24999344e-01, 2.12515876e-01, 2.50957519e-01, + 2.79240131e-01, 2.81288683e-01, 3.05763662e-01, + 3.11809599e-01, 3.40768367e-01, 3.51874888e-01, + 3.91162097e-01, 4.58450705e-01, 4.82642174e-01, + 4.96854514e-01, 7.20111370e-01, 7.22756803e-01, + 7.25001752e-01, 8.35289240e-01, 8.46509099e-01, + 8.93022776e-01, 9.00427580e-01, 9.17734325e-01, + 9.18030262e-01, 1.04210591e+00, 1.05506992e+00, + 1.09472048e+00, 1.15250385e+00, 1.16275501e+00, + 1.21244884e+00, 1.22725236e+00, 1.31463480e+00, + 1.33273876e+00, 1.57637489e+00, 1.58221984e+00, + 1.65665936e+00, 1.80032420e+00, 1.91410339e+00, + 2.02669597e+00, 2.08605909e+00, 2.09777880e+00, + 2.21240473e+00, + 3.5, 4, 5, 6, 7, 8, 1000000 + }; + { + // zscore=3.5, no iterations + ChauvenetCriterionStatistics cs(3.5, 0); + cs.setData(data, 107); + StatsData sd = cs.getStatistics(); + AlwaysAssert(sd.npts == 106, AipsError); + AlwaysAssert(*sd.max == 8, AipsError); + } + { + // zscore=3.5, one iteration + ChauvenetCriterionStatistics cs(3.5, 1); + cs.setData(data, 107); + StatsData sd = cs.getStatistics(); + AlwaysAssert(sd.npts == 104, AipsError); + AlwaysAssert(*sd.max == 6, AipsError); + } + { + // zscore=3.5, iterate until converged + ChauvenetCriterionStatistics cs(3.5, -1); + cs.setData(data, 107); + StatsData sd = cs.getStatistics(); + AlwaysAssert(sd.npts == 102, AipsError); + AlwaysAssert(*sd.max == 4, AipsError); + } + { + // use Chauvenet criterion, no iterations + ChauvenetCriterionStatistics cs(-1, 0); + cs.setData(data, 107); + StatsData sd = cs.getStatistics(); + AlwaysAssert(sd.npts == 106, AipsError); + AlwaysAssert(*sd.max == 8, AipsError); + } + { + // use Chauvenet criterion, one iteration + ChauvenetCriterionStatistics cs(-1, 1); + cs.setData(data, 107); + StatsData sd = cs.getStatistics(); + AlwaysAssert(sd.npts == 103, AipsError); + AlwaysAssert(*sd.max == 5, AipsError); + } + { + // use Chauvenet criterion, iterate until converged + ChauvenetCriterionStatistics cs(-1, -1); + cs.setData(data, 107); + StatsData sd = cs.getStatistics(); + AlwaysAssert(sd.npts == 100, AipsError); + AlwaysAssert(*sd.max == data[99], AipsError); + } + { + // a compile test: change final template parameter to Int* + ChauvenetCriterionStatistics cs(-1, -1); + cs.setData(data, 107); + StatsData sd = cs.getStatistics(); + AlwaysAssert(sd.npts == 100, AipsError); + AlwaysAssert(*sd.max == data[99], AipsError); + } + { + // illustrate fix of CAS-10103 + ChauvenetCriterionStatistics::const_iterator> cs(3); + vector v0; + v0.push_back(1.0); + cs.setData(v0.begin(), v0.size()); + StatsData sd = cs.getStatistics(); + AlwaysAssert(sd.mean == 1, AipsError); + vector v1; + v1.push_back(10); + v1.push_back(11); + cs.setData(v1.begin(), v1.size()); + sd = cs.getStatistics(); + AlwaysAssert(sd.mean == 10.5, AipsError); + } } catch (const AipsError& x) { diff -Nru casacore-2.2.0/scimath/Mathematics/test/tClassicalStatistics.cc casacore-2.3.0/scimath/Mathematics/test/tClassicalStatistics.cc --- casacore-2.2.0/scimath/Mathematics/test/tClassicalStatistics.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/test/tClassicalStatistics.cc 2017-10-12 12:24:04.000000000 +0000 @@ -1601,6 +1601,8 @@ cs.addData(v0.begin(), v0.size()); Double median = cs.getMedian(); AlwaysAssert(median == 2, AipsError); + median = cs.getStatistic(StatisticsData::MEDIAN); + AlwaysAssert(median == 2, AipsError); cs.reset(); vector m0(v0.size(), True); m0[0] = False; diff -Nru casacore-2.2.0/scimath/Mathematics/test/tGaussianBeam.cc casacore-2.3.0/scimath/Mathematics/test/tGaussianBeam.cc --- casacore-2.2.0/scimath/Mathematics/test/tGaussianBeam.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/test/tGaussianBeam.cc 2017-10-12 12:24:04.000000000 +0000 @@ -33,108 +33,122 @@ int main() { - try { - // null beam - GaussianBeam null; - AlwaysAssert(null.isNull(), AipsError); - Quantity qzero(0, "rad"); - AlwaysAssert(null.getMajor() == qzero, AipsError); - AlwaysAssert(null.getMinor() == qzero, AipsError); - AlwaysAssert(null.getPA() == qzero, AipsError); - // non null beam constructor - Quantity majAx(4, "arcsec"); - Quantity minAx(3, "arcsec"); - Quantity pa(20, "deg"); - GaussianBeam beam(majAx, minAx, pa); - AlwaysAssert(beam.getMajor() == majAx, AipsError); - AlwaysAssert(beam.getMinor() == minAx, AipsError); - AlwaysAssert(beam.getPA() == pa, AipsError); - - // copy constructor - GaussianBeam beam2(beam); - AlwaysAssert(beam2 == beam, AipsError); - AlwaysAssert(beam2 != null, AipsError); - - // = operator - beam2 = beam; - AlwaysAssert(beam2 == beam, AipsError); - AlwaysAssert(beam2 != null, AipsError); - - - - Bool except = False; - try { - // bogus units - majAx = Quantity(4, "m"); - GaussianBeam beam3(majAx, minAx, pa); - - } - catch (AipsError x) { - cout << "Exception thrown as expected: " << x.getMesg() << endl; - except = True; - } - AlwaysAssert(except, AipsError); - except = False; - try { - // major smaller than minor - majAx = Quantity(2, "arcsec"); - GaussianBeam beam3(majAx, minAx, pa); - - } - catch (AipsError x) { - cout << "Exception thrown as expected: " << x.getMesg() << endl; - except = True; - } - AlwaysAssert(except, AipsError); - - // getArea - majAx = Quantity(1, "arcsec"); - minAx = majAx; - beam = GaussianBeam(majAx, minAx, pa); - AlwaysAssert(beam.getArea("arcsec2") == Quantity(C::pi/4/C::ln2), AipsError); - except = False; - try { - // bogus units - beam.getArea("arcsec"); - } - catch (AipsError x) { - cout << "Exception thrown as expected: " << x.getMesg() << endl; - except = True; - } - AlwaysAssert(except, AipsError); - - // to/from Record - Record rec = beam.toRecord(); - beam2 = GaussianBeam::fromRecord(rec); - AlwaysAssert(beam == beam2, AipsError); - except = False; - try { - // bogus record - rec.define("bogus", 5); - beam2 = GaussianBeam::fromRecord(rec); - - } - catch (AipsError x) { - cout << "Exception thrown as expected: " << x.getMesg() << endl; - except = True; - } - AlwaysAssert(except, AipsError); - Vector v(3); - v[0] = majAx; - v[1] = minAx; - v[2] = pa; - GaussianBeam beam3(v); - AlwaysAssert(beam3 == beam, AipsError); - - v = beam.toVector(); - GaussianBeam beam4(v); - AlwaysAssert(beam4 == beam3, AipsError); - } - catch (AipsError x) { - cout << x.getMesg() << endl; - cout << "FAIL" << endl; - return 1; - } - cout << "OK" << endl; - return 0; + try { + // null beam + GaussianBeam null; + AlwaysAssert(null.isNull(), AipsError); + Quantity qzero(0, "rad"); + AlwaysAssert(null.getMajor() == qzero, AipsError); + AlwaysAssert(null.getMinor() == qzero, AipsError); + AlwaysAssert(null.getPA() == qzero, AipsError); + // non null beam constructor + Quantity majAx(4, "arcsec"); + Quantity minAx(3, "arcsec"); + Quantity pa(20, "deg"); + GaussianBeam beam(majAx, minAx, pa); + AlwaysAssert(beam.getMajor() == majAx, AipsError); + AlwaysAssert(beam.getMinor() == minAx, AipsError); + AlwaysAssert(beam.getPA() == pa, AipsError); + + // copy constructor + GaussianBeam beam2(beam); + AlwaysAssert(beam2 == beam, AipsError); + AlwaysAssert(beam2 != null, AipsError); + + // = operator + beam2 = beam; + AlwaysAssert(beam2 == beam, AipsError); + AlwaysAssert(beam2 != null, AipsError); + + + + Bool except = False; + try { + // bogus units + majAx = Quantity(4, "m"); + GaussianBeam beam3(majAx, minAx, pa); + + } + catch (AipsError x) { + cout << "Exception thrown as expected: " << x.getMesg() << endl; + except = True; + } + AlwaysAssert(except, AipsError); + except = False; + try { + // major smaller than minor + majAx = Quantity(2, "arcsec"); + GaussianBeam beam3(majAx, minAx, pa); + + } + catch (AipsError x) { + cout << "Exception thrown as expected: " << x.getMesg() << endl; + except = True; + } + AlwaysAssert(except, AipsError); + + // getArea + majAx = Quantity(1, "arcsec"); + minAx = majAx; + beam = GaussianBeam(majAx, minAx, pa); + AlwaysAssert(beam.getArea("arcsec2") == Quantity(C::pi/4/C::ln2), AipsError); + except = False; + try { + // bogus units + beam.getArea("arcsec"); + } + catch (AipsError x) { + cout << "Exception thrown as expected: " << x.getMesg() << endl; + except = True; + } + AlwaysAssert(except, AipsError); + + // to/from Record + Record rec = beam.toRecord(); + beam2 = GaussianBeam::fromRecord(rec); + AlwaysAssert(beam == beam2, AipsError); + except = False; + try { + // bogus record + rec.define("bogus", 5); + beam2 = GaussianBeam::fromRecord(rec); + + } + catch (AipsError x) { + cout << "Exception thrown as expected: " << x.getMesg() << endl; + except = True; + } + AlwaysAssert(except, AipsError); + Vector v(3); + v[0] = majAx; + v[1] = minAx; + v[2] = pa; + GaussianBeam beam3(v); + AlwaysAssert(beam3 == beam, AipsError); + + v = beam.toVector(); + GaussianBeam beam4(v); + AlwaysAssert(beam4 == beam3, AipsError); + { + cout << "Test setPA() and getPA() using unwrapping" << endl; + Double u = 60; + for (Double d=-660; d<=660; d+=30, u+=30) { + if (u > 90) { + u -= 180; + } + beam.setPA(Quantity(d, "deg"), False); + AlwaysAssert(beam.getPA(False).getValue("deg") == d, AipsError); + AlwaysAssert(beam.getPA(True).getValue("deg") == u, AipsError); + beam.setPA(Quantity(d, "deg"), True); + AlwaysAssert(beam.getPA(False).getValue("deg") == u, AipsError); + } + } + } + catch (AipsError x) { + cout << x.getMesg() << endl; + cout << "FAIL" << endl; + return 1; + } + cout << "OK" << endl; + return 0; } diff -Nru casacore-2.2.0/scimath/Mathematics/test/tInterpolate2D.cc casacore-2.3.0/scimath/Mathematics/test/tInterpolate2D.cc --- casacore-2.2.0/scimath/Mathematics/test/tInterpolate2D.cc 1970-01-01 00:00:00.000000000 +0000 +++ casacore-2.3.0/scimath/Mathematics/test/tInterpolate2D.cc 2017-10-12 12:24:04.000000000 +0000 @@ -0,0 +1,102 @@ +//# Copyright (C) 1996,1997,1998,1999,2000,2001,2002 +//# Associated Universities, Inc. Washington DC, USA. +//# +//# This library is free software; you can redistribute it and/or modify it +//# under the terms of the GNU Library General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or (at your +//# option) any later version. +//# +//# This library is distributed in the hope that it will be useful, but WITHOUT +//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public +//# License for more details. +//# +//# You should have received a copy of the GNU Library General Public License +//# along with this library; if not, write to the Free Software Foundation, +//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. +//# +//# Correspondence concerning AIPS++ should be addressed as follows: +//# Internet email: aips2-request@nrao.edu. +//# Postal address: AIPS++ Project Office +//# National Radio Astronomy Observatory +//# 520 Edgemont Road +//# Charlottesville, VA 22903-2475 USA +//# + +#include +#include +#include +#include +#include +#include + +#include + + +int main() { + try { + AlwaysAssert(Interpolate2D::stringToMethod("l") == + Interpolate2D::LINEAR, AipsError); + AlwaysAssert(Interpolate2D::stringToMethod("linear") == + Interpolate2D::LINEAR, AipsError); + AlwaysAssert(Interpolate2D::stringToMethod("z") == + Interpolate2D::LANCZOS, AipsError); + AlwaysAssert(Interpolate2D::stringToMethod("lanczos") == + Interpolate2D::LANCZOS, AipsError); + AlwaysAssert(Interpolate2D::stringToMethod("c") == + Interpolate2D::CUBIC, AipsError); + AlwaysAssert(Interpolate2D::stringToMethod("cubic") == + Interpolate2D::CUBIC, AipsError); + + // Set up matrix of input values + Matrix matt_f(10,10); + Matrix matt_d(10,10); + for (uInt i=0; i<10; ++i) { + for (uInt j=0; j<10; ++j) { + matt_f(i,j) = i+j; + matt_d(i,j) = i+j; + } + } + + // Where to evaluate the interpolation + Vector where(2); + where(0) = 3.452; where(1) = 6.1; + + // Test for all implemented methods + vector methods(4); + methods[0] = "linear"; + methods[1] = "cubic"; + methods[2] = "lanczos"; + methods[3] = "nearest"; + + vector results(4); + results[0] = 9.552; // Linear + results[1] = 9.552; // Cubic + results[2] = 9.473654921656; // Lanczos + results[3] = 9.; // Nearest + + for (uInt method=0; method::mapOnGet (Array&, const Array&) { - throw ("BaseMappedArrayEngine::mapOnGet not implemented"); + throw DataManInvOper("BaseMappedArrayEngine::mapOnGet not implemented " + "for column " + virtualName()); } template void BaseMappedArrayEngine::mapOnPut (const Array&, Array&) { - throw ("BaseMappedArrayEngine::mapOnPut not implemented"); + throw DataManInvOper("BaseMappedArrayEngine::mapOnPut not implemented " + "for column " + virtualName()); } diff -Nru casacore-2.2.0/tables/DataMan/DataManAccessor.cc casacore-2.3.0/tables/DataMan/DataManAccessor.cc --- casacore-2.2.0/tables/DataMan/DataManAccessor.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/DataManAccessor.cc 2017-10-12 12:24:04.000000000 +0000 @@ -53,7 +53,7 @@ itsDataManager->setProperties (prop); } else { throw DataManError ("setProperties cannot be used on a default " - "RODataManAccessor object"); + "empty RODataManAccessor object"); } } @@ -63,7 +63,7 @@ return itsDataManager->getProperties(); } throw DataManError ("getProperties cannot be used on a default " - "RODataManAccessor object"); + "empty RODataManAccessor object"); } } //# NAMESPACE CASACORE - END diff -Nru casacore-2.2.0/tables/DataMan/DataManager.cc casacore-2.3.0/tables/DataMan/DataManager.cc --- casacore-2.2.0/tables/DataMan/DataManager.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/DataManager.cc 2017-10-12 12:24:04.000000000 +0000 @@ -174,7 +174,10 @@ int dataType, const String& dataTypeId) const { if (dataType != colPtr->dataType()) { - throw (DataManInvDT ("Column " + columnName)); + throw (DataManInvDT ("Column " + columnName + + " has data type " + + String::toString(colPtr->dataTypeId()) + + "; expected " + String::toString(dataTypeId))); } if (dataType == TpOther) { if (dataTypeId != colPtr->dataTypeId()) { @@ -256,16 +259,20 @@ { return True; } void DataManager::addRow (uInt) - { throw (DataManInvOper ("DataManager::addRow not allowed")); } + { throw DataManInvOper ("DataManager::addRow not allowed for " + "data manager type " + dataManagerType()); } void DataManager::removeRow (uInt) - { throw (DataManInvOper ("DataManager::removeRow not allowed")); } + { throw DataManInvOper ("DataManager::removeRow not allowed for " + "data manager type " + dataManagerType()); } void DataManager::addColumn (DataManagerColumn*) - { throw (DataManInvOper ("DataManager::addColumn not allowed")); } + { throw DataManInvOper ("DataManager::addColumn not allowed for " + "data manager type " + dataManagerType()); } void DataManager::removeColumn (DataManagerColumn*) - { throw (DataManInvOper ("DataManager::removeColumn not allowed")); } + { throw DataManInvOper ("DataManager::removeColumn not allowed for " + "data manager type " + dataManagerType()); } diff -Nru casacore-2.2.0/tables/DataMan/ForwardCol.cc casacore-2.3.0/tables/DataMan/ForwardCol.cc --- casacore-2.2.0/tables/DataMan/ForwardCol.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/ForwardCol.cc 2017-10-12 12:24:04.000000000 +0000 @@ -123,7 +123,8 @@ return; } } - throw (DataManInternalError ("ForwardColumnEngine::addColumn")); + throw DataManInternalError ("ForwardColumnEngine::addColumn on column " + + colp->columnName()); } void ForwardColumnEngine::removeColumn (DataManagerColumn* colp) @@ -139,7 +140,8 @@ return; } } - throw (DataManInternalError ("ForwardColumnEngine::removeColumn")); + throw DataManInternalError ("ForwardColumnEngine::removeColumn on column " + + colp->columnName()); } diff -Nru casacore-2.2.0/tables/DataMan/ForwardColRow.cc casacore-2.3.0/tables/DataMan/ForwardColRow.cc --- casacore-2.2.0/tables/DataMan/ForwardColRow.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/ForwardColRow.cc 2017-10-12 12:24:04.000000000 +0000 @@ -185,7 +185,7 @@ void ForwardColumnIndexedRow::setShape (uInt, const IPosition&) { throw (DataManInvOper - ("setShape not supported by ForwardColumnIndexedRowEngine")); + ("setShape not supported by data manager ForwardColumnIndexedRow")); } uInt ForwardColumnIndexedRow::ndim (uInt rownr) @@ -227,13 +227,13 @@ void ForwardColumnIndexedRow::putArrayV (uInt, const void*) { throw (DataManInvOper - ("put not supported by ForwardColumnIndexedRowEngine")); + ("putArray not supported by data manager ForwardColumnIndexedRow")); } void ForwardColumnIndexedRow::putSliceV (uInt, const Slicer&, const void*) { throw (DataManInvOper - ("put not supported by ForwardColumnIndexedRowEngine")); + ("putSlice not supported by data manager ForwardColumnIndexedRow")); } @@ -243,7 +243,7 @@ void ForwardColumnIndexedRow::aips_name2(put,NM) (uInt, const T*) \ { \ throw (DataManInvOper \ - ("put not supported by ForwardColumnIndexedRowEngine")); \ + ("put not supported by data manager ForwardColumnIndexedRow")); \ } FORWARDCOLUMNINDEXEDROW_GETPUT(Bool,BoolV) diff -Nru casacore-2.2.0/tables/DataMan/ISMIndColumn.cc casacore-2.3.0/tables/DataMan/ISMIndColumn.cc --- casacore-2.2.0/tables/DataMan/ISMIndColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/ISMIndColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -156,9 +156,10 @@ { StIndArray* ptr = getArrayPtr (rownr); if (ptr == 0) { - throw (DataManInvOper ("ISM: no array in row " + - String::toString(rownr) + - " of " + stmanPtr_p->fileName())); + throw DataManInvOper ("ISM: no array in row " + + String::toString(rownr) + + " in column " + columnName() + + " of " + stmanPtr_p->fileName()); } ptr->getShape (*iosfile_p); return ptr; diff -Nru casacore-2.2.0/tables/DataMan/MSMBase.cc casacore-2.3.0/tables/DataMan/MSMBase.cc --- casacore-2.2.0/tables/DataMan/MSMBase.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/MSMBase.cc 2017-10-12 12:24:04.000000000 +0000 @@ -201,7 +201,8 @@ return; } } - throw (DataManInternalError ("MSMBase::addColumn")); + throw DataManInternalError ("MSMBase::addColumn, column " + + colp->columnName()); } void MSMBase::removeColumn (DataManagerColumn* colp) @@ -216,7 +217,9 @@ return; } } - throw (DataManInternalError ("MSMBase::removeColumn: no such column")); + throw DataManInternalError ("MSMBase::removeColumn: " + " column " + colp->columnName() + + " does not exist"); } void MSMBase::addRow (uInt nr) diff -Nru casacore-2.2.0/tables/DataMan/MSMColumn.cc casacore-2.3.0/tables/DataMan/MSMColumn.cc --- casacore-2.2.0/tables/DataMan/MSMColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/MSMColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -114,8 +114,10 @@ } } if (i > Int(nrext_p)) { - throw (indexError(index, "MSMColumn::findExt - " - "rownr out of range")); + throw indexError(index, "MSMColumn::findExt - " + "rownr " + String::toString(index) + + " in column " + columnName() + + " out of range"); } if (setCache) { columnCache().set (ncum_p[i-1], ncum_p[i]-1, data_p[i]); diff -Nru casacore-2.2.0/tables/DataMan/MSMIndColumn.cc casacore-2.3.0/tables/DataMan/MSMIndColumn.cc --- casacore-2.2.0/tables/DataMan/MSMIndColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/MSMIndColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -84,9 +84,10 @@ { void* ptr = getArrayPtr(rownr); if (ptr == 0) { - throw (DataManInvOper ("MSM: no array in row " + - String::toString(rownr) + - " of " + stmanPtr_p->fileName())); + throw DataManInvOper ("MSM: no array in row " + + String::toString(rownr) + + " in column " + columnName() + + " of " + stmanPtr_p->fileName()); } return static_cast(ptr); } @@ -265,7 +266,7 @@ data_p = new String[nelem]; break; default: - throw (DataManInvDT("MSMIndColumn")); + throw DataManInvDT("MSMIndColumn"); } } @@ -316,7 +317,7 @@ delete [] static_cast(data_p); break; default: - throw (DataManInvDT("MSMIndColumn")); + throw DataManInvDT("MSMIndColumn"); } data_p = 0; } diff -Nru casacore-2.2.0/tables/DataMan/SSMBase.cc casacore-2.3.0/tables/DataMan/SSMBase.cc --- casacore-2.2.0/tables/DataMan/SSMBase.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/SSMBase.cc 2017-10-12 12:24:04.000000000 +0000 @@ -786,8 +786,8 @@ if (rowsPerBucket < 1) { // The BucketSize is too small to contain data. - throw (DataManError ("StandardStMan::addColumn bucketsize too small" - " for adding column " + aColumn->columnName())); + throw DataManError ("StandardStMan::addColumn bucketsize too small" + " for adding column " + aColumn->columnName()); } uInt nrIdx=itsPtrIndex.nelements(); @@ -904,14 +904,15 @@ } char* SSMBase::find(uInt aRowNr, uInt aColNr, - uInt& aStartRow, uInt& anEndRow) + uInt& aStartRow, uInt& anEndRow, + const String& colName) { // Make sure that cache is available and filled. getCache(); SSMIndex* anIndexPtr = itsPtrIndex[itsColIndexMap[aColNr]]; uInt aBucketNr; - anIndexPtr->find(aRowNr,aBucketNr,aStartRow,anEndRow); + anIndexPtr->find(aRowNr,aBucketNr,aStartRow,anEndRow, colName); char* aPtr = getBucket(aBucketNr); return aPtr + itsColumnOffset[aColNr]; } diff -Nru casacore-2.2.0/tables/DataMan/SSMBase.h casacore-2.3.0/tables/DataMan/SSMBase.h --- casacore-2.2.0/tables/DataMan/SSMBase.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/SSMBase.h 2017-10-12 12:24:04.000000000 +0000 @@ -268,7 +268,8 @@ // to the beginning of the column data in that bucket. // It also fills in the start and end row for the column data. char* find (uInt aRowNr, uInt aColNr, - uInt& aStartRow, uInt& anEndRow); + uInt& aStartRow, uInt& anEndRow, + const String& colName); // Add a new bucket and get its bucket number. uInt getNewBucket(); diff -Nru casacore-2.2.0/tables/DataMan/SSMColumn.cc casacore-2.3.0/tables/DataMan/SSMColumn.cc --- casacore-2.2.0/tables/DataMan/SSMColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/SSMColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -101,7 +101,8 @@ uInt aStartRow; uInt anEndRow; char* aValPtr; - aValPtr = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValPtr = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); aRowNr = anEndRow+1; uInt aNr = anEndRow-aStartRow+1; aNrRows -= aNr; @@ -123,14 +124,15 @@ getRowValue(buf, aRowNr); if (buf[2] > 8 ) { itsSSMPtr->getStringHandler()->remove(buf[0], buf[1], buf[2]); - aValue = itsSSMPtr->find (aRowNr, itsColNr, aSRow, anERow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aSRow, anERow, + columnName()); shiftRows(aValue,aRowNr,aSRow,anERow); itsSSMPtr->setBucketDirty(); return; } } - aValue = itsSSMPtr->find (aRowNr, itsColNr, aSRow, anERow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aSRow, anERow, columnName()); // For bools be sure that cache is actual Bool isBool = (aDT == TpBool); @@ -253,7 +255,8 @@ char* sp = const_cast(aValue->chars()); uInt aStartRow; uInt anEndRow; - char* buf = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + char* buf = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); itsReadFunc (sp, buf+(aRowNr-aStartRow)*itsExternalSizeBytes, itsNrCopy); // Append a trailing zero (in case needed). @@ -293,7 +296,8 @@ uInt aStartRow; uInt anEndRow; char* aValue; - aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); itsReadFunc (data, aValue+(aRowNr-aStartRow)*itsExternalSizeBytes, itsNrCopy); return aValue+(aRowNr-aStartRow)*itsExternalSizeBytes; @@ -305,7 +309,8 @@ uInt aStartRow; uInt anEndRow; char* aValue; - aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); itsReadFunc (getDataPtr(), aValue, (anEndRow-aStartRow+1) * itsNrCopy); columnCache().set (aStartRow, anEndRow, getDataPtr()); } @@ -317,7 +322,8 @@ uInt anEndRow; char* aDummy; - aDummy = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aDummy = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); uInt anOff = aRowNr-aStartRow; @@ -410,7 +416,8 @@ if (itsMaxLen > 0) { uInt aStartRow; uInt anEndRow; - char* aDummy = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + char* aDummy = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); itsWriteFunc (aDummy+(aRowNr-aStartRow)*itsExternalSizeBytes, aValue->chars(), min(itsMaxLen, aValue->length()+1)); itsSSMPtr->setBucketDirty(); @@ -448,7 +455,8 @@ { uInt aStartRow; uInt anEndRow; - char* aDummy = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + char* aDummy = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); itsWriteFunc (aDummy+(aRowNr-aStartRow)*itsExternalSizeBytes, aValue, itsNrCopy); itsSSMPtr->setBucketDirty(); @@ -461,7 +469,8 @@ uInt anEndRow; char* aDummy; - aDummy = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aDummy = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); itsWriteFunc (aDummy+(aRowNr-aStartRow)*itsExternalSizeBytes, aValue, itsNrCopy); @@ -568,7 +577,8 @@ uInt aStartRow; uInt anEndRow; char* aValue; - aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); aRowNr = anEndRow+1; uInt aNr = anEndRow-aStartRow+1; rowsToDo -= aNr; @@ -674,7 +684,8 @@ uInt aStartRow; uInt anEndRow; char* aValPtr; - aValPtr = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValPtr = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); aRowNr = anEndRow+1; uInt aNr = anEndRow-aStartRow+1; rowsToDo -= aNr; diff -Nru casacore-2.2.0/tables/DataMan/SSMDirColumn.cc casacore-2.3.0/tables/DataMan/SSMDirColumn.cc --- casacore-2.2.0/tables/DataMan/SSMDirColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/SSMDirColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -49,7 +49,7 @@ char* aValue; uInt aSRow; uInt anERow; - aValue = itsSSMPtr->find (aRowNr, itsColNr, aSRow, anERow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aSRow, anERow, columnName()); if (aRowNr < anERow) { // remove from bucket @@ -83,7 +83,8 @@ Bool* data = aDataPtr->getStorage (deleteIt); - aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); uInt anOff = (aRowNr-aStartRow) * itsNrCopy; @@ -186,7 +187,8 @@ uInt aStartRow; uInt anEndRow; char* aValue; - aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); itsReadFunc (data, aValue+(aRowNr-aStartRow)*itsExternalSizeBytes, itsNrCopy); } @@ -201,7 +203,8 @@ uInt anEndRow; char* aValue; - aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); uInt anOff = (aRowNr-aStartRow) * itsNrCopy; diff -Nru casacore-2.2.0/tables/DataMan/SSMIndColumn.cc casacore-2.3.0/tables/DataMan/SSMIndColumn.cc --- casacore-2.2.0/tables/DataMan/SSMIndColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/SSMIndColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -80,7 +80,8 @@ uInt aStartRow; uInt anEndRow; char* aValPtr; - aValPtr = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValPtr = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); aRowNr = anEndRow+1; uInt aNr = anEndRow-aStartRow+1; aNrRows -= aNr; @@ -126,7 +127,8 @@ uInt anEndRow; char* aValue; - aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aStartRow, anEndRow, + columnName()); itsReadFunc (&anOffset, aValue+(aRowNr-aStartRow)*itsExternalSizeBytes, itsNrCopy); @@ -145,10 +147,10 @@ { StIndArray* aPtr = getArrayPtr (aRowNr); if (aPtr == 0) { - throw (DataManInvOper ("SSMIndColumn::getShape: no array in row "+ - String::toString(aRowNr) + " of column " - + columnName() - + " in table " + itsSSMPtr->table().tableName())); + throw DataManInvOper ("SSMIndColumn::getShape: no array in row "+ + String::toString(aRowNr) + " in column " + + columnName() + + " of table " + itsSSMPtr->table().tableName()); } aPtr->getShape (*itsIosFile); return aPtr; @@ -179,7 +181,7 @@ char* aValue; uInt aSRow; uInt anERow; - aValue = itsSSMPtr->find (aRowNr, itsColNr, aSRow, anERow); + aValue = itsSSMPtr->find (aRowNr, itsColNr, aSRow, anERow, columnName()); if (aRowNr < anERow) { // remove from bucket diff -Nru casacore-2.2.0/tables/DataMan/SSMIndex.cc casacore-2.3.0/tables/DataMan/SSMIndex.cc --- casacore-2.2.0/tables/DataMan/SSMIndex.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/SSMIndex.cc 2017-10-12 12:24:04.000000000 +0000 @@ -166,7 +166,7 @@ Int SSMIndex::deleteRow (uInt aRowNr) { // Decrement the rowNrs of all the intervals after the row to be removed - uInt anIndex = getIndex(aRowNr); + uInt anIndex = getIndex(aRowNr, String()); Bool isEmpty=False; for (uInt i = anIndex ; i< itsNUsed; i++) { @@ -210,14 +210,15 @@ } -uInt SSMIndex::getIndex (uInt aRowNumber) const +uInt SSMIndex::getIndex (uInt aRowNumber, const String& colName) const { Bool isFound; uInt anIndex = binarySearchBrackets( isFound, itsLastRow, aRowNumber, itsNUsed ); if (anIndex >= itsNUsed) { throw TableError ("SSMIndex::getIndex - access to non-existing row " - + String::toString(aRowNumber) + " in " + + + String::toString(aRowNumber) + + " in column " + colName + " of table " + itsSSMPtr->table().tableName()); } return anIndex; @@ -304,9 +305,10 @@ } void SSMIndex::find (uInt aRowNumber, uInt& aBucketNr, - uInt& aStartRow, uInt& anEndRow) const + uInt& aStartRow, uInt& anEndRow, + const String& colName) const { - uInt anIndex = getIndex(aRowNumber); + uInt anIndex = getIndex(aRowNumber, colName); aBucketNr = itsBucketNumber[anIndex]; anEndRow = itsLastRow[anIndex]; aStartRow = 0; diff -Nru casacore-2.2.0/tables/DataMan/SSMIndex.h casacore-2.3.0/tables/DataMan/SSMIndex.h --- casacore-2.2.0/tables/DataMan/SSMIndex.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/SSMIndex.h 2017-10-12 12:24:04.000000000 +0000 @@ -141,11 +141,11 @@ // An exception is thrown if not found. // It also sets the first and last row number fitting in that bucket. void find (uInt aRowNumber, uInt& aBucketNr, uInt& aStartRow, - uInt& anEndRow) const; + uInt& anEndRow, const String& colName) const; private: // Get the index of the bucket containing the given row. - uInt getIndex (uInt aRowNr) const; + uInt getIndex (uInt aRowNr, const String& colName) const; //# Pointer to specific Storage Manager. diff -Nru casacore-2.2.0/tables/DataMan/SSMIndStringColumn.cc casacore-2.3.0/tables/DataMan/SSMIndStringColumn.cc --- casacore-2.2.0/tables/DataMan/SSMIndStringColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/SSMIndStringColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -72,10 +72,10 @@ itsSSMPtr->getStringHandler()->getShape(aShape, buf[0], buf[1], buf[2]); } else { - throw (DataManInvOper ("SSMIndStringColumn::getShape: no array in row "+ - String::toString(aRowNr) + " of column " + throw DataManInvOper ("SSMIndStringColumn::getShape: no array in row "+ + String::toString(aRowNr) + " in column " + columnName() - + " in table " + itsSSMPtr->table().tableName())); + + " of table " + itsSSMPtr->table().tableName()); } return aShape; } @@ -111,10 +111,10 @@ Int buf[3]; getRowValue(buf, aRowNr); if ( buf[2] == 0 ) { - throw (DataManInvOper ( - "SSMIndStringColumn::getArrayStringV: no array in row " - + String::toString(aRowNr) + " of column " + columnName() - + " in table " + itsSSMPtr->table().tableName())); + throw DataManInvOper + ("SSMIndStringColumn::getArrayStringV: no array in row " + + String::toString(aRowNr) + " in column " + columnName() + + " of table " + itsSSMPtr->table().tableName()); } else { itsSSMPtr->getStringHandler()->get(*aDataPtr, buf[0], buf[1], diff -Nru casacore-2.2.0/tables/DataMan/StArrayFile.cc casacore-2.3.0/tables/DataMan/StArrayFile.cc --- casacore-2.2.0/tables/DataMan/StArrayFile.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/StArrayFile.cc 2017-10-12 12:24:04.000000000 +0000 @@ -143,7 +143,8 @@ { Int64 newpos = iofil_p->seek (pos); if (newpos != pos) { - throw (DataManError ("StManArrayFile::setpos failed")); + throw (DataManError ("StManArrayFile::setpos failed in file " + + file_p->fileName())); } } diff -Nru casacore-2.2.0/tables/DataMan/StManAipsIO.cc casacore-2.3.0/tables/DataMan/StManAipsIO.cc --- casacore-2.2.0/tables/DataMan/StManAipsIO.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/StManAipsIO.cc 2017-10-12 12:24:04.000000000 +0000 @@ -118,8 +118,10 @@ } } if (i > Int(nrext_p)) { - throw (indexError(index, "StManColumnAipsIO::findExt - " - "rownr out of range")); + throw indexError(index, "StManColumnAipsIO::findExt - " + "rownr " + String::toString(index) + + " in column " + columnName() + + " out of range"); } if (setCache) { columnCache().set (ncum_p[i-1], ncum_p[i]-1, data_p[i]); @@ -544,8 +546,8 @@ //# Get and check nr of values. ios >> nr; if (nr != nrval) { - throw (DataManInternalError - ("StManColumnAipsIO::getFile: mismatch in #values")); + throw DataManInternalError + ("StManColumnAipsIO::getFile: mismatch in #values"); } deleteAll(); if (nrval > 0) { @@ -558,7 +560,7 @@ nr = nrval - nrd; } if (nr+nrd > nrval) { - throw (DataManInternalError ("StManColumnAipsIO::getFile")); + throw DataManInternalError ("StManColumnAipsIO::getFile"); } getData (datap, nrd, nr, ios, version); nrd += nr; @@ -752,7 +754,7 @@ return; } } - throw (DataManInternalError ("StManAipsIO::addColumn")); + throw DataManInternalError ("StManAipsIO::addColumn"); } void StManAipsIO::removeColumn (DataManagerColumn* colp) @@ -768,7 +770,9 @@ return; } } - throw (DataManInternalError ("StManAipsIO::removeColumn: no such column")); + throw DataManInternalError ("StManAipsIO::removeColumn: " + " column " + colp->columnName() + + " does not exist"); } void StManAipsIO::addRow (uInt nr) @@ -851,8 +855,8 @@ ios >> nrrow_p; ios >> nrc; if (snr != sequenceNr() || nrc != ncolumn()) { - throw (DataManInternalError - ("StManAipsIO::open: mismatch in seqnr,#col")); + throw DataManInternalError + ("StManAipsIO::open: mismatch in seqnr,#col"); } if (nrrow != nrrow_p) { #if defined(TABLEREPAIR) @@ -861,17 +865,16 @@ cerr << "Remainder will be added or discarded" << endl; setHasPut(); #else - throw (DataManInternalError - ("StManAipsIO::open: mismatch in #row; expected " + - String::toString(nrrow) + ", found " + - String::toString(nrrow_p))); + throw DataManInternalError + ("StManAipsIO::open: mismatch in #row; expected " + + String::toString(nrrow) + ", found " + String::toString(nrrow_p)); #endif } for (i=0; i> dt; if (dt != colSet_p[i]->dataType()) { - throw (DataManInternalError - ("StManAipsIO::open: mismatch in data type")); + throw DataManInternalError + ("StManAipsIO::open: mismatch in data type"); } } //# Now read in all the columns. diff -Nru casacore-2.2.0/tables/DataMan/StManColumn.cc casacore-2.3.0/tables/DataMan/StManColumn.cc --- casacore-2.2.0/tables/DataMan/StManColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/StManColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -859,9 +859,11 @@ void StManColumn::throwGetArray() const - { throw (DataManInvOper ("StManColumn::getArray not possible")); } + { throw (DataManInvOper ("StManColumn::getArray not possible" + " for column " + columnName())); } void StManColumn::throwPutArray() const - { throw (DataManInvOper ("StManColumn::putArray not possible")); } + { throw (DataManInvOper ("StManColumn::putArray not possible" + " for column " + columnName())); } //# For scalars the default implementation of get/putScalarColumn handles @@ -973,7 +975,8 @@ while (rownr <= end) { \ if (! isFixedShape()) { \ if (! iter.array().shape().isEqual (shape(rownr))) { \ - throw DataManError("getArrayColumnCells shape mismatch"); \ + throw DataManError("getArrayColumnCells shape mismatch" \ + " for column " + columnName()); \ } \ } \ aips_name2(getArray,NM) (rownr, &(iter.array())); \ diff -Nru casacore-2.2.0/tables/DataMan/TiledStMan.cc casacore-2.3.0/tables/DataMan/TiledStMan.cc --- casacore-2.2.0/tables/DataMan/TiledStMan.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/TiledStMan.cc 2017-10-12 12:24:04.000000000 +0000 @@ -409,7 +409,8 @@ { if (hypercube >= nhypercubes() || cubeSet_p[hypercube] == 0) { throw (AipsError ("TiledStMan::getTSMCube - hypercube nr " - + String::toString(hypercube) + " does not exist")); + + String::toString(hypercube) + " does not exist in " + + hypercolumnName_p)); } return cubeSet_p[hypercube]; } @@ -702,7 +703,8 @@ uInt nrIdBound = getBindings (idNames, idColSet_p, True); // Check if no non-TiledStMan columns are bound. if (nrDataBound + nrCoordBound + nrIdBound != ncolumn()) { - throw (TSMError ("non-TiledStMan columns bound")); + throw (TSMError ("non-TiledStMan columns bound in " + + hypercolumnName_p)); } // Let the derived class do some more checks. setupCheck (tableDesc, dataNames); @@ -766,13 +768,15 @@ { // Check if the dimensionalities are correct. if (cubeShape.nelements() != nrdim_p) { - throw (TSMError ("addHypercube dimensionality mismatch")); + throw (TSMError ("addHypercube dimensionality mismatch in " + + hypercolumnName_p)); } // Check if all dimensions are > 0. // Only the last one in shape can be 0 (meaning extensible). for (uInt i=0; i= 0) { - throw (TSMError ("addHypercube with already existing id values")); + throw (TSMError ("addHypercube with already existing id values in " + + hypercolumnName_p)); } } @@ -1200,7 +1205,8 @@ //# Do internal check to see if TSMFile really exists. if (sequenceNumber >= fileSet_p.nelements() || fileSet_p[sequenceNumber] == 0) { - throw (DataManInternalError ("TiledStMan::getFile")); + throw (DataManInternalError ("TiledStMan::getFile in " + + hypercolumnName_p)); } return fileSet_p[sequenceNumber]; } diff -Nru casacore-2.2.0/tables/DataMan/TSMCube.cc casacore-2.3.0/tables/DataMan/TSMCube.cc --- casacore-2.2.0/tables/DataMan/TSMCube.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/TSMCube.cc 2017-10-12 12:24:04.000000000 +0000 @@ -412,7 +412,8 @@ const TSMColumn* lastCoordColumn) { if (!extensible_p) { - throw (TSMError ("Hypercube is not extensible")); + throw TSMError ("Hypercube in TSM " + stmanPtr_p->dataManagerName() + + " is not extensible"); } // Make the cache here, otherwise nrTiles_p is too high. makeCache(); @@ -618,7 +619,8 @@ } break; default: - throw (DataManInvDT ("extendCoordinates")); + throw DataManInvDT ("extendCoordinates in TSM " + + stmanPtr_p->dataManagerName()); } } @@ -791,7 +793,7 @@ || windowStart.nelements() > nrdim || windowLength.nelements() > nrdim || axisPath.nelements() > nrdim) { - throw (TSMError ("calcCacheSize: invalid arguments")); + throw TSMError ("calcCacheSize: invalid arguments"); } uInt i; // The unspecified sliceShape dimensions are 1. diff -Nru casacore-2.2.0/tables/DataMan/TSMCubeMMap.cc casacore-2.3.0/tables/DataMan/TSMCubeMMap.cc --- casacore-2.2.0/tables/DataMan/TSMCubeMMap.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/TSMCubeMMap.cc 2017-10-12 12:24:04.000000000 +0000 @@ -124,7 +124,8 @@ const TSMColumn* lastCoordColumn) { if (!extensible_p) { - throw (TSMError ("Hypercube is not extensible")); + throw TSMError ("Hypercube in TSM " + stmanPtr_p->dataManagerName() + + " is not extensible"); } // Make the cache here, otherwise nrTiles_p is too high. makeCache(); diff -Nru casacore-2.2.0/tables/DataMan/TSMDataColumn.cc casacore-2.3.0/tables/DataMan/TSMDataColumn.cc --- casacore-2.2.0/tables/DataMan/TSMDataColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/TSMDataColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -126,8 +126,8 @@ } if (!eq) { if (! canChangeShape()) { - throw (TSMError - ("Shape of data cells in same hypercube differs")); + throw TSMError ("Shape of data cells in same hypercube differs" + " for column " + columnName()); } //# Set the new shape and take care that on the next access //# the cache size is recalculated. @@ -380,7 +380,8 @@ if (! isFixedShape()) { IPosition hcShape = lastCube->cubeShape().getFirst (lastAxis); if (! cellShape.isEqual (hcShape)) { - throw DataManError("getArrayColumnCells shape mismatch"); + throw DataManError("getArrayColumnCells shape mismatch in column " + + columnName()); } } } else { diff -Nru casacore-2.2.0/tables/DataMan/TSMFile.cc casacore-2.3.0/tables/DataMan/TSMFile.cc --- casacore-2.2.0/tables/DataMan/TSMFile.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/TSMFile.cc 2017-10-12 12:24:04.000000000 +0000 @@ -76,7 +76,8 @@ { getObject (ios); if (seqnr != fileSeqnr_p) { - throw (DataManInternalError ("TSMFile::TSMFile")); + throw DataManInternalError ("TSMFile::TSMFile " + + stman->dataManagerName()); } char strc[8]; sprintf (strc, "_TSM%i", fileSeqnr_p); diff -Nru casacore-2.2.0/tables/DataMan/TSMIdColumn.cc casacore-2.3.0/tables/DataMan/TSMIdColumn.cc --- casacore-2.2.0/tables/DataMan/TSMIdColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/TSMIdColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -56,7 +56,8 @@ float value; TSMIdColumn::getfloatV (rownr, &value); if (value != *dataPtr) { - throw (TSMError ("TSMIdColumn::put: new value mismatches existing")); + throw TSMError ("TSMIdColumn::put: new value mismatches existing " + "in id column " + columnName()); } } @@ -73,7 +74,8 @@ T value; \ TSMIdColumn::aips_name2(get,NM) (rownr, &value); \ if (value != *dataPtr) { \ - throw (TSMError ("TSMIdColumn::put: new value mismatches existing")); \ + throw TSMError ("TSMIdColumn::put: new value mismatches existing" \ + " in id column " + columnName()); \ } \ } diff -Nru casacore-2.2.0/tables/DataMan/VirtArrCol.tcc casacore-2.3.0/tables/DataMan/VirtArrCol.tcc --- casacore-2.2.0/tables/DataMan/VirtArrCol.tcc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/VirtArrCol.tcc 2017-10-12 12:24:04.000000000 +0000 @@ -226,7 +226,8 @@ while (rownr <= end) { if (! isFixedShape()) { if (! iter.array().shape().isEqual (shape(rownr))) { - throw DataManError("getArrayColumnCells shape mismatch"); + throw DataManError("getArrayColumnCells shape mismatch" + " for column " + columnName()); } } getArray (rownr, iter.array()); @@ -298,7 +299,8 @@ template void VirtualArrayColumn::putArray (uInt, const Array&) { - throw (DataManInvOper ("VirtualArrayColumn::putArray not possible")); + throw DataManInvOper ("VirtualArrayColumn::putArray not possible" + " for column " + columnName()); } //# The default implementations of the shape functions throw @@ -306,29 +308,34 @@ template void VirtualArrayColumn::setShapeColumn (const IPosition&) { - throw (DataManInvOper ("VirtualArrayColumn::setShapeColumn not possible")); + throw DataManInvOper ("VirtualArrayColumn::setShapeColumn not possible" + " for column " + columnName()); } template void VirtualArrayColumn::setShape (uInt, const IPosition&) { - throw (DataManInvOper ("VirtualArrayColumn::setShape not possible")); + throw DataManInvOper ("VirtualArrayColumn::setShape not possible" + " for column " + columnName()); } template Bool VirtualArrayColumn::isShapeDefined (uInt) { - throw (DataManInvOper ("VirtualArrayColumn::isShapeDefined not possible")); + throw DataManInvOper ("VirtualArrayColumn::isShapeDefined not possible" + " for column " + columnName()); return False; } template uInt VirtualArrayColumn::ndim (uInt) { - throw (DataManInvOper ("VirtualArrayColumn::ndim not possible")); + throw DataManInvOper ("VirtualArrayColumn::ndim not possible" + " for column " + columnName()); return 0; } template IPosition VirtualArrayColumn::shape (uInt) { - throw (DataManInvOper ("VirtualArrayColumn::shape not possible")); + throw DataManInvOper ("VirtualArrayColumn::shape not possible" + " for column " + columnName()); return IPosition(0); } diff -Nru casacore-2.2.0/tables/DataMan/VirtualTaQLColumn.cc casacore-2.3.0/tables/DataMan/VirtualTaQLColumn.cc --- casacore-2.2.0/tables/DataMan/VirtualTaQLColumn.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/DataMan/VirtualTaQLColumn.cc 2017-10-12 12:24:04.000000000 +0000 @@ -162,7 +162,8 @@ // Check if the expression type matches the column type. if (itsNode->isScalar() == itsIsArray) { throw DataManError ("VirtualTaQLColumn: " - "expression and column type mismatch"); + "expression and " + itsColumnName + + " column type mismatch (not both scalar or array)"); } // Check if the data types match. int exptype = itsDataType; @@ -185,7 +186,8 @@ } if (itsNode->dataType() != exptype) { throw DataManError ("VirtualTaQLColumn: " - "expression and column data type mismatch"); + "expression and column " + itsColumnName + + " data type mismatch"); } } diff -Nru casacore-2.2.0/tables/Tables/BaseTabIter.cc casacore-2.3.0/tables/Tables/BaseTabIter.cc --- casacore-2.2.0/tables/Tables/BaseTabIter.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/Tables/BaseTabIter.cc 2017-10-12 12:24:04.000000000 +0000 @@ -49,6 +49,7 @@ int option) : lastRow_p (0), nrkeys_p (keys.nelements()), + keyChangeAtLastNext_p(""), lastVal_p (keys.nelements()), curVal_p (keys.nelements()), colPtr_p (keys.nelements()), @@ -147,6 +148,8 @@ colPtr_p[i]->get (lastRow_p, curVal_p[i]); if (cmpObj_p[i]->comp (curVal_p[i], lastVal_p[i]) != 0) { match = False; + // update so users can see which key changed + keyChangeAtLastNext_p=colPtr_p[i]->columnDesc().name(); break; } } @@ -155,6 +158,11 @@ } itp->addRownr (lastRow_p); } + + // If we've reached the end of the table, clear the keyCh_p + if (lastRow_p==nr) + keyChangeAtLastNext_p=String(); + //# Adjust rownrs in case source table is already a RefTable. Vector& rownrs = *(itp->rowStorage()); sortTab_p->adjustRownrs (itp->nrow(), rownrs, False); diff -Nru casacore-2.2.0/tables/Tables/BaseTabIter.h casacore-2.3.0/tables/Tables/BaseTabIter.h --- casacore-2.2.0/tables/Tables/BaseTabIter.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/Tables/BaseTabIter.h 2017-10-12 12:24:04.000000000 +0000 @@ -104,10 +104,17 @@ // Return the next group. virtual BaseTable* next(); + // Report Name of slowest sort column that changed to + // terminate the most recent call to next() + // Enables clients to sense iteration boundary properties + // and organize associated iterations + inline const String& keyChangeAtLastNext() const { return keyChangeAtLastNext_p; }; + protected: BaseTable* sortTab_p; //# Table sorted in iteration order uInt lastRow_p; //# last row used from reftab uInt nrkeys_p; //# nr of columns in group + String keyChangeAtLastNext_p; //# name of column that terminated most recent next() Block lastVal_p; //# last value per column Block curVal_p; //# current value per column PtrBlock colPtr_p; //# pointer to column objects diff -Nru casacore-2.2.0/tables/Tables/Table.h casacore-2.3.0/tables/Tables/Table.h --- casacore-2.2.0/tables/Tables/Table.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/Tables/Table.h 2017-10-12 12:24:04.000000000 +0000 @@ -547,7 +547,7 @@ Bool cOrder=False) const; // Show the table and/or column keywords, possibly also of all subtables. - // Maximum maxVal> values of Arrays will be shown. + // Maximum maxVal values of Arrays will be shown. void showKeywords (std::ostream&, Bool showSubTables=False, Bool showTabKey=True, diff -Nru casacore-2.2.0/tables/Tables/TableIter.cc casacore-2.3.0/tables/Tables/TableIter.cc --- casacore-2.2.0/tables/Tables/TableIter.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/Tables/TableIter.cc 2017-10-12 12:24:04.000000000 +0000 @@ -127,5 +127,12 @@ subTable_p = Table(tabIterPtr_p->next()); } +// Report Name of slowest column that changes at end of current iteration +const String& TableIterator::keyChangeAtLastNext() const +{ + return tabIterPtr_p->keyChangeAtLastNext(); +} + + } //# NAMESPACE CASACORE - END diff -Nru casacore-2.2.0/tables/Tables/TableIter.h casacore-2.3.0/tables/Tables/TableIter.h --- casacore-2.2.0/tables/Tables/TableIter.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/Tables/TableIter.h 2017-10-12 12:24:04.000000000 +0000 @@ -203,6 +203,9 @@ void operator++(int); // + // Report Name of slowest column that changes at end of current iteration + const String& keyChangeAtLastNext() const; + // Get the current group. Table table() const; diff -Nru casacore-2.2.0/tables/Tables/TableProxy.cc casacore-2.3.0/tables/Tables/TableProxy.cc --- casacore-2.2.0/tables/Tables/TableProxy.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/Tables/TableProxy.cc 2017-10-12 12:24:04.000000000 +0000 @@ -908,24 +908,45 @@ Record TableProxy::getTableDescription (Bool actual, Bool cOrder) { // Get the table description. - TableDesc* tableDescPtr; + const TableDesc* tableDescPtr; if (actual) { tableDescPtr = new TableDesc(table_p.actualTableDesc()); } else { tableDescPtr = new TableDesc(table_p.tableDesc()); } - // Return the table description as a record. - Record rec; - for (uInt i=0; incolumn(); i++) { - const ColumnDesc& columnDescription = tableDescPtr->columnDesc(i); - rec.defineRecord (columnDescription.name(), - recordColumnDesc (columnDescription, cOrder)); - } - rec.defineRecord ("_define_hypercolumn_", recordHCDesc (*tableDescPtr)); + Record rec = getTableDesc(*tableDescPtr, cOrder); + delete tableDescPtr; return rec; } +Record TableProxy::getTableDesc(const TableDesc & tabdesc, Bool cOrder) +{ + Record rec; + + // Convert columns + for (uInt i=0; i shape; - if (isArray) { - ndim = cold.asInt("ndim"); - if (cold.isDefined("shape")) { - shape = cold.asArrayInt ("shape"); - } - Bool cOrder = False; - if (cold.isDefined("_c_order")) { - cOrder = cold.asBool ("_c_order"); - } - if (! addArrayColumnDesc (tabdesc, valtype, name, comment, - dmtype, dmgrp, option, - ndim, shape, cOrder, message)) { - return False; - } - }else{ - if (valtype == "boolean" || valtype == "bool") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, option)); - } else if (valtype == "byte" || valtype == "uchar") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, 0, option)); - } else if (valtype == "short") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, 0, option)); - } else if (valtype == "ushort") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, 0, option)); - } else if (valtype == "integer" || valtype == "int") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, 0, option)); - } else if (valtype == "uint") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, 0, option)); - } else if (valtype == "float") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, option)); - } else if (valtype == "double") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, option)); - } else if (valtype == "complex") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, option)); - } else if (valtype == "dcomplex") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, option)); - } else if (valtype == "string") { - tabdesc.addColumn (ScalarColumnDesc - (name, comment, dmtype, dmgrp, option)); - } else if (valtype == "record") { - tabdesc.addColumn (ScalarRecordColumnDesc - (name, comment, dmtype, dmgrp)); - }else{ - message = "Unknown data type " + valtype + - " for scalar column " + name; - return False; - } - } - // Set maximum string length. - if (maxlen > 0) { - tabdesc.rwColumnDesc(nrdone).setMaxLength (maxlen); - } - // Define the keywords if needed. - if (cold.isDefined ("keywords")) { - TableRecord& keySet (tabdesc.rwColumnDesc(nrdone).rwKeywordSet()); - keySet.fromRecord (cold.asRecord("keywords")); - } - } - nrdone++; - } - if (gdesc.isDefined ("_define_hypercolumn_")) { - if (! makeHC (gdesc.asRecord("_define_hypercolumn_"), tabdesc, message)) { - return False; + for(uInt nrdone=0, nrcols=0; nrdone < gdesc.nfields(); ++nrdone) { + String name = gdesc.name(nrdone); + const Record& cold (gdesc.asRecord(nrdone)); + + // Avoid special records for now + if(name == "_define_hypercolumn_") { + // Ignore, for now, handled later + continue; + } else if(name == "_define_dminfo_") { + // Ignore, this is obsolete + continue; + } else if(name == "_keywords_") { + // Unpack keywords into TableDesc + tabdesc.rwKeywordSet().fromRecord(cold); + continue; + } else if(name == "_private_keywords_") { + // Ignore, private keywords are not + // publicly accessable on TableDesc + continue; + } else if(!cold.isDefined("valueType")) { + // Assume it is a column and complain as + // no value type exists to describe it + message = "No value type for column " + name; + return False; + } + + String valtype = cold.asString("valueType"); + valtype.downcase(); + + int option = 0; + if (cold.isDefined("option")) { + option = cold.asInt("option"); + } + + int maxlen = 0; + if (cold.isDefined("maxlen")) { + maxlen = cold.asInt("maxlen"); + } + + String comment, dmtype, dmgrp; + if (cold.isDefined("comment")) { + comment = cold.asString ("comment"); + } + + if (cold.isDefined("dataManagerType")) { + dmtype = cold.asString("dataManagerType"); + } + + if (cold.isDefined("dataManagerGroup")) { + dmgrp = cold.asString("dataManagerGroup"); + } + + Bool isArray = cold.isDefined("ndim"); + Int ndim; + Vector shape; + + if (isArray) { + ndim = cold.asInt("ndim"); + if (cold.isDefined("shape")) { + shape = cold.asArrayInt ("shape"); + } + Bool cOrder = False; + if (cold.isDefined("_c_order")) { + cOrder = cold.asBool ("_c_order"); + } + if (! addArrayColumnDesc (tabdesc, valtype, name, comment, + dmtype, dmgrp, option, + ndim, shape, cOrder, message)) { + return False; + } + } else { + if (valtype == "boolean" || valtype == "bool") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, option)); + } else if (valtype == "byte" || valtype == "uchar") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, 0, option)); + } else if (valtype == "short") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, 0, option)); + } else if (valtype == "ushort") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, 0, option)); + } else if (valtype == "integer" || valtype == "int") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, 0, option)); + } else if (valtype == "uint") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, 0, option)); + } else if (valtype == "float") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, option)); + } else if (valtype == "double") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, option)); + } else if (valtype == "complex") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, option)); + } else if (valtype == "dcomplex") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, option)); + } else if (valtype == "string") { + tabdesc.addColumn (ScalarColumnDesc + (name, comment, dmtype, dmgrp, option)); + } else if (valtype == "record") { + tabdesc.addColumn (ScalarRecordColumnDesc + (name, comment, dmtype, dmgrp)); + }else{ + message = "Unknown data type " + valtype + + " for scalar column " + name; + return False; + } + } + // Set maximum string length. + if (maxlen > 0) { + tabdesc.rwColumnDesc(nrcols).setMaxLength (maxlen); + } + // Define the keywords if needed. + if (cold.isDefined ("keywords")) { + TableRecord& keySet (tabdesc.rwColumnDesc(nrcols).rwKeywordSet()); + keySet.fromRecord (cold.asRecord("keywords")); + } + + ++nrcols; + } + + if (gdesc.isDefined ("_define_hypercolumn_")) { + if (! makeHC (gdesc.asRecord("_define_hypercolumn_"), tabdesc, message)) { + return False; + } } - } - return True; + + return True; } Bool TableProxy::addArrayColumnDesc (TableDesc& tabdesc, @@ -1963,6 +2008,11 @@ cdesc.define ("_c_order", cOrder); } } + + // Column keywords + const TableRecord & keys = cold.keywordSet(); + cdesc.defineRecord("keywords", keys.toRecord()); + return cdesc; } diff -Nru casacore-2.2.0/tables/Tables/TableProxy.h casacore-2.3.0/tables/Tables/TableProxy.h --- casacore-2.2.0/tables/Tables/TableProxy.h 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/Tables/TableProxy.h 2017-10-12 12:24:04.000000000 +0000 @@ -569,6 +569,9 @@ Record getTableDescription (Bool actual, //# use actual description? Bool cOrder=False); + // Create a Record table description from a TableDesc object + static Record getTableDesc(const TableDesc & tabdesc, Bool cOrder=False); + // Get the column description of a column in the table. // It returns a record containing the description. Record getColumnDescription (const String& columnName, @@ -602,8 +605,6 @@ static void putKeyValues (TableRecord& keySet, const Record& valueSet); // - -private: // Get the lock options from the fields in the record. // If the record or lockoption is invalid, an exception is thrown. static TableLock makeLockOptions (const Record& options); @@ -614,7 +615,79 @@ // Make hypercolumn definitions for the given hypercolumns. static Bool makeHC (const Record& gdesc, TableDesc& tabdesc, - String& message); + String& message); + + // Get the value of a keyword. + static ValueHolder getKeyValue (const TableRecord& keySet, + const RecordFieldId& fieldId); + + // Put the value of a keyword. + static void putKeyValue (TableRecord& keySet, + const RecordFieldId& fieldId, + const ValueHolder& value); + + // Make a real table description from a table description in a record. + // An exception is thrown if the record table description is invalid. + // A record table description is a Record object as returned by + // getDesc. + static Bool makeTableDesc (const Record& gdesc, TableDesc& tabdesc, + String& message); + + // Add an array column description to the table description. + // It is used by the function makeDesc. + static Bool addArrayColumnDesc (TableDesc& tableDesc, + const String& valueType, + const String& columnName, + const String& comment, + const String& dataManagerType, + const String& dataManagerGroup, + int options, + Int ndim, const Vector& shape, + Bool cOrder, + String& message); + + // Make a record containing the column description. + static Record recordColumnDesc (const ColumnDesc&, Bool cOrder); + + // Make a record containing the description of all hypercolumns. + static Record recordHCDesc (const TableDesc& tableDesc); + + // Calculate the values of a CALC expression and store them in field + // 'values' in rec. + static void calcValues (Record& rec, const TableExprNode& expr); + + // Get the type string as used externally (in e.g. glish). + static String getTypeStr (DataType); + + // Optionally reverse the axes. + static IPosition fillAxes (const IPosition&, Bool cOrder); + + // Check if the new shape is still the same. + //
    same: 0=first time; 1=still the same; 2=different + static void stillSameShape (Int& same, IPosition& shape, + const IPosition& newShape); + + // Copy the array contents of the record fields to a single array. + // This can only be done if the shape is constant. + template + static Array record2Array (const Record& rec) + { + if (rec.empty()) { + return Array(); + } + Array tmp; + rec.get (0, tmp); + IPosition shp(tmp.shape()); + shp.append (IPosition(1, rec.size())); + Array arr(shp); + ArrayIterator iter(arr, tmp.ndim()); + for (uInt i=0; i - // Get the value of a keyword. - static ValueHolder getKeyValue (const TableRecord& keySet, - const RecordFieldId& fieldId); - - // Put the value of a keyword. - static void putKeyValue (TableRecord& keySet, - const RecordFieldId& fieldId, - const ValueHolder& value); - - // Make a real table description from a table description in a record. - // An exception is thrown if the record table description is invalid. - // A record table description is a Record object as returned by - // getDesc. - static Bool makeTableDesc (const Record& gdesc, TableDesc& tabdesc, - String& message); - - // Add an array column description to the table description. - // It is used by the function makeDesc. - static Bool addArrayColumnDesc (TableDesc& tableDesc, - const String& valueType, - const String& columnName, - const String& comment, - const String& dataManagerType, - const String& dataManagerGroup, - int options, - Int ndim, const Vector& shape, - Bool cOrder, - String& message); - - // Make a record containing the column description. - static Record recordColumnDesc (const ColumnDesc&, Bool cOrder); - - // Make a record containing the description of all hypercolumns. - static Record recordHCDesc (const TableDesc& tableDesc); - // Replace the user-given default value (<0) by the default value // used by Slicer (i.e. by Slicer::MimicSource). void setDefaultForSlicer (IPosition& vec) const; - // Calculate the values of a CALC expression and store them in field - // 'values' in rec. - static void calcValues (Record& rec, const TableExprNode& expr); - // Synchronize table if readlocking is in effect. // In this way the number of rows is up-to-date. void syncTable (Table& table); - // Get the type string as used externally (in e.g. glish). - static String getTypeStr (DataType); - - // Optionally reverse the axes. - static IPosition fillAxes (const IPosition&, Bool cOrder); - - // Check if the new shape is still the same. - //
    same: 0=first time; 1=still the same; 2=different - static void stillSameShape (Int& same, IPosition& shape, - const IPosition& newShape); - - // Copy the array contents of the record fields to a single array. - // This can only be done if the shape is constant. - template - static Array record2Array (const Record& rec) - { - if (rec.empty()) { - return Array(); - } - Array tmp; - rec.get (0, tmp); - IPosition shp(tmp.shape()); - shp.append (IPosition(1, rec.size())); - Array arr(shp); - ArrayIterator iter(arr, tmp.ndim()); - for (uInt i=0; i #include +#include #include #include #include +#include #include #include #include @@ -821,6 +823,70 @@ TableRecord rec4(rec4a); AlwaysAssertExit (rec4.nfields() == 1); AlwaysAssertExit (rec4.asDouble("fld1") == 1.); + + // Test that a Record constructed with a TableDesc + // can be converted back into an equivalent TableDesc + TableDesc td3 ("td3", TableDesc::Scratch); + td3.addColumn (ScalarColumnDesc ("icol1")); + td3.addColumn (ScalarColumnDesc ("icol2")); + td3.addColumn (ScalarColumnDesc ("dcol1")); + td3.addColumn (ScalarColumnDesc ("dcol2")); + td3.addColumn (ScalarColumnDesc ("col1")); + td3.addColumn (ScalarColumnDesc ("col2")); + + + uInt keyvalue1 = 10; + td3.rwKeywordSet().define("key1", keyvalue1); + + // Add a hypercolumn + Vector dcnames(2); + dcnames[0] = "dcol1"; + dcnames[1] = "dcol2"; + Vector ccnames(2); + ccnames[0] = "col1"; + ccnames[1] = "col2"; + Vector icnames(2); + icnames[0] = "icol1"; + icnames[1] = "icol2"; + td3.defineHypercolumn("hc1", 2, dcnames, ccnames, icnames); + + // Convert to Record + Record rec5 = TableProxy::getTableDesc(td3); + + // Convert back to TableDesc + TableDesc td4; + String msg; + TableProxy::makeTableDesc(rec5, td4, msg); + + // Check that the number of columns is equal + AlwaysAssertExit (td3.ncolumn() == td4.ncolumn()); + + for(uInt i=0; i dcresult; + Vector ccresult; + Vector icresult; + uInt dim = td4.hypercolumnDesc("hc1", dcresult, ccresult, icresult); + + AlwaysAssertExit (dim == 2); + + for(uInt i=0; i //

    Applications to inspect/manipulate a table

    //
      -//
    • showtable shows the structure of a table. It can show: +//
    • showtableinfo shows the structure of a table. It can show: //
        //
      • the columns and their format (optionally sorted on name) //
      • the data managers used to store the column data diff -Nru casacore-2.2.0/tables/TaQL/ExprFuncNodeArray.cc casacore-2.3.0/tables/TaQL/ExprFuncNodeArray.cc --- casacore-2.2.0/tables/TaQL/ExprFuncNodeArray.cc 2016-12-01 08:43:41.000000000 +0000 +++ casacore-2.3.0/tables/TaQL/ExprFuncNodeArray.cc 2017-10-12 12:24:04.000000000 +0000 @@ -524,7 +524,18 @@ return order; } // Remove possibly too high axes. - return removeAxes (order, ndim); + IPosition ord = removeAxes (order, ndim); + if (!isCOrder_p) { + return ord; + } + // Take care of correct mapping for Python style. + // Unspecified axes have to be added first. + IPosition ordf = IPosition::makeAxisPath (ndim, ord); + IPosition nord(ordf.size()); + for (uInt i=0; i