-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a skeleton MeasurementSets module
for now it only allows you to create a measurement set with default keywords and columns
- Loading branch information
1 parent
79c95b4
commit 92d82c5
Showing
8 changed files
with
168 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
CXX = g++ | ||
CXXFLAGS = -c -std=c++0x -Wall -Werror -fpic -Wno-return-type-c-linkage | ||
|
||
SRC = $(wildcard *.cpp) | ||
OBJ = $(SRC:.cpp=.o) | ||
|
||
.PHONY: all clean | ||
|
||
all: module.o | ||
|
||
module.o: $(OBJ) | ||
$(LD) -r $(OBJ) -o module.o | ||
|
||
%.o: %.cpp | ||
$(CXX) $(CXXFLAGS) -o $@ $< | ||
|
||
clean: | ||
-rm -f $(OBJ) | ||
-rm -f module.o | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2015-2017 Michael Eastwood | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program 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 General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
#include <casacore/tables/Tables.h> | ||
#include <casacore/ms/MeasurementSets.h> | ||
using namespace casacore; | ||
|
||
extern "C" { | ||
Table* new_measurement_set_create(char* path) { | ||
SetupNewTable maker(path, MS::requiredTableDesc(), Table::NewNoReplace); | ||
MeasurementSet* ms = new MeasurementSet(maker); | ||
ms->createDefaultSubtables(Table::New); | ||
return ms; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ module CasaCore | |
|
||
include("Tables.jl") | ||
include("Measures.jl") | ||
include("MeasurementSets.jl") | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) 2015-2017 Michael Eastwood | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program 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 General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"The `MeasurementSets` module is used to interact with CasaCore measurement sets." | ||
module MeasurementSets | ||
|
||
using ..Tables | ||
|
||
const libcasacorewrapper = normpath(joinpath(@__DIR__, "..", "deps", "src", | ||
"libcasacorewrapper.so")) | ||
|
||
function __init__() | ||
isfile(libcasacorewrapper) || error("Run Pkg.build(\"CasaCore\")") | ||
end | ||
|
||
include("measurement-sets/measurement-sets.jl") | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) 2015-2017 Michael Eastwood | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program 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 General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
function create(path) | ||
path = Tables.table_fix_path(path) | ||
if isfile(path) || isdir(path) | ||
Tables.table_exists_error() | ||
end | ||
ptr = ccall((:new_measurement_set_create, libcasacorewrapper), Ptr{Tables.CasaCoreTable}, | ||
(Ptr{Cchar},), path) | ||
Table(path, Tables.readwrite, ptr) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright (c) 2015-2017 Michael Eastwood | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program 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 General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
@testset "Measurement Sets" begin | ||
|
||
@testset "creation" begin | ||
path = tempname()*".ms" | ||
ms = MeasurementSets.create(path) | ||
@test Tables.column_exists(ms, "UVW") | ||
@test Tables.column_exists(ms, "FLAG") | ||
@test Tables.column_exists(ms, "FLAG_CATEGORY") | ||
@test Tables.column_exists(ms, "WEIGHT") | ||
@test Tables.column_exists(ms, "SIGMA") | ||
@test Tables.column_exists(ms, "ANTENNA1") | ||
@test Tables.column_exists(ms, "ANTENNA2") | ||
@test Tables.column_exists(ms, "ARRAY_ID") | ||
@test Tables.column_exists(ms, "DATA_DESC_ID") | ||
@test Tables.column_exists(ms, "EXPOSURE") | ||
@test Tables.column_exists(ms, "FEED1") | ||
@test Tables.column_exists(ms, "FEED2") | ||
@test Tables.column_exists(ms, "FIELD_ID") | ||
@test Tables.column_exists(ms, "FLAG_ROW") | ||
@test Tables.column_exists(ms, "INTERVAL") | ||
@test Tables.column_exists(ms, "OBSERVATION_ID") | ||
@test Tables.column_exists(ms, "PROCESSOR_ID") | ||
@test Tables.column_exists(ms, "SCAN_NUMBER") | ||
@test Tables.column_exists(ms, "STATE_ID") | ||
@test Tables.column_exists(ms, "TIME") | ||
@test Tables.column_exists(ms, "TIME_CENTROID") | ||
@test ms[kw"MS_VERSION"] === Float32(2) | ||
@test Tables.keyword_exists(ms, kw"ANTENNA") | ||
@test Tables.keyword_exists(ms, kw"DATA_DESCRIPTION") | ||
@test Tables.keyword_exists(ms, kw"FEED") | ||
@test Tables.keyword_exists(ms, kw"FLAG_CMD") | ||
@test Tables.keyword_exists(ms, kw"FIELD") | ||
@test Tables.keyword_exists(ms, kw"HISTORY") | ||
@test Tables.keyword_exists(ms, kw"OBSERVATION") | ||
@test Tables.keyword_exists(ms, kw"POINTING") | ||
@test Tables.keyword_exists(ms, kw"POLARIZATION") | ||
@test Tables.keyword_exists(ms, kw"PROCESSOR") | ||
@test Tables.keyword_exists(ms, kw"SPECTRAL_WINDOW") | ||
@test Tables.keyword_exists(ms, kw"STATE") | ||
Tables.delete(ms) | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters