Skip to content

Commit 0b45ff5

Browse files
committed
Switched from phypp to vif
1 parent 0aba058 commit 0b45ff5

18 files changed

+179
-127
lines changed

CMakeLists.txt

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (NOT CMAKE_BUILD_TYPE)
77
endif()
88

99
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
10-
find_package(phypp)
10+
find_package(vif)
1111

1212
set(EGG_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/egg)
1313
install(FILES
@@ -24,37 +24,37 @@ install(DIRECTORY share/psfs
2424
add_definitions(-DEGG_SHARE_DIR="${EGG_SHARE_DIR}")
2525
add_definitions(-DFILTER_DB_DIR="${EGG_SHARE_DIR}/filter-db")
2626

27-
include_directories(${PHYPP_INCLUDE_DIRS})
27+
include_directories(${VIF_INCLUDE_DIRS})
2828

29-
message(STATUS ${PHYPP_INCLUDE_DIRS})
29+
message(STATUS ${VIF_INCLUDE_DIRS})
3030

3131
add_executable(egg-gencat src/egg-gencat.cpp)
32-
target_link_libraries(egg-gencat ${PHYPP_LIBRARIES})
32+
target_link_libraries(egg-gencat ${VIF_LIBRARIES})
3333
install(TARGETS egg-gencat DESTINATION bin)
3434

3535
if (NOT NO_GENMAP)
3636
add_executable(egg-genmap src/egg-genmap.cpp)
37-
target_link_libraries(egg-genmap ${PHYPP_LIBRARIES})
37+
target_link_libraries(egg-genmap ${VIF_LIBRARIES})
3838
install(TARGETS egg-genmap DESTINATION bin)
3939

4040
add_executable(egg-gennoise src/egg-gennoise.cpp)
41-
target_link_libraries(egg-gennoise ${PHYPP_LIBRARIES})
41+
target_link_libraries(egg-gennoise ${VIF_LIBRARIES})
4242
install(TARGETS egg-gennoise DESTINATION bin)
4343
endif()
4444

4545
add_executable(egg-buildmf src/egg-buildmf.cpp)
46-
target_link_libraries(egg-buildmf ${PHYPP_LIBRARIES})
46+
target_link_libraries(egg-buildmf ${VIF_LIBRARIES})
4747
install(TARGETS egg-buildmf DESTINATION bin)
4848

4949
add_executable(egg-2skymaker src/egg-2skymaker.cpp)
50-
target_link_libraries(egg-2skymaker ${PHYPP_LIBRARIES})
50+
target_link_libraries(egg-2skymaker ${VIF_LIBRARIES})
5151
install(TARGETS egg-2skymaker DESTINATION bin)
5252

5353
add_executable(egg-postskymaker src/egg-postskymaker.cpp)
54-
target_link_libraries(egg-postskymaker ${PHYPP_LIBRARIES})
54+
target_link_libraries(egg-postskymaker ${VIF_LIBRARIES})
5555
install(TARGETS egg-postskymaker DESTINATION bin)
5656

5757

5858
add_executable(egg-getsed src/egg-getsed.cpp)
59-
target_link_libraries(egg-getsed ${PHYPP_LIBRARIES})
59+
target_link_libraries(egg-getsed ${VIF_LIBRARIES})
6060
install(TARGETS egg-getsed DESTINATION bin)

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Empirical Galaxy Generator (EGG) is a set of tools to generate fake galaxy c
44
These tools can be used to test source extraction codes, or to evaluate the reliability of any map-based science (stacking, dropout identification, ...).
55

66
# Installation
7-
You must have the [phy++] library installed on your machine to compile EGG, configured at least with cfitsio and WCSlib support. [CMake] is used as a build system to handle dependency checks and compilation in a cross-platform way.
7+
You must have the [vif] library installed on your machine to compile EGG, configured at least with cfitsio and WCSlib support. [CMake] is used as a build system to handle dependency checks and compilation in a cross-platform way.
88

99
One you have installed all the dependencies, create yourself a directory called 'build' within the current directory. Navigate to the 'build' directory with your terminal, and call:
1010

@@ -22,6 +22,6 @@ See the output of 'egg-gencat help' after installing the programs.
2222
For further and more detailed help, see the documentation in the 'doc/' folder.
2323

2424
[SkyMaker]: http://www.astromatic.net/software/skymaker
25-
[phy++]: http://cschreib.github.io/phypp/
25+
[vif]: http://cschreib.github.io/vif/
2626
[CMake]: http://www.cmake.org/
2727
[install.sh]: https://raw.githubusercontent.com/cschreib/egg/master/doc/scripts/install.sh

cmake/FindGooglePerfTools.cmake

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# http://code.google.com/p/emeraldviewer/issues/detail?id=13&thanks=13&ts=1391277811
1717

1818
FIND_PATH(GOOGLE_PERFTOOLS_INCLUDE_DIR google/heap-profiler.h
19-
HINTS ${TCMALLOC_ROOT_DIR} PATH_SUFFIXES lib
20-
)
19+
HINTS ${TCMALLOC_ROOT_DIR} PATH_SUFFIXES lib
20+
)
2121

2222
SET(TCMALLOC_NAMES ${TCMALLOC_NAMES} tcmalloc)
2323
FIND_LIBRARY(TCMALLOC_LIBRARY
@@ -52,6 +52,10 @@ IF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
5252
SET(PROFILER_LIBRARIES ${PROFILER_LIBRARY})
5353
ENDIF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
5454

55+
FIND_PROGRAM(PROFILER_BINARY NAMES google-pprof pprof
56+
HINTS ${TCMALLOC_ROOT_DIR} PATH_SUFFIXES bin
57+
)
58+
5559
IF (GOOGLE_PERFTOOLS_FOUND)
5660
IF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY)
5761
MESSAGE(STATUS "Found Google perftools: ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES} ${PROFILER_LIBRARIES}")
@@ -66,5 +70,6 @@ MARK_AS_ADVANCED(
6670
TCMALLOC_LIBRARY
6771
STACKTRACE_LIBRARY
6872
PROFILER_LIBRARY
73+
PROFILER_BINARY
6974
GOOGLE_PERFTOOLS_INCLUDE_DIR
7075
)

cmake/FindWCSLib.cmake

+10-4
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,17 @@ if(NOT WCSLIB_FOUND)
3838
HINTS ${WCSLIB_ROOT_DIR} PATH_SUFFIXES lib)
3939
find_library(M_LIBRARY m)
4040

41-
file(STRINGS "${WCSLIB_INCLUDE_DIR}/wcslib/wcsconfig.h" TLINE
42-
REGEX "^#[\t ]*define[\t ]+WCSLIB_VERSION[\t ]+[0-9.]+$")
41+
if(EXISTS ${WCSLIB_INCLUDE_DIR})
42+
file(STRINGS "${WCSLIB_INCLUDE_DIR}/wcslib/wcsconfig.h" TLINE
43+
REGEX "^#[\t ]*define[\t ]+WCSLIB_VERSION[\t ]+[0-9.]+$")
4344

44-
string(REGEX REPLACE "^^#[\t ]*define[\t ]+WCSLIB_VERSION[\t ]+([0-9.]+)$" "\\1"
45-
WCSLIB_VERSION_STRING "${TLINE}")
45+
string(REGEX REPLACE "^#[\t ]*define[\t ]+WCSLIB_VERSION[\t ]+([0-9.]+)$" "\\1"
46+
WCSLIB_VERSION_STRING "${TLINE}")
47+
48+
if(NOT "${WCSLIB_VERSION_STRING}" STREQUAL "")
49+
message(STATUS "Found WCSLIB version ${WCSLIB_VERSION_STRING}")
50+
endif()
51+
endif()
4652

4753
mark_as_advanced(WCSLIB_INCLUDE_DIR WCSLIB_LIBRARY WCSLIB_VERSION_STRING M_LIBRARY)
4854

cmake/Findphypp.cmake renamed to cmake/Findvif.cmake

+69-46
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
if(NOT PHYPP_FOUND)
2-
# fine phy++ headers
3-
find_path(PHYPP_INCLUDE_DIR phypp.hpp
4-
HINTS ${PHYPP_ROOT_DIR} PATH_SUFFIXES include)
1+
if(NOT VIF_FOUND)
2+
# Find vif headers
3+
find_path(VIF_INCLUDE_DIR vif.hpp
4+
HINTS ${VIF_ROOT_DIR} PATH_SUFFIXES include)
55

6-
find_path(PHYPP_COMPILER_DIR cphy++
7-
HINTS ${PHYPP_ROOT_DIR} PATH_SUFFIXES bin)
6+
find_path(VIF_COMPILER_DIR cvif
7+
HINTS ${VIF_ROOT_DIR} PATH_SUFFIXES bin)
88

9-
find_path(PHYPP_REFGEN_DIR phy++-refgen
10-
HINTS ${PHYPP_ROOT_DIR} PATH_SUFFIXES bin)
9+
find_path(VIF_REFGEN_DIR vif-refgen
10+
HINTS ${VIF_ROOT_DIR} PATH_SUFFIXES bin)
1111

12-
set(PHYPP_COMPILER ${PHYPP_COMPILER_DIR}/cphy++)
13-
set(PHYPP_REFGEN ${PHYPP_REFGEN_DIR}/phy++-refgen)
12+
set(VIF_COMPILER ${VIF_COMPILER_DIR}/cvif)
13+
set(VIF_REFGEN ${VIF_REFGEN_DIR}/vif-refgen)
1414

15-
mark_as_advanced(PHYPP_INCLUDE_DIR PHYPP_REFGEN PHYPP_COMPILER)
15+
mark_as_advanced(VIF_INCLUDE_DIR VIF_REFGEN VIF_COMPILER)
1616

1717
include(FindPackageHandleStandardArgs)
18-
find_package_handle_standard_args(PHYPP DEFAULT_MSG PHYPP_INCLUDE_DIR)
18+
find_package_handle_standard_args(VIF DEFAULT_MSG VIF_INCLUDE_DIR)
1919

20-
set(PHYPP_INCLUDE_DIRS ${PHYPP_INCLUDE_DIR})
20+
set(VIF_INCLUDE_DIRS ${VIF_INCLUDE_DIR})
2121

22-
# configure compilers
22+
# Configure compilers
2323
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
2424
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3))
2525
message(STATUS "clang version >= 3.3 (${CMAKE_CXX_COMPILER_VERSION})")
2626
else()
27-
message(FATAL_ERROR "phy++ requires advanced features from the C++11 norm that are only available with clang 3.3 or higher (your version: ${CMAKE_CXX_COMPILER_VERSION}). Please upgrade your compiler.")
27+
message(FATAL_ERROR "vif requires advanced features from the C++11 norm that are only available with clang 3.3 or higher (your version: ${CMAKE_CXX_COMPILER_VERSION}). Please upgrade your compiler.")
2828
endif()
2929

3030
add_definitions(-Weverything)
@@ -51,7 +51,7 @@ if(NOT PHYPP_FOUND)
5151
add_definitions(-Wno-old-style-cast)
5252
endif()
5353
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8))
54-
add_definitions(-Wno-double-promote)
54+
add_definitions(-Wno-double-promotion)
5555
endif()
5656

5757
add_definitions(-std=c++11)
@@ -64,28 +64,40 @@ if(NOT PHYPP_FOUND)
6464
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7))
6565
message(STATUS "gcc version >= 4.7 (${CMAKE_CXX_COMPILER_VERSION})")
6666
else()
67-
message(FATAL_ERROR "phy++ requires advanced features from the C++11 norm that are only available with gcc 4.7 or higher (your version: ${CMAKE_CXX_COMPILER_VERSION}). Please upgrade your compiler.")
67+
message(FATAL_ERROR "vif requires advanced features from the C++11 norm that are only available with gcc 4.7 or higher (your version: ${CMAKE_CXX_COMPILER_VERSION}). Please upgrade your compiler.")
6868
endif()
6969
endif()
7070

7171
add_definitions(-Wall)
7272
add_definitions(-std=c++11)
7373
add_definitions(-fmax-errors=5)
7474
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
75-
message(ERROR "Intel C++ compiler is not supported")
75+
if ("${CMAKE_CXX_COMPILER_VERSION}" STREQUAL "")
76+
message(WARNING "could not figure out the version of Intel compiler, let's hope it is >= 14")
77+
else()
78+
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14))
79+
message(STATUS "Intel version >= 14 (${CMAKE_CXX_COMPILER_VERSION})")
80+
else()
81+
message(FATAL_ERROR "vif requires advanced features from the C++11 norm that are only available with Intel compiler 14 or higher (your version: ${CMAKE_CXX_COMPILER_VERSION}). Please upgrade your compiler.")
82+
endif()
83+
endif()
84+
85+
add_definitions(-Wall)
86+
add_definitions(-std=c++11)
87+
add_definitions(-diag-error-limit=5)
7688
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
7789
message(ERROR "Microsoft Visual C++ compiler is not supported")
7890
endif()
7991

8092
# find required libraries
81-
find_package(CFITSIO REQUIRED)
8293
find_package(Threads REQUIRED)
8394

84-
set(PHYPP_INCLUDE_DIRS ${PHYPP_INCLUDE_DIRS} ${CFITSIO_INCLUDES})
85-
set(PHYPP_LIBRARIES ${PHYPP_LIBRARIES} ${CFITSIO_LIBRARIES})
86-
set(PHYPP_LIBRARIES ${PHYPP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
95+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
8796

8897
# find optional libraries
98+
if (NOT NO_CFITSIO)
99+
find_package(CFITSIO)
100+
endif()
89101
if (NOT NO_LIBUNWIND)
90102
find_package(LibUnwind)
91103
endif()
@@ -109,71 +121,82 @@ if(NOT PHYPP_FOUND)
109121
find_package(WCSLib)
110122
endif()
111123

112-
# handle conditional reflection support
124+
# Handle conditional reflection support
113125
# WIP: just disabled for now
114126
set(NO_REFLECTION 1)
115127
add_definitions(-DNO_REFLECTION)
116128

117-
# handle conditional LAPACK support
129+
# Handle conditional CFITSIO support
130+
if (NOT CFITSIO_FOUND OR NO_CFITSIO)
131+
add_definitions(-DNO_CFITSIO)
132+
else()
133+
set(VIF_INCLUDE_DIRS ${VIF_INCLUDE_DIRS} ${CFITSIO_INCLUDES})
134+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${CFITSIO_LIBRARIES})
135+
endif()
136+
137+
# Handle conditional LAPACK support
118138
if (NOT LAPACK_FOUND OR NO_LAPACK)
119139
add_definitions(-DNO_LAPACK)
120140
else()
121-
set(PHYPP_LIBRARIES ${PHYPP_LIBRARIES} ${LAPACK_LIBRARIES})
141+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${LAPACK_LIBRARIES})
122142
endif()
123143

124-
# handle conditional GSL support
144+
# Handle conditional GSL support
125145
if (NOT GSL_FOUND OR NO_GSL OR NO_LAPACK OR NOT LAPACK_FOUND)
126146
add_definitions(-DNO_GSL)
127147
else()
128-
set(PHYPP_INCLUDE_DIRS ${PHYPP_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS})
129-
set(PHYPP_LIBRARIES ${PHYPP_LIBRARIES} ${GSL_LIBRARIES})
148+
set(VIF_INCLUDE_DIRS ${VIF_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS})
149+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${GSL_LIBRARIES})
130150
endif()
131151

132-
# handle conditional WCSLib support
133-
if (NOT WCSLIB_FOUND OR NO_WCSLIB)
152+
# Handle conditional WCSLib support
153+
if (NOT WCSLIB_FOUND OR NO_WCSLIB OR NO_CFITSIO)
134154
add_definitions(-DNO_WCSLIB)
135155
else()
136-
set(PHYPP_INCLUDE_DIRS ${PHYPP_INCLUDE_DIRS} ${WCSLIB_INCLUDE_DIRS})
137-
set(PHYPP_LIBRARIES ${PHYPP_LIBRARIES} ${WCSLIB_LIBRARIES})
156+
set(VIF_INCLUDE_DIRS ${VIF_INCLUDE_DIRS} ${WCSLIB_INCLUDE_DIRS})
157+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${WCSLIB_LIBRARIES})
138158

139159
if (WCSLIB_VERSION_STRING VERSION_LESS 5.0)
140160
add_definitions(-DWCSLIB_NO_DIS)
141161
endif()
142162
endif()
143163

144-
# handle conditional FFTW support
164+
# Handle conditional FFTW support
145165
if (NOT FFTW_FOUND OR NO_FFTW)
146166
add_definitions(-DNO_FFTW)
147167
else()
148-
set(PHYPP_INCLUDE_DIRS ${PHYPP_INCLUDE_DIRS} ${FFTW_INCLUDES})
149-
set(PHYPP_LIBRARIES ${PHYPP_LIBRARIES} ${FFTW_LIBRARIES})
168+
set(VIF_INCLUDE_DIRS ${VIF_INCLUDE_DIRS} ${FFTW_INCLUDES})
169+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${FFTW_LIBRARIES})
150170
endif()
151171

152-
# handle conditional LibUnwind support
172+
# Handle conditional LibUnwind support
153173
if (NOT LIBUNWIND_FOUND OR NO_LIBUNWIND)
154174
set(NO_UNWIND 1)
155175
add_definitions(-DNO_LIBUNWIND)
156176
else()
157177
set(NO_UNWIND 0)
158-
set(PHYPP_INCLUDE_DIRS ${PHYPP_INCLUDE_DIRS} ${LIBUNWIND_INCLUDE_DIR})
159-
set(PHYPP_LIBRARIES ${PHYPP_LIBRARIES} ${LIBUNWIND_LIBRARIES})
178+
set(VIF_INCLUDE_DIRS ${VIF_INCLUDE_DIRS} ${LIBUNWIND_INCLUDE_DIR})
179+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${LIBUNWIND_LIBRARIES})
160180
endif()
161181

162-
# handle conditional LibDwarf support
182+
# Handle conditional LibDwarf support
163183
if (NO_UNWIND OR NOT LIBELF_FOUND OR NOT LIBDWARF_FOUND OR NO_LIBDWARF)
164184
add_definitions(-DNO_LIBDWARF)
165185
else()
166-
set(PHYPP_INCLUDE_DIRS ${PHYPP_INCLUDE_DIRS} ${LIBDWARF_INCLUDE_DIRS})
167-
set(PHYPP_LIBRARIES ${PHYPP_LIBRARIES} ${LIBDWARF_LIBRARIES} ${LIBELF_LIBRARIES})
186+
set(VIF_INCLUDE_DIRS ${VIF_INCLUDE_DIRS} ${LIBDWARF_INCLUDE_DIRS})
187+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${LIBDWARF_LIBRARIES} ${LIBELF_LIBRARIES})
168188
endif()
169189

170-
# handle conditional Google perftools support
190+
# Handle conditional Google perftools support
171191
if (TCMALLOC_LIBRARY)
172-
set(PHYPP_LIBRARIES ${PHYPP_LIBRARIES} ${TCMALLOC_LIBRARY})
192+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${TCMALLOC_LIBRARY})
193+
endif()
194+
if (PROFILER_LIBRARY)
195+
set(VIF_LIBRARIES ${VIF_LIBRARIES} ${PROFILER_LIBRARY})
173196
endif()
174197
endif()
175198

176-
# Function to compile a phy++ program in CMake
199+
# Function to compile a vif program in CMake
177200
# This feature does not support including/linking other external libraries, as well as
178201
# "#define" commands, and is therefore not very powerful. But it is sufficient for basic
179202
# needs. Supports reflection.
@@ -184,11 +207,11 @@ function(add_phypp_target CPP_FILE_NAME)
184207
# Define the command to generate the binary file
185208
if(CMAKE_BUILD_TYPE MATCHES Debug)
186209
add_custom_command(OUTPUT "${FILE_BASE}-make" VERBATIM COMMAND
187-
${PHYPP_COMPILER} debug "${PROJECT_SOURCE_DIR}/${CPP_FILE_NAME}" -o "${CMAKE_CURRENT_BINARY_DIR}/${FILE_BASE}-make"
210+
${VIF_COMPILER} debug "${PROJECT_SOURCE_DIR}/${CPP_FILE_NAME}" -o "${CMAKE_CURRENT_BINARY_DIR}/${FILE_BASE}-make"
188211
DEPENDS ${PROJECT_SOURCE_DIR}/${CPP_FILE_NAME})
189212
else()
190213
add_custom_command(OUTPUT "${FILE_BASE}-make" VERBATIM COMMAND
191-
${PHYPP_COMPILER} optimize "${PROJECT_SOURCE_DIR}/${CPP_FILE_NAME}" -o "${CMAKE_CURRENT_BINARY_DIR}/${FILE_BASE}-make"
214+
${VIF_COMPILER} optimize "${PROJECT_SOURCE_DIR}/${CPP_FILE_NAME}" -o "${CMAKE_CURRENT_BINARY_DIR}/${FILE_BASE}-make"
192215
DEPENDS ${PROJECT_SOURCE_DIR}/${CPP_FILE_NAME})
193216
endif()
194217

doc/EGG.pdf

4.86 KB
Binary file not shown.

doc/EGG.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
\makeatother
4141

4242

43-
\newcommand{\phypp}{\textit{phy}$_{\text{++}}$\xspace}
43+
\newcommand{\vif}{\texttt{vif}\xspace}
4444
\newcommand{\cpp}[1]{\texttt{#1}\xspace}
4545
\newcommand{\stdvec}{\cppinline|std::vector|\xspace}
4646
\newcommand{\egg}{\textsc{EGG}\xspace}

doc/doc-egg-generic.tex

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ \subsubsection{Rules for ASCII table formatting}
6666

6767
\subsubsection{Column-oriented FITS tables}
6868

69-
For historical reasons tied to IDL, \egg and \phypp (the underlying C++ library) exclusively support column-oriented FITS tables. Although this is a perfectly valid way of doing things (according to the FITS standard), this is not the standard way FITS tables are used in general. It has, however, a number of advantages that I will not describe here (take a look at the \phypp documentation if you are interested). Instead, this section will tell you how you can read and write such kind of FITS tables.
69+
For historical reasons tied to IDL, \egg and \vif (the underlying C++ library) prefer to use column-oriented FITS tables. Although this is a perfectly valid way of doing things (according to the FITS standard), this is not the standard way FITS tables are used in general. It has, however, a number of advantages that I will not describe here (take a look at the \vif documentation if you are interested). Although EGG can deal with both row and column-oriented tables for inputs, it will always write outputs using the column-oriented format. This section will tell you how you can read and write such kind of FITS tables.
7070

71-
{\bf In C++.} Using the \phypp library, reading and writing these tables is natural:
71+
{\bf In C++.} Using the \vif library, reading and writing these tables is natural:
7272
\begin{cppcode}
7373
// First declare the columns you want to read (here: 1D columns of doubles)
7474
vec1d m, z, ra, dec;
@@ -82,7 +82,7 @@ \subsubsection{Column-oriented FITS tables}
8282
// Writing is as simple
8383
fits::write_table("new_file.fits", ftable(m, z, ra, dec));
8484
\end{cppcode}
85-
Only the columns you need are actually read from the file, and the type of the variables you declare in C++ has to match the type of the columns that are found inside the FITS table (conversions will be performed automatically only if they imply no potential loss of data). Diagnostics will be given if this is not the case. See the \phypp documentation for more detail.
85+
Only the columns you need are actually read from the file, and the type of the variables you declare in C++ has to match the type of the columns that are found inside the FITS table (conversions will be performed automatically only if they imply no potential loss of data). Diagnostics will be given if this is not the case. See the \vif documentation for more detail.
8686

8787
{\bf In IDL.} Column-oriented FITS tables can be read using \bashinline{mrdfits}, and written using \bashinline{mwrfits}:
8888
\begin{idlcode}
@@ -97,7 +97,7 @@ \subsubsection{Column-oriented FITS tables}
9797
\end{idlcode}
9898
Be careful not to forget the \idlinline{/create} keyword, else if the file already exists the function will add a new extension to the table to write the data, and this is not what you want.
9999

100-
{\bf In Python.} Column-oriented FITS tables are not well supported by the standard FITS I/O module from \bashinline{astropy} (you \emph{can} use \pythoninline{astropy.io.fits}, but it will be a bit cumbersome). To cope with this situation, I have written a small module that implements this in a user-friendly way; you can download it \href{https://github.com/cschreib/phypp/blob/master/python/pycolfits.py}{[here]}. Usage is as simple as above:
100+
{\bf In Python.} Column-oriented FITS tables are not well supported by the standard FITS I/O module from \bashinline{astropy} (you \emph{can} use \pythoninline{astropy.io.fits}, but it will be a bit cumbersome). To cope with this situation, I have written a small module that implements this in a user-friendly way; you can download it \href{https://github.com/cschreib/vif/blob/master/python/pycolfits.py}{[here]}. Usage is as simple as above:
101101
\begin{pythoncode}
102102
import pycolfits
103103

0 commit comments

Comments
 (0)